From c060f291c26ac22721a515c78c7a4779f389ff7e Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 8 Sep 2016 15:55:03 -0400 Subject: i915g: add dma-buf support to i915_drm_buffer_get_handle The implementation of i915_drm_buffer_get_handle now handles DRM_API_HANDLE_TYPE_FD in the same way that intel_winsys_import_handle does, by calling drm_intel_bo_gem_create_from_prime. Tested by successfully running Chrome's ozone_demo [1] with the ozone-gbm backend on an Intel Pineview M machine. Without this change it fails while trying to create a DMA-BUF. [1] https://chromium.googlesource.com/chromium/src.git/+/master/ui/ozone/demo/ozone_demo.cc Signed-off-by: Nicholas Bishop [Emil Velikov: Fix coding style] Signed-off-by: Emil Velikov --- src/gallium/winsys/i915/drm/i915_drm_buffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c index ba454ecf54c..890f7dc2833 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c @@ -153,6 +153,12 @@ i915_drm_buffer_get_handle(struct i915_winsys *iws, whandle->handle = buf->flink; } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) { whandle->handle = buf->bo->handle; + } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) { + int fd; + + if (drm_intel_bo_gem_export_to_prime(buf->bo, &fd)) + return FALSE; + whandle->handle = fd; } else { assert(!"unknown usage"); return FALSE; -- cgit v1.2.3