Skip to contentSkip to conversation

drm/amdgpu: add flags to emit_ib interface

PATCH Superseded Xiao, Jack 2 participants 2 messages Jan 18, 2019 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiao, Jack

author
#0 lore raw

PATCH 1/1 drm/amdgpu: add flags to emit_ib interface

Replace the last bool type parameter with a general flags parameter, to make the last parameter be able to contain more information.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   | 7 ++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h  | 2 +-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 6 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/si_dma.c      | 2 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c    | 6 +++---
 20 files changed, 35 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +6 -1
index c48207b3..1b7edd7 100644
@@ -221,7 +221,12 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 			!amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */
 			continue;
 
-		amdgpu_ring_emit_ib(ring, job, ib, need_ctx_switch);
+		if (need_ctx_switch)
+			status |= AMDGPU_HAVE_CTX_SWITCH;
+		else
+			status &= ~AMDGPU_HAVE_CTX_SWITCH;
+
+		amdgpu_ring_emit_ib(ring, job, ib, status);
 		need_ctx_switch = false;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
index d87e828..d7fae26 100644
@@ -131,7 +131,7 @@ struct amdgpu_ring_funcs {
 	void (*emit_ib)(struct amdgpu_ring *ring,
 			struct amdgpu_job *job,
 			struct amdgpu_ib *ib,
-			bool ctx_switch);
+			uint32_t flags);
 	void (*emit_fence)(struct amdgpu_ring *ring, uint64_t addr,
 			   uint64_t seq, unsigned flags);
 	void (*emit_pipeline_sync)(struct amdgpu_ring *ring);
@@ -229,7 +229,7 @@ struct amdgpu_ring {
 #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r))
 #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r))
 #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r))
-#define amdgpu_ring_emit_ib(r, job, ib, c) ((r)->funcs->emit_ib((r), (job), (ib), (c)))
+#define amdgpu_ring_emit_ib(r, job, ib, flags) ((r)->funcs->emit_ib((r), (job), (ib), (flags)))
 #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r))
 #define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr))
 #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags))
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 98a1b2c..c021b11 100644
@@ -1035,7 +1035,7 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx)
 void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring,
 				struct amdgpu_job *job,
 				struct amdgpu_ib *ib,
-				bool ctx_switch)
+				uint32_t flags)
 {
 	amdgpu_ring_write(ring, VCE_CMD_IB);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +1 -1
index 5029365..30ea54d 100644
@@ -66,7 +66,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
 int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx);
 int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx);
 void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
-				struct amdgpu_ib *ib, bool ctx_switch);
+				struct amdgpu_ib *ib, uint32_t flags);
 void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
 				unsigned flags);
 int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring);
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +1 -1
index 4579519..189599b 100644
@@ -220,7 +220,7 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 extra_bits = vmid & 0xf;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -2
index 1dc3013..305276c 100644
@@ -1842,13 +1842,13 @@ static void gfx_v6_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
 static void gfx_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 header, control = 0;
 
 	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
