[Mesa-dev] [PATCH v2] i965: Allocate tile aligned height

Ben Widawsky ben at bwidawsk.net
Mon Feb 6 07:03:11 UTC 2017


This patch shouldn't actually do anything because the libdrm function
should already do this alignment. However, it preps us for a future
patch where we add in the CCS AUX size, and in the process it serves as
a good place to find bisectable issues if libdrm or kernel does
something incorrectly.

v2: Do proper alignment for X tiling, and make sure non-tiled case is
handled (Jason)

Cc: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Acked-by: Daniel Stone <daniels at collabora.com>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index a7dc8c60a4..ed9ac040e6 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -606,13 +606,16 @@ create_image_with_modifier(struct intel_screen *screen,
 {
    uint32_t requested_tiling = I915_TILING_NONE, tiling = I915_TILING_NONE;
    unsigned long pitch;
+   unsigned tiled_height = height;
 
    switch (modifier) {
    case I915_FORMAT_MOD_Y_TILED:
       requested_tiling = tiling = I915_TILING_Y;
+      tiled_height = ALIGN(height, 32);
       break;
    case I915_FORMAT_MOD_X_TILED:
       requested_tiling = tiling = I915_TILING_X;
+      tiled_height = ALIGN(height, 8);
       break;
    case DRM_FORMAT_MOD_LINEAR:
       requested_tiling = tiling = I915_TILING_NONE;
@@ -625,7 +628,7 @@ create_image_with_modifier(struct intel_screen *screen,
    }
 
    image->bo = drm_intel_bo_alloc_tiled(screen->bufmgr, "image+mod",
-                                        width, height, cpp, &tiling,
+                                        width, tiled_height, cpp, &tiling,
                                         &pitch, 0);
    if (image->bo == NULL)
       return false;
-- 
2.11.1



More information about the mesa-dev mailing list