OLD | NEW |
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> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "components/display_compositor/display_compositor_export.h" | 16 #include "components/display_compositor/display_compositor_export.h" |
17 #include "gpu/ipc/common/surface_handle.h" | 17 #include "gpu/ipc/common/surface_handle.h" |
| 18 #include "ui/gfx/color_space.h" |
18 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 class GpuMemoryBuffer; | 23 class GpuMemoryBuffer; |
23 } | 24 } |
24 | 25 |
25 namespace gpu { | 26 namespace gpu { |
26 class GpuMemoryBufferManager; | 27 class GpuMemoryBufferManager; |
27 | 28 |
(...skipping 18 matching lines...) Expand all Loading... |
46 GLHelper* gl_helper, | 47 GLHelper* gl_helper, |
47 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 48 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
48 gpu::SurfaceHandle surface_handle); | 49 gpu::SurfaceHandle surface_handle); |
49 virtual ~BufferQueue(); | 50 virtual ~BufferQueue(); |
50 | 51 |
51 void Initialize(); | 52 void Initialize(); |
52 | 53 |
53 void BindFramebuffer(); | 54 void BindFramebuffer(); |
54 void SwapBuffers(const gfx::Rect& damage); | 55 void SwapBuffers(const gfx::Rect& damage); |
55 void PageFlipComplete(); | 56 void PageFlipComplete(); |
56 void Reshape(const gfx::Size& size, float scale_factor); | 57 void Reshape(const gfx::Size& size, |
| 58 float scale_factor, |
| 59 const gfx::ColorSpace& color_space); |
57 | 60 |
58 void RecreateBuffers(); | 61 void RecreateBuffers(); |
59 | 62 |
60 uint32_t current_texture_id() const { | 63 uint32_t current_texture_id() const { |
61 return current_surface_ ? current_surface_->texture : 0; | 64 return current_surface_ ? current_surface_->texture : 0; |
62 } | 65 } |
63 uint32_t fbo() const { return fbo_; } | 66 uint32_t fbo() const { return fbo_; } |
64 uint32_t internal_format() const { return internal_format_; } | 67 uint32_t internal_format() const { return internal_format_; } |
65 | 68 |
66 private: | 69 private: |
(...skipping 28 matching lines...) Expand all Loading... |
95 void UpdateBufferDamage(const gfx::Rect& damage); | 98 void UpdateBufferDamage(const gfx::Rect& damage); |
96 | 99 |
97 // Return a surface, available to be drawn into. | 100 // Return a surface, available to be drawn into. |
98 std::unique_ptr<AllocatedSurface> GetNextSurface(); | 101 std::unique_ptr<AllocatedSurface> GetNextSurface(); |
99 | 102 |
100 std::unique_ptr<AllocatedSurface> RecreateBuffer( | 103 std::unique_ptr<AllocatedSurface> RecreateBuffer( |
101 std::unique_ptr<AllocatedSurface> surface); | 104 std::unique_ptr<AllocatedSurface> surface); |
102 | 105 |
103 gpu::gles2::GLES2Interface* const gl_; | 106 gpu::gles2::GLES2Interface* const gl_; |
104 gfx::Size size_; | 107 gfx::Size size_; |
| 108 gfx::ColorSpace color_space_; |
105 uint32_t fbo_; | 109 uint32_t fbo_; |
106 size_t allocated_count_; | 110 size_t allocated_count_; |
107 uint32_t texture_target_; | 111 uint32_t texture_target_; |
108 uint32_t internal_format_; | 112 uint32_t internal_format_; |
109 // This surface is currently bound. This may be nullptr if no surface has | 113 // This surface is currently bound. This may be nullptr if no surface has |
110 // been bound, or if allocation failed at bind. | 114 // been bound, or if allocation failed at bind. |
111 std::unique_ptr<AllocatedSurface> current_surface_; | 115 std::unique_ptr<AllocatedSurface> current_surface_; |
112 // The surface currently on the screen, if any. | 116 // The surface currently on the screen, if any. |
113 std::unique_ptr<AllocatedSurface> displayed_surface_; | 117 std::unique_ptr<AllocatedSurface> displayed_surface_; |
114 // These are free for use, and are not nullptr. | 118 // These are free for use, and are not nullptr. |
115 std::vector<std::unique_ptr<AllocatedSurface>> available_surfaces_; | 119 std::vector<std::unique_ptr<AllocatedSurface>> available_surfaces_; |
116 // These have been swapped but are not displayed yet. Entries of this deque | 120 // These have been swapped but are not displayed yet. Entries of this deque |
117 // may be nullptr, if they represent frames that have been destroyed. | 121 // may be nullptr, if they represent frames that have been destroyed. |
118 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_; | 122 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_; |
119 GLHelper* gl_helper_; | 123 GLHelper* gl_helper_; |
120 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 124 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
121 gpu::SurfaceHandle surface_handle_; | 125 gpu::SurfaceHandle surface_handle_; |
122 | 126 |
123 DISALLOW_COPY_AND_ASSIGN(BufferQueue); | 127 DISALLOW_COPY_AND_ASSIGN(BufferQueue); |
124 }; | 128 }; |
125 | 129 |
126 } // namespace display_compositor | 130 } // namespace display_compositor |
127 | 131 |
128 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ | 132 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ |
OLD | NEW |