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/common/drm_util.h" | 5 #include "ui/ozone/platform/drm/common/drm_util.h" |
6 | 6 |
7 #include <drm_fourcc.h> | 7 #include <drm_fourcc.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return true; | 193 return true; |
194 } | 194 } |
195 } | 195 } |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 } // namespace | 199 } // namespace |
200 | 200 |
201 gfx::Size GetMaximumCursorSize(int fd) { | 201 gfx::Size GetMaximumCursorSize(int fd) { |
202 uint64_t width = 0, height = 0; | 202 uint64_t width = 0, height = 0; |
203 if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &width)) { | 203 // Querying cursor dimensions is optional and is unsupported on older Chrome |
204 VPLOG(1) << "Unable to get cursor width capability"; | 204 // OS kernels. |
| 205 if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &width) != 0 || |
| 206 drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &height) != 0) { |
205 return gfx::Size(kDefaultCursorWidth, kDefaultCursorHeight); | 207 return gfx::Size(kDefaultCursorWidth, kDefaultCursorHeight); |
206 } | 208 } |
207 if (drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &height)) { | |
208 VPLOG(1) << "Unable to get cursor height capability"; | |
209 return gfx::Size(kDefaultCursorWidth, kDefaultCursorHeight); | |
210 } | |
211 | |
212 return gfx::Size(width, height); | 209 return gfx::Size(width, height); |
213 } | 210 } |
214 | 211 |
215 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo( | 212 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo( |
216 ScopedDrmConnectorPtr connector, | 213 ScopedDrmConnectorPtr connector, |
217 ScopedDrmCrtcPtr crtc, | 214 ScopedDrmCrtcPtr crtc, |
218 size_t index) | 215 size_t index) |
219 : connector_(std::move(connector)), crtc_(std::move(crtc)), index_(index) {} | 216 : connector_(std::move(connector)), crtc_(std::move(crtc)), index_(index) {} |
220 | 217 |
221 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() { | 218 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 case gfx::BufferFormat::BGR_565: | 428 case gfx::BufferFormat::BGR_565: |
432 return DRM_FORMAT_RGB565; | 429 return DRM_FORMAT_RGB565; |
433 case gfx::BufferFormat::UYVY_422: | 430 case gfx::BufferFormat::UYVY_422: |
434 return DRM_FORMAT_UYVY; | 431 return DRM_FORMAT_UYVY; |
435 default: | 432 default: |
436 NOTREACHED(); | 433 NOTREACHED(); |
437 return 0; | 434 return 0; |
438 } | 435 } |
439 } | 436 } |
440 } // namespace ui | 437 } // namespace ui |
OLD | NEW |