linux-2.6-block.git
7 years agoMerge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Thu, 24 Nov 2016 23:03:27 +0000 (09:03 +1000)]
Merge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

Building on top of the MALI change previously merged, these changes:
* add tracing support for overlay updates
* refactor some of the plane support code
* de-midlayer the driver
* cleanups from other folk reviewing the code

* 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm:
  drm/armada: fix NULL pointer comparison warning
  drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
  drm/armada: remove some dead code
  drm/armada: mark symbols static where possible
  drm/armada: de-midlayer armada
  drm/armada: use common helper for plane base address
  drm/armada: move setting primary plane position to armada_drm_primary_set()
  drm/armada: split out primary plane update
  drm/armada: move plane state to struct armada_plane
  drm/armada: clean up armada_drm_plane_work_run()
  drm/armada: add tracing support

7 years agoMerge tag 'drm-hisilicon-next-2016-11-17' of http://github.com/zourongrong/linux...
Dave Airlie [Mon, 21 Nov 2016 01:42:17 +0000 (11:42 +1000)]
Merge tag 'drm-hisilicon-next-2016-11-17' of github.com/zourongrong/linux into drm-next

hibmc drm driver for hisilicon.

* tag 'drm-hisilicon-next-2016-11-17' of http://github.com/zourongrong/linux:
  MAINTAINERS: Update HISILICON DRM entries
  drm/hisilicon/hibmc: Add support for vblank interrupt
  drm/hisilicon/hibmc: Add support for VDAC
  drm/hisilicon/hibmc: Add support for display engine
  drm/hisilicon/hibmc: Add support for frame buffer
  drm/hisilicon/hibmc: Add video memory management
  drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

7 years agoMAINTAINERS: Update HISILICON DRM entries
Rongrong Zou [Wed, 16 Nov 2016 12:58:51 +0000 (20:58 +0800)]
MAINTAINERS: Update HISILICON DRM entries

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add support for vblank interrupt
Rongrong Zou [Wed, 16 Nov 2016 12:57:01 +0000 (20:57 +0800)]
drm/hisilicon/hibmc: Add support for vblank interrupt

Add vblank interrupt.

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add support for VDAC
Rongrong Zou [Wed, 16 Nov 2016 12:55:55 +0000 (20:55 +0800)]
drm/hisilicon/hibmc: Add support for VDAC

VDAC(Video Digital-to-Analog converter) converts the RGB diaital data
stream from DE to VGA analog signals.

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add support for display engine
Rongrong Zou [Wed, 16 Nov 2016 12:54:52 +0000 (20:54 +0800)]
drm/hisilicon/hibmc: Add support for display engine

Add display engine function, crtc/plane is initialized here.

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add support for frame buffer
Rongrong Zou [Wed, 16 Nov 2016 12:52:37 +0000 (20:52 +0800)]
drm/hisilicon/hibmc: Add support for frame buffer

Add support for fbdev and kms fb management.

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add video memory management
Rongrong Zou [Wed, 16 Nov 2016 13:31:51 +0000 (21:31 +0800)]
drm/hisilicon/hibmc: Add video memory management

Hibmc have 32m video memory which can be accessed through PCIe by host,
we use ttm to manage these memory.

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Rongrong Zou [Wed, 16 Nov 2016 09:15:34 +0000 (17:15 +0800)]
drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

Add DRM master driver for Hisilicon Hibmc SoC which used for
Out-of-band management. Blow is the general hardware connection,
both the Hibmc and the host CPU are on the same mother board.

+----------+       +----------+
|          | PCIe  |  Hibmc   |
|host CPU( |<----->| display  |
|arm64,x86)|       |subsystem |
+----------+       +----------+

Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
7 years agoMerge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Thu, 17 Nov 2016 00:08:29 +0000 (10:08 +1000)]
Merge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next

- GP102/GP104 devinit (suspend/resume, optimus) hang fix
- GP102/GP104 hardware cursor fix
- Fix for a regression on some non-MST monitors that was caused by the
MST work
- Workaround for certain laptops where ACPI sends display hotkey presses
on a modeset, causing gnome-settings-daemon to go into a continuous loop

* 'linux-4.10' of git://github.com/skeggsb/linux:
  drm/nouveau/disp/gp102: rename from gp104
  drm/nouveau/ce/gp102: rename from gp104
  drm/nouveau/fb/gp102: rename from gp104
  drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices
  drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes
  drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user
  drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE
  drm/nouveau/devinit/gm200: drop pmu reset sequence
  drm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops
  drm/nouveau/pmu/gp102: initial implementation
  drm/nouveau/pmu/gp100: initial implementation
  drm/nouveau/pmu: execute reset before running devinit
  drm/nouveau/pmu: move ucode handling into gt215 implementation
  drm/nouveau/core: initial support for GP102
  drm/nouveau/device/pci: fix oops if no mmu subdev present
  drm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP

7 years agodrm/armada: fix NULL pointer comparison warning
Ravikant B Sharma [Tue, 8 Nov 2016 06:00:09 +0000 (11:30 +0530)]
drm/armada: fix NULL pointer comparison warning

Replace direct comparisons to NULL i.e.
'x == NULL' with '!x'. As per coding standard.

Signed-off-by: Ravikant B Sharma <ravikant.s2@samsung.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
7 years agodrm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:14 +0000 (00:03 +0100)]
drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
7 years agodrm/armada: remove some dead code
Christophe JAILLET [Sun, 30 Oct 2016 15:38:42 +0000 (16:38 +0100)]
drm/armada: remove some dead code

'dma_buf_map_attachment()' can not return NULL, so there is no need to
check for it.

Also add a space in order to improve layout.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
7 years agodrm/armada: mark symbols static where possible
Baoyou Xie [Sat, 22 Oct 2016 09:03:58 +0000 (17:03 +0800)]
drm/armada: mark symbols static where possible

We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/armada/armada_gem.c:215:27: warning: no previous prototype for 'armada_gem_alloc_object' [-Wmissing-prototypes]
drivers/gpu/drm/armada/armada_gem.c:423:1: warning: no previous prototype for 'armada_gem_prime_map_dma_buf' [-Wmissing-prototypes]

In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
7 years agodrm/armada: de-midlayer armada
Russell King [Tue, 1 Nov 2016 20:05:47 +0000 (20:05 +0000)]
drm/armada: de-midlayer armada

Now that the drm_connector_register() is gone from tda998x, we can
remove the mid-layer from armada-drm, eliminating the load, unload,
debugfs_init, and debugfs_cleanup callbacks from armada's drm_driver
structure.  No functional changes.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
7 years agodrm/nouveau/disp/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 05:03:07 +0000 (15:03 +1000)]
drm/nouveau/disp/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/ce/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 05:01:37 +0000 (15:01 +1000)]
drm/nouveau/ce/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 04:59:49 +0000 (14:59 +1000)]
drm/nouveau/fb/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices
Ben Skeggs [Wed, 16 Nov 2016 04:53:08 +0000 (14:53 +1000)]
drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes
Ben Skeggs [Wed, 16 Nov 2016 04:49:35 +0000 (14:49 +1000)]
drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user
Ben Skeggs [Wed, 16 Nov 2016 04:38:44 +0000 (14:38 +1000)]
drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user

