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_rpm_interface { 40 struct ref_tracker *(*get)(const struct drm_device *drm); 41 struct ref_tracker *(*get_raw)(const struct drm_device *drm); 42 struct ref_tracker *(*get_if_in_use)(const struct drm_device *drm); 43 struct ref_tracker *(*get_noresume)(const struct drm_device *drm); 44 45 void (*put)(const struct drm_device *drm, struct ref_tracker *wakeref); 46 void (*put_raw)(const struct drm_device *drm, struct ref_tracker *wakeref); 47 void (*put_unchecked)(const struct drm_device *drm); 48 49 bool (*suspended)(const struct drm_device *drm); 50 void (*assert_held)(const struct drm_device *drm); 51 void (*assert_block)(const struct drm_device *drm); 52 void (*assert_unblock)(const struct drm_device *drm); 53 }; 54 55 struct intel_display_rps_interface { 56 void (*boost_if_not_started)(struct dma_fence *fence); 57 void (*mark_interactive)(struct drm_device *drm, bool interactive); 58 void (*ilk_irq_handler)(struct drm_device *drm); 59 }; 60 61 struct intel_display_stolen_interface { 62 int (*insert_node_in_range)(struct intel_stolen_node *node, u64 size, 63 unsigned int align, u64 start, u64 end); 64 int (*insert_node)(struct intel_stolen_node *node, u64 size, unsigned int align); /* Optional */ 65 void (*remove_node)(struct intel_stolen_node *node); 66 bool (*initialized)(struct drm_device *drm); 67 bool (*node_allocated)(const struct intel_stolen_node *node); 68 u64 (*node_offset)(const struct intel_stolen_node *node); 69 u64 (*area_address)(struct drm_device *drm); /* Optional */ 70 u64 (*area_size)(struct drm_device *drm); /* Optional */ 71 u64 (*node_address)(const struct intel_stolen_node *node); 72 u64 (*node_size)(const struct intel_stolen_node *node); 73 struct intel_stolen_node *(*node_alloc)(struct drm_device *drm); 74 void (*node_free)(const struct intel_stolen_node *node); 75 }; 76 77 /** 78 * struct intel_display_parent_interface - services parent driver provides to display 79 * 80 * The parent, or core, driver provides a pointer to this structure to display 81 * driver when calling intel_display_device_probe(). The display driver uses it 82 * to access services provided by the parent driver. The structure may contain 83 * sub-struct pointers to group function pointers by functionality. 84 * 85 * All function and sub-struct pointers must be initialized and callable unless 86 * explicitly marked as "optional" below. The display driver will only NULL 87 * check the optional pointers. 88 */ 89 struct intel_display_parent_interface { 90 /** @hdcp: HDCP GSC interface */ 91 const struct intel_display_hdcp_interface *hdcp; 92 93 /** @irq: IRQ interface */ 94 const struct intel_display_irq_interface *irq; 95 96 /** @panic: Panic interface */ 97 const struct intel_display_panic_interface *panic; 98 99 /** @rpm: Runtime PM functions */ 100 const struct intel_display_rpm_interface *rpm; 101 102 /** @rps: RPS interface. Optional. */ 103 const struct intel_display_rps_interface *rps; 104 105 /** @stolen: Stolen memory. */ 106 const struct intel_display_stolen_interface *stolen; 107 108 /* Generic independent functions */ 109 struct { 110 /** @fence_priority_display: Set display priority. Optional. */ 111 void (*fence_priority_display)(struct dma_fence *fence); 112 113 /** @has_auxccs: Are AuxCCS formats supported by the parent. Optional. */ 114 bool (*has_auxccs)(struct drm_device *drm); 115 116 /** @has_fenced_regions: Support legacy fencing? Optional. */ 117 bool (*has_fenced_regions)(struct drm_device *drm); 118 119 /** @vgpu_active: Is vGPU active? Optional. */ 120 bool (*vgpu_active)(struct drm_device *drm); 121 }; 122 }; 123 124 #endif 125