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

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

Issue 2452523002: exo: Add zcr_linux_explicit_synchronization_v1
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « components/exo/surface.h ('k') | components/exo/wayland/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 #include "ui/aura/window_delegate.h" 29 #include "ui/aura/window_delegate.h"
30 #include "ui/aura/window_property.h" 30 #include "ui/aura/window_property.h"
31 #include "ui/aura/window_targeter.h" 31 #include "ui/aura/window_targeter.h"
32 #include "ui/base/cursor/cursor.h" 32 #include "ui/base/cursor/cursor.h"
33 #include "ui/base/hit_test.h" 33 #include "ui/base/hit_test.h"
34 #include "ui/compositor/layer.h" 34 #include "ui/compositor/layer.h"
35 #include "ui/events/event.h" 35 #include "ui/events/event.h"
36 #include "ui/gfx/buffer_format_util.h" 36 #include "ui/gfx/buffer_format_util.h"
37 #include "ui/gfx/geometry/safe_integer_conversions.h" 37 #include "ui/gfx/geometry/safe_integer_conversions.h"
38 #include "ui/gfx/geometry/size_conversions.h" 38 #include "ui/gfx/geometry/size_conversions.h"
39 #include "ui/gfx/gpu_fence.h"
39 #include "ui/gfx/gpu_memory_buffer.h" 40 #include "ui/gfx/gpu_memory_buffer.h"
40 #include "ui/gfx/path.h" 41 #include "ui/gfx/path.h"
41 #include "ui/gfx/skia_util.h" 42 #include "ui/gfx/skia_util.h"
42 #include "ui/gfx/transform_util.h" 43 #include "ui/gfx/transform_util.h"
43 #include "ui/views/widget/widget.h" 44 #include "ui/views/widget/widget.h"
44 45
45 DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*); 46 DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*);
46 47
47 namespace exo { 48 namespace exo {
48 namespace { 49 namespace {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 255 }
255 256
256 void Surface::Attach(Buffer* buffer) { 257 void Surface::Attach(Buffer* buffer) {
257 TRACE_EVENT1("exo", "Surface::Attach", "buffer", 258 TRACE_EVENT1("exo", "Surface::Attach", "buffer",
258 buffer ? buffer->GetSize().ToString() : "null"); 259 buffer ? buffer->GetSize().ToString() : "null");
259 260
260 has_pending_contents_ = true; 261 has_pending_contents_ = true;
261 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>()); 262 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>());
262 } 263 }
263 264
265 void Surface::SetAcquireFence(std::unique_ptr<gfx::GpuFence> fence) {
266 TRACE_EVENT1("exo", "Surface::FenceAcquire", "fence", !!fence);
267
268 pending_fence_ = std::move(fence);
269 }
270
264 void Surface::Damage(const gfx::Rect& damage) { 271 void Surface::Damage(const gfx::Rect& damage) {
265 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString()); 272 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString());
266 273
267 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op); 274 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op);
268 } 275 }
269 276
270 void Surface::RequestFrameCallback(const FrameCallback& callback) { 277 void Surface::RequestFrameCallback(const FrameCallback& callback) {
271 TRACE_EVENT0("exo", "Surface::RequestFrameCallback"); 278 TRACE_EVENT0("exo", "Surface::RequestFrameCallback");
272 279
273 pending_frame_callbacks_.push_back(callback); 280 pending_frame_callbacks_.push_back(callback);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 has_pending_layer_changes_ = false; 467 has_pending_layer_changes_ = false;
461 468
462 state_ = pending_state_; 469 state_ = pending_state_;
463 pending_state_.only_visible_on_secure_output = false; 470 pending_state_.only_visible_on_secure_output = false;
464 471
465 // We update contents if Attach() has been called since last commit. 472 // We update contents if Attach() has been called since last commit.
466 if (has_pending_contents_) { 473 if (has_pending_contents_) {
467 has_pending_contents_ = false; 474 has_pending_contents_ = false;
468 475
469 current_buffer_ = std::move(pending_buffer_); 476 current_buffer_ = std::move(pending_buffer_);
477 fence_ = std::move(pending_fence_);
470 478
471 UpdateResource(true); 479 UpdateResource(true);
472 } 480 }
473 481
474 cc::LocalFrameId old_local_frame_id = local_frame_id_; 482 cc::LocalFrameId old_local_frame_id = local_frame_id_;
475 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) { 483 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) {
476 needs_commit_to_new_surface_ = false; 484 needs_commit_to_new_surface_ = false;
477 local_frame_id_ = factory_owner_->id_allocator_->GenerateId(); 485 local_frame_id_ = factory_owner_->id_allocator_->GenerateId();
478 factory_owner_->surface_factory_->Create(local_frame_id_); 486 factory_owner_->surface_factory_->Create(local_frame_id_);
479 } 487 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 layer_size, contents_surface_to_layer_scale, layer_size); 717 layer_size, contents_surface_to_layer_scale, layer_size);
710 } 718 }
711 719
712 void Surface::UpdateResource(bool client_usage) { 720 void Surface::UpdateResource(bool client_usage) {
713 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; 721 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback;
714 722
715 cc::TextureMailbox texture_mailbox; 723 cc::TextureMailbox texture_mailbox;
716 if (current_buffer_.buffer()) { 724 if (current_buffer_.buffer()) {
717 texture_mailbox_release_callback = 725 texture_mailbox_release_callback =
718 current_buffer_.buffer()->ProduceTextureMailbox( 726 current_buffer_.buffer()->ProduceTextureMailbox(
719 &texture_mailbox, state_.only_visible_on_secure_output, 727 &texture_mailbox, fence_.get(),
720 client_usage); 728 state_.only_visible_on_secure_output, client_usage);
721 } 729 }
722 730
723 if (texture_mailbox_release_callback) { 731 if (texture_mailbox_release_callback) {
724 cc::TransferableResource resource; 732 cc::TransferableResource resource;
725 resource.id = next_resource_id_++; 733 resource.id = next_resource_id_++;
726 resource.format = cc::RGBA_8888; 734 resource.format = cc::RGBA_8888;
727 resource.filter = 735 resource.filter =
728 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR; 736 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR;
729 resource.size = texture_mailbox.size_in_pixels(); 737 resource.size = texture_mailbox.size_in_pixels();
730 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(), 738 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(),
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 858
851 int64_t Surface::GetPropertyInternal(const void* key, 859 int64_t Surface::GetPropertyInternal(const void* key,
852 int64_t default_value) const { 860 int64_t default_value) const {
853 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 861 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
854 if (iter == prop_map_.end()) 862 if (iter == prop_map_.end())
855 return default_value; 863 return default_value;
856 return iter->second.value; 864 return iter->second.value;
857 } 865 }
858 866
859 } // namespace exo 867 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/surface.h ('k') | components/exo/wayland/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698