Mesa (master): nouveau: Support DRI Image 7 extension

Maarten Lankhorst mlankhorst at kemper.freedesktop.org
Tue Dec 10 08:53:19 UTC 2013


Module: Mesa
Branch: master
Commit: 3e680de1eb22db6afed58c1ac72ec31504538057
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e680de1eb22db6afed58c1ac72ec31504538057

Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Thu Nov 21 15:11:42 2013 +1100

nouveau: Support DRI Image 7 extension

Reviewed-by: Thomas Hellstrom <thellstrom at vmware.com>
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

---

 src/gallium/drivers/nouveau/nouveau_screen.c |   11 +++++++++--
 src/gallium/targets/dri-nouveau/target.c     |   18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 248d164..21b31e0 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -86,13 +86,18 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
 	struct nouveau_bo *bo = 0;
 	int ret;
 
-	if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) {
+	if (whandle->type != DRM_API_HANDLE_TYPE_SHARED &&
+	    whandle->type != DRM_API_HANDLE_TYPE_FD) {
 		debug_printf("%s: attempt to import unsupported handle type %d\n",
 			     __FUNCTION__, whandle->type);
 		return NULL;
 	}
 
-	ret = nouveau_bo_name_ref(dev, whandle->handle, &bo);
+	if (whandle->type == DRM_API_HANDLE_TYPE_SHARED)
+		ret = nouveau_bo_name_ref(dev, whandle->handle, &bo);
+	else
+		ret = nouveau_bo_prime_handle_ref(dev, whandle->handle, &bo);
+
 	if (ret) {
 		debug_printf("%s: ref name 0x%08x failed with %d\n",
 			     __FUNCTION__, whandle->handle, ret);
@@ -117,6 +122,8 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
 	} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
 		whandle->handle = bo->handle;
 		return TRUE;
+	} else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
+		return nouveau_bo_set_prime(bo, &whandle->handle) == 0;
 	} else {
 		return FALSE;
 	}
diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c
index c0d7f92..f0fcdd8 100644
--- a/src/gallium/targets/dri-nouveau/target.c
+++ b/src/gallium/targets/dri-nouveau/target.c
@@ -17,4 +17,20 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_SHARE_FD:
+      return &share_fd_ret;
+   default:
+      break;
+   }
+   return NULL;
+}
+
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, drm_configuration)




More information about the mesa-commit mailing list