Commit 3a1fde58 authored by Vivek Kasireddy's avatar Vivek Kasireddy Committed by Gerd Hoffmann

drm/virtio: Add fences for Guest blobs

Add prepare and cleanup routines for primary planes as well
where a fence is added only if the BO/FB associated with the
plane is a guest blob.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210610232456.671905-2-vivek.kasireddy@intel.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 2e717a55
...@@ -206,8 +206,8 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ...@@ -206,8 +206,8 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
virtio_gpu_notify(vgdev); virtio_gpu_notify(vgdev);
} }
static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane, static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state) struct drm_plane_state *new_state)
{ {
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
...@@ -219,7 +219,10 @@ static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane, ...@@ -219,7 +219,10 @@ static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
vgfb = to_virtio_gpu_framebuffer(new_state->fb); vgfb = to_virtio_gpu_framebuffer(new_state->fb);
bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
if (bo && bo->dumb && (plane->state->fb != new_state->fb)) { if (!bo || (plane->type == DRM_PLANE_TYPE_PRIMARY && !bo->guest_blob))
return 0;
if (bo->dumb && (plane->state->fb != new_state->fb)) {
vgfb->fence = virtio_gpu_fence_alloc(vgdev); vgfb->fence = virtio_gpu_fence_alloc(vgdev);
if (!vgfb->fence) if (!vgfb->fence)
return -ENOMEM; return -ENOMEM;
...@@ -228,8 +231,8 @@ static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane, ...@@ -228,8 +231,8 @@ static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
return 0; return 0;
} }
static void virtio_gpu_cursor_cleanup_fb(struct drm_plane *plane, static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_framebuffer *vgfb;
...@@ -321,13 +324,15 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, ...@@ -321,13 +324,15 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
} }
static const struct drm_plane_helper_funcs virtio_gpu_primary_helper_funcs = { static const struct drm_plane_helper_funcs virtio_gpu_primary_helper_funcs = {
.prepare_fb = virtio_gpu_plane_prepare_fb,
.cleanup_fb = virtio_gpu_plane_cleanup_fb,
.atomic_check = virtio_gpu_plane_atomic_check, .atomic_check = virtio_gpu_plane_atomic_check,
.atomic_update = virtio_gpu_primary_plane_update, .atomic_update = virtio_gpu_primary_plane_update,
}; };
static const struct drm_plane_helper_funcs virtio_gpu_cursor_helper_funcs = { static const struct drm_plane_helper_funcs virtio_gpu_cursor_helper_funcs = {
.prepare_fb = virtio_gpu_cursor_prepare_fb, .prepare_fb = virtio_gpu_plane_prepare_fb,
.cleanup_fb = virtio_gpu_cursor_cleanup_fb, .cleanup_fb = virtio_gpu_plane_cleanup_fb,
.atomic_check = virtio_gpu_plane_atomic_check, .atomic_check = virtio_gpu_plane_atomic_check,
.atomic_update = virtio_gpu_cursor_plane_update, .atomic_update = virtio_gpu_cursor_plane_update,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment