mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-16 22:25:13 -05:00
drm/amdgpu/gfx: Use CSB helpers in gfx_v9_0_get_csb_buffer
Eliminate code duplication in gfx_v9_0_get_csb_buffer by using CSB helpers. Signed-off-by: Rodrigo Siqueira <siqueira@igalia.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
0eef0e36ba
commit
9fec2e92fa
@@ -1651,40 +1651,16 @@ static u32 gfx_v9_0_get_csb_size(struct amdgpu_device *adev)
|
||||
static void gfx_v9_0_get_csb_buffer(struct amdgpu_device *adev,
|
||||
volatile u32 *buffer)
|
||||
{
|
||||
u32 count = 0, i;
|
||||
const struct cs_section_def *sect = NULL;
|
||||
const struct cs_extent_def *ext = NULL;
|
||||
u32 count = 0;
|
||||
|
||||
if (adev->gfx.rlc.cs_data == NULL)
|
||||
return;
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
|
||||
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
|
||||
|
||||
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
|
||||
buffer[count++] = cpu_to_le32(0x80000000);
|
||||
buffer[count++] = cpu_to_le32(0x80000000);
|
||||
|
||||
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
|
||||
for (ext = sect->section; ext->extent != NULL; ++ext) {
|
||||
if (sect->id == SECT_CONTEXT) {
|
||||
buffer[count++] =
|
||||
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
|
||||
buffer[count++] = cpu_to_le32(ext->reg_index -
|
||||
PACKET3_SET_CONTEXT_REG_START);
|
||||
for (i = 0; i < ext->reg_count; i++)
|
||||
buffer[count++] = cpu_to_le32(ext->extent[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
|
||||
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
|
||||
|
||||
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
|
||||
buffer[count++] = cpu_to_le32(0);
|
||||
count = amdgpu_gfx_csb_preamble_start(buffer);
|
||||
count = amdgpu_gfx_csb_data_parser(adev, buffer, count);
|
||||
amdgpu_gfx_csb_preamble_end(buffer, count);
|
||||
}
|
||||
|
||||
static void gfx_v9_0_init_always_on_cu_mask(struct amdgpu_device *adev)
|
||||
|
||||
Reference in New Issue
Block a user