Skip to contentSkip to conversation

drm/amdgpu: Modify the argument of emit_ib interface

PATCH Superseded Rex Zhu 2 participants 2 messages Oct 24, 2018 1 message not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Modify the argument of emit_ib interface

use the point of struct amdgpu_job as the function argument instand of vmid, so the other members of struct amdgpu_job can be visit in emit_ib function.

v2: add a wrapper for getting the VMID
add the job before the ib on the parameter list.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   |  3 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.h  |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  5 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h  |  4 ++--
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 10 +++++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 10 +++++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    | 26 +++++++++++++++-----------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  5 ++++-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  5 ++++-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   |  7 +++++--
 drivers/gpu/drm/amd/amdgpu/si_dma.c      |  4 +++-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    | 11 +++++++++--
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c    | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  6 +++++-
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c    | 18 +++++++++++++-----
 21 files changed, 106 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -2
index b8963b7..ba277cd 100644
@@ -221,8 +221,7 @@ 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, ib, job ? job->vmid : 0,
-				    need_ctx_switch);
+		amdgpu_ring_emit_ib(ring, job, ib, need_ctx_switch);
 		need_ctx_switch = false;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2 -0
index 57cfe78..a71fe22 100644
@@ -33,6 +33,8 @@
 #define to_amdgpu_job(sched_job)		\
 		container_of((sched_job), struct amdgpu_job, base)
 
+#define GET_VMID(job) ((job) ? (job)->vmid : 0)
+
 struct amdgpu_fence;
 
 struct amdgpu_job {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3 -2
index 4caa301..ef7252a 100644
@@ -129,8 +129,9 @@ struct amdgpu_ring_funcs {
 	unsigned emit_ib_size;
 	/* command emit functions */
 	void (*emit_ib)(struct amdgpu_ring *ring,
+			struct amdgpu_job *job,
 			struct amdgpu_ib *ib,
-			unsigned vmid, bool ctx_switch);
+			bool ctx_switch);
 	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 +230,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, ib, vmid, c) (r)->funcs->emit_ib((r), (ib), (vmid), (c))
+#define amdgpu_ring_emit_ib(r, job, ib, c) ((r)->funcs->emit_ib((r), (job), (ib), (c)))
 #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 +4 -2
index 5f3f540..56675ec 100644
@@ -1032,8 +1032,10 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx)
  * @ib: the IB to execute
  *
  */
-void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib,
-			     unsigned vmid, bool ctx_switch)
+void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring,
+				struct amdgpu_job *job,
+				struct amdgpu_ib *ib,
+				bool ctx_switch)
 {
 	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 +2 -2
index a1f209e..5029365 100644
@@ -65,8 +65,8 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
 void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp);
 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_ib *ib,
-			     unsigned vmid, bool ctx_switch);
+void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
+				struct amdgpu_ib *ib, bool ctx_switch);
 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 +3 -1
index 32eb43d..1586079 100644
@@ -218,9 +218,11 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  * Schedule an IB in the DMA ring (CIK).
  */
 static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 extra_bits = vmid & 0xf;
 
 	/* IB packet must end on a 8 DW boundary */
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 622dd70..82f8f92 100644
@@ -1845,9 +1845,11 @@ 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,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 header, control = 0;
 
 	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 -3
index cfa45d9..9fb809f 100644
@@ -2233,9 +2233,11 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
  * on the gfx ring for execution by the GPU.
  */
 static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
-				      struct amdgpu_ib *ib,
-				      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 header, control = 0;
 
 	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
@@ -2262,9 +2264,11 @@ 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,
-					  unsigned vmid, bool ctx_switch)
+					  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
 	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -3
index cdcfeb5..ae9efdd 100644
@@ -6129,9 +6129,11 @@ 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_ib *ib,
-				      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 header, control = 0;
 
 	if (ib->flags & AMDGPU_IB_FLAG_CE)
@@ -6159,9 +6161,11 @@ 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,
-					  unsigned vmid, bool ctx_switch)
+					  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
 	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +15 -11
