summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-03-20 13:42:29 -0700
committerJesse Hall <jessehall@google.com>2013-03-22 09:56:58 -0700
commitafaf14b9fbfe8943d845e2f01e8a401ad7a4d854 (patch)
treedfe47ff651f5354cf06ee0eb42621a7f58bca297 /services/surfaceflinger/DisplayHardware
parent13f01cbdbd34779a234bc674df79e23672fd5c0b (diff)
downloadframeworks_native-afaf14b9fbfe8943d845e2f01e8a401ad7a4d854.zip
frameworks_native-afaf14b9fbfe8943d845e2f01e8a401ad7a4d854.tar.gz
frameworks_native-afaf14b9fbfe8943d845e2f01e8a401ad7a4d854.tar.bz2
Use descriptive aliases instead of HWC_NUM_DISPLAY_TYPES
Bug: 8384764 Change-Id: Ia2563fab19dbc6e4a95bed03445e609334841cca
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index eb7d128..9d32410 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -49,6 +49,9 @@ namespace android {
#define MIN_HWC_HEADER_VERSION HWC_HEADER_VERSION
+#define NUM_PHYSICAL_DISPLAYS HWC_NUM_DISPLAY_TYPES
+#define VIRTUAL_DISPLAY_ID_BASE HWC_NUM_DISPLAY_TYPES
+
static uint32_t hwcApiVersion(const hwc_composer_device_1_t* hwc) {
uint32_t hwcVersion = hwc->common.version;
return hwcVersion & HARDWARE_API_VERSION_2_MAJ_MIN_MASK;
@@ -119,7 +122,7 @@ HWComposer::HWComposer(
}
// these display IDs are always reserved
- for (size_t i=0 ; i<HWC_NUM_DISPLAY_TYPES ; i++) {
+ for (size_t i=0 ; i<NUM_PHYSICAL_DISPLAYS ; i++) {
mAllocatedDisplayIDs.markBit(i);
}
@@ -151,7 +154,7 @@ HWComposer::HWComposer(
mNumDisplays = MAX_DISPLAYS;
} else if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
// 1.1 adds support for multiple displays
- mNumDisplays = HWC_NUM_DISPLAY_TYPES;
+ mNumDisplays = NUM_PHYSICAL_DISPLAYS;
} else {
mNumDisplays = 1;
}
@@ -179,7 +182,7 @@ HWComposer::HWComposer(
}
} else if (mHwc) {
// here we're guaranteed to have at least HWC 1.1
- for (size_t i =0 ; i<HWC_NUM_DISPLAY_TYPES ; i++) {
+ for (size_t i =0 ; i<NUM_PHYSICAL_DISPLAYS ; i++) {
queryDisplayProperties(i);
}
}
@@ -284,7 +287,7 @@ void HWComposer::vsync(int disp, int64_t timestamp) {
}
void HWComposer::hotplug(int disp, int connected) {
- if (disp == HWC_DISPLAY_PRIMARY || disp >= HWC_NUM_DISPLAY_TYPES) {
+ if (disp == HWC_DISPLAY_PRIMARY || disp >= VIRTUAL_DISPLAY_ID_BASE) {
ALOGE("hotplug event received for invalid display: disp=%d connected=%d",
disp, connected);
return;
@@ -383,7 +386,7 @@ int32_t HWComposer::allocateDisplayId() {
}
status_t HWComposer::freeDisplayId(int32_t id) {
- if (id < HWC_NUM_DISPLAY_TYPES) {
+ if (id < NUM_PHYSICAL_DISPLAYS) {
// cannot free the reserved IDs
return BAD_VALUE;
}
@@ -657,7 +660,7 @@ status_t HWComposer::commit() {
// For virtual displays, the framebufferTarget buffer also serves as
// the HWC output buffer, so we need to copy the buffer handle and
// dup() the acquire fence.
- for (size_t i=HWC_NUM_DISPLAY_TYPES; i<mNumDisplays; i++) {
+ for (size_t i=VIRTUAL_DISPLAY_ID_BASE; i<mNumDisplays; i++) {
DisplayData& disp(mDisplayData[i]);
if (disp.framebufferTarget) {
mLists[i]->outbuf = disp.framebufferTarget->handle;
@@ -685,7 +688,7 @@ status_t HWComposer::commit() {
}
status_t HWComposer::release(int disp) {
- LOG_FATAL_IF(disp >= HWC_NUM_DISPLAY_TYPES);
+ LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
if (mHwc) {
eventControl(disp, HWC_EVENT_VSYNC, 0);
return (status_t)mHwc->blank(mHwc, disp, 1);
@@ -694,7 +697,7 @@ status_t HWComposer::release(int disp) {
}
status_t HWComposer::acquire(int disp) {
- LOG_FATAL_IF(disp >= HWC_NUM_DISPLAY_TYPES);
+ LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
if (mHwc) {
return (status_t)mHwc->blank(mHwc, disp, 0);
}