dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/prime: expose capability flags for userspace.
@ 2012-04-02 13:11 Dave Airlie
  2012-04-03 12:02 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2012-04-02 13:11 UTC (permalink / raw)
  To: dri-devel

From: Dave Airlie <airlied@redhat.com>

This lets the kernel tell userspace if the device supports prime
import/export.

This is useful for -modesetting at least, but would be nice for other
drivers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_ioctl.c |    4 ++++
 include/drm/drm.h           |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index cf85155..64a62c6 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -283,6 +283,10 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 	case DRM_CAP_DUMB_PREFER_SHADOW:
 		req->value = dev->mode_config.prefer_shadow;
 		break;
+	case DRM_CAP_PRIME:
+		req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0;
+		req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 64ff02d..34d6335 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -775,6 +775,10 @@ struct drm_event_vblank {
 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
 #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
 #define DRM_CAP_DUMB_PREFER_SHADOW 0x4
+#define DRM_CAP_PRIME 0x5
+
+#define DRM_PRIME_CAP_IMPORT 0x1
+#define DRM_PRIME_CAP_EXPORT 0x2
 
 /* typedef area */
 #ifndef __KERNEL__
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/prime: expose capability flags for userspace.
  2012-04-02 13:11 [PATCH] drm/prime: expose capability flags for userspace Dave Airlie
@ 2012-04-03 12:02 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2012-04-03 12:02 UTC (permalink / raw)
  To: Dave Airlie, dri-devel

On Mon,  2 Apr 2012 14:11:50 +0100, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This lets the kernel tell userspace if the device supports prime
> import/export.
> 
> This is useful for -modesetting at least, but would be nice for other
> drivers.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-03 12:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 13:11 [PATCH] drm/prime: expose capability flags for userspace Dave Airlie
2012-04-03 12:02 ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox