From 4255bbd95846b6dcafd04a35f3bdfe9014550418 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 26 Aug 2024 07:07:47 +1000 Subject: [PATCH] radv: move video decode enable test into a flag This makes it easier to start conditionalising this on fw releases. Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_formats.c | 3 +-- src/amd/vulkan/radv_physical_device.c | 17 +++++++++-------- src/amd/vulkan/radv_physical_device.h | 2 +- src/amd/vulkan/radv_video.c | 11 +++++++++++ src/amd/vulkan/radv_video.h | 1 + 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 4cddbcf92f3..90968847261 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -269,7 +269,6 @@ static void radv_physical_device_get_format_properties(struct radv_physical_device *pdev, VkFormat format, VkFormatProperties3 *out_properties) { - const struct radv_instance *instance = radv_physical_device_instance(pdev); VkFormatFeatureFlags2 linear = 0, tiled = 0, buffer = 0; const struct util_format_description *desc = vk_format_description(format); bool scaled = false; @@ -315,7 +314,7 @@ radv_physical_device_get_format_properties(struct radv_physical_device *pdev, Vk tiling |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT; } - if (instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) { + if (pdev->video_decode_enabled) { if (format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM || format == VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 || format == VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16) diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 0a6cffda419..ebdcec2fc36 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -240,7 +240,7 @@ radv_physical_device_init_queue_table(struct radv_physical_device *pdev) idx++; } - if (instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) { + if (pdev->video_decode_enabled) { if (pdev->info.ip[pdev->vid_decode_ip].num_queues > 0) { pdev->vk_queue_to_radv[idx] = RADV_QUEUE_VIDEO_DEC; idx++; @@ -574,12 +574,12 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .KHR_variable_pointers = true, .KHR_vertex_attribute_divisor = true, .KHR_video_maintenance1 = true, - .KHR_video_queue = !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) || pdev->video_encode_enabled, + .KHR_video_queue = pdev->video_decode_enabled || pdev->video_encode_enabled, .KHR_video_decode_av1 = (pdev->info.vcn_ip_version >= VCN_3_0_0 && pdev->info.vcn_ip_version != VCN_3_0_33 && - VIDEO_CODEC_AV1DEC && !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE)), - .KHR_video_decode_queue = !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE), - .KHR_video_decode_h264 = VIDEO_CODEC_H264DEC && !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE), - .KHR_video_decode_h265 = VIDEO_CODEC_H265DEC && !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE), + VIDEO_CODEC_AV1DEC && pdev->video_decode_enabled), + .KHR_video_decode_queue = pdev->video_decode_enabled, + .KHR_video_decode_h264 = VIDEO_CODEC_H264DEC && pdev->video_decode_enabled, + .KHR_video_decode_h265 = VIDEO_CODEC_H265DEC && pdev->video_decode_enabled, .KHR_video_encode_h264 = VIDEO_CODEC_H264ENC && pdev->video_encode_enabled, .KHR_video_encode_h265 = VIDEO_CODEC_H265ENC && pdev->video_encode_enabled, .KHR_video_encode_queue = pdev->video_encode_enabled, @@ -2133,6 +2133,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm pdev->rt_wave_size = 64; } + radv_probe_video_decode(pdev); radv_probe_video_encode(pdev); pdev->max_shared_size = pdev->info.gfx_level >= GFX7 ? 65536 : 32768; @@ -2299,7 +2300,7 @@ radv_get_physical_device_queue_family_properties(struct radv_physical_device *pd if (pdev->info.ip[AMD_IP_COMPUTE].num_queues > 0 && !(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) num_queue_families++; - if (instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) { + if (pdev->video_decode_enabled) { if (pdev->info.ip[pdev->vid_decode_ip].num_queues > 0) num_queue_families++; } @@ -2354,7 +2355,7 @@ radv_get_physical_device_queue_family_properties(struct radv_physical_device *pd } } - if (instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) { + if (pdev->video_decode_enabled) { if (pdev->info.ip[pdev->vid_decode_ip].num_queues > 0) { if (*pCount > idx) { *pQueueFamilyProperties[idx] = (VkQueueFamilyProperties){ diff --git a/src/amd/vulkan/radv_physical_device.h b/src/amd/vulkan/radv_physical_device.h index 469ecc3e3d0..c8d288346cf 100644 --- a/src/amd/vulkan/radv_physical_device.h +++ b/src/amd/vulkan/radv_physical_device.h @@ -182,7 +182,7 @@ struct radv_physical_device { enum radv_video_enc_hw_ver enc_hw_ver; uint32_t encoder_interface_version; bool video_encode_enabled; - + bool video_decode_enabled; struct radv_physical_device_cache_key cache_key; uint32_t tess_distribution_mode; diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index 590435d877c..7f9e39f85b2 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -247,6 +247,17 @@ radv_init_physical_device_decoder(struct radv_physical_device *pdev) init_vcn_decoder(pdev); } +void +radv_probe_video_decode(struct radv_physical_device *pdev) +{ + const struct radv_instance *instance = radv_physical_device_instance(pdev); + + pdev->video_decode_enabled = false; + if (instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) { + pdev->video_decode_enabled = true; + } +} + static bool have_it(struct radv_video_session *vid) { diff --git a/src/amd/vulkan/radv_video.h b/src/amd/vulkan/radv_video.h index 2cfe6f44406..d6d4acd25bc 100644 --- a/src/amd/vulkan/radv_video.h +++ b/src/amd/vulkan/radv_video.h @@ -77,6 +77,7 @@ void radv_vcn_sq_tail(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq); void radv_vcn_write_event(struct radv_cmd_buffer *cmd_buffer, struct radv_event *event, unsigned value); void radv_init_physical_device_encoder(struct radv_physical_device *pdevice); +void radv_probe_video_decode(struct radv_physical_device *pdev); void radv_probe_video_encode(struct radv_physical_device *pdev); void radv_video_enc_begin_coding(struct radv_cmd_buffer *cmd_buffer); void radv_video_enc_end_coding(struct radv_cmd_buffer *cmd_buffer);