Commit b8af64a4 authored by Geoff Lang's avatar Geoff Lang Committed by Commit Bot

Don't create manager objects in ContextGroup when using the passthrough decoder

These objects are not used when the passthrough command decoder is in
use.  This saves several GPU memory allocations in TextureManager for
default and black textures.

Saves ~2 MB per context.

This is a reland of https://chromium-review.googlesource.com/c/chromium/src/+/2028291

TBR=sandersd@chromium.org

BUG=1046613
BUG=1030835

Change-Id: Iae138dd860023d3b16e958fed290ad78188b31bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072358
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Auto-Submit: Geoff Lang <geofflang@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745174}
parent e1514d43
...@@ -263,13 +263,17 @@ gpu::ContextResult ContextGroup::Initialize( ...@@ -263,13 +263,17 @@ gpu::ContextResult ContextGroup::Initialize(
&uniform_buffer_offset_alignment_); &uniform_buffer_offset_alignment_);
} }
buffer_manager_ = std::make_unique<BufferManager>(memory_tracker_.get(), // Managers are not used by the passthrough command decoder. Save memory by
feature_info_.get()); // not allocating them.
renderbuffer_manager_ = std::make_unique<RenderbufferManager>( if (!use_passthrough_cmd_decoder_) {
memory_tracker_.get(), max_renderbuffer_size, max_samples, buffer_manager_ = std::make_unique<BufferManager>(memory_tracker_.get(),
feature_info_.get()); feature_info_.get());
shader_manager_ = std::make_unique<ShaderManager>(progress_reporter_); renderbuffer_manager_ = std::make_unique<RenderbufferManager>(
sampler_manager_ = std::make_unique<SamplerManager>(feature_info_.get()); memory_tracker_.get(), max_renderbuffer_size, max_samples,
feature_info_.get());
shader_manager_ = std::make_unique<ShaderManager>(progress_reporter_);
sampler_manager_ = std::make_unique<SamplerManager>(feature_info_.get());
}
// Lookup GL things we need to know. // Lookup GL things we need to know.
const GLint kGLES2RequiredMinimumVertexAttribs = 8u; const GLint kGLES2RequiredMinimumVertexAttribs = 8u;
...@@ -389,11 +393,15 @@ gpu::ContextResult ContextGroup::Initialize( ...@@ -389,11 +393,15 @@ gpu::ContextResult ContextGroup::Initialize(
feature_info_->workarounds().max_3d_array_texture_size); feature_info_->workarounds().max_3d_array_texture_size);
} }
texture_manager_.reset(new TextureManager( // Managers are not used by the passthrough command decoder. Save memory by
memory_tracker_.get(), feature_info_.get(), max_texture_size, // not allocating them.
max_cube_map_texture_size, max_rectangle_texture_size, if (!use_passthrough_cmd_decoder_) {
max_3d_texture_size, max_array_texture_layers, bind_generates_resource_, texture_manager_.reset(new TextureManager(
progress_reporter_, discardable_manager_)); memory_tracker_.get(), feature_info_.get(), max_texture_size,
max_cube_map_texture_size, max_rectangle_texture_size,
max_3d_texture_size, max_array_texture_layers, bind_generates_resource_,
progress_reporter_, discardable_manager_));
}
const GLint kMinTextureImageUnits = 8; const GLint kMinTextureImageUnits = 8;
const GLint kMinVertexTextureImageUnits = 0; const GLint kMinVertexTextureImageUnits = 0;
...@@ -523,14 +531,18 @@ gpu::ContextResult ContextGroup::Initialize( ...@@ -523,14 +531,18 @@ gpu::ContextResult ContextGroup::Initialize(
} }
} }
path_manager_ = std::make_unique<PathManager>(); // Managers are not used by the passthrough command decoder. Save memory by
// not allocating them.
if (!use_passthrough_cmd_decoder_) {
path_manager_ = std::make_unique<PathManager>();
program_manager_ = std::make_unique<ProgramManager>( program_manager_ = std::make_unique<ProgramManager>(
program_cache_, max_varying_vectors_, max_draw_buffers_, program_cache_, max_varying_vectors_, max_draw_buffers_,
max_dual_source_draw_buffers_, max_vertex_attribs_, gpu_preferences_, max_dual_source_draw_buffers_, max_vertex_attribs_, gpu_preferences_,
feature_info_.get(), progress_reporter_); feature_info_.get(), progress_reporter_);
texture_manager_->Initialize(); texture_manager_->Initialize();
}
decoders_.push_back(decoder->AsWeakPtr()); decoders_.push_back(decoder->AsWeakPtr());
return gpu::ContextResult::kSuccess; return gpu::ContextResult::kSuccess;
......
...@@ -199,9 +199,6 @@ bool GpuSharedImageVideoFactory::CreateImageInternal( ...@@ -199,9 +199,6 @@ bool GpuSharedImageVideoFactory::CreateImageInternal(
gpu::gles2::ContextGroup* group = stub_->decoder_context()->GetContextGroup(); gpu::gles2::ContextGroup* group = stub_->decoder_context()->GetContextGroup();
if (!group) if (!group)
return false; return false;
gpu::gles2::TextureManager* texture_manager = group->texture_manager();
if (!texture_manager)
return false;
const auto& size = spec.size; const auto& size = spec.size;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "gpu/command_buffer/service/decoder_context.h" #include "gpu/command_buffer/service/decoder_context.h"
#include "gpu/command_buffer/service/scheduler.h" #include "gpu/command_buffer/service/scheduler.h"
#include "gpu/command_buffer/service/sync_point_manager.h" #include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/ipc/service/command_buffer_stub.h" #include "gpu/ipc/service/command_buffer_stub.h"
#include "gpu/ipc/service/gpu_channel.h" #include "gpu/ipc/service/gpu_channel.h"
#include "media/gpu/gles2_decoder_helper.h" #include "media/gpu/gles2_decoder_helper.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/decoder_context.h" #include "gpu/command_buffer/service/decoder_context.h"
#include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
#include "ui/gl/scoped_binders.h" #include "ui/gl/scoped_binders.h"
...@@ -28,10 +27,7 @@ class GLES2DecoderHelperImpl : public GLES2DecoderHelper { ...@@ -28,10 +27,7 @@ class GLES2DecoderHelperImpl : public GLES2DecoderHelper {
: decoder_(decoder) { : decoder_(decoder) {
DCHECK(decoder_); DCHECK(decoder_);
gpu::gles2::ContextGroup* group = decoder_->GetContextGroup(); gpu::gles2::ContextGroup* group = decoder_->GetContextGroup();
texture_manager_ = group->texture_manager();
mailbox_manager_ = group->mailbox_manager(); mailbox_manager_ = group->mailbox_manager();
// TODO(sandersd): Support GLES2DecoderPassthroughImpl.
DCHECK(texture_manager_);
DCHECK(mailbox_manager_); DCHECK(mailbox_manager_);
} }
...@@ -97,7 +93,6 @@ class GLES2DecoderHelperImpl : public GLES2DecoderHelper { ...@@ -97,7 +93,6 @@ class GLES2DecoderHelperImpl : public GLES2DecoderHelper {
private: private:
gpu::DecoderContext* decoder_; gpu::DecoderContext* decoder_;
gpu::gles2::TextureManager* texture_manager_;
gpu::MailboxManager* mailbox_manager_; gpu::MailboxManager* mailbox_manager_;
THREAD_CHECKER(thread_checker_); THREAD_CHECKER(thread_checker_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment