Skip to content

Commit 3d50e61

Browse files
vivekkreddydigetx
authored andcommitted
drm/virtio: Fix flickering issue seen with imported dmabufs
We need to save the reservation object pointer associated with the imported dmabuf in the newly created GEM object to allow drm_gem_plane_helper_prepare_fb() to extract the exclusive fence from it and attach it to the plane state during prepare phase. This is needed to ensure that drm_atomic_helper_wait_for_fences() correctly waits for the relevant fences (move, etc) associated with the reservation object, thereby implementing proper synchronization. Otherwise, artifacts or slight flickering can be seen when apps are dragged across the screen when running Gnome (Wayland). This problem is mostly seen with dGPUs in the case where the FBs are allocated in VRAM but need to be migrated to System RAM as they are shared with virtio-gpu. Fixes: ca77f27 ("drm/virtio: Import prime buffers from other devices as guest blobs") Cc: Gerd Hoffmann <[email protected]> Cc: Dmitry Osipenko <[email protected]> Cc: Gurchetan Singh <[email protected]> Cc: Chia-I Wu <[email protected]> Signed-off-by: Vivek Kasireddy <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> [[email protected]: Moved assignment before object_init()] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a5b230e commit 3d50e61

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/virtio/virtgpu_prime.c

+1
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ struct drm_gem_object *virtgpu_gem_prime_import(struct drm_device *dev,
319319
return ERR_PTR(-ENOMEM);
320320

321321
obj = &bo->base.base;
322+
obj->resv = buf->resv;
322323
obj->funcs = &virtgpu_gem_dma_buf_funcs;
323324
drm_gem_private_object_init(dev, obj, buf->size);
324325

0 commit comments

Comments
 (0)