[Mesa-dev] [PATCH v3 05/14] i965/screen: Allocate ZEROED BOs for images

Jason Ekstrand jason at jlekstrand.net
Thu Jul 13 04:23:16 UTC 2017


---
 src/mesa/drivers/dri/i965/intel_screen.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 6d0588e..b292300 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -674,9 +674,18 @@ intel_create_image_common(__DRIscreen *dri_screen,
       return NULL;
    }
 
+   /* We request that the bufmgr zero the buffer for us for two reasons:
+    *
+    *  1) If a buffer gets re-used from the pool, we don't want to leak random
+    *     garbage from our process to some other.
+    *
+    *  2) For images with CCS_E, we want to ensure that the CCS starts off in
+    *     a valid state.  A CCS value of 0 indicates that the given block is
+    *     in the pass-through state which is what we want.
+    */
    image->bo = brw_bo_alloc_tiled(screen->bufmgr, "image", surf.size,
                                   isl_tiling_to_i915_tiling(mod_info->tiling),
-                                  surf.row_pitch, 0);
+                                  surf.row_pitch, BO_ALLOC_ZEROED);
    if (image->bo == NULL) {
       free(image);
       return NULL;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list