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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1652873002: Android: Use virtualized context only for those with compatible config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 10 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 | « no previous file | content/common/gpu/stream_texture_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index d0ed3d1c42908ca3b99bd7de42dc60870fad4c93..91cc5bfecff6497b4a4014466b5dd4d0d56bf27c 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -164,8 +164,7 @@ gfx::GLSurface::Format GetSurfaceFormatFromAttribute(
const gpu::gles2::ContextCreationAttribHelper& attrib,
bool use_virtualized_gl_context) {
gfx::GLSurface::Format format = gfx::GLSurface::SURFACE_DEFAULT; // ARGB8888
- if (!use_virtualized_gl_context &&
- attrib.red_size <= 5 &&
+ if (attrib.red_size <= 5 &&
attrib.green_size <= 6 &&
attrib.blue_size <= 5 &&
attrib.alpha_size == 0) {
@@ -561,39 +560,36 @@ void GpuCommandBufferStub::OnInitialize(
}
scoped_refptr<gfx::GLContext> context;
- if (use_virtualized_gl_context_ && channel_->share_group()) {
- context = channel_->share_group()->GetSharedContext();
+ gfx::GLShareGroup* share_group = channel_->share_group();
+ if (use_virtualized_gl_context_ && share_group) {
no sievers 2016/02/17 00:56:26 Is it simpler to just treat |is_onscreen && is_low
Jinsuk Kim 2016/02/17 07:23:32 Good to know that virtualization can be done for s
+ context = share_group->GetSharedContext();
if (!context.get()) {
- context = gfx::GLContext::CreateGLContext(
- channel_->share_group(),
- channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(),
- gpu_preference_);
+ share_group->UpdateActiveSharedContext(surface_.get(), gpu_preference_);
+ context = share_group->GetSharedContext();
if (!context.get()) {
- DLOG(ERROR) << "Failed to create shared context for virtualization.";
OnInitializeFailed(reply_message);
return;
}
- channel_->share_group()->SetSharedContext(context.get());
}
// This should be a non-virtual GL context.
DCHECK(context->GetHandle());
context = new gpu::GLContextVirtual(
- channel_->share_group(), context.get(), decoder_->AsWeakPtr());
+ share_group, context.get(), decoder_->AsWeakPtr());
if (!context->Initialize(surface_.get(), gpu_preference_)) {
- // TODO(sievers): The real context created above for the default
- // offscreen surface might not be compatible with this surface.
- // Need to adjust at least GLX to be able to create the initial context
- // with a config that is compatible with onscreen and offscreen surfaces.
- context = NULL;
-
- DLOG(ERROR) << "Failed to initialize virtual GL context.";
- OnInitializeFailed(reply_message);
- return;
+ // Context with incompatible configuration was attempted to be made
+ // current. Update the shared context to a compatible one and init again.
+ share_group->UpdateActiveSharedContext(surface_.get(), gpu_preference_);
+ context->UpdateSharedContext(share_group->GetSharedContext());
+ if (!context->Initialize(surface_.get(), gpu_preference_)) {
+ DLOG(ERROR) << "Failed to initialize virtual GL context.";
+ OnInitializeFailed(reply_message);
+ return;
+ }
}
}
if (!context.get()) {
context = gfx::GLContext::CreateGLContext(
- channel_->share_group(), surface_.get(), gpu_preference_);
+ share_group, surface_.get(), gpu_preference_);
}
if (!context.get()) {
DLOG(ERROR) << "Failed to create context.";
« no previous file with comments | « no previous file | content/common/gpu/stream_texture_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698