| 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_atomic.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
| 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 10 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" | 10 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { | 39 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { |
| 40 bool found = | 40 bool found = |
| 41 std::find(plane_list->plane_list.begin(), plane_list->plane_list.end(), | 41 std::find(plane_list->plane_list.begin(), plane_list->plane_list.end(), |
| 42 plane) != plane_list->plane_list.end(); | 42 plane) != plane_list->plane_list.end(); |
| 43 if (!found) { | 43 if (!found) { |
| 44 // This plane is being released, so we need to zero it. | 44 // This plane is being released, so we need to zero it. |
| 45 plane->set_in_use(false); | 45 plane->set_in_use(false); |
| 46 HardwareDisplayPlaneAtomic* atomic_plane = | 46 HardwareDisplayPlaneAtomic* atomic_plane = |
| 47 static_cast<HardwareDisplayPlaneAtomic*>(plane); | 47 static_cast<HardwareDisplayPlaneAtomic*>(plane); |
| 48 atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), 0, 0, | 48 atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), 0, 0, |
| 49 gfx::Rect(), gfx::Rect()); | 49 gfx::Rect(), gfx::Rect(), |
| 50 gfx::OVERLAY_TRANSFORM_NONE); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 std::vector<base::WeakPtr<CrtcController>> crtcs; | 54 std::vector<base::WeakPtr<CrtcController>> crtcs; |
| 54 for (HardwareDisplayPlane* plane : plane_list->plane_list) { | 55 for (HardwareDisplayPlane* plane : plane_list->plane_list) { |
| 55 HardwareDisplayPlaneAtomic* atomic_plane = | 56 HardwareDisplayPlaneAtomic* atomic_plane = |
| 56 static_cast<HardwareDisplayPlaneAtomic*>(plane); | 57 static_cast<HardwareDisplayPlaneAtomic*>(plane); |
| 57 if (crtcs.empty() || crtcs.back().get() != atomic_plane->crtc()) | 58 if (crtcs.empty() || crtcs.back().get() != atomic_plane->crtc()) |
| 58 crtcs.push_back(atomic_plane->crtc()->AsWeakPtr()); | 59 crtcs.push_back(atomic_plane->crtc()->AsWeakPtr()); |
| 59 } | 60 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 HardwareDisplayPlane* hw_plane, | 92 HardwareDisplayPlane* hw_plane, |
| 92 const OverlayPlane& overlay, | 93 const OverlayPlane& overlay, |
| 93 uint32_t crtc_id, | 94 uint32_t crtc_id, |
| 94 const gfx::Rect& src_rect, | 95 const gfx::Rect& src_rect, |
| 95 CrtcController* crtc) { | 96 CrtcController* crtc) { |
| 96 HardwareDisplayPlaneAtomic* atomic_plane = | 97 HardwareDisplayPlaneAtomic* atomic_plane = |
| 97 static_cast<HardwareDisplayPlaneAtomic*>(hw_plane); | 98 static_cast<HardwareDisplayPlaneAtomic*>(hw_plane); |
| 98 uint32_t framebuffer_id = overlay.z_order | 99 uint32_t framebuffer_id = overlay.z_order |
| 99 ? overlay.buffer->GetFramebufferId() | 100 ? overlay.buffer->GetFramebufferId() |
| 100 : overlay.buffer->GetOpaqueFramebufferId(); | 101 : overlay.buffer->GetOpaqueFramebufferId(); |
| 101 if (!atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), | 102 if (!atomic_plane->SetPlaneData( |
| 102 crtc_id, framebuffer_id, | 103 plane_list->atomic_property_set.get(), crtc_id, framebuffer_id, |
| 103 overlay.display_bounds, src_rect)) { | 104 overlay.display_bounds, src_rect, overlay.plane_transform)) { |
| 104 LOG(ERROR) << "Failed to set plane properties"; | 105 LOG(ERROR) << "Failed to set plane properties"; |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 atomic_plane->set_crtc(crtc); | 108 atomic_plane->set_crtc(crtc); |
| 108 return true; | 109 return true; |
| 109 } | 110 } |
| 110 | 111 |
| 111 std::unique_ptr<HardwareDisplayPlane> | 112 std::unique_ptr<HardwareDisplayPlane> |
| 112 HardwareDisplayPlaneManagerAtomic::CreatePlane(uint32_t plane_id, | 113 HardwareDisplayPlaneManagerAtomic::CreatePlane(uint32_t plane_id, |
| 113 uint32_t possible_crtcs) { | 114 uint32_t possible_crtcs) { |
| 114 return std::unique_ptr<HardwareDisplayPlane>( | 115 return std::unique_ptr<HardwareDisplayPlane>( |
| 115 new HardwareDisplayPlaneAtomic(plane_id, possible_crtcs)); | 116 new HardwareDisplayPlaneAtomic(plane_id, possible_crtcs)); |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace ui | 119 } // namespace ui |
| OLD | NEW |