diff options
author | 2022-04-08 15:27:57 -0400 | |
---|---|---|
committer | 2022-04-13 13:32:37 -0400 | |
commit | cd9e7b46e6f62e0dcc4e7093917aeabfff40de2f (patch) | |
tree | b5ebe96b499e7d0fe3ff2edd23d7973f22a3004b | |
parent | e360c271c6f02693d189774f5967c237896d2d7b (diff) |
Report no DisplayDecorationSupport in GL
Previously we were using an EGLConfig that is out of line with the spec
in order to support this. It would be more work to get this to work
properly, and the devices we're shipping with hardware support will
always be using Vulkan in HWUI. Simply disable the feature, so that
such a device can still work when switched to use GL.
Add a new APEX header for querying various system properties. This matches
how libandroid_runtime accesses other HWUI utilities. Currently the new
header only includes one method, but could be expanded in the future to
include other properties.
Bug: 226371798
Test: manual
Change-Id: I276e089ecb68ce1fff58adeb38774f2c860e7cf6
-rw-r--r-- | core/jni/android_view_SurfaceControl.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/Android.bp | 1 | ||||
-rw-r--r-- | libs/hwui/apex/include/android/graphics/properties.h | 32 | ||||
-rw-r--r-- | libs/hwui/apex/properties.cpp | 24 | ||||
-rw-r--r-- | libs/hwui/libhwui.map.txt | 1 |
5 files changed, 65 insertions, 0 deletions
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 518fc09dee5a..51a708b76801 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -24,7 +24,9 @@ #include <memory> +#include <aidl/android/hardware/graphics/common/PixelFormat.h> #include <android-base/chrono_utils.h> +#include <android/graphics/properties.h> #include <android/graphics/region.h> #include <android/gui/BnScreenCaptureListener.h> #include <android/hardware/display/IDeviceProductInfoConstants.h> @@ -1888,6 +1890,11 @@ static jobject nativeGetDisplayDecorationSupport(JNIEnv* env, jclass clazz, return nullptr; } + using aidl::android::hardware::graphics::common::PixelFormat; + if (support.value().format == PixelFormat::R_8 && !hwui_uses_vulkan()) { + return nullptr; + } + jobject jDisplayDecorationSupport = env->NewObject(gDisplayDecorationSupportInfo.clazz, gDisplayDecorationSupportInfo.ctor); if (jDisplayDecorationSupport == nullptr) { diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index ece150a4bd45..d8b077b32420 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -249,6 +249,7 @@ cc_defaults { "apex/android_matrix.cpp", "apex/android_paint.cpp", "apex/android_region.cpp", + "apex/properties.cpp", ], header_libs: ["android_graphics_apex_headers"], diff --git a/libs/hwui/apex/include/android/graphics/properties.h b/libs/hwui/apex/include/android/graphics/properties.h new file mode 100644 index 000000000000..f24f840710f9 --- /dev/null +++ b/libs/hwui/apex/include/android/graphics/properties.h @@ -0,0 +1,32 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_GRAPHICS_PROPERTIES_H +#define ANDROID_GRAPHICS_PROPERTIES_H + +#include <cutils/compiler.h> +#include <sys/cdefs.h> + +__BEGIN_DECLS + +/** + * Returns true if libhwui is using the vulkan backend. + */ +ANDROID_API bool hwui_uses_vulkan(); + +__END_DECLS + +#endif // ANDROID_GRAPHICS_PROPERTIES_H diff --git a/libs/hwui/apex/properties.cpp b/libs/hwui/apex/properties.cpp new file mode 100644 index 000000000000..abb333be159a --- /dev/null +++ b/libs/hwui/apex/properties.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "android/graphics/properties.h" + +#include <Properties.h> + +bool hwui_uses_vulkan() { + return android::uirenderer::Properties::peekRenderPipelineType() == + android::uirenderer::RenderPipelineType::SkiaVulkan; +} diff --git a/libs/hwui/libhwui.map.txt b/libs/hwui/libhwui.map.txt index 087c006a8680..fdb237387098 100644 --- a/libs/hwui/libhwui.map.txt +++ b/libs/hwui/libhwui.map.txt @@ -39,6 +39,7 @@ LIBHWUI { # platform-only /* HWUI isn't current a module, so all of these are st ARegionIterator_next; ARegionIterator_getRect; ARegionIterator_getTotalBounds; + hwui_uses_vulkan; local: *; }; |