| 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/drm/gpu/hardware_display_plane_manager_legacy.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
| 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 10 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 10 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // must first flip to the new primary plane, which does. The error here will | 39 // must first flip to the new primary plane, which does. The error here will |
| 40 // be the delta of (new contents, old contents), but it should be barely | 40 // be the delta of (new contents, old contents), but it should be barely |
| 41 // noticeable. | 41 // noticeable. |
| 42 for (const auto& flip : plane_list->legacy_page_flips) { | 42 for (const auto& flip : plane_list->legacy_page_flips) { |
| 43 for (const auto& plane : flip.planes) { | 43 for (const auto& plane : flip.planes) { |
| 44 if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, plane.bounds, | 44 if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, plane.bounds, |
| 45 plane.src_rect, plane.plane)) { | 45 plane.src_rect, plane.plane)) { |
| 46 PLOG(ERROR) << "Cannot display plane on overlay: crtc=" << flip.crtc | 46 PLOG(ERROR) << "Cannot display plane on overlay: crtc=" << flip.crtc |
| 47 << " plane=" << plane.plane; | 47 << " plane=" << plane.plane; |
| 48 ret = false; | 48 ret = false; |
| 49 flip.crtc->PageFlipFailed(); | 49 flip.crtc->SignalPageFlipRequest(gfx::SwapResult::SWAP_FAILED); |
| 50 break; | 50 break; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, | 53 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, |
| 54 base::Bind(&CrtcController::OnPageFlipEvent, | 54 base::Bind(&CrtcController::OnPageFlipEvent, |
| 55 flip.crtc->AsWeakPtr()))) { | 55 flip.crtc->AsWeakPtr()))) { |
| 56 // 1) Permission Denied is a legitimate error. | 56 // 1) Permission Denied is a legitimate error. |
| 57 // 2) Device or resource busy is possible if we're page flipping a | 57 // 2) Device or resource busy is possible if we're page flipping a |
| 58 // disconnected CRTC. Pretend we're fine since a hotplug event is supposed | 58 // disconnected CRTC. Pretend we're fine since a hotplug event is supposed |
| 59 // to be on its way. | 59 // to be on its way. |
| 60 // NOTE: We could be getting EBUSY if we're trying to page flip a CRTC | 60 // NOTE: We could be getting EBUSY if we're trying to page flip a CRTC |
| 61 // that has a pending page flip, however the contract is that the caller | 61 // that has a pending page flip, however the contract is that the caller |
| 62 // will never attempt this (since the caller should be waiting for the | 62 // will never attempt this (since the caller should be waiting for the |
| 63 // page flip completion message). | 63 // page flip completion message). |
| 64 if (errno != EACCES && errno != EBUSY) { | 64 if (errno != EACCES && errno != EBUSY) { |
| 65 PLOG(ERROR) << "Cannot page flip: crtc=" << flip.crtc_id | 65 PLOG(ERROR) << "Cannot page flip: crtc=" << flip.crtc_id |
| 66 << " framebuffer=" << flip.framebuffer; | 66 << " framebuffer=" << flip.framebuffer; |
| 67 ret = false; | 67 ret = false; |
| 68 } | 68 } |
| 69 flip.crtc->PageFlipFailed(); | 69 flip.crtc->SignalPageFlipRequest(ret ? gfx::SwapResult::SWAP_ACK |
| 70 : gfx::SwapResult::SWAP_FAILED); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 // For each element in |old_plane_list|, if it hasn't been reclaimed (by | 73 // For each element in |old_plane_list|, if it hasn't been reclaimed (by |
| 73 // this or any other HDPL), clear the overlay contents. | 74 // this or any other HDPL), clear the overlay contents. |
| 74 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { | 75 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { |
| 75 if (!plane->in_use() && (plane->type() != HardwareDisplayPlane::kDummy)) { | 76 if (!plane->in_use() && (plane->type() != HardwareDisplayPlane::kDummy)) { |
| 76 // This plane is being released, so we need to zero it. | 77 // This plane is being released, so we need to zero it. |
| 77 if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(), | 78 if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(), |
| 78 gfx::Rect(), plane->plane_id())) { | 79 gfx::Rect(), plane->plane_id())) { |
| 79 PLOG(ERROR) << "Cannot free overlay: crtc=" << plane->owning_crtc() | 80 PLOG(ERROR) << "Cannot free overlay: crtc=" << plane->owning_crtc() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } else { | 112 } else { |
| 112 plane_list->legacy_page_flips.back().planes.push_back( | 113 plane_list->legacy_page_flips.back().planes.push_back( |
| 113 HardwareDisplayPlaneList::PageFlipInfo::Plane( | 114 HardwareDisplayPlaneList::PageFlipInfo::Plane( |
| 114 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), | 115 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), |
| 115 overlay.display_bounds, src_rect)); | 116 overlay.display_bounds, src_rect)); |
| 116 } | 117 } |
| 117 return true; | 118 return true; |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace ui | 121 } // namespace ui |
| OLD | NEW |