Skip to content

Commit

Permalink
vaapi: prefer EGL
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 20, 2015
1 parent 0266fe3 commit 745295d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/codec/video/VideoDecoderVAAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,19 @@ class VideoDecoderVAAPIPrivate Q_DECL_FINAL: public VideoDecoderFFmpegHWPrivate,
if (VAAPI_X11::isLoaded()) {
display_type = VideoDecoderVAAPI::X11;
#ifndef QT_NO_OPENGL
#if QTAV_HAVE(EGL_CAPI)
if (OpenGLHelper::isEGL())
display_type = VideoDecoderVAAPI::EGL;
#endif //QTAV_HAVE(EGL_CAPI)
#if VA_X11_INTEROP
copy_mode = VideoDecoderFFmpegHW::ZeroCopy;
#endif //VA_X11_INTEROP
#endif //QT_NO_OPENGL
}
#ifndef QT_NO_OPENGL
#if QTAV_HAVE(EGL_CAPI)
if (OpenGLHelper::isEGL()) {
display_type = VideoDecoderVAAPI::EGL;
copy_mode = VideoDecoderFFmpegHW::ZeroCopy;
}
#endif //QTAV_HAVE(EGL_CAPI)
#endif //QT_NO_OPENGL
config_id = VA_INVALID_ID;
context_id = VA_INVALID_ID;
version_major = 0;
Expand Down Expand Up @@ -276,7 +280,12 @@ class VideoDecoderVAAPIPrivate Q_DECL_FINAL: public VideoDecoderFFmpegHWPrivate,
VideoDecoderVAAPI::VideoDecoderVAAPI()
: VideoDecoderFFmpegHW(*new VideoDecoderVAAPIPrivate())
{
setDisplayPriority(QStringList() << QStringLiteral("X11") << QStringLiteral("GLX") << QStringLiteral("DRM") << QStringLiteral("EGL"));
QStringList dp = QStringList() << QStringLiteral("X11") << QStringLiteral("GLX") << QStringLiteral("DRM");
if (OpenGLHelper::isEGL()) //TODO: drm+egl
dp.prepend(QStringLiteral("EGL"));
else
dp.append(QStringLiteral("EGL"));
setDisplayPriority(dp);
// dynamic properties about static property details. used by UI
// format: detail_property
setProperty("detail_surfaces", tr("Decoding surfaces") + QStringLiteral(" ") + tr("0: auto"));
Expand Down
1 change: 1 addition & 0 deletions src/vaapi/SurfaceInteropVAAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ bool EGLInteropResource::map(const surface_ptr &surface, GLuint tex, int w, int
if (!ensure())
return false;
if (va_image.image_id == VA_INVALID_ID) {
// TODO: try vaGetImage. it's yuv420p. RG texture is not supported by gles2, so let's use yuv420p, or change the shader
VA_ENSURE(vaDeriveImage(surface->vadisplay(), surface->get(), &va_image), false);
}
if (!vabuf_handle) {
Expand Down

0 comments on commit 745295d

Please sign in to comment.