panfrost: Extend software tiling to larger bpp
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 1 Jul 2019 14:39:22 +0000 (07:39 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 1 Jul 2019 14:40:19 +0000 (07:40 -0700)
Should not affect lima.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/shared/pan_tiling.c

index 08c9561b2ef7c6c52728bd50619770a0a5e74062..72679f3ed8024c8c9741eba7ebcaa859fbc6150b 100644 (file)
@@ -219,17 +219,57 @@ panfrost_access_tiled_image_generic(void *dst, void *src,
          uint8_t *out = is_store ? dest : source;
          uint8_t *in = is_store ? source : dest;
 
-         /* Write out 1-4 bytes. Written like this rather than a loop so the
-          * compiler doesn't need to do branching (just some predication) */
+         uint16_t *out16 = (uint16_t *) out;
+         uint16_t *in16 = (uint16_t *) in;
 
-         out[0] = in[0];
-         if (bpp > 1) {
-            out[1] = in[1];
-            if (bpp > 2) {
+         uint32_t *out32 = (uint32_t *) out;
+         uint32_t *in32 = (uint32_t *) in;
+
+         uint64_t *out64 = (uint64_t *) out;
+         uint64_t *in64 = (uint64_t *) in;
+
+         /* Write out 1-16 bytes. Written like this rather than a loop so the
+          * compiler can see what's going on */
+
+         switch (bpp) {
+            case 1:
+               out[0] = in[0];
+               break;
+
+            case 2:
+               out16[0] = in16[0];
+               break;
+
+            case 3:
+               out16[0] = in16[0];
                out[2] = in[2];
-               if (bpp > 3)
-                  out[3] = in[3];
-            }
+               break;
+
+            case 4:
+               out32[0] = in32[0];
+               break;
+
+            case 6:
+               out32[0] = in32[0];
+               out16[2] = in16[2];
+               break;
+
+            case 8:
+               out64[0] = in64[0];
+               break;
+
+            case 12:
+               out64[0] = in64[0];
+               out32[2] = in32[2];
+               break;
+
+            case 16:
+               out64[0] = in64[0];
+               out64[1] = in64[1];
+               break;
+
+            default:
+               unreachable("Invalid bpp in software tiling");
          }
       }
    }