Re: [PATCH] 2.2.18pre21: DRM update

2000-11-24 Thread Ed Tomlinson

Alan Cox wrote:

> I'll look over it. It may be worth doing the fixing for 2.2.18, since
> 2.2.17 doesnt have DRM anyway. As posted it doesnt build against vanilla
> 2.2.18pre but I can see why so not a problem

This patch enables a G400 to use DRI using debian woody.  Without this its 
2.4 time.  (BTW 2.4.0test11-ac3 BUG()ed out at sched.c:513 when playing the 
the matrox fb stuff).

Ed Tomlinson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] 2.2.18pre21: DRM update

2000-11-24 Thread Ed Tomlinson

Alan Cox wrote:

 I'll look over it. It may be worth doing the fixing for 2.2.18, since
 2.2.17 doesnt have DRM anyway. As posted it doesnt build against vanilla
 2.2.18pre but I can see why so not a problem

This patch enables a G400 to use DRI using debian woody.  Without this its 
2.4 time.  (BTW 2.4.0test11-ac3 BUG()ed out at sched.c:513 when playing the 
the matrox fb stuff).

Ed Tomlinson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] 2.2.18pre21: DRM update

2000-11-20 Thread Peter Samuelson


[Chip Salzenberg]
> --- drivers/char/Makefile.prev
> +++ drivers/char/Makefile Fri Nov 17 13:30:04 2000
> @@ -12,5 +12,5 @@
>  SUB_DIRS := 
>  MOD_SUB_DIRS := $(SUB_DIRS)
> -ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick drm agp
> +ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick
>  
>  #
> @@ -395,4 +395,16 @@
>  endif
>  
> +ifeq ($(CONFIG_DRM),y)
> +O_OBJS += drm/drm.o
> +ALL_SUB_DIRS += drm
> +MOD_SUB_DIRS += drm

The bits about ALL_SUB_DIRS are trivially wrong.  You should define it
unconditionally -- that way the user doesn't have to 'make dep' after
every 'make *config'.

Not a very important point, granted.


>  #ifndef __HAVE_ARCH_CMPXCHG
>   /* Include this here so that driver can be
> used with older kernels. */
> +#if defined(__alpha__)

This section ought to be in include/asm-{alpha,i386}/system.h like in
2.4 (and like sparc64 in 2.2).  Then again, perhaps in 2.2 it is best
to let sleeping dogs lie.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] 2.2.18pre21: DRM update

2000-11-20 Thread Peter Samuelson


[Chip Salzenberg]
 --- drivers/char/Makefile.prev
 +++ drivers/char/Makefile Fri Nov 17 13:30:04 2000
 @@ -12,5 +12,5 @@
  SUB_DIRS := 
  MOD_SUB_DIRS := $(SUB_DIRS)
 -ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick drm agp
 +ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick
  
  #
 @@ -395,4 +395,16 @@
  endif
  
 +ifeq ($(CONFIG_DRM),y)
 +O_OBJS += drm/drm.o
 +ALL_SUB_DIRS += drm
 +MOD_SUB_DIRS += drm

The bits about ALL_SUB_DIRS are trivially wrong.  You should define it
unconditionally -- that way the user doesn't have to 'make dep' after
every 'make *config'.

Not a very important point, granted.


  #ifndef __HAVE_ARCH_CMPXCHG
   /* Include this here so that driver can be
 used with older kernels. */
 +#if defined(__alpha__)

This section ought to be in include/asm-{alpha,i386}/system.h like in
2.4 (and like sparc64 in 2.2).  Then again, perhaps in 2.2 it is best
to let sleeping dogs lie.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] 2.2.18pre21: DRM update

2000-11-18 Thread Alan Cox

I'll look over it. It may be worth doing the fixing for 2.2.18, since 2.2.17
doesnt have DRM anyway. As posted it doesnt build against vanilla 2.2.18pre but
I can see why so not a problem

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] 2.2.18pre21: DRM update

2000-11-18 Thread Alan Cox

I'll look over it. It may be worth doing the fixing for 2.2.18, since 2.2.17
doesnt have DRM anyway. As posted it doesnt build against vanilla 2.2.18pre but
I can see why so not a problem

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[PATCH] 2.2.18pre21: DRM update

2000-11-17 Thread Chip Salzenberg

This is an update from the main DRM tree, but with cosmetic changes
removed and only meat left.  This patch is already in VA's shipping
kernel, so you know we really trust it.  :-,

BTW, this patch is not fluff: It includes bug fixes.  But it's pretty
big, so if you want to wait until 2.2.19 I'll understand

Index: drivers/char/Makefile
--- drivers/char/Makefile.prev
+++ drivers/char/Makefile   Fri Nov 17 13:30:04 2000
@@ -12,5 +12,5 @@
 SUB_DIRS := 
 MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick drm agp
+ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick
 
 #
@@ -395,4 +395,16 @@
 endif
 
