[SurfaceFlinger] Replace android_dataspace with Dataspace.
This patch replaces all android_dataspace in SurfaceFlinger with Dataspace
V1.1. 3 commands in sequence are used to do the conversion:
find ./ -type f -exec sed -i -e 's/android_dataspace_t/Dataspace/g' {} \;
find ./ -type f -exec sed -i -e 's/android_dataspace/Dataspace/g' {} \;
find ./ -type f -exec sed -i -e 's/HAL_DATASPACE_/Dataspace::/g' {} \;
With some minor tweak because most of the APIs in frameworks/native are still
accepting android_dataspace/android_dataspace_t.
Next step is to convert the rest of android_dataspace usage to Dataspace in
frameworks/native as well as frameworks/base.
BUG: 77156734
Test: Build and flash
Change-Id: I2304c7014cb49a1c9f67c4563603fb55e8dbd679
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
index 117a99d..bbffd0a 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
@@ -32,6 +32,7 @@
using hardware::Return;
using hardware::hidl_vec;
using hardware::hidl_handle;
+using namespace hardware::graphics::common;
using namespace hardware::graphics::composer;
using PerFrameMetadata = hardware::graphics::composer::V2_2::IComposerClient::PerFrameMetadata;
using PerFrameMetadataKey =
@@ -256,17 +257,32 @@
{
const uint32_t bufferSlotCount = 1;
Error error = kDefaultError;
- mClient->createVirtualDisplay(width, height, *format, bufferSlotCount,
- [&](const auto& tmpError, const auto& tmpDisplay,
- const auto& tmpFormat) {
- error = tmpError;
- if (error != Error::NONE) {
- return;
- }
+ if (mClient_2_2) {
+ mClient_2_2->createVirtualDisplay_2_2(width, height, *format, bufferSlotCount,
+ [&](const auto& tmpError, const auto& tmpDisplay,
+ const auto& tmpFormat) {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
- *outDisplay = tmpDisplay;
- *format = tmpFormat;
+ *outDisplay = tmpDisplay;
+ *format = tmpFormat;
+ });
+ } else {
+ mClient->createVirtualDisplay(width, height,
+ static_cast<V1_0::PixelFormat>(*format), bufferSlotCount,
+ [&](const auto& tmpError, const auto& tmpDisplay,
+ const auto& tmpFormat) {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outDisplay = tmpDisplay;
+ *format = static_cast<PixelFormat>(tmpFormat);
});
+ }
return error;
}
@@ -522,7 +538,7 @@
.height = target->getHeight(),
.stride = target->getStride(),
.layerCount = target->getLayerCount(),
- .format = static_cast<PixelFormat>(target->getPixelFormat()),
+ .format = static_cast<V1_0::PixelFormat>(target->getPixelFormat()),
.usage = target->getUsage(),
};
mWriter.setClientTargetMetadata(metadata);
@@ -645,7 +661,7 @@
.height = buffer->getHeight(),
.stride = buffer->getStride(),
.layerCount = buffer->getLayerCount(),
- .format = static_cast<PixelFormat>(buffer->getPixelFormat()),
+ .format = static_cast<V1_0::PixelFormat>(buffer->getPixelFormat()),
.usage = buffer->getUsage(),
};
mWriter.setLayerBufferMetadata(metadata);