diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index 855eff834e2a..827eb53c9649 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | |||
@@ -34,8 +34,8 @@ | |||
34 | * GPU GFX IP block helpers function. | 34 | * GPU GFX IP block helpers function. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec, | 37 | int amdgpu_gfx_mec_queue_to_bit(struct amdgpu_device *adev, int mec, |
38 | int pipe, int queue) | 38 | int pipe, int queue) |
39 | { | 39 | { |
40 | int bit = 0; | 40 | int bit = 0; |
41 | 41 | ||
@@ -47,8 +47,8 @@ int amdgpu_gfx_queue_to_bit(struct amdgpu_device *adev, int mec, | |||
47 | return bit; | 47 | return bit; |
48 | } | 48 | } |
49 | 49 | ||
50 | void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit, | 50 | void amdgpu_gfx_bit_to_mec_queue(struct amdgpu_device *adev, int bit, |
51 | int *mec, int *pipe, int *queue) | 51 | int *mec, int *pipe, int *queue) |
52 | { | 52 | { |
53 | *queue = bit % adev->gfx.mec.num_queue_per_pipe; | 53 | *queue = bit % adev->gfx.mec.num_queue_per_pipe; |
54 | *pipe = (bit / adev->gfx.mec.num_queue_per_pipe) | 54 | *pipe = (bit / adev->gfx.mec.num_queue_per_pipe) |
@@ -61,10 +61,40 @@ void amdgpu_gfx_bit_to_queue(struct amdgpu_device *adev, int bit, | |||
61 | bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev, | 61 | bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev, |
62 | int mec, int pipe, int queue) | 62 | int mec, int pipe, int queue) |
63 | { | 63 | { |
64 | return test_bit(amdgpu_gfx_queue_to_bit(adev, mec, pipe, queue), | 64 | return test_bit(amdgpu_gfx_mec_queue_to_bit(adev, mec, pipe, queue), |
65 | adev->gfx.mec.queue_bitmap); | 65 | adev->gfx.mec.queue_bitmap); |
66 | } | 66 | } |
67 | 67 | ||
68 | int amdgpu_gfx_me_queue_to_bit(struct amdgpu_device *adev, | ||
69 | int me, int pipe, int queue) | ||
70 | { | ||
71 | int bit = 0; | ||
72 | |||
73 | bit += me * adev->gfx.me.num_pipe_per_me | ||
74 | * adev->gfx.me.num_queue_per_pipe; | ||
75 | bit += pipe * adev->gfx.me.num_queue_per_pipe; | ||
76 | bit += queue; | ||
77 | |||
78 | return bit; | ||
79 | } | ||
80 | |||
81 | void amdgpu_gfx_bit_to_me_queue(struct amdgpu_device *adev, int bit, | ||
82 | int *me, int *pipe, int *queue) | ||
83 | { | ||
84 | *queue = bit % adev->gfx.me.num_queue_per_pipe; | ||
85 | *pipe = (bit / adev->gfx.me.num_queue_per_pipe) | ||
86 | % adev->gfx.me.num_pipe_per_me; | ||
87 | *me = (bit / adev->gfx.me.num_queue_per_pipe) | ||
88 | / adev->gfx.me.num_pipe_per_me; | ||
89 | } | ||
90 | |||
91 | bool amdgpu_gfx_is_me_queue_enabled(struct amdgpu_device *adev, | ||
92 | int me, int pipe, int queue) | ||
93 | { | ||
94 | return test_bit(amdgpu_gfx_me_queue_to_bit(adev, me, pipe, queue), | ||
95 | adev->gfx.me.queue_bitmap); | ||
96 | } | ||
97 | |||
68 | /** | 98 | /** |
69 | * amdgpu_gfx_scratch_get - Allocate a scratch register | 99 | * amdgpu_gfx_scratch_get - Allocate a scratch register |
70 | * | 100 | * |
@@ -237,7 +267,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, | |||
237 | if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap)) | 267 | if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap)) |
238 | continue; | 268 | continue; |
239 | 269 | ||
240 | amdgpu_gfx_bit_to_queue(adev, queue_bit, &mec, &pipe, &queue); | 270 | amdgpu_gfx_bit_to_mec_queue(adev, queue_bit, &mec, &pipe, &queue); |
241 | 271 | ||
242 | /* | 272 | /* |
243 | * 1. Using pipes 2/3 from MEC 2 seems cause problems. | 273 | * 1. Using pipes 2/3 from MEC 2 seems cause problems. |