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