Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d555684c authored by Mathias Agopian's avatar Mathias Agopian
Browse files

reinstate black-screenshot debugging code

turned off by default.

Bug: 10809349
Change-Id: I3e6b8c7860e6b0e122b8f07de4020967cd1f005c
parent e2a3e872
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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",
+1 −2
Original line number Diff line number Diff line
@@ -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;
};

+14 −6
Original line number Diff line number Diff line
@@ -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;
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -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);