freedreno/a6xx: Refactor handle import

Explicitly layout the resource in all cases, rather than depending on
the partial/incomplete layout that is done in fd_resource_from_handle()
(which will be going away).

Now that we are not YOLOing the layout, it turns up some questionable
assumptions in piglit.  Just mark those xfails for now.

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36075>
This commit is contained in:
Rob Clark
2025-07-11 07:23:07 -07:00
committed by Marge Bot
parent 27b0f64b3e
commit b4b1573258
5 changed files with 31 additions and 21 deletions
@@ -229,6 +229,10 @@ spec@arb_base_instance@arb_base_instance-drawarrays,Fail
spec@ext_base_instance@arb_base_instance-baseinstance-doesnt-affect-gl-instance-id_gles3,Fail
spec@ext_base_instance@arb_base_instance-drawarrays_gles3,Fail
# Bad assumptions in piglit about layout of multiplanar formats,
# it should use separate buffers per plane:
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
# glcts update
dEQP-GLES2.functional.texture.mipmap.cube.projected.nearest_linear,Fail
KHR-GL46.texture_view.view_classes,Fail
@@ -222,6 +222,10 @@ spec@arb_occlusion_query@occlusion_query_order,Fail
spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail
spec@khr_texture_compression_astc@miptree-gles srgb-fp@sRGB decode full precision,Fail
# Bad assumptions in piglit about layout of multiplanar formats,
# it should use separate buffers per plane:
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
# glcts update
dEQP-GLES2.functional.texture.mipmap.cube.projected.nearest_linear,Fail
KHR-GLES3.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singlesampled_blit,Fail
@@ -21,6 +21,10 @@ dEQP-VK.dynamic_rendering.primary_cmd_buff.local_read.max_input_attachments,Fail
gmem-dEQP-VK.dynamic_rendering.primary_cmd_buff.local_read.input_attachments_without_mapping,Fail
gmem-dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.uniform_32struct_to_16struct.uniform_geom,Fail
# Bad assumptions in piglit about layout of multiplanar formats,
# it should use separate buffers per plane:
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
# OpenCL tests below
#
## rusticl-core issues:
@@ -31,6 +31,10 @@ dynamic-dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_u
dynamic-dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint.compatibility_depth_zero_stencil_zero_testing_stencil,Fail
dynamic-dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil,Fail
# Bad assumptions in piglit about layout of multiplanar formats,
# it should use separate buffers per plane:
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
# New fails in 1.3.10.0
dEQP-VK.dynamic_rendering.primary_cmd_buff.local_read.max_input_attachments,Fail
@@ -278,7 +278,8 @@ fd6_layout_resource(struct fd_resource *rsc, enum fd_layout_type type)
}
static bool
fill_ubwc_buffer_sizes(struct fd_resource *rsc, struct winsys_handle *handle)
layout_resource_for_handle(struct fd_resource *rsc, struct winsys_handle *handle,
bool ubwc, unsigned tile_mode)
{
struct pipe_resource *prsc = &rsc->b.b;
struct fd_screen *screen = fd_screen(prsc->screen);
@@ -287,10 +288,10 @@ fill_ubwc_buffer_sizes(struct fd_resource *rsc, struct winsys_handle *handle)
.pitch = handle->stride,
};
if (!can_do_ubwc(prsc))
if (ubwc && !can_do_ubwc(prsc))
return false;
struct fdl_image_params params = fd_image_params(prsc, true, TILE6_3);
struct fdl_image_params params = fd_image_params(prsc, ubwc, tile_mode);
if (!fdl6_layout_image(&rsc->layout, screen->info, &params, &l))
return false;
@@ -304,29 +305,22 @@ fill_ubwc_buffer_sizes(struct fd_resource *rsc, struct winsys_handle *handle)
static bool
fd6_layout_resource_for_handle(struct fd_resource *rsc, struct winsys_handle *handle)
{
switch (handle->modifier) {
uint64_t modifier = handle->modifier;
switch (modifier) {
case DRM_FORMAT_MOD_QCOM_COMPRESSED:
return fill_ubwc_buffer_sizes(rsc, handle);
return layout_resource_for_handle(rsc, handle, true, TILE6_3);
case DRM_FORMAT_MOD_LINEAR:
if (can_do_ubwc(&rsc->b.b)) {
perf_debug("%" PRSC_FMT
": not UBWC: imported with DRM_FORMAT_MOD_LINEAR!",
PRSC_ARGS(&rsc->b.b));
}
return true;
case DRM_FORMAT_MOD_QCOM_TILED3:
rsc->layout.tile_mode = fd6_tile_mode(&rsc->b.b);
FALLTHROUGH;
case DRM_FORMAT_MOD_INVALID:
/* For now, without buffer metadata, we must assume that buffers
* imported with INVALID modifier are linear
*/
if (can_do_ubwc(&rsc->b.b)) {
perf_debug("%" PRSC_FMT
": not UBWC: imported with DRM_FORMAT_MOD_INVALID!",
PRSC_ARGS(&rsc->b.b));
const char *mod_name =
(modifier == DRM_FORMAT_MOD_LINEAR) ? "LINEAR" : "INVALID";
perf_debug("%" PRSC_FMT ": not UBWC: imported with DRM_FORMAT_MOD_%s!",
PRSC_ARGS(&rsc->b.b), mod_name);
}
return true;
return layout_resource_for_handle(rsc, handle, false, TILE6_LINEAR);
case DRM_FORMAT_MOD_QCOM_TILED3:
return layout_resource_for_handle(rsc, handle, false, TILE6_3);
default:
return false;
}