Re: [PATCH] drm/radeon/rv515: Remove unused function

Alex Deucher
2015-01-15T15:56:57Z

[-- Attachment #1: Type: text/plain, Size: 6053 bytes --]

On Thu, Jan 15, 2015 at 10:43 AM, Jerome Glisse <j.glisse@gmail.com> wrote:
> This one looks highly suspicious, i need to check, but i would think
> that this function should be use !

Yeah, I think the attached patch is probably correct. Although r5xx
has been using the r300 ring start function for a while apparently.

Alex

>
> On Wed, Jan 14, 2015 at 4:44 PM, Alex Deucher <alexdeucher@gmail.com> wrote:
>> On Tue, Jan 13, 2015 at 1:55 PM, Rickard Strandqvist
>> <rickard_strandqvist@spectrumdigital.se> wrote:
>>> Remove the function rv515_ring_start() that is not used anywhere.
>>>
>>> This was partially found by using a static code analysis program called cppcheck.
>>>
>>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>>
>> Applied. thanks!
>>
>> Alex
>>
>>> ---
>>> drivers/gpu/drm/radeon/radeon_asic.h | 1 -
>>> drivers/gpu/drm/radeon/rv515.c | 68 ----------------------------------
>>> 2 files changed, 69 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
>>> index d8ace5b..52667b3 100644
>>> --- a/drivers/gpu/drm/radeon/radeon_asic.h
>>> +++ b/drivers/gpu/drm/radeon/radeon_asic.h
>>> @@ -280,7 +280,6 @@ int rv515_init(struct radeon_device *rdev);
>>> void rv515_fini(struct radeon_device *rdev);
>>> uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
>>> void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
>>> -void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
>>> void rv515_bandwidth_update(struct radeon_device *rdev);
>>> int rv515_resume(struct radeon_device *rdev);
>>> int rv515_suspend(struct radeon_device *rdev);
>>> diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
>>> index 8a477bf..cb966e6 100644
>>> --- a/drivers/gpu/drm/radeon/rv515.c
>>> +++ b/drivers/gpu/drm/radeon/rv515.c
>>> @@ -59,74 +59,6 @@ void rv515_debugfs(struct radeon_device *rdev)
>>> }
>>> }
>>>
>>> -void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring)
>>> -{
>>> - int r;
>>> -
>>> - r = radeon_ring_lock(rdev, ring, 64);
>>> - if (r) {
>>> - return;
>>> - }
>>> - radeon_ring_write(ring, PACKET0(ISYNC_CNTL, 0));
>>> - radeon_ring_write(ring,
>>> - ISYNC_ANY2D_IDLE3D |
>>> - ISYNC_ANY3D_IDLE2D |
>>> - ISYNC_WAIT_IDLEGUI |
>>> - ISYNC_CPSCRATCH_IDLEGUI);
>>> - radeon_ring_write(ring, PACKET0(WAIT_UNTIL, 0));
>>> - radeon_ring_write(ring, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN);
>>> - radeon_ring_write(ring, PACKET0(R300_DST_PIPE_CONFIG, 0));
>>> - radeon_ring_write(ring, R300_PIPE_AUTO_CONFIG);
>>> - radeon_ring_write(ring, PACKET0(GB_SELECT, 0));
>>> - radeon_ring_write(ring, 0);
>>> - radeon_ring_write(ring, PACKET0(GB_ENABLE, 0));
>>> - radeon_ring_write(ring, 0);
>>> - radeon_ring_write(ring, PACKET0(R500_SU_REG_DEST, 0));
>>> - radeon_ring_write(ring, (1 << rdev->num_gb_pipes) - 1);
>>> - radeon_ring_write(ring, PACKET0(VAP_INDEX_OFFSET, 0));
>>> - radeon_ring_write(ring, 0);
>>> - radeon_ring_write(ring, PACKET0(RB3D_DSTCACHE_CTLSTAT, 0));
>>> - radeon_ring_write(ring, RB3D_DC_FLUSH | RB3D_DC_FREE);
>>> - radeon_ring_write(ring, PACKET0(ZB_ZCACHE_CTLSTAT, 0));
>>> - radeon_ring_write(ring, ZC_FLUSH | ZC_FREE);
>>> - radeon_ring_write(ring, PACKET0(WAIT_UNTIL, 0));
>>> - radeon_ring_write(ring, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN);
>>> - radeon_ring_write(ring, PACKET0(GB_AA_CONFIG, 0));
>>> - radeon_ring_write(ring, 0);
>>> - radeon_ring_write(ring, PACKET0(RB3D_DSTCACHE_CTLSTAT, 0));
>>> - radeon_ring_write(ring, RB3D_DC_FLUSH | RB3D_DC_FREE);
>>> - radeon_ring_write(ring, PACKET0(ZB_ZCACHE_CTLSTAT, 0));
>>> - radeon_ring_write(ring, ZC_FLUSH | ZC_FREE);
>>> - radeon_ring_write(ring, PACKET0(GB_MSPOS0, 0));
>>> - radeon_ring_write(ring,
>>> - ((6 << MS_X0_SHIFT) |
>>> - (6 << MS_Y0_SHIFT) |
>>> - (6 << MS_X1_SHIFT) |
>>> - (6 << MS_Y1_SHIFT) |
>>> - (6 << MS_X2_SHIFT) |
>>> - (6 << MS_Y2_SHIFT) |
>>> - (6 << MSBD0_Y_SHIFT) |
>>> - (6 << MSBD0_X_SHIFT)));
>>> - radeon_ring_write(ring, PACKET0(GB_MSPOS1, 0));
>>> - radeon_ring_write(ring,
>>> - ((6 << MS_X3_SHIFT) |
>>> - (6 << MS_Y3_SHIFT) |
>>> - (6 << MS_X4_SHIFT) |
>>> - (6 << MS_Y4_SHIFT) |
>>> - (6 << MS_X5_SHIFT) |
>>> - (6 << MS_Y5_SHIFT) |
>>> - (6 << MSBD1_SHIFT)));
>>> - radeon_ring_write(ring, PACKET0(GA_ENHANCE, 0));
>>> - radeon_ring_write(ring, GA_DEADLOCK_CNTL | GA_FASTSYNC_CNTL);
>>> - radeon_ring_write(ring, PACKET0(GA_POLY_MODE, 0));
>>> - radeon_ring_write(ring, FRONT_PTYPE_TRIANGE | BACK_PTYPE_TRIANGE);
>>> - radeon_ring_write(ring, PACKET0(GA_ROUND_MODE, 0));
>>> - radeon_ring_write(ring, GEOMETRY_ROUND_NEAREST | COLOR_ROUND_NEAREST);
>>> - radeon_ring_write(ring, PACKET0(0x20C8, 0));
>>> - radeon_ring_write(ring, 0);
>>> - radeon_ring_unlock_commit(rdev, ring, false);
>>> -}
>>> -
>>> int rv515_mc_wait_for_idle(struct radeon_device *rdev)
>>> {
>>> unsigned i;
>>> --
>>> 1.7.10.4
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel

[-- Attachment #2: 0001-drm-radeon-use-rv515_ring_start-on-r5xx.patch --]
[-- Type: text/x-patch, Size: 1854 bytes --]

From 39cd26b5d602f57a114def29b8c0931b4069da89 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Thu, 15 Jan 2015 10:52:33 -0500
Subject: [PATCH] drm/radeon: use rv515_ring_start on r5xx

At some point these seems to have been lost in favor
of the r300_ring_start function.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/radeon/radeon_asic.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 6e47662..f811ee1 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -333,6 +333,20 @@ static struct radeon_asic_ring r300_gfx_ring = {
.set_wptr = &r100_gfx_set_wptr,
};

+static struct radeon_asic_ring rv515_gfx_ring = {
+ .ib_execute = &r100_ring_ib_execute,
+ .emit_fence = &r300_fence_ring_emit,
+ .emit_semaphore = &r100_semaphore_ring_emit,
+ .cs_parse = &r300_cs_parse,
+ .ring_start = &rv515_ring_start,
+ .ring_test = &r100_ring_test,
+ .ib_test = &r100_ib_test,
+ .is_lockup = &r100_gpu_is_lockup,
+ .get_rptr = &r100_gfx_get_rptr,
+ .get_wptr = &r100_gfx_get_wptr,
+ .set_wptr = &r100_gfx_set_wptr,
+};
+
static struct radeon_asic r300_asic = {
.init = &r300_init,
.fini = &r300_fini,
@@ -744,7 +758,7 @@ static struct radeon_asic rv515_asic = {
.set_page = &rv370_pcie_gart_set_page,
},
.ring = {
- [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
+ [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
},
.irq = {
.set = &rs600_irq_set,
@@ -810,7 +824,7 @@ static struct radeon_asic r520_asic = {
.set_page = &rv370_pcie_gart_set_page,
},
.ring = {
- [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
+ [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
},
.irq = {
.set = &rs600_irq_set,
--
1.8.3.1