Skip to content

Commit

Permalink
Remove driver bug workarounds from Capabilities.
Browse files Browse the repository at this point in the history
It's a hack way to share these info bits from GPU to Renderer through
Capabilities. Now we share properly through GpuFeatureInfo, these bits
in Capabilities are just duplicates and should be removed.

BUG=744658
TEST=bots
R=piman@chromium.org,kbr@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I6b68cd902617127561e6469179bd2d447d08eba8
Reviewed-on: https://chromium-review.googlesource.com/714156
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508495}
  • Loading branch information
zhenyao authored and Commit Bot committed Oct 12, 2017
1 parent 4afbd51 commit fc5c7b8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 46 deletions.
9 changes: 7 additions & 2 deletions content/browser/compositor/gpu_process_transport_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "gpu/ipc/host/gpu_memory_buffer_support.h"
#include "gpu/vulkan/features.h"
Expand Down Expand Up @@ -540,11 +542,14 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
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 = base::MakeUnique<GpuOutputSurfaceMac>(
compositor->widget(), context_provider, data->surface_handle,
vsync_callback,
CreateOverlayCandidateValidator(
compositor->widget(), capabilities.disable_overlay_ca_layers),
CreateOverlayCandidateValidator(compositor->widget(),
disable_overlay_ca_layers),
GetGpuMemoryBufferManager());
#else
auto gpu_output_surface =
Expand Down
11 changes: 0 additions & 11 deletions gpu/command_buffer/common/capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ struct GPU_EXPORT Capabilities {
bool flips_vertically = false;
bool msaa_is_slow = false;
bool disable_one_component_textures = false;
bool disable_multisampling_color_mask_usage = false;
bool disable_webgl_rgb_multisampling_usage = false;
bool gpu_rasterization = false;
bool avoid_stencil_buffers = false;
bool multisample_compatibility = false;
Expand All @@ -168,19 +166,10 @@ struct GPU_EXPORT Capabilities {
// details.
bool chromium_image_rgb_emulation = false;

// When true, RGB framebuffer formats are unsupported. Emulate with RGBA to
// work around this. See https://crbug.com/449150 for an example.
bool emulate_rgb_buffer_with_rgba = false;

// When true, is safe to convert a canvas from software to accelerated.
// See https://crbug.com/710029.
bool software_to_accelerated_canvas_upgrade = true;

// When true, non-empty post sub buffer calls are unsupported.
bool disable_non_empty_post_sub_buffers = false;

bool disable_2d_canvas_copy_on_write = false;
bool disable_overlay_ca_layers = false;

bool texture_npot = false;

Expand Down
14 changes: 1 addition & 13 deletions gpu/command_buffer/service/gles2_cmd_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3923,20 +3923,11 @@ Capabilities GLES2DecoderImpl::GetCapabilities() {
caps.occlusion_query = feature_info_->feature_flags().occlusion_query;
caps.occlusion_query_boolean =
feature_info_->feature_flags().occlusion_query_boolean;
caps.timer_queries =
query_manager_->GPUTimingAvailable();
caps.disable_multisampling_color_mask_usage =
workarounds().disable_multisampling_color_mask_usage;
caps.timer_queries = query_manager_->GPUTimingAvailable();
caps.gpu_rasterization =
group_->gpu_feature_info()
.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] ==
kGpuFeatureStatusEnabled;
caps.disable_webgl_rgb_multisampling_usage =
workarounds().disable_webgl_rgb_multisampling_usage;
caps.software_to_accelerated_canvas_upgrade =
!workarounds().disable_software_to_accelerated_canvas_upgrade;
caps.emulate_rgb_buffer_with_rgba =
workarounds().disable_gl_rgb_format;
if (workarounds().disable_non_empty_post_sub_buffers_for_onscreen_surfaces &&
!surface_->IsOffscreen()) {
caps.disable_non_empty_post_sub_buffers = true;
Expand All @@ -3945,9 +3936,6 @@ Capabilities GLES2DecoderImpl::GetCapabilities() {
group_->gpu_preferences().enable_threaded_texture_mailboxes) {
caps.disable_2d_canvas_copy_on_write = true;
}
if (workarounds().disable_overlay_ca_layers) {
caps.disable_overlay_ca_layers = true;
}
caps.texture_npot = feature_info_->feature_flags().npot_ok;

return caps;
Expand Down
5 changes: 0 additions & 5 deletions gpu/ipc/common/gpu_command_buffer_traits_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,15 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities)
IPC_STRUCT_TRAITS_MEMBER(timer_queries)
IPC_STRUCT_TRAITS_MEMBER(surfaceless)
IPC_STRUCT_TRAITS_MEMBER(flips_vertically)
IPC_STRUCT_TRAITS_MEMBER(disable_multisampling_color_mask_usage)
IPC_STRUCT_TRAITS_MEMBER(disable_webgl_rgb_multisampling_usage)
IPC_STRUCT_TRAITS_MEMBER(msaa_is_slow)
IPC_STRUCT_TRAITS_MEMBER(disable_one_component_textures)
IPC_STRUCT_TRAITS_MEMBER(gpu_rasterization)
IPC_STRUCT_TRAITS_MEMBER(chromium_image_rgb_emulation)
IPC_STRUCT_TRAITS_MEMBER(emulate_rgb_buffer_with_rgba)
IPC_STRUCT_TRAITS_MEMBER(software_to_accelerated_canvas_upgrade)
IPC_STRUCT_TRAITS_MEMBER(dc_layers)
IPC_STRUCT_TRAITS_MEMBER(use_dc_overlays_for_video)
IPC_STRUCT_TRAITS_MEMBER(disable_non_empty_post_sub_buffers)
IPC_STRUCT_TRAITS_MEMBER(avoid_stencil_buffers)
IPC_STRUCT_TRAITS_MEMBER(disable_2d_canvas_copy_on_write)
IPC_STRUCT_TRAITS_MEMBER(disable_overlay_ca_layers)
IPC_STRUCT_TRAITS_MEMBER(texture_npot)

IPC_STRUCT_TRAITS_MEMBER(major_version)
Expand Down
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/platform/graphics/gpu/DEPS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_rules = [
# For tests only!
"+gpu/command_buffer/client/gles2_interface_stub.h",
"+gpu/command_buffer/common/capabilities.h",
"+gpu/command_buffer/common/gpu_memory_buffer_support.h",
"+gpu/config/gpu_driver_bug_workaround_type.h",
"+gpu/config/gpu_feature_info.h"
]
21 changes: 11 additions & 10 deletions third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "gpu/config/gpu_feature_info.h"
#include "platform/graphics/AcceleratedStaticBitmapImage.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/graphics/ImageBuffer.h"
Expand Down Expand Up @@ -239,7 +241,8 @@ bool DrawingBuffer::DefaultBufferRequiresAlphaChannelToBePreserved() {
}

bool rgb_emulation =
ContextProvider()->GetCapabilities().emulate_rgb_buffer_with_rgba ||
ContextProvider()->GetGpuFeatureInfo().IsWorkaroundEnabled(
gpu::DISABLE_GL_RGB_FORMAT) ||
(ShouldUseChromiumImage() &&
ContextProvider()->GetCapabilities().chromium_image_rgb_emulation);
return !want_alpha_channel_ && rgb_emulation;
Expand Down Expand Up @@ -573,9 +576,8 @@ DrawingBuffer::TextureColorBufferParameters() {
parameters.target = GL_TEXTURE_2D;
if (want_alpha_channel_) {
parameters.allocate_alpha_channel = true;
} else if (ContextProvider()
->GetCapabilities()
.emulate_rgb_buffer_with_rgba) {
} else if (ContextProvider()->GetGpuFeatureInfo().IsWorkaroundEnabled(
gpu::DISABLE_GL_RGB_FORMAT)) {
parameters.allocate_alpha_channel = true;
} else {
parameters.allocate_alpha_channel =
Expand Down Expand Up @@ -1035,9 +1037,8 @@ void DrawingBuffer::ResolveMultisampleFramebufferInternal() {
// multisampled renderbuffers and the alpha channel can be overwritten.
// Clear the alpha channel of |m_fbo|.
if (DefaultBufferRequiresAlphaChannelToBePreserved() &&
ContextProvider()
->GetCapabilities()
.disable_multisampling_color_mask_usage) {
ContextProvider()->GetGpuFeatureInfo().IsWorkaroundEnabled(
gpu::DISABLE_MULTISAMPLING_COLOR_MASK_USAGE)) {
gl_->ClearColor(0, 0, 0, 1);
gl_->ColorMask(false, false, false, true);
gl_->Clear(GL_COLOR_BUFFER_BIT);
Expand Down Expand Up @@ -1310,10 +1311,10 @@ GLenum DrawingBuffer::GetMultisampledRenderbufferFormat() {
if (ShouldUseChromiumImage() &&
ContextProvider()->GetCapabilities().chromium_image_rgb_emulation)
return GL_RGBA8_OES;
if (ContextProvider()
->GetCapabilities()
.disable_webgl_rgb_multisampling_usage)
if (ContextProvider()->GetGpuFeatureInfo().IsWorkaroundEnabled(
gpu::DISABLE_WEBGL_RGB_MULTISAMPLING_USAGE)) {
return GL_RGBA8_OES;
}
return GL_RGB8_OES;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include "platform/graphics/gpu/SharedGpuContext.h"

#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "gpu/config/gpu_feature_info.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/WaitableEvent.h"
#include "platform/WebTaskRunner.h"
Expand Down Expand Up @@ -111,9 +112,10 @@ bool SharedGpuContext::AllowSoftwareToAcceleratedCanvasUpgrade() {
this_ptr->CreateContextProviderIfNeeded();
if (!this_ptr->context_provider_wrapper_)
return false;
return this_ptr->context_provider_wrapper_->ContextProvider()
->GetCapabilities()
.software_to_accelerated_canvas_upgrade;
return !this_ptr->context_provider_wrapper_->ContextProvider()
->GetGpuFeatureInfo()
.IsWorkaroundEnabled(
gpu::DISABLE_SOFTWARE_TO_ACCELERATED_CANVAS_UPGRADE);
}

} // blink

0 comments on commit fc5c7b8

Please sign in to comment.