summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/xf86drm.c108
-rw-r--r--linux-core/drmP.h7
-rw-r--r--linux-core/i810_dma.c14
-rw-r--r--linux-core/i810_drv.c11
-rw-r--r--linux-core/i810_drv.h6
-rw-r--r--linux-core/mga_drv.c16
-rw-r--r--linux-core/r128_drv.c70
-rw-r--r--linux-core/tdfx_drv.c10
-rw-r--r--linux/Makefile.linux39
-rw-r--r--linux/agpsupport.c5
-rw-r--r--linux/auth.c6
-rw-r--r--linux/bufs.c8
-rw-r--r--linux/context.c5
-rw-r--r--linux/ctxbitmap.c7
-rw-r--r--linux/dma.c7
-rw-r--r--linux/drawable.c5
-rw-r--r--linux/drm.h16
-rw-r--r--linux/drmP.h7
-rw-r--r--linux/fops.c19
-rw-r--r--linux/gamma_dma.c37
-rw-r--r--linux/gamma_drv.c61
-rw-r--r--linux/gamma_drv.h6
-rw-r--r--linux/i810_bufs.c7
-rw-r--r--linux/i810_context.c6
-rw-r--r--linux/i810_dma.c14
-rw-r--r--linux/i810_drv.c11
-rw-r--r--linux/i810_drv.h6
-rw-r--r--linux/init.c14
-rw-r--r--linux/ioctl.c5
-rw-r--r--linux/lists.c5
-rw-r--r--linux/lock.c5
-rw-r--r--linux/memory.c5
-rw-r--r--linux/mga_bufs.c7
-rw-r--r--linux/mga_context.c6
-rw-r--r--linux/mga_dma.c9
-rw-r--r--linux/mga_drm.h6
-rw-r--r--linux/mga_drv.c16
-rw-r--r--linux/mga_drv.h6
-rw-r--r--linux/mga_state.c1196
-rw-r--r--linux/proc.c7
-rw-r--r--linux/r128_dma.c23
-rw-r--r--linux/r128_drv.c70
-rw-r--r--linux/tdfx_context.c8
-rw-r--r--linux/tdfx_drv.c10
-rw-r--r--linux/tdfx_drv.h3
-rw-r--r--linux/vm.c6
-rw-r--r--shared-core/drm.h16
-rw-r--r--shared/drm.h16
-rw-r--r--tests/drmstat.c4
49 files changed, 1082 insertions, 875 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 2e3c9b43..1174a0fa 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -1,7 +1,8 @@
/* xf86drm.c -- User-level interface to DRM device
* Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -23,8 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- *
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Kevin E. Martin <martin@valinux.com>
+ *
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.10 2000/02/23 04:47:23 martin Exp $
*
*/
@@ -71,10 +73,23 @@ extern int xf86RemoveSIGIOHandler(int fd);
#define MAP_FAILED ((void *)-1)
#endif
-#include <sys/sysmacros.h> /* for makedev() */
#include "xf86drm.h"
#include "drm.h"
+#define DRM_FIXED_DEVICE_MAJOR 145
+
+#ifdef __linux__
+#include <sys/sysmacros.h> /* for makedev() */
+#endif
+
+#ifndef makedev
+ /* This definition needs to be changed on
+ some systems if dev_t is a structure.
+ If there is a header file we can get it
+ from, there would be best. */
+#define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
+#endif
+
static void *drmHashTable = NULL; /* Context switch callbacks */
typedef struct drmHashEntry {
@@ -95,9 +110,16 @@ void drmFree(void *pt)
if (pt) _DRM_FREE(pt);
}
+/* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */
static char *drmStrdup(const char *s)
{
- return s ? strdup(s) : NULL;
+ char *retval = NULL;
+
+ if (s) {
+ retval = _DRM_MALLOC(strlen(s)+1);
+ strcpy(retval, s);
+ }
+ return retval;
}
@@ -134,7 +156,7 @@ static drmHashEntry *drmGetEntry(int fd)
return entry;
}
-/* drm_open is used to open the /dev/drm device */
+/* drm_open is used to open the /dev/dri device */
static int drm_open(const char *file)
{
@@ -144,14 +166,6 @@ static int drm_open(const char *file)
return -errno;
}
-/* drmAvailable looks for /proc/dri, and returns 1 if it is present. */
-
-int drmAvailable(void)
-{
- if (!access("/proc/dri/0", R_OK)) return 1;
- return 0;
-}
-
static int drmOpenDevice(const char *path, long dev,
mode_t mode, uid_t user, gid_t group)
{
@@ -161,7 +175,16 @@ static int drmOpenDevice(const char *path, long dev,
struct stat st;
#endif
- if (!stat(path, &st) && st.st_rdev == dev) return drm_open(path);
+ /* Fiddle mode to remove execute bits */
+ mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+
+ if (!stat(path, &st) && st.st_rdev == dev) {
+ if (!geteuid()) {
+ chown(path, user, group);
+ chmod(path, mode);
+ }
+ return drm_open(path);
+ }
if (geteuid()) return DRM_ERR_NOT_ROOT;
remove(path);
@@ -174,6 +197,38 @@ static int drmOpenDevice(const char *path, long dev,
return drm_open(path);
}
+/* drmAvailable looks for /proc/dri, and returns 1 if it is present. On
+ OSs that do not have a Linux-like /proc, this information will not be
+ available, and we'll have to create a device and check if the driver is
+ loaded that way. */
+
+int drmAvailable(void)
+{
+ char dev_name[64];
+ drmVersionPtr version;
+ int retval = 0;
+ int fd;
+
+ if (!access("/proc/dri/0", R_OK)) return 1;
+
+ sprintf(dev_name, "/dev/dri-temp-%d", getpid());
+
+ remove(dev_name);
+ if ((fd = drmOpenDevice(dev_name, makedev(DRM_FIXED_DEVICE_MAJOR, 0),
+ S_IRUSR, geteuid(), getegid())) >= 0) {
+ /* Read version to make sure this is
+ actually a DRI device. */
+ if ((version = drmGetVersion(fd))) {
+ retval = 1;
+ drmFreeVersion(version);
+ }
+ close(fd);
+ }
+ remove(dev_name);
+
+ return retval;
+}
+
static int drmOpenByBusid(const char *busid)
{
int i;
@@ -268,7 +323,24 @@ static int drmOpenByName(const char *name)
}
}
}
- } else remove(dev_name);
+ } else {
+ drmVersionPtr version;
+ /* /proc/dri not available, possibly
+ because we aren't on a Linux system.
+ So, try to create the next device and
+ see if it's active. */
+ dev = makedev(DRM_FIXED_DEVICE_MAJOR, i);
+ if ((fd = drmOpenDevice(dev_name, dev, mode, user, group))) {
+ if ((version = drmGetVersion(fd))) {
+ if (!strcmp(version->name, name)) {
+ drmFreeVersion(version);
+ return fd;
+ }
+ drmFreeVersion(version);
+ }
+ }
+ remove(dev_name);
+ }
}
return -1;
}
@@ -303,7 +375,7 @@ static void drmFreeKernelVersion(drm_version_t *v)
drmFree(v);
}
-static void drmCopyVersion(drmVersionPtr d, drm_version_t *s)
+static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s)
{
d->version_major = s->version_major;
d->version_minor = s->version_minor;
@@ -317,7 +389,7 @@ static void drmCopyVersion(drmVersionPtr d, drm_version_t *s)
}
/* drmVersion obtains the version information via an ioctl. Similar
- * information is available via /proc/drm. */
+ * information is available via /proc/dri. */
drmVersionPtr drmGetVersion(int fd)
{
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 43670e28..350d1ef9 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -1,7 +1,8 @@
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -23,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.6 2000/02/23 04:47:27 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -528,6 +530,7 @@ typedef struct drm_device {
/* Misc. support (init.c) */
extern int drm_flags;
extern void drm_parse_options(char *s);
+extern int drm_cpu_valid(void);
/* Device support (fops.c) */
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index f041f209..94f35b61 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,11 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- * Keith Whitwell <keithw@precisioninsight.com>
- *
- * $XFree86$
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
*/
@@ -37,6 +36,11 @@
#include <linux/interrupt.h> /* For task queue support */
+/* in case we don't have a 2.3.99-pre6 kernel or later: */
+#ifndef VM_DONTCOPY
+#define VM_DONTCOPY 0
+#endif
+
#define I810_BUF_FREE 2
#define I810_BUF_CLIENT 1
#define I810_BUF_HARDWARE 0
diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c
index 75b402da..b523db90 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@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
@@ -23,10 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c,v 1.1 2000/02/11 17:26:05 dawes Exp $
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
*/
@@ -41,9 +40,9 @@ EXPORT_SYMBOL(i810_cleanup);
#define I810_NAME "i810"
#define I810_DESC "Intel I810"
#define I810_DATE "19991213"
-#define I810_MAJOR 0
+#define I810_MAJOR 1
#define I810_MINOR 0
-#define I810_PATCHLEVEL 1
+#define I810_PATCHLEVEL 0
static drm_device_t i810_device;
drm_ctx_t i810_res_ctx;
diff --git a/linux-core/i810_drv.h b/linux-core/i810_drv.h
index 334cacb2..c387bf72 100644
--- a/linux-core/i810_drv.h
+++ b/linux-core/i810_drv.h
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h,v 1.1 2000/02/11 17:26:05 dawes Exp $
*/
#ifndef _I810_DRV_H_
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index 5fabe1f2..4b2c835f 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c,v 1.1 2000/02/11 17:26:07 dawes Exp $
*
*/
@@ -39,9 +39,9 @@ EXPORT_SYMBOL(mga_cleanup);
#define MGA_NAME "mga"
#define MGA_DESC "Matrox g200/g400"
#define MGA_DATE "19991213"
-#define MGA_MAJOR 0
+#define MGA_MAJOR 1
#define MGA_MINOR 0
-#define MGA_PATCHLEVEL 1
+#define MGA_PATCHLEVEL 0
static drm_device_t mga_device;
drm_ctx_t mga_res_ctx;
@@ -385,9 +385,9 @@ int mga_init(void)
DRM_DEBUG("doing agp init\n");
dev->agp = drm_agp_init();
if(dev->agp == NULL) {
- DRM_DEBUG("The mga drm module requires the agpgart module"
- " to function correctly\nPlease load the agpgart"
- " module before you load the mga module\n");
+ DRM_INFO("The mga drm module requires the agpgart module"
+ " to function correctly\nPlease load the agpgart"
+ " module before you load the mga module\n");
drm_proc_cleanup();
misc_deregister(&mga_misc);
mga_takedown(dev);
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index 45ade1de..e5a85af9 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -10,11 +10,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,10 +22,10 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
+ *
* Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
* Kevin E. Martin <kevin@precisioninsight.com>
- *
+ *
* $XFree86$
*
*/
@@ -38,10 +38,10 @@ EXPORT_SYMBOL(r128_cleanup);
#define R128_NAME "r128"
#define R128_DESC "r128"
-#define R128_DATE "20000422"
-#define R128_MAJOR 0
+#define R128_DATE "20000607"
+#define R128_MAJOR 1
#define R128_MINOR 0
-#define R128_PATCHLEVEL 5
+#define R128_PATCHLEVEL 0
static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
@@ -108,7 +108,7 @@ static drm_ioctl_desc_t r128_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_eng_reset, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_FLUSH)] = { r128_eng_flush, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_submit_pkt, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCEIDL)] = { r128_cce_idle, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_IDLE)] = { r128_cce_idle, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_vertex_buf, 1, 0 },
};
#define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls)
@@ -144,7 +144,7 @@ void cleanup_module(void)
*
* This is not currently supported, since it requires changes to
* linux/init/main.c. */
-
+
void __init r128_setup(char *str, int *ints)
{
@@ -159,7 +159,7 @@ void __init r128_setup(char *str, int *ints)
static int r128_setup(drm_device_t *dev)
{
int i;
-
+
atomic_set(&dev->ioctl_count, 0);
atomic_set(&dev->vma_count, 0);
dev->buf_use = 0;
@@ -202,7 +202,7 @@ static int r128_setup(drm_device_t *dev)
dev->ctx_start = 0;
dev->lck_start = 0;
-
+
dev->buf_rp = dev->buf;
dev->buf_wp = dev->buf;
dev->buf_end = dev->buf + DRM_BSZ;
@@ -211,15 +211,15 @@ static int r128_setup(drm_device_t *dev)
init_waitqueue_head(&dev->buf_writers);
r128_res_ctx.handle=-1;
-
+
DRM_DEBUG("\n");
-
+
/* The kernel's context could be created here, but is now created
in drm_dma_enqueue. This is more resource-efficient for
hardware that does not do DMA, but may mean that
drm_select_queue fails between the time the interrupt is
initialized and the time the queues are initialized. */
-
+
return 0;
}
@@ -235,12 +235,12 @@ static int r128_takedown(drm_device_t *dev)
down(&dev->struct_sem);
del_timer(&dev->timer);
-
+
if (dev->devname) {
drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
dev->devname = NULL;
}
-
+
if (dev->unique) {
drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
dev->unique = NULL;
@@ -260,7 +260,7 @@ static int r128_takedown(drm_device_t *dev)
if (dev->agp) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
-
+
/* Remove AGP resources, but leave dev->agp
intact until r128_cleanup is called. */
for (entry = dev->agp->memory; entry; entry = nexte) {
@@ -270,15 +270,15 @@ static int r128_takedown(drm_device_t *dev)
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
}
dev->agp->memory = NULL;
-
+
if (dev->agp->acquired && drm_agp.release)
(*drm_agp.release)();
-
+
dev->agp->acquired = 0;
dev->agp->enabled = 0;
}
#endif
-
+
/* Clear vma list (only built for debugging) */
if (dev->vmalist) {
for (vma = dev->vmalist; vma; vma = vma_next) {
@@ -287,7 +287,7 @@ static int r128_takedown(drm_device_t *dev)
}
dev->vmalist = NULL;
}
-
+
/* Clear map area and mtrr information */
if (dev->maplist) {
for (i = 0; i < dev->map_count; i++) {
@@ -325,7 +325,7 @@ static int r128_takedown(drm_device_t *dev)
dev->maplist = NULL;
dev->map_count = 0;
}
-
+
drm_dma_takedown(dev);
dev->queue_count = 0;
@@ -335,7 +335,7 @@ static int r128_takedown(drm_device_t *dev)
wake_up_interruptible(&dev->lock.lock_queue);
}
up(&dev->struct_sem);
-
+
return 0;
}
@@ -352,7 +352,7 @@ int r128_init(void)
memset((void *)dev, 0, sizeof(*dev));
dev->count_lock = SPIN_LOCK_UNLOCKED;
sema_init(&dev->struct_sem, 1);
-
+
#ifdef MODULE
drm_parse_options(r128);
#endif
@@ -404,7 +404,7 @@ void r128_cleanup(void)
drm_device_t *dev = &r128_device;
DRM_DEBUG("\n");
-
+
drm_proc_cleanup();
if (misc_deregister(&r128_misc)) {
DRM_ERROR("Cannot unload module\n");
@@ -460,7 +460,7 @@ int r128_open(struct inode *inode, struct file *filp)
{
drm_device_t *dev = &r128_device;
int retcode = 0;
-
+
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
MOD_INC_USE_COUNT;
@@ -517,7 +517,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->ioctl_count);
atomic_inc(&dev->total_ioctl);
++priv->ioctl_count;
-
+
DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
current->pid, cmd, nr, dev->device, priv->authenticated);
@@ -537,7 +537,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
retcode = (func)(inode, filp, cmd, arg);
}
}
-
+
atomic_dec(&dev->ioctl_count);
return retcode;
}
@@ -574,7 +574,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
if (lock.context < 0 || lock.context >= dev->queue_count)
return -EINVAL;
#endif
-
+
if (!ret) {
#if 0
if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
@@ -586,7 +586,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
/* Can't take lock if we just had it and
there is contention. */
DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n",
- lock.context, current->pid, j,
+ lock.context, current->pid, j,
dev->lock.lock_time, jiffies);
current->state = TASK_INTERRUPTIBLE;
current->policy |= SCHED_YIELD;
@@ -609,7 +609,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->total_locks);
break; /* Got lock */
}
-
+
/* Contention */
atomic_inc(&dev->total_sleeps);
current->state = TASK_INTERRUPTIBLE;
@@ -665,7 +665,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
}
#if 0
- DRM_ERROR("pid = %5d, old counter = %5ld\n",
+ DRM_ERROR("pid = %5d, old counter = %5ld\n",
current->pid, current->counter);
#endif
if (lock.context != r128_res_ctx.handle) {
@@ -683,7 +683,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
#if DRM_DMA_HISTOGRAM
atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
#endif
-
+
return ret;
}
@@ -696,7 +696,7 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
drm_lock_t lock;
copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
-
+
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock.context);
@@ -732,6 +732,6 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(10);
#endif
-
+
return 0;
}
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index fb7a997b..d8fef953 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -1,8 +1,8 @@
/* tdfx.c -- tdfx driver -*- linux-c -*-
* Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:35 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,7 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c,v 1.3 2000/02/23 04:47:31 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Daryll Strauss <daryll@valinux.com>
*
*/
@@ -37,9 +39,9 @@ EXPORT_SYMBOL(tdfx_cleanup);
#define TDFX_NAME "tdfx"
#define TDFX_DESC "tdfx"
#define TDFX_DATE "19991009"
-#define TDFX_MAJOR 0
+#define TDFX_MAJOR 1
#define TDFX_MINOR 0
-#define TDFX_PATCHLEVEL 1
+#define TDFX_PATCHLEVEL 0
static drm_device_t tdfx_device;
drm_ctx_t tdfx_res_ctx;
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index 368c3c85..ecc196bd 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -1,7 +1,8 @@
# Makefile -- For the Direct Rendering Manager module (drm)
# Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com
#
-# Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+# 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
@@ -23,8 +24,22 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.6 2000/02/23 04:47:25 martin Exp $
-#
+#
+# ***** NOTE NOTE NOTE NOTE NOTE *****
+# To override the automatic Linux source tree determination, pass the
+# pathname for the kernel that you want to compile on the command line,
+# like this:
+# make TREE=/usr/my-kernel-tree/include
+#
+#
+# ***** NOTE NOTE NOTE NOTE NOTE *****
+# Because some distributions patch 2.2.x kernels to make kill_fasync have
+# three parameters, this script tries to determine, via the examination of
+# header files, if your kernel has been patched. If this detection is
+# incorrect, you can override the value on the command line, like this:
+# make PARAMS=2
+# or
+# make PARAMS=3
.SUFFIXES:
@@ -96,11 +111,6 @@ endif
endif
endif
-# To override this determination, pass the path on the make command line:
-# make TREE=/usr/my-kernel-tree/include
-# or hardcode a value for TREE here:
-# TREE:=/usr/include
-
ifeq ($(TREE),0)
all:; @echo Error: Could not locate kernel tree in $A $B $C
else
@@ -110,6 +120,8 @@ MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
| grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'AGP = ' | cut -d' ' -f3)
+PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h \
+ | fgrep -q band; then echo 3; else echo 2; fi)
ifeq ($(AGP),0)
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'AGP_MODULE = ' | cut -d' ' -f3)
@@ -127,8 +139,9 @@ I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o
I810HEADERS= i810_drv.h $(DRMHEADERS)
endif
-all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS} \
- AGP=${AGP}
+all::;@echo === KERNEL HEADERS IN $(TREE)
+all::;@echo === SMP=${SMP} MODVERSIONS=${MODVERSIONS} AGP=${AGP}
+all::;@echo === kill_fasync has $(PARAMS) parameters
all:: $(LIBS) $(MODS) $(PROGS)
endif
@@ -141,7 +154,9 @@ endif
ifeq ($(MODVERSIONS),1)
MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h
endif
-
+ifeq ($(PARAMS),3)
+MODCFLAGS += -DKILLFASYNCHASTHREEPARAMETERS
+endif
# **** End of configuration
@@ -178,7 +193,7 @@ ChangeLog:
# .o files are used for modules
%.o: %.c
- $(CC) $(MODCFLAGS) -c $< -o $@
+ $(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@
%.po: %.c
$(CC) $(PRGCFLAGS) -DDRM_USE_MALLOC -c $< -o $@
diff --git a/linux/agpsupport.c b/linux/agpsupport.c
index 14fb8b53..c89c3e25 100644
--- a/linux/agpsupport.c
+++ b/linux/agpsupport.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 09:56:45 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
@@ -23,9 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c,v 1.1 2000/02/11 17:26:02 dawes Exp $
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/auth.c b/linux/auth.c
index 0e3b1c56..b133bc50 100644
--- a/linux/auth.c
+++ b/linux/auth.c
@@ -1,8 +1,8 @@
/* auth.c -- IOCTLs for authentication -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:48 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.2 2000/02/23 04:47:25 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -44,7 +45,6 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
down(&dev->struct_sem);
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
- if (pt->priv->authenticated) continue;
if (pt->magic == magic) {
retval = pt->priv;
break;
diff --git a/linux/bufs.c b/linux/bufs.c
index 7902f0cc..011e4241 100644
--- a/linux/bufs.c
+++ b/linux/bufs.c
@@ -1,8 +1,8 @@
/* bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Mon Feb 14 00:14:11 2000 by kevin@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 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,11 +24,13 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.5 2000/02/23 04:47:25 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#define __NO_VERSION__
+#include <linux/config.h>
#include "drmP.h"
#include "linux/un.h"
diff --git a/linux/context.c b/linux/context.c
index fdf8fd9f..ca491094 100644
--- a/linux/context.c
+++ b/linux/context.c
@@ -1,8 +1,8 @@
/* context.c -- IOCTLs for contexts and DMA queues -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:32:09 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.2 2000/02/23 04:47:26 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/ctxbitmap.c b/linux/ctxbitmap.c
index 781984f1..61550597 100644
--- a/linux/ctxbitmap.c
+++ b/linux/ctxbitmap.c
@@ -1,7 +1,8 @@
/* ctxbitmap.c -- Context bitmap management -*- linux-c -*-
* Created: Thu Jan 6 03:56:42 2000 by jhartmann@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 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
@@ -23,9 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Author: Jeff Hartmann <jhartmann@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c,v 1.1 2000/02/11 17:26:02 dawes Exp $
+ * Author: Jeff Hartmann <jhartmann@valinux.com>
*
*/
diff --git a/linux/dma.c b/linux/dma.c
index 37ab674f..ac2d1bc5 100644
--- a/linux/dma.c
+++ b/linux/dma.c
@@ -1,8 +1,8 @@
/* dma.c -- DMA IOCTL and function support -*- linux-c -*-
* Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Sun Feb 13 23:19:45 2000 by kevin@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.5 2000/02/23 04:47:26 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinuxa.com>
*
*/
diff --git a/linux/drawable.c b/linux/drawable.c
index c7acecb9..03839f5b 100644
--- a/linux/drawable.c
+++ b/linux/drawable.c
@@ -1,8 +1,8 @@
/* drawable.c -- IOCTLs for drawables -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:03 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.2 2000/02/23 04:47:26 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/drm.h b/linux/drm.h
index b2e2a0ac..56ef48d2 100644
--- a/linux/drm.h
+++ b/linux/drm.h
@@ -1,7 +1,8 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -10,11 +11,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,8 +23,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.5 2000/02/23 04:47:26 martin Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
@@ -60,7 +62,7 @@ typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
typedef unsigned int drm_magic_t;
-/* Warning: If you change this structure, make sure you change
+/* Warning: If you change this structure, make sure you change
* XF86DRIClipRectRec in the server as well */
typedef struct drm_clip_rect {
@@ -356,7 +358,7 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t)
#define DRM_IOCTL_R128_RESET DRM_IO( 0x41)
#define DRM_IOCTL_R128_FLUSH DRM_IO( 0x42)
-#define DRM_IOCTL_R128_CCEIDL DRM_IO( 0x43)
+#define DRM_IOCTL_R128_IDLE DRM_IO( 0x43)
#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t)
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t)
diff --git a/linux/drmP.h b/linux/drmP.h
index 43670e28..350d1ef9 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -1,7 +1,8 @@
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -23,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.6 2000/02/23 04:47:27 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -528,6 +530,7 @@ typedef struct drm_device {
/* Misc. support (init.c) */
extern int drm_flags;
extern void drm_parse_options(char *s);
+extern int drm_cpu_valid(void);
/* Device support (fops.c) */
diff --git a/linux/fops.c b/linux/fops.c
index 1c1a3584..1eb2bdac 100644
--- a/linux/fops.c
+++ b/linux/fops.c
@@ -1,8 +1,8 @@
/* fops.c -- File operations for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 10:26:26 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
@@ -23,8 +23,10 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.6 2000/02/23 04:47:27 martin Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Daryll Strauss <daryll@valinux.com>
*
*/
@@ -40,6 +42,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
drm_file_t *priv;
if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
+ if (!drm_cpu_valid()) return -EINVAL;
DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
@@ -211,11 +214,15 @@ int drm_write_string(drm_device_t *dev, const char *s)
send -= count;
}
-#if LINUX_VERSION_CODE < 0x02020e || \
- ( LINUX_VERSION_CODE > 0x020300 && LINUX_VERSION_CODE < 0x020315 )
+#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS)
+ /* The extra parameter to kill_fasync was added in 2.3.21, and is
+ _not_ present in _stock_ 2.2.14 and 2.2.15. However, some
+ distributions patch 2.2.x kernels to add this parameter. The
+ Makefile.linux attempts to detect this addition and defines
+ KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
#else
- /* Parameter added in 2.2.14 and 2.3.21 */
+ /* Parameter added in 2.3.21 */
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
#endif
DRM_DEBUG("waking\n");
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index eec0f859..eb78c037 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -1,8 +1,8 @@
/* gamma_dma.c -- DMA support for GMX 2000 -*- linux-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
@@ -23,8 +23,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.2 2000/02/23 04:47:28 martin Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -87,13 +88,31 @@ static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address,
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);
@@ -103,7 +122,6 @@ static inline void gamma_dma_quiescent(drm_device_t *dev)
;
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
-
/* Read from second MX */
do {
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000))
@@ -788,8 +806,13 @@ int gamma_lock(struct inode *inode, struct file *filp, unsigned int cmd,
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/linux/gamma_drv.c b/linux/gamma_drv.c
index a3c2bd4a..a90f09b7 100644
--- a/linux/gamma_drv.c
+++ b/linux/gamma_drv.c
@@ -1,8 +1,8 @@
/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-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,22 +24,31 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.4 2000/02/23 04:47:28 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#define EXPORT_SYMTAB
#include "drmP.h"
#include "gamma_drv.h"
+#include <linux/pci.h>
EXPORT_SYMBOL(gamma_init);
EXPORT_SYMBOL(gamma_cleanup);
+#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
+
#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
static drm_device_t gamma_device;
@@ -98,10 +107,13 @@ static drm_ioctl_desc_t gamma_ioctls[] = {
int init_module(void);
void cleanup_module(void);
static char *gamma = NULL;
+static int devices = 0;
MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas.");
MODULE_DESCRIPTION("3dlabs GMX 2000");
MODULE_PARM(gamma, "s");
+MODULE_PARM(devices, "i");
+MODULE_PARM_DESC(devices, "devices=x, where x is the number of MX chips on your card\n");
/* init_module is called when insmod is used to load the module */
@@ -121,7 +133,7 @@ void cleanup_module(void)
#ifndef MODULE
/* gamma_setup is called by the kernel to parse command-line options passed
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
- * drm_parse_drm.
+ * drm_parse_options.
*
* This is not currently supported, since it requires changes to
* linux/init/main.c. */
@@ -271,10 +283,12 @@ static int gamma_takedown(drm_device_t *dev)
- PAGE_SHIFT,
DRM_MEM_SAREA);
break;
+#ifdef DRM_AGP
case _DRM_AGP:
/* Do nothing here, because this is all
handled in the AGP/GART driver. */
break;
+#endif
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
}
@@ -314,6 +328,34 @@ static int gamma_takedown(drm_device_t *dev)
return 0;
}
+int gamma_found(void)
+{
+ return devices;
+}
+
+int gamma_find_devices(void)
+{
+ struct pci_dev *d = NULL, *one = NULL, *two = NULL;
+
+ d = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_GAMMA,d);
+ if (!d) return 0;
+
+ one = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,d);
+ if (!one) return 0;
+
+ /* Make sure it's on the same card, if not - no MX's found */
+ if (PCI_SLOT(d->devfn) != PCI_SLOT(one->devfn)) return 0;
+
+ two = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,one);
+ if (!two) return 1;
+
+ /* Make sure it's on the same card, if not - only 1 MX found */
+ if (PCI_SLOT(d->devfn) != PCI_SLOT(two->devfn)) return 1;
+
+ /* Two MX's found - we don't currently support more than 2 */
+ return 2;
+}
+
/* gamma_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
@@ -331,6 +373,8 @@ int gamma_init(void)
#ifdef MODULE
drm_parse_options(gamma);
#endif
+ devices = gamma_find_devices();
+ if (devices == 0) return -1;
if ((retcode = misc_register(&gamma_misc))) {
DRM_ERROR("Cannot register \"%s\"\n", GAMMA_NAME);
@@ -342,13 +386,14 @@ int gamma_init(void)
drm_mem_init();
drm_proc_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,
- gamma_misc.minor);
+ gamma_misc.minor,
+ devices);
return 0;
}
diff --git a/linux/gamma_drv.h b/linux/gamma_drv.h
index d78a13eb..55dc26be 100644
--- a/linux/gamma_drv.h
+++ b/linux/gamma_drv.h
@@ -1,8 +1,8 @@
/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-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,8 +24,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.2 2000/02/23 04:47:28 martin Exp $
- *
*/
#ifndef _GAMMA_DRV_H_
@@ -53,5 +51,7 @@ extern int gamma_irq_install(drm_device_t *dev, int irq);
extern int gamma_irq_uninstall(drm_device_t *dev);
extern int gamma_control(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern int gamma_find_devices(void);
+extern int gamma_found(void);
#endif
diff --git a/linux/i810_bufs.c b/linux/i810_bufs.c
index 9737ae92..fa1f84dc 100644
--- a/linux/i810_bufs.c
+++ b/linux/i810_bufs.c
@@ -2,6 +2,7 @@
* Created: Thu Jan 6 01:47:26 2000 by jhartmann@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
@@ -23,11 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c,v 1.1 2000/02/11 17:26:04 dawes Exp $
- *
*/
#define __NO_VERSION__
diff --git a/linux/i810_context.c b/linux/i810_context.c
index 5503edf2..689814db 100644
--- a/linux/i810_context.c
+++ b/linux/i810_context.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 09:51:35 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
@@ -23,9 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- *
- * $XFree86$
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
*/
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index f041f209..94f35b61 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,11 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- * Keith Whitwell <keithw@precisioninsight.com>
- *
- * $XFree86$
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
*/
@@ -37,6 +36,11 @@
#include <linux/interrupt.h> /* For task queue support */
+/* in case we don't have a 2.3.99-pre6 kernel or later: */
+#ifndef VM_DONTCOPY
+#define VM_DONTCOPY 0
+#endif
+
#define I810_BUF_FREE 2
#define I810_BUF_CLIENT 1
#define I810_BUF_HARDWARE 0
diff --git a/linux/i810_drv.c b/linux/i810_drv.c
index 75b402da..b523db90 100644
--- a/linux/i810_drv.c
+++ b/linux/i810_drv.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@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
@@ -23,10 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c,v 1.1 2000/02/11 17:26:05 dawes Exp $
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
*/
@@ -41,9 +40,9 @@ EXPORT_SYMBOL(i810_cleanup);
#define I810_NAME "i810"
#define I810_DESC "Intel I810"
#define I810_DATE "19991213"
-#define I810_MAJOR 0
+#define I810_MAJOR 1
#define I810_MINOR 0
-#define I810_PATCHLEVEL 1
+#define I810_PATCHLEVEL 0
static drm_device_t i810_device;
drm_ctx_t i810_res_ctx;
diff --git a/linux/i810_drv.h b/linux/i810_drv.h
index 334cacb2..c387bf72 100644
--- a/linux/i810_drv.h
+++ b/linux/i810_drv.h
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h,v 1.1 2000/02/11 17:26:05 dawes Exp $
*/
#ifndef _I810_DRV_H_
diff --git a/linux/init.c b/linux/init.c
index 25c0aed2..aefc884e 100644
--- a/linux/init.c
+++ b/linux/init.c
@@ -1,8 +1,8 @@
/* init.c -- Setup/Cleanup for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:02 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.2 2000/02/23 04:47:29 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -34,7 +35,7 @@
int drm_flags = 0;
/* drm_parse_option parses a single option. See description for
- drm_parse_drm for details. */
+ drm_parse_options for details. */
static void drm_parse_option(char *s)
{
@@ -96,3 +97,10 @@ void drm_parse_options(char *s)
}
}
+int drm_cpu_valid(void)
+{
+#if defined(__i386__)
+ if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
+#endif
+ return 1;
+}
diff --git a/linux/ioctl.c b/linux/ioctl.c
index 8edfb437..b246f76e 100644
--- a/linux/ioctl.c
+++ b/linux/ioctl.c
@@ -1,8 +1,8 @@
/* ioctl.c -- IOCTL processing for DRM -*- linux-c -*-
* Created: Fri Jan 8 09:01:26 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:02 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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.2 2000/02/23 04:47:29 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/lists.c b/linux/lists.c
index af8f6150..f62495aa 100644
--- a/linux/lists.c
+++ b/linux/lists.c
@@ -1,8 +1,8 @@
/* lists.c -- Buffer list handling routines -*- linux-c -*-
* Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com
- * Revised: Sun Feb 13 23:37:52 2000 by kevin@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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.6 2000/02/23 04:56:42 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/lock.c b/linux/lock.c
index adf27ab5..55082727 100644
--- a/linux/lock.c
+++ b/linux/lock.c
@@ -1,8 +1,8 @@
/* lock.c -- IOCTLs for locking -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Sun Feb 13 23:38:25 2000 by kevin@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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 2000/02/23 04:47:29 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/memory.c b/linux/memory.c
index 559ac739..0e92401b 100644
--- a/linux/memory.c
+++ b/linux/memory.c
@@ -1,8 +1,8 @@
/* memory.c -- Memory management wrappers for DRM -*- linux-c -*-
* Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com
- * Revised: Sun Feb 13 23:39:37 2000 by kevin@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,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.5 2000/02/23 04:47:30 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/mga_bufs.c b/linux/mga_bufs.c
index 3ce428b2..b97eb495 100644
--- a/linux/mga_bufs.c
+++ b/linux/mga_bufs.c
@@ -2,6 +2,7 @@
* Created: Thu Jan 6 01:47:26 2000 by jhartmann@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
@@ -23,10 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c,v 1.1 2000/02/11 17:26:06 dawes Exp $
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
*/
diff --git a/linux/mga_context.c b/linux/mga_context.c
index 2459b35b..d0259274 100644
--- a/linux/mga_context.c
+++ b/linux/mga_context.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 09:51:35 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
@@ -23,9 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c,v 1.1 2000/02/11 17:26:06 dawes Exp $
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
*/
diff --git a/linux/mga_dma.c b/linux/mga_dma.c
index fe6a7b52..25e3622c 100644
--- a/linux/mga_dma.c
+++ b/linux/mga_dma.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,11 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
- * Keith Whitwell <keithw@precisioninsight.com>
- *
- * $XFree86$
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
*/
diff --git a/linux/mga_drm.h b/linux/mga_drm.h
index 7228b905..e75e91a4 100644
--- a/linux/mga_drm.h
+++ b/linux/mga_drm.h
@@ -2,6 +2,7 @@
* Created: Tue Jan 25 01:50:01 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Jeff Hartmann <jhartmann@precisioninsight.com>
- * Keith Whitwell <keithw@precisioninsight.com>
+ * Authors: Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
- * $XFree86$
*/
#ifndef _MGA_DRM_H_
diff --git a/linux/mga_drv.c b/linux/mga_drv.c
index 5fabe1f2..4b2c835f 100644
--- a/linux/mga_drv.c
+++ b/linux/mga_drv.c
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c,v 1.1 2000/02/11 17:26:07 dawes Exp $
*
*/
@@ -39,9 +39,9 @@ EXPORT_SYMBOL(mga_cleanup);
#define MGA_NAME "mga"
#define MGA_DESC "Matrox g200/g400"
#define MGA_DATE "19991213"
-#define MGA_MAJOR 0
+#define MGA_MAJOR 1
#define MGA_MINOR 0
-#define MGA_PATCHLEVEL 1
+#define MGA_PATCHLEVEL 0
static drm_device_t mga_device;
drm_ctx_t mga_res_ctx;
@@ -385,9 +385,9 @@ int mga_init(void)
DRM_DEBUG("doing agp init\n");
dev->agp = drm_agp_init();
if(dev->agp == NULL) {
- DRM_DEBUG("The mga drm module requires the agpgart module"
- " to function correctly\nPlease load the agpgart"
- " module before you load the mga module\n");
+ DRM_INFO("The mga drm module requires the agpgart module"
+ " to function correctly\nPlease load the agpgart"
+ " module before you load the mga module\n");
drm_proc_cleanup();
misc_deregister(&mga_misc);
mga_takedown(dev);
diff --git a/linux/mga_drv.h b/linux/mga_drv.h
index ee75a03e..f217acb9 100644
--- a/linux/mga_drv.h
+++ b/linux/mga_drv.h
@@ -2,6 +2,7 @@
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@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
@@ -23,10 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
- * Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
*
- * $XFree86$
*/
#ifndef _MGA_DRV_H_
diff --git a/linux/mga_state.c b/linux/mga_state.c
index 32f6bcf4..c9c6ef3d 100644
--- a/linux/mga_state.c
+++ b/linux/mga_state.c
@@ -2,6 +2,7 @@
* Created: Thu Jan 27 02:53:43 2000 by jhartmann@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
@@ -26,369 +27,362 @@
* Authors: Jeff Hartmann <jhartmann@precisioninsight.com>
* Keith Whitwell <keithw@precisioninsight.com>
*
- * $XFree86$
- *
*/
-
+
#define __NO_VERSION__
#include "drmP.h"
#include "mga_drv.h"
#include "drm.h"
-static void mgaEmitClipRect( drm_mga_private_t *dev_priv,
- drm_clip_rect_t *box )
+static void mgaEmitClipRect(drm_mga_private_t * dev_priv,
+ drm_clip_rect_t * box)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->ContextState;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- /* This takes 10 dwords */
- PRIMGETPTR( dev_priv );
-
- /* Force reset of dwgctl (eliminates clip disable) */
-#if 1
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DWGSYNC, 0 );
- PRIMOUTREG( MGAREG_DWGSYNC, 0 );
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
+ /* This takes 10 dwords */
+ PRIMGETPTR(dev_priv);
+
+ /* Force reset of dwgctl (eliminates clip disable) */
+#if 0
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0);
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
#else
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
- PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000 );
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
- PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000 );
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+ PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000);
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+ PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000);
#endif
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_CXBNDRY, ((box->x2)<<16)|(box->x1) );
- PRIMOUTREG( MGAREG_YTOP, box->y1 * dev_priv->stride/2 );
- PRIMOUTREG( MGAREG_YBOT, box->y2 * dev_priv->stride/2 );
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1));
+ PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / 2);
+ PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / 2);
- PRIMADVANCE( dev_priv );
+ PRIMADVANCE(dev_priv);
}
-static void mgaEmitContext(drm_mga_private_t *dev_priv )
+static void mgaEmitContext(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->ContextState;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- /* This takes a max of 15 dwords */
- PRIMGETPTR( dev_priv );
-
- PRIMOUTREG( MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG] );
- PRIMOUTREG( MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS] );
- PRIMOUTREG( MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT] );
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
-
- PRIMOUTREG( MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL] );
- PRIMOUTREG( MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR] );
- PRIMOUTREG( MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG] );
- PRIMOUTREG( MGAREG_ZORG, dev_priv->depthOffset ); /* invarient */
-
- if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
- PRIMOUTREG( MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG] );
- PRIMOUTREG( MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0] );
- PRIMOUTREG( MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1] );
- PRIMOUTREG( MGAREG_FCOL, regs[MGA_CTXREG_FCOL] );
+
+ /* This takes a max of 15 dwords */
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]);
+ PRIMOUTREG(MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS]);
+ PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]);
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+
+ PRIMOUTREG(MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL]);
+ PRIMOUTREG(MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR]);
+ PRIMOUTREG(MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG]);
+ PRIMOUTREG(MGAREG_ZORG, dev_priv->depthOffset); /* invarient */
+
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
+ PRIMOUTREG(MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG]);
+ PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]);
+ PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]);
+ PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
} else {
- PRIMOUTREG( MGAREG_FCOL, regs[MGA_CTXREG_FCOL] );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
+ PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
}
-
- PRIMADVANCE( dev_priv );
+
+ PRIMADVANCE(dev_priv);
}
-static void mgaG200EmitTex( drm_mga_private_t *dev_priv )
+static void mgaG200EmitTex(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->TexState[0];
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- PRIMGETPTR( dev_priv );
-
- /* This takes 20 dwords */
+ PRIMGETPTR(dev_priv);
- PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
- PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
- PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
- PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
+ /* This takes 20 dwords */
- PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
- PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
- PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
- PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2]);
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]);
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]);
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]);
- PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
- PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
- PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
- PRIMOUTREG( 0x2d00 + 24*4, regs[MGA_TEXREG_WIDTH] );
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]);
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]);
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]);
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]);
- PRIMOUTREG( 0x2d00 + 34*4, regs[MGA_TEXREG_HEIGHT] );
- PRIMOUTREG( MGAREG_TEXTRANS, 0xffff );
- PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
+ PRIMOUTREG(0x2d00 + 24 * 4, regs[MGA_TEXREG_WIDTH]);
- PRIMADVANCE( dev_priv );
+ PRIMOUTREG(0x2d00 + 34 * 4, regs[MGA_TEXREG_HEIGHT]);
+ PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
+ PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMADVANCE(dev_priv);
}
-static void mgaG400EmitTex0( drm_mga_private_t *dev_priv )
+static void mgaG400EmitTex0(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->TexState[0];
int multitex = sarea_priv->WarpPipe & MGA_T2;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- PRIMGETPTR( dev_priv );
-
- /* This takes a max of 30 dwords */
-
- PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
- PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
- PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
- PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
-
- PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
- PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
- PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
- PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
-
- PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
- PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
- PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
- PRIMOUTREG( 0x2d00 + 49*4, 0 );
-
- PRIMOUTREG( 0x2d00 + 57*4, 0 );
- PRIMOUTREG( 0x2d00 + 53*4, 0 );
- PRIMOUTREG( 0x2d00 + 61*4, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- if (!multitex) {
- PRIMOUTREG( 0x2d00 + 52*4, 0x40 );
- PRIMOUTREG( 0x2d00 + 60*4, 0x40 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- }
-
- PRIMOUTREG( 0x2d00 + 54*4, regs[MGA_TEXREG_WIDTH] | 0x40 );
- PRIMOUTREG( 0x2d00 + 62*4, regs[MGA_TEXREG_HEIGHT] | 0x40 );
- PRIMOUTREG( MGAREG_TEXTRANS, 0xffff );
- PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff );
-
- PRIMADVANCE( dev_priv );
-}
+ PRIMGETPTR(dev_priv);
-#define TMC_map1_enable 0x80000000
+ /* This takes a max of 30 dwords */
-static void mgaG400EmitTex1( drm_mga_private_t *dev_priv )
-{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->TexState[1];
- PRIMLOCALS;
- DRM_DEBUG("%s\n", __FUNCTION__);
-
- PRIMGETPTR( dev_priv );
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000);
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]);
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]);
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]);
- /* This takes 25 dwords */
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]);
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]);
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]);
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]);
- PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | TMC_map1_enable );
- PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
- PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
- PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
+ PRIMOUTREG(0x2d00 + 49 * 4, 0);
- PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
- PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
- PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
- PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
+ PRIMOUTREG(0x2d00 + 57 * 4, 0);
+ PRIMOUTREG(0x2d00 + 53 * 4, 0);
+ PRIMOUTREG(0x2d00 + 61 * 4, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
- PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
- PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
- PRIMOUTREG( 0x2d00 + 49*4, 0 );
-
- PRIMOUTREG( 0x2d00 + 57*4, 0 );
- PRIMOUTREG( 0x2d00 + 53*4, 0 );
- PRIMOUTREG( 0x2d00 + 61*4, 0 );
- PRIMOUTREG( 0x2d00 + 52*4, regs[MGA_TEXREG_WIDTH] | 0x40 );
+ if (!multitex) {
+ PRIMOUTREG(0x2d00 + 52 * 4, 0x40);
+ PRIMOUTREG(0x2d00 + 60 * 4, 0x40);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ }
- PRIMOUTREG( 0x2d00 + 60*4, regs[MGA_TEXREG_HEIGHT] | 0x40 );
- PRIMOUTREG( MGAREG_TEXTRANS, 0xffff );
- PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff );
- PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
+ PRIMOUTREG(0x2d00 + 54 * 4, regs[MGA_TEXREG_WIDTH] | 0x40);
+ PRIMOUTREG(0x2d00 + 62 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40);
+ PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
+ PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
- PRIMADVANCE( dev_priv );
+ PRIMADVANCE(dev_priv);
}
-/* Required when switching from multitexturing to single texturing.
- */
-static void mgaG400EmitTexFlush( drm_mga_private_t *dev_priv )
+#define TMC_map1_enable 0x80000000
+
+static void mgaG400EmitTex1(drm_mga_private_t * dev_priv)
{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int *regs = sarea_priv->TexState[1];
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- PRIMGETPTR( dev_priv );
- /* This takes 15 dwords */
+ PRIMGETPTR(dev_priv);
- PRIMOUTREG( MGAREG_YDST, 0 );
- PRIMOUTREG( MGAREG_FXLEFT, 0 );
- PRIMOUTREG( MGAREG_FXRIGHT, 1 );
- PRIMOUTREG( MGAREG_DWGCTL, MGA_FLUSH_CMD );
+ /* This takes 25 dwords */
- PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 1 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DWGSYNC, 0x7000 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
+ PRIMOUTREG(MGAREG_TEXCTL2,
+ regs[MGA_TEXREG_CTL2] | TMC_map1_enable | 0x00008000);
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]);
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]);
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]);
- PRIMOUTREG( MGAREG_TEXCTL2, 0 );
- PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0 );
- PRIMOUTREG( MGAREG_TEXCTL2, 0x80 );
- PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0 );
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]);
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]);
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]);
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]);
- PRIMADVANCE( dev_priv );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
+ PRIMOUTREG(0x2d00 + 49 * 4, 0);
+
+ PRIMOUTREG(0x2d00 + 57 * 4, 0);
+ PRIMOUTREG(0x2d00 + 53 * 4, 0);
+ PRIMOUTREG(0x2d00 + 61 * 4, 0);
+ PRIMOUTREG(0x2d00 + 52 * 4, regs[MGA_TEXREG_WIDTH] | 0x40);
+
+ PRIMOUTREG(0x2d00 + 60 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40);
+ PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
+ PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000);
+
+ PRIMADVANCE(dev_priv);
}
-static void mgaG400EmitPipe( drm_mga_private_t *dev_priv )
+#define EMIT_PIPE 50
+static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int pipe = sarea_priv->WarpPipe;
float fParam = 12800.0f;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- PRIMGETPTR( dev_priv );
- /* This takes 30 dwords */
+ PRIMGETPTR(dev_priv);
+
+ /* This takes 50 dwords */
/* Establish vertex size.
*/
+ PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
if (pipe & MGA_T2) {
- PRIMOUTREG( MGAREG_WIADDR2, WIA_wmode_suspend );
- PRIMOUTREG( MGAREG_WVRTXSZ, 0x00001e09 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
-
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0x1e000000 );
+ PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000);
} else {
- PRIMOUTREG( MGAREG_WIADDR2, WIA_wmode_suspend );
- PRIMOUTREG( MGAREG_WVRTXSZ, 0x00001807 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
-
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 );
- PRIMOUTREG( MGAREG_WACCEPTSEQ, 0x18000000 );
- }
-
- PRIMOUTREG( MGAREG_WFLAG, 0 );
- PRIMOUTREG( MGAREG_WFLAG1, 0 );
- PRIMOUTREG( 0x2d00 + 56*4, *((u32 *)(&fParam)) );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
-
- PRIMOUTREG( 0x2d00 + 49*4, 0 ); /* Tex stage 0 */
- PRIMOUTREG( 0x2d00 + 57*4, 0 ); /* Tex stage 0 */
- PRIMOUTREG( 0x2d00 + 53*4, 0 ); /* Tex stage 1 */
- PRIMOUTREG( 0x2d00 + 61*4, 0 ); /* Tex stage 1 */
-
- PRIMOUTREG( 0x2d00 + 54*4, 0x40 ); /* Tex stage 0 : w */
- PRIMOUTREG( 0x2d00 + 62*4, 0x40 ); /* Tex stage 0 : h */
- PRIMOUTREG( 0x2d00 + 52*4, 0x40 ); /* Tex stage 1 : w */
- PRIMOUTREG( 0x2d00 + 60*4, 0x40 ); /* Tex stage 1 : h */
-
+ if (dev_priv->WarpPipe & MGA_T2) {
+ /* Flush the WARP pipe */
+ PRIMOUTREG(MGAREG_YDST, 0);
+ PRIMOUTREG(MGAREG_FXLEFT, 0);
+ PRIMOUTREG(MGAREG_FXRIGHT, 1);
+ PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD);
+
+ PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000);
+ PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
+ PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000);
+ PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
+ }
+
+ PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000);
+ }
+
+ PRIMOUTREG(MGAREG_WFLAG, 0);
+ PRIMOUTREG(MGAREG_WFLAG1, 0);
+ PRIMOUTREG(0x2d00 + 56 * 4, *((u32 *) (&fParam)));
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMOUTREG(0x2d00 + 49 * 4, 0); /* Tex stage 0 */
+ PRIMOUTREG(0x2d00 + 57 * 4, 0); /* Tex stage 0 */
+ PRIMOUTREG(0x2d00 + 53 * 4, 0); /* Tex stage 1 */
+ PRIMOUTREG(0x2d00 + 61 * 4, 0); /* Tex stage 1 */
+
+ PRIMOUTREG(0x2d00 + 54 * 4, 0x40); /* Tex stage 0 : w */
+ PRIMOUTREG(0x2d00 + 62 * 4, 0x40); /* Tex stage 0 : h */
+ PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */
+ PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */
+
/* Dma pading required due to hw bug */
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_WIADDR2, (u32)(dev_priv->WarpIndex[pipe].phys_addr |
- WIA_wmode_start | WIA_wagp_agp) );
- PRIMADVANCE( dev_priv );
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_WIADDR2,
+ (u32) (dev_priv->WarpIndex[pipe].
+ phys_addr | WIA_wmode_start | WIA_wagp_agp));
+ PRIMADVANCE(dev_priv);
}
-static void mgaG200EmitPipe( drm_mga_private_t *dev_priv )
+static void mgaG200EmitPipe(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int pipe = sarea_priv->WarpPipe;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- PRIMGETPTR( dev_priv );
-
- /* This takes 15 dwords */
-
- PRIMOUTREG( MGAREG_WIADDR, WIA_wmode_suspend );
- PRIMOUTREG( MGAREG_WVRTXSZ, 7 );
- PRIMOUTREG( MGAREG_WFLAG, 0 );
- PRIMOUTREG( 0x2d00 + 24*4, 0 ); /* tex w/h */
-
- PRIMOUTREG( 0x2d00 + 25*4, 0x100 );
- PRIMOUTREG( 0x2d00 + 34*4, 0 ); /* tex w/h */
- PRIMOUTREG( 0x2d00 + 42*4, 0xFFFF );
- PRIMOUTREG( 0x2d00 + 60*4, 0xFFFF );
-
+ PRIMGETPTR(dev_priv);
+
+ /* This takes 15 dwords */
+
+ PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend);
+ PRIMOUTREG(MGAREG_WVRTXSZ, 7);
+ PRIMOUTREG(MGAREG_WFLAG, 0);
+ PRIMOUTREG(0x2d00 + 24 * 4, 0); /* tex w/h */
+
+ PRIMOUTREG(0x2d00 + 25 * 4, 0x100);
+ PRIMOUTREG(0x2d00 + 34 * 4, 0); /* tex w/h */
+ PRIMOUTREG(0x2d00 + 42 * 4, 0xFFFF);
+ PRIMOUTREG(0x2d00 + 60 * 4, 0xFFFF);
+
/* Dma pading required due to hw bug */
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff );
- PRIMOUTREG( MGAREG_WIADDR, (u32)(dev_priv->WarpIndex[pipe].phys_addr |
- WIA_wmode_start | WIA_wagp_agp) );
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_WIADDR,
+ (u32) (dev_priv->WarpIndex[pipe].
+ phys_addr | WIA_wmode_start | WIA_wagp_agp));
PRIMADVANCE( dev_priv );
}
-static void mgaEmitState( drm_mga_private_t *dev_priv )
+static void mgaEmitState(drm_mga_private_t * dev_priv)
{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty;
DRM_DEBUG("%s\n", __FUNCTION__);
- if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
int multitex = sarea_priv->WarpPipe & MGA_T2;
if (sarea_priv->WarpPipe != dev_priv->WarpPipe) {
- if ((dev_priv->WarpPipe & MGA_T2) && !multitex) {
- mgaG400EmitTexFlush( dev_priv );
- }
- mgaG400EmitPipe( dev_priv );
+ mgaG400EmitPipe(dev_priv);
dev_priv->WarpPipe = sarea_priv->WarpPipe;
}
if (dirty & MGA_UPLOAD_CTX) {
- mgaEmitContext( dev_priv );
- sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
+ mgaEmitContext(dev_priv);
+ sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
}
if (dirty & MGA_UPLOAD_TEX0) {
- mgaG400EmitTex0( dev_priv );
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
+ mgaG400EmitTex0(dev_priv);
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
}
if ((dirty & MGA_UPLOAD_TEX1) && multitex) {
- mgaG400EmitTex1( dev_priv );
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX1;
+ mgaG400EmitTex1(dev_priv);
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX1;
}
} else {
- if (sarea_priv->WarpPipe != dev_priv->WarpPipe) {
- mgaG200EmitPipe( dev_priv );
+ if (sarea_priv->WarpPipe != dev_priv->WarpPipe) {
+ mgaG200EmitPipe(dev_priv);
dev_priv->WarpPipe = sarea_priv->WarpPipe;
}
if (dirty & MGA_UPLOAD_CTX) {
- mgaEmitContext( dev_priv );
- sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
+ mgaEmitContext(dev_priv);
+ sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
}
if (dirty & MGA_UPLOAD_TEX0) {
- mgaG200EmitTex( dev_priv );
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
+ mgaG200EmitTex(dev_priv);
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
}
}
}
@@ -396,19 +390,19 @@ static void mgaEmitState( drm_mga_private_t *dev_priv )
/* Disallow all write destinations except the front and backbuffer.
*/
-static int mgaVerifyContext(drm_mga_private_t *dev_priv )
+static int mgaVerifyContext(drm_mga_private_t * dev_priv)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->ContextState;
- DRM_DEBUG("%s\n", __FUNCTION__);
+ DRM_DEBUG("%s\n", __FUNCTION__);
if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOffset &&
regs[MGA_CTXREG_DSTORG] != dev_priv->backOffset) {
- DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n",
- regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset,
- dev_priv->backOffset);
- regs[MGA_CTXREG_DSTORG] = 0;
+ DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n",
+ regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset,
+ dev_priv->backOffset);
+ regs[MGA_CTXREG_DSTORG] = 0;
return -1;
}
@@ -417,210 +411,196 @@ static int mgaVerifyContext(drm_mga_private_t *dev_priv )
/* Disallow texture reads from PCI space.
*/
-static int mgaVerifyTex(drm_mga_private_t *dev_priv,
- int unit)
+static int mgaVerifyTex(drm_mga_private_t * dev_priv, int unit)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- DRM_DEBUG("%s\n", __FUNCTION__);
+ DRM_DEBUG("%s\n", __FUNCTION__);
if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1) {
- DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n",
- sarea_priv->TexState[unit][MGA_TEXREG_ORG],
- unit);
+ DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n",
+ sarea_priv->TexState[unit][MGA_TEXREG_ORG],
+ unit);
sarea_priv->TexState[unit][MGA_TEXREG_ORG] = 0;
return -1;
- }
+ }
return 0;
}
-static int mgaVerifyState( drm_mga_private_t *dev_priv )
+static int mgaVerifyState(drm_mga_private_t * dev_priv)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty;
int rv = 0;
- DRM_DEBUG("%s\n", __FUNCTION__);
+ DRM_DEBUG("%s\n", __FUNCTION__);
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
- sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
+ if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
if (dirty & MGA_UPLOAD_CTX)
- rv |= mgaVerifyContext( dev_priv );
+ rv |= mgaVerifyContext(dev_priv);
if (dirty & MGA_UPLOAD_TEX0)
- rv |= mgaVerifyTex( dev_priv, 0 );
+ rv |= mgaVerifyTex(dev_priv, 0);
- if (dev_priv->chipset == MGA_CARD_TYPE_G400)
- {
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
if (dirty & MGA_UPLOAD_TEX1)
- rv |= mgaVerifyTex( dev_priv, 1 );
-
- if (dirty & MGA_UPLOAD_PIPE)
- rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES);
- }
- else
- {
- if (dirty & MGA_UPLOAD_PIPE)
- rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES);
- }
+ rv |= mgaVerifyTex(dev_priv, 1);
+
+ if (dirty & MGA_UPLOAD_PIPE)
+ rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES);
+ } else {
+ if (dirty & MGA_UPLOAD_PIPE)
+ rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES);
+ }
return rv == 0;
}
-static int mgaVerifyIload( drm_mga_private_t *dev_priv,
- unsigned long bus_address,
- unsigned int dstOrg, int length )
+static int mgaVerifyIload(drm_mga_private_t * dev_priv,
+ unsigned long bus_address,
+ unsigned int dstOrg, int length)
{
- DRM_DEBUG("%s\n", __FUNCTION__);
+ DRM_DEBUG("%s\n", __FUNCTION__);
- if(dstOrg < dev_priv->textureOffset ||
- dstOrg + length >
- (dev_priv->textureOffset + dev_priv->textureSize)) {
- return -EINVAL;
+ if (dstOrg < dev_priv->textureOffset ||
+ dstOrg + length >
+ (dev_priv->textureOffset + dev_priv->textureSize)) {
+ return -EINVAL;
}
- if(length % 64) {
- return -EINVAL;
+ if (length % 64) {
+ return -EINVAL;
}
- return 0;
+ return 0;
}
/* This copies a 64 byte aligned agp region to the frambuffer
* with a standard blit, the ioctl needs to do checking */
-static void mga_dma_dispatch_tex_blit( drm_device_t *dev,
- unsigned long bus_address,
- int length,
- unsigned int destOrg )
+static void mga_dma_dispatch_tex_blit(drm_device_t * dev,
+ unsigned long bus_address,
+ int length, unsigned int destOrg)
{
- drm_mga_private_t *dev_priv = dev->dev_private;
- int use_agp = PDEA_pagpxfer_enable | 0x00000001;
- u16 y2;
- PRIMLOCALS;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ int use_agp = PDEA_pagpxfer_enable | 0x00000001;
+ u16 y2;
+ PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- y2 = length / 64;
-
- PRIM_OVERFLOW( dev, dev_priv, 30 );
- PRIMGETPTR( dev_priv );
-
- PRIMOUTREG( MGAREG_DSTORG, destOrg );
- PRIMOUTREG( MGAREG_MACCESS, 0x00000000 );
- DRM_DEBUG("srcorg : %lx\n", bus_address | use_agp);
- PRIMOUTREG( MGAREG_SRCORG, (u32) bus_address | use_agp );
- PRIMOUTREG( MGAREG_AR5, 64 );
-
- PRIMOUTREG( MGAREG_PITCH, 64 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DWGCTL, MGA_COPY_CMD );
-
- PRIMOUTREG( MGAREG_AR0, 63 );
- PRIMOUTREG( MGAREG_AR3, 0 );
- PRIMOUTREG( MGAREG_FXBNDRY, (63 << 16) );
- PRIMOUTREG( MGAREG_YDSTLEN+MGAREG_MGA_EXEC, y2 );
-
- PRIMOUTREG( MGAREG_SRCORG, 0 );
- PRIMOUTREG( MGAREG_PITCH, dev_priv->stride / dev_priv->cpp );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMADVANCE( dev_priv );
+
+ y2 = length / 64;
+
+ PRIM_OVERFLOW(dev, dev_priv, 30);
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG(MGAREG_DSTORG, destOrg);
+ PRIMOUTREG(MGAREG_MACCESS, 0x00000000);
+ DRM_DEBUG("srcorg : %lx\n", bus_address | use_agp);
+ PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp);
+ PRIMOUTREG(MGAREG_AR5, 64);
+
+ PRIMOUTREG(MGAREG_PITCH, 64);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
+
+ PRIMOUTREG(MGAREG_AR0, 63);
+ PRIMOUTREG(MGAREG_AR3, 0);
+ PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16));
+ PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2);
+
+ PRIMOUTREG(MGAREG_SRCORG, 0);
+ PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMADVANCE(dev_priv);
}
-static void mga_dma_dispatch_vertex(drm_device_t *dev,
- drm_buf_t *buf)
+static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
{
- drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_buf_priv_t *buf_priv = buf->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned long address = (unsigned long)buf->bus_address;
- int length = buf->used;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned long address = (unsigned long) buf->bus_address;
+ int length = buf->used;
int use_agp = PDEA_pagpxfer_enable;
int i = 0;
- int primary_needed;
- PRIMLOCALS;
+ int primary_needed;
+ PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
DRM_DEBUG("dispatch vertex %d addr 0x%lx, "
- "length 0x%x nbox %d dirty %x\n",
- buf->idx, address, length,
+ "length 0x%x nbox %d dirty %x\n",
+ buf->idx, address, length,
sarea_priv->nbox, sarea_priv->dirty);
DRM_DEBUG("used : %d, total : %d\n", buf->used, buf->total);
- if(sarea_priv->WarpPipe & MGA_T2) {
- if ((buf->used/4) % 10)
- DRM_DEBUG("Multitex Buf is not aligned properly!!!\n");
- } else {
- if ((buf->used/4) % 8)
- DRM_DEBUG("Buf is not aligned properly!!!\n");
- }
if (buf->used) {
/* WARNING: if you change any of the state functions verify
* these numbers (Overestimating this doesn't hurt).
*/
buf_priv->dispatched = 1;
- primary_needed = (30+15+15+30+25+
- 10 +
- 15 * MGA_NR_SAREA_CLIPRECTS);
+ primary_needed = (50 + 15 + 15 + 30 + 25 +
+ 10 + 15 * MGA_NR_SAREA_CLIPRECTS);
PRIM_OVERFLOW(dev, dev_priv, primary_needed);
- mgaEmitState( dev_priv );
+ mgaEmitState(dev_priv);
do {
if (i < sarea_priv->nbox) {
DRM_DEBUG("idx %d Emit box %d/%d:"
- "%d,%d - %d,%d\n",
+ "%d,%d - %d,%d\n",
buf->idx,
i, sarea_priv->nbox,
- sarea_priv->boxes[i].x1,
+ sarea_priv->boxes[i].x1,
sarea_priv->boxes[i].y1,
- sarea_priv->boxes[i].x2,
+ sarea_priv->boxes[i].x2,
sarea_priv->boxes[i].y2);
-
- mgaEmitClipRect( dev_priv,
- &sarea_priv->boxes[i] );
+
+ mgaEmitClipRect(dev_priv,
+ &sarea_priv->boxes[i]);
}
-
- PRIMGETPTR( dev_priv );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_SECADDRESS,
- ((u32)address) | TT_VERTEX );
- PRIMOUTREG( MGAREG_SECEND,
- (((u32)(address + length)) | use_agp) );
- PRIMADVANCE( dev_priv );
- } while (++i < sarea_priv->nbox);
+
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_SECADDRESS,
+ ((u32) address) | TT_VERTEX);
+ PRIMOUTREG(MGAREG_SECEND,
+ (((u32) (address + length)) | use_agp));
+ PRIMADVANCE(dev_priv);
+ } while (++i < sarea_priv->nbox);
}
- if (buf_priv->discard) {
- if (buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv);
+ if (buf_priv->discard) {
+ if (buf_priv->dispatched == 1)
+ AGEBUF(dev_priv, buf_priv);
buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
+ mga_freelist_put(dev, buf);
}
}
-static void mga_dma_dispatch_indices(drm_device_t *dev,
- drm_buf_t *buf,
- unsigned int start,
- unsigned int end)
+static void mga_dma_dispatch_indices(drm_device_t * dev,
+ drm_buf_t * buf,
+ unsigned int start, unsigned int end)
{
- drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_buf_priv_t *buf_priv = buf->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int address = (unsigned int)buf->bus_address;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int address = (unsigned int) buf->bus_address;
int use_agp = PDEA_pagpxfer_enable;
int i = 0;
- int primary_needed;
- PRIMLOCALS;
+ int primary_needed;
+ PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
DRM_DEBUG("dispatch indices %d addr 0x%x, "
- "start 0x%x end 0x%x nbox %d dirty %x\n",
- buf->idx, address, start, end,
+ "start 0x%x end 0x%x nbox %d dirty %x\n",
+ buf->idx, address, start, end,
sarea_priv->nbox, sarea_priv->dirty);
if (start != end) {
@@ -628,174 +608,182 @@ static void mga_dma_dispatch_indices(drm_device_t *dev,
* these numbers (Overestimating this doesn't hurt).
*/
buf_priv->dispatched = 1;
- primary_needed = (25+15+30+25+
- 10 +
- 15 * MGA_NR_SAREA_CLIPRECTS);
- PRIM_OVERFLOW( dev, dev_priv, primary_needed );
- mgaEmitState( dev_priv );
+ primary_needed = (50 + 15 + 15 + 30 + 25 +
+ 10 + 15 * MGA_NR_SAREA_CLIPRECTS);
+ PRIM_OVERFLOW(dev, dev_priv, primary_needed);
+ mgaEmitState(dev_priv);
do {
if (i < sarea_priv->nbox) {
DRM_DEBUG("idx %d Emit box %d/%d:"
- "%d,%d - %d,%d\n",
+ "%d,%d - %d,%d\n",
buf->idx,
i, sarea_priv->nbox,
- sarea_priv->boxes[i].x1,
+ sarea_priv->boxes[i].x1,
sarea_priv->boxes[i].y1,
- sarea_priv->boxes[i].x2,
+ sarea_priv->boxes[i].x2,
sarea_priv->boxes[i].y2);
-
- mgaEmitClipRect( dev_priv,
- &sarea_priv->boxes[i] );
+
+ mgaEmitClipRect(dev_priv,
+ &sarea_priv->boxes[i]);
}
- PRIMGETPTR( dev_priv );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_SETUPADDRESS,
- ((address + start) |
- SETADD_mode_vertlist) );
- PRIMOUTREG( MGAREG_SETUPEND,
- ((address + end) | use_agp) );
- PRIMADVANCE( dev_priv );
- } while (++i < sarea_priv->nbox);
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_SETUPADDRESS,
+ ((address + start) |
+ SETADD_mode_vertlist));
+ PRIMOUTREG(MGAREG_SETUPEND,
+ ((address + end) | use_agp));
+ PRIMADVANCE(dev_priv);
+ } while (++i < sarea_priv->nbox);
}
- if (buf_priv->discard) {
- if (buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv);
+ if (buf_priv->discard) {
+ if (buf_priv->dispatched == 1)
+ AGEBUF(dev_priv, buf_priv);
buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
+ mga_freelist_put(dev, buf);
}
}
-static void mga_dma_dispatch_clear( drm_device_t *dev, int flags,
- unsigned int clear_color,
- unsigned int clear_zval )
+static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
+ unsigned int clear_color,
+ unsigned int clear_zval)
{
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->ContextState;
int nbox = sarea_priv->nbox;
drm_clip_rect_t *pbox = sarea_priv->boxes;
unsigned int cmd;
int i;
- int primary_needed;
- PRIMLOCALS;
+ int primary_needed;
+ PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- if ( dev_priv->sgram )
+ if (dev_priv->sgram)
cmd = MGA_CLEAR_CMD | DC_atype_blk;
else
cmd = MGA_CLEAR_CMD | DC_atype_rstr;
-
- primary_needed = nbox * 70;
- if (primary_needed == 0) primary_needed = 70;
- PRIM_OVERFLOW( dev, dev_priv, primary_needed );
- PRIMGETPTR( dev_priv );
-
- for (i = 0 ; i < nbox ; i++) {
+
+ primary_needed = nbox * 70;
+ if (primary_needed == 0)
+ primary_needed = 70;
+ PRIM_OVERFLOW(dev, dev_priv, primary_needed);
+ PRIMGETPTR(dev_priv);
+
+ for (i = 0; i < nbox; i++) {
unsigned int height = pbox[i].y2 - pbox[i].y1;
- DRM_DEBUG("dispatch clear %d,%d-%d,%d flags %x!\n",
- pbox[i].x1, pbox[i].y1, pbox[i].x2,
+ DRM_DEBUG("dispatch clear %d,%d-%d,%d flags %x!\n",
+ pbox[i].x1, pbox[i].y1, pbox[i].x2,
pbox[i].y2, flags);
- if ( flags & MGA_FRONT ) {
- DRM_DEBUG("clear front\n");
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height);
- PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1);
-
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_FCOL, clear_color );
- PRIMOUTREG( MGAREG_DSTORG, dev_priv->frontOffset );
- PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ if (flags & MGA_FRONT) {
+ DRM_DEBUG("clear front\n");
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_YDSTLEN,
+ (pbox[i].y1 << 16) | height);
+ PRIMOUTREG(MGAREG_FXBNDRY,
+ (pbox[i].x2 << 16) | pbox[i].x1);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_FCOL, clear_color);
+ PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset);
+ PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
}
- if ( flags & MGA_BACK ) {
+ if (flags & MGA_BACK) {
DRM_DEBUG("clear back\n");
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height );
- PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1 );
-
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_FCOL, clear_color );
- PRIMOUTREG( MGAREG_DSTORG, dev_priv->backOffset );
- PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_YDSTLEN,
+ (pbox[i].y1 << 16) | height);
+ PRIMOUTREG(MGAREG_FXBNDRY,
+ (pbox[i].x2 << 16) | pbox[i].x1);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_FCOL, clear_color);
+ PRIMOUTREG(MGAREG_DSTORG, dev_priv->backOffset);
+ PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
}
- if ( flags & MGA_DEPTH ) {
+ if (flags & MGA_DEPTH) {
DRM_DEBUG("clear depth\n");
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height );
- PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1 );
-
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_FCOL, clear_zval );
- PRIMOUTREG( MGAREG_DSTORG, dev_priv->depthOffset );
- PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_YDSTLEN,
+ (pbox[i].y1 << 16) | height);
+ PRIMOUTREG(MGAREG_FXBNDRY,
+ (pbox[i].x2 << 16) | pbox[i].x1);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_FCOL, clear_zval);
+ PRIMOUTREG(MGAREG_DSTORG, dev_priv->depthOffset);
+ PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
}
}
/* Force reset of DWGCTL */
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
- PRIMADVANCE( dev_priv );
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+ PRIMADVANCE(dev_priv);
}
-static void mga_dma_dispatch_swap( drm_device_t *dev )
+static void mga_dma_dispatch_swap(drm_device_t * dev)
{
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->ContextState;
int nbox = sarea_priv->nbox;
drm_clip_rect_t *pbox = sarea_priv->boxes;
int i;
- int primary_needed;
- PRIMLOCALS;
+ int primary_needed;
+ PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- primary_needed = nbox * 5;
- primary_needed += 60;
+ primary_needed = nbox * 5;
+ primary_needed += 60;
PRIM_OVERFLOW(dev, dev_priv, primary_needed);
- PRIMGETPTR( dev_priv );
-
- PRIMOUTREG( MGAREG_DSTORG, dev_priv->frontOffset );
- PRIMOUTREG( MGAREG_MACCESS, dev_priv->mAccess );
- PRIMOUTREG( MGAREG_SRCORG, dev_priv->backOffset );
- PRIMOUTREG( MGAREG_AR5, dev_priv->stride/2 );
-
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DWGCTL, MGA_COPY_CMD );
-
- for (i = 0 ; i < nbox; i++) {
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset);
+ PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess);
+ PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset);
+ PRIMOUTREG(MGAREG_AR5, dev_priv->stride / 2);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
+
+ for (i = 0; i < nbox; i++) {
unsigned int h = pbox[i].y2 - pbox[i].y1;
- unsigned int start = pbox[i].y1 * dev_priv->stride/2;
-
- DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n",
- pbox[i].x1, pbox[i].y1,
- pbox[i].x2, pbox[i].y2);
-
- PRIMOUTREG( MGAREG_AR0, start + pbox[i].x2 - 1 );
- PRIMOUTREG( MGAREG_AR3, start + pbox[i].x1 );
- PRIMOUTREG( MGAREG_FXBNDRY, pbox[i].x1|((pbox[i].x2 - 1)<<16) );
- PRIMOUTREG( MGAREG_YDSTLEN+MGAREG_MGA_EXEC, (pbox[i].y1<<16)|h );
+ unsigned int start = pbox[i].y1 * dev_priv->stride / 2;
+
+ DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n",
+ pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2);
+
+ PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1);
+ PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1);
+ PRIMOUTREG(MGAREG_FXBNDRY,
+ pbox[i].x1 | ((pbox[i].x2 - 1) << 16));
+ PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC,
+ (pbox[i].y1 << 16) | h);
}
- /* Force reset of DWGCTL */
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_DMAPAD, 0 );
- PRIMOUTREG( MGAREG_SRCORG, 0 );
- PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
+ /* Force reset of DWGCTL */
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_SRCORG, 0);
+ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
- PRIMADVANCE( dev_priv );
+ PRIMADVANCE(dev_priv);
}
int mga_clear_bufs(struct inode *inode, struct file *filp,
@@ -803,32 +791,32 @@ int mga_clear_bufs(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_mga_clear_t clear;
- copy_from_user_ret(&clear, (drm_mga_clear_t *)arg, sizeof(clear),
+ copy_from_user_ret(&clear, (drm_mga_clear_t *) arg, sizeof(clear),
-EFAULT);
DRM_DEBUG("%s\n", __FUNCTION__);
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_clear_bufs called without lock held\n");
return -EINVAL;
}
-
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
- sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
+
+ if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
/* Make sure we restore the 3D state next time.
*/
dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
- mga_dma_dispatch_clear( dev, clear.flags,
- clear.clear_color,
- clear.clear_depth );
- PRIMUPDATE(dev_priv);
+ mga_dma_dispatch_clear(dev, clear.flags,
+ clear.clear_color, clear.clear_depth);
+ PRIMUPDATE(dev_priv);
mga_flush_write_combine();
mga_dma_schedule(dev, 1);
- return 0;
+ return 0;
}
int mga_swap_bufs(struct inode *inode, struct file *filp,
@@ -836,76 +824,77 @@ int mga_swap_bufs(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_swap_bufs called without lock held\n");
return -EINVAL;
}
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
- sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
+ if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
/* Make sure we restore the 3D state next time.
*/
dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
- mga_dma_dispatch_swap( dev );
- PRIMUPDATE(dev_priv);
- set_bit(MGA_BUF_SWAP_PENDING, &dev_priv->current_prim->buffer_status);
+ mga_dma_dispatch_swap(dev);
+ PRIMUPDATE(dev_priv);
+ set_bit(MGA_BUF_SWAP_PENDING,
+ &dev_priv->current_prim->buffer_status);
mga_flush_write_combine();
mga_dma_schedule(dev, 1);
- return 0;
+ return 0;
}
int mga_iload(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+ unsigned int cmd, unsigned long arg)
{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
- drm_device_dma_t *dma = dev->dma;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- drm_buf_t *buf;
- drm_mga_buf_priv_t *buf_priv;
- drm_mga_iload_t iload;
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_buf_t *buf;
+ drm_mga_buf_priv_t *buf_priv;
+ drm_mga_iload_t iload;
unsigned long bus_address;
DRM_DEBUG("%s\n", __FUNCTION__);
-
- DRM_DEBUG("Starting Iload\n");
- copy_from_user_ret(&iload, (drm_mga_iload_t *)arg, sizeof(iload),
- -EFAULT);
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ DRM_DEBUG("Starting Iload\n");
+ copy_from_user_ret(&iload, (drm_mga_iload_t *) arg, sizeof(iload),
+ -EFAULT);
+
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_iload called without lock held\n");
return -EINVAL;
}
- buf = dma->buflist[ iload.idx ];
+ buf = dma->buflist[iload.idx];
buf_priv = buf->dev_private;
- bus_address = buf->bus_address;
- DRM_DEBUG("bus_address %lx, length %d, destorg : %x\n",
- bus_address, iload.length, iload.destOrg);
-
- if(mgaVerifyIload(dev_priv,
- bus_address,
- iload.destOrg,
- iload.length)) {
- mga_freelist_put(dev, buf);
- return -EINVAL;
+ bus_address = buf->bus_address;
+ DRM_DEBUG("bus_address %lx, length %d, destorg : %x\n",
+ bus_address, iload.length, iload.destOrg);
+
+ if (mgaVerifyIload(dev_priv,
+ bus_address, iload.destOrg, iload.length)) {
+ mga_freelist_put(dev, buf);
+ return -EINVAL;
}
-
- sarea_priv->dirty |= MGA_UPLOAD_CTX;
- mga_dma_dispatch_tex_blit(dev, bus_address, iload.length,
+ sarea_priv->dirty |= MGA_UPLOAD_CTX;
+
+ mga_dma_dispatch_tex_blit(dev, bus_address, iload.length,
iload.destOrg);
AGEBUF(dev_priv, buf_priv);
buf_priv->discard = 1;
- mga_freelist_put(dev, buf);
+ mga_freelist_put(dev, buf);
mga_flush_write_combine();
mga_dma_schedule(dev, 1);
- return 0;
+ return 0;
}
int mga_vertex(struct inode *inode, struct file *filp,
@@ -913,45 +902,47 @@ int mga_vertex(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+ drm_device_dma_t *dma = dev->dma;
drm_buf_t *buf;
- drm_mga_buf_priv_t *buf_priv;
+ drm_mga_buf_priv_t *buf_priv;
drm_mga_vertex_t vertex;
DRM_DEBUG("%s\n", __FUNCTION__);
- copy_from_user_ret(&vertex, (drm_mga_vertex_t *)arg, sizeof(vertex),
- -EFAULT);
-
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ copy_from_user_ret(&vertex, (drm_mga_vertex_t *) arg,
+ sizeof(vertex), -EFAULT);
+
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_vertex called without lock held\n");
return -EINVAL;
}
DRM_DEBUG("mga_vertex\n");
- buf = dma->buflist[ vertex.idx ];
- buf_priv = buf->dev_private;
+ buf = dma->buflist[vertex.idx];
+ buf_priv = buf->dev_private;
buf->used = vertex.used;
buf_priv->discard = vertex.discard;
-
+
if (!mgaVerifyState(dev_priv)) {
- if (vertex.discard) {
- if(buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv);
- buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
- }
- DRM_DEBUG("bad state\n");
- return -EINVAL;
+ if (vertex.discard) {
+ if (buf_priv->dispatched == 1)
+ AGEBUF(dev_priv, buf_priv);
+ buf_priv->dispatched = 0;
+ mga_freelist_put(dev, buf);
+ }
+ DRM_DEBUG("bad state\n");
+ return -EINVAL;
}
mga_dma_dispatch_vertex(dev, buf);
- PRIMUPDATE(dev_priv);
+ PRIMUPDATE(dev_priv);
mga_flush_write_combine();
mga_dma_schedule(dev, 1);
- return 0;
+ return 0;
}
@@ -960,48 +951,50 @@ int mga_indices(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+ drm_device_dma_t *dma = dev->dma;
drm_buf_t *buf;
- drm_mga_buf_priv_t *buf_priv;
+ drm_mga_buf_priv_t *buf_priv;
drm_mga_indices_t indices;
DRM_DEBUG("%s\n", __FUNCTION__);
- copy_from_user_ret(&indices, (drm_mga_indices_t *)arg, sizeof(indices),
- -EFAULT);
-
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ copy_from_user_ret(&indices, (drm_mga_indices_t *) arg,
+ sizeof(indices), -EFAULT);
+
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_indices called without lock held\n");
return -EINVAL;
}
DRM_DEBUG("mga_indices\n");
- buf = dma->buflist[ indices.idx ];
- buf_priv = buf->dev_private;
+ buf = dma->buflist[indices.idx];
+ buf_priv = buf->dev_private;
buf_priv->discard = indices.discard;
-
+
if (!mgaVerifyState(dev_priv)) {
- if (indices.discard) {
- if(buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv);
- buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
- }
- return -EINVAL;
+ if (indices.discard) {
+ if (buf_priv->dispatched == 1)
+ AGEBUF(dev_priv, buf_priv);
+ buf_priv->dispatched = 0;
+ mga_freelist_put(dev, buf);
+ }
+ return -EINVAL;
}
mga_dma_dispatch_indices(dev, buf, indices.start, indices.end);
- PRIMUPDATE(dev_priv);
+ PRIMUPDATE(dev_priv);
mga_flush_write_combine();
mga_dma_schedule(dev, 1);
- return 0;
+ return 0;
}
-static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d)
+static int mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d)
{
int i;
drm_buf_t *buf;
@@ -1009,16 +1002,13 @@ static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d)
for (i = d->granted_count; i < d->request_count; i++) {
buf = mga_freelist_get(dev);
- if (!buf) break;
+ if (!buf)
+ break;
buf->pid = current->pid;
copy_to_user_ret(&d->request_indices[i],
- &buf->idx,
- sizeof(buf->idx),
- -EFAULT);
+ &buf->idx, sizeof(buf->idx), -EFAULT);
copy_to_user_ret(&d->request_sizes[i],
- &buf->total,
- sizeof(buf->total),
- -EFAULT);
+ &buf->total, sizeof(buf->total), -EFAULT);
++d->granted_count;
}
return 0;
@@ -1027,18 +1017,18 @@ static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d)
int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
- drm_device_dma_t *dma = dev->dma;
- int retcode = 0;
- drm_dma_t d;
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ int retcode = 0;
+ drm_dma_t d;
DRM_DEBUG("%s\n", __FUNCTION__);
- copy_from_user_ret(&d, (drm_dma_t *)arg, sizeof(d), -EFAULT);
+ copy_from_user_ret(&d, (drm_dma_t *) arg, sizeof(d), -EFAULT);
DRM_DEBUG("%d %d: %d send, %d req\n",
current->pid, d.context, d.send_count, d.request_count);
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("mga_dma called without lock held\n");
return -EINVAL;
}
@@ -1046,19 +1036,21 @@ int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd,
/* Please don't send us buffers.
*/
if (d.send_count != 0) {
- DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
- current->pid, d.send_count);
+ DRM_ERROR
+ ("Process %d trying to send %d buffers via drmDMA\n",
+ current->pid, d.send_count);
return -EINVAL;
}
-
+
/* We'll send you buffers.
*/
if (d.request_count < 0 || d.request_count > dma->buf_count) {
- DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
- current->pid, d.request_count, dma->buf_count);
+ DRM_ERROR
+ ("Process %d trying to get %d buffers (of %d max)\n",
+ current->pid, d.request_count, dma->buf_count);
return -EINVAL;
}
-
+
d.granted_count = 0;
if (d.request_count) {
@@ -1067,6 +1059,6 @@ int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd,
DRM_DEBUG("%d returning, granted = %d\n",
current->pid, d.granted_count);
- copy_to_user_ret((drm_dma_t *)arg, &d, sizeof(d), -EFAULT);
+ copy_to_user_ret((drm_dma_t *) arg, &d, sizeof(d), -EFAULT);
return retcode;
}
diff --git a/linux/proc.c b/linux/proc.c
index 392abceb..ba6dee00 100644
--- a/linux/proc.c
+++ b/linux/proc.c
@@ -1,7 +1,8 @@
/* proc.c -- /proc support for DRM -*- linux-c -*-
* Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -22,9 +23,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.6 2000/02/23 04:47:30 martin Exp $
*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*/
#define __NO_VERSION__
diff --git a/linux/r128_dma.c b/linux/r128_dma.c
index 860c4188..dd416db1 100644
--- a/linux/r128_dma.c
+++ b/linux/r128_dma.c
@@ -10,11 +10,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,9 +22,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
+ *
* Authors: Kevin E. Martin <kevin@precisioninsight.com>
- *
+ *
* $XFree86$
*
*/
@@ -88,6 +88,20 @@ static void r128_flush_write_combine(void)
"pop %%eax" : /* no outputs */ : /* no inputs */ );
}
+static void r128_status(drm_device_t *dev)
+{
+ drm_r128_private_t *dev_priv = dev->dev_private;
+
+ printk("GUI_STAT = 0x%08x\n",
+ (unsigned int)R128_READ(R128_GUI_STAT));
+ printk("PM4_STAT = 0x%08x\n",
+ (unsigned int)R128_READ(R128_PM4_STAT));
+ printk("PM4_BUFFER_DL_WPTR = 0x%08x\n",
+ (unsigned int)R128_READ(R128_PM4_BUFFER_DL_WPTR));
+ printk("PM4_BUFFER_DL_RPTR = 0x%08x\n",
+ (unsigned int)R128_READ(R128_PM4_BUFFER_DL_RPTR));
+}
+
static int r128_do_cleanup_cce(drm_device_t *dev)
{
if (dev->dev_private) {
@@ -828,6 +842,7 @@ static drm_buf_t *r128_freelist_get(drm_device_t *dev)
udelay(1);
}
+ r128_status(dev);
return NULL;
}
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index 45ade1de..e5a85af9 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -10,11 +10,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,10 +22,10 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
+ *
* Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
* Kevin E. Martin <kevin@precisioninsight.com>
- *
+ *
* $XFree86$
*
*/
@@ -38,10 +38,10 @@ EXPORT_SYMBOL(r128_cleanup);
#define R128_NAME "r128"
#define R128_DESC "r128"
-#define R128_DATE "20000422"
-#define R128_MAJOR 0
+#define R128_DATE "20000607"
+#define R128_MAJOR 1
#define R128_MINOR 0
-#define R128_PATCHLEVEL 5
+#define R128_PATCHLEVEL 0
static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
@@ -108,7 +108,7 @@ static drm_ioctl_desc_t r128_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_eng_reset, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_FLUSH)] = { r128_eng_flush, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_submit_pkt, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCEIDL)] = { r128_cce_idle, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_IDLE)] = { r128_cce_idle, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_vertex_buf, 1, 0 },
};
#define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls)
@@ -144,7 +144,7 @@ void cleanup_module(void)
*
* This is not currently supported, since it requires changes to
* linux/init/main.c. */
-
+
void __init r128_setup(char *str, int *ints)
{
@@ -159,7 +159,7 @@ void __init r128_setup(char *str, int *ints)
static int r128_setup(drm_device_t *dev)
{
int i;
-
+
atomic_set(&dev->ioctl_count, 0);
atomic_set(&dev->vma_count, 0);
dev->buf_use = 0;
@@ -202,7 +202,7 @@ static int r128_setup(drm_device_t *dev)
dev->ctx_start = 0;
dev->lck_start = 0;
-
+
dev->buf_rp = dev->buf;
dev->buf_wp = dev->buf;
dev->buf_end = dev->buf + DRM_BSZ;
@@ -211,15 +211,15 @@ static int r128_setup(drm_device_t *dev)
init_waitqueue_head(&dev->buf_writers);
r128_res_ctx.handle=-1;
-
+
DRM_DEBUG("\n");
-
+
/* The kernel's context could be created here, but is now created
in drm_dma_enqueue. This is more resource-efficient for
hardware that does not do DMA, but may mean that
drm_select_queue fails between the time the interrupt is
initialized and the time the queues are initialized. */
-
+
return 0;
}
@@ -235,12 +235,12 @@ static int r128_takedown(drm_device_t *dev)
down(&dev->struct_sem);
del_timer(&dev->timer);
-
+
if (dev->devname) {
drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
dev->devname = NULL;
}
-
+
if (dev->unique) {
drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
dev->unique = NULL;
@@ -260,7 +260,7 @@ static int r128_takedown(drm_device_t *dev)
if (dev->agp) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
-
+
/* Remove AGP resources, but leave dev->agp
intact until r128_cleanup is called. */
for (entry = dev->agp->memory; entry; entry = nexte) {
@@ -270,15 +270,15 @@ static int r128_takedown(drm_device_t *dev)
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
}
dev->agp->memory = NULL;
-
+
if (dev->agp->acquired && drm_agp.release)
(*drm_agp.release)();
-
+
dev->agp->acquired = 0;
dev->agp->enabled = 0;
}
#endif
-
+
/* Clear vma list (only built for debugging) */
if (dev->vmalist) {
for (vma = dev->vmalist; vma; vma = vma_next) {
@@ -287,7 +287,7 @@ static int r128_takedown(drm_device_t *dev)
}
dev->vmalist = NULL;
}
-
+
/* Clear map area and mtrr information */
if (dev->maplist) {
for (i = 0; i < dev->map_count; i++) {
@@ -325,7 +325,7 @@ static int r128_takedown(drm_device_t *dev)
dev->maplist = NULL;
dev->map_count = 0;
}
-
+
drm_dma_takedown(dev);
dev->queue_count = 0;
@@ -335,7 +335,7 @@ static int r128_takedown(drm_device_t *dev)
wake_up_interruptible(&dev->lock.lock_queue);
}
up(&dev->struct_sem);
-
+
return 0;
}
@@ -352,7 +352,7 @@ int r128_init(void)
memset((void *)dev, 0, sizeof(*dev));
dev->count_lock = SPIN_LOCK_UNLOCKED;
sema_init(&dev->struct_sem, 1);
-
+
#ifdef MODULE
drm_parse_options(r128);
#endif
@@ -404,7 +404,7 @@ void r128_cleanup(void)
drm_device_t *dev = &r128_device;
DRM_DEBUG("\n");
-
+
drm_proc_cleanup();
if (misc_deregister(&r128_misc)) {
DRM_ERROR("Cannot unload module\n");
@@ -460,7 +460,7 @@ int r128_open(struct inode *inode, struct file *filp)
{
drm_device_t *dev = &r128_device;
int retcode = 0;
-
+
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
MOD_INC_USE_COUNT;
@@ -517,7 +517,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->ioctl_count);
atomic_inc(&dev->total_ioctl);
++priv->ioctl_count;
-
+
DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
current->pid, cmd, nr, dev->device, priv->authenticated);
@@ -537,7 +537,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
retcode = (func)(inode, filp, cmd, arg);
}
}
-
+
atomic_dec(&dev->ioctl_count);
return retcode;
}
@@ -574,7 +574,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
if (lock.context < 0 || lock.context >= dev->queue_count)
return -EINVAL;
#endif
-
+
if (!ret) {
#if 0
if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
@@ -586,7 +586,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
/* Can't take lock if we just had it and
there is contention. */
DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n",
- lock.context, current->pid, j,
+ lock.context, current->pid, j,
dev->lock.lock_time, jiffies);
current->state = TASK_INTERRUPTIBLE;
current->policy |= SCHED_YIELD;
@@ -609,7 +609,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->total_locks);
break; /* Got lock */
}
-
+
/* Contention */
atomic_inc(&dev->total_sleeps);
current->state = TASK_INTERRUPTIBLE;
@@ -665,7 +665,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
}
#if 0
- DRM_ERROR("pid = %5d, old counter = %5ld\n",
+ DRM_ERROR("pid = %5d, old counter = %5ld\n",
current->pid, current->counter);
#endif
if (lock.context != r128_res_ctx.handle) {
@@ -683,7 +683,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
#if DRM_DMA_HISTOGRAM
atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
#endif
-
+
return ret;
}
@@ -696,7 +696,7 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
drm_lock_t lock;
copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
-
+
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock.context);
@@ -732,6 +732,6 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(10);
#endif
-
+
return 0;
}
diff --git a/linux/tdfx_context.c b/linux/tdfx_context.c
index 74b107bd..c8d6e50e 100644
--- a/linux/tdfx_context.c
+++ b/linux/tdfx_context.c
@@ -1,8 +1,8 @@
/* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*-
* Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com
- * Revised: Sat Oct 9 23:39:56 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,10 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c,v 1.2 2000/02/23 04:47:30 martin Exp $
- *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Daryll Strauss <daryll@valinux.com>
+ *
*/
#include <linux/sched.h>
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index fb7a997b..d8fef953 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -1,8 +1,8 @@
/* tdfx.c -- tdfx driver -*- linux-c -*-
* Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:35 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,7 +24,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c,v 1.3 2000/02/23 04:47:31 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Daryll Strauss <daryll@valinux.com>
*
*/
@@ -37,9 +39,9 @@ EXPORT_SYMBOL(tdfx_cleanup);
#define TDFX_NAME "tdfx"
#define TDFX_DESC "tdfx"
#define TDFX_DATE "19991009"
-#define TDFX_MAJOR 0
+#define TDFX_MAJOR 1
#define TDFX_MINOR 0
-#define TDFX_PATCHLEVEL 1
+#define TDFX_PATCHLEVEL 0
static drm_device_t tdfx_device;
drm_ctx_t tdfx_res_ctx;
diff --git a/linux/tdfx_drv.h b/linux/tdfx_drv.h
index 3866010a..6b1c208e 100644
--- a/linux/tdfx_drv.h
+++ b/linux/tdfx_drv.h
@@ -1,8 +1,8 @@
/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*-
* Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com
- * Revised: Sat Oct 9 23:38:19 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,7 +24,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h,v 1.2 2000/02/23 04:47:31 martin Exp $
*
*/
diff --git a/linux/vm.c b/linux/vm.c
index 9c2cea56..0b2b00e0 100644
--- a/linux/vm.c
+++ b/linux/vm.c
@@ -1,7 +1,8 @@
/* vm.c -- Memory mapping for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -23,7 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.5 2000/02/23 04:47:31 martin Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/shared-core/drm.h b/shared-core/drm.h
index b2e2a0ac..56ef48d2 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -1,7 +1,8 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -10,11 +11,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,8 +23,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.5 2000/02/23 04:47:26 martin Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
@@ -60,7 +62,7 @@ typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
typedef unsigned int drm_magic_t;
-/* Warning: If you change this structure, make sure you change
+/* Warning: If you change this structure, make sure you change
* XF86DRIClipRectRec in the server as well */
typedef struct drm_clip_rect {
@@ -356,7 +358,7 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t)
#define DRM_IOCTL_R128_RESET DRM_IO( 0x41)
#define DRM_IOCTL_R128_FLUSH DRM_IO( 0x42)
-#define DRM_IOCTL_R128_CCEIDL DRM_IO( 0x43)
+#define DRM_IOCTL_R128_IDLE DRM_IO( 0x43)
#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t)
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t)
diff --git a/shared/drm.h b/shared/drm.h
index b2e2a0ac..56ef48d2 100644
--- a/shared/drm.h
+++ b/shared/drm.h
@@ -1,7 +1,8 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * 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
@@ -10,11 +11,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,8 +23,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.5 2000/02/23 04:47:26 martin Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
@@ -60,7 +62,7 @@ typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
typedef unsigned int drm_magic_t;
-/* Warning: If you change this structure, make sure you change
+/* Warning: If you change this structure, make sure you change
* XF86DRIClipRectRec in the server as well */
typedef struct drm_clip_rect {
@@ -356,7 +358,7 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t)
#define DRM_IOCTL_R128_RESET DRM_IO( 0x41)
#define DRM_IOCTL_R128_FLUSH DRM_IO( 0x42)
-#define DRM_IOCTL_R128_CCEIDL DRM_IO( 0x43)
+#define DRM_IOCTL_R128_IDLE DRM_IO( 0x43)
#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t)
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t)
diff --git a/tests/drmstat.c b/tests/drmstat.c
index a96a38b2..8c691c49 100644
--- a/tests/drmstat.c
+++ b/tests/drmstat.c
@@ -1,8 +1,8 @@
/* drmstat.c -- DRM device status and testing program
* Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com
- * Revised: Sun Feb 13 23:35:00 2000 by kevin@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,7 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c,v 1.6 2000/02/23 04:47:27 martin Exp $
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
*/