anv: consolidate environment variables

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34332>
This commit is contained in:
Lionel Landwerlin
2025-04-01 23:39:36 +03:00
committed by Marge Bot
parent 713cb0fdc1
commit 789f13359a
10 changed files with 81 additions and 56 deletions

View File

@@ -3,8 +3,7 @@
VARS=(
ACO_DEBUG
ANGLE_TAG
ANV_VIDEO_DECODE
ANV_VIDEO_ENCODE
ANV_DEBUG
ARTIFACTS_BASE_URL
ASAN_OPTIONS
BASE_SYSTEM_FORK_HOST_PREFIX

View File

@@ -860,17 +860,29 @@ Intel driver environment variables
Anvil(ANV) driver environment variables
---------------------------------------
.. envvar:: ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS
.. envvar:: ANV_DEBUG
Accepts the following comma-separated list of flags:
``bindless``
Forces all descriptor sets to use the internal :ref:`Bindless model`
``no-gpl``
Disables `VK_KHR_graphics_pipeline_library` support
``no-secondary-call``
Disables secondary command buffer calls
``no-sparse``
Disables sparse support
``sparse-trtt``
Forces use of TR-TT hardware for sparse support
``video-decode``
Enables video decoding support
``video-encode``
Enables video encoding support
If defined to ``1`` or ``true``, this will prevent usage of self
modifying command buffers to implement ``vkCmdExecuteCommands``. As
a result of this, it will also disable :ext:`VK_KHR_performance_query`.
.. envvar:: ANV_ALWAYS_BINDLESS
If defined to ``1`` or ``true``, this forces all descriptor sets to
use the internal :ref:`Bindless model`.
.. envvar:: ANV_PRIMITIVE_REPLICATION_MAX_VIEWS
Specifies up to how many view shaders can be lowered to handle
@@ -878,10 +890,9 @@ Anvil(ANV) driver environment variables
using instanced rendering. If unspecified, the value default to
``2``.
.. envvar:: ANV_NO_GPL
.. envvar:: ANV_PRINTF_BUFFER_SIZE
If set to 1, true, or yes, then VK_EXT_graphics_pipeline_library
will be disabled.
Specifies the size of the printf buffer.
.. envvar:: ANV_QUEUE_OVERRIDE

View File

@@ -352,8 +352,7 @@
- .anv-rules
variables:
DRIVER_NAME: anv
ANV_VIDEO_DECODE: "true"
ANV_VIDEO_ENCODE: "true"
ANV_DEBUG: "video-decode,video-encode"
.iris-test:
extends:

View File

@@ -1067,7 +1067,7 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
* actual ExecuteCommands implementation.
*/
const uint32_t length = cmd_buffer->batch.next - cmd_buffer->batch.start;
if (cmd_buffer->device->physical->use_call_secondary) {
if (!(cmd_buffer->device->physical->instance->debug & ANV_DEBUG_NO_SECONDARY_CALL)) {
cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_CALL_AND_RETURN;
void *jump_addr =

View File

@@ -448,7 +448,7 @@ anv_descriptor_requires_bindless(const struct anv_physical_device *pdevice,
const struct anv_descriptor_set_layout *set,
const struct anv_descriptor_set_binding_layout *binding)
{
if (pdevice->always_use_bindless)
if (pdevice->instance->debug & ANV_DEBUG_BINDLESS)
return anv_descriptor_supports_bindless(pdevice, set, binding);
if (set->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR)

View File

@@ -682,11 +682,11 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device
assert(aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
if (anv_format->flags & ANV_FORMAT_FLAG_CAN_VIDEO) {
flags |= physical_device->video_decode_enabled ?
flags |= (physical_device->instance->debug & ANV_DEBUG_VIDEO_DECODE) ?
VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR |
VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR : 0;
flags |= physical_device->video_encode_enabled ?
flags |= (physical_device->instance->debug & ANV_DEBUG_VIDEO_ENCODE) ?
VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR |
VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR : 0;
}

View File

@@ -71,6 +71,16 @@ static const driOptionDescription anv_dri_options[] = {
DRI_CONF_SECTION_END
};
static const struct debug_control debug_control[] = {
{ "bindless", ANV_DEBUG_BINDLESS},
{ "no-gpl", ANV_DEBUG_NO_GPL},
{ "no-sparse", ANV_DEBUG_NO_SPARSE},
{ "sparse-trtt", ANV_DEBUG_SPARSE_TRTT},
{ "video-decode", ANV_DEBUG_VIDEO_DECODE},
{ "video-encode", ANV_DEBUG_VIDEO_ENCODE},
{ NULL, 0 }
};
VkResult anv_EnumerateInstanceVersion(
uint32_t* pApiVersion)
{
@@ -255,6 +265,9 @@ VkResult anv_CreateInstance(
anv_init_dri_options(instance);
instance->debug = parse_debug_string(os_get_option("ANV_DEBUG"),
debug_control);
intel_driver_ds_init();
*pInstance = anv_instance_to_handle(instance);

View File

@@ -2283,7 +2283,7 @@ binding_should_use_surface_binding_table(const struct apply_pipeline_layout_stat
if ((bind_layout->data & ANV_DESCRIPTOR_BTI_SURFACE_STATE) == 0)
return false;
if (state->pdevice->always_use_bindless &&
if ((state->pdevice->instance->debug & ANV_DEBUG_BINDLESS) &&
(bind_layout->data & ANV_DESCRIPTOR_SURFACE))
return false;
@@ -2301,7 +2301,7 @@ binding_should_use_sampler_binding_table(const struct apply_pipeline_layout_stat
if ((binding->data & ANV_DESCRIPTOR_BTI_SAMPLER_STATE) == 0)
return false;
if (state->pdevice->always_use_bindless &&
if ((state->pdevice->instance->debug & ANV_DEBUG_BINDLESS) &&
(binding->data & ANV_DESCRIPTOR_SAMPLER))
return false;

View File

@@ -131,6 +131,8 @@ get_device_extensions(const struct anv_physical_device *device,
(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT) != 0;
const bool rt_enabled = ANV_SUPPORT_RT && device->info.has_ray_tracing;
const bool video_decode_enabled = device->instance->debug & ANV_DEBUG_VIDEO_DECODE;
const bool video_encode_enabled = device->instance->debug & ANV_DEBUG_VIDEO_ENCODE;
*ext = (struct vk_device_extension_table) {
.KHR_8bit_storage = true,
@@ -185,7 +187,7 @@ get_device_extensions(const struct anv_physical_device *device,
device->perf &&
(intel_perf_has_hold_preemption(device->perf) ||
INTEL_DEBUG(DEBUG_NO_OACONFIG)) &&
device->use_call_secondary,
!(device->instance->debug & ANV_DEBUG_NO_SECONDARY_CALL),
.KHR_pipeline_executable_properties = true,
.KHR_pipeline_library = true,
/* Hide these behind dri configs for now since we cannot implement it reliably on
@@ -235,21 +237,21 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_uniform_buffer_standard_layout = true,
.KHR_variable_pointers = true,
.KHR_vertex_attribute_divisor = true,
.KHR_video_queue = device->video_decode_enabled || device->video_encode_enabled,
.KHR_video_decode_queue = device->video_decode_enabled,
.KHR_video_decode_h264 = VIDEO_CODEC_H264DEC && device->video_decode_enabled,
.KHR_video_decode_h265 = VIDEO_CODEC_H265DEC && device->video_decode_enabled,
.KHR_video_decode_av1 = device->info.ver >= 12 && VIDEO_CODEC_AV1DEC && device->video_decode_enabled,
.KHR_video_encode_queue = device->video_encode_enabled,
.KHR_video_encode_h264 = VIDEO_CODEC_H264ENC && device->video_encode_enabled,
.KHR_video_encode_h265 = device->info.ver >= 12 && VIDEO_CODEC_H265ENC && device->video_encode_enabled,
.KHR_video_maintenance1 = (device->video_decode_enabled &&
.KHR_video_queue = video_decode_enabled || video_encode_enabled,
.KHR_video_decode_queue = video_decode_enabled,
.KHR_video_decode_h264 = VIDEO_CODEC_H264DEC && video_decode_enabled,
.KHR_video_decode_h265 = VIDEO_CODEC_H265DEC && video_decode_enabled,
.KHR_video_decode_av1 = device->info.ver >= 12 && VIDEO_CODEC_AV1DEC && video_decode_enabled,
.KHR_video_encode_queue = video_encode_enabled,
.KHR_video_encode_h264 = VIDEO_CODEC_H264ENC && video_encode_enabled,
.KHR_video_encode_h265 = device->info.ver >= 12 && VIDEO_CODEC_H265ENC && video_encode_enabled,
.KHR_video_maintenance1 = (video_decode_enabled &&
(VIDEO_CODEC_H264DEC || VIDEO_CODEC_H265DEC)) ||
(device->video_encode_enabled &&
(video_encode_enabled &&
(VIDEO_CODEC_H264ENC || VIDEO_CODEC_H265ENC)),
.KHR_video_maintenance2 = (device->video_decode_enabled &&
.KHR_video_maintenance2 = (video_decode_enabled &&
(VIDEO_CODEC_H264DEC || VIDEO_CODEC_H265DEC)) ||
(device->video_encode_enabled &&
(video_encode_enabled &&
(VIDEO_CODEC_H264ENC || VIDEO_CODEC_H265ENC)),
.KHR_vulkan_memory_model = true,
.KHR_workgroup_memory_explicit_layout = true,
@@ -287,7 +289,7 @@ get_device_extensions(const struct anv_physical_device *device,
VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR,
.EXT_global_priority_query = device->max_context_priority >=
VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR,
.EXT_graphics_pipeline_library = !debug_get_bool_option("ANV_NO_GPL", false),
.EXT_graphics_pipeline_library = !(device->instance->debug & ANV_DEBUG_NO_GPL),
.EXT_hdr_metadata = true,
.EXT_host_image_copy = !device->emu_astc_ldr,
.EXT_host_query_reset = true,
@@ -2173,8 +2175,9 @@ anv_physical_device_init_uuids(struct anv_physical_device *device)
_mesa_sha1_init(&sha1_ctx);
_mesa_sha1_update(&sha1_ctx, build_id_data(note), build_id_len);
brw_device_sha1_update(&sha1_ctx, &device->info);
_mesa_sha1_update(&sha1_ctx, &device->always_use_bindless,
sizeof(device->always_use_bindless));
bool always_use_bindless = !!(device->instance->debug & ANV_DEBUG_BINDLESS);
_mesa_sha1_update(&sha1_ctx, &always_use_bindless,
sizeof(always_use_bindless));
_mesa_sha1_final(&sha1_ctx, sha1);
memcpy(device->pipeline_cache_uuid, sha1, VK_UUID_SIZE);
@@ -2351,7 +2354,8 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
.engine_class = compute_class,
};
}
if (v_count > 0 && (pdevice->video_decode_enabled || pdevice->video_encode_enabled)) {
if (v_count > 0 && ((pdevice->instance->debug & ANV_DEBUG_VIDEO_DECODE) ||
(pdevice->instance->debug & ANV_DEBUG_VIDEO_ENCODE))) {
/* HEVC support on Gfx9 is only available on VCS0. So limit the number of video queues
* to the first VCS engine instance.
*
@@ -2364,8 +2368,10 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
*/
/* TODO: enable protected content on video queue */
pdevice->queue.families[family_count++] = (struct anv_queue_family) {
.queueFlags = (pdevice->video_decode_enabled ? VK_QUEUE_VIDEO_DECODE_BIT_KHR : 0) |
(pdevice->video_encode_enabled ? VK_QUEUE_VIDEO_ENCODE_BIT_KHR : 0),
.queueFlags = ((pdevice->instance->debug & ANV_DEBUG_VIDEO_DECODE) ?
VK_QUEUE_VIDEO_DECODE_BIT_KHR : 0) |
((pdevice->instance->debug & ANV_DEBUG_VIDEO_ENCODE) ?
VK_QUEUE_VIDEO_ENCODE_BIT_KHR : 0),
.queueCount = pdevice->info.ver == 9 ? MIN2(1, v_count) : v_count,
.engine_class = INTEL_ENGINE_CLASS_VIDEO,
};
@@ -2571,15 +2577,6 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->vk.pipeline_cache_import_ops = anv_cache_import_ops;
device->always_use_bindless =
debug_get_bool_option("ANV_ALWAYS_BINDLESS", false);
device->use_call_secondary =
!debug_get_bool_option("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false);
device->video_decode_enabled = debug_get_bool_option("ANV_VIDEO_DECODE", false);
device->video_encode_enabled = debug_get_bool_option("ANV_VIDEO_ENCODE", false);
device->uses_ex_bso = device->info.verx10 >= 125;
/* For now always use indirect descriptors. We'll update this
@@ -2600,9 +2597,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->uses_relocs = device->info.kmd_type != INTEL_KMD_TYPE_XE;
/* While xe.ko can use both vm_bind and TR-TT, i915.ko only has TR-TT. */
if (debug_get_bool_option("ANV_SPARSE", true)) {
if (!(instance->debug & ANV_DEBUG_NO_SPARSE)) {
if (device->info.kmd_type == INTEL_KMD_TYPE_XE) {
if (debug_get_bool_option("ANV_SPARSE_USE_TRTT", false))
if (instance->debug & ANV_DEBUG_SPARSE_TRTT)
device->sparse_type = ANV_SPARSE_TYPE_TRTT;
else
device->sparse_type = ANV_SPARSE_TYPE_VM_BIND;

View File

@@ -1025,9 +1025,6 @@ struct anv_physical_device {
char path[20];
struct intel_device_info info;
bool video_decode_enabled;
bool video_encode_enabled;
struct brw_compiler * compiler;
struct isl_device isl_dev;
struct intel_perf_config * perf;
@@ -1041,9 +1038,6 @@ struct anv_physical_device {
VkQueueGlobalPriorityKHR max_context_priority;
uint64_t gtt_size;
bool always_use_bindless;
bool use_call_secondary;
/** True if we can use timeline semaphores through execbuf */
bool has_exec_timeline;
@@ -1296,12 +1290,24 @@ anv_physical_device_has_vram(const struct anv_physical_device *device)
return device->vram_mappable.size > 0;
}
enum anv_debug {
ANV_DEBUG_BINDLESS = BITFIELD_BIT(0),
ANV_DEBUG_NO_GPL = BITFIELD_BIT(1),
ANV_DEBUG_NO_SECONDARY_CALL = BITFIELD_BIT(2),
ANV_DEBUG_NO_SPARSE = BITFIELD_BIT(3),
ANV_DEBUG_SPARSE_TRTT = BITFIELD_BIT(4),
ANV_DEBUG_VIDEO_DECODE = BITFIELD_BIT(5),
ANV_DEBUG_VIDEO_ENCODE = BITFIELD_BIT(6),
};
struct anv_instance {
struct vk_instance vk;
struct driOptionCache dri_options;
struct driOptionCache available_dri_options;
enum anv_debug debug;
int mesh_conv_prim_attrs_to_vert_attrs;
bool enable_tbimr;
bool enable_vf_distribution;