* [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops
@ 2024-08-14 14:33 Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes Lynne via ffmpeg-devel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Lynne via ffmpeg-devel @ 2024-08-14 14:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Lynne
In 680d969a305c0927480573a1b455024088b51aeb, the new API was
used to find a queue family for dispatch, but the found queue
family was not used for decoding, just for dispatching.
---
libavcodec/vulkan_decode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index b89bfa17f2..c7a32cc439 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -1198,7 +1198,7 @@ int ff_vk_decode_init(AVCodecContext *avctx)
nb_q = 1;
session_create.flags = 0x0;
- session_create.queueFamilyIndex = s->hwctx->queue_family_decode_index;
+ session_create.queueFamilyIndex = ctx->qf.queue_family;
session_create.maxCodedExtent = ctx->caps.maxCodedExtent;
session_create.maxDpbSlots = ctx->caps.maxDpbSlots;
session_create.maxActiveReferencePictures = ctx->caps.maxActiveReferencePictures;
--
2.45.2.753.g447d99e1c3b
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes
2024-08-14 14:33 [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops Lynne via ffmpeg-devel
@ 2024-08-14 14:33 ` Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 4/4] hwcontext_vulkan: setup extensions before features Lynne via ffmpeg-devel
2 siblings, 0 replies; 4+ messages in thread
From: Lynne via ffmpeg-devel @ 2024-08-14 14:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Lynne
The validation layer option only supported GPU-assisted validation.
This is mutually exclusive with shader debug printfs, so we need to
differentiate between the two.
This also fixes issues with user-given layers, and leaks in case of
errors.
---
libavutil/hwcontext_vulkan.c | 215 +++++++++++++++++++++++------------
1 file changed, 143 insertions(+), 72 deletions(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 55dd657ddd..506629141e 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -498,8 +498,19 @@ static VkBool32 VKAPI_CALL vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEX
av_free((void *)props); \
}
+enum FFVulkanDebugMode {
+ FF_VULKAN_DEBUG_NONE = 0,
+ /* Standard GPU-assisted validation */
+ FF_VULKAN_DEBUG_VALIDATE = 1,
+ /* Passes printfs in shaders to the debug callback */
+ FF_VULKAN_DEBUG_PRINTF = 2,
+ /* Enables extra printouts */
+ FF_VULKAN_DEBUG_PRACTICES = 3,
+};
+
static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts,
- const char * const **dst, uint32_t *num, int debug)
+ const char * const **dst, uint32_t *num,
+ enum FFVulkanDebugMode debug_mode)
{
const char *tstr;
const char **extension_names = NULL;
@@ -571,7 +582,10 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts,
ADD_VAL_TO_LIST(extension_names, extensions_found, tstr);
}
- if (debug && !dev) {
+ if (!dev &&
+ ((debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
+ (debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
+ (debug_mode == FF_VULKAN_DEBUG_PRACTICES))) {
tstr = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
found = 0;
for (int j = 0; j < sup_ext_count; j++) {
@@ -627,20 +641,21 @@ fail:
return err;
}
-static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts,
- const char * const **dst, uint32_t *num,
- int *debug_mode)
+static int check_layers(AVHWDeviceContext *ctx, AVDictionary *opts,
+ const char * const **dst, uint32_t *num,
+ enum FFVulkanDebugMode *debug_mode)
{
- static const char default_layer[] = { "VK_LAYER_KHRONOS_validation" };
-
- int found = 0, err = 0;
+ int err = 0;
VulkanDevicePriv *priv = ctx->hwctx;
FFVulkanFunctions *vk = &priv->vkctx.vkfn;
+ static const char layer_standard_validation[] = { "VK_LAYER_KHRONOS_validation" };
+ int layer_standard_validation_found = 0;
+
uint32_t sup_layer_count;
VkLayerProperties *sup_layers;
- AVDictionaryEntry *user_layers;
+ AVDictionaryEntry *user_layers = av_dict_get(opts, "validation_layers", NULL, 0);
char *user_layers_str = NULL;
char *save, *token;
@@ -648,99 +663,134 @@ static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts,
uint32_t enabled_layers_count = 0;
AVDictionaryEntry *debug_opt = av_dict_get(opts, "debug", NULL, 0);
- int debug = debug_opt && strtol(debug_opt->value, NULL, 10);
+ enum FFVulkanDebugMode mode;
- /* If `debug=0`, enable no layers at all. */
- if (debug_opt && !debug)
- return 0;
+ *debug_mode = mode = FF_VULKAN_DEBUG_NONE;
+ /* Get a list of all layers */
vk->EnumerateInstanceLayerProperties(&sup_layer_count, NULL);
sup_layers = av_malloc_array(sup_layer_count, sizeof(VkLayerProperties));
if (!sup_layers)
return AVERROR(ENOMEM);
vk->EnumerateInstanceLayerProperties(&sup_layer_count, sup_layers);
- av_log(ctx, AV_LOG_VERBOSE, "Supported validation layers:\n");
+ av_log(ctx, AV_LOG_VERBOSE, "Supported layers:\n");
for (int i = 0; i < sup_layer_count; i++)
av_log(ctx, AV_LOG_VERBOSE, "\t%s\n", sup_layers[i].layerName);
- /* If `debug=1` is specified, enable the standard validation layer extension */
- if (debug) {
- *debug_mode = debug;
+ /* If no user layers or debug layers are given, return */
+ if (!debug_opt && !user_layers)
+ goto end;
+
+ /* Check for any properly supported validation layer */
+ if (debug_opt) {
+ if (!strcmp(debug_opt->value, "printf")) {
+ mode = FF_VULKAN_DEBUG_PRINTF;
+ } else if (!strcmp(debug_opt->value, "validate")) {
+ mode = FF_VULKAN_DEBUG_VALIDATE;
+ } else if (!strcmp(debug_opt->value, "practices")) {
+ mode = FF_VULKAN_DEBUG_PRACTICES;
+ } else {
+ int idx = strtol(debug_opt->value, NULL, 10);
+ if (idx < 0 || idx > FF_VULKAN_DEBUG_PRACTICES) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid debugging mode \"%s\"\n",
+ debug_opt->value);
+ err = AVERROR(EINVAL);
+ goto end;
+ }
+ mode = idx;
+ }
+ }
+
+ /* If mode is VALIDATE or PRINTF, try to find the standard validation layer extension */
+ if ((mode == FF_VULKAN_DEBUG_VALIDATE) ||
+ (mode == FF_VULKAN_DEBUG_PRINTF) ||
+ (mode == FF_VULKAN_DEBUG_PRACTICES)) {
for (int i = 0; i < sup_layer_count; i++) {
- if (!strcmp(default_layer, sup_layers[i].layerName)) {
- found = 1;
- av_log(ctx, AV_LOG_VERBOSE, "Default validation layer %s is enabled\n",
- default_layer);
- ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, default_layer);
+ if (!strcmp(layer_standard_validation, sup_layers[i].layerName)) {
+ av_log(ctx, AV_LOG_VERBOSE, "Standard validation layer %s is enabled\n",
+ layer_standard_validation);
+ ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, layer_standard_validation);
+ *debug_mode = mode;
+ layer_standard_validation_found = 1;
break;
}
}
+ if (!layer_standard_validation_found) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Validation Layer \"%s\" not supported\n", layer_standard_validation);
+ err = AVERROR(ENOTSUP);
+ goto end;
+ }
}
- user_layers = av_dict_get(opts, "validation_layers", NULL, 0);
- if (!user_layers)
- goto end;
+ /* Process any custom layers enabled */
+ if (user_layers) {
+ int found;
- user_layers_str = av_strdup(user_layers->value);
- if (!user_layers_str) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
+ user_layers_str = av_strdup(user_layers->value);
+ if (!user_layers_str) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
- token = av_strtok(user_layers_str, "+", &save);
- while (token) {
- found = 0;
- if (!strcmp(default_layer, token)) {
- if (debug) {
- /* if the `debug=1`, default_layer is enabled, skip here */
+ token = av_strtok(user_layers_str, "+", &save);
+ while (token) {
+ found = 0;
+
+ /* If debug=1/2 was specified as an option, skip this layer */
+ if (!strcmp(layer_standard_validation, token) && layer_standard_validation_found) {
token = av_strtok(NULL, "+", &save);
- continue;
- } else {
- /* if the `debug=0`, enable debug mode to load its callback properly */
- *debug_mode = debug;
- }
- }
- for (int j = 0; j < sup_layer_count; j++) {
- if (!strcmp(token, sup_layers[j].layerName)) {
- found = 1;
break;
}
- }
- if (found) {
- av_log(ctx, AV_LOG_VERBOSE, "Requested Validation Layer: %s\n", token);
- ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, token);
- } else {
- av_log(ctx, AV_LOG_ERROR,
- "Validation Layer \"%s\" not support.\n", token);
- err = AVERROR(EINVAL);
- goto fail;
- }
- token = av_strtok(NULL, "+", &save);
- }
- av_free(user_layers_str);
+ /* Try to find the layer in the list of supported layers */
+ for (int j = 0; j < sup_layer_count; j++) {
+ if (!strcmp(token, sup_layers[j].layerName)) {
+ found = 1;
+ break;
+ }
+ }
-end:
- av_free(sup_layers);
+ if (found) {
+ av_log(ctx, AV_LOG_VERBOSE, "Requested layer: %s\n", token);
+ ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, token);
- *dst = enabled_layers;
- *num = enabled_layers_count;
+ /* If debug was not set as an option, force it */
+ if (!strcmp(layer_standard_validation, token))
+ *debug_mode = FF_VULKAN_DEBUG_VALIDATE;
+ } else {
+ av_log(ctx, AV_LOG_ERROR,
+ "Layer \"%s\" not supported\n", token);
+ err = AVERROR(EINVAL);
+ goto end;
+ }
- return 0;
+ token = av_strtok(NULL, "+", &save);
+ }
+ }
fail:
- RELEASE_PROPS(enabled_layers, enabled_layers_count);
+end:
av_free(sup_layers);
av_free(user_layers_str);
+
+ if (err < 0) {
+ RELEASE_PROPS(enabled_layers, enabled_layers_count);
+ } else {
+ *dst = enabled_layers;
+ *num = enabled_layers_count;
+ }
+
return err;
}
/* Creates a VkInstance */
static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
{
- int err = 0, debug_mode = 0;
+ int err = 0;
VkResult ret;
+ enum FFVulkanDebugMode debug_mode;
VulkanDevicePriv *p = ctx->hwctx;
AVVulkanDeviceContext *hwctx = &p->p;
FFVulkanFunctions *vk = &p->vkctx.vkfn;
@@ -776,8 +826,8 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
return err;
}
- err = check_validation_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
- &inst_props.enabledLayerCount, &debug_mode);
+ err = check_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
+ &inst_props.enabledLayerCount, &debug_mode);
if (err)
goto fail;
@@ -789,14 +839,32 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
if (err < 0)
goto fail;
- if (debug_mode) {
- static const VkValidationFeatureEnableEXT feat_list[] = {
+ /* Enable debug features if needed */
+ if (debug_mode == FF_VULKAN_DEBUG_VALIDATE) {
+ static const VkValidationFeatureEnableEXT feat_list_validate[] = {
+ VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
+ VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
+ };
+ validation_features.pEnabledValidationFeatures = feat_list_validate;
+ validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_validate);
+ inst_props.pNext = &validation_features;
+ } else if (debug_mode == FF_VULKAN_DEBUG_PRINTF) {
+ static const VkValidationFeatureEnableEXT feat_list_debug[] = {
+ VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
+ VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT,
+ };
+ validation_features.pEnabledValidationFeatures = feat_list_debug;
+ validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_debug);
+ inst_props.pNext = &validation_features;
+ } else if (debug_mode == FF_VULKAN_DEBUG_PRACTICES) {
+ static const VkValidationFeatureEnableEXT feat_list_practices[] = {
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
+ VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
};
- validation_features.pEnabledValidationFeatures = feat_list;
- validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list);
+ validation_features.pEnabledValidationFeatures = feat_list_practices;
+ validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_practices);
inst_props.pNext = &validation_features;
}
@@ -827,7 +895,10 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
goto fail;
}
- if (debug_mode) {
+ /* Setup debugging callback if needed */
+ if ((debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
+ (debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
+ (debug_mode == FF_VULKAN_DEBUG_PRACTICES)) {
VkDebugUtilsMessengerCreateInfoEXT dbg = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
--
2.45.2.753.g447d99e1c3b
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension
2024-08-14 14:33 [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes Lynne via ffmpeg-devel
@ 2024-08-14 14:33 ` Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 4/4] hwcontext_vulkan: setup extensions before features Lynne via ffmpeg-devel
2 siblings, 0 replies; 4+ messages in thread
From: Lynne via ffmpeg-devel @ 2024-08-14 14:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Lynne
It was added to Vulkan 1.1 a long time ago.
Validation layer will warn if this is enabled.
---
libavutil/hwcontext_vulkan.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 506629141e..2c958b86bb 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -416,7 +416,6 @@ static const VulkanOptExtension optional_device_exts[] = {
/* Misc or required by other extensions */
{ VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
{ VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
{ VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME, FF_VK_EXT_DESCRIPTOR_BUFFER, },
{ VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME, FF_VK_EXT_DEVICE_DRM },
{ VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME, FF_VK_EXT_ATOMIC_FLOAT },
--
2.45.2.753.g447d99e1c3b
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] hwcontext_vulkan: setup extensions before features
2024-08-14 14:33 [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension Lynne via ffmpeg-devel
@ 2024-08-14 14:33 ` Lynne via ffmpeg-devel
2 siblings, 0 replies; 4+ messages in thread
From: Lynne via ffmpeg-devel @ 2024-08-14 14:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Lynne
The issue is that enabling features requires that the device
extension is supported. The extensions bitfield was set later,
so it was always 0, leading to no features being added.
---
libavutil/hwcontext_vulkan.c | 73 +++++++++++++++++++-----------------
1 file changed, 38 insertions(+), 35 deletions(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2c958b86bb..18148353c2 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1440,35 +1440,6 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
};
- hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
- hwctx->device_features.pNext = &p->device_features_1_1;
- p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
- p->device_features_1_1.pNext = &p->device_features_1_2;
- p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
- p->device_features_1_2.pNext = &p->device_features_1_3;
- p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
- p->device_features_1_3.pNext = NULL;
-
-#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE) \
- do { \
- if (p->vkctx.extensions & EXT_FLAG) { \
- (STRUCT_P)->sType = TYPE; \
- ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \
- } \
- } while (0)
-
- OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT);
- OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT);
- OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR);
- OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT);
- OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV);
-#undef OPT_CHAIN
-
ctx->free = vulkan_device_free;
/* Create an instance if not given one */
@@ -1537,12 +1508,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
p->shader_object_features.shaderObject = shader_object_features.shaderObject;
- dev_info.pNext = &hwctx->device_features;
-
- /* Setup queue family */
- if ((err = setup_queue_families(ctx, &dev_info)))
- goto end;
-
+ /* Find and enable extensions */
if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
&dev_info.enabledExtensionCount, 0))) {
for (int i = 0; i < dev_info.queueCreateInfoCount; i++)
@@ -1551,6 +1517,43 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
goto end;
}
+ /* Setup enabled device features */
+ hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
+ hwctx->device_features.pNext = &p->device_features_1_1;
+ p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
+ p->device_features_1_1.pNext = &p->device_features_1_2;
+ p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
+ p->device_features_1_2.pNext = &p->device_features_1_3;
+ p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
+ p->device_features_1_3.pNext = NULL;
+
+#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE) \
+ do { \
+ if (p->vkctx.extensions & EXT_FLAG) { \
+ (STRUCT_P)->sType = TYPE; \
+ ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \
+ } \
+ } while (0)
+
+ OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT);
+ OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT);
+ OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR);
+ OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT);
+ OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV);
+#undef OPT_CHAIN
+
+ /* Add the enabled features into the pnext chain of device creation */
+ dev_info.pNext = &hwctx->device_features;
+
+ /* Setup enabled queue families */
+ if ((err = setup_queue_families(ctx, &dev_info)))
+ goto end;
+
ret = vk->CreateDevice(hwctx->phys_dev, &dev_info, hwctx->alloc,
&hwctx->act_dev);
--
2.45.2.753.g447d99e1c3b
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-14 14:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 14:33 [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension Lynne via ffmpeg-devel
2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 4/4] hwcontext_vulkan: setup extensions before features Lynne via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git