GP102/GP104 make life difficult by redefining the channel indices for
some registers, but not others.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE
Hans de Goede [Wed, 9 Nov 2016 17:17:44 +0000 (18:17 +0100)]
drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE

Various notebooks with nvidia GPUs generate an ACPI_VIDEO_NOTIFY_PROBE
acpi-video event when an external device gets plugged in (and again on
modesets on that connector), the default behavior in the acpi-video
driver for this is to send a KEY_SWITCHVIDEOMODE evdev event, which
causes e.g. gnome-settings-daemon to ask us to rescan the connectors
(good), but also causes g-s-d to switch to mirror mode on a newly plugged
monitor rather then using the monitor to extend the desktop (bad)
as KEY_SWITCHVIDEOMODE is supposed to switch between extend the desktop
vs mirror mode.

More troublesome are the repeated ACPI_VIDEO_NOTIFY_PROBE events on
changing the mode on the connector, which cause g-s-d to switch
between mirror/extend mode, which causes a new ACPI_VIDEO_NOTIFY_PROBE
event and we end up with an endless loop.

This commit fixes this by adding an acpi notifier block handler to
nouveau_display.c to intercept ACPI_VIDEO_NOTIFY_PROBE and:

1) Wake-up runtime suspended GPUs and call drm_helper_hpd_irq_event()
   on them, this is necessary in some cases for the GPU to detect connector
   hotplug events while runtime suspended
2) Return NOTIFY_BAD to stop acpi-video from emitting a bogus
   KEY_SWITCHVIDEOMODE key-press event

There already is another acpi notifier block handler registered in
drivers/gpu/drm/nouveau/nvkm/engine/device/acpi.c, but that is not
suitable since that one gets unregistered on runtime suspend, and
we also want to intercept ACPI_VIDEO_NOTIFY_PROBE when runtime suspended.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agodrm/nouveau/devinit/gm200: drop pmu reset sequence
Ben Skeggs [Wed, 9 Nov 2016 00:42:47 +0000 (10:42 +1000)]
drm/nouveau/devinit/gm200: drop pmu reset sequence

This sequence is incorrect for GP102/GP104 boards.  This is now being
handled correctly by the PMU subdev during preinit();

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops
Ben Skeggs [Tue, 8 Nov 2016 01:54:24 +0000 (11:54 +1000)]
drm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops

It appears to be safe to access PTIMER on an unposted board with newer
chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gp102: initial implementation
Ben Skeggs [Wed, 9 Nov 2016 00:41:43 +0000 (10:41 +1000)]
drm/nouveau/pmu/gp102: initial implementation

GP102/GP104 require a harder reset of PMU prior to DEVINIT, or the IFR
image will hang.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gp100: initial implementation
Ben Skeggs [Wed, 9 Nov 2016 00:37:56 +0000 (10:37 +1000)]
drm/nouveau/pmu/gp100: initial implementation

Just enough to hookup preinit reset(), which DEVINIT will depend on later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: execute reset before running devinit
Ben Skeggs [Wed, 9 Nov 2016 00:39:08 +0000 (10:39 +1000)]
drm/nouveau/pmu: execute reset before running devinit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: move ucode handling into gt215 implementation
Ben Skeggs [Wed, 9 Nov 2016 00:23:55 +0000 (10:23 +1000)]
drm/nouveau/pmu: move ucode handling into gt215 implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: initial support for GP102
Ben Skeggs [Mon, 7 Nov 2016 07:38:43 +0000 (17:38 +1000)]
drm/nouveau/core: initial support for GP102

From visual inspection of traces, what we currently implement appears to
be identical to GP104.  Seems to work well enough too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/device/pci: fix oops if no mmu subdev present
Ben Skeggs [Mon, 7 Nov 2016 23:43:50 +0000 (09:43 +1000)]
drm/nouveau/device/pci: fix oops if no mmu subdev present

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP
Ben Skeggs [Mon, 7 Nov 2016 04:51:53 +0000 (14:51 +1000)]
drm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP

Fixes certain displays not being detected due to DPAUX errors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agoMerge tag 'drm-vc4-next-2016-11-16' of https://github.com/anholt/linux into drm-next
Dave Airlie [Wed, 16 Nov 2016 23:43:56 +0000 (09:43 +1000)]
Merge tag 'drm-vc4-next-2016-11-16' of https://github.com/anholt/linux into drm-next

This pull request brings in fragment shader threading and ETC1 support
for vc4.

7 years agoMerge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Wed, 16 Nov 2016 22:55:26 +0000 (08:55 +1000)]
Merge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

Fix conncector registration with tda998x.

* 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm:
  drm/i2c: tda998x: mali-dp: hdlcd: refactor connector registration

7 years agoMerge tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc...
Dave Airlie [Wed, 16 Nov 2016 22:02:46 +0000 (08:02 +1000)]
Merge tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Another pile of misc:
- Explicit fencing for atomic! Big thanks to Gustavo, Sean, Rob 3x, Brian
  and anyone else I've forgotten to make this happen.
- roll out fbdev helper ops to drivers (Stefan Christ)
- last bits of drm_crtc split-up&kerneldoc
- some drm_irq.c crtc functions cleanup
- prepare_fb helper for cma, works correctly with explicit fencing (Marek
  Vasut)
- misc small patches all over

* tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc: (51 commits)
  drm/fence: add out-fences support
  drm/fence: add fence timeline to drm_crtc
  drm/fence: add in-fences support
  drm/bridge: analogix_dp: return error if transfer none byte
  drm: drm_irq.h header cleanup
  drm/irq: Unexport drm_vblank_on/off
  drm/irq: Unexport drm_vblank_count
  drm/irq: Make drm_vblank_pre/post_modeset internal
  drm/nouveau: Use drm_crtc_vblank_off/on
  drm/amdgpu: Use drm_crtc_vblank_on/off for dce6
  drm/color: document NULL values and default settings better
  drm: Drop externs from drm_crtc.h
  drm: Move tile group code into drm_connector.c
  drm: Extract drm_mode_config.[hc]
  Revert "drm: Add aspect ratio parsing in DRM layer"
  Revert "drm: Add and handle new aspect ratios in DRM layer"
  drm/print: Move kerneldoc next to definition
  drm: Consolidate dumb buffer docs
  drm: Clean up kerneldoc for struct drm_driver
  drm: Extract drm_drv.h
  ...

7 years agodrm/vc4: Add fragment shader threading support
Jonas Pfeil [Mon, 7 Nov 2016 23:18:39 +0000 (00:18 +0100)]
drm/vc4: Add fragment shader threading support

