Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: gpu/command_buffer/service/gl_context_virtual.cc

Issue 14069008: GPU: Reduce MakeCurrent calls to fix Orange San Diego (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/gpu/gpu_info_collector_android.cc ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gl_context_virtual.cc
diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc
index 5503a94b76307c974910d7e1ae3133b46ab9eac6..b7a90ce9b52b2fec95dd28e2faad1813848c611e 100644
--- a/gpu/command_buffer/service/gl_context_virtual.cc
+++ b/gpu/command_buffer/service/gl_context_virtual.cc
@@ -29,12 +29,12 @@ bool GLContextVirtual::Initialize(
gfx::GLSurface* compatible_surface, gfx::GpuPreference gpu_preference) {
display_ = static_cast<gfx::Display*>(compatible_surface->GetDisplay());
- if (!shared_context_->MakeCurrent(compatible_surface))
- return false;
+ if (!IsCurrent(compatible_surface)) {
no sievers 2013/04/10 22:44:31 shared_context_->MakeCurrent() here is called to f
epennerAtGoogle 2013/04/11 03:23:43 Hmm, if you want to legitimately bind a pbuffer su
no sievers 2013/04/11 19:56:19 Discussed optimizing this by having the caller pas
epenner 2013/05/02 04:13:11 Sorry but that won't work. Initialize always need
+ if (!shared_context_->MakeCurrent(compatible_surface))
+ return false;
+ }
shared_context_->SetupForVirtualization();
-
- shared_context_->ReleaseCurrent(compatible_surface);
no sievers 2013/04/10 22:44:31 This can probably just go away.
epennerAtGoogle 2013/04/11 03:23:43 Done.
epennerAtGoogle 2013/04/11 03:23:43 SGTM
return true;
}
@@ -45,7 +45,7 @@ void GLContextVirtual::Destroy() {
}
bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
- if (decoder_.get() && decoder_->initialized())
+ if (IsCurrent(surface) || (decoder_.get() && decoder_->initialized()))
shared_context_->MakeVirtuallyCurrent(this, surface);
else
shared_context_->MakeCurrent(surface);
@@ -53,8 +53,8 @@ bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
}
void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) {
- if (IsCurrent(surface))
no sievers 2013/04/10 22:44:31 shared_context_->ReleaseCurrent() still needs to b
no sievers 2013/04/10 22:47:23 Or to generalize, ReleaseCurrent() would have to b
epennerAtGoogle 2013/04/11 03:23:43 Okay I see the problem there. That's a pretty nast
no sievers 2013/04/11 19:56:19 Discussed optimizing this by moving the call site
epenner 2013/05/02 04:13:11 To clarify, are you suggesting that every derived
- shared_context_->ReleaseCurrent(surface);
+ // This is intentionally a no-op. When using virtual contexts
+ // the shared context should always stay current.
}
bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) {
« no previous file with comments | « content/gpu/gpu_info_collector_android.cc ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698