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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_util.cc

Issue 991963002: [Ozone-Drm] More LOG cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 "ui/ozone/platform/drm/gpu/drm_util.h" 5 #include "ui/ozone/platform/drm/gpu/drm_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (*pixels == MAP_FAILED) { 122 if (*pixels == MAP_FAILED) {
123 VPLOG(2) << "Cannot mmap dumb buffer"; 123 VPLOG(2) << "Cannot mmap dumb buffer";
124 return false; 124 return false;
125 } 125 }
126 126
127 return true; 127 return true;
128 } 128 }
129 129
130 void ForceInitializationOfPrimaryDisplay(const scoped_refptr<DrmDevice>& drm, 130 void ForceInitializationOfPrimaryDisplay(const scoped_refptr<DrmDevice>& drm,
131 ScreenManager* screen_manager) { 131 ScreenManager* screen_manager) {
132 LOG(WARNING) << "Forcing initialization of primary display."; 132 VLOG(2) << "Forcing initialization of primary display.";
133 ScopedVector<HardwareDisplayControllerInfo> displays = 133 ScopedVector<HardwareDisplayControllerInfo> displays =
134 GetAvailableDisplayControllerInfos(drm->get_fd()); 134 GetAvailableDisplayControllerInfos(drm->get_fd());
135 135
136 if (displays.empty()) 136 if (displays.empty())
137 return; 137 return;
138 138
139 ScopedDrmPropertyPtr dpms(drm->GetProperty(displays[0]->connector(), "DPMS")); 139 ScopedDrmPropertyPtr dpms(drm->GetProperty(displays[0]->connector(), "DPMS"));
140 140
141 screen_manager->AddDisplayController(drm, displays[0]->crtc()->crtc_id, 141 screen_manager->AddDisplayController(drm, displays[0]->crtc()->crtc_id,
142 displays[0]->connector()->connector_id); 142 displays[0]->connector()->connector_id);
143 if (screen_manager->ConfigureDisplayController( 143 if (screen_manager->ConfigureDisplayController(
144 drm, displays[0]->crtc()->crtc_id, 144 drm, displays[0]->crtc()->crtc_id,
145 displays[0]->connector()->connector_id, gfx::Point(), 145 displays[0]->connector()->connector_id, gfx::Point(),
146 displays[0]->connector()->modes[0])) { 146 displays[0]->connector()->modes[0])) {
147 if (dpms) 147 if (dpms)
148 drm->SetProperty(displays[0]->connector()->connector_id, dpms->prop_id, 148 drm->SetProperty(displays[0]->connector()->connector_id, dpms->prop_id,
149 DRM_MODE_DPMS_ON); 149 DRM_MODE_DPMS_ON);
150 } 150 }
151 } 151 }
152 152
153 base::FilePath GetPrimaryDisplayCardPath() { 153 base::FilePath GetPrimaryDisplayCardPath() {
154 struct drm_mode_card_res res; 154 struct drm_mode_card_res res;
155 for (int i = 0; /* end on first card# that does not exist */; i++) { 155 for (int i = 0; /* end on first card# that does not exist */; i++) {
156 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i); 156 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i);
157 157
158 if (access(card_path.c_str(), F_OK) != 0) 158 if (access(card_path.c_str(), F_OK) != 0)
159 break; 159 break;
160 160
161 int fd = open(card_path.c_str(), O_RDWR | O_CLOEXEC); 161 int fd = open(card_path.c_str(), O_RDWR | O_CLOEXEC);
162 if (fd < 0) 162 if (fd < 0) {
163 VPLOG(1) << "Failed to open '" << card_path << "'";
163 continue; 164 continue;
165 }
164 166
165 memset(&res, 0, sizeof(struct drm_mode_card_res)); 167 memset(&res, 0, sizeof(struct drm_mode_card_res));
166 int ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res); 168 int ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res);
167 close(fd); 169 close(fd);
168 if (ret == 0 && res.count_crtcs > 0) { 170 if (ret == 0 && res.count_crtcs > 0) {
169 return base::FilePath(card_path); 171 return base::FilePath(card_path);
170 } 172 }
173
174 VPLOG_IF(1, ret) << "Failed to get DRM resources for '" << card_path << "'";
171 } 175 }
172 176
173 return base::FilePath(); 177 return base::FilePath();
174 } 178 }
175 179
176 } // namespace ui 180 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698