iris: Set clear_color_unknown if the bo is not mappable

Rework:
 * Ken: Check bo for IRIS_MMAP_NONE rather than the global
   intel_vram_all_mappable

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17349>
This commit is contained in:
Jordan Justen 2022-05-16 10:47:15 -07:00 committed by Marge Bot
parent 180aa4f3b2
commit 7cf67e9da3
1 changed files with 11 additions and 8 deletions

View File

@ -939,16 +939,19 @@ iris_resource_init_aux_buf(struct iris_screen *screen,
0, res->aux.extra_aux.surf.size_B);
}
unsigned clear_color_size =
iris_get_aux_clear_color_state_size(screen, res);
unsigned clear_color_size = iris_get_aux_clear_color_state_size(screen, res);
if (clear_color_size > 0) {
if (!map)
map = iris_bo_map(NULL, res->bo, MAP_WRITE | MAP_RAW);
if (!map)
return false;
if (iris_bo_mmap_mode(res->bo) != IRIS_MMAP_NONE) {
if (!map)
map = iris_bo_map(NULL, res->bo, MAP_WRITE | MAP_RAW);
if (!map)
return false;
/* Zero the indirect clear color to match ::fast_clear_color. */
memset((char *)map + res->aux.clear_color_offset, 0, clear_color_size);
/* Zero the indirect clear color to match ::fast_clear_color. */
memset((char *)map + res->aux.clear_color_offset, 0, clear_color_size);
} else {
res->aux.clear_color_unknown = true;
}
}
if (map)