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

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

Issue 10916355: Use PBuffer to make TextureImageTransportSurface current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 texture_manager->SetParameter( 81 texture_manager->SetParameter(
82 texture.info, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 82 texture.info, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
83 texture_manager->SetParameter( 83 texture_manager->SetParameter(
84 texture.info, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 84 texture.info, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
85 texture_manager->SetParameter( 85 texture_manager->SetParameter(
86 texture.info, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 86 texture.info, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
87 texture_manager->SetParameter( 87 texture_manager->SetParameter(
88 texture.info, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 88 texture.info, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
89 } 89 }
90 90
91 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1));
92 if (!surface_.get())
93 return false;
94
91 if (!helper_->Initialize()) 95 if (!helper_->Initialize())
92 return false; 96 return false;
93 97
94 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 98 const CommandLine* command_line = CommandLine::ForCurrentProcess();
95 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) 99 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
96 helper_->SetPreemptByCounter(parent_channel->MessagesPendingCount()); 100 helper_->SetPreemptByCounter(parent_channel->MessagesPendingCount());
97 101
98 return true; 102 return true;
99 } 103 }
100 104
101 void TextureImageTransportSurface::Destroy() { 105 void TextureImageTransportSurface::Destroy() {
102 if (parent_stub_) { 106 if (parent_stub_) {
103 parent_stub_->decoder()->MakeCurrent(); 107 parent_stub_->decoder()->MakeCurrent();
104 ReleaseParentStub(); 108 ReleaseParentStub();
105 } 109 }
106 110
111 if (surface_.get()) {
112 surface_->Destroy();
113 surface_ = NULL;
114 }
115
107 helper_->Destroy(); 116 helper_->Destroy();
108 } 117 }
109 118
110 bool TextureImageTransportSurface::Resize(const gfx::Size&) { 119 bool TextureImageTransportSurface::Resize(const gfx::Size&) {
111 return true; 120 return true;
112 } 121 }
113 122
114 bool TextureImageTransportSurface::IsOffscreen() { 123 bool TextureImageTransportSurface::IsOffscreen() {
115 return parent_stub_ ? parent_stub_->surface()->IsOffscreen() : true; 124 return true;
116 } 125 }
117 126
118 bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { 127 bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
119 if (stub_destroyed_) { 128 if (stub_destroyed_) {
120 // Early-exit so that we don't recreate the fbo. We still want to return 129 // Early-exit so that we don't recreate the fbo. We still want to return
121 // true, so that the context is made current and the GLES2DecoderImpl can 130 // true, so that the context is made current and the GLES2DecoderImpl can
122 // release its own resources. 131 // release its own resources.
123 return true; 132 return true;
124 } 133 }
125 134
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 textures_[front()].sent_to_client = false; 195 textures_[front()].sent_to_client = false;
187 } 196 }
188 } 197 }
189 } 198 }
190 199
191 void* TextureImageTransportSurface::GetShareHandle() { 200 void* TextureImageTransportSurface::GetShareHandle() {
192 return GetHandle(); 201 return GetHandle();
193 } 202 }
194 203
195 void* TextureImageTransportSurface::GetDisplay() { 204 void* TextureImageTransportSurface::GetDisplay() {
196 return parent_stub_ ? parent_stub_->surface()->GetDisplay() : NULL; 205 return surface_.get() ? surface_->GetDisplay() : NULL;
197 } 206 }
198 207
199 void* TextureImageTransportSurface::GetConfig() { 208 void* TextureImageTransportSurface::GetConfig() {
200 return parent_stub_ ? parent_stub_->surface()->GetConfig() : NULL; 209 return surface_.get() ? surface_->GetConfig() : NULL;
201 } 210 }
202 211
203 void TextureImageTransportSurface::OnResize(gfx::Size size) { 212 void TextureImageTransportSurface::OnResize(gfx::Size size) {
204 CreateBackTexture(size); 213 CreateBackTexture(size);
205 } 214 }
206 215
207 void TextureImageTransportSurface::OnWillDestroyStub( 216 void TextureImageTransportSurface::OnWillDestroyStub(
208 GpuCommandBufferStub* stub) { 217 GpuCommandBufferStub* stub) {
209 if (stub == parent_stub_) { 218 if (stub == parent_stub_) {
210 ReleaseParentStub(); 219 ReleaseParentStub();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 337
329 gfx::Size TextureImageTransportSurface::GetSize() { 338 gfx::Size TextureImageTransportSurface::GetSize() {
330 gfx::Size size = textures_[back()].size; 339 gfx::Size size = textures_[back()].size;
331 340
332 // OSMesa expects a non-zero size. 341 // OSMesa expects a non-zero size.
333 return gfx::Size(size.width() == 0 ? 1 : size.width(), 342 return gfx::Size(size.width() == 0 ? 1 : size.width(),
334 size.height() == 0 ? 1 : size.height()); 343 size.height() == 0 ? 1 : size.height());
335 } 344 }
336 345
337 void* TextureImageTransportSurface::GetHandle() { 346 void* TextureImageTransportSurface::GetHandle() {
338 return parent_stub_ ? parent_stub_->surface()->GetHandle() : NULL; 347 return surface_.get() ? surface_->GetHandle() : NULL;
339 } 348 }
340 349
341 unsigned TextureImageTransportSurface::GetFormat() { 350 unsigned TextureImageTransportSurface::GetFormat() {
342 return parent_stub_ ? parent_stub_->surface()->GetFormat() : 0; 351 return surface_ ? surface_->GetFormat() : 0;
343 } 352 }
344 353
345 void TextureImageTransportSurface::OnSetFrontSurfaceIsProtected( 354 void TextureImageTransportSurface::OnSetFrontSurfaceIsProtected(
346 bool is_protected, uint32 protection_state_id) { 355 bool is_protected, uint32 protection_state_id) {
347 protection_state_id_ = protection_state_id; 356 protection_state_id_ = protection_state_id;
348 if (frontbuffer_is_protected_ == is_protected) 357 if (frontbuffer_is_protected_ == is_protected)
349 return; 358 return;
350 frontbuffer_is_protected_ = is_protected; 359 frontbuffer_is_protected_ = is_protected;
351 AdjustFrontBufferAllocation(); 360 AdjustFrontBufferAllocation();
352 361
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 Texture& texture = textures_[i]; 515 Texture& texture = textures_[i];
507 texture.info = NULL; 516 texture.info = NULL;
508 if (!texture.sent_to_client) 517 if (!texture.sent_to_client)
509 continue; 518 continue;
510 GpuHostMsg_AcceleratedSurfaceRelease_Params params; 519 GpuHostMsg_AcceleratedSurfaceRelease_Params params;
511 params.identifier = texture.client_id; 520 params.identifier = texture.client_id;
512 helper_->SendAcceleratedSurfaceRelease(params); 521 helper_->SendAcceleratedSurfaceRelease(params);
513 } 522 }
514 parent_stub_ = NULL; 523 parent_stub_ = NULL;
515 } 524 }
OLDNEW
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698