xref: /linux/drivers/gpu/drm/i915/display/intel_parent.h (revision 53597deca0e38c30e6cd4ba2114fa42d2bcd85bb)
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 struct dma_fence;
10 struct drm_file;
11 struct drm_gem_object;
12 struct drm_scanout_buffer;
13 struct i915_vma;
14 struct intel_display;
15 struct intel_dpt;
16 struct intel_frontbuffer;
17 struct intel_hdcp_gsc_context;
18 struct intel_panic;
19 struct intel_stolen_node;
20 
21 /* dpt */
22 struct intel_dpt *intel_parent_dpt_create(struct intel_display *display,
23 					  struct drm_gem_object *obj, size_t size);
24 void intel_parent_dpt_destroy(struct intel_display *display, struct intel_dpt *dpt);
25 void intel_parent_dpt_suspend(struct intel_display *display, struct intel_dpt *dpt);
26 void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dpt);
27 
28 /* frontbuffer */
29 struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj);
30 void intel_parent_frontbuffer_ref(struct intel_display *display, struct intel_frontbuffer *front);
31 void intel_parent_frontbuffer_put(struct intel_display *display, struct intel_frontbuffer *front);
32 void intel_parent_frontbuffer_flush_for_display(struct intel_display *display, struct intel_frontbuffer *front);
33 
34 /* hdcp */
35 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
36 				       struct intel_hdcp_gsc_context *gsc_context,
37 				       void *msg_in, size_t msg_in_len,
38 				       void *msg_out, size_t msg_out_len);
39 bool intel_parent_hdcp_gsc_check_status(struct intel_display *display);
40 struct intel_hdcp_gsc_context *intel_parent_hdcp_gsc_context_alloc(struct intel_display *display);
41 void intel_parent_hdcp_gsc_context_free(struct intel_display *display,
42 					struct intel_hdcp_gsc_context *gsc_context);
43 
44 /* irq */
45 bool intel_parent_irq_enabled(struct intel_display *display);
46 void intel_parent_irq_synchronize(struct intel_display *display);
47 
48 /* overlay */
49 bool intel_parent_overlay_is_active(struct intel_display *display);
50 int intel_parent_overlay_on(struct intel_display *display,
51 			    u32 frontbuffer_bits);
52 int intel_parent_overlay_continue(struct intel_display *display,
53 				  struct i915_vma *vma,
54 				  bool load_polyphase_filter);
55 int intel_parent_overlay_off(struct intel_display *display);
56 int intel_parent_overlay_recover_from_interrupt(struct intel_display *display);
57 int intel_parent_overlay_release_old_vid(struct intel_display *display);
58 void intel_parent_overlay_reset(struct intel_display *display);
59 struct i915_vma *intel_parent_overlay_pin_fb(struct intel_display *display,
60 					     struct drm_gem_object *obj,
61 					     u32 *offset);
62 void intel_parent_overlay_unpin_fb(struct intel_display *display,
63 				   struct i915_vma *vma);
64 struct drm_gem_object *intel_parent_overlay_obj_lookup(struct intel_display *display,
65 						       struct drm_file *filp,
66 						       u32 handle);
67 void __iomem *intel_parent_overlay_setup(struct intel_display *display,
68 					 bool needs_physical);
69 void intel_parent_overlay_cleanup(struct intel_display *display);
70 
71 /* panic */
72 struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
73 int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
74 void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
75 
76 /* pc8 */
77 void intel_parent_pc8_block(struct intel_display *display);
78 void intel_parent_pc8_unblock(struct intel_display *display);
79 
80 /* pcode */
81 int intel_parent_pcode_read(struct intel_display *display, u32 mbox, u32 *val, u32 *val1);
82 int intel_parent_pcode_write_timeout(struct intel_display *display, u32 mbox, u32 val, int timeout_ms);
83 int intel_parent_pcode_write(struct intel_display *display, u32 mbox, u32 val);
84 int intel_parent_pcode_request(struct intel_display *display, u32 mbox, u32 request,
85 			       u32 reply_mask, u32 reply, int timeout_base_ms);
86 
87 /* rps */
88 bool intel_parent_rps_available(struct intel_display *display);
89 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
90 void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive);
91 void intel_parent_rps_ilk_irq_handler(struct intel_display *display);
92 
93 /* stolen */
94 int intel_parent_stolen_insert_node_in_range(struct intel_display *display,
95 					     struct intel_stolen_node *node, u64 size,
96 					     unsigned int align, u64 start, u64 end);
97 int intel_parent_stolen_insert_node(struct intel_display *display, struct intel_stolen_node *node, u64 size,
98 				    unsigned int align);
99 void intel_parent_stolen_remove_node(struct intel_display *display,
100 				     struct intel_stolen_node *node);
101 bool intel_parent_stolen_initialized(struct intel_display *display);
102 bool intel_parent_stolen_node_allocated(struct intel_display *display,
103 					const struct intel_stolen_node *node);
104 u32 intel_parent_stolen_node_offset(struct intel_display *display, struct intel_stolen_node *node);
105 u64 intel_parent_stolen_area_address(struct intel_display *display);
106 u64 intel_parent_stolen_area_size(struct intel_display *display);
107 u64 intel_parent_stolen_node_address(struct intel_display *display, struct intel_stolen_node *node);
108 u64 intel_parent_stolen_node_size(struct intel_display *display, const struct intel_stolen_node *node);
109 struct intel_stolen_node *intel_parent_stolen_node_alloc(struct intel_display *display);
110 void intel_parent_stolen_node_free(struct intel_display *display, const struct intel_stolen_node *node);
111 
112 /* vma */
113 int intel_parent_vma_fence_id(struct intel_display *display, const struct i915_vma *vma);
114 
115 /* generic */
116 bool intel_parent_has_auxccs(struct intel_display *display);
117 bool intel_parent_has_fenced_regions(struct intel_display *display);
118 bool intel_parent_vgpu_active(struct intel_display *display);
119 void intel_parent_fence_priority_display(struct intel_display *display, struct dma_fence *fence);
120 
121 #endif /* __INTEL_PARENT_H__ */
122