FS threading brings performance improvements of 0-20% in glmark2.

The validation code checks for thread switch signals and ensures that
the registers of the other thread are not touched, and that our clamps
are not live across thread switches.  It also checks that the
threading and branching instructions do not interfere.

(Original patch by Jonas, changes by anholt for style cleanup,
removing validation the kernel doesn't need to do, and adding the flag
for userspace).

v2: Minor style fixes from checkpatch.

Signed-off-by: Jonas Pfeil <pfeiljonas@gmx.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
7 years agodrm/fence: add out-fences support
Gustavo Padovan [Wed, 16 Nov 2016 13:00:21 +0000 (22:00 +0900)]
drm/fence: add out-fences support

Support DRM out-fences by creating a sync_file with a fence for each CRTC
that sets the OUT_FENCE_PTR property.

We use the out_fence pointer received in the OUT_FENCE_PTR prop to send
the sync_file fd back to userspace.

The sync_file and fd are allocated/created before commit, but the
fd_install operation only happens after we know that commit succeed.

v2: Comment by Rob Clark:
- Squash commit that adds DRM_MODE_ATOMIC_OUT_FENCE flag here.

    Comment by Daniel Vetter:
- Add clean up code for out_fences

v3: Comments by Daniel Vetter:
- create DRM_MODE_ATOMIC_EVENT_MASK
- userspace should fill out_fences_ptr with the crtc_ids for which
it wants fences back.

v4: Create OUT_FENCE_PTR properties and remove old approach.

v5: Comments by Brian Starkey:
- Remove extra fence_get() in atomic_ioctl()
- Check ret before iterating on the crtc_state
- check ret before fd_install
- set fence_state to NULL at the beginning
- check fence_state->out_fence_ptr before put_user()
- change order of fput() and put_unused_fd() on failure

     - Add access_ok() check to the out_fence_ptr received
     - Rebase after fence -> dma_fence rename
     - Store out_fence_ptr in the drm_atomic_state
     - Split crtc_setup_out_fence()
     - return -1 as out_fence with TEST_ONLY flag

v6: Comments by Daniel Vetter
- Add prepare/unprepare_crtc_signaling()
- move struct drm_out_fence_state to drm_atomic.c
- mark get_crtc_fence() as static

    Comments by Brian Starkey
- proper set fence_ptr fence_state array
- isolate fence_idx increment

    - improve error handling

v7: Comments by Daniel Vetter
- remove prefix from internal functions
- make out_fence_ptr an s64 pointer
- degrade DRM_INFO to DRM_DEBUG_ATOMIC when put_user fail
- fix doc issues
- filter out OUT_FENCE_PTR == NULL and do not fail in this case
- add complete_crtc_signalling()
- krealloc fence_state on demand

    Comment by Brian Starkey
- remove unused crtc_state arg from get_out_fence()

v8: Comment by Brian Starkey
- cancel events before check for !fence_state
- convert a few lefovers u64 types for out_fence_ptr
- fix memleak by assign fence_state earlier after realloc
- proper accout num_fences in case of error

v9: Comment by Brian Starkey
- memset last position of fence_state after krealloc
    Comments by Sean Paul
- pass install_fds in complete_crtc_signaling() instead of ret

     - put_user(-1, fence_ptr) when decoding props

v10: Comment by Brian Starkey
- remove unneeded num_fences increment on error path
- kfree fence_state after installing fences fd

v11: rebase against latest drm-misc

v12: rebase again against latest drm-misc

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Brian Starkey <brian.starkey@arm.com> (v10)
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Robert Foss <robert.foss@collabora.com> (v10)
[danvet: Appease checkpatch.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479301221-13056-1-git-send-email-gustavo@padovan.org
7 years agodrm/fence: add fence timeline to drm_crtc
Gustavo Padovan [Tue, 15 Nov 2016 14:37:08 +0000 (23:37 +0900)]
drm/fence: add fence timeline to drm_crtc

Create one timeline context for each CRTC to be able to handle out-fences
and signal them. It adds a few members to struct drm_crtc: fence_context,
where we store the context we get from fence_context_alloc(), the
fence seqno and the fence lock, that we pass in fence_init() to be
used by the fence.

v2: Comment by Daniel Stone:
- add BUG_ON() to fence_to_crtc() macro

v3: Comment by Ville Syrjälä
- Use more meaningful name as crtc timeline name

v4: Comments by Brian Starkey
- Use even more meaninful name for the crtc timeline
- add doc for timeline_name
    Comment by Daniel Vetter
- use in-line style for comments

    - rebase after fence -> dma_fence rename

v5: Comment by Daniel Vetter
- Add doc for drm_crtc_fence_ops

v6: Comment by Chris Wilson
- Move fence_to_crtc to drm_crtc.c
- Move export of drm_crtc_fence_ops to drm_crtc_internal.h

    - rebase against latest drm-misc

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v5)
Reviewed-by: Sean Paul <seanpaul@chromium.org> (v5)
Tested-by: Robert Foss <robert.foss@collabora.com> (v5)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479220628-10204-1-git-send-email-gustavo@padovan.org
7 years agodrm/fence: add in-fences support
Gustavo Padovan [Tue, 15 Nov 2016 13:06:39 +0000 (22:06 +0900)]
drm/fence: add in-fences support

There is now a new property called IN_FENCE_FD attached to every plane
state that receives sync_file fds from userspace via the atomic commit
IOCTL.

The fd is then translated to a fence (that may be a fence_array
subclass or just a normal fence) and then used by DRM to fence_wait() for
all fences in the sync_file to signal. So it only commits when all
framebuffers are ready to scanout.

v2: Comments by Daniel Vetter:
- remove set state->fence = NULL in destroy phase
- accept fence -1 as valid and just return 0
- do not call fence_get() - sync_file_fences_get() already calls it
- fence_put() if state->fence is already set, in case userspace
set the property more than once.

v3: WARN_ON if fence is set but state has no FB

v4: Comment from Maarten Lankhorst
- allow set fence with no related fb

v5: rename FENCE_FD to IN_FENCE_FD

v6: Comments by Daniel Vetter:
- rename plane_state->in_fence back to "fence"
- re-introduce WARN_ON if fence set but no fb

     - rebase after fence -> dma_fence rename

v7: Comments by Brian Starkey
- set state->fence to NULL when duplicating the state
- fail if IN_FENCE_FD was already set

v8: rebase against latest drm-misc

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Robert Foss <robert.foss@collabora.com>
[danvet: Rebase onto extracted drm_mode_config.[hc].]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
7 years agodrm/bridge: analogix_dp: return error if transfer none byte
Jianqun Xu [Wed, 16 Nov 2016 00:13:39 +0000 (08:13 +0800)]
drm/bridge: analogix_dp: return error if transfer none byte

Reference from drm_dp_aux description (about transfer):
Upon success, the implementation should return the number of payload bytes
that were transferred, or a negative error-code on failure. Helpers
propagate errors from the .transfer() function, with the exception of
the -EBUSY error, which causes a transaction to be retried. On a short,
helpers will return -EPROTO to make it simpler to check for failure.

