| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 TextureImageTransportSurface::TextureImageTransportSurface( | 66 TextureImageTransportSurface::TextureImageTransportSurface( |
| 67 GpuChannelManager* manager, | 67 GpuChannelManager* manager, |
| 68 GpuCommandBufferStub* stub, | 68 GpuCommandBufferStub* stub, |
| 69 const gfx::GLSurfaceHandle& handle) | 69 const gfx::GLSurfaceHandle& handle) |
| 70 : fbo_id_(0), | 70 : fbo_id_(0), |
| 71 front_(0), | 71 front_(0), |
| 72 stub_destroyed_(false), | 72 stub_destroyed_(false), |
| 73 backbuffer_suggested_allocation_(true), | 73 backbuffer_suggested_allocation_(true), |
| 74 frontbuffer_suggested_allocation_(true), | 74 frontbuffer_suggested_allocation_(true), |
| 75 frontbuffer_is_protected_(true), |
| 76 protection_state_id_(0), |
| 75 handle_(handle), | 77 handle_(handle), |
| 76 parent_stub_(NULL) { | 78 parent_stub_(NULL) { |
| 77 helper_.reset(new ImageTransportHelper(this, | 79 helper_.reset(new ImageTransportHelper(this, |
| 78 manager, | 80 manager, |
| 79 stub, | 81 stub, |
| 80 gfx::kNullPluginWindow)); | 82 gfx::kNullPluginWindow)); |
| 81 | 83 |
| 82 stub->AddDestructionObserver(this); | 84 stub->AddDestructionObserver(this); |
| 83 } | 85 } |
| 84 | 86 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 180 } |
| 179 | 181 |
| 180 void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) { | 182 void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) { |
| 181 if (backbuffer_suggested_allocation_ == allocation) | 183 if (backbuffer_suggested_allocation_ == allocation) |
| 182 return; | 184 return; |
| 183 backbuffer_suggested_allocation_ = allocation; | 185 backbuffer_suggested_allocation_ = allocation; |
| 184 | 186 |
| 185 if (!helper_->MakeCurrent()) | 187 if (!helper_->MakeCurrent()) |
| 186 return; | 188 return; |
| 187 | 189 |
| 188 if (backbuffer_suggested_allocation_) | 190 if (backbuffer_suggested_allocation_) { |
| 191 DCHECK(!textures_[back()].info->service_id() || |
| 192 !textures_[back()].sent_to_client); |
| 189 CreateBackTexture(textures_[back()].size); | 193 CreateBackTexture(textures_[back()].size); |
| 190 else | 194 } else { |
| 191 ReleaseBackTexture(); | 195 ReleaseTexture(back()); |
| 196 } |
| 192 } | 197 } |
| 193 | 198 |
| 194 void TextureImageTransportSurface::SetFrontbufferAllocation(bool allocation) { | 199 void TextureImageTransportSurface::SetFrontbufferAllocation(bool allocation) { |
| 195 if (frontbuffer_suggested_allocation_ == allocation) | 200 if (frontbuffer_suggested_allocation_ == allocation) |
| 196 return; | 201 return; |
| 197 frontbuffer_suggested_allocation_ = allocation; | 202 frontbuffer_suggested_allocation_ = allocation; |
| 203 AdjustFrontBufferAllocation(); |
| 204 } |
| 205 |
| 206 void TextureImageTransportSurface::AdjustFrontBufferAllocation() { |
| 207 if (!helper_->MakeCurrent()) |
| 208 return; |
| 209 |
| 210 if (!frontbuffer_suggested_allocation_ && !frontbuffer_is_protected_ && |
| 211 textures_[front()].info->service_id()) { |
| 212 ReleaseTexture(front()); |
| 213 if (textures_[front()].sent_to_client) { |
| 214 GpuHostMsg_AcceleratedSurfaceRelease_Params params; |
| 215 params.identifier = textures_[front()].client_id; |
| 216 helper_->SendAcceleratedSurfaceRelease(params); |
| 217 textures_[front()].sent_to_client = false; |
| 218 } |
| 219 } |
| 198 } | 220 } |
| 199 | 221 |
| 200 void* TextureImageTransportSurface::GetShareHandle() { | 222 void* TextureImageTransportSurface::GetShareHandle() { |
| 201 return GetHandle(); | 223 return GetHandle(); |
| 202 } | 224 } |
| 203 | 225 |
| 204 void* TextureImageTransportSurface::GetDisplay() { | 226 void* TextureImageTransportSurface::GetDisplay() { |
| 205 return parent_stub_ ? parent_stub_->surface()->GetDisplay() : NULL; | 227 return parent_stub_ ? parent_stub_->surface()->GetDisplay() : NULL; |
| 206 } | 228 } |
| 207 | 229 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 228 CHECK_GL_ERROR(); | 250 CHECK_GL_ERROR(); |
| 229 fbo_id_ = 0; | 251 fbo_id_ = 0; |
| 230 } | 252 } |
| 231 | 253 |
| 232 stub_destroyed_ = true; | 254 stub_destroyed_ = true; |
| 233 } | 255 } |
| 234 } | 256 } |
| 235 | 257 |
| 236 bool TextureImageTransportSurface::SwapBuffers() { | 258 bool TextureImageTransportSurface::SwapBuffers() { |
| 237 DCHECK(backbuffer_suggested_allocation_); | 259 DCHECK(backbuffer_suggested_allocation_); |
| 238 if (!frontbuffer_suggested_allocation_) | 260 if (!frontbuffer_suggested_allocation_ || !frontbuffer_is_protected_) |
| 239 return true; | 261 return true; |
| 240 if (!parent_stub_) { | 262 if (!parent_stub_) { |
| 241 LOG(ERROR) << "SwapBuffers failed because no parent stub."; | 263 LOG(ERROR) << "SwapBuffers failed because no parent stub."; |
| 242 return false; | 264 return false; |
| 243 } | 265 } |
| 244 | 266 |
| 245 glFlush(); | 267 glFlush(); |
| 246 front_ = back(); | 268 front_ = back(); |
| 247 previous_damage_rect_ = gfx::Rect(textures_[front_].size); | 269 previous_damage_rect_ = gfx::Rect(textures_[front()].size); |
| 248 | 270 |
| 249 DCHECK(textures_[front_].client_id != 0); | 271 DCHECK(textures_[front()].client_id != 0); |
| 250 | 272 |
| 251 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 273 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
| 252 params.surface_handle = textures_[front_].client_id; | 274 params.surface_handle = textures_[front()].client_id; |
| 275 params.protection_state_id = protection_state_id_; |
| 276 params.skip_ack = false; |
| 253 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 277 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
| 254 helper_->SetScheduled(false); | 278 helper_->SetScheduled(false); |
| 255 return true; | 279 return true; |
| 256 } | 280 } |
| 257 | 281 |
| 258 bool TextureImageTransportSurface::PostSubBuffer( | 282 bool TextureImageTransportSurface::PostSubBuffer( |
| 259 int x, int y, int width, int height) { | 283 int x, int y, int width, int height) { |
| 260 DCHECK(backbuffer_suggested_allocation_); | 284 DCHECK(backbuffer_suggested_allocation_); |
| 261 if (!frontbuffer_suggested_allocation_) | 285 DCHECK(textures_[back()].info->service_id()); |
| 286 if (!frontbuffer_suggested_allocation_ || !frontbuffer_is_protected_) |
| 262 return true; | 287 return true; |
| 263 // If we are recreating the frontbuffer with this swap, make sure we are | 288 // If we are recreating the frontbuffer with this swap, make sure we are |
| 264 // drawing a full frame. | 289 // drawing a full frame. |
| 265 DCHECK(textures_[front_].info->service_id() || | 290 DCHECK(textures_[front()].info->service_id() || |
| 266 (!x && !y && gfx::Size(width, height) == textures_[back()].size)); | 291 (!x && !y && gfx::Size(width, height) == textures_[back()].size)); |
| 267 if (!parent_stub_) { | 292 if (!parent_stub_) { |
| 268 LOG(ERROR) << "PostSubBuffer failed because no parent stub."; | 293 LOG(ERROR) << "PostSubBuffer failed because no parent stub."; |
| 269 return false; | 294 return false; |
| 270 } | 295 } |
| 271 | 296 |
| 272 DCHECK(textures_[back()].info); | |
| 273 int back_texture_service_id = textures_[back()].info->service_id(); | |
| 274 | |
| 275 DCHECK(textures_[front_].info); | |
| 276 int front_texture_service_id = textures_[front_].info->service_id(); | |
| 277 | |
| 278 gfx::Size expected_size = textures_[back()].size; | |
| 279 bool surfaces_same_size = textures_[front_].size == expected_size; | |
| 280 | |
| 281 const gfx::Rect new_damage_rect(x, y, width, height); | 297 const gfx::Rect new_damage_rect(x, y, width, height); |
| 282 | 298 |
| 283 // An empty damage rect is a successful no-op. | 299 // An empty damage rect is a successful no-op. |
| 284 if (new_damage_rect.IsEmpty()) | 300 if (new_damage_rect.IsEmpty()) |
| 285 return true; | 301 return true; |
| 286 | 302 |
| 303 int back_texture_service_id = textures_[back()].info->service_id(); |
| 304 int front_texture_service_id = textures_[front()].info->service_id(); |
| 305 |
| 306 gfx::Size expected_size = textures_[back()].size; |
| 307 bool surfaces_same_size = textures_[front()].size == expected_size; |
| 308 |
| 287 if (surfaces_same_size) { | 309 if (surfaces_same_size) { |
| 288 std::vector<gfx::Rect> regions_to_copy; | 310 std::vector<gfx::Rect> regions_to_copy; |
| 289 GetRegionsToCopy(previous_damage_rect_, new_damage_rect, ®ions_to_copy); | 311 GetRegionsToCopy(previous_damage_rect_, new_damage_rect, ®ions_to_copy); |
| 290 | 312 |
| 291 ScopedFrameBufferBinder fbo_binder(fbo_id_); | 313 ScopedFrameBufferBinder fbo_binder(fbo_id_); |
| 292 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, | 314 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, |
| 293 GL_COLOR_ATTACHMENT0, | 315 GL_COLOR_ATTACHMENT0, |
| 294 GL_TEXTURE_2D, | 316 GL_TEXTURE_2D, |
| 295 front_texture_service_id, | 317 front_texture_service_id, |
| 296 0); | 318 0); |
| 297 ScopedTextureBinder texture_binder(back_texture_service_id); | 319 ScopedTextureBinder texture_binder(back_texture_service_id); |
| 298 | 320 |
| 299 for (size_t i = 0; i < regions_to_copy.size(); ++i) { | 321 for (size_t i = 0; i < regions_to_copy.size(); ++i) { |
| 300 const gfx::Rect& region_to_copy = regions_to_copy[i]; | 322 const gfx::Rect& region_to_copy = regions_to_copy[i]; |
| 301 if (!region_to_copy.IsEmpty()) { | 323 if (!region_to_copy.IsEmpty()) { |
| 302 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, region_to_copy.x(), | 324 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, region_to_copy.x(), |
| 303 region_to_copy.y(), region_to_copy.x(), region_to_copy.y(), | 325 region_to_copy.y(), region_to_copy.x(), region_to_copy.y(), |
| 304 region_to_copy.width(), region_to_copy.height()); | 326 region_to_copy.width(), region_to_copy.height()); |
| 305 } | 327 } |
| 306 } | 328 } |
| 307 } else { | 329 } else { |
| 308 DCHECK(new_damage_rect == gfx::Rect(expected_size)); | 330 DCHECK(new_damage_rect == gfx::Rect(expected_size)); |
| 309 } | 331 } |
| 310 | 332 |
| 311 glFlush(); | 333 glFlush(); |
| 312 front_ = back(); | 334 front_ = back(); |
| 335 previous_damage_rect_ = new_damage_rect; |
| 336 |
| 337 DCHECK(textures_[front()].client_id); |
| 313 | 338 |
| 314 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; | 339 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; |
| 315 params.surface_handle = textures_[front_].client_id; | 340 params.surface_handle = textures_[front()].client_id; |
| 316 params.x = x; | 341 params.x = x; |
| 317 params.y = y; | 342 params.y = y; |
| 318 params.width = width; | 343 params.width = width; |
| 319 params.height = height; | 344 params.height = height; |
| 345 params.protection_state_id = protection_state_id_; |
| 320 helper_->SendAcceleratedSurfacePostSubBuffer(params); | 346 helper_->SendAcceleratedSurfacePostSubBuffer(params); |
| 321 helper_->SetScheduled(false); | 347 helper_->SetScheduled(false); |
| 322 | |
| 323 previous_damage_rect_ = new_damage_rect; | |
| 324 return true; | 348 return true; |
| 325 } | 349 } |
| 326 | 350 |
| 327 std::string TextureImageTransportSurface::GetExtensions() { | 351 std::string TextureImageTransportSurface::GetExtensions() { |
| 328 std::string extensions = gfx::GLSurface::GetExtensions(); | 352 std::string extensions = gfx::GLSurface::GetExtensions(); |
| 329 extensions += extensions.empty() ? "" : " "; | 353 extensions += extensions.empty() ? "" : " "; |
| 330 extensions += "GL_CHROMIUM_front_buffer_cached "; | 354 extensions += "GL_CHROMIUM_front_buffer_cached "; |
| 331 extensions += "GL_CHROMIUM_post_sub_buffer"; | 355 extensions += "GL_CHROMIUM_post_sub_buffer"; |
| 332 return extensions; | 356 return extensions; |
| 333 } | 357 } |
| 334 | 358 |
| 335 gfx::Size TextureImageTransportSurface::GetSize() { | 359 gfx::Size TextureImageTransportSurface::GetSize() { |
| 336 gfx::Size size = textures_[back()].size; | 360 gfx::Size size = textures_[back()].size; |
| 337 | 361 |
| 338 // OSMesa expects a non-zero size. | 362 // OSMesa expects a non-zero size. |
| 339 return gfx::Size(size.width() == 0 ? 1 : size.width(), | 363 return gfx::Size(size.width() == 0 ? 1 : size.width(), |
| 340 size.height() == 0 ? 1 : size.height()); | 364 size.height() == 0 ? 1 : size.height()); |
| 341 } | 365 } |
| 342 | 366 |
| 343 void* TextureImageTransportSurface::GetHandle() { | 367 void* TextureImageTransportSurface::GetHandle() { |
| 344 return parent_stub_ ? parent_stub_->surface()->GetHandle() : NULL; | 368 return parent_stub_ ? parent_stub_->surface()->GetHandle() : NULL; |
| 345 } | 369 } |
| 346 | 370 |
| 347 unsigned TextureImageTransportSurface::GetFormat() { | 371 unsigned TextureImageTransportSurface::GetFormat() { |
| 348 return parent_stub_ ? parent_stub_->surface()->GetFormat() : 0; | 372 return parent_stub_ ? parent_stub_->surface()->GetFormat() : 0; |
| 349 } | 373 } |
| 350 | 374 |
| 375 void TextureImageTransportSurface::OnSetFrontSurfaceIsProtected( |
| 376 bool is_protected, uint32 protection_state_id) { |
| 377 protection_state_id_ = protection_state_id; |
| 378 if (frontbuffer_is_protected_ == is_protected) |
| 379 return; |
| 380 frontbuffer_is_protected_ = is_protected; |
| 381 AdjustFrontBufferAllocation(); |
| 382 |
| 383 // If surface is set to protected, and we haven't actually released it yet, |
| 384 // we can set the ui surface handle now just by sending a swap message. |
| 385 if (is_protected && textures_[front()].info->service_id() && |
| 386 textures_[front()].sent_to_client) { |
| 387 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
| 388 params.surface_handle = textures_[front()].client_id; |
| 389 params.protection_state_id = protection_state_id_; |
| 390 params.skip_ack = true; |
| 391 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
| 392 } |
| 393 } |
| 394 |
| 351 void TextureImageTransportSurface::OnBufferPresented(uint32 sync_point) { | 395 void TextureImageTransportSurface::OnBufferPresented(uint32 sync_point) { |
| 352 if (sync_point == 0) { | 396 if (sync_point == 0) { |
| 353 BufferPresentedImpl(); | 397 BufferPresentedImpl(); |
| 354 } else { | 398 } else { |
| 355 helper_->manager()->sync_point_manager()->AddSyncPointCallback( | 399 helper_->manager()->sync_point_manager()->AddSyncPointCallback( |
| 356 sync_point, | 400 sync_point, |
| 357 base::Bind(&TextureImageTransportSurface::BufferPresentedImpl, | 401 base::Bind(&TextureImageTransportSurface::BufferPresentedImpl, |
| 358 this->AsWeakPtr())); | 402 this->AsWeakPtr())); |
| 359 } | 403 } |
| 360 } | 404 } |
| 361 | 405 |
| 362 void TextureImageTransportSurface::BufferPresentedImpl() { | 406 void TextureImageTransportSurface::BufferPresentedImpl() { |
| 363 // We're relying on the fact that the parent context is | 407 // We're relying on the fact that the parent context is |
| 364 // finished with it's context when it inserts the sync point that | 408 // finished with it's context when it inserts the sync point that |
| 365 // triggers this callback. | 409 // triggers this callback. |
| 366 if (helper_->MakeCurrent()) { | 410 if (helper_->MakeCurrent()) { |
| 367 if (textures_[front_].size != textures_[back()].size) { | 411 if (textures_[front()].size != textures_[back()].size || |
| 368 CreateBackTexture(textures_[front_].size); | 412 !textures_[back()].info->service_id() || |
| 413 !textures_[back()].sent_to_client) { |
| 414 // We may get an ACK from a stale swap just to reschedule. In that case, |
| 415 // we may not have a backbuffer suggestion and should not recreate one. |
| 416 if (backbuffer_suggested_allocation_) |
| 417 CreateBackTexture(textures_[front()].size); |
| 369 } else { | 418 } else { |
| 370 AttachBackTextureToFBO(); | 419 AttachBackTextureToFBO(); |
| 371 } | 420 } |
| 372 } | 421 } |
| 373 | 422 |
| 374 // Even if MakeCurrent fails, schedule anyway, to trigger the lost context | 423 // Even if MakeCurrent fails, schedule anyway, to trigger the lost context |
| 375 // logic. | 424 // logic. |
| 376 helper_->SetScheduled(true); | 425 helper_->SetScheduled(true); |
| 377 } | 426 } |
| 378 | 427 |
| 379 void TextureImageTransportSurface::OnResizeViewACK() { | 428 void TextureImageTransportSurface::OnResizeViewACK() { |
| 380 NOTREACHED(); | 429 NOTREACHED(); |
| 381 } | 430 } |
| 382 | 431 |
| 383 void TextureImageTransportSurface::ReleaseBackTexture() { | 432 void TextureImageTransportSurface::ReleaseTexture(int id) { |
| 384 if (!parent_stub_) | 433 if (!parent_stub_) |
| 385 return; | 434 return; |
| 386 TextureInfo* info = textures_[back()].info; | 435 Texture& texture = textures_[id]; |
| 436 TextureInfo* info = texture.info; |
| 387 DCHECK(info); | 437 DCHECK(info); |
| 388 | 438 |
| 389 GLuint service_id = info->service_id(); | 439 GLuint service_id = info->service_id(); |
| 390 if (!service_id) | 440 if (!service_id) |
| 391 return; | 441 return; |
| 392 info->SetServiceId(0); | 442 info->SetServiceId(0); |
| 393 | 443 |
| 394 { | 444 { |
| 395 ScopedFrameBufferBinder fbo_binder(fbo_id_); | 445 ScopedFrameBufferBinder fbo_binder(fbo_id_); |
| 396 glDeleteTextures(1, &service_id); | 446 glDeleteTextures(1, &service_id); |
| 397 } | 447 } |
| 398 glFlush(); | 448 glFlush(); |
| 399 CHECK_GL_ERROR(); | 449 CHECK_GL_ERROR(); |
| 400 } | 450 } |
| 401 | 451 |
| 402 void TextureImageTransportSurface::CreateBackTexture(const gfx::Size& size) { | 452 void TextureImageTransportSurface::CreateBackTexture(const gfx::Size& size) { |
| 403 if (!parent_stub_) | 453 if (!parent_stub_) |
| 404 return; | 454 return; |
| 405 Texture& texture = textures_[back()]; | 455 Texture& texture = textures_[back()]; |
| 406 TextureInfo* info = texture.info; | 456 TextureInfo* info = texture.info; |
| 407 DCHECK(info); | 457 DCHECK(info); |
| 408 | 458 |
| 409 GLuint service_id = info->service_id(); | 459 GLuint service_id = info->service_id(); |
| 410 | 460 |
| 411 if (service_id && texture.size == size) | 461 if (service_id && texture.size == size && texture.sent_to_client) |
| 412 return; | 462 return; |
| 413 | 463 |
| 414 if (!service_id) { | 464 if (!service_id) { |
| 415 glGenTextures(1, &service_id); | 465 glGenTextures(1, &service_id); |
| 416 info->SetServiceId(service_id); | 466 info->SetServiceId(service_id); |
| 417 } | 467 } |
| 418 | 468 |
| 419 if (size != texture.size) { | 469 if (size != texture.size) { |
| 420 texture.size = size; | 470 texture.size = size; |
| 421 TextureManager* texture_manager = | 471 TextureManager* texture_manager = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 452 params.width = size.width(); | 502 params.width = size.width(); |
| 453 params.height = size.height(); | 503 params.height = size.height(); |
| 454 params.surface_handle = texture.client_id; | 504 params.surface_handle = texture.client_id; |
| 455 helper_->SendAcceleratedSurfaceNew(params); | 505 helper_->SendAcceleratedSurfaceNew(params); |
| 456 texture.sent_to_client = true; | 506 texture.sent_to_client = true; |
| 457 } | 507 } |
| 458 | 508 |
| 459 void TextureImageTransportSurface::AttachBackTextureToFBO() { | 509 void TextureImageTransportSurface::AttachBackTextureToFBO() { |
| 460 if (!parent_stub_) | 510 if (!parent_stub_) |
| 461 return; | 511 return; |
| 462 DCHECK(textures_[back()].info); | 512 TextureInfo* info = textures_[back()].info; |
| 513 DCHECK(info); |
| 463 | 514 |
| 464 ScopedFrameBufferBinder fbo_binder(fbo_id_); | 515 ScopedFrameBufferBinder fbo_binder(fbo_id_); |
| 465 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, | 516 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, |
| 466 GL_COLOR_ATTACHMENT0, | 517 GL_COLOR_ATTACHMENT0, |
| 467 GL_TEXTURE_2D, | 518 GL_TEXTURE_2D, |
| 468 textures_[back()].info->service_id(), | 519 info->service_id(), |
| 469 0); | 520 0); |
| 470 glFlush(); | 521 glFlush(); |
| 471 CHECK_GL_ERROR(); | 522 CHECK_GL_ERROR(); |
| 472 | 523 |
| 473 #ifndef NDEBUG | 524 #ifndef NDEBUG |
| 474 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 525 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 475 if (status != GL_FRAMEBUFFER_COMPLETE) { | 526 if (status != GL_FRAMEBUFFER_COMPLETE) { |
| 476 DLOG(ERROR) << "Framebuffer incomplete."; | 527 DLOG(ERROR) << "Framebuffer incomplete."; |
| 477 } | 528 } |
| 478 #endif | 529 #endif |
| 479 } | 530 } |
| 480 | 531 |
| 481 void TextureImageTransportSurface::ReleaseParentStub() { | 532 void TextureImageTransportSurface::ReleaseParentStub() { |
| 482 DCHECK(parent_stub_); | 533 DCHECK(parent_stub_); |
| 483 parent_stub_->RemoveDestructionObserver(this); | 534 parent_stub_->RemoveDestructionObserver(this); |
| 484 for (int i = 0; i < 2; ++i) { | 535 for (int i = 0; i < 2; ++i) { |
| 485 Texture& texture = textures_[i]; | 536 Texture& texture = textures_[i]; |
| 486 texture.info = NULL; | 537 texture.info = NULL; |
| 487 if (!texture.sent_to_client) | 538 if (!texture.sent_to_client) |
| 488 continue; | 539 continue; |
| 489 GpuHostMsg_AcceleratedSurfaceRelease_Params params; | 540 GpuHostMsg_AcceleratedSurfaceRelease_Params params; |
| 490 params.identifier = texture.client_id; | 541 params.identifier = texture.client_id; |
| 491 helper_->SendAcceleratedSurfaceRelease(params); | 542 helper_->SendAcceleratedSurfaceRelease(params); |
| 492 } | 543 } |
| 493 parent_stub_ = NULL; | 544 parent_stub_ = NULL; |
| 494 } | 545 } |
| OLD | NEW |