Skip to content

Commit

Permalink
vaapi: use egl+tfp for glx display
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 23, 2015
1 parent 2992715 commit 7e70dfe
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/codec/video/VideoDecoderVAAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class VideoDecoderVAAPI : public VideoDecoderFFmpegHW
Q_PROPERTY(DisplayType display READ display WRITE setDisplay)
Q_ENUMS(DisplayType)
public:
// TODO: interopType: GLX, X11, DMA, DRM
enum DisplayType {
X11,
GLX,
Expand Down Expand Up @@ -276,9 +275,9 @@ VideoDecoderVAAPI::VideoDecoderVAAPI()
setProperty("detail_surfaces", tr("Decoding surfaces") + QStringLiteral(" ") + tr("0: auto"));
setProperty("detail_derive", tr("Maybe faster"));
setProperty("detail_display", QString("%1\n%2\n%3")
.arg("X11: Support all copy modes. libva-x11.so is required")
.arg("GLX: 0-copy does not work with EGL. libva-glx.so is required")
.arg("DRM: Support 0-copy with EGL. May work without X11. libva-drm.so is required")
.arg("X11: libva-x11.so is required")
.arg("GLX: libva-glx.so is required")
.arg("DRM: Support 0-copy only with EGL. May work without X11. libva-drm.so is required")
);
}

Expand Down Expand Up @@ -368,7 +367,6 @@ VideoFrame VideoDecoderVAAPI::frame()
VideoFormat fmt(VideoFormat::Format_RGB32);
VAImage img;
// TODO: derive/get image only once and pass to interop object
///TODO: x11 can use egl tfp and egl dma(va>=0.38). now all display can use 0-copy!
const bool test_format = OpenGLHelper::isEGL() && va_0_38::isValid();
if (test_format) {
vaDeriveImage(d.display->get(), p->get(), &img);
Expand Down Expand Up @@ -581,9 +579,13 @@ bool VideoDecoderVAAPIPrivate::open()
interop_res = InteropResourcePtr(new X11InteropResource());
#endif //VA_X11_INTEROP
#if QTAV_HAVE(EGL_CAPI)
if (OpenGLHelper::isEGL() && va_0_38::isValid())
interop_res = InteropResourcePtr(new EGLInteropResource());
#endif
if (OpenGLHelper::isEGL()) {
if (va_0_38::isValid())
interop_res = InteropResourcePtr(new EGLInteropResource());
else if (display_type == VideoDecoderVAAPI::GLX)
interop_res = InteropResourcePtr(new X11InteropResource());
}
#endif //QTAV_HAVE(EGL_CAPI)
#endif //QT_NO_OPENGL
codec_ctx->hwaccel_context = &hw_ctx; //must set before open
return true;
Expand Down Expand Up @@ -619,7 +621,7 @@ bool VideoDecoderVAAPIPrivate::prepareVAImage(int w, int h)
return false;
image_fmt = pixelFormatFromVA(image.format.fourcc);
VAImage test_image;
if (!disable_derive || copy_mode == VideoDecoderVAAPI::ZeroCopy) { //TODO: check egl?
if (!disable_derive || copy_mode == VideoDecoderVAAPI::ZeroCopy) {
if (vaDeriveImage(display->get(), surfaces[0], &test_image) == VA_STATUS_SUCCESS) {
qDebug("vaDeriveImage supported");
supports_derive = true;
Expand Down

0 comments on commit 7e70dfe

Please sign in to comment.