The analogix_dp_transfer will return num_transferred, but if there is none
byte been transferred, the return value will be 0, which means success, we
should return error-code if transfer none byte.

for (retry = 0; retry < 32; retry++) {
err = aux->transfer(aux, &msg);
if (err < 0) {
if (err == -EBUSY)
continue;

goto unlock;
}
}

Cc: zain wang <wzz@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1479255219-7243-1-git-send-email-jay.xu@rock-chips.com
7 years agoMerge tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/linux/kernel/git...
Dave Airlie [Tue, 15 Nov 2016 23:39:55 +0000 (09:39 +1000)]
Merge tag 'sunxi-drm-for-4.10' of https://git./linux/kernel/git/mripard/linux into drm-next

sun4i-drm changes for 4.10

Support for the Allwinner A31 SoC display engine using the sun4i-drm
driver.

* tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  drm/sun4i: Add a few formats
  drm/sun4i: Add compatible strings for A31/A31s display pipelines
  drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)
  drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure
  drm/sun4i: sun6i-drc: Support DRC on A31 and A31s

7 years agoMerge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next
Dave Airlie [Tue, 15 Nov 2016 23:39:21 +0000 (09:39 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next

rcar-du -next branch.

* 'drm/next/du' of git://linuxtv.org/pinchartl/media:
  drm: rcar-du: Fix LVDS start sequence on Gen3
  drm: rcar-du: Fix H/V sync signal polarity configuration
  drm: rcar-du: Fix display timing controller parameter
  drm: rcar-du: Fix dot clock routing configuration
  drm: rcar-du: Add R8A7796 support
  drm: rcar-du: Add R8A7792 support
  drm: rcar-du: Simplify and fix probe error handling
  drm: rcar-du: Fix crash in encoder failure error path
  drm: rcar-du: Remove memory allocation error message
  drm: rcar-du: Remove test for impossible error condition
  drm: rcar-du: Bring HDMI encoder comments in line with the driver
  drm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()
  video: of: Constify node argument to display timing functions

7 years agodrm: drm_irq.h header cleanup
Daniel Vetter [Mon, 14 Nov 2016 09:02:55 +0000 (10:02 +0100)]
drm: drm_irq.h header cleanup

- Drop extern for functions, it's noise.
- Move&consolidate drm.ko internal parts into drm-internal.h.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-6-daniel.vetter@ffwll.ch
7 years agodrm/irq: Unexport drm_vblank_on/off
Daniel Vetter [Mon, 14 Nov 2016 09:02:54 +0000 (10:02 +0100)]
drm/irq: Unexport drm_vblank_on/off

Only remaining use was in amdgpu, and trivial to convert over to
drm_crtc_vblank_* variants.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-5-daniel.vetter@ffwll.ch
7 years agodrm/irq: Unexport drm_vblank_count
Daniel Vetter [Mon, 14 Nov 2016 09:02:53 +0000 (10:02 +0100)]
drm/irq: Unexport drm_vblank_count

No one outside of drm_irq.c should ever need this. The correct way to
implement get_vblank_count for hw lacking a vblank counter is
drm_vblank_no_hw_counter. Fix this up in mtk, which is the only
offender left over.

Cc: CK Hu <ck.hu@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-4-daniel.vetter@ffwll.ch
7 years agodrm/irq: Make drm_vblank_pre/post_modeset internal
Daniel Vetter [Mon, 14 Nov 2016 09:02:52 +0000 (10:02 +0100)]
drm/irq: Make drm_vblank_pre/post_modeset internal

Now that all drivers are switched over to drm_crtc_vblank_on/off we
can relegate pre/post_modeset to the purely drm_irq.c internal role of
supporting old ums userspace.

As usual switch to the drm_legacy_ prefix to make it clear this is
for old drivers only.

v2: Rebase on top of Thierry's s/int crtc/unsigned int pipe/ changes.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodrm/nouveau: Use drm_crtc_vblank_off/on
Daniel Vetter [Tue, 15 Nov 2016 21:58:19 +0000 (22:58 +0100)]
drm/nouveau: Use drm_crtc_vblank_off/on

With atomic nv50+ is already converted over to them, but the old
display code is still using it. Found in a 2 year old patch I have
lying around to un-export these old helpers!

v2: Drop the hand-rolled versions from resume/suspend code. Now that
crtc callbacks do this, we don't need a special case for s/r anymore.

v3: Remove unused variables.

v4: Don't remove drm_crtc_vblank_off from suspend paths, non-atomic
nouveau still needs that. But still switch to drm_crtc_vblank_off
since drm_vblank_off will disappear.

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114114101.21731-1-daniel.vetter@ffwll.ch
7 years agodrm/amdgpu: Use drm_crtc_vblank_on/off for dce6
Daniel Vetter [Mon, 14 Nov 2016 09:02:50 +0000 (10:02 +0100)]
drm/amdgpu: Use drm_crtc_vblank_on/off for dce6

This old code pattern was reintroduced in

Author: Ken Wang <Qingqing.Wang@amd.com>
Date:   Tue Jan 19 14:03:24 2016 +0800

    drm/amdgpu: add display controller implementation for si v10

Realign it with later display code. Tsk, tsk for massive copypasting
;-)

Cc: Christian König <christian.koenig@amd.com>
Cc: Ken Wang <Qingqing.Wang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com> for the whole series.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-1-daniel.vetter@ffwll.ch
7 years agodrm/color: document NULL values and default settings better
Daniel Vetter [Mon, 26 Sep 2016 09:04:37 +0000 (11:04 +0200)]
drm/color: document NULL values and default settings better

Brought up in a discussion for enabling gamma on fsl-dcu.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Meng Yi <meng.yi@nxp.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160926090437.22676-1-daniel.vetter@ffwll.ch
7 years agodrm: Drop externs from drm_crtc.h
Daniel Vetter [Mon, 14 Nov 2016 11:58:25 +0000 (12:58 +0100)]
drm: Drop externs from drm_crtc.h

Just noise.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-11-daniel.vetter@ffwll.ch
7 years agodrm: Move tile group code into drm_connector.c
Daniel Vetter [Mon, 14 Nov 2016 11:58:24 +0000 (12:58 +0100)]
drm: Move tile group code into drm_connector.c

And also put the overview section into the KMS Properties part of the
docs, instead of randomly-placed within the helpers - this is part of
the uabi.

With this patch I think drm_crtc.[hc] is cleaned up and entirely
documented.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodrm: Extract drm_mode_config.[hc]
Daniel Vetter [Mon, 14 Nov 2016 11:58:23 +0000 (12:58 +0100)]
drm: Extract drm_mode_config.[hc]

And shuffle the kernel-doc structure a bit since drm_crtc.[hc] now
only contains CRTC-related functions and structures.

v2:
- rebase onto drm-misc
- don't forget to move drm_mode_config_cleanup.
- move 2 internal decls under the right heading (Chris)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agoRevert "drm: Add aspect ratio parsing in DRM layer"
Ville Syrjälä [Thu, 3 Nov 2016 12:31:44 +0000 (14:31 +0200)]
Revert "drm: Add aspect ratio parsing in DRM layer"

This reverts commit 6dffd431e2296cda08e7e4f0242e02df1d1698cd.

Adding new mode flags willy nilly breaks existing userspace. We need to
coordinate this better, potentially with a new client cap that only
exposes the aspect ratio flags when userspace is prepared for them
(similar to what we do with stereo 3D modes).

This also broke things so that we would always send out VIC==0 in
the AVI infoframe unless the user specified an aspect ratio via
the mode flags. And the automagic RGB full vs. limited range
handling was similartly broken as the user mode would never match
any CEA mode.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Lin, Jia <lin.a.jia@intel.com>
Cc: Akashdeep Sharma <akashdeep.sharma@intel.com>
Cc: Jim Bride <jim.bride@linux.intel.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478176304-6743-2-git-send-email-ville.syrjala@linux.intel.com
7 years agoRevert "drm: Add and handle new aspect ratios in DRM layer"
Ville Syrjälä [Thu, 3 Nov 2016 12:31:43 +0000 (14:31 +0200)]
Revert "drm: Add and handle new aspect ratios in DRM layer"

This reverts commit a68362fe3e84fcbedd49939aa200519aa5410135.

Adding new mode flags willy nilly breaks existing userspace. We need to
coordinate this better, potentially with a new client cap that only
exposes the aspect ratio flags when userspace is prepared for them
(similar to what we do with stereo 3D modes).

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Lin, Jia <lin.a.jia@intel.com>
Cc: Akashdeep Sharma <akashdeep.sharma@intel.com>
Cc: Jim Bride <jim.bride@linux.intel.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478176304-6743-1-git-send-email-ville.syrjala@linux.intel.com
7 years agodrm/print: Move kerneldoc next to definition
Daniel Vetter [Mon, 14 Nov 2016 11:58:22 +0000 (12:58 +0100)]
drm/print: Move kerneldoc next to definition

kerneldoc expects the comment next to definitions, otherwise it can't
pick up exported vs. internal stuff.

This fixes a warning from the doc build done with:

$ make DOCBOOKS="" htmldocs

Fixes: d8187177b0b1 ("drm: add helper for printing to log or seq_file")
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-8-daniel.vetter@ffwll.ch
7 years agodrm: Consolidate dumb buffer docs
Daniel Vetter [Mon, 14 Nov 2016 11:58:21 +0000 (12:58 +0100)]
drm: Consolidate dumb buffer docs

Put the callback docs into struct drm_driver, and the small overview
into a DOC comment.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-7-daniel.vetter@ffwll.ch
7 years agodrm: Clean up kerneldoc for struct drm_driver
Daniel Vetter [Mon, 14 Nov 2016 11:58:20 +0000 (12:58 +0100)]
drm: Clean up kerneldoc for struct drm_driver

Just cleans up what's there, still plenty missing.

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/20161114115825.22050-6-daniel.vetter@ffwll.ch
7 years agodrm: Extract drm_drv.h
Daniel Vetter [Mon, 14 Nov 2016 11:58:19 +0000 (12:58 +0100)]
drm: Extract drm_drv.h

I want to move dumb buffer documentation into the right vfuncs, and
for that I first need to be able to pull that into kerneldoc without
having to clean up all of drmP.h. Also, header-splitting is nice.

While at it shuffle all the function declarations for drm_drv.c into
the right spots, and drop the kerneldoc for drm_minor_acquire/release
since it's only used internally.

v2: Keep all existing copyright notices (Chris).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodoc/dma-buf: Fix up include directives
Daniel Vetter [Mon, 14 Nov 2016 11:58:18 +0000 (12:58 +0100)]
doc/dma-buf: Fix up include directives

Would be great if everony could add

$ make DOCBOOKS="" htmldocs

to their build scripts to catch these. 0day should also report them,
not sure why it failed to spot this.

Fixes: f54d1867005c ("dma-buf: Rename struct fence to dma_fence")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-4-daniel.vetter@ffwll.ch
7 years agodrm/i915: Fixup kerneldoc includes
Daniel Vetter [Mon, 14 Nov 2016 11:58:17 +0000 (12:58 +0100)]
drm/i915: Fixup kerneldoc includes

Would be great if everony could add

$ make DOCBOOKS="" htmldocs

to their build scripts to catch these. 0day should also report them,
not sure why it failed to spot this.

Fixes: b42fe9ca0a1e ("drm/i915: Split out i915_vma.c")
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-3-daniel.vetter@ffwll.ch
7 years agodrm: Extract drm_dumb_buffers.c
Daniel Vetter [Mon, 14 Nov 2016 11:58:16 +0000 (12:58 +0100)]
drm: Extract drm_dumb_buffers.c

Just code movement, doc cleanup will follow up later.

v2: Keep all the copyright notices.

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/20161114115825.22050-2-daniel.vetter@ffwll.ch
7 years agodrm/fb_cma_helper: Add missing forward declaration
Marek Vasut [Tue, 15 Nov 2016 10:55:29 +0000 (11:55 +0100)]
drm/fb_cma_helper: Add missing forward declaration

Add missing forward declaration for struct drm_plane and drm_plane_state,
which causes the following warning in the VC4 driver (can be replicated
by building using bcm2835_defconfig):

In file included from drivers/gpu/drm/vc4/vc4_drv.c:18:0:
include/drm/drm_fb_cma_helper.h:45:13: warning: ‘struct drm_plane_state’ declared inside parameter list will not be visible outside of this definition or declaration
      struct drm_plane_state *state);
             ^~~~~~~~~~~~~~~
