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

Unified Diff: ui/ozone/platform/drm/host/drm_overlay_manager.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: fix leak, other comments Created 5 years, 7 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/drm/host/drm_overlay_manager.cc
diff --git a/ui/ozone/platform/drm/host/drm_overlay_manager.cc b/ui/ozone/platform/drm/host/drm_overlay_manager.cc
index 747c43845d31ab0083102f67de5e0bc0f2f53cbe..63c132746f9c8b88ed23a838c6fc5690b68bd803 100644
--- a/ui/ozone/platform/drm/host/drm_overlay_manager.cc
+++ b/ui/ozone/platform/drm/host/drm_overlay_manager.cc
@@ -6,70 +6,30 @@
#include "base/command_line.h"
#include "ui/gfx/geometry/rect_conversions.h"
+#include "ui/ozone/platform/drm/host/drm_host_overlay_candidates.h"
#include "ui/ozone/public/overlay_candidates_ozone.h"
#include "ui/ozone/public/ozone_switches.h"
namespace ui {
-namespace {
-class SingleOverlay : public OverlayCandidatesOzone {
- public:
- SingleOverlay() {}
- ~SingleOverlay() override {}
-
- void CheckOverlaySupport(OverlaySurfaceCandidateList* candidates) override {
- if (candidates->size() == 2) {
- OverlayCandidatesOzone::OverlaySurfaceCandidate* first =
- &(*candidates)[0];
- OverlayCandidatesOzone::OverlaySurfaceCandidate* second =
- &(*candidates)[1];
- OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay;
- if (first->plane_z_order == 0) {
- overlay = second;
- } else if (second->plane_z_order == 0) {
- overlay = first;
- } else {
- NOTREACHED();
- return;
- }
- // 0.01 constant chosen to match DCHECKs in gfx::ToNearestRect and avoid
- // that code asserting on quads that we accept.
- if (overlay->plane_z_order > 0 &&
- IsTransformSupported(overlay->transform) &&
- gfx::IsNearestRectWithinDistance(overlay->display_rect, 0.01f)) {
- overlay->overlay_handled = true;
- }
- }
- }
-
- private:
- bool IsTransformSupported(gfx::OverlayTransform transform) {
- switch (transform) {
- case gfx::OVERLAY_TRANSFORM_NONE:
- return true;
- default:
- return false;
- }
- }
-
- DISALLOW_COPY_AND_ASSIGN(SingleOverlay);
-};
-
-} // namespace
-
-DrmOverlayManager::DrmOverlayManager(bool allow_surfaceless)
- : allow_surfaceless_(allow_surfaceless) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kOzoneTestSingleOverlaySupport))
- candidates_ = make_scoped_ptr(new SingleOverlay());
+DrmOverlayManager::DrmOverlayManager(
+ bool allow_surfaceless,
+ DrmGpuPlatformSupportHost* platform_support_host)
+ : platform_support_host_(platform_support_host),
+ allow_surfaceless_(allow_surfaceless) {
+ is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kOzoneTestSingleOverlaySupport);
}
DrmOverlayManager::~DrmOverlayManager() {
}
-OverlayCandidatesOzone* DrmOverlayManager::GetOverlayCandidates(
+scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::GetOverlayCandidates(
dnicoara 2015/05/29 19:28:23 This should be renamed to CreateOverlayCandidates(
achaulk 2015/06/01 20:43:08 Acknowledged.
gfx::AcceleratedWidget w) {
- return candidates_.get();
+ if (!is_supported_)
+ return nullptr;
+ return scoped_ptr<OverlayCandidatesOzone>(
+ new DrmHostOverlayCandidates(w, platform_support_host_));
}
bool DrmOverlayManager::CanShowPrimaryPlaneAsOverlay() {

Powered by Google App Engine
This is Rietveld 408576698