dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Bishop <nbishop@neverware.com>
To: dri-devel@lists.freedesktop.org
Cc: Nicholas Bishop <nbishop@neverware.com>
Subject: [PATCH] drm/cirrus: implement create_handle for framebuffers
Date: Thu, 18 May 2017 15:03:11 -0400	[thread overview]
Message-ID: <20170518190311.14391-1-nbishop@neverware.com> (raw)

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 <nbishop@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	other threads:[~2017-05-18 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 19:03 Nicholas Bishop [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-05-18 20:28 [PATCH] drm/cirrus: implement create_handle for framebuffers Nicholas Bishop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170518190311.14391-1-nbishop@neverware.com \
    --to=nbishop@neverware.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).