intel/blorp: Avoid 32bpc fast clear sampling issue
For 32bpc formats, the ICL+ sampler fetches the raw clear color dwords used for rendering instead of the converted pixel dwords typically used for sampling. The CLEAR_COLOR struct page documents this for 128bpp formats, but not for 32bpp and 64bpp formats. In blorp_copy, map R11G11B10_FLOAT to R8G8B8A8_UINT instead of R32_UINT. This will cause the sampler to fetch the clear color pixel, allowing drivers to keep clear color support enabled during copies. If iris is forced to convert blits to copies, this patch fixes the following test on gfx12: dEQP-GLES3.functional.fbo.color.repeated_clear.blit.rbo.r11f_g11f_b10f At the moment, both iris and anv won't hit this issue outside of blorp_copy. This is due to the read/write access restrictions they currently place on texture views that reinterpret the surface format. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8964 Reviewed-by: Jianxun Zhang <jianxun.zhang@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23604>
This commit is contained in:
@@ -2720,7 +2720,7 @@ get_ccs_compatible_copy_format(const struct isl_format_layout *fmtl)
|
||||
return ISL_FORMAT_R32_UINT;
|
||||
|
||||
case ISL_FORMAT_R11G11B10_FLOAT:
|
||||
return ISL_FORMAT_R32_UINT;
|
||||
return ISL_FORMAT_R8G8B8A8_UINT;
|
||||
|
||||
case ISL_FORMAT_B10G10R10A2_UNORM:
|
||||
case ISL_FORMAT_B10G10R10A2_UNORM_SRGB:
|
||||
@@ -2964,6 +2964,28 @@ blorp_copy(struct blorp_batch *batch,
|
||||
blorp_copy_get_formats(isl_dev, ¶ms.src.surf, ¶ms.dst.surf,
|
||||
¶ms.src.view.format, ¶ms.dst.view.format);
|
||||
|
||||
if (isl_aux_usage_has_fast_clears(params.src.aux_usage) &&
|
||||
isl_dev->ss.clear_color_state_size > 0) {
|
||||
/* For 32bpc formats, the sampler fetches the raw clear color dwords
|
||||
* used for rendering instead of the converted pixel dwords typically
|
||||
* used for sampling. The CLEAR_COLOR struct page documents this for
|
||||
* 128bpp formats, but not for 32bpp and 64bpp formats.
|
||||
*
|
||||
* Note that although the sampler doesn't use the converted clear color
|
||||
* field with 32bpc formats, the Clear Color Conversion hardware feature
|
||||
* still occurs when the format sizes are less than 128bpp.
|
||||
*
|
||||
* The sampler changing its clear color fetching location can be a
|
||||
* problem in some cases, but we won't run into them here. When using an
|
||||
* indirect clear color, we won't create 32bpc views of non-32bpc
|
||||
* surfaces (and vice-versa).
|
||||
*/
|
||||
const struct isl_format_layout *src_view_fmtl =
|
||||
isl_format_get_layout(params.src.view.format);
|
||||
assert((src_fmtl->channels.r.bits == 32) ==
|
||||
(src_view_fmtl->channels.r.bits == 32));
|
||||
}
|
||||
|
||||
if (params.src.view.format != params.dst.view.format) {
|
||||
enum isl_format src_cast_format = params.src.view.format;
|
||||
enum isl_format dst_cast_format = params.dst.view.format;
|
||||
|
||||
Reference in New Issue
Block a user