1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
gpu / command_buffer / service / display_compositor_memory_and_task_controller_on_gpu.h [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_COMMAND_BUFFER_SERVICE_DISPLAY_COMPOSITOR_MEMORY_AND_TASK_CONTROLLER_ON_GPU_H_
#define GPU_COMMAND_BUFFER_SERVICE_DISPLAY_COMPOSITOR_MEMORY_AND_TASK_CONTROLLER_ON_GPU_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/sequence_checker.h"
#include "gpu/command_buffer/common/context_creation_attribs.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/sequence_id.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "gpu/gpu_gles2_export.h"
#include "gpu/ipc/common/command_buffer_id.h"
namespace gpu {
class SyncPointManager;
class SharedImageManager;
struct GpuFeatureInfo;
struct GpuPreferences;
// This class holds ownership of data structure that is only used on the gpu
// thread. This class is expected to be 1:1 relationship with the display
// compositor.
class GPU_GLES2_EXPORT DisplayCompositorMemoryAndTaskControllerOnGpu {
public:
DisplayCompositorMemoryAndTaskControllerOnGpu(
scoped_refptr<SharedContextState> shared_context_state,
SharedImageManager* shared_image_manager,
SyncPointManager* sync_point_manager,
const GpuPreferences& gpu_preferences,
const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds,
const GpuFeatureInfo& gpu_feature_info);
DisplayCompositorMemoryAndTaskControllerOnGpu(
const DisplayCompositorMemoryAndTaskControllerOnGpu&) = delete;
DisplayCompositorMemoryAndTaskControllerOnGpu& operator=(
const DisplayCompositorMemoryAndTaskControllerOnGpu&) = delete;
~DisplayCompositorMemoryAndTaskControllerOnGpu();
SharedContextState* shared_context_state() const {
return shared_context_state_.get();
}
MemoryTracker* memory_tracker() const;
CommandBufferId command_buffer_id() const { return command_buffer_id_; }
// Used to create SharedImageInterface. Only used for in process command
// buffer and shared image channels created for the display compositor in the
// GPU process. Not Used for cross process shared image stub.
static gpu::CommandBufferId NextCommandBufferId();
SharedImageManager* shared_image_manager() const {
return shared_image_manager_;
}
SyncPointManager* sync_point_manager() const { return sync_point_manager_; }
const GpuPreferences& gpu_preferences() const { return *gpu_preferences_; }
const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const {
return gpu_driver_bug_workarounds_;
}
const GpuFeatureInfo& gpu_feature_info() const { return *gpu_feature_info_; }
private:
scoped_refptr<SharedContextState> shared_context_state_;
const CommandBufferId command_buffer_id_;
// Used for creating SharedImageFactory.
raw_ptr<SharedImageManager> shared_image_manager_;
raw_ptr<SyncPointManager> sync_point_manager_;
const raw_ref<const GpuPreferences> gpu_preferences_;
GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
const raw_ref<const GpuFeatureInfo> gpu_feature_info_;
SEQUENCE_CHECKER(gpu_sequence_checker_);
};
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_DISPLAY_COMPOSITOR_MEMORY_AND_TASK_CONTROLLER_ON_GPU_H_