From patchwork Sun Sep 22 07:22:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 51691 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp1851911vqb; Sun, 22 Sep 2024 00:23:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWse4IfV4jrs6o9xMQBPFnj08xvU/4mybUNBDVQwJ8ZXaRTDxCInTeOhR1TMbCSI24ts6oApTfxr18cqqzHTvcM@gmail.com X-Google-Smtp-Source: AGHT+IFgVYYXmRT1NR9KPGgVIqLSVavGH2e2FFxrLp1b3usNeAxqHVeyfnf62e4QwAT/OW5kcenT X-Received: by 2002:a2e:bc0e:0:b0:2f4:f3e7:2a36 with SMTP id 38308e7fff4ca-2f7cb2dd226mr13678061fa.3.1726989791105; Sun, 22 Sep 2024 00:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726989791; cv=none; d=google.com; s=arc-20240605; b=kLwS1zdXFNfUmq/nw45iCHNm1U7y/ssuVjGddENjK9yM3w/XAgfsLlWniMN0eaJd/z RCfYLj3cskeaI7y7EG5aJwm5LQlN7wJWU5VotYxb+1t23ZfvF1hfg4i1hieaEyp8Ymji 68F6s0IoBPnv2DPQpmp9oL8tqo9e0mv1Hh+xQwiowNhR+tAxud7PgyHkL4zIuTA7VI5M PMCMkbhoigbJLxdEhLldEMQ87HVicLfaeKxKhWA+mUX1ZJ+O1Bzkm/+kGs+9FrnthZ95 QkJ6kY/ZzSeSH8eSwQLgTTDKXgpcNmeQkI1NCtlO4mJkR45SYb1iAqk51nAionXZJ2OD dtfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:delivered-to; bh=G1TvtcS1HoI2l82svIvXC7qziEb+nD6Y2an/Kk4Bq78=; fh=nenT92/WZoU6unXd3J6UhGUdod4piddKfVtctNBOh6k=; b=iUpZn4PrutUgIvbwMSDjWLbKxKtAA12lxhK5/odpq5SquPGwDkVI5o/EZcXIrK/W2S ME2bKtA4kC2qCwGksADIx12AmFabkkbX/DUcWPuNTnCLJXupzv3AsOCq0ewNPFk6f9HD m/oWQ4a4HSxWx4I64W6wSW9FJa5MuWN754satb9VealDVYWdYNeIZN9nkORV+ssTfffR 3rqEL+R44XlMm/0unWLPGz+CnksDBu4E65zyFgj18M944/gCIiCKZC99p59mbzxVA8P0 PQkdAaSvj5N6LF1KomOeMq+fdn8ZaxDaGryyMVVK5U1b+LCJ5VPytyjK4yFvma1bQAxv 0bBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-536870490d5si6264843e87.167.2024.09.22.00.23.10; Sun, 22 Sep 2024 00:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 42BDB68DB18; Sun, 22 Sep 2024 10:22:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vidala.lynne.ee (vidala.pars.ee [116.203.72.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 274B868DB0F for ; Sun, 22 Sep 2024 10:22:48 +0300 (EEST) To: ffmpeg-devel@ffmpeg.org Date: Sun, 22 Sep 2024 09:22:36 +0200 Message-ID: <20240922072243.175005-3-dev@lynne.ee> X-Mailer: git-send-email 2.45.2.753.g447d99e1c3b In-Reply-To: <20240922072243.175005-1-dev@lynne.ee> References: <20240922072243.175005-1-dev@lynne.ee> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: forward debug_mode to check_extensions() for devices X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lynne via ffmpeg-devel From: Lynne Reply-To: FFmpeg development discussions and patches Cc: Lynne Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WkmMaJucfMpq This allows disabling of certain extensions when debug mode is turned on. --- libavutil/hwcontext_vulkan.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 6604dffd30..5e56a215e8 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -798,11 +798,11 @@ end: } /* Creates a VkInstance */ -static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) +static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts, + enum FFVulkanDebugMode *debug_mode) { int err = 0; VkResult ret; - enum FFVulkanDebugMode debug_mode; VulkanDevicePriv *p = ctx->hwctx; AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; @@ -839,20 +839,20 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) } err = check_layers(ctx, opts, &inst_props.ppEnabledLayerNames, - &inst_props.enabledLayerCount, &debug_mode); + &inst_props.enabledLayerCount, debug_mode); if (err) goto fail; /* Check for present/missing extensions */ err = check_extensions(ctx, 0, opts, &inst_props.ppEnabledExtensionNames, - &inst_props.enabledExtensionCount, debug_mode); + &inst_props.enabledExtensionCount, *debug_mode); hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames; hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount; if (err < 0) goto fail; /* Enable debug features if needed */ - if (debug_mode == FF_VULKAN_DEBUG_VALIDATE) { + 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, @@ -861,7 +861,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) 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) { + } 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, @@ -870,7 +870,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) 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) { + } 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, @@ -908,9 +908,9 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) } /* Setup debugging callback if needed */ - if ((debug_mode == FF_VULKAN_DEBUG_VALIDATE) || - (debug_mode == FF_VULKAN_DEBUG_PRINTF) || - (debug_mode == FF_VULKAN_DEBUG_PRACTICES)) { + 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 | @@ -1403,6 +1403,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, VulkanDevicePriv *p = ctx->hwctx; AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; + enum FFVulkanDebugMode debug_mode = FF_VULKAN_DEBUG_NONE; /* * VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but @@ -1460,7 +1461,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, ctx->free = vulkan_device_free; /* Create an instance if not given one */ - if ((err = create_instance(ctx, opts))) + if ((err = create_instance(ctx, opts, &debug_mode))) goto end; /* Find a device (if not given one) */ @@ -1529,7 +1530,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, /* Find and enable extensions */ if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames, - &dev_info.enabledExtensionCount, 0))) { + &dev_info.enabledExtensionCount, debug_mode))) { for (int i = 0; i < dev_info.queueCreateInfoCount; i++) av_free((void *)dev_info.pQueueCreateInfos[i].pQueuePriorities); av_free((void *)dev_info.pQueueCreateInfos);