From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 512B8466FE for ; Wed, 7 Jun 2023 21:33:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C4DBB68C0A9; Thu, 8 Jun 2023 00:32:58 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [72.14.183.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C52068BE2F for ; Thu, 8 Jun 2023 00:32:52 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=overt.org; s=mail; t=1686173571; bh=6uYxgDPQJJX3tUiG4aEXM31Vnfc03bZqnIEkzFpeHwA=; h=Date:From:To:Subject:In-Reply-To:References:From; b=F/M2aM5NrQKvPBmj9oOOG6tiD7kqOKgv1IrWaOX/tOySfp293Y3e7pu1Kw6EhHuSQ 5Lw4ouJYjk9hUmHL9IAe7aVKHFUFEqA1PLkAiWBV1RP4W8NBAtMK5uOuiAMrAW4m/M 0s9I1lV3TkTMMkhLC0v5m4jaiReJPktM74n9skakwchOpeO4s0B9plx5rj0/nitgLX DVWLMou43E1eujhqWdxTFhdfJx9WloRixYKD0/3CHWyanHbJ3XwNzPgge7zGsFz0Ch VSdBNxF4Q86/rOjEx1ab6hhCrtQzupRhxyqNuhrods13QwbQ0d0QnAtp8zBHfklqNS 2JMQdDrW/kUWg== Received: from authenticated-user (mail.overt.org [72.14.183.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id D6ACF60389 for ; Wed, 7 Jun 2023 16:32:50 -0500 (CDT) Date: Wed, 7 Jun 2023 14:32:49 -0700 From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Message-ID: <20230607143249.1004c98d@fluffy> In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 2/2] vulkan: discard dependencies when explicitly waiting for execution 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, 7 Jun 2023 01:23:24 +0200 (CEST) Lynne wrote: > From eb74297de8662c9fa66cd719c6315567966afe56 Mon Sep 17 00:00:00 2001 > From: Lynne > Date: Wed, 7 Jun 2023 01:16:29 +0200 > Subject: [PATCH 2/2] vulkan: discard dependencies when explicitly > waiting for execution > > This reduces memory needed dramatically, as unneeded resources > can be immediately returned to the pool. > Although waitforfences is threadsafe, we add a mutex wait around > it, as the mutex fence in combination with waitforfences assures > us that no other thread will reset the fence in the meanwhile > whilst the mutex is locked. This allows is to call > ff_vk_exec_discard_deps. > --- > libavutil/vulkan.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c > index 4b96c0c200..0cfe334db0 100644 > --- a/libavutil/vulkan.c > +++ b/libavutil/vulkan.c > @@ -480,7 +480,10 @@ FFVkExecContext *ff_vk_exec_get(FFVkExecPool > *pool) void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e) > { > FFVulkanFunctions *vk = &s->vkfn; > + pthread_mutex_lock(&e->lock); > vk->WaitForFences(s->hwctx->act_dev, 1, &e->fence, VK_TRUE, > UINT64_MAX); > + ff_vk_exec_discard_deps(s, e); > + pthread_mutex_unlock(&e->lock); > } > > int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e) LGTM. --phil _______________________________________________ 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".