Module: Mesa
Branch: main
Commit: d09ad16fd4a0596fb6c97cffaf0fdf031053b5a4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d09ad16fd4a0596fb6c97cffaf0fdf031053b5a4

Author: Timur Kristóf <timur.kris...@gmail.com>
Date:   Wed Nov  8 10:22:23 2023 +0100

ac: Remove CIK prefix from SDMA opcodes.

The vast majority of AMD GPUs (except the very first GCN) have
the same SDMA packet format, so let's just call it SDMA instead
of CIK_SDMA.

(And leave the oldest GPUs with SI_SDMA as they are now.)

Signed-off-by: Timur Kristóf <timur.kris...@gmail.com>
Reviewed-by: Tatsuyuki Ishi <ishitatsuy...@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26110>

---

 src/amd/common/ac_debug.c                         | 16 +++++-----
 src/amd/common/sid.h                              | 38 +++++++++++------------
 src/amd/vulkan/radv_cs.h                          |  4 +--
 src/amd/vulkan/radv_sdma.c                        | 12 +++----
 src/amd/vulkan/si_cmd_buffer.c                    |  2 +-
 src/gallium/drivers/radeonsi/si_sdma_copy_image.c | 14 ++++-----
 6 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c
index 48040f85726..22b001c2a11 100644
--- a/src/amd/common/ac_debug.c
+++ b/src/amd/common/ac_debug.c
@@ -735,7 +735,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
       const uint32_t sub_op = (header >> 8) & 0xff;
 
       switch (opcode) {
-      case CIK_SDMA_OPCODE_NOP: {
+      case SDMA_OPCODE_NOP: {
          fprintf(f, "NOP\n");
 
          const uint32_t count = header >> 16;
@@ -745,7 +745,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
          }
          break;
       }
-      case CIK_SDMA_OPCODE_CONSTANT_FILL: {
+      case SDMA_OPCODE_CONSTANT_FILL: {
          fprintf(f, "CONSTANT_FILL\n");
          ac_ib_get(ib);
          fprintf(f, "\n");
@@ -764,7 +764,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
 
          break;
       }
-      case CIK_SDMA_OPCODE_WRITE: {
+      case SDMA_OPCODE_WRITE: {
          fprintf(f, "WRITE\n");
 
          /* VA */
@@ -783,9 +783,9 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
 
          break;
       }
-      case CIK_SDMA_OPCODE_COPY: {
+      case SDMA_OPCODE_COPY: {
          switch (sub_op) {
-         case CIK_SDMA_COPY_SUB_OPCODE_LINEAR: {
+         case SDMA_COPY_SUB_OPCODE_LINEAR: {
             fprintf(f, "COPY LINEAR\n");
 
             uint32_t copy_bytes = ac_ib_get(ib) + (ib->gfx_level >= GFX9 ? 1 : 
0);
@@ -803,7 +803,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
 
             break;
          }
-         case CIK_SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW: {
+         case SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW: {
             fprintf(f, "COPY LINEAR_SUB_WINDOW\n");
 
             for (unsigned i = 0; i < 12; ++i) {
@@ -812,7 +812,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
             }
             break;
          }
-         case CIK_SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW: {
+         case SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW: {
             fprintf(f, "COPY TILED_SUB_WINDOW %s\n", header >> 31 ? "t2l" : 
"l2t");
             uint32_t dcc = (header >> 19) & 1;
 
@@ -860,7 +860,7 @@ static void parse_sdma_ib(FILE *f, struct ac_ib_parser *ib)
             }
             break;
          }
-         case CIK_SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW: {
+         case SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW: {
             fprintf(f, "COPY T2T_SUB_WINDOW\n");
             uint32_t dcc = (header >> 19) & 1;
 
diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h
index 20a318a2ba2..09755147610 100644
--- a/src/amd/common/sid.h
+++ b/src/amd/common/sid.h
@@ -321,36 +321,36 @@
 #define SI_DMA_PACKET_NOP                  0xf
 
 /* CIK async DMA packets */
-#define CIK_SDMA_PACKET(op, sub_op, n)                                         
                    \
+#define SDMA_PACKET(op, sub_op, n)                                             
                    \
    ((((unsigned)(n)&0xFFFF) << 16) | (((unsigned)(sub_op)&0xFF) << 8) |        
                    \
     (((unsigned)(op)&0xFF) << 0))
 /* CIK async DMA packet types */
-#define CIK_SDMA_OPCODE_NOP                        0x0
-#define CIK_SDMA_OPCODE_COPY                       0x1
-#define CIK_SDMA_COPY_SUB_OPCODE_LINEAR            0x0
-#define CIK_SDMA_COPY_SUB_OPCODE_TILED             0x1
-#define CIK_SDMA_COPY_SUB_OPCODE_SOA               0x3
-#define CIK_SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW 0x4
-#define CIK_SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW  0x5
-#define CIK_SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW    0x6
-#define CIK_SDMA_OPCODE_WRITE                      0x2
+#define SDMA_OPCODE_NOP                            0x0
+#define SDMA_OPCODE_COPY                           0x1
+#define SDMA_COPY_SUB_OPCODE_LINEAR                0x0
+#define SDMA_COPY_SUB_OPCODE_TILED                 0x1
+#define SDMA_COPY_SUB_OPCODE_SOA                   0x3
+#define SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW     0x4
+#define SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW      0x5
+#define SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW        0x6
+#define SDMA_OPCODE_WRITE                          0x2
 #define SDMA_WRITE_SUB_OPCODE_LINEAR               0x0
 #define SDMA_WRITE_SUB_OPCODE_TILED                0x1
-#define CIK_SDMA_OPCODE_INDIRECT_BUFFER            0x4
-#define CIK_SDMA_OPCODE_FENCE                      0x5
+#define SDMA_OPCODE_INDIRECT_BUFFER                0x4
+#define SDMA_OPCODE_FENCE                          0x5
 #define SDMA_FENCE_MTYPE_UC                        0x3
-#define CIK_SDMA_OPCODE_TRAP                       0x6
-#define CIK_SDMA_OPCODE_SEMAPHORE                  0x7
-#define CIK_SDMA_OPCODE_POLL_REGMEM                0x8
+#define SDMA_OPCODE_TRAP                           0x6
+#define SDMA_OPCODE_SEMAPHORE                      0x7
+#define SDMA_OPCODE_POLL_REGMEM                    0x8
 #define SDMA_POLL_MEM                              (1 << 31)
 #define SDMA_POLL_INTERVAL_160_CLK                 0xa
 #define SDMA_POLL_RETRY_INDEFINITELY               0xfff
-#define CIK_SDMA_OPCODE_CONSTANT_FILL              0xb
-#define CIK_SDMA_OPCODE_TIMESTAMP                  0xd
+#define SDMA_OPCODE_CONSTANT_FILL                  0xb
+#define SDMA_OPCODE_TIMESTAMP                      0xd
 #define SDMA_TS_SUB_OPCODE_SET_LOCAL_TIMESTAMP     0x0
 #define SDMA_TS_SUB_OPCODE_GET_LOCAL_TIMESTAMP     0x1
 #define SDMA_TS_SUB_OPCODE_GET_GLOBAL_TIMESTAMP    0x2
-#define CIK_SDMA_OPCODE_SRBM_WRITE                 0xe
+#define SDMA_OPCODE_SRBM_WRITE                     0xe
 
 /* There is apparently an undocumented HW limitation that
  * prevents the HW from copying the last 255 bytes of (1 << 22) - 1
@@ -358,7 +358,7 @@
 #define SDMA_V2_0_COPY_MAX_BYTES 0x3fff00   /* almost 4 MB*/
 #define SDMA_V5_2_COPY_MAX_BYTES 0x3fffff00 /* almost 1 GB */
 
-#define SDMA_NOP_PAD CIK_SDMA_PACKET(CIK_SDMA_OPCODE_NOP, 0, 0) /* header-only 
version */
+#define SDMA_NOP_PAD SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0) /* header-only version 
*/
 
 enum amd_cmp_class_flags
 {
diff --git a/src/amd/vulkan/radv_cs.h b/src/amd/vulkan/radv_cs.h
index d8f525713ae..1c8114fff66 100644
--- a/src/amd/vulkan/radv_cs.h
+++ b/src/amd/vulkan/radv_cs.h
@@ -223,7 +223,7 @@ radv_cp_wait_mem(struct radeon_cmdbuf *cs, const enum 
radv_queue_family qf, cons
       radeon_emit(cs, mask); /* mask */
       radeon_emit(cs, 4);    /* poll interval */
    } else if (qf == RADV_QUEUE_TRANSFER) {
-      radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_POLL_REGMEM, 0, 0) | op 
<< 28 | SDMA_POLL_MEM);
+      radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_POLL_REGMEM, 0, 0) | op << 28 | 
SDMA_POLL_MEM);
       radeon_emit(cs, va);
       radeon_emit(cs, va >> 32);
       radeon_emit(cs, ref);
@@ -250,7 +250,7 @@ radv_cs_write_data_head(const struct radv_device *device, 
struct radeon_cmdbuf *
       /* Vulkan transfer queues don't support conditional rendering, so we can 
ignore predication here.
        * Furthermore, we can ignore the engine selection here, it is 
meaningless to the SDMA.
        */
-      radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_WRITE, 
SDMA_WRITE_SUB_OPCODE_LINEAR, 0));
+      radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_WRITE, 
SDMA_WRITE_SUB_OPCODE_LINEAR, 0));
       radeon_emit(cs, va);
       radeon_emit(cs, va >> 32);
       radeon_emit(cs, count - 1);
diff --git a/src/amd/vulkan/radv_sdma.c b/src/amd/vulkan/radv_sdma.c
index 9cd829c92f6..b56c5ddc503 100644
--- a/src/amd/vulkan/radv_sdma.c
+++ b/src/amd/vulkan/radv_sdma.c
@@ -347,7 +347,7 @@ radv_sdma_emit_nop(const struct radv_device *device, struct 
radeon_cmdbuf *cs)
 {
    /* SDMA NOP acts as a fence command and causes the SDMA engine to wait for 
pending copy operations. */
    radeon_check_space(device->ws, cs, 1);
-   radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_NOP, 0, 0));
+   radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0));
 }
 
 void
@@ -380,7 +380,7 @@ radv_sdma_copy_buffer(const struct radv_device *device, 
struct radeon_cmdbuf *cs
 
    for (unsigned i = 0; i < ncopy; i++) {
       unsigned csize = size >= 4 ? MIN2(size & align, max_size_per_packet) : 
size;
-      radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY, 
CIK_SDMA_COPY_SUB_OPCODE_LINEAR, 0));
+      radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_COPY, 
SDMA_COPY_SUB_OPCODE_LINEAR, 0));
       radeon_emit(cs, gfx_level >= GFX9 ? csize - 1 : csize);
       radeon_emit(cs, 0); /* src/dst endian swap */
       radeon_emit(cs, src_va);