index 4281a37..360349b 100644
@@ -4072,9 +4072,11 @@ 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_ib *ib,
-                                      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	u32 header, control = 0;
 
 	if (ib->flags & AMDGPU_IB_FLAG_CE)
@@ -4103,20 +4105,22 @@ 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_ib *ib,
-                                          unsigned vmid, bool ctx_switch)
+					  struct amdgpu_job *job,
+					  struct amdgpu_ib *ib,
+					  bool ctx_switch)
 {
-        u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
+	unsigned vmid = GET_VMID(job);
+	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
-        amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
+	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
 	BUG_ON(ib->gpu_addr & 0x3); /* Dword align */
-        amdgpu_ring_write(ring,
+	amdgpu_ring_write(ring,
 #ifdef __BIG_ENDIAN
-                                (2 << 0) |
+				(2 << 0) |
 #endif
-                                lower_32_bits(ib->gpu_addr));
-        amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
-        amdgpu_ring_write(ring, control);
+				lower_32_bits(ib->gpu_addr));
+	amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
+	amdgpu_ring_write(ring, control);
 }
 
 static void gfx_v9_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +4 -1
index bedbd5f..8281b6d 100644
@@ -245,9 +245,12 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  * Schedule an IB in the DMA ring (VI).
  */
 static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring,
+				   struct amdgpu_job *job,
 				   struct amdgpu_ib *ib,
-				   unsigned vmid, bool ctx_switch)
+				   bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	/* IB packet must end on a 8 DW boundary */
 	sdma_v2_4_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +4 -1
index 415968d..4f9671a 100644
@@ -419,9 +419,12 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  * Schedule an IB in the DMA ring (VI).
  */
 static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
+				   struct amdgpu_job *job,
 				   struct amdgpu_ib *ib,
-				   unsigned vmid, bool ctx_switch)
+				   bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	/* IB packet must end on a 8 DW boundary */
 	sdma_v3_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 -2
index 88d9343..365b56f 100644
@@ -502,9 +502,12 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  * Schedule an IB in the DMA ring (VEGA10).
  */
 static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring,
-					struct amdgpu_ib *ib,
-					unsigned vmid, bool ctx_switch)
+				   struct amdgpu_job *job,
+				   struct amdgpu_ib *ib,
+				   bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	/* IB packet must end on a 8 DW boundary */
 	sdma_v4_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/si_dma.c +3 -1
index d9b27d7..fbd029e 100644
@@ -61,9 +61,11 @@ 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,
-				unsigned vmid, bool ctx_switch)
+				bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
 	/* The indirect buffer packet must end on an 8 DW boundary in the DMA ring.
 	 * Pad as necessary with NOPs.
 	 */
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
index 1fc17bf..a32b361 100644
@@ -519,8 +519,9 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring)
  * Write ring commands to execute the indirect buffer
  */
 static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
 	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 +2 -1
index fde6ad5..2a3554a 100644
@@ -535,8 +535,9 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)
  * Write ring commands to execute the indirect buffer
  */
 static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
 	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 +9 -2
index 7a5b402..ad380cc 100644
@@ -1004,9 +1004,12 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring)
  * Write ring commands to execute the indirect buffer
  */
 static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_VMID, 0));
 	amdgpu_ring_write(ring, vmid);
 
@@ -1027,8 +1030,12 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
  * Write enc ring commands to execute the indirect buffer
  */
 static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);
 	amdgpu_ring_write(ring, vmid);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +8 -2
index 58b39af..e5f085e 100644
@@ -1300,10 +1300,12 @@ static int uvd_v7_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
  * Write ring commands to execute the indirect buffer
  */
 static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
 				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
 {
 	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
 	amdgpu_ring_write(ring,
 		PACKET0(SOC15_REG_OFFSET(UVD, ring->me, mmUVD_LMI_RBC_IB_VMID), 0));
@@ -1329,8 +1331,12 @@ static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
  * Write enc ring commands to execute the indirect buffer
  */
 static void uvd_v7_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);
 	amdgpu_ring_write(ring, vmid);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +5 -1
