diff mbox series

[FFmpeg-devel,v2] lavfi: add hwdevice flag to hwupload/hwmap

Message ID 20230324161458.819260-1-ullysses.a.eoff@intel.com
State Accepted
Commit 9bf1848acfb7cbdb7f8dcaa07649467dfb3cec7b
Headers show
Series [FFmpeg-devel,v2] lavfi: add hwdevice flag to hwupload/hwmap | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Eoff, Ullysses A March 24, 2023, 4:14 p.m. UTC
This fixes a regression introduced by:

  commit 3f63685c3554aea7f72bab1fdbde440820816d37
   and
  commit 632c34993195f716e9fa575af3de80d07fd50991

...where command-lines like:

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt yuv420p \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12,hwupload=extra_hw_frames=120' \
  -an -c:v h264_qsv -y output.h264

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt nv12 \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12|qsv,hwupload=extra_hw_frames=16,vpp_qsv=procamp=1:saturation=1.0,hwdownload,format=nv12' \
  -pix_fmt nv12 -f rawvideo -fps_mode passthrough -an -y output.yuv

...produced errors like:

[hwupload @ 0x55b6171d0dc0] A hardware device reference is required to upload frames to.
[Parsed_hwupload_1 @ 0x55b6172053c0] Query format failed for 'Parsed_hwupload_1': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
---
 libavfilter/vf_hwmap.c    | 1 +
 libavfilter/vf_hwupload.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Dennis Mungai March 25, 2023, 12:32 a.m. UTC | #1
On Fri, 24 Mar 2023 at 19:15, U. Artie Eoff <
ullysses.a.eoff-at-intel.com@ffmpeg.org> wrote:

> This fixes a regression introduced by:
>
>   commit 3f63685c3554aea7f72bab1fdbde440820816d37
>    and
>   commit 632c34993195f716e9fa575af3de80d07fd50991
>
> ...where command-lines like:
>
> ffmpeg -v verbose -hwaccel qsv \
>   -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
>   -hwaccel_output_format qsv -f rawvideo -pix_fmt yuv420p \
>   -s:v 352x288 -r:v 25 -i input.yuv \
>   -vf 'format=nv12,hwupload=extra_hw_frames=120' \
>   -an -c:v h264_qsv -y output.h264
>
> ffmpeg -v verbose -hwaccel qsv \
>   -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
>   -hwaccel_output_format qsv -f rawvideo -pix_fmt nv12 \
>   -s:v 352x288 -r:v 25 -i input.yuv \
>   -vf
> 'format=nv12|qsv,hwupload=extra_hw_frames=16,vpp_qsv=procamp=1:saturation=1.0,hwdownload,format=nv12'
> \
>   -pix_fmt nv12 -f rawvideo -fps_mode passthrough -an -y output.yuv
>
> ...produced errors like:
>
> [hwupload @ 0x55b6171d0dc0] A hardware device reference is required to
> upload frames to.
> [Parsed_hwupload_1 @ 0x55b6172053c0] Query format failed for
> 'Parsed_hwupload_1': Invalid argument
> Error reinitializing filters!
> Failed to inject frame into filter network: Invalid argument
>
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
> ---
>  libavfilter/vf_hwmap.c    | 1 +
>  libavfilter/vf_hwupload.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/libavfilter/vf_hwmap.c b/libavfilter/vf_hwmap.c
> index 2e03dfc1fec7..e246b22603b5 100644
> --- a/libavfilter/vf_hwmap.c
> +++ b/libavfilter/vf_hwmap.c
> @@ -427,4 +427,5 @@ const AVFilter ff_vf_hwmap = {
>      FILTER_OUTPUTS(hwmap_outputs),
>      FILTER_QUERY_FUNC(hwmap_query_formats),
>      .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
> +    .flags          = AVFILTER_FLAG_HWDEVICE,
>  };
> diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
> index dbc41734ccc3..ef61bb413757 100644
> --- a/libavfilter/vf_hwupload.c
> +++ b/libavfilter/vf_hwupload.c
> @@ -258,4 +258,5 @@ const AVFilter ff_vf_hwupload = {
>      FILTER_OUTPUTS(hwupload_outputs),
>      FILTER_QUERY_FUNC(hwupload_query_formats),
>      .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
> +    .flags          = AVFILTER_FLAG_HWDEVICE,
>  };
> --
> 2.38.1
>
>
>
Related,

