From cddb6f08b4d1bb14e6fff4a6adcd6814ea582b8e Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 8 Jun 2010 22:24:15 -0700 Subject: Enable EGL+GLES2 drawing when Wayland is selected --- configure | 34 ++++++++++++++++++++++++++++++++++ mkspecs/linux-g++/qmake.conf | 6 ++++++ src/gui/egl/egl.pri | 10 +++++----- src/gui/egl/qegl_wayland.cpp | 28 ---------------------------- src/gui/gui.pro | 5 ++++- src/opengl/opengl.pro | 18 +++--------------- 6 files changed, 52 insertions(+), 49 deletions(-) diff --git a/configure b/configure index 53a7be5804..9012de0e06 100755 --- a/configure +++ b/configure @@ -1313,7 +1313,11 @@ while [ "$#" -gt 0 ]; do PLATFORM_X11=yes ;; wayland) + # Wayland needs EGL and GLES2 PLATFORM_WAYLAND=yes + CFG_GRAPHICS_SYSTEM=opengl + CFG_OPENGL=es2 + CFG_EGL=yes ;; sdk) if [ "$PLATFORM_MAC" = "yes" ]; then @@ -5918,6 +5922,36 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_WAYLAND" = fi fi +if [ "$PLATFORM_WAYLAND" = "yes" ]; then + if [ "$CFG_OPENGL" = "yes" ]; then + CFG_EGL=auto + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_OPENGL=es2 + else + echo "All the OpenGL ES functionality tests failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + elif [ "$CFG_OPENGL" = "es2" ]; then + #OpenGL ES 2.x + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL ES 2.0 functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + CFG_EGL=yes + elif [ "$CFG_OPENGL" = "desktop" ]; then + # Desktop OpenGL support + echo "Desktop OpenGL support is not avaliable on Qt on Wayland" + exit 1 + fi +fi + # freetype support [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE" [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no diff --git a/mkspecs/linux-g++/qmake.conf b/mkspecs/linux-g++/qmake.conf index 4b218960c8..60c4ff8c21 100644 --- a/mkspecs/linux-g++/qmake.conf +++ b/mkspecs/linux-g++/qmake.conf @@ -12,3 +12,9 @@ QMAKE_INCREMENTAL_STYLE = sublib include(../common/g++.conf) include(../common/linux.conf) load(qt_config) + +QMAKE_INCDIR_OPENGL_ES2=/opt/gfx-test/include +QMAKE_LIBDIR_OPENGL_ES2=/opt/gfx-test/lib +QMAKE_LIBS_OPENGL_ES2=-lGLESv2 +QMAKE_INCDIR_OPENGL=/opt/gfx-test/include +QMAKE_LIBDIR_OPENGL=/opt/gfx-test/lib diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index c39c5ea9d9..4c7a5f8365 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -18,15 +18,15 @@ contains(QT_CONFIG, egl): { } else { symbian { SOURCES += egl/qegl_symbian.cpp - } else { + } + x11 { SOURCES += egl/qegl_x11.cpp } + wayland { + SOURCES += egl/qegl_wayland.cpp + } } } - - wayland { - SOURCES += egl/qegl_wayland.cpp - } } else:symbian { DEFINES += QT_NO_EGL SOURCES += egl/qegl_stub.cpp diff --git a/src/gui/egl/qegl_wayland.cpp b/src/gui/egl/qegl_wayland.cpp index 7510dabca8..bfd745df2a 100644 --- a/src/gui/egl/qegl_wayland.cpp +++ b/src/gui/egl/qegl_wayland.cpp @@ -48,48 +48,20 @@ #if !defined(QT_NO_EGL) -#include -#include #include #include QT_BEGIN_NAMESPACE -static QScreen *screenForDevice(QPaintDevice *device) -{ - QScreen *screen = qt_screen; - if (!screen) - return 0; - if (screen->classId() == QScreen::MultiClass) { - int screenNumber; - if (device && device->devType() == QInternal::Widget) - screenNumber = qApp->desktop()->screenNumber(static_cast(device)); - else - screenNumber = 0; - screen = screen->subScreens()[screenNumber]; - } - while (screen->classId() == QScreen::ProxyClass || - screen->classId() == QScreen::TransformedClass) { - screen = static_cast(screen)->screen(); - } - return screen; -} - // Set pixel format and other properties based on a paint device. void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) { if (!dev) return; - // Find the QGLScreen for this paint device. - QScreen *screen = screenForDevice(dev); - if (!screen) - return; int devType = dev->devType(); if (devType == QInternal::Image) setPixelFormat(static_cast(dev)->format()); - else - setPixelFormat(screen->pixelFormat()); } EGLNativeDisplayType QEgl::nativeDisplay() diff --git a/src/gui/gui.pro b/src/gui/gui.pro index cbc2ac6577..6264081e5f 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -22,7 +22,10 @@ symbian { include(kernel/symbian.pri) include(s60framework/s60framework.pri) } -wayland:include(kernel/wayland.pri) +wayland { + include(kernel/wayland.pri) + CONFIG += opengl +} #modules include(animation/animation.pri) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 2d2ed15899..90abe1e4f8 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -123,25 +123,13 @@ wayland { qpixmapdata_waylandgl_p.h \ qwindowsurface_waylandgl_p.h - } else { - SOURCES += qgl_wayland.cpp \ - qglpixelbuffer_wayland.cpp } - - contains(QT_CONFIG, fontconfig) { - contains(QT_CONFIG, system-freetype) { - embedded:CONFIG += opentype - # pull in the proper freetype2 include directory + contains(QT_CONFIG, system-freetype) { + embedded:CONFIG += opentype + # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) LIBS_PRIVATE += -lfreetype - } else { - ### Note: how does this compile with a non-system freetype? - # This probably does not compile - } - } else { - DEFINES *= QT_NO_FREETYPE } - LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD } -- cgit v1.2.3