From patchwork Sun Oct 22 01:56:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 44307 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1b28:b0:15d:8365:d4b8 with SMTP id ch40csp682548pzb; Sat, 21 Oct 2023 18:56:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkq+SIfEAmk2Rl+zzNW46ORTzWO3S3OGsRB6UqWud5jGhvlOJQOuSu77mTAkHl30yel4SE X-Received: by 2002:a05:6402:26d2:b0:53e:94f8:85b0 with SMTP id x18-20020a05640226d200b0053e94f885b0mr5003946edd.13.1697939801035; Sat, 21 Oct 2023 18:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697939801; cv=none; d=google.com; s=arc-20160816; b=X3qZeEz2yftusVxjJEC4SR8C6BaqCysXEohJZKYysuFf343Xdqd3sm7pdUq+dO+EQB 6C09PhTtkPkT2ucHOKG1Cwbhhu8Z2BW7k5IQvl9o7J6PKG22WfCm42RjTb0Hqz6RAymI MQvlBKmElccB290fZ1IA7I0+pwI3BkWqv7EJlj+GXasC6XxHvL+u37nm/3YSLaZqYouG Dd6LaZMTyrN9r3GLJ6i2GgnANoxpW2MPQ6Bc+581s6JU6LBpJV3cLAGY/HK6Y0tI7khf 8xB/H0Gqc0Xwa2yDd7mURDPFyn928RgrrmLiuLqH9+KeKWL46qPxEnqjp+xGguUFkTO9 CgTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:to:from:date:dkim-signature:delivered-to; bh=0p76BC0FQzO23qFHgDcjb+LIQLhEO0YD0u4eifprrig=; fh=Q46kXK7oI5D1Jhi90JBr53c7NIaTxGaU4KPeRZyM/hI=; b=CPMY+MQmUg9T7xbN/9zxIr7wCAfpE7GW1pvW0TmtbfiRPdH1iK1lli6BH9YPzTHPNu v6nRcc2j5Od+kr4jsIidtvKSF7vtVmb8Cpmmyg7Bwx2FbAL4RRxGZRl3kx0tI13lab81 qMrpcSwa3pDDm5/hpGAvRXX8Nd7ccgCbC86qM0yI2P7Vl0DZ2yOad+lXUAGAH+ZjFdOc MGSzS3yu9lU+X5C+2X3Mx2I8DL6SPNBKV5oUFrpt/C8TzErXelmf5iW+bulJqE7QXlg1 T16uOU4Ms6T3WzIRogJsiXKPK0i8rvFFmRv7pGKEdAp0BtImuW0o3Ve21k5dsHJx1Ed+ pw+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=JiHBb99N; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lynne.ee Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l19-20020a056402255300b0053ef3aca6a0si2153633edb.535.2023.10.21.18.56.40; Sat, 21 Oct 2023 18:56:41 -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; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=JiHBb99N; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lynne.ee Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8126F680101; Sun, 22 Oct 2023 04:56:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 58DDF680101 for ; Sun, 22 Oct 2023 04:56:32 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 0F4A21060147 for ; Sun, 22 Oct 2023 01:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1697939792; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=DDTwqAgLbYuICSBEQgrqfI8fqquxGg1Cz0lc+OxtaN4=; b=JiHBb99NmQKxyX5WbpAg4mf0RrYw+xMj28VwXKx+E+pJ0HuWp2N9Qs+7BtCQbHBY Mh87Yjg821k4cxzXPT+TiHTt31/bRyfcOB0GdveHv/KjOLGTsq98sD6mGpH2C3wZY6J nZFJpepsLBrchSqYyOxMJcYGlFNCUqZ+i9XMs11jVPzsPf6ySKbLjkLURjhia7/+DDW 9Z8WxqqBICjaSXij6kUxU11IpgfencqgJt1TV2bM9VRhvySepsqcQi1bRGN2CFXfbl7 5FAG261JTmWOUgCf0LPIF17OvAK8xegKnG4cBEkyYQwFL5b43gIuKWAWOmsXvpzJoPr o7VJKG+Rsg== Date: Sun, 22 Oct 2023 03:56:32 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] hwcontext_vulkan: improve queue family init code 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: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3p1headOfIJk When users zero-init'd the struct, or left it as-is, the encode queue family matched the graphics queue family, which led it to be incorrectly logged as being used for encode. This just improves the logging so this isn't printed anymore. Patch attached. From 39ff0b95e9d7038775da8c07af526c4a50b0af24 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sun, 22 Oct 2023 03:52:33 +0200 Subject: [PATCH] hwcontext_vulkan: improve queue family init code When users zero-init'd the struct, or left it as-is, the encode queue family matched the graphics queue family, which led it to be incorrectly logged as being used for encode. This just improves the logging so this isn't printed anymore. --- libavutil/hwcontext_vulkan.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index b955ec483e..4adcc0e839 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1475,11 +1475,11 @@ static int vulkan_device_init(AVHWDeviceContext *ctx) av_free(qf); - graph_index = hwctx->queue_family_index; - comp_index = hwctx->queue_family_comp_index; - tx_index = hwctx->queue_family_tx_index; - enc_index = hwctx->queue_family_encode_index; - dec_index = hwctx->queue_family_decode_index; + graph_index = hwctx->nb_graphics_queues ? hwctx->queue_family_index : -1; + comp_index = hwctx->nb_comp_queues ? hwctx->queue_family_comp_index : -1; + tx_index = hwctx->nb_tx_queues ? hwctx->queue_family_tx_index : -1; + dec_index = hwctx->nb_decode_queues ? hwctx->queue_family_decode_index : -1; + enc_index = hwctx->nb_encode_queues ? hwctx->queue_family_encode_index : -1; #define CHECK_QUEUE(type, required, fidx, ctx_qf, qc) \ do { \ @@ -1512,10 +1512,10 @@ static int vulkan_device_init(AVHWDeviceContext *ctx) } while (0) CHECK_QUEUE("graphics", 0, graph_index, hwctx->queue_family_index, hwctx->nb_graphics_queues); - CHECK_QUEUE("upload", 1, tx_index, hwctx->queue_family_tx_index, hwctx->nb_tx_queues); CHECK_QUEUE("compute", 1, comp_index, hwctx->queue_family_comp_index, hwctx->nb_comp_queues); - CHECK_QUEUE("encode", 0, enc_index, hwctx->queue_family_encode_index, hwctx->nb_encode_queues); + CHECK_QUEUE("upload", 1, tx_index, hwctx->queue_family_tx_index, hwctx->nb_tx_queues); CHECK_QUEUE("decode", 0, dec_index, hwctx->queue_family_decode_index, hwctx->nb_decode_queues); + CHECK_QUEUE("encode", 0, enc_index, hwctx->queue_family_encode_index, hwctx->nb_encode_queues); #undef CHECK_QUEUE -- 2.42.0