| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 drmModeConnector* connector, | 65 drmModeConnector* connector, |
| 66 drmModeRes* resources, | 66 drmModeRes* resources, |
| 67 const ScopedVector<HardwareDisplayControllerInfo>& displays) { | 67 const ScopedVector<HardwareDisplayControllerInfo>& displays) { |
| 68 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(fd)); | 68 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(fd)); |
| 69 std::vector<ScopedDrmPlanePtr> planes; | 69 std::vector<ScopedDrmPlanePtr> planes; |
| 70 for (uint32_t i = 0; i < plane_resources->count_planes; i++) | 70 for (uint32_t i = 0; i < plane_resources->count_planes; i++) |
| 71 planes.emplace_back(drmModeGetPlane(fd, plane_resources->planes[i])); | 71 planes.emplace_back(drmModeGetPlane(fd, plane_resources->planes[i])); |
| 72 | 72 |
| 73 DCHECK_GE(32, resources->count_crtcs); | 73 DCHECK_GE(32, resources->count_crtcs); |
| 74 uint32_t best_crtc = 0; | 74 uint32_t best_crtc = 0; |
| 75 int best_crtc_planes = 0; | 75 int best_crtc_planes = -1; |
| 76 | 76 |
| 77 // Try to find an encoder for the connector. | 77 // Try to find an encoder for the connector. |
| 78 for (int i = 0; i < connector->count_encoders; ++i) { | 78 for (int i = 0; i < connector->count_encoders; ++i) { |
| 79 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, connector->encoders[i])); | 79 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, connector->encoders[i])); |
| 80 if (!encoder) | 80 if (!encoder) |
| 81 continue; | 81 continue; |
| 82 | 82 |
| 83 for (int j = 0; j < resources->count_crtcs; ++j) { | 83 for (int j = 0; j < resources->count_crtcs; ++j) { |
| 84 // Check if the encoder is compatible with this CRTC | 84 // Check if the encoder is compatible with this CRTC |
| 85 int crtc_bit = 1 << j; | 85 int crtc_bit = 1 << j; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 case gfx::BufferFormat::BGR_565: | 449 case gfx::BufferFormat::BGR_565: |
| 450 return DRM_FORMAT_RGB565; | 450 return DRM_FORMAT_RGB565; |
| 451 case gfx::BufferFormat::UYVY_422: | 451 case gfx::BufferFormat::UYVY_422: |
| 452 return DRM_FORMAT_UYVY; | 452 return DRM_FORMAT_UYVY; |
| 453 default: | 453 default: |
| 454 NOTREACHED(); | 454 NOTREACHED(); |
| 455 return 0; | 455 return 0; |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } // namespace ui | 458 } // namespace ui |
| OLD | NEW |