| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/drm/gpu/drm_util.h" | 5 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/mman.h> | 9 #include <sys/mman.h> |
| 10 #include <xf86drmMode.h> | 10 #include <xf86drmMode.h> |
| 11 | 11 |
| 12 #include "ui/ozone/platform/drm/gpu/drm_device.h" | |
| 13 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | |
| 14 | |
| 15 namespace ui { | 12 namespace ui { |
| 16 | 13 |
| 17 namespace { | 14 namespace { |
| 18 | 15 |
| 19 bool IsCrtcInUse(uint32_t crtc, | 16 bool IsCrtcInUse(uint32_t crtc, |
| 20 const ScopedVector<HardwareDisplayControllerInfo>& displays) { | 17 const ScopedVector<HardwareDisplayControllerInfo>& displays) { |
| 21 for (size_t i = 0; i < displays.size(); ++i) { | 18 for (size_t i = 0; i < displays.size(); ++i) { |
| 22 if (crtc == displays[i]->crtc()->crtc_id) | 19 if (crtc == displays[i]->crtc()->crtc_id) |
| 23 return true; | 20 return true; |
| 24 } | 21 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool SameMode(const drmModeModeInfo& lhs, const drmModeModeInfo& rhs) { | 93 bool SameMode(const drmModeModeInfo& lhs, const drmModeModeInfo& rhs) { |
| 97 return lhs.clock == rhs.clock && lhs.hdisplay == rhs.hdisplay && | 94 return lhs.clock == rhs.clock && lhs.hdisplay == rhs.hdisplay && |
| 98 lhs.vdisplay == rhs.vdisplay && lhs.vrefresh == rhs.vrefresh && | 95 lhs.vdisplay == rhs.vdisplay && lhs.vrefresh == rhs.vrefresh && |
| 99 lhs.hsync_start == rhs.hsync_start && lhs.hsync_end == rhs.hsync_end && | 96 lhs.hsync_start == rhs.hsync_start && lhs.hsync_end == rhs.hsync_end && |
| 100 lhs.htotal == rhs.htotal && lhs.hskew == rhs.hskew && | 97 lhs.htotal == rhs.htotal && lhs.hskew == rhs.hskew && |
| 101 lhs.vsync_start == rhs.vsync_start && lhs.vsync_end == rhs.vsync_end && | 98 lhs.vsync_start == rhs.vsync_start && lhs.vsync_end == rhs.vsync_end && |
| 102 lhs.vtotal == rhs.vtotal && lhs.vscan == rhs.vscan && | 99 lhs.vtotal == rhs.vtotal && lhs.vscan == rhs.vscan && |
| 103 lhs.flags == rhs.flags && strcmp(lhs.name, rhs.name) == 0; | 100 lhs.flags == rhs.flags && strcmp(lhs.name, rhs.name) == 0; |
| 104 } | 101 } |
| 105 | 102 |
| 106 void ForceInitializationOfPrimaryDisplay(const scoped_refptr<DrmDevice>& drm, | |
| 107 ScreenManager* screen_manager) { | |
| 108 VLOG(2) << "Forcing initialization of primary display."; | |
| 109 ScopedVector<HardwareDisplayControllerInfo> displays = | |
| 110 GetAvailableDisplayControllerInfos(drm->get_fd()); | |
| 111 | |
| 112 if (displays.empty()) | |
| 113 return; | |
| 114 | |
| 115 screen_manager->AddDisplayController(drm, displays[0]->crtc()->crtc_id, | |
| 116 displays[0]->connector()->connector_id); | |
| 117 screen_manager->ConfigureDisplayController( | |
| 118 drm, displays[0]->crtc()->crtc_id, displays[0]->connector()->connector_id, | |
| 119 gfx::Point(), displays[0]->connector()->modes[0]); | |
| 120 } | |
| 121 | |
| 122 } // namespace ui | 103 } // namespace ui |
| OLD | NEW |