include/drm/drm_fb_cma_helper.h:44:34: warning: ‘struct drm_plane’ declared inside parameter list will not be visible outside of this definition or declaration
 int drm_fb_cma_prepare_fb(struct drm_plane *plane,

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161115105529.3227-1-marex@denx.de
7 years agodrm: zte: checking for NULL instead of IS_ERR()
Dan Carpenter [Tue, 15 Nov 2016 09:53:01 +0000 (12:53 +0300)]
drm: zte: checking for NULL instead of IS_ERR()

drm_dev_alloc() never returns NULL, it only returns error pointers on
error.

Fixes: 0a886f59528a ("drm: zte: add initial vou drm driver")
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/20161115095301.GC15424@mwanda
7 years agodrm: don't let crtc_ww_class leak out
Rob Clark [Mon, 14 Nov 2016 22:40:57 +0000 (17:40 -0500)]
drm: don't let crtc_ww_class leak out

kbuild spotted this error, with drm/msm patches that add a new
modeset-lock in the driver and driver built as a module:

  ERROR: "crtc_ww_class" [drivers/gpu/drm/msm/msm.ko] undefined!

Really the only reason for crtc_ww_class not being internal to
drm_modeset_lock.c is that drm_modeset_lock_init() was static-inline
(for no particularly good reason).

Fix that, and move crtc_ww_class into drm_modeset_lock.c.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479163257-18703-1-git-send-email-robdclark@gmail.com
7 years agodma-buf: Use fence_get_rcu_safe() for retrieving the exclusive fence
Chris Wilson [Mon, 14 Nov 2016 11:55:40 +0000 (11:55 +0000)]
dma-buf: Use fence_get_rcu_safe() for retrieving the exclusive fence

The current code is subject to a race where we may try to acquire a
reference on a stale fence:

[13703.335118] WARNING: CPU: 1 PID: 14975 at ./include/linux/kref.h:46 i915_gem_object_wait+0x1a3/0x1c0
[13703.335184] Modules linked in:
[13703.335202] CPU: 1 PID: 14975 Comm: gem_concurrent_ Not tainted 4.9.0-rc4+ #26
[13703.335216] Hardware name:                  /        , BIOS PYBSWCEL.86A.0027.2015.0507.1758 05/07/2015
[13703.335233]  ffffc90002f5bcc8 ffffffff812807de 0000000000000000 0000000000000000
[13703.335257]  ffffc90002f5bd08 ffffffff81073811 0000002e80000000 ffff88026bf7c780
[13703.335279]  7fffffffffffffff 0000000000000001 ffff88027045a550 ffff88026bf7c780
[13703.335301] Call Trace:
[13703.335316]  [<ffffffff812807de>] dump_stack+0x4d/0x6f
[13703.335331]  [<ffffffff81073811>] __warn+0xc1/0xe0
[13703.335343]  [<ffffffff810738e8>] warn_slowpath_null+0x18/0x20
[13703.335355]  [<ffffffff813ac443>] i915_gem_object_wait+0x1a3/0x1c0
[13703.335367]  [<ffffffff813ae8ec>] i915_gem_set_domain_ioctl+0xcc/0x330
[13703.335386]  [<ffffffff813534ab>] drm_ioctl+0x1cb/0x410
[13703.335400]  [<ffffffff813ae820>] ? i915_gem_obj_prepare_shmem_write+0x1d0/0x1d0
[13703.335416]  [<ffffffff8135359b>] ? drm_ioctl+0x2bb/0x410
[13703.335429]  [<ffffffff8117d32f>] do_vfs_ioctl+0x8f/0x5c0
[13703.335442]  [<ffffffff8117d89c>] SyS_ioctl+0x3c/0x70
[13703.335456]  [<ffffffff815a07a4>] entry_SYSCALL_64_fastpath+0x17/0x98
[13703.335558] ---[ end trace fd24176416ba6981 ]---
[13703.382778] general protection fault: 0000 [#1] SMP
[13703.382802] Modules linked in:
[13703.382816] CPU: 1 PID: 14967 Comm: gem_concurrent_ Tainted: G        W       4.9.0-rc4+ #26
[13703.382828] Hardware name:                  /        , BIOS PYBSWCEL.86A.0027.2015.0507.1758 05/07/2015
[13703.382841] task: ffff880275458000 task.stack: ffffc90002f18000
[13703.382849] RIP: 0010:[<ffffffff813b3534>]  [<ffffffff813b3534>] i915_gem_request_retire+0x2b4/0x320
[13703.382870] RSP: 0018:ffffc90002f1bbc8  EFLAGS: 00010293
[13703.382878] RAX: dead000000000200 RBX: ffff88026bf7dce8 RCX: dead000000000100
[13703.382887] RDX: dead000000000100 RSI: ffff88026bf7c930 RDI: ffff88026bf7dd00
[13703.382897] RBP: ffffc90002f1bbf8 R08: 00000000ffffffff R09: ffff88026b89a000
[13703.382905] R10: 0000000000000001 R11: ffff88026bbe8fe0 R12: ffff88026bf7c000
[13703.382913] R13: ffff880275af8000 R14: ffff88026bf7c180 R15: dead000000000200
[13703.382922] FS:  00007f89e787d740(0000) GS:ffff88027fd00000(0000) knlGS:0000000000000000
[13703.382934] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[13703.382942] CR2: 00007f9053d2e000 CR3: 000000026d414000 CR4: 00000000001006e0
[13703.382951] Stack:
[13703.382958]  ffff880275413000 ffffc90002f1bde8 ffff880275af8000 ffff880274e8a600
[13703.382976]  ffff880276a06000 ffffc90002f1bde8 ffffc90002f1bc38 ffffffff813b48c5
[13703.382995]  ffffc90002f1bc00 ffffc90002f1bde8 ffff88026972a440 0000000000000000
[13703.383021] Call Trace:
[13703.383032]  [<ffffffff813b48c5>] i915_gem_request_alloc+0xa5/0x350
[13703.383043]  [<ffffffff813a17c3>] i915_gem_do_execbuffer.isra.41+0x7b3/0x18b0
[13703.383055]  [<ffffffff813b144c>] ? i915_gem_object_get_sg+0x25c/0x2b0
[13703.383065]  [<ffffffff813b1d4d>] ? i915_gem_object_get_page+0x1d/0x50
[13703.383076]  [<ffffffff813b28cc>] ? i915_gem_pwrite_ioctl+0x66c/0x6d0
[13703.383086]  [<ffffffff813a2c25>] i915_gem_execbuffer2+0x95/0x1e0
[13703.383096]  [<ffffffff813534ab>] drm_ioctl+0x1cb/0x410
[13703.383105]  [<ffffffff813a2b90>] ? i915_gem_execbuffer+0x2d0/0x2d0
[13703.383117]  [<ffffffff810c3df0>] ? hrtimer_start_range_ns+0x1a0/0x310
[13703.383128]  [<ffffffff8117d32f>] do_vfs_ioctl+0x8f/0x5c0
[13703.383140]  [<ffffffff810c60e8>] ? SyS_timer_settime+0x118/0x1a0
[13703.383150]  [<ffffffff8117d89c>] SyS_ioctl+0x3c/0x70
[13703.383162]  [<ffffffff815a07a4>] entry_SYSCALL_64_fastpath+0x17/0x98
[13703.383172] Code: 49 39 c6 48 8d 70 e8 48 8d 5f e8 75 16 eb 47 48 8d 43 18 48 8b 53 18 48 89 de 49 39 c6 48 8d 5a e8 74 33 48 8b 56 08 48 8b 46 10 <48> 89 42 08 48 89 10 f6 46 38 01 48 89 4e 08 4c 89 7e 10 74 cf
[13703.383557] RIP  [<ffffffff813b3534>] i915_gem_request_retire+0x2b4/0x320
[13703.383570]  RSP <ffffc90002f1bbc8>
[13703.383586] ---[ end trace fd24176416ba6982 ]---

This is fixed by using the kref_get_unless_zero() as a full memory
barrier to validate the fence is still the current exclusive fence before
returning it back to the caller. (Note the fix only requires using
dma_fence_get_rcu() and correct handling, but we may as well use the
helper rather than inline equivalent code.)

Note: Issue can only be hit with the i915 driver.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org
Fixes: d07f0e59b2c7 ("drm/i915: Move GEM activity tracking into a common struct reservation_object")
Reviewed-by: Christian König <christian.koenig@amd.com>.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115540.31155-1-chris@chris-wilson.co.uk
7 years agodrm/imx: Switch to drm_fb_cma_prepare_fb() helper
Marek Vasut [Mon, 14 Nov 2016 10:07:32 +0000 (11:07 +0100)]
drm/imx: Switch to drm_fb_cma_prepare_fb() helper

Remove the common code from the driver and use the
drm_fb_cma_prepare_fb() helper instead.
Moveover, call the helper from prepare_fb() plane hook .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114100732.3446-2-marex@denx.de
Link: http://patchwork.freedesktop.org/patch/msgid/1476451342-146510-1-git-send-email-dvyukov@google.com
7 years agodrm: rcar-du: Fix LVDS start sequence on Gen3
Koji Matsuoka [Tue, 28 Jun 2016 07:33:45 +0000 (16:33 +0900)]
drm: rcar-du: Fix LVDS start sequence on Gen3

According to the latest revision of the datasheet, the LVDS I/O pins
must be enabled before starting the PLL. Fix it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Fix H/V sync signal polarity configuration
Koji Matsuoka [Mon, 16 May 2016 02:28:15 +0000 (11:28 +0900)]
drm: rcar-du: Fix H/V sync signal polarity configuration

The VSL and HSL bits in the DSMR register set the corresponding
horizontal and vertical sync signal polarity to active high. The code
got it the wrong way around, fix it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Fix display timing controller parameter
Koji Matsuoka [Mon, 18 Apr 2016 07:31:30 +0000 (16:31 +0900)]
drm: rcar-du: Fix display timing controller parameter

There is a bug in the setting of the DES (Display Enable Signal)
register. This current setting occurs 1 dot left shift. The DES
register should be set minus one value about the specifying value
with H/W specification. This patch corrects it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Fix dot clock routing configuration
Laurent Pinchart [Sat, 22 Oct 2016 16:05:53 +0000 (19:05 +0300)]
drm: rcar-du: Fix dot clock routing configuration

Dot clock routing is setup through different registers depending on the
DU generation. The code has been designed for Gen2 and hasn't been
updated since. This works thanks to good reset default value, but isn't
very safe. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Add R8A7796 support
Laurent Pinchart [Mon, 5 Sep 2016 23:11:43 +0000 (02:11 +0300)]
drm: rcar-du: Add R8A7796 support

Document the R8A7796-specific DT bindings and support them in the
driver. The HDMI output is currently not supported.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Add R8A7792 support
Sergei Shtylyov [Thu, 4 Aug 2016 22:01:02 +0000 (15:01 -0700)]
drm: rcar-du: Add R8A7792 support

Add support for the R8A7792 DU; it has 2 DPAD (RGB) outputs.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm: rcar-du: Simplify and fix probe error handling
Laurent Pinchart [Tue, 18 Oct 2016 21:51:35 +0000 (00:51 +0300)]
drm: rcar-du: Simplify and fix probe error handling

It isn't safe to call drm_dev_unregister() without first initializing
mode setting with drm_mode_config_init(). This leads to a crash if
either IO memory can't be remapped or vblank initialization fails.

Fix this by reordering the initialization sequence. Move vblank
initialization after the drm_mode_config_init() call, and move IO
remapping before drm_dev_alloc() to avoid the need to perform clean up
in case of failure.

While at it remove the explicit drm_vblank_cleanup() call from
rcar_du_remove() as the drm_dev_unregister() function already cleans up
vblank.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
7 years agodrm/fb_cma_helper: Add drm_fb_cma_prepare_fb() helper
Marek Vasut [Mon, 14 Nov 2016 10:07:31 +0000 (11:07 +0100)]
drm/fb_cma_helper: Add drm_fb_cma_prepare_fb() helper

Add new drm_fb_cma_prepare_fb() helper function extracted from the
imx-drm driver. This function checks if the plane has DMABUF attached
to it, extracts the exclusive fence from it and attaches it to the
plane state for the atomic helper to wait on it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114100732.3446-1-marex@denx.de
7 years agodrm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:28 +0000 (00:03 +0100)]
drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This refactoring leads to real functional changes in the driver.

Now the struct psbfb_ops implements two additional members:

       .fb_setcmap     = drm_fb_helper_setcmap,
       .fb_pan_display = drm_fb_helper_pan_display,

and the struct psbfb_roll_ops implements one additional member:

       .fb_setcmap     = drm_fb_helper_setcmap,

and the struct psbfb_unaccel_ops implements two additional members:

       .fb_setcmap     = drm_fb_helper_setcmap,
       .fb_pan_display = drm_fb_helper_pan_display,

These changes are not tested.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-19-git-send-email-contact@stefanchrist.eu
7 years agodrm/i915: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:27 +0000 (00:03 +0100)]
drm/i915: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-18-git-send-email-contact@stefanchrist.eu
7 years agodrm/omapdrm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:26 +0000 (00:03 +0100)]
drm/omapdrm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-17-git-send-email-contact@stefanchrist.eu
7 years agodrm/virtio: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:25 +0000 (00:03 +0100)]
drm/virtio: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This patch removes a TODO comment in the code. I do not know whether it
is still relevant.

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-16-git-send-email-contact@stefanchrist.eu
7 years agodrm/msm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:24 +0000 (00:03 +0100)]
drm/msm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-15-git-send-email-contact@stefanchrist.eu
7 years agodrm/udl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:23 +0000 (00:03 +0100)]
drm/udl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-14-git-send-email-contact@stefanchrist.eu
7 years agodrm/tegra: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:22 +0000 (00:03 +0100)]
drm/tegra: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-13-git-send-email-contact@stefanchrist.eu
7 years agodrm/radeon: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:21 +0000 (00:03 +0100)]
drm/radeon: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-12-git-send-email-contact@stefanchrist.eu
7 years agodrm/rockchip: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:20 +0000 (00:03 +0100)]
drm/rockchip: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-11-git-send-email-contact@stefanchrist.eu
7 years agodrm/qxl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:19 +0000 (00:03 +0100)]
drm/qxl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This patch removes a TODO comment in the code. I do not know whether it
is still relevant.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-10-git-send-email-contact@stefanchrist.eu
7 years agodrm/nouveau: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:18 +0000 (00:03 +0100)]
drm/nouveau: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-9-git-send-email-contact@stefanchrist.eu
7 years agodrm/exynos: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:17 +0000 (00:03 +0100)]
drm/exynos: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-8-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb_cma_helper: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:16 +0000 (00:03 +0100)]
drm/fb_cma_helper: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-7-git-send-email-contact@stefanchrist.eu
7 years agodrm/bochs: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:15 +0000 (00:03 +0100)]
drm/bochs: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-6-git-send-email-contact@stefanchrist.eu
7 years agodrm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:14 +0000 (00:03 +0100)]
drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-5-git-send-email-contact@stefanchrist.eu
7 years agodrm/amdgpu: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:13 +0000 (00:03 +0100)]
drm/amdgpu: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-4-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb-helper: add fb_debug_* to DRM_FB_HELPER_DEFAULT_OPS
Stefan Christ [Sun, 13 Nov 2016 23:03:12 +0000 (00:03 +0100)]
drm/fb-helper: add fb_debug_* to DRM_FB_HELPER_DEFAULT_OPS

