panfrost: Always align strides to cache line (64)
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 7 Jun 2019 15:58:16 +0000 (08:58 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 10 Jun 2019 13:44:56 +0000 (06:44 -0700)
(Performance tweak.)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_resource.c

index 23a05ee43ccd1ee7e8bce626fbc00c3add0d3d6e..9e8f305c849397314654865bb5d143d0abbf211b 100644 (file)
@@ -210,7 +210,13 @@ panfrost_setup_slices(const struct pipe_resource *tmpl, struct panfrost_bo *bo)
                 }
 
                 slice->offset = offset;
-                slice->stride = bytes_per_pixel * effective_width;
+
+                /* Compute the would-be stride */
+                unsigned stride = bytes_per_pixel * effective_width;
+
+                /* ..but cache-line align it for performance */
+                stride = ALIGN(stride, 64);
+                slice->stride = stride;
 
                 offset += slice->stride * effective_height;