[Mesa-dev] [PATCH 27/27] i965: Handle compression modifier

Ben Widawsky benjamin.widawsky at intel.com
Thu Dec 1 22:10:08 UTC 2016


From: Ben Widawsky <ben at bwidawsk.net>

FINISHME: Use the kernel's final choice for the fb modifier

bwidawsk at norris2:~/intel-gfx/kmscube (modifiers $) ~/scripts/measure_bandwidth.sh ./kmscube none
Read bandwidth: 603.91 MiB/s
Write bandwidth: 615.28 MiB/s
bwidawsk at norris2:~/intel-gfx/kmscube (modifiers $) ~/scripts/measure_bandwidth.sh ./kmscube ytile
Read bandwidth: 571.13 MiB/s
Write bandwidth: 555.51 MiB/s
bwidawsk at norris2:~/intel-gfx/kmscube (modifiers $) ~/scripts/measure_bandwidth.sh ./kmscube ccs
Read bandwidth: 259.34 MiB/s
Write bandwidth: 337.83 MiB/s

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 7ee21ee..36639f4 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -637,9 +637,15 @@ __intel_create_image(__DRIscreen *dri_screen,
    if (use & __DRI_IMAGE_USE_LINEAR)
       tiling = I915_TILING_NONE;
 
+   /* This determines the prioritized modifier to pick for later */
    for (int i = 0; i < count; i++) {
       switch (modifiers[i]) {
       case I915_FORMAT_MOD_Y_TILED:
+         /* Y-tiling is the lowest priority modifier */
+         if (modifier)
+            continue;
+         /* fallthrough */
+      case /* I915_FORMAT_MOD_CCS */ fourcc_mod_code(INTEL, 4):
          /* Kernel provides no way to query support for this. Assume GEN check
           * is enough :/
           */
@@ -649,12 +655,11 @@ __intel_create_image(__DRIscreen *dri_screen,
          }
 
          if (tiling == I915_TILING_NONE) {
-            _mesa_warning(NULL, "Invalid use/modifier combination (%x %llx)\n",
-                          use, I915_FORMAT_MOD_Y_TILED);
+            _mesa_warning(NULL, "Invalid use/modifier combination (%x %" PRIx64")\n",
+                          use, modifiers[i]);
             continue;
          }
-
-         modifier = I915_FORMAT_MOD_Y_TILED;
+         modifier = modifiers[i];
          break;
       }
    }
@@ -707,7 +712,8 @@ intel_create_image_with_modifiers(__DRIscreen *dri_screen,
    for (int i = 0; i < count; i++) {
       switch (modifiers[i]) {
       case I915_FORMAT_MOD_Y_TILED:
-         local_mods[local_count++] = I915_FORMAT_MOD_Y_TILED;
+      case /* I915_FORMAT_MOD_CCS */ fourcc_mod_code(INTEL, 4):
+         local_mods[local_count++] = modifiers[i];
          break;
       }
    }
-- 
2.10.2



More information about the mesa-dev mailing list