summaryrefslogtreecommitdiff
path: root/bsd/gamma
diff options
context:
space:
mode:
authorDoug Rabson <dfr@freebsd.org>2000-06-13 17:38:09 +0000
committerDoug Rabson <dfr@freebsd.org>2000-06-13 17:38:09 +0000
commitd399dbcd569a66f5bf4863ffa2aab95fa8ebd5fc (patch)
treeb8593f0ebff44aae83b89416e193d6ffc1ad0f24 /bsd/gamma
parent2fbd4bf0189cf6d421000c7eea85fee3b9c79ed0 (diff)
Merged bsd-1-0-1
Diffstat (limited to 'bsd/gamma')
-rw-r--r--bsd/gamma/Makefile4
-rw-r--r--bsd/gamma/gamma_dma.c36
-rw-r--r--bsd/gamma/gamma_drv.c71
-rw-r--r--bsd/gamma/gamma_drv.h6
4 files changed, 96 insertions, 21 deletions
diff --git a/bsd/gamma/Makefile b/bsd/gamma/Makefile
index dd611038..f5635910 100644
--- a/bsd/gamma/Makefile
+++ b/bsd/gamma/Makefile
@@ -4,7 +4,7 @@ KMOD = gamma
SRCS = gamma_drv.c gamma_dma.c
SRCS += device_if.h bus_if.h pci_if.h
CFLAGS += ${DEBUG_FLAGS} -I..
-KERN = /usr/src/sys
+KMODDEPS = drm
@:
ln -sf /sys @
@@ -12,4 +12,4 @@ KERN = /usr/src/sys
machine:
ln -sf /sys/i386/include machine
-.include "/usr/src/sys/conf/kmod.mk"
+.include <bsd.kmod.mk>
diff --git a/bsd/gamma/gamma_dma.c b/bsd/gamma/gamma_dma.c
index 177440db..07d8248b 100644
--- a/bsd/gamma/gamma_dma.c
+++ b/bsd/gamma/gamma_dma.c
@@ -1,8 +1,8 @@
/* gamma_dma.c -- DMA support for GMX 2000 -*- c -*-
* Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Thu Sep 16 12:55:37 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,8 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.9 1999/09/16 16:56:18 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -92,13 +92,31 @@ static __inline void gamma_dma_dispatch(drm_device_t *dev,
GAMMA_WRITE(GAMMA_DMACOUNT, length / 4);
}
-static __inline void gamma_dma_quiescent(drm_device_t *dev)
+static __inline void gamma_dma_quiescent_single(drm_device_t *dev)
{
while (GAMMA_READ(GAMMA_DMACOUNT))
;
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
;
+
+ GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
+ GAMMA_WRITE(GAMMA_SYNC, 0);
+
+ do {
+ while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
+ ;
+ } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
+}
+
+static __inline void gamma_dma_quiescent_dual(drm_device_t *dev)
+{
+ while (GAMMA_READ(GAMMA_DMACOUNT))
+ ;
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
+ ;
+
GAMMA_WRITE(GAMMA_BROADCASTMASK, 3);
+
GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
GAMMA_WRITE(GAMMA_SYNC, 0);
@@ -107,7 +125,6 @@ static __inline void gamma_dma_quiescent(drm_device_t *dev)
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
;
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
-
/* Read from second MX */
do {
@@ -784,8 +801,13 @@ int gamma_lock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p)
if (!ret) {
if (lock.flags & _DRM_LOCK_READY)
gamma_dma_ready(dev);
- if (lock.flags & _DRM_LOCK_QUIESCENT)
- gamma_dma_quiescent(dev);
+ if (lock.flags & _DRM_LOCK_QUIESCENT) {
+ if (gamma_found() == 1) {
+ gamma_dma_quiescent_single(dev);
+ } else {
+ gamma_dma_quiescent_dual(dev);
+ }
+ }
}
DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
diff --git a/bsd/gamma/gamma_drv.c b/bsd/gamma/gamma_drv.c
index fe71737a..8663a2ac 100644
--- a/bsd/gamma/gamma_drv.c
+++ b/bsd/gamma/gamma_drv.c
@@ -1,8 +1,8 @@
/* gamma.c -- 3dlabs GMX 2000 driver -*- c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:36 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,8 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -36,6 +36,16 @@
MODULE_DEPEND(gamma, drm, 1, 1, 1);
+#ifndef PCI_DEVICE_ID_3DLABS_GAMMA
+#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
+#endif
+#ifndef PCI_DEVICE_ID_3DLABS_MX
+#define PCI_DEVICE_ID_3DLABS_MX 0x0006
+#endif
+#ifndef PCI_VENDOR_ID_3DLABS
+#define PCI_VENDOR_ID_3DLABS 0x3d3d
+#endif
+
static int gamma_init(device_t nbdev);
static void gamma_cleanup(device_t nbdev);
@@ -47,6 +57,10 @@ static int gamma_probe(device_t dev)
case 0x00083d3d:
s = "3D Labs Gamma graphics accelerator";
break;
+
+ case 0x00063d3d:
+ s = "3D Labs MX graphics accelerator";
+ break;
}
if (s) {
@@ -92,10 +106,10 @@ DRIVER_MODULE(if_gamma, pci, gamma_driver, gamma_devclass, 0, 0);
#define GAMMA_NAME "gamma"
#define GAMMA_DESC "3dlabs GMX 2000"
-#define GAMMA_DATE "19990830"
-#define GAMMA_MAJOR 0
+#define GAMMA_DATE "20000606"
+#define GAMMA_MAJOR 1
#define GAMMA_MINOR 0
-#define GAMMA_PATCHLEVEL 5
+#define GAMMA_PATCHLEVEL 0
#define CDEV_MAJOR 200
@@ -150,6 +164,8 @@ static drm_ioctl_desc_t gamma_ioctls[] = {
};
#define GAMMA_IOCTL_COUNT DRM_ARRAY_SIZE(gamma_ioctls)
+static int devices = 0;
+
static int gamma_setup(drm_device_t *dev)
{
int i;
@@ -285,6 +301,10 @@ gamma_takedown(drm_device_t *dev)
- PAGE_SHIFT,
DRM_MEM_SAREA);
break;
+ case _DRM_AGP:
+ /* Do nothing here, because this is all
+ handled in the AGP/GART driver. */
+ break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
}
@@ -326,6 +346,38 @@ gamma_takedown(drm_device_t *dev)
return 0;
}
+int gamma_found(void)
+{
+ return devices;
+}
+
+static int
+gamma_find_devices(device_t dev)
+{
+ device_t *children, child;
+ int nchildren, i;
+ int count = 0;
+
+ if (device_get_children(device_get_parent(dev), &children, &nchildren))
+ return 0;
+
+ for (i = 0; i < nchildren; i++) {
+ child = children[i];
+
+ if (pci_get_slot(dev) == pci_get_slot(child) &&
+ pci_get_vendor(child) == PCI_VENDOR_ID_3DLABS &&
+ pci_get_device(child) == PCI_DEVICE_ID_3DLABS_MX) {
+ count++;
+ }
+ }
+ free(children, M_TEMP);
+
+ /* we don't currently support more than two */
+ if (count > 2) count = 2;
+
+ return count;
+}
+
/* gamma_init is called via gamma_attach at module load time */
static int
@@ -342,6 +394,8 @@ gamma_init(device_t nbdev)
#if 0 /* XXX use getenv I guess */
drm_parse_options(gamma);
#endif
+ devices = gamma_find_devices(nbdev);
+ if (devices == 0) return -1;
#if 0
if ((retcode = misc_register(&gamma_misc))) {
@@ -361,13 +415,14 @@ gamma_init(device_t nbdev)
drm_mem_init();
drm_sysctl_init(dev);
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+ DRM_INFO("Initialized %s %d.%d.%d %s on minor %d with %d MX devices\n",
GAMMA_NAME,
GAMMA_MAJOR,
GAMMA_MINOR,
GAMMA_PATCHLEVEL,
GAMMA_DATE,
- device_get_unit(nbdev));
+ device_get_unit(nbdev),
+ devices);
return 0;
}
diff --git a/bsd/gamma/gamma_drv.h b/bsd/gamma/gamma_drv.h
index e4888220..b7c6df5d 100644
--- a/bsd/gamma/gamma_drv.h
+++ b/bsd/gamma/gamma_drv.h
@@ -1,8 +1,8 @@
/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:24:27 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,9 +24,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.1 1999/09/25 14:38:00 dawes Exp $
- *
*/
#ifndef _GAMMA_DRV_H_
@@ -46,5 +43,6 @@ extern d_ioctl_t gamma_control;
extern int gamma_dma_schedule(drm_device_t *dev, int locked);
extern int gamma_irq_install(drm_device_t *dev, int irq);
extern int gamma_irq_uninstall(drm_device_t *dev);
+extern int gamma_found(void);
#endif