• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/interfaces


Commit MetaInfo

修订版48ffe289b0b8fb6515f77affbac6a261ef6552fe (tree)
时间2017-09-09 03:51:57
作者Chia-I Wu <olv@goog...>
CommiterChia-I Wu

Log Message

graphics: discard stale data from message queue

Our use of message queues is synchronous. If there are already data
in the queue when writeQueue is called, we know they are stale and
can be discarded.

Bug: 65449888
Test: manual
Change-Id: Ie29b8a7386c9733c183a6c3569e3572efa62cbc2

更改概述

差异

--- a/graphics/composer/2.1/default/IComposerCommandBuffer.h
+++ b/graphics/composer/2.1/default/IComposerCommandBuffer.h
@@ -92,6 +92,23 @@ public:
9292 bool writeQueue(bool* outQueueChanged, uint32_t* outCommandLength,
9393 hidl_vec<hidl_handle>* outCommandHandles)
9494 {
95+ // After data are written to the queue, it may not be read by the
96+ // remote reader when
97+ //
98+ // - the writer does not send them (because of other errors)
99+ // - the hwbinder transaction fails
100+ // - the reader does not read them (because of other errors)
101+ //
102+ // Discard the stale data here.
103+ size_t staleDataSize = mQueue ? mQueue->availableToRead() : 0;
104+ if (staleDataSize > 0) {
105+ ALOGW("discarding stale data from message queue");
106+ CommandQueueType::MemTransaction tx;
107+ if (mQueue->beginRead(staleDataSize, &tx)) {
108+ mQueue->commitRead(staleDataSize);
109+ }
110+ }
111+
95112 // write data to queue, optionally resizing it
96113 if (mQueue && (mDataMaxSize <= mQueue->getQuantumCount())) {
97114 if (!mQueue->write(mData.get(), mDataWritten)) {