From patchwork Wed May 13 15:53:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 19673 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 66AB444B129 for ; Wed, 13 May 2020 18:53:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4AE0868A3DF; Wed, 13 May 2020 18:53:08 +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 4FCBC68067E for ; Wed, 13 May 2020 18:53:01 +0300 (EEST) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 2780D1060271 for ; Wed, 13 May 2020 15:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1589385180; 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=3VqAIDKOb7bsQgThvJYnnYwMPu2jX/cq2ImvSO1W8ZU=; b=huu47nLTGgipJ38RMybNysyayMhND3xt3xyT8M2hyLeXCYmYfC42dYnVL/ZTMAWC G9DypQefU2ehFoFF2ZiBbkdvpM1UGRKRlrS/Egyx/HhkdkcmKeGoZkxlyN24PglwMga ltF/+21ZkL9351JE2GcP6UykEI9Srs/OdCtc9X6OoVqZSF6Iu+hBvjqhawz1ygjFh2P 3SV7yELZC30oWJZ3mw1FXTTbRVClH5CjntlxsZmvVG3Sf1c1r0rFzh/1vC06lhvVhDD y42NpqPJ6rqSRNG5pcNz2No4h7yDxujRNc9fmNdpvFi2F64F6EEcFI+Pba/jy1ZrM6q GEaMfILhfw== Date: Wed, 13 May 2020 17:53:00 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] hwcontext_vulkan: expose the amount of queues for each queue family X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" This, along with the next patch, are the last missing pieces to being interoperable with libplacebo. There is no danger of users running into this API break because there are none, and API was completely backwards-incompatibly changed just 2 days ago. This is needed so we won't have to break the API anymore in the future. Patch attached. Subject: [PATCH 1/2] hwcontext_vulkan: expose the amount of queues for each queue family This, along with the next patch, are the last missing pieces to being interoperable with libplacebo. --- libavutil/hwcontext_vulkan.c | 3 +++ libavutil/hwcontext_vulkan.h | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 8f3f3fdd2a..82ceb7013a 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -679,16 +679,19 @@ static int search_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd) hwctx->queue_family_index = graph_index; hwctx->queue_family_comp_index = graph_index; hwctx->queue_family_tx_index = graph_index; + hwctx->nb_graphics_queues = qs[graph_index].queueCount; if (comp_index != -1) { ADD_QUEUE(comp_index, 0, 1, tx_index < 0) hwctx->queue_family_tx_index = comp_index; hwctx->queue_family_comp_index = comp_index; + hwctx->nb_comp_queues = qs[comp_index].queueCount; } if (tx_index != -1) { ADD_QUEUE(tx_index, 0, 0, 1) hwctx->queue_family_tx_index = tx_index; + hwctx->nb_tx_queues = qs[tx_index].queueCount; } #undef ADD_QUEUE diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h index c3fc14af70..9fbe8b9dcb 100644 --- a/libavutil/hwcontext_vulkan.h +++ b/libavutil/hwcontext_vulkan.h @@ -55,16 +55,26 @@ typedef struct AVVulkanDeviceContext { * @note av_hwdevice_create() will set all 3 queue indices if unset * If there is no dedicated queue for compute or transfer operations, * they will be set to the graphics queue index which can handle both. + * nb_graphics_queues indicates how many queues were enabled for the + * graphics queue (must be at least 1) */ int queue_family_index; + int nb_graphics_queues; /** - * Queue family index for transfer ops only + * Queue family index to use for transfer operations, and the amount of queues + * enabled. In case there is no dedicated transfer queue, nb_tx_queues + * must be 0 and queue_family_tx_index must be the same as either the graphics + * queue or the compute queue, if available. */ int queue_family_tx_index; + int nb_tx_queues; /** - * Queue family index for compute ops + * Queue family index for compute ops, and the amount of queues enabled. + * In case there are no dedicated compute queues, nb_comp_queues must be + * 0 and its queue family index must be set to the graphics queue. */ int queue_family_comp_index; + int nb_comp_queues; /** * Enabled instance extensions. By default, VK_KHR_surface is enabled if found. * If supplying your own device context, set this to an array of strings, with