am d555684c: reinstate black-screenshot debugging code

* commit 'd555684cb36dfb959694db76962e570184f98838':
  reinstate black-screenshot debugging code
This commit is contained in:
Mathias Agopian 2013-09-19 17:13:52 -07:00 committed by Android Git Automerger
commit 754bad4534
4 changed files with 20 additions and 9 deletions

View File

@ -201,6 +201,10 @@ void RenderEngine::deleteTextures(size_t count, uint32_t const* names) {
glDeleteTextures(count, names);
}
void RenderEngine::readPixels(size_t l, size_t b, size_t w, size_t h, uint32_t* pixels) {
glReadPixels(l, b, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
}
void RenderEngine::dump(String8& result) {
const GLExtensions& extensions(GLExtensions::getInstance());
result.appendFormat("GLES: %s, %s, %s\n",

View File

@ -70,6 +70,7 @@ public:
void disableScissor();
void genTextures(size_t count, uint32_t* names);
void deleteTextures(size_t count, uint32_t const* names);
void readPixels(size_t l, size_t b, size_t w, size_t h, uint32_t* pixels);
class BindImageAsFramebuffer {
RenderEngine& mEngine;
@ -106,8 +107,6 @@ public:
virtual size_t getMaxTextureSize() const = 0;
virtual size_t getMaxViewportDims() const = 0;
EGLContext getEGLContext() const;
};

View File

@ -2832,6 +2832,15 @@ status_t SurfaceFlinger::captureScreenImplLocked(
// dependent on the context's EGLConfig.
renderScreenImplLocked(hw, reqWidth, reqHeight,
minLayerZ, maxLayerZ, true);
if (DEBUG_SCREENSHOTS) {
uint32_t* pixels = new uint32_t[reqWidth*reqHeight];
getRenderEngine().readPixels(0, 0, reqWidth, reqHeight, pixels);
checkScreenshot(reqWidth, reqHeight, reqWidth, pixels,
hw, minLayerZ, maxLayerZ);
delete [] pixels;
}
} else {
ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot");
result = INVALID_OPERATION;
@ -2852,13 +2861,12 @@ status_t SurfaceFlinger::captureScreenImplLocked(
return result;
}
void SurfaceFlinger::checkScreenshot(const sp<GraphicBuffer>& buf, void const* vaddr,
const sp<const DisplayDevice>& hw,
uint32_t minLayerZ, uint32_t maxLayerZ) {
void SurfaceFlinger::checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr,
const sp<const DisplayDevice>& hw, uint32_t minLayerZ, uint32_t maxLayerZ) {
if (DEBUG_SCREENSHOTS) {
for (ssize_t y=0 ; y<buf->height ; y++) {
uint32_t const * p = (uint32_t const *)vaddr + y*buf->stride;
for (ssize_t x=0 ; x<buf->width ; x++) {
for (size_t y=0 ; y<h ; y++) {
uint32_t const * p = (uint32_t const *)vaddr + y*s;
for (size_t x=0 ; x<w ; x++) {
if (p[x] != 0xFF000000) return;
}
}

View File

@ -388,7 +388,7 @@ private:
void dumpAllLocked(const Vector<String16>& args, size_t& index, String8& result) const;
bool startDdmConnection();
static void appendSfConfigString(String8& result);
void checkScreenshot(const sp<GraphicBuffer>& buf, void const* vaddr,
void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr,
const sp<const DisplayDevice>& hw,
uint32_t minLayerZ, uint32_t maxLayerZ);