| 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/gpu/hardware_display_plane_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
| 6 | 6 |
| 7 #include <drm.h> | 7 #include <drm.h> |
| 8 #include <xf86drm.h> | 8 #include <xf86drm.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) { | 68 bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) { |
| 69 drm_ = drm; | 69 drm_ = drm; |
| 70 ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd())); | 70 ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd())); |
| 71 if (!resources) { | 71 if (!resources) { |
| 72 PLOG(ERROR) << "Failed to get resources"; | 72 PLOG(ERROR) << "Failed to get resources"; |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(drm->get_fd())); | 76 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(drm->get_fd())); |
| 77 if (!plane_resources) { | 77 if (!plane_resources) { |
| 78 LOG(ERROR) << "Failed to get plane resources."; | 78 PLOG(ERROR) << "Failed to get plane resources"; |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 crtcs_.clear(); | 82 crtcs_.clear(); |
| 83 for (int i = 0; i < resources->count_crtcs; ++i) { | 83 for (int i = 0; i < resources->count_crtcs; ++i) { |
| 84 crtcs_.push_back(resources->crtcs[i]); | 84 crtcs_.push_back(resources->crtcs[i]); |
| 85 } | 85 } |
| 86 | 86 |
| 87 uint32_t num_planes = plane_resources->count_planes; | 87 uint32_t num_planes = plane_resources->count_planes; |
| 88 std::set<uint32_t> plane_ids; | 88 std::set<uint32_t> plane_ids; |
| 89 for (uint32_t i = 0; i < num_planes; ++i) { | 89 for (uint32_t i = 0; i < num_planes; ++i) { |
| 90 ScopedDrmPlanePtr drm_plane( | 90 ScopedDrmPlanePtr drm_plane( |
| 91 drmModeGetPlane(drm->get_fd(), plane_resources->planes[i])); | 91 drmModeGetPlane(drm->get_fd(), plane_resources->planes[i])); |
| 92 if (!drm_plane) { | 92 if (!drm_plane) { |
| 93 LOG(ERROR) << "Failed to get plane " << i << "."; | 93 PLOG(ERROR) << "Failed to get plane " << i; |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 plane_ids.insert(drm_plane->plane_id); | 96 plane_ids.insert(drm_plane->plane_id); |
| 97 scoped_ptr<HardwareDisplayPlane> plane( | 97 scoped_ptr<HardwareDisplayPlane> plane( |
| 98 new HardwareDisplayPlane(drm_plane.Pass())); | 98 new HardwareDisplayPlane(drm_plane.Pass())); |
| 99 if (plane->Initialize(drm)) | 99 if (plane->Initialize(drm)) |
| 100 planes_.push_back(plane.release()); | 100 planes_.push_back(plane.release()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // crbug.com/464085: if driver reports no primary planes for a crtc, create a | 103 // crbug.com/464085: if driver reports no primary planes for a crtc, create a |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (plane->owning_crtc() == crtc_id) { | 206 if (plane->owning_crtc() == crtc_id) { |
| 207 plane->set_owning_crtc(0); | 207 plane->set_owning_crtc(0); |
| 208 plane->set_in_use(false); | 208 plane->set_in_use(false); |
| 209 } else { | 209 } else { |
| 210 plane_list->old_plane_list.push_back(plane); | 210 plane_list->old_plane_list.push_back(plane); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace ui | 215 } // namespace ui |
| OLD | NEW |