From patchwork Tue Aug 31 01:43:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 29888 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4497666iov; Mon, 30 Aug 2021 18:46:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAwb2Mfp0vAIIv8A+lelSElvxJbFn2DupmA/f/j2a7GtDeW29QjVACH/37AXzcpIiYPcrg X-Received: by 2002:a50:bb68:: with SMTP id y95mr8660349ede.231.1630374413131; Mon, 30 Aug 2021 18:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630374413; cv=none; d=google.com; s=arc-20160816; b=ddFyKDT6Klu8bH3SmTOg6xLCvw/iTnp4Uy2/OiJEL4s3u3rsQVTrCL4wwOpfQVv8Ut /cBfDSybdfVfI96AUPmP6VDTwGF9rtEmn/HpDzz1OFwKqHO+hOBMnYfdbRtmInGTWPcP xduIHR7r1UFZNFsfAyOZV2vZgfxJ9Bq3mObQuFPz5obVn0GBbWlWUzex6Wi256WV3Yo8 Wf0xS4fuxvLWshJ6wjyWHaSTiRCMgPBaG0MRHfNk0XaAoTOew/mmeA0ju2I+Hpva3Eab XQTUYPlxxlmdXqht4Q6+JW0kZjPpI6VrO8VFC3r61um9MEvwA4SlcOT0erFc6L6V7B4j /nlw== 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=iN59ZpIpOfCPTZHbjVi/+CzsjHYN4fZToIyI6sPAtRM=; b=AptAcLvNbhTRinYBf+m4DFLGaCMNSzqWd2CLuuU84xD17rXDIUsQVedqQHu9BwEUe9 ntYf8i7YXLZuBXhjaHmfkHsIBrNZifJW+rPbuP2cJ4JcUdIjRyekIYIb7UwCbpcH4CdT FaQqMsPvx3kdeB+FuQyqbpki+DlQLRjws4MOuMMAvXh6DlNvVIV4Od5dc4JmuZmNuj8o wWOUFsBbTlW8NTa+l9LyJZFIrUpBih/IuLTKx56++EUREIr2oj3wdAw5clEb3+Q8KsLY v7LK9Qf6IqTB5lOhEhTQeKuH8En7y+awF6CqeFgUAVCtDlMdwz6iehIc7gHedPluPAiT k2og== 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 dk23si16563499edb.444.2021.08.30.18.46.52; Mon, 30 Aug 2021 18:46:53 -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; 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 0537968A497; Tue, 31 Aug 2021 04:46:07 +0300 (EEST) 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 4897868A2CE for ; Tue, 31 Aug 2021 04:45:59 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10092"; a="216531729" X-IronPort-AV: E=Sophos;i="5.84,365,1620716400"; d="scan'208";a="216531729" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 18:45:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,365,1620716400"; d="scan'208";a="530827068" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.5]) by FMSMGA003.fm.intel.com with ESMTP; 30 Aug 2021 18:45:49 -0700 From: wenbin.chen@intel.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 09:43:34 +0800 Message-Id: <20210831014338.134086-6-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210831014338.134086-1-wenbin.chen@intel.com> References: <20210831014338.134086-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/10] 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: "Chen,Wenbin" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dtVTpTZyKvpW From: "Chen,Wenbin" 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 9a29267aed..6417f59d4a 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -211,6 +211,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; @@ -1321,6 +1324,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; @@ -1443,8 +1451,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;