New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 652865 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

add implicit out fences to kernel 4.4

Project Member Reported by dbehr@chromium.org, Oct 4 2016

Issue description

Add fences protecting dma-buf from GPU rendering while the buffer is being displayed. Roll up DRM event handling cleanups and merge Gustavo's fence in event change from upstream first.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 7 2016

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/5d8dfd4c47546d1c8e7496a8be3e8bb284beacac

commit 5d8dfd4c47546d1c8e7496a8be3e8bb284beacac
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Nov 25 14:39:02 2015

UPSTREAM: drm: Drop dev->event_lock spinlock around faulting copy_to_user()

In

commit cdd1cf799bd24ac0a4184549601ae302267301c5
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 4 21:03:25 2014 +0000

    drm: Make drm_read() more robust against multithreaded races

I fixed the races by serialising the use of the event by extending the
dev->event_lock. However, as Thomas pointed out, the copy_to_user() may
fault (even the __copy_to_user_inatomic() variant used here) and calling
into the driver backend with the spinlock held is bad news. Therefore we
have to drop the spinlock before the copy, but that exposes us to the
old race whereby a second reader could see an out-of-order event (as the
first reader may claim the first request but fail to copy it back to
userspace and so on returning it to the event list it will be behind the
current event being copied by the second reader).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reported-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448462343-2072-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 83eb64c85b80959549c114365016276f318afeb2)

Change-Id: I9dc47f8a501743559c08c8274c993e1c395d33db
Reviewed-on: https://chromium-review.googlesource.com/393346
Commit-Ready: Dominik Behr <dbehr@chromium.org>
Tested-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/5d8dfd4c47546d1c8e7496a8be3e8bb284beacac/drivers/gpu/drm/drm_fops.c

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/3dda517ceba92a66d4fdd6d9fe3779a038df5629

commit 3dda517ceba92a66d4fdd6d9fe3779a038df5629
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Nov 25 14:39:03 2015

UPSTREAM: drm: Serialise multiple event readers

The previous patch reintroduced a race condition whereby a failure in
one reader may allow a second reader to see out-of-order events.
Introduce a mutex to serialise readers so that an event is completed in
its entirety before another reader may process an event. The two readers
may race against each other, but the events each retrieves are in the
correct order.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448462343-2072-2-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 9b2c0b7fb4ce79566d830d03ce7aa11cccc39f97)
Change-Id: I15b9763a5159de351af8c3a7d9283d4a89e5b1f6
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393347
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/3dda517ceba92a66d4fdd6d9fe3779a038df5629/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/3dda517ceba92a66d4fdd6d9fe3779a038df5629/include/drm/drmP.h

Project Member

Comment 3 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fdbf1f981e10f257c4ba09aef308130f6cc5f247

commit fdbf1f981e10f257c4ba09aef308130f6cc5f247
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:55 2016

UPSTREAM: drm: kerneldoc for drm_fops.c

Just prep work before I throw more drm_event refactorings on top.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-2-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
(cherry picked from commit bcb877e4dcf21c3ba486fd7cc563126f08c39b8a)
Change-Id: Idcd7de518280183d39d2865568593893a41feaaa
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393348
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/fdbf1f981e10f257c4ba09aef308130f6cc5f247/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/fdbf1f981e10f257c4ba09aef308130f6cc5f247/include/drm/drmP.h
[modify] https://crrev.com/fdbf1f981e10f257c4ba09aef308130f6cc5f247/Documentation/DocBook/gpu.tmpl

Project Member

Comment 4 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/00fb9269a0ad0f4c4847b39ab0058eb82ed63088

commit 00fb9269a0ad0f4c4847b39ab0058eb82ed63088
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:56 2016

UPSTREAM: drm: Add functions to setup/tear down drm_events.

An attempt at not spreading out the file_priv->event_space stuff out
quite so far and wide.  And I think fixes something in ipp_get_event()
that is broken (or if they are doing something more weird/subtle, then
breaks it in a fun way).

Based upon a patch from Rob Clark, rebased and polished.

