aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2018-08-02 04:12:39 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 12:09:54 -0400
commit448fe1928ce415b8cae0425e5c7f066d6bd8b2de (patch)
treea187437c65eae3fcb8cd69640ede6254e454f8c2 /drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
parentfd28705388ef5244a963aa5ec70751d522c214c3 (diff)
drm/amdgpu: move gfx definitions into amdgpu_gfx header
Demangle amdgpu.h Signed-off-by: Huang Rui <ray.huang@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 11d4d9f93b95..bbb81e23020e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -30,8 +30,40 @@
30#define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(500) 30#define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(500)
31 31
32/* 32/*
33 * GPU scratch registers helpers function. 33 * GPU GFX IP block helpers function.
34 */ 34 */
35
36int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec,
37 int pipe, int queue)
38{
39 int bit = 0;
40
41 bit += mec * adev->gfx.mec.num_pipe_per_mec
42 * adev->gfx.mec.num_queue_per_pipe;
43 bit += pipe * adev->gfx.mec.num_queue_per_pipe;
44 bit += queue;
45
46 return bit;
47}
48
49void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit,
50 int *mec, int *pipe, int *queue)
51{
52 *queue = bit % adev->gfx.mec.num_queue_per_pipe;
53 *pipe = (bit / adev->gfx.mec.num_queue_per_pipe)
54 % adev->gfx.mec.num_pipe_per_mec;
55 *mec = (bit / adev->gfx.mec.num_queue_per_pipe)
56 / adev->gfx.mec.num_pipe_per_mec;
57
58}
59
60bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev,
61 int mec, int pipe, int queue)
62{
63 return test_bit(amdgpu_gfx_queue_to_bit(adev, mec, pipe, queue),
64 adev->gfx.mec.queue_bitmap);
65}
66
35/** 67/**
36 * amdgpu_gfx_scratch_get - Allocate a scratch register 68 * amdgpu_gfx_scratch_get - Allocate a scratch register
37 * 69 *