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

Commit f6134e7c authored by Denise Cheng's avatar Denise Cheng Committed by Giulio Cervera
Browse files

SurfaceTexture: Reset buffer values during connect

Reset buffer values during connect instead of disconnect since other
clients may still be accessing the SurfaceTexture after disconnect.

CRs-fixed: 360883 375225
(cherry picked from commit e324ee6f793ddb1031c97fe71d64c42cd3b8f315)

Change-Id: Ib2c04a1b224fd5f278d0da665e8d23d7fe97b2ef
parent 35f5cf4d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -751,6 +751,13 @@ status_t SurfaceTexture::connect(int api,
                        mConnectedApi, api);
                err = -EINVAL;
            } else {
#ifdef QCOM_HARDWARE
                memcpy(mCurrentTransformMatrix, mtxIdentity,
                        sizeof(mCurrentTransformMatrix));
                mNextBufferInfo.width = 0;
                mNextBufferInfo.height = 0;
                mNextBufferInfo.format = 0;
#endif
                mConnectedApi = api;
                *outWidth = mDefaultWidth;
                *outHeight = mDefaultHeight;
@@ -786,13 +793,6 @@ status_t SurfaceTexture::disconnect(int api) {
                mNextCrop.makeInvalid();
                mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
                mNextTransform = 0;
#ifdef QCOM_HARDWARE
                memcpy(mCurrentTransformMatrix, mtxIdentity,
                       sizeof(mCurrentTransformMatrix));
                mNextBufferInfo.width = 0;
                mNextBufferInfo.height = 0;
                mNextBufferInfo.format = 0;
#endif
                mDequeueCondition.signal();
            } else {
                ST_LOGE("disconnect: connected to another api (cur=%d, req=%d)",