VCN 4.0.5
Subsystems (2)
Alex Deucher
maintainercover VCN 4.0.5
This adds support for VCN (Video Codec Next) 4.0.5. This is the video encode/decode and JPEG engine on the GPU.
The register header patch was too large for the
mailing list.
Saleemkhan Jamadar (9):
drm/amdgpu: add vcn 4_0_5 header files drm/amdgpu: add VCN4 ip block support drm/amdgpu/jpeg: add jpeg support for VCN4_0_5 drm/amdgpu: add VCN_4_0_5 firmware support drm/amdgpu:enable CG and PG flags for VCN drm/amdgpu/soc21: Add video cap query support for VCN_4_0_5 drm/amdgpu/discovery: add VCN 4.0.5 Support drm/amdgpu:update kernel vcn ring test drm/amdgpu: enable PG flags for VCN
drivers/gpu/drm/amd/amdgpu/Makefile | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 32 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 + drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 621 ++ drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.h | 35 + drivers/gpu/drm/amd/amdgpu/soc21.c | 9 +- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 1779 ++++ drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.h | 35 + .../include/asic_reg/vcn/vcn_4_0_5_offset.h | 1797 ++++ .../include/asic_reg/vcn/vcn_4_0_5_sh_mask.h | 8614 +++++++++++++++++ 11 files changed, 12929 insertions(+), 6 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c create mode 100644 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.h create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_4_0_5_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_4_0_5_sh_mask.h
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 2/9 drm/amdgpu: add VCN4 ip block support
From: Saleemkhan Jamadar <[email protected]>
Add VCN 4.0.5 initialization and decoder/encoder ring functions.
v2 - update license year (Leo Liu)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 1779 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.h | 35 + 3 files changed, 1815 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -0
@@ -206,6 +206,7 @@ amdgpu-y += \ vcn_v3_0.o \ vcn_v4_0.o \ vcn_v4_0_3.o \ + vcn_v4_0_5.o \ amdgpu_jpeg.o \ jpeg_v1_0.o \ jpeg_v2_0.o \
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c new file +1779 -0
1,779 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __VCN_V4_0_5_H__ +#define __VCN_V4_0_5_H__ + +enum amdgpu_vcn_v4_0_5_sub_block { +AMDGPU_VCN_V4_0_5_VCPU_VCODEC =0 , + +AMDGPU_VCN_V4_0_5_MAX_SUB_BLOCK , +}; + +extern const struct amdgpu_ip_block_version vcn_v4_0_5_ip_block; + +#endif /* __VCN_V4_0_5_H__ */
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 3/9 drm/amdgpu/jpeg: add jpeg support for VCN4_0_5
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Add jpeg support for VCN4_0_5
v2 - update license year (Leo Liu)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 621 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.h | 35 ++ 3 files changed, 658 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c create mode 100644 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -213,7 +213,8 @@ amdgpu-y += \ jpeg_v2_5.o \ jpeg_v3_0.o \ jpeg_v4_0.o \ - jpeg_v4_0_3.o + jpeg_v4_0_3.o \ + jpeg_v4_0_5.o # add VPE block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c new file +621 -0
621 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __JPEG_V4_0_5_H__ +#define __JPEG_V4_0_5_H__ + +enum amdgpu_jpeg_v4_0_5_sub_block { +AMDGPU_JPEG_V4_0_5_JPEG0 =0 , + +AMDGPU_JPEG_V4_0_5_MAX_SUB_BLOCK , +}; + +extern const struct amdgpu_ip_block_version jpeg_v4_0_5_ip_block; + +#endif /* __JPEG_V4_0_H__ */
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 4/9 drm/amdgpu: add VCN_4_0_5 firmware support
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Add VCN_4_0_5 firmware support
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -0
@@ -58,6 +58,7 @@#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin"#define FIRMWARE_VCN4_0_3 "amdgpu/vcn_4_0_3.bin"#define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin" +#define FIRMWARE_VCN4_0_5 "amdgpu/vcn_4_0_5.bin"MODULE_FIRMWARE (FIRMWARE_RAVEN );MODULE_FIRMWARE (FIRMWARE_PICASSO );
@@ -80,6 +81,7 @@ MODULE_FIRMWARE(FIRMWARE_VCN4_0_0);MODULE_FIRMWARE (FIRMWARE_VCN4_0_2 );MODULE_FIRMWARE (FIRMWARE_VCN4_0_3 );MODULE_FIRMWARE (FIRMWARE_VCN4_0_4 ); +MODULE_FIRMWARE (FIRMWARE_VCN4_0_5 );static void amdgpu_vcn_idle_work_handler (struct work_struct *work);
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 5/9 drm/amdgpu:enable CG and PG flags for VCN
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Enable CG and PG flags for VCN on IP 11_5_0
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +4 -2
@@ -691,8 +691,10 @@ static int soc21_common_early_init(void *handle)case IP_VERSION (11 ,5 ,0 ): - adev->cg_flags =0 ; - adev->pg_flags =0 ; + adev->cg_flags =AMD_CG_SUPPORT_VCN_MGCG | +AMD_CG_SUPPORT_JPEG_MGCG ; + adev->pg_flags =AMD_PG_SUPPORT_VCN_DPG | +AMD_PG_SUPPORT_GFX_PG ; adev->external_rev_id = adev->rev_id +0x1 ;break ;default :
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 6/9 drm/amdgpu/soc21: Add video cap query support for VCN_4_0_5
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Added the video capability query support for VCN version 4_0_5
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -0
@@ -157,6 +157,7 @@ static int soc21_query_video_codecs(struct amdgpu_device *adev, bool encode,case IP_VERSION (4 ,0 ,0 ):case IP_VERSION (4 ,0 ,2 ):case IP_VERSION (4 ,0 ,4 ): +case IP_VERSION (4 ,0 ,5 ):if (amdgpu_sriov_vf (adev)) {if ((adev->vcn.harvest_config &AMDGPU_VCN_HARVEST_VCN0 ) || !amdgpu_sriov_is_av1_support (adev)) {
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 7/9 drm/amdgpu/discovery: add VCN 4.0.5 Support
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Enable VCN 4.0.5 on gc 11_5_0.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -0
@@ -81,6 +81,8 @@#include "jpeg_v4_0.h" #include "vcn_v4_0_3.h" #include "jpeg_v4_0_3.h" +#include "vcn_v4_0_5.h" +#include "jpeg_v4_0_5.h" #include "amdgpu_vkms.h" #include "mes_v10_1.h" #include "mes_v11_0.h"
@@ -2081,6 +2083,10 @@ static int amdgpu_discovery_set_mm_ip_blocks(struct amdgpu_device *adev)amdgpu_device_ip_block_add (adev, &vcn_v4_0_3_ip_block);amdgpu_device_ip_block_add (adev, &jpeg_v4_0_3_ip_block);break ; +case IP_VERSION (4 ,0 ,5 ): +amdgpu_device_ip_block_add (adev, &vcn_v4_0_5_ip_block); +amdgpu_device_ip_block_add (adev, &jpeg_v4_0_5_ip_block); +break ;default : dev_err(adev->dev, "Failed to add vcn/jpeg ip block(UVD_HWIP:0x%x)\n",
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 8/9 drm/amdgpu:update kernel vcn ring test
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
add session context buffer to decoder ring test.
v2 - put the buffer at the end of the IB (Christian)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 30 ++++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 +++ 2 files changed, 30 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +27 -3
@@ -693,7 +693,8 @@ static void amdgpu_vcn_unified_ring_ib_checksum(uint32_t **ib_checksum,static int amdgpu_vcn_dec_sw_send_msg (struct amdgpu_ring *ring,struct amdgpu_ib *ib_msg, -struct dma_fence **fence) +struct dma_fence **fence, +uint64_t session_ctx_buf_gaddr) {struct amdgpu_vcn_decode_buffer *decode_buffer =NULL ;unsigned int ib_size_dw =64 ;
@@ -732,6 +733,14 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, ib->length_dw +=sizeof (struct amdgpu_vcn_decode_buffer ) /4 ;memset (decode_buffer,0 ,sizeof (struct amdgpu_vcn_decode_buffer )); +if (session_ctx_buf_gaddr) { + decode_buffer->valid_buf_flag |= +cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER ); + decode_buffer->session_context_buffer_address_hi = +cpu_to_le32 (session_ctx_buf_gaddr >>32 ); + decode_buffer->session_context_buffer_address_lo = +cpu_to_le32 (session_ctx_buf_gaddr); + } decode_buffer->valid_buf_flag |=cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_MSG_BUFFER ); decode_buffer->msg_buffer_address_hi =cpu_to_le32 (addr >>32 ); decode_buffer->msg_buffer_address_lo =cpu_to_le32 (addr);
@@ -765,20 +774,34 @@ int amdgpu_vcn_dec_sw_ring_test_ib(struct amdgpu_ring *ring, long timeout) {struct dma_fence *fence =NULL ;struct amdgpu_ib ib; +struct amdgpu_bo *session_ctx_buf =NULL ; +void *cpu_addr =NULL ; +uint64_t gpu_addr =0 ;long r; + r =amdgpu_bo_create_kernel (ring->adev,128 *1024 ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM | +AMDGPU_GEM_DOMAIN_GTT , + &session_ctx_buf, + &gpu_addr, + &cpu_addr); +if (r) { +dev_err (ring->adev->dev,"VCN ib test:%ld failed to allocate session ctx bo\n" , r); +return r; + } + r =amdgpu_vcn_dec_get_create_msg (ring,1 , &ib);if (r) goto error; - r =amdgpu_vcn_dec_sw_send_msg (ring, &ib,NULL ); + r =amdgpu_vcn_dec_sw_send_msg (ring, &ib,NULL , gpu_addr);if (r) goto error; r =amdgpu_vcn_dec_get_destroy_msg (ring,1 , &ib);if (r) goto error; - r =amdgpu_vcn_dec_sw_send_msg (ring, &ib, &fence); + r =amdgpu_vcn_dec_sw_send_msg (ring, &ib, &fence, gpu_addr);if (r) goto error;
@@ -790,6 +813,7 @@ int amdgpu_vcn_dec_sw_ring_test_ib(struct amdgpu_ring *ring, long timeout)dma_fence_put (fence); error: +amdgpu_bo_free_kernel (&session_ctx_buf, &gpu_addr, &cpu_addr);return r; }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
@@ -172,6 +172,7 @@#define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER 0x00000001#define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER 0x00000001 +#define AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER 0x00100000#define VCN_CODEC_DISABLE_MASK_AV1 (1 << 0)#define VCN_CODEC_DISABLE_MASK_VP9 (1 << 1)
@@ -375,6 +376,8 @@ struct amdgpu_vcn_decode_buffer {uint32_t valid_buf_flag;uint32_t msg_buffer_address_hi;uint32_t msg_buffer_address_lo; +unsigned int session_context_buffer_address_hi; +unsigned int session_context_buffer_address_lo;uint32_t pad[30 ]; };
Signature · 1 line
2.41.0
Alex Deucher
maintainerPATCH 9/9 drm/amdgpu: enable PG flags for VCN
In reply to Alex DeucherFrom: Saleemkhan Jamadar <[email protected]>
Enable PG flags for VCN and Jpeg on IP 11_5_0
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc21.c +2 -0
@@ -695,6 +695,8 @@ static int soc21_common_early_init(void *handle) adev->cg_flags =AMD_CG_SUPPORT_VCN_MGCG |AMD_CG_SUPPORT_JPEG_MGCG ; adev->pg_flags =AMD_PG_SUPPORT_VCN_DPG | +AMD_PG_SUPPORT_VCN | +AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_GFX_PG ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 1 line
2.41.0