Chromium Code Reviews| 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 CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/linked_ptr.h" | |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 class ContextProvider; | 19 class ContextProvider; |
| 19 } | 20 } |
| 20 | 21 |
| 22 namespace gfx { | |
| 23 class GpuMemoryBuffer; | |
| 24 } | |
| 25 | |
| 21 namespace content { | 26 namespace content { |
| 22 | 27 |
| 23 class BrowserGpuMemoryBufferManager; | 28 class BrowserGpuMemoryBufferManager; |
| 24 class GLHelper; | 29 class GLHelper; |
| 25 | 30 |
| 26 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers | 31 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers |
| 27 // created using CHROMIUM_gpu_memory_buffer_image. Double/triple buffering is | 32 // created using CHROMIUM_gpu_memory_buffer_image. Double/triple buffering is |
| 28 // implemented internally. Doublebuffering occurs if PageFlipComplete is called | 33 // implemented internally. Doublebuffering occurs if PageFlipComplete is called |
| 29 // before the next BindFramebuffer call, otherwise it creates extra buffers. | 34 // before the next BindFramebuffer call, otherwise it creates extra buffers. |
| 30 class CONTENT_EXPORT BufferQueue { | 35 class CONTENT_EXPORT BufferQueue { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 46 | 51 |
| 47 void RecreateBuffers(); | 52 void RecreateBuffers(); |
| 48 | 53 |
| 49 unsigned int current_texture_id() const { return current_surface_.texture; } | 54 unsigned int current_texture_id() const { return current_surface_.texture; } |
| 50 unsigned int fbo() const { return fbo_; } | 55 unsigned int fbo() const { return fbo_; } |
| 51 | 56 |
| 52 private: | 57 private: |
| 53 friend class BufferQueueTest; | 58 friend class BufferQueueTest; |
| 54 | 59 |
| 55 struct AllocatedSurface { | 60 struct AllocatedSurface { |
| 56 AllocatedSurface() : texture(0), image(0) {} | 61 AllocatedSurface(); |
| 57 AllocatedSurface(unsigned int texture, | 62 AllocatedSurface(scoped_ptr<gfx::GpuMemoryBuffer> buffer, |
| 63 unsigned int texture, | |
| 58 unsigned int image, | 64 unsigned int image, |
| 59 const gfx::Rect& rect) | 65 const gfx::Rect& rect); |
| 60 : texture(texture), image(image), damage(rect) {} | 66 ~AllocatedSurface(); |
|
ccameron
2015/10/22 22:16:49
This is the part where we keep the GMB around whil
Ken Russell (switch to Gerrit)
2015/10/23 01:13:13
I'm not qualified to review this change; suggest d
danakj
2015/10/23 19:52:08
Ya reveman or some of the ozone ppls would be good
alexst (slow to review)
2015/10/23 19:59:10
This should be fine, the reason we didn't hold ont
| |
| 67 linked_ptr<gfx::GpuMemoryBuffer> buffer; | |
|
reveman
2015/10/23 20:44:40
Can we avoid having these be reference counted?
ccameron
2015/10/26 22:28:11
Yes, but that will require making the various inst
| |
| 61 unsigned int texture; | 68 unsigned int texture; |
| 62 unsigned int image; | 69 unsigned int image; |
| 63 gfx::Rect damage; // This is the damage for this frame from the previous. | 70 gfx::Rect damage; // This is the damage for this frame from the previous. |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 void FreeAllSurfaces(); | 73 void FreeAllSurfaces(); |
| 67 | 74 |
| 68 void FreeSurface(AllocatedSurface* surface); | 75 void FreeSurface(AllocatedSurface* surface); |
| 69 | 76 |
| 70 // Copy everything that is in |copy_rect|, except for what is in | 77 // Copy everything that is in |copy_rect|, except for what is in |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 94 GLHelper* gl_helper_; | 101 GLHelper* gl_helper_; |
| 95 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager_; | 102 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 96 int surface_id_; | 103 int surface_id_; |
| 97 | 104 |
| 98 DISALLOW_COPY_AND_ASSIGN(BufferQueue); | 105 DISALLOW_COPY_AND_ASSIGN(BufferQueue); |
| 99 }; | 106 }; |
| 100 | 107 |
| 101 } // namespace content | 108 } // namespace content |
| 102 | 109 |
| 103 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ | 110 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ |
| OLD | NEW |