From 556f4458fe90cea54caa63310dce9dded4034aea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 18 Jun 2020 01:04:51 -0400 Subject: [PATCH] amd: add proper definitions for NOP packets Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/common/ac_debug.c | 2 +- src/amd/common/sid.h | 3 +++ src/amd/vulkan/si_cmd_buffer.c | 4 ++-- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 6 +++--- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 8 ++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index 77c0e0aa790..b81897811a1 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -441,7 +441,7 @@ static void ac_parse_packet3(FILE *f, uint32_t header, struct ac_ib_parser *ib, case PKT3_PFP_SYNC_ME: break; case PKT3_NOP: - if (header == 0xffff1000) { + if (header == PKT3_NOP_PAD) { count = -1; /* One dword NOP. */ } else if (count == 0 && ib->cur_dw < ib->num_dw && AC_IS_TRACE_POINT(ib->ib[ib->cur_dw])) { diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h index d77d2ff5750..fef3e14d5e2 100644 --- a/src/amd/common/sid.h +++ b/src/amd/common/sid.h @@ -231,6 +231,9 @@ #define PKT0(index, count) (PKT_TYPE_S(0) | PKT0_BASE_INDEX_S(index) | PKT_COUNT_S(count)) #define PKT3(op, count, predicate) (PKT_TYPE_S(3) | PKT_COUNT_S(count) | PKT3_IT_OPCODE_S(op) | PKT3_PREDICATE(predicate)) +#define PKT2_NOP_PAD PKT_TYPE_S(2) +#define PKT3_NOP_PAD PKT3(PKT3_NOP, 0x3fff, 0) /* header-only version */ + #define PKT3_CP_DMA 0x41 /* 1. header * 2. SRC_ADDR_LO [31:0] or DATA [31:0] diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c index d53aaf33144..e6a3bcd45a2 100644 --- a/src/amd/vulkan/si_cmd_buffer.c +++ b/src/amd/vulkan/si_cmd_buffer.c @@ -520,9 +520,9 @@ cik_create_gfx_config(struct radv_device *device) while (cs->cdw & 7) { if (device->physical_device->rad_info.gfx_ib_pad_with_type2) - radeon_emit(cs, 0x80000000); + radeon_emit(cs, PKT2_NOP_PAD); else - radeon_emit(cs, 0xffff1000); + radeon_emit(cs, PKT3_NOP_PAD); } device->gfx_init = device->ws->buffer_create(device->ws, diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index 65b6bb4187d..7f391a60a72 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -424,7 +424,7 @@ static void radv_amdgpu_cs_grow(struct radeon_cmdbuf *_cs, size_t min_size) ib_size = MIN2(ib_size, 0xfffff); while (!cs->base.cdw || (cs->base.cdw & 7) != 4) - radeon_emit(&cs->base, 0xffff1000); + radeon_emit(&cs->base, PKT3_NOP_PAD); *cs->ib_size_ptr |= cs->base.cdw + 4; @@ -480,7 +480,7 @@ static VkResult radv_amdgpu_cs_finalize(struct radeon_cmdbuf *_cs) if (cs->ws->use_ib_bos) { while (!cs->base.cdw || (cs->base.cdw & 7) != 0) - radeon_emit(&cs->base, 0xffff1000); + radeon_emit(&cs->base, PKT3_NOP_PAD); *cs->ib_size_ptr |= cs->base.cdw; @@ -1042,7 +1042,7 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx, struct radeon_winsys *ws = (struct radeon_winsys*)cs0->ws; uint32_t bo_list; struct radv_amdgpu_cs_request request; - uint32_t pad_word = 0xffff1000U; + uint32_t pad_word = PKT3_NOP_PAD; bool emit_signal_sem = sem_info->cs_emit_signal; if (radv_amdgpu_winsys(ws)->info.chip_class == GFX6) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index a8e7ed0f21b..80eb0f6b7f0 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -1099,7 +1099,7 @@ static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw, /* Pad with NOPs and add INDIRECT_BUFFER packet */ while ((rcs->current.cdw & 7) != 4) - radeon_emit(rcs, 0xffff1000); /* type3 nop packet */ + radeon_emit(rcs, PKT3_NOP_PAD); radeon_emit(rcs, PKT3(PKT3_INDIRECT_BUFFER_CIK, 2, 0)); radeon_emit(rcs, va); @@ -1680,10 +1680,10 @@ static int amdgpu_cs_flush(struct radeon_cmdbuf *rcs, /* pad GFX ring to 8 DWs to meet CP fetch alignment requirements */ if (ws->info.gfx_ib_pad_with_type2) { while (rcs->current.cdw & 7) - radeon_emit(rcs, 0x80000000); /* type2 nop packet */ + radeon_emit(rcs, PKT2_NOP_PAD); } else { while (rcs->current.cdw & 7) - radeon_emit(rcs, 0xffff1000); /* type3 nop packet */ + radeon_emit(rcs, PKT3_NOP_PAD); } if (cs->ring_type == RING_GFX) ws->gfx_ib_size_counter += (rcs->prev_dw + rcs->current.cdw) * 4; @@ -1691,7 +1691,7 @@ static int amdgpu_cs_flush(struct radeon_cmdbuf *rcs, /* Also pad secondary IBs. */ if (cs->compute_ib.ib_mapped) { while (cs->compute_ib.base.current.cdw & 7) - radeon_emit(&cs->compute_ib.base, 0xffff1000); /* type3 nop packet */ + radeon_emit(&cs->compute_ib.base, PKT3_NOP_PAD); } break; case RING_UVD: -- 2.30.2