summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 23:54:51 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 23:54:51 +0000
commit75c023cd5170f47a2e19fd4d77f7e404b3c22e91 (patch)
tree66bd5ec390b457efa85c4ed63b631d74b5b13e86 /gpu
parent83bfbb4c3cff5341236817b2e0e0d69254f29a61 (diff)
downloadchromium_src-75c023cd5170f47a2e19fd4d77f7e404b3c22e91.zip
chromium_src-75c023cd5170f47a2e19fd4d77f7e404b3c22e91.tar.gz
chromium_src-75c023cd5170f47a2e19fd4d77f7e404b3c22e91.tar.bz2
Work around NVIDIA driver bug on Mac OS X 10.6 causing GPU process
crashes during resizing. Explicitly delete and re-create the FBO associated with the "saved texture", to give the driver a hint that drawing commands targeting the old texture must be flushed. (Re-land of http://codereview.chromium.org/7685024/ with gpu_unittest fixes.) BUG=89557 TEST=none (manually resized window with test case from bug; no crashes) Review URL: http://codereview.chromium.org/7711020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97776 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc20
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc6
2 files changed, 25 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 5e500bb..c357913 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -15,6 +15,9 @@
#include "base/atomicops.h"
#include "base/at_exit.h"
#include "base/callback.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
@@ -1319,6 +1322,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
bool has_arb_robustness_;
GLenum reset_status_;
+ bool needs_mac_nvidia_driver_workaround_;
+
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
};
@@ -1680,7 +1685,8 @@ GLES2DecoderImpl::GLES2DecoderImpl(SurfaceManager* surface_manager,
tex_image_2d_failed_(false),
frame_number_(0),
has_arb_robustness_(false),
- reset_status_(GL_NO_ERROR) {
+ reset_status_(GL_NO_ERROR),
+ needs_mac_nvidia_driver_workaround_(false) {
DCHECK(group);
attrib_0_value_.v[0] = 0.0f;
@@ -1934,6 +1940,14 @@ bool GLES2DecoderImpl::Initialize(
has_arb_robustness_ = context->HasExtension("GL_ARB_robustness");
+#if defined(OS_MACOSX)
+ const char* vendor_str = reinterpret_cast<const char*>(
+ glGetString(GL_VENDOR));
+ needs_mac_nvidia_driver_workaround_ =
+ vendor_str && strstr(vendor_str, "NVIDIA") &&
+ base::mac::IsOSSnowLeopardOrEarlier();
+#endif
+
if (!InitializeShaderTranslator()) {
return false;
}
@@ -2516,6 +2530,10 @@ bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) {
RestoreClearState();
}
+ // Workaround for driver bug on OS X 10.6.x and earlier; crbug.com/89557
+ if (needs_mac_nvidia_driver_workaround_)
+ offscreen_saved_frame_buffer_->Create();
+
// Allocate the offscreen saved color texture.
DCHECK(offscreen_saved_color_format_);
offscreen_saved_color_texture_->AllocateStorage(
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 41e42ad0..d20daa9 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -150,6 +150,12 @@ void GLES2DecoderTestBase::InitDecoder(
.Times(1)
.RetiresOnSaturation();
+#if defined(OS_MACOSX)
+ EXPECT_CALL(*gl_, GetString(GL_VENDOR))
+ .Times(1)
+ .RetiresOnSaturation();
+#endif
+
engine_.reset(new StrictMock<MockCommandBufferEngine>());
Buffer buffer = engine_->GetSharedMemoryBuffer(kSharedMemoryId);
shared_memory_offset_ = kSharedMemoryOffset;