summaryrefslogtreecommitdiff
path: root/libs/gui
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/LayerState.cpp12
-rw-r--r--libs/gui/SurfaceComposerClient.cpp16
-rw-r--r--libs/gui/include/gui/LayerState.h7
-rw-r--r--libs/gui/include/gui/SurfaceComposerClient.h3
4 files changed, 35 insertions, 3 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index a7c4f4670a..8b448ff3f6 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -110,6 +110,9 @@ status_t layer_state_t::write(Parcel& output) const
}
}
output.writeFloat(shadowRadius);
+
+ output.writeInt32(frameRateSelectionPriority);
+
return NO_ERROR;
}
@@ -188,6 +191,9 @@ status_t layer_state_t::read(const Parcel& input)
listeners.emplace_back(listener, callbackIds);
}
shadowRadius = input.readFloat();
+
+ frameRateSelectionPriority = input.readInt32();
+
return NO_ERROR;
}
@@ -406,12 +412,14 @@ void layer_state_t::merge(const layer_state_t& other) {
what |= eMetadataChanged;
metadata.merge(other.metadata);
}
-
if (other.what & eShadowRadiusChanged) {
what |= eShadowRadiusChanged;
shadowRadius = other.shadowRadius;
}
-
+ if (other.what & eFrameRateSelectionPriority) {
+ what |= eFrameRateSelectionPriority;
+ frameRateSelectionPriority = other.frameRateSelectionPriority;
+ }
if ((other.what & what) != other.what) {
ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
"other.what=0x%" PRIu64 " what=0x%" PRIu64,
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 5e259e258c..2ef33cf253 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1192,6 +1192,22 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColor
}
SurfaceComposerClient::Transaction&
+SurfaceComposerClient::Transaction::setFrameRateSelectionPriority(const sp<SurfaceControl>& sc,
+ int32_t priority) {
+ layer_state_t* s = getLayerState(sc);
+ if (!s) {
+ mStatus = BAD_INDEX;
+ return *this;
+ }
+
+ s->what |= layer_state_t::eFrameRateSelectionPriority;
+ s->frameRateSelectionPriority = priority;
+
+ registerSurfaceControlForCallback(sc);
+ return *this;
+}
+
+SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction::addTransactionCompletedCallback(
TransactionCompletedCallbackTakesContext callback, void* callbackContext) {
auto listener = TransactionCompletedListener::getInstance();
diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h
index fb186396a6..03e91c4905 100644
--- a/libs/gui/include/gui/LayerState.h
+++ b/libs/gui/include/gui/LayerState.h
@@ -99,6 +99,7 @@ struct layer_state_t {
eBackgroundColorChanged = 0x4'00000000,
eMetadataChanged = 0x8'00000000,
eColorSpaceAgnosticChanged = 0x10'00000000,
+ eFrameRateSelectionPriority = 0x20'00000000,
};
layer_state_t()
@@ -128,7 +129,8 @@ struct layer_state_t {
bgColorAlpha(0),
bgColorDataspace(ui::Dataspace::UNKNOWN),
colorSpaceAgnostic(false),
- shadowRadius(0.0f) {
+ shadowRadius(0.0f),
+ frameRateSelectionPriority(-1) {
matrix.dsdx = matrix.dtdy = 1.0f;
matrix.dsdy = matrix.dtdx = 0.0f;
hdrMetadata.validTypes = 0;
@@ -209,6 +211,9 @@ struct layer_state_t {
// Draws a shadow around the surface.
float shadowRadius;
+
+ // Priority of the layer assigned by Window Manager.
+ int32_t frameRateSelectionPriority;
};
struct ComposerState {
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 44f29eaa6f..6a3f452f77 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -483,6 +483,9 @@ public:
Transaction& setDesiredPresentTime(nsecs_t desiredPresentTime);
Transaction& setColorSpaceAgnostic(const sp<SurfaceControl>& sc, const bool agnostic);
+ // Sets information about the priority of the frame.
+ Transaction& setFrameRateSelectionPriority(const sp<SurfaceControl>& sc, int32_t priority);
+
Transaction& addTransactionCompletedCallback(
TransactionCompletedCallbackTakesContext callback, void* callbackContext);