mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu: enable the Doorbell support for VCN2.5
Including decode, encode, and JPEG decode rings Signed-off-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
39a5053fb2
commit
530e30fc32
|
@ -128,6 +128,8 @@ static int vcn_v2_5_sw_init(void *handle)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
ring = &adev->vcn.ring_dec;
|
ring = &adev->vcn.ring_dec;
|
||||||
|
ring->use_doorbell = true;
|
||||||
|
ring->doorbell_index = adev->doorbell_index.vcn.vcn_ring0_1 << 1;
|
||||||
sprintf(ring->name, "vcn_dec");
|
sprintf(ring->name, "vcn_dec");
|
||||||
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
||||||
if (r)
|
if (r)
|
||||||
|
@ -153,6 +155,8 @@ static int vcn_v2_5_sw_init(void *handle)
|
||||||
|
|
||||||
for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
|
for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
|
||||||
ring = &adev->vcn.ring_enc[i];
|
ring = &adev->vcn.ring_enc[i];
|
||||||
|
ring->use_doorbell = true;
|
||||||
|
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 2 + i;
|
||||||
sprintf(ring->name, "vcn_enc%d", i);
|
sprintf(ring->name, "vcn_enc%d", i);
|
||||||
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
||||||
if (r)
|
if (r)
|
||||||
|
@ -160,6 +164,8 @@ static int vcn_v2_5_sw_init(void *handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
ring = &adev->vcn.ring_jpeg;
|
ring = &adev->vcn.ring_jpeg;
|
||||||
|
ring->use_doorbell = true;
|
||||||
|
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1;
|
||||||
sprintf(ring->name, "vcn_jpeg");
|
sprintf(ring->name, "vcn_jpeg");
|
||||||
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
|
||||||
if (r)
|
if (r)
|
||||||
|
@ -879,7 +885,10 @@ static uint64_t vcn_v2_5_dec_ring_get_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
return RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR);
|
if (ring->use_doorbell)
|
||||||
|
return adev->wb.wb[ring->wptr_offs];
|
||||||
|
else
|
||||||
|
return RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -893,7 +902,12 @@ static void vcn_v2_5_dec_ring_set_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR, lower_32_bits(ring->wptr));
|
if (ring->use_doorbell) {
|
||||||
|
adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr);
|
||||||
|
WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr));
|
||||||
|
} else {
|
||||||
|
WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR, lower_32_bits(ring->wptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct amdgpu_ring_funcs vcn_v2_5_dec_ring_vm_funcs = {
|
static const struct amdgpu_ring_funcs vcn_v2_5_dec_ring_vm_funcs = {
|
||||||
|
@ -954,10 +968,17 @@ static uint64_t vcn_v2_5_enc_ring_get_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
if (ring == &adev->vcn.ring_enc[0])
|
if (ring == &adev->vcn.ring_enc[0]) {
|
||||||
return RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR);
|
if (ring->use_doorbell)
|
||||||
else
|
return adev->wb.wb[ring->wptr_offs];
|
||||||
return RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2);
|
else
|
||||||
|
return RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR);
|
||||||
|
} else {
|
||||||
|
if (ring->use_doorbell)
|
||||||
|
return adev->wb.wb[ring->wptr_offs];
|
||||||
|
else
|
||||||
|
return RREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -971,10 +992,21 @@ static void vcn_v2_5_enc_ring_set_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
if (ring == &adev->vcn.ring_enc[0])
|
if (ring == &adev->vcn.ring_enc[0]) {
|
||||||
WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR, lower_32_bits(ring->wptr));
|
if (ring->use_doorbell) {
|
||||||
else
|
adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr);
|
||||||
WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2, lower_32_bits(ring->wptr));
|
WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr));
|
||||||
|
} else {
|
||||||
|
WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR, lower_32_bits(ring->wptr));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ring->use_doorbell) {
|
||||||
|
adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr);
|
||||||
|
WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr));
|
||||||
|
} else {
|
||||||
|
WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2, lower_32_bits(ring->wptr));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct amdgpu_ring_funcs vcn_v2_5_enc_ring_vm_funcs = {
|
static const struct amdgpu_ring_funcs vcn_v2_5_enc_ring_vm_funcs = {
|
||||||
|
@ -1032,7 +1064,10 @@ static uint64_t vcn_v2_5_jpeg_ring_get_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
return RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR);
|
if (ring->use_doorbell)
|
||||||
|
return adev->wb.wb[ring->wptr_offs];
|
||||||
|
else
|
||||||
|
return RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1046,7 +1081,12 @@ static void vcn_v2_5_jpeg_ring_set_wptr(struct amdgpu_ring *ring)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = ring->adev;
|
struct amdgpu_device *adev = ring->adev;
|
||||||
|
|
||||||
WREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR, lower_32_bits(ring->wptr));
|
if (ring->use_doorbell) {
|
||||||
|
adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr);
|
||||||
|
WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr));
|
||||||
|
} else {
|
||||||
|
WREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR, lower_32_bits(ring->wptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct amdgpu_ring_funcs vcn_v2_5_jpeg_ring_vm_funcs = {
|
static const struct amdgpu_ring_funcs vcn_v2_5_jpeg_ring_vm_funcs = {
|
||||||
|
|
|
@ -85,6 +85,10 @@ void vega20_doorbell_index_init(struct amdgpu_device *adev)
|
||||||
adev->doorbell_index.uvd_vce.vce_ring2_3 = AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3;
|
adev->doorbell_index.uvd_vce.vce_ring2_3 = AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3;
|
||||||
adev->doorbell_index.uvd_vce.vce_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5;
|
adev->doorbell_index.uvd_vce.vce_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5;
|
||||||
adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7;
|
adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7;
|
||||||
|
adev->doorbell_index.vcn.vcn_ring0_1 = AMDGPU_VEGA20_DOORBELL64_VCN0_1;
|
||||||
|
adev->doorbell_index.vcn.vcn_ring2_3 = AMDGPU_VEGA20_DOORBELL64_VCN2_3;
|
||||||
|
adev->doorbell_index.vcn.vcn_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCN4_5;
|
||||||
|
adev->doorbell_index.vcn.vcn_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCN6_7;
|
||||||
|
|
||||||
adev->doorbell_index.first_non_cp = AMDGPU_VEGA20_DOORBELL64_FIRST_NON_CP;
|
adev->doorbell_index.first_non_cp = AMDGPU_VEGA20_DOORBELL64_FIRST_NON_CP;
|
||||||
adev->doorbell_index.last_non_cp = AMDGPU_VEGA20_DOORBELL64_LAST_NON_CP;
|
adev->doorbell_index.last_non_cp = AMDGPU_VEGA20_DOORBELL64_LAST_NON_CP;
|
||||||
|
|
Loading…
Reference in New Issue