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