diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 02:37:40 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 02:37:40 +0000 |
commit | b3239979c58d07fb797d8a9f4260d9a0c4b67186 (patch) | |
tree | bd5a6cc82f27e6dbb62c32de1eac93f924501024 /gpu | |
parent | bbdbafe78bb72d5173f383b8cebca719dcb703d1 (diff) | |
download | chromium_src-b3239979c58d07fb797d8a9f4260d9a0c4b67186.zip chromium_src-b3239979c58d07fb797d8a9f4260d9a0c4b67186.tar.gz chromium_src-b3239979c58d07fb797d8a9f4260d9a0c4b67186.tar.bz2 |
Partial revert of "GPU: Reduce MakeCurrent calls to fix Orange San Diego"
GPU: Reduce MakeCurrent calls to fix Orange San Diego
We have hit several separate issues resulting from calling
MakeCurrent to change surfaces (when using virtual contexts).
This removes most cases of MakeCurrent that aren't needed,
and enables virtual contexts for Orange San Diego.
Original code review: https://codereview.chromium.org/14069008/
The last remaining case is ReleaseCurrent which isn't needed
for the Orange San Diego fix, and will be done in a follow up CL.
BUG=179250, 229643, 230896
NOTRY=true
Reason for revert:
Flakiness on content_shell tests. Appears to be caused by this change. Example breakage:http://build.chromium.org/p/chromium.linux/buildstatus?builder=Android%20Tests%20%28dbg%29&number=10928
Original cl: https://chromiumcodereview.appspot.com/14069008
TBR=sievers@chromium.org
Review URL: https://codereview.chromium.org/15796002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gl_context_virtual.cc | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc index d142e01..938d811 100644 --- a/gpu/command_buffer/service/gl_context_virtual.cc +++ b/gpu/command_buffer/service/gl_context_virtual.cc @@ -30,19 +30,12 @@ bool GLContextVirtual::Initialize( display_ = static_cast<gfx::Display*>(compatible_surface->GetDisplay()); - // Virtual contexts obviously can't make a context that is compatible - // with the surface (the context already exists), but we do need to - // make a context current for SetupForVirtualization() below. - if (!IsCurrent(compatible_surface)) { - if (!shared_context_->MakeCurrent(compatible_surface)) { - // This is likely an error. The real context should be made as - // compatible with all required surfaces when it was created. - LOG(ERROR) << "Failed MakeCurrent(compatible_surface)"; - return false; - } - } + if (!shared_context_->MakeCurrent(compatible_surface)) + return false; shared_context_->SetupForVirtualization(); + + shared_context_->ReleaseCurrent(compatible_surface); return true; } @@ -66,14 +59,18 @@ void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) { } bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) { - // If it's a real surface it needs to be current. - if (surface && - !surface->GetBackingFrameBufferObject() && - !surface->IsOffscreen()) - return shared_context_->IsCurrent(surface); - - // Otherwise, only insure the context itself is current. - return shared_context_->IsCurrent(NULL); + bool context_current = shared_context_->IsCurrent(NULL); + if (!context_current) + return false; + + if (!surface) + return true; + + gfx::GLSurface* current_surface = gfx::GLSurface::GetCurrent(); + return surface->GetBackingFrameBufferObject() || + surface->IsOffscreen() || + (current_surface && + current_surface->GetHandle() == surface->GetHandle()); } void* GLContextVirtual::GetHandle() { |