diff mbox series

[FFmpeg-devel,v3,3/3] Update QSV after adding support for VAAPI on Windows:

Message ID 20230412122741.474-3-sivileri@microsoft.com
State New
Headers show
Series [FFmpeg-devel,v3,1/3] Add support for VAAPI on Windows in hwcontext_vaapi using vaGetDisplayWin32. | expand

Checks

Context Check Description
andriy/commit_msg_x86 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
yinshiyou/commit_msg_loongarch64 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Sil Vilerino April 12, 2023, 12:27 p.m. UTC
- qsv_internal.h: Remove unnecessary include va_drm.h
- qsv_internal.h: Enable AVCODEC_QSV_LINUX_SESSION_HANDLE on Linux/VA only
- hwcontext_qsv.c: Do not allow child_device_type VAAPI for Windows until support is added, keep D3D11/DXVA2 as more prioritary defaults.

Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/
Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
---
 libavcodec/qsv_internal.h |  5 ++---
 libavutil/hwcontext_qsv.c | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

Comments

Hendrik Leppkes April 12, 2023, 4:18 p.m. UTC | #1
On Wed, Apr 12, 2023 at 2:28 PM Sil Vilerino
<sivileri-at-microsoft.com@ffmpeg.org> wrote:
>
> - qsv_internal.h: Remove unnecessary include va_drm.h
> - qsv_internal.h: Enable AVCODEC_QSV_LINUX_SESSION_HANDLE on Linux/VA only
> - hwcontext_qsv.c: Do not allow child_device_type VAAPI for Windows until support is added, keep D3D11/DXVA2 as more prioritary defaults.
>
> Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/
> Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
> Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
> ---
>  libavcodec/qsv_internal.h |  5 ++---
>  libavutil/hwcontext_qsv.c | 14 ++++++++++++--
>  2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
> index 5119ef4dff..df5e1e05ca 100644
> --- a/libavcodec/qsv_internal.h
> +++ b/libavcodec/qsv_internal.h
> @@ -23,9 +23,9 @@
>
>  #include "config.h"
>
> -#if CONFIG_VAAPI
> +#if CONFIG_VAAPI && !_WIN32 // Do not enable for libva-win32 on Windows

Shouldn't this be defined(_WIN32), same below?

>  #define AVCODEC_QSV_LINUX_SESSION_HANDLE
> -#endif //CONFIG_VAAPI
> +#endif //CONFIG_VAAPI && !_WIN32
>
>  #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
>  #include <stdio.h>
> @@ -35,7 +35,6 @@
>  #endif
>  #include <fcntl.h>
>  #include <va/va.h>
> -#include <va/va_drm.h>
>  #include "libavutil/hwcontext_vaapi.h"
>  #endif
>
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 6780428875..71212b177a 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -2126,8 +2126,6 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
>                     "\"%s\".\n", e->value);
>              return AVERROR(EINVAL);
>          }
> -    } else if (CONFIG_VAAPI) {
> -        child_device_type = AV_HWDEVICE_TYPE_VAAPI;
>  #if QSV_ONEVPL
>      } else if (CONFIG_D3D11VA) {  // Use D3D11 by default if d3d11va is enabled
>          av_log(ctx, AV_LOG_VERBOSE,
> @@ -2147,11 +2145,23 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
>      } else if (CONFIG_D3D11VA) {
>          child_device_type = AV_HWDEVICE_TYPE_D3D11VA;
>  #endif
> +    } else if (CONFIG_VAAPI) {
> +        child_device_type = AV_HWDEVICE_TYPE_VAAPI;
>      } else {
>          av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");
>          return AVERROR(ENOSYS);
>      }
>
> +#if CONFIG_VAAPI && _WIN32
> +    /* AV_HWDEVICE_TYPE_VAAPI on Windows/Libva-win32 not supported */
> +    /* Reject user specified child_device_type or CONFIG_VAAPI on Windows */
> +    if (child_device_type == AV_HWDEVICE_TYPE_VAAPI) {
> +        av_log(ctx, AV_LOG_ERROR, "VAAPI child device type not supported for oneVPL on Windows"
> +                "\"%s\".\n", e->value);
> +        return AVERROR(EINVAL);
> +    }
> +#endif
> +
>      child_device_opts = NULL;
>      switch (child_device_type) {
>  #if CONFIG_VAAPI
> --
> 2.39.2.vfs.0.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".
Neal Gompa April 12, 2023, 10:37 p.m. UTC | #2
On Wed, Apr 12, 2023 at 8:28 AM Sil Vilerino
<sivileri-at-microsoft.com@ffmpeg.org> wrote:
>
> - qsv_internal.h: Remove unnecessary include va_drm.h
> - qsv_internal.h: Enable AVCODEC_QSV_LINUX_SESSION_HANDLE on Linux/VA only
> - hwcontext_qsv.c: Do not allow child_device_type VAAPI for Windows until support is added, keep D3D11/DXVA2 as more prioritary defaults.
>
> Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/
> Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
> Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>

This email address is... interesting.

Perhaps you might want to add a manual From: statement to ensure
correct attribution?
Sil Vilerino April 13, 2023, 1:08 p.m. UTC | #3
On 4/12/2023 6:38 PM, Neal Gompa wrote:
> 
> This email address is... interesting.
> 
> Perhaps you might want to add a manual From: statement to ensure correct attribution?

Oh, I'm not sure why it's showing like this, thanks for pointing this 
out. I checked git send-email with another destination address and seems 
to be using the intended sender address sivileri@linux.microsoft.com

I'll make sure to add the Signed-Off-By tag and check the From: 
statement in next versions of the patches to ensure correct attribution.
Sil Vilerino April 13, 2023, 1:11 p.m. UTC | #4
On 4/12/2023 12:18 PM, Hendrik Leppkes wrote:
>> -#if CONFIG_VAAPI
>> +#if CONFIG_VAAPI && !_WIN32 // Do not enable for libva-win32 on
>> +Windows
> 
> Shouldn't this be defined(_WIN32), same below?
> 

Great catch, thanks for pointing this out. Will change to 
defined(_WIN32) on both files qsv_internal.h and hwcontext_qsv.c, will 
wait a couple more days for comments on V3 before sending V4 with those 
changes.
diff mbox series

Patch

diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 5119ef4dff..df5e1e05ca 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -23,9 +23,9 @@ 
 
 #include "config.h"
 
-#if CONFIG_VAAPI
+#if CONFIG_VAAPI && !_WIN32 // Do not enable for libva-win32 on Windows
 #define AVCODEC_QSV_LINUX_SESSION_HANDLE
-#endif //CONFIG_VAAPI
+#endif //CONFIG_VAAPI && !_WIN32
 
 #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
 #include <stdio.h>
@@ -35,7 +35,6 @@ 
 #endif
 #include <fcntl.h>
 #include <va/va.h>
-#include <va/va_drm.h>
 #include "libavutil/hwcontext_vaapi.h"
 #endif
 
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 6780428875..71212b177a 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -2126,8 +2126,6 @@  static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
                    "\"%s\".\n", e->value);
             return AVERROR(EINVAL);
         }
-    } else if (CONFIG_VAAPI) {
-        child_device_type = AV_HWDEVICE_TYPE_VAAPI;
 #if QSV_ONEVPL
     } else if (CONFIG_D3D11VA) {  // Use D3D11 by default if d3d11va is enabled
         av_log(ctx, AV_LOG_VERBOSE,
@@ -2147,11 +2145,23 @@  static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
     } else if (CONFIG_D3D11VA) {
         child_device_type = AV_HWDEVICE_TYPE_D3D11VA;
 #endif
+    } else if (CONFIG_VAAPI) {
+        child_device_type = AV_HWDEVICE_TYPE_VAAPI;
     } else {
         av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");
         return AVERROR(ENOSYS);
     }
 
+#if CONFIG_VAAPI && _WIN32
+    /* AV_HWDEVICE_TYPE_VAAPI on Windows/Libva-win32 not supported */
+    /* Reject user specified child_device_type or CONFIG_VAAPI on Windows */
+    if (child_device_type == AV_HWDEVICE_TYPE_VAAPI) {
+        av_log(ctx, AV_LOG_ERROR, "VAAPI child device type not supported for oneVPL on Windows"
+                "\"%s\".\n", e->value);
+        return AVERROR(EINVAL);
+    }
+#endif
+
     child_device_opts = NULL;
     switch (child_device_type) {
 #if CONFIG_VAAPI