diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.c b/src/gallium/drivers/crocus/crocus_bufmgr.c index caca821cd7e..68e8453f581 100644 --- a/src/gallium/drivers/crocus/crocus_bufmgr.c +++ b/src/gallium/drivers/crocus/crocus_bufmgr.c @@ -1219,7 +1219,7 @@ crocus_bo_get_tiling(struct crocus_bo *bo, uint32_t *tiling_mode, struct crocus_bo * crocus_bo_import_dmabuf(struct crocus_bufmgr *bufmgr, int prime_fd, - uint32_t tiling, uint32_t stride) + uint32_t tiling) { uint32_t handle; struct crocus_bo *bo; @@ -1265,18 +1265,17 @@ crocus_bo_import_dmabuf(struct crocus_bufmgr *bufmgr, int prime_fd, bo->gem_handle = handle; _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo); - struct drm_i915_gem_get_tiling get_tiling = { .handle = bo->gem_handle }; - if (intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling)) - goto err; - - if (get_tiling.tiling_mode == tiling || tiling > I915_TILING_LAST) { - bo->tiling_mode = get_tiling.tiling_mode; - bo->swizzle_mode = get_tiling.swizzle_mode; - /* XXX stride is unknown */ - } else { - if (bo_set_tiling_internal(bo, tiling, stride)) { + if (tiling != -1) { + /* Modifiers path */ + bo->tiling_mode = tiling; + } else if (bufmgr->has_tiling_uapi) { + struct drm_i915_gem_get_tiling get_tiling = { .handle = bo->gem_handle }; + if (intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling)) goto err; - } + + bo->tiling_mode = get_tiling.tiling_mode; + } else { + bo->tiling_mode = I915_TILING_NONE; } out: diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.h b/src/gallium/drivers/crocus/crocus_bufmgr.h index 8bb328fdeae..52b6d58a078 100644 --- a/src/gallium/drivers/crocus/crocus_bufmgr.h +++ b/src/gallium/drivers/crocus/crocus_bufmgr.h @@ -306,8 +306,7 @@ void crocus_destroy_hw_context(struct crocus_bufmgr *bufmgr, uint32_t ctx_id); int crocus_bo_export_dmabuf(struct crocus_bo *bo, int *prime_fd); struct crocus_bo *crocus_bo_import_dmabuf(struct crocus_bufmgr *bufmgr, - int prime_fd, uint32_t tiling, - uint32_t stride); + int prime_fd, uint32_t tiling); /** * Exports a bo as a GEM handle into a given DRM file descriptor diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c index b5bf5a42e1a..bb67d6f5377 100644 --- a/src/gallium/drivers/crocus/crocus_resource.c +++ b/src/gallium/drivers/crocus/crocus_resource.c @@ -868,7 +868,7 @@ crocus_resource_from_handle(struct pipe_screen *pscreen, else tiling = I915_TILING_LAST + 1; res->bo = crocus_bo_import_dmabuf(bufmgr, whandle->handle, - tiling, whandle->stride); + tiling); break; case WINSYS_HANDLE_TYPE_SHARED: res->bo = crocus_bo_gem_create_from_name(bufmgr, "winsys image",