Delete patches_treble_td/platform_frameworks_native/0009-FOD-support-for-Samsung-and-Asus.patch
This commit is contained in:
parent
ceb4c21f6a
commit
ed55506f1e
@ -1,282 +0,0 @@
|
||||
From 1093dcac13fc8c18e24e8b6394dc2beee6b5d309 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 18 Dec 2022 18:17:30 -0500
|
||||
Subject: [PATCH 09/10] FOD support for Samsung and Asus
|
||||
|
||||
---
|
||||
libs/gui/BLASTBufferQueue.cpp | 20 ++++++++++++++--
|
||||
libs/ui/Gralloc2.cpp | 1 -
|
||||
libs/ui/Gralloc3.cpp | 1 -
|
||||
libs/ui/Gralloc4.cpp | 1 -
|
||||
services/surfaceflinger/BufferQueueLayer.cpp | 1 +
|
||||
.../CompositionEngine/src/OutputLayer.cpp | 24 +++++++++++++++++++
|
||||
.../DisplayHardware/AidlComposerHal.cpp | 7 ++++++
|
||||
.../DisplayHardware/AidlComposerHal.h | 2 ++
|
||||
.../DisplayHardware/ComposerHal.h | 3 +++
|
||||
.../surfaceflinger/DisplayHardware/HWC2.cpp | 8 +++++++
|
||||
.../surfaceflinger/DisplayHardware/HWC2.h | 5 ++++
|
||||
.../DisplayHardware/HidlComposerHal.cpp | 7 ++++++
|
||||
.../DisplayHardware/HidlComposerHal.h | 2 ++
|
||||
13 files changed, 77 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
|
||||
index b8ea0808ab..f6b6752b01 100644
|
||||
--- a/libs/gui/BLASTBufferQueue.cpp
|
||||
+++ b/libs/gui/BLASTBufferQueue.cpp
|
||||
@@ -33,11 +33,20 @@
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include <private/gui/ComposerService.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sSamsungFod = false;
|
||||
+static void init_fod_props() {
|
||||
+ if(sCheckedProps) return;
|
||||
+ sCheckedProps = true;
|
||||
+ sSamsungFod = property_get_bool("persist.sys.phh.fod.samsung", false);
|
||||
+}
|
||||
+
|
||||
namespace {
|
||||
inline const char* boolToString(bool b) {
|
||||
return b ? "true" : "false";
|
||||
@@ -147,9 +156,16 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, bool updateDestinati
|
||||
|
||||
// safe default, most producers are expected to override this
|
||||
mProducer->setMaxDequeuedBufferCount(2);
|
||||
+ uint64_t usage = GraphicBuffer::USAGE_HW_COMPOSER |
|
||||
+ GraphicBuffer::USAGE_HW_TEXTURE;
|
||||
+
|
||||
+ init_fod_props();
|
||||
+ if(sSamsungFod && name.find("SurfaceView[UdfpsControllerOverlay]") != std::string::npos) {
|
||||
+ usage |= 0x400000000LL;
|
||||
+ }
|
||||
+
|
||||
mBufferItemConsumer = new BLASTBufferItemConsumer(mConsumer,
|
||||
- GraphicBuffer::USAGE_HW_COMPOSER |
|
||||
- GraphicBuffer::USAGE_HW_TEXTURE,
|
||||
+ usage,
|
||||
1, false, this);
|
||||
static int32_t id = 0;
|
||||
mName = name + "#" + std::to_string(id);
|
||||
diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp
|
||||
index 4e7fd7ca29..a358f78528 100644
|
||||
--- a/libs/ui/Gralloc2.cpp
|
||||
+++ b/libs/ui/Gralloc2.cpp
|
||||
@@ -115,7 +115,6 @@ status_t Gralloc2Mapper::validateBufferDescriptorInfo(
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Gralloc2 implementations never understand non-BLOB with GPU_DATA_BUFFER
|
||||
diff --git a/libs/ui/Gralloc3.cpp b/libs/ui/Gralloc3.cpp
|
||||
index 194cbdf161..661ecc62a2 100644
|
||||
--- a/libs/ui/Gralloc3.cpp
|
||||
+++ b/libs/ui/Gralloc3.cpp
|
||||
@@ -106,7 +106,6 @@ status_t Gralloc3Mapper::validateBufferDescriptorInfo(
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Gralloc3 implementations never understand non-BLOB with GPU_DATA_BUFFER
|
||||
diff --git a/libs/ui/Gralloc4.cpp b/libs/ui/Gralloc4.cpp
|
||||
index 63f7d31b05..562e383919 100644
|
||||
--- a/libs/ui/Gralloc4.cpp
|
||||
+++ b/libs/ui/Gralloc4.cpp
|
||||
@@ -127,7 +127,6 @@ static status_t validateBufferDescriptorInfo(IMapper::BufferDescriptorInfo* desc
|
||||
if (descriptorInfo->usage & ~validUsageBits) {
|
||||
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
|
||||
descriptorInfo->usage & ~validUsageBits);
|
||||
- return BAD_VALUE;
|
||||
}
|
||||
|
||||
// Combinations that are only allowed with gralloc 4.1.
|
||||
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
index bee4de32a6..4992b8374d 100644
|
||||
--- a/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
@@ -472,6 +472,7 @@ status_t BufferQueueLayer::setDefaultBufferProperties(uint32_t w, uint32_t h, Pi
|
||||
setDefaultBufferSize(w, h);
|
||||
mConsumer->setDefaultBufferFormat(format);
|
||||
mConsumer->setConsumerUsageBits(getEffectiveUsage(0));
|
||||
+ ALOGE("bufferqueuelayer -- name %s", mName.c_str());
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
index 1bb9d0eb63..3960808d49 100644
|
||||
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "system/graphics-base-v1.0.h"
|
||||
|
||||
#include <ui/DataspaceUtils.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic push
|
||||
@@ -37,6 +38,9 @@
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic pop // ignored "-Wconversion"
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sAsusFod = false;
|
||||
+
|
||||
using aidl::android::hardware::graphics::composer3::Composition;
|
||||
|
||||
namespace android::compositionengine {
|
||||
@@ -425,6 +429,26 @@ void OutputLayer::writeOutputDependentGeometryStateToHWC(HWC2::Layer* hwcLayer,
|
||||
->getHeight()));
|
||||
}
|
||||
|
||||
+ if(!sCheckedProps) {
|
||||
+ sCheckedProps = true;
|
||||
+ sAsusFod = property_get_bool("persist.sys.phh.fod.asus", false);
|
||||
+ }
|
||||
+
|
||||
+ if (strstr(getLayerFE().getDebugName(), "UdfpsControllerOverlay#") != nullptr) {
|
||||
+ if (sAsusFod) {
|
||||
+ if (auto error = hwcLayer->setLayerClass(5); error != hal::Error::NONE) {
|
||||
+ ALOGE("Failed setting Asus layer class");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (strstr(getLayerFE().getDebugName(), "SurfaceView[UdfpsControllerOverlay](BLAST)#") != nullptr) {
|
||||
+ if (sAsusFod) {
|
||||
+ if (auto error = hwcLayer->setLayerClass(4); error != hal::Error::NONE) {
|
||||
+ ALOGE("Failed setting Asus layer class");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ALOGV("Writing display frame [%d, %d, %d, %d]", displayFrame.left, displayFrame.top,
|
||||
displayFrame.right, displayFrame.bottom);
|
||||
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
index 79dcd159d3..922bd8c364 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
|
||||
@@ -1126,5 +1126,12 @@ Error AidlComposer::getPhysicalDisplayOrientation(Display displayId,
|
||||
return Error::NONE;
|
||||
}
|
||||
|
||||
+Error AidlComposer::setLayerClass(Display display, Layer layer, uint32_t layerClass) {
|
||||
+ (void) display;
|
||||
+ (void) layer;
|
||||
+ (void) layerClass;
|
||||
+ return Error::NONE;
|
||||
+}
|
||||
+
|
||||
} // namespace Hwc2
|
||||
} // namespace android
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
index 18d2242c7e..8ebca826a4 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
|
||||
@@ -227,6 +227,8 @@ public:
|
||||
Error getPhysicalDisplayOrientation(Display displayId,
|
||||
AidlTransform* outDisplayOrientation) override;
|
||||
|
||||
+ // Proprietary extensions
|
||||
+ Error setLayerClass(Display display, Layer layer, uint32_t layerClass) override;
|
||||
private:
|
||||
// Many public functions above simply write a command into the command
|
||||
// queue to batch the calls. validateDisplay and presentDisplay will call
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
index d266d942fb..b81d01e6d8 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h
|
||||
@@ -281,6 +281,9 @@ public:
|
||||
virtual Error setIdleTimerEnabled(Display displayId, std::chrono::milliseconds timeout) = 0;
|
||||
virtual Error getPhysicalDisplayOrientation(Display displayId,
|
||||
AidlTransform* outDisplayOrientation) = 0;
|
||||
+
|
||||
+ // Proprietary extensions
|
||||
+ virtual Error setLayerClass(Display display, Layer layer, uint32_t layerClass) = 0;
|
||||
};
|
||||
|
||||
} // namespace Hwc2
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
index c52e96d146..82f60516ae 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
|
||||
@@ -988,6 +988,14 @@ Error Layer::setBlockingRegion(const Region& region) {
|
||||
return static_cast<Error>(intError);
|
||||
}
|
||||
|
||||
+Error Layer::setLayerClass(uint32_t layerClass) {
|
||||
+ if (CC_UNLIKELY(!mDisplay)) {
|
||||
+ return Error::BAD_DISPLAY;
|
||||
+ }
|
||||
+ auto intError = mComposer.setLayerClass(mDisplay->getId(), mId, layerClass);
|
||||
+ return static_cast<Error>(intError);
|
||||
+}
|
||||
+
|
||||
} // namespace impl
|
||||
} // namespace HWC2
|
||||
} // namespace android
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
index 24aef9b73c..138d14456c 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
|
||||
@@ -333,6 +333,9 @@ public:
|
||||
// AIDL HAL
|
||||
[[nodiscard]] virtual hal::Error setBrightness(float brightness) = 0;
|
||||
[[nodiscard]] virtual hal::Error setBlockingRegion(const android::Region& region) = 0;
|
||||
+
|
||||
+ // Proprietary HAL
|
||||
+ [[nodiscard]] virtual hal::Error setLayerClass(uint32_t layerClass) = 0;
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
@@ -382,6 +385,8 @@ public:
|
||||
hal::Error setBrightness(float brightness) override;
|
||||
hal::Error setBlockingRegion(const android::Region& region) override;
|
||||
|
||||
+ // Proprietary HAL
|
||||
+ hal::Error setLayerClass(uint32_t layerClass) override;
|
||||
private:
|
||||
// These are references to data owned by HWC2::Device, which will outlive
|
||||
// this HWC2::Layer, so these references are guaranteed to be valid for
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
index 2597ae6091..12b36f321e 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
|
||||
@@ -1345,6 +1345,13 @@ Error HidlComposer::getPhysicalDisplayOrientation(Display, AidlTransform*) {
|
||||
"OptionalFeature::PhysicalDisplayOrientation is not supported on HIDL");
|
||||
}
|
||||
|
||||
+Error HidlComposer::setLayerClass(Display display, Layer layer, uint32_t layerClass) {
|
||||
+ mWriter.selectDisplay(display);
|
||||
+ mWriter.selectLayer(layer);
|
||||
+ mWriter.vendor800_1(layerClass);
|
||||
+ return Error::NONE;
|
||||
+}
|
||||
+
|
||||
void HidlComposer::registerCallback(ComposerCallback& callback) {
|
||||
const bool vsyncSwitchingSupported =
|
||||
isSupported(Hwc2::Composer::OptionalFeature::RefreshRateSwitching);
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
index d0d3c2e6d7..c40986fae9 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
|
||||
@@ -338,6 +338,8 @@ public:
|
||||
Error getPhysicalDisplayOrientation(Display displayId,
|
||||
AidlTransform* outDisplayOrientation) override;
|
||||
|
||||
+ // Proprietary extensions
|
||||
+ Error setLayerClass(Display display, Layer layer, uint32_t layerClass) override;
|
||||
private:
|
||||
class CommandWriter : public CommandWriterBase {
|
||||
public:
|
||||
--
|
||||
2.34.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user