GitHub/LineageOS/android_kernel_motorola_exynos9610.git
8 years agodrm/vc4: Use lockless gem BO free callback
Daniel Vetter [Mon, 30 May 2016 17:53:07 +0000 (19:53 +0200)]
drm/vc4: Use lockless gem BO free callback

No dev->struct_mutex anywhere to be seen.

Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-16-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/vc4: Use drm_gem_object_unreference_unlocked
Daniel Vetter [Mon, 30 May 2016 17:53:06 +0000 (19:53 +0200)]
drm/vc4: Use drm_gem_object_unreference_unlocked

Since my last struct_mutex crusade someone escaped!

This already has the advantage that for the common case when someone
else holds a ref the unref won't even acquire dev->struct_mutex. And
I'm working on code to allow drivers to completely opt-out of any and
all dev->struct_mutex usage, but that only works if they use the
_unlocked variants everywhere.

v2: Drop comment too.

v3: Drop the other comment too.

Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-15-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Initialize a linear gamma table by default
Daniel Vetter [Wed, 30 Mar 2016 09:51:16 +0000 (11:51 +0200)]
drm: Initialize a linear gamma table by default

Code stolen from gma500.

This is just a minor bit of safety code that I spotted and figured it
might be useful if we put it into the core. This is to make the
get_gamma ioctl reflect likely reality even before the first set_gamma
ioctl call.

v2 on irc: Extend commit message per Maarten's suggestions.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331485-28376-2-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/vgem: Use lockless gem BO free callback
Daniel Vetter [Mon, 30 May 2016 17:53:08 +0000 (19:53 +0200)]
drm/vgem: Use lockless gem BO free callback

No dev->struct_mutex anywhere to be seen.

Cc: seanpaul@chromium.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-17-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/qxl: Don't set a gamma table size
Daniel Vetter [Wed, 30 Mar 2016 09:51:24 +0000 (11:51 +0200)]
drm/qxl: Don't set a gamma table size

qxl doesn't have any functions for setting the gamma table, so this is
completely defunct.

Not nice to lie to userspace, so let's stop!

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331485-28376-10-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/msm: Nuke dummy gamma_set/get functions
Daniel Vetter [Wed, 30 Mar 2016 09:51:21 +0000 (11:51 +0200)]
drm/msm: Nuke dummy gamma_set/get functions

Again the fbdev emulation gamma_set/get functions are only needed for
drivers that try to also use 8bpp paletted mode. Which msm doesn't, so
this is dead code. Let's rip it out.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331485-28376-7-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/cirrus: Drop redundnant gamma size check
Daniel Vetter [Wed, 30 Mar 2016 09:51:20 +0000 (11:51 +0200)]
drm/cirrus: Drop redundnant gamma size check

The core does this for us already.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331485-28376-6-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/fb-helper: Remove dead code in setcolreg
Daniel Vetter [Wed, 30 Mar 2016 09:51:17 +0000 (11:51 +0200)]
drm/fb-helper: Remove dead code in setcolreg

DRM fbdev emulation only supports pallete_color with depth == 8, and
truecolor with depth > 8. Handling depth == 16 for palettes is hence
dead code, let's remove it.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331485-28376-3-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/mediatek: Use lockless gem BO free callback
Daniel Vetter [Mon, 30 May 2016 17:53:19 +0000 (19:53 +0200)]
drm/mediatek: Use lockless gem BO free callback

No dev->struct_mutex anywhere to be seen.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-28-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/hisilicon: Use lockless gem BO free callback
Daniel Vetter [Mon, 30 May 2016 17:53:18 +0000 (19:53 +0200)]
drm/hisilicon: Use lockless gem BO free callback

No dev->struct_mutex anywhere to be seen.

Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Acked-by: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-27-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/hlcd: Use lockless gem BO free callback
Daniel Vetter [Mon, 30 May 2016 17:53:17 +0000 (19:53 +0200)]
drm/hlcd: Use lockless gem BO free callback

No dev->struct_mutex anywhere to be seen.

Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-26-git-send-email-daniel.vetter@ffwll.ch
8 years agovga_switcheroo: Support deferred probing of audio clients
Lukas Wunner [Tue, 31 May 2016 09:13:27 +0000 (11:13 +0200)]
vga_switcheroo: Support deferred probing of audio clients

Daniel Vetter pointed out that vga_switcheroo_client_probe_defer() could
be needed by audio clients as well. To avoid mistakes when someone adds
conditions for these in the future, constrain the single existing
condition to VGA clients by checking for PCI_BASE_CLASS_DISPLAY. This
encompasses both PCI_CLASS_DISPLAY_VGA as well as PCI_CLASS_DISPLAY_3D,
which is used by some Nvidia Optimus GPUs.

Any future checks for audio clients should then be constrained to
PCI_BASE_CLASS_MULTIMEDIA.

v6: Spun out from commit introducing vga_switcheroo_client_probe_defer()
    to keep it a pure refactoring change. (Emil Velikov, Jani Nikula)

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/358d58490eb9dda5f270d844b0dce511a2a20828.1464685538.git.lukas@wunner.de
8 years agovga_switcheroo: Add helper for deferred probing
Lukas Wunner [Tue, 31 May 2016 09:13:27 +0000 (11:13 +0200)]
vga_switcheroo: Add helper for deferred probing

