mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-20 05:50:27 +01:00
iris: Don't call SET_TILING for dmabuf imports
Calling SET_TILING on a DMA buffer with the gen12 CCS modifier can fail unnecessarily. The main surface in the BO is Y-tiled, but the CCS portion is linear and can have a stride that's not a multiple of 128B. Because SET_TILING is called on the CCS plane with I915_TILING_Y, the ioctl will sometimes reject the stride. SET_TILING was originally used inb6d45e7f74to fix an assertion failure in iris_resource_from_handle. Assigning the BO's tiling_mode field is sufficient to avoid the failure. Fixes:c19492bcdb("iris: Handle importing aux-enabled surfaces on TGL") Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6296>
This commit is contained in:
parent
0c97e601a4
commit
c111e9099c
3 changed files with 11 additions and 18 deletions
|
|
@ -1381,7 +1381,7 @@ bo_set_tiling_internal(struct iris_bo *bo, uint32_t tiling_mode,
|
|||
|
||||
struct iris_bo *
|
||||
iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
|
||||
int tiling, uint32_t stride)
|
||||
int tiling)
|
||||
{
|
||||
uint32_t handle;
|
||||
struct iris_bo *bo;
|
||||
|
|
@ -1441,23 +1441,16 @@ iris_bo_import_dmabuf(struct iris_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 (!bufmgr->has_tiling_uapi)
|
||||
get_tiling.tiling_mode = I915_TILING_NONE;
|
||||
else if (gen_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling))
|
||||
goto err;
|
||||
|
||||
if (tiling == -1) {
|
||||
bo->tiling_mode = get_tiling.tiling_mode;
|
||||
/* XXX stride is unknown */
|
||||
} else {
|
||||
if (tiling != -1) {
|
||||
/* Modifiers path */
|
||||
if (get_tiling.tiling_mode == tiling || !bufmgr->has_tiling_uapi) {
|
||||
bo->tiling_mode = tiling;
|
||||
bo->stride = stride;
|
||||
} else if (bo_set_tiling_internal(bo, tiling, stride)) {
|
||||
bo->tiling_mode = tiling;
|
||||
} else if (bufmgr->has_tiling_uapi) {
|
||||
struct drm_i915_gem_get_tiling get_tiling = { .handle = bo->gem_handle };
|
||||
if (gen_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:
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ void iris_destroy_hw_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id);
|
|||
|
||||
int iris_bo_export_dmabuf(struct iris_bo *bo, int *prime_fd);
|
||||
struct iris_bo *iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
|
||||
int tiling, uint32_t stride);
|
||||
int tiling);
|
||||
|
||||
/**
|
||||
* Exports a bo as a GEM handle into a given DRM file descriptor
|
||||
|
|
|
|||
|
|
@ -1046,7 +1046,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
|
|||
else
|
||||
tiling = -1;
|
||||
res->bo = iris_bo_import_dmabuf(bufmgr, whandle->handle,
|
||||
tiling, whandle->stride);
|
||||
tiling);
|
||||
break;
|
||||
case WINSYS_HANDLE_TYPE_SHARED:
|
||||
res->bo = iris_bo_gem_create_from_name(bufmgr, "winsys image",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue