diff options
author | boliu <boliu@chromium.org> | 2015-05-28 17:56:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 00:57:12 +0000 |
commit | 54a15ddb2f34f95dae482d56e42855be694ae79c (patch) | |
tree | a1f1d7bc3dd3ad06b68a457221e2e5ad8856bc7b /gpu | |
parent | fdbff0e3b60139805609f643eb40b4b3453e7953 (diff) | |
download | chromium_src-54a15ddb2f34f95dae482d56e42855be694ae79c.zip chromium_src-54a15ddb2f34f95dae482d56e42855be694ae79c.tar.gz chromium_src-54a15ddb2f34f95dae482d56e42855be694ae79c.tar.bz2 |
Move eglCreateImageKHR in ProduceTexture out of lock
eglCreateImageKHR is expensive in some drivers. Move the call in
ProduceTexture out of the lock to reduce lock contention.
BUG=492315
Review URL: https://codereview.chromium.org/1156493008
Cr-Commit-Position: refs/heads/master@{#331902}
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager_sync.cc | 29 | ||||
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager_sync.h | 5 |
2 files changed, 12 insertions, 22 deletions
diff --git a/gpu/command_buffer/service/mailbox_manager_sync.cc b/gpu/command_buffer/service/mailbox_manager_sync.cc index 00c9abaa..3ca3268 100644 --- a/gpu/command_buffer/service/mailbox_manager_sync.cc +++ b/gpu/command_buffer/service/mailbox_manager_sync.cc @@ -77,21 +77,6 @@ base::LazyInstance<MailboxManagerSync::TextureGroup::MailboxToGroupMap> LAZY_INSTANCE_INITIALIZER; // static -MailboxManagerSync::TextureGroup* -MailboxManagerSync::TextureGroup::CreateFromTexture(const Mailbox& name, - MailboxManagerSync* manager, - Texture* texture) { - TextureGroup* group = new TextureGroup(); - group->AddTexture(manager, texture); - group->AddName(name); - if (!SkipTextureWorkarounds(texture)) { - group->definition_ = - TextureDefinition(texture, kNewTextureVersion, NULL); - } - return group; -} - -// static MailboxManagerSync::TextureGroup* MailboxManagerSync::TextureGroup::FromName( const Mailbox& name) { MailboxToGroupMap::iterator it = mailbox_to_group_.Get().find(name); @@ -101,7 +86,9 @@ MailboxManagerSync::TextureGroup* MailboxManagerSync::TextureGroup::FromName( return it->second.get(); } -MailboxManagerSync::TextureGroup::TextureGroup() { +MailboxManagerSync::TextureGroup::TextureGroup( + const TextureDefinition& definition) + : definition_(definition) { } MailboxManagerSync::TextureGroup::~TextureGroup() { @@ -250,8 +237,14 @@ void MailboxManagerSync::ProduceTexture(const Mailbox& mailbox, } else { // This is a new texture, so create a new group. texture->SetMailboxManager(this); - group_for_texture = - TextureGroup::CreateFromTexture(mailbox, this, texture); + TextureDefinition definition; + if (!SkipTextureWorkarounds(texture)) { + base::AutoUnlock unlock(g_lock.Get()); + definition = TextureDefinition(texture, kNewTextureVersion, NULL); + } + group_for_texture = new TextureGroup(definition); + group_for_texture->AddTexture(this, texture); + group_for_texture->AddName(mailbox); texture_to_group_.insert(std::make_pair( texture, TextureGroupRef(kNewTextureVersion, group_for_texture))); } diff --git a/gpu/command_buffer/service/mailbox_manager_sync.h b/gpu/command_buffer/service/mailbox_manager_sync.h index 4b3abf9..481948e 100644 --- a/gpu/command_buffer/service/mailbox_manager_sync.h +++ b/gpu/command_buffer/service/mailbox_manager_sync.h @@ -46,9 +46,7 @@ class GPU_EXPORT MailboxManagerSync : public MailboxManager { class TextureGroup : public base::RefCounted<TextureGroup> { public: - static TextureGroup* CreateFromTexture(const Mailbox& name, - MailboxManagerSync* manager, - Texture* texture); + explicit TextureGroup(const TextureDefinition& definition); static TextureGroup* FromName(const Mailbox& name); void AddName(const Mailbox& name); @@ -66,7 +64,6 @@ class GPU_EXPORT MailboxManagerSync : public MailboxManager { private: friend class base::RefCounted<TextureGroup>; - TextureGroup(); ~TextureGroup(); typedef std::vector<std::pair<MailboxManagerSync*, Texture*>> TextureList; |