So far we've got one condition when DRM drivers need to defer probing
on a dual GPU system and it's coded separately into each of the relevant
drivers. As suggested by Daniel Vetter, deduplicate that code in the
drivers and move it to a new vga_switcheroo helper. This yields better
encapsulation of concepts and lets us add further checks in a central
place. (The existing check pertains to pre-retina MacBook Pros and an
additional check is expected to be needed for retinas.)

One might be tempted to check deferred probing conditions in
vga_switcheroo_register_client(), but this is usually called fairly late
during driver load. The GPU is fully brought up and ready for switching
at that point. On boot the ->probe hook is potentially called dozens of
times until it finally succeeds, and each time we'd repeat bringup and
teardown of the GPU, lengthening boot time considerably and cluttering
logfiles. A separate helper is therefore needed which can be called
right at the beginning of the ->probe hook.

Note that amdgpu currently does not call this helper as the AMD GPUs
built into MacBook Pros are only supported by radeon so far.

v2: This helper could eventually be used by audio clients as well,
    so rephrase kerneldoc to refer to "client" instead of "GPU"
    and move the single existing check in an if block specific
    to PCI_CLASS_DISPLAY_VGA devices. Move documentation on
    that check from kerneldoc to a comment. (Daniel Vetter)

v3: Mandate in kerneldoc that registration of client shall only
    happen after calling this helper. (Daniel Vetter)

v4: Rebase on 412c8f7de011 ("drm/radeon: Return -EPROBE_DEFER when
    amdkfd not loaded")

v5: Some Optimus GPUs use PCI_CLASS_DISPLAY_3D, make sure those are
    matched as well. (Emil Velikov)

v6: The if-condition referring to PCI_BASE_CLASS_DISPLAY may be
    considered a functional change. Move to a separate commit to
    keep this a pure refactoring change. (Emil Velikov, Jani Nikula)

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/575885fd440c2b13c3f19ddf44360cfbbff35f50.1464685538.git.lukas@wunner.de
8 years agovirtio-gpu: fix output lookup
Gerd Hoffmann [Mon, 30 May 2016 12:03:26 +0000 (14:03 +0200)]
virtio-gpu: fix output lookup

Needed for multihead setups where we can have disabled
outputs and therefore plane->crtc can be NULL.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464609806-22013-1-git-send-email-kraxel@redhat.com
8 years agodrm/doc: Unify KMS Locking docs
Daniel Vetter [Mon, 30 May 2016 09:10:49 +0000 (11:10 +0200)]
drm/doc: Unify KMS Locking docs

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Acked-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464599449-12509-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled
Liu Ying [Fri, 27 May 2016 09:35:54 +0000 (17:35 +0800)]
drm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled

When a CRTC is going to be disabled, it's state may contain a display mode
with zeroed content.  This could be reproduced by HDMI cable hotplug out
operation with legacy fbdev support in dual display cases.  It would confuse
driver's CRTC callback ->mode_fixup and make the total state be rejected.
So, let's don't call the callback for the CRTC.

Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464341754-7087-1-git-send-email-gnuiyl@gmail.com
8 years agoFix annoyingly awkward typo in drm_edid_load.c
Valdis Kletnieks [Mon, 30 May 2016 06:26:38 +0000 (02:26 -0400)]
Fix annoyingly awkward typo in drm_edid_load.c

Fix egregious typo in comment.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/10576.1464589598@turing-police.cc.vt.edu
8 years agodrm/doc: Drop vblank_disable_allow wording
Daniel Vetter [Tue, 24 May 2016 12:45:15 +0000 (14:45 +0200)]
drm/doc: Drop vblank_disable_allow wording

Forgot to update the docs when nuking that. Oops.

Fixes: fcee59065e58 ("drm: Nuke ->vblank_disable_allowed")
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464093915-3935-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: use seqlock for vblank time/count
Matthew Auld [Tue, 10 May 2016 14:21:28 +0000 (15:21 +0100)]
drm: use seqlock for vblank time/count

This patch aims to replace the roll-your-own seqlock implementation with
full-blown seqlock'. We also remove the timestamp ring-buffer in favour
of single timestamp/count pair protected by a seqlock. In turn this
means we can now increment the vblank freely without the need for
clamping.

v2:
  - reduce the scope of the seqlock, keeping vblank_time_lock
  - make the seqlock per vblank_crtc, so multiple readers aren't blocked by
    the writer

Cc: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462890088-18194-1-git-send-email-matthew.auld@intel.com
8 years agodrm/mm: avoid possible null pointer dereference
Heinrich Schuchardt [Wed, 18 May 2016 20:17:19 +0000 (22:17 +0200)]
drm/mm: avoid possible null pointer dereference

Do not dereference node before the check if node is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463602639-4861-1-git-send-email-xypron.glpk@gmx.de
8 years agoMAINTAINERS: Add file patterns for drm device tree bindings
Geert Uytterhoeven [Sun, 22 May 2016 09:05:53 +0000 (11:05 +0200)]
MAINTAINERS: Add file patterns for drm device tree bindings

Submitters of device tree binding documentation may forget to CC
the subsystem maintainer if this is missing.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463907991-7916-17-git-send-email-geert@linux-m68k.org
8 years agodrm/edid: add displayid detailed 1 timings to the modelist. (v1.1)
Dave Airlie [Sun, 1 May 2016 22:35:05 +0000 (08:35 +1000)]
drm/edid: add displayid detailed 1 timings to the modelist. (v1.1)

The tiled 5K Dell monitor appears to be hiding it's tiled mode
inside the displayid timings block, this patch parses this
blocks and adds the modes to the modelist.

v1.1: add missing __packed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95207
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/edid: move displayid validation to it's own function.
Dave Airlie [Tue, 3 May 2016 05:38:37 +0000 (15:38 +1000)]
drm/edid: move displayid validation to it's own function.

We need to use this for validating modeline additions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/displayid: Iterate over all DisplayID blocks
Tomas Bzatek [Sun, 1 May 2016 13:02:45 +0000 (15:02 +0200)]
drm/displayid: Iterate over all DisplayID blocks

This will iterate over all DisplayID blocks found in the buffer.
Previously only the first block was parsed.

https://bugs.freedesktop.org/show_bug.cgi?id=95207

Signed-off-by: Tomas Bzatek <tomas@bzatek.net>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/edid: move displayid tiled block parsing into separate function.
Dave Airlie [Tue, 3 May 2016 05:31:12 +0000 (15:31 +1000)]
drm/edid: move displayid tiled block parsing into separate function.

This just makes the code easier to follow.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: Nuke ->vblank_disable_allowed
Daniel Vetter [Wed, 18 May 2016 19:47:38 +0000 (21:47 +0200)]
drm: Nuke ->vblank_disable_allowed

This was added in

commit 0a3e67a4caac273a3bfc4ced3da364830b1ab241
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Sep 30 12:14:26 2008 -0700

    drm: Rework vblank-wait handling to allow interrupt reduction.

to stay backwards-compatible with old UMS code that didn't even tell
the kernel when it did a modeset, so that the kernel could
save/restore vblank counters. At worst this means vblanks will be
somewhat funky on a setup that very likely no one still runs.

So let's just nuke it.

Plan B would be to set it unconditionally in drm_vblank_init for kms
drivers, instead of in each driver separately. So if this patch breaks
anything please only restore the hunks in drmP.h and drm_irq.c, plus
add a check for DRIVER_MODESET in drm_vblank_init.

Stumbled over this in a discussion on irc with Chris.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoMerge tag 'vmwgfx-next-160520' of git://people.freedesktop.org/~thomash/linux into...
Dave Airlie [Fri, 20 May 2016 20:41:59 +0000 (06:41 +1000)]
Merge tag 'vmwgfx-next-160520' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request of 2016-05-20

* tag 'vmwgfx-next-160520' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Report vmwgfx version to vmware.log
  drm/vmwgfx: Add VMWare host messaging capability
  drm/vmwgfx: Kill some lockdep warnings

8 years agoMerge branch 'linux-4.7' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Fri, 20 May 2016 20:12:13 +0000 (06:12 +1000)]
Merge branch 'linux-4.7' of git://github.com/skeggsb/linux into drm-next

