[Mesa-dev] [PATCH 7/8] i965/dri: Handle X-tiled modifier

Ben Widawsky ben at bwidawsk.net
Tue Mar 21 20:45:06 UTC 2017


This doesn't really "do" anything because the default tiling for the
winsys buffer is X tiled. We do however want the X tiled modifier to
work correctly from the API perspective, which would imply that if you
set this modifier, and later do a get_modifier, you get back at least X
tiled.

Running with a modified kmscube, here are the bandwidth measurements.

Linear:
Read bandwidth: 1039.31 MiB/s
Write bandwidth: 1453.56 MiB/s

Y-tiled:
Read bandwidth: 458.29 MiB/s
Write bandwidth: 542.12 MiB/s

X-tiled:
Read bandwidth: 575.01 MiB/s
Write bandwidth: 606.25 MiB/s

Cc: Kristian Høgsberg <krh at bitplanet.net>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Acked-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 8bb3aca946..b51b9c859a 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -519,12 +519,14 @@ intel_destroy_image(__DRIimage *image)
 enum modifier_priority {
    MODIFIER_PRIORITY_INVALID = 0,
    MODIFIER_PRIORITY_LINEAR,
+   MODIFIER_PRIORITY_X,
    MODIFIER_PRIORITY_Y,
 };
 
 const uint64_t priority_to_modifier[] = {
    [MODIFIER_PRIORITY_INVALID] = DRM_FORMAT_MOD_INVALID,
    [MODIFIER_PRIORITY_LINEAR] = DRM_FORMAT_MOD_LINEAR,
+   [MODIFIER_PRIORITY_X] = I915_FORMAT_MOD_X_TILED,
    [MODIFIER_PRIORITY_Y] = I915_FORMAT_MOD_Y_TILED,
 };
 
@@ -540,6 +542,9 @@ select_best_modifier(struct gen_device_info *devinfo,
       case I915_FORMAT_MOD_Y_TILED:
          prio = MAX2(prio, MODIFIER_PRIORITY_Y);
          break;
+      case I915_FORMAT_MOD_X_TILED:
+         prio = MAX2(prio, MODIFIER_PRIORITY_X);
+         break;
       case DRM_FORMAT_MOD_LINEAR:
          prio = MAX2(prio, MODIFIER_PRIORITY_LINEAR);
          break;
@@ -577,6 +582,9 @@ intel_create_image_common(__DRIscreen *dri_screen,
 
    uint64_t modifier = select_best_modifier(&screen->devinfo, modifiers, count);
    switch (modifier) {
+   case I915_FORMAT_MOD_X_TILED:
+      assert(tiling == I915_TILING_X);
+      break;
    case DRM_FORMAT_MOD_LINEAR:
       tiling = I915_TILING_NONE;
       break;
@@ -643,6 +651,7 @@ intel_create_image_with_modifiers(__DRIscreen *dri_screen,
    for (int i = 0; i < count; i++) {
       switch (modifiers[i]) {
       case I915_FORMAT_MOD_Y_TILED:
+      case I915_FORMAT_MOD_X_TILED:
       case DRM_FORMAT_MOD_LINEAR:
          local_mods[local_count++] = modifiers[i];
          break;
-- 
2.12.0



More information about the mesa-dev mailing list