summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_x11egl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove stray qDebugTom Cooksey2010-04-261-1/+0
| | | | Reviewed-By: TrustMe
* Make sure recreateEglSurface creates a surface if there isn't oneTom Cooksey2010-04-221-12/+12
| | | | | | | | If QGLWidgetPrivate::recreateEglSurface is called after a surface has been deleted, it should always create a new surface and ignore the fact that the window ID may not have changed. Reviewed-By: Trond
* Set EGL_SWAP_BEHAVIOR to EGL_BUFFER_PRESERVED for regular QWidgetsTom Cooksey2010-04-161-0/+4
| | | | | | | | | QGLWidgets are assumed to be buffer destroyed, however regular QWidgets assume they can to partial updates and thus need the preserved swap behaviour. Reviewed-By: Trond Task-number: QTBUG-9554
* Wrap EGL image function pointers and move into QEgl namespaceTom Cooksey2010-04-151-6/+2
| | | | | | | QtGui exporting a symbol called eglCreateImageKHR seems a pretty silly idea. Much better to have them in the QEgl namespace. Reviewed-By: Iain
* Avoid having to create temporary QPixmaps when binding to textureTom Cooksey2010-03-261-8/+5
| | | | Reviewed-By: TrustMe
* Implement Texture-From-Pixmap using EGLImage extensions on X11/EGLTom Cooksey2010-03-261-35/+111
| | | | | | | | | | | | | | | | | | | | | | There's lots of EGLImage extensions, split between EGL and client rendering APIs like OpenGL ES & OpenVG. To implement texture-from- pixmap using EGLImage, both EGL extensions and OpenGL ES extensions are needed. This patch resolves the EGL extension function pointers after the display is initialized in QEgl::display(). These are then exported from QtGui so they can be used in QtOpenGL. The OpenGL ES extension function pointers are resolved using the usual qglextensions.cpp mechanism. Using EGLImage seems to remove a fixed ~10 millisecond overhead per pixmap bind when compared to using EGLSurface. Exact results per bind for 100 QPixmaps are: 8x8 Pixmap: 12 -> 1.71 msecs (EGLSurface -> EGLImage) 64x64 Pixmap: 11.6 -> 1.83 msecs (EGLSurface -> EGLImage) 128x128 Pixmap: 12.8 -> 2.74 msecs (EGLSurface -> EGLImage) 256x256 Pixmap: 16 -> 6.20 msecs (EGLSurface -> EGLImage) Reviewed-By: Trond
* Delete the QGLContext in ~QX11GLPixmapDataTom Cooksey2010-03-111-0/+1
| | | | | | | | This also includes changes which allow QGLContext to not own it's own QEglContext. With X11GL, the QEglContext gets reused by multiple QGLContexts so it is important QGLContext doesn't delete it. Reviewed-By: TrustMe
* Update QGLFormat from EGLConfig properlyTom Cooksey2010-03-101-3/+2
| | | | | | | Previously, some members of QGLFormat (like alphaBufferSize) would be left to the initial -1 value. Reviewed-By: TrustMe
* Make sure 16-bit EGL configs are chosen over 32-bit configsTom Cooksey2010-03-101-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide the best performance. The EGL config selection algorithm is a bit stange in this regard: The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard 32-bit configs completely from the selection. So it then comes to the sorting algorithm. The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort order is special and described as "by larger _total_ number of color bits.". So EGL will put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on to say "If the requested number of bits in attrib_list for a particular component is 0, then the number of bits for that component is not considered". This part of the spec also seems to imply that setting the red/green/blue bits to zero means none of the components are considered and EGL disregards the entire sorting rule. It then looks to the next highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, we must set the red/green/blue sizes to zero. This has an unfortunate consequence that if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. Reviewed-By: TrustMe
* Handle EGLSurfaces better, including more error detectionTom Cooksey2010-03-101-4/+4
| | | | | | | Note: This changes QX11PixmapData::gl_surface to a void* to enable build on 64-bit systems where EGLSurface is a pointer. Reviewed-By: TrustMe
* Enable cleanup hooks when creating an EGL surface for a pixmapTom Cooksey2010-03-081-1/+0
| | | | Reviewed-By: TrustMe
* Port QX11GLPixmapData & QX11GLWindowSurface to new QEgl APITom Cooksey2010-03-051-107/+0
| | | | | | | It's still just as buggy, but at least it allows us to remove a lot of crud from qgl_x11egl.cpp. Reviewed-By: TrustMe
* Fix build on EGL implementations where EGLConfig is a pointerTom Cooksey2010-03-041-3/+2
| | | | | | | EGLConfig is an opaque type which we really shouldn't cast to an int. Instead, we get the config id for the EGLConfig. Reviewed-By: TrustMe
* Add and use QGLContextPrivate::eglSurfaceForDevice()Tom Cooksey2010-03-021-1/+1
| | | | | | | | | The QGLContext only stores the EGLSurface for QWidgets & QGLWidgets, other device types like QPixmap & QGLPixelBuffer store the surface themsselves. With this patch it is possible to create a QGLContext on a QPixmap, make it current and render GL to that QPixmap on X11. Reviewed-By: TrustMe
* Make bindTextureFromNativePixmap use new QEgl APIsTom Cooksey2010-03-021-2/+7
| | | | | | | The old qt_chooseEGLConfigForPixmap & qt_createEGLSurfaceForPixmap code will remain until QX11GLPixmapData can be re-written properly. Reviewed-By: TrustMe
* Move QGLWidget::setContext logic into QEgl & QGLContextTom Cooksey2010-03-021-118/+55
| | | | | | | | | | | | | | | | QEgl::createSurface() on X11 will now check to see if the device's X11 Visual is compatible with the EGLConfig passed in. If it is not compatible, the function will re-create the QPaintDevice's native drawable with a different Visual (one which is compatable with the EGLConfig). This represented the bulk of the QGLWidget::setContext method which is now much simpler. As a consequense of this change, QWidgets with graphicssystem opengl will behave much more like QGLWidget as most of the code is re-used. So things like WA_TranslucentBackground should now work with opengl graphicssystem too. Reviewed-By: TrustMe
* Move EGL surface type setting to new QEglProperties::setDeviceTypeTom Cooksey2010-03-021-1/+2
| | | | | | Also renamed qt_egl_set_format->qt_eglproperties_set_glformat Reviewed-By: TrustMe
* Replace qt_egl_add_platform_config with existing QEglProperties APITom Cooksey2010-03-021-7/+1
| | | | | | | QEglProperties::setPaintDeviceFormat() seems to be a copy & paste of qt_egl_add_platform_config for every platform anyway. Reviewed-By: TrustMe
* Use QEgl::display in QGLTemporaryContext so EGL is init'd only onceTom Cooksey2010-03-021-6/+1
| | | | Reviewed-By: Trond Kjernåsen
* Remove qt_egl_setup_x11_visualTom Cooksey2010-03-021-149/+1
| | | | | | | This method has been re-written as QEgl::getCompatibleVisualId() which is much cleaner code. Reviewed-By: TrustMe
* Make QGLWidget use new QEgl::getCompatibleVisualId APITom Cooksey2010-03-021-3/+15
| | | | Reviewed-By: TrustMe
* Move static methods from QEglContext to QEgl namespaceTom Cooksey2010-03-021-10/+10
| | | | Reviewed-By: Aleksandar Sasha Babic
* Cleanup QEglContext & EGLDisplaysTom Cooksey2010-02-121-9/+4
| | | | | | | | | This basicaly replaces display(), openDisplay() & defaultDisplay() methods with a single display() and nativeDisplay(), the latter being implemented in the platform-specific files and everything else being cross-platform code. Reviewed-By: Trond
* Rework how Qt handles GL extensions.Trond Kjernåsen2010-01-131-102/+92
| | | | | | | | | | | | | | | | | | Qt used to store the GL extensions a particular implementation supported in a global cache, which was initialized once and never updated. This could cause problems because different types of context might support different kinds of extensions (e.g. the difference between sw and hw contexts). With this patch, the GL extensions are cached and updated within each QGLContext. It also makes the extension initialization lazy, which saves application initialization costs for embedded platforms. The patch introduces a internal cross platform QGLTemporaryContext class that is used to create a light-weight GL context without going via QGLWidget and friends (QWS and WinCE still have QGLWidget fallbacks for now). Reviewed-by: Kim Reviewed-by: Samuel
* Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6Simon Hausmann2010-01-081-67/+67
|\ | | | | | | | | Conflicts: src/multimedia/audio/qaudioformat.cpp
| * Fixed indentation and typo.Trond Kjernåsen2010-01-071-67/+67
| | | | | | | | Reviewed-by: TrustMe
* | Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-071-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: QIODevice: Fix readAll() Temporary hackiesh solution to prevent BOM in the xml data. Fixed qxmlstream autotest when using shadow builds. Attempt at readding the capital P headers for Phonon Remove special Phonon processing from syncqt. Use the lowercase/shortname.h headers for Phonon includes Fixes a crash when setting focus on a widget with a focus proxy. Update copyright year to 2010 doc: Clarified activeSubControls and subControls. Remove warning "statement with no effect" doc: Clarified that .lnk files are System files on Windows.
| * Update copyright year to 2010Jason McDonald2010-01-061-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Improved initial startup time for a QGLWidget ontop of EGL/X11.Trond Kjernåsen2010-01-061-5/+111
|/ | | | | | | Exchanged the temporary QGLWidget with a lightweight internal class. Measured on a device it can be upto 20 ms faster to construct. Reviewed-by: Tom Cooksey
* Fix QGLWidgets created with an alpha channel on X11/EGLTom Cooksey2009-12-151-1/+1
| | | | | | | | If the QGLWidget's QGLFormat says it should have an alpha channel, try to find an ARGB Visual. Reviewed-By: Trond Task-number: QT-2602
* Add QT_DEBUG_X11_VISUAL_SELECTION to aid debugging X11/EGLTom Cooksey2009-12-151-15/+31
|
* Fix WA_TranslucentBackground for QGLWidgets on X11/EGLTom Cooksey2009-12-041-45/+73
| | | | | | | Also check for existing QEglContext before creating a new one and leaking a context. Reviewed-by: TrustMe
* Mark both the new and original EGL contexts as sharingRhys Weatherley2009-11-091-0/+2
| | | | | | | If we succeed in creating a shared context, then mark the original as shared as well. Reviewed-by: Sarah Smith
* Detect context sharing on EGL systemsRhys Weatherley2009-11-091-0/+1
| | | | | | | | Context sharing was enabled on EGL systems, but QGLContext::isSharing() was still returning false because the flag in QGLContextPrivate was not updated. Reviewed-by: Sarah Smith
* Added QImagePixmapCleanupHooks functions for enabling hooks.Samuel Rødal2009-10-291-1/+2
| | | | | | | Better than having to befriend QPixmapData and setting is_cached manually. Reviewed-by: Tom Cooksey
* Fix bug for message error "Texture updload failed, error code 0x500"Stefano Pironato2009-10-281-1/+0
| | | | | | | | | | | | The error message come from the QGLContextPrivate::bindTexture. But since OpenGl errors are retains until glGetError is called the actual error was happening somewhere else. After adding in all the gl* call a check for a gl error, I was able to get the place where opengl fail with a GL_INVALID_ENUM. This happen in the call of glEnable(GL_TEXTURE_2D) in the file qgl_x11egl.cpp. This glEnable call does not need: removed. Reviewed-by: Tom Cooksey
* Make sure QGLTextureCache exists when creating surfaces for pixmapsTom Cooksey2009-10-201-0/+8
| | | | | | | QGLTextureCache installs pixmap cleanup hooks which are used to clean up the EGL surfaces. Reviewed-By: Trustme
* Add a new QX11GLPixmapData which renders to X pixmaps using GLTom Cooksey2009-10-191-1/+4
| | | | | Enable it by setting QT_USE_X11GL_PIXMAPS environment variable while using the -graphicssystem opengl
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6Gunnar Sletta2009-10-021-147/+186
|\
| * Refactor retrieving the X11 visual for EGLEskil Abrahamsen Blomfeldt2009-10-011-74/+84
| | | | | | | | | | | | | | | | | | We need this in qwindowsurface_gl.cpp. This patch was modified slightly by Tom, who stole it from another branch. :-) Reviewed-by: Gunnar
| * Split EGL config selection & surface creation into seperate functionsTom Cooksey2009-10-011-73/+102
| | | | | | | | | | This is needed to implement render-to-pixmap on x11/EGL, which will also need to create an EGL surface for pixmaps.
* | Make 16-bit graphicssystem opengl workGunnar Sletta2009-10-021-1/+11
|/ | | | Reviewed-by: Eskil
* Move common EGL functions to qgl_egl.cppRhys Weatherley2009-09-251-40/+0
| | | | | | | | There were several copies of the same stubbed functions in qgl_wince.cpp, qgl_qws.cpp, and qgl_x11egl.cpp. Move them all to a common location for easier maintainence. Reviewed-by: Sarah Smith
* Remove the storage of the EGLSurface from QEglContextRhys Weatherley2009-09-251-4/+9
| | | | Reviewed-by: Sarah Smith
* Start to separate the EGLSurface from QEglContext in QtOpenGLRhys Weatherley2009-09-241-53/+6
| | | | | | | Also, move the EGL makeCurrent(), doneCurrent(), swapBuffers(), and reset() functions into the common qgl_egl.cpp. Reviewed-by: Sarah Smith
* Make QtOpenGL on X11/EGL less chatty with it's debug outputTom Cooksey2009-09-161-5/+6
| | | | Reviewed-by: Trustme
* Performance: reduce TLS overhead of QGLContext::currentContext()Rhys Weatherley2009-09-141-10/+3
| | | | | | | | | | | | | The handling for the current QGLContext was looking up the same TLS data several times per call (hasLocalData() and localData() calls particularly). This change also refactors the code a little so that the setting of the QGLContext within makeCurrent() and doneCurrent() is in one location in the code instead of six (one per platform). Reviewed-by: Michael Brasser Reviewed-by: Sarah Smith
* Make an EGL context current when initializing GL extensionsRhys Weatherley2009-09-101-0/+7
| | | | Reviewed-by: trustme
* Don't yinvert pixmaps on eglx11Gunnar Sletta2009-09-101-3/+0
| | | | Reviewed-by: Tom
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me