From 9e12625b31e1d95f023fe67deb50e8bf97903994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 29 Mar 2010 09:37:55 +0200 Subject: Compile fix the openkode graphicssystem Does not work well yet though :( --- src/gui/egl/qegl_lite.cpp | 23 ++++++---- src/plugins/graphicssystems/openkode/openkode.pro | 2 +- .../openkode/qgraphicssystem_openkode.cpp | 13 +++--- .../openkode/qgraphicssystem_openkode.h | 2 +- .../openkode/qwindowsurface_openkode.cpp | 51 +++++++++++++--------- .../openkode/qwindowsurface_openkode.h | 3 +- 6 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp index 60b862b..2bbf22b 100644 --- a/src/gui/egl/qegl_lite.cpp +++ b/src/gui/egl/qegl_lite.cpp @@ -42,7 +42,7 @@ #include #include #include -#include "qegl_p.h" +#include "qeglcontext_p.h" #if !defined(QT_NO_EGL) @@ -52,19 +52,26 @@ QT_BEGIN_NAMESPACE -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLNativeDisplayType QEgl::nativeDisplay() { - Q_UNUSED(device); - Q_UNUSED(properties); - return 0; + return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY); +} + +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); } -EGLDisplay QEglContext::getDisplay(QPaintDevice *device) +EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) { - Q_UNUSED(device); - return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); + return 0; } +//EGLDisplay QEglContext::display() +//{ +// return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); +//} + static QGraphicsSystemScreen *screenForDevice(QPaintDevice *device) { QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); diff --git a/src/plugins/graphicssystems/openkode/openkode.pro b/src/plugins/graphicssystems/openkode/openkode.pro index f8f0bcb..055048d 100644 --- a/src/plugins/graphicssystems/openkode/openkode.pro +++ b/src/plugins/graphicssystems/openkode/openkode.pro @@ -11,4 +11,4 @@ INSTALLS += target # openkode specific stuff INCLUDEPATH += $(OPENKODE_DIR)/include -LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2_CM +LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2 diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp index 51364e4..7a07776 100644 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp @@ -92,7 +92,7 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() } // Once we've set up the desktop and display we don't need them anymore -// kdReleaseDisplayNV(kdDisplay); TODO!!! + kdReleaseDisplayNV(kdDisplay); kdReleaseDesktopNV(kdDesktop); const int defaultDpi = 72; @@ -102,12 +102,6 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() mDepth = 24; mFormat = QImage::Format_RGB888; - if (!mContext.openDisplay(0)) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - qDebug() << " - QEglContext::openDisplay OK"; QEglProperties properties; properties.setPixelFormat(QImage::Format_RGB888); @@ -119,6 +113,11 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() return; } + if (!mContext.display()) { + qWarning("qEglContext: Unable to open display!"); + return; + } + qDebug() << " - QEglContext::openDisplay OK"; } diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h index 972c42e..7d73ae0 100644 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h @@ -45,7 +45,7 @@ #include #include -#include +#include # include diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp index 33c76e4..b3f3965 100644 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp @@ -51,12 +51,13 @@ QT_BEGIN_NAMESPACE QOpenKODEWindowSurface::QOpenKODEWindowSurface (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) : QWindowSurface(window), - mScreen(screen) + mScreen(screen), + mSurface(0) { qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() << "pos" << window->x() << "x" << window->y(); - if (!mContext.openDisplay(0)) { + if (!mContext.display()) { qWarning("qEglContext: Unable to open display!"); return; } @@ -76,6 +77,7 @@ QOpenKODEWindowSurface::QOpenKODEWindowSurface void QOpenKODEWindowSurface::createWindow(QWidget *window) { + qDebug() << "createWindow"; kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); if (!kdWindow) { @@ -89,17 +91,17 @@ void QOpenKODEWindowSurface::createWindow(QWidget *window) return; } - const KDboolean windowExclusive[] = { false }; - if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { - qErrnoWarning(kdGetError(), "Could not set exclusive bit"); - return; - } + //const KDboolean windowExclusive[] = { false }; + //if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { + // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); + // //return; + //} - const KDint windowPos[2] = { window->x(), window->y() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - qErrnoWarning(kdGetError(), "Could not set native window position"); - return; - } + //const KDint windowPos[2] = { window->x(), window->y() }; + //if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + // qErrnoWarning(kdGetError(), "Could not set native window position"); + // //return; + //} EGLNativeWindowType nativeWindow; @@ -107,24 +109,29 @@ void QOpenKODEWindowSurface::createWindow(QWidget *window) qErrnoWarning(kdGetError(), "Could not realize native window"); return; } + qDebug() << "kdRealizeWindow" << nativeWindow; // Create an EGL window surface for the native window EGLint windowAttrs[3] = { EGL_NONE }; - EGLSurface eglSurface = eglCreateWindowSurface(mContext.display(), + qDebug() << "doing createwindowsurface"; + *mSurface = eglCreateWindowSurface(mContext.display(), mContext.config(), nativeWindow, windowAttrs); - if (!eglSurface) { + qDebug() << "create windowsurface"; + if (!mSurface) { qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); return; } - mContext.setSurface(eglSurface); - + qDebug() << "making context"; if (!mContext.createContext()) { qDebug() << "Unable to create context!"; return; } + + qDebug() << "about to make current"; + mContext.makeCurrent(mSurface); } QOpenKODEWindowSurface::~QOpenKODEWindowSurface() @@ -133,19 +140,20 @@ QOpenKODEWindowSurface::~QOpenKODEWindowSurface() QPaintDevice *QOpenKODEWindowSurface::paintDevice() { - //qDebug() << "QOpenKODEWindowSurface::paintDevice"; + qDebug() << "QOpenKODEWindowSurface::paintDevice"; return &mImage; } // ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) { + qDebug() << "in flush"; if (!offset.isNull()) { qWarning("Offset flushing not supported yet"); return; } - if (!mContext.makeCurrent()) { + if (!mContext.makeCurrent(mSurface)) { qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); return; } @@ -222,8 +230,8 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const if (texId) glDeleteTextures(1, &texId); - mContext.swapBuffers(); mContext.doneCurrent(); + mContext.swapBuffers(mSurface); } void QOpenKODEWindowSurface::setGeometry(const QRect &rect) @@ -233,9 +241,10 @@ void QOpenKODEWindowSurface::setGeometry(const QRect &rect) if (mImage.size() != rect.size()) mImage = QImage(rect.size(), mScreen->format()); - mContext.destroySurface(); + mContext.destroySurface(mSurface); kdDestroyWindow(kdWindow); createWindow(window()); + qDebug() << "set geometry workded"; } bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h index 1c70f55..bee94a5 100644 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h @@ -43,7 +43,7 @@ #define QWINDOWSURFACE_OPENKODE_H #include -#include +#include QT_BEGIN_NAMESPACE @@ -68,6 +68,7 @@ private: QOpenKODEGraphicsSystemScreen *mScreen; QImage mImage; struct KDWindow *kdWindow; + EGLSurface *mSurface; QEglContext mContext; void createWindow(QWidget *window); -- cgit v0.12