| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| 6 | 6 |
| 7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
| 8 #include <OpenGL/OpenGL.h> | 8 #include <OpenGL/OpenGL.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if (!initialized_workaround) { | 443 if (!initialized_workaround) { |
| 444 force_on_workaround = CommandLine::ForCurrentProcess()->HasSwitch( | 444 force_on_workaround = CommandLine::ForCurrentProcess()->HasSwitch( |
| 445 switches::kForceGLFinishWorkaround); | 445 switches::kForceGLFinishWorkaround); |
| 446 force_off_workaround = CommandLine::ForCurrentProcess()->HasSwitch( | 446 force_off_workaround = CommandLine::ForCurrentProcess()->HasSwitch( |
| 447 switches::kDisableGpuDriverBugWorkarounds); | 447 switches::kDisableGpuDriverBugWorkarounds); |
| 448 | 448 |
| 449 initialized_workaround = true; | 449 initialized_workaround = true; |
| 450 } | 450 } |
| 451 | 451 |
| 452 const bool workaround_needed = | 452 const bool workaround_needed = |
| 453 drawing_context->IsVendorIntel() && !base::mac::IsOSMountainLionOrLater(); | 453 drawing_context->IsVendorIntel() && |
| 454 (!base::mac::IsOSMountainLionOrLater() || base::mac::IsOSMavericks()); |
| 454 const bool use_glfinish_workaround = | 455 const bool use_glfinish_workaround = |
| 455 (workaround_needed || force_on_workaround) && !force_off_workaround; | 456 (workaround_needed || force_on_workaround) && !force_off_workaround; |
| 456 | 457 |
| 457 if (use_glfinish_workaround) { | 458 if (use_glfinish_workaround) { |
| 458 TRACE_EVENT0("gpu", "glFinish"); | 459 TRACE_EVENT0("gpu", "glFinish"); |
| 459 // http://crbug.com/123409 : work around bugs in graphics driver on | 460 // http://crbug.com/123409 : work around bugs in graphics driver on |
| 460 // MacBook Air with Intel HD graphics, and possibly on other models, | 461 // MacBook Air with Intel HD graphics, and possibly on other models, |
| 461 // by forcing the graphics pipeline to be completely drained at this | 462 // by forcing the graphics pipeline to be completely drained at this |
| 462 // point. | 463 // point. This workaround is not necessary on Mountain Lion. |
| 463 // This workaround is not necessary on Mountain Lion. | 464 // http://crbug.com/318877 : work around a bug where the window does |
| 465 // not finish rendering its contents before displaying them on Mavericks |
| 466 // on Retina MacBook Pro when using the Intel HD graphics GPU. |
| 464 glFinish(); | 467 glFinish(); |
| 465 } | 468 } |
| 466 | 469 |
| 467 base::Closure copy_done_callback; | 470 base::Closure copy_done_callback; |
| 468 if (frame_subscriber) { | 471 if (frame_subscriber) { |
| 469 const base::Time present_time = base::Time::Now(); | 472 const base::Time present_time = base::Time::Now(); |
| 470 scoped_refptr<media::VideoFrame> frame; | 473 scoped_refptr<media::VideoFrame> frame; |
| 471 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; | 474 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; |
| 472 if (frame_subscriber->ShouldCaptureFrame(present_time, &frame, &callback)) { | 475 if (frame_subscriber->ShouldCaptureFrame(present_time, &frame, &callback)) { |
| 473 copy_done_callback = CopyToVideoFrameWithinContext( | 476 copy_done_callback = CopyToVideoFrameWithinContext( |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 } | 1039 } |
| 1037 | 1040 |
| 1038 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { | 1041 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { |
| 1039 GLenum gl_error = glGetError(); | 1042 GLenum gl_error = glGetError(); |
| 1040 if (gl_error_ == GL_NO_ERROR) | 1043 if (gl_error_ == GL_NO_ERROR) |
| 1041 gl_error_ = gl_error; | 1044 gl_error_ = gl_error; |
| 1042 return gl_error; | 1045 return gl_error; |
| 1043 } | 1046 } |
| 1044 | 1047 |
| 1045 } // namespace content | 1048 } // namespace content |
| OLD | NEW |