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

Unified Diff: ui/ozone/platform/drm/gpu/drm_window.cc

Issue 1157793004: ozone: Add overlay candidate implementation that queries support via IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing license header Created 5 years, 6 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
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window.h ('k') | ui/ozone/platform/drm/host/drm_overlay_candidates_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_window.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc
index b2f7a460bb2ecbefab95a557bdd3600a68f6234b..81756f794c34be12c0fcc27082859d8afab79cb2 100644
--- a/ui/ozone/platform/drm/gpu/drm_window.cc
+++ b/ui/ozone/platform/drm/gpu/drm_window.cc
@@ -8,9 +8,11 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkSurface.h"
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/platform/drm/gpu/drm_buffer.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
+#include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
#include "ui/ozone/platform/drm/gpu/screen_manager.h"
namespace ui {
@@ -25,6 +27,9 @@ namespace {
#define DRM_CAP_CURSOR_HEIGHT 0x9
#endif
+void EmptyFlipCallback(gfx::SwapResult) {
+}
+
void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) {
SkRect damage;
image.getBounds(&damage);
@@ -139,6 +144,36 @@ bool DrmWindow::SchedulePageFlip(bool is_sync,
return true;
}
+bool DrmWindow::TestPageFlip(const std::vector<OverlayCheck_Params>& overlays,
+ ScanoutBufferGenerator* buffer_generator) {
+ if (!controller_)
+ return true;
+ for (const auto& overlay : overlays) {
+ // It is possible that the cc rect we get actually falls off the edge of
+ // the screen. Usually this is prevented via things like status bars
+ // blocking overlaying or cc clipping it, but in case it wasn't properly
+ // clipped (since GL will render this situation fine) just ignore it here.
+ // This should be an extremely rare occurrance.
+ if (overlay.plane_z_order != 0 && !bounds().Contains(overlay.display_rect))
+ return false;
+ }
+
+ scoped_refptr<DrmDevice> drm = controller_->GetAllocationDrmDevice();
+ OverlayPlaneList planes;
+ for (const auto& overlay : overlays) {
+ gfx::Size size =
+ (overlay.plane_z_order == 0) ? bounds().size() : overlay.buffer_size;
+ scoped_refptr<ScanoutBuffer> buffer = buffer_generator->Create(drm, size);
+ if (!buffer)
+ return false;
+ planes.push_back(OverlayPlane(buffer, overlay.plane_z_order,
+ overlay.transform, overlay.display_rect,
+ gfx::RectF(gfx::Size(1, 1))));
+ }
+ return controller_->SchedulePageFlip(planes, true, true,
+ base::Bind(&EmptyFlipCallback));
+}
+
const OverlayPlane* DrmWindow::GetLastModesetBuffer() {
return OverlayPlane::GetPrimaryPlane(last_submitted_planes_);
}
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window.h ('k') | ui/ozone/platform/drm/host/drm_overlay_candidates_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698