The two mentioned commits above also broke hwupload use with CUDA.
Xiang, Haihao March 27, 2023, 4:37 a.m. UTC | #2
On Vr, 2023-03-24 at 12:14 -0400, U. Artie Eoff wrote:
> This fixes a regression introduced by:
> 
>   commit 3f63685c3554aea7f72bab1fdbde440820816d37
>    and
>   commit 632c34993195f716e9fa575af3de80d07fd50991
> 
> ...where command-lines like:
> 
> ffmpeg -v verbose -hwaccel qsv \
>   -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
>   -hwaccel_output_format qsv -f rawvideo -pix_fmt yuv420p \
>   -s:v 352x288 -r:v 25 -i input.yuv \
>   -vf 'format=nv12,hwupload=extra_hw_frames=120' \
>   -an -c:v h264_qsv -y output.h264
> 
> ffmpeg -v verbose -hwaccel qsv \
>   -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
>   -hwaccel_output_format qsv -f rawvideo -pix_fmt nv12 \
>   -s:v 352x288 -r:v 25 -i input.yuv \
>   -vf
> 'format=nv12|qsv,hwupload=extra_hw_frames=16,vpp_qsv=procamp=1:saturation=1.0,
> hwdownload,format=nv12' \
>   -pix_fmt nv12 -f rawvideo -fps_mode passthrough -an -y output.yuv
> 
> ...produced errors like:
> 
> [hwupload @ 0x55b6171d0dc0] A hardware device reference is required to upload
> frames to.
> [Parsed_hwupload_1 @ 0x55b6172053c0] Query format failed for
> 'Parsed_hwupload_1': Invalid argument
> Error reinitializing filters!
> Failed to inject frame into filter network: Invalid argument
> 
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
> ---
>  libavfilter/vf_hwmap.c    | 1 +
>  libavfilter/vf_hwupload.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/libavfilter/vf_hwmap.c b/libavfilter/vf_hwmap.c
> index 2e03dfc1fec7..e246b22603b5 100644
> --- a/libavfilter/vf_hwmap.c
> +++ b/libavfilter/vf_hwmap.c
> @@ -427,4 +427,5 @@ const AVFilter ff_vf_hwmap = {
>      FILTER_OUTPUTS(hwmap_outputs),
>      FILTER_QUERY_FUNC(hwmap_query_formats),
>      .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
> +    .flags          = AVFILTER_FLAG_HWDEVICE,
>  };
> diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
> index dbc41734ccc3..ef61bb413757 100644
> --- a/libavfilter/vf_hwupload.c
> +++ b/libavfilter/vf_hwupload.c
> @@ -258,4 +258,5 @@ const AVFilter ff_vf_hwupload = {
>      FILTER_OUTPUTS(hwupload_outputs),
>      FILTER_QUERY_FUNC(hwupload_query_formats),
>      .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
> +    .flags          = AVFILTER_FLAG_HWDEVICE,
>  };

LGTM

- Haihao
diff mbox series

Patch

diff --git a/libavfilter/vf_hwmap.c b/libavfilter/vf_hwmap.c
index 2e03dfc1fec7..e246b22603b5 100644
--- a/libavfilter/vf_hwmap.c
+++ b/libavfilter/vf_hwmap.c
@@ -427,4 +427,5 @@  const AVFilter ff_vf_hwmap = {
     FILTER_OUTPUTS(hwmap_outputs),
     FILTER_QUERY_FUNC(hwmap_query_formats),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
+    .flags          = AVFILTER_FLAG_HWDEVICE,
 };
diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index dbc41734ccc3..ef61bb413757 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -258,4 +258,5 @@  const AVFilter ff_vf_hwupload = {
     FILTER_OUTPUTS(hwupload_outputs),
     FILTER_QUERY_FUNC(hwupload_query_formats),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
+    .flags          = AVFILTER_FLAG_HWDEVICE,
 };