[Mesa-dev] [PATCH 13/34] i965: Handle X tiled modifier

Ben Widawsky ben at bwidawsk.net
Tue Jan 24 06:21:36 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.

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>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 6eaf146181..eb4f3d7e6b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -560,10 +560,14 @@ select_best_modifier(struct gen_device_info *devinfo,
                      const uint64_t *modifiers,
                      const unsigned count)
 {
-#define YTILE  (1 << 1)
+#define YTILE  (1 << 2)
+#define XTILE  (1 << 1)
 #define LINEAR (1 << 0)
 
-   const uint64_t prio_modifiers[] = { I915_FORMAT_MOD_Y_TILED, DRM_FORMAT_MOD_LINEAR };
+   const uint64_t prio_modifiers[] = {
+      I915_FORMAT_MOD_Y_TILED,
+      I915_FORMAT_MOD_X_TILED,
+      DRM_FORMAT_MOD_LINEAR };
    uint32_t modifier_bitmask = 0; /* API only allows 32 */
 
    for (int i = 0; i < count; i++) {
@@ -571,6 +575,9 @@ select_best_modifier(struct gen_device_info *devinfo,
       case DRM_FORMAT_MOD_LINEAR:
          modifier_bitmask |= LINEAR;
          break;
+      case I915_FORMAT_MOD_X_TILED:
+         modifier_bitmask |= XTILE;
+         break;
       case I915_FORMAT_MOD_Y_TILED:
          if (devinfo->gen < 9) {
             _mesa_warning(NULL, "Invalid Y-tiling parameter\n");
@@ -588,6 +595,7 @@ select_best_modifier(struct gen_device_info *devinfo,
    return DRM_FORMAT_MOD_INVALID;
 
 #undef LINEAR
+#undef XTILE
 #undef YTILE
 }
 
@@ -616,6 +624,9 @@ __intel_create_image(__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;
@@ -680,6 +691,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.11.0



More information about the mesa-dev mailing list