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

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

Issue 522463005: [Ozone-GBM] Handle GPU crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reland of: [Ozone-GBM] Handle GPU crashes Created 6 years, 3 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
Index: ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc
diff --git a/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc b/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc
index 17f582ce013455e12ea840f4e4bb41d668cd8a38..02817f9d7d79f5458dc97828a2fa5536317607cd 100644
--- a/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc
+++ b/ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc
@@ -52,6 +52,23 @@ uint32_t GetContentProtectionValue(drmModePropertyRes* property,
return 0;
}
+class DisplaySnapshotComparator {
+ public:
+ DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot)
+ : snapshot_(snapshot) {}
+
+ bool operator()(const DisplaySnapshotDri* other) const {
+ if (snapshot_->connector() == other->connector() &&
+ snapshot_->crtc() == other->crtc())
+ return true;
+
+ return false;
+ }
+
+ private:
+ const DisplaySnapshotDri* snapshot_;
+};
+
} // namespace
NativeDisplayDelegateDri::NativeDisplayDelegateDri(
@@ -288,18 +305,25 @@ void NativeDisplayDelegateDri::NotifyScreenManager(
const std::vector<DisplaySnapshotDri*>& new_displays,
const std::vector<DisplaySnapshotDri*>& old_displays) const {
for (size_t i = 0; i < old_displays.size(); ++i) {
- bool found = false;
- for (size_t j = 0; j < new_displays.size(); ++j) {
- if (old_displays[i]->connector() == new_displays[j]->connector() &&
- old_displays[i]->crtc() == new_displays[j]->crtc()) {
- found = true;
- break;
- }
- }
+ const std::vector<DisplaySnapshotDri*>::const_iterator it =
+ std::find_if(new_displays.begin(),
+ new_displays.end(),
+ DisplaySnapshotComparator(old_displays[i]));
- if (!found)
+ if (it == new_displays.end())
screen_manager_->RemoveDisplayController(old_displays[i]->crtc());
}
+
+ for (size_t i = 0; i < new_displays.size(); ++i) {
+ const std::vector<DisplaySnapshotDri*>::const_iterator it =
+ std::find_if(old_displays.begin(),
+ old_displays.end(),
+ DisplaySnapshotComparator(new_displays[i]));
+
+ if (it == old_displays.end())
+ screen_manager_->AddDisplayController(new_displays[i]->crtc(),
+ new_displays[i]->connector());
+ }
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698