diff options
author | Steve Kondik <shade@chemlab.org> | 2015-02-20 17:35:44 +0100 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-03-22 02:33:42 -0700 |
commit | 7efec2dec0c4086b7be2a5d4e7d2f850c0e0fcb2 (patch) | |
tree | 436b8a42a816110e922903beeae8f0b52d38ffa1 | |
parent | ca0c135723b9af840f31c5de372969d533ebe61f (diff) | |
download | android_frameworks_native-7efec2dec0c4086b7be2a5d4e7d2f850c0e0fcb2.tar.gz android_frameworks_native-7efec2dec0c4086b7be2a5d4e7d2f850c0e0fcb2.tar.bz2 android_frameworks_native-7efec2dec0c4086b7be2a5d4e7d2f850c0e0fcb2.zip |
libgui: squashed update for readding ICS and JB_MR0 support
Squash of the following commits:
- SurfaceComposerClient: bring back getDisplayWidth, Height & Orientation
enable it with either ICS_CAMERA_BLOB or MR0_CAMERA_BLOB CFLAG
Author: Steve Kondik
- Add setOrientation back
this is needed for some tegra ICS and JB_MR0 prebuilts
Author: Steve Kondik
- libgui: Add ICS/MR0-compatible client::createSurface constructors
Author: Steve Kondik
Change-Id: I35abe8e6a2984024935dc9f28a3af9d30695f27a
-rw-r--r-- | include/gui/SurfaceComposerClient.h | 11 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 70 |
2 files changed, 81 insertions, 0 deletions
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h index 7aa1c5422..3cb1ee4d3 100644 --- a/include/gui/SurfaceComposerClient.h +++ b/include/gui/SurfaceComposerClient.h @@ -88,6 +88,13 @@ public: /* Triggers screen on/off or low power mode and waits for it to complete */ static void setDisplayPowerMode(const sp<IBinder>& display, int mode); +#if defined(ICS_CAMERA_BLOB) || defined(MR0_CAMERA_BLOB) + static status_t getDisplayInfo(int32_t displayId, DisplayInfo* info); + static ssize_t getDisplayWidth(int32_t displayId); + static ssize_t getDisplayHeight(int32_t displayId); + static ssize_t getDisplayOrientation(int32_t displayId); +#endif + // ------------------------------------------------------------------------ // surface creation / destruction @@ -123,6 +130,10 @@ public: //! Close a composer transaction on all active SurfaceComposerClients. static void closeGlobalTransaction(bool synchronous = false); +#if defined(MR0_CAMERA_BLOB) + static int setOrientation(int32_t dpy, int orientation, uint32_t flags); +#endif + //! Flag the currently open transaction as an animation transaction. static void setAnimationTransaction(); diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 59787bf47..b6025f287 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -490,6 +490,17 @@ void Composer::setDisplaySize(const sp<IBinder>& token, uint32_t width, uint32_t s.what |= DisplayState::eDisplaySizeChanged; } +#if defined(MR0_CAMERA_BLOB) +status_t Composer::setOrientation(int orientation) { + sp<ISurfaceComposer> sm(ComposerService::getComposerService()); + sp<IBinder> token(sm->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); + DisplayState& s(getDisplayStateLocked(token)); + s.orientation = orientation; + mForceSynchronous = true; // TODO: do we actually still need this? + return NO_ERROR; +} +#endif + // --------------------------------------------------------------------------- SurfaceComposerClient::SurfaceComposerClient() @@ -538,6 +549,32 @@ void SurfaceComposerClient::dispose() { mStatus = NO_INIT; } +#if defined(MR0_CAMERA_BLOB) +/* Create ICS/MR0-compatible constructors */ +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij( + const String8& name, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags); +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceEijjij( + uint32_t 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, "<pid_%d>", getpid()); + name.append(buffer); + + return _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij(name, + w, h, format, flags); +} +#endif + sp<SurfaceControl> SurfaceComposerClient::createSurface( const String8& name, uint32_t w, @@ -681,6 +718,13 @@ status_t SurfaceComposerClient::setMatrix(const sp<IBinder>& id, float dsdx, flo return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy); } +#if defined(MR0_CAMERA_BLOB) +status_t SurfaceComposerClient::setOrientation(int32_t dpy, int orientation, uint32_t flags) +{ + return Composer::getInstance().setOrientation(orientation); +} +#endif + // ---------------------------------------------------------------------------- void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token, @@ -753,6 +797,32 @@ status_t SurfaceComposerClient::getAnimationFrameStats(FrameStats* outStats) { return ComposerService::getComposerService()->getAnimationFrameStats(outStats); } +#if defined(ICS_CAMERA_BLOB) || defined(MR0_CAMERA_BLOB) +status_t SurfaceComposerClient::getDisplayInfo( + int32_t displayId, DisplayInfo* info) +{ + return getDisplayInfo(getBuiltInDisplay(displayId), info); +} + +ssize_t SurfaceComposerClient::getDisplayWidth(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.w; +} + +ssize_t SurfaceComposerClient::getDisplayHeight(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.h; +} + +ssize_t SurfaceComposerClient::getDisplayOrientation(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.orientation; +} +#endif + // ---------------------------------------------------------------------------- #ifndef FORCE_SCREENSHOT_CPU_PATH |