fix "show screen update" debug option.

Change-Id: I7d8b24124768b5f7d59d3bb0b019e9baaa0dfc4f
NOTE: from now on, this also disable the h/w composer
This commit is contained in:
Mathias Agopian 2011-08-22 21:44:41 -07:00
parent d8d4366e72
commit 53331da007
2 changed files with 27 additions and 20 deletions

View File

@ -822,7 +822,7 @@ void SurfaceFlinger::handleWorkList()
hwc_layer_t* const cur(hwc.getLayers()); hwc_layer_t* const cur(hwc.getLayers());
for (size_t i=0 ; cur && i<count ; i++) { for (size_t i=0 ; cur && i<count ; i++) {
currentLayers[i]->setGeometry(&cur[i]); currentLayers[i]->setGeometry(&cur[i]);
if (mDebugDisableHWC) { if (mDebugDisableHWC || mDebugRegion) {
cur[i].compositionType = HWC_FRAMEBUFFER; cur[i].compositionType = HWC_FRAMEBUFFER;
cur[i].flags |= HWC_SKIP_LAYER; cur[i].flags |= HWC_SKIP_LAYER;
} }
@ -974,6 +974,10 @@ void SurfaceFlinger::debugFlashRegions()
{ {
const DisplayHardware& hw(graphicPlane(0).displayHardware()); const DisplayHardware& hw(graphicPlane(0).displayHardware());
const uint32_t flags = hw.getFlags(); const uint32_t flags = hw.getFlags();
const int32_t height = hw.getHeight();
if (mInvalidRegion.isEmpty()) {
return;
}
if (!((flags & DisplayHardware::SWAP_RECTANGLE) || if (!((flags & DisplayHardware::SWAP_RECTANGLE) ||
(flags & DisplayHardware::BUFFER_PRESERVED))) { (flags & DisplayHardware::BUFFER_PRESERVED))) {
@ -999,26 +1003,21 @@ void SurfaceFlinger::debugFlashRegions()
while (it != end) { while (it != end) {
const Rect& r = *it++; const Rect& r = *it++;
GLfloat vertices[][2] = { GLfloat vertices[][2] = {
{ r.left, r.top }, { r.left, height - r.top },
{ r.left, r.bottom }, { r.left, height - r.bottom },
{ r.right, r.bottom }, { r.right, height - r.bottom },
{ r.right, r.top } { r.right, height - r.top }
}; };
glVertexPointer(2, GL_FLOAT, 0, vertices); glVertexPointer(2, GL_FLOAT, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
} }
if (mInvalidRegion.isEmpty()) {
mDirtyRegion.dump("mDirtyRegion");
mInvalidRegion.dump("mInvalidRegion");
}
hw.flip(mInvalidRegion); hw.flip(mInvalidRegion);
if (mDebugRegion > 1) if (mDebugRegion > 1)
usleep(mDebugRegion * 1000); usleep(mDebugRegion * 1000);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
//mDirtyRegion.dump("mDirtyRegion");
} }
void SurfaceFlinger::drawWormhole() const void SurfaceFlinger::drawWormhole() const
@ -1581,7 +1580,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
HWComposer& hwc(hw.getHwComposer()); HWComposer& hwc(hw.getHwComposer());
snprintf(buffer, SIZE, " h/w composer %s and %s\n", snprintf(buffer, SIZE, " h/w composer %s and %s\n",
hwc.initCheck()==NO_ERROR ? "present" : "not present", hwc.initCheck()==NO_ERROR ? "present" : "not present",
mDebugDisableHWC ? "disabled" : "enabled"); (mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
result.append(buffer); result.append(buffer);
hwc.dump(result, buffer, SIZE); hwc.dump(result, buffer, SIZE);
@ -1660,21 +1659,15 @@ status_t SurfaceFlinger::onTransact(
case 1002: // SHOW_UPDATES case 1002: // SHOW_UPDATES
n = data.readInt32(); n = data.readInt32();
mDebugRegion = n ? n : (mDebugRegion ? 0 : 1); mDebugRegion = n ? n : (mDebugRegion ? 0 : 1);
invalidateHwcGeometry();
repaintEverything();
return NO_ERROR; return NO_ERROR;
case 1003: // SHOW_BACKGROUND case 1003: // SHOW_BACKGROUND
n = data.readInt32(); n = data.readInt32();
mDebugBackground = n ? 1 : 0; mDebugBackground = n ? 1 : 0;
return NO_ERROR; return NO_ERROR;
case 1008: // toggle use of hw composer
n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0;
invalidateHwcGeometry();
// fall-through...
case 1004:{ // repaint everything case 1004:{ // repaint everything
Mutex::Autolock _l(mStateLock); repaintEverything();
const DisplayHardware& hw(graphicPlane(0).displayHardware());
mDirtyRegion.set(hw.bounds()); // careful that's not thread-safe
signalEvent();
return NO_ERROR; return NO_ERROR;
} }
case 1005:{ // force transaction case 1005:{ // force transaction
@ -1690,6 +1683,12 @@ status_t SurfaceFlinger::onTransact(
mFreezeCount = data.readInt32(); mFreezeCount = data.readInt32();
mFreezeDisplayTime = 0; mFreezeDisplayTime = 0;
return NO_ERROR; return NO_ERROR;
case 1008: // toggle use of hw composer
n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0;
invalidateHwcGeometry();
repaintEverything();
return NO_ERROR;
case 1010: // interrogate. case 1010: // interrogate.
reply->writeInt32(0); reply->writeInt32(0);
reply->writeInt32(0); reply->writeInt32(0);
@ -1707,6 +1706,13 @@ status_t SurfaceFlinger::onTransact(
return err; return err;
} }
void SurfaceFlinger::repaintEverything() {
Mutex::Autolock _l(mStateLock);
const DisplayHardware& hw(graphicPlane(0).displayHardware());
mDirtyRegion.set(hw.bounds()); // careful that's not thread-safe
signalEvent();
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy, status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,

View File

@ -278,6 +278,7 @@ private:
void handleRepaint(); void handleRepaint();
void postFramebuffer(); void postFramebuffer();
void composeSurfaces(const Region& dirty); void composeSurfaces(const Region& dirty);
void repaintEverything();
ssize_t addClientLayer(const sp<Client>& client, ssize_t addClientLayer(const sp<Client>& client,