xref: /linux/drivers/gpu/drm/i915/display/intel_initial_plane.c (revision a13f152a6c09338a7f81efdd414425a9d8d50b16)
1 // SPDX-License-Identifier: MIT
2 /* Copyright © 2025 Intel Corporation */
3 
4 #include <drm/intel/display_parent_interface.h>
5 
6 #include "intel_display_core.h"
7 #include "intel_display_types.h"
8 #include "intel_initial_plane.h"
9 
10 void intel_initial_plane_vblank_wait(struct intel_crtc *crtc)
11 {
12 	struct intel_display *display = to_intel_display(crtc);
13 
14 	display->parent->initial_plane->vblank_wait(&crtc->base);
15 }
16 
17 static void
18 intel_find_initial_plane_obj(struct intel_crtc *crtc,
19 			     struct intel_initial_plane_config plane_configs[])
20 {
21 	struct intel_display *display = to_intel_display(crtc);
22 
23 	display->parent->initial_plane->find_obj(&crtc->base, plane_configs);
24 }
25 
26 static void plane_config_fini(struct intel_display *display,
27 			      struct intel_initial_plane_config *plane_config)
28 {
29 	display->parent->initial_plane->config_fini(plane_config);
30 }
31 
32 void intel_initial_plane_config(struct intel_display *display)
33 {
34 	struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {};
35 	struct intel_crtc *crtc;
36 
37 	for_each_intel_crtc(display->drm, crtc) {
38 		const struct intel_crtc_state *crtc_state =
39 			to_intel_crtc_state(crtc->base.state);
40 		struct intel_initial_plane_config *plane_config =
41 			&plane_configs[crtc->pipe];
42 
43 		if (!crtc_state->hw.active)
44 			continue;
45 
46 		/*
47 		 * Note that reserving the BIOS fb up front prevents us
48 		 * from stuffing other stolen allocations like the ring
49 		 * on top.  This prevents some ugliness at boot time, and
50 		 * can even allow for smooth boot transitions if the BIOS
51 		 * fb is large enough for the active pipe configuration.
52 		 */
53 		display->funcs.display->get_initial_plane_config(crtc, plane_config);
54 
55 		/*
56 		 * If the fb is shared between multiple heads, we'll
57 		 * just get the first one.
58 		 */
59 		intel_find_initial_plane_obj(crtc, plane_configs);
60 
61 		if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config))
62 			intel_initial_plane_vblank_wait(crtc);
63 
64 		plane_config_fini(display, plane_config);
65 	}
66 }
67