From 7cf67e9da3e97a6832ea2580bc0a683e5a8b0c15 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Mon, 16 May 2022 10:47:15 -0700 Subject: [PATCH] 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 Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_resource.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 4ba93709f38..d1adaa1722a 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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)