Pass the correct number of displays based on HWC version

Change-Id: I27372f5d3102ad56f6d67722d631ae18d37f8330
This commit is contained in:
Jesse Hall 2012-08-22 11:50:00 -07:00
parent 9f54ac3886
commit 8f971ff666
2 changed files with 10 additions and 8 deletions

View File

@ -182,7 +182,7 @@ HWComposer::HWComposer(
EventHandler& handler,
framebuffer_device_t const* fbDev)
: mFlinger(flinger),
mModule(0), mHwc(0), mCapacity(0),
mModule(0), mHwc(0), mNumDisplays(1), mCapacity(0),
mNumOVLayers(0), mNumFBLayers(0),
mCBContext(new cb_context),
mEventHandler(handler), mRefreshPeriod(0),
@ -234,8 +234,11 @@ HWComposer::HWComposer(
memset(mCBContext->procs.zero, 0, sizeof(mCBContext->procs.zero));
}
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_1))
mNumDisplays = HWC_NUM_DISPLAY_TYPES;
// create initial empty display contents for display 0
createWorkList(MAIN, 0);
createWorkList(HWC_DISPLAY_PRIMARY, 0);
}
}
@ -358,7 +361,7 @@ status_t HWComposer::createWorkList(int32_t id, size_t numLayers) {
}
status_t HWComposer::prepare() const {
int err = hwcPrepare(mHwc, 1,
int err = hwcPrepare(mHwc, mNumDisplays,
const_cast<hwc_display_contents_1_t**>(mLists));
if (err == NO_ERROR) {
@ -428,7 +431,7 @@ size_t HWComposer::getLayerCount(int32_t id, int type) const {
status_t HWComposer::commit(void* fbDisplay, void* fbSurface) const {
int err = NO_ERROR;
if (mHwc) {
err = hwcSet(mHwc, fbDisplay, fbSurface, 1,
err = hwcSet(mHwc, fbDisplay, fbSurface, mNumDisplays,
const_cast<hwc_display_contents_1_t**>(mLists));
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
if (mLists[0]->flipFenceFd != -1) {
@ -461,7 +464,7 @@ status_t HWComposer::acquire() const {
status_t HWComposer::disable() {
if (mHwc) {
hwcNumHwLayers(mHwc, mLists[0]) = 0;
int err = hwcPrepare(mHwc, 1, mLists);
int err = hwcPrepare(mHwc, mNumDisplays, mLists);
return (status_t)err;
}
return NO_ERROR;

View File

@ -58,9 +58,7 @@ public:
};
enum {
MAIN = 0,
HDMI = 1,
MAX_DISPLAYS
MAX_DISPLAYS = HWC_NUM_DISPLAY_TYPES + 1
};
HWComposer(
@ -245,6 +243,7 @@ private:
// TODO: decide whether mLists[i>0] should be non-NULL when display i is
// not attached/enabled.
struct hwc_display_contents_1* mLists[MAX_DISPLAYS];
size_t mNumDisplays;
size_t mCapacity;
mutable size_t mNumOVLayers;