diff --git a/src/intel/vulkan_hasvk/anv_device.c b/src/intel/vulkan_hasvk/anv_device.c index 521e876..b9dea71 100644 --- a/src/intel/vulkan_hasvk/anv_device.c +++ b/src/intel/vulkan_hasvk/anv_device.c @@ -96,6 +96,13 @@ static const driOptionDescription anv_dri_options[] = { /* Render engine timestamp register */ #define TIMESTAMP 0x2358 +static const struct debug_control debug_control[] = { + { "video-decode", ANV_DEBUG_VIDEO_DECODE }, + { NULL, 0 } +}; + +enum anv_debug anv_debug; + /* The "RAW" clocks on Linux are called "FAST" on FreeBSD */ #if !defined(CLOCK_MONOTONIC_RAW) && defined(CLOCK_MONOTONIC_FAST) #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST @@ -198,7 +205,7 @@ get_device_extensions(const struct anv_physical_device *device, const bool has_syncobj_wait = (device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT) != 0; - const bool video_decode = VIDEO_CODEC_H264DEC; + const bool video_decode = VIDEO_CODEC_H264DEC && ANV_DEBUG(VIDEO_DECODE); *ext = (struct vk_device_extension_table) { .KHR_8bit_storage = device->info.ver >= 8, @@ -1582,7 +1589,7 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice) .engine_class = INTEL_ENGINE_CLASS_RENDER, }; } - if (v_count > 0 && VIDEO_CODEC_H264DEC) { + if (v_count > 0 && VIDEO_CODEC_H264DEC && ANV_DEBUG(VIDEO_DECODE)) { pdevice->queue.families[family_count++] = (struct anv_queue_family) { .queueFlags = VK_QUEUE_VIDEO_DECODE_BIT_KHR, .queueCount = v_count, @@ -2024,6 +2031,7 @@ VkResult anv_CreateInstance( anv_init_dri_options(instance); process_intel_debug_variable(); + anv_debug = parse_debug_string(os_get_option("HASVK_DEBUG"), debug_control); instance->vk.enable_debug_logging = INTEL_DEBUG(DEBUG_PERF); intel_driver_ds_init(); diff --git a/src/intel/vulkan_hasvk/anv_formats.c b/src/intel/vulkan_hasvk/anv_formats.c index 58bebaf..77df092 100644 --- a/src/intel/vulkan_hasvk/anv_formats.c +++ b/src/intel/vulkan_hasvk/anv_formats.c @@ -606,7 +606,7 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo, if ((anv_format->flags & ANV_FORMAT_FLAG_CAN_VIDEO) && (anv_format->n_planes > 1 || vk_tiling == VK_IMAGE_TILING_OPTIMAL)) { - flags |= VIDEO_CODEC_H264DEC ? + flags |= (VIDEO_CODEC_H264DEC && ANV_DEBUG(VIDEO_DECODE)) ? VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR | VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR : 0; } diff --git a/src/intel/vulkan_hasvk/anv_private.h b/src/intel/vulkan_hasvk/anv_private.h index cc0489f..91cb21a 100644 --- a/src/intel/vulkan_hasvk/anv_private.h +++ b/src/intel/vulkan_hasvk/anv_private.h @@ -940,6 +940,15 @@ struct anv_instance { bool no_16bit; }; +/* Parsed from the HASVK_DEBUG environment variable. */ +enum anv_debug { + ANV_DEBUG_VIDEO_DECODE = BITFIELD_BIT(0), +}; + +extern enum anv_debug anv_debug; + +#define ANV_DEBUG(name) unlikely(anv_debug & ANV_DEBUG_##name) + VkResult anv_init_wsi(struct anv_physical_device *physical_device); void anv_finish_wsi(struct anv_physical_device *physical_device);