From 367dc0bd5f0fea8dcf9534d0e6b127dd467adc50 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 25 Oct 2010 16:29:24 -0700 Subject: [PATCH] Updade Surface (ANativeWindow) format based on its buffers format this is to allow applications to change the format of a surface's buffer, and have it reflected in EGL; which is needed for EGLConfig validation. Change-Id: Iee074c30ad765881e2409c1d37450b05e561c44d --- libs/surfaceflinger_client/Surface.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp index d44aab994..854a3c6fd 100644 --- a/libs/surfaceflinger_client/Surface.cpp +++ b/libs/surfaceflinger_client/Surface.cpp @@ -866,7 +866,18 @@ int Surface::setBuffersGeometry(int w, int h, int format) return BAD_VALUE; Mutex::Autolock _l(mSurfaceLock); + if (mConnected == NATIVE_WINDOW_API_EGL) { + return INVALID_OPERATION; + } + mBufferInfo.set(w, h, format); + if (format != 0) { + // we update the format of the surface as reported by query(). + // this is to allow applications to change the format of a surface's + // buffer, and have it reflected in EGL; which is needed for + // EGLConfig validation. + mFormat = format; + } return NO_ERROR; }