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