-	if (ctx_switch) {
+	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
 		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
 		amdgpu_ring_write(ring, 0);
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -3
index 3a9fb60..7984292 100644
@@ -2228,13 +2228,13 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
 static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 header, control = 0;
 
 	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
-	if (ctx_switch) {
+	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
 		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
 		amdgpu_ring_write(ring, 0);
 	}
@@ -2259,7 +2259,7 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
 					  struct amdgpu_job *job,
 					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index 57cb3a5..a267476 100644
@@ -6047,7 +6047,7 @@ static void gfx_v8_0_ring_emit_vgt_flush(struct amdgpu_ring *ring)
 static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 header, control = 0;
@@ -6079,7 +6079,7 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
 					  struct amdgpu_job *job,
 					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index fbca049..262ee3c 100644
@@ -3972,7 +3972,7 @@ static void gfx_v9_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
 static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 header, control = 0;
@@ -4005,7 +4005,7 @@ static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 static void gfx_v9_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
 					  struct amdgpu_job *job,
 					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
index 9f3cb2a..cca3552 100644
@@ -247,7 +247,7 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring,
 				   struct amdgpu_job *job,
 				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
index 06c5a27..0ce8331 100644
@@ -421,7 +421,7 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
 				   struct amdgpu_job *job,
 				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
index 48a166b..127b859 100644
@@ -500,7 +500,7 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring,
 				   struct amdgpu_job *job,
 				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/si_dma.c +1 -1
index b6e4731..f15f196 100644
@@ -63,7 +63,7 @@ static void si_dma_ring_set_wptr(struct amdgpu_ring *ring)
 static void si_dma_ring_emit_ib(struct amdgpu_ring *ring,
 				struct amdgpu_job *job,
 				struct amdgpu_ib *ib,
-				bool ctx_switch)
+				uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 	/* The indirect buffer packet must end on an 8 DW boundary in the DMA ring.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -1
index d69c8f6..c4fb586 100644
@@ -511,7 +511,7 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring)
 static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0));
 	amdgpu_ring_write(ring, ib->gpu_addr);
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -1
index ee8cd06..52bd8a6 100644
@@ -526,7 +526,7 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)
 static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0));
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -2
index d4f4a66..c9edddf 100644
@@ -977,7 +977,7 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring)
 static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
@@ -1003,7 +1003,7 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
 static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +2 -2
index aef9240..dc461df 100644
@@ -1272,7 +1272,7 @@ static int uvd_v7_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
 static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	struct amdgpu_device *adev = ring->adev;
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
@@ -1303,7 +1303,7 @@ static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
 static void uvd_v7_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -1
index 2668eff..6ec65cf1 100644
@@ -834,7 +834,7 @@ static void vce_v3_0_get_clockgating_state(void *handle, u32 *flags)
 static void vce_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
 				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -1
index 9fb34b7..aadc3e6 100644
@@ -947,7 +947,7 @@ static int vce_v4_0_set_powergating_state(void *handle,
 #endif
 
 static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
-					struct amdgpu_ib *ib, bool ctx_switch)
+					struct amdgpu_ib *ib, uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -3
index 89bb2fe..3dbc51f 100644
@@ -1371,7 +1371,7 @@ static void vcn_v1_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
 static void vcn_v1_0_dec_ring_emit_ib(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	struct amdgpu_device *adev = ring->adev;
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
@@ -1531,7 +1531,7 @@ static void vcn_v1_0_enc_ring_insert_end(struct amdgpu_ring *ring)
 static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
@@ -1736,7 +1736,7 @@ static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6
 static void vcn_v1_0_jpeg_ring_emit_ib(struct amdgpu_ring *ring,
 					struct amdgpu_job *job,
 					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
 {
 	struct amdgpu_device *adev = ring->adev;
 	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1547807663-16333-1-git-send-email-Jack.Xiao-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 18.01.19 um 11:41 schrieb Xiao, Jack:

Quoted 32 lines

Replace the last bool type parameter with a general flags parameter, to make the last parameter be able to contain more information.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   | 7 ++++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h  | 2 +-
  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 6 +++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 2 +-
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 2 +-
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 2 +-
  drivers/gpu/drm/amd/amdgpu/si_dma.c      | 2 +-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c    | 6 +++---
  20 files changed, 35 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
index c48207b3..1b7edd7 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · line 227

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +4 -1
@@ -221,7 +221,12 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  			!amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */
  			continue;
 
-		amdgpu_ring_emit_ib(ring, job, ib, need_ctx_switch);
+		if (need_ctx_switch)
+			status |= AMDGPU_HAVE_CTX_SWITCH;
+		else
+			status &= ~AMDGPU_HAVE_CTX_SWITCH;

Better drop setting need_ctx_switch = false below and set the status directly.

Apart from that this looks good to me,
Christian.

Quoted 330 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -0
+
+		amdgpu_ring_emit_ib(ring, job, ib, status);
  		need_ctx_switch = false;
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
index d87e828..d7fae26 100644
@@ -131,7 +131,7 @@ struct amdgpu_ring_funcs {
  	void (*emit_ib)(struct amdgpu_ring *ring,
  			struct amdgpu_job *job,
  			struct amdgpu_ib *ib,
-			bool ctx_switch);
+			uint32_t flags);
  	void (*emit_fence)(struct amdgpu_ring *ring, uint64_t addr,
  			   uint64_t seq, unsigned flags);
  	void (*emit_pipeline_sync)(struct amdgpu_ring *ring);
@@ -229,7 +229,7 @@ struct amdgpu_ring {
  #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r))
  #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r))
  #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r))
-#define amdgpu_ring_emit_ib(r, job, ib, c) ((r)->funcs->emit_ib((r), (job), (ib), (c)))
+#define amdgpu_ring_emit_ib(r, job, ib, flags) ((r)->funcs->emit_ib((r), (job), (ib), (flags)))
  #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r))
  #define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr))
  #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags))
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 98a1b2c..c021b11 100644
@@ -1035,7 +1035,7 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx)
  void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring,
  				struct amdgpu_job *job,
  				struct amdgpu_ib *ib,
-				bool ctx_switch)
+				uint32_t flags)
  {
  	amdgpu_ring_write(ring, VCE_CMD_IB);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +1 -1
index 5029365..30ea54d 100644
@@ -66,7 +66,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
  int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx);
  int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx);
  void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
