Skip to content

Commit

Permalink
Fix emulator vsync
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fadden committed Oct 19, 2012
1 parent 60393d4 commit 620685c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions services/surfaceflinger/DisplayHardware/HWComposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ HWComposer::HWComposer(
abort();
}

// these display IDs are always reserved
for (size_t i=0 ; i<HWC_NUM_DISPLAY_TYPES ; i++) {
mAllocatedDisplayIDs.markBit(i);
}

if (mHwc) {
ALOGI("Using %s version %u.%u", HWC_HARDWARE_COMPOSER,
(hwcApiVersion(mHwc) >> 24) & 0xff,
Expand All @@ -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 ; i<HWC_NUM_DISPLAY_TYPES ; i++) {
mAllocatedDisplayIDs.markBit(i);
}

// the number of displays we actually have depends on the
// hw composer version
if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_2)) {
Expand Down Expand Up @@ -445,6 +445,13 @@ bool HWComposer::isConnected(int disp) const {

void HWComposer::eventControl(int disp, int event, int enabled) {
if (uint32_t(disp)>31 || !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;
Expand Down

0 comments on commit 620685c

Please sign in to comment.