iris: Fix and refactor check for clear color being fully zero

I missed updating this code to check res->aux.clear_color_unknown when
I added it a while back.  While we're here, also refactor this code into
a helper function - I'll want to use it in another place shortly.

Fixes: e83da2d8e3 ("iris: Don't try to CPU read imported clear color BOs")

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14687>
This commit is contained in:
Kenneth Graunke 2021-12-06 15:42:01 -08:00 committed by Marge Bot
parent 053251f18c
commit 09072a0803
1 changed files with 11 additions and 4 deletions

View File

@ -343,6 +343,16 @@ pipe_format_for_aspect(enum pipe_format format, unsigned pipe_mask)
}
}
static bool
clear_color_is_fully_zero(const struct iris_resource *res)
{
return !res->aux.clear_color_unknown &&
res->aux.clear_color.u32[0] == 0 &&
res->aux.clear_color.u32[1] == 0 &&
res->aux.clear_color.u32[2] == 0 &&
res->aux.clear_color.u32[3] == 0;
}
/**
* The pipe->blit() driver hook.
*
@ -595,10 +605,7 @@ get_copy_region_aux_settings(struct iris_context *ice,
* original format (e.g. A8_UNORM/R8_UINT).
*/
*out_clear_supported = (devinfo->ver >= 11 && !is_dest) ||
(res->aux.clear_color.u32[0] == 0 &&
res->aux.clear_color.u32[1] == 0 &&
res->aux.clear_color.u32[2] == 0 &&
res->aux.clear_color.u32[3] == 0);
clear_color_is_fully_zero(res);
break;
default:
*out_aux_usage = ISL_AUX_USAGE_NONE;