xref: /linux/include/drm/intel/display_parent_interface.h (revision c0d6f52f9b62479d61f8cd4faf9fb2f8bce6e301)
1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2025 Intel Corporation x*/
3 
4 #ifndef __DISPLAY_PARENT_INTERFACE_H__
5 #define __DISPLAY_PARENT_INTERFACE_H__
6 
7 #include <linux/types.h>
8 
9 struct dma_fence;
10 struct drm_crtc;
11 struct drm_device;
12 struct drm_framebuffer;
13 struct drm_gem_object;
14 struct drm_plane_state;
15 struct drm_scanout_buffer;
16 struct i915_vma;
17 struct intel_hdcp_gsc_context;
18 struct intel_initial_plane_config;
19 struct intel_panic;
20 struct intel_stolen_node;
21 struct ref_tracker;
22 
23 /* Keep struct definitions sorted */
24 
25 struct intel_display_hdcp_interface {
26 	ssize_t (*gsc_msg_send)(struct intel_hdcp_gsc_context *gsc_context,
27 				void *msg_in, size_t msg_in_len,
28 				void *msg_out, size_t msg_out_len);
29 	bool (*gsc_check_status)(struct drm_device *drm);
30 	struct intel_hdcp_gsc_context *(*gsc_context_alloc)(struct drm_device *drm);
31 	void (*gsc_context_free)(struct intel_hdcp_gsc_context *gsc_context);
32 };
33 
34 struct intel_display_initial_plane_interface {
35 	void (*vblank_wait)(struct drm_crtc *crtc);
36 	struct drm_gem_object *(*alloc_obj)(struct drm_device *drm, struct intel_initial_plane_config *plane_config);
37 	int (*setup)(struct drm_plane_state *plane_state, struct intel_initial_plane_config *plane_config,
38 		     struct drm_framebuffer *fb, struct i915_vma *vma);
39 	void (*config_fini)(struct intel_initial_plane_config *plane_configs);
40 };
41 
42 struct intel_display_irq_interface {
43 	bool (*enabled)(struct drm_device *drm);
44 	void (*synchronize)(struct drm_device *drm);
45 };
46 
47 struct intel_display_panic_interface {
48 	struct intel_panic *(*alloc)(void);
49 	int (*setup)(struct intel_panic *panic, struct drm_scanout_buffer *sb);
50 	void (*finish)(struct intel_panic *panic);
51 };
52 
53 struct intel_display_pc8_interface {
54 	void (*block)(struct drm_device *drm);
55 	void (*unblock)(struct drm_device *drm);
56 };
57 
58 struct intel_display_rpm_interface {
59 	struct ref_tracker *(*get)(const struct drm_device *drm);
60 	struct ref_tracker *(*get_raw)(const struct drm_device *drm);
61 	struct ref_tracker *(*get_if_in_use)(const struct drm_device *drm);
62 	struct ref_tracker *(*get_noresume)(const struct drm_device *drm);
63 
64 	void (*put)(const struct drm_device *drm, struct ref_tracker *wakeref);
65 	void (*put_raw)(const struct drm_device *drm, struct ref_tracker *wakeref);
66 	void (*put_unchecked)(const struct drm_device *drm);
67 
68 	bool (*suspended)(const struct drm_device *drm);
69 	void (*assert_held)(const struct drm_device *drm);
70 	void (*assert_block)(const struct drm_device *drm);
71 	void (*assert_unblock)(const struct drm_device *drm);
72 };
73 
74 struct intel_display_rps_interface {
75 	void (*boost_if_not_started)(struct dma_fence *fence);
76 	void (*mark_interactive)(struct drm_device *drm, bool interactive);
77 	void (*ilk_irq_handler)(struct drm_device *drm);
78 };
79 
80 struct intel_display_stolen_interface {
81 	int (*insert_node_in_range)(struct intel_stolen_node *node, u64 size,
82 				    unsigned int align, u64 start, u64 end);
83 	int (*insert_node)(struct intel_stolen_node *node, u64 size, unsigned int align); /* Optional */
84 	void (*remove_node)(struct intel_stolen_node *node);
85 	bool (*initialized)(struct drm_device *drm);
86 	bool (*node_allocated)(const struct intel_stolen_node *node);
87 	u64 (*node_offset)(const struct intel_stolen_node *node);
88 	u64 (*area_address)(struct drm_device *drm); /* Optional */
89 	u64 (*area_size)(struct drm_device *drm); /* Optional */
90 	u64 (*node_address)(const struct intel_stolen_node *node);
91 	u64 (*node_size)(const struct intel_stolen_node *node);
92 	struct intel_stolen_node *(*node_alloc)(struct drm_device *drm);
93 	void (*node_free)(const struct intel_stolen_node *node);
94 };
95 
96 /**
97  * struct intel_display_parent_interface - services parent driver provides to display
98  *
99  * The parent, or core, driver provides a pointer to this structure to display
100  * driver when calling intel_display_device_probe(). The display driver uses it
101  * to access services provided by the parent driver. The structure may contain
102  * sub-struct pointers to group function pointers by functionality.
103  *
104  * All function and sub-struct pointers must be initialized and callable unless
105  * explicitly marked as "optional" below. The display driver will only NULL
106  * check the optional pointers.
107  */
108 struct intel_display_parent_interface {
109 	/** @hdcp: HDCP GSC interface */
110 	const struct intel_display_hdcp_interface *hdcp;
111 
112 	/** @initial_plane: Initial plane interface */
113 	const struct intel_display_initial_plane_interface *initial_plane;
114 
115 	/** @irq: IRQ interface */
116 	const struct intel_display_irq_interface *irq;
117 
118 	/** @panic: Panic interface */
119 	const struct intel_display_panic_interface *panic;
120 
121 	/** @pc8: PC8 interface. Optional. */
122 	const struct intel_display_pc8_interface *pc8;
123 
124 	/** @rpm: Runtime PM functions */
125 	const struct intel_display_rpm_interface *rpm;
126 
127 	/** @rps: RPS interface. Optional. */
128 	const struct intel_display_rps_interface *rps;
129 
130 	/** @stolen: Stolen memory. */
131 	const struct intel_display_stolen_interface *stolen;
132 
133 	/* Generic independent functions */
134 	struct {
135 		/** @fence_priority_display: Set display priority. Optional. */
136 		void (*fence_priority_display)(struct dma_fence *fence);
137 
138 		/** @has_auxccs: Are AuxCCS formats supported by the parent. Optional. */
139 		bool (*has_auxccs)(struct drm_device *drm);
140 
141 		/** @has_fenced_regions: Support legacy fencing? Optional. */
142 		bool (*has_fenced_regions)(struct drm_device *drm);
143 
144 		/** @vgpu_active: Is vGPU active? Optional. */
145 		bool (*vgpu_active)(struct drm_device *drm);
146 	};
147 };
148 
149 #endif
150