| Index: ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc
|
| diff --git a/ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc b/ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc
|
| deleted file mode 100644
|
| index bc0f6c4c0bfe20d552f876356d2c6e724b883bfc..0000000000000000000000000000000000000000
|
| --- a/ui/ozone/platform/drm/host/drm_overlay_candidates_host_core.cc
|
| +++ /dev/null
|
| @@ -1,146 +0,0 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| -// 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 <stddef.h>
|
| -
|
| -#include <algorithm>
|
| -
|
| -#include "ui/gfx/geometry/rect_conversions.h"
|
| -#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
|
| -#include "ui/ozone/platform/drm/host/drm_window_host.h"
|
| -
|
| -namespace ui {
|
| -
|
| -namespace {
|
| -const size_t kMaxCacheSize = 200;
|
| -} // namespace
|
| -
|
| -DrmOverlayCandidatesHostProxy::~DrmOverlayCandidatesHostProxy() {}
|
| -
|
| -DrmOverlayCandidatesHostCore::DrmOverlayCandidatesHostCore(
|
| - DrmOverlayCandidatesHostProxy* proxy,
|
| - DrmWindowHost* window)
|
| - : proxy_(proxy), window_(window), cache_(kMaxCacheSize) {
|
| - proxy_->RegisterHandler();
|
| - window_->SetOverlayCandidatesHost(this);
|
| -}
|
| -
|
| -DrmOverlayCandidatesHostCore::~DrmOverlayCandidatesHostCore() {
|
| - proxy_->UnregisterHandler();
|
| - window_->SetOverlayCandidatesHost(nullptr);
|
| -}
|
| -
|
| -void DrmOverlayCandidatesHostCore::CheckOverlaySupport(
|
| - OverlaySurfaceCandidateList* candidates) {
|
| - std::vector<OverlayCheck_Params> overlay_params;
|
| - for (auto& candidate : *candidates) {
|
| - // Reject candidates that don't fall on a pixel boundary.
|
| - if (!gfx::IsNearestRectWithinDistance(candidate.display_rect, 0.01f)) {
|
| - DCHECK(candidate.plane_z_order != 0);
|
| - overlay_params.push_back(OverlayCheck_Params());
|
| - overlay_params.back().is_overlay_candidate = false;
|
| - continue;
|
| - }
|
| -
|
| - // Compositor doesn't have information about the total size of primary
|
| - // candidate. We get this information from display rect.
|
| - if (candidate.plane_z_order == 0)
|
| - candidate.buffer_size = gfx::ToNearestRect(candidate.display_rect).size();
|
| -
|
| - overlay_params.push_back(OverlayCheck_Params(candidate));
|
| - }
|
| -
|
| - const auto& iter = cache_.Get(overlay_params);
|
| - // We are still waiting on results for this candidate list from GPU.
|
| - if (iter != cache_.end() && iter->second)
|
| - return;
|
| -
|
| - size_t size = candidates->size();
|
| -
|
| - if (iter == cache_.end()) {
|
| - // We can skip GPU side validation in case all candidates are invalid.
|
| - bool needs_gpu_validation = false;
|
| - for (size_t i = 0; i < size; i++) {
|
| - if (!overlay_params.at(i).is_overlay_candidate)
|
| - continue;
|
| -
|
| - const OverlaySurfaceCandidate& candidate = candidates->at(i);
|
| - if (!CanHandleCandidate(candidate)) {
|
| - DCHECK(candidate.plane_z_order != 0);
|
| - overlay_params.at(i).is_overlay_candidate = false;
|
| - continue;
|
| - }
|
| -
|
| - needs_gpu_validation = true;
|
| - }
|
| -
|
| - cache_.Put(overlay_params, needs_gpu_validation);
|
| -
|
| - if (needs_gpu_validation)
|
| - SendOverlayValidationRequest(overlay_params);
|
| - } else {
|
| - const std::vector<OverlayCheck_Params>& validated_params = iter->first;
|
| - DCHECK(size == validated_params.size());
|
| -
|
| - for (size_t i = 0; i < size; i++) {
|
| - candidates->at(i).overlay_handled =
|
| - validated_params.at(i).is_overlay_candidate;
|
| - }
|
| - }
|
| -}
|
| -
|
| -void DrmOverlayCandidatesHostCore::ResetCache() {
|
| - cache_.Clear();
|
| -}
|
| -
|
| -void DrmOverlayCandidatesHostCore::SendOverlayValidationRequest(
|
| - const std::vector<OverlayCheck_Params>& new_params) const {
|
| - if (!proxy_->IsConnected())
|
| - return;
|
| -
|
| - proxy_->CheckOverlayCapabilities(window_->GetAcceleratedWidget(), new_params);
|
| -}
|
| -
|
| -// TODO(rjkroege) Remove the IPC component of OverlayCheck_Params in the future.
|
| -void DrmOverlayCandidatesHostCore::GpuSentOverlayResult(
|
| - bool* handled,
|
| - 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 {
|
| - if (candidate.buffer_size.IsEmpty())
|
| - return false;
|
| -
|
| - if (candidate.transform == gfx::OVERLAY_TRANSFORM_INVALID)
|
| - return false;
|
| -
|
| - if (candidate.plane_z_order != 0) {
|
| - // 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 (!window_->GetBounds().Contains(
|
| - gfx::ToNearestRect(candidate.display_rect))) {
|
| - return false;
|
| - }
|
| - }
|
| -
|
| - if (candidate.is_clipped &&
|
| - !candidate.clip_rect.Contains(candidate.quad_rect_in_target_space))
|
| - return false;
|
| -
|
| - return true;
|
| -}
|
| -
|
| -} // namespace ui
|
|
|