Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/VCN2.5: set JPEG decode ring functions

Also reuse most of the JPEG2.0 decode ring functions

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>

authored by

Leo Liu and committed by
Alex Deucher
80010737 e87d5a7a

+78
+78
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
··· 1004 1004 .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1005 1005 }; 1006 1006 1007 + /** 1008 + * vcn_v2_5_jpeg_ring_get_rptr - get read pointer 1009 + * 1010 + * @ring: amdgpu_ring pointer 1011 + * 1012 + * Returns the current hardware read pointer 1013 + */ 1014 + static uint64_t vcn_v2_5_jpeg_ring_get_rptr(struct amdgpu_ring *ring) 1015 + { 1016 + struct amdgpu_device *adev = ring->adev; 1017 + 1018 + return RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_RPTR); 1019 + } 1020 + 1021 + /** 1022 + * vcn_v2_5_jpeg_ring_get_wptr - get write pointer 1023 + * 1024 + * @ring: amdgpu_ring pointer 1025 + * 1026 + * Returns the current hardware write pointer 1027 + */ 1028 + static uint64_t vcn_v2_5_jpeg_ring_get_wptr(struct amdgpu_ring *ring) 1029 + { 1030 + struct amdgpu_device *adev = ring->adev; 1031 + 1032 + return RREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR); 1033 + } 1034 + 1035 + /** 1036 + * vcn_v2_5_jpeg_ring_set_wptr - set write pointer 1037 + * 1038 + * @ring: amdgpu_ring pointer 1039 + * 1040 + * Commits the write pointer to the hardware 1041 + */ 1042 + static void vcn_v2_5_jpeg_ring_set_wptr(struct amdgpu_ring *ring) 1043 + { 1044 + struct amdgpu_device *adev = ring->adev; 1045 + 1046 + WREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_WPTR, lower_32_bits(ring->wptr)); 1047 + } 1048 + 1049 + static const struct amdgpu_ring_funcs vcn_v2_5_jpeg_ring_vm_funcs = { 1050 + .type = AMDGPU_RING_TYPE_VCN_JPEG, 1051 + .align_mask = 0xf, 1052 + .vmhub = AMDGPU_MMHUB_1, 1053 + .get_rptr = vcn_v2_5_jpeg_ring_get_rptr, 1054 + .get_wptr = vcn_v2_5_jpeg_ring_get_wptr, 1055 + .set_wptr = vcn_v2_5_jpeg_ring_set_wptr, 1056 + .emit_frame_size = 1057 + SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 + 1058 + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 8 + 1059 + 8 + /* vcn_v2_0_jpeg_ring_emit_vm_flush */ 1060 + 18 + 18 + /* vcn_v2_0_jpeg_ring_emit_fence x2 vm fence */ 1061 + 8 + 16, 1062 + .emit_ib_size = 22, /* vcn_v2_0_jpeg_ring_emit_ib */ 1063 + .emit_ib = vcn_v2_0_jpeg_ring_emit_ib, 1064 + .emit_fence = vcn_v2_0_jpeg_ring_emit_fence, 1065 + .emit_vm_flush = vcn_v2_0_jpeg_ring_emit_vm_flush, 1066 + .test_ring = amdgpu_vcn_jpeg_ring_test_ring, 1067 + .test_ib = amdgpu_vcn_jpeg_ring_test_ib, 1068 + .insert_nop = vcn_v2_0_jpeg_ring_nop, 1069 + .insert_start = vcn_v2_0_jpeg_ring_insert_start, 1070 + .insert_end = vcn_v2_0_jpeg_ring_insert_end, 1071 + .pad_ib = amdgpu_ring_generic_pad_ib, 1072 + .begin_use = amdgpu_vcn_ring_begin_use, 1073 + .end_use = amdgpu_vcn_ring_end_use, 1074 + .emit_wreg = vcn_v2_0_jpeg_ring_emit_wreg, 1075 + .emit_reg_wait = vcn_v2_0_jpeg_ring_emit_reg_wait, 1076 + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1077 + }; 1078 + 1007 1079 static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) 1008 1080 { 1009 1081 adev->vcn.ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs; ··· 1090 1018 adev->vcn.ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs; 1091 1019 1092 1020 DRM_INFO("VCN encode is enabled in VM mode\n"); 1021 + } 1022 + 1023 + static void vcn_v2_5_set_jpeg_ring_funcs(struct amdgpu_device *adev) 1024 + { 1025 + adev->vcn.ring_jpeg.funcs = &vcn_v2_5_jpeg_ring_vm_funcs; 1026 + DRM_INFO("VCN jpeg decode is enabled in VM mode\n"); 1093 1027 } 1094 1028 1095 1029 static bool vcn_v2_5_is_idle(void *handle)