v2: Spelling fixes (Alex).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-3-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
(cherry picked from commit 2dd500f1870e3d852488c9b30c4ecec91c6e2eea)
Change-Id: Ib73b37b454140eaad447955043f622c2f2d4a04e
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393349
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/00fb9269a0ad0f4c4847b39ab0058eb82ed63088/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/00fb9269a0ad0f4c4847b39ab0058eb82ed63088/include/drm/drmP.h
[modify] https://crrev.com/00fb9269a0ad0f4c4847b39ab0058eb82ed63088/drivers/gpu/drm/drm_atomic.c
[modify] https://crrev.com/00fb9269a0ad0f4c4847b39ab0058eb82ed63088/drivers/gpu/drm/drm_crtc.c

Project Member

Comment 5 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/6e0dbbf9dfd8495e16838a8572a66530544875f6

commit 6e0dbbf9dfd8495e16838a8572a66530544875f6
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:59 2016

UPSTREAM: drm: Create drm_send_event helpers

Use them in the core vblank code and exynos/vmwgfx drivers.

Note that the difference between wake_up_all and _interruptible in
vmwgfx doesn't matter since the only waiter is the core code in
drm_fops.c. And that is interruptible.

v2: Adjust existing kerneldoc too.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Acked-by: Daniel Stone <daniels@collabora.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Inki Dae <inki.dae@samsung.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-6-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Squash in compile fixup, spotted by 0-day.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit fb740cf2492cc1e8f2216bc5ad9f5b2c49a32752)
Change-Id: I36aeffafd09eb53237e5803ab8e0f4ac0bbd0145
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393350
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/drivers/gpu/drm/exynos/exynos_drm_g2d.c
[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/drivers/gpu/drm/exynos/exynos_drm_ipp.c
[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/drivers/gpu/drm/drm_irq.c
[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
[modify] https://crrev.com/6e0dbbf9dfd8495e16838a8572a66530544875f6/include/drm/drmP.h

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b30c527b0a8cd0011c89dcada8657f5f4b5c8dec

commit b30c527b0a8cd0011c89dcada8657f5f4b5c8dec
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Thu Jan 28 11:01:04 2016

UPSTREAM: drm/vblank: Use drm_event_reserve_init

Well we can't use that directly since that code must hold
dev->event_lock already. Extract an _unlocked version.

Embarrassingly I've totally forgotten about this patch and any kind of
event-based vblank wait totally blew up, killing the kernel.

v2: Pick the right base struct, someone didn't noticed that gcc was
unhappy. No bug since the addresses at least matched (Daniel Stone)

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453978864-1513-1-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 4020b220edb3419975c0d9322ee0e0c07e09f6bf)
Change-Id: I951edb8af50b243dfdadf8268558731f1e706466
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393351
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/b30c527b0a8cd0011c89dcada8657f5f4b5c8dec/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/b30c527b0a8cd0011c89dcada8657f5f4b5c8dec/include/drm/drmP.h
[modify] https://crrev.com/b30c527b0a8cd0011c89dcada8657f5f4b5c8dec/drivers/gpu/drm/drm_irq.c

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2d2c53542ad8934795afbd270a3f2ce6a01bbb13

commit 2d2c53542ad8934795afbd270a3f2ce6a01bbb13
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 25 21:16:43 2016

UPSTREAM: drm: Clean up pending events in the core

There's really no reason to not do so, instead of replicating this
for every use-case and every driver. Now we can't just nuke the events,
since that would still mean that all drm_event users would need to know
when that has happened, since calling e.g. drm_send_event isn't allowed
any more. Instead just unlink them from the file, and detect this case
and handle it appropriately in all functions.

v2: Adjust existing kerneldoc too.

v3: Improve wording of the kerneldoc and split out vblank cleanup (Laurent).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1453756616-28942-2-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 681047b48601841c8380abd406301648c3590592)
Change-Id: Ic27b80ec59d42f83256988facad18fe7f166692c
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393352
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/2d2c53542ad8934795afbd270a3f2ce6a01bbb13/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/2d2c53542ad8934795afbd270a3f2ce6a01bbb13/include/drm/drmP.h

Project Member

Comment 8 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/744bcce0c54ba79bf33f93020689e25f66e936f5

commit 744bcce0c54ba79bf33f93020689e25f66e936f5
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 25 21:16:44 2016

UPSTREAM: drm: Nuke vblank event file cleanup code

The core code now takes care of unlinking drm_events from the file in
a generic way, so this code isn't needed any more.

For those wondering where the drm_vblank_put went to: With the new
logic events only get unlinked, but still exist. Hence any resources
(like vblank counters) don't need to be released since the event user
will still process the event normally. In this case this is the
callsites of send_vblank_event, which of course already have a
drm_vblank_put.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453756616-28942-3-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 7eb98020b73e20ce18d3ed704d7b7988ddad5dfd)
Change-Id: I8444b8e6123be63091988d8f8d7b3fb7495e9cda
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393353
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/744bcce0c54ba79bf33f93020689e25f66e936f5/drivers/gpu/drm/drm_fops.c

