From 620685c2e684082c82657732d1e35cefd0c79006 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 19 Oct 2012 12:53:46 -0700 Subject: [PATCH] Fix emulator vsync The code that reserves display IDs was only run when a hardware composer was present. The eventControl() function, which handles enabling of vsync, was ignoring the request because the primary display didn't appear in its set of allocated IDs. This moves reservation of IDs for built-in displays outside the HWC-only block. Also, added a couple of warnings in eventControl(). Bug 7376568 Change-Id: I185ccdf817a25499b5c2668f8f6d594afb8c1568 --- .../DisplayHardware/HWComposer.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index d9bda11fc..31d731eae 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -128,6 +128,11 @@ HWComposer::HWComposer( abort(); } + // these display IDs are always reserved + for (size_t i=0 ; i> 24) & 0xff, @@ -149,11 +154,6 @@ HWComposer::HWComposer( // always turn vsync off when we start eventControl(HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, 0); - // these IDs are always reserved - for (size_t i=0 ; i31 || !mAllocatedDisplayIDs.hasBit(disp)) { + ALOGD("eventControl ignoring event %d on unallocated disp %d (en=%d)", + event, disp, enabled); + return; + } + if (event != EVENT_VSYNC) { + ALOGW("eventControl got unexpected event %d (disp=%d en=%d)", + event, disp, enabled); return; } status_t err = NO_ERROR;