Commit 0d012669 authored by kylechar's avatar kylechar Committed by Commit Bot

oopd: Delete win/mac code for VizDisplayCompositor disabled.

You can no longer no disable VizDisplayCompositor feature on Windows or
Mac so anything platform specific there is effectively dead code.

Bug: 936425
Change-Id: Iadc74ac6447f980929535bec7024ae754364aaf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602283Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659050}
parent 48561d50
......@@ -244,8 +244,8 @@ OutputSurfaceProviderImpl::CreateSoftwareOutputDeviceForPlatform(
return std::make_unique<SoftwareOutputDevice>();
#if defined(OS_WIN)
return CreateSoftwareOutputDeviceWinGpu(
surface_handle, &output_device_backing_, display_client);
return CreateSoftwareOutputDeviceWin(surface_handle, &output_device_backing_,
display_client);
#elif defined(OS_MACOSX)
return std::make_unique<SoftwareOutputDeviceMac>(task_runner_);
#elif defined(OS_ANDROID)
......
......@@ -170,62 +170,6 @@ void SoftwareOutputDeviceWinDirect::EndPaintDelegated(
::ReleaseDC(hwnd(), hdc);
}
// SoftwareOutputDevice implementation that uses layered window API to draw to
// the provided HWND.
class SoftwareOutputDeviceWinLayered : public SoftwareOutputDeviceWinBase {
public:
explicit SoftwareOutputDeviceWinLayered(HWND hwnd)
: SoftwareOutputDeviceWinBase(hwnd) {}
~SoftwareOutputDeviceWinLayered() override = default;
// SoftwareOutputDeviceWinBase implementation.
void ResizeDelegated() override;
SkCanvas* BeginPaintDelegated() override;
void EndPaintDelegated(const gfx::Rect& damage_rect) override;
private:
std::unique_ptr<SkCanvas> canvas_;
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWinLayered);
};
void SoftwareOutputDeviceWinLayered::ResizeDelegated() {
canvas_.reset();
}
SkCanvas* SoftwareOutputDeviceWinLayered::BeginPaintDelegated() {
if (!canvas_) {
// Layered windows can't share a pixel backing.
canvas_ = skia::CreatePlatformCanvasWithSharedSection(
viewport_pixel_size_.width(), viewport_pixel_size_.height(), true,
nullptr, skia::CRASH_ON_FAILURE);
}
return canvas_.get();
}
void SoftwareOutputDeviceWinLayered::EndPaintDelegated(
const gfx::Rect& damage_rect) {
if (!canvas_)
return;
// Set WS_EX_LAYERED extended window style if not already set.
DWORD style = GetWindowLong(hwnd(), GWL_EXSTYLE);
DCHECK(!(style & WS_EX_COMPOSITED));
if (!(style & WS_EX_LAYERED))
SetWindowLong(hwnd(), GWL_EXSTYLE, style | WS_EX_LAYERED);
RECT wr;
GetWindowRect(hwnd(), &wr);
SIZE size = {wr.right - wr.left, wr.bottom - wr.top};
POINT position = {wr.left, wr.top};
POINT zero = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0x00, 0xFF, AC_SRC_ALPHA};
HDC dib_dc = skia::GetNativeDrawingContext(canvas_.get());
UpdateLayeredWindow(hwnd(), nullptr, &position, &size, dib_dc, &zero,
RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
}
// SoftwareOutputDevice implementation that uses layered window API to draw
// indirectly. Since UpdateLayeredWindow() is blocked by the GPU sandbox an
// implementation of mojom::LayeredWindowUpdater in the browser process handles
......@@ -340,16 +284,7 @@ void SoftwareOutputDeviceWinProxy::DrawAck() {
} // namespace
std::unique_ptr<SoftwareOutputDevice> CreateSoftwareOutputDeviceWinBrowser(
HWND hwnd,
OutputDeviceBacking* backing) {
if (NeedsToUseLayerWindow(hwnd))
return std::make_unique<SoftwareOutputDeviceWinLayered>(hwnd);
return std::make_unique<SoftwareOutputDeviceWinDirect>(hwnd, backing);
}
std::unique_ptr<SoftwareOutputDevice> CreateSoftwareOutputDeviceWinGpu(
std::unique_ptr<SoftwareOutputDevice> CreateSoftwareOutputDeviceWin(
HWND hwnd,
OutputDeviceBacking* backing,
mojom::DisplayClient* display_client) {
......
......@@ -17,17 +17,11 @@ namespace viz {
class OutputDeviceBacking;
// Creates an appropriate SoftwareOutputDevice implementation for the browser
// process.
// Creates an appropriate SoftwareOutputDevice implementation.
VIZ_SERVICE_EXPORT std::unique_ptr<SoftwareOutputDevice>
CreateSoftwareOutputDeviceWinBrowser(HWND hwnd, OutputDeviceBacking* backing);
// Creates an appropriate SoftwareOutputDevice implementation for the GPU
// process.
VIZ_SERVICE_EXPORT std::unique_ptr<SoftwareOutputDevice>
CreateSoftwareOutputDeviceWinGpu(HWND hwnd,
OutputDeviceBacking* backing,
mojom::DisplayClient* display_client);
CreateSoftwareOutputDeviceWin(HWND hwnd,
OutputDeviceBacking* backing,
mojom::DisplayClient* display_client);
} // namespace viz
......
......@@ -2604,8 +2604,6 @@ jumbo_source_set("browser") {
"compositor/browser_compositor_output_surface.h",
"compositor/gpu_browser_compositor_output_surface.cc",
"compositor/gpu_browser_compositor_output_surface.h",
"compositor/gpu_output_surface_mac.cc",
"compositor/gpu_output_surface_mac.h",
"compositor/gpu_process_transport_factory.cc",
"compositor/gpu_process_transport_factory.h",
"compositor/gpu_surfaceless_browser_compositor_output_surface.cc",
......@@ -2630,16 +2628,6 @@ jumbo_source_set("browser") {
"renderer_host/delegated_frame_host.cc",
"renderer_host/delegated_frame_host.h",
]
if (is_mac) {
jumbo_excluded_sources = [
# Both Mac SDK headers and third_party/khronos/GLES2/gl2ext.h
# declare macros GL_LINES_ADJACENCY_EXT, GL_LINE_STRIP_ADJACENCY_EXT,
# GL_TRIANGLES_ADJACENCY_EXT and GL_TRIANGLE_STRIP_ADJACENCY_EXT. They
# get the same values but with different formatting (0xD vs 0x000D).
# https://crbug.com/783666
"compositor/gpu_output_surface_mac.cc",
]
}
deps += [
"//components/viz/service",
"//ui/compositor",
......
// 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 "content/browser/compositor/gpu_output_surface_mac.h"
#include "components/viz/service/display/output_surface_client.h"
#include "components/viz/service/display/output_surface_frame.h"
#include "components/viz/service/display_embedder/compositor_overlay_candidate_validator.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "services/ws/public/cpp/gpu/context_provider_command_buffer.h"
namespace content {
GpuOutputSurfaceMac::GpuOutputSurfaceMac(
scoped_refptr<ws::ContextProviderCommandBuffer> context,
gpu::SurfaceHandle surface_handle,
std::unique_ptr<viz::CompositorOverlayCandidateValidator>
overlay_candidate_validator,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager)
: GpuSurfacelessBrowserCompositorOutputSurface(
std::move(context),
surface_handle,
std::move(overlay_candidate_validator),
gfx::BufferFormat::RGBA_8888,
gpu_memory_buffer_manager) {}
GpuOutputSurfaceMac::~GpuOutputSurfaceMac() {}
} // namespace content
// 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.
#ifndef CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
#define CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
#include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h"
#include "ui/gfx/native_widget_types.h"
namespace content {
class GpuOutputSurfaceMac
: public GpuSurfacelessBrowserCompositorOutputSurface {
public:
GpuOutputSurfaceMac(scoped_refptr<ws::ContextProviderCommandBuffer> context,
gpu::SurfaceHandle surface_handle,
std::unique_ptr<viz::CompositorOverlayCandidateValidator>
overlay_candidate_validator,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
~GpuOutputSurfaceMac() override;
private:
DISALLOW_COPY_AND_ASSIGN(GpuOutputSurfaceMac);
};
} // namespace content
#endif // CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
......@@ -76,19 +76,7 @@
#include "ui/gfx/switches.h"
#include "ui/gl/gl_switches.h"
#if defined(USE_AURA)
#include "content/public/common/service_manager_connection.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
#endif
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "components/viz/service/display_embedder/compositor_overlay_candidate_validator_win.h"
#include "components/viz/service/display_embedder/output_device_backing.h"
#include "components/viz/service/display_embedder/software_output_device_win.h"
#include "ui/gfx/win/rendering_window_manager.h"
#elif defined(USE_OZONE)
#if defined(USE_OZONE)
#include "components/viz/service/display_embedder/compositor_overlay_candidate_validator_ozone.h"
#include "components/viz/service/display_embedder/software_output_device_ozone.h"
#include "ui/ozone/public/overlay_candidates_ozone.h"
......@@ -100,12 +88,6 @@
#include "ui/ozone/public/surface_ozone_canvas.h"
#elif defined(USE_X11)
#include "components/viz/service/display_embedder/software_output_device_x11.h"
#elif defined(OS_MACOSX)
#include "components/viz/service/display_embedder/compositor_overlay_candidate_validator_mac.h"
#include "components/viz/service/display_embedder/software_output_device_mac.h"
#include "content/browser/compositor/gpu_output_surface_mac.h"
#include "ui/base/cocoa/remote_layer_api.h"
#include "ui/base/ui_base_switches.h"
#endif
#if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
#include "gpu/ipc/common/gpu_surface_tracker.h"
......@@ -131,13 +113,6 @@ constexpr char kIdentityUrl[] =
constexpr gpu::SchedulingPriority kStreamPriority =
content::kGpuStreamPriorityUI;
#if defined(OS_MACOSX)
bool IsCALayersDisabledFromCommandLine() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kDisableMacOverlays);
}
#endif
} // namespace
namespace content {
......@@ -187,9 +162,6 @@ GpuProcessTransportFactory::GpuProcessTransportFactory(
task_graph_runner_->Start("CompositorTileWorker1",
base::SimpleThread::Options());
#if defined(OS_WIN)
software_backing_ = std::make_unique<viz::OutputDeviceBacking>();
#endif
if (command_line->HasSwitch(switches::kDisableGpu) ||
command_line->HasSwitch(switches::kDisableGpuCompositing)) {
......@@ -218,9 +190,7 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice(
return base::WrapUnique(new viz::SoftwareOutputDevice);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if defined(OS_WIN)
return CreateSoftwareOutputDeviceWinBrowser(widget, software_backing_.get());
#elif defined(USE_OZONE)
#if defined(USE_OZONE)
ui::SurfaceFactoryOzone* factory =
ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
std::unique_ptr<ui::PlatformWindowSurface> platform_window_surface =
......@@ -232,8 +202,6 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice(
std::move(platform_window_surface), std::move(surface_ozone));
#elif defined(USE_X11)
return std::make_unique<viz::SoftwareOutputDeviceX11>(widget);
#elif defined(OS_MACOSX)
return std::make_unique<viz::SoftwareOutputDeviceMac>(std::move(task_runner));
#else
NOTREACHED();
return std::unique_ptr<viz::SoftwareOutputDevice>();
......@@ -241,13 +209,7 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice(
}
std::unique_ptr<viz::CompositorOverlayCandidateValidator>
CreateOverlayCandidateValidator(
#if defined(OS_MACOSX)
gfx::AcceleratedWidget widget,
bool disable_overlay_ca_layers) {
#else
gfx::AcceleratedWidget widget) {
#endif
CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) {
std::unique_ptr<viz::CompositorOverlayCandidateValidator> validator;
#if defined(USE_OZONE)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
......@@ -269,18 +231,6 @@ CreateOverlayCandidateValidator(
std::move(overlay_candidates),
viz::ParseOverlayStategies(enable_overlay_flag)));
}
#elif defined(OS_MACOSX)
// Overlays are only supported through the remote layer API.
if (ui::RemoteLayerAPISupported()) {
static bool overlays_disabled_at_command_line =
IsCALayersDisabledFromCommandLine();
const bool ca_layers_disabled =
overlays_disabled_at_command_line || disable_overlay_ca_layers;
validator.reset(
new viz::CompositorOverlayCandidateValidatorMac(ca_layers_disabled));
}
#elif defined(OS_WIN)
validator = std::make_unique<viz::CompositorOverlayCandidateValidatorWin>();
#endif
return validator;
......@@ -299,11 +249,6 @@ void GpuProcessTransportFactory::CreateLayerTreeFrameSink(
data->display_output_surface = nullptr;
}
#if defined(OS_WIN)
gfx::RenderingWindowManager::GetInstance()->UnregisterParent(
compositor->widget());
#endif
const bool use_gpu_compositing =
!compositor->force_software_compositor() && !is_gpu_compositing_disabled_;
if (use_gpu_compositing) {
......@@ -350,11 +295,6 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
support_stencil = true;
#endif
#if defined(OS_WIN)
gfx::RenderingWindowManager::GetInstance()->RegisterParent(
compositor->widget());
#endif
scoped_refptr<ws::ContextProviderCommandBuffer> context_provider;
if (!use_gpu_compositing) {
......@@ -455,16 +395,6 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
context_provider,
std::unique_ptr<viz::CompositorOverlayCandidateValidator>());
} else if (capabilities.surfaceless) {
#if defined(OS_MACOSX)
const auto& gpu_feature_info = context_provider->GetGpuFeatureInfo();
bool disable_overlay_ca_layers =
gpu_feature_info.IsWorkaroundEnabled(gpu::DISABLE_OVERLAY_CA_LAYERS);
display_output_surface = std::make_unique<GpuOutputSurfaceMac>(
context_provider, data->surface_handle,
CreateOverlayCandidateValidator(compositor->widget(),
disable_overlay_ca_layers),
GetGpuMemoryBufferManager());
#else
DCHECK(capabilities.texture_format_bgra8888);
auto gpu_output_surface =
std::make_unique<GpuSurfacelessBrowserCompositorOutputSurface>(
......@@ -473,20 +403,9 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
display::DisplaySnapshot::PrimaryFormat(),
GetGpuMemoryBufferManager());
display_output_surface = std::move(gpu_output_surface);
#endif
} else {
std::unique_ptr<viz::CompositorOverlayCandidateValidator> validator;
#if defined(OS_WIN)
const bool use_overlays_for_sw_protected_video =
base::FeatureList::IsEnabled(
features::kUseDCOverlaysForSoftwareProtectedVideo);
if (capabilities.dc_layers && (capabilities.use_dc_overlays_for_video ||
use_overlays_for_sw_protected_video))
validator = CreateOverlayCandidateValidator(compositor->widget());
#elif !defined(OS_MACOSX)
// Overlays are only supported on surfaceless output surfaces on Mac.
validator = CreateOverlayCandidateValidator(compositor->widget());
#endif
std::unique_ptr<viz::CompositorOverlayCandidateValidator> validator =
CreateOverlayCandidateValidator(compositor->widget());
auto gpu_output_surface =
std::make_unique<GpuBrowserCompositorOutputSurface>(
context_provider, std::move(validator));
......@@ -684,10 +603,6 @@ void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) {
for (auto& observer : observer_list_)
observer.OnLostSharedContext();
}
#if defined(OS_WIN)
gfx::RenderingWindowManager::GetInstance()->UnregisterParent(
compositor->widget());
#endif
}
gpu::GpuMemoryBufferManager*
......
......@@ -40,7 +40,6 @@ class GpuChannelEstablishFactory;
namespace viz {
class CompositingModeReporterImpl;
class OutputDeviceBacking;
class RasterContextProvider;
class ServerSharedBitmapManager;
class SoftwareOutputDevice;
......@@ -146,11 +145,6 @@ class GpuProcessTransportFactory : public ui::ContextFactory,
viz::FrameSinkIdAllocator frame_sink_id_allocator_;
#if defined(OS_WIN)
// Used by output surface, stored in PerCompositorData.
std::unique_ptr<viz::OutputDeviceBacking> software_backing_;
#endif
// Depends on SurfaceManager.
typedef std::map<ui::Compositor*, std::unique_ptr<PerCompositorData>>
PerCompositorDataMap;
......
......@@ -493,9 +493,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// Send updated vsync parameters to the top level display.
void UpdateDisplayVSyncParameters();
// Adds/Removes frame observer based on state.
void UpdateNeedsBeginFramesInternal();
void SendSyntheticWheelEventWithPhaseEnded(
blink::WebMouseWheelEvent wheel_event,
bool should_route_event);
......@@ -575,9 +572,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// Display link for getting vsync info.
scoped_refptr<ui::DisplayLinkMac> display_link_;
// Whether a request for begin frames has been issued.
bool needs_begin_frames_;
// Whether or not the background is opaque as determined by calls to
// SetBackgroundColor. The default value is opaque.
bool background_is_opaque_ = true;
......
......@@ -87,7 +87,6 @@ void RenderWidgetHostViewMac::BrowserCompositorMacOnBeginFrame(
// ProgressFling must get called for middle click autoscroll fling on Mac.
if (host())
host()->ProgressFlingIfNeeded(frame_time);
UpdateNeedsBeginFramesInternal();
}
void RenderWidgetHostViewMac::OnFrameTokenChanged(uint32_t frame_token) {
......@@ -212,8 +211,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
GetFrameSinkId(), this);
}
bool needs_begin_frames = true;
RenderWidgetHostOwnerDelegate* owner_delegate = host()->owner_delegate();
if (owner_delegate) {
// TODO(mostynb): actually use prefs. Landing this as a separate CL
......@@ -221,29 +218,12 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
// NOTE: This will not be run for child frame widgets, which do not have
// an owner delegate and won't get a RenderViewHost here.
ignore_result(owner_delegate->GetWebkitPreferencesForWidget());
needs_begin_frames = !owner_delegate->IsNeverVisible();
}
cursor_manager_.reset(new CursorManager(this));
if (GetTextInputManager())
GetTextInputManager()->AddObserver(this);
// When Viz Display Compositor is not active, RenderWidgetHostViewMac is
// responsible for handling BeginFrames.
//
// Because of the way Mac pumps messages during resize, SetNeedsBeginFrame
// messages are not delayed on Mac. This leads to creation-time raciness
// where renderer sends a SetNeedsBeginFrame(true) before the renderer host is
// created to receive it.
//
// Any renderer that will produce frames needs to have begin frames sent to
// it. So unless it is never visible, start this value at true here to avoid
// startup raciness and decrease latency.
if (!features::IsVizDisplayCompositorEnabled()) {
needs_begin_frames_ = needs_begin_frames;
UpdateNeedsBeginFramesInternal();
}
}
RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
......@@ -869,12 +849,7 @@ void RenderWidgetHostViewMac::EnsureSurfaceSynchronizedForWebTest() {
}
void RenderWidgetHostViewMac::SetNeedsBeginFrames(bool needs_begin_frames) {
needs_begin_frames_ = needs_begin_frames;
UpdateNeedsBeginFramesInternal();
}
void RenderWidgetHostViewMac::UpdateNeedsBeginFramesInternal() {
browser_compositor_->SetNeedsBeginFrames(needs_begin_frames_);
NOTREACHED();
}
void RenderWidgetHostViewMac::OnDidUpdateVisualPropertiesComplete(
......
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