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

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: comment addressed 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') | ui/gl/gl_surface.h » ('J')
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..9b17c44890f47dc1e474f587046c8144eb3a7c13 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -13,6 +13,7 @@
#include "base/json/json_writer.h"
#include "base/macros.h"
#include "base/memory/shared_memory.h"
+#include "base/sys_info.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -164,8 +165,7 @@ gfx::GLSurface::Format GetSurfaceFormatFromAttribute(
const gpu::gles2::ContextCreationAttribHelper& attrib,
bool use_virtualized_gl_context) {
no sievers 2016/02/17 23:38:01 nit: this argument is unused now
Jinsuk Kim 2016/02/18 02:57:24 Done.
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,8 +561,13 @@ 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();
+
+ // On-screen 16-bit surfaces on low-end device won't use virtualized context.
no sievers 2016/02/17 23:38:01 You mean 32-bit surfaces, right?
Jinsuk Kim 2016/02/18 02:57:24 My bad.. removed the comment as this part is being
+ if (handle_.is_null() ||
+ !base::SysInfo::IsLowEndDevice() ||
no sievers 2016/02/17 23:38:01 You could actually generalize this and just say th
Jinsuk Kim 2016/02/18 02:57:24 Done.
+ surface_format_ == gfx::GLSurface::SURFACE_RGB565) {
+ context = share_group->GetSharedContext();
if (!context.get()) {
context = gfx::GLContext::CreateGLContext(
channel_->share_group(),
@@ -578,7 +583,7 @@ void GpuCommandBufferStub::OnInitialize(
// 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.
@@ -593,7 +598,7 @@ void GpuCommandBufferStub::OnInitialize(
}
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') | ui/gl/gl_surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698