diff mbox series

[FFmpeg-devel,v2,1/4] fftools/qsv: enabling d3d11va/dxva2 device selection

Message ID 20200415130741.27263-1-artem.galin@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v2,1/4] fftools/qsv: enabling d3d11va/dxva2 device selection | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

galinart April 15, 2020, 1:07 p.m. UTC
From: Artem Galin <artem.galin@intel.com>

child_device_type argument is responsible for selection.

Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
                -init_hw_device qsv:hw,child_device_type=dxva2

Signed-off-by: Artem Galin <artem.galin@intel.com>
---
 fftools/ffmpeg_opt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Steve Lhomme April 21, 2020, 10:25 a.m. UTC | #1
Hi,

On 2020-04-15 15:07, artem.galin@gmail.com wrote:
> From: Artem Galin <artem.galin@intel.com>
> 
> child_device_type argument is responsible for selection.
> 
> Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
>                  -init_hw_device qsv:hw,child_device_type=dxva2
> 
> Signed-off-by: Artem Galin <artem.galin@intel.com>
> ---
>   fftools/ffmpeg_opt.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 95001a963f..82232c60b3 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -568,7 +568,17 @@ static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
>           printf("\n");
>           exit_program(0);
>       } else {
> -        return hw_device_init_from_string(arg, NULL);
> +        HWDevice *dev;
> +        int err;
> +        if (!arg)
> +            return AVERROR(ENOMEM);
> +        err = hw_device_init_from_string(arg, &dev);
> +        if (err < 0)
> +            return err;
> +        hw_device_ctx = av_buffer_ref(dev->device_ref);
> +        if (!hw_device_ctx)
> +            return AVERROR(ENOMEM);
> +        return 0;

This is very similar to what is done in opt_vaapi_device().

Maybe you could modify the "qsv_device" handling to support this ? It 
will be ifdef'ed out when QSV is not enabled.

There might also be some side effects for other hardware devices. 
Especially the hw_device_ctx reference doesn't seem to be released (but 
it's the same in opt_vaapi_device so I might be missing something).

>       }
>   }
>   
> -- 
> 2.26.0
> 
> _______________________________________________
> 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".
>
galinart April 22, 2020, 2:39 p.m. UTC | #2
Hi Steve,

On Tue, 21 Apr 2020 at 11:25, Steve Lhomme <robux4@ycbcr.xyz> wrote:

> Hi,
>
> On 2020-04-15 15:07, artem.galin@gmail.com wrote:
> > From: Artem Galin <artem.galin@intel.com>
> >
> > child_device_type argument is responsible for selection.
> >
> > Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
> >                  -init_hw_device qsv:hw,child_device_type=dxva2
> >
> > Signed-off-by: Artem Galin <artem.galin@intel.com>
> > ---
> >   fftools/ffmpeg_opt.c | 12 +++++++++++-
> >   1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> > index 95001a963f..82232c60b3 100644
> > --- a/fftools/ffmpeg_opt.c
> > +++ b/fftools/ffmpeg_opt.c
> > @@ -568,7 +568,17 @@ static int opt_init_hw_device(void *optctx, const
> char *opt, const char *arg)
> >           printf("\n");
> >           exit_program(0);
> >       } else {
> > -        return hw_device_init_from_string(arg, NULL);
> > +        HWDevice *dev;
> > +        int err;
> > +        if (!arg)
> > +            return AVERROR(ENOMEM);
> > +        err = hw_device_init_from_string(arg, &dev);
> > +        if (err < 0)
> > +            return err;
> > +        hw_device_ctx = av_buffer_ref(dev->device_ref);
> > +        if (!hw_device_ctx)
> > +            return AVERROR(ENOMEM);
> > +        return 0;
>
> This is very similar to what is done in opt_vaapi_device().
>
> Maybe you could modify the "qsv_device" handling to support this ? It
> will be ifdef'ed out when QSV is not enabled.
>
> There might also be some side effects for other hardware devices.
> Especially the hw_device_ctx reference doesn't seem to be released (but
> it's the same in opt_vaapi_device so I might be missing something).
>
>
This has been intentionally done to match VAAPI behavior and suggested by
Mark Thompson
Please see discussion by link below:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200123151813.31739-1-artem.galin@gmail.com/


> >       }
> >   }
> >
> > --
> > 2.26.0
> >
> > _______________________________________________
> > 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".
> >
> _______________________________________________
> 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".
galinart April 24, 2020, 3:46 p.m. UTC | #3
Hi Steve,

The updated review is available by link
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1017

Thanks,
Artem.

On Wed, 22 Apr 2020 at 15:39, Artem Galin <artem.galin@gmail.com> wrote:

> Hi Steve,
>
> On Tue, 21 Apr 2020 at 11:25, Steve Lhomme <robux4@ycbcr.xyz> wrote:
>
>> Hi,
>>
>> On 2020-04-15 15:07, artem.galin@gmail.com wrote:
>> > From: Artem Galin <artem.galin@intel.com>
>> >
>> > child_device_type argument is responsible for selection.
>> >
>> > Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
>> >                  -init_hw_device qsv:hw,child_device_type=dxva2
>> >
>> > Signed-off-by: Artem Galin <artem.galin@intel.com>
>> > ---
>> >   fftools/ffmpeg_opt.c | 12 +++++++++++-
>> >   1 file changed, 11 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
>> > index 95001a963f..82232c60b3 100644
>> > --- a/fftools/ffmpeg_opt.c
>> > +++ b/fftools/ffmpeg_opt.c
>> > @@ -568,7 +568,17 @@ static int opt_init_hw_device(void *optctx, const
>> char *opt, const char *arg)
>> >           printf("\n");
>> >           exit_program(0);
>> >       } else {
>> > -        return hw_device_init_from_string(arg, NULL);
>> > +        HWDevice *dev;
>> > +        int err;
>> > +        if (!arg)
>> > +            return AVERROR(ENOMEM);
>> > +        err = hw_device_init_from_string(arg, &dev);
>> > +        if (err < 0)
>> > +            return err;
>> > +        hw_device_ctx = av_buffer_ref(dev->device_ref);
>> > +        if (!hw_device_ctx)
>> > +            return AVERROR(ENOMEM);
>> > +        return 0;
>>
>> This is very similar to what is done in opt_vaapi_device().
>>
>> Maybe you could modify the "qsv_device" handling to support this ? It
>> will be ifdef'ed out when QSV is not enabled.
>>
>> There might also be some side effects for other hardware devices.
>> Especially the hw_device_ctx reference doesn't seem to be released (but
>> it's the same in opt_vaapi_device so I might be missing something).
>>
>>
> This has been intentionally done to match VAAPI behavior and suggested by
> Mark Thompson
> Please see discussion by link below:
>
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200123151813.31739-1-artem.galin@gmail.com/
>
>
>> >       }
>> >   }
>> >
>> > --
>> > 2.26.0
>> >
>> > _______________________________________________
>> > 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".
>> >
>> _______________________________________________
>> 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".
>
>
diff mbox series

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 95001a963f..82232c60b3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -568,7 +568,17 @@  static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
         printf("\n");
         exit_program(0);
     } else {
-        return hw_device_init_from_string(arg, NULL);
+        HWDevice *dev;
+        int err;
+        if (!arg)
+            return AVERROR(ENOMEM);
+        err = hw_device_init_from_string(arg, &dev);
+        if (err < 0)
+            return err;
+        hw_device_ctx = av_buffer_ref(dev->device_ref);
+        if (!hw_device_ctx)
+            return AVERROR(ENOMEM);
+        return 0;
     }
 }