+ifeq ($(CONFIG_DRM),y)
+O_OBJS += drm/drm.o
+ALL_SUB_DIRS += drm
+MOD_SUB_DIRS += drm
+SUB_DIRS += drm
+else
+  ifeq ($(CONFIG_DRM),m)
+  ALL_SUB_DIRS += drm
+  MOD_SUB_DIRS += drm
+  endif
+endif
+
 ifeq ($(CONFIG_INTEL_RNG),y)
 O_OBJS += i810_rng.o
@@ -650,16 +662,4 @@
 OX_OBJS += h8.o
 endif
-
-
-ifeq ($(CONFIG_DRM),y)
-SUB_DIRS += drm
-O_OBJS += drm/drm.o
-MOD_SUB_DIRS += drm
-else
-  ifeq ($(CONFIG_DRM),m)
-  MOD_SUB_DIRS += drm
-  endif
-endif
-
 
 ifeq ($(L_I2C),y)

Index: drivers/char/drm/drmP.h
--- drivers/char/drm/drmP.h.prev
+++ drivers/char/drm/drmP.h Fri Nov 17 13:30:04 2000
@@ -34,4 +34,9 @@
 
 #ifdef __KERNEL__
+#ifdef __alpha__
+/* add include of current.h so that "current" is defined
+ * before static inline funcs in wait.h. 4/21/2000 S + B */
+#include 
+#endif /* __alpha__ */
 #include 
 #include 
@@ -47,8 +52,11 @@
 #include 
 #include /* For (un)lock_kernel */
+#include 
+#ifdef __alpha__
+#include  /* For pte_wrprotect */
+#endif
 #include 
 #include 
 #include 
-#include 
 #ifdef CONFIG_MTRR
 #include 
@@ -133,8 +141,86 @@
 #endif
 
+   /* module_init/module_exit added in 2.3.13 */
+#ifndef module_init
+#define module_init(x)  int init_module(void) { return x(); }
+#endif
+#ifndef module_exit
+#define module_exit(x)  void cleanup_module(void) { x(); }
+#endif
+
+   /* virt_to_page added in 2.4.0-test6 */
+#if LINUX_VERSION_CODE < 0x020400
+#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
+#endif
+
/* Generic cmpxchg added in 2.3.x */
 #ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
used with older kernels. */
+#if defined(__alpha__)
+static __inline__ unsigned long
+__cmpxchg_u32(volatile int *m, int old, int new)
+{
+   unsigned long prev, cmp;
+
+   __asm__ __volatile__(
+   "1: ldl_l %0,%2\n"
+   "   cmpeq %0,%3,%1\n"
+   "   beq %1,2f\n"
+   "   mov %4,%1\n"
+   "   stl_c %1,%2\n"
+   "   beq %1,3f\n"
+   "2: mb\n"
+   ".subsection 2\n"
+   "3: br 1b\n"
+   ".previous"
+   : "="(prev), "="(cmp), "=m"(*m)
+   : "r"((long) old), "r"(new), "m"(*m));
+
+   return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+{
+   unsigned long prev, cmp;
+
+   __asm__ __volatile__(
+   "1: ldq_l %0,%2\n"
+   "   cmpeq %0,%3,%1\n"
+   "   beq %1,2f\n"
+   "   mov %4,%1\n"
+   "   stq_c %1,%2\n"
+   "   beq %1,3f\n"
+   "2: mb\n"
+   ".subsection 2\n"
+   "3: br 1b\n"
+   ".previous"
+   : "="(prev), "="(cmp), "=m"(*m)
+   : "r"((long) old), "r"(new), "m"(*m));
+
+   return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+   switch (size) {
+   case 4:
+   return __cmpxchg_u32(ptr, old, new);
+   case 8:
+   return __cmpxchg_u64(ptr, old, new);
+   }
+   return old;
+}
+#define cmpxchg(ptr,o,n)\
+  ({\
+ __typeof__(*(ptr)) _o_ = (o);  \
+ __typeof__(*(ptr)) _n_ = (n);  \
+ (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,  \
+   (unsigned long)_n_, sizeof(*(ptr))); \
+  })
+
+#elif __i386__
 static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
  unsigned long new, int size)