Add additional members fb_debug_enter and fb_debug_leave to helper
define. They are shared by all fb_ops implementations.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-3-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb-helper: fix segfaults in drm_fb_helper_debug_*
Stefan Christ [Sun, 13 Nov 2016 23:03:11 +0000 (00:03 +0100)]
drm/fb-helper: fix segfaults in drm_fb_helper_debug_*

A drm driver that is implementing

      fb_debug_enter and fb_debug_leave

in struct fb_ops with drm fb helper functions

     drm_fb_helper_debug_enter and drm_fb_helper_debug_leave

must also implement the callback 'mode_set_base_atomic' in struct
drm_crtc_helper_funcs. See Documentation/DocBook/kgdb.tmpl.  The current
implementation will segfault when 'mode_set_base_atomic' is a NULL
pointer.

Before this patch at least the drm drivers armada, ast, qxl, udl and
virtio do not have a 'mode_set_base_atomic' implementation but using
drm_fb_helper_debug_(enter|leave). So these drivers may segfault when
callbacks fb_debug_(enter|leave) are called.

Avoid the issue by just checking for NULL pointers. So all drivers can
unconditionally implement fb_debug_(enter|leave) with the drm_fb_helper
functions. If callback 'mode_set_base_atomic' is not implemented, the
code in drm_fb_helper_debug_(enter|leave) does effectively nothing.

Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-2-git-send-email-contact@stefanchrist.eu
7 years agodrm/ast: free correct pointer in astfb_create() error paths
Andrew Donnellan [Mon, 14 Nov 2016 03:03:59 +0000 (14:03 +1100)]
drm/ast: free correct pointer in astfb_create() error paths

