1 /* SPDX-License-Identifier: MIT */ 2 /* Copyright © 2025 Intel Corporation */ 3 4 #ifndef __INTEL_PARENT_H__ 5 #define __INTEL_PARENT_H__ 6 7 #include <linux/types.h> 8 9 enum vlv_iosf_sb_unit; 10 struct dma_fence; 11 struct drm_file; 12 struct drm_gem_object; 13 struct drm_scanout_buffer; 14 struct i915_gtt_view; 15 struct i915_vma; 16 struct intel_display; 17 struct intel_dpt; 18 struct intel_fb_pin_params; 19 struct intel_frontbuffer; 20 struct intel_hdcp_gsc_context; 21 struct intel_panic; 22 struct intel_stolen_node; 23 struct iosys_map; 24 25 /* dpt */ 26 struct intel_dpt *intel_parent_dpt_create(struct intel_display *display, 27 struct drm_gem_object *obj, size_t size); 28 void intel_parent_dpt_destroy(struct intel_display *display, struct intel_dpt *dpt); 29 void intel_parent_dpt_suspend(struct intel_display *display, struct intel_dpt *dpt); 30 void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dpt); 31 32 /* fb_pin */ 33 int intel_parent_fb_pin_ggtt_pin(struct intel_display *display, 34 struct drm_gem_object *obj, 35 const struct intel_fb_pin_params *pin_params, 36 struct i915_vma **out_ggtt_vma, 37 u32 *out_offset, 38 int *out_fence_id); 39 void intel_parent_fb_pin_ggtt_unpin(struct intel_display *display, 40 struct i915_vma *ggtt_vma, 41 int fence_id); 42 int intel_parent_fb_pin_dpt_pin(struct intel_display *display, 43 struct drm_gem_object *obj, 44 struct intel_dpt *dpt, 45 const struct intel_fb_pin_params *pin_params, 46 struct i915_vma **out_dpt_vma, 47 struct i915_vma **out_ggtt_vma, 48 u32 *out_offset); 49 void intel_parent_fb_pin_dpt_unpin(struct intel_display *display, 50 struct intel_dpt *dpt, 51 struct i915_vma *dpt_vma, 52 struct i915_vma *ggtt_vma); 53 struct i915_vma *intel_parent_fb_pin_reuse_vma(struct intel_display *display, 54 struct i915_vma *old_ggtt_vma, 55 struct drm_gem_object *old_obj, 56 const struct i915_gtt_view *old_view, 57 struct drm_gem_object *new_obj, 58 const struct i915_gtt_view *new_view, 59 u32 *out_offset); 60 void intel_parent_fb_pin_get_map(struct intel_display *display, 61 struct i915_vma *vma, struct iosys_map *map); 62 63 /* frontbuffer */ 64 struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj); 65 void intel_parent_frontbuffer_ref(struct intel_display *display, struct intel_frontbuffer *front); 66 void intel_parent_frontbuffer_put(struct intel_display *display, struct intel_frontbuffer *front); 67 void intel_parent_frontbuffer_flush_for_display(struct intel_display *display, struct intel_frontbuffer *front); 68 69 /* hdcp */ 70 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display, 71 struct intel_hdcp_gsc_context *gsc_context, 72 void *msg_in, size_t msg_in_len, 73 void *msg_out, size_t msg_out_len); 74 bool intel_parent_hdcp_gsc_check_status(struct intel_display *display); 75 struct intel_hdcp_gsc_context *intel_parent_hdcp_gsc_context_alloc(struct intel_display *display); 76 void intel_parent_hdcp_gsc_context_free(struct intel_display *display, 77 struct intel_hdcp_gsc_context *gsc_context); 78 79 /* irq */ 80 bool intel_parent_irq_enabled(struct intel_display *display); 81 void intel_parent_irq_synchronize(struct intel_display *display); 82 83 /* overlay */ 84 bool intel_parent_overlay_is_active(struct intel_display *display); 85 int intel_parent_overlay_on(struct intel_display *display, 86 u32 frontbuffer_bits); 87 int intel_parent_overlay_continue(struct intel_display *display, 88 struct i915_vma *vma, 89 bool load_polyphase_filter); 90 int intel_parent_overlay_off(struct intel_display *display); 91 int intel_parent_overlay_recover_from_interrupt(struct intel_display *display); 92 int intel_parent_overlay_release_old_vid(struct intel_display *display); 93 void intel_parent_overlay_reset(struct intel_display *display); 94 struct i915_vma *intel_parent_overlay_pin_fb(struct intel_display *display, 95 struct drm_gem_object *obj, 96 u32 *offset); 97 void intel_parent_overlay_unpin_fb(struct intel_display *display, 98 struct i915_vma *vma); 99 struct drm_gem_object *intel_parent_overlay_obj_lookup(struct intel_display *display, 100 struct drm_file *filp, 101 u32 handle); 102 void __iomem *intel_parent_overlay_setup(struct intel_display *display, 103 bool needs_physical); 104 void intel_parent_overlay_cleanup(struct intel_display *display); 105 106 /* panic */ 107 struct intel_panic *intel_parent_panic_alloc(struct intel_display *display); 108 int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb); 109 void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic); 110 111 /* pc8 */ 112 void intel_parent_pc8_block(struct intel_display *display); 113 void intel_parent_pc8_unblock(struct intel_display *display); 114 115 /* pcode */ 116 int intel_parent_pcode_read(struct intel_display *display, u32 mbox, u32 *val, u32 *val1); 117 int intel_parent_pcode_write_timeout(struct intel_display *display, u32 mbox, u32 val, int timeout_ms); 118 int intel_parent_pcode_write(struct intel_display *display, u32 mbox, u32 val); 119 int intel_parent_pcode_request(struct intel_display *display, u32 mbox, u32 request, 120 u32 reply_mask, u32 reply, int timeout_base_ms); 121 122 /* rps */ 123 bool intel_parent_rps_available(struct intel_display *display); 124 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence); 125 void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive); 126 void intel_parent_rps_ilk_irq_handler(struct intel_display *display); 127 128 /* stolen */ 129 int intel_parent_stolen_insert_node_in_range(struct intel_display *display, 130 struct intel_stolen_node *node, u64 size, 131 unsigned int align, u64 start, u64 end); 132 int intel_parent_stolen_insert_node(struct intel_display *display, struct intel_stolen_node *node, u64 size, 133 unsigned int align); 134 void intel_parent_stolen_remove_node(struct intel_display *display, 135 struct intel_stolen_node *node); 136 bool intel_parent_stolen_initialized(struct intel_display *display); 137 bool intel_parent_stolen_node_allocated(struct intel_display *display, 138 const struct intel_stolen_node *node); 139 u32 intel_parent_stolen_node_offset(struct intel_display *display, struct intel_stolen_node *node); 140 u64 intel_parent_stolen_area_address(struct intel_display *display); 141 u64 intel_parent_stolen_area_size(struct intel_display *display); 142 u64 intel_parent_stolen_node_address(struct intel_display *display, struct intel_stolen_node *node); 143 u64 intel_parent_stolen_node_size(struct intel_display *display, const struct intel_stolen_node *node); 144 struct intel_stolen_node *intel_parent_stolen_node_alloc(struct intel_display *display); 145 void intel_parent_stolen_node_free(struct intel_display *display, const struct intel_stolen_node *node); 146 147 /* vlv iosf */ 148 void intel_parent_vlv_iosf_get(struct intel_display *display, unsigned long unit_mask); 149 void intel_parent_vlv_iosf_put(struct intel_display *display, unsigned long unit_mask); 150 u32 intel_parent_vlv_iosf_read(struct intel_display *display, enum vlv_iosf_sb_unit unit, u32 addr); 151 int intel_parent_vlv_iosf_write(struct intel_display *display, enum vlv_iosf_sb_unit unit, u32 addr, u32 val); 152 153 /* generic */ 154 bool intel_parent_has_auxccs(struct intel_display *display); 155 bool intel_parent_has_fenced_regions(struct intel_display *display); 156 bool intel_parent_vgpu_active(struct intel_display *display); 157 void intel_parent_fence_priority_display(struct intel_display *display, struct dma_fence *fence); 158 159 #endif /* __INTEL_PARENT_H__ */ 160