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