In the err_free_vram and err_release_fbi error paths in astfb_create(), we
attempt to free afbdev->sysram. The only jumps to these error paths occur
before we assign afbdev->sysram = sysram. Free sysram instead.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114030359.27852-1-andrew.donnellan@au1.ibm.com
7 years agodrm: rcar-du: Fix crash in encoder failure error path
Laurent Pinchart [Mon, 3 Oct 2016 17:03:22 +0000 (20:03 +0300)]
drm: rcar-du: Fix crash in encoder failure error path

When an encoder fails to initialize the driver prints an error message
to the kernel log. The message contains the name of the encoder's DT
node, which is NULL for internal encoders. Use the of_node_full_name()
macro to avoid dereferencing a NULL pointer, print the output number to
add more context to the error, and make sure we still own a reference to
the encoder's DT node by delaying the of_node_put() call.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Remove memory allocation error message
Laurent Pinchart [Mon, 3 Oct 2016 14:42:07 +0000 (17:42 +0300)]
drm: rcar-du: Remove memory allocation error message

Memory allocation failures print messages to the kernel log, there's no
need to print an extra one. Remove the duplicate message.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Remove test for impossible error condition
Laurent Pinchart [Mon, 3 Oct 2016 14:40:20 +0000 (17:40 +0300)]
drm: rcar-du: Remove test for impossible error condition