Project Member

Comment 9 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/89692981f97a6f434875c72a644d2e51e5762902

commit 89692981f97a6f434875c72a644d2e51e5762902
Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Date: Wed Jun 01 22:06:35 2016

BACKPORT: drm/fence: add fence to drm_pending_event

Now a drm_pending_event can either send a real drm_event or signal a
fence, or both. It allow us to signal via fences when the buffer is
displayed on the screen. Which in turn means that the previous buffer
is not in use anymore and can be freed or sent back to another driver
for processing.

v2: Comments from Daniel Vetter
	- call fence_signal in drm_send_event_locked()
	- remove unneeded !e->event check

v3: Remove drm_pending_event->destroy to fix a leak when e->file_priv
is not set.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v2)
[danvet: fix one e->destroy in arcpgu due to rebasing.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464818821-5736-13-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 1b47aaf9a93a69a61f8cc5219fd9c758b8588a59)
Change-Id: I9e11a3d8d7bbc87d5572016329995bc91703e14c
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393354
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/drivers/gpu/drm/evdi/evdi_painter.c
[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/drivers/gpu/drm/nouveau/nouveau_usif.c
[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/include/drm/drmP.h
[modify] https://crrev.com/89692981f97a6f434875c72a644d2e51e5762902/drivers/gpu/drm/drm_atomic.c

Project Member

Comment 10 by bugdroid1@chromium.org, Oct 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/40917c5b8ded6378e937b57994f828078296295d

commit 40917c5b8ded6378e937b57994f828078296295d
Author: Christian König <christian.koenig@amd.com>
Date: Wed Jun 01 13:10:04 2016

BACKPORT: dma-buf/fence: add signal_on_any to the fence array v2

If @signal_on_any is true the fence array signals if any fence in the array
signals, otherwise it signals when all fences in the array signal.

v2: fix signaled test and add comment suggested by Chris Wilson.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Signed-off-by: Christian Knig <christian.koenig@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464786612-5010-4-git-send-email-deathsimple@vodafone.de
(cherry picked from commit f71045689656e307166f6d625fa13d8b75fb0523)
Change-Id: I5dc30d21ba23bba8a3c9a6de58851f501cd683fa
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393355
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/40917c5b8ded6378e937b57994f828078296295d/include/linux/fence-array.h
[modify] https://crrev.com/40917c5b8ded6378e937b57994f828078296295d/drivers/dma-buf/fence-array.c
[modify] https://crrev.com/40917c5b8ded6378e937b57994f828078296295d/drivers/gpu/drm/drm_atomic_helper.c

Project Member

Comment 11 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ba294d4792a17055f5d6967b629f01274b89bc60

commit ba294d4792a17055f5d6967b629f01274b89bc60
Author: Guenter Roeck <groeck@chromium.org>
Date: Sat Oct 08 10:32:50 2016

FIXUP: BACKPORT: drm/fence: add fence to drm_pending_event

The backport removed the delete callback from struct drm_pending_event
but missed a number of callers. This results in the following build errors
when building various images.

drivers/gpu/drm/vc4/vc4_crtc.c: In function vc4_cancel_page_flip:
drivers/gpu/drm/vc4/vc4_crtc.c:511:24: error:
	struct drm_pending_event has no member named destroy

drivers/gpu/drm/vmwgfx/vmwgfx_fence.c: In function vmw_event_fence_fpriv_gone:
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:841:8: error:
	struct drm_pending_event has no member named destroy

drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:
	In function vmw_event_fence_action_create:
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:1057:13: error:
	struct drm_pending_event has no member named destroy
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:1078:13: error:
	struct drm_pending_event has no member named destroy

drivers/gpu/drm/exynos/exynos_drm_drv.c: In function 'exynos_drm_postclose':
drivers/gpu/drm/exynos/exynos_drm_drv.c:387:4: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c:
	In function 'atmel_hlcdc_crtc_cancel_page_flip':
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c:294:14: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/exynos/exynos_drm_g2d.c:
	In function 'exynos_g2d_set_cmdlist_ioctl':
drivers/gpu/drm/exynos/exynos_drm_g2d.c:1117:10: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/exynos/exynos_drm_ipp.c: In function 'ipp_get_event':
drivers/gpu/drm/exynos/exynos_drm_ipp.c:651:9: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/omapdrm/omap_crtc.c: In function 'omap_crtc_complete_page_flip':
drivers/gpu/drm/omapdrm/omap_crtc.c:282:14: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/rcar-du/rcar_du_crtc.c:
	In function 'rcar_du_crtc_cancel_page_flip':
drivers/gpu/drm/rcar-du/rcar_du_crtc.c:299:14: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/shmobile/shmob_drm_crtc.c:
	In function 'shmob_drm_crtc_cancel_page_flip':
drivers/gpu/drm/shmobile/shmob_drm_crtc.c:455:14: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/tegra/dc.c: In function 'tegra_dc_cancel_page_flip':
drivers/gpu/drm/tegra/dc.c:1000:18: error:
	'struct drm_pending_event' has no member named 'destroy'

drivers/gpu/drm/tilcdc/tilcdc_crtc.c: In function 'tilcdc_crtc_cancel_page_flip':
drivers/gpu/drm/tilcdc/tilcdc_crtc.c:679:14: error:
	'struct drm_pending_event' has no member named 'destroy'

Remove the assignments to the no longer existing structure element,
and replace the callbacks with direct calls to kfree().

BUG= chromium:652865 ,  chromium:654094 
TEST=build x86_64:allmodconfig, arm:allmodconfig

Note for rebase to later kernels: Drop this and the associated backport.

Change-Id: Id857c22dca0fbdd1a761b1691e7a6ee92954d556
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/395631
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/tegra/dc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/exynos/exynos_drm_g2d.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/vc4/vc4_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/exynos/exynos_drm_drv.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/omapdrm/omap_crtc.c
[modify] https://crrev.com/ba294d4792a17055f5d6967b629f01274b89bc60/drivers/gpu/drm/exynos/exynos_drm_ipp.c

Comment 12 by tfiga@chromium.org, Oct 12 2016

Labels: Merge-Request-55
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 12 2016

Labels: merge-merged-release-R55-8872.B-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b2c8a24afdb26efb2681d42d79394d58e92cc597

commit b2c8a24afdb26efb2681d42d79394d58e92cc597
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Nov 25 14:39:02 2015

UPSTREAM: drm: Drop dev->event_lock spinlock around faulting copy_to_user()

In

commit cdd1cf799bd24ac0a4184549601ae302267301c5
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 4 21:03:25 2014 +0000

    drm: Make drm_read() more robust against multithreaded races

I fixed the races by serialising the use of the event by extending the
dev->event_lock. However, as Thomas pointed out, the copy_to_user() may
fault (even the __copy_to_user_inatomic() variant used here) and calling
into the driver backend with the spinlock held is bad news. Therefore we
have to drop the spinlock before the copy, but that exposes us to the
old race whereby a second reader could see an out-of-order event (as the
first reader may claim the first request but fail to copy it back to
userspace and so on returning it to the event list it will be behind the
current event being copied by the second reader).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reported-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448462343-2072-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 83eb64c85b80959549c114365016276f318afeb2)

Change-Id: I9dc47f8a501743559c08c8274c993e1c395d33db
Reviewed-on: https://chromium-review.googlesource.com/393346
Commit-Ready: Dominik Behr <dbehr@chromium.org>
Tested-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 5d8dfd4c47546d1c8e7496a8be3e8bb284beacac)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397019

