[Intel-gfx] [PATCH 11/13] drm/i915: move gem init up from modeset init

Jani Nikula jani.nikula at intel.com
Thu Sep 19 14:03:58 UTC 2019


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 at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

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:
-- 
2.20.1



More information about the Intel-gfx mailing list