[11/13] drm/i915: move gem init up from modeset init

Submitted by Jani Nikula on Sept. 19, 2019, 2:03 p.m.

Details

Message ID 48a647c1e9e59b27b9fcd2193835dad68bf3839f.1568901239.git.jani.nikula@intel.com
State New
Headers show
Series "drm/i915: modeset probe/remove path refactoring" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula Sept. 19, 2019, 2:03 p.m.
Pair the gem init and cleanup in the same layer. This moves the gem init
before the modeset init.

The error paths remain a mess.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 30b0548a5648..27613f497a46 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -392,10 +392,6 @@  static int i915_driver_modeset_probe_irq(struct drm_i915_private *i915)
 	if (ret)
 		goto out;
 
-	ret = i915_gem_init(i915);
-	if (ret)
-		goto cleanup_modeset;
-
 	intel_overlay_setup(i915);
 
 	if (!HAS_DISPLAY(i915) || !INTEL_DISPLAY_ENABLED(i915))
@@ -403,7 +399,7 @@  static int i915_driver_modeset_probe_irq(struct drm_i915_private *i915)
 
 	ret = intel_fbdev_init(&i915->drm);
 	if (ret)
-		goto cleanup_gem;
+		goto cleanup_modeset;
 
 	/* Only enable hotplug handling once the fbdev is fully set up. */
 	intel_hpd_init(i915);
@@ -412,10 +408,6 @@  static int i915_driver_modeset_probe_irq(struct drm_i915_private *i915)
 
 	return 0;
 
-cleanup_gem:
-	i915_gem_suspend(i915);
-	i915_gem_driver_remove(i915);
-	i915_gem_driver_release(i915);
 cleanup_modeset:
 	intel_modeset_driver_remove_irq(i915);
 	intel_modeset_driver_remove(i915);
@@ -1586,9 +1578,13 @@  int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto out_cleanup_modeset;
 
+	ret = i915_gem_init(dev_priv);
+	if (ret)
+		goto out_cleanup_irq;
+
 	ret = i915_driver_modeset_probe_irq(dev_priv);
 	if (ret < 0)
-		goto out_cleanup_irq;
+		goto out_cleanup_gem;
 
 	i915_driver_register(dev_priv);
 
@@ -1598,6 +1594,10 @@  int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	return 0;
 
+out_cleanup_gem:
+	i915_gem_suspend(dev_priv);
+	i915_gem_driver_remove(dev_priv);
+	i915_gem_driver_release(dev_priv);
 out_cleanup_irq:
 	intel_irq_uninstall(dev_priv);
 out_cleanup_modeset:

Comments

Quoting Jani Nikula (2019-09-19 15:03:58)
> Pair the gem init and cleanup in the same layer. This moves the gem init
> before the modeset init.

The important part here was that BIOS takeover by display is before we
clear the GGTT in i915_gem_init -> i915_init_ggtt. iirc marking up the
preallocated GGTT ranges is in intel_modeset_init.
-Chris
On Thu, 19 Sep 2019, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Quoting Jani Nikula (2019-09-19 15:03:58)
>> Pair the gem init and cleanup in the same layer. This moves the gem init
>> before the modeset init.
>
> The important part here was that BIOS takeover by display is before we
> clear the GGTT in i915_gem_init -> i915_init_ggtt. iirc marking up the
> preallocated GGTT ranges is in intel_modeset_init.

Aww, thanks. More dragons to tame.

BR,
Jani.