[PATCH 5/7] drm/xe/display: move xe->display initialization to xe_display_probe()
Matthew Auld
matthew.auld at intel.com
Fri May 16 14:24:57 UTC 2025
On 16/05/2025 13:16, Jani Nikula wrote:
> The future goal is to have intel_display_device_probe() create struct
> intel_display. As the first step, postpone xe->display initialization
> right before that call. This is the same location as in i915.
>
> There's a subtle functional change here: xe->display will now be
> initialized only if xe->info.probe_display.
>
> The xe_display_create() function becomes empty, and can be removed. Move
> its documentation to xe_display_probe()
>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
> ---
> drivers/gpu/drm/xe/display/xe_display.c | 33 +++++++++++--------------
> drivers/gpu/drm/xe/display/xe_display.h | 4 ---
> drivers/gpu/drm/xe/xe_device.c | 4 ---
> 3 files changed, 14 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index b0f5624177bd..c35444637620 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -83,25 +83,6 @@ static void unset_display_features(struct xe_device *xe)
> xe->drm.driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC);
> }
>
> -/**
> - * xe_display_create - create display struct
> - * @xe: XE device instance
> - *
> - * Initialize all fields used by the display part.
> - *
> - * TODO: once everything can be inside a single struct, make the struct opaque
> - * to the rest of xe and return it to be xe->display.
> - *
> - * Returns: 0 on success
> - */
> -int xe_display_create(struct xe_device *xe)
> -{
> - /* TODO: Allocate display dynamically. */
> - xe->display = &xe->__display;
> -
> - return 0;
> -}
> -
> static void xe_display_fini_early(void *arg)
> {
> struct xe_device *xe = arg;
> @@ -524,6 +505,17 @@ static void display_device_remove(struct drm_device *dev, void *arg)
> intel_display_device_remove(display);
> }
>
> +/**
> + * xe_display_probe - probe display and create display struct
> + * @xe: XE device instance
> + *
> + * Initialize all fields used by the display part.
> + *
> + * TODO: once everything can be inside a single struct, make the struct opaque
> + * to the rest of xe and return it to be xe->display.
> + *
> + * Returns: 0 on success
> + */
> int xe_display_probe(struct xe_device *xe)
> {
> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> @@ -533,6 +525,9 @@ int xe_display_probe(struct xe_device *xe)
> if (!xe->info.probe_display)
> goto no_display;
>
> + /* TODO: Allocate display dynamically. */
> + xe->display = &xe->__display;
> +
> display = intel_display_device_probe(pdev);
>
> err = drmm_add_action_or_reset(&xe->drm, display_device_remove, display);
> diff --git a/drivers/gpu/drm/xe/display/xe_display.h b/drivers/gpu/drm/xe/display/xe_display.h
> index 46e14f8dee28..e533aa4750bc 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.h
> +++ b/drivers/gpu/drm/xe/display/xe_display.h
> @@ -15,8 +15,6 @@ struct drm_driver;
> bool xe_display_driver_probe_defer(struct pci_dev *pdev);
> void xe_display_driver_set_hooks(struct drm_driver *driver);
>
> -int xe_display_create(struct xe_device *xe);
> -
> int xe_display_probe(struct xe_device *xe);
>
> int xe_display_init_early(struct xe_device *xe);
> @@ -46,8 +44,6 @@ static inline int xe_display_driver_probe_defer(struct pci_dev *pdev) { return 0
> static inline void xe_display_driver_set_hooks(struct drm_driver *driver) { }
> static inline void xe_display_driver_remove(struct xe_device *xe) {}
>
> -static inline int xe_display_create(struct xe_device *xe) { return 0; }
> -
> static inline int xe_display_probe(struct xe_device *xe) { return 0; }
>
> static inline int xe_display_init_early(struct xe_device *xe) { return 0; }
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index d4b6e623aa48..660b0c5126dc 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -491,10 +491,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> if (err)
> goto err;
>
> - err = xe_display_create(xe);
> - if (WARN_ON(err))
> - goto err;
> -
> return xe;
>
> err:
More information about the Intel-gfx
mailing list