Module: Mesa
Branch: main
Commit: 2fdf75dadf44242fdbb37a304d79839952ad22b7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fdf75dadf44242fdbb37a304d79839952ad22b7

Author: Dave Airlie <[email protected]>
Date:   Thu Mar 16 13:24:23 2023 +1000

radv: set a video decode ip block in physical device.

This makes it easier to add navi 3x

Reviewed-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21980>

---

 src/amd/vulkan/radv_cmd_buffer.c      |  2 +-
 src/amd/vulkan/radv_physical_device.c | 28 ++++------------------------
 src/amd/vulkan/radv_private.h         |  1 +
 src/amd/vulkan/radv_video.c           |  5 +++++
 4 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 72d1acd71f8..faad8c56a42 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -273,7 +273,7 @@ radv_queue_family_to_ring(struct radv_physical_device 
*physical_device,
    case RADV_QUEUE_TRANSFER:
       return AMD_IP_SDMA;
    case RADV_QUEUE_VIDEO_DEC:
-      return radv_has_uvd(physical_device) ? AMD_IP_UVD : AMD_IP_VCN_DEC;
+      return physical_device->vid_decode_ip;
    case RADV_QUEUE_VIDEO_ENC:
       return AMD_IP_VCN_ENC;
    default:
diff --git a/src/amd/vulkan/radv_physical_device.c 
b/src/amd/vulkan/radv_physical_device.c
index cbc468591d6..6955d32302d 100644
--- a/src/amd/vulkan/radv_physical_device.c
+++ b/src/amd/vulkan/radv_physical_device.c
@@ -176,12 +176,7 @@ radv_physical_device_init_queue_table(struct 
radv_physical_device *pdevice)
    }
 
    if (pdevice->instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) {
-      if (pdevice->rad_info.ip[AMD_IP_VCN_DEC].num_queues > 0) {
-         pdevice->vk_queue_to_radv[idx] = RADV_QUEUE_VIDEO_DEC;
-         idx++;
-      }
-
-      if (radv_has_uvd(pdevice)) {
+      if (pdevice->rad_info.ip[pdevice->vid_decode_ip].num_queues > 0) {
          pdevice->vk_queue_to_radv[idx] = RADV_QUEUE_VIDEO_DEC;
          idx++;
       }
@@ -2466,10 +2461,7 @@ radv_get_physical_device_queue_family_properties(struct 
radv_physical_device *pd
       num_queue_families++;
 
    if (pdevice->instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) {
-      if (pdevice->rad_info.ip[AMD_IP_VCN_DEC].num_queues > 0)
-         num_queue_families++;
-
-      if (radv_has_uvd(pdevice))
+      if (pdevice->rad_info.ip[pdevice->vid_decode_ip].num_queues > 0)
          num_queue_families++;
    }
 
@@ -2508,23 +2500,11 @@ radv_get_physical_device_queue_family_properties(struct 
radv_physical_device *pd
    }
 
    if (pdevice->instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) {
-      if (pdevice->rad_info.ip[AMD_IP_VCN_DEC].num_queues > 0) {
-         if (*pCount > idx) {
-            *pQueueFamilyProperties[idx] = (VkQueueFamilyProperties){
-               .queueFlags = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
-               .queueCount = pdevice->rad_info.ip[AMD_IP_VCN_DEC].num_queues,
-               .timestampValidBits = 64,
-               .minImageTransferGranularity = (VkExtent3D){1, 1, 1},
-            };
-            idx++;
-         }
-      }
-
-      if (radv_has_uvd(pdevice)) {
+      if (pdevice->rad_info.ip[pdevice->vid_decode_ip].num_queues > 0) {
          if (*pCount > idx) {
             *pQueueFamilyProperties[idx] = (VkQueueFamilyProperties){
                .queueFlags = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
-               .queueCount = pdevice->rad_info.ip[AMD_IP_UVD].num_queues,
+               .queueCount = 
pdevice->rad_info.ip[pdevice->vid_decode_ip].num_queues,
                .timestampValidBits = 64,
                .minImageTransferGranularity = (VkExtent3D){1, 1, 1},
             };
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index aad1e0b4df9..f1706403f00 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -372,6 +372,7 @@ struct radv_physical_device {
       unsigned cmd;
       unsigned cntl;
    } vid_dec_reg;
+   enum amd_ip_type vid_decode_ip;
 };
 
 uint32_t radv_find_memory_index(struct radv_physical_device *pdevice, 
VkMemoryPropertyFlags flags);
diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c
index 3a0806a3a6a..2d2913ded17 100644
--- a/src/amd/vulkan/radv_video.c
+++ b/src/amd/vulkan/radv_video.c
@@ -68,6 +68,11 @@ static unsigned si_vid_alloc_stream_handle()
 void
 radv_init_physical_device_decoder(struct radv_physical_device *pdevice)
 {
+   if (radv_has_uvd(pdevice))
+      pdevice->vid_decode_ip = AMD_IP_UVD;
+   else
+      pdevice->vid_decode_ip = AMD_IP_VCN_DEC;
+
    switch (pdevice->rad_info.family) {
    case CHIP_VEGA10:
    case CHIP_VEGA12:

Reply via email to