diff options
author | Bo Hu <bohu@google.com> | 2023-07-06 18:06:00 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-07-06 18:06:00 +0000 |
commit | 6a51f0236bf6c17d0745a767f5200ce846b468c6 (patch) | |
tree | cfae870fad9fae0b0fb4a3acfff09ab3d70cc75e | |
parent | ea385d951c5519238deadb20999c241811d3063a (diff) | |
parent | f8ebd505ec29ebde604e3257c2b8df016cd5135f (diff) | |
download | goldfish-opengl-6a51f0236bf6c17d0745a767f5200ce846b468c6.tar.gz |
hw3: add ro.root.qemu.external.displays am: f8ebd505ec
Original change: https://googleplex-android-review.googlesource.com/c/device/generic/goldfish-opengl/+/23916946
Change-Id: I5662075e6c1e938a2b05449d0279cb7bf34946f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | system/hwc3/DisplayFinder.cpp | 69 | ||||
-rw-r--r-- | system/hwc3/DisplayFinder.h | 2 | ||||
-rw-r--r-- | system/hwc3/GuestFrameComposer.cpp | 30 |
3 files changed, 46 insertions, 55 deletions
diff --git a/system/hwc3/DisplayFinder.cpp b/system/hwc3/DisplayFinder.cpp index 1bbb56c2..b3bc4f67 100644 --- a/system/hwc3/DisplayFinder.cpp +++ b/system/hwc3/DisplayFinder.cpp @@ -123,39 +123,54 @@ HWC3::Error findGoldfishPrimaryDisplay( return HWC3::Error::None; } +void parseExternalDisplaysFromProperties(std::vector<int>& outPropIntParts) { + + static constexpr const char* kExternalDisplayProp[] = { + "hwservicemanager.external.displays", + "ro.boot.qemu.external.displays", + }; + + for (auto propName: kExternalDisplayProp) { + const std::string propVal = ::android::base::GetProperty(propName, ""); + if (propVal.empty()) { + DEBUG_LOG("%s: prop name is: %s, prop value is: empty", __FUNCTION__, + propName); + continue; + } + DEBUG_LOG("%s: prop name is: %s, prop value is: %s", __FUNCTION__, + propName, propVal.c_str()); + + const std::vector<std::string> propStringParts = + ::android::base::Split(propVal, ","); + if (propStringParts.size() % 5 != 0) { + ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, + propName, propVal.c_str()); + continue; + } + std::vector<int> propIntParts; + for (const std::string& propStringPart : propStringParts) { + int propIntPart; + if (!::android::base::ParseInt(propStringPart, &propIntPart)) { + ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, + propName, propVal.c_str()); + break; + } + propIntParts.push_back(propIntPart); + } + if (propIntParts.empty() || propIntParts.size() % 5 != 0) { + continue; + } + outPropIntParts.insert(outPropIntParts.end(), propIntParts.begin(), propIntParts.end()); + } +} + HWC3::Error findGoldfishSecondaryDisplays( std::vector<DisplayMultiConfigs>* outDisplays) { DEBUG_LOG("%s", __FUNCTION__); - static constexpr const char kExternalDisplayProp[] = - "hwservicemanager.external.displays"; - - const auto propString = - ::android::base::GetProperty(kExternalDisplayProp, ""); - DEBUG_LOG("%s: prop value is: %s", __FUNCTION__, propString.c_str()); - - if (propString.empty()) { - return HWC3::Error::None; - } - - const std::vector<std::string> propStringParts = - ::android::base::Split(propString, ","); - if (propStringParts.size() % 5 != 0) { - ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, - kExternalDisplayProp, propString.c_str()); - return HWC3::Error::BadParameter; - } std::vector<int> propIntParts; - for (const std::string& propStringPart : propStringParts) { - int propIntPart; - if (!::android::base::ParseInt(propStringPart, &propIntPart)) { - ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, - kExternalDisplayProp, propString.c_str()); - return HWC3::Error::BadParameter; - } - propIntParts.push_back(propIntPart); - } + parseExternalDisplaysFromProperties(propIntParts); int64_t secondaryDisplayId = 1; while (!propIntParts.empty()) { diff --git a/system/hwc3/DisplayFinder.h b/system/hwc3/DisplayFinder.h index 963e4c17..f66eedfb 100644 --- a/system/hwc3/DisplayFinder.h +++ b/system/hwc3/DisplayFinder.h @@ -33,6 +33,8 @@ struct DisplayMultiConfigs { std::vector<DisplayConfig> configs; }; +void parseExternalDisplaysFromProperties(std::vector<int>& outPropIntParts); + HWC3::Error findDisplays(const DrmClient* drm, std::vector<DisplayMultiConfigs>* outDisplays); diff --git a/system/hwc3/GuestFrameComposer.cpp b/system/hwc3/GuestFrameComposer.cpp index 078cce4f..b4eef6a4 100644 --- a/system/hwc3/GuestFrameComposer.cpp +++ b/system/hwc3/GuestFrameComposer.cpp @@ -29,6 +29,7 @@ #include <ui/GraphicBufferMapper.h> #include "Display.h" +#include "DisplayFinder.h" #include "Drm.h" #include "Layer.h" @@ -591,35 +592,8 @@ HWC3::Error GuestFrameComposer::getDisplayConfigsFromSystemProp( std::vector<GuestFrameComposer::DisplayConfig>* configs) { DEBUG_LOG("%s", __FUNCTION__); - static constexpr const char kExternalDisplayProp[] = - "hwservicemanager.external.displays"; - - const auto propString = - ::android::base::GetProperty(kExternalDisplayProp, ""); - DEBUG_LOG("%s: prop value is: %s", __FUNCTION__, propString.c_str()); - - if (propString.empty()) { - return HWC3::Error::None; - } - - const std::vector<std::string> propStringParts = - ::android::base::Split(propString, ","); - if (propStringParts.size() % 5 != 0) { - ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, - kExternalDisplayProp, propString.c_str()); - return HWC3::Error::BadParameter; - } - std::vector<int> propIntParts; - for (const std::string& propStringPart : propStringParts) { - int propIntPart; - if (!::android::base::ParseInt(propStringPart, &propIntPart)) { - ALOGE("%s: Invalid syntax for system prop %s which is %s", __FUNCTION__, - kExternalDisplayProp, propString.c_str()); - return HWC3::Error::BadParameter; - } - propIntParts.push_back(propIntPart); - } + parseExternalDisplaysFromProperties(propIntParts); while (!propIntParts.empty()) { DisplayConfig display_config = { |