Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/i915drm i915: Nix drm_dev_alloc, and d...
details: https://anonhg.NetBSD.org/src/rev/a12b8b893ac1
branches: trunk
changeset: 1028738:a12b8b893ac1
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:54:03 2021 +0000
description:
i915: Nix drm_dev_alloc, and do drm_pci_attach in i915_driver_probe.
i915 uses a struct drm_device embedded in struct drm_i915_private
now, so we can't allocate it separately.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_drv.c | 19 ++++++++++++--
sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c | 29 +++-------------------
2 files changed, 20 insertions(+), 28 deletions(-)
diffs (121 lines):
diff -r 86c55c2d1d4c -r a12b8b893ac1 sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c Sun Dec 19 11:53:50 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c Sun Dec 19 11:54:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_drv.c,v 1.40 2021/12/19 11:26:35 riastradh Exp $ */
+/* $NetBSD: i915_drv.c,v 1.41 2021/12/19 11:54:03 riastradh Exp $ */
/* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
*/
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.40 2021/12/19 11:26:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.41 2021/12/19 11:54:03 riastradh Exp $");
#include <linux/acpi.h>
#include <linux/device.h>
@@ -1537,6 +1537,12 @@
if (IS_ERR(dev_priv))
return PTR_ERR(dev_priv);
+#ifdef __NetBSD__
+ ret = drm_pci_attach(&dev_priv->drm, pdev);
+ if (ret)
+ goto out_destroy;
+#endif
+
/* Disable nuclear pageflip by default on pre-ILK */
if (!i915_modparams.nuclear_pageflip && match_info->gen < 5)
dev_priv->drm.driver_features &= ~DRIVER_ATOMIC;
@@ -1605,9 +1611,13 @@
#ifndef __NetBSD__
pci_disable_device(pdev);
out_fini:
+#endif
i915_probe_error(dev_priv, "Device initialization failed (%d)\n", ret);
+#ifdef __NetBSD__
+ drm_pci_detach(&dev_priv->drm);
+out_destroy:
+#endif
i915_driver_destroy(dev_priv);
-#endif
return ret;
}
@@ -1663,6 +1673,9 @@
intel_runtime_pm_driver_release(rpm);
i915_driver_late_release(dev_priv);
+#ifdef __NetBSD__
+ drm_pci_detach(dev);
+#endif
i915_driver_destroy(dev_priv);
}
diff -r 86c55c2d1d4c -r a12b8b893ac1 sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c
--- a/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c Sun Dec 19 11:53:50 2021 +0000
+++ b/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c Sun Dec 19 11:54:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_pci_autoconf.c,v 1.7 2021/12/19 11:53:51 riastradh Exp $ */
+/* $NetBSD: i915_pci_autoconf.c,v 1.8 2021/12/19 11:54:03 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_pci_autoconf.c,v 1.7 2021/12/19 11:53:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_pci_autoconf.c,v 1.8 2021/12/19 11:54:03 riastradh Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -180,22 +180,6 @@
/* Initialize the Linux PCI device descriptor. */
linux_pci_dev_init(&sc->sc_pci_dev, self, device_parent(self), pa, 0);
- sc->sc_drm_dev = drm_dev_alloc(i915_drm_driver, self);
- if (IS_ERR(sc->sc_drm_dev)) {
- aprint_error_dev(self, "unable to create drm device: %ld\n",
- PTR_ERR(sc->sc_drm_dev));
- sc->sc_drm_dev = NULL;
- return;
- }
-
- /* XXX errno Linux->NetBSD */
- error = -drm_pci_attach(sc->sc_drm_dev, &sc->sc_pci_dev);
- if (error) {
- aprint_error_dev(self, "unable to attach drm: %d\n", error);
- return;
- }
- sc->sc_pci_attached = true;
-
/* XXX errno Linux->NetBSD */
error = -i915_driver_probe(&sc->sc_pci_dev, ent);
if (error) {
@@ -203,6 +187,7 @@
return;
}
sc->sc_dev_registered = true;
+ sc->sc_drm_dev = pci_get_drvdata(&sc->sc_pci_dev);
while (!SIMPLEQ_EMPTY(&sc->sc_task_u.attach)) {
struct i915drmkms_task *const task =
@@ -243,14 +228,8 @@
if (sc->sc_drm_dev == NULL)
goto out0;
- if (!sc->sc_pci_attached)
- goto out1;
- if (!sc->sc_dev_registered)
- goto out2;
- drm_dev_unregister(sc->sc_drm_dev);
-out2: drm_pci_detach(sc->sc_drm_dev);
-out1: drm_dev_put(sc->sc_drm_dev);
+ i915_driver_remove(sc->sc_drm_dev->dev_private);
sc->sc_drm_dev = NULL;
out0: linux_pci_dev_destroy(&sc->sc_pci_dev);
pmf_device_deregister(self);
Home |
Main Index |
Thread Index |
Old Index