Skip to content

Commit

Permalink
MacViews: Enable GPU rasterization (where available)
Browse files Browse the repository at this point in the history
This should relieve pressure on the browser's UI thread.

Disallow anonymous GLImages when GpuMemoryBuffers are disabled
(several tests would attempt to use this path while it was
disabled, and crash).

Add a NOTREACHED to cc::TestImageFactory, so that such failures
are easier to diagnose in the future.

Bug: 845213
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ibaf017e9ee3c22b3391fe2d2b47b82c8fbff8e93
Reviewed-on: https://chromium-review.googlesource.com/1076531
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: enne <enne@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562696}
  • Loading branch information
ccameron-chromium authored and Commit Bot committed May 30, 2018
1 parent b21ce44 commit 7b38a45
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
10 changes: 10 additions & 0 deletions cc/test/test_image_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@ scoped_refptr<gl::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer(
return image;
}

scoped_refptr<gl::GLImage> TestImageFactory::CreateAnonymousImage(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
unsigned internalformat,
bool* is_cleared) {
NOTREACHED();
return nullptr;
}

} // namespace cc
5 changes: 5 additions & 0 deletions cc/test/test_image_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class TestImageFactory : public gpu::ImageFactory {
unsigned internalformat,
int client_id,
gpu::SurfaceHandle surface_handle) override;
scoped_refptr<gl::GLImage> CreateAnonymousImage(const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
unsigned internalformat,
bool* is_cleared) override;

private:
DISALLOW_COPY_AND_ASSIGN(TestImageFactory);
Expand Down
7 changes: 4 additions & 3 deletions gpu/command_buffer/service/feature_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,15 @@ void FeatureInfo::InitializeFeatures() {
// so the extension string is always exposed.
AddExtensionString("GL_OES_vertex_array_object");

if (!disallowed_features_.gpu_memory_manager) {
// Texture storage image is only usable with native gpu memory buffer support.
#if defined(OS_MACOSX) || (defined(OS_LINUX) && defined(USE_OZONE))
feature_flags_.chromium_texture_storage_image = true;
AddExtensionString("GL_CHROMIUM_texture_storage_image");
feature_flags_.chromium_texture_storage_image = true;
AddExtensionString("GL_CHROMIUM_texture_storage_image");
#endif

if (!disallowed_features_.gpu_memory_manager)
AddExtensionString("GL_CHROMIUM_gpu_memory_manager");
}

if (gl::HasExtension(extensions, "GL_ANGLE_translated_shader_source")) {
feature_flags_.angle_translated_shader_source = true;
Expand Down
7 changes: 6 additions & 1 deletion ui/base/ui_base_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ bool IsNotificationIndicatorEnabled() {

// Enables GPU rasterization for all UI drawing (where not blacklisted).
const base::Feature kUiGpuRasterization = {"UiGpuRasterization",
base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_MACOSX)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};

bool IsUiGpuRasterizationEnabled() {
return base::FeatureList::IsEnabled(kUiGpuRasterization);
Expand Down

0 comments on commit 7b38a45

Please sign in to comment.