summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorccameron <ccameron@chromium.org>2015-06-16 12:59:30 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-16 20:00:03 +0000
commitbdc507d4498c61d4c995c82118ab287d0298608f (patch)
tree52e621f432e6541a1b0a8a8228119fd018b1688d
parent8a219eabd69a669085561bcf2106e2e7d63ee83b (diff)
downloadchromium_src-bdc507d4498c61d4c995c82118ab287d0298608f.zip
chromium_src-bdc507d4498c61d4c995c82118ab287d0298608f.tar.gz
chromium_src-bdc507d4498c61d4c995c82118ab287d0298608f.tar.bz2
Mac: Add GPU driver workaround for NSCGLSurface on multi-GPU
The NSCGLSurface API is not reliable on multi-GPU systems. Disallow use of this API multi-GPU systems. BUG=496484 Review URL: https://codereview.chromium.org/1179153004 Cr-Commit-Position: refs/heads/master@{#334668}
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc4
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.h2
-rw-r--r--content/common/gpu/image_transport_surface_calayer_mac.mm9
-rw-r--r--content/common/gpu/image_transport_surface_fbo_mac.h2
-rw-r--r--content/common/gpu/image_transport_surface_fbo_mac.mm5
-rw-r--r--gpu/config/gpu_driver_bug_list_json.cc17
-rw-r--r--gpu/config/gpu_driver_bug_workaround_type.h2
7 files changed, 37 insertions, 4 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index e50de4c..81a6e2c 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -1054,6 +1054,10 @@ gfx::Size GpuCommandBufferStub::GetSurfaceSize() const {
return surface_->GetSize();
}
+const gpu::gles2::FeatureInfo* GpuCommandBufferStub::GetFeatureInfo() const {
+ return context_group_->feature_info();
+}
+
gpu::gles2::MemoryTracker* GpuCommandBufferStub::GetMemoryTracker() const {
return context_group_->memory_tracker();
}
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
index 52f319e..f9e6207 100644
--- a/content/common/gpu/gpu_command_buffer_stub.h
+++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -146,6 +146,8 @@ class GpuCommandBufferStub
void MarkContextLost();
+ const gpu::gles2::FeatureInfo* GetFeatureInfo() const;
+
uint64 GetMemoryUsage() const;
void SendSwapBuffersCompleted(
diff --git a/content/common/gpu/image_transport_surface_calayer_mac.mm b/content/common/gpu/image_transport_surface_calayer_mac.mm
index ac2d8e3..e2c8b43 100644
--- a/content/common/gpu/image_transport_surface_calayer_mac.mm
+++ b/content/common/gpu/image_transport_surface_calayer_mac.mm
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/mac/sdk_forward_declarations.h"
#include "base/trace_event/trace_event.h"
+#include "gpu/config/gpu_info_collector.h"
#include "ui/accelerated_widget_mac/surface_handle_types.h"
#include "ui/base/cocoa/animation_utils.h"
#include "ui/base/ui_base_switches.h"
@@ -24,7 +25,7 @@ const size_t kCanDrawFalsesBeforeSwitchFromAsync = 4;
const base::TimeDelta kMinDeltaToSwitchToAsync =
base::TimeDelta::FromSecondsD(1. / 15.);
-bool CanUseNSCGLSurface() {
+bool CanUseNSCGLSurface(const gpu::gles2::FeatureInfo* feature_info) {
// Respect command line flags for the API's usage.
static bool forced_at_command_line =
base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -55,7 +56,8 @@ bool CanUseNSCGLSurface() {
// will briefly flash during resize, and especially during transitions between
// the iGPU and the dGPU. These problems are exhibited by layer-backed
// NSOpenGLViews as well.
- // TODO(ccameron): Add this check.
+ if (feature_info->workarounds().disable_ns_cgl_surface_api)
+ return false;
// Leave this feature disabled until a flag for it is available.
return false;
@@ -550,7 +552,8 @@ void CALayerStorageProvider::SwapBuffers(const gfx::Rect& dirty_rect) {
// Determine if it is safe to use an NSCGLSurface, or if we should use the
// CAOpenGLLayer fallback. If we're not using the preferred type of layer,
// then reset the layer and re-create one of the preferred type.
- bool can_use_ns_cgl_surface = CanUseNSCGLSurface();
+ bool can_use_ns_cgl_surface =
+ CanUseNSCGLSurface(transport_surface_->GetFeatureInfo());
Class expected_layer_class = can_use_ns_cgl_surface ?
[ImageTransportNSCGLSurface class] : [ImageTransportCAOpenGLLayer class];
if (![layer_ isKindOfClass:expected_layer_class])
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.h b/content/common/gpu/image_transport_surface_fbo_mac.h
index b01bff0..1839264d 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.h
+++ b/content/common/gpu/image_transport_surface_fbo_mac.h
@@ -89,6 +89,8 @@ class ImageTransportSurfaceFBO
float scale_factor);
void SetRendererID(int renderer_id);
+ const gpu::gles2::FeatureInfo* GetFeatureInfo() const;
+
protected:
// ImageTransportSurface implementation
void OnBufferPresented(
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.mm b/content/common/gpu/image_transport_surface_fbo_mac.mm
index 503fac1..e6fcc40 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.mm
+++ b/content/common/gpu/image_transport_surface_fbo_mac.mm
@@ -217,6 +217,11 @@ void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) {
context_->share_group()->SetRendererID(renderer_id);
}
+const gpu::gles2::FeatureInfo* ImageTransportSurfaceFBO::GetFeatureInfo()
+ const {
+ return helper_->stub()->GetFeatureInfo();
+}
+
gfx::SwapResult ImageTransportSurfaceFBO::PostSubBuffer(int x,
int y,
int width,
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc
index 28c102c0..987138e 100644
--- a/gpu/config/gpu_driver_bug_list_json.cc
+++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST(
{
"name": "gpu driver bug list",
// Please update the version number whenever you change this file.
- "version": "8.13",
+ "version": "8.14",
"entries": [
{
"id": 1,
@@ -1441,6 +1441,21 @@ LONG_STRING_CONST(
"features": [
"max_copy_texture_chromium_size_262144"
]
+ },
+ {
+ "id": 121,
+ "description": "NSCGLSurface API is buggy on multi-GPU systems",
+ "cr_bugs": [496484],
+ "os": {
+ "type": "macosx"
+ },
+ "gpu_count": {
+ "op": ">",
+ "value": "1"
+ },
+ "features": [
+ "disable_ns_cgl_surface_api"
+ ]
}
]
}
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h
index 9cf6d05..c5c9b83 100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -40,6 +40,8 @@
disable_multimonitor_multisampling) \
GPU_OP(DISABLE_MULTISAMPLED_RENDER_TO_TEXTURE, \
disable_multisampled_render_to_texture) \
+ GPU_OP(DISABLE_NS_CGL_SURFACE_API, \
+ disable_ns_cgl_surface_api) \
GPU_OP(DISABLE_POST_SUB_BUFFERS_FOR_ONSCREEN_SURFACES, \
disable_post_sub_buffers_for_onscreen_surfaces) \
GPU_OP(ETC1_POWER_OF_TWO_ONLY, \