summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2022-02-23 19:03:31 -0500
committer John Reck <jreck@google.com> 2022-02-24 17:30:24 +0000
commit49d9ad3da8592b5a9887785574453aa733294d15 (patch)
tree293005033c54ded8c546d3e2f8f4b5c8ef71c937
parent7e6544bd15f1831f6b601c2ea31111d6edc2241f (diff)
Allow skipping camera layers for HDR callback
Bug: 218728138 Test: make; verified callback didn't change for youtube HDR Change-Id: I3ee4999d221052be5d8d093033b90bfe6b3aa87e
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp17
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h3
-rw-r--r--services/surfaceflinger/SurfaceFlingerProperties.cpp4
-rw-r--r--services/surfaceflinger/SurfaceFlingerProperties.h2
-rw-r--r--services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop9
-rw-r--r--services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt4
6 files changed, 38 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dc88793479..eda0c5dd79 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -500,6 +500,8 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI
if (!mIsUserBuild && base::GetBoolProperty("debug.sf.enable_transaction_tracing"s, true)) {
mTransactionTracing.emplace();
}
+
+ mIgnoreHdrCameraLayers = ignore_hdr_camera_layers(false);
}
LatchUnsignaledConfig SurfaceFlinger::getLatchUnsignaledConfig() {
@@ -2375,6 +2377,19 @@ void SurfaceFlinger::setCompositorTimingSnapped(const DisplayStatInfo& stats,
getBE().mCompositorTiming.presentLatency = snappedCompositeToPresentLatency;
}
+bool SurfaceFlinger::isHdrLayer(Layer* layer) const {
+ if (!isHdrDataspace(layer->getDataSpace())) {
+ return false;
+ }
+ if (mIgnoreHdrCameraLayers) {
+ auto buffer = layer->getBuffer();
+ if (buffer && (buffer->getUsage() & GRALLOC_USAGE_HW_CAMERA_WRITE) != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
void SurfaceFlinger::postComposition() {
ATRACE_CALL();
ALOGV("postComposition");
@@ -2460,7 +2475,7 @@ void SurfaceFlinger::postComposition() {
mDrawingState.traverse([&, compositionDisplay = compositionDisplay](Layer* layer) {
const auto layerFe = layer->getCompositionEngineLayerFE();
if (layer->isVisible() && compositionDisplay->includesLayer(layerFe)) {
- if (isHdrDataspace(layer->getDataSpace())) {
+ if (isHdrLayer(layer)) {
const auto* outputLayer =
compositionDisplay->getOutputLayerForLayer(layerFe);
if (outputLayer) {
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 3ecce33d33..cedb107615 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1120,6 +1120,8 @@ private:
void updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay)
REQUIRES(mStateLock);
+ bool isHdrLayer(Layer* layer) const;
+
sp<StartPropertySetThread> mStartPropertySetThread;
surfaceflinger::Factory& mFactory;
pid_t mPid;
@@ -1168,6 +1170,7 @@ private:
// Used to ensure we omit a callback when HDR layer info listener is newly added but the
// scene hasn't changed
bool mAddingHDRLayerInfoListener = false;
+ bool mIgnoreHdrCameraLayers = false;
// Set during transaction application stage to track if the input info or children
// for a layer has changed.
diff --git a/services/surfaceflinger/SurfaceFlingerProperties.cpp b/services/surfaceflinger/SurfaceFlingerProperties.cpp
index 16f6e31946..20fa091730 100644
--- a/services/surfaceflinger/SurfaceFlingerProperties.cpp
+++ b/services/surfaceflinger/SurfaceFlingerProperties.cpp
@@ -371,5 +371,9 @@ bool enable_layer_caching(bool defaultValue) {
return SurfaceFlingerProperties::enable_layer_caching().value_or(defaultValue);
}
+bool ignore_hdr_camera_layers(bool defaultValue) {
+ return SurfaceFlingerProperties::ignore_hdr_camera_layers().value_or(defaultValue);
+}
+
} // namespace sysprop
} // namespace android
diff --git a/services/surfaceflinger/SurfaceFlingerProperties.h b/services/surfaceflinger/SurfaceFlingerProperties.h
index 8d0e4263b1..080feee686 100644
--- a/services/surfaceflinger/SurfaceFlingerProperties.h
+++ b/services/surfaceflinger/SurfaceFlingerProperties.h
@@ -100,6 +100,8 @@ bool enable_layer_caching(bool defaultValue);
bool enable_sdr_dimming(bool defaultValue);
+bool ignore_hdr_camera_layers(bool defaultValue);
+
} // namespace sysprop
} // namespace android
#endif // SURFACEFLINGERPROPERTIES_H_
diff --git a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
index 7702ea240b..bcbe21a483 100644
--- a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
+++ b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
@@ -461,4 +461,13 @@ prop {
scope: Public
access: Readonly
prop_name: "ro.surface_flinger.enable_sdr_dimming"
+}
+
+# Ignores Camera layers when calculating HDR coverage information
+prop {
+ api_name: "ignore_hdr_camera_layers"
+ type: Boolean
+ scope: Public
+ access: Readonly
+ prop_name: "ro.surface_flinger.ignore_hdr_camera_layers"
} \ No newline at end of file
diff --git a/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt b/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt
index bf1e7e2908..348a462038 100644
--- a/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt
+++ b/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt
@@ -69,6 +69,10 @@ props {
prop_name: "ro.surface_flinger.has_wide_color_display"
}
prop {
+ api_name: "ignore_hdr_camera_layers"
+ prop_name: "ro.surface_flinger.ignore_hdr_camera_layers"
+ }
+ prop {
api_name: "max_frame_buffer_acquired_buffers"
type: Long
prop_name: "ro.surface_flinger.max_frame_buffer_acquired_buffers"