summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/gui/SurfaceComposerClient.h11
-rw-r--r--libs/gui/SurfaceComposerClient.cpp70
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