[FFmpeg-devel] [PATCH 1/2] qsvdec: add support for HW_DEVICE_CTX method

Xiang, Haihao haihao.xiang at intel.com
Thu Jun 24 04:33:53 EEST 2021


On Wed, 2021-06-23 at 16:41 +0000, Soft Works wrote:
> 
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Haihao Xiang
> Sent: Mittwoch, 23. Juni 2021 05:04
> To: ffmpeg-devel at ffmpeg.org
> Cc: Haihao Xiang <haihao.xiang at intel.com>
> Subject: [FFmpeg-devel] [PATCH 1/2] qsvdec: add support for HW_DEVICE_CTX
> method
> 
> This allows user set hw_device_ctx instead of hw_frames_ctx for QSV decoders,
> hence we may remove the ad-hoc libmfx setup code from FFmpeg.
> 
> "-hwaccel_output_format format" is applied to QSV decoders after removing the
> ad-hoc libmfx code. In order to keep compatibility with old commandlines, the
> default format is set to AV_PIX_FMT_QSV, but this behavior will be removed in
> the future. Please set "-hwaccel_output_format qsv"
> explicitly if AV_PIX_FMT_QSV is expected.
> 
> The normal device stuff works for QSV decoders now, user may use "-
> init_hw_device args" to initialise device and "-hwaccel_device devicename" to
> select a device for QSV decoders. "-qsv_device device"
> which was added for workarounding device selection in the ad-hoc libmfx code
> is deprecated and will be removed from FFmpeg.
> 
> For example:
> 
> $> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device qsv=hw at va
> -hwaccel qsv -c:v h264_qsv -i input.h264 -f null -
> 
> /dev/dri/renderD128 is actually open for h264_qsv decoder in the above command
> without this patch. After applying this patch, /dev/dri/card0 is used.
> 
> $> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device qsv=hw at va
> -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264 -f null -
> 
> device hw of type qsv is not usable in the above command without this patch.
> After applying this patch, this command works as expected.
> ---
> 
> Haihao,
> 
> I think, from all the not-yet-merged QSV patches, this is the most important
> one.
> I'll try to find some time to review shortly.

Thanks for helping to review this patch, and any comment is welcome. 

> 
> Is this patch independent of your other submitted patches?

Yes, this patch is independent of other patches and you may apply it to the
latest master branch directly. 

BTW the fix in 
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276695.html is no longer
needed after applying this patch. The command  works for me if using
-init_hw_device qsv=qsv at intel to create the connection between vaapi and QSVdevices. 

Regards
Haihao

> 
> softworkz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list