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

Side by Side Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10388010: Decoupling backbuffer allocation suggestion from frontbuffer allocation suggestion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/texture_image_transport_surface.h" 5 #include "content/common/gpu/texture_image_transport_surface.h"
6 6
7 #include "content/common/gpu/gpu_channel.h" 7 #include "content/common/gpu/gpu_channel.h"
8 #include "content/common/gpu/gpu_channel_manager.h" 8 #include "content/common/gpu/gpu_channel_manager.h"
9 #include "content/common/gpu/gpu_messages.h" 9 #include "content/common/gpu/gpu_messages.h"
10 #include "gpu/command_buffer/service/context_group.h" 10 #include "gpu/command_buffer/service/context_group.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 TextureImageTransportSurface::Texture::~Texture() { 58 TextureImageTransportSurface::Texture::~Texture() {
59 } 59 }
60 60
61 TextureImageTransportSurface::TextureImageTransportSurface( 61 TextureImageTransportSurface::TextureImageTransportSurface(
62 GpuChannelManager* manager, 62 GpuChannelManager* manager,
63 GpuCommandBufferStub* stub, 63 GpuCommandBufferStub* stub,
64 const gfx::GLSurfaceHandle& handle) 64 const gfx::GLSurfaceHandle& handle)
65 : fbo_id_(0), 65 : fbo_id_(0),
66 front_(0), 66 front_(0),
67 stub_destroyed_(false), 67 stub_destroyed_(false),
68 backbuffer_suggested_allocation_(true),
69 frontbuffer_suggested_allocation_(true),
68 parent_stub_(NULL) { 70 parent_stub_(NULL) {
69 GpuChannel* parent_channel = manager->LookupChannel(handle.parent_client_id); 71 GpuChannel* parent_channel = manager->LookupChannel(handle.parent_client_id);
70 DCHECK(parent_channel); 72 DCHECK(parent_channel);
71 parent_stub_ = parent_channel->LookupCommandBuffer(handle.parent_context_id); 73 parent_stub_ = parent_channel->LookupCommandBuffer(handle.parent_context_id);
72 DCHECK(parent_stub_); 74 DCHECK(parent_stub_);
73 parent_stub_->AddDestructionObserver(this); 75 parent_stub_->AddDestructionObserver(this);
74 TextureManager* texture_manager = 76 TextureManager* texture_manager =
75 parent_stub_->decoder()->GetContextGroup()->texture_manager(); 77 parent_stub_->decoder()->GetContextGroup()->texture_manager();
76 DCHECK(texture_manager); 78 DCHECK(texture_manager);
77 79
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #endif 150 #endif
149 } 151 }
150 152
151 return true; 153 return true;
152 } 154 }
153 155
154 unsigned int TextureImageTransportSurface::GetBackingFrameBufferObject() { 156 unsigned int TextureImageTransportSurface::GetBackingFrameBufferObject() {
155 return fbo_id_; 157 return fbo_id_;
156 } 158 }
157 159
158 void TextureImageTransportSurface::SetBufferAllocation( 160 void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) {
159 BufferAllocationState state) { 161 if (backbuffer_suggested_allocation_ == allocation)
162 return;
163 backbuffer_suggested_allocation_ = allocation;
164 AdjustBufferAllocations();
165 }
166
167 void TextureImageTransportSurface::SetFrontbufferAllocation(bool allocation) {
168 if (frontbuffer_suggested_allocation_ == allocation)
169 return;
170 frontbuffer_suggested_allocation_ = allocation;
171 AdjustBufferAllocations();
jonathan.backer 2012/05/09 18:13:01 Why are we doing this when AdjustBufferAllocations
mmocny 2012/05/09 18:59:15 Just for consistency. I can remove it from this p
jonathan.backer 2012/05/10 21:37:48 I'm concerned that order of allocating buffers mat
172 }
173
174 void TextureImageTransportSurface::AdjustBufferAllocations() {
160 if (!helper_->MakeCurrent()) 175 if (!helper_->MakeCurrent())
161 return; 176 return;
162 switch (state) { 177 if (backbuffer_suggested_allocation_)
163 case BUFFER_ALLOCATION_FRONT_AND_BACK: 178 CreateBackTexture(textures_[back()].size);
164 CreateBackTexture(textures_[back()].size); 179 else
165 break; 180 ReleaseBackTexture();
166 case BUFFER_ALLOCATION_FRONT_ONLY:
167 case BUFFER_ALLOCATION_NONE:
168 ReleaseBackTexture();
169 break;
170 };
171 } 181 }
172 182
173 void* TextureImageTransportSurface::GetShareHandle() { 183 void* TextureImageTransportSurface::GetShareHandle() {
174 return GetHandle(); 184 return GetHandle();
175 } 185 }
176 186
177 void* TextureImageTransportSurface::GetDisplay() { 187 void* TextureImageTransportSurface::GetDisplay() {
178 return parent_stub_ ? parent_stub_->surface()->GetDisplay() : NULL; 188 return parent_stub_ ? parent_stub_->surface()->GetDisplay() : NULL;
179 } 189 }
180 190
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 Texture& texture = textures_[i]; 441 Texture& texture = textures_[i];
432 texture.info = NULL; 442 texture.info = NULL;
433 if (!texture.sent_to_client) 443 if (!texture.sent_to_client)
434 continue; 444 continue;
435 GpuHostMsg_AcceleratedSurfaceRelease_Params params; 445 GpuHostMsg_AcceleratedSurfaceRelease_Params params;
436 params.identifier = texture.client_id; 446 params.identifier = texture.client_id;
437 helper_->SendAcceleratedSurfaceRelease(params); 447 helper_->SendAcceleratedSurfaceRelease(params);
438 } 448 }
439 parent_stub_ = NULL; 449 parent_stub_ = NULL;
440 } 450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698