diff options
author | Mathias Agopian <mathias@google.com> | 2013-09-20 11:20:44 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-20 11:20:44 -0700 |
commit | 1c479c56da44c8942ab3d858ebcc19e4a6f76786 (patch) | |
tree | 89923c9089591c2356d8b8968e7ee9cb407254fc /services | |
parent | 4d5755389d111eb58ba5bdade84a39614dd222ed (diff) | |
parent | 754bad4534e9a2de8b4e3ecbe097993c71246f91 (diff) | |
download | frameworks_native-1c479c56da44c8942ab3d858ebcc19e4a6f76786.zip frameworks_native-1c479c56da44c8942ab3d858ebcc19e4a6f76786.tar.gz frameworks_native-1c479c56da44c8942ab3d858ebcc19e4a6f76786.tar.bz2 |
am 754bad45: am d555684c: reinstate black-screenshot debugging code
* commit '754bad4534e9a2de8b4e3ecbe097993c71246f91':
reinstate black-screenshot debugging code
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/RenderEngine/RenderEngine.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/RenderEngine/RenderEngine.h | 3 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 20 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 |
4 files changed, 20 insertions, 9 deletions
diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.cpp b/services/surfaceflinger/RenderEngine/RenderEngine.cpp index c36fcde..ba82cad 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/RenderEngine.cpp @@ -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", diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.h b/services/surfaceflinger/RenderEngine/RenderEngine.h index 5f331d4..3c7f9ab 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/RenderEngine.h @@ -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; }; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 4bb487c..240c08a 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2865,6 +2865,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; @@ -2885,13 +2894,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; } } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 27205e2..70ea555 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -389,7 +389,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); |