Commit 1e2803e5 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/xe/display: move xe->display initialization to xe_display_probe()



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()

Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://lore.kernel.org/r/6c3075739d84cecea258d686c3ef38455a61191c.1747397638.git.jani.nikula@intel.com


Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent ed23224b
Loading
Loading
Loading
Loading
+14 −19
Original line number Diff line number Diff line
@@ -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);
+0 −4
Original line number Diff line number Diff line
@@ -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; }
+0 −4
Original line number Diff line number Diff line
@@ -493,10 +493,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: