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

Side by Side Diff: components/display_compositor/buffer_queue.h

Issue 2612023002: cc: Implement overdraw feedback debugging feature. (Closed)
Patch Set: make sure overdraw_feedback_ is initialized and reset properly Created 3 years, 11 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/display_compositor/buffer_queue.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ 5 #ifndef COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
6 #define COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ 6 #define COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 gpu::SurfaceHandle surface_handle); 51 gpu::SurfaceHandle surface_handle);
52 virtual ~BufferQueue(); 52 virtual ~BufferQueue();
53 53
54 void Initialize(); 54 void Initialize();
55 55
56 void BindFramebuffer(); 56 void BindFramebuffer();
57 void SwapBuffers(const gfx::Rect& damage); 57 void SwapBuffers(const gfx::Rect& damage);
58 void PageFlipComplete(); 58 void PageFlipComplete();
59 void Reshape(const gfx::Size& size, 59 void Reshape(const gfx::Size& size,
60 float scale_factor, 60 float scale_factor,
61 const gfx::ColorSpace& color_space); 61 const gfx::ColorSpace& color_space,
62 bool use_stencil);
62 63
63 void RecreateBuffers(); 64 void RecreateBuffers();
64 65
65 uint32_t current_texture_id() const { 66 uint32_t current_texture_id() const {
66 return current_surface_ ? current_surface_->texture : 0; 67 return current_surface_ ? current_surface_->texture : 0;
67 } 68 }
68 uint32_t fbo() const { return fbo_; } 69 uint32_t fbo() const { return fbo_; }
69 uint32_t internal_format() const { return internal_format_; } 70 uint32_t internal_format() const { return internal_format_; }
70 71
71 private: 72 private:
72 friend class BufferQueueTest; 73 friend class BufferQueueTest;
73 friend class AllocatedSurface; 74 friend class AllocatedSurface;
74 75
75 struct DISPLAY_COMPOSITOR_EXPORT AllocatedSurface { 76 struct DISPLAY_COMPOSITOR_EXPORT AllocatedSurface {
76 AllocatedSurface(BufferQueue* buffer_queue, 77 AllocatedSurface(BufferQueue* buffer_queue,
77 std::unique_ptr<gfx::GpuMemoryBuffer> buffer, 78 std::unique_ptr<gfx::GpuMemoryBuffer> buffer,
78 uint32_t texture, 79 uint32_t texture,
79 uint32_t image, 80 uint32_t image,
81 uint32_t stencil,
80 const gfx::Rect& rect); 82 const gfx::Rect& rect);
81 ~AllocatedSurface(); 83 ~AllocatedSurface();
82 BufferQueue* const buffer_queue; 84 BufferQueue* const buffer_queue;
83 std::unique_ptr<gfx::GpuMemoryBuffer> buffer; 85 std::unique_ptr<gfx::GpuMemoryBuffer> buffer;
84 const uint32_t texture; 86 const uint32_t texture;
85 const uint32_t image; 87 const uint32_t image;
88 const uint32_t stencil;
86 gfx::Rect damage; // This is the damage for this frame from the previous. 89 gfx::Rect damage; // This is the damage for this frame from the previous.
87 }; 90 };
88 91
89 void FreeAllSurfaces(); 92 void FreeAllSurfaces();
90 93
91 void FreeSurfaceResources(AllocatedSurface* surface); 94 void FreeSurfaceResources(AllocatedSurface* surface);
92 95
93 // Copy everything that is in |copy_rect|, except for what is in 96 // Copy everything that is in |copy_rect|, except for what is in
94 // |exclude_rect| from |source_texture| to |texture|. 97 // |exclude_rect| from |source_texture| to |texture|.
95 virtual void CopyBufferDamage(int texture, 98 virtual void CopyBufferDamage(int texture,
96 int source_texture, 99 int source_texture,
97 const gfx::Rect& new_damage, 100 const gfx::Rect& new_damage,
98 const gfx::Rect& old_damage); 101 const gfx::Rect& old_damage);
99 102
100 void UpdateBufferDamage(const gfx::Rect& damage); 103 void UpdateBufferDamage(const gfx::Rect& damage);
101 104
102 // Return a surface, available to be drawn into. 105 // Return a surface, available to be drawn into.
103 std::unique_ptr<AllocatedSurface> GetNextSurface(); 106 std::unique_ptr<AllocatedSurface> GetNextSurface();
104 107
105 std::unique_ptr<AllocatedSurface> RecreateBuffer( 108 std::unique_ptr<AllocatedSurface> RecreateBuffer(
106 std::unique_ptr<AllocatedSurface> surface); 109 std::unique_ptr<AllocatedSurface> surface);
107 110
108 gpu::gles2::GLES2Interface* const gl_; 111 gpu::gles2::GLES2Interface* const gl_;
109 gfx::Size size_; 112 gfx::Size size_;
110 gfx::ColorSpace color_space_; 113 gfx::ColorSpace color_space_;
114 bool use_stencil_ = false;
111 uint32_t fbo_; 115 uint32_t fbo_;
112 size_t allocated_count_; 116 size_t allocated_count_;
113 uint32_t texture_target_; 117 uint32_t texture_target_;
114 uint32_t internal_format_; 118 uint32_t internal_format_;
115 gfx::BufferFormat format_; 119 gfx::BufferFormat format_;
116 // This surface is currently bound. This may be nullptr if no surface has 120 // This surface is currently bound. This may be nullptr if no surface has
117 // been bound, or if allocation failed at bind. 121 // been bound, or if allocation failed at bind.
118 std::unique_ptr<AllocatedSurface> current_surface_; 122 std::unique_ptr<AllocatedSurface> current_surface_;
119 // The surface currently on the screen, if any. 123 // The surface currently on the screen, if any.
120 std::unique_ptr<AllocatedSurface> displayed_surface_; 124 std::unique_ptr<AllocatedSurface> displayed_surface_;
121 // These are free for use, and are not nullptr. 125 // These are free for use, and are not nullptr.
122 std::vector<std::unique_ptr<AllocatedSurface>> available_surfaces_; 126 std::vector<std::unique_ptr<AllocatedSurface>> available_surfaces_;
123 // These have been swapped but are not displayed yet. Entries of this deque 127 // These have been swapped but are not displayed yet. Entries of this deque
124 // may be nullptr, if they represent frames that have been destroyed. 128 // may be nullptr, if they represent frames that have been destroyed.
125 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_; 129 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_;
126 GLHelper* gl_helper_; 130 GLHelper* gl_helper_;
127 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 131 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
128 gpu::SurfaceHandle surface_handle_; 132 gpu::SurfaceHandle surface_handle_;
129 133
130 DISALLOW_COPY_AND_ASSIGN(BufferQueue); 134 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
131 }; 135 };
132 136
133 } // namespace display_compositor 137 } // namespace display_compositor
134 138
135 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ 139 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/display_compositor/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698