v3d: handle new TEXTURE_SHADER_STATE v71 YCbCr fields

There are some new fields for YCbCr with pointers for the various
planes in multi-planar formats. These need to match the base address
pointer in the texture state, or the hardware will assume this is a
multi-planar texture.

Notice we don't use an address type for these fields in the XML
description. This is because the addresses are 64-bit aligned (even
though the PRM doesn't say it) which means the 6 LSB bits are
implicitly 0, but the fields are encoded before the 6th bit of their
starting byte, so we can't use the usual trick we do with address
types where the first 6 bits in the byte are implicitly overwritten by
other fields and we have to encode this manually as a uint field. This
would mean that if we had an actual BO we would also need to add it
manually to the job's list, but since we don't have one, we don't have
to do anything about it.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
This commit is contained in:
Alejandro Piñeiro 2021-10-22 10:54:24 +02:00 committed by Marge Bot
parent 80923c889a
commit 9be4d4def6

View file

@ -935,17 +935,26 @@ v3d_setup_texture_shader_state(struct V3DX(TEXTURE_SHADER_STATE) *tex,
}
tex->base_level = base_level;
#if V3D_VERSION >= 40
tex->max_level = last_level;
/* Note that we don't have a job to reference the texture's sBO
* at state create time, so any time this sampler view is used
* we need to add the texture to the job.
*/
tex->texture_base_pointer =
cl_address(NULL,
rsc->bo->offset +
v3d_layer_offset(prsc, 0, first_layer));
const uint32_t base_offset = rsc->bo->offset +
v3d_layer_offset(prsc, 0, first_layer);
tex->texture_base_pointer = cl_address(NULL, base_offset);
#endif
#if V3D_VERSION >= 71
tex->chroma_offset_x = 1;
tex->chroma_offset_y = 1;
/* See comment in XML field definition for rationale of the shifts */
tex->texture_base_pointer_cb = base_offset >> 6;
tex->texture_base_pointer_cr = base_offset >> 6;
#endif
tex->array_stride_64_byte_aligned = rsc->cube_map_stride / 64;
/* Since other platform devices may produce UIF images even