Module Name:    src
Committed By:   riastradh
Date:           Sun Sep  8 16:28:27 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
            i915_gem.c
        src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Still more error branch cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.30 -r1.1.1.1.2.31 \
    src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.14 -r1.1.1.1.2.15 \
    src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \
    src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.30 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.31
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.30	Sun Sep  8 16:27:15 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:28:27 2013
@@ -1758,9 +1758,7 @@ out_gem_unload:
 
 	intel_teardown_gmbus(dev);
 	intel_teardown_mchbar(dev);
-#ifdef __NetBSD__		/* XXX gt fini */
 	intel_gt_fini(dev);
-#endif
 	destroy_workqueue(dev_priv->wq);
 out_mtrrfree:
 	if (dev_priv->mm.gtt_mtrr >= 0) {
@@ -1873,6 +1871,7 @@ int i915_driver_unload(struct drm_device
 		i915_gem_context_fini(dev);
 		mutex_unlock(&dev->struct_mutex);
 		i915_gem_cleanup_aliasing_ppgtt(dev);
+		i915_gem_fini_global_gtt(dev);
 		i915_gem_cleanup_stolen(dev);
 		drm_mm_takedown(&dev_priv->mm.stolen);
 
@@ -1906,9 +1905,11 @@ int i915_driver_unload(struct drm_device
 
 	intel_teardown_gmbus(dev);
 	intel_teardown_mchbar(dev);
+	intel_gt_fini(dev);
 
 	destroy_workqueue(dev_priv->wq);
 
+	i915_gem_gtt_fini(dev);
 	pci_dev_put(dev_priv->bridge_dev);
 	kfree(dev->dev_private);
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.15
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14	Sun Sep  8 16:05:06 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:28:27 2013
@@ -4471,9 +4471,7 @@ int i915_gem_init(struct drm_device *dev
 
 		ret = i915_gem_init_aliasing_ppgtt(dev);
 		if (ret) {
-#ifdef __NetBSD__		/* XXX fini global gtt */
 			i915_gem_fini_global_gtt(dev);
-#endif
 			mutex_unlock(&dev->struct_mutex);
 			return ret;
 		}

Index: src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.5 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.6
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.5	Sun Sep  8 16:13:55 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Sun Sep  8 16:28:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.6 2013/09/08 16:28:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.1.2.6 2013/09/08 16:28:27 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -244,6 +244,17 @@ void
 i915_gem_fini_global_gtt(struct drm_device *dev)
 {
 	struct drm_i915_private *const dev_priv = dev->dev_private;
+	struct drm_i915_gem_object *obj, *next;
+	int ret;
+
+	/* Empty the mm before taking it down.  */
+	list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list,
+	    gtt_list) {
+		ret = i915_gem_object_unbind(obj);
+		if (ret)
+			DRM_ERROR("Unable to unbind object %p: %d\n", obj,
+			    ret);
+	}
 
 	drm_mm_takedown(&dev_priv->mm.gtt_space);
 }

Reply via email to