Merge "SurfaceFlinger: track the HWC retire fences"

This commit is contained in:
Jamie Gennis 2012-11-19 16:37:42 -08:00 committed by Android (Google) Code Review
commit e64b38fad2
2 changed files with 16 additions and 2 deletions

View File

@ -419,6 +419,11 @@ nsecs_t HWComposer::getRefreshTimestamp(int disp) const {
return now - ((now - mLastHwVSync) % mDisplayData[disp].refresh);
}
sp<Fence> HWComposer::getDisplayFence(int disp) const {
return mDisplayData[disp].lastDisplayFence;
}
uint32_t HWComposer::getWidth(int disp) const {
return mDisplayData[disp].width;
}
@ -663,9 +668,11 @@ status_t HWComposer::commit() {
for (size_t i=0 ; i<mNumDisplays ; i++) {
DisplayData& disp(mDisplayData[i]);
disp.lastDisplayFence = disp.lastRetireFence;
disp.lastRetireFence = NULL;
if (disp.list) {
if (disp.list->retireFenceFd != -1) {
close(disp.list->retireFenceFd);
disp.lastRetireFence = new Fence(disp.list->retireFenceFd);
disp.list->retireFenceFd = -1;
}
disp.list->flags &= ~HWC_GEOMETRY_CHANGED;

View File

@ -22,13 +22,15 @@
#include <hardware/hwcomposer_defs.h>
#include <ui/Fence.h>
#include <utils/BitSet.h>
#include <utils/Condition.h>
#include <utils/Mutex.h>
#include <utils/StrongPointer.h>
#include <utils/Thread.h>
#include <utils/Timers.h>
#include <utils/Vector.h>
#include <utils/BitSet.h>
extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *request,
@ -233,6 +235,7 @@ public:
// HWC_DISPLAY_PRIMARY).
nsecs_t getRefreshPeriod(int disp) const;
nsecs_t getRefreshTimestamp(int disp) const;
sp<Fence> getDisplayFence(int disp) const;
uint32_t getWidth(int disp) const;
uint32_t getHeight(int disp) const;
uint32_t getFormat(int disp) const;
@ -306,6 +309,10 @@ private:
hwc_display_contents_1* list;
hwc_layer_1* framebufferTarget;
buffer_handle_t fbTargetHandle;
sp<Fence> lastRetireFence; // signals when the last set op retires
sp<Fence> lastDisplayFence; // signals when the last set op takes
// effect on screen
// protected by mEventControlLock
int32_t events;
};