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

Unified Diff: ui/ozone/platform/dri/hardware_display_controller.cc

Issue 371813004: ozone: gbm: Add overlay support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test build Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/dri/hardware_display_controller.cc
diff --git a/ui/ozone/platform/dri/hardware_display_controller.cc b/ui/ozone/platform/dri/hardware_display_controller.cc
index 9e79118cc478f54ef612467b7bc1cd94088433b5..f863e3ff2ad274e69cd3633a1a193004061b2c57 100644
--- a/ui/ozone/platform/dri/hardware_display_controller.cc
+++ b/ui/ozone/platform/dri/hardware_display_controller.cc
@@ -19,6 +19,7 @@
#include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_wrapper.h"
#include "ui/ozone/platform/dri/scanout_surface.h"
+#include "ui/ozone/public/native_pixmap.h"
namespace ui {
@@ -46,6 +47,19 @@ void HandlePageFlipEvent(int fd,
} // namespace
+OzoneOverlayPlane::OzoneOverlayPlane(ScanoutSurface* scanout,
+ int z_order,
+ gfx::OverlayTransform plane_transform,
+ const gfx::Rect& display_bounds,
+ const gfx::RectF& crop_rect)
+ : scanout(scanout),
+ z_order(z_order),
+ plane_transform(plane_transform),
+ display_bounds(display_bounds),
+ crop_rect(crop_rect),
+ overlay_plane(0) {
+}
+
HardwareDisplayController::HardwareDisplayController(
DriWrapper* drm,
uint32_t connector_id,
@@ -112,15 +126,54 @@ void HardwareDisplayController::Disable() {
is_disabled_ = true;
}
-bool HardwareDisplayController::SchedulePageFlip() {
- CHECK(surface_);
- if (!is_disabled_ && !drm_->PageFlip(crtc_id_,
- surface_->GetFramebufferId(),
- this)) {
+ScanoutSurface* HardwareDisplayController::GetPrimaryPlane(
+ const std::vector<OzoneOverlayPlane>& overlays) {
+ ScanoutSurface* primary = surface_.get();
+ for (size_t i = 0; i < overlays.size(); i++) {
+ const OzoneOverlayPlane& plane = overlays[i];
+ if (plane.z_order == 0) {
+ return plane.scanout;
+ }
+ }
+
+ return primary;
+}
+
+bool HardwareDisplayController::SchedulePageFlip(
+ const std::vector<OzoneOverlayPlane>& overlays,
+ NativePixmapList* references) {
+ ScanoutSurface* primary = GetPrimaryPlane(overlays);
+ CHECK(primary);
+
+ primary->PreSwapBuffers();
+
+ if (!is_disabled_ &&
+ !drm_->PageFlip(crtc_id_, primary->GetFramebufferId(), this)) {
LOG(ERROR) << "Cannot page flip: " << strerror(errno);
return false;
}
+ current_overlay_references_.clear();
+ if (references)
+ current_overlay_references_.swap(*references);
+
+ for (size_t i = 0; i < overlays.size(); i++) {
+ const OzoneOverlayPlane& plane = overlays[i];
+ if (!plane.overlay_plane)
+ continue;
+ const gfx::Size& size = plane.scanout->Size();
+ gfx::RectF crop_rect = plane.crop_rect;
+ crop_rect.Scale(size.width(), size.height());
+ if (!drm_->PageFlipOverlay(crtc_id_,
+ plane.scanout->GetFramebufferId(),
+ plane.display_bounds,
+ crop_rect,
+ plane.overlay_plane)) {
+ LOG(ERROR) << "Cannot display on overlay: " << strerror(errno);
+ return false;
+ }
+ }
+
return true;
}
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_controller.h ('k') | ui/ozone/platform/dri/hardware_display_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698