xref: /linux/drivers/gpu/drm/i915/display/intel_parent.c (revision 29fdc6e98d3c3657c8b4874ab3bfc75f9df59bf4)
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/intel/display_parent_interface.h>
21 
22 #include "intel_display_core.h"
23 #include "intel_parent.h"
24 
25 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
26 				       struct intel_hdcp_gsc_context *gsc_context,
27 				       void *msg_in, size_t msg_in_len,
28 				       void *msg_out, size_t msg_out_len)
29 {
30 	return display->parent->hdcp->gsc_msg_send(gsc_context, msg_in, msg_in_len, msg_out, msg_out_len);
31 }
32 
33 bool intel_parent_hdcp_gsc_check_status(struct intel_display *display)
34 {
35 	return display->parent->hdcp->gsc_check_status(display->drm);
36 }
37 
38 struct intel_hdcp_gsc_context *intel_parent_hdcp_gsc_context_alloc(struct intel_display *display)
39 {
40 	return display->parent->hdcp->gsc_context_alloc(display->drm);
41 }
42 
43 void intel_parent_hdcp_gsc_context_free(struct intel_display *display,
44 					struct intel_hdcp_gsc_context *gsc_context)
45 {
46 	display->parent->hdcp->gsc_context_free(gsc_context);
47 }
48 
49 bool intel_parent_irq_enabled(struct intel_display *display)
50 {
51 	return display->parent->irq->enabled(display->drm);
52 }
53 
54 void intel_parent_irq_synchronize(struct intel_display *display)
55 {
56 	display->parent->irq->synchronize(display->drm);
57 }
58 
59 bool intel_parent_rps_available(struct intel_display *display)
60 {
61 	return display->parent->rps;
62 }
63 
64 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence)
65 {
66 	if (display->parent->rps)
67 		display->parent->rps->boost_if_not_started(fence);
68 }
69 
70 void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive)
71 {
72 	if (display->parent->rps)
73 		display->parent->rps->mark_interactive(display->drm, interactive);
74 }
75 
76 void intel_parent_rps_ilk_irq_handler(struct intel_display *display)
77 {
78 	if (display->parent->rps)
79 		display->parent->rps->ilk_irq_handler(display->drm);
80 }
81 
82 bool intel_parent_vgpu_active(struct intel_display *display)
83 {
84 	return display->parent->vgpu_active && display->parent->vgpu_active(display->drm);
85 }
86 
87 bool intel_parent_has_fenced_regions(struct intel_display *display)
88 {
89 	return display->parent->has_fenced_regions && display->parent->has_fenced_regions(display->drm);
90 }
91 
92 void intel_parent_fence_priority_display(struct intel_display *display, struct dma_fence *fence)
93 {
94 	if (display->parent->fence_priority_display)
95 		display->parent->fence_priority_display(fence);
96 }
97