summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-07-24 20:43:54 -0700
committerMathias Agopian <mathias@google.com>2012-07-24 20:43:54 -0700
commit8b33f032327f8de0dcc0e6d0d43ed80f834b51f6 (patch)
treed6228a0088740fe5f5c73f405f353bffd121bbae /libs
parent921e6ac4b7610a178285898d191eb0e3afe906c0 (diff)
downloadframeworks_native-8b33f032327f8de0dcc0e6d0d43ed80f834b51f6.zip
frameworks_native-8b33f032327f8de0dcc0e6d0d43ed80f834b51f6.tar.gz
frameworks_native-8b33f032327f8de0dcc0e6d0d43ed80f834b51f6.tar.bz2
update SF binder protocol to support setting display attributes
no change of functionality -- the old behavior is implemented on top of this new protocol. this new protocol will allow, eventually, to pass informations about displays and layer stacks. Change-Id: Ic6c2295e61ec8ecbc8ce01ab7664e35d928202fc
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/ISurfaceComposer.cpp38
-rw-r--r--libs/gui/LayerState.cpp23
-rw-r--r--libs/gui/SurfaceComposerClient.cpp10
3 files changed, 58 insertions, 13 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index bc550bf..60341ff 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -76,18 +76,29 @@ public:
return interface_cast<IMemoryHeap>(reply.readStrongBinder());
}
- virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags)
+ virtual void setTransactionState(
+ const Vector<ComposerState>& state,
+ const Vector<DisplayState>& displays,
+ uint32_t flags)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- Vector<ComposerState>::const_iterator b(state.begin());
- Vector<ComposerState>::const_iterator e(state.end());
- data.writeInt32(state.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
+ {
+ Vector<ComposerState>::const_iterator b(state.begin());
+ Vector<ComposerState>::const_iterator e(state.end());
+ data.writeInt32(state.size());
+ for ( ; b != e ; ++b ) {
+ b->write(data);
+ }
+ }
+ {
+ Vector<DisplayState>::const_iterator b(displays.begin());
+ Vector<DisplayState>::const_iterator e(displays.end());
+ data.writeInt32(displays.size());
+ for ( ; b != e ; ++b ) {
+ b->write(data);
+ }
}
- data.writeInt32(orientation);
data.writeInt32(flags);
remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
}
@@ -244,9 +255,16 @@ status_t BnSurfaceComposer::onTransact(
s.read(data);
state.add(s);
}
- int orientation = data.readInt32();
+ count = data.readInt32();
+ DisplayState d;
+ Vector<DisplayState> displays;
+ displays.setCapacity(count);
+ for (size_t i=0 ; i<count ; i++) {
+ d.read(data);
+ displays.add(d);
+ }
uint32_t flags = data.readInt32();
- setTransactionState(state, orientation, flags);
+ setTransactionState(state, displays, flags);
} break;
case BOOT_FINISHED: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 224c305..25c773c 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -17,6 +17,7 @@
#include <utils/Errors.h>
#include <binder/Parcel.h>
#include <gui/ISurfaceComposerClient.h>
+#include <gui/ISurfaceTexture.h>
#include <private/gui/LayerState.h>
namespace android {
@@ -69,4 +70,26 @@ status_t ComposerState::read(const Parcel& input) {
return state.read(input);
}
+
+status_t DisplayState::write(Parcel& output) const {
+ output.writeStrongBinder(surface->asBinder());
+ output.writeInt32(displayId);
+ output.writeInt32(layerStack);
+ output.writeInt32(orientation);
+ memcpy(output.writeInplace(sizeof(Rect)), &viewport, sizeof(Rect));
+ memcpy(output.writeInplace(sizeof(Rect)), &frame, sizeof(Rect));
+ return NO_ERROR;
+}
+
+status_t DisplayState::read(const Parcel& input) {
+ surface = interface_cast<ISurfaceTexture>(input.readStrongBinder());
+ displayId = input.readInt32();
+ layerStack = input.readInt32();
+ orientation = input.readInt32();
+ memcpy(&viewport, input.readInplace(sizeof(Rect)), sizeof(Rect));
+ memcpy(&frame, input.readInplace(sizeof(Rect)), sizeof(Rect));
+ return NO_ERROR;
+}
+
+
}; // namespace android
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index b1bd78b..8aa0c55 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -138,7 +138,7 @@ void Composer::closeGlobalTransactionImpl(bool synchronous) {
sp<ISurfaceComposer> sm(getComposerService());
Vector<ComposerState> transaction;
- int orientation;
+ Vector<DisplayState> displayTransaction;
uint32_t flags = 0;
{ // scope for the lock
@@ -146,7 +146,11 @@ void Composer::closeGlobalTransactionImpl(bool synchronous) {
transaction = mStates;
mStates.clear();
- orientation = mOrientation;
+ // FIXME: this should be the displays transaction state here
+ DisplayState item;
+ item.orientation = mOrientation;
+ displayTransaction.add(item);
+
mOrientation = ISurfaceComposer::eOrientationUnchanged;
if (synchronous || mForceSynchronous) {
@@ -155,7 +159,7 @@ void Composer::closeGlobalTransactionImpl(bool synchronous) {
mForceSynchronous = false;
}
- sm->setTransactionState(transaction, orientation, flags);
+ sm->setTransactionState(transaction, displayTransaction, flags);
}
layer_state_t* Composer::getLayerStateLocked(