Skip to content

Commit 65e366a

Browse files
author
Maarten Lankhorst
committed
drm/xe/display: Use a single early init call for display
Now that interrupts are disabled for xe_display_init_noaccel, both xe_display_init_noirq and xe_display_init_noaccel run in the same context. This means that we can get rid of the 3 different init calls. Without interrupts, nothing is touching display up to this point. Unify those 3 early display calls into a single xe_display_init_early(), this makes the init sequence cleaner, and display less tangled during init. Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250121142850.4960-3-dev@lankhorst.se Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
1 parent f595fe5 commit 65e366a

File tree

3 files changed

+22
-69
lines changed

3 files changed

+22
-69
lines changed

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,25 @@ int xe_display_create(struct xe_device *xe)
101101
return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
102102
}
103103

104-
static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
104+
static void xe_display_fini_early(void *arg)
105105
{
106-
struct xe_device *xe = to_xe_device(dev);
106+
struct xe_device *xe = arg;
107107
struct intel_display *display = &xe->display;
108108

109109
if (!xe->info.probe_display)
110110
return;
111111

112+
intel_display_driver_remove_nogem(display);
113+
intel_display_driver_remove_noirq(display);
114+
intel_opregion_cleanup(display);
112115
intel_power_domains_cleanup(display);
113116
}
114117

115-
int xe_display_init_nommio(struct xe_device *xe)
118+
int xe_display_init_early(struct xe_device *xe)
116119
{
120+
struct intel_display *display = &xe->display;
121+
int err;
122+
117123
if (!xe->info.probe_display)
118124
return 0;
119125

@@ -123,29 +129,6 @@ int xe_display_init_nommio(struct xe_device *xe)
123129
/* This must be called before any calls to HAS_PCH_* */
124130
intel_detect_pch(xe);
125131

126-
return drmm_add_action_or_reset(&xe->drm, xe_display_fini_nommio, xe);
127-
}
128-
129-
static void xe_display_fini_noirq(void *arg)
130-
{
131-
struct xe_device *xe = arg;
132-
struct intel_display *display = &xe->display;
133-
134-
if (!xe->info.probe_display)
135-
return;
136-
137-
intel_display_driver_remove_noirq(display);
138-
intel_opregion_cleanup(display);
139-
}
140-
141-
int xe_display_init_noirq(struct xe_device *xe)
142-
{
143-
struct intel_display *display = &xe->display;
144-
int err;
145-
146-
if (!xe->info.probe_display)
147-
return 0;
148-
149132
intel_display_driver_early_probe(display);
150133

151134
/* Early display init.. */
@@ -162,38 +145,20 @@ int xe_display_init_noirq(struct xe_device *xe)
162145
intel_display_device_info_runtime_init(display);
163146

164147
err = intel_display_driver_probe_noirq(display);
165-
if (err) {
166-
intel_opregion_cleanup(display);
167-
return err;
168-
}
169-
170-
return devm_add_action_or_reset(xe->drm.dev, xe_display_fini_noirq, xe);
171-
}
172-
173-
static void xe_display_fini_noaccel(void *arg)
174-
{
175-
struct xe_device *xe = arg;
176-
struct intel_display *display = &xe->display;
177-
178-
if (!xe->info.probe_display)
179-
return;
180-
181-
intel_display_driver_remove_nogem(display);
182-
}
183-
184-
int xe_display_init_noaccel(struct xe_device *xe)
185-
{
186-
struct intel_display *display = &xe->display;
187-
int err;
188-
189-
if (!xe->info.probe_display)
190-
return 0;
148+
if (err)
149+
goto err_opregion;
191150

192151
err = intel_display_driver_probe_nogem(display);
193152
if (err)
194-
return err;
153+
goto err_noirq;
195154

196-
return devm_add_action_or_reset(xe->drm.dev, xe_display_fini_noaccel, xe);
155+
return devm_add_action_or_reset(xe->drm.dev, xe_display_fini_early, xe);
156+
err_noirq:
157+
intel_display_driver_remove_noirq(display);
158+
intel_power_domains_cleanup(display);
159+
err_opregion:
160+
intel_opregion_cleanup(display);
161+
return err;
197162
}
198163

199164
int xe_display_init(struct xe_device *xe)

drivers/gpu/drm/xe/display/xe_display.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ int xe_display_create(struct xe_device *xe);
2020

2121
int xe_display_probe(struct xe_device *xe);
2222

23-
int xe_display_init_nommio(struct xe_device *xe);
24-
int xe_display_init_noirq(struct xe_device *xe);
25-
int xe_display_init_noaccel(struct xe_device *xe);
23+
int xe_display_init_early(struct xe_device *xe);
2624
int xe_display_init(struct xe_device *xe);
2725
void xe_display_fini(struct xe_device *xe);
2826

@@ -54,9 +52,7 @@ static inline int xe_display_create(struct xe_device *xe) { return 0; }
5452

5553
static inline int xe_display_probe(struct xe_device *xe) { return 0; }
5654

57-
static inline int xe_display_init_nommio(struct xe_device *xe) { return 0; }
58-
static inline int xe_display_init_noirq(struct xe_device *xe) { return 0; }
59-
static inline int xe_display_init_noaccel(struct xe_device *xe) { return 0; }
55+
static inline int xe_display_init_early(struct xe_device *xe) { return 0; }
6056
static inline int xe_display_init(struct xe_device *xe) { return 0; }
6157
static inline void xe_display_fini(struct xe_device *xe) {}
6258

drivers/gpu/drm/xe/xe_device.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,6 @@ int xe_device_probe(struct xe_device *xe)
752752
return err;
753753

754754
xe->info.mem_region_mask = 1;
755-
err = xe_display_init_nommio(xe);
756-
if (err)
757-
return err;
758-
759755
err = xe_set_dma_info(xe);
760756
if (err)
761757
return err;
@@ -810,10 +806,6 @@ int xe_device_probe(struct xe_device *xe)
810806
if (err)
811807
return err;
812808

813-
err = xe_display_init_noirq(xe);
814-
if (err)
815-
return err;
816-
817809
err = probe_has_flat_ccs(xe);
818810
if (err)
819811
goto err;
@@ -837,7 +829,7 @@ int xe_device_probe(struct xe_device *xe)
837829
* This is the reason the first allocation needs to be done
838830
* inside display.
839831
*/
840-
err = xe_display_init_noaccel(xe);
832+
err = xe_display_init_early(xe);
841833
if (err)
842834
goto err;
843835

0 commit comments

Comments
 (0)