summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorericrk <ericrk@chromium.org>2016-03-18 14:44:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 21:45:56 +0000
commitd72af43d432d9def9ce591b7167c19b7b1581e30 (patch)
tree811d9218dc7488e56e28aec2f29e2a001fe31575 /cc
parent6f495a8a85da6d8e34cc649e091033e8a441d846 (diff)
downloadchromium_src-d72af43d432d9def9ce591b7167c19b7b1581e30.zip
chromium_src-d72af43d432d9def9ce591b7167c19b7b1581e30.tar.gz
chromium_src-d72af43d432d9def9ce591b7167c19b7b1581e30.tar.bz2
Add CONTEXT_TYPE_OPENGLES2_PEPPER
Adds a new context type for Pepper GL contexts. This allows us to fine tune driver bug workarounds for pepper vs. non-pepper contexts. Currently used to disable the Intel MSAA blacklist on pepper contexts, as it should be up to the app whether to use MSAA. BUG=527565 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1781093002 Cr-Commit-Position: refs/heads/master@{#382097}
Diffstat (limited to 'cc')
-rw-r--r--cc/output/delegating_renderer.cc8
-rw-r--r--cc/output/gl_renderer.cc8
-rw-r--r--cc/test/test_web_graphics_context_3d.h3
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc36
4 files changed, 53 insertions, 2 deletions
diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc
index 365ee85..1bd7d0a 100644
--- a/cc/output/delegating_renderer.cc
+++ b/cc/output/delegating_renderer.cc
@@ -56,7 +56,13 @@ DelegatingRenderer::DelegatingRenderer(RendererClient* client,
capabilities_.using_image = caps.gpu.image;
capabilities_.allow_rasterize_on_demand = false;
- capabilities_.max_msaa_samples = caps.gpu.max_samples;
+
+ // If MSAA is slow, we want this renderer to behave as though MSAA is not
+ // available. Set samples to 0 to achieve this.
+ if (caps.gpu.msaa_is_slow)
+ capabilities_.max_msaa_samples = 0;
+ else
+ capabilities_.max_msaa_samples = caps.gpu.max_samples;
}
}
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 77ff5ca..e264257 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -373,7 +373,13 @@ GLRenderer::GLRenderer(RendererClient* client,
context_caps.gpu.discard_framebuffer;
capabilities_.allow_rasterize_on_demand = true;
- capabilities_.max_msaa_samples = context_caps.gpu.max_samples;
+
+ // If MSAA is slow, we want this renderer to behave as though MSAA is not
+ // available. Set samples to 0 to achieve this.
+ if (context_caps.gpu.msaa_is_slow)
+ capabilities_.max_msaa_samples = 0;
+ else
+ capabilities_.max_msaa_samples = context_caps.gpu.max_samples;
use_sync_query_ = context_caps.gpu.sync_query;
use_blend_equation_advanced_ = context_caps.gpu.blend_equation_advanced;
diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h
index f497ac4..a913eda 100644
--- a/cc/test/test_web_graphics_context_3d.h
+++ b/cc/test/test_web_graphics_context_3d.h
@@ -350,6 +350,9 @@ class TestWebGraphicsContext3D {
void set_support_texture_half_float_linear(bool support) {
test_capabilities_.gpu.texture_half_float_linear = support;
}
+ void set_msaa_is_slow(bool msaa_is_slow) {
+ test_capabilities_.gpu.msaa_is_slow = msaa_is_slow;
+ }
// When this context is lost, all contexts in its share group are also lost.
void add_share_group_context(TestWebGraphicsContext3D* context3d) {
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 5be1b46..9c968bd 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -10188,6 +10188,42 @@ TEST_F(LayerTreeHostImplTest, GpuRasterizationStatusModes) {
EXPECT_TRUE(host_impl_->use_gpu_rasterization());
}
+class MsaaIsSlowLayerTreeHostImplTest : public LayerTreeHostImplTest {
+ public:
+ void CreateHostImplWithMsaaIsSlow(bool msaa_is_slow) {
+ LayerTreeSettings settings = DefaultSettings();
+ settings.gpu_rasterization_enabled = true;
+ settings.gpu_rasterization_msaa_sample_count = 4;
+ auto context_provider = TestContextProvider::Create();
+ context_provider->UnboundTestContext3d()->SetMaxSamples(4);
+ context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow);
+ auto msaa_is_normal_output_surface =
+ FakeOutputSurface::Create3d(context_provider);
+ EXPECT_TRUE(
+ CreateHostImpl(settings, std::move(msaa_is_normal_output_surface)));
+ }
+};
+
+TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) {
+ // Ensure that without the msaa_is_slow cap we raster unsuitable content with
+ // msaa.
+ CreateHostImplWithMsaaIsSlow(false);
+ host_impl_->SetHasGpuRasterizationTrigger(true);
+ host_impl_->SetContentIsSuitableForGpuRasterization(false);
+ EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT,
+ host_impl_->gpu_rasterization_status());
+ EXPECT_TRUE(host_impl_->use_gpu_rasterization());
+
+ // Ensure that with the msaa_is_slow cap we don't raster unsuitable content
+ // with msaa.
+ CreateHostImplWithMsaaIsSlow(true);
+ host_impl_->SetHasGpuRasterizationTrigger(true);
+ host_impl_->SetContentIsSuitableForGpuRasterization(false);
+ EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
+ host_impl_->gpu_rasterization_status());
+ EXPECT_FALSE(host_impl_->use_gpu_rasterization());
+}
+
// A mock output surface which lets us detect calls to ForceReclaimResources.
class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
public: