Skip to content

Commit

Permalink
lavu/hwcontext_qsv: Update after adding support for VAAPI on Windows
Browse files Browse the repository at this point in the history
- 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 intel-media-ci#619

Signed-off-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
  • Loading branch information
sivileri committed Apr 14, 2023
1 parent 0a568e3 commit 5505076
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 2 additions & 3 deletions libavcodec/qsv_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

#include "config.h"

#if CONFIG_VAAPI
#if CONFIG_VAAPI && !defined(_WIN32) // Do not enable for libva-win32 on Windows
#define AVCODEC_QSV_LINUX_SESSION_HANDLE
#endif //CONFIG_VAAPI
#endif //CONFIG_VAAPI && !defined(_WIN32)

#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
#include <stdio.h>
Expand All @@ -35,7 +35,6 @@
#endif
#include <fcntl.h>
#include <va/va.h>
#include <va/va_drm.h>
#include "libavutil/hwcontext_vaapi.h"
#endif

Expand Down
14 changes: 12 additions & 2 deletions libavutil/hwcontext_qsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 && defined(_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
Expand Down

0 comments on commit 5505076

Please sign in to comment.