index 6dbd397..d9dbaa1 100644
@@ -838,8 +838,12 @@ 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_ib *ib, unsigned int vmid, bool ctx_switch)
+				  struct amdgpu_job *job,
+				  struct amdgpu_ib *ib,
+				  bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, VCE_CMD_IB_VM);
 	amdgpu_ring_write(ring, vmid);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +4 -2
index 1c94718..fee8ea2 100644
@@ -951,9 +951,11 @@ 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_ib *ib, unsigned int vmid, bool ctx_switch)
+static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
+					struct amdgpu_ib *ib, bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, VCE_CMD_IB_VM);
 	amdgpu_ring_write(ring, vmid);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +13 -5
index eae9092..422bec4 100644
@@ -1366,10 +1366,12 @@ static void vcn_v1_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
  * Write ring commands to execute the indirect buffer
  */
 static void vcn_v1_0_dec_ring_emit_ib(struct amdgpu_ring *ring,
-				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
 	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
 	amdgpu_ring_write(ring,
 		PACKET0(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_RBC_IB_VMID), 0));
@@ -1524,8 +1526,12 @@ static void vcn_v1_0_enc_ring_insert_end(struct amdgpu_ring *ring)
  * Write enc ring commands to execute the indirect buffer
  */
 static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
+	unsigned vmid = GET_VMID(job);
+
 	amdgpu_ring_write(ring, VCN_ENC_CMD_IB);
 	amdgpu_ring_write(ring, vmid);
 	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
@@ -1725,10 +1731,12 @@ static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6
  * Write ring commands to execute the indirect buffer.
  */
 static void vcn_v1_0_jpeg_ring_emit_ib(struct amdgpu_ring *ring,
-				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
 {
 	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
 	amdgpu_ring_write(ring,
 		PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_IB_VMID), 0, 0, PACKETJ_TYPE0));
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): 1540364466-29657-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 24.10.18 um 09:01 schrieb Rex Zhu:

Quoted 51 lines

use the point of struct amdgpu_job as the function argument instand of vmid, so the other members of struct amdgpu_job can be visit in emit_ib function.

v2: add a wrapper for getting the VMID
add the job before the ib on the parameter list.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   |  3 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h  |  2 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  5 +++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h  |  4 ++--
  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 10 +++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 10 +++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    | 26 +++++++++++++++-----------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  5 ++++-
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  5 ++++-
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   |  7 +++++--
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  4 +++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    | 11 +++++++++--
  drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c    | 10 ++++++++--
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  6 +++++-
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c    | 18 +++++++++++++-----
  21 files changed, 106 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -2
index b8963b7..ba277cd 100644
@@ -221,8 +221,7 @@ 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, ib, job ? job->vmid : 0,
-				    need_ctx_switch);
+		amdgpu_ring_emit_ib(ring, job, ib, need_ctx_switch);
  		need_ctx_switch = false;
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0 -0
index 57cfe78..a71fe22 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_job.h line 36

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +1 -0
@@ -33,6 +33,8 @@
  #define to_amdgpu_job(sched_job)		\
  		container_of((sched_job), struct amdgpu_job, base)
 
+#define GET_VMID(job) ((job) ? (job)->vmid : 0)

This needs a better name, something like AMDGPU_JOB_GET_VMID().

Apart from that looks good to me,
Christian.

Quoted 446 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +1 -0
+
  struct amdgpu_fence;
 
  struct amdgpu_job {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3 -2
index 4caa301..ef7252a 100644
@@ -129,8 +129,9 @@ struct amdgpu_ring_funcs {
  	unsigned emit_ib_size;
  	/* command emit functions */
  	void (*emit_ib)(struct amdgpu_ring *ring,
+			struct amdgpu_job *job,
  			struct amdgpu_ib *ib,
-			unsigned vmid, bool ctx_switch);
+			bool ctx_switch);
  	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 +230,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, ib, vmid, c) (r)->funcs->emit_ib((r), (ib), (vmid), (c))
+#define amdgpu_ring_emit_ib(r, job, ib, c) ((r)->funcs->emit_ib((r), (job), (ib), (c)))
  #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 +4 -2
