Merge "SF: Update DispSync to std::vector."
diff --git a/cmds/surfacereplayer/replayer/Android.bp b/cmds/surfacereplayer/replayer/Android.bp
index 5caceec..7632311 100644
--- a/cmds/surfacereplayer/replayer/Android.bp
+++ b/cmds/surfacereplayer/replayer/Android.bp
@@ -1,6 +1,5 @@
cc_library_shared {
name: "libsurfacereplayer",
- clang: true,
srcs: [
"BufferQueueScheduler.cpp",
"Event.cpp",
@@ -16,7 +15,6 @@
"-Wno-float-equal",
"-Wno-sign-conversion",
"-Wno-padded",
- "-std=c++14",
],
static_libs: [
"libtrace_proto",
@@ -41,7 +39,6 @@
cc_binary {
name: "surfacereplayer",
- clang: true,
srcs: [
"Main.cpp",
],
@@ -61,6 +58,5 @@
"-Wno-float-conversion",
"-Wno-disabled-macro-expansion",
"-Wno-float-equal",
- "-std=c++14",
],
}
diff --git a/services/batteryservice/Android.bp b/services/batteryservice/Android.bp
index 7e2f648..66ee8ff 100644
--- a/services/batteryservice/Android.bp
+++ b/services/batteryservice/Android.bp
@@ -1,6 +1,7 @@
cc_library_headers {
name: "libbatteryservice_headers",
vendor_available: true,
+ recovery_available: true,
export_include_dirs: ["include"],
header_libs: ["libutils_headers"],
export_header_lib_headers: ["libutils_headers"],
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index e128df7..37f4b0f 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -160,6 +160,8 @@
bool useIdentityTransform) const {
ATRACE_CALL();
+ CompositionInfo& compositionInfo = getBE().compositionInfo;
+
if (CC_UNLIKELY(mActiveBuffer == 0)) {
// the texture has not been created yet, this Layer has
// in fact never been drawn into. This happens frequently with
@@ -241,6 +243,7 @@
mTexture.setDimensions(mActiveBuffer->getWidth(), mActiveBuffer->getHeight());
mTexture.setFiltering(useFiltering);
mTexture.setMatrix(textureMatrix);
+ compositionInfo.re.texture = mTexture;
engine.setupLayerTexturing(mTexture);
} else {
@@ -250,6 +253,23 @@
engine.disableTexturing();
}
+void BufferLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
+ CompositionInfo& compositionInfo = getBE().compositionInfo;
+ auto& engine(mFlinger->getRenderEngine());
+
+ draw(renderArea, useIdentityTransform);
+
+ engine.setupLayerTexturing(compositionInfo.re.texture);
+ engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
+ false, compositionInfo.re.color);
+ engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
+ engine.setSourceY410BT2020(compositionInfo.re.Y410BT2020);
+ engine.drawMesh(getBE().getMesh());
+ engine.disableBlending();
+ engine.disableTexturing();
+ engine.setSourceY410BT2020(false);
+}
+
void BufferLayer::onLayerDisplayed(const sp<Fence>& releaseFence) {
mConsumer->setReleaseFence(releaseFence);
}
diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h
index 7f5ff3f..0886f17 100644
--- a/services/surfaceflinger/BufferLayer.h
+++ b/services/surfaceflinger/BufferLayer.h
@@ -101,6 +101,7 @@
*/
void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const override;
+ void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const;
void onLayerDisplayed(const sp<Fence>& releaseFence) override;
diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp
index aebe4ea..8515fcf 100644
--- a/services/surfaceflinger/ColorLayer.cpp
+++ b/services/surfaceflinger/ColorLayer.cpp
@@ -46,16 +46,27 @@
bool useIdentityTransform) const {
half4 color = getColor();
if (color.a > 0) {
- Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2);
- computeGeometry(renderArea, mesh, useIdentityTransform);
- auto& engine(mFlinger->getRenderEngine());
- engine.setupLayerBlending(getPremultipledAlpha(), false /* opaque */,
- true /* disableTexture */, color);
- engine.drawMesh(mesh);
- engine.disableBlending();
+ computeGeometry(renderArea, getBE().mMesh, useIdentityTransform);
+ getBE().compositionInfo.re.preMultipliedAlpha = getPremultipledAlpha();
+ getBE().compositionInfo.re.opaque = false;
+ getBE().compositionInfo.re.disableTexture = true;
+ getBE().compositionInfo.re.color = color;
}
}
+void ColorLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
+ CompositionInfo& compositionInfo = getBE().compositionInfo;
+ auto& engine(mFlinger->getRenderEngine());
+
+ draw(renderArea, useIdentityTransform);
+
+ engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
+ compositionInfo.re.disableTexture, compositionInfo.re.color);
+ engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
+ engine.drawMesh(getBE().getMesh());
+ engine.disableBlending();
+}
+
bool ColorLayer::isVisible() const {
const Layer::State& s(getDrawingState());
return !isHiddenByPolicy() && s.color.a;
diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h
index 3408045..8417135 100644
--- a/services/surfaceflinger/ColorLayer.h
+++ b/services/surfaceflinger/ColorLayer.h
@@ -32,6 +32,7 @@
virtual const char* getTypeId() const { return "ColorLayer"; }
virtual void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const;
+ void drawNow(const RenderArea& , bool ) const;
bool isVisible() const override;
void setPerFrameData(const sp<const DisplayDevice>& display) override;
diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp
index f259d93..320c0df 100644
--- a/services/surfaceflinger/ContainerLayer.cpp
+++ b/services/surfaceflinger/ContainerLayer.cpp
@@ -30,6 +30,8 @@
void ContainerLayer::onDraw(const RenderArea&, const Region& /* clip */, bool) const {}
+void ContainerLayer::drawNow(const RenderArea&, bool) const {}
+
bool ContainerLayer::isVisible() const {
return !isHiddenByPolicy();
}
diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h
index 06cfbcd..29a5c3a 100644
--- a/services/surfaceflinger/ContainerLayer.h
+++ b/services/surfaceflinger/ContainerLayer.h
@@ -32,6 +32,7 @@
const char* getTypeId() const override { return "ContainerLayer"; }
void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const override;
+ void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const override;
bool isVisible() const override;
void setPerFrameData(const sp<const DisplayDevice>& display) override;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 11c3db0..40d89bd 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2004,6 +2004,16 @@
layerInfo->set_refresh_pending(isBufferLatched());
layerInfo->set_window_type(state.type);
layerInfo->set_app_id(state.appId);
+ layerInfo->set_curr_frame(mCurrentFrameNumber);
+
+ for (const auto& pendingState : mPendingStates) {
+ auto barrierLayer = pendingState.barrierLayer.promote();
+ if (barrierLayer != nullptr) {
+ BarrierLayerProto* barrierLayerProto = layerInfo->add_barrier_layer();
+ barrierLayerProto->set_id(barrierLayer->sequence);
+ barrierLayerProto->set_frame_number(pendingState.frameNumber);
+ }
+ }
}
void Layer::writeToProto(LayerProto* layerInfo, int32_t displayId) {
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 03720a9..f724096 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -374,6 +374,16 @@
void draw(const RenderArea& renderArea) const;
/*
+ * drawNow uses the renderEngine to draw the layer. This is different than the
+ * draw function as with the FE/BE split, the draw function runs in the FE and
+ * sets up state for the BE to do the actual drawing. drawNow is used to tell
+ * the layer to skip the state setup and just go ahead and draw the layer. This
+ * is used for screen captures which happens separately from the frame
+ * compositing path.
+ */
+ virtual void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const = 0;
+
+ /*
* doTransaction - process the transaction. This is a good place to figure
* out which attributes of the surface have changed.
*/
diff --git a/services/surfaceflinger/LayerBE.cpp b/services/surfaceflinger/LayerBE.cpp
index bef051f..51b615b 100644
--- a/services/surfaceflinger/LayerBE.cpp
+++ b/services/surfaceflinger/LayerBE.cpp
@@ -57,7 +57,8 @@
ALOGV("[%s]\tblackoutLayer=%d", tag, re.blackoutLayer);
ALOGV("[%s]\tclearArea=%d", tag, re.clearArea);
ALOGV("[%s]\tpreMultipliedAlpha=%d", tag, re.preMultipliedAlpha);
- ALOGV("[%s]\topaque=%d\n", tag, re.opaque);
+ ALOGV("[%s]\topaque=%d", tag, re.opaque);
+ ALOGV("[%s]\tdisableTexture=%d", tag, re.disableTexture);
ALOGV("[%s]\ttexture:name(%d), target(%d), size(%d/%d)", tag, re.texture.getTextureName(), re.texture.getTextureTarget(), (unsigned int)re.texture.getWidth(), (unsigned int)re.texture.getHeight());
ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform);
}
diff --git a/services/surfaceflinger/LayerBE.h b/services/surfaceflinger/LayerBE.h
index f610677..9aa43f7 100644
--- a/services/surfaceflinger/LayerBE.h
+++ b/services/surfaceflinger/LayerBE.h
@@ -52,7 +52,7 @@
Region visibleRegion;
Region surfaceDamage;
sp<NativeHandle> sidebandStream;
- android_dataspace dataspace;
+ ui::Dataspace dataspace;
hwc_color_t color;
} hwc;
struct {
@@ -61,9 +61,11 @@
bool clearArea = false;
bool preMultipliedAlpha = false;
bool opaque = false;
+ bool disableTexture = false;
half4 color;
Texture texture;
bool useIdentityTransform = false;
+ bool Y410BT2020 = false;
} re;
void dump(const char* tag) const;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7680f2a..085dcc2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -114,6 +114,33 @@
using ui::RenderIntent;
namespace {
+
+#pragma clang diagnostic push
+#pragma clang diagnostic error "-Wswitch-enum"
+
+bool isWideColorMode(const ColorMode colorMode) {
+ switch (colorMode) {
+ case ColorMode::DISPLAY_P3:
+ case ColorMode::ADOBE_RGB:
+ case ColorMode::DCI_P3:
+ case ColorMode::BT2020:
+ case ColorMode::BT2100_PQ:
+ case ColorMode::BT2100_HLG:
+ return true;
+ case ColorMode::NATIVE:
+ case ColorMode::STANDARD_BT601_625:
+ case ColorMode::STANDARD_BT601_625_UNADJUSTED:
+ case ColorMode::STANDARD_BT601_525:
+ case ColorMode::STANDARD_BT601_525_UNADJUSTED:
+ case ColorMode::STANDARD_BT709:
+ case ColorMode::SRGB:
+ return false;
+ }
+ return false;
+}
+
+#pragma clang diagnostic pop
+
class ConditionalLock {
public:
ConditionalLock(Mutex& mutex, bool lock) : mMutex(mutex), mLocked(lock) {
@@ -126,6 +153,7 @@
Mutex& mMutex;
bool mLocked;
};
+
} // namespace anonymous
// ---------------------------------------------------------------------------
@@ -2262,14 +2290,8 @@
if (hasWideColorDisplay) {
std::vector<ColorMode> modes = getHwComposer().getColorModes(displayId);
for (ColorMode colorMode : modes) {
- switch (colorMode) {
- case ColorMode::DISPLAY_P3:
- case ColorMode::ADOBE_RGB:
- case ColorMode::DCI_P3:
- hasWideColorGamut = true;
- break;
- default:
- break;
+ if (isWideColorMode(colorMode)) {
+ hasWideColorGamut = true;
}
std::vector<RenderIntent> renderIntents =
@@ -5098,7 +5120,7 @@
traverseLayers([&](Layer* layer) {
if (filtering) layer->setFiltering(true);
- layer->draw(renderArea, useIdentityTransform);
+ layer->drawNow(renderArea, useIdentityTransform);
if (filtering) layer->setFiltering(false);
});
}
diff --git a/services/surfaceflinger/layerproto/layers.proto b/services/surfaceflinger/layerproto/layers.proto
index eb34694..e34772f 100644
--- a/services/surfaceflinger/layerproto/layers.proto
+++ b/services/surfaceflinger/layerproto/layers.proto
@@ -82,6 +82,10 @@
optional bool is_protected = 36;
// If active_buffer is not null, record its transform
optional TransformProto buffer_transform = 37;
+ // Current frame number being rendered.
+ optional uint64 curr_frame = 38;
+ // A list of barriers that the layer is waiting to update state.
+ repeated BarrierLayerProto barrier_layer = 39;
}
message PositionProto {
@@ -133,3 +137,10 @@
optional float b = 3;
optional float a = 4;
}
+
+message BarrierLayerProto {
+ // layer id the barrier is waiting on.
+ optional int32 id = 1;
+ // frame number the barrier is waiting on.
+ optional uint64 frame_number = 2;
+}
diff --git a/vulkan/libvulkan/Android.bp b/vulkan/libvulkan/Android.bp
index 7f4f2c4..cbba5f4 100644
--- a/vulkan/libvulkan/Android.bp
+++ b/vulkan/libvulkan/Android.bp
@@ -43,7 +43,6 @@
],
cppflags: [
- "-std=c++14",
"-Wno-c99-extensions",
"-Wno-c++98-compat-pedantic",
"-Wno-exit-time-destructors",