From 9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 24 Aug 2012 20:00:51 -0700 Subject: Banish DisplayID from the SurfaceFlinger API. Use only display tokens in the API to refer to new displays. Don't require the caller to specify the display when creating a surface (since in general a surface could be shown on any display). This is intended to be a minimum change just to update the API. Note that SurfaceFlinger still uses DisplayID in a few places internally that might cause some features not to work properly when there are multiple displays (LayerScreenshot, for example). Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6 --- libs/gui/SurfaceComposerClient.cpp | 53 ++++++++++++++------------------------ 1 file changed, 20 insertions(+), 33 deletions(-) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 1e6e1bd..1b81e45 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -94,6 +94,7 @@ class Composer : public Singleton public: sp createDisplay(); + sp getBuiltInDisplay(int32_t id); status_t setPosition(const sp& client, SurfaceID id, float x, float y); @@ -135,6 +136,10 @@ sp Composer::createDisplay() { return ComposerService::getComposerService()->createDisplay(); } +sp Composer::getBuiltInDisplay(int32_t id) { + return ComposerService::getComposerService()->getBuiltInDisplay(id); +} + void Composer::closeGlobalTransactionImpl(bool synchronous) { sp sm(ComposerService::getComposerService()); @@ -403,25 +408,7 @@ void SurfaceComposerClient::dispose() { } sp SurfaceComposerClient::createSurface( - DisplayID display, - uint32_t w, - uint32_t h, - PixelFormat format, - uint32_t flags) -{ - String8 name; - const size_t SIZE = 128; - char buffer[SIZE]; - snprintf(buffer, SIZE, "", getpid()); - name.append(buffer); - - return SurfaceComposerClient::createSurface(name, display, - w, h, format, flags); -} - -sp SurfaceComposerClient::createSurface( const String8& name, - DisplayID display, uint32_t w, uint32_t h, PixelFormat format, @@ -431,7 +418,7 @@ sp SurfaceComposerClient::createSurface( if (mStatus == NO_ERROR) { ISurfaceComposerClient::surface_data_t data; sp surface = mClient->createSurface(&data, name, - display, w, h, format, flags); + w, h, format, flags); if (surface != 0) { result = new SurfaceControl(this, surface, data); } @@ -443,6 +430,10 @@ sp SurfaceComposerClient::createDisplay() { return Composer::getInstance().createDisplay(); } +sp SurfaceComposerClient::getBuiltInDisplay(int32_t id) { + return Composer::getInstance().getBuiltInDisplay(id); +} + status_t SurfaceComposerClient::destroySurface(SurfaceID sid) { if (mStatus != NO_ERROR) return mStatus; @@ -517,12 +508,6 @@ status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx, return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy); } -status_t SurfaceComposerClient::setOrientation(DisplayID dpy, - int orientation, uint32_t flags) -{ - return Composer::getInstance().setOrientation(orientation); -} - // ---------------------------------------------------------------------------- void SurfaceComposerClient::setDisplaySurface(const sp& token, @@ -553,9 +538,9 @@ void SurfaceComposerClient::setDisplayFrame(const sp& token, // ---------------------------------------------------------------------------- status_t SurfaceComposerClient::getDisplayInfo( - DisplayID dpy, DisplayInfo* info) + const sp& display, DisplayInfo* info) { - return ComposerService::getComposerService()->getDisplayInfo(dpy, info); + return ComposerService::getComposerService()->getDisplayInfo(display, info); } // ---------------------------------------------------------------------------- @@ -564,30 +549,32 @@ ScreenshotClient::ScreenshotClient() : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { } -status_t ScreenshotClient::update() { +status_t ScreenshotClient::update(const sp& display) { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; mHeap = 0; - return s->captureScreen(0, &mHeap, + return s->captureScreen(display, &mHeap, &mWidth, &mHeight, &mFormat, 0, 0, 0, -1UL); } -status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight) { +status_t ScreenshotClient::update(const sp& display, + uint32_t reqWidth, uint32_t reqHeight) { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; mHeap = 0; - return s->captureScreen(0, &mHeap, + return s->captureScreen(display, &mHeap, &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, 0, -1UL); } -status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight, +status_t ScreenshotClient::update(const sp& display, + uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ) { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; mHeap = 0; - return s->captureScreen(0, &mHeap, + return s->captureScreen(display, &mHeap, &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, minLayerZ, maxLayerZ); } -- cgit v1.1