index 5f3f540..56675ec 100644
@@ -1032,8 +1032,10 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx)
   * @ib: the IB to execute
   *
   */
-void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib,
-			     unsigned vmid, bool ctx_switch)
+void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring,
+				struct amdgpu_job *job,
+				struct amdgpu_ib *ib,
+				bool ctx_switch)
  {
  	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 +2 -2
index a1f209e..5029365 100644
@@ -65,8 +65,8 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
  void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp);
  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_ib *ib,
-			     unsigned vmid, bool ctx_switch);
+void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
+				struct amdgpu_ib *ib, bool ctx_switch);
  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 +3 -1
index 32eb43d..1586079 100644
@@ -218,9 +218,11 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
   * Schedule an IB in the DMA ring (CIK).
   */
  static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 extra_bits = vmid & 0xf;
 
  	/* IB packet must end on a 8 DW boundary */
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 622dd70..82f8f92 100644
@@ -1845,9 +1845,11 @@ 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,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 header, control = 0;
 
  	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 -3
index cfa45d9..9fb809f 100644
@@ -2233,9 +2233,11 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
   * on the gfx ring for execution by the GPU.
   */
  static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
-				      struct amdgpu_ib *ib,
-				      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 header, control = 0;
 
  	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
@@ -2262,9 +2264,11 @@ 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,
-					  unsigned vmid, bool ctx_switch)
+					  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
  	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -3
index cdcfeb5..ae9efdd 100644
@@ -6129,9 +6129,11 @@ 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_ib *ib,
-				      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 header, control = 0;
 
  	if (ib->flags & AMDGPU_IB_FLAG_CE)
@@ -6159,9 +6161,11 @@ 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,
-					  unsigned vmid, bool ctx_switch)
+					  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
  	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +15 -11
index 4281a37..360349b 100644
@@ -4072,9 +4072,11 @@ 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_ib *ib,
-                                      unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	u32 header, control = 0;
 
  	if (ib->flags & AMDGPU_IB_FLAG_CE)
@@ -4103,20 +4105,22 @@ 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_ib *ib,
-                                          unsigned vmid, bool ctx_switch)
+					  struct amdgpu_job *job,
+					  struct amdgpu_ib *ib,
+					  bool ctx_switch)
  {
-        u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
+	unsigned vmid = GET_VMID(job);
+	u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
 
-        amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
+	amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
  	BUG_ON(ib->gpu_addr & 0x3); /* Dword align */
-        amdgpu_ring_write(ring,
+	amdgpu_ring_write(ring,
  #ifdef __BIG_ENDIAN
-                                (2 << 0) |
+				(2 << 0) |
  #endif
-                                lower_32_bits(ib->gpu_addr));
-        amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
-        amdgpu_ring_write(ring, control);
+				lower_32_bits(ib->gpu_addr));
+	amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
+	amdgpu_ring_write(ring, control);
  }
 
  static void gfx_v9_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +4 -1
index bedbd5f..8281b6d 100644
@@ -245,9 +245,12 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
   * Schedule an IB in the DMA ring (VI).
   */
  static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring,
+				   struct amdgpu_job *job,
  				   struct amdgpu_ib *ib,
-				   unsigned vmid, bool ctx_switch)
+				   bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	/* IB packet must end on a 8 DW boundary */
  	sdma_v2_4_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +4 -1
index 415968d..4f9671a 100644
@@ -419,9 +419,12 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
   * Schedule an IB in the DMA ring (VI).
   */
  static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
+				   struct amdgpu_job *job,
  				   struct amdgpu_ib *ib,
-				   unsigned vmid, bool ctx_switch)
+				   bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	/* IB packet must end on a 8 DW boundary */
  	sdma_v3_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 -2
index 88d9343..365b56f 100644
@@ -502,9 +502,12 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
   * Schedule an IB in the DMA ring (VEGA10).
   */
  static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring,
-					struct amdgpu_ib *ib,
-					unsigned vmid, bool ctx_switch)
+				   struct amdgpu_job *job,
+				   struct amdgpu_ib *ib,
+				   bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	/* IB packet must end on a 8 DW boundary */
  	sdma_v4_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);
 
