radv/video: add debug flag to enable dpb image array on newer GPUs.

This is useful to test the paths on newer GPUs that work on older GPUs.

Reviewed-by: Lynne <dev@lynne.ee>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23227>
This commit is contained in:
Dave Airlie
2023-05-25 14:04:40 +10:00
committed by Marge Bot
parent 04c28c9fba
commit 1a2a330483
3 changed files with 16 additions and 4 deletions

View File

@@ -70,6 +70,7 @@ enum {
RADV_DEBUG_SHADOW_REGS = 1ull << 39, RADV_DEBUG_SHADOW_REGS = 1ull << 39,
RADV_DEBUG_EXTRA_MD = 1ull << 40, RADV_DEBUG_EXTRA_MD = 1ull << 40,
RADV_DEBUG_NO_GPL = 1ull << 41, RADV_DEBUG_NO_GPL = 1ull << 41,
RADV_DEBUG_VIDEO_ARRAY_PATH = 1ull << 42,
}; };
enum { enum {

View File

@@ -76,6 +76,7 @@ static const struct debug_control radv_debug_options[] = {
{"shadowregs", RADV_DEBUG_SHADOW_REGS}, {"shadowregs", RADV_DEBUG_SHADOW_REGS},
{"extra_md", RADV_DEBUG_EXTRA_MD}, {"extra_md", RADV_DEBUG_EXTRA_MD},
{"nogpl", RADV_DEBUG_NO_GPL}, {"nogpl", RADV_DEBUG_NO_GPL},
{"videoarraypath", RADV_DEBUG_VIDEO_ARRAY_PATH},
{NULL, 0}}; {NULL, 0}};
const char * const char *

View File

@@ -32,6 +32,7 @@
#include "ac_uvd_dec.h" #include "ac_uvd_dec.h"
#include "radv_cs.h" #include "radv_cs.h"
#include "radv_debug.h"
#define NUM_H264_REFS 17 #define NUM_H264_REFS 17
#define NUM_H265_REFS 8 #define NUM_H265_REFS 8
@@ -44,6 +45,15 @@
/* Not 100% sure this isn't too much but works */ /* Not 100% sure this isn't too much but works */
#define VID_DEFAULT_ALIGNMENT 256 #define VID_DEFAULT_ALIGNMENT 256
static bool
radv_enable_tier2(struct radv_physical_device *pdevice)
{
if (pdevice->rad_info.family >= CHIP_NAVI21 &&
!(pdevice->instance->debug_flags & RADV_DEBUG_VIDEO_ARRAY_PATH))
return true;
return false;
}
static bool static bool
radv_vid_buffer_upload_alloc(struct radv_cmd_buffer *cmd_buffer, unsigned size, radv_vid_buffer_upload_alloc(struct radv_cmd_buffer *cmd_buffer, unsigned size,
unsigned *out_offset, void **ptr) unsigned *out_offset, void **ptr)
@@ -285,12 +295,12 @@ radv_CreateVideoSessionKHR(VkDevice _device,
switch (vid->vk.op) { switch (vid->vk.op) {
case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR: case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR:
vid->stream_type = RDECODE_CODEC_H264_PERF; vid->stream_type = RDECODE_CODEC_H264_PERF;
if (device->physical_device->rad_info.family >= CHIP_NAVI21) if (radv_enable_tier2(device->physical_device))
vid->dpb_type = DPB_DYNAMIC_TIER_2; vid->dpb_type = DPB_DYNAMIC_TIER_2;
break; break;
case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR: case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR:
vid->stream_type = RDECODE_CODEC_H265; vid->stream_type = RDECODE_CODEC_H265;
if (device->physical_device->rad_info.family >= CHIP_NAVI21) if (radv_enable_tier2(device->physical_device))
vid->dpb_type = DPB_DYNAMIC_TIER_2; vid->dpb_type = DPB_DYNAMIC_TIER_2;
break; break;
default: default:
@@ -406,7 +416,7 @@ radv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice,
pCapabilities->maxActiveReferencePictures = NUM_H264_REFS; pCapabilities->maxActiveReferencePictures = NUM_H264_REFS;
/* for h264 on navi21+ separate dpb images should work */ /* for h264 on navi21+ separate dpb images should work */
if (pdevice->rad_info.family >= CHIP_NAVI21) if (radv_enable_tier2(pdevice))
pCapabilities->flags |= VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR; pCapabilities->flags |= VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
ext->fieldOffsetGranularity.x = 0; ext->fieldOffsetGranularity.x = 0;
ext->fieldOffsetGranularity.y = 0; ext->fieldOffsetGranularity.y = 0;
@@ -421,7 +431,7 @@ radv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice,
pCapabilities->maxDpbSlots = NUM_H264_REFS; pCapabilities->maxDpbSlots = NUM_H264_REFS;
pCapabilities->maxActiveReferencePictures = NUM_H265_REFS; pCapabilities->maxActiveReferencePictures = NUM_H265_REFS;
/* for h265 on navi21+ separate dpb images should work */ /* for h265 on navi21+ separate dpb images should work */
if (pdevice->rad_info.family >= CHIP_NAVI21) if (radv_enable_tier2(pdevice))
pCapabilities->flags |= VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR; pCapabilities->flags |= VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
ext->maxLevelIdc = 51; ext->maxLevelIdc = 51;
strcpy(pCapabilities->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME); strcpy(pCapabilities->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME);