summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/display/intel_parent.c
blob: 72ae553f79a4a2a9f2f4d3c6b3a3e2a21b374b0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// SPDX-License-Identifier: MIT
/* Copyright © 2025 Intel Corporation */

/*
 * Convenience wrapper functions to call the parent interface functions:
 *
 * - display->parent->SUBSTRUCT->FUNCTION()
 * - display->parent->FUNCTION()
 *
 * All functions here should be named accordingly:
 *
 * - intel_parent_SUBSTRUCT_FUNCTION()
 * - intel_parent_FUNCTION()
 *
 * These functions may use display driver specific types for parameters and
 * return values, translating them to and from the generic types used in the
 * function pointer interface.
 */

#include <drm/drm_print.h>
#include <drm/intel/display_parent_interface.h>

#include "intel_display_core.h"
#include "intel_parent.h"

/* hdcp */
ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
				       struct intel_hdcp_gsc_context *gsc_context,
				       void *msg_in, size_t msg_in_len,
				       void *msg_out, size_t msg_out_len)
{
	return display->parent->hdcp->gsc_msg_send(gsc_context, msg_in, msg_in_len, msg_out, msg_out_len);
}

bool intel_parent_hdcp_gsc_check_status(struct intel_display *display)
{
	return display->parent->hdcp->gsc_check_status(display->drm);
}

struct intel_hdcp_gsc_context *intel_parent_hdcp_gsc_context_alloc(struct intel_display *display)
{
	return display->parent->hdcp->gsc_context_alloc(display->drm);
}

void intel_parent_hdcp_gsc_context_free(struct intel_display *display,
					struct intel_hdcp_gsc_context *gsc_context)
{
	display->parent->hdcp->gsc_context_free(gsc_context);
}

/* irq */
bool intel_parent_irq_enabled(struct intel_display *display)
{
	return display->parent->irq->enabled(display->drm);
}

void intel_parent_irq_synchronize(struct intel_display *display)
{
	display->parent->irq->synchronize(display->drm);
}

/* panic */
struct intel_panic *intel_parent_panic_alloc(struct intel_display *display)
{
	return display->parent->panic->alloc();
}

int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb)
{
	return display->parent->panic->setup(panic, sb);
}

void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic)
{
	display->parent->panic->finish(panic);
}

/* pc8 */
void intel_parent_pc8_block(struct intel_display *display)
{
	if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
		return;

	display->parent->pc8->block(display->drm);
}

void intel_parent_pc8_unblock(struct intel_display *display)
{
	if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
		return;

	display->parent->pc8->unblock(display->drm);
}

/* rps */
bool intel_parent_rps_available(struct intel_display *display)
{
	return display->parent->rps;
}

void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence)
{
	if (display->parent->rps)
		display->parent->rps->boost_if_not_started(fence);
}

void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive)
{
	if (display->parent->rps)
		display->parent->rps->mark_interactive(display->drm, interactive);
}

void intel_parent_rps_ilk_irq_handler(struct intel_display *display)
{
	if (display->parent->rps)
		display->parent->rps->ilk_irq_handler(display->drm);
}

/* stolen */
int intel_parent_stolen_insert_node_in_range(struct intel_display *display,
					     struct intel_stolen_node *node, u64 size,
					     unsigned int align, u64 start, u64 end)
{
	return display->parent->stolen->insert_node_in_range(node, size, align, start, end);
}

int intel_parent_stolen_insert_node(struct intel_display *display, struct intel_stolen_node *node, u64 size,
				    unsigned int align)
{
	if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->insert_node))
		return -ENODEV;

	return display->parent->stolen->insert_node(node, size, align);
}

void intel_parent_stolen_remove_node(struct intel_display *display,
				     struct intel_stolen_node *node)
{
	display->parent->stolen->remove_node(node);
}

bool intel_parent_stolen_initialized(struct intel_display *display)
{
	return display->parent->stolen->initialized(display->drm);
}

bool intel_parent_stolen_node_allocated(struct intel_display *display,
					const struct intel_stolen_node *node)
{
	return display->parent->stolen->node_allocated(node);
}

u32 intel_parent_stolen_node_offset(struct intel_display *display, struct intel_stolen_node *node)
{
	return display->parent->stolen->node_offset(node);
}

u64 intel_parent_stolen_area_address(struct intel_display *display)
{
	if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->area_address))
		return 0;

	return display->parent->stolen->area_address(display->drm);
}

u64 intel_parent_stolen_area_size(struct intel_display *display)
{
	if (drm_WARN_ON_ONCE(display->drm, !display->parent->stolen->area_size))
		return 0;

	return display->parent->stolen->area_size(display->drm);
}

u64 intel_parent_stolen_node_address(struct intel_display *display, struct intel_stolen_node *node)
{
	return display->parent->stolen->node_address(node);
}

u64 intel_parent_stolen_node_size(struct intel_display *display, const struct intel_stolen_node *node)
{
	return display->parent->stolen->node_size(node);
}

struct intel_stolen_node *intel_parent_stolen_node_alloc(struct intel_display *display)
{
	return display->parent->stolen->node_alloc(display->drm);
}

void intel_parent_stolen_node_free(struct intel_display *display, const struct intel_stolen_node *node)
{
	display->parent->stolen->node_free(node);
}

/* generic */
void intel_parent_fence_priority_display(struct intel_display *display, struct dma_fence *fence)
{
	if (display->parent->fence_priority_display)
		display->parent->fence_priority_display(fence);
}

bool intel_parent_has_auxccs(struct intel_display *display)
{
	return display->parent->has_auxccs && display->parent->has_auxccs(display->drm);
}

bool intel_parent_has_fenced_regions(struct intel_display *display)
{
	return display->parent->has_fenced_regions && display->parent->has_fenced_regions(display->drm);
}

bool intel_parent_vgpu_active(struct intel_display *display)
{
	return display->parent->vgpu_active && display->parent->vgpu_active(display->drm);
}