Commit 550ad6ff authored by Weiliang Chen's avatar Weiliang Chen Committed by Commit Bot

overlay: Use a Stub OverlayProcessor When Offscreen

When the display compositor is offscreen, and the passed in surface
handle is null, return a stub class for overlay processor. This removes
enable_overlay and could_overlay bools from other overlay processor
classes.

R=Khushal

Bug: 898680
Change-Id: I75f72ba3dfabcc3ab0e2fe80509bb6cad7a74910
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446463Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarMaggie Chen <magchen@chromium.org>
Commit-Queue: weiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816631}
parent c6edb33a
...@@ -95,8 +95,7 @@ class OverlayOutputSurface : public OutputSurface { ...@@ -95,8 +95,7 @@ class OverlayOutputSurface : public OutputSurface {
class CATestOverlayProcessor : public OverlayProcessorMac { class CATestOverlayProcessor : public OverlayProcessorMac {
public: public:
CATestOverlayProcessor() CATestOverlayProcessor()
: OverlayProcessorMac(true /* could_overlay */, : OverlayProcessorMac(true /* enable_ca_overlay */) {}
true /* enable_ca_overlay */) {}
}; };
std::unique_ptr<AggregatedRenderPass> CreateRenderPass() { std::unique_ptr<AggregatedRenderPass> CreateRenderPass() {
......
...@@ -20,14 +20,8 @@ namespace viz { ...@@ -20,14 +20,8 @@ namespace viz {
OverlayProcessorAndroid::OverlayProcessorAndroid( OverlayProcessorAndroid::OverlayProcessorAndroid(
gpu::SharedImageManager* shared_image_manager, gpu::SharedImageManager* shared_image_manager,
gpu::MemoryTracker* memory_tracker, gpu::MemoryTracker* memory_tracker,
gpu::GpuTaskSchedulerHelper* gpu_task_scheduler, gpu::GpuTaskSchedulerHelper* gpu_task_scheduler)
bool enable_overlay) : OverlayProcessorUsingStrategy(), gpu_task_scheduler_(gpu_task_scheduler) {
: OverlayProcessorUsingStrategy(),
gpu_task_scheduler_(gpu_task_scheduler),
overlay_enabled_(enable_overlay) {
if (!overlay_enabled_)
return;
// In unittests, we don't have the gpu_task_scheduler_ set up, but still want // In unittests, we don't have the gpu_task_scheduler_ set up, but still want
// to test ProcessForOverlays functionalities where we are making overlay // to test ProcessForOverlays functionalities where we are making overlay
// candidates correctly. // candidates correctly.
...@@ -90,7 +84,7 @@ void OverlayProcessorAndroid::DestroyOverlayProcessorOnGpu( ...@@ -90,7 +84,7 @@ void OverlayProcessorAndroid::DestroyOverlayProcessorOnGpu(
} }
bool OverlayProcessorAndroid::IsOverlaySupported() const { bool OverlayProcessorAndroid::IsOverlaySupported() const {
return overlay_enabled_; return true;
} }
bool OverlayProcessorAndroid::NeedsSurfaceDamageRectList() const { bool OverlayProcessorAndroid::NeedsSurfaceDamageRectList() const {
......
...@@ -34,8 +34,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid ...@@ -34,8 +34,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid
public: public:
OverlayProcessorAndroid(gpu::SharedImageManager* shared_image_manager, OverlayProcessorAndroid(gpu::SharedImageManager* shared_image_manager,
gpu::MemoryTracker* memory_tracker, gpu::MemoryTracker* memory_tracker,
gpu::GpuTaskSchedulerHelper* gpu_task_scheduler, gpu::GpuTaskSchedulerHelper* gpu_task_scheduler);
bool enable_overlay);
~OverlayProcessorAndroid() override; ~OverlayProcessorAndroid() override;
bool IsOverlaySupported() const override; bool IsOverlaySupported() const override;
...@@ -79,7 +78,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid ...@@ -79,7 +78,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid
PromotionHintInfoMap promotion_hint_info_map_; PromotionHintInfoMap promotion_hint_info_map_;
gpu::GpuTaskSchedulerHelper* gpu_task_scheduler_; gpu::GpuTaskSchedulerHelper* gpu_task_scheduler_;
const bool overlay_enabled_;
// This class is created, accessed, and destroyed on the gpu thread. // This class is created, accessed, and destroyed on the gpu thread.
std::unique_ptr<OverlayProcessorOnGpu> processor_on_gpu_; std::unique_ptr<OverlayProcessorOnGpu> processor_on_gpu_;
......
...@@ -88,25 +88,34 @@ OverlayProcessorInterface::CreateOverlayProcessor( ...@@ -88,25 +88,34 @@ OverlayProcessorInterface::CreateOverlayProcessor(
gpu::SharedImageInterface* shared_image_interface, gpu::SharedImageInterface* shared_image_interface,
const RendererSettings& renderer_settings, const RendererSettings& renderer_settings,
const DebugRendererSettings* debug_settings) { const DebugRendererSettings* debug_settings) {
// If we are offscreen, we don't have overlay support.
// TODO(vasilyt): WebView would have a kNullSurfaceHandle. Make sure when
// overlay for WebView is enabled, this check still works.
if (surface_handle == gpu::kNullSurfaceHandle)
return std::make_unique<OverlayProcessorStub>();
#if defined(OS_APPLE) #if defined(OS_APPLE)
bool could_overlay = DCHECK(capabilities.supports_surfaceless);
output_surface->GetSurfaceHandle() != gpu::kNullSurfaceHandle;
could_overlay &= output_surface->capabilities().supports_surfaceless;
bool enable_ca_overlay = could_overlay && renderer_settings.allow_overlays;
return std::make_unique<OverlayProcessorMac>(could_overlay, return std::make_unique<OverlayProcessorMac>(
enable_ca_overlay); renderer_settings.allow_overlays);
#elif defined(OS_WIN) #elif defined(OS_WIN)
if (!capabilities.supports_dc_layers)
return std::make_unique<OverlayProcessorStub>();
return std::make_unique<OverlayProcessorWin>( return std::make_unique<OverlayProcessorWin>(
output_surface, std::make_unique<DCLayerOverlayProcessor>( output_surface, std::make_unique<DCLayerOverlayProcessor>(
debug_settings, /*allowed_yuv_overlay_count=*/1)); debug_settings, /*allowed_yuv_overlay_count=*/1));
#elif defined(USE_OZONE) #elif defined(USE_OZONE)
if (!features::IsUsingOzonePlatform()) if (!features::IsUsingOzonePlatform())
return std::make_unique<OverlayProcessorStub>(); return std::make_unique<OverlayProcessorStub>();
bool overlay_enabled = surface_handle != gpu::kNullSurfaceHandle;
overlay_enabled &= !renderer_settings.overlay_strategies.empty(); // In tests and Ozone/X11, we do not expect surfaceless surface support.
if (!capabilities.supports_surfaceless)
return std::make_unique<OverlayProcessorStub>();
std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates; std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates;
if (overlay_enabled) { if (!renderer_settings.overlay_strategies.empty()) {
auto* overlay_manager = auto* overlay_manager =
ui::OzonePlatform::GetInstance()->GetOverlayManager(); ui::OzonePlatform::GetInstance()->GetOverlayManager();
overlay_candidates = overlay_candidates =
...@@ -114,19 +123,18 @@ OverlayProcessorInterface::CreateOverlayProcessor( ...@@ -114,19 +123,18 @@ OverlayProcessorInterface::CreateOverlayProcessor(
} }
gpu::SharedImageInterface* sii = nullptr; gpu::SharedImageInterface* sii = nullptr;
if (overlay_enabled && features::ShouldUseRealBuffersForPageFlipTest()) { if (features::ShouldUseRealBuffersForPageFlipTest()) {
sii = shared_image_interface; sii = shared_image_interface;
CHECK(shared_image_interface); CHECK(shared_image_interface);
} }
return std::make_unique<OverlayProcessorOzone>( return std::make_unique<OverlayProcessorOzone>(
overlay_enabled, std::move(overlay_candidates), std::move(overlay_candidates),
std::move(renderer_settings.overlay_strategies), sii); std::move(renderer_settings.overlay_strategies), sii);
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
bool overlay_enabled = surface_handle != gpu::kNullSurfaceHandle;
if (capabilities.supports_surfaceless) { if (capabilities.supports_surfaceless) {
// This is for Android SurfaceControl case. // This is for Android SurfaceControl case.
return std::make_unique<OverlayProcessorSurfaceControl>(overlay_enabled); return std::make_unique<OverlayProcessorSurfaceControl>();
} else { } else {
// When SurfaceControl is enabled, any resource backed by // When SurfaceControl is enabled, any resource backed by
// an AHardwareBuffer can be marked as an overlay candidate but it requires // an AHardwareBuffer can be marked as an overlay candidate but it requires
...@@ -134,10 +142,11 @@ OverlayProcessorInterface::CreateOverlayProcessor( ...@@ -134,10 +142,11 @@ OverlayProcessorInterface::CreateOverlayProcessor(
// native window backed GLSurface, the overlay processing code will // native window backed GLSurface, the overlay processing code will
// incorrectly assume these resources can be overlaid. So we disable all // incorrectly assume these resources can be overlaid. So we disable all
// overlay processing for this OutputSurface. // overlay processing for this OutputSurface.
overlay_enabled &= !capabilities.android_surface_control_feature_enabled; if (capabilities.android_surface_control_feature_enabled)
return std::make_unique<OverlayProcessorStub>();
return std::make_unique<OverlayProcessorAndroid>( return std::make_unique<OverlayProcessorAndroid>(
shared_image_manager, memory_tracker, gpu_task_scheduler, shared_image_manager, memory_tracker, gpu_task_scheduler);
overlay_enabled);
} }
#else // Default #else // Default
return std::make_unique<OverlayProcessorStub>(); return std::make_unique<OverlayProcessorStub>();
......
...@@ -15,17 +15,14 @@ ...@@ -15,17 +15,14 @@
#include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/rect_conversions.h"
namespace viz { namespace viz {
OverlayProcessorMac::OverlayProcessorMac(bool could_overlay, OverlayProcessorMac::OverlayProcessorMac(bool enable_ca_overlay)
bool enable_ca_overlay) : enable_ca_overlay_(enable_ca_overlay),
: could_overlay_(could_overlay),
enable_ca_overlay_(enable_ca_overlay),
ca_layer_overlay_processor_(std::make_unique<CALayerOverlayProcessor>()) { ca_layer_overlay_processor_(std::make_unique<CALayerOverlayProcessor>()) {
} }
OverlayProcessorMac::OverlayProcessorMac( OverlayProcessorMac::OverlayProcessorMac(
std::unique_ptr<CALayerOverlayProcessor> ca_layer_overlay_processor) std::unique_ptr<CALayerOverlayProcessor> ca_layer_overlay_processor)
: could_overlay_(true), : enable_ca_overlay_(true),
enable_ca_overlay_(true),
ca_layer_overlay_processor_(std::move(ca_layer_overlay_processor)) {} ca_layer_overlay_processor_(std::move(ca_layer_overlay_processor)) {}
OverlayProcessorMac::~OverlayProcessorMac() = default; OverlayProcessorMac::~OverlayProcessorMac() = default;
...@@ -35,7 +32,7 @@ bool OverlayProcessorMac::DisableSplittingQuads() const { ...@@ -35,7 +32,7 @@ bool OverlayProcessorMac::DisableSplittingQuads() const {
} }
bool OverlayProcessorMac::IsOverlaySupported() const { bool OverlayProcessorMac::IsOverlaySupported() const {
return could_overlay_; return true;
} }
gfx::Rect OverlayProcessorMac::GetPreviousFrameOverlaysBoundingRect() const { gfx::Rect OverlayProcessorMac::GetPreviousFrameOverlaysBoundingRect() const {
......
...@@ -27,7 +27,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorMac ...@@ -27,7 +27,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorMac
public: public:
using CandidateList = CALayerOverlayList; using CandidateList = CALayerOverlayList;
OverlayProcessorMac(bool could_overlay, bool enable_ca_overlay); explicit OverlayProcessorMac(bool enable_ca_overlay);
// For testing. // For testing.
explicit OverlayProcessorMac( explicit OverlayProcessorMac(
std::unique_ptr<CALayerOverlayProcessor> ca_layer_overlay_processor); std::unique_ptr<CALayerOverlayProcessor> ca_layer_overlay_processor);
...@@ -67,7 +67,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorMac ...@@ -67,7 +67,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorMac
base::Optional<OutputSurfaceOverlayPlane>* output_surface_plane) override; base::Optional<OutputSurfaceOverlayPlane>* output_surface_plane) override;
private: private:
const bool could_overlay_;
const bool enable_ca_overlay_; const bool enable_ca_overlay_;
gfx::Rect ca_overlay_damage_rect_; gfx::Rect ca_overlay_damage_rect_;
gfx::Rect previous_frame_full_bounding_rect_; gfx::Rect previous_frame_full_bounding_rect_;
......
...@@ -71,37 +71,32 @@ void ReportSharedImageExists(bool exists) { ...@@ -71,37 +71,32 @@ void ReportSharedImageExists(bool exists) {
// |available_strategies| is a list of overlay strategies that should be // |available_strategies| is a list of overlay strategies that should be
// initialized by InitializeStrategies. // initialized by InitializeStrategies.
OverlayProcessorOzone::OverlayProcessorOzone( OverlayProcessorOzone::OverlayProcessorOzone(
bool overlay_enabled,
std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates,
std::vector<OverlayStrategy> available_strategies, std::vector<OverlayStrategy> available_strategies,
gpu::SharedImageInterface* shared_image_interface) gpu::SharedImageInterface* shared_image_interface)
: OverlayProcessorUsingStrategy(), : OverlayProcessorUsingStrategy(),
overlay_enabled_(overlay_enabled),
overlay_candidates_(std::move(overlay_candidates)), overlay_candidates_(std::move(overlay_candidates)),
available_strategies_(std::move(available_strategies)), available_strategies_(std::move(available_strategies)),
shared_image_interface_(shared_image_interface) { shared_image_interface_(shared_image_interface) {
if (overlay_enabled_) { for (OverlayStrategy strategy : available_strategies_) {
for (OverlayStrategy strategy : available_strategies_) { switch (strategy) {
switch (strategy) { case OverlayStrategy::kFullscreen:
case OverlayStrategy::kFullscreen: strategies_.push_back(
strategies_.push_back( std::make_unique<OverlayStrategyFullscreen>(this));
std::make_unique<OverlayStrategyFullscreen>(this)); break;
break; case OverlayStrategy::kSingleOnTop:
case OverlayStrategy::kSingleOnTop: strategies_.push_back(
strategies_.push_back( std::make_unique<OverlayStrategySingleOnTop>(this));
std::make_unique<OverlayStrategySingleOnTop>(this)); break;
break; case OverlayStrategy::kUnderlay:
case OverlayStrategy::kUnderlay: strategies_.push_back(std::make_unique<OverlayStrategyUnderlay>(this));
strategies_.push_back( break;
std::make_unique<OverlayStrategyUnderlay>(this)); case OverlayStrategy::kUnderlayCast:
break; strategies_.push_back(
case OverlayStrategy::kUnderlayCast: std::make_unique<OverlayStrategyUnderlayCast>(this));
strategies_.push_back( break;
std::make_unique<OverlayStrategyUnderlayCast>(this)); default:
break; NOTREACHED();
default:
NOTREACHED();
}
} }
} }
} }
...@@ -109,7 +104,7 @@ OverlayProcessorOzone::OverlayProcessorOzone( ...@@ -109,7 +104,7 @@ OverlayProcessorOzone::OverlayProcessorOzone(
OverlayProcessorOzone::~OverlayProcessorOzone() = default; OverlayProcessorOzone::~OverlayProcessorOzone() = default;
bool OverlayProcessorOzone::IsOverlaySupported() const { bool OverlayProcessorOzone::IsOverlaySupported() const {
return overlay_enabled_; return true;
} }
bool OverlayProcessorOzone::NeedsSurfaceDamageRectList() const { bool OverlayProcessorOzone::NeedsSurfaceDamageRectList() const {
......
...@@ -18,7 +18,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorOzone ...@@ -18,7 +18,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorOzone
: public OverlayProcessorUsingStrategy { : public OverlayProcessorUsingStrategy {
public: public:
OverlayProcessorOzone( OverlayProcessorOzone(
bool overlay_enabled,
std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates,
std::vector<OverlayStrategy> available_strategies, std::vector<OverlayStrategy> available_strategies,
gpu::SharedImageInterface* shared_image_interface); gpu::SharedImageInterface* shared_image_interface);
...@@ -45,8 +44,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorOzone ...@@ -45,8 +44,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorOzone
bool SetNativePixmapForCandidate(ui::OverlaySurfaceCandidate* candidate, bool SetNativePixmapForCandidate(ui::OverlaySurfaceCandidate* candidate,
const gpu::Mailbox& mailbox); const gpu::Mailbox& mailbox);
const bool overlay_enabled_;
std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates_; std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates_;
const std::vector<OverlayStrategy> available_strategies_; const std::vector<OverlayStrategy> available_strategies_;
gpu::SharedImageInterface* const shared_image_interface_; gpu::SharedImageInterface* const shared_image_interface_;
......
...@@ -30,19 +30,16 @@ gfx::RectF ClipFromOrigin(gfx::RectF input) { ...@@ -30,19 +30,16 @@ gfx::RectF ClipFromOrigin(gfx::RectF input) {
} // namespace } // namespace
OverlayProcessorSurfaceControl::OverlayProcessorSurfaceControl( OverlayProcessorSurfaceControl::OverlayProcessorSurfaceControl()
bool enable_overlay) : OverlayProcessorUsingStrategy() {
: OverlayProcessorUsingStrategy(), overlay_enabled_(enable_overlay) { strategies_.push_back(std::make_unique<OverlayStrategyUnderlay>(
if (overlay_enabled_) { this, OverlayStrategyUnderlay::OpaqueMode::AllowTransparentCandidates));
strategies_.push_back(std::make_unique<OverlayStrategyUnderlay>(
this, OverlayStrategyUnderlay::OpaqueMode::AllowTransparentCandidates));
}
} }
OverlayProcessorSurfaceControl::~OverlayProcessorSurfaceControl() {} OverlayProcessorSurfaceControl::~OverlayProcessorSurfaceControl() {}
bool OverlayProcessorSurfaceControl::IsOverlaySupported() const { bool OverlayProcessorSurfaceControl::IsOverlaySupported() const {
return overlay_enabled_; return true;
} }
bool OverlayProcessorSurfaceControl::NeedsSurfaceDamageRectList() const { bool OverlayProcessorSurfaceControl::NeedsSurfaceDamageRectList() const {
......
...@@ -13,7 +13,7 @@ namespace viz { ...@@ -13,7 +13,7 @@ namespace viz {
class VIZ_SERVICE_EXPORT OverlayProcessorSurfaceControl class VIZ_SERVICE_EXPORT OverlayProcessorSurfaceControl
: public OverlayProcessorUsingStrategy { : public OverlayProcessorUsingStrategy {
public: public:
explicit OverlayProcessorSurfaceControl(bool enable_overlay); OverlayProcessorSurfaceControl();
~OverlayProcessorSurfaceControl() override; ~OverlayProcessorSurfaceControl() override;
bool IsOverlaySupported() const override; bool IsOverlaySupported() const override;
...@@ -32,7 +32,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorSurfaceControl ...@@ -32,7 +32,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorSurfaceControl
const OverlayCandidate& overlay) const override; const OverlayCandidate& overlay) const override;
private: private:
const bool overlay_enabled_;
gfx::OverlayTransform display_transform_ = gfx::OVERLAY_TRANSFORM_NONE; gfx::OverlayTransform display_transform_ = gfx::OVERLAY_TRANSFORM_NONE;
gfx::Size viewport_size_; gfx::Size viewport_size_;
}; };
......
...@@ -20,7 +20,7 @@ TEST(OverlayCandidateValidatorSurfaceControlTest, NoClipOrNegativeOffset) { ...@@ -20,7 +20,7 @@ TEST(OverlayCandidateValidatorSurfaceControlTest, NoClipOrNegativeOffset) {
OverlayCandidateList candidates; OverlayCandidateList candidates;
candidates.push_back(candidate); candidates.push_back(candidate);
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.CheckOverlaySupport(nullptr, &candidates); processor.CheckOverlaySupport(nullptr, &candidates);
EXPECT_TRUE(candidates.at(0).overlay_handled); EXPECT_TRUE(candidates.at(0).overlay_handled);
EXPECT_RECTF_EQ(candidates.at(0).display_rect, gfx::RectF(10.f, 10.f)); EXPECT_RECTF_EQ(candidates.at(0).display_rect, gfx::RectF(10.f, 10.f));
...@@ -37,7 +37,7 @@ TEST(OverlayProcessorSurfaceControlTest, Clipped) { ...@@ -37,7 +37,7 @@ TEST(OverlayProcessorSurfaceControlTest, Clipped) {
OverlayCandidateList candidates; OverlayCandidateList candidates;
candidates.push_back(candidate); candidates.push_back(candidate);
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.CheckOverlaySupport(nullptr, &candidates); processor.CheckOverlaySupport(nullptr, &candidates);
EXPECT_TRUE(candidates.at(0).overlay_handled); EXPECT_TRUE(candidates.at(0).overlay_handled);
EXPECT_RECTF_EQ(candidates.at(0).display_rect, EXPECT_RECTF_EQ(candidates.at(0).display_rect,
...@@ -56,7 +56,7 @@ TEST(OverlayProcessorSurfaceControlTest, NegativeOffset) { ...@@ -56,7 +56,7 @@ TEST(OverlayProcessorSurfaceControlTest, NegativeOffset) {
OverlayCandidateList candidates; OverlayCandidateList candidates;
candidates.push_back(candidate); candidates.push_back(candidate);
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.CheckOverlaySupport(nullptr, &candidates); processor.CheckOverlaySupport(nullptr, &candidates);
EXPECT_TRUE(candidates.at(0).overlay_handled); EXPECT_TRUE(candidates.at(0).overlay_handled);
EXPECT_RECTF_EQ(candidates.at(0).display_rect, EXPECT_RECTF_EQ(candidates.at(0).display_rect,
...@@ -75,7 +75,7 @@ TEST(OverlayProcessorSurfaceControlTest, ClipAndNegativeOffset) { ...@@ -75,7 +75,7 @@ TEST(OverlayProcessorSurfaceControlTest, ClipAndNegativeOffset) {
OverlayCandidateList candidates; OverlayCandidateList candidates;
candidates.push_back(candidate); candidates.push_back(candidate);
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.CheckOverlaySupport(nullptr, &candidates); processor.CheckOverlaySupport(nullptr, &candidates);
EXPECT_TRUE(candidates.at(0).overlay_handled); EXPECT_TRUE(candidates.at(0).overlay_handled);
EXPECT_RECTF_EQ(candidates.at(0).display_rect, EXPECT_RECTF_EQ(candidates.at(0).display_rect,
...@@ -92,7 +92,7 @@ TEST(OverlayProcessorSurfaceControlTest, DisplayTransformOverlay) { ...@@ -92,7 +92,7 @@ TEST(OverlayProcessorSurfaceControlTest, DisplayTransformOverlay) {
OverlayCandidateList candidates; OverlayCandidateList candidates;
candidates.push_back(candidate); candidates.push_back(candidate);
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.SetViewportSize(gfx::Size(100, 200)); processor.SetViewportSize(gfx::Size(100, 200));
processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90); processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90);
...@@ -116,7 +116,7 @@ TEST(OverlayProcessorSurfaceControlTest, DisplayTransformOutputSurfaceOverlay) { ...@@ -116,7 +116,7 @@ TEST(OverlayProcessorSurfaceControlTest, DisplayTransformOutputSurfaceOverlay) {
base::Optional<OverlayProcessorInterface::OutputSurfaceOverlayPlane> base::Optional<OverlayProcessorInterface::OutputSurfaceOverlayPlane>
overlay_plane = candidate; overlay_plane = candidate;
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.SetViewportSize(gfx::Size(100, 200)); processor.SetViewportSize(gfx::Size(100, 200));
processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90); processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90);
processor.AdjustOutputSurfaceOverlay(&overlay_plane); processor.AdjustOutputSurfaceOverlay(&overlay_plane);
...@@ -130,7 +130,7 @@ TEST(OverlayCandidateValidatorTest, OverlayDamageRectForOutputSurface) { ...@@ -130,7 +130,7 @@ TEST(OverlayCandidateValidatorTest, OverlayDamageRectForOutputSurface) {
candidate.transform = gfx::OVERLAY_TRANSFORM_ROTATE_90; candidate.transform = gfx::OVERLAY_TRANSFORM_ROTATE_90;
candidate.overlay_handled = false; candidate.overlay_handled = false;
OverlayProcessorSurfaceControl processor(true); OverlayProcessorSurfaceControl processor;
processor.SetViewportSize(gfx::Size(100, 200)); processor.SetViewportSize(gfx::Size(100, 200));
processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90); processor.SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_90);
......
...@@ -27,13 +27,14 @@ OverlayProcessorWin::OverlayProcessorWin( ...@@ -27,13 +27,14 @@ OverlayProcessorWin::OverlayProcessorWin(
OutputSurface* output_surface, OutputSurface* output_surface,
std::unique_ptr<DCLayerOverlayProcessor> dc_layer_overlay_processor) std::unique_ptr<DCLayerOverlayProcessor> dc_layer_overlay_processor)
: output_surface_(output_surface), : output_surface_(output_surface),
supports_dc_layers_(output_surface->capabilities().supports_dc_layers), dc_layer_overlay_processor_(std::move(dc_layer_overlay_processor)) {
dc_layer_overlay_processor_(std::move(dc_layer_overlay_processor)) {} DCHECK(output_surface_->capabilities().supports_dc_layers);
}
OverlayProcessorWin::~OverlayProcessorWin() = default; OverlayProcessorWin::~OverlayProcessorWin() = default;
bool OverlayProcessorWin::IsOverlaySupported() const { bool OverlayProcessorWin::IsOverlaySupported() const {
return supports_dc_layers_; return true;
} }
gfx::Rect OverlayProcessorWin::GetPreviousFrameOverlaysBoundingRect() const { gfx::Rect OverlayProcessorWin::GetPreviousFrameOverlaysBoundingRect() const {
...@@ -85,9 +86,6 @@ void OverlayProcessorWin::ProcessForOverlays( ...@@ -85,9 +86,6 @@ void OverlayProcessorWin::ProcessForOverlays(
return; return;
} }
if (!supports_dc_layers_)
return;
dc_layer_overlay_processor_->Process( dc_layer_overlay_processor_->Process(
resource_provider, gfx::RectF(root_render_pass->output_rect), resource_provider, gfx::RectF(root_render_pass->output_rect),
render_passes, damage_rect, surface_damage_rect_list, candidates); render_passes, damage_rect, surface_damage_rect_list, candidates);
......
...@@ -70,8 +70,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorWin ...@@ -70,8 +70,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorWin
private: private:
OutputSurface* const output_surface_; OutputSurface* const output_surface_;
// Whether direct composition layers are supported by the output surface.
const bool supports_dc_layers_;
// Whether direct composition layers are being used with SetEnableDCLayers(). // Whether direct composition layers are being used with SetEnableDCLayers().
bool using_dc_layers_ = false; bool using_dc_layers_ = false;
// Number of frames since the last time direct composition layers were used. // Number of frames since the last time direct composition layers were used.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment