summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2009-11-25 14:48:03 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2009-11-26 14:42:48 (GMT)
commite84f5486724bf11d2a20e405a30db618f8c48e33 (patch)
tree1d33b837999dbffd01dce1bc38259773f66a6a18
parente9704a297f788bb79b2a89e9b16214443931af5d (diff)
downloadQt-e84f5486724bf11d2a20e405a30db618f8c48e33.zip
Qt-e84f5486724bf11d2a20e405a30db618f8c48e33.tar.gz
Qt-e84f5486724bf11d2a20e405a30db618f8c48e33.tar.bz2
Suspend DSA while drawing is in progress
In order to prevent flicker or - on some versions of the platform - video disappearing from the screen altogether, the video controller's DSA session must be suspended while the window control is redrawn. Task-number: QTBUG-5467 Reviewed-by: Jason Barron
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.cpp57
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.h7
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp16
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h6
4 files changed, 85 insertions, 1 deletions
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
index 2059fbe..0fd4d67 100644
--- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
@@ -50,6 +50,8 @@ MMF::VideoPlayer::VideoPlayer()
, m_window(0)
, m_totalTime(0)
, m_pendingChanges(false)
+ , m_dsaActive(false)
+ , m_dsaWasActive(false)
{
construct();
}
@@ -61,6 +63,7 @@ MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
, m_window(0)
, m_totalTime(0)
, m_pendingChanges(false)
+ , m_dsaActive(false)
{
construct();
}
@@ -86,6 +89,9 @@ void MMF::VideoPlayer::construct()
))
);
+ // CVideoPlayerUtility::NewL starts DSA
+ m_dsaActive = true;
+
if (KErrNone != err)
changeState(ErrorState);
@@ -349,6 +355,18 @@ void MMF::VideoPlayer::initVideoOutput()
Q_ASSERT(connected);
connected = connect(
+ m_videoOutput, SIGNAL(beginVideoWindowNativePaint()),
+ this, SLOT(suspendDirectScreenAccess())
+ );
+ Q_ASSERT(connected);
+
+ connected = connect(
+ m_videoOutput, SIGNAL(endVideoWindowNativePaint()),
+ this, SLOT(resumeDirectScreenAccess())
+ );
+ Q_ASSERT(connected);
+
+ connected = connect(
m_videoOutput, SIGNAL(aspectRatioChanged()),
this, SLOT(aspectRatioChanged())
);
@@ -370,12 +388,48 @@ void MMF::VideoPlayer::videoWindowChanged()
TRACE_ENTRY("state %d", state());
m_window = m_videoOutput->videoWindow();
-
updateVideoRect();
TRACE_EXIT_0();
}
+void MMF::VideoPlayer::suspendDirectScreenAccess()
+{
+ m_dsaWasActive = stopDirectScreenAccess();
+}
+
+void MMF::VideoPlayer::resumeDirectScreenAccess()
+{
+ if(m_dsaWasActive) {
+ startDirectScreenAccess();
+ m_dsaWasActive = false;
+ }
+}
+
+void MMF::VideoPlayer::startDirectScreenAccess()
+{
+ if(!m_dsaActive) {
+ TRAPD(err, m_player->StartDirectScreenAccessL());
+ if(KErrNone == err)
+ m_dsaActive = true;
+ else
+ setError(NormalError);
+ }
+}
+
+bool MMF::VideoPlayer::stopDirectScreenAccess()
+{
+ const bool dsaWasActive = m_dsaActive;
+ if(m_dsaActive) {
+ TRAPD(err, m_player->StopDirectScreenAccessL());
+ if(KErrNone == err)
+ m_dsaActive = false;
+ else
+ setError(NormalError);
+ }
+ return dsaWasActive;
+}
+
// Helper function for aspect ratio / scale mode handling
QSize scaleToAspect(const QSize& srcRect, int aspectWidth, int aspectHeight)
{
@@ -553,6 +607,7 @@ void MMF::VideoPlayer::applyVideoWindowChange()
TRACE("SetDisplayWindowL err %d", err);
setError(NormalError);
} else {
+ m_dsaActive = true;
TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias));
if(KErrNone != err) {
TRACE("SetScaleFactorL (2) err %d", err);
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
index 599bb88..abb1da8 100644
--- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
@@ -72,6 +72,8 @@ public Q_SLOTS:
void videoWindowChanged();
void aspectRatioChanged();
void scaleModeChanged();
+ void suspendDirectScreenAccess();
+ void resumeDirectScreenAccess();
private:
void construct();
@@ -89,6 +91,9 @@ private:
void applyPendingChanges();
void applyVideoWindowChange();
+ void startDirectScreenAccess();
+ bool stopDirectScreenAccess();
+
// AbstractMediaPlayer
virtual int numberOfMetaDataEntries() const;
virtual QPair<QString, QString> metaDataEntry(int index) const;
@@ -111,6 +116,8 @@ private:
qint64 m_totalTime;
bool m_pendingChanges;
+ bool m_dsaActive;
+ bool m_dsaWasActive;
};
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index f16f332..119dcb1 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -34,6 +34,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <coecntrl.h>
+#include <coemain.h> // for CCoeEnv
+
QT_BEGIN_NAMESPACE
using namespace Phonon;
@@ -73,6 +75,7 @@ MMF::VideoOutput::VideoOutput
setAutoFillBackground(false);
qt_widget_private(this)->extraData()->nativePaintMode = QWExtra::ZeroFill;
+ qt_widget_private(this)->extraData()->receiveNativePaintEvents = true;
getVideoWindowRect();
registerForAncestorMoved();
@@ -283,5 +286,18 @@ void MMF::VideoOutput::dump() const
#endif
}
+void MMF::VideoOutput::beginNativePaintEvent(const QRect& /*controlRect*/)
+{
+ emit beginVideoWindowNativePaint();
+}
+
+void MMF::VideoOutput::endNativePaintEvent(const QRect& /*controlRect*/)
+{
+ // Ensure that draw ops are executed into the WSERV output framebuffer
+ CCoeEnv::Static()->WsSession().Flush();
+
+ emit endVideoWindowNativePaint();
+}
+
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
index 6dfe69d..2788401 100644
--- a/src/3rdparty/phonon/mmf/videooutput.h
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -63,10 +63,16 @@ public:
// Debugging output
void dump() const;
+public Q_SLOTS:
+ void beginNativePaintEvent(const QRect& /*controlRect*/);
+ void endNativePaintEvent(const QRect& /*controlRect*/);
+
Q_SIGNALS:
void videoWindowChanged();
void aspectRatioChanged();
void scaleModeChanged();
+ void beginVideoWindowNativePaint();
+ void endVideoWindowNativePaint();
protected:
// Override QWidget functions