drivers/gpu/drm/amd/amdgpu/si_dma.c +3 -1
index d9b27d7..fbd029e 100644
@@ -61,9 +61,11 @@ 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,
-				unsigned vmid, bool ctx_switch)
+				bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
  	/* The indirect buffer packet must end on an 8 DW boundary in the DMA ring.
  	 * Pad as necessary with NOPs.
  	 */
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
index 1fc17bf..a32b361 100644
@@ -519,8 +519,9 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring)
   * Write ring commands to execute the indirect buffer
   */
  static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
  	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 +2 -1
index fde6ad5..2a3554a 100644
@@ -535,8 +535,9 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)
   * Write ring commands to execute the indirect buffer
   */
  static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
  	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 +9 -2
index 7a5b402..ad380cc 100644
@@ -1004,9 +1004,12 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring)
   * Write ring commands to execute the indirect buffer
   */
  static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_VMID, 0));
  	amdgpu_ring_write(ring, vmid);
 
@@ -1027,8 +1030,12 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
   * Write enc ring commands to execute the indirect buffer
   */
  static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);
  	amdgpu_ring_write(ring, vmid);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +8 -2
index 58b39af..e5f085e 100644
@@ -1300,10 +1300,12 @@ static int uvd_v7_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
   * Write ring commands to execute the indirect buffer
   */
  static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
+				  struct amdgpu_job *job,
  				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+				  bool ctx_switch)
  {
  	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
  	amdgpu_ring_write(ring,
  		PACKET0(SOC15_REG_OFFSET(UVD, ring->me, mmUVD_LMI_RBC_IB_VMID), 0));
@@ -1329,8 +1331,12 @@ static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
   * Write enc ring commands to execute the indirect buffer
   */
  static void uvd_v7_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);
  	amdgpu_ring_write(ring, vmid);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +5 -1
index 6dbd397..d9dbaa1 100644
@@ -838,8 +838,12 @@ 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_ib *ib, unsigned int vmid, bool ctx_switch)
+				  struct amdgpu_job *job,
+				  struct amdgpu_ib *ib,
+				  bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, VCE_CMD_IB_VM);
  	amdgpu_ring_write(ring, vmid);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +4 -2
index 1c94718..fee8ea2 100644
@@ -951,9 +951,11 @@ 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_ib *ib, unsigned int vmid, bool ctx_switch)
+static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
+					struct amdgpu_ib *ib, bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, VCE_CMD_IB_VM);
  	amdgpu_ring_write(ring, vmid);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +9 -4
index eae9092..422bec4 100644
@@ -1366,10 +1366,12 @@ static void vcn_v1_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
   * Write ring commands to execute the indirect buffer
   */
  static void vcn_v1_0_dec_ring_emit_ib(struct amdgpu_ring *ring,
-				  struct amdgpu_ib *ib,
-				  unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
  	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
  	amdgpu_ring_write(ring,
  		PACKET0(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_RBC_IB_VMID), 0));
@@ -1524,8 +1526,12 @@ static void vcn_v1_0_enc_ring_insert_end(struct amdgpu_ring *ring)
   * Write enc ring commands to execute the indirect buffer
   */
  static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
-		struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
+	unsigned vmid = GET_VMID(job);
+
  	amdgpu_ring_write(ring, VCN_ENC_CMD_IB);
  	amdgpu_ring_write(ring, vmid);
  	amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
@@ -1725,10 +1731,12 @@ static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6
   * Write ring commands to execute the indirect buffer.
   */
  static void vcn_v1_0_jpeg_ring_emit_ib(struct amdgpu_ring *ring,
-				  struct amdgpu_ib *ib,

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 10 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +4 -1
-				  unsigned vmid, bool ctx_switch)
+					struct amdgpu_job *job,
+					struct amdgpu_ib *ib,
+					bool ctx_switch)
  {
  	struct amdgpu_device *adev = ring->adev;
+	unsigned vmid = GET_VMID(job);
 
  	amdgpu_ring_write(ring,
  		PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_IB_VMID), 0, 0, PACKETJ_TYPE0));

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