| 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/dri/hardware_display_plane_manager.h" | 5 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h" |
| 6 | 6 |
| 7 #include <drm.h> | 7 #include <drm.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <xf86drm.h> | 9 #include <xf86drm.h> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/ozone/platform/dri/crtc_controller.h" | 13 #include "ui/ozone/platform/dri/crtc_controller.h" |
| 14 #include "ui/ozone/platform/dri/dri_wrapper.h" | 14 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 15 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 15 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
| 16 #include "ui/ozone/platform/dri/scanout_buffer.h" | 16 #include "ui/ozone/platform/dri/scanout_buffer.h" |
| 17 #include "ui/ozone/public/ozone_switches.h" | 17 #include "ui/ozone/public/ozone_switches.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const float kFixedPointScaleValue = 65536.0f; | 22 const float kFixedPointScaleValue = 65536.0f; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 HardwareDisplayPlaneList::HardwareDisplayPlaneList() { | 26 HardwareDisplayPlaneList::HardwareDisplayPlaneList() : committed(false) { |
| 27 } | 27 } |
| 28 HardwareDisplayPlaneList::~HardwareDisplayPlaneList() { | 28 HardwareDisplayPlaneList::~HardwareDisplayPlaneList() { |
| 29 for (auto* plane : plane_list) { | 29 for (auto* plane : plane_list) { |
| 30 plane->set_in_use(false); | 30 plane->set_in_use(false); |
| 31 plane->set_owning_crtc(0); | 31 plane->set_owning_crtc(0); |
| 32 } | 32 } |
| 33 for (auto* plane : old_plane_list) { | 33 for (auto* plane : old_plane_list) { |
| 34 plane->set_in_use(false); | 34 plane->set_in_use(false); |
| 35 plane->set_owning_crtc(0); | 35 plane->set_owning_crtc(0); |
| 36 } | 36 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (crtcs_[i] == crtc_id) | 144 if (crtcs_[i] == crtc_id) |
| 145 return i; | 145 return i; |
| 146 return -1; | 146 return -1; |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool HardwareDisplayPlaneManager::AssignOverlayPlanes( | 149 bool HardwareDisplayPlaneManager::AssignOverlayPlanes( |
| 150 HardwareDisplayPlaneList* plane_list, | 150 HardwareDisplayPlaneList* plane_list, |
| 151 const OverlayPlaneList& overlay_list, | 151 const OverlayPlaneList& overlay_list, |
| 152 uint32_t crtc_id, | 152 uint32_t crtc_id, |
| 153 CrtcController* crtc) { | 153 CrtcController* crtc) { |
| 154 for (auto* plane : plane_list->old_plane_list) { | 154 // If we had previously committed this set, mark all owned planes as free. |
| 155 plane->set_in_use(false); | 155 if (plane_list->committed) { |
| 156 plane_list->committed = false; |
| 157 for (auto* plane : plane_list->old_plane_list) { |
| 158 plane->set_in_use(false); |
| 159 } |
| 156 } | 160 } |
| 157 plane_list->old_plane_list.clear(); | |
| 158 | 161 |
| 159 int crtc_index = LookupCrtcIndex(crtc_id); | 162 int crtc_index = LookupCrtcIndex(crtc_id); |
| 160 if (crtc_index < 0) { | 163 if (crtc_index < 0) { |
| 161 LOG(ERROR) << "Cannot find crtc " << crtc_id; | 164 LOG(ERROR) << "Cannot find crtc " << crtc_id; |
| 162 return false; | 165 return false; |
| 163 } | 166 } |
| 164 | 167 |
| 165 size_t plane_idx = 0; | 168 size_t plane_idx = 0; |
| 166 for (const auto& plane : overlay_list) { | 169 for (const auto& plane : overlay_list) { |
| 167 HardwareDisplayPlane* hw_plane = | 170 HardwareDisplayPlane* hw_plane = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (plane->owning_crtc() == crtc_id) { | 205 if (plane->owning_crtc() == crtc_id) { |
| 203 plane->set_owning_crtc(0); | 206 plane->set_owning_crtc(0); |
| 204 plane->set_in_use(false); | 207 plane->set_in_use(false); |
| 205 } else { | 208 } else { |
| 206 plane_list->old_plane_list.push_back(plane); | 209 plane_list->old_plane_list.push_back(plane); |
| 207 } | 210 } |
| 208 } | 211 } |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace ui | 214 } // namespace ui |
| OLD | NEW |