diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 18:00:34 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 18:00:34 +0000 |
commit | 34466d02f35920cfbe0f1a3441a2a2c0724e0424 (patch) | |
tree | a5991a68e582b9b7be194742f20954569c36b42d /gpu | |
parent | 120cf540da701f19e9017cf7e603b2946aa88530 (diff) | |
download | chromium_src-34466d02f35920cfbe0f1a3441a2a2c0724e0424.zip chromium_src-34466d02f35920cfbe0f1a3441a2a2c0724e0424.tar.gz chromium_src-34466d02f35920cfbe0f1a3441a2a2c0724e0424.tar.bz2 |
Implement TextureImageTransportSurface using texture mailbox
This has a couple of advantages:
- allow tearing down and recreating the UI parent context without
losing the renderer contexts
- do not require a context to be able to generate textures when
creating the GLSurfaceHandle
- clearer ownership semantics that potentially allows for more
robust and easier lost context handling/thumbnailing/etc., since a texture is at
any given time owned by either: UI parent, mailbox, or
TextureImageTransportSurface
- simplify frontbuffer protection logic;
the frontbuffer textures are now owned by RWHV where they are refcounted
The TextureImageTransportSurface informs RenderWidgetHostView of the
mailbox names for the front- and backbuffer textures by
associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message.
During SwapBuffers() or PostSubBuffer() cycles, it then uses
produceTextureCHROMIUM() and consumeTextureCHROMIUM()
to transfer ownership between renderer and browser compositor.
RWHV sends back the surface_handle of the buffer being returned with the Swap ACK
(or 0 if no buffer is being returned in which case TextureImageTransportSurface will
allocate a new texture - note that this could be used to
simply keep textures for thumbnailing).
BUG=154815,139616
TBR=sky@chromium.org
NOTRY=True
Review URL: https://chromiumcodereview.appspot.com/11194042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager.cc | 13 | ||||
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager.h | 3 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_definition.cc | 12 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_definition.h | 4 |
4 files changed, 27 insertions, 5 deletions
diff --git a/gpu/command_buffer/service/mailbox_manager.cc b/gpu/command_buffer/service/mailbox_manager.cc index ec7ad94..9019393 100644 --- a/gpu/command_buffer/service/mailbox_manager.cc +++ b/gpu/command_buffer/service/mailbox_manager.cc @@ -4,6 +4,8 @@ #include "gpu/command_buffer/service/mailbox_manager.h" +#include <algorithm> + #include "base/rand_util.h" #include "crypto/hmac.h" #include "gpu/command_buffer/service/gl_utils.h" @@ -12,6 +14,11 @@ namespace gpu { namespace gles2 { +MailboxName::MailboxName() { + std::fill(key, key + sizeof(key), 0); + std::fill(signature, signature + sizeof(signature), 0); +} + MailboxManager::MailboxManager() : hmac_(crypto::HMAC::SHA256), textures_(std::ptr_fun(&MailboxManager::TargetNameLess)) { @@ -19,9 +26,11 @@ MailboxManager::MailboxManager() bool success = hmac_.Init( base::StringPiece(private_key_, sizeof(private_key_))); DCHECK(success); + DCHECK(!IsMailboxNameValid(MailboxName())); } MailboxManager::~MailboxManager() { + DCHECK(!textures_.size()); } void MailboxManager::GenerateMailboxName(MailboxName* name) { @@ -36,10 +45,8 @@ TextureDefinition* MailboxManager::ConsumeTexture(unsigned target, TextureDefinitionMap::iterator it = textures_.find(TargetName(target, name)); - if (it == textures_.end()) { - NOTREACHED(); + if (it == textures_.end()) return NULL; - } TextureDefinition* definition = it->second.definition.release(); textures_.erase(it); diff --git a/gpu/command_buffer/service/mailbox_manager.h b/gpu/command_buffer/service/mailbox_manager.h index 337998d..8f97dd4 100644 --- a/gpu/command_buffer/service/mailbox_manager.h +++ b/gpu/command_buffer/service/mailbox_manager.h @@ -30,7 +30,8 @@ class TextureManager; // Identifies a mailbox where a texture definition can be stored for // transferring textures between contexts that are not in the same context // group. It is a random key signed with a hash of a private key. -struct MailboxName { +struct GPU_EXPORT MailboxName { + MailboxName(); GLbyte key[GL_MAILBOX_SIZE_CHROMIUM / 2]; GLbyte signature[GL_MAILBOX_SIZE_CHROMIUM / 2]; }; diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc index aba0dfa..e1c606f 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc @@ -27,6 +27,18 @@ TextureDefinition::LevelInfo::LevelInfo(GLenum target, cleared(cleared) { } +TextureDefinition::LevelInfo::LevelInfo() + : target(0), + internal_format(0), + width(0), + height(0), + depth(0), + border(0), + format(0), + type(0), + cleared(true) { +} + TextureDefinition::TextureDefinition(GLenum target, GLuint service_id, GLenum min_filter, diff --git a/gpu/command_buffer/service/texture_definition.h b/gpu/command_buffer/service/texture_definition.h index 0a9910b..7f7d3cd 100644 --- a/gpu/command_buffer/service/texture_definition.h +++ b/gpu/command_buffer/service/texture_definition.h @@ -19,7 +19,7 @@ namespace gles2 { // context using the same GLShareGroup with the corresponding service ID. class GPU_EXPORT TextureDefinition { public: - struct LevelInfo { + struct GPU_EXPORT LevelInfo { LevelInfo(GLenum target, GLenum internal_format, GLsizei width, @@ -29,6 +29,8 @@ class GPU_EXPORT TextureDefinition { GLenum format, GLenum type, bool cleared); + LevelInfo(); + GLenum target; GLenum internal_format; GLsizei width; |