drm/vmwgfx: Implement create_handle on drm_framebuffer_funcs
authorZack Rusin <zackr@vmware.com>
Mon, 6 Dec 2021 17:26:13 +0000 (12:26 -0500)
committerZack Rusin <zackr@vmware.com>
Thu, 9 Dec 2021 18:16:21 +0000 (13:16 -0500)
The fb handle code assumes it deals with GEM objects. Because vmwgfx
buffer objects were not actually GEM objects we were not able to
implement that interface. Now that vmwgfx supports GEM buffer objects
we can trivially implement create_handle for buffer object backed
framebuffers.
Among others this gets IGT's kms_getfb test passing.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Martin Krastev <krastevm@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211206172620.3139754-6-zack@kde.org
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

index b4bbb5c..4e693e8 100644 (file)
@@ -987,6 +987,16 @@ out_err1:
  * Buffer-object framebuffer code
  */
 
+static int vmw_framebuffer_bo_create_handle(struct drm_framebuffer *fb,
+                                           struct drm_file *file_priv,
+                                           unsigned int *handle)
+{
+       struct vmw_framebuffer_bo *vfbd =
+                       vmw_framebuffer_to_vfbd(fb);
+
+       return drm_gem_handle_create(file_priv, &vfbd->buffer->base.base, handle);
+}
+
 static void vmw_framebuffer_bo_destroy(struct drm_framebuffer *framebuffer)
 {
        struct vmw_framebuffer_bo *vfbd =
@@ -1059,6 +1069,7 @@ static int vmw_framebuffer_bo_dirty_ext(struct drm_framebuffer *framebuffer,
 }
 
 static const struct drm_framebuffer_funcs vmw_framebuffer_bo_funcs = {
+       .create_handle = vmw_framebuffer_bo_create_handle,
        .destroy = vmw_framebuffer_bo_destroy,
        .dirty = vmw_framebuffer_bo_dirty_ext,
 };