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