From d5a3a2d2fbc42da04ff7ea09356ada134a42d6dd Mon Sep 17 00:00:00 2001 From: Christopher James Halse Rogers Date: Thu, 21 Nov 2013 15:11:39 +1100 Subject: gallium/winsys/drm: Prepare for passing prime fds in winsys_handle Signed-off-by: Christopher James Halse Rogers Reviewed-by: Thomas Hellstrom Signed-off-by: Maarten Lankhorst --- src/gallium/winsys/i915/drm/i915_drm_buffer.c | 6 +++++- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 6 ++++++ src/gallium/winsys/svga/drm/vmw_screen_dri.c | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c index ac66af333df..38e06193c61 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c @@ -95,9 +95,13 @@ i915_drm_buffer_from_handle(struct i915_winsys *iws, unsigned *stride) { struct i915_drm_winsys *idws = i915_drm_winsys(iws); - struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer); + struct i915_drm_buffer *buf; uint32_t tile = 0, swizzle = 0; + if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) + return NULL; + + buf = CALLOC_STRUCT(i915_drm_buffer); if (!buf) return NULL; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 3019a525cf8..744df1b745e 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -877,6 +877,9 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws, memset(&open_arg, 0, sizeof(open_arg)); + if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) + return NULL; + /* We must maintain a list of pairs , so that we always return * the same BO for one particular handle. If we didn't do that and created * more than one BO for the same handle and then relocated them in a CS, @@ -991,6 +994,9 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer, whandle->handle = bo->flink; } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) { whandle->handle = bo->handle; + } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) { + /* TODO: Implement */ + return FALSE; } whandle->stride = stride; diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c index 511cca73aea..6323a8ae2c4 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c @@ -163,6 +163,12 @@ vmw_drm_surface_from_handle(struct svga_winsys_screen *sws, int ret; int i; + if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) { + vmw_error("Attempt to import unknown handle type %d\n", + whandle->type); + return NULL; + } + /** * The vmware device specific handle is the hardware SID. * FIXME: We probably want to move this to the ioctl implementations. -- cgit v1.2.3