iris: Zero the add-on clear color BO on import
authorNanley Chery <nanley.g.chery@intel.com>
Fri, 10 Jul 2020 22:48:36 +0000 (15:48 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 3 Aug 2020 16:24:16 +0000 (16:24 +0000)
When iris imports an I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS surface, it
allocates a buffer to hold the indirect clear color. When the import is
complete, iris_resource::aux::clear_color is set to zero but the
indirect buffer is filled with garbage values. This could break certain
texture view use-cases, so zero the allocated buffer to fix those.

Fixes: c19492bcdb9 ("iris: Handle importing aux-enabled surfaces on TGL")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6092>

src/gallium/drivers/iris/iris_resource.c

index d37f742658338844746a6b455749a71872522f8f..62888bbacd5bec1e2a20320a0be9860e649a84fa 100644 (file)
@@ -782,8 +782,9 @@ iris_resource_finish_aux_import(struct pipe_screen *pscreen,
 
    if (clear_color_state_size > 0) {
       res->aux.clear_color_bo =
-         iris_bo_alloc(screen->bufmgr, "clear color buffer",
-                       clear_color_state_size, IRIS_MEMZONE_OTHER);
+         iris_bo_alloc_tiled(screen->bufmgr, "clear color_buffer",
+                             clear_color_state_size, 1, IRIS_MEMZONE_OTHER,
+                             I915_TILING_NONE, 0, BO_ALLOC_ZEROED);
       res->aux.clear_color_offset = 0;
    }