diff --git a/src/amd/vulkan/radv_physical_device.h b/src/amd/vulkan/radv_physical_device.h index af0a5475a8d..2214392035b 100644 --- a/src/amd/vulkan/radv_physical_device.h +++ b/src/amd/vulkan/radv_physical_device.h @@ -17,6 +17,7 @@ #include "radv_instance.h" #include "radv_queue.h" #include "radv_radeon_winsys.h" +#include "ac_uvd_dec.h" #include "ac_vcn_enc.h" #include "wsi_common.h" @@ -177,8 +178,7 @@ struct radv_physical_device { } vid_dec_reg; enum amd_ip_type vid_decode_ip; uint32_t vid_addr_gfx_mode; - uint32_t stream_handle_base; - uint32_t stream_handle_counter; + struct ac_uvd_stream_handle stream_handle; uint32_t av1_version; rvcn_enc_cmd_t vcn_enc_cmds; enum radv_video_enc_hw_ver enc_hw_ver; diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index 86fa138bef8..2c3cdf674d1 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -184,16 +184,6 @@ radv_vcn_sq_start(struct radv_cmd_buffer *cmd_buffer) memset(cmd_buffer->video.decode_buffer, 0, sizeof(struct rvcn_decode_buffer_s)); } -/* generate an stream handle */ -static unsigned -radv_vid_alloc_stream_handle(struct radv_physical_device *pdev) -{ - unsigned stream_handle = pdev->stream_handle_base; - - stream_handle ^= ++pdev->stream_handle_counter; - return stream_handle; -} - static void init_uvd_decoder(struct radv_physical_device *pdev) { @@ -273,10 +263,7 @@ radv_init_physical_device_decoder(struct radv_physical_device *pdev) pdev->vid_decode_ip = AMD_IP_VCN_DEC; pdev->av1_version = RDECODE_AV1_VER_0; - pdev->stream_handle_counter = 0; - pdev->stream_handle_base = 0; - - pdev->stream_handle_base = util_bitreverse(getpid()); + ac_uvd_init_stream_handle(&pdev->stream_handle); pdev->vid_addr_gfx_mode = RDECODE_ARRAY_MODE_LINEAR; @@ -520,7 +507,7 @@ radv_CreateVideoSessionKHR(VkDevice _device, const VkVideoSessionCreateInfoKHR * return VK_ERROR_FEATURE_NOT_PRESENT; } - vid->stream_handle = radv_vid_alloc_stream_handle(pdev); + vid->stream_handle = ac_uvd_alloc_stream_handle(&pdev->stream_handle); vid->dbg_frame_cnt = 0; vid->db_alignment = radv_video_get_db_alignment( pdev, vid->vk.max_coded.width,