summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/i915/drm/i915_drm_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/i915/drm/i915_drm_buffer.c')
-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;