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

Side by Side Diff: ui/ozone/platform/dri/dri_util.cc

Issue 953363003: Figure out the default graphics card on the Browser process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assume-minigbm
Patch Set: Rename Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_util.h ('k') | ui/ozone/platform/dri/native_display_delegate_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "ui/ozone/platform/dri/dri_util.h" 6 #include "ui/ozone/platform/dri/dri_util.h"
7 7
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (screen_manager->ConfigureDisplayController( 158 if (screen_manager->ConfigureDisplayController(
159 drm, displays[0]->crtc()->crtc_id, 159 drm, displays[0]->crtc()->crtc_id,
160 displays[0]->connector()->connector_id, gfx::Point(), 160 displays[0]->connector()->connector_id, gfx::Point(),
161 displays[0]->connector()->modes[0])) { 161 displays[0]->connector()->modes[0])) {
162 if (dpms) 162 if (dpms)
163 drm->SetProperty(displays[0]->connector()->connector_id, dpms->prop_id, 163 drm->SetProperty(displays[0]->connector()->connector_id, dpms->prop_id,
164 DRM_MODE_DPMS_ON); 164 DRM_MODE_DPMS_ON);
165 } 165 }
166 } 166 }
167 167
168 base::FilePath GetFirstDisplayCardPath() { 168 base::FilePath GetPrimaryDisplayCardPath() {
169 struct drm_mode_card_res res; 169 struct drm_mode_card_res res;
170 for (int i = 0; /* end on first card# that does not exist */; i++) { 170 for (int i = 0; /* end on first card# that does not exist */; i++) {
171 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i); 171 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i);
172 172
173 if (access(card_path.c_str(), F_OK) != 0) 173 if (access(card_path.c_str(), F_OK) != 0)
174 break; 174 break;
175 175
176 int fd = open(card_path.c_str(), O_RDWR | O_CLOEXEC); 176 int fd = open(card_path.c_str(), O_RDWR | O_CLOEXEC);
177 if (fd < 0) 177 if (fd < 0)
178 continue; 178 continue;
179 179
180 memset(&res, 0, sizeof(struct drm_mode_card_res)); 180 memset(&res, 0, sizeof(struct drm_mode_card_res));
181 int ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res); 181 int ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res);
182 close(fd); 182 close(fd);
183 if (ret == 0 && res.count_crtcs > 0) { 183 if (ret == 0 && res.count_crtcs > 0) {
184 return base::FilePath(card_path); 184 return base::FilePath(card_path);
185 } 185 }
186 } 186 }
187 187
188 return base::FilePath(); 188 return base::FilePath();
189 } 189 }
190 190
191 } // namespace ui 191 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_util.h ('k') | ui/ozone/platform/dri/native_display_delegate_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698