10#include <QtGui/QOpenGLContext>
11#include <qpa/qplatformopenglcontext.h>
12#include <qpa/qwindowsysteminterface.h>
13#include <QtGui/QScreen>
15#include <QtGui/private/qeglplatformcontext_p.h>
16#include <QtGui/private/qeglconvenience_p.h>
18#include <QtGui/private/qt_egl_p.h>
22#ifdef DIRECTFB_PLATFORM_HOOKS
23extern QDirectFBEGLHooks platform_hook;
24static QDirectFBEGLHooks *hooks = &platform_hook;
30
31
32
33
34
35
48 void platformDestroy();
51 EGLDisplay m_eglDisplay;
67 EGLSurface m_eglSurface;
93 if (m_eglDisplay == EGL_NO_DISPLAY)
100 m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
101 if (m_eglDisplay == EGL_NO_DISPLAY)
107 eglBindAPI(EGL_OPENGL_ES_API);
108 eglInitialize(m_eglDisplay, &major, &minor);
131 if (m_eglSurface != EGL_NO_SURFACE) {
134 eglDestroySurface(dfbScreen->eglDisplay(), m_eglSurface);
141 if (window()->surfaceType() == QSurface::RasterSurface)
144 Q_ASSERT(!m_dfbWindow.data());
146 DFBWindowDescription description;
147 memset(&description, 0,
sizeof(DFBWindowDescription));
148 description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH | DWDESC_HEIGHT|
149 DWDESC_POSX | DWDESC_POSY|
150 DWDESC_PIXELFORMAT | DWDESC_SURFACE_CAPS);
151 description.width = qMax(1, window()->width());
152 description.height = qMax(1, window()->height());
153 description.posx = window()->x();
154 description.posy = window()->y();
156 description.surface_caps = DSCAPS_GL;
157 description.pixelformat = DSPF_RGB16;
159 IDirectFBDisplayLayer *layer;
160 layer = toDfbScreen(window())->dfbLayer();
161 DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
162 if (result != DFB_OK)
163 DirectFBError(
"QDirectFbWindow: failed to create window", result);
165 m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
166 m_inputHandler->addWindow(m_dfbWindow.data(), window());
171 if (m_eglSurface == EGL_NO_SURFACE) {
173 EGLConfig config = q_configFromGLFormat(dfbScreen->eglDisplay(), format(),
true);
174 m_eglSurface = eglCreateWindowSurface(dfbScreen->eglDisplay(), config, dfbSurface(), NULL);
176 if (m_eglSurface == EGL_NO_SURFACE)
185 return window()->requestedFormat();
197 return window->eglSurface();
200QPlatformWindow *QDirectFbIntegrationEGL::createPlatformWindow(QWindow *window)
const
202 QDirectFbWindow *dfbWindow =
new QDirectFbWindowEGL(window, m_input.data());
203 dfbWindow->createDirectFBWindow();
207QPlatformOpenGLContext *QDirectFbIntegrationEGL::createPlatformOpenGLContext(QOpenGLContext *context)
const
209 QDirectFbScreenEGL *screen;
210 screen =
static_cast<QDirectFbScreenEGL*>(context->screen()->handle());
211 return new QDirectFbEGLContext(screen, context);
214void QDirectFbIntegrationEGL::initializeScreen()
216 m_primaryScreen.reset(
new QDirectFbScreenEGL(0));
217 QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
220bool QDirectFbIntegrationEGL::hasCapability(QPlatformIntegration::Capability cap)
const
223 if (hooks && hooks->hasCapability(cap))
225 return QDirectFbIntegration::hasCapability(cap);
QDirectFbEGLContext(QDirectFbScreenEGL *screen, QOpenGLContext *context)
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface)
QDirectFbScreenEGL(int display)
QDirectFbScreen(int display)
void createDirectFBWindow()
QDirectFbWindowEGL(QWindow *tlw, QDirectFbInput *inputhandler)
QSurfaceFormat format() const
Returns the actual surface format of the window.
virtual void createDirectFBWindow()
static QT_BEGIN_NAMESPACE QDirectFBEGLHooks * hooks