Module: Mesa Branch: main Commit: a95ea2b6d66b4b3e5087a119db92162a850c5643 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a95ea2b6d66b4b3e5087a119db92162a850c5643
Author: Rob Clark <[email protected]> Date: Wed Nov 1 09:46:04 2023 -0700 freedreno: Fix modifier determination Now that we have TILED2 and TILED3 modifiers, we should handle those cases. Fixes assert that modifier != INVALID in spec@ext_image_dma_buf_import@ext_image_dma_buf_import-modifiers Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25995> --- src/gallium/drivers/freedreno/freedreno_resource.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index a57807071f7..b981a5612a7 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -1082,14 +1082,15 @@ fd_resource_destroy(struct pipe_screen *pscreen, struct pipe_resource *prsc) static uint64_t fd_resource_modifier(struct fd_resource *rsc) { - if (!rsc->layout.tile_mode) - return DRM_FORMAT_MOD_LINEAR; - if (rsc->layout.ubwc_layer_size) return DRM_FORMAT_MOD_QCOM_COMPRESSED; - /* TODO invent a modifier for tiled but not UBWC buffers: */ - return DRM_FORMAT_MOD_INVALID; + switch (rsc->layout.tile_mode) { + case 3: return DRM_FORMAT_MOD_QCOM_TILED3; + case 2: return DRM_FORMAT_MOD_QCOM_TILED2; + case 0: return DRM_FORMAT_MOD_LINEAR; + default: return DRM_FORMAT_MOD_INVALID; + } } static bool
