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

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

Issue 548613002: Revert of [Ozone-GBM] Handle GPU crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.h ('k') | ui/ozone/platform/dri/screen_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/screen_manager.cc
diff --git a/ui/ozone/platform/dri/screen_manager.cc b/ui/ozone/platform/dri/screen_manager.cc
index d82ae01fc6e3ad16dff540ada414b3dbb8c827d3..f14b0869b9581f5b4931a14b5170ba9649444625 100644
--- a/ui/ozone/platform/dri/screen_manager.cc
+++ b/ui/ozone/platform/dri/screen_manager.cc
@@ -24,21 +24,6 @@
ScreenManager::~ScreenManager() {
}
-void ScreenManager::AddDisplayController(uint32_t crtc, uint32_t connector) {
- HardwareDisplayControllers::iterator it = FindDisplayController(crtc);
- // TODO(dnicoara): Turn this into a DCHECK when async display configuration is
- // properly supported. (When there can't be a race between forcing initial
- // display configuration in ScreenManager and NativeDisplayDelegate creating
- // the display controllers.)
- if (it != controllers_.end()) {
- LOG(WARNING) << "Display controller (crtc=" << crtc << ") already present.";
- return;
- }
-
- controllers_.push_back(new HardwareDisplayController(
- dri_, scoped_ptr<CrtcState>(new CrtcState(dri_, crtc, connector))));
-}
-
void ScreenManager::RemoveDisplayController(uint32_t crtc) {
HardwareDisplayControllers::iterator it = FindDisplayController(crtc);
if (it != controllers_.end()) {
@@ -56,33 +41,47 @@
gfx::Rect modeset_bounds(
origin.x(), origin.y(), mode.hdisplay, mode.vdisplay);
HardwareDisplayControllers::iterator it = FindDisplayController(crtc);
- DCHECK(controllers_.end() != it) << "Display controller (crtc=" << crtc
- << ") doesn't exist.";
-
- HardwareDisplayController* controller = *it;
- controller = *it;
- // If nothing changed just enable the controller. Note, we perform an exact
- // comparison on the mode since the refresh rate may have changed.
- if (SameMode(mode, controller->get_mode()) &&
- origin == controller->origin() && !controller->IsDisabled())
- return controller->Enable();
-
- // Either the mode or the location of the display changed, so exit mirror
- // mode and configure the display independently. If the caller still wants
- // mirror mode, subsequent calls configuring the other controllers will
- // restore mirror mode.
- if (controller->IsMirrored()) {
- controller =
- new HardwareDisplayController(dri_, controller->RemoveCrtc(crtc));
+ HardwareDisplayController* controller = NULL;
+ if (it != controllers_.end()) {
+ controller = *it;
+ // If nothing changed just enable the controller. Note, we perform an exact
+ // comparison on the mode since the refresh rate may have changed.
+ if (SameMode(mode, controller->get_mode()) &&
+ origin == controller->origin() && !controller->IsDisabled())
+ return controller->Enable();
+
+ // Either the mode or the location of the display changed, so exit mirror
+ // mode and configure the display independently. If the caller still wants
+ // mirror mode, subsequent calls configuring the other controllers will
+ // restore mirror mode.
+ if (controller->IsMirrored()) {
+ controller =
+ new HardwareDisplayController(dri_, controller->RemoveCrtc(crtc));
+ controllers_.push_back(controller);
+ it = --controllers_.end();
+ }
+
+ HardwareDisplayControllers::iterator mirror =
+ FindActiveDisplayControllerByLocation(modeset_bounds);
+ // Handle mirror mode.
+ if (mirror != controllers_.end() && it != mirror)
+ return HandleMirrorMode(it, mirror, crtc, connector);
+ } else {
+ HardwareDisplayControllers::iterator mirror =
+ FindActiveDisplayControllerByLocation(modeset_bounds);
+ if (mirror != controllers_.end()) {
+ (*mirror)->AddCrtc(
+ scoped_ptr<CrtcState>(new CrtcState(dri_, crtc, connector)));
+ return (*mirror)->Enable();
+ }
+ }
+
+ if (!controller) {
+ controller = new HardwareDisplayController(
+ dri_,
+ scoped_ptr<CrtcState>(new CrtcState(dri_, crtc, connector)));
controllers_.push_back(controller);
- it = --controllers_.end();
- }
-
- HardwareDisplayControllers::iterator mirror =
- FindActiveDisplayControllerByLocation(modeset_bounds);
- // Handle mirror mode.
- if (mirror != controllers_.end() && it != mirror)
- return HandleMirrorMode(it, mirror, crtc, connector);
+ }
return ModesetDisplayController(controller, origin, mode);
}
@@ -161,8 +160,6 @@
dpms->prop_id,
DRM_MODE_DPMS_ON);
- AddDisplayController(displays[0]->crtc()->crtc_id,
- displays[0]->connector()->connector_id);
ConfigureDisplayController(displays[0]->crtc()->crtc_id,
displays[0]->connector()->connector_id,
gfx::Point(),
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.h ('k') | ui/ozone/platform/dri/screen_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698