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 /services/surfaceflinger | |
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 'services/surfaceflinger')
-rw-r--r-- | services/surfaceflinger/DisplayHardware.cpp | 34 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware.h | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 29 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 7 | ||||
-rw-r--r-- | services/surfaceflinger/tests/Transaction_test.cpp | 8 |
5 files changed, 33 insertions, 47 deletions
diff --git a/services/surfaceflinger/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware.cpp index 067a54f..4b5d8ab 100644 --- a/services/surfaceflinger/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayHardware.cpp @@ -24,6 +24,7 @@ #include <utils/RefBase.h> #include <utils/Log.h> +#include <ui/DisplayInfo.h> #include <ui/PixelFormat.h> #include <GLES/gl.h> @@ -31,7 +32,6 @@ #include <EGL/eglext.h> #include <hardware/gralloc.h> -#include <private/gui/SharedBufferStack.h> #include "DisplayHardware/FramebufferSurface.h" #include "DisplayHardware/DisplayHardwareBase.h" @@ -148,6 +148,19 @@ EGLSurface DisplayHardware::getEGLSurface() const { return mSurface; } +status_t DisplayHardware::getInfo(DisplayInfo* info) const { + info->w = getWidth(); + info->h = getHeight(); + info->xdpi = getDpiX(); + info->ydpi = getDpiY(); + info->fps = getRefreshRate(); + info->density = getDensity(); + info->orientation = getOrientation(); + // TODO: this needs to go away (currently needed only by webkit) + getPixelFormatInfo(getFormat(), &info->pixelFormatInfo); + return NO_ERROR; +} + void DisplayHardware::init(EGLConfig config) { ANativeWindow* const window = mNativeWindow.get(); @@ -226,17 +239,6 @@ void DisplayHardware::init(EGLConfig config) mFormat = format; mPageFlipCount = 0; - // initialize the shared control block - surface_flinger_cblk_t* const scblk = mFlinger->getControlBlock(); - scblk->connected |= 1 << mDisplayId; - display_cblk_t* dcblk = &scblk->displays[mDisplayId]; - memset(dcblk, 0, sizeof(display_cblk_t)); - dcblk->format = format; - dcblk->xdpi = mDpiX; - dcblk->ydpi = mDpiY; - dcblk->fps = mRefreshRate; - dcblk->density = mDensity; - // initialize the display orientation transform. DisplayHardware::setOrientation(ISurfaceComposer::eOrientationDefault); } @@ -365,13 +367,5 @@ status_t DisplayHardware::setOrientation(int orientation) { h = tmp; } mOrientation = orientation; - - // update the shared control block - surface_flinger_cblk_t* const scblk = mFlinger->getControlBlock(); - volatile display_cblk_t* dcblk = &scblk->displays[mDisplayId]; - dcblk->orientation = orientation; - dcblk->w = w; - dcblk->h = h; - return NO_ERROR; } diff --git a/services/surfaceflinger/DisplayHardware.h b/services/surfaceflinger/DisplayHardware.h index 88a8c0d..98579b4 100644 --- a/services/surfaceflinger/DisplayHardware.h +++ b/services/surfaceflinger/DisplayHardware.h @@ -36,6 +36,7 @@ namespace android { +class DisplayInfo; class FramebufferSurface; class LayerBase; class SurfaceFlinger; @@ -74,6 +75,7 @@ public: uint32_t getFlags() const; nsecs_t getRefreshPeriod() const; nsecs_t getRefreshTimestamp() const; + status_t getInfo(DisplayInfo* info) const; EGLSurface getEGLSurface() const; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 992c779..192378f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -32,6 +32,8 @@ #include <binder/MemoryHeapBase.h> #include <binder/PermissionCache.h> +#include <ui/DisplayInfo.h> + #include <gui/IDisplayEventConnection.h> #include <gui/BitTube.h> #include <gui/SurfaceTextureClient.h> @@ -45,7 +47,6 @@ #include <utils/Trace.h> #include <private/android_filesystem_config.h> -#include <private/gui/SharedBufferStack.h> #include "clz.h" #include "DdmConnection.h" @@ -153,11 +154,6 @@ void SurfaceFlinger::binderDied(const wp<IBinder>& who) startBootAnim(); } -sp<IMemoryHeap> SurfaceFlinger::getCblk() const -{ - return mServerHeap; -} - sp<ISurfaceComposerClient> SurfaceFlinger::createConnection() { sp<ISurfaceComposerClient> bclient; @@ -361,24 +357,11 @@ void SurfaceFlinger::initializeGL(EGLDisplay display, EGLSurface surface) { ALOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]); } -surface_flinger_cblk_t* SurfaceFlinger::getControlBlock() const { - return mServerCblk; -} - status_t SurfaceFlinger::readyToRun() { ALOGI( "SurfaceFlinger's main thread ready to run. " "Initializing graphics H/W..."); - // create the shared control-block - mServerHeap = new MemoryHeapBase(4096, - MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap"); - ALOGE_IF(mServerHeap==0, "can't create shared memory dealer"); - mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase()); - ALOGE_IF(mServerCblk==0, "can't get to shared control block's address"); - new(mServerCblk) surface_flinger_cblk_t; - - // initialize EGL EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(display, NULL, NULL); @@ -485,6 +468,14 @@ bool SurfaceFlinger::authenticateSurfaceTexture( return false; } +status_t SurfaceFlinger::getDisplayInfo(DisplayID dpy, DisplayInfo* info) { + if (uint32_t(dpy) >= 2) { + return BAD_INDEX; + } + const DisplayHardware& hw(getDefaultDisplayHardware()); + return hw.getInfo(info); +} + // ---------------------------------------------------------------------------- sp<IDisplayEventConnection> SurfaceFlinger::createDisplayEventConnection() { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 6418122..c33f1a3 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -64,7 +64,6 @@ class LayerBaseClient; class LayerDim; class LayerScreenshot; class SurfaceTextureClient; -struct surface_flinger_cblk_t; // --------------------------------------------------------------------------- @@ -176,7 +175,6 @@ private: */ virtual sp<ISurfaceComposerClient> createConnection(); virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc(); - virtual sp<IMemoryHeap> getCblk() const; virtual void bootFinished(); virtual void setTransactionState(const Vector<ComposerState>& state, const Vector<DisplayState>& displays, uint32_t flags); @@ -193,6 +191,7 @@ private: virtual void blank(); // called when screen is turning back on virtual void unblank(); + virtual status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info); virtual void connectDisplay(const sp<ISurfaceTexture> display); /* ------------------------------------------------------------------------ @@ -382,8 +381,6 @@ private: Region mInvalidateRegion; // constant members (no synchronization needed for access) - sp<IMemoryHeap> mServerHeap; - surface_flinger_cblk_t* mServerCblk; HWComposer* mHwc; GLuint mWormholeTexName; GLuint mProtectedTexName; @@ -431,8 +428,6 @@ private: EGLSurface getExternalDisplaySurface() const; sp<SurfaceTextureClient> mExternalDisplayNativeWindow; EGLSurface mExternalDisplaySurface; -public: - surface_flinger_cblk_t* getControlBlock() const; }; // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp index 84ae0d9..e3a98ff 100644 --- a/services/surfaceflinger/tests/Transaction_test.cpp +++ b/services/surfaceflinger/tests/Transaction_test.cpp @@ -24,6 +24,7 @@ #include <private/gui/ComposerService.h> #include <utils/String8.h> +#include <ui/DisplayInfo.h> namespace android { @@ -92,8 +93,11 @@ protected: mComposerClient = new SurfaceComposerClient; ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); - ssize_t displayWidth = mComposerClient->getDisplayWidth(0); - ssize_t displayHeight = mComposerClient->getDisplayHeight(0); + DisplayInfo info; + SurfaceComposerClient::getDisplayInfo(0, &info); + + ssize_t displayWidth = info.w; + ssize_t displayHeight = info.h; // Background surface mBGSurfaceControl = mComposerClient->createSurface( |