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

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

Issue 2404513002: exo: Implement zcr_linux_explicit_synchronization_v1
Patch Set: rebase, pull in cl 2443823002 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 254 }
254 255
255 void Surface::Attach(Buffer* buffer) { 256 void Surface::Attach(Buffer* buffer) {
256 TRACE_EVENT1("exo", "Surface::Attach", "buffer", 257 TRACE_EVENT1("exo", "Surface::Attach", "buffer",
257 buffer ? buffer->GetSize().ToString() : "null"); 258 buffer ? buffer->GetSize().ToString() : "null");
258 259
259 has_pending_contents_ = true; 260 has_pending_contents_ = true;
260 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>()); 261 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>());
261 } 262 }
262 263
264 void Surface::SetAcquireFence(std::unique_ptr<gfx::GpuFence> fence) {
265 TRACE_EVENT1("exo", "Surface::FenceAcquire", "fence", !!fence);
266
267 pending_fence_ = std::move(fence);
268 }
269
263 void Surface::Damage(const gfx::Rect& damage) { 270 void Surface::Damage(const gfx::Rect& damage) {
264 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString()); 271 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString());
265 272
266 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op); 273 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op);
267 } 274 }
268 275
269 void Surface::RequestFrameCallback(const FrameCallback& callback) { 276 void Surface::RequestFrameCallback(const FrameCallback& callback) {
270 TRACE_EVENT0("exo", "Surface::RequestFrameCallback"); 277 TRACE_EVENT0("exo", "Surface::RequestFrameCallback");
271 278
272 pending_frame_callbacks_.push_back(callback); 279 pending_frame_callbacks_.push_back(callback);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 has_pending_layer_changes_ = false; 466 has_pending_layer_changes_ = false;
460 467
461 state_ = pending_state_; 468 state_ = pending_state_;
462 pending_state_.only_visible_on_secure_output = false; 469 pending_state_.only_visible_on_secure_output = false;
463 470
464 // We update contents if Attach() has been called since last commit. 471 // We update contents if Attach() has been called since last commit.
465 if (has_pending_contents_) { 472 if (has_pending_contents_) {
466 has_pending_contents_ = false; 473 has_pending_contents_ = false;
467 474
468 current_buffer_ = std::move(pending_buffer_); 475 current_buffer_ = std::move(pending_buffer_);
476 fence_ = std::move(pending_fence_);
469 477
470 UpdateResource(true); 478 UpdateResource(true);
471 } 479 }
472 480
473 cc::LocalFrameId old_local_frame_id = local_frame_id_; 481 cc::LocalFrameId old_local_frame_id = local_frame_id_;
474 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) { 482 if (needs_commit_to_new_surface_ || local_frame_id_.is_null()) {
475 needs_commit_to_new_surface_ = false; 483 needs_commit_to_new_surface_ = false;
476 local_frame_id_ = factory_owner_->id_allocator_->GenerateId(); 484 local_frame_id_ = factory_owner_->id_allocator_->GenerateId();
477 factory_owner_->surface_factory_->Create(local_frame_id_); 485 factory_owner_->surface_factory_->Create(local_frame_id_);
478 } 486 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 694 }
687 } 695 }
688 696
689 void Surface::UpdateResource(bool client_usage) { 697 void Surface::UpdateResource(bool client_usage) {
690 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; 698 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback;
691 699
692 cc::TextureMailbox texture_mailbox; 700 cc::TextureMailbox texture_mailbox;
693 if (current_buffer_.buffer()) { 701 if (current_buffer_.buffer()) {
694 texture_mailbox_release_callback = 702 texture_mailbox_release_callback =
695 current_buffer_.buffer()->ProduceTextureMailbox( 703 current_buffer_.buffer()->ProduceTextureMailbox(
696 &texture_mailbox, state_.only_visible_on_secure_output, 704 &texture_mailbox, fence_.get(),
697 client_usage); 705 state_.only_visible_on_secure_output, client_usage);
698 } 706 }
699 707
700 if (texture_mailbox_release_callback) { 708 if (texture_mailbox_release_callback) {
701 cc::TransferableResource resource; 709 cc::TransferableResource resource;
702 resource.id = next_resource_id_++; 710 resource.id = next_resource_id_++;
703 resource.format = cc::RGBA_8888; 711 resource.format = cc::RGBA_8888;
704 resource.filter = 712 resource.filter =
705 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR; 713 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR;
706 resource.size = texture_mailbox.size_in_pixels(); 714 resource.size = texture_mailbox.size_in_pixels();
707 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(), 715 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 832
825 int64_t Surface::GetPropertyInternal(const void* key, 833 int64_t Surface::GetPropertyInternal(const void* key,
826 int64_t default_value) const { 834 int64_t default_value) const {
827 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 835 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
828 if (iter == prop_map_.end()) 836 if (iter == prop_map_.end())
829 return default_value; 837 return default_value;
830 return iter->second.value; 838 return iter->second.value;
831 } 839 }
832 840
833 } // namespace exo 841 } // 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