summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorStéphane Marchesin <marcheu@chromium.org>2015-04-01 20:00:08 -0700
committerStéphane Marchesin <marcheu@chromium.org>2015-04-01 20:13:37 -0700
commit70eed78cacd711e663068e78a8430372cc5fabf1 (patch)
tree39c1144a0cb29e0616ff75a3b06a5ae95f801ba0 /src/gallium/winsys
parenta03d0ba78f33e43df2ca7a9e4c58fdc9fbc9876a (diff)
downloadmesa-70eed78cacd711e663068e78a8430372cc5fabf1.tar.gz
mesa-70eed78cacd711e663068e78a8430372cc5fabf1.tar.bz2
mesa-70eed78cacd711e663068e78a8430372cc5fabf1.zip
i915g: Implement EGL_EXT_image_dma_buf_import
This adds all the plumbing to get EGL_EXT_image_dma_buf_import in i915g. Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_buffer.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 38e06193c61..c0698529e1c 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -1,4 +1,3 @@
-
#include "state_tracker/drm_driver.h"
#include "i915_drm_winsys.h"
#include "util/u_memory.h"
@@ -72,7 +71,7 @@ i915_drm_buffer_create_tiled(struct i915_winsys *iws,
buf->bo = drm_intel_bo_alloc_tiled(idws->gem_manager,
i915_drm_type_to_name(type),
- *stride, height, 1,
+ *stride, height, 1,
&tiling_mode, &pitch, 0);
if (!buf->bo)
@@ -91,6 +90,7 @@ err:
static struct i915_winsys_buffer *
i915_drm_buffer_from_handle(struct i915_winsys *iws,
struct winsys_handle *whandle,
+ unsigned height,
enum i915_winsys_buffer_tile *tiling,
unsigned *stride)
{
@@ -98,7 +98,7 @@ i915_drm_buffer_from_handle(struct i915_winsys *iws,
struct i915_drm_buffer *buf;
uint32_t tile = 0, swizzle = 0;
- if (whandle->type != DRM_API_HANDLE_TYPE_SHARED)
+ if ((whandle->type != DRM_API_HANDLE_TYPE_SHARED) && (whandle->type != DRM_API_HANDLE_TYPE_FD))
return NULL;
buf = CALLOC_STRUCT(i915_drm_buffer);
@@ -106,7 +106,14 @@ i915_drm_buffer_from_handle(struct i915_winsys *iws,
return NULL;
buf->magic = 0xDEAD1337;
- buf->bo = drm_intel_bo_gem_create_from_name(idws->gem_manager, "gallium3d_from_handle", whandle->handle);
+
+ if (whandle->type == DRM_API_HANDLE_TYPE_SHARED)
+ buf->bo = drm_intel_bo_gem_create_from_name(idws->gem_manager, "gallium3d_from_handle", whandle->handle);
+ else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
+ int fd = (int) whandle->handle;
+ buf->bo = drm_intel_bo_gem_create_from_prime(idws->gem_manager, fd, height * whandle->stride);
+ }
+
buf->flinked = TRUE;
buf->flink = whandle->handle;