From 831703157e7b272fcd1d36de2b3bcc8d5ec7d500 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Thu, 3 Aug 2023 12:06:43 -0400 Subject: [PATCH] iris: Use resource_get_param in resource_get_handle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor iris_resource_get_handle to use iris_resource_get_param to pick up the fix from the previous patch. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9994 Reviewed-by: Tapani Pälli Part-of: --- src/gallium/drivers/iris/iris_resource.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index a4d279db09a..ae29911a6ef 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1777,21 +1777,28 @@ iris_resource_get_handle(struct pipe_screen *pscreen, isl_drm_modifier_plane_is_clear_color(res->mod_info->modifier, whandle->plane)) { bo = res->aux.clear_color_bo; - whandle->offset = res->aux.clear_color_offset; } else if (mod_with_aux && whandle->plane > 0) { bo = res->aux.bo; - whandle->stride = res->aux.surf.row_pitch_B; - whandle->offset = res->aux.offset; } else { - /* If this is a buffer, stride should be 0 - no need to special case */ - whandle->stride = res->surf.row_pitch_B; bo = res->bo; } + uint64_t stride; + iris_resource_get_param(pscreen, ctx, resource, whandle->plane, 0, 0, + PIPE_RESOURCE_PARAM_STRIDE, usage, &stride); + + uint64_t offset; + iris_resource_get_param(pscreen, ctx, resource, whandle->plane, 0, 0, + PIPE_RESOURCE_PARAM_OFFSET, usage, &offset); + + uint64_t modifier; + iris_resource_get_param(pscreen, ctx, resource, whandle->plane, 0, 0, + PIPE_RESOURCE_PARAM_MODIFIER, usage, &modifier); + + whandle->stride = stride; + whandle->offset = offset; + whandle->modifier = modifier; whandle->format = res->external_format; - whandle->modifier = - res->mod_info ? res->mod_info->modifier - : tiling_to_modifier(isl_tiling_to_i915_tiling(res->surf.tiling)); #ifndef NDEBUG enum isl_aux_usage allowed_usage =