diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-15 04:18:39 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-15 04:18:39 (GMT) |
commit | 51ef1546721340fdb6ea7ddbfd93f751c0dc95ad (patch) | |
tree | f708eff7418f8781fcc27a2fed3d827c207537b6 | |
parent | bc7732197cd65ceafded4e5b61f8c10edc0f6094 (diff) | |
parent | 2c46a28541c3d75639c00e7ee7e82113beec9a4a (diff) | |
download | Qt-51ef1546721340fdb6ea7ddbfd93f751c0dc95ad.zip Qt-51ef1546721340fdb6ea7ddbfd93f751c0dc95ad.tar.gz Qt-51ef1546721340fdb6ea7ddbfd93f751c0dc95ad.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt-releases into 4.5
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 5 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_qws.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_egl.cpp | 15 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp | 128 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 19 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp | 8 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h | 4 |
8 files changed, 29 insertions, 154 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index aef1258..d747345 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -954,7 +954,10 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < channelCount; ++i) { if (channels[i].reply == reply) { channels[i].reply = 0; - if (reply->d_func()->connectionCloseEnabled()) + // if HTTP mandates we should close + // or the reply is not finished yet, e.g. it was aborted + // we have to close that connection + if (reply->d_func()->connectionCloseEnabled() || !reply->isFinished()) closeChannel(i); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); return; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 7e91c35..348a677 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -74,7 +74,7 @@ void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize()); if (f.sampleBuffers()) { props.setValue(EGL_SAMPLE_BUFFERS, 1); - props.setValue(EGL_SAMPLES, f.samples()); + props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples()); } else { props.setValue(EGL_SAMPLE_BUFFERS, 0); } diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index b842426..4058b66 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -187,6 +187,8 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); if (d->eglContext) { + if (d->eglContext->surface() != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglContext->surface()); delete d->eglContext; d->eglContext = 0; } diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index b2f16c1..fbe6c36 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -152,7 +152,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge bool QGLPixelBufferPrivate::cleanup() { - eglDestroySurface(QEglContext::defaultDisplay(0), pbuf); + // No need to destroy "pbuf" here - it is done in QGLContext::reset(). return true; } @@ -203,13 +203,20 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const bool QGLPixelBuffer::hasOpenGLPbuffers() { // See if we have at least 1 configuration that matches the default format. - QEglContext ctx; - if (!ctx.openDisplay(0)) + EGLDisplay dpy = QEglContext::defaultDisplay(0); + if (dpy == EGL_NO_DISPLAY) return false; QEglProperties configProps; qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat()); configProps.setRenderableType(QEglContext::OpenGL); - return ctx.chooseConfig(configProps, QEglContext::BestPixelFormat); + do { + EGLConfig cfg = 0; + EGLint matching = 0; + if (eglChooseConfig(dpy, configProps.properties(), + &cfg, 1, &matching) && matching > 0) + return true; + } while (configProps.reduceConfiguration()); + return false; } QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index cb453d7..6696672 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -60,17 +60,20 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; - if (QWSServer::instance()) - holder = new PvrEglSurfaceHolder(); - else - holder = 0; + + // Make sure that the EGL layer is initialized and the drivers loaded. + EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); + if (!eglInitialize(dpy, 0, 0)) + qWarning("Could not initialize EGL display - are the drivers loaded?"); + + // Make sure that screen 0 is initialized. + pvrQwsScreenWindow(0); } PvrEglScreen::~PvrEglScreen() { if (fd >= 0) ::close(fd); - delete holder; } bool PvrEglScreen::initDevice() @@ -194,7 +197,7 @@ QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const { if (key == QLatin1String("PvrEgl")) - return new PvrEglWindowSurface(holder); + return new PvrEglWindowSurface(); return QScreen::createSurface(key); } @@ -275,116 +278,3 @@ bool PvrEglScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNative *native = (EGLNativeWindowType)(nsurface->nativeDrawable()); return true; } - -// The PowerVR engine on the device needs to allocate about 2Mb of -// contiguous physical memory to manage drawing into a surface. -// -// The problem is that once Qtopia begins its startup sequence, -// it allocates enough memory to severely fragment the physical -// address space on the device. This leaves the PowerVR engine -// unable to allocate the necessary contiguous physical memory -// when an EGL surface is created. -// -// A solution to this is to pre-allocate a dummy surface early -// in the startup sequence before memory becomes fragmented, -// reserving it for any future EGL applications to use. -// -// However, the PowerVR engine has problems managing multiple -// surfaces concurrently, and so real EGL applications end up -// with unacceptably slow frame rates unless the dummy surface -// is destroyed while the real EGL applications are running. -// -// In summary, we need to try to ensure that there is always at -// least one EGL surface active at any given time to reserve the -// memory but destroy the temporary surface when a real surface -// is using the device. That is the purpose of PvrEglSurfaceHolder. - -PvrEglSurfaceHolder::PvrEglSurfaceHolder(QObject *parent) - : QObject(parent) -{ - numRealSurfaces = 0; - - PvrQwsRect rect; - rect.x = 0; - rect.y = 0; - rect.width = 16; - rect.height = 16; - tempSurface = pvrQwsCreateWindow(0, -1, &rect); - - dpy = EGL_NO_DISPLAY; - config = 0; - surface = EGL_NO_SURFACE; - - dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (!eglInitialize(dpy, 0, 0)) { - qWarning("Could not initialize EGL display - are the drivers loaded?"); - dpy = EGL_NO_DISPLAY; - return; - } - - EGLint attribList[16]; - int temp = 0; - attribList[temp++] = EGL_LEVEL; // Framebuffer level 0 - attribList[temp++] = 0; - attribList[temp++] = EGL_SURFACE_TYPE; - attribList[temp++] = EGL_WINDOW_BIT; - attribList[temp++] = EGL_NONE; - - EGLint numConfigs = 0; - if (!eglChooseConfig(dpy, attribList, &config, 1, &numConfigs) || numConfigs != 1) { - qWarning("Could not find a matching a EGL configuration"); - eglTerminate(dpy); - dpy = EGL_NO_DISPLAY; - return; - } - - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not create the temporary EGL surface"); -} - -PvrEglSurfaceHolder::~PvrEglSurfaceHolder() -{ - if (surface != EGL_NO_SURFACE) - eglDestroySurface(dpy, surface); - if (dpy != EGL_NO_DISPLAY) - eglTerminate(dpy); - if (tempSurface) - pvrQwsDestroyDrawable(tempSurface); -} - -// Add a real EGL surface to the system. -void PvrEglSurfaceHolder::addSurface() -{ - ++numRealSurfaces; - if (numRealSurfaces == 1) { - // Destroy the temporary surface while some other application - // is making use of the EGL sub-system for 3D rendering. - if (surface != EGL_NO_SURFACE) { - eglDestroySurface(dpy, surface); - surface = EGL_NO_SURFACE; - } - } -} - -// Remove an actual EGL surface from the system. -void PvrEglSurfaceHolder::removeSurface() -{ - if (numRealSurfaces > 0) { - --numRealSurfaces; - if (numRealSurfaces == 0) { - // The last real EGL surface has been destroyed, so re-create - // the temporary surface. There is a race condition here in - // that Qtopia could allocate a lot of memory just after - // the real EGL surface is destroyed but before we could - // create the temporary surface again. - if (surface == EGL_NO_SURFACE && dpy != EGL_NO_DISPLAY) { - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not re-create the temporary EGL surface"); - } - } - } -} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 1c79f8e..8bf42c7 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -59,24 +59,6 @@ private: int displayId; }; -class PvrEglSurfaceHolder : public QObject -{ - Q_OBJECT -public: - PvrEglSurfaceHolder(QObject *parent=0); - ~PvrEglSurfaceHolder(); - - void addSurface(); - void removeSurface(); - -private: - int numRealSurfaces; - PvrQwsDrawable *tempSurface; - EGLDisplay dpy; - EGLConfig config; - EGLSurface surface; -}; - class PvrEglScreen : public QGLScreen { public: @@ -105,7 +87,6 @@ private: int fd; int ttyfd, oldKdMode; - PvrEglSurfaceHolder *holder; QString ttyDevice; bool doGraphicsMode; }; diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 09c0ace..2c5ac21 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -53,7 +53,6 @@ PvrEglWindowSurface::PvrEglWindowSurface this->widget = widget; this->screen = screen; - this->holder = 0; this->pdevice = 0; QPoint pos = offset(widget); @@ -78,7 +77,7 @@ PvrEglWindowSurface::PvrEglWindowSurface drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); } -PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) +PvrEglWindowSurface::PvrEglWindowSurface() : QWSGLWindowSurface() { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -86,9 +85,6 @@ PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) widget = 0; screen = 0; pdevice = 0; - - this->holder = holder; - holder->addSurface(); } PvrEglWindowSurface::~PvrEglWindowSurface() @@ -100,8 +96,6 @@ PvrEglWindowSurface::~PvrEglWindowSurface() if (drawable && pvrQwsReleaseWindow(drawable)) pvrQwsDestroyDrawable(drawable); - if (holder) - holder->removeSurface(); delete pdevice; } diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 0da3653..58a5fb2 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -46,13 +46,12 @@ #include "pvrqwsdrawable.h" class QScreen; -class PvrEglSurfaceHolder; class PvrEglWindowSurface : public QWSGLWindowSurface { public: PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); - PvrEglWindowSurface(PvrEglSurfaceHolder *holder); + PvrEglWindowSurface(); ~PvrEglWindowSurface(); QString key() const { return QLatin1String("PvrEgl"); } @@ -78,7 +77,6 @@ private: QWidget *widget; PvrQwsDrawable *drawable; QScreen *screen; - PvrEglSurfaceHolder *holder; QPaintDevice *pdevice; }; |