aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
diff options
context:
space:
mode:
authorNils Wallménius <nils.wallmenius@gmail.com>2017-01-16 15:56:48 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 11:13:32 -0500
commit50261151a13176a99ee6117dbbb2e557fd0b608b (patch)
treefb6fe0437e2e5e44fa25edc4dd1f6df169da066d /drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
parentcb341a319f7e66f879d69af929c3dadfc1a8f31e (diff)
drm/amdgpu: simplify allocation of scratch regs
The scratch regs are sequential so there's no need to keep them in an array, we can just return the index of the first free register + the base register. Also change the array of bools for keeping track of the free regs to a bitfield. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index b323f5ef64d2..e0132436c76f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -1794,14 +1794,9 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
1794 1794
1795static void gfx_v6_0_scratch_init(struct amdgpu_device *adev) 1795static void gfx_v6_0_scratch_init(struct amdgpu_device *adev)
1796{ 1796{
1797 int i;
1798
1799 adev->gfx.scratch.num_reg = 7; 1797 adev->gfx.scratch.num_reg = 7;
1800 adev->gfx.scratch.reg_base = mmSCRATCH_REG0; 1798 adev->gfx.scratch.reg_base = mmSCRATCH_REG0;
1801 for (i = 0; i < adev->gfx.scratch.num_reg; i++) { 1799 adev->gfx.scratch.free_mask = (1u << adev->gfx.scratch.num_reg) - 1;
1802 adev->gfx.scratch.free[i] = true;
1803 adev->gfx.scratch.reg[i] = adev->gfx.scratch.reg_base + i;
1804 }
1805} 1800}
1806 1801
1807static int gfx_v6_0_ring_test_ring(struct amdgpu_ring *ring) 1802static int gfx_v6_0_ring_test_ring(struct amdgpu_ring *ring)