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