| 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 CC_SURFACES_DISPLAY_H_ | 5 #ifndef CC_SURFACES_DISPLAY_H_ |
| 6 #define CC_SURFACES_DISPLAY_H_ | 6 #define CC_SURFACES_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // A Display produces a surface that can be used to draw to a physical display | 49 // A Display produces a surface that can be used to draw to a physical display |
| 50 // (OutputSurface). The client is responsible for creating and sizing the | 50 // (OutputSurface). The client is responsible for creating and sizing the |
| 51 // surface IDs used to draw into the display and deciding when to draw. | 51 // surface IDs used to draw into the display and deciding when to draw. |
| 52 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, | 52 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, |
| 53 public OutputSurfaceClient, | 53 public OutputSurfaceClient, |
| 54 public RendererClient, | 54 public RendererClient, |
| 55 public SurfaceDamageObserver { | 55 public SurfaceDamageObserver { |
| 56 public: | 56 public: |
| 57 // The |begin_frame_source| and |scheduler| may be null (together). In that | 57 // The |begin_frame_source| and |scheduler| may be null (together). In that |
| 58 // case, DrawAndSwap must be called externally when needed. | 58 // case, DrawAndSwap must be called externally when needed. |
| 59 Display(SurfaceManager* manager, | 59 Display(SharedBitmapManager* bitmap_manager, |
| 60 SharedBitmapManager* bitmap_manager, | |
| 61 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 60 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 62 const RendererSettings& settings, | 61 const RendererSettings& settings, |
| 63 uint32_t compositor_surface_namespace, | |
| 64 std::unique_ptr<BeginFrameSource> begin_frame_source, | 62 std::unique_ptr<BeginFrameSource> begin_frame_source, |
| 65 std::unique_ptr<OutputSurface> output_surface, | 63 std::unique_ptr<OutputSurface> output_surface, |
| 66 std::unique_ptr<DisplayScheduler> scheduler, | 64 std::unique_ptr<DisplayScheduler> scheduler, |
| 67 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter); | 65 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter); |
| 68 | 66 |
| 69 ~Display() override; | 67 ~Display() override; |
| 70 | 68 |
| 71 void Initialize(DisplayClient* client); | 69 void Initialize(DisplayClient* client, |
| 70 SurfaceManager* surface_manager, |
| 71 uint32_t compositor_surface_namespace); |
| 72 | 72 |
| 73 // device_scale_factor is used to communicate to the external window system | 73 // device_scale_factor is used to communicate to the external window system |
| 74 // what scale this was rendered at. | 74 // what scale this was rendered at. |
| 75 void SetSurfaceId(const SurfaceId& id, float device_scale_factor); | 75 void SetSurfaceId(const SurfaceId& id, float device_scale_factor); |
| 76 void Resize(const gfx::Size& new_size); | 76 void Resize(const gfx::Size& new_size); |
| 77 void SetColorSpace(const gfx::ColorSpace& color_space); | 77 void SetColorSpace(const gfx::ColorSpace& color_space); |
| 78 void SetExternalClip(const gfx::Rect& clip); | 78 void SetExternalClip(const gfx::Rect& clip); |
| 79 void SetOutputIsSecure(bool secure); | 79 void SetOutputIsSecure(bool secure); |
| 80 | 80 |
| 81 const SurfaceId& CurrentSurfaceId(); | 81 const SurfaceId& CurrentSurfaceId(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 void SetFullRootLayerDamage() override; | 107 void SetFullRootLayerDamage() override; |
| 108 | 108 |
| 109 // SurfaceDamageObserver implementation. | 109 // SurfaceDamageObserver implementation. |
| 110 void OnSurfaceDamaged(const SurfaceId& surface, bool* changed) override; | 110 void OnSurfaceDamaged(const SurfaceId& surface, bool* changed) override; |
| 111 | 111 |
| 112 void SetEnlargePassTextureAmountForTesting( | 112 void SetEnlargePassTextureAmountForTesting( |
| 113 const gfx::Size& enlarge_texture_amount) { | 113 const gfx::Size& enlarge_texture_amount) { |
| 114 enlarge_texture_amount_ = enlarge_texture_amount; | 114 enlarge_texture_amount_ = enlarge_texture_amount; |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool has_scheduler() const { return !!scheduler_; } |
| 118 |
| 117 private: | 119 private: |
| 118 void InitializeRenderer(); | 120 void InitializeRenderer(); |
| 119 void UpdateRootSurfaceResourcesLocked(); | 121 void UpdateRootSurfaceResourcesLocked(); |
| 120 | 122 |
| 123 SharedBitmapManager* const bitmap_manager_; |
| 124 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 125 const RendererSettings settings_; |
| 126 |
| 121 DisplayClient* client_; | 127 DisplayClient* client_; |
| 122 SurfaceManager* surface_manager_; | 128 SurfaceManager* surface_manager_; |
| 123 SharedBitmapManager* bitmap_manager_; | 129 uint32_t compositor_surface_namespace_; |
| 124 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | |
| 125 RendererSettings settings_; | |
| 126 SurfaceId current_surface_id_; | 130 SurfaceId current_surface_id_; |
| 127 uint32_t compositor_surface_namespace_; | |
| 128 gfx::Size current_surface_size_; | 131 gfx::Size current_surface_size_; |
| 129 float device_scale_factor_ = 1.f; | 132 float device_scale_factor_ = 1.f; |
| 130 gfx::ColorSpace device_color_space_; | 133 gfx::ColorSpace device_color_space_; |
| 131 bool swapped_since_resize_ = false; | 134 bool swapped_since_resize_ = false; |
| 132 gfx::Rect external_clip_; | 135 gfx::Rect external_clip_; |
| 133 gfx::Size enlarge_texture_amount_; | 136 gfx::Size enlarge_texture_amount_; |
| 134 bool output_is_secure_ = false; | 137 bool output_is_secure_ = false; |
| 135 | 138 |
| 136 // The begin_frame_source_ is often known by the output_surface_ and | 139 // The begin_frame_source_ is often known by the output_surface_ and |
| 137 // the scheduler_. | 140 // the scheduler_. |
| 138 std::unique_ptr<BeginFrameSource> begin_frame_source_; | 141 std::unique_ptr<BeginFrameSource> begin_frame_source_; |
| 139 std::unique_ptr<OutputSurface> output_surface_; | 142 std::unique_ptr<OutputSurface> output_surface_; |
| 140 std::unique_ptr<DisplayScheduler> scheduler_; | 143 std::unique_ptr<DisplayScheduler> scheduler_; |
| 141 std::unique_ptr<ResourceProvider> resource_provider_; | 144 std::unique_ptr<ResourceProvider> resource_provider_; |
| 142 std::unique_ptr<SurfaceAggregator> aggregator_; | 145 std::unique_ptr<SurfaceAggregator> aggregator_; |
| 143 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; | 146 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
| 144 std::unique_ptr<DirectRenderer> renderer_; | 147 std::unique_ptr<DirectRenderer> renderer_; |
| 145 SoftwareRenderer* software_renderer_ = nullptr; | 148 SoftwareRenderer* software_renderer_ = nullptr; |
| 146 std::vector<ui::LatencyInfo> stored_latency_info_; | 149 std::vector<ui::LatencyInfo> stored_latency_info_; |
| 147 | 150 |
| 148 private: | 151 private: |
| 149 DISALLOW_COPY_AND_ASSIGN(Display); | 152 DISALLOW_COPY_AND_ASSIGN(Display); |
| 150 }; | 153 }; |
| 151 | 154 |
| 152 } // namespace cc | 155 } // namespace cc |
| 153 | 156 |
| 154 #endif // CC_SURFACES_DISPLAY_H_ | 157 #endif // CC_SURFACES_DISPLAY_H_ |
| OLD | NEW |