diff options
author | Jamie Gennis <jgennis@google.com> | 2012-12-20 14:05:45 -0800 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2013-02-12 18:15:38 -0800 |
commit | 1df8c345854155cbbcb9f80de9d12d66ea70ac08 (patch) | |
tree | 9e3eedb37edfbb45c323364366ae09ea82ba847d /services | |
parent | 351c2941736039c495dd7ac849ec64fbf7f3ff05 (diff) | |
download | frameworks_native-1df8c345854155cbbcb9f80de9d12d66ea70ac08.zip frameworks_native-1df8c345854155cbbcb9f80de9d12d66ea70ac08.tar.gz frameworks_native-1df8c345854155cbbcb9f80de9d12d66ea70ac08.tar.bz2 |
libgui: disallow NULL Fence pointers
This change eliminates the uses of a NULL sp<Fence> indicating that no waiting
is required. Instead we use a non-NULL but invalid Fence object for which the
wait methods will return immediately.
Bug: 7892871
Change-Id: I5360aebe3090422ef6920d56c99fc4eedc642e48
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlingerConsumer.cpp | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index ead158e..7a24d4c 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -539,7 +539,7 @@ status_t HWComposer::setFramebufferTarget(int32_t id, } int acquireFenceFd = -1; - if (acquireFence != NULL) { + if (acquireFence->isValid()) { acquireFenceFd = acquireFence->dup(); } @@ -659,7 +659,7 @@ status_t HWComposer::commit() { for (size_t i=0 ; i<mNumDisplays ; i++) { DisplayData& disp(mDisplayData[i]); disp.lastDisplayFence = disp.lastRetireFence; - disp.lastRetireFence = NULL; + disp.lastRetireFence = Fence::NO_FENCE; if (disp.list) { if (disp.list->retireFenceFd != -1) { disp.lastRetireFence = new Fence(disp.list->retireFenceFd); @@ -725,9 +725,7 @@ int HWComposer::fbPost(int32_t id, if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { return setFramebufferTarget(id, acquireFence, buffer); } else { - if (acquireFence != NULL) { - acquireFence->waitForever(1000, "HWComposer::fbPost"); - } + acquireFence->waitForever(1000, "HWComposer::fbPost"); return mFbDev->post(mFbDev, buffer->handle); } } diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 99af857..1401154 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -298,7 +298,7 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& hw, if (layer.getCompositionType() == HWC_OVERLAY) { sp<Fence> fence = mSurfaceFlingerConsumer->getCurrentFence(); - if (fence.get()) { + if (fence->isValid()) { fenceFd = fence->dup(); if (fenceFd == -1) { ALOGW("failed to dup layer fence, skipping sync: %d", errno); diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp index dc9089e..e427072 100644 --- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp +++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp @@ -15,6 +15,7 @@ */ #define ATRACE_TAG ATRACE_TAG_GRAPHICS +//#define LOG_NDEBUG 0 #include "SurfaceFlingerConsumer.h" |