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