From fc74c2e9d65dbd0c611e1610886df098c6e3273b Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Mon, 2 Jun 2008 13:12:59 -0400 Subject: [FreeBSD] Go back to using vbl_lock and move init/destroy to load/unload. --- bsd-core/drm_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 9924ac34..ece00e18 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -202,7 +202,9 @@ int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist) DRM_DEV_MODE, "dri/card%d", unit); #if __FreeBSD_version >= 500000 - mtx_init(&dev->dev_lock, "drm device", NULL, MTX_DEF); + mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF); + mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); + mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF); #endif @@ -594,6 +596,9 @@ error: #ifdef __FreeBSD__ destroy_dev(dev->devnode); #if __FreeBSD_version >= 500000 + mtx_destroy(&dev->drw_lock); + mtx_destroy(&dev->irq_lock); + mtx_destroy(&dev->vbl_lock); mtx_destroy(&dev->dev_lock); #endif #endif -- cgit v1.2.3 From ec3d9960219e49e1bd24a097e04c3da88e2fcc53 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Tue, 3 Jun 2008 13:02:38 -0400 Subject: [FreeBSD] Forgot to call mtx_destroy on all the locks at unload. --- bsd-core/drm_drv.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index ece00e18..1616dbb4 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -655,6 +655,9 @@ static void drm_unload(struct drm_device *dev) drm_mem_uninit(); #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 + mtx_destroy(&dev->drw_lock); + mtx_destroy(&dev->irq_lock); + mtx_destroy(&dev->vbl_lock); mtx_destroy(&dev->dev_lock); #endif } -- cgit v1.2.3 From 96141bd33c0d6c4b95a2adb668538ffc1103cc18 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Thu, 5 Jun 2008 12:46:39 -0400 Subject: [FreeBSD] We need to request busmastering support. This seems to be the key to getting at least some radeon cards working. Most, if not all drivers need it enabled, so just request it once the driver has attached. --- bsd-core/drm_drv.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 1616dbb4..740a8b57 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -544,6 +544,8 @@ static int drm_load(struct drm_device *dev) /* Shared code returns -errno. */ retcode = -dev->driver.load(dev, dev->id_entry->driver_private); + if (pci_enable_busmaster(dev->device)) + DRM_ERROR("Request to enable bus-master failed.\n"); DRM_UNLOCK(); if (retcode != 0) goto error; @@ -654,6 +656,10 @@ static void drm_unload(struct drm_device *dev) delete_unrhdr(dev->drw_unrhdr); drm_mem_uninit(); + + if (pci_disable_busmaster(dev->device)) + DRM_ERROR("Request to disable bus-master failed.\n"); + #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 mtx_destroy(&dev->drw_lock); mtx_destroy(&dev->irq_lock); -- cgit v1.2.3 From 74cf1f91be7f4139601624af0343e3d411190dec Mon Sep 17 00:00:00 2001 From: Owain Gordon Ainsworth Date: Mon, 7 Jul 2008 17:23:48 +0100 Subject: BSD: change drm_locked_task*() to use the same scheme as linux. The current code can sleep in an interrupt handler, that is bad. So instead if we can't grab the lock, flag it and run the tasklet on unlock. Signed-off-by: Robert Noland --- bsd-core/drm_drv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 740a8b57..9bd6079f 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -206,6 +206,7 @@ int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist) mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF); + mtx_init(&dev->tsk_lock, "drmtsk", NULL, MTX_DEF); #endif id_entry = drm_find_description(pci_get_vendor(dev->device), -- cgit v1.2.3 From 7a3d6624c47d87bdd46f5394b8cc5130c7a4ed0d Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Fri, 25 Jul 2008 13:46:28 -0400 Subject: [FreeBSD] Duh, we need to actually define the drm_modeset_ctl... --- bsd-core/drm_drv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 9bd6079f..771e5554 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -125,6 +125,7 @@ static drm_ioctl_desc_t drm_ioctls[256] = { DRM_IOCTL_DEF(DRM_IOCTL_SG_FREE, drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank, 0), + DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_modeset_ctl, 0), DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_update_draw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), }; -- cgit v1.2.3