diff options
| author | Huang Rui <[email protected]> | 2018-08-02 08:12:39 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2018-08-27 16:09:54 +0000 |
| commit | 448fe1928ce415b8cae0425e5c7f066d6bd8b2de (patch) | |
| tree | a187437c65eae3fcb8cd69640ede6254e454f8c2 /drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | |
| parent | drm/amd/pp: Delete duplicated interface in hwmgr_func (diff) | |
| download | kernel-448fe1928ce415b8cae0425e5c7f066d6bd8b2de.tar.gz kernel-448fe1928ce415b8cae0425e5c7f066d6bd8b2de.zip | |
drm/amdgpu: move gfx definitions into amdgpu_gfx header
Demangle amdgpu.h
Signed-off-by: Huang Rui <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 34 |
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 @@ #define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(500) /* - * GPU scratch registers helpers function. + * GPU GFX IP block helpers function. */ + +int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec, + int pipe, int queue) +{ + int bit = 0; + + bit += mec * adev->gfx.mec.num_pipe_per_mec + * adev->gfx.mec.num_queue_per_pipe; + bit += pipe * adev->gfx.mec.num_queue_per_pipe; + bit += queue; + + return bit; +} + +void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit, + int *mec, int *pipe, int *queue) +{ + *queue = bit % adev->gfx.mec.num_queue_per_pipe; + *pipe = (bit / adev->gfx.mec.num_queue_per_pipe) + % adev->gfx.mec.num_pipe_per_mec; + *mec = (bit / adev->gfx.mec.num_queue_per_pipe) + / adev->gfx.mec.num_pipe_per_mec; + +} + +bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev, + int mec, int pipe, int queue) +{ + return test_bit(amdgpu_gfx_queue_to_bit(adev, mec, pipe, queue), + adev->gfx.mec.queue_bitmap); +} + /** * amdgpu_gfx_scratch_get - Allocate a scratch register * |
