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

Side by Side Diff: content/common/gpu/image_transport_surface_overlay_mac.h

Issue 1280033004: Revert of Mac Overlays: Add GPU back-pressure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
7 7
8 #include <deque>
9
10 #include "base/memory/linked_ptr.h"
11 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
12 #include "content/common/gpu/gpu_command_buffer_stub.h" 9 #include "content/common/gpu/gpu_command_buffer_stub.h"
13 #include "content/common/gpu/image_transport_surface.h" 10 #include "content/common/gpu/image_transport_surface.h"
14 #include "ui/accelerated_widget_mac/display_link_mac.h"
15 #include "ui/gl/gl_surface.h" 11 #include "ui/gl/gl_surface.h"
16 12
17 @class CAContext; 13 @class CAContext;
18 @class CALayer; 14 @class CALayer;
19 15
20 namespace content { 16 namespace content {
21 17
22 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, 18 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
23 public ImageTransportSurface { 19 public ImageTransportSurface {
24 public: 20 public:
(...skipping 19 matching lines...) Expand all
44 bool IsSurfaceless() const override; 40 bool IsSurfaceless() const override;
45 41
46 // ImageTransportSurface implementation 42 // ImageTransportSurface implementation
47 void OnBufferPresented( 43 void OnBufferPresented(
48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; 44 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override;
49 void OnResize(gfx::Size pixel_size, float scale_factor) override; 45 void OnResize(gfx::Size pixel_size, float scale_factor) override;
50 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override; 46 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override;
51 void WakeUpGpu() override; 47 void WakeUpGpu() override;
52 48
53 private: 49 private:
54 class PendingSwap;
55
56 ~ImageTransportSurfaceOverlayMac() override; 50 ~ImageTransportSurfaceOverlayMac() override;
57
58 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect);
59
60 // Returns true if the front of |pending_swaps_| has completed, or has timed
61 // out by |now|.
62 bool IsFirstPendingSwapReadyToDisplay(
63 const base::TimeTicks& now);
64 // Sets the CALayer contents to the IOSurface for the front of
65 // |pending_swaps_|, and removes it from the queue.
66 void DisplayFirstPendingSwapImmediately();
67 // Force that all of |pending_swaps_| displayed immediately, and the list be
68 // cleared.
69 void FinishAllPendingSwaps();
70 // Callback issued during the next vsync period ofter a SwapBuffers call,
71 // to check if the swap is completed, and display the frame. Note that if
72 // another SwapBuffers happens before this callback, the pending swap will
73 // be tested at that time, too.
74 void CheckPendingSwapsCallback();
75 // Function to post the above callback. The argument |now| is passed as an
76 // argument to avoid redundant calls to base::TimeTicks::Now.
77 void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now);
78
79 scoped_ptr<ImageTransportHelper> helper_; 51 scoped_ptr<ImageTransportHelper> helper_;
80 base::scoped_nsobject<CAContext> ca_context_; 52 base::scoped_nsobject<CAContext> ca_context_;
81 base::scoped_nsobject<CALayer> layer_; 53 base::scoped_nsobject<CALayer> layer_;
82 54
55 // A phony NSView handle used to identify this.
56 gfx::AcceleratedWidget widget_;
57
83 gfx::Size pixel_size_; 58 gfx::Size pixel_size_;
84 float scale_factor_; 59 float scale_factor_;
85 std::vector<ui::LatencyInfo> latency_info_; 60 std::vector<ui::LatencyInfo> latency_info_;
86 61
87 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is 62 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is
88 // consumed and reset when SwapBuffers is called. For now, only one overlay 63 // consumed and reset when SwapBuffers is called. For now, only one overlay
89 // plane is supported. 64 // plane is supported.
90 gfx::GLImage* pending_overlay_image_; 65 gfx::GLImage* pending_overlay_image_;
91
92 // A queue of all frames that have been created by SwapBuffersInternal but
93 // have not yet been displayed. This queue is checked at the beginning of
94 // every swap and also by a callback.
95 std::deque<linked_ptr<PendingSwap>> pending_swaps_;
96
97 // The display link used to compute the time for callbacks.
98 scoped_refptr<ui::DisplayLinkMac> display_link_mac_;
99
100 // True if there is a pending call to CheckPendingSwapsCallback posted.
101 bool has_pending_callback_;
102
103 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_;
104 }; 66 };
105 67
106 } // namespace content 68 } // namespace content
107 69
108 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ 70 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_calayer_mac.mm ('k') | content/common/gpu/image_transport_surface_overlay_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698