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

Side by Side Diff: components/exo/surface.cc

Issue 2404513002: exo: Implement zcr_linux_explicit_synchronization_v1
Patch Set: Created 4 years, 2 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
OLDNEW
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/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 void Surface::Attach(Buffer* buffer) { 255 void Surface::Attach(Buffer* buffer) {
256 TRACE_EVENT1("exo", "Surface::Attach", "buffer", 256 TRACE_EVENT1("exo", "Surface::Attach", "buffer",
257 buffer ? buffer->GetSize().ToString() : "null"); 257 buffer ? buffer->GetSize().ToString() : "null");
258 258
259 has_pending_contents_ = true; 259 has_pending_contents_ = true;
260 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>()); 260 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>());
261 } 261 }
262 262
263 void Surface::FenceAcquire(std::unique_ptr<gfx::GpuFence> fence) {
264 // A better representation would be good here.
reveman 2016/10/09 19:03:17 TRACE_EVENT1(... "fence", !!fence) would be good e
fooishbar 2016/10/12 15:41:56 Done.
265 TRACE_EVENT1("exo", "Surface::FenceAcquire", "fence", fence.get());
266
267 pending_acquire_fence_ = std::move(fence);
268
269 DLOG(WARNING) << "Surface " << GetSurfaceId().ToString() << ": new acquire-fen ce";
reveman 2016/10/09 19:03:17 Please remove this debug log before landing this c
fooishbar 2016/10/12 15:41:55 Done.
270 }
271
263 void Surface::Damage(const gfx::Rect& damage) { 272 void Surface::Damage(const gfx::Rect& damage) {
264 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString()); 273 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString());
265 274
266 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op); 275 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op);
267 } 276 }
268 277
269 void Surface::RequestFrameCallback(const FrameCallback& callback) { 278 void Surface::RequestFrameCallback(const FrameCallback& callback) {
270 TRACE_EVENT0("exo", "Surface::RequestFrameCallback"); 279 TRACE_EVENT0("exo", "Surface::RequestFrameCallback");
271 280
272 pending_frame_callbacks_.push_back(callback); 281 pending_frame_callbacks_.push_back(callback);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 has_pending_layer_changes_ = false; 468 has_pending_layer_changes_ = false;
460 469
461 state_ = pending_state_; 470 state_ = pending_state_;
462 pending_state_.only_visible_on_secure_output = false; 471 pending_state_.only_visible_on_secure_output = false;
463 472
464 // We update contents if Attach() has been called since last commit. 473 // We update contents if Attach() has been called since last commit.
465 if (has_pending_contents_) { 474 if (has_pending_contents_) {
466 has_pending_contents_ = false; 475 has_pending_contents_ = false;
467 476
468 current_buffer_ = std::move(pending_buffer_); 477 current_buffer_ = std::move(pending_buffer_);
478 acquire_fence_ = std::move(pending_acquire_fence_);
469 479
470 UpdateResource(true); 480 UpdateResource(true);
471 } 481 }
472 482
473 cc::LocalFrameId old_local_frame_id = local_frame_id_; 483 cc::LocalFrameId old_local_frame_id = local_frame_id_;
474 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) { 484 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) {
475 needs_commit_to_new_surface_ = false; 485 needs_commit_to_new_surface_ = false;
476 local_frame_id_ = factory_owner_->id_allocator_->GenerateId(); 486 local_frame_id_ = factory_owner_->id_allocator_->GenerateId();
477 factory_owner_->surface_factory_->Create(local_frame_id_); 487 factory_owner_->surface_factory_->Create(local_frame_id_);
478 } 488 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 layer_size, contents_surface_to_layer_scale, layer_size); 718 layer_size, contents_surface_to_layer_scale, layer_size);
709 } 719 }
710 720
711 void Surface::UpdateResource(bool client_usage) { 721 void Surface::UpdateResource(bool client_usage) {
712 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; 722 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback;
713 723
714 cc::TextureMailbox texture_mailbox; 724 cc::TextureMailbox texture_mailbox;
715 if (current_buffer_.buffer()) { 725 if (current_buffer_.buffer()) {
716 texture_mailbox_release_callback = 726 texture_mailbox_release_callback =
717 current_buffer_.buffer()->ProduceTextureMailbox( 727 current_buffer_.buffer()->ProduceTextureMailbox(
718 &texture_mailbox, state_.only_visible_on_secure_output, 728 &texture_mailbox, std::move(acquire_fence_),
reveman 2016/10/09 19:03:17 I think we need to keep the ownership of the acqui
fooishbar 2016/10/12 15:41:56 Phew, that was my guess as to what probably made t
729 » state_.only_visible_on_secure_output,
719 client_usage); 730 client_usage);
720 } 731 }
721 732
722 if (texture_mailbox_release_callback) { 733 if (texture_mailbox_release_callback) {
723 cc::TransferableResource resource; 734 cc::TransferableResource resource;
724 resource.id = next_resource_id_++; 735 resource.id = next_resource_id_++;
725 resource.format = cc::RGBA_8888; 736 resource.format = cc::RGBA_8888;
726 resource.filter = 737 resource.filter =
727 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR; 738 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR;
728 resource.size = texture_mailbox.size_in_pixels(); 739 resource.size = texture_mailbox.size_in_pixels();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 860
850 int64_t Surface::GetPropertyInternal(const void* key, 861 int64_t Surface::GetPropertyInternal(const void* key,
851 int64_t default_value) const { 862 int64_t default_value) const {
852 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 863 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
853 if (iter == prop_map_.end()) 864 if (iter == prop_map_.end())
854 return default_value; 865 return default_value;
855 return iter->second.value; 866 return iter->second.value;
856 } 867 }
857 868
858 } // namespace exo 869 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698