android-12.0.0_r32 patches

This commit is contained in:
Ziyang Zhou
2023-10-05 22:27:22 +08:00
parent b3fa25049b
commit 03a0fccccd
18 changed files with 928 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
From d7c7d10b4f754ec4063cb619a8a7485174ada4ce Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 20 Sep 2021 18:22:20 +0000
Subject: [PATCH] video playback workaround
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 4711315615..af596e8168 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -130,6 +130,7 @@ void SoftwareRenderer::resetFormatIfChanged(
// hardware has YUV12 and RGBA8888 support, so convert known formats
{
switch (mColorFormat) {
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar:
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
@@ -139,6 +140,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
@@ -154,6 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar16:
{
if (((dataSpace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT2020)
@@ -170,6 +173,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
{
break;
--
2.34.1

View File

@@ -0,0 +1,58 @@
From 78a265c62f866a3d83701ad337158fd615e4e5f1 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:04:00 +0800
Subject: [PATCH 1/2] fix booting
---
libs/binder/Binder.cpp | 1 +
libs/binder/IPCThreadState.cpp | 2 +-
libs/binder/ProcessState.cpp | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index d5bdd1c803..94b8da8e1c 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -276,6 +276,7 @@ bool BBinder::isRequestingSid()
void BBinder::setRequestingSid(bool requestingSid)
{
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index c415ea02e2..3e71a9c8e6 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -1242,7 +1242,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
clearPropagateWorkSource();
mCallingPid = tr.sender_pid;
- mCallingSid = reinterpret_cast<const char*>(tr_secctx.secctx);
+ mCallingSid = "HACKED";
mCallingUid = tr.sender_euid;
mLastTransactionBinderFlags = tr.flags;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index bade9187ac..8e8fec5040 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -149,11 +149,14 @@ bool ProcessState::becomeContextManager()
{
AutoMutex _l(mLock);
+#if 0 // HACKED
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
int result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ status_t result = 1;
// fallback to original method
if (result != 0) {
--
2.34.1

View File

@@ -0,0 +1,70 @@
From 335caa486b9faa8e89a1b81e442726fa839d4776 Mon Sep 17 00:00:00 2001
From: Chris Forbes <chrisforbes@google.com>
Date: Thu, 22 Jul 2021 13:54:04 -0700
Subject: [PATCH 2/2] Inline GetPhysicalDeviceProperties2 into
QueryPresentationProperties
In general, we implement the 1.1 instance / physical device API as
preferring to call the native 1.1 function if available; otherwise
falling back to calling the equivalent GPDP2 function. If the
underlying driver supports *neither* then any caller of that function
has already invoked UB by calling it and so falling over is acceptable.
Unfortunately, the loader itself does call vkGetPhysicalDeviceProperties2
in one case, regardless of what the driver may support, in order to
determine whether the platform's swapchain implementation should expose
some features. On a 1.0 driver without the GPDP2 extension, this caused
trouble.
As a slight further wrinkle, vkGetPhysicalDeviceProperties2 "cannot
fail", making propagating a failure back up through the loader annoying.
As a workaround, inline the calls to GetPhysicalDeviceProperties2 and
GetPhysicalDeviceProperties2KHR into QueryPresentationProperties, where
we can handle our one special case of both function pointers being
missing but behavior being defined.
Bug: b/192130684
Bug: 208682099
Test: TH
Change-Id: Iff2bae98b7931bed80fafd895cf57061becabd8d
Merged-In: Iff2bae98b7931bed80fafd895cf57061becabd8d
---
vulkan/libvulkan/driver.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index d7fdab5586..cf774fd9b8 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -979,6 +979,8 @@ VkResult EnumerateInstanceExtensionProperties(
void QueryPresentationProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDevicePresentationPropertiesANDROID* presentation_properties) {
+ ATRACE_CALL();
+
// Request the android-specific presentation properties via GPDP2
VkPhysicalDeviceProperties2 properties = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
@@ -994,7 +996,17 @@ void QueryPresentationProperties(
presentation_properties->pNext = nullptr;
presentation_properties->sharedImage = VK_FALSE;
- GetPhysicalDeviceProperties2(physicalDevice, &properties);
+ const auto& driver = GetData(physicalDevice).driver;
+
+ if (driver.GetPhysicalDeviceProperties2) {
+ // >= 1.1 driver, supports core GPDP2 entrypoint.
+ driver.GetPhysicalDeviceProperties2(physicalDevice, &properties);
+ } else if (driver.GetPhysicalDeviceProperties2KHR) {
+ // Old driver, but may support presentation properties
+ // if we have the GPDP2 extension. Otherwise, no presentation
+ // properties supported.
+ driver.GetPhysicalDeviceProperties2KHR(physicalDevice, &properties);
+ }
}
VkResult EnumerateDeviceExtensionProperties(
--
2.34.1