make sure to clear the framebuffer when using overlays
Bug: 6354761, 6353719 Change-Id: I0739de3fee7c54c14b294ffd768b70ee1f541d9e
This commit is contained in:
parent
992b4c556b
commit
b9494d5c9d
|
@ -87,7 +87,6 @@ SurfaceFlinger::SurfaceFlinger()
|
||||||
mHwWorkListDirty(false),
|
mHwWorkListDirty(false),
|
||||||
mElectronBeamAnimationMode(0),
|
mElectronBeamAnimationMode(0),
|
||||||
mDebugRegion(0),
|
mDebugRegion(0),
|
||||||
mDebugBackground(0),
|
|
||||||
mDebugDDMS(0),
|
mDebugDDMS(0),
|
||||||
mDebugDisableHWC(0),
|
mDebugDisableHWC(0),
|
||||||
mDebugDisableTransformHint(0),
|
mDebugDisableTransformHint(0),
|
||||||
|
@ -111,9 +110,6 @@ void SurfaceFlinger::init()
|
||||||
property_get("debug.sf.showupdates", value, "0");
|
property_get("debug.sf.showupdates", value, "0");
|
||||||
mDebugRegion = atoi(value);
|
mDebugRegion = atoi(value);
|
||||||
|
|
||||||
property_get("debug.sf.showbackground", value, "0");
|
|
||||||
mDebugBackground = atoi(value);
|
|
||||||
|
|
||||||
#ifdef DDMS_DEBUGGING
|
#ifdef DDMS_DEBUGGING
|
||||||
property_get("debug.sf.ddms", value, "0");
|
property_get("debug.sf.ddms", value, "0");
|
||||||
mDebugDDMS = atoi(value);
|
mDebugDDMS = atoi(value);
|
||||||
|
@ -123,7 +119,6 @@ void SurfaceFlinger::init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ALOGI_IF(mDebugRegion, "showupdates enabled");
|
ALOGI_IF(mDebugRegion, "showupdates enabled");
|
||||||
ALOGI_IF(mDebugBackground, "showbackground enabled");
|
|
||||||
ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
|
ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,9 +897,20 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
|
||||||
if (fbLayerCount) {
|
if (fbLayerCount) {
|
||||||
// Never touch the framebuffer if we don't have any framebuffer layers
|
// Never touch the framebuffer if we don't have any framebuffer layers
|
||||||
|
|
||||||
if (!mWormholeRegion.isEmpty()) {
|
if (hwc.getLayerCount(HWC_OVERLAY)) {
|
||||||
// can happen with SurfaceView
|
// when using overlays, we assume a fully transparent framebuffer
|
||||||
drawWormhole();
|
// NOTE: we could reduce how much we need to clear, for instance
|
||||||
|
// remove where there are opaque FB layers. however, on some
|
||||||
|
// GPUs doing a "clean slate" glClear might be more efficient.
|
||||||
|
// We'll revisit later if needed.
|
||||||
|
glClearColor(0, 0, 0, 0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
} else {
|
||||||
|
// screen is already cleared here
|
||||||
|
if (!mWormholeRegion.isEmpty()) {
|
||||||
|
// can happen with SurfaceView
|
||||||
|
drawWormhole();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -919,9 +925,11 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
|
||||||
const sp<LayerBase>& layer(layers[i]);
|
const sp<LayerBase>& layer(layers[i]);
|
||||||
const Region clip(dirty.intersect(layer->visibleRegionScreen));
|
const Region clip(dirty.intersect(layer->visibleRegionScreen));
|
||||||
if (!clip.isEmpty()) {
|
if (!clip.isEmpty()) {
|
||||||
if (cur && (cur[i].compositionType != HWC_FRAMEBUFFER)) {
|
if (cur && (cur[i].compositionType == HWC_OVERLAY)) {
|
||||||
if ((cur[i].hints & HWC_HINT_CLEAR_FB)
|
if (i && (cur[i].hints & HWC_HINT_CLEAR_FB)
|
||||||
&& layer->isOpaque()) {
|
&& layer->isOpaque()) {
|
||||||
|
// never clear the very first layer since we're
|
||||||
|
// guaranteed the FB is already cleared
|
||||||
layer->clearWithOpenGL(clip);
|
layer->clearWithOpenGL(clip);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -988,25 +996,9 @@ void SurfaceFlinger::drawWormhole() const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_EXTERNAL_OES);
|
glDisable(GL_TEXTURE_EXTERNAL_OES);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
glColor4f(0,0,0,0);
|
||||||
if (CC_LIKELY(!mDebugBackground)) {
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glColor4f(0,0,0,0);
|
|
||||||
} else {
|
|
||||||
const DisplayHardware& hw(graphicPlane(0).displayHardware());
|
|
||||||
const int32_t width = hw.getWidth();
|
|
||||||
const int32_t height = hw.getHeight();
|
|
||||||
const GLfloat tcoords[][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, tcoords);
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, mWormholeTexName);
|
|
||||||
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
|
||||||
glMatrixMode(GL_TEXTURE);
|
|
||||||
glLoadIdentity();
|
|
||||||
glScalef(width*(1.0f/32.0f), height*(1.0f/32.0f), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLfloat vertices[4][2];
|
GLfloat vertices[4][2];
|
||||||
glVertexPointer(2, GL_FLOAT, 0, vertices);
|
glVertexPointer(2, GL_FLOAT, 0, vertices);
|
||||||
|
@ -1024,11 +1016,6 @@ void SurfaceFlinger::drawWormhole() const
|
||||||
vertices[3][1] = r.bottom;
|
vertices[3][1] = r.bottom;
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glLoadIdentity();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t SurfaceFlinger::addLayer(const sp<LayerBase>& layer)
|
status_t SurfaceFlinger::addLayer(const sp<LayerBase>& layer)
|
||||||
|
@ -1714,10 +1701,6 @@ status_t SurfaceFlinger::onTransact(
|
||||||
invalidateHwcGeometry();
|
invalidateHwcGeometry();
|
||||||
repaintEverything();
|
repaintEverything();
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
case 1003: // SHOW_BACKGROUND
|
|
||||||
n = data.readInt32();
|
|
||||||
mDebugBackground = n ? 1 : 0;
|
|
||||||
return NO_ERROR;
|
|
||||||
case 1004:{ // repaint everything
|
case 1004:{ // repaint everything
|
||||||
repaintEverything();
|
repaintEverything();
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
|
@ -1746,7 +1729,7 @@ status_t SurfaceFlinger::onTransact(
|
||||||
reply->writeInt32(0);
|
reply->writeInt32(0);
|
||||||
reply->writeInt32(0);
|
reply->writeInt32(0);
|
||||||
reply->writeInt32(mDebugRegion);
|
reply->writeInt32(mDebugRegion);
|
||||||
reply->writeInt32(mDebugBackground);
|
reply->writeInt32(0);
|
||||||
reply->writeInt32(mDebugDisableHWC);
|
reply->writeInt32(mDebugDisableHWC);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
case 1013: {
|
case 1013: {
|
||||||
|
|
|
@ -350,7 +350,7 @@ private:
|
||||||
|
|
||||||
void debugFlashRegions();
|
void debugFlashRegions();
|
||||||
void drawWormhole() const;
|
void drawWormhole() const;
|
||||||
|
|
||||||
void listLayersLocked(const Vector<String16>& args, size_t& index,
|
void listLayersLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const;
|
String8& result, char* buffer, size_t SIZE) const;
|
||||||
void dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
void dumpStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
|
@ -402,7 +402,6 @@ private:
|
||||||
|
|
||||||
// don't use a lock for these, we don't care
|
// don't use a lock for these, we don't care
|
||||||
int mDebugRegion;
|
int mDebugRegion;
|
||||||
int mDebugBackground;
|
|
||||||
int mDebugDDMS;
|
int mDebugDDMS;
|
||||||
int mDebugDisableHWC;
|
int mDebugDisableHWC;
|
||||||
int mDebugDisableTransformHint;
|
int mDebugDisableTransformHint;
|
||||||
|
|
Loading…
Reference in New Issue