diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2014-03-21 16:02:48 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-01 15:01:41 +0200 |
commit | 36649887e8ba8841b45522a772cf83b5c5130fca (patch) | |
tree | 123a5a79b8dcb765bfa8dd5dcca59c693ec8fea0 /src/plugins/qnx/common/windowgrabber.h | |
parent | d2b54b360ec0cedf2dfd64c72cc8f476fb93bc7c (diff) |
QNX: Remove most of the CPU overhead for video rendering
This patch uses the GL_OES_EGL_image extension to create a OpenGL Texture handle
for a libscreen pixmap. If the extension is not available it uses the "old"
technique as fallback where the image data is copied into a QImage.
This reduces the CPU load by more than 70% and allows HD videos to be played jitter-free.
Task-number: QTBUG-37752
Change-Id: I4cad22c39390e4cf9eb5be5f0bfe446544a11b9e
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/plugins/qnx/common/windowgrabber.h')
-rw-r--r-- | src/plugins/qnx/common/windowgrabber.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/qnx/common/windowgrabber.h b/src/plugins/qnx/common/windowgrabber.h index 7ec4202a2..40351ef25 100644 --- a/src/plugins/qnx/common/windowgrabber.h +++ b/src/plugins/qnx/common/windowgrabber.h @@ -41,6 +41,12 @@ #ifndef WINDOWGRABBER_H #define WINDOWGRABBER_H +#define EGL_EGLEXT_PROTOTYPES = 1 +#define GL_GLEXT_PROTOTYPES = 1 +#include <EGL/egl.h> +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> +#include <EGL/eglext.h> #include <QAbstractNativeEventFilter> #include <QObject> #include <QTimer> @@ -59,6 +65,8 @@ public: void setFrameRate(int frameRate); + void createEglImages(); + void setWindowId(const QByteArray &windowId); void start(); @@ -73,8 +81,12 @@ public: QByteArray windowGroupId() const; + bool eglImageSupported(); + void checkForEglImageExtension(); + bool eglImagesInitialized(); + signals: - void frameGrabbed(const QImage &frame); + void frameGrabbed(const QImage &frame, int); private slots: void grab(); @@ -89,10 +101,10 @@ private: screen_window_t m_window; screen_context_t m_screenContext; - screen_pixmap_t m_screenPixmap; - screen_buffer_t m_screenPixmapBuffer; + screen_pixmap_t m_screenPixmaps[2]; + screen_buffer_t m_screenPixmapBuffers[2]; - char* m_screenBuffer; + char *m_screenBuffers[2]; int m_screenBufferWidth; int m_screenBufferHeight; @@ -100,8 +112,13 @@ private: bool m_active : 1; bool m_screenContextInitialized : 1; - bool m_screenPixmapInitialized : 1; - bool m_screenPixmapBufferInitialized : 1; + bool m_screenPixmapBuffersInitialized : 1; + int m_currentFrame; + EGLImageKHR img[2]; + GLuint imgTextures[2]; + bool m_eglImageSupported : 1; + bool m_eglImagesInitialized : 1; + bool m_eglImageCheck : 1; // We must not send a grabed frame before this is true }; QT_END_NAMESPACE |