The driver has lost platform data support a long time ago. R-Car DU
devices can only be instantiated through DT now, making it impossible to
have a NULL DT node pointer. Remove the error check.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Bring HDMI encoder comments in line with the driver
Laurent Pinchart [Thu, 25 Feb 2016 20:04:55 +0000 (22:04 +0200)]
drm: rcar-du: Bring HDMI encoder comments in line with the driver

Capitalize acronyms and use determiners and punctuation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()
Laurent Pinchart [Mon, 3 Oct 2016 13:56:48 +0000 (16:56 +0300)]
drm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()

The node passed as a pointer to the rcar_du_lvds_connector_init()
function is never modified, make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agovideo: of: Constify node argument to display timing functions
Laurent Pinchart [Mon, 3 Oct 2016 13:55:48 +0000 (16:55 +0300)]
video: of: Constify node argument to display timing functions

The node pointer passed to the display timing functions is never
modified, make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/sun4i: constify component_ops structures
Julia Lawall [Sat, 12 Nov 2016 17:19:58 +0000 (18:19 +0100)]
drm/sun4i: constify component_ops structures

These component_ops structures are only used as the second argument to
component_add and component_del, which are declared as const, so the
structures can be declared as const as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@

static struct component_ops i@p = { ... };

@ok1@
identifier r.i;
expression e1;
position p;
@@

component_add(e1,&i@p)

@ok2@
identifier r.i;
expression e1;
position p;
@@

component_del(e1, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct component_ops e;
@@

e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@

static
+const
 struct component_ops i = { ... };
// </smpl>

The result of the size command before the change is (arm):

   text       data         bss     dec      hex filename
   5266        236           8    5510     1586 sun4i_backend.o
   6393        236           8    6637     19ed sun4i_tcon.o
   3700        368           8    4076      fec sun4i_tv.o
   1668        108           0    1776      6f0 sun6i_drc.o

and after the change:

   text       data         bss     dec     hex filename
   5274        228           8    5510    1586 sun4i_backend.o
   6401        228           8    6637    19ed sun4i_tcon.o
   3708        360           8    4076     fec sun4i_tv.o
   1676        100           0    1776     6f0 sun6i_drc.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478971198-3659-1-git-send-email-Julia.Lawall@lip6.fr
7 years agodrm: move allocation out of drm_get_format_name()
Eric Engestrom [Sat, 12 Nov 2016 01:12:56 +0000 (01:12 +0000)]
drm: move allocation out of drm_get_format_name()

The function's behaviour was changed in 90844f00049e, without changing
its signature, causing people to keep using it the old way without
realising they were now leaking memory.
Rob Clark also noticed it was also allocating GFP_KERNEL memory in
atomic contexts, breaking them.

Instead of having to allocate GFP_ATOMIC memory and fixing the callers
to make them cleanup the memory afterwards, let's change the function's
signature by having the caller take care of the memory and passing it to
the function.
The new parameter is a single-field struct in order to enforce the size
of its buffer and help callers to correctly manage their memory.

Fixes: 90844f00049e ("drm: make drm_get_format_name thread-safe")
Cc: Rob Clark <robdclark@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Sinclair Yeh <syeh@vmware.com> (vmwgfx)
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161112011309.9799-1-eric@engestrom.ch