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 52F5C429F5 for ; Mon, 10 Jan 2022 21:16:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7FDF668AB82; Mon, 10 Jan 2022 23:16:35 +0200 (EET) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32BF3680814 for ; Mon, 10 Jan 2022 23:16:29 +0200 (EET) Received: by mail-wr1-f50.google.com with SMTP id k30so11641288wrd.9 for ; Mon, 10 Jan 2022 13:16:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=O3rraldZnayAkRMxG+zjdSu0y0PhKARJ5Ex0iRtWZJw=; b=AUFOHHZR148lYdSwAE+tzGIBZz4SY2yl7EcLibkjwm1n0Lk5nDLL4MVLUYV39N2Vta mqVP4MCZabWE8x+rUW83xXVLgEXWLqNLbCQld0+WX5/ECEBZnqOFwxNbBEQdHL5O6dv+ 952ZHED4IzI08E3tI9j1MBL38Et6S7xt7zIrCAg/1NxrG+mQ6EuKXGkwFXIJFkqhRG+2 w/mc9Og1AfP9FeDJbKUBBR7Xe7qiGR1XJ6bOXaFRG9B4/roK9zbhKfvtkB8lGoPzsMF0 mLFmCf84T6MWuvmB8NT61zUilCs/4uBe1BZeZVwWf8SDWulgfPPacfM84GT4zxY7eXGN 90Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=O3rraldZnayAkRMxG+zjdSu0y0PhKARJ5Ex0iRtWZJw=; b=WxWv/kxkX/85eqA8/+gUEZqtb6RBOfRff5yOXem/iUuAoYldX/I7yOK6cBXVMpRXxp 02z4KNIWkMZHOF/PX26G0abv9UWwqf0wKLM/kDH34t1FyhZNq0PN7jX2gZTVHrOXxQ/8 xAiro3FkV4u6BEIDu3hx/bM9Ilg65gc3J1rJHVp88ixt8rslBy5+jPpUkzAg15E+oqt7 V2NIqbH1qZxNWerpGj22MY6i9KbxDqyqt1LH+d5Q1jRT6w7PRxVENhqARS/0Nrr1cllE 7Pw6hGWWnWklJsPScSh47507ftGlfaPzQB0AeYmx8DudlZiSYETQuDwnSETR43rfyNvt 4vVA== X-Gm-Message-State: AOAM530Zeht0h99E5aSzQ/tjJPkmGDY1tZJxwu6eLIUkKv5K4YC4MtUI uqtViSQSJqES3qESV34djzhvorBVeCVujQK3 X-Google-Smtp-Source: ABdhPJztA199KSA0sfNC2S8wXgpyBLfhT0ExMb++LzjlDY8qFSQ7wToJdrQikdboEWyGHyp5u3x4Vg== X-Received: by 2002:a5d:5282:: with SMTP id c2mr1205613wrv.580.1641849387608; Mon, 10 Jan 2022 13:16:27 -0800 (PST) Received: from [192.168.0.11] (cpc91222-cmbg18-2-0-cust46.5-4.cable.virginm.net. [81.106.30.47]) by smtp.gmail.com with ESMTPSA id s10sm1788wmr.30.2022.01.10.13.16.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jan 2022 13:16:27 -0800 (PST) Message-ID: <8c4d65af-49c3-d594-75a9-b78bfc80792d@jkqxz.net> Date: Mon, 10 Jan 2022 21:16:26 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <163795393240.7822.9483345286843818669@lain.red.khirnov.net> <50841f8a73c902d3fca896b1eda923d082b27383.camel@intel.com> <6c1f517dad96d2d6075cb69a30e1a50aefd3feb9.camel@intel.com> <1379ae9c-d8f9-7e32-260f-eff79ac1cfd7@gmail.com> <6cc00dffb915619af857283b9fb503e7aaeeb603.camel@intel.com> <595cea3f-43d1-e1fb-8541-c620cfd47090@jkqxz.net> <97ce0944-17bc-6e89-160a-e103b77db861@jkqxz.net> From: Mark Thompson In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 10/01/2022 06:47, Xiang, Haihao wrote: > > Hi Mark, > > We want to provide a more user friendly command-line to share gfx memory between > QSV, VAAPI and other HW methods. > > E.g. VAAPI provides sharpness_vaapi but QSV doesn't provide a corresponding > filter, we want to use sharpness_vaapi filter on the output from QSV decoders. > Currently the first command-line below may work, however the second command line > below can't work because QSV device is not derived from a VAAPI device > explicitly, so ffmpeg fails to derive VAAPI device from QSV device (it may > derive VAAPI device from QSV device in the first case) > > $ ffmpeg -init_hw_device vaapi=intel -init_hw_device qsv=qsv@intel -hwaccel qsv > -c:v h264_qsv -i input.mp4 -vf hwmap=derive_device=vaapi,sharpness_vaapi -f null > - With explicit device selection: $ ffmpeg -init_hw_device vaapi=intel -init_hw_device qsv=qsv@intel -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwmap{intel},sharpness_vaapi -f null - (Exact syntax unknown, but I was intending something like that.) > > $ ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf > hwmap=derive_device=vaapi,sharpness_vaapi -f null - This is really wanting the reverse case of device derivation. I guess this does want the libmfx hwcontext to always have the source device there, as suggested above. > After applying Softworks' patch, the above two command-lines may work well. In > addition, we may use other HW methods on QSV output without copy for gfx memory, > e.g. > > $ ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf > "hwmap=derive_device=vaapi,format=vaapi,hwmap=derive_device=vulkan,scale_vulkan= > w=1920:h=1080" -f null - So, we move the derivation out of the graph and get: $ ffmpeg -init_hw_device vaapi=vadev -init_hw_device qsv=qsvdev@vadev -init_hw_device vulkan=vkdev@vadev \ -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf "hwmap{vadev},format=vaapi,hwmap{vkdev},scale_vulkan=w=1920:h=1080" -f null - (Maybe it would help to have some shorter options for making devices like the first line there, because making a set derived in the right sequence is probably quite a common operation. If ffmpeg knows the possible-derivations this wouldn't be hard to make.) Making it all explicit also lets multiple physical devices work together straightforwardly, as Intel seems likely to want to support in the not-too-distant future. - Mark _______________________________________________ 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".