[modify] https://crrev.com/b2c8a24afdb26efb2681d42d79394d58e92cc597/drivers/gpu/drm/drm_fops.c

Project Member

Comment 14 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/feb75188cda23111ddd85299f76a72ea90d4c001

commit feb75188cda23111ddd85299f76a72ea90d4c001
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Nov 25 14:39:03 2015

UPSTREAM: drm: Serialise multiple event readers

The previous patch reintroduced a race condition whereby a failure in
one reader may allow a second reader to see out-of-order events.
Introduce a mutex to serialise readers so that an event is completed in
its entirety before another reader may process an event. The two readers
may race against each other, but the events each retrieves are in the
correct order.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448462343-2072-2-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 9b2c0b7fb4ce79566d830d03ce7aa11cccc39f97)
Change-Id: I15b9763a5159de351af8c3a7d9283d4a89e5b1f6
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393347
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 3dda517ceba92a66d4fdd6d9fe3779a038df5629)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397020

[modify] https://crrev.com/feb75188cda23111ddd85299f76a72ea90d4c001/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/feb75188cda23111ddd85299f76a72ea90d4c001/include/drm/drmP.h

Project Member

Comment 15 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/51284cb8ec2cdc70a1537f4cfc551fd587cc4453

commit 51284cb8ec2cdc70a1537f4cfc551fd587cc4453
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:55 2016

