SF: Use consistent names for display IDs
There are two types of display IDs: hwc2_display_t for HWC IDs, and
int32_t for SF IDs. The latter are confusingly referred to as "hwcId".
This CL renames them to "hwcDisplayId" and "displayId", respectively.
Note that int32_t will be replaced by DisplayId in a follow-up CL.
Bug: 74619554
Test: Build
Change-Id: Ia9b621d385c2bf842a2093b578140dc7a2eaea69
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index 0b6a9b1..1a7805a 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -234,8 +234,8 @@
*
*/
-template <DisplayDevice::DisplayType type, DisplayDevice::DisplayType hwcId, int width, int height,
- Critical critical, Async async, Secure secure, int grallocUsage>
+template <DisplayDevice::DisplayType type, DisplayDevice::DisplayType displayId, int width,
+ int height, Critical critical, Async async, Secure secure, int grallocUsage>
struct DisplayVariant {
// The display width and height
static constexpr int WIDTH = width;
@@ -245,7 +245,7 @@
// The type for this display
static constexpr DisplayDevice::DisplayType TYPE = type;
- static constexpr DisplayDevice::DisplayType HWCOMPOSER_ID = hwcId;
+ static constexpr DisplayDevice::DisplayType DISPLAY_ID = displayId;
// When creating native window surfaces for the framebuffer, whether those should be critical
static constexpr Critical CRITICAL = critical;
@@ -257,7 +257,7 @@
static constexpr Secure SECURE = secure;
static auto makeFakeExistingDisplayInjector(DisplayTransactionTest* test) {
- auto injector = FakeDisplayDeviceInjector(test->mFlinger, TYPE, HWCOMPOSER_ID);
+ auto injector = FakeDisplayDeviceInjector(test->mFlinger, TYPE, DISPLAY_ID);
injector.setSecure(static_cast<bool>(SECURE));
return injector;
}
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index f512fba..5dcac92 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -70,11 +70,11 @@
auto resetDisplayState() { return mFlinger->resetDisplayState(); }
- auto setupNewDisplayDeviceInternal(const wp<IBinder>& displayToken, int hwcId,
+ auto setupNewDisplayDeviceInternal(const wp<IBinder>& displayToken, int32_t displayId,
const DisplayDeviceState& state,
const sp<DisplaySurface>& dispSurface,
const sp<IGraphicBufferProducer>& producer) {
- return mFlinger->setupNewDisplayDeviceInternal(displayToken, hwcId, state, dispSurface,
+ return mFlinger->setupNewDisplayDeviceInternal(displayToken, displayId, state, dispSurface,
producer);
}
@@ -255,8 +255,8 @@
class FakeDisplayDeviceInjector {
public:
FakeDisplayDeviceInjector(TestableSurfaceFlinger& flinger, DisplayDevice::DisplayType type,
- int hwcId)
- : mFlinger(flinger), mType(type), mHwcId(hwcId) {}
+ int32_t displayId)
+ : mFlinger(flinger), mType(type), mDisplayId(displayId) {}
sp<IBinder> token() const { return mDisplayToken; }
@@ -301,10 +301,10 @@
sp<DisplayDevice> inject() {
std::unordered_map<ui::ColorMode, std::vector<ui::RenderIntent>> hdrAndRenderIntents;
sp<DisplayDevice> device =
- new DisplayDevice(mFlinger.mFlinger.get(), mType, mHwcId, mSecure, mDisplayToken,
- mNativeWindow, mDisplaySurface, std::move(mRenderSurface), 0,
- 0, false, HdrCapabilities(), 0, hdrAndRenderIntents,
- HWC_POWER_MODE_NORMAL);
+ new DisplayDevice(mFlinger.mFlinger.get(), mType, mDisplayId, mSecure,
+ mDisplayToken, mNativeWindow, mDisplaySurface,
+ std::move(mRenderSurface), 0, 0, false, HdrCapabilities(), 0,
+ hdrAndRenderIntents, HWC_POWER_MODE_NORMAL);
mFlinger.mutableDisplays().emplace(mDisplayToken, device);
DisplayDeviceState state;
@@ -324,7 +324,7 @@
TestableSurfaceFlinger& mFlinger;
sp<BBinder> mDisplayToken = new BBinder();
DisplayDevice::DisplayType mType;
- int mHwcId;
+ const int32_t mDisplayId;
sp<ANativeWindow> mNativeWindow;
sp<DisplaySurface> mDisplaySurface;
std::unique_ptr<RE::Surface> mRenderSurface;