Daniel Vetter
1a02ea434e
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
2016-11-15 12:46:36 +01:00
Marek Vasut
196594efc2
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
2016-11-15 12:24:08 +01:00
Dan Carpenter
72282a88d4
drm: zte: checking for NULL instead of IS_ERR()
...
drm_dev_alloc() never returns NULL, it only returns error pointers on
error.
Fixes: 0a886f5952 ("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
2016-11-15 11:00:42 +01:00
Rob Clark
35cf03508d
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
2016-11-15 08:33:35 +01:00
Chris Wilson
6bfec6d945
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: d07f0e59b2 ("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
2016-11-15 08:30:02 +01:00
Marek Vasut
782ea2a493
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
2016-11-15 08:25:06 +01:00
Marek Vasut
14d7f96f90
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
2016-11-14 12:43:58 +01:00
Stefan Christ
3da6c2f3b7
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
2016-11-14 08:01:01 +01:00
Stefan Christ
a36384dd94
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
2016-11-14 07:58:20 +01:00
Stefan Christ
d074e55de4
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
2016-11-14 07:58:15 +01:00
Stefan Christ
e59a03f581
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
2016-11-14 07:58:10 +01:00
Stefan Christ
00d44063fd
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
2016-11-14 07:58:04 +01:00
Stefan Christ
812162f04f
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
2016-11-14 07:57:59 +01:00
Stefan Christ
902c255b52
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
2016-11-14 07:56:58 +01:00
Stefan Christ
13be31f958
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
2016-11-14 07:56:52 +01:00
Stefan Christ
72b6bcb1a2
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
2016-11-14 07:56:47 +01:00
Stefan Christ
1102af19cd
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
2016-11-14 07:55:33 +01:00
Stefan Christ
51a11f3ba5
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
2016-11-14 07:55:14 +01:00
Stefan Christ
2eec838cf4
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
2016-11-14 07:54:50 +01:00
Stefan Christ
659119de7e
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
2016-11-14 07:54:43 +01:00
Stefan Christ
d4d938c9bd
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
2016-11-14 07:54:38 +01:00
Stefan Christ
1caae27760
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
2016-11-14 07:54:13 +01:00
Stefan Christ
ea4ffffea3
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
2016-11-14 07:54:04 +01:00
Stefan Christ
1e0089288b
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
2016-11-14 07:47:46 +01:00
Stefan Christ
1b99b72489
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
2016-11-14 07:47:34 +01:00