summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Dawes <dawes@xfree86.org>2001-04-09 21:56:31 +0000
committerDavid Dawes <dawes@xfree86.org>2001-04-09 21:56:31 +0000
commit18fc5ee92394b31c00df8e72b1f29bada79292f5 (patch)
tree6c3bebbd78b4e493fc5fcb02aefdb88ea695922d
parent1759c16ab9b64598968a0058039e8a66bf5f9773 (diff)
First pass of XFree86 4.0.99.2 merge.X_4_0_99_2-20010410-merge
-rw-r--r--bsd-core/drmP.h32
-rw-r--r--bsd/drm/proc.c8
-rw-r--r--bsd/drm/sysctl.c56
-rw-r--r--bsd/drmP.h32
-rw-r--r--libdrm/xf86drm.c13
-rw-r--r--libdrm/xf86drmHash.c2
6 files changed, 88 insertions, 55 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index b62aff08..7a1159c7 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.1 2000/06/17 00:03:28 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.3 2001/03/06 16:45:26 dawes Exp $
*
*/
@@ -49,11 +49,11 @@
#include <sys/sysctl.h>
#include <sys/select.h>
#include <sys/bus.h>
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
#include <sys/taskqueue.h>
#endif
-#if __FreeBSD_version >= 500006
+#if __FreeBSD_version >= 400006
#define DRM_AGP
#endif
@@ -73,6 +73,11 @@ typedef u_int32_t spinlock_t;
#define atomic_add(n, p) atomic_add_int(p, n)
#define atomic_sub(n, p) atomic_subtract_int(p, n)
+/* The version number here is a guess */
+#if __FreeBSD_version >= 500010
+#define callout_init(a) callout_init(a, 0)
+#endif
+
/* Fake this */
static __inline u_int32_t
test_and_set_bit(int b, volatile u_int32_t *p)
@@ -128,14 +133,14 @@ find_first_zero_bit(volatile u_int32_t *p, int max)
* Fake out the module macros for versions of FreeBSD where they don't
* exist.
*/
-#if __FreeBSD_version < 500002
+#if __FreeBSD_version < 400002
#define MODULE_VERSION(a,b) struct __hack
#define MODULE_DEPEND(a,b,c,d,e) struct __hack
#endif
-#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
+#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
also include looping detection. */
#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
@@ -340,6 +345,7 @@ typedef struct drm_freelist {
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
atomic_t wfh; /* If waiting for high mark */
+ struct simplelock lock; /* hope this doesn't need to be linux compatible */
} drm_freelist_t;
typedef struct drm_buf_entry {
@@ -509,15 +515,15 @@ typedef struct drm_device {
/* Context support */
struct resource *irq; /* Interrupt used by board */
void *irqh; /* Handle from bus_setup_intr */
- __volatile__ int context_flag; /* Context swapping flag */
- __volatile__ int interrupt_flag;/* Interruption handler flag */
- __volatile__ int dma_flag; /* DMA dispatch flag */
+ __volatile__ long context_flag; /* Context swapping flag */
+ __volatile__ long interrupt_flag;/* Interruption handler flag */
+ __volatile__ long dma_flag; /* DMA dispatch flag */
struct callout timer; /* Timer for delaying ctx switch */
int context_wait; /* Processes waiting on ctx switch */
int last_checked; /* Last context checked for DMA */
int last_context; /* Last current context */
int last_switch; /* Time at last context switch */
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
struct task task;
#endif
struct timespec ctx_start;
@@ -594,7 +600,13 @@ extern int drm_sysctl_cleanup(drm_device_t *dev);
/* Memory management support (memory.c) */
extern void drm_mem_init(void);
-extern int drm_mem_info SYSCTL_HANDLER_ARGS;
+
+#if __FreeBSD_version < 411000
+#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
+#else
+#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
+#endif
+extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS;
extern void *drm_alloc(size_t size, int area);
extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area);
diff --git a/bsd/drm/proc.c b/bsd/drm/proc.c
index 3f6616ef..6ca3fabc 100644
--- a/bsd/drm/proc.c
+++ b/bsd/drm/proc.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.1 2000/06/17 00:03:30 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.2 2001/03/02 02:45:38 dawes Exp $
*
*/
@@ -165,7 +165,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len,
{
drm_device_t *dev = (drm_device_t *)data;
drm_map_t *map;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP" };
const char *type;
int i;
@@ -176,7 +176,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len,
"address mtrr\n\n");
for (i = 0; i < dev->map_count; i++) {
map = dev->maplist[i];
- if (map->type < 0 || map->type > 2) type = "??";
+ if (map->type < 0 || map->type > 3) type = "??";
else type = types[map->type];
DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
@@ -226,7 +226,7 @@ static int _drm_queues_info(char *buf, char **start, off_t offset, int len,
atomic_inc(&q->use_count);
DRM_PROC_PRINT_RET(atomic_dec(&q->use_count),
"%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
+ " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n",
i,
q->flags,
atomic_read(&q->use_count),
diff --git a/bsd/drm/sysctl.c b/bsd/drm/sysctl.c
index a890abac..0bc04d22 100644
--- a/bsd/drm/sysctl.c
+++ b/bsd/drm/sysctl.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI$
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.1 2000/06/17 00:03:31 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.2 2001/03/02 02:45:38 dawes Exp $
*
*/
@@ -35,21 +35,21 @@
SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics");
-static int drm_name_info SYSCTL_HANDLER_ARGS;
-static int drm_vm_info SYSCTL_HANDLER_ARGS;
-static int drm_clients_info SYSCTL_HANDLER_ARGS;
-static int drm_queues_info SYSCTL_HANDLER_ARGS;
-static int drm_bufs_info SYSCTL_HANDLER_ARGS;
+static int drm_name_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS;
#if DRM_DEBUG_CODExx
-static int drm_vma_info SYSCTL_HANDLER_ARGS;
+static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS;
#endif
#if DRM_DMA_HISTOGRAM
-static int drm_histo_info SYSCTL_HANDLER_ARGS;
+static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS;
#endif
struct drm_sysctl_list {
const char *name;
- int (*f) SYSCTL_HANDLER_ARGS;
+ int (*f) DRM_SYSCTL_HANDLER_ARGS;
} drm_sysctl_list[] = {
{ "name", drm_name_info },
{ "mem", drm_mem_info },
@@ -137,7 +137,7 @@ int drm_sysctl_cleanup(drm_device_t *dev)
return 0;
}
-static int drm_name_info SYSCTL_HANDLER_ARGS
+static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
char buf[128];
@@ -155,11 +155,11 @@ static int drm_name_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int _drm_vm_info SYSCTL_HANDLER_ARGS
+static int _drm_vm_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_map_t *map;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP" };
const char *type;
int i;
char buf[128];
@@ -172,7 +172,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS
for (i = 0; i < dev->map_count; i++) {
map = dev->maplist[i];
- if (map->type < 0 || map->type > 2) type = "??";
+ if (map->type < 0 || map->type > 3) type = "??";
else type = types[map->type];
DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
@@ -192,7 +192,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_vm_info SYSCTL_HANDLER_ARGS
+static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -205,7 +205,7 @@ static int drm_vm_info SYSCTL_HANDLER_ARGS
}
-static int _drm_queues_info SYSCTL_HANDLER_ARGS
+static int _drm_queues_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int i;
@@ -221,7 +221,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS
atomic_inc(&q->use_count);
DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count),
"%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
+ " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n",
i,
q->flags,
atomic_read(&q->use_count),
@@ -243,7 +243,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_queues_info SYSCTL_HANDLER_ARGS
+static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -257,7 +257,7 @@ static int drm_queues_info SYSCTL_HANDLER_ARGS
/* drm_bufs_info is called whenever a process reads
hw.dri.0.bufs. */
-static int _drm_bufs_info SYSCTL_HANDLER_ARGS
+static int _drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_device_dma_t *dma = dev->dma;
@@ -293,7 +293,7 @@ static int _drm_bufs_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_bufs_info SYSCTL_HANDLER_ARGS
+static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -305,7 +305,7 @@ static int drm_bufs_info SYSCTL_HANDLER_ARGS
}
-static int _drm_clients_info SYSCTL_HANDLER_ARGS
+static int _drm_clients_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_file_t *priv;
@@ -327,7 +327,7 @@ static int _drm_clients_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_clients_info SYSCTL_HANDLER_ARGS
+static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -340,7 +340,7 @@ static int drm_clients_info SYSCTL_HANDLER_ARGS
#if DRM_DEBUG_CODExx
-static int _drm_vma_info SYSCTL_HANDLER_ARGS
+static int _drm_vma_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_vma_entry_t *pt;
@@ -412,7 +412,7 @@ static int _drm_vma_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_vma_info SYSCTL_HANDLER_ARGS
+static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -426,7 +426,7 @@ static int drm_vma_info SYSCTL_HANDLER_ARGS
#if DRM_DMA_HISTOGRAM
-static int _drm_histo_info SYSCTL_HANDLER_ARGS
+static int _drm_histo_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_device_dma_t *dma = dev->dma;
@@ -498,9 +498,9 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS
} else {
DRM_SYSCTL_PRINT("lock none\n");
}
- DRM_SYSCTL_PRINT("context_flag 0x%08x\n", dev->context_flag);
- DRM_SYSCTL_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag);
- DRM_SYSCTL_PRINT("dma_flag 0x%08x\n", dev->dma_flag);
+ DRM_SYSCTL_PRINT("context_flag 0x%08lx\n", dev->context_flag);
+ DRM_SYSCTL_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag);
+ DRM_SYSCTL_PRINT("dma_flag 0x%08lx\n", dev->dma_flag);
DRM_SYSCTL_PRINT("queue_count %10d\n", dev->queue_count);
DRM_SYSCTL_PRINT("last_context %10d\n", dev->last_context);
@@ -541,7 +541,7 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_histo_info SYSCTL_HANDLER_ARGS
+static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
diff --git a/bsd/drmP.h b/bsd/drmP.h
index b62aff08..7a1159c7 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.1 2000/06/17 00:03:28 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.3 2001/03/06 16:45:26 dawes Exp $
*
*/
@@ -49,11 +49,11 @@
#include <sys/sysctl.h>
#include <sys/select.h>
#include <sys/bus.h>
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
#include <sys/taskqueue.h>
#endif
-#if __FreeBSD_version >= 500006
+#if __FreeBSD_version >= 400006
#define DRM_AGP
#endif
@@ -73,6 +73,11 @@ typedef u_int32_t spinlock_t;
#define atomic_add(n, p) atomic_add_int(p, n)
#define atomic_sub(n, p) atomic_subtract_int(p, n)
+/* The version number here is a guess */
+#if __FreeBSD_version >= 500010
+#define callout_init(a) callout_init(a, 0)
+#endif
+
/* Fake this */
static __inline u_int32_t
test_and_set_bit(int b, volatile u_int32_t *p)
@@ -128,14 +133,14 @@ find_first_zero_bit(volatile u_int32_t *p, int max)
* Fake out the module macros for versions of FreeBSD where they don't
* exist.
*/
-#if __FreeBSD_version < 500002
+#if __FreeBSD_version < 400002
#define MODULE_VERSION(a,b) struct __hack
#define MODULE_DEPEND(a,b,c,d,e) struct __hack
#endif
-#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
+#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
also include looping detection. */
#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
@@ -340,6 +345,7 @@ typedef struct drm_freelist {
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
atomic_t wfh; /* If waiting for high mark */
+ struct simplelock lock; /* hope this doesn't need to be linux compatible */
} drm_freelist_t;
typedef struct drm_buf_entry {
@@ -509,15 +515,15 @@ typedef struct drm_device {
/* Context support */
struct resource *irq; /* Interrupt used by board */
void *irqh; /* Handle from bus_setup_intr */
- __volatile__ int context_flag; /* Context swapping flag */
- __volatile__ int interrupt_flag;/* Interruption handler flag */
- __volatile__ int dma_flag; /* DMA dispatch flag */
+ __volatile__ long context_flag; /* Context swapping flag */
+ __volatile__ long interrupt_flag;/* Interruption handler flag */
+ __volatile__ long dma_flag; /* DMA dispatch flag */
struct callout timer; /* Timer for delaying ctx switch */
int context_wait; /* Processes waiting on ctx switch */
int last_checked; /* Last context checked for DMA */
int last_context; /* Last current context */
int last_switch; /* Time at last context switch */
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
struct task task;
#endif
struct timespec ctx_start;
@@ -594,7 +600,13 @@ extern int drm_sysctl_cleanup(drm_device_t *dev);
/* Memory management support (memory.c) */
extern void drm_mem_init(void);
-extern int drm_mem_info SYSCTL_HANDLER_ARGS;
+
+#if __FreeBSD_version < 411000
+#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
+#else
+#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
+#endif
+extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS;
extern void *drm_alloc(size_t size, int area);
extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area);
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index bb719edb..33d387e9 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -27,7 +27,7 @@
* 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.17 2000/09/24 13:51:32 alanh Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.18 2001/03/21 18:08:54 dawes Exp $
*
*/
@@ -164,7 +164,11 @@ static drmHashEntry *drmGetEntry(int fd)
static int drmOpenDevice(long dev, int minor)
{
- stat_t st;
+#ifdef XFree86LOADER
+ struct xf86stat st;
+#else
+ struct stat st;
+#endif
char buf[64];
int fd;
mode_t dirmode = DRM_DEV_DIRMODE;
@@ -485,6 +489,11 @@ int drmAddMap(int fd,
drm_map_t map;
map.offset = offset;
+#ifdef __alpha__
+ /* Make sure we add the bus_base to all but shm */
+ if (type != DRM_SHM)
+ map.offset += BUS_BASE;
+#endif
map.size = size;
map.handle = 0;
map.type = type;
diff --git a/libdrm/xf86drmHash.c b/libdrm/xf86drmHash.c
index 70240b95..1f1a05b3 100644
--- a/libdrm/xf86drmHash.c
+++ b/libdrm/xf86drmHash.c
@@ -25,7 +25,7 @@
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $
*
* DESCRIPTION
*