diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-10 20:21:19 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-10 20:21:19 +0000 |
commit | b86a16374503de409d12672eac8f7557c576fe9a (patch) | |
tree | 9bcebb49e3a71e84d9a0db91275d7a5d28c0b860 | |
parent | 623593ba2ddb7dadfc3e16296f9593b56a30b5e3 (diff) | |
download | chromium_src-b86a16374503de409d12672eac8f7557c576fe9a.zip chromium_src-b86a16374503de409d12672eac8f7557c576fe9a.tar.gz chromium_src-b86a16374503de409d12672eac8f7557c576fe9a.tar.bz2 |
Merge 201665 "Partial revert of "GPU: Reduce MakeCurrent calls t..."
> 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
TBR=yfriedman@chromium.org
Review URL: https://codereview.chromium.org/15734024
git-svn-id: svn://svn.chromium.org/chrome/branches/1500/src@205291 0039d316-1c4b-4281-b951-d872f2087c98
-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 d0602b2..de94f43 100644 --- a/gpu/command_buffer/service/gl_context_virtual.cc +++ b/gpu/command_buffer/service/gl_context_virtual.cc @@ -29,19 +29,12 @@ bool GLContextVirtual::Initialize( gfx::GLSurface* compatible_surface, gfx::GpuPreference gpu_preference) { 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; } @@ -65,14 +58,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() { |