| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 drmModeConnector* connector, | 45 drmModeConnector* connector, |
| 46 drmModeRes* resources, | 46 drmModeRes* resources, |
| 47 const ScopedVector<HardwareDisplayControllerInfo>& displays) { | 47 const ScopedVector<HardwareDisplayControllerInfo>& displays) { |
| 48 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(fd)); | 48 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(fd)); |
| 49 std::vector<ScopedDrmPlanePtr> planes; | 49 std::vector<ScopedDrmPlanePtr> planes; |
| 50 for (uint32_t i = 0; i < plane_resources->count_planes; i++) | 50 for (uint32_t i = 0; i < plane_resources->count_planes; i++) |
| 51 planes.emplace_back(drmModeGetPlane(fd, plane_resources->planes[i])); | 51 planes.emplace_back(drmModeGetPlane(fd, plane_resources->planes[i])); |
| 52 | 52 |
| 53 DCHECK_GE(32, resources->count_crtcs); | 53 DCHECK_GE(32, resources->count_crtcs); |
| 54 uint32_t best_crtc = 0; | 54 uint32_t best_crtc = 0; |
| 55 int best_crtc_planes = 0; | 55 int best_crtc_planes = -1; |
| 56 | 56 |
| 57 // Try to find an encoder for the connector. | 57 // Try to find an encoder for the connector. |
| 58 for (int i = 0; i < connector->count_encoders; ++i) { | 58 for (int i = 0; i < connector->count_encoders; ++i) { |
| 59 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, connector->encoders[i])); | 59 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, connector->encoders[i])); |
| 60 if (!encoder) | 60 if (!encoder) |
| 61 continue; | 61 continue; |
| 62 | 62 |
| 63 for (int j = 0; j < resources->count_crtcs; ++j) { | 63 for (int j = 0; j < resources->count_crtcs; ++j) { |
| 64 // Check if the encoder is compatible with this CRTC | 64 // Check if the encoder is compatible with this CRTC |
| 65 int crtc_bit = 1 << j; | 65 int crtc_bit = 1 << j; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 case gfx::BufferFormat::BGR_565: | 431 case gfx::BufferFormat::BGR_565: |
| 432 return DRM_FORMAT_RGB565; | 432 return DRM_FORMAT_RGB565; |
| 433 case gfx::BufferFormat::UYVY_422: | 433 case gfx::BufferFormat::UYVY_422: |
| 434 return DRM_FORMAT_UYVY; | 434 return DRM_FORMAT_UYVY; |
| 435 default: | 435 default: |
| 436 NOTREACHED(); | 436 NOTREACHED(); |
| 437 return 0; | 437 return 0; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } // namespace ui | 440 } // namespace ui |
| OLD | NEW |