Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 CC_OUTPUT_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
| 6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/output/direct_renderer.h" | 14 #include "cc/output/direct_renderer.h" |
| 15 #include "cc/output/gl_renderer_draw_cache.h" | 15 #include "cc/output/gl_renderer_draw_cache.h" |
| 16 #include "cc/output/program_binding.h" | 16 #include "cc/output/program_binding.h" |
| 17 #include "cc/output/renderer.h" | 17 #include "cc/output/renderer.h" |
| 18 #include "cc/quads/debug_border_draw_quad.h" | 18 #include "cc/quads/debug_border_draw_quad.h" |
| 19 #include "cc/quads/render_pass_draw_quad.h" | 19 #include "cc/quads/render_pass_draw_quad.h" |
| 20 #include "cc/quads/solid_color_draw_quad.h" | 20 #include "cc/quads/solid_color_draw_quad.h" |
| 21 #include "cc/quads/tile_draw_quad.h" | 21 #include "cc/quads/tile_draw_quad.h" |
| 22 #include "cc/quads/yuv_video_draw_quad.h" | 22 #include "cc/quads/yuv_video_draw_quad.h" |
| 23 #include "cc/resources/scoped_resource.h" | |
| 23 #include "ui/gfx/geometry/quad_f.h" | 24 #include "ui/gfx/geometry/quad_f.h" |
| 24 | 25 |
| 25 class SkBitmap; | 26 class SkBitmap; |
| 26 | 27 |
| 27 namespace gpu { | 28 namespace gpu { |
| 28 namespace gles2 { | 29 namespace gles2 { |
| 29 class GLES2Interface; | 30 class GLES2Interface; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 const gfx::Transform& device_transform, | 142 const gfx::Transform& device_transform, |
| 142 const RenderPassDrawQuad* quad, | 143 const RenderPassDrawQuad* quad, |
| 143 const gfx::QuadF* device_layer_quad, | 144 const gfx::QuadF* device_layer_quad, |
| 144 const gfx::QuadF* clip_region, | 145 const gfx::QuadF* clip_region, |
| 145 gfx::QuadF* local_quad, | 146 gfx::QuadF* local_quad, |
| 146 float edge[24]); | 147 float edge[24]); |
| 147 | 148 |
| 148 private: | 149 private: |
| 149 friend class GLRendererShaderPixelTest; | 150 friend class GLRendererShaderPixelTest; |
| 150 friend class GLRendererShaderTest; | 151 friend class GLRendererShaderTest; |
| 152 FRIEND_TEST_ALL_PREFIXES(GLRendererRenderPassDrawQuadCopierTest, Reuse); | |
| 153 FRIEND_TEST_ALL_PREFIXES(GLRendererRenderPassDrawQuadCopierTest, | |
| 154 ReleaseResources); | |
| 155 FRIEND_TEST_ALL_PREFIXES(GLRendererRenderPassDrawQuadCopierTest, | |
| 156 MaxCacheSize); | |
| 151 | 157 |
| 152 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); | 158 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); |
| 153 | 159 |
| 154 void DiscardPixels(); | 160 void DiscardPixels(); |
| 155 void ClearFramebuffer(DrawingFrame* frame); | 161 void ClearFramebuffer(DrawingFrame* frame); |
| 156 void SetViewport(); | 162 void SetViewport(); |
| 157 | 163 |
| 158 void DrawDebugBorderQuad(const DrawingFrame* frame, | 164 void DrawDebugBorderQuad(const DrawingFrame* frame, |
| 159 const DebugBorderDrawQuad* quad); | 165 const DebugBorderDrawQuad* quad); |
| 160 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { | 166 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 void RestoreGLState(); | 262 void RestoreGLState(); |
| 257 void RestoreFramebuffer(DrawingFrame* frame); | 263 void RestoreFramebuffer(DrawingFrame* frame); |
| 258 | 264 |
| 259 void DiscardBackbuffer() override; | 265 void DiscardBackbuffer() override; |
| 260 void EnsureBackbuffer() override; | 266 void EnsureBackbuffer() override; |
| 261 void EnforceMemoryPolicy(); | 267 void EnforceMemoryPolicy(); |
| 262 | 268 |
| 263 void ScheduleCALayers(DrawingFrame* frame); | 269 void ScheduleCALayers(DrawingFrame* frame); |
| 264 void ScheduleOverlays(DrawingFrame* frame); | 270 void ScheduleOverlays(DrawingFrame* frame); |
| 265 | 271 |
| 272 void OverlayResourceNoLongerInUse(GLuint texture); | |
| 273 ResourceId CreateOrReuseIOSurface(const gfx::Size& size); | |
| 274 void DeleteIOSurfacesOverCacheLimit(); | |
| 275 | |
| 276 // RenderPassDrawQuadCopier | |
| 277 bool CopyRenderPassDrawQuadToIOSurface(const RenderPassDrawQuad* quad, | |
| 278 ResourceId* resource_id) override; | |
| 279 void ReleaseIOSurfaces(const std::vector<ResourceId>& resources) override; | |
| 280 void UpdateCopyCountForFrame(size_t count) override; | |
| 281 | |
| 266 using OverlayResourceLock = | 282 using OverlayResourceLock = |
| 267 std::unique_ptr<ResourceProvider::ScopedReadLockGL>; | 283 std::unique_ptr<ResourceProvider::ScopedReadLockGL>; |
| 268 using OverlayResourceLockList = std::vector<OverlayResourceLock>; | 284 using OverlayResourceLockList = std::vector<OverlayResourceLock>; |
| 269 | 285 |
| 270 // Resources that have been sent to the GPU process, but not yet swapped. | 286 // Resources that have been sent to the GPU process, but not yet swapped. |
| 271 OverlayResourceLockList pending_overlay_resources_; | 287 OverlayResourceLockList pending_overlay_resources_; |
| 272 | 288 |
| 273 // Resources that should be shortly swapped by the GPU process. | 289 // Resources that should be shortly swapped by the GPU process. |
| 274 std::deque<OverlayResourceLockList> swapping_overlay_resources_; | 290 std::deque<OverlayResourceLockList> swapping_overlay_resources_; |
| 275 | 291 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 ResourceFormat current_framebuffer_format_; | 530 ResourceFormat current_framebuffer_format_; |
| 515 | 531 |
| 516 class SyncQuery; | 532 class SyncQuery; |
| 517 std::deque<std::unique_ptr<SyncQuery>> pending_sync_queries_; | 533 std::deque<std::unique_ptr<SyncQuery>> pending_sync_queries_; |
| 518 std::deque<std::unique_ptr<SyncQuery>> available_sync_queries_; | 534 std::deque<std::unique_ptr<SyncQuery>> available_sync_queries_; |
| 519 std::unique_ptr<SyncQuery> current_sync_query_; | 535 std::unique_ptr<SyncQuery> current_sync_query_; |
| 520 bool use_sync_query_; | 536 bool use_sync_query_; |
| 521 bool use_blend_equation_advanced_; | 537 bool use_blend_equation_advanced_; |
| 522 bool use_blend_equation_advanced_coherent_; | 538 bool use_blend_equation_advanced_coherent_; |
| 523 | 539 |
| 540 // Keep an LRU buffer of GMB resources to encourage reuse. | |
|
ccameron
2016/07/20 05:32:19
Can we use/augment the existing cc::ResourcePool::
erikchen
2016/07/20 21:48:01
Done.
| |
| 541 std::vector<std::unique_ptr<ScopedResource>> in_use_iosurfaces_; | |
| 542 std::vector<std::unique_ptr<ScopedResource>> free_iosurfaces_; | |
| 543 size_t iosurface_limit_ = 0; | |
| 544 | |
| 524 BoundGeometry bound_geometry_; | 545 BoundGeometry bound_geometry_; |
| 525 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 546 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
| 526 }; | 547 }; |
| 527 | 548 |
| 528 } // namespace cc | 549 } // namespace cc |
| 529 | 550 |
| 530 #endif // CC_OUTPUT_GL_RENDERER_H_ | 551 #endif // CC_OUTPUT_GL_RENDERER_H_ |
| OLD | NEW |