SF: Generate stable display IDs using EDID
The display IDs generated by HWC are opaque handles. In order for SF and
eventually DisplayManagerService to keep track of more than two displays
and recognize previously seen displays, displays should be given stable
and persistent IDs.
If the HWC supports IComposerClient.getDisplayIdentificationData, SF
parses the EDID structure to generate stable display IDs, which will
be used in a follow-up CL to replace HWC_DISPLAY_{PRIMARY,EXTERNAL}.
Bug: 74619554
Test: dumpsys SurfaceFlinger --display-identification
Test: libsurfaceflinger_unittest
Change-Id: I1a710e2efcf1581fabe48ab96a0eb4e7a5163c0c
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index d7f3b08..bf398b4 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -37,6 +37,8 @@
#include <set>
#include <vector>
+#include "DisplayIdentification.h"
+
extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *request,
struct timespec *remain);
@@ -74,6 +76,9 @@
void registerCallback(HWC2::ComposerCallback* callback,
int32_t sequenceId);
+ bool getDisplayIdentificationData(hwc2_display_t displayId, uint8_t* outPort,
+ DisplayIdentificationData* outData) const;
+
bool hasCapability(HWC2::Capability capability) const;
// Attempts to allocate a virtual display. If the virtual display is created
@@ -149,7 +154,8 @@
// DisplayDevice::DisplayType of the display is returned as an output param.
bool onVsync(hwc2_display_t displayId, int64_t timestamp,
int32_t* outDisplay);
- void onHotplug(hwc2_display_t displayId, int32_t displayType, HWC2::Connection connection);
+ std::optional<DisplayId> onHotplug(hwc2_display_t displayId, int32_t displayType,
+ HWC2::Connection connection);
void setVsyncEnabled(int32_t displayId, HWC2::Vsync enabled);