UPSTREAM: drm: kerneldoc for drm_fops.c

Just prep work before I throw more drm_event refactorings on top.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-2-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
(cherry picked from commit bcb877e4dcf21c3ba486fd7cc563126f08c39b8a)
Change-Id: Idcd7de518280183d39d2865568593893a41feaaa
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393348
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit fdbf1f981e10f257c4ba09aef308130f6cc5f247)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397021

[modify] https://crrev.com/51284cb8ec2cdc70a1537f4cfc551fd587cc4453/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/51284cb8ec2cdc70a1537f4cfc551fd587cc4453/include/drm/drmP.h
[modify] https://crrev.com/51284cb8ec2cdc70a1537f4cfc551fd587cc4453/Documentation/DocBook/gpu.tmpl

Project Member

Comment 16 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/8206518090f233af268d898685603a5a92ccc83a

commit 8206518090f233af268d898685603a5a92ccc83a
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:56 2016

UPSTREAM: drm: Add functions to setup/tear down drm_events.

An attempt at not spreading out the file_priv->event_space stuff out
quite so far and wide.  And I think fixes something in ipp_get_event()
that is broken (or if they are doing something more weird/subtle, then
breaks it in a fun way).

Based upon a patch from Rob Clark, rebased and polished.

v2: Spelling fixes (Alex).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-3-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
(cherry picked from commit 2dd500f1870e3d852488c9b30c4ecec91c6e2eea)
Change-Id: Ib73b37b454140eaad447955043f622c2f2d4a04e
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393349
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 00fb9269a0ad0f4c4847b39ab0058eb82ed63088)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397022

[modify] https://crrev.com/8206518090f233af268d898685603a5a92ccc83a/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/8206518090f233af268d898685603a5a92ccc83a/include/drm/drmP.h
[modify] https://crrev.com/8206518090f233af268d898685603a5a92ccc83a/drivers/gpu/drm/drm_atomic.c
[modify] https://crrev.com/8206518090f233af268d898685603a5a92ccc83a/drivers/gpu/drm/drm_crtc.c

Project Member

Comment 17 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bcbefdae01cb6f5002a62642870ed83390df1a64

commit bcbefdae01cb6f5002a62642870ed83390df1a64
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 11 21:40:59 2016

UPSTREAM: drm: Create drm_send_event helpers

Use them in the core vblank code and exynos/vmwgfx drivers.

Note that the difference between wake_up_all and _interruptible in
vmwgfx doesn't matter since the only waiter is the core code in
drm_fops.c. And that is interruptible.

