<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;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Nope your eyes are fine. Note that the same pattern exists in gfx_v8_0.c as well. I guess different ring struct pointers are passed so they're not talking to the same ring.</p>
<p><br>
</p>
<p>We could merge those to reduce the # of LOC.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Christian König <deathsimple@vodafone.de><br>
<b>Sent:</b> Thursday, September 1, 2016 13:59<br>
<b>To:</b> Tom St Denis; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> StDenis, Tom<br>
<b>Subject:</b> Re: [PATCH 3/3] drm/amd/amdgpu: Various tidy ups for gfx6</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Am 01.09.2016 um 19:44 schrieb Tom St Denis:<br>
> Various whitespace and logical simplifications for gfx6.<br>
><br>
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 40 +++++------------------------------<br>
> 1 file changed, 5 insertions(+), 35 deletions(-)<br>
><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 5f508c96496f..63ca77937714 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c<br>
> @@ -1211,11 +1211,8 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)<br>
> SC_EARLYZ_TILE_FIFO_SIZE(adev->gfx.config.sc_earlyz_tile_fifo_size)));<br>
> <br>
> WREG32(VGT_NUM_INSTANCES, 1);<br>
> -<br>
> WREG32(CP_PERFMON_CNTL, 0);<br>
> -<br>
> WREG32(SQ_CONFIG, 0);<br>
> -<br>
> WREG32(PA_SC_FORCE_EOV_MAX_CNTS, (FORCE_EOV_MAX_CLK_CNT(4095) |<br>
> FORCE_EOV_MAX_REZ_CNT(255)));<br>
> <br>
> @@ -1240,7 +1237,6 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)<br>
> WREG32(PA_CL_ENHANCE, CLIP_VTX_REORDER_ENA | NUM_CLIP_SEQ(3));<br>
> <br>
> udelay(50);<br>
> -<br>
> }<br>
> <br>
> <br>
> @@ -1661,21 +1657,14 @@ static int gfx_v6_0_cp_gfx_resume(struct amdgpu_device *adev)<br>
> <br>
> static u32 gfx_v6_0_ring_get_rptr_gfx(struct amdgpu_ring *ring)<br>
> {<br>
> - u32 rptr;<br>
> -<br>
> - rptr = ring->adev->wb.wb[ring->rptr_offs];<br>
> -<br>
> - return rptr;<br>
> + return ring->adev->wb.wb[ring->rptr_offs];<br>
> }<br>
> <br>
> static u32 gfx_v6_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)<br>
> {<br>
> struct amdgpu_device *adev = ring->adev;<br>
> - u32 wptr;<br>
> <br>
> - wptr = RREG32(CP_RB0_WPTR);<br>
> -<br>
> - return wptr;<br>
> + return RREG32(CP_RB0_WPTR);<br>
> }<br>
> <br>
> static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)<br>
> @@ -1688,9 +1677,7 @@ static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)<br>
> <br>
> static u32 gfx_v6_0_ring_get_rptr_compute(struct amdgpu_ring *ring)<br>
> {<br>
> - u32 rptr = ring->adev->wb.wb[ring->rptr_offs];<br>
> -<br>
> - return rptr;<br>
> + return ring->adev->wb.wb[ring->rptr_offs];<br>
> }<br>
<br>
Am I blind or are the gfx_v6_0_ring_get_rptr_compute() and <br>
gfx_v6_0_ring_get_rptr_gfx() functions identical?<br>
<br>
If that's true might be a good idea to just use one function.<br>
<br>
Either way patch is Reviewed-by: Christian König <christian.koenig@amd.com><br>
<br>
Christian.<br>
<br>
> <br>
> static u32 gfx_v6_0_ring_get_wptr_compute(struct amdgpu_ring *ring)<br>
> @@ -1770,14 +1757,12 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev)<br>
> ring->wptr = 0;<br>
> WREG32(CP_RB1_WPTR, ring->wptr);<br>
> <br>
> -<br>
> rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);<br>
> WREG32(CP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));<br>
> WREG32(CP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF);<br>
> <br>
> mdelay(1);<br>
> WREG32(CP_RB1_CNTL, tmp);<br>
> -<br>
> WREG32(CP_RB1_BASE, ring->gpu_addr >> 8);<br>
> <br>
> ring = &adev->gfx.compute_ring[1];<br>
> @@ -1797,7 +1782,6 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev)<br>
> <br>
> mdelay(1);<br>
> WREG32(CP_RB2_CNTL, tmp);<br>
> -<br>
> WREG32(CP_RB2_BASE, ring->gpu_addr >> 8);<br>
> <br>
> adev->gfx.compute_ring[0].ready = true;<br>
> @@ -1825,12 +1809,7 @@ static void gfx_v6_0_cp_enable(struct amdgpu_device *adev, bool enable)<br>
> <br>
> static int gfx_v6_0_cp_load_microcode(struct amdgpu_device *adev)<br>
> {<br>
> - int r;<br>
> -<br>
> - r = gfx_v6_0_cp_gfx_load_microcode(adev);<br>
> -<br>
> - return r;<br>
> -<br>
> + return gfx_v6_0_cp_gfx_load_microcode(adev);<br>
> }<br>
> <br>
> static void gfx_v6_0_enable_gui_idle_interrupt(struct amdgpu_device *adev,<br>
> @@ -2172,7 +2151,6 @@ static void gfx_v6_0_rlc_stop(struct amdgpu_device *adev)<br>
> WREG32(RLC_CNTL, 0);<br>
> <br>
> gfx_v6_0_enable_gui_idle_interrupt(adev, false);<br>
> -<br>
> gfx_v6_0_wait_for_rlc_serdes(adev);<br>
> }<br>
> <br>
> @@ -2223,11 +2201,8 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev)<br>
> return -EINVAL;<br>
> <br>
> gfx_v6_0_rlc_stop(adev);<br>
> -<br>
> gfx_v6_0_rlc_reset(adev);<br>
> -<br>
> gfx_v6_0_init_pg(adev);<br>
> -<br>
> gfx_v6_0_init_cg(adev);<br>
> <br>
> WREG32(RLC_RL_BASE, 0);<br>
> @@ -2254,7 +2229,6 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev)<br>
> WREG32(RLC_UCODE_ADDR, 0);<br>
> <br>
> gfx_v6_0_enable_lbpw(adev, gfx_v6_0_lbpw_supported(adev));<br>
> -<br>
> gfx_v6_0_rlc_start(adev);<br>
> <br>
> return 0;<br>
> @@ -2278,7 +2252,6 @@ static void gfx_v6_0_enable_cgcg(struct amdgpu_device *adev, bool enable)<br>
> WREG32(RLC_SERDES_WR_CTRL, 0x00b000ff);<br>
> <br>
> gfx_v6_0_wait_for_rlc_serdes(adev);<br>
> -<br>
> gfx_v6_0_update_rlc(adev, tmp);<br>
> <br>
> WREG32(RLC_SERDES_WR_CTRL, 0x007000ff);<br>
> @@ -2931,13 +2904,10 @@ static bool gfx_v6_0_is_idle(void *handle)<br>
> static int gfx_v6_0_wait_for_idle(void *handle)<br>
> {<br>
> unsigned i;<br>
> - u32 tmp;<br>
> struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
> <br>
> for (i = 0; i < adev->usec_timeout; i++) {<br>
> - tmp = RREG32(GRBM_STATUS) & GRBM_STATUS__GUI_ACTIVE_MASK;<br>
> -<br>
> - if (!tmp)<br>
> + if (gfx_v6_0_is_idle(handle))<br>
> return 0;<br>
> udelay(1);<br>
> }<br>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>