From f19290bd6d0babefd660aa589f004b1b1a8c2a30 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 15 Mar 2010 13:48:29 +0200 Subject: Added exit softkey to Wiggly example Part of QtP delta reduction effort, original task: QTTH-42 Reviewed-by: Janne Anttila --- examples/widgets/wiggly/dialog.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/widgets/wiggly/dialog.cpp b/examples/widgets/wiggly/dialog.cpp index 02d3272..0838472 100644 --- a/examples/widgets/wiggly/dialog.cpp +++ b/examples/widgets/wiggly/dialog.cpp @@ -56,6 +56,17 @@ Dialog::Dialog(QWidget *parent, bool smallScreen) layout->addWidget(lineEdit); setLayout(layout); +#ifdef QT_SOFTKEYS_ENABLED + QAction *exitAction = new QAction(tr("Exit"), this); + exitAction->setSoftKeyRole(QAction::NegativeSoftKey); + connect (exitAction, SIGNAL(triggered()),this, SLOT(close())); + addAction (exitAction); + + Qt::WindowFlags flags = windowFlags(); + flags |= Qt::WindowSoftkeysVisibleHint; + setWindowFlags(flags); +#endif + connect(lineEdit, SIGNAL(textChanged(QString)), wigglyWidget, SLOT(setText(QString))); if (!smallScreen){ -- cgit v0.12 From 1a76892b00ff2c07b15338a25918a2395ce759ae Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 15 Mar 2010 13:56:04 +0100 Subject: Make QColorDialog usable on small screens QColorDialog was always assuming that it got its minimal size requirements. On a lot of screens, this was not the case, so choosing a color in the QColorPicker was totally off. This patch handles the resize event correctly, so the QColorPicker will be usable on all possible screen sizes. This fixes Maemo's bug https://bugs.maemo.org/show_bug.cgi?id=9526 Reviewed-by: Robert Griebl --- src/gui/dialogs/qcolordialog.cpp | 69 ++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index e6abf7f..e9b5720 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -644,6 +644,7 @@ protected: void paintEvent(QPaintEvent*); void mouseMoveEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); private: int hue; @@ -654,7 +655,7 @@ private: int satPt(const QPoint &pt); void setCol(const QPoint &pt); - QPixmap *pix; + QPixmap pix; }; static int pWidth = 220; @@ -790,13 +791,27 @@ void QColorLuminancePicker::setCol(int h, int s , int v) } QPoint QColorPicker::colPt() -{ return QPoint((360-hue)*(pWidth-1)/360, (255-sat)*(pHeight-1)/255); } +{ + QRect r = contentsRect(); + return QPoint((360 - hue) * (r.width() - 1) / 360, (255 - sat) * (r.height() - 1) / 255); +} + int QColorPicker::huePt(const QPoint &pt) -{ return 360 - pt.x()*360/(pWidth-1); } +{ + QRect r = contentsRect(); + return 360 - pt.x() * 360 / (r.width() - 1); +} + int QColorPicker::satPt(const QPoint &pt) -{ return 255 - pt.y()*255/(pHeight-1) ; } +{ + QRect r = contentsRect(); + return 255 - pt.y() * 255 / (r.height() - 1); +} + void QColorPicker::setCol(const QPoint &pt) -{ setCol(huePt(pt), satPt(pt)); } +{ + setCol(huePt(pt), satPt(pt)); +} QColorPicker::QColorPicker(QWidget* parent) : QFrame(parent) @@ -804,29 +819,12 @@ QColorPicker::QColorPicker(QWidget* parent) hue = 0; sat = 0; setCol(150, 255); - QImage img(pWidth, pHeight, QImage::Format_RGB32); - int x, y; - uint *pixel = (uint *) img.scanLine(0); - for (y = 0; y < pHeight; y++) { - const uint *end = pixel + pWidth; - x = 0; - while (pixel < end) { - QPoint p(x, y); - QColor c; - c.setHsv(huePt(p), satPt(p), 200); - *pixel = c.rgb(); - ++pixel; - ++x; - } - } - pix = new QPixmap(QPixmap::fromImage(img)); setAttribute(Qt::WA_NoSystemBackground); setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed) ); } QColorPicker::~QColorPicker() { - delete pix; } QSize QColorPicker::sizeHint() const @@ -869,7 +867,7 @@ void QColorPicker::paintEvent(QPaintEvent* ) drawFrame(&p); QRect r = contentsRect(); - p.drawPixmap(r.topLeft(), *pix); + p.drawPixmap(r.topLeft(), pix); QPoint pt = colPt() + r.topLeft(); p.setPen(Qt::black); @@ -878,6 +876,31 @@ void QColorPicker::paintEvent(QPaintEvent* ) } +void QColorPicker::resizeEvent(QResizeEvent *ev) +{ + QFrame::resizeEvent(ev); + + int w = width() - frameWidth() * 2; + int h = height() - frameWidth() * 2; + QImage img(w, h, QImage::Format_RGB32); + int x, y; + uint *pixel = (uint *) img.scanLine(0); + for (y = 0; y < h; y++) { + const uint *end = pixel + w; + x = 0; + while (pixel < end) { + QPoint p(x, y); + QColor c; + c.setHsv(huePt(p), satPt(p), 200); + *pixel = c.rgb(); + ++pixel; + ++x; + } + } + pix = QPixmap::fromImage(img); +} + + class QColSpinBox : public QSpinBox { public: -- cgit v0.12 From be0b2f1eb209c0177500db3bf28bed3631523464 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Mon, 15 Mar 2010 15:05:54 +0100 Subject: Fixed cleartype text rendering on translucent surfaces. We were using gamma corrected 11 bit values instead of the 8 bit non- corrected values, which caused some strange rendering effects. Task-number: QTBUG-9036 Reviewed-by: Samuel --- src/gui/painting/qdrawhelper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 070491d..2724d7f 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7174,9 +7174,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int ) { int a = qGray(coverage); - sr = qt_div_255(sr * a); - sg = qt_div_255(sg * a); - sb = qt_div_255(sb * a); + sr = qt_div_255(qt_pow_rgb_invgamma[sr] * a); + sg = qt_div_255(qt_pow_rgb_invgamma[sg] * a); + sb = qt_div_255(qt_pow_rgb_invgamma[sb] * a); int ia = 255 - a; dr = qt_div_255(dr * ia); -- cgit v0.12 From 5715a66650174f8df85f8776d0ab6d98b6b83adb Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 18 Jan 2010 18:35:23 +0100 Subject: Fix fromSymbian*() image conversion functions. Do not explicitly create instances of QS60PixmapData in this function because it is possible that we are using another graphics system. The fromNativeType() function is virtual so the graphics system will create the right version of the pixmap data for us and ensure that we get into the right implementation. Reviewed-by: Aleksandar Sasha Babic --- src/gui/image/qpixmap_s60.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 4f3a719..a13c8c8 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -337,7 +337,7 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QPixmapData::create(0,0, QPixmapData::PixmapType)); data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); QPixmap pixmap(data.take()); return pixmap; @@ -735,7 +735,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QPixmapData::create(0,0, QPixmapData::PixmapType)); data->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); QPixmap pixmap(data.take()); return pixmap; -- cgit v0.12 From 56e872353f5c496b27d3e9e614e3d3fea0ae8987 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 11 Mar 2010 17:46:11 +0100 Subject: Fix runonphone target due to changed name of sis files change b37ac454832a23c17418f5ebca8928b63fe02289 changed sis file names from qt_debug-armv5.sis to qt.sis This updates the runonphone make target to the new sis file name Reviewed-by: axis --- qmake/generators/symbian/symmake.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index f906c76..9aa122a 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -2084,7 +2084,7 @@ void SymbianMakefileGenerator::generateExecutionTargets(QTextStream& t, const QS t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; } t << "runonphone: sis" << endl; - t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << "_$(QT_SIS_TARGET).sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; + t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << ".sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; t << endl; } } -- cgit v0.12 From 643f80ec50ada93b4f0a5771e6260fd32efa3e54 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 15 Mar 2010 17:19:10 +0100 Subject: Implement symbian^3 e32atomics API Symbian^3 provides an enhanced atomics API, which provides relaxed, acquire, release, ordered versions of each atomic operation. The armv5 and armv6 assembly atomics previously used in Qt are not SMP safe. The atomics provided by the OS will be SMP safe when using the SMP kernel, or similar ARM assembly implementations when using the uniprocessor kernel. Task-number: QTBUG-7655 Reviewed-by: mread --- src/corelib/arch/armv6/qatomic_generic_armv6.cpp | 212 ++++++++++++++++ src/corelib/arch/qatomic_symbian.h | 90 ++++--- src/corelib/arch/symbian/qatomic_symbian.cpp | 307 ++++++++++++++++++++++- src/s60installs/bwins/QtCoreu.def | 18 ++ src/s60installs/eabi/QtCoreu.def | 18 ++ 5 files changed, 607 insertions(+), 38 deletions(-) diff --git a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp index f638891..39d966a 100644 --- a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp +++ b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp @@ -46,6 +46,7 @@ #include #ifdef QT_HAVE_ARMV6 +#ifndef SYMBIAN_E32_ATOMIC_API QT_BEGIN_NAMESPACE @@ -55,6 +56,24 @@ QT_USE_NAMESPACE #pragma push #pragma arm Q_CORE_EXPORT asm +bool QBasicAtomicInt_testAndSetRelaxed(volatile int *_q_value, int expectedValue, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +bool QBasicAtomicInt_testAndSetAcquire(volatile int *_q_value, int expectedValue, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +bool QBasicAtomicInt_testAndSetRelease(volatile int *_q_value, int expectedValue, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue) { CODE32 @@ -73,6 +92,24 @@ retry_testAndSetOrdered } Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndStoreRelaxed(volatile int *_q_value, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndStoreAcquire(volatile int *_q_value, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndStoreRelease(volatile int *_q_value, int newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue) { CODE32 @@ -88,6 +125,24 @@ retry_fetchAndStoreOrdered } Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndAddRelaxed(volatile int *_q_value, int valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndAddAcquire(volatile int *_q_value, int valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +int QBasicAtomicInt_fetchAndAddRelease(volatile int *_q_value, int valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd) { CODE32 @@ -105,6 +160,30 @@ retry_fetchAndAddOrdered } Q_CORE_EXPORT asm +bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +bool QBasicAtomicPointer_testAndSetRelease(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value, void *expectedValue, void *newValue) @@ -125,6 +204,24 @@ retryPointer_testAndSetOrdered } Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *_q_value, void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *_q_value, void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *_q_value, void *newValue) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue) { CODE32 @@ -140,6 +237,24 @@ retryPointer_fetchAndStoreOrdered } Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *_q_value, qptrdiff valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndAddRelease(void * volatile *_q_value, qptrdiff valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm +void *QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *_q_value, qptrdiff valueToAdd) +{ + CODE32 + //fall through +} +Q_CORE_EXPORT asm void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd) { CODE32 @@ -159,6 +274,21 @@ retryPointer_fetchAndAddOrdered #pragma pop #elif defined (Q_CC_GCCE) Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicInt_testAndSetRelaxed(volatile int *_q_value, int expectedValue, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicInt_testAndSetAcquire(volatile int *_q_value, int expectedValue, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicInt_testAndSetRelease(volatile int *_q_value, int expectedValue, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue) { //R0 = _q_value @@ -176,6 +306,21 @@ bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue } Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndStoreRelaxed(volatile int *_q_value, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndStoreAcquire(volatile int *_q_value, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndStoreRelease(volatile int *_q_value, int newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue) { //R0 = _q_value @@ -190,6 +335,21 @@ int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue) } Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndAddRelaxed(volatile int *_q_value, int valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndAddAcquire(volatile int *_q_value, int valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +int QBasicAtomicInt_fetchAndAddRelease(volatile int *_q_value, int valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd) { //R0 = _q_value @@ -206,6 +366,27 @@ int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd) } Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicPointer_testAndSetRelease(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value, void *expectedValue, void *newValue) @@ -225,6 +406,21 @@ bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value, } Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *_q_value, void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *_q_value, void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *_q_value, void *newValue) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue) { //R0 = _q_value @@ -239,6 +435,21 @@ void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void * } Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *_q_value, qptrdiff valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndAddRelease(void * volatile *_q_value, qptrdiff valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) +void *QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *_q_value, qptrdiff valueToAdd) +{ + //fall through +} +Q_CORE_EXPORT __declspec( naked ) void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd) { //R0 = _q_value @@ -258,3 +469,4 @@ void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff #endif QT_END_NAMESPACE #endif +#endif diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index fa4e4a9..893bb300 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -104,10 +104,28 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndAddWaitFree() Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int); Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int); Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int); +Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetRelaxed(volatile int *, int, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreRelaxed(volatile int *, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddRelaxed(volatile int *, int); +Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetAcquire(volatile int *, int, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreAcquire(volatile int *, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddAcquire(volatile int *, int); +Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetRelease(volatile int *, int, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreRelease(volatile int *, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddRelease(volatile int *, int); Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *); Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *); Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff); +Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *, void *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *, qptrdiff); +Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *, void *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *, qptrdiff); +Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetRelease(void * volatile *, void *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddRelease(void * volatile *, qptrdiff); // Reference counting @@ -133,17 +151,17 @@ inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicInt_testAndSetRelaxed(&_q_value, expectedValue, newValue); } inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicInt_testAndSetAcquire(&_q_value, expectedValue, newValue); } inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicInt_testAndSetRelease(&_q_value, expectedValue, newValue); } // Fetch and store for integers @@ -155,17 +173,17 @@ inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - return fetchAndStoreOrdered(newValue); + return QBasicAtomicInt_fetchAndStoreRelaxed(&_q_value, newValue); } inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - return fetchAndStoreOrdered(newValue); + return QBasicAtomicInt_fetchAndStoreAcquire(&_q_value, newValue); } inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - return fetchAndStoreOrdered(newValue); + return QBasicAtomicInt_fetchAndStoreRelease(&_q_value, newValue); } // Fetch and add for integers @@ -177,17 +195,17 @@ inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return QBasicAtomicInt_fetchAndAddRelaxed(&_q_value, valueToAdd); } inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return QBasicAtomicInt_fetchAndAddAcquire(&_q_value, valueToAdd); } inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return QBasicAtomicInt_fetchAndAddRelease(&_q_value, valueToAdd); } // Test and set for pointers @@ -195,27 +213,29 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) { - union { T * volatile * typed; void * volatile * voidp; } pointer; - pointer.typed = &_q_value; - return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue); + return QBasicAtomicPointer_testAndSetOrdered(reinterpret_cast(&_q_value), + expectedValue, newValue); } template Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicPointer_testAndSetRelaxed(reinterpret_cast(&_q_value), + expectedValue, newValue); } template Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicPointer_testAndSetAcquire(reinterpret_cast(&_q_value), + expectedValue, newValue); } template Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) { - return testAndSetOrdered(expectedValue, newValue); + return QBasicAtomicPointer_testAndSetRelease(reinterpret_cast(&_q_value), + expectedValue, newValue); } // Fetch and store for pointers @@ -223,29 +243,33 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValu template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreOrdered(T *newValue) { - union { T * volatile * typed; void * volatile * voidp; } pointer; - union { T *typed; void *voidp; } returnValue; - pointer.typed = &_q_value; - returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue); - return returnValue.typed; + return static_cast(QBasicAtomicPointer_fetchAndStoreOrdered( + reinterpret_cast(&_q_value) + , newValue)); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelaxed(T *newValue) { - return fetchAndStoreOrdered(newValue); + return static_cast(QBasicAtomicPointer_fetchAndStoreRelaxed( + reinterpret_cast(&_q_value) + , newValue)); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreAcquire(T *newValue) { - return fetchAndStoreOrdered(newValue); + return static_cast(QBasicAtomicPointer_fetchAndStoreAcquire( + reinterpret_cast(&_q_value) + , newValue)); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) { - return fetchAndStoreOrdered(newValue); + return static_cast(QBasicAtomicPointer_fetchAndStoreRelease( + reinterpret_cast(&_q_value) + , newValue)); } // Fetch and add for pointers @@ -253,29 +277,33 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) { - union { T * volatile *typed; void * volatile *voidp; } pointer; - union { T *typed; void *voidp; } returnValue; - pointer.typed = &_q_value; - returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T)); - return returnValue.typed; + return static_cast(QBasicAtomicPointer_fetchAndAddOrdered( + reinterpret_cast(&_q_value), + valueToAdd * sizeof(T))); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return static_cast(QBasicAtomicPointer_fetchAndAddRelaxed( + reinterpret_cast(&_q_value), + valueToAdd * sizeof(T))); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return static_cast(QBasicAtomicPointer_fetchAndAddAcquire( + reinterpret_cast(&_q_value), + valueToAdd * sizeof(T))); } template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) { - return fetchAndAddOrdered(valueToAdd); + return static_cast(QBasicAtomicPointer_fetchAndAddRelease( + reinterpret_cast(&_q_value), + valueToAdd * sizeof(T))); } QT_END_NAMESPACE diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp index a2228a1..568fb7a 100644 --- a/src/corelib/arch/symbian/qatomic_symbian.cpp +++ b/src/corelib/arch/symbian/qatomic_symbian.cpp @@ -42,6 +42,10 @@ #include #include +#ifdef SYMBIAN_E32_ATOMIC_API +#include +#endif + #include QT_BEGIN_NAMESPACE @@ -79,7 +83,7 @@ struct QSymbianPrintExitInfo Q_CORE_EXPORT bool QBasicAtomicInt::isReferenceCountingNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -88,7 +92,7 @@ Q_CORE_EXPORT bool QBasicAtomicInt::isReferenceCountingNative() Q_CORE_EXPORT bool QBasicAtomicInt::isTestAndSetNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -97,7 +101,7 @@ Q_CORE_EXPORT bool QBasicAtomicInt::isTestAndSetNative() Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndStoreNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -106,7 +110,7 @@ Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndStoreNative() Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndAddNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -115,7 +119,7 @@ Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndAddNative() Q_CORE_EXPORT bool QBasicAtomicPointer_isTestAndSetNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -124,7 +128,7 @@ Q_CORE_EXPORT bool QBasicAtomicPointer_isTestAndSetNative() Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndStoreNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; @@ -133,13 +137,187 @@ Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndStoreNative() Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndAddNative() { -#ifdef QT_HAVE_ARMV6 +#if !defined(SYMBIAN_E32_ATOMIC_API) && defined(QT_HAVE_ARMV6) return true; #else return false; #endif } +#ifdef SYMBIAN_E32_ATOMIC_API +//Symbian's API is SMP-safe when using SMP kernel, and cheap when using uniprocessor kernel + +//generate compiler error if casting assumptions are wrong (symbian64?) +__ASSERT_COMPILE(sizeof(int) == sizeof(TUint32)); +__ASSERT_COMPILE(sizeof(void *) == sizeof(TUint32)); + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue) +{ + return static_cast(__e32_atomic_cas_ord32(_q_value, + reinterpret_cast(&expectedValue), newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetRelaxed(volatile int *_q_value, int expectedValue, int newValue) +{ + return static_cast(__e32_atomic_cas_rlx32(_q_value, + reinterpret_cast(&expectedValue), newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetAcquire(volatile int *_q_value, int expectedValue, int newValue) +{ + return static_cast(__e32_atomic_cas_acq32(_q_value, + reinterpret_cast(&expectedValue), newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetRelease(volatile int *_q_value, int expectedValue, int newValue) +{ + return static_cast(__e32_atomic_cas_rel32(_q_value, + reinterpret_cast(&expectedValue), newValue)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue) +{ + return static_cast(__e32_atomic_swp_ord32(_q_value, newValue)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreRelaxed(volatile int *_q_value, int newValue) +{ + return static_cast(__e32_atomic_swp_rlx32(_q_value, newValue)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreAcquire(volatile int *_q_value, int newValue) +{ + return static_cast(__e32_atomic_swp_acq32(_q_value, newValue)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreRelease(volatile int *_q_value, int newValue) +{ + return static_cast(__e32_atomic_swp_rel32(_q_value, newValue)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd) +{ + return static_cast(__e32_atomic_add_ord32(_q_value, valueToAdd)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddRelaxed(volatile int *_q_value, int valueToAdd) +{ + return static_cast(__e32_atomic_add_rlx32(_q_value, valueToAdd)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddAcquire(volatile int *_q_value, int valueToAdd) +{ + return static_cast(__e32_atomic_add_acq32(_q_value, valueToAdd)); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddRelease(volatile int *_q_value, int valueToAdd) +{ + return static_cast(__e32_atomic_add_rel32(_q_value, valueToAdd)); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return static_cast(__e32_atomic_cas_ord_ptr(_q_value, + &expectedValue, + newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return static_cast(__e32_atomic_cas_rlx_ptr(_q_value, + &expectedValue, + newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return static_cast(__e32_atomic_cas_acq_ptr(_q_value, + &expectedValue, + newValue)); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetRelease(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return static_cast(__e32_atomic_cas_rel_ptr(_q_value, + &expectedValue, + newValue)); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue) +{ + return __e32_atomic_swp_ord_ptr(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *_q_value, void *newValue) +{ + return __e32_atomic_swp_rlx_ptr(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *_q_value, void *newValue) +{ + return __e32_atomic_swp_acq_ptr(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *_q_value, void *newValue) +{ + return __e32_atomic_swp_rel_ptr(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return __e32_atomic_add_ord_ptr(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return __e32_atomic_add_rlx_ptr(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return __e32_atomic_add_acq_ptr(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddRelease(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return __e32_atomic_add_rel_ptr(_q_value, valueToAdd); +} + +#else +//Symbian kernels 9.4 and earlier don't expose a suitable API + //For ARMv6, the generic atomics are machine coded #ifndef QT_HAVE_ARMV6 @@ -229,6 +407,121 @@ void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff return returnValue; } +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetRelaxed(volatile int *_q_value, int expectedValue, int newValue) +{ + return QBasicAtomicInt_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetAcquire(volatile int *_q_value, int expectedValue, int newValue) +{ + return QBasicAtomicInt_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +bool QBasicAtomicInt_testAndSetRelease(volatile int *_q_value, int expectedValue, int newValue) +{ + return QBasicAtomicInt_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreRelaxed(volatile int *_q_value, int newValue) +{ + return QBasicAtomicInt_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreAcquire(volatile int *_q_value, int newValue) +{ + return QBasicAtomicInt_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndStoreRelease(volatile int *_q_value, int newValue) +{ + return QBasicAtomicInt_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddRelaxed(volatile int *_q_value, int valueToAdd) +{ + return QBasicAtomicInt_fetchAndAddOrdered(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddAcquire(volatile int *_q_value, int valueToAdd) +{ + return QBasicAtomicInt_fetchAndAddOrdered(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +int QBasicAtomicInt_fetchAndAddRelease(volatile int *_q_value, int valueToAdd) +{ + return QBasicAtomicInt_fetchAndAddOrdered(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return QBasicAtomicPointer_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return QBasicAtomicPointer_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +bool QBasicAtomicPointer_testAndSetRelease(void * volatile *_q_value, + void *expectedValue, + void *newValue) +{ + return QBasicAtomicPointer_testAndSetOrdered(_q_value, expectedValue, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *_q_value, void *newValue) +{ + return QBasicAtomicPointer_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *_q_value, void *newValue) +{ + return QBasicAtomicPointer_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *_q_value, void *newValue) +{ + return QBasicAtomicPointer_fetchAndStoreOrdered(_q_value, newValue); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return QBasicAtomicPointer_fetchAndAddOrdered(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return QBasicAtomicPointer_fetchAndAddOrdered(_q_value, valueToAdd); +} + +Q_CORE_EXPORT +void *QBasicAtomicPointer_fetchAndAddRelease(void * volatile *_q_value, qptrdiff valueToAdd) +{ + return QBasicAtomicPointer_fetchAndAddOrdered(_q_value, valueToAdd); +} + #endif // QT_HAVE_ARMV6 +#endif // SYMBIAN_E32_ATOMIC_API QT_END_NAMESPACE diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index e7e890c..df10406 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4399,4 +4399,22 @@ EXPORTS ?sender@SignalEvent@QStateMachine@@QBEPAVQObject@@XZ @ 4398 NONAME ; class QObject * QStateMachine::SignalEvent::sender(void) const ?signalIndex@SignalEvent@QStateMachine@@QBEHXZ @ 4399 NONAME ; int QStateMachine::SignalEvent::signalIndex(void) const ?disconnectOne@QMetaObject@@SA_NPBVQObject@@H0H@Z @ 4400 NONAME ; bool QMetaObject::disconnectOne(class QObject const *, int, class QObject const *, int) + ?QBasicAtomicInt_fetchAndAddRelease@@YAHPCHH@Z @ 4401 NONAME ; int QBasicAtomicInt_fetchAndAddRelease(int volatile *, int) + ?QBasicAtomicPointer_testAndSetRelaxed@@YA_NPCRAXPAX1@Z @ 4402 NONAME ; bool QBasicAtomicPointer_testAndSetRelaxed(void * volatile *, void *, void *) + ?QBasicAtomicInt_fetchAndAddRelaxed@@YAHPCHH@Z @ 4403 NONAME ; int QBasicAtomicInt_fetchAndAddRelaxed(int volatile *, int) + ?QBasicAtomicPointer_testAndSetRelease@@YA_NPCRAXPAX1@Z @ 4404 NONAME ; bool QBasicAtomicPointer_testAndSetRelease(void * volatile *, void *, void *) + ?QBasicAtomicInt_fetchAndStoreRelease@@YAHPCHH@Z @ 4405 NONAME ; int QBasicAtomicInt_fetchAndStoreRelease(int volatile *, int) + ?QBasicAtomicPointer_fetchAndAddAcquire@@YAPAXPCRAXH@Z @ 4406 NONAME ; void * QBasicAtomicPointer_fetchAndAddAcquire(void * volatile *, int) + ?QBasicAtomicPointer_fetchAndAddRelease@@YAPAXPCRAXH@Z @ 4407 NONAME ; void * QBasicAtomicPointer_fetchAndAddRelease(void * volatile *, int) + ?QBasicAtomicPointer_testAndSetAcquire@@YA_NPCRAXPAX1@Z @ 4408 NONAME ; bool QBasicAtomicPointer_testAndSetAcquire(void * volatile *, void *, void *) + ?QBasicAtomicPointer_fetchAndStoreAcquire@@YAPAXPCRAXPAX@Z @ 4409 NONAME ; void * QBasicAtomicPointer_fetchAndStoreAcquire(void * volatile *, void *) + ?QBasicAtomicPointer_fetchAndAddRelaxed@@YAPAXPCRAXH@Z @ 4410 NONAME ; void * QBasicAtomicPointer_fetchAndAddRelaxed(void * volatile *, int) + ?QBasicAtomicInt_testAndSetAcquire@@YA_NPCHHH@Z @ 4411 NONAME ; bool QBasicAtomicInt_testAndSetAcquire(int volatile *, int, int) + ?QBasicAtomicPointer_fetchAndStoreRelaxed@@YAPAXPCRAXPAX@Z @ 4412 NONAME ; void * QBasicAtomicPointer_fetchAndStoreRelaxed(void * volatile *, void *) + ?QBasicAtomicInt_fetchAndStoreRelaxed@@YAHPCHH@Z @ 4413 NONAME ; int QBasicAtomicInt_fetchAndStoreRelaxed(int volatile *, int) + ?QBasicAtomicInt_testAndSetRelaxed@@YA_NPCHHH@Z @ 4414 NONAME ; bool QBasicAtomicInt_testAndSetRelaxed(int volatile *, int, int) + ?QBasicAtomicPointer_fetchAndStoreRelease@@YAPAXPCRAXPAX@Z @ 4415 NONAME ; void * QBasicAtomicPointer_fetchAndStoreRelease(void * volatile *, void *) + ?QBasicAtomicInt_testAndSetRelease@@YA_NPCHHH@Z @ 4416 NONAME ; bool QBasicAtomicInt_testAndSetRelease(int volatile *, int, int) + ?QBasicAtomicInt_fetchAndStoreAcquire@@YAHPCHH@Z @ 4417 NONAME ; int QBasicAtomicInt_fetchAndStoreAcquire(int volatile *, int) + ?QBasicAtomicInt_fetchAndAddAcquire@@YAHPCHH@Z @ 4418 NONAME ; int QBasicAtomicInt_fetchAndAddAcquire(int volatile *, int) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index a427ff9..c648d87 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3634,4 +3634,22 @@ EXPORTS _ZTVN13QStateMachine11SignalEventE @ 3633 NONAME _ZTVN13QStateMachine12WrappedEventE @ 3634 NONAME _ZN11QMetaObject13disconnectOneEPK7QObjectiS2_i @ 3635 NONAME + _Z33QBasicAtomicInt_testAndSetAcquirePViii @ 3636 NONAME + _Z33QBasicAtomicInt_testAndSetRelaxedPViii @ 3637 NONAME + _Z33QBasicAtomicInt_testAndSetReleasePViii @ 3638 NONAME + _Z34QBasicAtomicInt_fetchAndAddAcquirePVii @ 3639 NONAME + _Z34QBasicAtomicInt_fetchAndAddRelaxedPVii @ 3640 NONAME + _Z34QBasicAtomicInt_fetchAndAddReleasePVii @ 3641 NONAME + _Z36QBasicAtomicInt_fetchAndStoreAcquirePVii @ 3642 NONAME + _Z36QBasicAtomicInt_fetchAndStoreRelaxedPVii @ 3643 NONAME + _Z36QBasicAtomicInt_fetchAndStoreReleasePVii @ 3644 NONAME + _Z37QBasicAtomicPointer_testAndSetAcquirePVPvS_S_ @ 3645 NONAME + _Z37QBasicAtomicPointer_testAndSetRelaxedPVPvS_S_ @ 3646 NONAME + _Z37QBasicAtomicPointer_testAndSetReleasePVPvS_S_ @ 3647 NONAME + _Z38QBasicAtomicPointer_fetchAndAddAcquirePVPvi @ 3648 NONAME + _Z38QBasicAtomicPointer_fetchAndAddRelaxedPVPvi @ 3649 NONAME + _Z38QBasicAtomicPointer_fetchAndAddReleasePVPvi @ 3650 NONAME + _Z40QBasicAtomicPointer_fetchAndStoreAcquirePVPvS_ @ 3651 NONAME + _Z40QBasicAtomicPointer_fetchAndStoreRelaxedPVPvS_ @ 3652 NONAME + _Z40QBasicAtomicPointer_fetchAndStoreReleasePVPvS_ @ 3653 NONAME -- cgit v0.12 From 3f41524598f5b4795f0f6b279450daf792df927d Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Mon, 15 Mar 2010 15:20:50 +1000 Subject: Make sure to check for a valid audioformat before open. Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_mac_p.cpp | 2 +- src/multimedia/audio/qaudiooutput_mac_p.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index f394ca4..7ab8c27 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -710,7 +710,7 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) { QIODevice* op = device; - if (!open()) { + if (!audioFormat.isValid() || !open()) { stateCode = QAudio::StoppedState; errorCode = QAudio::OpenError; return audioIO; diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index 6f32257..b457fed 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -435,7 +435,7 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) { QIODevice* op = device; - if (!open()) { + if (!audioFormat.isValid() || !open()) { stateCode = QAudio::StoppedState; errorCode = QAudio::OpenError; return audioIO; -- cgit v0.12 From 1c5f43489f7c2e47dd602307570dd6235355da9d Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Mon, 15 Mar 2010 15:21:45 +1000 Subject: Handle values passed to setNotifyInterval more robustly. Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_mac_p.cpp | 9 ++++++++- src/multimedia/audio/qaudiooutput_mac_p.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index 7ab8c27..1db5866 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -807,6 +807,12 @@ int QAudioInputPrivate::bufferSize() const void QAudioInputPrivate::setNotifyInterval(int milliSeconds) { + if (intervalTimer->interval() == milliSeconds) + return; + + if (milliSeconds <= 0) + milliSeconds = 0; + intervalTimer->setInterval(milliSeconds); } @@ -886,7 +892,8 @@ void QAudioInputPrivate::audioDeviceError() void QAudioInputPrivate::startTimers() { audioBuffer->startFlushTimer(); - intervalTimer->start(); + if (intervalTimer->interval() > 0) + intervalTimer->start(); } void QAudioInputPrivate::stopTimers() diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index b457fed..9689101 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -536,6 +536,12 @@ int QAudioOutputPrivate::bufferSize() const void QAudioOutputPrivate::setNotifyInterval(int milliSeconds) { + if (intervalTimer->interval() == milliSeconds) + return; + + if (milliSeconds <= 0) + milliSeconds = 0; + intervalTimer->setInterval(milliSeconds); } @@ -622,7 +628,8 @@ void QAudioOutputPrivate::audioDeviceError() void QAudioOutputPrivate::startTimers() { audioBuffer->startFillTimer(); - intervalTimer->start(); + if (intervalTimer->interval() > 0) + intervalTimer->start(); } void QAudioOutputPrivate::stopTimers() -- cgit v0.12 From abcbcece2988d36fe88116fae429685430452689 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Tue, 16 Mar 2010 10:12:21 +1000 Subject: Use AudioConverter when not preferred format. Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_mac_p.cpp | 58 ++++++++++++++++-------------- src/multimedia/audio/qaudioinput_mac_p.h | 2 ++ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index 1db5866..4b37b18 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -54,12 +54,11 @@ #include #include -#include #include #include "qaudio_mac_p.h" #include "qaudioinput_mac_p.h" - +#include "qaudiodeviceinfo_mac_p.h" QT_BEGIN_NAMESPACE @@ -241,7 +240,7 @@ public: m_flushTimer = new QTimer(this); connect(m_flushTimer, SIGNAL(timeout()), SLOT(flushBuffer())); - if (inputFormat.mSampleRate != outputFormat.mSampleRate) { + if (toQAudioFormat(inputFormat) != toQAudioFormat(outputFormat)) { if (AudioConverterNew(&m_inputFormat, &m_outputFormat, &m_audioConverter) != noErr) { qWarning() << "QAudioInput: Unable to create an Audio Converter"; m_audioConverter = 0; @@ -520,6 +519,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray& device, QAudioFormat co if (QAudio::Mode(mode) == QAudio::AudioOutput) errorCode = QAudio::OpenError; else { + audioDeviceInfo = new QAudioDeviceInfoInternal(device, QAudio::AudioInput); isOpen = false; audioDeviceId = AudioDeviceID(did); audioUnit = 0; @@ -540,6 +540,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray& device, QAudioFormat co QAudioInputPrivate::~QAudioInputPrivate() { close(); + delete audioDeviceInfo; } bool QAudioInputPrivate::open() @@ -577,7 +578,7 @@ bool QAudioInputPrivate::open() 1, &enable, sizeof(enable)) != noErr) { - qWarning() << "QAudioInput: Unabled to switch to input mode (Enable Input)"; + qWarning() << "QAudioInput: Unable to switch to input mode (Enable Input)"; return false; } @@ -588,7 +589,7 @@ bool QAudioInputPrivate::open() 0, &enable, sizeof(enable)) != noErr) { - qWarning() << "QAudioInput: Unabled to switch to input mode (Disable output)"; + qWarning() << "QAudioInput: Unable to switch to input mode (Disable output)"; return false; } @@ -619,35 +620,40 @@ bool QAudioInputPrivate::open() } // Set format + // Wanted streamFormat = toAudioStreamBasicDescription(audioFormat); - size = sizeof(deviceFormat); - if (AudioUnitGetProperty(audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 1, - &deviceFormat, - &size) != noErr) { - qWarning() << "QAudioInput: Unable to retrieve device format"; - return false; - } - - // If the device frequency is different to the requested use a converter - if (deviceFormat.mSampleRate != streamFormat.mSampleRate) { - AudioUnitSetProperty(audioUnit, + // Required on unit + if (audioFormat == audioDeviceInfo->preferredFormat()) { + deviceFormat = streamFormat; + AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &deviceFormat, - sizeof(streamFormat)); + sizeof(deviceFormat)); } else { - AudioUnitSetProperty(audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, - 1, - &streamFormat, - sizeof(streamFormat)); + size = sizeof(deviceFormat); + if (AudioUnitGetProperty(audioUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Input, + 1, + &deviceFormat, + &size) != noErr) { + qWarning() << "QAudioInput: Unable to retrieve device format"; + return false; + } + + if (AudioUnitSetProperty(audioUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Output, + 1, + &deviceFormat, + sizeof(deviceFormat)) != noErr) { + qWarning() << "QAudioInput: Unable to set device format"; + return false; + } } // Setup buffers diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h index 42f90e2..7aa4168 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.h +++ b/src/multimedia/audio/qaudioinput_mac_p.h @@ -74,6 +74,7 @@ QT_BEGIN_NAMESPACE class QTimer; class QIODevice; +class QAbstractAudioDeviceInfo; namespace QtMultimediaInternal { @@ -104,6 +105,7 @@ public: QTimer* intervalTimer; AudioStreamBasicDescription streamFormat; AudioStreamBasicDescription deviceFormat; + QAbstractAudioDeviceInfo *audioDeviceInfo; QAudioInputPrivate(const QByteArray& device, QAudioFormat const& format); ~QAudioInputPrivate(); -- cgit v0.12