Nothing too exciting here, there's a larger chunk of work that still
needs more testing but not likely to get that done today - so - here's
the rest of it.  Assuming nothing else goes horribly wrong, I should be
able to send the rest Monday if it isn't too late....

Changes:
- Improvements to power sensor support
- Initial attempt at GM108 support
- Minor fixes to GR init + ucode
- Make use of topology information (provided by the GPU) in various
places, should at least fix some fault recovery issues and
engine/runlist mapping confusion on newer GPUs.

* 'linux-4.7' of git://github.com/skeggsb/linux: (51 commits)
  drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
  drm/nouveau/core: recognise GM108 chipsets
  drm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup
  drm/nouveau/gr/gk104-: share implementation of ppc exception init
  drm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx
  drm/nouveau/bios/pll: check BIT table version before trying to parse it
  drm/nouveau/bios/pll: prevent oops when limits table can't be parsed
  drm/nouveau/volt/gk104: round up in gk104_volt_set
  drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
  drm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()
  drm/nouveau/fb/gf100-: allocate mmu debug buffers
  drm/nouveau/fb: allow chipset-specific actions for oneinit()
  drm/nouveau/gr/gm200-: fix bad hardcoding of a max-tpcs-per-gpc value
  drm/nouveau/gr/gm200-: rop count == ltc count
  drm/nouveau/gr/gm200: modify the mask when copying mmu settings from fb
  drm/nouveau/gr/gm200: move some code into init_gpc_mmu() hook
  drm/nouveau/gr/gm200: make generate_main() static
  drm/nouveau/gr/gf100-: abstract fetching rop count
  drm/nouveau/gr/gf100-: rename magic_not_rop_nr to screen_tile_row_offset
  drm/nouveau/gr/gf100-: remove hardcoded idle_timeout values
  ...

8 years agodrm/vmwgfx: Report vmwgfx version to vmware.log
Sinclair Yeh [Thu, 28 Apr 2016 02:11:18 +0000 (19:11 -0700)]
drm/vmwgfx: Report vmwgfx version to vmware.log

