Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc

Issue 821023003: [Ozone-DRI] Listen for swap events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async-swap
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_legacy.h" 5 #include "ui/ozone/platform/dri/hardware_display_plane_manager_legacy.h"
6 6
7 #include "base/bind.h"
7 #include "ui/ozone/platform/dri/crtc_controller.h" 8 #include "ui/ozone/platform/dri/crtc_controller.h"
8 #include "ui/ozone/platform/dri/dri_wrapper.h" 9 #include "ui/ozone/platform/dri/dri_wrapper.h"
9 #include "ui/ozone/platform/dri/scanout_buffer.h" 10 #include "ui/ozone/platform/dri/scanout_buffer.h"
10 11
11 namespace ui { 12 namespace ui {
12 13
13 HardwareDisplayPlaneManagerLegacy::HardwareDisplayPlaneManagerLegacy() { 14 HardwareDisplayPlaneManagerLegacy::HardwareDisplayPlaneManagerLegacy() {
14 } 15 }
15 16
16 HardwareDisplayPlaneManagerLegacy::~HardwareDisplayPlaneManagerLegacy() { 17 HardwareDisplayPlaneManagerLegacy::~HardwareDisplayPlaneManagerLegacy() {
17 } 18 }
18 19
19 bool HardwareDisplayPlaneManagerLegacy::Commit( 20 bool HardwareDisplayPlaneManagerLegacy::Commit(
20 HardwareDisplayPlaneList* plane_list) { 21 HardwareDisplayPlaneList* plane_list) {
21 bool ret = true; 22 bool ret = true;
22 plane_list->plane_list.swap(plane_list->old_plane_list); 23 plane_list->plane_list.swap(plane_list->old_plane_list);
23 plane_list->plane_list.clear(); 24 plane_list->plane_list.clear();
24 for (const auto& flip : plane_list->legacy_page_flips) { 25 for (const auto& flip : plane_list->legacy_page_flips) {
25 // Permission Denied is a legitimate error 26 // Permission Denied is a legitimate error
26 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, flip.crtc)) { 27 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer,
28 base::Bind(&CrtcController::OnPageFlipEvent,
29 flip.crtc->AsWeakPtr()))) {
27 if (errno != EACCES) { 30 if (errno != EACCES) {
28 LOG(ERROR) << "Cannot page flip: error='" << strerror(errno) << "'" 31 LOG(ERROR) << "Cannot page flip: error='" << strerror(errno) << "'"
29 << " crtc=" << flip.crtc_id 32 << " crtc=" << flip.crtc_id
30 << " framebuffer=" << flip.framebuffer; 33 << " framebuffer=" << flip.framebuffer;
31 LOG(ERROR) << "Failed to commit planes"; 34 LOG(ERROR) << "Failed to commit planes";
32 ret = false; 35 ret = false;
33 } 36 }
34 flip.crtc->PageFlipFailed(); 37 flip.crtc->PageFlipFailed();
35 } else { 38 } else {
36 for (const auto& plane : flip.planes) { 39 for (const auto& plane : flip.planes) {
(...skipping 29 matching lines...) Expand all
66 } else { 69 } else {
67 plane_list->legacy_page_flips.back().planes.push_back( 70 plane_list->legacy_page_flips.back().planes.push_back(
68 HardwareDisplayPlaneList::PageFlipInfo::Plane( 71 HardwareDisplayPlaneList::PageFlipInfo::Plane(
69 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), 72 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(),
70 overlay.display_bounds, src_rect)); 73 overlay.display_bounds, src_rect));
71 } 74 }
72 return true; 75 return true;
73 } 76 }
74 77
75 } // namespace ui 78 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698