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

Commit 9ed9e79b authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge changes I083c4133,If904634e

* changes:
  make sure to re-initialize SurfaceTexture to its default state on disconnect
  Fix screenshots
parents 2b9eaaf8 70e3f81d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -608,6 +608,9 @@ status_t SurfaceTexture::disconnect(int api) {
            if (mConnectedApi == api) {
                drainQueueAndFreeBuffersLocked();
                mConnectedApi = NO_CONNECTED_API;
                mNextCrop.makeInvalid();
                mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
                mNextTransform = 0;
                mDequeueCondition.signal();
            } else {
                LOGE("disconnect: connected to another api (cur=%d, req=%d)",
@@ -1022,7 +1025,7 @@ void SurfaceTexture::dump(String8& result, const char* prefix,
            mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
            mCurrentTransform, mCurrentTexture,
            prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom,
            mCurrentTransform, fifoSize, fifo.string()
            mNextTransform, fifoSize, fifo.string()
    );
    result.append(buffer);

+9 −2
Original line number Diff line number Diff line
@@ -407,9 +407,16 @@ int SurfaceTextureClient::disconnect(int api) {
    LOGV("SurfaceTextureClient::disconnect");
    Mutex::Autolock lock(mMutex);
    int err = mSurfaceTexture->disconnect(api);
    if (!err && api == NATIVE_WINDOW_API_CPU) {
    if (!err) {
        freeAllBuffers();
        mReqFormat = 0;
        mReqWidth = 0;
        mReqHeight = 0;
        mReqUsage = 0;
        if (api == NATIVE_WINDOW_API_CPU) {
            mConnectedToCpu = false;
        }
    }
    return err;
}

+13 −7
Original line number Diff line number Diff line
@@ -2211,6 +2211,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
    const size_t count = layers.size();
    for (size_t i=0 ; i<count ; ++i) {
        const sp<LayerBase>& layer(layers[i]);
        const uint32_t flags = layer->drawingState().flags;
        if (!(flags & ISurfaceComposer::eLayerHidden)) {
            const uint32_t z = layer->drawingState().z;
            if (z >= minLayerZ && z <= maxLayerZ) {
                if (layer->isProtected()) {
@@ -2218,6 +2220,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
                }
            }
        }
    }

    if (!GLExtensions::getInstance().haveFramebufferObject())
        return INVALID_OPERATION;
@@ -2270,11 +2273,14 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,

        for (size_t i=0 ; i<count ; ++i) {
            const sp<LayerBase>& layer(layers[i]);
            const uint32_t flags = layer->drawingState().flags;
            if (!(flags & ISurfaceComposer::eLayerHidden)) {
                const uint32_t z = layer->drawingState().z;
                if (z >= minLayerZ && z <= maxLayerZ) {
                    layer->drawForSreenShot();
                }
            }
        }

        // XXX: this is needed on tegra
        glEnable(GL_SCISSOR_TEST);