diff options
-rw-r--r-- | src/gallium/auxiliary/target-helpers/inline_drm_helper.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_resource_texture.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_winsys.h | 1 | ||||
-rw-r--r-- | src/gallium/targets/pipe-loader/pipe_i915.c | 25 | ||||
-rw-r--r-- | src/gallium/winsys/i915/drm/i915_drm_buffer.c | 15 |
5 files changed, 38 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h index 54c1c6c3259..542ad438790 100644 --- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h @@ -430,7 +430,7 @@ dd_configuration(enum drm_conf conf) #if defined(GALLIUM_I915) if (strcmp(driver_name, "i915") == 0) - return NULL; + return configuration_query(conf); else #endif #if defined(GALLIUM_ILO) diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 36fb3e28a75..dc8f4d1c903 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -989,7 +989,7 @@ i915_texture_from_handle(struct pipe_screen * screen, assert(screen); - buffer = iws->buffer_from_handle(iws, whandle, &tiling, &stride); + buffer = iws->buffer_from_handle(iws, whandle, template->height0, &tiling, &stride); /* Only supports one type */ if ((template->target != PIPE_TEXTURE_2D && diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h index 6cf802fe073..509e6cca13b 100644 --- a/src/gallium/drivers/i915/i915_winsys.h +++ b/src/gallium/drivers/i915/i915_winsys.h @@ -176,6 +176,7 @@ struct i915_winsys { struct i915_winsys_buffer * (*buffer_from_handle)(struct i915_winsys *iws, struct winsys_handle *whandle, + unsigned height, enum i915_winsys_buffer_tile *tiling, unsigned *stride); diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c index 85662cb85b5..b0da6137f3d 100644 --- a/src/gallium/targets/pipe-loader/pipe_i915.c +++ b/src/gallium/targets/pipe-loader/pipe_i915.c @@ -23,5 +23,28 @@ create_screen(int fd) return screen; } +static const struct drm_conf_ret throttle_ret = { + .type = DRM_CONF_INT, + .val.val_int = 2, +}; + +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_THROTTLE: + return &throttle_ret; + case DRM_CONF_SHARE_FD: + return &share_fd_ret; + default: + break; + } + return NULL; +} + PUBLIC -DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL) +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, drm_configuration) 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; |