summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
diff options
context:
space:
mode:
authorNils Wallménius2017-01-16 21:56:48 +0100
committerAlex Deucher2017-01-27 17:13:32 +0100
commit50261151a13176a99ee6117dbbb2e557fd0b608b (patch)
treefb6fe0437e2e5e44fa25edc4dd1f6df169da066d /drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
parentdrm/amdgpu: Refactor flip into prepare submit and submit. (v3) (diff)
downloadkernel-qcow2-linux-50261151a13176a99ee6117dbbb2e557fd0b608b.tar.gz
kernel-qcow2-linux-50261151a13176a99ee6117dbbb2e557fd0b608b.tar.xz
kernel-qcow2-linux-50261151a13176a99ee6117dbbb2e557fd0b608b.zip
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_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index c8c45ba952c8..69543d4eef34 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -749,14 +749,9 @@ static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev)
static void gfx_v8_0_scratch_init(struct amdgpu_device *adev)
{
- int i;
-
adev->gfx.scratch.num_reg = 7;
adev->gfx.scratch.reg_base = mmSCRATCH_REG0;
- for (i = 0; i < adev->gfx.scratch.num_reg; i++) {
- adev->gfx.scratch.free[i] = true;
- adev->gfx.scratch.reg[i] = adev->gfx.scratch.reg_base + i;
- }
+ adev->gfx.scratch.free_mask = (1u << adev->gfx.scratch.num_reg) - 1;
}
static int gfx_v8_0_ring_test_ring(struct amdgpu_ring *ring)