Commit 43fd1f40 authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

Android OOP-D: Pass alpha preferences to VizProcessContextProvider

Currently VizProcessContextProvider assumes no alpha. Android needs
alpha in cases where it is rendering on top of a video overlay. Plumb
the alpha request through via RendererSettings.

Bug: 869131
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I6c51a07b141e61d95b2e25183156ebf15daeca38
Reviewed-on: https://chromium-review.googlesource.com/1155715Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580015}
parent bcfda9cf
......@@ -312,7 +312,8 @@ void PixelTest::SetUpSkiaRendererDDL() {
base::MakeRefCounted<viz::VizProcessContextProvider>(
task_executor_, gpu::kNullSurfaceHandle,
gpu_memory_buffer_manager_.get(), image_factory,
gpu_channel_manager_delegate, gpu::SharedMemoryLimits());
gpu_channel_manager_delegate, gpu::SharedMemoryLimits(),
false /* requires_alpha_channel */);
child_context_provider_->BindToCurrentThread();
child_resource_provider_ =
std::make_unique<viz::ClientResourceProvider>(true);
......
......@@ -34,6 +34,7 @@ class VIZ_COMMON_EXPORT RendererSettings {
bool dont_round_texture_sizes_for_pixel_tests = false;
int highp_threshold_min = 0;
bool auto_resize_output_surface = true;
bool requires_alpha_channel = false;
int slow_down_compositing_scale_factor = 1;
......
......@@ -136,7 +136,7 @@ std::unique_ptr<Display> GpuDisplayProvider::CreateDisplay(
context_provider = base::MakeRefCounted<VizProcessContextProvider>(
task_executor_, surface_handle, gpu_memory_buffer_manager_.get(),
image_factory_, gpu_channel_manager_delegate_,
gpu::SharedMemoryLimits());
gpu::SharedMemoryLimits(), renderer_settings.requires_alpha_channel);
context_result = context_provider->BindToCurrentThread();
if (context_result == gpu::ContextResult::kFatalFailure) {
......
......@@ -39,9 +39,9 @@ namespace viz {
namespace {
gpu::ContextCreationAttribs CreateAttributes() {
gpu::ContextCreationAttribs CreateAttributes(bool requires_alpha_channel) {
gpu::ContextCreationAttribs attributes;
attributes.alpha_size = -1;
attributes.alpha_size = requires_alpha_channel ? 8 : -1;
attributes.depth_size = 0;
#if defined(OS_CHROMEOS)
// Chrome OS uses surfaceless when running on a real device and stencil
......@@ -73,8 +73,9 @@ VizProcessContextProvider::VizProcessContextProvider(
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory,
gpu::GpuChannelManagerDelegate* gpu_channel_manager_delegate,
const gpu::SharedMemoryLimits& limits)
: attributes_(CreateAttributes()),
const gpu::SharedMemoryLimits& limits,
bool requires_alpha_channel)
: attributes_(CreateAttributes(requires_alpha_channel)),
context_(std::make_unique<gpu::GLInProcessContext>()),
context_result_(
context_->Initialize(std::move(task_executor),
......
......@@ -48,7 +48,8 @@ class VIZ_SERVICE_EXPORT VizProcessContextProvider
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory,
gpu::GpuChannelManagerDelegate* gpu_channel_manager_delegate,
const gpu::SharedMemoryLimits& limits);
const gpu::SharedMemoryLimits& limits,
bool requires_alpha_channel);
// ContextProvider implementation.
void AddRef() const override;
......
......@@ -1295,6 +1295,7 @@ void CompositorImpl::InitializeVizLayerTreeFrameSink(
viz::RendererSettings renderer_settings;
renderer_settings.allow_antialiasing = false;
renderer_settings.highp_threshold_min = 2048;
renderer_settings.requires_alpha_channel = requires_alpha_channel_;
root_params->frame_sink_id = frame_sink_id_;
root_params->widget = surface_handle_;
root_params->gpu_compositing = true;
......
......@@ -20,4 +20,5 @@ struct RendererSettings {
bool use_skia_renderer;
bool use_skia_deferred_display_list;
bool allow_overlays;
bool requires_alpha_channel;
};
......@@ -28,6 +28,7 @@ bool StructTraits<viz::mojom::RendererSettingsDataView, viz::RendererSettings>::
out->use_skia_renderer = data.use_skia_renderer();
out->use_skia_deferred_display_list = data.use_skia_deferred_display_list();
out->allow_overlays = data.allow_overlays();
out->requires_alpha_channel = data.requires_alpha_channel();
return true;
}
......
......@@ -76,6 +76,10 @@ struct StructTraits<viz::mojom::RendererSettingsDataView,
return input.allow_overlays;
}
static bool requires_alpha_channel(const viz::RendererSettings& input) {
return input.requires_alpha_channel;
}
static bool Read(viz::mojom::RendererSettingsDataView data,
viz::RendererSettings* out);
};
......
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