v2: Adjust existing kerneldoc too.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Acked-by: Daniel Stone <daniels@collabora.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Inki Dae <inki.dae@samsung.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-6-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Squash in compile fixup, spotted by 0-day.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit fb740cf2492cc1e8f2216bc5ad9f5b2c49a32752)
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393350
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

(cherry picked from commit 6e0dbbf9dfd8495e16838a8572a66530544875f6)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Change-Id: I36aeffafd09eb53237e5803ab8e0f4ac0bbd0145
Reviewed-on: https://chromium-review.googlesource.com/397023

[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/drivers/gpu/drm/exynos/exynos_drm_g2d.c
[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/drivers/gpu/drm/exynos/exynos_drm_ipp.c
[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/drivers/gpu/drm/drm_irq.c
[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
[modify] https://crrev.com/bcbefdae01cb6f5002a62642870ed83390df1a64/include/drm/drmP.h

Project Member

Comment 18 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/06c9ff1036e84d7636a476413c994fc3465d8b59

commit 06c9ff1036e84d7636a476413c994fc3465d8b59
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Thu Jan 28 11:01:04 2016

UPSTREAM: drm/vblank: Use drm_event_reserve_init

Well we can't use that directly since that code must hold
dev->event_lock already. Extract an _unlocked version.

Embarrassingly I've totally forgotten about this patch and any kind of
event-based vblank wait totally blew up, killing the kernel.

v2: Pick the right base struct, someone didn't noticed that gcc was
unhappy. No bug since the addresses at least matched (Daniel Stone)

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453978864-1513-1-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 4020b220edb3419975c0d9322ee0e0c07e09f6bf)
Change-Id: I951edb8af50b243dfdadf8268558731f1e706466
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393351
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit b30c527b0a8cd0011c89dcada8657f5f4b5c8dec)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397024

[modify] https://crrev.com/06c9ff1036e84d7636a476413c994fc3465d8b59/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/06c9ff1036e84d7636a476413c994fc3465d8b59/include/drm/drmP.h
[modify] https://crrev.com/06c9ff1036e84d7636a476413c994fc3465d8b59/drivers/gpu/drm/drm_irq.c

Project Member

Comment 19 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a220b611719e204e99ad0954ff13cb7613c4e707

commit a220b611719e204e99ad0954ff13cb7613c4e707
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 25 21:16:43 2016

UPSTREAM: drm: Clean up pending events in the core

There's really no reason to not do so, instead of replicating this
for every use-case and every driver. Now we can't just nuke the events,
since that would still mean that all drm_event users would need to know
when that has happened, since calling e.g. drm_send_event isn't allowed
any more. Instead just unlink them from the file, and detect this case
and handle it appropriately in all functions.

v2: Adjust existing kerneldoc too.

v3: Improve wording of the kerneldoc and split out vblank cleanup (Laurent).

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1453756616-28942-2-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 681047b48601841c8380abd406301648c3590592)
Change-Id: Ic27b80ec59d42f83256988facad18fe7f166692c
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393352
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 2d2c53542ad8934795afbd270a3f2ce6a01bbb13)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397025

[modify] https://crrev.com/a220b611719e204e99ad0954ff13cb7613c4e707/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/a220b611719e204e99ad0954ff13cb7613c4e707/include/drm/drmP.h

Project Member

Comment 20 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/7cb95e6dd83072052c745e6538d56a483369b7a0

commit 7cb95e6dd83072052c745e6538d56a483369b7a0
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jan 25 21:16:44 2016

UPSTREAM: drm: Nuke vblank event file cleanup code

The core code now takes care of unlinking drm_events from the file in
a generic way, so this code isn't needed any more.

For those wondering where the drm_vblank_put went to: With the new
logic events only get unlinked, but still exist. Hence any resources
(like vblank counters) don't need to be released since the event user
will still process the event normally. In this case this is the
callsites of send_vblank_event, which of course already have a
drm_vblank_put.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453756616-28942-3-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 7eb98020b73e20ce18d3ed704d7b7988ddad5dfd)
Change-Id: I8444b8e6123be63091988d8f8d7b3fb7495e9cda
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393353
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 744bcce0c54ba79bf33f93020689e25f66e936f5)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397026

[modify] https://crrev.com/7cb95e6dd83072052c745e6538d56a483369b7a0/drivers/gpu/drm/drm_fops.c

Project Member

Comment 21 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406

commit 7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406
Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Date: Wed Jun 01 22:06:35 2016

BACKPORT: drm/fence: add fence to drm_pending_event

Now a drm_pending_event can either send a real drm_event or signal a
fence, or both. It allow us to signal via fences when the buffer is
displayed on the screen. Which in turn means that the previous buffer
is not in use anymore and can be freed or sent back to another driver
for processing.

v2: Comments from Daniel Vetter
	- call fence_signal in drm_send_event_locked()
	- remove unneeded !e->event check

v3: Remove drm_pending_event->destroy to fix a leak when e->file_priv
is not set.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v2)
[danvet: fix one e->destroy in arcpgu due to rebasing.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464818821-5736-13-git-send-email-daniel.vetter@ffwll.ch
(cherry picked from commit 1b47aaf9a93a69a61f8cc5219fd9c758b8588a59)
Change-Id: I9e11a3d8d7bbc87d5572016329995bc91703e14c
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393354
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 89692981f97a6f434875c72a644d2e51e5762902)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397027

[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/drivers/gpu/drm/evdi/evdi_painter.c
[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/drivers/gpu/drm/nouveau/nouveau_usif.c
[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/drivers/gpu/drm/drm_fops.c
[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/include/drm/drmP.h
[modify] https://crrev.com/7c45cb20e972ebc1c7a3c9f579e41bc0bc3ba406/drivers/gpu/drm/drm_atomic.c

Project Member

Comment 22 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c5cc659ae9af20d1534e0c8f8d440b9b5f812ef2

commit c5cc659ae9af20d1534e0c8f8d440b9b5f812ef2
Author: Christian König <christian.koenig@amd.com>
Date: Wed Jun 01 13:10:04 2016

BACKPORT: dma-buf/fence: add signal_on_any to the fence array v2

If @signal_on_any is true the fence array signals if any fence in the array
signals, otherwise it signals when all fences in the array signal.

v2: fix signaled test and add comment suggested by Chris Wilson.

BUG= chromium:652865 
TEST=build and run kernel 4.4 on kevin

Signed-off-by: Christian Knig <christian.koenig@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464786612-5010-4-git-send-email-deathsimple@vodafone.de
(cherry picked from commit f71045689656e307166f6d625fa13d8b75fb0523)
Change-Id: I5dc30d21ba23bba8a3c9a6de58851f501cd683fa
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393355
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 40917c5b8ded6378e937b57994f828078296295d)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/397028

[modify] https://crrev.com/c5cc659ae9af20d1534e0c8f8d440b9b5f812ef2/include/linux/fence-array.h
[modify] https://crrev.com/c5cc659ae9af20d1534e0c8f8d440b9b5f812ef2/drivers/dma-buf/fence-array.c
[modify] https://crrev.com/c5cc659ae9af20d1534e0c8f8d440b9b5f812ef2/drivers/gpu/drm/drm_atomic_helper.c

Comment 23 by tfiga@chromium.org, Oct 12 2016

Merged tentatively for Kevin.
Labels: OS-Chrome
This seems to be specific to Chrome OS so applying Chrome OS label.

Comment 25 by dimu@chromium.org, Oct 13 2016

Labels: -Merge-Request-55 Merge-Approved-55 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M55 (branch: 2883)
Project Member

Comment 26 by sheriffbot@chromium.org, Oct 16 2016

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 27 by sheriffbot@chromium.org, Oct 20 2016

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 28 by sheriffbot@chromium.org, Dec 1 2016

Labels: -Merge-Approved-55
This issue hasn't been updated in the last 6 weeks, so removing its merge approval label. Please re-request a merge if needed.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Fixed (was: Started)
So we have implicit in-fence and it works, but we are switching to explicit in-fence. Chrome does not really need out-fence either because it doesnt render to buffers that are being displayed because it pays attention to drm events. So out-fences are not necessary now and will not be really needed in the future. So lets close this bug.

Comment 30 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Comment 31 by dchan@chromium.org, Jan 23 2018

Status: Fixed (was: Archived)

Sign in to add a comment