diff options
author | Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> | 2012-03-16 16:52:39 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-04 16:05:06 +0200 |
commit | 24afb1097d6257063786a9e36b92e85adfa8ed74 (patch) | |
tree | 70ad1e21cd923d8f980694ee2e794dee7bf61732 /src/plugins/platforms/eglfs/qeglfsscreen.cpp | |
parent | 246c16e0007473874e0407ca067c0b031c17852f (diff) |
eglfs: Introduce hooks for the eglfs plugin
EGL provides an api to create a rendering context for khronos APIs
on native surfaces. The board initialization and window creation
is platform specific.
This commit adds platform hooks/extensions to the EGLFS plugin and
implements them for the Amlogic 8726M. The hook interface is internal
and there are no ABI/API guarantees.
EGLFS is now linked with -Wl,-no-undefined to make sure that a hook does not
add unresolvable symbols.
Change-Id: I7f4fcdb422aacbf00de468f4d8e85ae5368bfacf
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsscreen.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsscreen.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index fdffd96d6e..c7e983b0fb 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -41,6 +41,7 @@ #include "qeglfsscreen.h" #include "qeglfswindow.h" +#include "qeglfs_hooks.h" #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglplatformcontext_p.h> @@ -52,6 +53,13 @@ QT_BEGIN_NAMESPACE +#ifdef EGLFS_PLATFORM_HOOKS +extern QEglFSHooks platform_hooks; +static QEglFSHooks *hooks = &platform_hooks; +#else +static QEglFSHooks *hooks = 0; +#endif + // #define QEGL_EXTRA_DEBUG #ifdef QEGL_EXTRA_DEBUG @@ -104,16 +112,20 @@ public: } }; -QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) +QEglFSScreen::QEglFSScreen() : m_depth(32) , m_format(QImage::Format_Invalid) , m_platformContext(0) , m_surface(0) + , m_window(0) { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglScreen %p\n", this); #endif + if (hooks) + hooks->platformInit(); + EGLint major, minor; if (!eglBindAPI(EGL_OPENGL_ES_API)) { @@ -121,7 +133,7 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) qFatal("EGL error"); } - m_dpy = eglGetDisplay(display); + m_dpy = eglGetDisplay(hooks ? hooks->platformDisplay() : EGL_DEFAULT_DISPLAY); if (m_dpy == EGL_NO_DISPLAY) { qWarning("Could not open egl display\n"); qFatal("EGL error"); @@ -151,7 +163,13 @@ QEglFSScreen::~QEglFSScreen() if (m_surface) eglDestroySurface(m_dpy, m_surface); + if (hooks) + hooks->destroyNativeWindow(m_window); + eglTerminate(m_dpy); + + if (hooks) + hooks->platformDestroy(); } void QEglFSScreen::createAndSetPlatformContext() const { @@ -185,14 +203,16 @@ void QEglFSScreen::createAndSetPlatformContext() EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat); - EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE if (kdInitializeNV() == KD_ENOTINITIALIZED) { qFatal("Did not manage to initialize openkode"); } KDWindow *window = kdCreateWindow(m_dpy,config,0); - kdRealizeWindow(window,&eglWindow); + kdRealizeWindow(window, &m_window); +#else + if (hooks) + m_window = hooks->createNativeWindow(hooks->screenSize()); #endif #ifdef QEGL_EXTRA_DEBUG @@ -209,7 +229,7 @@ void QEglFSScreen::createAndSetPlatformContext() qWarning("\n"); #endif - m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL); + m_surface = eglCreateWindowSurface(m_dpy, config, m_window, NULL); if (m_surface == EGL_NO_SURFACE) { qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError()); eglTerminate(m_dpy); |