diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h index e76442549..bc630ae4e 100644 --- a/include/gui/ISurfaceTexture.h +++ b/include/gui/ISurfaceTexture.h @@ -79,8 +79,8 @@ protected: // must be monotonically increasing. Its other properties (zero point, etc) // are client-dependent, and should be documented by the client. // - // outWidth, outHeight and outTransform are filed with the default width - // default height of the window and current transform applied to buffers, + // outWidth, outHeight and outTransform are filled with the default width + // and height of the window and current transform applied to buffers, // respectively. virtual status_t queueBuffer(int slot, int64_t timestamp, uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0; diff --git a/include/surfaceflinger/ISurfaceComposerClient.h b/include/surfaceflinger/ISurfaceComposerClient.h index 6e9a65464..02cabc1cd 100644 --- a/include/surfaceflinger/ISurfaceComposerClient.h +++ b/include/surfaceflinger/ISurfaceComposerClient.h @@ -45,9 +45,6 @@ public: struct surface_data_t { int32_t token; int32_t identity; - uint32_t width; - uint32_t height; - uint32_t format; status_t readFromParcel(const Parcel& parcel); status_t writeToParcel(Parcel* parcel) const; }; diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h index c2a494de4..9c352ad9a 100644 --- a/include/surfaceflinger/Surface.h +++ b/include/surfaceflinger/Surface.h @@ -57,7 +57,6 @@ public: static bool isSameSurface( const sp& lhs, const sp& rhs); - uint32_t getFlags() const { return mFlags; } uint32_t getIdentity() const { return mIdentity; } // release surface data from java @@ -86,25 +85,13 @@ private: SurfaceControl& operator = (SurfaceControl& rhs); SurfaceControl(const SurfaceControl& rhs); - friend class SurfaceComposerClient; - - // camera and camcorder need access to the ISurface binder interface for preview - friend class CameraService; - friend class MediaRecorder; - // mediaplayer needs access to ISurface for display - friend class MediaPlayer; - // for testing - friend class Test; - // videoEditor preview classes - friend class VideoEditorPreviewController; friend class Surface; SurfaceControl( const sp& client, const sp& surface, - const ISurfaceComposerClient::surface_data_t& data, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); + const ISurfaceComposerClient::surface_data_t& data); ~SurfaceControl(); @@ -115,10 +102,6 @@ private: sp mSurface; SurfaceID mToken; uint32_t mIdentity; - uint32_t mWidth; - uint32_t mHeight; - PixelFormat mFormat; - uint32_t mFlags; mutable Mutex mLock; mutable sp mSurfaceData; @@ -139,17 +122,13 @@ public: uint32_t reserved[2]; }; - static status_t writeToParcel( - const sp& control, Parcel* parcel); - + static status_t writeToParcel(const sp& control, Parcel* parcel); static sp readFromParcel(const Parcel& data); - static bool isValid(const sp& surface) { return (surface != 0) && surface->isValid(); } bool isValid(); - uint32_t getFlags() const { return mFlags; } uint32_t getIdentity() const { return mIdentity; } sp getSurfaceTexture(); @@ -176,22 +155,14 @@ private: * private stuff... */ void init(); - status_t validate(bool inCancelBuffer = false) const; static void cleanCachedSurfacesLocked(); virtual int query(int what, int* value) const; // constants - status_t mInitCheck; sp mSurface; uint32_t mIdentity; - PixelFormat mFormat; - uint32_t mFlags; - - // query() must be called from dequeueBuffer() thread - uint32_t mWidth; - uint32_t mHeight; // A cache of Surface objects that have been deserialized into this process. static Mutex sCachedSurfacesLock; diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index bc97cacbe..ace16aaae 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -132,9 +132,6 @@ status_t ISurfaceComposerClient::surface_data_t::readFromParcel(const Parcel& pa { token = parcel.readInt32(); identity = parcel.readInt32(); - width = parcel.readInt32(); - height = parcel.readInt32(); - format = parcel.readInt32(); return NO_ERROR; } @@ -142,9 +139,6 @@ status_t ISurfaceComposerClient::surface_data_t::writeToParcel(Parcel* parcel) c { parcel->writeInt32(token); parcel->writeInt32(identity); - parcel->writeInt32(width); - parcel->writeInt32(height); - parcel->writeInt32(format); return NO_ERROR; } diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index dabe643f2..c4f9e53d5 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -26,15 +26,12 @@ #include #include -#include #include #include #include #include -#include -#include #include #include @@ -42,8 +39,6 @@ #include #include -#include - namespace android { // ============================================================================ @@ -53,12 +48,9 @@ namespace android { SurfaceControl::SurfaceControl( const sp& client, const sp& surface, - const ISurfaceComposerClient::surface_data_t& data, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) + const ISurfaceComposerClient::surface_data_t& data) : mClient(client), mSurface(surface), - mToken(data.token), mIdentity(data.identity), - mWidth(data.width), mHeight(data.height), mFormat(data.format), - mFlags(flags) + mToken(data.token), mIdentity(data.identity) { } @@ -187,24 +179,12 @@ status_t SurfaceControl::writeSurfaceToParcel( { sp sur; uint32_t identity = 0; - uint32_t width = 0; - uint32_t height = 0; - uint32_t format = 0; - uint32_t flags = 0; if (SurfaceControl::isValid(control)) { sur = control->mSurface; identity = control->mIdentity; - width = control->mWidth; - height = control->mHeight; - format = control->mFormat; - flags = control->mFlags; } parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL); parcel->writeInt32(identity); - parcel->writeInt32(width); - parcel->writeInt32(height); - parcel->writeInt32(format); - parcel->writeInt32(flags); return NO_ERROR; } @@ -225,25 +205,17 @@ sp SurfaceControl::getSurface() const Surface::Surface(const sp& surface) : SurfaceTextureClient(), - mInitCheck(NO_INIT), mSurface(surface->mSurface), - mIdentity(surface->mIdentity), - mFormat(surface->mFormat), mFlags(surface->mFlags), - mWidth(surface->mWidth), mHeight(surface->mHeight) + mIdentity(surface->mIdentity) { init(); } Surface::Surface(const Parcel& parcel, const sp& ref) - : SurfaceTextureClient(), - mInitCheck(NO_INIT) + : SurfaceTextureClient() { mSurface = interface_cast(ref); mIdentity = parcel.readInt32(); - mWidth = parcel.readInt32(); - mHeight = parcel.readInt32(); - mFormat = parcel.readInt32(); - mFlags = parcel.readInt32(); init(); } @@ -252,31 +224,16 @@ status_t Surface::writeToParcel( { sp sur; uint32_t identity = 0; - uint32_t width = 0; - uint32_t height = 0; - uint32_t format = 0; - uint32_t flags = 0; if (Surface::isValid(surface)) { sur = surface->mSurface; identity = surface->mIdentity; - width = surface->mWidth; - height = surface->mHeight; - format = surface->mFormat; - flags = surface->mFlags; } else if (surface != 0 && surface->mSurface != 0) { LOGW("Parceling invalid surface with non-NULL ISurface as NULL: " - "mSurface = %p, mIdentity = %d, mWidth = %d, mHeight = %d, " - "mFormat = %d, mFlags = 0x%08x, mInitCheck = %d", - surface->mSurface.get(), surface->mIdentity, surface->mWidth, - surface->mHeight, surface->mFormat, surface->mFlags, - surface->mInitCheck); + "mSurface = %p, mIdentity = %d", + surface->mSurface.get(), surface->mIdentity); } parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL); parcel->writeInt32(identity); - parcel->writeInt32(width); - parcel->writeInt32(height); - parcel->writeInt32(format); - parcel->writeInt32(flags); return NO_ERROR; } @@ -325,10 +282,6 @@ void Surface::init() const_cast(ANativeWindow::xdpi) = dinfo.xdpi; const_cast(ANativeWindow::ydpi) = dinfo.ydpi; const_cast(ANativeWindow::flags) = 0; - - if (surfaceTexture != NULL) { - mInitCheck = NO_ERROR; - } } } @@ -341,21 +294,11 @@ Surface::~Surface() } bool Surface::isValid() { - return mInitCheck == NO_ERROR; -} - -status_t Surface::validate(bool inCancelBuffer) const -{ - // check that we initialized ourself properly - if (mInitCheck != NO_ERROR) { - LOGE("invalid token (identity=%u)", mIdentity); - return mInitCheck; - } - return NO_ERROR; + return getISurfaceTexture() != NULL; } sp Surface::getSurfaceTexture() { - return mSurface != NULL ? mSurface->getSurfaceTexture() : NULL; + return getISurfaceTexture(); } sp Surface::asBinder() const { @@ -367,7 +310,6 @@ sp Surface::asBinder() const { int Surface::query(int what, int* value) const { switch (what) { case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: - // TODO: this is not needed anymore *value = 1; return NO_ERROR; case NATIVE_WINDOW_CONCRETE_TYPE: diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 8cead808a..3b0ffea0f 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -339,7 +339,7 @@ sp SurfaceComposerClient::createSurface( sp surface = mClient->createSurface(&data, name, display, w, h, format, flags); if (surface != 0) { - result = new SurfaceControl(this, surface, data, w, h, format, flags); + result = new SurfaceControl(this, surface, data); } } return result; diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp index 2b8f20456..c1a3c98d6 100644 --- a/libs/gui/tests/SurfaceTextureClient_test.cpp +++ b/libs/gui/tests/SurfaceTextureClient_test.cpp @@ -116,11 +116,6 @@ TEST_F(SurfaceTextureClientTest, ConcreteTypeIsSurfaceTextureClient) { EXPECT_EQ(NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT, result); } -TEST_F(SurfaceTextureClientTest, ANativeWindowLockFails) { - ANativeWindow_Buffer buf; - ASSERT_EQ(BAD_VALUE, ANativeWindow_lock(mANW.get(), &buf, NULL)); -} - TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) { EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); ASSERT_EQ(EGL_SUCCESS, eglGetError()); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 680814cf2..4a2770191 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1318,9 +1318,6 @@ sp SurfaceFlinger::createSurface( if (surfaceHandle != 0) { params->token = token; params->identity = layer->getIdentity(); - params->width = w; - params->height = h; - params->format = format; if (normalLayer != 0) { Mutex::Autolock _l(mStateLock); mLayerMap.add(layer->getSurfaceBinder(), normalLayer);