Initial commit, syncing up to v115

This commit is contained in:
AndyCGYan
2019-08-08 02:52:03 +00:00
commit b71d406ba3
91 changed files with 7298 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
From edeb825839b1c1e315b0194fa91a6c8c47f3331f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 21:01:35 +0200
Subject: [PATCH 1/4] AOSP 8.0/8.1 didn't use presentOrValidate, so it's
broken. Don't use it
---
services/surfaceflinger/DisplayHardware/HWComposer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index f5f7a821f..3c269ea1f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -435,7 +435,7 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {
// The check below is incorrect. We actually rely on HWC here to fall
// back to validate when there is any client layer.
displayData.validateWasSkipped = false;
- if (!displayData.hasClientComposition) {
+ if ((false)) { //!displayData.hasClientComposition) {
sp<android::Fence> outPresentFence;
uint32_t state = UINT32_MAX;
error = hwcDisplay->presentOrValidate(&numTypes, &numRequests, &outPresentFence , &state);
--
2.17.1

View File

@@ -0,0 +1,26 @@
From 12169a1da2a3ed976027784496035655aa5a5545 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 23:07:24 +0200
Subject: [PATCH 2/4] Ignore usage bits verification
This didn't ignore as of 8.1, so we're ""safe""
---
libs/ui/Gralloc2.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp
index b92cbf351..1c0e5d5ea 100644
--- a/libs/ui/Gralloc2.cpp
+++ b/libs/ui/Gralloc2.cpp
@@ -92,7 +92,7 @@ Gralloc2::Error Mapper::validateBufferDescriptorInfo(
if (descriptorInfo.usage & ~validUsageBits) {
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
descriptorInfo.usage & ~validUsageBits);
- return Error::BAD_VALUE;
+ //return Error::BAD_VALUE;
}
return Error::NONE;
}
--
2.17.1

View File

@@ -0,0 +1,42 @@
From bdded5a601c39eb445128bd6c5085970ffd6d4e5 Mon Sep 17 00:00:00 2001
From: phh <phh@phh.me>
Date: Wed, 22 Aug 2018 08:57:52 +0000
Subject: [PATCH] Enable fallback to old ro.sf.hwrotation property
---
services/surfaceflinger/SurfaceFlinger.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dfeabc059..22d161b65 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -316,6 +316,25 @@ SurfaceFlinger::SurfaceFlinger() : SurfaceFlinger(SkipInitialization) {
}
ALOGV("Primary Display Orientation is set to %2d.", SurfaceFlinger::primaryDisplayOrientation);
+ if(primaryDisplayOrientation == V1_1::DisplayOrientation::ORIENTATION_0) {
+ int sfRotation = property_get_int32("ro.sf.hwrotation", -1);
+ switch(sfRotation) {
+ case 0:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientationDefault;
+ break;
+ case 90:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation90;
+ break;
+ case 180:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation180;
+ break;
+ case 270:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation270;
+ break;
+ }
+ }
+ ALOGV("Primary Display Orientation is set to %2d.", SurfaceFlinger::primaryDisplayOrientation);
+
mPrimaryDispSync.init(SurfaceFlinger::hasSyncFramework, SurfaceFlinger::dispSyncPresentTimeOffset);
// debugging stuff...
--
2.17.1

View File

@@ -0,0 +1,74 @@
From 399d13fc183a7fbd3118425c7cfecbb9a72ba9ce Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 5 Jan 2018 00:26:38 +0100
Subject: [PATCH 4/4] [device] ::Huawei:: HWC doesn't understand 0,0,0,0 ==
fullscreen damage. Set it to the whole visible surface
::Huawei:: Fix damage for Huawei compositor
For Huawei compositor, the damage area is a region on the screen.
But for SurfaceFlinger, this is a region on the source surface.
On Huawei devices, do the plane conversion.
This fixes several UI glitches, most notably GBoard.
---
services/surfaceflinger/BufferLayer.cpp | 8 +++++++-
services/surfaceflinger/SurfaceFlinger.cpp | 8 ++++++++
services/surfaceflinger/SurfaceFlinger.h | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 7ac143219..2646af0c9 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -631,7 +631,13 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice)
visible.dump(LOG_TAG);
}
- error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
+ if(mFlinger->mDamageUsesScreenReference) {
+ const auto& frame = hwcInfo.displayFrame;
+ auto fullSource = Region(Rect(frame.left, frame.top, frame.right, frame.bottom));
+ error = hwcLayer->setSurfaceDamage(fullSource);
+ } else {
+ error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
+ }
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(),
to_string(error).c_str(), static_cast<int32_t>(error));
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 860625525..2c6dc7f21 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -384,6 +384,14 @@ SurfaceFlinger::SurfaceFlinger() : SurfaceFlinger(SkipInitialization) {
// for production purposes later on.
setenv("TREBLE_TESTING_OVERRIDE", "true", true);
}
+
+ property_get("ro.hardware", value, "");
+ if(strstr(value, "hi3660")||
+ strstr(value, "hi6250") ||
+ strstr(value, "hi3670") ||
+ strstr(value, "kirin970")) {
+ mDamageUsesScreenReference = true;
+ }
}
void SurfaceFlinger::onFirstRef()
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 0148ab675..367ea555a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -852,6 +852,9 @@ private:
// Restrict layers to use two buffers in their bufferqueues.
bool mLayerTripleBufferingDisabled = false;
+ bool mDamageUsesScreenReference;
+
+
// these are thread safe
mutable std::unique_ptr<MessageQueue> mEventQueue{std::make_unique<impl::MessageQueue>()};
FrameTracker mAnimFrameTracker;
--
2.17.1