@@ -167,4 +253,5 @@
   ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
 (unsigned long)(n),sizeof(*(ptr
+#endif /* i386 & alpha */
 #endif
 
@@ -316,4 +403,5 @@
int   high_mark;   /* High water mark  */
atomic_t  wfh; /* If waiting for high mark */
+   spinlock_tlock;
 } drm_freelist_t;
 
@@ -344,4 +432,5 @@
struct drm_file   *prev;
struct drm_device *dev;
+   

[PATCH] 2.2.18pre21: DRM update

2000-11-17 Thread Chip Salzenberg

This is an update from the main DRM tree, but with cosmetic changes
removed and only meat left.  This patch is already in VA's shipping
kernel, so you know we really trust it.  :-,

BTW, this patch is not fluff: It includes bug fixes.  But it's pretty
big, so if you want to wait until 2.2.19 I'll understand

Index: drivers/char/Makefile
--- drivers/char/Makefile.prev
+++ drivers/char/Makefile   Fri Nov 17 13:30:04 2000
@@ -12,5 +12,5 @@
 SUB_DIRS := 
 MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick drm agp
+ALL_SUB_DIRS := $(SUB_DIRS) rio ftape joystick
 
 #
@@ -395,4 +395,16 @@
 endif
 
+ifeq ($(CONFIG_DRM),y)
+O_OBJS += drm/drm.o
+ALL_SUB_DIRS += drm
+MOD_SUB_DIRS += drm
+SUB_DIRS += drm
+else
+  ifeq ($(CONFIG_DRM),m)
+  ALL_SUB_DIRS += drm
+  MOD_SUB_DIRS += drm
+  endif
+endif
+
 ifeq ($(CONFIG_INTEL_RNG),y)
 O_OBJS += i810_rng.o
@@ -650,16 +662,4 @@
 OX_OBJS += h8.o
 endif
-
-
-ifeq ($(CONFIG_DRM),y)
-SUB_DIRS += drm
-O_OBJS += drm/drm.o
-MOD_SUB_DIRS += drm
-else
-  ifeq ($(CONFIG_DRM),m)
-  MOD_SUB_DIRS += drm
-  endif
-endif
-
 
 ifeq ($(L_I2C),y)

Index: drivers/char/drm/drmP.h
--- drivers/char/drm/drmP.h.prev
+++ drivers/char/drm/drmP.h Fri Nov 17 13:30:04 2000
@@ -34,4 +34,9 @@
 
 #ifdef __KERNEL__
+#ifdef __alpha__
+/* add include of current.h so that "current" is defined
+ * before static inline funcs in wait.h. 4/21/2000 S + B */
+#include asm/current.h
+#endif /* __alpha__ */
 #include linux/config.h
 #include linux/module.h
@@ -47,8 +52,11 @@
 #include linux/sched.h
 #include linux/smp_lock.h/* For (un)lock_kernel */
+#include linux/mm.h
+#ifdef __alpha__
+#include asm/pgtable.h /* For pte_wrprotect */
+#endif
 #include asm/io.h
 #include asm/mman.h
 #include asm/uaccess.h
-#include asm/pgtable.h
 #ifdef CONFIG_MTRR
 #include asm/mtrr.h
@@ -133,8 +141,86 @@
 #endif
 
+   /* module_init/module_exit added in 2.3.13 */
+#ifndef module_init
+#define module_init(x)  int init_module(void) { return x(); }
+#endif
+#ifndef module_exit
+#define module_exit(x)  void cleanup_module(void) { x(); }
+#endif
+
+   /* virt_to_page added in 2.4.0-test6 */
+#if LINUX_VERSION_CODE  0x020400
+#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
+#endif
+
/* Generic cmpxchg added in 2.3.x */
 #ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
used with older kernels. */
+#if defined(__alpha__)
+static __inline__ unsigned long
+__cmpxchg_u32(volatile int *m, int old, int new)
+{
+   unsigned long prev, cmp;
+
+   __asm__ __volatile__(
+   "1: ldl_l %0,%2\n"
+   "   cmpeq %0,%3,%1\n"
+   "   beq %1,2f\n"
+   "   mov %4,%1\n"
+   "   stl_c %1,%2\n"
+   "   beq %1,3f\n"
+   "2: mb\n"
+   ".subsection 2\n"
+   "3: br 1b\n"
+   ".previous"
+   : "=r"(prev), "=r"(cmp), "=m"(*m)
+   : "r"((long) old), "r"(new), "m"(*m));
+
+   return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+{
+   unsigned long prev, cmp;
+
+   __asm__ __volatile__(
+   "1: ldq_l %0,%2\n"
+   "   cmpeq %0,%3,%1\n"
+   "   beq %1,2f\n"
+   "   mov %4,%1\n"
+   "   stq_c %1,%2\n"
+   "   beq %1,3f\n"
+   "2: mb\n"
+   ".subsection 2\n"
+   "3: br 1b\n"
+   ".previous"
+   : "=r"(prev), "=r"(cmp), "=m"(*m)
+   : "r"((long) old), "r"(new), "m"(*m));
+
+   return prev;
+}
+
+static __inline__ unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+   switch (size) {
+   case 4:
+   return __cmpxchg_u32(ptr, old, new);
+   case 8:
+   return __cmpxchg_u64(ptr, old, new);
+   }
+   return old;
+}
+#define cmpxchg(ptr,o,n)\
+  ({\
+ __typeof__(*(ptr)) _o_ = (o);  \
+ __typeof__(*(ptr)) _n_ = (n);  \
+ (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,  \
+   (unsigned long)_n_, sizeof(*(ptr))); \
+  })
+
+#elif __i386__
 static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
  unsigned long new, int size)
@@ -167,4 +253,5 @@
   ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
 (unsigned long)(n),sizeof(*(ptr
+#endif /* i386  alpha */
 #endif
 
@@ -316,4 +403,5 @@
int   high_mark;   /* High water mark  */
atomic_t  wfh; /* If waiting for high mark