| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h" |
| 6 |
| 7 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 8 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" |
| 9 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 HardwareDisplayPlaneManagerAtomic::HardwareDisplayPlaneManagerAtomic() { |
| 14 } |
| 15 |
| 16 HardwareDisplayPlaneManagerAtomic::~HardwareDisplayPlaneManagerAtomic() { |
| 17 } |
| 18 |
| 19 bool HardwareDisplayPlaneManagerAtomic::Commit( |
| 20 HardwareDisplayPlaneList* plane_list, |
| 21 bool is_sync) { |
| 22 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { |
| 23 bool found = std::find(plane_list->plane_list.begin(), |
| 24 plane_list->plane_list.begin(), |
| 25 plane) != plane_list->plane_list.end(); |
| 26 if (!found) { |
| 27 // This plane is being released, so we need to zero it. |
| 28 plane->set_in_use(false); |
| 29 HardwareDisplayPlaneAtomic* atomic_plane = |
| 30 static_cast<HardwareDisplayPlaneAtomic*>(plane); |
| 31 atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), 0, 0, |
| 32 gfx::Rect(), gfx::Rect()); |
| 33 } |
| 34 } |
| 35 |
| 36 plane_list->plane_list.swap(plane_list->old_plane_list); |
| 37 plane_list->plane_list.clear(); |
| 38 if (!drm_->CommitProperties(plane_list->atomic_property_set.get(), 0, |
| 39 nullptr)) { |
| 40 PLOG(ERROR) << "Failed to commit properties"; |
| 41 return false; |
| 42 } |
| 43 return true; |
| 44 } |
| 45 |
| 46 bool HardwareDisplayPlaneManagerAtomic::AssignOverlayPlanes( |
| 47 HardwareDisplayPlaneList* plane_list, |
| 48 const OverlayPlaneList& overlay_list, |
| 49 uint32_t crtc_id, |
| 50 CrtcController* crtc) { |
| 51 if (!plane_list->atomic_property_set) |
| 52 plane_list->atomic_property_set.reset(drmModePropertySetAlloc()); |
| 53 return HardwareDisplayPlaneManager::AssignOverlayPlanes( |
| 54 plane_list, overlay_list, crtc_id, crtc); |
| 55 } |
| 56 |
| 57 bool HardwareDisplayPlaneManagerAtomic::SetPlaneData( |
| 58 HardwareDisplayPlaneList* plane_list, |
| 59 HardwareDisplayPlane* hw_plane, |
| 60 const OverlayPlane& overlay, |
| 61 uint32_t crtc_id, |
| 62 const gfx::Rect& src_rect, |
| 63 CrtcController* crtc) { |
| 64 HardwareDisplayPlaneAtomic* atomic_plane = |
| 65 static_cast<HardwareDisplayPlaneAtomic*>(hw_plane); |
| 66 if (!atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), |
| 67 crtc_id, overlay.buffer->GetFramebufferId(), |
| 68 overlay.display_bounds, src_rect)) { |
| 69 LOG(ERROR) << "Failed to set plane properties"; |
| 70 return false; |
| 71 } |
| 72 plane_list->plane_list.push_back(hw_plane); |
| 73 return true; |
| 74 } |
| 75 |
| 76 scoped_ptr<HardwareDisplayPlane> HardwareDisplayPlaneManagerAtomic::CreatePlane( |
| 77 uint32_t plane_id, |
| 78 uint32_t possible_crtcs) { |
| 79 return scoped_ptr<HardwareDisplayPlane>( |
| 80 new HardwareDisplayPlaneAtomic(plane_id, possible_crtcs)); |
| 81 } |
| 82 |
| 83 } // namespace ui |
| OLD | NEW |