From patchwork Wed Oct 25 23:02:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 44356 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bf16:b0:15d:8365:d4b8 with SMTP id gc22csp259066pzb; Wed, 25 Oct 2023 16:03:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnxY+lBM1/veRD6lo00I8tJ0/MuLBqNAwSLk5iUbFBqBrJjZmV+7atfYBO8mkJLUMUTg8j X-Received: by 2002:a17:907:8687:b0:9ad:e3fd:d46c with SMTP id qa7-20020a170907868700b009ade3fdd46cmr958916ejc.10.1698274987150; Wed, 25 Oct 2023 16:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698274987; cv=none; d=google.com; s=arc-20160816; b=ZfUga5mTgtGbiWQZ5BMUvL4vZ7Ob24frtm8juS8HNMmPVKZ8xFW23JO+5QUlc28OEx yf5nhg4ri+njg/SV+ZD8hpjOIGHTCGGvzyeSa64RG+nNp7RNYLvpr1T/YVBoGBEZmQPJ VWDyJGT+tZrlsISaGCsoeFapVNlJSbyDR6FE8+FA63CCLvTc8ND61n3rq1/QJTN8zb6P VeYnj+AfgJCCFQIt/OdyikNhdLX46NxIBywu15j/tv0pDN6N0EbZlmM5ANaTtitGBoSB D+SgP42I2QCEsomYBDJNuAG0X+6aWZ6AwQK21tmpwfysQGWSJWGfiZPUFjwJaiGAxY/B rpvw== 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=MEMgNizUazJItIHVrQfznPhi97j0/SPrSKkYKMlUcxA=; fh=Q46kXK7oI5D1Jhi90JBr53c7NIaTxGaU4KPeRZyM/hI=; b=kq5kuggbV5HUKNY6DMDaUhqdKDfHT3WBEEanShYW4F80pi+geS5UalTWfv78/wQlJm v4i3/iJGBNdFHQ6tea7ts/VyqItO7fLkdDiS2L0yd3+HZEXAB7ei1plfzlGB5EQP0alY j9v8DMkGEHK9QxYNnTSR7ishwHVHA81LJGRXdfSM8p1uWT8ollZIo+F4xtcOCKR+Mi1m Fp4eiB+Fyqe9EawrBqGcutBKIEU2rWhttGkyDd9N5kRLdNKiuig51Mmqfq7etkFamBE6 F2mKc6rH1Yo3J/kaNtf/LtgjIWbRidK02vvFlW0Sh3DTMsHut2njbEE9t10th5HJWFRY WgPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=w1N2UQpW; 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 dn22-20020a17090794d600b009b2b365c522si6294044ejc.396.2023.10.25.16.02.37; Wed, 25 Oct 2023 16:03:07 -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=w1N2UQpW; 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 CAE7668CB00; Thu, 26 Oct 2023 02:02:33 +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 30CAD68C965 for ; Thu, 26 Oct 2023 02:02:27 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id CC3851060307 for ; Wed, 25 Oct 2023 23:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1698274946; 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=JVTp9mFPcU5XH8AZ8A9fr/ZbkTW27C7afdstWFakvvo=; b=w1N2UQpW/w9zQPs7XCByU15IgbYKPxQ+KcgbD0LeSFLiTWuVWek/luhrmF4qy+Hw Ep56SwAucM7eCfVxo2aL1aPsgHMLpEHcQ2BysMPdqcyR61hdUiQ2pPc8rs/4Sk0cm3k 9VPhm84Ny/sZDTDixwSzHRbvWUDTezZ6OHVToKHVId1MvTqcLxOCXmsp7wSEfpjmq0W uAF0DEYExQB8/cREHUn6fbAlZg6+Sqz0drz1WMKL3OTHWgb4C5p2sfXonJOQLSNCfnk qIYb4YZRCSvzFFuRP1bZv9rSn5FW0UDCxdLmbb9jIdXkmgO6yAzmE8CiUarMFOed9IT 3cDua8njQw== Date: Thu, 26 Oct 2023 01:02:26 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] vulkan: return VK_NOT_READY when no queries are available 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: KiKOsXsbIRn0 Fixes a validation issue. The issue is that the function gets called before we've sumitted a frame for decoding to that context. However, we cannot run queries before they've been reset, which happens at submission time. As we'd need to otherwise run a command queue at init-time, just check if submissions have happened. Patch attached. From 833a1c249f5e41305fe8ea68f5e2453a5505817d Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 25 Oct 2023 22:58:20 +0000 Subject: [PATCH] vulkan: return VK_NOT_READY when no queries are available Fixes a validation issue. The issue is that the function gets called before we've sumitted a frame for decoding to that context. However, we cannot run queries before they've been reset, which happens at submission time. As we'd need to otherwise run a command queue at init-time, just check if submissions have happened. --- libavutil/vulkan.c | 5 +++++ libavutil/vulkan.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index dec8ccad64..5674ec2943 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -456,6 +456,9 @@ VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e, int64_t res = 0; VkQueryResultFlags qf = 0; + if (!e->has_query) + return VK_NOT_READY; + qf |= pool->query_64bit ? VK_QUERY_RESULT_64_BIT : 0x0; qf |= pool->query_statuses ? @@ -779,6 +782,8 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e) } } + e->has_query = 1; + return 0; } diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h index 25c5ad4b74..3069dd27c2 100644 --- a/libavutil/vulkan.h +++ b/libavutil/vulkan.h @@ -168,6 +168,7 @@ typedef struct FFVkExecContext { void *query_data; int query_idx; + int has_query; /* Buffer dependencies */ AVBufferRef **buf_deps; -- 2.40.1