Avi Drissman | 8ba1bad | 2022-09-13 19:22:36 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_ |
| 6 | #define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
Weiliang Chen | 8bab2d6d3 | 2020-10-24 00:28:24 | [diff] [blame] | 10 | #include "components/viz/service/display/display_compositor_memory_and_task_controller.h" |
Kevin Haslett | 927f234 | 2022-08-02 20:10:58 | [diff] [blame] | 11 | #include "gpu/command_buffer/service/gpu_task_scheduler_helper.h" |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 12 | #include "gpu/ipc/common/surface_handle.h" |
Miyoung Shin | 2be27f5 | 2019-07-27 15:35:39 | [diff] [blame] | 13 | #include "services/viz/privileged/mojom/compositing/display_private.mojom.h" |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 14 | |
Maggie Chen | 0b4389c | 2024-08-07 21:25:05 | [diff] [blame] | 15 | namespace gpu { |
| 16 | class Scheduler; |
| 17 | } // namespace gpu |
| 18 | |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 19 | namespace viz { |
| 20 | |
Alexander Alekseev | 81b0161 | 2020-07-10 22:56:29 | [diff] [blame] | 21 | struct DebugRendererSettings; |
Weiliang Chen | 8bab2d6d3 | 2020-10-24 00:28:24 | [diff] [blame] | 22 | class DisplayCompositorMemoryAndTaskController; |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 23 | class RendererSettings; |
| 24 | class OutputSurface; |
| 25 | |
| 26 | // Handles creating OutputSurface for FrameSinkManagerImpl. |
| 27 | class OutputSurfaceProvider { |
| 28 | public: |
Sorin Jianu | 5842190 | 2024-10-10 21:33:45 | [diff] [blame] | 29 | virtual ~OutputSurfaceProvider() = default; |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 30 | |
Weiliang Chen | b26e8e0 | 2020-10-02 19:29:55 | [diff] [blame] | 31 | // Needs to be called before calling the CreateOutputSurface function. Output |
| 32 | // of this should feed into the CreateOutputSurface function. |
Weiliang Chen | 8bab2d6d3 | 2020-10-24 00:28:24 | [diff] [blame] | 33 | virtual std::unique_ptr<DisplayCompositorMemoryAndTaskController> |
| 34 | CreateGpuDependency(bool gpu_compositing, |
kylechar | 18a2fff | 2022-06-01 19:19:28 | [diff] [blame] | 35 | gpu::SurfaceHandle surface_handle) = 0; |
Weiliang Chen | b26e8e0 | 2020-10-02 19:29:55 | [diff] [blame] | 36 | |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 37 | // Creates a new OutputSurface for |surface_handle|. If creating an |
| 38 | // OutputSurface fails this function will return null. |
| 39 | virtual std::unique_ptr<OutputSurface> CreateOutputSurface( |
| 40 | gpu::SurfaceHandle surface_handle, |
| 41 | bool gpu_compositing, |
| 42 | mojom::DisplayClient* display_client, |
Weiliang Chen | 8bab2d6d3 | 2020-10-24 00:28:24 | [diff] [blame] | 43 | DisplayCompositorMemoryAndTaskController* gpu_dependency, |
Alexander Alekseev | 81b0161 | 2020-07-10 22:56:29 | [diff] [blame] | 44 | const RendererSettings& renderer_settings, |
| 45 | const DebugRendererSettings* debug_settings) = 0; |
Maggie Chen | 177e3a0 | 2023-11-15 02:13:03 | [diff] [blame] | 46 | |
| 47 | virtual gpu::SharedImageManager* GetSharedImageManager() = 0; |
Maggie Chen | 1b874190 | 2023-11-30 21:35:42 | [diff] [blame] | 48 | virtual gpu::SyncPointManager* GetSyncPointManager() = 0; |
Maggie Chen | 0b4389c | 2024-08-07 21:25:05 | [diff] [blame] | 49 | virtual gpu::Scheduler* GetGpuScheduler() = 0; |
Sunny Sachanandani | ec6f13b | 2019-05-01 00:25:50 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | } // namespace viz |
| 53 | |
Maggie Chen | 0b4389c | 2024-08-07 21:25:05 | [diff] [blame] | 54 | #endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_ |