When tracking down a customer issue, it is useful to know exactly
which version of the vmwgfx they are using.  Since vmware.log is
often the only available debug log, report vmwgfx version in there.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agodrm/vmwgfx: Add VMWare host messaging capability
Sinclair Yeh [Thu, 28 Apr 2016 02:10:19 +0000 (19:10 -0700)]
drm/vmwgfx: Add VMWare host messaging capability

This patch adds capabilities for a VMWare guest to send and
receive messages from the host, and adds functions to sending log
messages to vmware.log and to request device settings that aren't
available through the virtual hardware, e.g. certain settings in
the VMX file.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agodrm/vmwgfx: Kill some lockdep warnings
Thomas Hellstrom [Tue, 3 May 2016 09:24:35 +0000 (11:24 +0200)]
drm/vmwgfx: Kill some lockdep warnings

Some global KMS state that is elsewhere protected by the mode_config
mutex here needs to be protected with a local mutex. Remove corresponding
lockdep checks and introduce a new driver-private global_kms_state_mutex,
and make sure its locking order is *after* the crtc locks in order to
avoid having to release those when the new mutex is taken.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Cc: <stable@vger.kernel.org> # 4.6
8 years agodrm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
Ben Skeggs [Thu, 19 May 2016 23:04:41 +0000 (09:04 +1000)]
drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode

This is a simplied version of the fix by Roy in fdo#93629.  While this
doesn't appear to fix the issues for the users in that report, it's a
real issue that deserves to be resolved.

Reported-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: recognise GM108 chipsets
Ben Skeggs [Thu, 21 Apr 2016 00:35:38 +0000 (10:35 +1000)]
drm/nouveau/core: recognise GM108 chipsets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup
Ben Skeggs [Thu, 21 Apr 2016 00:28:55 +0000 (10:28 +1000)]
drm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup

Also removes an XXX; according to nvgpu headers the field is called
NV_PGRAPH_GPCS_SWDX_TC_BETA_CB_SIZE_DIV3, so, apparently not some
magic we need to figure out :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gk104-: share implementation of ppc exception init
Ben Skeggs [Thu, 21 Apr 2016 00:23:10 +0000 (10:23 +1000)]
drm/nouveau/gr/gk104-: share implementation of ppc exception init

This was really inconsistent, some implementations could touch PPCs
that didn't exist, others neglected to touch ones that did.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx
Ben Skeggs [Tue, 19 Apr 2016 01:10:38 +0000 (11:10 +1000)]
drm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx

Matches newer RM.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios/pll: check BIT table version before trying to parse it
Ben Skeggs [Tue, 19 Apr 2016 00:28:44 +0000 (10:28 +1000)]
drm/nouveau/bios/pll: check BIT table version before trying to parse it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios/pll: prevent oops when limits table can't be parsed
Ben Skeggs [Tue, 19 Apr 2016 00:07:04 +0000 (10:07 +1000)]
drm/nouveau/bios/pll: prevent oops when limits table can't be parsed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/volt/gk104: round up in gk104_volt_set
Karol Herbst [Sat, 16 Apr 2016 18:01:59 +0000 (20:01 +0200)]
drm/nouveau/volt/gk104: round up in gk104_volt_set

We always want a equal or higher voltage than the requested ones, otherwise
nouveau undervolts.

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
Ben Skeggs [Thu, 14 Apr 2016 01:14:33 +0000 (11:14 +1000)]
drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()
Ben Skeggs [Thu, 14 Apr 2016 00:50:55 +0000 (10:50 +1000)]
drm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fb/gf100-: allocate mmu debug buffers
Ben Skeggs [Thu, 14 Apr 2016 00:39:18 +0000 (10:39 +1000)]
drm/nouveau/fb/gf100-: allocate mmu debug buffers

Later chipsets require setting this up both in FB and GR, so let's just
move the allocation to FB.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fb: allow chipset-specific actions for oneinit()
Ben Skeggs [Thu, 14 Apr 2016 00:38:55 +0000 (10:38 +1000)]
drm/nouveau/fb: allow chipset-specific actions for oneinit()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200-: fix bad hardcoding of a max-tpcs-per-gpc value
Ben Skeggs [Thu, 14 Apr 2016 05:36:16 +0000 (15:36 +1000)]
drm/nouveau/gr/gm200-: fix bad hardcoding of a max-tpcs-per-gpc value

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200-: rop count == ltc count
Ben Skeggs [Thu, 14 Apr 2016 04:28:03 +0000 (14:28 +1000)]
drm/nouveau/gr/gm200-: rop count == ltc count

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: modify the mask when copying mmu settings from fb
Ben Skeggs [Thu, 14 Apr 2016 04:41:52 +0000 (14:41 +1000)]
drm/nouveau/gr/gm200: modify the mask when copying mmu settings from fb

Appears to more closely match what RM does.

