[Mesa-dev] [PATCH 6/6] panfrost/midgard: Differentiate vertex/fragment texture tags

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Tue Jun 11 17:53:28 UTC 2019


Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/gallium/drivers/panfrost/midgard/helpers.h          | 2 ++
 src/gallium/drivers/panfrost/midgard/midgard_emit.c     | 8 +++++---
 src/gallium/drivers/panfrost/midgard/midgard_schedule.c | 9 ++++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/helpers.h b/src/gallium/drivers/panfrost/midgard/helpers.h
index b6ab3c86c97..a2cc7e67eaf 100644
--- a/src/gallium/drivers/panfrost/midgard/helpers.h
+++ b/src/gallium/drivers/panfrost/midgard/helpers.h
@@ -86,6 +86,7 @@
 
 /* 4-bit type tags */
 
+#define TAG_TEXTURE_4_VTX 0x2
 #define TAG_TEXTURE_4 0x3
 #define TAG_LOAD_STORE_4 0x5
 #define TAG_ALU_4 0x8
@@ -100,6 +101,7 @@ quadword_size(int tag)
         case TAG_ALU_4:
         case TAG_LOAD_STORE_4:
         case TAG_TEXTURE_4:
+        case TAG_TEXTURE_4_VTX:
                 return 1;
         case TAG_ALU_8:
                 return 2;
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_emit.c b/src/gallium/drivers/panfrost/midgard/midgard_emit.c
index 5ddcee419bf..bf6ee4508f5 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_emit.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_emit.c
@@ -203,13 +203,15 @@ emit_binary_bundle(compiler_context *ctx,
                 break;
         }
 
-        case TAG_TEXTURE_4: {
+        case TAG_TEXTURE_4:
+        case TAG_TEXTURE_4_VTX: {
                 /* Texture instructions are easy, since there is no pipelining
-                 * nor VLIW to worry about. We may need to set .last flag */
+                 * nor VLIW to worry about. We may need to set .cont/.last
+                 * flags. */
 
                 midgard_instruction *ins = bundle->instructions[0];
 
-                ins->texture.type = TAG_TEXTURE_4;
+                ins->texture.type = bundle->tag;
                 ins->texture.next_type = next_tag;
 
                 ctx->texture_op_count--;
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_schedule.c b/src/gallium/drivers/panfrost/midgard/midgard_schedule.c
index 9d4ce2a97d5..3d6c7f9cf53 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_schedule.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_schedule.c
@@ -370,8 +370,15 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
                 break;
         }
 
+        case TAG_TEXTURE_4: {
+                /* Which tag we use depends on the shader stage */
+                bool in_frag = ctx->stage == MESA_SHADER_FRAGMENT;
+                bundle.tag = in_frag ? TAG_TEXTURE_4 : TAG_TEXTURE_4_VTX;
+                break;
+        }
+
         default:
-                /* Texture ops default to single-op-per-bundle scheduling */
+                unreachable("Unknown tag");
                 break;
         }
 
-- 
2.20.1



More information about the mesa-dev mailing list