1 // SPDX-License-Identifier: MIT 2 /* Copyright © 2025 Intel Corporation */ 3 4 /* 5 * Convenience wrapper functions to call the parent interface functions: 6 * 7 * - display->parent->SUBSTRUCT->FUNCTION() 8 * - display->parent->FUNCTION() 9 * 10 * All functions here should be named accordingly: 11 * 12 * - intel_parent_SUBSTRUCT_FUNCTION() 13 * - intel_parent_FUNCTION() 14 * 15 * These functions may use display driver specific types for parameters and 16 * return values, translating them to and from the generic types used in the 17 * function pointer interface. 18 */ 19 20 #include <drm/drm_print.h> 21 #include <drm/intel/display_parent_interface.h> 22 23 #include "intel_display_core.h" 24 #include "intel_parent.h" 25 26 /* hdcp */ 27 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display, 28 struct intel_hdcp_gsc_context *gsc_context, 29 void *msg_in, size_t msg_in_len, 30 void *msg_out, size_t msg_out_len) 31 { 32 return display->parent->hdcp->gsc_msg_send(gsc_context, msg_in, msg_in_len, msg_out, msg_out_len); 33 } 34 35 bool intel_parent_hdcp_gsc_check_status(struct intel_display *display) 36 { 37 return display->parent->hdcp->gsc_check_status(display->drm); 38 } 39 40 struct intel_hdcp_gsc_context *intel_parent_hdcp_gsc_context_alloc(struct intel_display *display) 41 { 42 return display->parent->hdcp->gsc_context_alloc(display->drm); 43 } 44 45 void intel_parent_hdcp_gsc_context_free(struct intel_display *display, 46 struct intel_hdcp_gsc_context *gsc_context) 47 { 48 display->parent->hdcp->gsc_context_free(gsc_context); 49 } 50 51 /* irq */ 52 bool intel_parent_irq_enabled(struct intel_display *display) 53 { 54 return display->parent->irq->enabled(display->drm); 55 } 56 57 void intel_parent_irq_synchronize(struct intel_display *display) 58 { 59 display->parent->irq->synchronize(display->drm); 60 } 61 62 /* panic */ 63 struct intel_panic *intel_parent_panic_alloc(struct intel_display *display) 64 { 65 return display->parent->panic->alloc(); 66 } 67 68 int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb) 69 { 70 return display->parent->panic->setup(panic, sb); 71 } 72 73 void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic) 74 { 75 display->parent->panic->finish(panic); 76 } 77 78 /* pc8 */ 79 void intel_parent_pc8_block(struct intel_display *display) 80 { 81 if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8)) 82 return; 83 84 display->parent->pc8->block(display->drm); 85 } 86 87 void intel_parent_pc8_unblock(struct intel_display *display) 88 { 89 if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8)) 90 return; 91 92 display->parent->pc8->unblock(display->drm); 93 } 94 95 /* rps */ 96 bool intel_parent_rps_available(struct intel_display *display) 97 { 98 return display->parent->rps; 99 } 100 101 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence) 102 { 103 if (display->parent->rps) 104 display->parent->rps->boost_if_not_started(fence); 105 } 106 107 void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive) 108 { 109 if (display->parent->rps) 110 display->parent->rps->mark_interactive(display->drm, interactive); 111 } 112 113 void intel_parent_rps_ilk_irq_handler(struct intel_display *display) 114 { 115 if (display->parent->rps) 116 display->parent->rps->ilk_irq_handler(display->drm); 117 } 118 119 /* stolen */ 120 int intel_parent_stolen_insert_node_in_range(struct intel_display *display, 121 struct intel_stolen_node *node, u64 size, 122 unsigned int align, u64 start, u64 end) 123 { 124 return display->parent->stolen->insert_node_in_range(node, size, align, start, end); 125 } 126 127 int intel_parent_stolen_insert_node(struct intel_display *display, struct intel_stolen_node *node, u64 size, 128 unsigned int align) 129 { 130 if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->insert_node)) 131 return -ENODEV; 132 133 return display->parent->stolen->insert_node(node, size, align); 134 } 135 136 void intel_parent_stolen_remove_node(struct intel_display *display, 137 struct intel_stolen_node *node) 138 { 139 display->parent->stolen->remove_node(node); 140 } 141 142 bool intel_parent_stolen_initialized(struct intel_display *display) 143 { 144 return display->parent->stolen->initialized(display->drm); 145 } 146 147 bool intel_parent_stolen_node_allocated(struct intel_display *display, 148 const struct intel_stolen_node *node) 149 { 150 return display->parent->stolen->node_allocated(node); 151 } 152 153 u32 intel_parent_stolen_node_offset(struct intel_display *display, struct intel_stolen_node *node) 154 { 155 return display->parent->stolen->node_offset(node); 156 } 157 158 u64 intel_parent_stolen_area_address(struct intel_display *display) 159 { 160 if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->area_address)) 161 return 0; 162 163 return display->parent->stolen->area_address(display->drm); 164 } 165 166 u64 intel_parent_stolen_area_size(struct intel_display *display) 167 { 168 if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->area_size)) 169 return 0; 170 171 return display->parent->stolen->area_size(display->drm); 172 } 173 174 u64 intel_parent_stolen_node_address(struct intel_display *display, struct intel_stolen_node *node) 175 { 176 return display->parent->stolen->node_address(node); 177 } 178 179 u64 intel_parent_stolen_node_size(struct intel_display *display, const struct intel_stolen_node *node) 180 { 181 return display->parent->stolen->node_size(node); 182 } 183 184 struct intel_stolen_node *intel_parent_stolen_node_alloc(struct intel_display *display) 185 { 186 return display->parent->stolen->node_alloc(display->drm); 187 } 188 189 void intel_parent_stolen_node_free(struct intel_display *display, const struct intel_stolen_node *node) 190 { 191 display->parent->stolen->node_free(node); 192 } 193 194 /* generic */ 195 void intel_parent_fence_priority_display(struct intel_display *display, struct dma_fence *fence) 196 { 197 if (display->parent->fence_priority_display) 198 display->parent->fence_priority_display(fence); 199 } 200 201 bool intel_parent_has_auxccs(struct intel_display *display) 202 { 203 return display->parent->has_auxccs && display->parent->has_auxccs(display->drm); 204 } 205 206 bool intel_parent_has_fenced_regions(struct intel_display *display) 207 { 208 return display->parent->has_fenced_regions && display->parent->has_fenced_regions(display->drm); 209 } 210 211 bool intel_parent_vgpu_active(struct intel_display *display) 212 { 213 return display->parent->vgpu_active && display->parent->vgpu_active(display->drm); 214 } 215