For GM20B, now also copying bit 12 from NV_PFB_MMU_CTRL as upcoming
changes will require it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: move some code into init_gpc_mmu() hook
Ben Skeggs [Thu, 14 Apr 2016 01:19:54 +0000 (11:19 +1000)]
drm/nouveau/gr/gm200: move some code into init_gpc_mmu() hook

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: make generate_main() static
Ben Skeggs [Thu, 14 Apr 2016 02:58:29 +0000 (12:58 +1000)]
drm/nouveau/gr/gm200: make generate_main() static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100-: abstract fetching rop count
Ben Skeggs [Thu, 14 Apr 2016 04:26:18 +0000 (14:26 +1000)]
drm/nouveau/gr/gf100-: abstract fetching rop count

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100-: rename magic_not_rop_nr to screen_tile_row_offset
Ben Skeggs [Thu, 14 Apr 2016 04:08:25 +0000 (14:08 +1000)]
drm/nouveau/gr/gf100-: rename magic_not_rop_nr to screen_tile_row_offset

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100-: remove hardcoded idle_timeout values
Ben Skeggs [Thu, 14 Apr 2016 02:57:01 +0000 (12:57 +1000)]
drm/nouveau/gr/gf100-: remove hardcoded idle_timeout values

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gm107-: remove engines from mmu engine mapping array
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gm107-: remove engines from mmu engine mapping array

These are specified by PTOP on Maxwell GPUs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104-: identify mmu engine ids for host faults
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gk104-: identify mmu engine ids for host faults

It appears these don't map to PBDMAs (at least on Kepler, it may or may
be valid for Fermi - this hasn't been checked), but to runlists.

This drops the NVKM_ENGINE_FIFO data from the entries too, as resetting
all of PFIFO is *not* the way to handle such faults.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104-: implement support for PTOP fault info
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gk104-: implement support for PTOP fault info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104-: abstract mmu fault data structures
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gk104-: abstract mmu fault data structures

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104-: subclass func
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gk104-: subclass func

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104-: use device info from top subdev
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/fifo/gk104-: use device info from top subdev

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: remove pmc_enable argument from subdev ctor
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/core: remove pmc_enable argument from subdev ctor

These are now specified directly in the MC subdev.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/nv04: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/nv04: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/nv11: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/nv11: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/nv17: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/nv17: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/nv50: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/nv50: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/g84: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/g84: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/g98: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/g98: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/gt215: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/gt215: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/gf100: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/gf100: define reset masks + intr cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc/gk104: define reset masks + intr cleanup
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc/gk104: define reset masks + intr cleanup

Engine fields have been removed, as they're specified by PTOP.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc: implement support for PTOP interrupt routing
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc: implement support for PTOP interrupt routing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc: implement support for PTOP reset info
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc: implement support for PTOP reset info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc: allow for local definition of reset bits
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc: allow for local definition of reset bits

With the addition of PTOP-specified reset bits, it makes more sense to
move the definitions here rather than in individual subdev
implementations.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc: add helper function to handle device reset
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc: add helper function to handle device reset

This will be later extended to handle PTOP-specified reset masks as well
as the hardcoded ones.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/mc: rename struct nvkm_mc_intr to nvkm_mc_map
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/mc: rename struct nvkm_mc_intr to nvkm_mc_map

This will also be used to define NV_PMC_ENABLE <-> subdev mappings in an
upcoming commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/top/gk104: initial implementation
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/top/gk104: initial implementation

Ported from the code currently in engine/fifo/gk104.c.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/top: initial implementation
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/top: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add top plumbing
Ben Skeggs [Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)]
drm/nouveau/core: add top plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/iccsense: configure sensors like nvidia does
Karol Herbst [Mon, 28 Mar 2016 12:24:32 +0000 (14:24 +0200)]
drm/nouveau/iccsense: configure sensors like nvidia does

v2: rename ina209/ina219 read function

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/iccsense: split sensor into own struct
Karol Herbst [Mon, 28 Mar 2016 12:24:31 +0000 (14:24 +0200)]
drm/nouveau/iccsense: split sensor into own struct

v2: add list_del call, reword error message

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/iccsense: convert to linked list
Karol Herbst [Mon, 28 Mar 2016 12:24:30 +0000 (14:24 +0200)]
drm/nouveau/iccsense: convert to linked list

v2: add list_del calls

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/iccsense: remove read function
Karol Herbst [Mon, 28 Mar 2016 12:24:29 +0000 (14:24 +0200)]
drm/nouveau/iccsense: remove read function

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/pmu: be more strict about locking
Karol Herbst [Mon, 11 Jan 2016 01:58:03 +0000 (02:58 +0100)]
drm/nouveau/pmu: be more strict about locking

When we start communicating with the pmu a bit more, the current code is
a real issue. I encountered a dead lock here, while testing my dynamic
reclocking code

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/devinit/gf100: make devinit on resume safer
Alexandre Courbot [Fri, 1 Apr 2016 06:40:59 +0000 (15:40 +0900)]
drm/nouveau/devinit/gf100: make devinit on resume safer

In case of successful suspend, devinit will have to be run and this is
the behavior currently hardcoded. However, as FD bug 94725 suggests,
there might be cases where runtime suspend leaves the GPU powered, and
in such cases devinit should not be run on resume.

On GF100+ we have a reliable way to know whether we need to run devinit.
Use it instead of blindly trusting the flag set by nvkm_devinit_fini().

