diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-11 23:00:11 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-11 23:00:11 (GMT) |
commit | ce35bb2c0bd3f9ca451d9099177692eaa261b8a5 (patch) | |
tree | 58cebbdc81e13a9dbed5a3f4eda6fbc5ad09efeb | |
parent | ad925d41019d5e5c47143ab91f775f970995ad0d (diff) | |
parent | 7a81735272b5ee065f499a492cca4b4a703e0659 (diff) | |
download | Qt-ce35bb2c0bd3f9ca451d9099177692eaa261b8a5.zip Qt-ce35bb2c0bd3f9ca451d9099177692eaa261b8a5.tar.gz Qt-ce35bb2c0bd3f9ca451d9099177692eaa261b8a5.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-water
51 files changed, 693 insertions, 218 deletions
@@ -3314,12 +3314,9 @@ if [ -z "$QT_INSTALL_PREFIX" ]; then if [ "$PLATFORM" != "$XPLATFORM" ]; then QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" fi - elif [ -d "$EPOCROOT" ]; then - case "$XPLATFORM" in *symbian*) - QT_INSTALL_PREFIX="$EPOCROOT/epoc32/" - QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/" - ;; - esac + elif [ -d "$EPOCROOT" ] && echo $XPLATFORM | grep symbian > /dev/null; then + QT_INSTALL_PREFIX="$EPOCROOT/epoc32/" + QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/" else QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION fi diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index dbedc1d..9c5f3c8 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -739,6 +739,9 @@ \o \c AllFiles when \l{http://developer.symbian.org/wiki/index.php/Capabilities_%28Symbian_Signed%29/AllFiles_Capability}{accessing specific areas.} \row \o QtNetwork \o \c NetworkServices is basically always required for this module. + \o \c ReadUserData is required to include all the phone's SSL certificates in the system's default CA certificate list + (for example those added by the user or stored in the SIM card), + without this capability only the CA certs built into the phone are used. \row \o QtMultiMedia \o \c UserEnvironment if QAudioInput is used. \endtable diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index c638eec..3a3189c 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1029,6 +1029,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, d->contentItem->setWidth(width()); emit contentWidthChanged(); } + // Make sure that we're entirely in view. + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { + int oldDuration = d->fixupDuration; + d->fixupDuration = 0; + d->fixupX(); + d->fixupDuration = oldDuration; + } } if (newGeometry.height() != oldGeometry.height()) { if (yflick()) @@ -1037,6 +1044,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, d->contentItem->setHeight(height()); emit contentHeightChanged(); } + // Make sure that we're entirely in view. + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { + int oldDuration = d->fixupDuration; + d->fixupDuration = 0; + d->fixupY(); + d->fixupDuration = oldDuration; + } } if (changed) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index ed28185..bffe681 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -502,7 +502,8 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, property.write(expression); } else if (hasValidSignal(object, propertyName)) { QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); - QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber()); } else if (property.isProperty()) { QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); binding->setTarget(property); diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp index 3334455..3b79129 100644 --- a/src/gui/kernel/qmotifdnd_x11.cpp +++ b/src/gui/kernel/qmotifdnd_x11.cpp @@ -385,7 +385,10 @@ static void DndReadSourceProperty(Display * dpy, static void DndWriteReceiverProperty(Display * dpy, Window window, unsigned char protocol_style) { - DndReceiverProp receiver_prop ; + DndReceiverProp receiver_prop; + + // squelch potential valgrind errors about uninitialized reads + memset(&receiver_prop, 0, sizeof(receiver_prop)); receiver_prop.byte_order = DndByteOrder() ; receiver_prop.protocol_version = DND_PROTOCOL_VERSION; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 0a0987a..05eb6cb 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -88,18 +88,6 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request) { - QNetworkRequest::CacheLoadControl mode = - static_cast<QNetworkRequest::CacheLoadControl>( - request.attribute(QNetworkRequest::CacheLoadControlAttribute, - QNetworkRequest::PreferNetwork).toInt()); - if (mode == QNetworkRequest::AlwaysCache - && (op == QNetworkAccessManager::GetOperation - || op == QNetworkAccessManager::HeadOperation)) { - QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend; - backend->manager = this; - return backend; - } - if (!factoryDataShutdown) { QMutexLocker locker(&factoryData()->mutex); QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 4fe6de6..7faa5cb 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -115,7 +115,6 @@ public: virtual bool start(); #endif virtual void closeDownstreamChannel() = 0; - virtual bool waitForDownstreamReadyRead(int msecs) = 0; // slot-like: virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 73491a9..e78694e 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -132,18 +132,6 @@ void QNetworkAccessCacheBackend::closeUpstreamChannel() Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); } -bool QNetworkAccessCacheBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO , "This function show not have been called!"); - return false; -} - -bool QNetworkAccessCacheBackend::waitForUpstreamBytesWritten(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); - return false; -} - void QNetworkAccessCacheBackend::upstreamReadyRead() { Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h index df001ab..32581d5 100644 --- a/src/network/access/qnetworkaccesscachebackend_p.h +++ b/src/network/access/qnetworkaccesscachebackend_p.h @@ -69,8 +69,6 @@ public: void open(); void closeDownstreamChannel(); void closeUpstreamChannel(); - bool waitForDownstreamReadyRead(int msecs); - bool waitForUpstreamBytesWritten(int msecs); void upstreamReadyRead(); void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index cd077e7..5f99f84 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -278,12 +278,6 @@ void QNetworkAccessDebugPipeBackend::socketConnected() { } -bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) -{ - Q_UNUSED(ms); - qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()"); - return false; -} #endif diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 58a4fd0..918a813 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -71,7 +71,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 4560153..65f19ca 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -203,12 +203,6 @@ void QNetworkAccessFileBackend::closeDownstreamChannel() } } -bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT(operation() == QNetworkAccessManager::GetOperation); - return readMoreFromFile(); -} - void QNetworkAccessFileBackend::downstreamReadyWrite() { Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend", diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index 6df8710..d1dbe8d 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -69,7 +69,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 1a59011..d1a18d3 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -182,23 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel() #endif } -bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) -{ - if (!ftp) - return false; - - if (ftp->bytesAvailable()) { - ftpReadyRead(); - return true; - } - - if (ms == 0) - return false; - - qCritical("QNetworkAccess: FTP backend does not support waitForReadyRead()"); - return false; -} - void QNetworkAccessFtpBackend::downstreamReadyWrite() { if (state == Transferring && ftp && ftp->bytesAvailable()) diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 737fa72..8a2bfc3 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -87,7 +87,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 2a0daf8..80b05a4 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -674,26 +674,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel() // this indicates that the user closed the stream while the reply isn't finished yet } -bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) -{ - Q_ASSERT(http); - - if (httpReply->bytesAvailable()) { - readFromHttp(); - return true; - } - - if (msecs == 0) { - // no bytes available in the socket and no waiting - return false; - } - - // ### FIXME - qCritical("QNetworkAccess: HTTP backend does not support waitForReadyRead()"); - return false; -} - - void QNetworkAccessHttpBackend::downstreamReadyWrite() { readFromHttp(); diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 568b2ee..5de3429 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -79,7 +79,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); virtual void setDownstreamLimited(bool b); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e5f4d5a..effd79e 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -54,6 +54,7 @@ #include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessdatabackend_p.h" #include "qnetworkaccessdebugpipebackend_p.h" +#include "qnetworkaccesscachebackend_p.h" #include "qfilenetworkreply_p.h" #include "QtCore/qbuffer.h" @@ -970,6 +971,26 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } + // A request with QNetworkRequest::AlwaysCache does not need any bearer management + QNetworkRequest::CacheLoadControl mode = + static_cast<QNetworkRequest::CacheLoadControl>( + req.attribute(QNetworkRequest::CacheLoadControlAttribute, + QNetworkRequest::PreferNetwork).toInt()); + if (mode == QNetworkRequest::AlwaysCache + && (op == QNetworkAccessManager::GetOperation + || op == QNetworkAccessManager::HeadOperation)) { + // FIXME Implement a QNetworkReplyCacheImpl instead, see QTBUG-15106 + QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + QNetworkReplyImplPrivate *priv = reply->d_func(); + priv->manager = this; + priv->backend = new QNetworkAccessCacheBackend(); + priv->backend->manager = this->d_func(); + priv->backend->setParent(reply); + priv->backend->reply = priv; + priv->setup(op, req, outgoingData); + return reply; + } + #ifndef QT_NO_BEARERMANAGEMENT // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 2910538..426b07a 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -51,6 +51,7 @@ #include <QtCore/qdebug.h> #include <QtCore/qdir.h> #include <QtCore/qdiriterator.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qfile.h> #include <QtCore/qfileinfo.h> #include <QtCore/qmutex.h> @@ -574,7 +575,7 @@ void QSslSocketPrivate::resetDefaultCiphers() #if defined(Q_OS_SYMBIAN) CSymbianCertificateRetriever::CSymbianCertificateRetriever() : CActive(CActive::EPriorityStandard), - iSequenceError(KErrNone) + iCertificatePtr(0,0,0), iSequenceError(KErrNone) { } @@ -618,6 +619,11 @@ void CSymbianCertificateRetriever::doThreadEntryL() iCertStore = CUnifiedCertStore::NewLC(qt_s60GetRFs(), EFalse); iCertFilter = CCertAttributeFilter::NewLC(); + // only interested in CA certs + iCertFilter->SetOwnerType(ECACertificate); + // only interested in X.509 format (we don't support WAP formats) + iCertFilter->SetFormat(EX509Certificate); + // Kick off the sequence by initializing the cert store iState = Initializing; iCertStore->Initialize(iStatus); @@ -637,6 +643,7 @@ void CSymbianCertificateRetriever::doThreadEntryL() TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams) { + User::SetCritical(User::EProcessCritical); CTrapCleanup* cleanupStack = CTrapCleanup::New(); CSymbianCertificateRetriever* self = (CSymbianCertificateRetriever*) aParams; @@ -658,7 +665,17 @@ void CSymbianCertificateRetriever::ConstructL() void CSymbianCertificateRetriever::DoCancel() { - // We never cancel the sequence + switch(iState) { + case Initializing: + iCertStore->CancelInitialize(); + break; + case Listing: + iCertStore->CancelList(); + break; + case RetrievingCertificates: + iCertStore->CancelGetCert(); + break; + } } TInt CSymbianCertificateRetriever::RunError(TInt aError) @@ -671,37 +688,51 @@ TInt CSymbianCertificateRetriever::RunError(TInt aError) void CSymbianCertificateRetriever::GetCertificateL() { - CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex]; - iCertificateData.resize(certInfo->Size()); - TPtr8 des((TUint8*)iCertificateData.data(), 0, iCertificateData.size()); - iCertStore->Retrieve(*certInfo, des, iStatus); - iState = RetrievingCertificates; - SetActive(); + if (iCurrentCertIndex < iCertInfos.Count()) { + CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex++]; + iCertificateData = QByteArray(); + QT_TRYCATCH_LEAVING(iCertificateData.resize(certInfo->Size())); + iCertificatePtr.Set((TUint8*)iCertificateData.data(), 0, iCertificateData.size()); +#ifdef QSSLSOCKET_DEBUG + qDebug() << "getting " << qt_TDesC2QString(certInfo->Label()) << " size=" << certInfo->Size(); + qDebug() << "format=" << certInfo->CertificateFormat(); + qDebug() << "ownertype=" << certInfo->CertificateOwnerType(); + qDebug() << "type=" << hex << certInfo->Type().iUid; +#endif + iCertStore->Retrieve(*certInfo, iCertificatePtr, iStatus); + iState = RetrievingCertificates; + SetActive(); + } else { + //reached end of list + CActiveScheduler::Stop(); + } } void CSymbianCertificateRetriever::RunL() { +#ifdef QSSLSOCKET_DEBUG + qDebug() << "CSymbianCertificateRetriever::RunL status " << iStatus.Int() << " count " << iCertInfos.Count() << " index " << iCurrentCertIndex; +#endif switch (iState) { case Initializing: + User::LeaveIfError(iStatus.Int()); // initialise fail means pointless to continue iState = Listing; iCertStore->List(iCertInfos, *iCertFilter, iStatus); SetActive(); break; case Listing: + User::LeaveIfError(iStatus.Int()); // listing fail means pointless to continue iCurrentCertIndex = 0; GetCertificateL(); break; case RetrievingCertificates: - iCertificates->append(iCertificateData); - iCertificateData = QByteArray(); - iCurrentCertIndex++; - if (iCurrentCertIndex < iCertInfos.Count()) - GetCertificateL(); + if (iStatus.Int() == KErrNone) + iCertificates->append(iCertificateData); else - // Stop the scheduler to return to the thread entry function - CActiveScheduler::Stop(); + qWarning() << "CSymbianCertificateRetriever: failed to retreive a certificate, error " << iStatus.Int(); + GetCertificateL(); break; } } @@ -710,6 +741,10 @@ void CSymbianCertificateRetriever::RunL() QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() { ensureInitialized(); +#ifdef QSSLSOCKET_DEBUG + QElapsedTimer timer; + timer.start(); +#endif QList<QSslCertificate> systemCerts; #if defined(Q_OS_MAC) CFArrayRef cfCerts; @@ -808,10 +843,18 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() retriever->GetCertificates(certs); foreach (const QByteArray &encodedCert, certs) { QSslCertificate cert(encodedCert, QSsl::Der); - if (!cert.isNull()) + if (!cert.isNull()) { +#ifdef QSSLSOCKET_DEBUG + qDebug() << "imported certificate: " << cert.issuerInfo(QSslCertificate::CommonName); +#endif systemCerts.append(cert); + } } #endif +#ifdef QSSLSOCKET_DEBUG + qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms"; + qDebug() << "imported " << systemCerts.count() << " certificates"; +#endif return systemCerts; } diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index dec98ae..b59a6c9 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -165,6 +165,7 @@ private: CCertAttributeFilter* iCertFilter; TInt iCurrentCertIndex; QByteArray iCertificateData; + TPtr8 iCertificatePtr; QList<QByteArray>* iCertificates; TInt iSequenceError; }; diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h index 46029b9..b8c1018 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h @@ -93,7 +93,7 @@ struct QGLRect GLfloat right; GLfloat bottom; - operator QRectF() {return QRectF(left, top, right-left, bottom-top);} + operator QRectF() const {return QRectF(left, top, right-left, bottom-top);} }; class QGL2PEXVertexArray diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 922a501..9cb3955 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -1,7 +1,7 @@ TARGET = qcorewlanbearer include(../../qpluginbase.pri) -QT = core gui network +QT = core network LIBS += -framework Foundation -framework SystemConfiguration contains(QT_CONFIG, corewlan) { diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 844e38b..9946b17 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -64,12 +64,17 @@ #include <Foundation/NSLock.h> #include <SystemConfiguration/SCNetworkConfiguration.h> -#include <private/qt_cocoa_helpers_mac_p.h> #include "private/qcore_mac_p.h" #include <net/if.h> #include <ifaddrs.h> +inline QString qt_NSStringToQString(const NSString *nsstr) +{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); } + +inline NSString *qt_QStringToNSString(const QString &qstr) +{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; } + @interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject { @@ -93,11 +98,12 @@ - (id) init { [locker lock]; - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; notificationCenter = [NSNotificationCenter defaultCenter]; currentInterface = [CWInterface interfaceWithName:nil]; [notificationCenter addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil]; [locker unlock]; + [autoreleasepool release]; return self; } @@ -161,10 +167,10 @@ void QScanThread::quit() void QScanThread::run() { - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; QStringList found; mutex.lock(); - CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)]; + CWInterface *currentInterface = [CWInterface interfaceWithName:qt_QStringToNSString(interfaceName)]; mutex.unlock(); if([currentInterface power]) { @@ -182,14 +188,14 @@ void QScanThread::run() for(uint row=0; row < [apArray count]; row++ ) { apNetwork = [apArray objectAtIndex:row]; - const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]); + const QString networkSsid = qt_NSStringToQString([apNetwork ssid]); const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); found.append(id); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; bool known = isKnownSsid(networkSsid); if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) { + if( networkSsid == qt_NSStringToQString( [currentInterface ssid])) { state = QNetworkConfiguration::Active; } } @@ -232,7 +238,7 @@ void QScanThread::run() } if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) { + if( networkSsid == qt_NSStringToQString([currentInterface ssid])) { state = QNetworkConfiguration::Active; } } @@ -251,6 +257,7 @@ void QScanThread::run() } } emit networksChanged(); + [autoreleasepool release]; } QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose) @@ -290,7 +297,7 @@ void QScanThread::getUserConfigurations() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; userProfiles.clear(); NSArray *wifiInterfaces = [CWInterface supportedInterfaces]; @@ -310,10 +317,10 @@ void QScanThread::getUserConfigurations() NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; for(NSString *ssidkey in thisSsidarray) { - QString thisSsid = qt_mac_NSStringToQString(ssidkey); + QString thisSsid = qt_NSStringToQString(ssidkey); if(!userProfiles.contains(thisSsid)) { QMap <QString,QString> map; - map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName)); + map.insert(thisSsid, qt_NSStringToQString(nsInterfaceName)); userProfiles.insert(thisSsid, map); } } @@ -322,7 +329,7 @@ void QScanThread::getUserConfigurations() // 802.1X user profiles QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist"; - NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease]; + NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_QStringToNSString(userProfilePath)] autorelease]; if(eapDict != nil) { NSString *profileStr= @"Profiles"; NSString *nameStr = @"UserDefinedName"; @@ -341,15 +348,15 @@ void QScanThread::getUserConfigurations() QString ssid; for(int i = 0; i < dictSize; i++) { if([nameStr isEqualToString:keys[i]]) { - networkName = qt_mac_NSStringToQString(objects[i]); + networkName = qt_NSStringToQString(objects[i]); } if([networkSsidStr isEqualToString:keys[i]]) { - ssid = qt_mac_NSStringToQString(objects[i]); + ssid = qt_NSStringToQString(objects[i]); } if(!userProfiles.contains(networkName) && !ssid.isEmpty()) { QMap<QString,QString> map; - map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName)); + map.insert(ssid, qt_NSStringToQString(nsInterfaceName)); userProfiles.insert(networkName, map); } } @@ -358,6 +365,7 @@ void QScanThread::getUserConfigurations() } } } + [autoreleasepool release]; } QString QScanThread::getSsidFromNetworkName(const QString &name) @@ -434,7 +442,7 @@ QCoreWlanEngine::~QCoreWlanEngine() void QCoreWlanEngine::initialize() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; if([[CWInterface supportedInterfaces] count] > 0 && !listener) { listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init]; @@ -446,6 +454,7 @@ void QCoreWlanEngine::initialize() storeSession = NULL; startNetworkChangeLoop(); + [autoreleasepool release]; } @@ -466,11 +475,11 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id) void QCoreWlanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; QString interfaceString = getInterfaceFromId(id); CWInterface *wifiInterface = - [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)]; + [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)]; if ([wifiInterface power]) { NSError *err = nil; @@ -488,9 +497,9 @@ void QCoreWlanEngine::connectToId(const QString &id) NSArray *array = [CW8021XProfile allUser8021XProfiles]; for (NSUInteger i = 0; i < [array count]; ++i) { - const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName]))); + const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] userDefinedName]))); - const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid]))); + const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] ssid]))); if (id == networkNameHashCheck || id == ssidHash) { const QString thisName = scanThread->getSsidFromNetworkName(id); @@ -523,7 +532,7 @@ void QCoreWlanEngine::connectToId(const QString &id) [NSNumber numberWithBool:YES], kCWScanKeyMerge, [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, [NSNumber numberWithInteger:100], kCWScanKeyRestTime, - qt_mac_QStringToNSString(wantedSsid), kCWScanKeySSID, + qt_QStringToNSString(wantedSsid), kCWScanKeySSID, nil]; NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err]; @@ -532,7 +541,7 @@ void QCoreWlanEngine::connectToId(const QString &id) for(uint row=0; row < [scanArray count]; row++ ) { CWNetwork *apNetwork = [scanArray objectAtIndex:row]; - if(wantedSsid == qt_mac_NSStringToQString([apNetwork ssid])) { + if(wantedSsid == qt_NSStringToQString([apNetwork ssid])) { if(!using8021X) { SecKeychainAttribute attributes[3]; @@ -599,18 +608,19 @@ void QCoreWlanEngine::connectToId(const QString &id) return; } } else { - qDebug() <<"associate ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]); + qDebug() <<"associate ERROR"<< qt_NSStringToQString([err localizedDescription ]); } } } //end scan network } else { - qDebug() <<"scan ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]); + qDebug() <<"scan ERROR"<< qt_NSStringToQString([err localizedDescription ]); } emit connectionError(id, InterfaceLookupError); } locker.unlock(); emit connectionError(id, InterfaceLookupError); + [autoreleasepool release]; } void QCoreWlanEngine::disconnectFromId(const QString &id) @@ -618,10 +628,10 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) QMutexLocker locker(&mutex); QString interfaceString = getInterfaceFromId(id); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; CWInterface *wifiInterface = - [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)]; + [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)]; [wifiInterface disassociate]; if ([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { @@ -629,6 +639,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) emit connectionError(id, DisconnectionError); locker.relock(); } + [autoreleasepool release]; } void QCoreWlanEngine::requestUpdate() @@ -641,27 +652,30 @@ void QCoreWlanEngine::doRequestUpdate() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; NSArray *wifiInterfaces = [CWInterface supportedInterfaces]; for (uint row = 0; row < [wifiInterfaces count]; ++row) { - scanThread->interfaceName = qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]); + scanThread->interfaceName = qt_NSStringToQString([wifiInterfaces objectAtIndex:row]); scanThread->start(); } locker.unlock(); + [autoreleasepool release]; } bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) { QMutexLocker locker(&mutex); - + bool haswifi = false; if(hasWifi) { - QMacCocoaAutoReleasePool pool; - CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)]; - if([defaultInterface power]) - return true; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_QStringToNSString(wifiDeviceName)]; + if([defaultInterface power]) { + haswifi = true; + } + [autoreleasepool release]; } - return false; + return haswifi; } @@ -853,7 +867,7 @@ quint64 QCoreWlanEngine::bytesReceived(const QString &id) quint64 QCoreWlanEngine::startTime(const QString &id) { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; quint64 timestamp = 0; NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"; @@ -884,7 +898,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) bool ok = false; for(int i = 0; i < dictSize; i++) { if([ssidStr isEqualToString:keys[i]]) { - const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i]))); + const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString(objects[i]))); if(ident == id) { ok = true; } @@ -900,6 +914,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) } } } + [autoreleasepool release]; return timestamp; } diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro index 464cc1c..6700cda 100644 --- a/src/plugins/bearer/icd/icd.pro +++ b/src/plugins/bearer/icd/icd.pro @@ -1,7 +1,7 @@ TARGET = qicdbearer include(../../qpluginbase.pri) -QT += network dbus +QT = core network dbus QMAKE_CXXFLAGS *= $$QT_CFLAGS_DBUS $$QT_CFLAGS_CONNSETTINGS LIBS += $$QT_LIBS_CONNSETTINGS diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 4869eba..c16a242 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -55,6 +55,7 @@ #include <private/qpixmap_raster_p.h> #include <private/qimagepixmapcleanuphooks_p.h> + QT_BEGIN_NAMESPACE class SurfaceCache; @@ -112,7 +113,11 @@ public: static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; } #endif - void prepareForBlit(bool alpha); + enum BlitFlag { + HasAlpha = 0x1, + Premultiplied = 0x2 + }; + void prepareForBlit(uint blitFlags); IDirectFBSurface *surface; @@ -616,7 +621,12 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE bool release; IDirectFBSurface *imgSurface = d->getSurface(image, &release); - d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface)); + uint blitFlags = 0; + if (image.hasAlphaChannel()) + blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; + if (QDirectFBScreen::isPremultiplied(image.format())) + blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; + d->prepareForBlit(blitFlags); CLIPPED_PAINT(d->blit(r, imgSurface, sr)); if (release) { #if (Q_DIRECTFB_VERSION >= 0x010000) @@ -655,8 +665,14 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, QRasterPaintEngine::drawImage(r, *img, sr); } else { QDirectFBPaintEnginePrivate::unlock(dfbData); - d->prepareForBlit(pixmap.hasAlphaChannel()); IDirectFBSurface *s = dfbData->directFBSurface(); + uint blitFlags = 0; + if (pixmap.hasAlphaChannel()) + blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; + if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) + blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; + + d->prepareForBlit(blitFlags); CLIPPED_PAINT(d->blit(r, s, sr)); } } @@ -978,7 +994,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_SourceOver: compositionModeStatus &= ~PorterDuff_AlwaysBlend; - surface->SetPorterDuff(surface, DSPD_NONE); + surface->SetPorterDuff(surface, DSPD_SRC_OVER); break; case QPainter::CompositionMode_DestinationOver: surface->SetPorterDuff(surface, DSPD_DST_OVER); @@ -1031,13 +1047,18 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) } } -void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) +void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags) { - DFBSurfaceBlittingFlags blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + if (flags & Premultiplied) + blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + if (flags & HasAlpha) + blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; if (opacity != 255) { blittingFlags |= DSBLIT_BLEND_COLORALPHA; + surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); } - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); + surface->SetBlittingFlags(surface, blittingFlags); } @@ -1154,13 +1175,18 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix QPointF offset = off; Q_ASSERT(transform.type() <= QTransform::TxScale); - prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); + IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); + uint blitFlags = 0; + if (dfbData->hasAlphaChannel()) + blitFlags |= HasAlpha; + if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) + blitFlags |= Premultiplied; + prepareForBlit(blitFlags); QDirectFBPaintEnginePrivate::unlock(dfbData); const QSize pixmapSize = dfbData->size(); - IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); if (transform.isScaling()) { Q_ASSERT(supportsStretchBlit()); Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp index 611c962..dff80a4 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp @@ -47,6 +47,7 @@ bool QMeeGoExtensions::initialized = false; bool QMeeGoExtensions::hasImageShared = false; bool QMeeGoExtensions::hasSurfaceScaling = false; bool QMeeGoExtensions::hasLockSurface = false; +bool QMeeGoExtensions::hasFenceSync = false; /* Extension funcs */ @@ -54,8 +55,12 @@ typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR, typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*); typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK); typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint); -typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay, EGLSurface, const EGLint*); +typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay, EGLSurface); +typedef EGLSyncKHR (EGLAPIENTRY *eglCreateSyncKHRFunc)(EGLDisplay, EGLenum, const EGLint*); +typedef EGLBoolean (EGLAPIENTRY *eglDestroySyncKHRFunc)(EGLDisplay, EGLSyncKHR); +typedef EGLint (EGLAPIENTRY *eglClientWaitSyncKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR); +typedef EGLBoolean (EGLAPIENTRY *eglGetSyncAttribKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLint*); static eglQueryImageNOKFunc _eglQueryImageNOK = 0; static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0; @@ -63,6 +68,10 @@ static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0; static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0; static eglLockSurfaceKHRFunc _eglLockSurfaceKHR = 0; static eglUnlockSurfaceKHRFunc _eglUnlockSurfaceKHR = 0; +static eglCreateSyncKHRFunc _eglCreateSyncKHR = 0; +static eglDestroySyncKHRFunc _eglDestroySyncKHR = 0; +static eglClientWaitSyncKHRFunc _eglClientWaitSyncKHR = 0; +static eglGetSyncAttribKHRFunc _eglGetSyncAttribKHR = 0; /* Public */ @@ -76,15 +85,15 @@ void QMeeGoExtensions::ensureInitialized() EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props) { - if (! hasImageShared) + if (!hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); - + return _eglCreateSharedImageNOK(dpy, image, props); } bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v) { - if (! hasImageShared) + if (!hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); return _eglQueryImageNOK(dpy, image, prop, v); @@ -92,7 +101,7 @@ bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLin bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img) { - if (! hasImageShared) + if (!hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); return _eglDestroySharedImageNOK(dpy, img); @@ -100,7 +109,7 @@ bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedI bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height) { - if (! hasSurfaceScaling) + if (!hasSurfaceScaling) qFatal("EGL_NOK_surface_scaling not found but trying to use capability!"); return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height); @@ -108,7 +117,7 @@ bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surfac bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list) { - if (! hasLockSurface) + if (!hasLockSurface) qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!"); return _eglLockSurfaceKHR(display, surface, attrib_list); @@ -116,19 +125,51 @@ bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, bool QMeeGoExtensions::eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface) { - if (! hasLockSurface) + if (!hasLockSurface) qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!"); return _eglUnlockSurfaceKHR(display, surface); } +EGLSyncKHR QMeeGoExtensions::eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) +{ + if (!hasFenceSync) + qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); + + return _eglCreateSyncKHR(dpy, type, attrib_list); +} + +bool QMeeGoExtensions::eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) +{ + if (!hasFenceSync) + qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); + + return _eglDestroySyncKHR(dpy, sync); +} + +EGLint QMeeGoExtensions::eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) +{ + if (!hasFenceSync) + qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); + + return _eglClientWaitSyncKHR(dpy, sync, flags, timeout); +} + +EGLBoolean QMeeGoExtensions::eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) +{ + if (!hasFenceSync) + qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); + + return _eglGetSyncAttribKHR(dpy, sync, attribute, value); +} + /* Private */ void QMeeGoExtensions::initialize() { QGLContext *ctx = (QGLContext *) QGLContext::currentContext(); qt_resolve_eglimage_gl_extensions(ctx); - + if (QEgl::hasExtension("EGL_NOK_image_shared")) { qDebug("MeegoGraphics: found EGL_NOK_image_shared"); _eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK"); @@ -136,15 +177,15 @@ void QMeeGoExtensions::initialize() _eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK"); _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR"); _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR"); - + Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK); hasImageShared = true; } - + if (QEgl::hasExtension("EGL_NOK_surface_scaling")) { qDebug("MeegoGraphics: found EGL_NOK_surface_scaling"); _eglSetSurfaceScalingNOK = (eglSetSurfaceScalingNOKFunc) eglGetProcAddress("eglSetSurfaceScalingNOK"); - + Q_ASSERT(_eglSetSurfaceScalingNOK); hasSurfaceScaling = true; } @@ -153,9 +194,20 @@ void QMeeGoExtensions::initialize() qDebug("MeegoGraphics: found EGL_KHR_lock_surface2"); _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR"); _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR"); - + Q_ASSERT(_eglLockSurfaceKHR && _eglUnlockSurfaceKHR); hasLockSurface = true; } + + if (QEgl::hasExtension("EGL_KHR_fence_sync")) { + qDebug("MeegoGraphics: found EGL_KHR_fence_sync"); + _eglCreateSyncKHR = (eglCreateSyncKHRFunc) eglGetProcAddress("eglCreateSyncKHR"); + _eglDestroySyncKHR = (eglDestroySyncKHRFunc) eglGetProcAddress("eglDestroySyncKHR"); + _eglClientWaitSyncKHR = (eglClientWaitSyncKHRFunc) eglGetProcAddress("eglClientWaitSyncKHR"); + _eglGetSyncAttribKHR = (eglGetSyncAttribKHRFunc) eglGetProcAddress("eglGetSyncAttribKHR"); + + Q_ASSERT(_eglCreateSyncKHR && _eglDestroySyncKHR && _eglClientWaitSyncKHR && _eglGetSyncAttribKHR); + hasFenceSync = true; + } } diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h index 9e78caf..49a1e30 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.h +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h @@ -77,6 +77,23 @@ typedef void* EGLNativeSharedImageTypeNOK; #define EGL_WRITE_SURFACE_BIT_KHR 0x0002 #endif +#ifndef EGL_SYNC_FENCE_KHR +#define EGL_SYNC_FENCE_KHR 0x30F9 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) +typedef void* EGLSyncKHR; +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +#endif + /* Class */ class QMeeGoExtensions @@ -90,6 +107,10 @@ public: static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height); static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface); + static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); + static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); + static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); + static EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); private: static void initialize(); @@ -98,6 +119,7 @@ private: static bool hasImageShared; static bool hasSurfaceScaling; static bool hasLockSurface; + static bool hasFenceSync; }; #endif diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 67d760c..063af13 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -82,12 +82,12 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { - // Long story short: without this it's possible to hit an - // uninitialized paintDevice due to a Qt bug too complex to even - // explain here... not to mention fix without going crazy. + // Long story short: without this it's possible to hit an + // unitialized paintDevice due to a Qt bug too complex to even + // explain here... not to mention fix without going crazy. // MDK QGLShareContextScope ctx(qt_gl_share_widget()->context()); - + return new QRasterPixmapData(type); } @@ -103,8 +103,8 @@ QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin) if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource)) return new QMeeGoPixmapData(); - } - + } + return new QRasterPixmapData(origin->pixelType()); } @@ -155,7 +155,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl qFatal("For egl shared images, the soft image has to be ARGB32_Premultiplied or RGB32"); return NULL; } - + if (QMeeGoGraphicsSystem::meeGoRunning()) { QMeeGoPixmapData *pmd = new QMeeGoPixmapData; pmd->fromEGLSharedImage(handle, softImage); @@ -177,9 +177,9 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap) { QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData(); - + // Basic sanity check to make sure this is really a QMeeGoPixmapData... - if (pmd->classId() != QPixmapData::OpenGLClass) + if (pmd->classId() != QPixmapData::OpenGLClass) qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!"); pmd->updateFromSoftImage(); @@ -218,10 +218,10 @@ QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(Qt::HANDLE ha return new QMeeGoLivePixmapData(handle); } -QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap) +QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap, void* fenceSync) { QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data()); - return pixmapData->lock(); + return pixmapData->lock(fenceSync); } bool QMeeGoGraphicsSystem::releaseLiveTexture(QPixmap *pixmap, QImage *image) @@ -236,6 +236,20 @@ Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle(QPixmap *pixmap) return pixmapData->handle(); } +void* QMeeGoGraphicsSystem::createFenceSync() +{ + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QMeeGoExtensions::ensureInitialized(); + return QMeeGoExtensions::eglCreateSyncKHR(QEgl::display(), EGL_SYNC_FENCE_KHR, NULL); +} + +void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync) +{ + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QMeeGoExtensions::ensureInitialized(); + QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync); +} + /* C API */ int qt_meego_image_to_egl_shared_image(const QImage &image) @@ -288,9 +302,9 @@ QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle) return QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(handle); } -QImage* qt_meego_live_texture_lock(QPixmap *pixmap) +QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync) { - return QMeeGoGraphicsSystem::lockLiveTexture(pixmap); + return QMeeGoGraphicsSystem::lockLiveTexture(pixmap, fenceSync); } bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image) @@ -302,3 +316,13 @@ Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap) { return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap); } + +void* qt_meego_create_fence_sync(void) +{ + return QMeeGoGraphicsSystem::createFenceSync(); +} + +void qt_meego_destroy_fence_sync(void* fs) +{ + return QMeeGoGraphicsSystem::destroyFenceSync(fs); +} diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index 2697f0f..1e50f00 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -69,10 +69,13 @@ public: static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format); static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle); - static QImage *lockLiveTexture(QPixmap* pixmap); + static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync); static bool releaseLiveTexture(QPixmap *pixmap, QImage *image); static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap); + static void* createFenceSync(); + static void destroyFenceSync(void* fenceSync); + private: static bool meeGoRunning(); static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap); @@ -95,9 +98,11 @@ extern "C" { Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent); Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format); Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle); - Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap); + Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync); Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image); Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap); + Q_DECL_EXPORT void* qt_meego_create_fence_sync(void); + Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs); } #endif diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp index 405b765..16096c9 100644 --- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qmeegolivepixmapdata.h" -#include "qmeegoextensions.h" #include "qmeegorasterpixmapdata.h" #include <private/qimage_p.h> #include <private/qwindowsurface_gl_p.h> @@ -171,11 +170,18 @@ QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const return new QMeeGoRasterPixmapData(pixelType()); } -QImage* QMeeGoLivePixmapData::lock() +QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync) { QGLShareContextScope ctx(qt_gl_share_widget()->context()); QMeeGoExtensions::ensureInitialized(); + if (fenceSync) { + QMeeGoExtensions::eglClientWaitSyncKHR(QEgl::display(), + fenceSync, + EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, + EGL_FOREVER_KHR); + } + void *data = 0; int pitch = 0; EGLSurface surface = 0; @@ -214,7 +220,6 @@ bool QMeeGoLivePixmapData::release(QImage* /*img*/) if (QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), getSurfaceForBackingPixmap())) { lockedImage = QImage(); - glFinish(); return true; } else { lockedImage = QImage(); @@ -229,7 +234,7 @@ Qt::HANDLE QMeeGoLivePixmapData::handle() bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect) { - lock(); + lock(NULL); if (!lockedImage.isNull()) qt_scrollRectInImage(lockedImage, rect, QPoint(dx, dy)); diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h index 1d647f0..2c6854e 100644 --- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h +++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h @@ -43,6 +43,7 @@ #define MLIVEPIXMAPDATA_H #include <private/qpixmapdata_gl_p.h> +#include "qmeegoextensions.h" class QMeeGoLivePixmapData : public QGLPixmapData { @@ -50,16 +51,16 @@ public: QMeeGoLivePixmapData(int w, int h, QImage::Format format); QMeeGoLivePixmapData(Qt::HANDLE h); ~QMeeGoLivePixmapData(); - + QPixmapData *createCompatiblePixmapData() const; bool scroll(int dx, int dy, const QRect &rect); void initializeThroughEGLImage(); - - QImage* lock(); + + QImage* lock(EGLSyncKHR fenceSync); bool release(QImage *img); Qt::HANDLE handle(); - + EGLSurface getSurfaceForBackingPixmap(); void destroySurfaceForPixmapData(QPixmapData* pmd); diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index ac11188..691fc80 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -18,7 +18,7 @@ symbian { # This is necessary because both epoc32/include and Phonon contain videoplayer.h. # By making /epoc32/include the first SYSTEMINCLUDE, we ensure that # '#include <videoplayer.h>' picks up the Symbian header, as intended. - PREPEND_INCLUDEPATH = /epoc32/include + PREPEND_INCLUDEPATH = $${EPOCROOT}epoc32/include PREPEND_INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index f494106..e40458b 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2036,6 +2036,7 @@ void QScriptValue::setData(const QScriptValue &data) Q_D(QScriptValue); if (!d || !d->isObject()) return; + QScript::APIShim shim(d->engine); JSC::JSValue other = d->engine->scriptValueToJSCValue(data); if (d->jscValue.inherits(&QScriptObject::info)) { QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index dd229f1..228e755 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -78,6 +78,12 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object, scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id); if (flags & QScriptClass::HandlesReadAccess) { QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } slot.setValue(engine->scriptValueToJSCValue(value)); return true; } @@ -119,6 +125,12 @@ bool ClassObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object, attribs |= pflags & QScriptValue::UserRange; // Rather than calling the getter, we could return an access descriptor here. QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } descriptor.setDescriptor(engine->scriptValueToJSCValue(value), attribs); return true; } diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index b4dbe73..da6c76f 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -66,6 +66,7 @@ public: private slots: void newInstance(); void getAndSetProperty(); + void getProperty_invalidValue(); void enumerate(); void extension(); }; @@ -741,6 +742,26 @@ void tst_QScriptClass::getAndSetProperty() QVERIFY(!obj1.property(bar).isValid()); } +void tst_QScriptClass::getProperty_invalidValue() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess, + /*id=*/0, QScriptValue::ReadOnly, QScriptValue()); + QScriptValue obj = eng.newObject(&cls); + + QVERIFY(obj.property("foo").isUndefined()); + + eng.globalObject().setProperty("obj", obj); + QVERIFY(eng.evaluate("obj.hasOwnProperty('foo'))").toBool()); + // The JS environment expects that a valid value is returned, + // otherwise we could crash. + QVERIFY(eng.evaluate("obj.foo").isUndefined()); + QVERIFY(eng.evaluate("obj.foo + ''").isString()); + QVERIFY(eng.evaluate("Object.getOwnPropertyDescriptor(obj, 'foo').value").isUndefined()); + QVERIFY(eng.evaluate("Object.getOwnPropertyDescriptor(obj, 'foo').value +''").isString()); +} + void tst_QScriptClass::enumerate() { QScriptEngine eng; diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 639df36..53e2699 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2253,6 +2253,19 @@ void tst_QScriptValue::getSetData() QVERIFY(!object.data().isValid()); } +void tst_QScriptValue::setData_QTBUG15144() +{ + QScriptEngine eng; + QScriptValue obj = eng.newObject(); + for (int i = 0; i < 10000; ++i) { + // Create an object with property 'fooN' on it, and immediately kill + // the reference to the object so it and the property name become garbage. + eng.evaluate(QString::fromLatin1("o = {}; o.foo%0 = 10; o = null;").arg(i)); + // Setting the data will cause a JS string to be allocated, which could + // trigger a GC. This should not cause a crash. + obj.setData("foodfight"); + } +} class TestScriptClass : public QScriptClass { public: diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h index 462749a..aa6bc6c 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.h +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h @@ -216,6 +216,7 @@ private slots: void getSetProperty(); void arrayElementGetterSetter(); void getSetData(); + void setData_QTBUG15144(); void getSetScriptClass(); void call(); void construct(); diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/qsslcertificate/qsslcertificate.pro index d7671ea..b04dde3 100644 --- a/tests/auto/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/qsslcertificate/qsslcertificate.pro @@ -24,5 +24,6 @@ wince*: { DEFINES += SRCDIR=\\\".\\\" } else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" - TARGET.CAPABILITY = NetworkServices } + +symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 808299b..23f6a6c 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -2054,6 +2054,7 @@ void tst_QTextDocument::clonePreservesIndentWidth() doc->setIndentWidth(42); QTextDocument *clone = doc->clone(); QCOMPARE(clone->indentWidth(), qreal(42)); + delete clone; } void tst_QTextDocument::blockCount() diff --git a/tests/benchmarks/corelib/tools/qstring/data.cpp b/tests/benchmarks/corelib/tools/qstring/data.cpp index 6d1a069..d44a796 100644 --- a/tests/benchmarks/corelib/tools/qstring/data.cpp +++ b/tests/benchmarks/corelib/tools/qstring/data.cpp @@ -1,5 +1,8 @@ // This is a generated file - DO NOT EDIT -static const ushort stringCollectionData[] __attribute__((aligned(16))) = { + +#include "data.h" + +const ushort stringCollectionData[] __attribute__((aligned(16))) = { // #0 65535, 99, 111, 109, 112, 105, 108, 101, 114, 32, 118, 101, 114, 115, 105, 111, 110, 115, 47, @@ -1123,15 +1126,9 @@ static const ushort stringCollectionData[] __attribute__((aligned(16))) = { 65535, 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, 65535,65534,65533, // 5216 - - }; -static struct StringCollection -{ - int len; - int offset1, offset2; - ushort align1, align2; -} stringCollection[] = { + +const struct StringCollection stringCollection[] = { {18, 1, 29, 3666, 106}, // #0 {18, 53, 77, 106, 1978}, // #1 {20, 97, 125, 2850, 3210}, // #2 @@ -1274,8 +1271,8 @@ static struct StringCollection {12, 5153, 5169, 130, 2930}, // #139 {12, 5185, 5201, 242, 2930}, // #140 }; -static const int stringCollectionCount = 141; -static const int stringCollectionMaxLen = 51; +const int stringCollectionCount = 141; +const int stringCollectionMaxLen = 51; // average comparison length: 12.0922 // cache-line crosses: 6 (2.1%) // alignment histogram: diff --git a/tests/benchmarks/corelib/tools/qstring/data.h b/tests/benchmarks/corelib/tools/qstring/data.h index c7a7467..ce733fb 100644 --- a/tests/benchmarks/corelib/tools/qstring/data.h +++ b/tests/benchmarks/corelib/tools/qstring/data.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef DATA_H +#define DATA_H + #include <qglobal.h> struct StringCollection @@ -49,5 +52,7 @@ struct StringCollection }; extern const ushort stringCollectionData[]; -extern StringCollection stringCollection[]; +extern const StringCollection stringCollection[]; extern const int stringCollectionCount; + +#endif // DATA_H diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl index d027adb..48a8518 100644 --- a/tests/benchmarks/corelib/tools/qstring/generatelist.pl +++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl @@ -103,9 +103,10 @@ sub printUshortArray($$$) { return ($offset + $headpadding, $offset + $headpadding + $len + $tailpadding); } +print "// This is a generated file - DO NOT EDIT\n\n"; + print "#include \"data.h\"\n\n"; -print "// This is a generated file - DO NOT EDIT\n"; print "const ushort stringCollectionData[] __attribute__((aligned(64))) = {\n"; $count = 0; $offset = 0; @@ -160,11 +161,10 @@ while (1) { $totalsize += $len; $maxlen = $len if $len > $maxlen; } -print "\n};\n"; +print "};\n"; close IN; -print "struct StringCollection stringCollection[] = {\n"; - +print "const struct StringCollection stringCollection[] = {\n"; for $i (0..$count-1) { print " {", $data[$i]->{len}, ", ", diff --git a/tools/qconfig/qconfig.pro b/tools/qconfig/qconfig.pro index efbfcf2..171924f 100644 --- a/tools/qconfig/qconfig.pro +++ b/tools/qconfig/qconfig.pro @@ -6,5 +6,4 @@ build_all:!build_pass { } HEADERS = feature.h featuretreemodel.h graphics.h SOURCES = main.cpp feature.cpp featuretreemodel.cpp -INTERFACES = TARGET = qconfig diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync.cpp b/tools/qmeegographicssystemhelper/qmeegofencesync.cpp new file mode 100644 index 0000000..499e102 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegofencesync.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegofencesync.h" +#include "qmeegofencesync_p.h" +#include "qmeegoruntime.h" + +/* QMeeGoFenceSyncPrivate */ + +QMeeGoFenceSyncPrivate::QMeeGoFenceSyncPrivate() : syncObject(NULL) +{ +} + +QMeeGoFenceSyncPrivate::~QMeeGoFenceSyncPrivate() +{ + if (syncObject) { + QMeeGoRuntime::destroyFenceSync(syncObject); + syncObject = NULL; + } +} + +/* QMeeGoFenceSync */ + +QMeeGoFenceSync::QMeeGoFenceSync(QWidget *parent) : QObject(parent), d_ptr(new QMeeGoFenceSyncPrivate()) +{ + Q_D(QMeeGoFenceSync); + d->q_ptr = this; +} + +QMeeGoFenceSync::~QMeeGoFenceSync() +{ +} + +void QMeeGoFenceSync::setSyncPoint() +{ + Q_D(QMeeGoFenceSync); + if (d->syncObject) + QMeeGoRuntime::destroyFenceSync(d->syncObject); + + d->syncObject = QMeeGoRuntime::createFenceSync(); +} diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync.h b/tools/qmeegographicssystemhelper/qmeegofencesync.h new file mode 100644 index 0000000..2d3f5c5 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegofencesync.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEEGOFENCESYNC_H +#define QMEEGOFENCESYNC_H + +#include <QWidget> + +class QMeeGoFenceSyncPrivate; + +//! A synchronization helper for GL pipeline. +/*! + Fence syncs provide a mechanism for synchronizing access to certain GL primitives + and make it possible for the application developer to be sure that a certain point + in the GL processing pipeline has been already executed before continuing operation. + + Currently fence syncs are only useful in conjunction with QMeeGoLivePixmaps. + \code + ... + // In your paint/expose event: + QImage *image = livePixmap->lock(&someGlobalFenceSync); + // Modify the image... + livePixmap->release(image); + + painter->drawPixmap(0, 0, *livePixmap); + someGlobalFenceSync.setSyncPoint(); + ... + \endcode + + Assuming the paint/expose events come repeatedly, the lock operation + will block till the previous event completed painting the livePixmap. +*/ + +class Q_DECL_EXPORT QMeeGoFenceSync : public QObject +{ +public: + //! Constructs a new fence sync. + /*! + The fence sync is created without a sync point. You need to set the sync point manually. + */ + QMeeGoFenceSync(QWidget *parent = 0); + + //! Destructor for the fence sync. + virtual ~QMeeGoFenceSync(); + + //! Sets the fence sync. + /*! + The fence sync synchronization point should be set after all drawing has been scheduled. + Setting a synchronization point always overrides the previous point -- whetver is was + used (waited upon) or not. + */ + void setSyncPoint(); + +private: + Q_DISABLE_COPY(QMeeGoFenceSync) + Q_DECLARE_PRIVATE(QMeeGoFenceSync) + +protected: + QScopedPointer<QMeeGoFenceSyncPrivate> d_ptr; //! Private bits. + friend class QMeeGoLivePixmap; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegofencesync_p.h b/tools/qmeegographicssystemhelper/qmeegofencesync_p.h new file mode 100644 index 0000000..8a5d26e --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegofencesync_p.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegofencesync.h" + +#ifndef QMEEGOFENCESYNC_P_H +#define QMEEGOFENCESYNC_P_H + +class QMeeGoFenceSyncPrivate +{ +public: + Q_DECLARE_PUBLIC(QMeeGoFenceSync); + QMeeGoFenceSyncPrivate(); + + virtual ~QMeeGoFenceSyncPrivate(); + + void* syncObject; + + QMeeGoFenceSync *q_ptr; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro index 7412fc3..161a31b 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro @@ -6,5 +6,5 @@ include(../../src/qbase.pri) QT += gui INCLUDEPATH += '../../src/plugins/graphicssystems/meego' -HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h -SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h +HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h +SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegofencesync.cpp diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp index d43efe2..9700581f 100644 --- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp @@ -41,6 +41,7 @@ #include "qmeegolivepixmap.h" #include "qmeegolivepixmap_p.h" +#include "qmeegofencesync_p.h" #include "qmeegoruntime.h" /* QMeeGoLivePixmapPrivate */ @@ -102,10 +103,12 @@ QMeeGoLivePixmap::~QMeeGoLivePixmap() { } -QImage* QMeeGoLivePixmap::lock() +QImage* QMeeGoLivePixmap::lock(QMeeGoFenceSync *fenceSync) { - return QMeeGoRuntime::lockLiveTexture(this); - + if (fenceSync) + return QMeeGoRuntime::lockLiveTexture(this, fenceSync->d_func()->syncObject); + else + return QMeeGoRuntime::lockLiveTexture(this, NULL); } void QMeeGoLivePixmap::release(QImage *img) diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h index 7be2c4b..51b5976 100644 --- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h @@ -43,6 +43,7 @@ #define QMEEGOLIVEPIXMAP_H #include <QPixmap> +#include "qmeegofencesync.h" class QMeeGoLivePixmapPrivate; class QSharedMemory; @@ -82,8 +83,12 @@ public: //! Locks the access to the pixmap. /*! The returned image can be used for direct access. + You can optionally specify a fence sync to wait upon before unlocking. When + you specify a fence sync, you can be sure that this function will return only + when the previsouly set QMeeGoFenceSync synchronization point has been executed/passed + by the GL processing pipeline. */ - QImage* lock(); + QImage* lock(QMeeGoFenceSync *fenceSync = NULL); //! Unlocks the access to the pixmap. /*! diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp index ac627e5..2d3ee3c 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -60,9 +60,11 @@ typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h); typedef void (*QMeeGoSetTranslucentFunc) (bool translucent); typedef QPixmapData* (*QMeeGoPixmapDataWithNewLiveTextureFunc) (int w, int h, QImage::Format format); typedef QPixmapData* (*QMeeGoPixmapDataFromLiveTextureHandleFunc) (Qt::HANDLE h); -typedef QImage* (*QMeeGoLiveTextureLockFunc) (QPixmap*); +typedef QImage* (*QMeeGoLiveTextureLockFunc) (QPixmap*, void* fenceSync); typedef bool (*QMeeGoLiveTextureReleaseFunc) (QPixmap*, QImage *i); typedef Qt::HANDLE (*QMeeGoLiveTextureGetHandleFunc) (QPixmap*); +typedef void* (*QMeeGoCreateFenceSyncFunc) (void); +typedef void (*QMeeGoDestroyFenceSyncFunc) (void *fs); static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL; @@ -77,6 +79,8 @@ static QMeeGoPixmapDataFromLiveTextureHandleFunc qt_meego_pixmapdata_from_live_t static QMeeGoLiveTextureLockFunc qt_meego_live_texture_lock = NULL; static QMeeGoLiveTextureReleaseFunc qt_meego_live_texture_release = NULL; static QMeeGoLiveTextureGetHandleFunc qt_meego_live_texture_get_handle = NULL; +static QMeeGoCreateFenceSyncFunc qt_meego_create_fence_sync = NULL; +static QMeeGoDestroyFenceSyncFunc qt_meego_destroy_fence_sync = NULL; void QMeeGoRuntime::initialize() { @@ -103,12 +107,15 @@ void QMeeGoRuntime::initialize() qt_meego_live_texture_lock = (QMeeGoLiveTextureLockFunc) library.resolve("qt_meego_live_texture_lock"); qt_meego_live_texture_release = (QMeeGoLiveTextureReleaseFunc) library.resolve("qt_meego_live_texture_release"); qt_meego_live_texture_get_handle = (QMeeGoLiveTextureGetHandleFunc) library.resolve("qt_meego_live_texture_get_handle"); + qt_meego_create_fence_sync = (QMeeGoCreateFenceSyncFunc) library.resolve("qt_meego_create_fence_sync"); + qt_meego_destroy_fence_sync = (QMeeGoDestroyFenceSyncFunc) library.resolve("qt_meego_destroy_fence_sync"); if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent && qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle && - qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle) + qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle && + qt_meego_create_fence_sync && qt_meego_destroy_fence_sync) { qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion)); } else { @@ -191,11 +198,11 @@ QPixmapData* QMeeGoRuntime::pixmapDataFromLiveTextureHandle(Qt::HANDLE h) return qt_meego_pixmapdata_from_live_texture_handle(h); } -QImage* QMeeGoRuntime::lockLiveTexture(QPixmap *p) +QImage* QMeeGoRuntime::lockLiveTexture(QPixmap *p, void* fenceSync) { ENSURE_INITIALIZED; Q_ASSERT(qt_meego_live_texture_lock); - return qt_meego_live_texture_lock(p); + return qt_meego_live_texture_lock(p, fenceSync); } bool QMeeGoRuntime::releaseLiveTexture(QPixmap *p, QImage *i) @@ -211,3 +218,17 @@ Qt::HANDLE QMeeGoRuntime::getLiveTextureHandle(QPixmap *pixmap) Q_ASSERT(qt_meego_live_texture_get_handle); return qt_meego_live_texture_get_handle(pixmap); } + +void* QMeeGoRuntime::createFenceSync() +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_create_fence_sync); + return qt_meego_create_fence_sync(); +} + +void QMeeGoRuntime::destroyFenceSync(void *fs) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_destroy_fence_sync); + qt_meego_destroy_fence_sync(fs); +} diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h index 6b34836..be6ff6b 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.h +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -57,9 +57,11 @@ public: static void setTranslucent(bool translucent); static QPixmapData* pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format); static QPixmapData* pixmapDataFromLiveTextureHandle(Qt::HANDLE h); - static QImage* lockLiveTexture(QPixmap *pixmap); + static QImage* lockLiveTexture(QPixmap *pixmap, void *fenceSync); static bool releaseLiveTexture(QPixmap *pixmap, QImage *image); static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap); + static void* createFenceSync(); + static void destroyFenceSync(void *fs); private: static bool initialized; |