<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><font size="2"><span style="font-size:11pt;">>Maybe indeed provide the CSA address as parameter instead. It doesn't
<br>
>really matter that it is unused by most IP block implementations. <br>
</span></font></p>
<p style="margin-top:0;margin-bottom:0"><font size="2"><span style="font-size:11pt;">>Alternative is to use a wrapper function to get the VMID from the job.</span></font><br>
</p>
<br>
<p style="margin-top:0;margin-bottom:0">I preferred to use a wrapper function to get vmid.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Because if use CSA address as parameter, we need to check which ring it is.</p>
<p style="margin-top:0;margin-bottom:0">The csa address is different between sdma/gfx/compute.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Tuesday, October 23, 2018 8:09 PM<br>
<b>To:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Modify the argument of emit_ib interface</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 23.10.18 um 14:01 schrieb Rex Zhu:<br>
> use the point of struct amdgpu_job as the function<br>
> argument instand of vmid, so the other members of<br>
> struct amdgpu_job can be visit in emit_ib function.<br>
><br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 3 +--<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 2 +-<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | 2 +-<br>
> drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 3 ++-<br>
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 3 ++-<br>
> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++++--<br>
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 ++++--<br>
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 24 +++++++++++++-----------<br>
> drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 4 +++-<br>
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 4 +++-<br>
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 +++-<br>
> drivers/gpu/drm/amd/amdgpu/si_dma.c | 3 ++-<br>
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 2 +-<br>
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 2 +-<br>
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++++--<br>
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 7 +++++--<br>
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 4 +++-<br>
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 4 +++-<br>
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 10 +++++++---<br>
> 20 files changed, 66 insertions(+), 37 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
> index b8963b7..0b227ca 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
> @@ -221,8 +221,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,<br>
> !amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */<br>
> continue;<br>
> <br>
> - amdgpu_ring_emit_ib(ring, ib, job ? job->vmid : 0,<br>
> - need_ctx_switch);<br>
> + amdgpu_ring_emit_ib(ring, ib, job, need_ctx_switch);<br>
> need_ctx_switch = false;<br>
> }<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
> index 3cb7fb8..0f0f8fb 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
> @@ -229,7 +229,7 @@ struct amdgpu_ring {<br>
> #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r))<br>
> #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r))<br>
> #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r))<br>
> -#define amdgpu_ring_emit_ib(r, ib, vmid, c) (r)->funcs->emit_ib((r), (ib), (vmid), (c))<br>
> +#define amdgpu_ring_emit_ib(r, ib, job, c) ((r)->funcs->emit_ib((r), (ib), (job), (c)))<br>
> #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r))<br>
> #define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr))<br>
> #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags))<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> index 84dd550..8f98641 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> @@ -1032,7 +1032,7 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx)<br>
> *<br>
> */<br>
> void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
<br>
The indentation here looks wrong on first glance.<br>
<br>
Additional to that I would put the job before the IB in the parameter <br>
list because it is the containing object.<br>
<br>
> {<br>
> amdgpu_ring_write(ring, VCE_CMD_IB);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h<br>
> index a1f209e..06d6d87 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h<br>
> @@ -66,7 +66,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,<br>
> int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx);<br>
> int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p, uint32_t ib_idx);<br>
> void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch);<br>
> + struct amdgpu_job *job, bool ctx_switch);<br>
> void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,<br>
> unsigned flags);<br>
> int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring);<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c<br>
> index 32eb43d..70d4419 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c<br>
> @@ -219,8 +219,9 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)<br>
> */<br>
> static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
<br>
I'm not 100% sure if duplicating this logic over and over again is such <br>
a good idea.<br>
<br>
Maybe indeed provide the CSA address as parameter instead. It doesn't <br>
really matter that it is unused by most IP block implementations.<br>
<br>
Alternative is to use a wrapper function to get the VMID from the job.<br>
<br>
Regards,<br>
Christian.<br>
<br>
> u32 extra_bits = vmid & 0xf;<br>
> <br>
> /* IB packet must end on a 8 DW boundary */<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c<br>
> index 622dd70..266482f6 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c<br>
> @@ -1846,8 +1846,9 @@ static void gfx_v6_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,<br>
> <br>
> static void gfx_v6_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 header, control = 0;<br>
> <br>
> /* insert SWITCH_BUFFER packet before first IB in the ring frame */<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c<br>
> index cfa45d9..dbcd9cc 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c<br>
> @@ -2234,8 +2234,9 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,<br>
> */<br>
> static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 header, control = 0;<br>
> <br>
> /* insert SWITCH_BUFFER packet before first IB in the ring frame */<br>
> @@ -2263,8 +2264,9 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> <br>
> static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);<br>
> <br>
> amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
> index f6cc0d3..355679a 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
> @@ -6130,8 +6130,9 @@ static void gfx_v8_0_ring_emit_vgt_flush(struct amdgpu_ring *ring)<br>
> <br>
> static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 header, control = 0;<br>
> <br>
> if (ib->flags & AMDGPU_IB_FLAG_CE)<br>
> @@ -6160,8 +6161,9 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> <br>
> static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);<br>
> <br>
> amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
> index f1bf0b7..34bf45c 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
> @@ -4072,9 +4072,10 @@ static void gfx_v9_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)<br>
> }<br>
> <br>
> static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib,<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> u32 header, control = 0;<br>
> <br>
> if (ib->flags & AMDGPU_IB_FLAG_CE)<br>
> @@ -4103,20 +4104,21 @@ static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,<br>
> }<br>
> <br>
> static void gfx_v9_0_ring_emit_ib_compute(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib,<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> - u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> + u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);<br>
> <br>
> - amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));<br>
> + amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));<br>
> BUG_ON(ib->gpu_addr & 0x3); /* Dword align */<br>
> - amdgpu_ring_write(ring,<br>
> + amdgpu_ring_write(ring,<br>
> #ifdef __BIG_ENDIAN<br>
> - (2 << 0) |<br>
> + (2 << 0) |<br>
> #endif<br>
> - lower_32_bits(ib->gpu_addr));<br>
> - amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));<br>
> - amdgpu_ring_write(ring, control);<br>
> + lower_32_bits(ib->gpu_addr));<br>
> + amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));<br>
> + amdgpu_ring_write(ring, control);<br>
> }<br>
> <br>
> static void gfx_v9_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c<br>
> index bedbd5f..d29f126 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c<br>
> @@ -246,8 +246,10 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)<br>
> */<br>
> static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> /* IB packet must end on a 8 DW boundary */<br>
> sdma_v2_4_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
> index 6d039b6..061ef5f 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
> @@ -420,8 +420,10 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)<br>
> */<br>
> static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> /* IB packet must end on a 8 DW boundary */<br>
> sdma_v3_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
> index 2b97224..452fef3 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
> @@ -503,8 +503,10 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)<br>
> */<br>
> static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> /* IB packet must end on a 8 DW boundary */<br>
> sdma_v4_0_ring_insert_nop(ring, (10 - (lower_32_bits(ring->wptr) & 7)) % 8);<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c<br>
> index d9b27d7..1bf54b2 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/si_dma.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c<br>
> @@ -62,8 +62,9 @@ static void si_dma_ring_set_wptr(struct amdgpu_ring *ring)<br>
> <br>
> static void si_dma_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> /* The indirect buffer packet must end on an 8 DW boundary in the DMA ring.<br>
> * Pad as necessary with NOPs.<br>
> */<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c<br>
> index 1fc17bf..4706c91 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c<br>
> @@ -520,7 +520,7 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring)<br>
> */<br>
> static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0));<br>
> amdgpu_ring_write(ring, ib->gpu_addr);<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c<br>
> index fde6ad5..b69c2ac 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c<br>
> @@ -536,7 +536,7 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)<br>
> */<br>
> static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0));<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> index 7a5b402..36f6b96 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> @@ -1005,8 +1005,10 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring)<br>
> */<br>
> static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_VMID, 0));<br>
> amdgpu_ring_write(ring, vmid);<br>
> <br>
> @@ -1027,8 +1029,10 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> * Write enc ring commands to execute the indirect buffer<br>
> */<br>
> static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib, struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);<br>
> amdgpu_ring_write(ring, vmid);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c<br>
> index 58b39af..beda492 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c<br>
> @@ -1301,9 +1301,10 @@ static int uvd_v7_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,<br>
> */<br>
> static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> struct amdgpu_device *adev = ring->adev;<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> <br>
> amdgpu_ring_write(ring,<br>
> PACKET0(SOC15_REG_OFFSET(UVD, ring->me, mmUVD_LMI_RBC_IB_VMID), 0));<br>
> @@ -1329,8 +1330,10 @@ static void uvd_v7_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> * Write enc ring commands to execute the indirect buffer<br>
> */<br>
> static void uvd_v7_0_enc_ring_emit_ib(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib, struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, HEVC_ENC_CMD_IB_VM);<br>
> amdgpu_ring_write(ring, vmid);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
> index a1feea0..26661bf 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
> @@ -849,8 +849,10 @@ static void vce_v3_0_get_clockgating_state(void *handle, u32 *flags)<br>
> }<br>
> <br>
> static void vce_v3_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib, struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, VCE_CMD_IB_VM);<br>
> amdgpu_ring_write(ring, vmid);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c<br>
> index 1c94718..e531cfe 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c<br>
> @@ -952,8 +952,10 @@ static int vce_v4_0_set_powergating_state(void *handle,<br>
> #endif<br>
> <br>
> static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib, struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, VCE_CMD_IB_VM);<br>
> amdgpu_ring_write(ring, vmid);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> index eae9092..f7abf5b 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> @@ -1367,9 +1367,10 @@ static void vcn_v1_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64<br>
> */<br>
> static void vcn_v1_0_dec_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> struct amdgpu_device *adev = ring->adev;<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> <br>
> amdgpu_ring_write(ring,<br>
> PACKET0(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_RBC_IB_VMID), 0));<br>
> @@ -1524,8 +1525,10 @@ static void vcn_v1_0_enc_ring_insert_end(struct amdgpu_ring *ring)<br>
> * Write enc ring commands to execute the indirect buffer<br>
> */<br>
> static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,<br>
> - struct amdgpu_ib *ib, unsigned int vmid, bool ctx_switch)<br>
> + struct amdgpu_ib *ib, struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> +<br>
> amdgpu_ring_write(ring, VCN_ENC_CMD_IB);<br>
> amdgpu_ring_write(ring, vmid);<br>
> amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));<br>
> @@ -1726,9 +1729,10 @@ static void vcn_v1_0_jpeg_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u6<br>
> */<br>
> static void vcn_v1_0_jpeg_ring_emit_ib(struct amdgpu_ring *ring,<br>
> struct amdgpu_ib *ib,<br>
> - unsigned vmid, bool ctx_switch)<br>
> + struct amdgpu_job *job, bool ctx_switch)<br>
> {<br>
> struct amdgpu_device *adev = ring->adev;<br>
> + unsigned vmid = job ? job->vmid : 0;<br>
> <br>
> amdgpu_ring_write(ring,<br>
> PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_IB_VMID), 0, 0, PACKETJ_TYPE0));<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>