This fixes the DRM_IOCTL_MODE_GETFB ioctl for cirrus so that it
returns an actual handle instead of failing with ENODEV.

Tested in a QEMU VM with "-vga cirrus" by running this script:

https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/bin/screenshot.py

Implementation cargo-culted from radeon_user_framebuffer_create_handle().

Signed-off-by: Nicholas Bishop <nbis...@neverware.com>
---
 drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index e7fc95f..2b0b27b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -23,8 +23,18 @@ static void cirrus_user_framebuffer_destroy(struct 
drm_framebuffer *fb)
        kfree(fb);
 }
 
+static int cirrus_user_framebuffer_create_handle(struct drm_framebuffer *fb,
+                                                struct drm_file *file_priv,
+                                                unsigned int *handle)
+{
+       struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb);
+
+       return drm_gem_handle_create(file_priv, cirrus_fb->obj, handle);
+}
+
 static const struct drm_framebuffer_funcs cirrus_fb_funcs = {
        .destroy = cirrus_user_framebuffer_destroy,
+       .create_handle = cirrus_user_framebuffer_create_handle,
 };
 
 int cirrus_framebuffer_init(struct drm_device *dev,
-- 
2.9.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to