From patchwork Tue Nov 9 09:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 31335 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp885290iob; Tue, 9 Nov 2021 01:23:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvuICdTpGj4mhwSk0S8QOgWmBeoSPyR1Md3nH4wH1jOCh6ua23JolYFtuQHCXZuGn4jVCH X-Received: by 2002:a17:907:9690:: with SMTP id hd16mr7512953ejc.297.1636449783093; Tue, 09 Nov 2021 01:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636449783; cv=none; d=google.com; s=arc-20160816; b=BwMmkC9LsQwZPMwqMSJDN35NsRVjpceEXZUKzW2PvtLJO7MD1dqBTnJPeoHZrz5MVY D3KX6JPjr1CF4DjW2aZaHZVbzMebrSGB7T36jS8k8MkIGmRBKh0eOzC/xkpgvvZnmUUD moBhgnh0p3cdAJOqMS9dSiGmLOGYTWclR/dOtakIcYJjc5wCd1IEvSNsYsVmu8ApzQi+ 6GEMgd6ww0UtSIJKb/jgg49LXF2+jHzPL1iii9MhaQ4/XP1FcEhzdlkzM4LuvADdrA8Y 0Y23aCOXYticw8v2kBHvkkl7W2aIBYCq/DWHCDmU/OQwxMOFBZm1YXYzTgU+yt2vsgAE QcGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=u2Yfrp8uP4C0/wrJqd9V696Z0tFyx5Ms69KtWp4J/Xw=; b=RY5BnKMHOhOCoc2WN4ialXFcXV4dFiPEaqeYQq/oadJ+IPJI91RfPqlXx/w69sv6oV T7kfwS9iTB+tpddB67iGpM1/1CYQHRQu5yE1jAb9zvHoQVY4fOr8YdJQddaE72tLKANj +HTTsLZJROz/CRS8CHWSimi7EAd4yzruuc3rFZqMqVhBUv0TB8dJgstKke78JgGbv8Fp 2O3wuhPDLwORfK2cIYNOaiTBhudhAcGfgeIhSYqsbZIwa4JpQXNT6AyCakJgJiZfTUaL lEYcDb/mhnOjiA0gKzDWeHb0fLL2AlIB2bASx8TOPDUBYRocpTaN2U3LiL3cP16UG3cV 69mg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 5si29240379eji.628.2021.11.09.01.23.02; Tue, 09 Nov 2021 01:23:03 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 99FC468A98D; Tue, 9 Nov 2021 11:22:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11E6C68A9A8 for ; Tue, 9 Nov 2021 11:22:45 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="231131823" X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="231131823" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 01:22:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="491593929" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga007.jf.intel.com with ESMTP; 09 Nov 2021 01:22:43 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Nov 2021 17:18:39 +0800 Message-Id: <20211109091843.2024927-3-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109091843.2024927-1-wenbin.chen@intel.com> References: <20211109091843.2024927-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] libavutil/hwcontext_vulkan: Add one_memory flag to make vulkan compatible with vaapi device. 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 Cc: Wenbin Chen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: U2Ea/Oh9CGgY Vaapi can import external surface, but all the planes of the external frames should be in the same drm object. A new flag is introduced and vulkan can choose to allocate planes in one memory according this flag. This flag will be enabled when the vulkan device is derived from vaapi device, so that this change will not affect current vulkan behaviour. Signed-off-by: Wenbin Chen --- libavutil/hwcontext_vulkan.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 6041580117..ccf3e58f49 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -100,6 +100,9 @@ typedef struct VulkanDevicePriv { /* Settings */ int use_linear_images; + /* map all planes to one memory */ + int use_one_memory; + /* Nvidia */ int dev_is_nvidia; } VulkanDevicePriv; @@ -1245,6 +1248,11 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, if (opt_d) p->use_linear_images = strtol(opt_d->value, NULL, 10); + opt_d = av_dict_get(opts, "one_memory", NULL, 0); + if (opt_d) + p->use_one_memory = strtol(opt_d->value, NULL, 10); + + hwctx->enabled_dev_extensions = dev_info.ppEnabledExtensionNames; hwctx->nb_enabled_dev_extensions = dev_info.enabledExtensionCount; @@ -1365,8 +1373,10 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, return AVERROR_EXTERNAL; } - if (strstr(vendor, "Intel")) + if (strstr(vendor, "Intel")) { + av_dict_set_int(&opts, "one_memory", 1, 0); dev_select.vendor_id = 0x8086; + } if (strstr(vendor, "AMD")) dev_select.vendor_id = 0x1002;