The code around the NvForcePost also needs to be slightly reworked in
order to keep working.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Suggested-by: Dave Airlie <airlied@redhat.com>
Suggested-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau: rename nouveau_drm.h to nouveau_drv.h
Ben Skeggs [Thu, 19 May 2016 23:22:55 +0000 (09:22 +1000)]
drm/nouveau: rename nouveau_drm.h to nouveau_drv.h

Fixes out-of-tree build issue where uapi/drm/nouveau_drm.h gets picked
up instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agoMerge tag 'topic/drm-misc-2016-05-18' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Wed, 18 May 2016 20:48:29 +0000 (06:48 +1000)]
Merge tag 'topic/drm-misc-2016-05-18' of git://anongit.freedesktop.org/drm-intel into drm-next

Update drm-misc pull with a few more fixes included, plus the two from
Arnd for the fallout from the drm_gem_object_lookup() refactor that I
failed to spot :(

* tag 'topic/drm-misc-2016-05-18' of git://anongit.freedesktop.org/drm-intel:
  drm: remove unused dev variables
  drm: mediatek: fixup drm_gem_object_lookup API change
  drm/tegra: Fix crash caused by reference count imbalance
  drm: Fix error handling in drm_connector_register
  drm: Avoid connector reference imbalance on error path
  drm/fb_helper: Fix references to dev->mode_config.num_connector
  drm/i915/fbdev: Fix num_connector references in intel_fb_initial_config()
  qxl: catch qxlfb_create_pinned_object failures
  drm/exynos/hdmi: add a missing tab
  drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
  drm/fb-cma-helper: Use const for drm_framebuffer_funcs argument
  drm: Drop connector argument from __drm_atomic_helper_connector_destroy_state
  drm: Drop plane argument from __drm_atomic_helper_plane_destroy_state
  drm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_state
  drm: Remove unused drm_device from drm_gem_object_lookup()

8 years agodrm: remove unused dev variables
Arnd Bergmann [Wed, 18 May 2016 16:07:33 +0000 (18:07 +0200)]
drm: remove unused dev variables

After drm_gem_object_lookup() was changed along with all its callers,
we have several drivers that have unused variables:

drm/armada/armada_crtc.c: In function 'armada_drm_crtc_cursor_set':
drm/armada/armada_crtc.c:900:21: error: unused variable 'dev' [-Werror=unused-variable]
drm/nouveau/nouveau_gem.c: In function 'validate_init':
drm/nouveau/nouveau_gem.c:371:21: error: unused variable 'dev' [-Werror=unused-variable]
drm/nouveau/nv50_display.c: In function 'nv50_crtc_cursor_set':
drm/nouveau/nv50_display.c:1308:21: error: unused variable 'dev' [-Werror=unused-variable]
drm/radeon/radeon_cs.c: In function 'radeon_cs_parser_relocs':
drm/radeon/radeon_cs.c:77:21: error: unused variable 'ddev' [-Werror=unused-variable]

This fixes all the instances I found with ARM randconfig builds so far.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a8ad0bd84f98 ("drm: Remove unused drm_device from drm_gem_object_lookup()")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463587653-3035181-6-git-send-email-arnd@arndb.de
8 years agodrm: mediatek: fixup drm_gem_object_lookup API change
Arnd Bergmann [Wed, 18 May 2016 16:07:31 +0000 (18:07 +0200)]
drm: mediatek: fixup drm_gem_object_lookup API change

The drm_gem_object_lookup() function prototype changed while this
driver was added, so it fails to build now:

drivers/gpu/drm/mediatek/mtk_drm_gem.c: In function 'mtk_drm_gem_dumb_map_offset':
drivers/gpu/drm/mediatek/mtk_drm_gem.c:142:30: error: passing argument 1 of 'drm_gem_object_lookup' from incompatible pointer type [-Werror=incompatible-pointer-types]
  obj = drm_gem_object_lookup(dev, file_priv, handle);

This fixes the new caller as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a8ad0bd84f98 ("drm: Remove unused drm_device from drm_gem_object_lookup()")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463587653-3035181-4-git-send-email-arnd@arndb.de
8 years agodrm/tegra: Fix crash caused by reference count imbalance
Jon Hunter [Wed, 18 May 2016 15:37:36 +0000 (16:37 +0100)]
drm/tegra: Fix crash caused by reference count imbalance

Commit d2307dea14a4 ("drm/atomic: use connector references (v3)") added
reference counting for DRM connectors and this caused a crash when
exercising system suspend on Tegra114 Dalmore.

The Tegra DSI driver implements a Tegra specific function,
tegra_dsi_connector_duplicate_state(), to duplicate the connector state
and destroys the state using the generic helper function,
drm_atomic_helper_connector_destroy_state(). Following commit
d2307dea14a4 ("drm/atomic: use connector references (v3)") there is
now an imbalance in the connector reference count because the Tegra
function to duplicate state does not take a reference when duplicating
the state information. However, the generic helper function to destroy
the state information assumes a reference has been taken and during
system suspend, when the connector state is destroyed, this leads to a
crash because we attempt to put the reference for an object that has
already been freed.

Fix this by calling __drm_atomic_helper_connector_duplicate_state() from
tegra_dsi_connector_duplicate_state() to ensure that we take a reference
on a connector if crtc is set. Note that this will also copy the
connector state a 2nd time, but this should be harmless.

By fixing tegra_dsi_connector_duplicate_state() to take a reference,
although a crash was no longer seen, it was then observed that after
each system suspend-resume cycle, the reference would be one greater
than before the suspend-resume cycle. Following commit d2307dea14a4
("drm/atomic: use connector references (v3)"), it was found that we
also need to put the reference when calling the function
tegra_dsi_connector_reset() before freeing the state. Fix this by
updating tegra_dsi_connector_reset() to call the function
__drm_atomic_helper_connector_destroy_state() in order to put the
reference for the connector.

Fixes: d2307dea14a4 ("drm/atomic: use connector references (v3)")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463585856-16606-1-git-send-email-jonathanh@nvidia.com
8 years agodrm: Fix error handling in drm_connector_register
Daniel Vetter [Fri, 6 May 2016 12:55:02 +0000 (14:55 +0200)]
drm: Fix error handling in drm_connector_register

When debugfs or sysfs registration failed, we failed to clean up the
idr registration. Reorder to fix this.

Cc: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462539302-27764-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Avoid connector reference imbalance on error path
Chris Wilson [Fri, 6 May 2016 11:47:45 +0000 (12:47 +0100)]
drm: Avoid connector reference imbalance on error path

Whilst looking at the fallout from using connector references for
atomic, I noticed that there is an early return buried in
drm_atomic_set_crtc_for_connector() that if hit could cause us to leak a
reference on the connector.

Fixes: d2307dea14 (drm/atomic: use connector references (v3))
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462535265-13058-1-git-send-email-chris@chris-wilson.co.uk
8 years agodrm/fb_helper: Fix references to dev->mode_config.num_connector
Lyude [Thu, 12 May 2016 14:56:59 +0000 (10:56 -0400)]
drm/fb_helper: Fix references to dev->mode_config.num_connector

During boot, MST hotplugs are generally expected (even if no physical
hotplugging occurs) and result in DRM's connector topology changing.
This means that using num_connector from the current mode configuration
can lead to the number of connectors changing under us. This can lead to
some nasty scenarios in fbcon:

- We allocate an array to the size of dev->mode_config.num_connectors.
- MST hotplug occurs, dev->mode_config.num_connectors gets incremented.
- We try to loop through each element in the array using the new value
  of dev->mode_config.num_connectors, and end up going out of bounds
  since dev->mode_config.num_connectors is now larger then the array we
  allocated.

fb_helper->connector_count however, will always remain consistent while
we do a modeset in fb_helper.

Note: This is just polish for 4.7, Dave Airlie's drm_connector
refcounting fixed these bugs for real. But it's good enough duct-tape
for stable kernel backporting, since backporting the refcounting
changes is way too invasive.

Cc: stable@vger.kernel.org
Signed-off-by: Lyude <cpaul@redhat.com>
[danvet: Clarify why we need this. Also remove the now unused "dev"
local variable to appease gcc.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463065021-18280-3-git-send-email-cpaul@redhat.com
8 years agodrm/i915/fbdev: Fix num_connector references in intel_fb_initial_config()
Lyude [Thu, 12 May 2016 14:56:58 +0000 (10:56 -0400)]
drm/i915/fbdev: Fix num_connector references in intel_fb_initial_config()

During boot time, MST devices usually send a ton of hotplug events
irregardless of whether or not any physical hotplugs actually occurred.
Hotplugs mean connectors being created/destroyed, and the number of DRM
connectors changing under us. This isn't a problem if we use
fb_helper->connector_count since we only set it once in the code,
however if we use num_connector from struct drm_mode_config we risk it's
value changing under us. On top of that, there's even a chance that
dev->mode_config.num_connector != fb_helper->connector_count. If the
number of connectors happens to increase under us, we'll end up using
the wrong array size for memcpy and start writing beyond the actual
length of the array, occasionally resulting in kernel panics.

Note: This is just polish for 4.7, Dave Airlie's drm_connector
refcounting fixed these bugs for real. But it's good enough duct-tape
for stable kernel backporting, since backporting the refcounting
changes is way too invasive.

Cc: stable@vger.kernel.org
Signed-off-by: Lyude <cpaul@redhat.com>
[danvet: Clarify why we need this.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463065021-18280-2-git-send-email-cpaul@redhat.com
8 years agoqxl: catch qxlfb_create_pinned_object failures
Gerd Hoffmann [Thu, 12 May 2016 17:06:56 +0000 (19:06 +0200)]
qxl: catch qxlfb_create_pinned_object failures

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463072816-11788-1-git-send-email-kraxel@redhat.com
8 years agodrm/exynos/hdmi: add a missing tab
Dan Carpenter [Thu, 12 May 2016 19:54:57 +0000 (22:54 +0300)]
drm/exynos/hdmi: add a missing tab

Smatch warns that the if statement isn't indented.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160512195457.GA19095@mwanda
8 years agodrm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
Noralf Trønnes [Thu, 12 May 2016 18:25:22 +0000 (20:25 +0200)]
drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()

Add drm_fb_cma_create_with_funcs() for drivers that need to set the
dirty() callback.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463077523-23959-3-git-send-email-noralf@tronnes.org
8 years agodrm/fb-cma-helper: Use const for drm_framebuffer_funcs argument
Noralf Trønnes [Thu, 12 May 2016 18:25:21 +0000 (20:25 +0200)]
drm/fb-cma-helper: Use const for drm_framebuffer_funcs argument

drm_framebuffer_init() uses const for the drm_framebuffer_funcs
argument so use that on drm_fb_cma_alloc() and
drm_fbdev_cma_create_with_funcs() as well.

Cc: laurent.pinchart@ideasonboard.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463077523-23959-2-git-send-email-noralf@tronnes.org
8 years agodrm: Drop connector argument from __drm_atomic_helper_connector_destroy_state
Daniel Vetter [Mon, 9 May 2016 14:34:11 +0000 (16:34 +0200)]
drm: Drop connector argument from __drm_atomic_helper_connector_destroy_state

It's unused, and really this helper should only look at the state
structure and nothing else. Note that this conflicts with a patch from
Dave that adds refcounting to drm_connectors. It's not yet clear
whether the check Dave adds for connector != NULL is really needed or
the right check.

v2: Fix commmit message (Laurent).

Cc: Dave Airlie <airlied@gmail.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-3-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Drop plane argument from __drm_atomic_helper_plane_destroy_state
Daniel Vetter [Mon, 9 May 2016 14:34:10 +0000 (16:34 +0200)]
drm: Drop plane argument from __drm_atomic_helper_plane_destroy_state

It's unused, and really this helper should only look at the state
structure and nothing else.

v2: Fix commit message (Laurent).

v3: Rebase onto mtk driver merge.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-2-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_state
Daniel Vetter [Mon, 9 May 2016 14:34:09 +0000 (16:34 +0200)]
drm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_state

It's unused, and really this helper should only look at the state
structure and nothing else.

v2: Rebase on top of rockchip changes

v3: Drop unrelated hunk, spotted by Laurent.

v4: Rebase onto mtk driver merge.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Remove unused drm_device from drm_gem_object_lookup()
Chris Wilson [Mon, 9 May 2016 10:04:54 +0000 (11:04 +0100)]
drm: Remove unused drm_device from drm_gem_object_lookup()

drm_gem_object_lookup() has never required the drm_device for its file
local translation of the user handle to the GEM object. Let's remove the
unused parameter and save some space.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
[danvet: Fixup kerneldoc too.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agoMerge branch 'drm-uapi-extern-c-fixes' of https://github.com/evelikov/linux into...
Dave Airlie [Tue, 17 May 2016 06:34:43 +0000 (16:34 +1000)]
Merge branch 'drm-uapi-extern-c-fixes' of https://github.com/evelikov/linux into drm-next

Not the biggest fan of doing it this way, but what the hell.

* 'drm-uapi-extern-c-fixes' of https://github.com/evelikov/linux: (22 commits)
  drm/vmwgfx: add extern C guard for the UAPI header
  drm/virgl: add extern C guard for the UAPI header
  drm/via: add extern C guard for the UAPI header
  drm/vc4: add extern C guard for the UAPI header
  drm/tegra: add extern C guard for the UAPI header
  drm/sis: add extern C guard for the UAPI header
  drm/savage: add extern C guard for the UAPI header
  drm/radeon: add extern C guard for the UAPI header
  drm/r128: add extern C guard for the UAPI header
  drm/qxl: add extern C guard for the UAPI header
  drm/omap: add extern C guard for the UAPI header
  drm/nouveau: drop drm/ prefix from include
  drm/nouveau: add extern C guard for the UAPI header
  drm/msm: add extern C guard for the UAPI header
  drm/mga: add extern C guard for the UAPI header
  drm/i915: add extern C guard for the UAPI header
  drm/i810: add extern C guard for the UAPI header
  drm/exynos: add extern C guard for the UAPI header
  drm/etnaviv: add extern C guard for the UAPI header
  drm: add extern C guard for the UAPI headers
  ...

8 years agoMerge tag 'topic/drm-misc-2016-05-13' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Mon, 16 May 2016 21:06:14 +0000 (07:06 +1000)]
Merge tag 'topic/drm-misc-2016-05-13' of git://anongit.freedesktop.org/drm-intel into drm-next

I kinda hoped that I could still sneak in Noralf's
drm_simple_display_pipe, since there's intereset by others now (for tilcdc
at least). But it wasn't ready by a hair. Oh well.

Otherwise random stuff plus prep patches from Noralf.

* tag 'topic/drm-misc-2016-05-13' of git://anongit.freedesktop.org/drm-intel:
  drm/atomic: Add drm_atomic_helper_best_encoder()
  drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs
  drm/fb-cma-helper: Hook up to DocBook and fix some docs
  drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs
  drm/sti: include linux/seq_file.h where needed
  drm/tegra: Use lockless gem BO free callback
  drm/exynos: Use lockless gem BO free callback
  drm: Make drm_encoder_helper_funcs optional