| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/buffer.h" | 5 #include "components/exo/buffer.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 release_contents_callback_.Reset( | 450 release_contents_callback_.Reset( |
| 451 base::Bind(&Buffer::ReleaseContents, base::Unretained(this))); | 451 base::Bind(&Buffer::ReleaseContents, base::Unretained(this))); |
| 452 | 452 |
| 453 // Zero-copy means using the contents texture directly. | 453 // Zero-copy means using the contents texture directly. |
| 454 if (use_zero_copy_) { | 454 if (use_zero_copy_) { |
| 455 // This binds the latest contents of this buffer to |contents_texture|. | 455 // This binds the latest contents of this buffer to |contents_texture|. |
| 456 gpu::SyncToken sync_token = contents_texture->BindTexImage(); | 456 gpu::SyncToken sync_token = contents_texture->BindTexImage(); |
| 457 resource->mailbox_holder = gpu::MailboxHolder(contents_texture->mailbox(), | 457 resource->mailbox_holder = gpu::MailboxHolder(contents_texture->mailbox(), |
| 458 sync_token, texture_target_); | 458 sync_token, texture_target_); |
| 459 resource->is_overlay_candidate = is_overlay_candidate_; | 459 resource->is_overlay_candidate = is_overlay_candidate_; |
| 460 resource->buffer_format = gpu_memory_buffer_->GetFormat(); |
| 460 | 461 |
| 461 // The contents texture will be released when no longer used by the | 462 // The contents texture will be released when no longer used by the |
| 462 // compositor. | 463 // compositor. |
| 463 compositor_frame_sink_holder_->SetResourceReleaseCallback( | 464 compositor_frame_sink_holder_->SetResourceReleaseCallback( |
| 464 resource_id, | 465 resource_id, |
| 465 base::Bind(&Buffer::Texture::ReleaseTexImage, | 466 base::Bind(&Buffer::Texture::ReleaseTexImage, |
| 466 base::Unretained(contents_texture), | 467 base::Unretained(contents_texture), |
| 467 base::Bind(&Buffer::ReleaseContentsTexture, AsWeakPtr(), | 468 base::Bind(&Buffer::ReleaseContentsTexture, AsWeakPtr(), |
| 468 base::Passed(&contents_texture_), | 469 base::Passed(&contents_texture_), |
| 469 release_contents_callback_.callback()))); | 470 release_contents_callback_.callback()))); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 558 |
| 558 // Cancel callback to indicate that buffer has been released. | 559 // Cancel callback to indicate that buffer has been released. |
| 559 release_contents_callback_.Cancel(); | 560 release_contents_callback_.Cancel(); |
| 560 | 561 |
| 561 // Release buffer if not attached to surface. | 562 // Release buffer if not attached to surface. |
| 562 if (!attach_count_) | 563 if (!attach_count_) |
| 563 Release(); | 564 Release(); |
| 564 } | 565 } |
| 565 | 566 |
| 566 } // namespace exo | 567 } // namespace exo |
| OLD | NEW |