iris: Use resource_get_param in resource_get_handle

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 <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28258>
This commit is contained in:
Nanley Chery 2023-08-03 12:06:43 -04:00 committed by Marge Bot
parent bf1008ac28
commit 831703157e

View file

@ -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 =