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

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

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase Created 3 years, 7 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 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_VIZ_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
6 #define COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ 6 #define COMPONENTS_VIZ_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/viz/viz_export.h"
17 #include "gpu/ipc/common/surface_handle.h" 17 #include "gpu/ipc/common/surface_handle.h"
18 #include "ui/gfx/buffer_types.h" 18 #include "ui/gfx/buffer_types.h"
19 #include "ui/gfx/color_space.h" 19 #include "ui/gfx/color_space.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gfx/geometry/size.h" 21 #include "ui/gfx/geometry/size.h"
22 22
23 namespace gfx { 23 namespace gfx {
24 class GpuMemoryBuffer; 24 class GpuMemoryBuffer;
25 } 25 }
26 26
27 namespace gpu { 27 namespace gpu {
28 class GpuMemoryBufferManager; 28 class GpuMemoryBufferManager;
29 29
30 namespace gles2 { 30 namespace gles2 {
31 class GLES2Interface; 31 class GLES2Interface;
32 } 32 }
33 } 33 }
34 34
35 namespace display_compositor { 35 namespace viz {
36 36
37 class GLHelper; 37 class GLHelper;
38 38
39 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers 39 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers
40 // created using CHROMIUM_image. Double/triple buffering is implemented 40 // created using CHROMIUM_image. Double/triple buffering is implemented
41 // internally. Doublebuffering occurs if PageFlipComplete is called before the 41 // internally. Doublebuffering occurs if PageFlipComplete is called before the
42 // next BindFramebuffer call, otherwise it creates extra buffers. 42 // next BindFramebuffer call, otherwise it creates extra buffers.
43 class DISPLAY_COMPOSITOR_EXPORT BufferQueue { 43 class VIZ_EXPORT BufferQueue {
44 public: 44 public:
45 BufferQueue(gpu::gles2::GLES2Interface* gl, 45 BufferQueue(gpu::gles2::GLES2Interface* gl,
46 uint32_t texture_target, 46 uint32_t texture_target,
47 uint32_t internal_format, 47 uint32_t internal_format,
48 gfx::BufferFormat format, 48 gfx::BufferFormat format,
49 GLHelper* gl_helper, 49 GLHelper* gl_helper,
50 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 50 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
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 bool use_stencil);
63 void RecreateBuffers(); 63 void RecreateBuffers();
64 uint32_t GetCurrentTextureId() const; 64 uint32_t GetCurrentTextureId() const;
65 65
66 uint32_t fbo() const { return fbo_; } 66 uint32_t fbo() const { return fbo_; }
67 uint32_t internal_format() const { return internal_format_; } 67 uint32_t internal_format() const { return internal_format_; }
68 68
69 private: 69 private:
70 friend class BufferQueueTest; 70 friend class BufferQueueTest;
71 friend class AllocatedSurface; 71 friend class AllocatedSurface;
72 72
73 struct DISPLAY_COMPOSITOR_EXPORT AllocatedSurface { 73 struct VIZ_EXPORT AllocatedSurface {
74 AllocatedSurface(BufferQueue* buffer_queue, 74 AllocatedSurface(BufferQueue* buffer_queue,
75 std::unique_ptr<gfx::GpuMemoryBuffer> buffer, 75 std::unique_ptr<gfx::GpuMemoryBuffer> buffer,
76 uint32_t texture, 76 uint32_t texture,
77 uint32_t image, 77 uint32_t image,
78 uint32_t stencil, 78 uint32_t stencil,
79 const gfx::Rect& rect); 79 const gfx::Rect& rect);
80 ~AllocatedSurface(); 80 ~AllocatedSurface();
81 BufferQueue* const buffer_queue; 81 BufferQueue* const buffer_queue;
82 std::unique_ptr<gfx::GpuMemoryBuffer> buffer; 82 std::unique_ptr<gfx::GpuMemoryBuffer> buffer;
83 const uint32_t texture; 83 const uint32_t texture;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // These have been swapped but are not displayed yet. Entries of this deque 124 // These have been swapped but are not displayed yet. Entries of this deque
125 // may be nullptr, if they represent frames that have been destroyed. 125 // may be nullptr, if they represent frames that have been destroyed.
126 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_; 126 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_;
127 GLHelper* gl_helper_; 127 GLHelper* gl_helper_;
128 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 128 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
129 gpu::SurfaceHandle surface_handle_; 129 gpu::SurfaceHandle surface_handle_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(BufferQueue); 131 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
132 }; 132 };
133 133
134 } // namespace display_compositor 134 } // namespace viz
135 135
136 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_ 136 #endif // COMPONENTS_VIZ_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
OLDNEW
« no previous file with comments | « components/viz/display_compositor/OWNERS ('k') | components/viz/display_compositor/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698