summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioscontext.mm
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-231-1/+5
|\ | | | | | | | | | | | | | | Conflicts: src/angle/src/libGLESv2/libGLESv2.pro src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp Change-Id: If8da4cfe8f57fea9f78e7239f378a6302c01674e
| * UIKit: Treat windows as exposed only during Qt::ApplicationStateActiveTor Arne Vestbø2016-06-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | We previously treated Qt::ApplicationStateInactive as a valid state to expose windows in, to prevent a visible flash of black screen at app startup between iOS hiding the launch screen and Qt drawing it's first frame, but this lag is no longer an issue, so we can apply the best practice of only rendering during Qt::ApplicationStateActive. This may prevent crashes during application suspension. Task-number: QTBUG-52493 Change-Id: I271281ed6fb857e6849cdb88cc2d8251d1bba1df Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-66/+93
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
| * UIKit: Detect swapBuffers on non-exposed windows and skip flushTor Arne Vestbø2016-06-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | When using threaded rendering the render-thread might be half-way into rendering a frame when the application is backgrounded, resulting in the following swap happening on a non-exposed window. This may result in the system killing the application, as rendering is not supposed to happen when an application is backgrounded, so we skip the flush. Change-Id: I9ab8f2c4617391fd827558af9fb473f1734b3688 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * UIKit: Don't reallocate renderbuffer on QIOSContext::swapBuffers()Tor Arne Vestbø2016-06-171-66/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During device rotation, the backing CEAGLLayer of our custom UIView is resized by the system. Normally this is the time where we would then reconfigure the corresponding renderbuffer that we render to, which shares memory with the CEAGLLayer, but we chose a lazy approach where we'd defer the reconfigure until client code actually called makeCurrent. This caused problems because not only did we implement the lazy reconfig in makeCurrent, but in every QIOSContext function that operated on the default FBO, including swapBuffers(). When using threaded rendering, such as in Qt Quick, the render thread may be half way in rendering a new frame when the system resizes the CEAGLLayer, and we pick up that resize on the swapBuffer call and allocate a new renderbuffer, before flushing the queued up GL commands that were operating on another renderbuffer of a different size. This resulted in the following crash: 0 - gpus_ReturnObjectErrorKillClient() 1 - gpusSubmitDataBuffers() 2 - glrFlushContextToken() 3 - flush(__GLIContextRec*)() 4 - QIOSContext::swapBuffers(QPlatformSurface*) ... We solve this by still being lazy in how we reconfigure, but limit the reconfigure to makeCurrent(). If the CEAGLLayer is resized in between two frames, we skip the half-drawn frame. The old frame will then be scaled to match the new size by the system, but this is preferable to flushing a new frame that may have been drawn with two conflicting window geometries. Task-number: QTBUG-50017 Change-Id: Ie229f26d156dfbfc7ed8d9efd0eb5e992eee73f1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Avoid repeated QByteArray creation when resolving opengl functionsLars Knoll2016-03-011-2/+2
| | | | | | | | | | | | | | | | | | | | Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix broken QIOSContext setup due to missing 0-initialization of EAGLContextTor Arne Vestbø2015-12-101-3/+4
| | | | | | Change-Id: Ia4dbb2e3b055a7899c4a3e02698c5776ea7f73ea Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Favor OpenGLES 3 on iOS if availableMike Krus2015-12-091-3/+5
| | | | | | | | | | | | First tries OpenGLES 3 context since it’s strictly compatible with OpenGLES 2. If it fails, then try 2. This is required to use QOpenGLFramebufferObject::blitFramebuffer without having to look at using an Apple-specific extension. Change-Id: I01f8f058fa82e7f2c90d1b894ad36f3d3939c994 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* ios: Add support for QOpenGLWidget and QQuickWidgetLaszlo Agocs2015-05-071-2/+4
| | | | | | | | | | | | The global shared context is now always enabled on iOS. This means that contexts used by QOpenGLWindow/Widget and QQuickWindow/Widget and the iOS backingstore will share with each other. [ChangeLog][QtGui] QOpenGLWidget and QQuickWidget are now supported on iOS. Task-number: QTBUG-40034 Change-Id: Ibfb99ffcb18f8f8d263662fbf237bc348fc730ee Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Allow ES3 (and ES1) context creation on iOSJames Turner2014-08-191-5/+18
| | | | | | | | | Instead of hardcoding an ES2 context, use the major version from QSurfaceFormat. The EAGL API constants match the major versions so simply cast to avoid SDK version issues. Change-Id: Ieb46f10ea6b797d65c6c8b778bb043becb7a2f95 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* iOS: Fix compilation with Xcode6/iOS8 SDKTor Arne Vestbø2014-07-211-0/+1
| | | | | | | We were implicitly including OpenGLES/ES2/glext.h prior to iOS8. Change-Id: I353badb5c209b9ebc57c1718223c164590705064 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Share default-FBO for windows between contexts in a share-groupTor Arne Vestbø2014-03-311-4/+9
| | | | | | | | | | | | | | | The current implementation of QOpenGLContext sharing assumes that the contexts form a tree and that leaf-nodes are destroyed before their parents. We build on this assumption and keep track of the default FBOs for windows in the root context of the tree. This allows two shared contexts to both makeCurrent() on the same window surface without resulting in two FBOs being set up (which doesn't work on iOS due to the CEAGLLayer already being tied to another render-buffer). Change-Id: Ib9f8c597effe488480fe99e10846be22c257f490 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* iOS: Add support for offscreen GL surfaces without using hidden windowsTor Arne Vestbø2014-03-281-0/+16
| | | | | | | | | | | | | | There's no need to create a hidden window to get a surface on iOS, as the platform supports FBOs. Note that defaultFramebufferObject() returns 0 in the case of offscreen surfaces, which is technically not a valid FBO on iOS due to the indirect rendering, but binding and rendering to the zero-FBO seems to be no-ops, so clients may safely call eg glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject()) to restore the default FBO after drawing to its own FBO. Change-Id: I2e67f5d69c0698562052f5ac1df0bbfaa3337148 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* iOS: Check FBO status and return failure from QIOSContext::makeCurrent()Tor Arne Vestbø2014-03-271-6/+34
| | | | | | | | | | | | | | The Khronos documentation for glCheckFramebufferStatus recommends calling the function to see if the framebuffer is complete prior to rendering. We now give more info to clients that call makeCurrent(), by storing the state of the default FBO and returning that, instead of always returning true and leaving the clients vulnerable to calling OpenGL functions on a non-complete FBO. Change-Id: Ia99c21f811ac799b350f07e73b2ae4b173d71120 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* iOS: Tie QIOSContext FBOs to corresponding QPlatformWindow, not QWindowTor Arne Vestbø2013-11-141-5/+4
| | | | | | | | | | | | | | | | A QWindow may be created() and destroyed() multiple times in the lifetime of the window, each time resulting in a new platform window (QIOSWindow) being created. This QIOSWindow is backed by a new UIView each time, hence it needs a new FBO and renderbuffer-mapping, since the previous renderbuffer was mapped to the old UIView. This fixes a bug where a QWindow would not render after a destroy() unless it was resized (which triggered new FBO/renderbuffers). We need to inherit QObject so that we can watch the destroyed() signal. Change-Id: I93172dd6280b86b49755bf7abddf061d7e6b66f1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Enable threaded OpenGL.Maciej Kujalowicz2013-11-051-1/+14
| | | | | | | | | | This change activates ThreadedOpenGL and ThreadedPixmaps capabilities in the iOS integration. QIOSContext is expanded with a support for a shared context. Change-Id: I56615c870a24e17850ad2748421c54e015de3ab2 Reviewed-by: Ian Dean <ian@mediator-software.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Determine render buffer resize based on CA layer, not Qt windowTor Arne Vestbø2013-08-231-5/+5
| | | | | | | | | | | | | | | We resize the render-buffer based on the CALayer of the UIView that's backing the QPlatformWindow, so the logic in defaultFramebufferObject() to determine if a resize is needed should be based on the relationship between the render buffer-and the CALayer, not the render-buffer and the QPlatformWindow. There is still an issue of the QPlatformWindow and its UIView/CALayer not being in sync, but that's a separate issue. Change-Id: I84f617d07ec64fea0d027473e9720523eeae0c7a Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Merge branch 'stable' into devSergio Ahumada2013-07-111-0/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/mac/pbuilder_pbx.cpp src/corelib/json/qjsonwriter.cpp src/corelib/kernel/qeventdispatcher_blackberry.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm Change-Id: I24df576c4cbd18fa51b03122f71e32bb83b9028f
| * iOS: Make sure we're deleting framebuffers in the right contextTor Arne Vestbø2013-07-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When a QWindow was destroyed, we'd delete its corresponding buffers, but failed to make the correct EAGLContext current first. This would result in deleting/invalidating buffers for another window (whatever window's context was current at the time), and that window would then seemingly stop rendering anything, and turn black on rotation. Task-number: QTBUG-32246 Change-Id: I335a8c580203fc01e43da31c5cb6f567614c26fc Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | iOS: Look up OpenGL symbols using RTLD_DEFAULT instead of RTLD_NEXTTor Arne Vestbø2013-05-291-1/+1
|/ | | | | | | | Even if the call site is in the application binary, it's safer to use RTLD_DEFAULT as that implies using the default library search order. Change-Id: I1b30bded92b95fc7451fcdbf7afd7444dcecea71 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Set context and bind FBO before allocating render-buffer storageTor Arne Vestbø2013-05-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | defaultFramebufferObject() may be called from anywhere, at any point, not just makeCurrent(). One example is the glyph-cache, which uses it to re-bind the default FBO after generating the texture cache. If the default FBO had already been created, but the render-buffer was out of sync with the window size, we would end up in the resize code without the correct context current, and without the render-buffer's owning FBO bound. This caused "Failed to make complete framebuffer object 8cd7" warnings at runtime. We now make the context current and bind the FBO, even though it might already be bound and the context current from makeCurrent(), or when initially creating the FBO. For the future we should move the whole resize logic out of defaultFramebufferObject() and call it from makeCurrent(), or possibly [EAGLView layoutSubviews]. That's a higher impact change though, which we reserve for the 'dev' branch. Change-Id: I50ea949c12a02ad1af6ec9fdc3215d5da85b324f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Don't pretend like our OpenGL context is single-bufferedTor Arne Vestbø2013-04-301-4/+5
| | | | | | | | | | | | | | | Internally iOS double-buffers its rendering using copy instead of flipping, so we reported that our context was single-buffered so that clients could take advantage of the unchanged buffer. This failed when clients (such as Qt itself) then assumed that calling swapBufferes() was not needed. We now properly report that we're double-buffered, and we'll have to find another way to report the way double-buffering works if that's still an optimization we'd like to provide to clients. Change-Id: Id2e4faa68ed3b837ad01d6f22b2927fc9c9769c2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* iOS: Simplify context format setupTor Arne Vestbø2013-04-301-9/+5
| | | | | Change-Id: I6a6a025410298cecd5f62abd08388a7379359af7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Fix build on case sensitive file systemsTor Arne Vestbø2013-04-041-1/+1
| | | | | Change-Id: I920e7320e429006aef9433db3e942dc257dc72eb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: implement QIOSWindow::winId()Richard Moe Gustavsen2013-02-271-1/+2
| | | | | Change-Id: I3dd7accae43bcf7d4d6dfd8b272ab65d67bd935c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Move handling of FBOs to QIOSContext instead of QIOSWindowTor Arne Vestbø2013-02-271-12/+88
| | | | | | | | | | | | | | | The lifetime of an FBO is tied to its context, so letting each window manage its own FBO failed when the window tried to delete the FBO at destruction time without the proper context being current, or even available anymore. We solve this by moving all handling of FBOs to the context itself, which is fine as we're exposing the necessary bits from the window to allocate storage based on its layer. Change-Id: I8c7c96cf63d6b667527c816f10ac2f4ff6a05e0c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Remove unnecessary const-trickery when passing QIOSContext to the windowTor Arne Vestbø2013-02-271-2/+2
| | | | | Change-Id: I56b3873342c1572ea6a651027e8f1a684cbe2a5a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Update GL render buffers when the accociated window is resizedTor Arne Vestbø2013-02-271-8/+8
| | | | | | | | We keep track of the with and height of the FBO's buffers, and update their storage if the window size has changed since last time. Change-Id: I97788b69e7067a5b5b9f28e8498cf1bc5d2cf6ea Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Unset EAGL context if it's current when destroying QIOSContextTor Arne Vestbø2013-02-271-0/+3
| | | | | Change-Id: Ie0b27e6b0dafa2a7283b44d6676871fce15cc42a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Implement QPlatformOpenGLContextTor Arne Vestbø2013-02-271-0/+124
The iOS platform GL context is an EAGLContext, which is wrapped by the new class QIOSContext. The class takes care of makeCurrent() and swapBuffers(), but defers framebuffer management to the corresponding QIOSWindow. At the moment only a single framebuffer is created, and changing the geometry of the QWindow does not trigger any sort of invalidation of the buffers. The implementation assumes OpenGL ES2.x support. Though strictly speaking we could support ES1 for QtGui, it serves little purpose as Qt Quick 2 requires ES2. This patch also disabled touch event synthesization until we have figured out where we will maintain the connection to UIWindow. QPlatformOpenGLContext::getProcAddress() for getting extensions is implemented by using dlsym() to look up the symbol. This should not present any issues for App Store deployment, like dlopen() would. Change-Id: I166f800f3ecc0d180133c590465371ac1642b0ec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>