diff options
author | Mathias Agopian <mathias@google.com> | 2012-07-25 18:56:13 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-07-25 21:13:10 -0700 |
commit | c666cae2d5995097ec49a87e375e2afdd92802b7 (patch) | |
tree | 235abd54f4c3c6ed2c6b59bbade55a6459f13ed8 /libs | |
parent | 028508cad5ef63ef9fbd42c14e76658e4fd9ebf2 (diff) | |
download | frameworks_native-c666cae2d5995097ec49a87e375e2afdd92802b7.zip frameworks_native-c666cae2d5995097ec49a87e375e2afdd92802b7.tar.gz frameworks_native-c666cae2d5995097ec49a87e375e2afdd92802b7.tar.bz2 |
get rid of the shared-memory control block
Change-Id: If814060aca1d2ff2619d4adcd57296983d207f7f
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 32 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 66 |
2 files changed, 20 insertions, 78 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 60341ff..4cc0262 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -68,14 +68,6 @@ public: return interface_cast<IGraphicBufferAlloc>(reply.readStrongBinder()); } - virtual sp<IMemoryHeap> getCblk() const - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - remote()->transact(BnSurfaceComposer::GET_CBLK, data, &reply); - return interface_cast<IMemoryHeap>(reply.readStrongBinder()); - } - virtual void setTransactionState( const Vector<ComposerState>& state, const Vector<DisplayState>& displays, @@ -219,6 +211,17 @@ public: remote()->transact(BnSurfaceComposer::UNBLANK, data, &reply); } + virtual status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeInt32(dpy); + remote()->transact(BnSurfaceComposer::GET_DISPLAY_INFO, data, &reply); + memcpy(info, reply.readInplace(sizeof(DisplayInfo)), sizeof(DisplayInfo)); + return reply.readInt32(); + } + + virtual void connectDisplay(const sp<ISurfaceTexture> display) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); @@ -270,11 +273,6 @@ status_t BnSurfaceComposer::onTransact( CHECK_INTERFACE(ISurfaceComposer, data, reply); bootFinished(); } break; - case GET_CBLK: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp<IBinder> b = getCblk()->asBinder(); - reply->writeStrongBinder(b); - } break; case CAPTURE_SCREEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); DisplayID dpy = data.readInt32(); @@ -326,6 +324,14 @@ status_t BnSurfaceComposer::onTransact( CHECK_INTERFACE(ISurfaceComposer, data, reply); unblank(); } break; + case GET_DISPLAY_INFO: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + DisplayInfo info; + DisplayID dpy = data.readInt32(); + status_t result = getDisplayInfo(dpy, &info); + memcpy(reply->writeInplace(sizeof(DisplayInfo)), &info, sizeof(DisplayInfo)); + reply->writeInt32(result); + } break; case CONNECT_DISPLAY: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<ISurfaceTexture> surfaceTexture = diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 4930e33..1aecddb 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -38,7 +38,6 @@ #include <private/gui/ComposerService.h> #include <private/gui/LayerState.h> -#include <private/gui/SharedBufferStack.h> namespace android { // --------------------------------------------------------------------------- @@ -51,27 +50,16 @@ ComposerService::ComposerService() while (getService(name, &mComposerService) != NO_ERROR) { usleep(250000); } - mServerCblkMemory = mComposerService->getCblk(); - mServerCblk = static_cast<surface_flinger_cblk_t volatile *>( - mServerCblkMemory->getBase()); } sp<ISurfaceComposer> ComposerService::getComposerService() { return ComposerService::getInstance().mComposerService; } -surface_flinger_cblk_t const volatile * ComposerService::getControlBlock() { - return ComposerService::getInstance().mServerCblk; -} - static inline sp<ISurfaceComposer> getComposerService() { return ComposerService::getComposerService(); } -static inline surface_flinger_cblk_t const volatile * get_cblk() { - return ComposerService::getControlBlock(); -} - // --------------------------------------------------------------------------- // NOTE: this is NOT a member function (it's a friend defined with its @@ -476,59 +464,7 @@ status_t SurfaceComposerClient::setOrientation(DisplayID dpy, status_t SurfaceComposerClient::getDisplayInfo( DisplayID dpy, DisplayInfo* info) { - if (uint32_t(dpy)>=NUM_DISPLAY_MAX) - return BAD_VALUE; - - volatile surface_flinger_cblk_t const * cblk = get_cblk(); - volatile display_cblk_t const * dcblk = cblk->displays + dpy; - - info->w = dcblk->w; - info->h = dcblk->h; - info->orientation = dcblk->orientation; - info->xdpi = dcblk->xdpi; - info->ydpi = dcblk->ydpi; - info->fps = dcblk->fps; - info->density = dcblk->density; - return getPixelFormatInfo(dcblk->format, &(info->pixelFormatInfo)); -} - -ssize_t SurfaceComposerClient::getDisplayWidth(DisplayID dpy) -{ - if (uint32_t(dpy)>=NUM_DISPLAY_MAX) - return BAD_VALUE; - volatile surface_flinger_cblk_t const * cblk = get_cblk(); - volatile display_cblk_t const * dcblk = cblk->displays + dpy; - return dcblk->w; -} - -ssize_t SurfaceComposerClient::getDisplayHeight(DisplayID dpy) -{ - if (uint32_t(dpy)>=NUM_DISPLAY_MAX) - return BAD_VALUE; - volatile surface_flinger_cblk_t const * cblk = get_cblk(); - volatile display_cblk_t const * dcblk = cblk->displays + dpy; - return dcblk->h; -} - -ssize_t SurfaceComposerClient::getDisplayOrientation(DisplayID dpy) -{ - if (uint32_t(dpy)>=NUM_DISPLAY_MAX) - return BAD_VALUE; - volatile surface_flinger_cblk_t const * cblk = get_cblk(); - volatile display_cblk_t const * dcblk = cblk->displays + dpy; - return dcblk->orientation; -} - -ssize_t SurfaceComposerClient::getNumberOfDisplays() -{ - volatile surface_flinger_cblk_t const * cblk = get_cblk(); - uint32_t connected = cblk->connected; - int n = 0; - while (connected) { - if (connected&1) n++; - connected >>= 1; - } - return n; + return getComposerService()->getDisplayInfo(dpy, info); } // ---------------------------------------------------------------------------- |