-				struct amdgpu_ib *ib, bool ctx_switch);
+				struct amdgpu_ib *ib, uint32_t flags);
  void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
  				unsigned flags);
  int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring);
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +1 -1
index 4579519..189599b 100644
@@ -220,7 +220,7 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 extra_bits = vmid & 0xf;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -2
index 1dc3013..305276c 100644
@@ -1842,13 +1842,13 @@ static void gfx_v6_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
  static void gfx_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 header, control = 0;
 
  	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
-	if (ctx_switch) {
+	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
  		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
  		amdgpu_ring_write(ring, 0);
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -3
index 3a9fb60..7984292 100644
@@ -2228,13 +2228,13 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
  static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 header, control = 0;
 
  	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
-	if (ctx_switch) {
+	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
  		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
  		amdgpu_ring_write(ring, 0);
  	}
@@ -2259,7 +2259,7 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
  					  struct amdgpu_job *job,
  					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index 57cb3a5..a267476 100644
@@ -6047,7 +6047,7 @@ static void gfx_v8_0_ring_emit_vgt_flush(struct amdgpu_ring *ring)
  static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 header, control = 0;
@@ -6079,7 +6079,7 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
  					  struct amdgpu_job *job,
  					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index fbca049..262ee3c 100644
@@ -3972,7 +3972,7 @@ static void gfx_v9_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
  static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 header, control = 0;
@@ -4005,7 +4005,7 @@ static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
  static void gfx_v9_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
  					  struct amdgpu_job *job,
  					  struct amdgpu_ib *ib,
-					  bool ctx_switch)
+					  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
index 9f3cb2a..cca3552 100644
@@ -247,7 +247,7 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring,
  				   struct amdgpu_job *job,
  				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
index 06c5a27..0ce8331 100644
@@ -421,7 +421,7 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
  				   struct amdgpu_job *job,
  				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
index 48a166b..127b859 100644
@@ -500,7 +500,7 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring,
  				   struct amdgpu_job *job,
  				   struct amdgpu_ib *ib,
-				   bool ctx_switch)
+				   uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/si_dma.c +1 -1
index b6e4731..f15f196 100644
@@ -63,7 +63,7 @@ static void si_dma_ring_set_wptr(struct amdgpu_ring *ring)
  static void si_dma_ring_emit_ib(struct amdgpu_ring *ring,
  				struct amdgpu_job *job,
  				struct amdgpu_ib *ib,
-				bool ctx_switch)
+				uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
  	/* The indirect buffer packet must end on an 8 DW boundary in the DMA ring.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -1
index d69c8f6..c4fb586 100644
@@ -511,7 +511,7 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring)
  static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0));
  	amdgpu_ring_write(ring, ib->gpu_addr);
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -1
index ee8cd06..52bd8a6 100644
@@ -526,7 +526,7 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)
  static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0));
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -2
index d4f4a66..c9edddf 100644
@@ -977,7 +977,7 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring)
  static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
@@ -1003,7 +1003,7 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
  static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +2 -2
index aef9240..dc461df 100644
@@ -1272,7 +1272,7 @@ static int uvd_v7_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
  static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	struct amdgpu_device *adev = ring->adev;
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
@@ -1303,7 +1303,7 @@ static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
  static void uvd_v7_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -1
index 2668eff..6ec65cf1 100644
@@ -834,7 +834,7 @@ static void vce_v3_0_get_clockgating_state(void *handle, u32 *flags)
  static void vce_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
  				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  bool ctx_switch)
+				  uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -1
index 9fb34b7..aadc3e6 100644
@@ -947,7 +947,7 @@ static int vce_v4_0_set_powergating_state(void *handle,
  #endif
 
  static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
-					struct amdgpu_ib *ib, bool ctx_switch)
+					struct amdgpu_ib *ib, uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -2
index 89bb2fe..3dbc51f 100644
@@ -1371,7 +1371,7 @@ static void vcn_v1_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
  static void vcn_v1_0_dec_ring_emit_ib(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	struct amdgpu_device *adev = ring->adev;
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
@@ -1531,7 +1531,7 @@ static void vcn_v1_0_enc_ring_insert_end(struct amdgpu_ring *ring)
  static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);
 

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6 · line 1742

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 -1
@@ -1736,7 +1736,7 @@ static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6
  static void vcn_v1_0_jpeg_ring_emit_ib(struct amdgpu_ring *ring,
  					struct amdgpu_job *job,
  					struct amdgpu_ib *ib,
-					bool ctx_switch)
+					uint32_t flags)
  {
  	struct amdgpu_device *adev = ring->adev;
  	unsigned vmid = AMDGPU_JOB_GET_VMID(job);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx