Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: ui/ozone/platform/dri/native_display_delegate_dri.cc

Issue 845383002: [Ozone-DRI] Make sure the display configuration is up-to-date on the GPU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_gpu_platform_support.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/native_display_delegate_dri.cc
diff --git a/ui/ozone/platform/dri/native_display_delegate_dri.cc b/ui/ozone/platform/dri/native_display_delegate_dri.cc
index 70dc7d4fb50f0290f5949a7272dd0433e8d1a5a3..d1b853b4d5d944929ceb47d134720466980ad48c 100644
--- a/ui/ozone/platform/dri/native_display_delegate_dri.cc
+++ b/ui/ozone/platform/dri/native_display_delegate_dri.cc
@@ -49,19 +49,19 @@ uint32_t GetContentProtectionValue(drmModePropertyRes* property,
class DisplaySnapshotComparator {
public:
- DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot)
- : snapshot_(snapshot) {}
+ explicit DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot)
+ : crtc_(snapshot->crtc()), connector_(snapshot->connector()) {}
- bool operator()(const DisplaySnapshotDri* other) const {
- if (snapshot_->connector() == other->connector() &&
- snapshot_->crtc() == other->crtc())
- return true;
+ DisplaySnapshotComparator(uint32_t crtc, uint32_t connector)
+ : crtc_(crtc), connector_(connector) {}
- return false;
+ bool operator()(const DisplaySnapshotDri* other) const {
+ return connector_ == other->connector() && crtc_ == other->crtc();
}
private:
- const DisplaySnapshotDri* snapshot_;
+ uint32_t crtc_;
+ uint32_t connector_;
};
} // namespace
@@ -140,13 +140,25 @@ void NativeDisplayDelegateDri::ForceDPMSOn() {
std::vector<DisplaySnapshot*> NativeDisplayDelegateDri::GetDisplays() {
ScopedVector<DisplaySnapshotDri> old_displays(cached_displays_.Pass());
- cached_modes_.clear();
+ ScopedVector<const DisplayMode> old_modes(cached_modes_.Pass());
ScopedVector<HardwareDisplayControllerInfo> displays =
GetAvailableDisplayControllerInfos(dri_->get_fd());
for (size_t i = 0; i < displays.size(); ++i) {
DisplaySnapshotDri* display = new DisplaySnapshotDri(
dri_, displays[i]->connector(), displays[i]->crtc(), i);
+
+ // If the display exists make sure to sync up the new snapshot with the old
+ // one to keep the user configured details.
+ auto it = std::find_if(
+ old_displays.begin(), old_displays.end(),
+ DisplaySnapshotComparator(displays[i]->crtc()->crtc_id,
+ displays[i]->connector()->connector_id));
+ // Origin is only used within the platform code to keep track of the display
+ // location.
+ if (it != old_displays.end())
+ display->set_origin((*it)->origin());
+
cached_displays_.push_back(display);
cached_modes_.insert(cached_modes_.end(), display->modes().begin(),
display->modes().end());
« no previous file with comments | « ui/ozone/platform/dri/dri_gpu_platform_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698