summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-08-16 14:28:37 -0700
committerJesse Hall <jessehall@google.com>2013-08-16 14:28:37 -0700
commit9e663de4fe1dcc872373ee530c60a375624671c3 (patch)
tree6ebc930f8a2626a56a19ffe033890c95d1da036e /services/surfaceflinger/DisplayHardware
parente048a4374c4e355c361f5eec0482ac85df0c73fe (diff)
downloadframeworks_native-9e663de4fe1dcc872373ee530c60a375624671c3.zip
frameworks_native-9e663de4fe1dcc872373ee530c60a375624671c3.tar.gz
frameworks_native-9e663de4fe1dcc872373ee530c60a375624671c3.tar.bz2
Use new HWC display type/count constants.
Change-Id: I774d0c68906ac6dc69268f708c30a6b0868b8816
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp19
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h23
2 files changed, 19 insertions, 23 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index f6256f9..ef07f18 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -48,15 +48,8 @@
namespace android {
-#ifndef HWC_DEVICE_API_VERSION_1_3
-#define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION)
-#endif
-
#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;
@@ -96,7 +89,7 @@ HWComposer::HWComposer(
mEventHandler(handler),
mVSyncCount(0), mDebugForceFakeVSync(false)
{
- for (size_t i =0 ; i<MAX_DISPLAYS ; i++) {
+ for (size_t i =0 ; i<MAX_HWC_DISPLAYS ; i++) {
mLists[i] = 0;
}
@@ -127,7 +120,7 @@ HWComposer::HWComposer(
}
// these display IDs are always reserved
- for (size_t i=0 ; i<NUM_PHYSICAL_DISPLAYS ; i++) {
+ for (size_t i=0 ; i<NUM_BUILTIN_DISPLAYS ; i++) {
mAllocatedDisplayIDs.markBit(i);
}
@@ -156,10 +149,10 @@ HWComposer::HWComposer(
// hw composer version
if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) {
// 1.3 adds support for virtual displays
- mNumDisplays = MAX_DISPLAYS;
+ mNumDisplays = MAX_HWC_DISPLAYS;
} else if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
// 1.1 adds support for multiple displays
- mNumDisplays = NUM_PHYSICAL_DISPLAYS;
+ mNumDisplays = NUM_BUILTIN_DISPLAYS;
} else {
mNumDisplays = 1;
}
@@ -187,7 +180,7 @@ HWComposer::HWComposer(
}
} else if (mHwc) {
// here we're guaranteed to have at least HWC 1.1
- for (size_t i =0 ; i<NUM_PHYSICAL_DISPLAYS ; i++) {
+ for (size_t i =0 ; i<NUM_BUILTIN_DISPLAYS ; i++) {
queryDisplayProperties(i);
}
}
@@ -400,7 +393,7 @@ int32_t HWComposer::allocateDisplayId() {
}
status_t HWComposer::freeDisplayId(int32_t id) {
- if (id < NUM_PHYSICAL_DISPLAYS) {
+ if (id < NUM_BUILTIN_DISPLAYS) {
// cannot free the reserved IDs
return BAD_VALUE;
}
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 0462bcc..d901c62 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -64,7 +64,9 @@ public:
};
enum {
- MAX_DISPLAYS = HWC_NUM_DISPLAY_TYPES + 1
+ NUM_BUILTIN_DISPLAYS = HWC_NUM_PHYSICAL_DISPLAY_TYPES,
+ MAX_HWC_DISPLAYS = HWC_NUM_DISPLAY_TYPES,
+ VIRTUAL_DISPLAY_ID_BASE = HWC_DISPLAY_VIRTUAL,
};
HWComposer(
@@ -75,15 +77,16 @@ public:
status_t initCheck() const;
- // returns a display ID starting at MAX_DISPLAYS, this ID
- // is to be used with createWorkList (and all other
- // methods requiring an ID below).
- // IDs below MAX_DISPLAY are pre-defined and therefore are always valid.
- // returns a negative error code if an ID cannot be allocated
+ // Returns a display ID starting at VIRTUAL_DISPLAY_ID_BASE, this ID is to
+ // be used with createWorkList (and all other methods requiring an ID
+ // below).
+ // IDs below NUM_BUILTIN_DISPLAYS are pre-defined and therefore are
+ // always valid.
+ // Returns -1 if an ID cannot be allocated
int32_t allocateDisplayId();
- // recycles the given ID and frees the associated worklist.
- // IDs below MAX_DISPLAYS are not recycled
+ // Recycles the given virtual display ID and frees the associated worklist.
+ // IDs below NUM_BUILTIN_DISPLAYS are not recycled.
status_t freeDisplayId(int32_t id);
@@ -333,8 +336,8 @@ private:
struct hwc_composer_device_1* mHwc;
// invariant: mLists[0] != NULL iff mHwc != NULL
// mLists[i>0] can be NULL. that display is to be ignored
- struct hwc_display_contents_1* mLists[MAX_DISPLAYS];
- DisplayData mDisplayData[MAX_DISPLAYS];
+ struct hwc_display_contents_1* mLists[MAX_HWC_DISPLAYS];
+ DisplayData mDisplayData[MAX_HWC_DISPLAYS];
size_t mNumDisplays;
cb_context* mCBContext;