@@ -424,8 +424,8 @@ radv_sdma_emit_copy_linear_sub_window(const struct 
radv_device *device, struct r
 
    ASSERTED unsigned cdw_end = radeon_check_space(device->ws, cs, 13);
 
-   radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY, 
CIK_SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW, 0) |
-                      util_logbase2(src->bpp) << 29);
+   radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_COPY, 
SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW, 0) | util_logbase2(src->bpp)
+                                                                               
                  << 29);
    radeon_emit(cs, src->va);
    radeon_emit(cs, src->va >> 32);
    radeon_emit(cs, src_off.x | src_off.y << 16);
@@ -468,8 +468,8 @@ radv_sdma_emit_copy_tiled_sub_window(const struct 
radv_device *device, struct ra
 
    ASSERTED unsigned cdw_end = radeon_check_space(device->ws, cs, 14 + (dcc ? 
3 : 0));
 
-   radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY, 
CIK_SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW, 0) | dcc << 19 |
-                      detile << 31 | tiled->header_dword);
+   radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_COPY, 
SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW, 0) | dcc << 19 | detile << 31 |
+                      tiled->header_dword);
    radeon_emit(cs, tiled->va);
    radeon_emit(cs, tiled->va >> 32);
    radeon_emit(cs, tiled_off.x | tiled_off.y << 16);
diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c
index ecb00d98575..73f469c5bf6 100644
--- a/src/amd/vulkan/si_cmd_buffer.c
+++ b/src/amd/vulkan/si_cmd_buffer.c
@@ -952,7 +952,7 @@ si_cs_emit_write_event_eop(struct radeon_cmdbuf *cs, enum 
amd_gfx_level gfx_leve
                            uint32_t new_fence, uint64_t gfx9_eop_bug_va)
 {
    if (qf == RADV_QUEUE_TRANSFER) {
-      radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_FENCE, 0, 
SDMA_FENCE_MTYPE_UC));
+      radeon_emit(cs, SDMA_PACKET(SDMA_OPCODE_FENCE, 0, SDMA_FENCE_MTYPE_UC));
       radeon_emit(cs, va);
       radeon_emit(cs, va >> 32);
       radeon_emit(cs, new_fence);
diff --git a/src/gallium/drivers/radeonsi/si_sdma_copy_image.c 
b/src/gallium/drivers/radeonsi/si_sdma_copy_image.c
index e0e282a4d2f..65fa4fca2c9 100644
--- a/src/gallium/drivers/radeonsi/si_sdma_copy_image.c
+++ b/src/gallium/drivers/radeonsi/si_sdma_copy_image.c
@@ -82,8 +82,8 @@ static bool si_sdma_v4_v5_copy_texture(struct si_context 
*sctx, struct si_textur
       radeon_begin(cs);
       for (int i = 0; i < chunk_count; i++) {
          uint32_t size = MIN2(chunk_size, bytes);
-         radeon_emit(CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY,
-                                     CIK_SDMA_COPY_SUB_OPCODE_LINEAR,
+         radeon_emit(SDMA_PACKET(SDMA_OPCODE_COPY,
+                                     SDMA_COPY_SUB_OPCODE_LINEAR,
                                      (tmz ? 4 : 0)));
          radeon_emit(size - 1);
          radeon_emit(0);
@@ -125,8 +125,8 @@ static bool si_sdma_v4_v5_copy_texture(struct si_context 
*sctx, struct si_textur
 
       radeon_begin(cs);
       radeon_emit(
-         CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY,
-                         CIK_SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW,
+         SDMA_PACKET(SDMA_OPCODE_COPY,
+                     SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW,
                          (tmz ? 4 : 0)) |
          dcc << 19 |
          (is_v5 ? 0 : tiled->buffer.b.b.last_level) << 20 |
@@ -216,7 +216,7 @@ bool cik_sdma_copy_texture(struct si_context *sctx, struct 
si_texture *sdst, str
       struct radeon_cmdbuf *cs = sctx->sdma_cs;
 
       radeon_begin(cs);
-      radeon_emit(CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY, 
CIK_SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW, 0) |
+      radeon_emit(SDMA_PACKET(SDMA_OPCODE_COPY, 
SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW, 0) |
                   (util_logbase2(bpp) << 29));
       radeon_emit(src_address);
       radeon_emit(src_address >> 32);
@@ -338,8 +338,8 @@ bool cik_sdma_copy_texture(struct si_context *sctx, struct 
si_texture *sdst, str
          uint32_t direction = linear == sdst ? 1u << 31 : 0;
 
          radeon_begin(cs);
-         radeon_emit(CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY,
-                                     
CIK_SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW, 0) |
+         radeon_emit(SDMA_PACKET(SDMA_OPCODE_COPY,
+                                 SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW, 0) |
                      direction);
          radeon_emit(tiled_address);
          radeon_emit(tiled_address >> 32);

Reply via email to