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_legacy.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.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/scanout_buffer.h" | 10 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // This plane is being released, so we need to zero it. | 76 // This plane is being released, so we need to zero it. |
77 if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(), | 77 if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(), |
78 gfx::Rect(), plane->plane_id())) { | 78 gfx::Rect(), plane->plane_id())) { |
79 PLOG(ERROR) << "Cannot free overlay: crtc=" << plane->owning_crtc() | 79 PLOG(ERROR) << "Cannot free overlay: crtc=" << plane->owning_crtc() |
80 << " plane=" << plane->plane_id(); | 80 << " plane=" << plane->plane_id(); |
81 ret = false; | 81 ret = false; |
82 break; | 82 break; |
83 } | 83 } |
84 } | 84 } |
85 } | 85 } |
86 plane_list->plane_list.swap(plane_list->old_plane_list); | 86 |
87 plane_list->plane_list.clear(); | 87 if (ret) { |
88 plane_list->legacy_page_flips.clear(); | 88 plane_list->plane_list.swap(plane_list->old_plane_list); |
| 89 plane_list->plane_list.clear(); |
| 90 plane_list->legacy_page_flips.clear(); |
| 91 } else { |
| 92 ResetCurrentPlaneList(plane_list); |
| 93 } |
| 94 |
89 return ret; | 95 return ret; |
90 } | 96 } |
91 | 97 |
92 bool HardwareDisplayPlaneManagerLegacy::SetPlaneData( | 98 bool HardwareDisplayPlaneManagerLegacy::SetPlaneData( |
93 HardwareDisplayPlaneList* plane_list, | 99 HardwareDisplayPlaneList* plane_list, |
94 HardwareDisplayPlane* hw_plane, | 100 HardwareDisplayPlane* hw_plane, |
95 const OverlayPlane& overlay, | 101 const OverlayPlane& overlay, |
96 uint32_t crtc_id, | 102 uint32_t crtc_id, |
97 const gfx::Rect& src_rect, | 103 const gfx::Rect& src_rect, |
98 CrtcController* crtc) { | 104 CrtcController* crtc) { |
99 if ((hw_plane->type() == HardwareDisplayPlane::kDummy) || | 105 if ((hw_plane->type() == HardwareDisplayPlane::kDummy) || |
100 plane_list->legacy_page_flips.empty() || | 106 plane_list->legacy_page_flips.empty() || |
101 plane_list->legacy_page_flips.back().crtc_id != crtc_id) { | 107 plane_list->legacy_page_flips.back().crtc_id != crtc_id) { |
102 plane_list->legacy_page_flips.push_back( | 108 plane_list->legacy_page_flips.push_back( |
103 HardwareDisplayPlaneList::PageFlipInfo( | 109 HardwareDisplayPlaneList::PageFlipInfo( |
104 crtc_id, overlay.buffer->GetFramebufferId(), crtc)); | 110 crtc_id, overlay.buffer->GetFramebufferId(), crtc)); |
105 } else { | 111 } else { |
106 plane_list->legacy_page_flips.back().planes.push_back( | 112 plane_list->legacy_page_flips.back().planes.push_back( |
107 HardwareDisplayPlaneList::PageFlipInfo::Plane( | 113 HardwareDisplayPlaneList::PageFlipInfo::Plane( |
108 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), | 114 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), |
109 overlay.display_bounds, src_rect)); | 115 overlay.display_bounds, src_rect)); |
110 } | 116 } |
111 return true; | 117 return true; |
112 } | 118 } |
113 | 119 |
114 } // namespace ui | 120 } // namespace ui |
OLD | NEW |