From a95ea2b6d66b4b3e5087a119db92162a850c5643 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 1 Nov 2023 09:46:04 -0700 Subject: [PATCH] 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 Part-of: --- 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