Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface
@ 2022-01-11  6:55 Wenbin Chen
  2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenbin Chen @ 2022-01-11  6:55 UTC (permalink / raw)
  To: ffmpeg-devel

For vaapi if the init_pool_size is not zero, the pool size is fixed.
This means max surfaces is init_pool_size, but when mapping vaapi
frame to qsv frame, the init_pool_size < nb_surface. The cause is that
vaapi_decode_make_config() config the init_pool_size and it is called
twice. The first time is to init frame_context and the second time is to
init codec. On the second time the init_pool_size is changed to original
value so the init_pool_size is lower than the reall size because
pool_size used to initialize frame_context need to plus thread_count and
3 (guarantee 4 base work surfaces). Now add code to make sure
init_pool_size is only set once. Now the following commandline works:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi -i input.264 \
-vf "hwmap=derive_device=qsv,format=qsv" \
-c:v h264_qsv output.264

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavcodec/vaapi_decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 665af370ed..da0e72b10b 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -650,7 +650,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
     ctx->hwctx  = ctx->device->hwctx;
 
     err = vaapi_decode_make_config(avctx, ctx->frames->device_ref,
-                                   &ctx->va_config, avctx->hw_frames_ctx);
+                                   &ctx->va_config, NULL);
     if (err)
         goto fail;
 
-- 
2.25.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
  2022-01-11  6:55 [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Wenbin Chen
@ 2022-01-11  6:55 ` Wenbin Chen
  2022-01-20  7:21   ` Chen, Wenbin
  2022-01-27  5:35   ` Xiang, Haihao
  2022-01-20  7:21 ` [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Chen, Wenbin
  2022-01-26  3:07 ` Xiang, Haihao
  2 siblings, 2 replies; 6+ messages in thread
From: Wenbin Chen @ 2022-01-11  6:55 UTC (permalink / raw)
  To: ffmpeg-devel

From: nyanmisaka <nst799610810@gmail.com>

mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
Now the following commandline works:

ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
-init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl \
-hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
-i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
-c:v h264_qsv output.264

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavutil/hwcontext_opencl.c | 14 +++++++++++++-
 libavutil/hwcontext_qsv.c    | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 26a3a24593..4e2ab18ede 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -72,6 +72,12 @@
 #include "hwcontext_drm.h"
 #endif
 
+#if HAVE_OPENCL_VAAPI_INTEL_MEDIA && CONFIG_LIBMFX
+extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
+                                          enum AVHWDeviceType base_dev_typ,
+                                          void **base_handle);
+#endif
+
 
 typedef struct OpenCLDeviceContext {
     // Default command queue to use for transfer/mapping operations on
@@ -2248,8 +2254,14 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst,
 
 #if CONFIG_LIBMFX
     if (src->format == AV_PIX_FMT_QSV) {
+        void *base_handle;
         mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
-        va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
+        err = ff_qsv_get_surface_base_handle(mfx_surface,
+                                             AV_HWDEVICE_TYPE_VAAPI,
+                                             &base_handle);
+        if (err < 0)
+            return err;
+        va_surface = *(VASurfaceID *)base_handle;
     } else
 #endif
         if (src->format == AV_PIX_FMT_VAAPI) {
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 853fb7f60d..6d9b8324c2 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -112,6 +112,40 @@ static const struct {
 #endif
 };
 
+extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
+                                          enum AVHWDeviceType base_dev_type,
+                                          void **base_handle);
+
+/**
+ * Caller needs to allocate enough space for base_handle pointer.
+ **/
+int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
+                                   enum AVHWDeviceType base_dev_type,
+                                   void **base_handle)
+{
+    mfxHDLPair *handle_pair;
+    handle_pair = surf->Data.MemId;
+    switch (base_dev_type) {
+#if CONFIG_VAAPI
+    case AV_HWDEVICE_TYPE_VAAPI:
+        base_handle[0] = handle_pair->first;
+        return 0;
+#endif
+#if CONFIG_D3D11VA
+    case AV_HWDEVICE_TYPE_D3D11VA:
+        base_handle[0] = handle_pair->first;
+        base_handle[1] = handle_pair->secode;
+        return 0;
+#endif
+#if CONFIG_DXVA2
+    case AV_HWDEVICE_TYPE_DXVA2:
+        base_handle[0] = handle_pair->first;
+        return 0;
+#endif
+    }
+    return AVERROR(EINVAL);
+}
+
 static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
 {
     int i;
-- 
2.25.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
  2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
@ 2022-01-20  7:21   ` Chen, Wenbin
  2022-01-27  5:35   ` Xiang, Haihao
  1 sibling, 0 replies; 6+ messages in thread
From: Chen, Wenbin @ 2022-01-20  7:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> From: nyanmisaka <nst799610810@gmail.com>
> 
> mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
> Now the following commandline works:
> 
> ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
> -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -
> filter_hw_device ocl \
> -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv
> \
> -i input.264 -vf
> "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
> hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: nyanmisaka <nst799610810@gmail.com>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavutil/hwcontext_opencl.c | 14 +++++++++++++-
>  libavutil/hwcontext_qsv.c    | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index 26a3a24593..4e2ab18ede 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -72,6 +72,12 @@
>  #include "hwcontext_drm.h"
>  #endif
> 
> +#if HAVE_OPENCL_VAAPI_INTEL_MEDIA && CONFIG_LIBMFX
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                          enum AVHWDeviceType base_dev_typ,
> +                                          void **base_handle);
> +#endif
> +
> 
>  typedef struct OpenCLDeviceContext {
>      // Default command queue to use for transfer/mapping operations on
> @@ -2248,8 +2254,14 @@ static int
> opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst,
> 
>  #if CONFIG_LIBMFX
>      if (src->format == AV_PIX_FMT_QSV) {
> +        void *base_handle;
>          mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
> -        va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
> +        err = ff_qsv_get_surface_base_handle(mfx_surface,
> +                                             AV_HWDEVICE_TYPE_VAAPI,
> +                                             &base_handle);
> +        if (err < 0)
> +            return err;
> +        va_surface = *(VASurfaceID *)base_handle;
>      } else
>  #endif
>          if (src->format == AV_PIX_FMT_VAAPI) {
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 853fb7f60d..6d9b8324c2 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -112,6 +112,40 @@ static const struct {
>  #endif
>  };
> 
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                          enum AVHWDeviceType base_dev_type,
> +                                          void **base_handle);
> +
> +/**
> + * Caller needs to allocate enough space for base_handle pointer.
> + **/
> +int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                   enum AVHWDeviceType base_dev_type,
> +                                   void **base_handle)
> +{
> +    mfxHDLPair *handle_pair;
> +    handle_pair = surf->Data.MemId;
> +    switch (base_dev_type) {
> +#if CONFIG_VAAPI
> +    case AV_HWDEVICE_TYPE_VAAPI:
> +        base_handle[0] = handle_pair->first;
> +        return 0;
> +#endif
> +#if CONFIG_D3D11VA
> +    case AV_HWDEVICE_TYPE_D3D11VA:
> +        base_handle[0] = handle_pair->first;
> +        base_handle[1] = handle_pair->secode;
> +        return 0;
> +#endif
> +#if CONFIG_DXVA2
> +    case AV_HWDEVICE_TYPE_DXVA2:
> +        base_handle[0] = handle_pair->first;
> +        return 0;
> +#endif
> +    }
> +    return AVERROR(EINVAL);
> +}
> +
>  static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
>  {
>      int i;
> --
> 2.25.1
> 

ping

> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface
  2022-01-11  6:55 [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Wenbin Chen
  2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
@ 2022-01-20  7:21 ` Chen, Wenbin
  2022-01-26  3:07 ` Xiang, Haihao
  2 siblings, 0 replies; 6+ messages in thread
From: Chen, Wenbin @ 2022-01-20  7:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> For vaapi if the init_pool_size is not zero, the pool size is fixed.
> This means max surfaces is init_pool_size, but when mapping vaapi
> frame to qsv frame, the init_pool_size < nb_surface. The cause is that
> vaapi_decode_make_config() config the init_pool_size and it is called
> twice. The first time is to init frame_context and the second time is to
> init codec. On the second time the init_pool_size is changed to original
> value so the init_pool_size is lower than the reall size because
> pool_size used to initialize frame_context need to plus thread_count and
> 3 (guarantee 4 base work surfaces). Now add code to make sure
> init_pool_size is only set once. Now the following commandline works:
> 
> ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
> -hwaccel_output_format vaapi -i input.264 \
> -vf "hwmap=derive_device=qsv,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavcodec/vaapi_decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 665af370ed..da0e72b10b 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -650,7 +650,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
>      ctx->hwctx  = ctx->device->hwctx;
> 
>      err = vaapi_decode_make_config(avctx, ctx->frames->device_ref,
> -                                   &ctx->va_config, avctx->hw_frames_ctx);
> +                                   &ctx->va_config, NULL);
>      if (err)
>          goto fail;
> 
> --
> 2.25.1
> 

ping

> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface
  2022-01-11  6:55 [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Wenbin Chen
  2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
  2022-01-20  7:21 ` [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Chen, Wenbin
@ 2022-01-26  3:07 ` Xiang, Haihao
  2 siblings, 0 replies; 6+ messages in thread
From: Xiang, Haihao @ 2022-01-26  3:07 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, 2022-01-11 at 14:55 +0800, Wenbin Chen wrote:
> For vaapi if the init_pool_size is not zero, the pool size is fixed.
> This means max surfaces is init_pool_size, but when mapping vaapi
> frame to qsv frame, the init_pool_size < nb_surface. The cause is that
> vaapi_decode_make_config() config the init_pool_size and it is called
> twice. The first time is to init frame_context and the second time is to
> init codec. On the second time the init_pool_size is changed to original
> value so the init_pool_size is lower than the reall size because
> pool_size used to initialize frame_context need to plus thread_count and
> 3 (guarantee 4 base work surfaces). Now add code to make sure
> init_pool_size is only set once. Now the following commandline works:
> 
> ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
> -hwaccel_output_format vaapi -i input.264 \
> -vf "hwmap=derive_device=qsv,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavcodec/vaapi_decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 665af370ed..da0e72b10b 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -650,7 +650,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
>      ctx->hwctx  = ctx->device->hwctx;
>  
>      err = vaapi_decode_make_config(avctx, ctx->frames->device_ref,
> -                                   &ctx->va_config, avctx->hw_frames_ctx);
> +                                   &ctx->va_config, NULL);
>      if (err)
>          goto fail;
>  

LGTM, and the command works well for me now. 

Will aplly

Thanks
Haihao

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
  2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
  2022-01-20  7:21   ` Chen, Wenbin
@ 2022-01-27  5:35   ` Xiang, Haihao
  1 sibling, 0 replies; 6+ messages in thread
From: Xiang, Haihao @ 2022-01-27  5:35 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, 2022-01-11 at 14:55 +0800, Wenbin Chen wrote:
> From: nyanmisaka <nst799610810@gmail.com>
> 
> mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
> Now the following commandline works:
> 
> ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
> -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl
> \
> -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
> -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
> hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: nyanmisaka <nst799610810@gmail.com>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavutil/hwcontext_opencl.c | 14 +++++++++++++-
>  libavutil/hwcontext_qsv.c    | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index 26a3a24593..4e2ab18ede 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -72,6 +72,12 @@
>  #include "hwcontext_drm.h"
>  #endif
>  
> +#if HAVE_OPENCL_VAAPI_INTEL_MEDIA && CONFIG_LIBMFX
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                          enum AVHWDeviceType base_dev_typ,
> +                                          void **base_handle);
> +#endif
> +
>  
>  typedef struct OpenCLDeviceContext {
>      // Default command queue to use for transfer/mapping operations on
> @@ -2248,8 +2254,14 @@ static int opencl_map_from_qsv(AVHWFramesContext
> *dst_fc, AVFrame *dst,
>  
>  #if CONFIG_LIBMFX
>      if (src->format == AV_PIX_FMT_QSV) {
> +        void *base_handle;
>          mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
> -        va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
> +        err = ff_qsv_get_surface_base_handle(mfx_surface,
> +                                             AV_HWDEVICE_TYPE_VAAPI,
> +                                             &base_handle);
> +        if (err < 0)
> +            return err;
> +        va_surface = *(VASurfaceID *)base_handle;
>      } else
>  #endif
>          if (src->format == AV_PIX_FMT_VAAPI) {
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 853fb7f60d..6d9b8324c2 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -112,6 +112,40 @@ static const struct {
>  #endif
>  };
>  
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                          enum AVHWDeviceType base_dev_type,
> +                                          void **base_handle);
> +
> +/**
> + * Caller needs to allocate enough space for base_handle pointer.
> + **/
> +int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +                                   enum AVHWDeviceType base_dev_type,
> +                                   void **base_handle)
> +{
> +    mfxHDLPair *handle_pair;
> +    handle_pair = surf->Data.MemId;
> +    switch (base_dev_type) {
> +#if CONFIG_VAAPI
> +    case AV_HWDEVICE_TYPE_VAAPI:
> +        base_handle[0] = handle_pair->first;
> +        return 0;
> +#endif
> +#if CONFIG_D3D11VA
> +    case AV_HWDEVICE_TYPE_D3D11VA:
> +        base_handle[0] = handle_pair->first;
> +        base_handle[1] = handle_pair->secode;
> +        return 0;
> +#endif
> +#if CONFIG_DXVA2
> +    case AV_HWDEVICE_TYPE_DXVA2:
> +        base_handle[0] = handle_pair->first;
> +        return 0;
> +#endif
> +    }
> +    return AVERROR(EINVAL);
> +}
> +
>  static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
>  {
>      int i;

LGTM, will apply

-Haihao

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-27  5:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  6:55 [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Wenbin Chen
2022-01-11  6:55 ` [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Wenbin Chen
2022-01-20  7:21   ` Chen, Wenbin
2022-01-27  5:35   ` Xiang, Haihao
2022-01-20  7:21 ` [FFmpeg-devel] [PATCH V5 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface Chen, Wenbin
2022-01-26  3:07 ` Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git