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

Unified Diff: ui/ozone/platform/drm/host/drm_overlay_manager_core.cc

Issue 1631073002: Relocate ozone gbm overlay config cache to manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased correctly Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/host/drm_overlay_manager_core.h ('k') | ui/ozone/platform/drm/host/drm_window_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/host/drm_overlay_manager_core.cc
diff --git a/ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc b/ui/ozone/platform/drm/host/drm_overlay_manager_core.cc
similarity index 65%
rename from ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc
rename to ui/ozone/platform/drm/host/drm_overlay_manager_core.cc
index bc0f6c4c0bfe20d552f876356d2c6e724b883bfc..6e108d8053f197b3e322b4797b768844d8dfabdd 100644
--- a/ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc
+++ b/ui/ozone/platform/drm/host/drm_overlay_manager_core.cc
@@ -2,39 +2,55 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.h"
+#include "ui/ozone/platform/drm/host/drm_overlay_manager_core.h"
#include <stddef.h>
#include <algorithm>
+#include "base/command_line.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
+#include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h"
#include "ui/ozone/platform/drm/host/drm_window_host.h"
+#include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
+#include "ui/ozone/public/ozone_switches.h"
namespace ui {
+typedef OverlayCandidatesOzone::OverlaySurfaceCandidateList
+ OverlaySurfaceCandidateList;
+typedef OverlayCandidatesOzone::OverlaySurfaceCandidate OverlaySurfaceCandidate;
+
namespace {
const size_t kMaxCacheSize = 200;
} // namespace
-DrmOverlayCandidatesHostProxy::~DrmOverlayCandidatesHostProxy() {}
+DrmOverlayManagerProxy::~DrmOverlayManagerProxy() {}
-DrmOverlayCandidatesHostCore::DrmOverlayCandidatesHostCore(
- DrmOverlayCandidatesHostProxy* proxy,
- DrmWindowHost* window)
- : proxy_(proxy), window_(window), cache_(kMaxCacheSize) {
+DrmOverlayManagerCore::DrmOverlayManagerCore(
+ DrmOverlayManagerProxy* proxy,
+ DrmWindowHostManager* window_manager)
+ : proxy_(proxy), window_manager_(window_manager), cache_(kMaxCacheSize) {
+ is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kOzoneTestSingleOverlaySupport);
proxy_->RegisterHandler();
- window_->SetOverlayCandidatesHost(this);
}
-DrmOverlayCandidatesHostCore::~DrmOverlayCandidatesHostCore() {
+DrmOverlayManagerCore::~DrmOverlayManagerCore() {
proxy_->UnregisterHandler();
- window_->SetOverlayCandidatesHost(nullptr);
}
-void DrmOverlayCandidatesHostCore::CheckOverlaySupport(
- OverlaySurfaceCandidateList* candidates) {
+scoped_ptr<OverlayCandidatesOzone>
+DrmOverlayManagerCore::CreateOverlayCandidates(gfx::AcceleratedWidget w) {
+ if (!is_supported_)
+ return nullptr;
+ return make_scoped_ptr(new DrmOverlayCandidatesHost(this, w));
+}
+
+void DrmOverlayManagerCore::CheckOverlaySupport(
+ OverlayCandidatesOzone::OverlaySurfaceCandidateList* candidates,
+ gfx::AcceleratedWidget widget) {
std::vector<OverlayCheck_Params> overlay_params;
for (auto& candidate : *candidates) {
// Reject candidates that don't fall on a pixel boundary.
@@ -68,7 +84,7 @@ void DrmOverlayCandidatesHostCore::CheckOverlaySupport(
continue;
const OverlaySurfaceCandidate& candidate = candidates->at(i);
- if (!CanHandleCandidate(candidate)) {
+ if (!CanHandleCandidate(candidate, widget)) {
DCHECK(candidate.plane_z_order != 0);
overlay_params.at(i).is_overlay_candidate = false;
continue;
@@ -80,7 +96,7 @@ void DrmOverlayCandidatesHostCore::CheckOverlaySupport(
cache_.Put(overlay_params, needs_gpu_validation);
if (needs_gpu_validation)
- SendOverlayValidationRequest(overlay_params);
+ SendOverlayValidationRequest(overlay_params, widget);
} else {
const std::vector<OverlayCheck_Params>& validated_params = iter->first;
DCHECK(size == validated_params.size());
@@ -92,32 +108,29 @@ void DrmOverlayCandidatesHostCore::CheckOverlaySupport(
}
}
-void DrmOverlayCandidatesHostCore::ResetCache() {
+void DrmOverlayManagerCore::ResetCache() {
cache_.Clear();
}
-void DrmOverlayCandidatesHostCore::SendOverlayValidationRequest(
- const std::vector<OverlayCheck_Params>& new_params) const {
+void DrmOverlayManagerCore::SendOverlayValidationRequest(
+ const std::vector<OverlayCheck_Params>& new_params,
+ gfx::AcceleratedWidget widget) const {
if (!proxy_->IsConnected())
return;
- proxy_->CheckOverlayCapabilities(window_->GetAcceleratedWidget(), new_params);
+ proxy_->CheckOverlayCapabilities(widget, new_params);
}
// TODO(rjkroege) Remove the IPC component of OverlayCheck_Params in the future.
-void DrmOverlayCandidatesHostCore::GpuSentOverlayResult(
- bool* handled,
+void DrmOverlayManagerCore::GpuSentOverlayResult(
gfx::AcceleratedWidget widget,
const std::vector<OverlayCheck_Params>& params) {
- if (widget != window_->GetAcceleratedWidget())
- return;
-
- *handled = true;
cache_.Put(params, false);
}
-bool DrmOverlayCandidatesHostCore::CanHandleCandidate(
- const OverlaySurfaceCandidate& candidate) const {
+bool DrmOverlayManagerCore::CanHandleCandidate(
+ const OverlaySurfaceCandidate& candidate,
+ gfx::AcceleratedWidget widget) const {
if (candidate.buffer_size.IsEmpty())
return false;
@@ -130,7 +143,8 @@ bool DrmOverlayCandidatesHostCore::CanHandleCandidate(
// 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 (!window_->GetBounds().Contains(
+ DrmWindowHost* window = window_manager_->GetWindow(widget);
+ if (!window->GetBounds().Contains(
gfx::ToNearestRect(candidate.display_rect))) {
return false;
}
« no previous file with comments | « ui/ozone/platform/drm/host/drm_overlay_manager_core.h ('k') | ui/ozone/platform/drm/host/drm_window_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698