add a way to toggle the h/w composer at runtime

to DISABLE the h/w composer:
  adb shell service call SurfaceFlinger 1008 i32 1

to ENABLE the h/w composer:
  adb shell service call SurfaceFlinger 1008 i32 0

the state is dumped in "dumpsys SurfaceFlinger"

Change-Id: I23e2242d42c6e3fd5261a83332dd900b189e38ce
This commit is contained in:
Mathias Agopian 2010-09-22 18:58:01 -07:00
parent 583d8577b3
commit 73d3ba9e50
2 changed files with 18 additions and 0 deletions

View File

@ -85,6 +85,7 @@ SurfaceFlinger::SurfaceFlinger()
mFreezeDisplayTime(0),
mDebugRegion(0),
mDebugBackground(0),
mDebugDisableHWC(0),
mDebugInSwapBuffers(0),
mLastSwapBufferTime(0),
mDebugInTransaction(0),
@ -768,6 +769,10 @@ void SurfaceFlinger::handleWorkList()
hwc_layer_t* const cur(hwc.getLayers());
for (size_t i=0 ; cur && i<count ; i++) {
currentLayers[i]->setGeometry(&cur[i]);
if (mDebugDisableHWC) {
cur[i].compositionType = HWC_FRAMEBUFFER;
cur[i].flags |= HWC_SKIP_LAYER;
}
}
}
}
@ -901,6 +906,7 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
continue;
}
}
const sp<LayerBase>& layer(layers[i]);
const Region clip(dirty.intersect(layer->visibleRegionScreen));
if (!clip.isEmpty()) {
@ -1522,6 +1528,12 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
result.append(buffer);
}
HWComposer& hwc(hw.getHwComposer());
snprintf(buffer, SIZE, " h/w composer %s and %s\n",
hwc.initCheck()==NO_ERROR ? "present" : "not present",
mDebugDisableHWC ? "disabled" : "enabled");
result.append(buffer);
const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
alloc.dump(result);
@ -1580,6 +1592,11 @@ status_t SurfaceFlinger::onTransact(
n = data.readInt32();
mDebugBackground = n ? 1 : 0;
return NO_ERROR;
case 1008: // toggle use of hw composer
n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0;
mHwWorkListDirty = true;
// fall-through...
case 1004:{ // repaint everything
Mutex::Autolock _l(mStateLock);
const DisplayHardware& hw(graphicPlane(0).displayHardware());

View File

@ -382,6 +382,7 @@ private:
// don't use a lock for these, we don't care
int mDebugRegion;
int mDebugBackground;
int mDebugDisableHWC;
volatile nsecs_t mDebugInSwapBuffers;
nsecs_t mLastSwapBufferTime;
volatile nsecs_t mDebugInTransaction;