rpms/kernel/devel drm-mm-git.patch, NONE, 1.1 kernel.spec, 1.171, 1.172 nouveau-drm.patch, 1.4, 1.5

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Wed Sep 19 23:45:15 UTC 2007


Author: airlied

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2236

Modified Files:
	kernel.spec nouveau-drm.patch 
Added Files:
	drm-mm-git.patch 
Log Message:
* Thu Sep 20 2007 Dave Airlie <airlied at redhat.com>
- drm-mm-git.patch - pull in DRM git queue
- nouveau-drm.patch - update nouveau patch on top of drm git queue


drm-mm-git.patch:

--- NEW FILE drm-mm-git.patch ---
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 2d6f2d0..82fb3d0 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -63,27 +63,9 @@
 #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
 #endif
 
-#define XFREE86_VERSION(major,minor,patch,snap) \
-		((major << 16) | (minor << 8) | patch)
-
-#ifndef CONFIG_XFREE86_VERSION
-#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
-#endif
-
-#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
-#define DRM_PROC_DEVICES "/proc/devices"
-#define DRM_PROC_MISC	 "/proc/misc"
-#define DRM_PROC_DRM	 "/proc/drm"
-#define DRM_DEV_DRM	 "/dev/drm"
-#define DRM_DEV_MODE	 (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-#define DRM_DEV_UID	 0
-#define DRM_DEV_GID	 0
-#endif
-
-#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
 #define DRM_MAJOR       226
 #define DRM_MAX_MINOR   15
-#endif
+
 #define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
 #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
 #define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 0df87fc..9dd0760 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -80,6 +80,9 @@
 #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
 #define __OS_HAS_MTRR (defined(CONFIG_MTRR))
 
+struct drm_file;
+struct drm_device;
+
 #include "drm_os_linux.h"
 #include "drm_hashtab.h"
 
@@ -231,12 +234,13 @@
  * \param dev DRM device.
  * \param filp file pointer of the caller.
  */
-#define LOCK_TEST_WITH_RETURN( dev, filp )				\
+#define LOCK_TEST_WITH_RETURN( dev, file_priv )				\
 do {									\
 	if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||		\
-	     dev->lock.filp != filp ) {				\
-		DRM_ERROR( "%s called without lock held\n",		\
-			   __FUNCTION__ );				\
+	     dev->lock.file_priv != file_priv )	{			\
+		DRM_ERROR( "%s called without lock held, held  %d owner %p %p\n",\
+			   __FUNCTION__, _DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ),\
+			   dev->lock.file_priv, file_priv );		\
 		return -EINVAL;						\
 	}								\
 } while (0)
@@ -257,12 +261,12 @@ do {									\
  * Ioctl function type.
  *
  * \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private pointer.
  * \param cmd command.
  * \param arg argument.
  */
-typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
-			unsigned int cmd, unsigned long arg);
+typedef int drm_ioctl_t(struct drm_device *dev, void *data,
+			struct drm_file *file_priv);
 
 typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
 			       unsigned long arg);
@@ -271,10 +275,18 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
 #define	DRM_MASTER	0x2
 #define DRM_ROOT_ONLY	0x4
 
-typedef struct drm_ioctl_desc {
+struct drm_ioctl_desc {
+	unsigned int cmd;
 	drm_ioctl_t *func;
 	int flags;
-} drm_ioctl_desc_t;
+};
+
+/**
+ * Creates a driver or general drm_ioctl_desc array entry for the given
+ * ioctl, for use by drm_ioctl().
+ */
+#define DRM_IOCTL_DEF(ioctl, func, flags) \
+	[DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
 
 struct drm_magic_entry {
 	struct list_head head;
@@ -304,7 +316,7 @@ struct drm_buf {
 	__volatile__ int waiting;      /**< On kernel DMA queue */
 	__volatile__ int pending;      /**< On hardware DMA queue */
 	wait_queue_head_t dma_wait;    /**< Processes waiting */
-	struct file *filp;	       /**< Pointer to holding file descr */
+	struct drm_file *file_priv;    /**< Private of holding file descr */
 	int context;		       /**< Kernel queue for this buffer */
 	int while_locked;	       /**< Dispatch this buffer while locked */
 	enum {
@@ -377,6 +389,7 @@ struct drm_file {
 	int remove_auth_on_close;
 	unsigned long lock_count;
 	void *driver_priv;
+	struct file *filp;
 };
 
 /** Wait queue */
@@ -403,7 +416,7 @@ struct drm_queue {
  */
 struct drm_lock_data {
 	struct drm_hw_lock *hw_lock;	/**< Hardware lock */
-	struct file *filp;		/**< File descr of lock holder (0=kernel) */
+	struct drm_file *file_priv;	/**< File descr of lock holder (0=kernel) */
 	wait_queue_head_t lock_queue;	/**< Queue of blocked processes */
 	unsigned long lock_time;	/**< Time of last lock in jiffies */
 	spinlock_t spinlock;
@@ -552,11 +565,11 @@ struct drm_driver {
 	int (*load) (struct drm_device *, unsigned long flags);
 	int (*firstopen) (struct drm_device *);
 	int (*open) (struct drm_device *, struct drm_file *);
-	void (*preclose) (struct drm_device *, struct file * filp);
+	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
 	void (*postclose) (struct drm_device *, struct drm_file *);
 	void (*lastclose) (struct drm_device *);
 	int (*unload) (struct drm_device *);
-	int (*dma_ioctl) (DRM_IOCTL_ARGS);
+	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	void (*dma_ready) (struct drm_device *);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_ctor) (struct drm_device *dev, int context);
@@ -587,11 +600,12 @@ struct drm_driver {
 	void (*irq_preinstall) (struct drm_device *dev);
 	void (*irq_postinstall) (struct drm_device *dev);
 	void (*irq_uninstall) (struct drm_device *dev);
-	void (*reclaim_buffers) (struct drm_device *dev, struct file * filp);
+	void (*reclaim_buffers) (struct drm_device *dev,
+				 struct drm_file * file_priv);
 	void (*reclaim_buffers_locked) (struct drm_device *dev,
-					struct file *filp);
+					struct drm_file *file_priv);
 	void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
-					struct file * filp);
+					    struct drm_file *file_priv);
 	unsigned long (*get_map_ofs) (struct drm_map * map);
 	unsigned long (*get_reg_ofs) (struct drm_device *dev);
 	void (*set_version) (struct drm_device *dev,
@@ -606,7 +620,7 @@ struct drm_driver {
 
 	u32 driver_features;
 	int dev_priv_size;
-	drm_ioctl_desc_t *ioctls;
+	struct drm_ioctl_desc *ioctls;
 	int num_ioctls;
 	struct file_operations fops;
 	struct pci_driver pci_driver;
@@ -850,70 +864,70 @@ extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
 extern int drm_unbind_agp(DRM_AGP_MEM * handle);
 
 				/* Misc. IOCTL support (drm_ioctl.h) */
-extern int drm_irq_by_busid(struct inode *inode, struct file *filp,
-			    unsigned int cmd, unsigned long arg);
-extern int drm_getunique(struct inode *inode, struct file *filp,
-			 unsigned int cmd, unsigned long arg);
-extern int drm_setunique(struct inode *inode, struct file *filp,
-			 unsigned int cmd, unsigned long arg);
-extern int drm_getmap(struct inode *inode, struct file *filp,
-		      unsigned int cmd, unsigned long arg);
-extern int drm_getclient(struct inode *inode, struct file *filp,
-			 unsigned int cmd, unsigned long arg);
-extern int drm_getstats(struct inode *inode, struct file *filp,
-			unsigned int cmd, unsigned long arg);
-extern int drm_setversion(struct inode *inode, struct file *filp,
-			  unsigned int cmd, unsigned long arg);
-extern int drm_noop(struct inode *inode, struct file *filp,
-		    unsigned int cmd, unsigned long arg);
+extern int drm_irq_by_busid(struct drm_device *dev, void *data,
+			    struct drm_file *file_priv);
+extern int drm_getunique(struct drm_device *dev, void *data,
+			 struct drm_file *file_priv);
+extern int drm_setunique(struct drm_device *dev, void *data,
+			 struct drm_file *file_priv);
+extern int drm_getmap(struct drm_device *dev, void *data,
+		      struct drm_file *file_priv);
+extern int drm_getclient(struct drm_device *dev, void *data,
+			 struct drm_file *file_priv);
+extern int drm_getstats(struct drm_device *dev, void *data,
+			struct drm_file *file_priv);
[...12031 lines suppressed...]
-	dev_priv->vram_offset = fb.offset;
+	dev_priv->vram_offset = fb->offset;
 
 	mutex_unlock(&dev->struct_mutex);
-	DRM_DEBUG("offset = %u, size = %u", fb.offset, fb.size);
+	DRM_DEBUG("offset = %u, size = %u", fb->offset, fb->size);
 
 	return 0;
 
@@ -121,80 +115,71 @@ void via_lastclose(struct drm_device *dev)
 	mutex_unlock(&dev->struct_mutex);
 }	
 
-int via_mem_alloc(DRM_IOCTL_ARGS)
+int via_mem_alloc(struct drm_device *dev, void *data,
+		  struct drm_file *file_priv)
 {
-	DRM_DEVICE;
-
-	drm_via_mem_t mem;
+	drm_via_mem_t *mem = data;
 	int retval = 0;
 	struct drm_memblock_item *item;
 	drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
 	unsigned long tmpSize;
 
-	DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t __user *) data,
-				 sizeof(mem));
-
-	if (mem.type > VIA_MEM_AGP) {
+	if (mem->type > VIA_MEM_AGP) {
 		DRM_ERROR("Unknown memory type allocation\n");
-		return DRM_ERR(EINVAL);
+		return -EINVAL;
 	}
 	mutex_lock(&dev->struct_mutex);
-	if (0 == ((mem.type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
+	if (0 == ((mem->type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
 		      dev_priv->agp_initialized)) {
 		DRM_ERROR
 		    ("Attempt to allocate from uninitialized memory manager.\n");
 		mutex_unlock(&dev->struct_mutex);
-		return DRM_ERR(EINVAL);
+		return -EINVAL;
 	}
 
-	tmpSize = (mem.size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT;
-	item = drm_sman_alloc(&dev_priv->sman, mem.type, tmpSize, 0,
-			      (unsigned long)priv);
+	tmpSize = (mem->size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT;
+	item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0,
+			      (unsigned long)file_priv);
 	mutex_unlock(&dev->struct_mutex);
 	if (item) {
-		mem.offset = ((mem.type == VIA_MEM_VIDEO) ?
+		mem->offset = ((mem->type == VIA_MEM_VIDEO) ?
 			      dev_priv->vram_offset : dev_priv->agp_offset) +
 		    (item->mm->
 		     offset(item->mm, item->mm_info) << VIA_MM_ALIGN_SHIFT);
-		mem.index = item->user_hash.key;
+		mem->index = item->user_hash.key;
 	} else {
-		mem.offset = 0;
-		mem.size = 0;
-		mem.index = 0;
+		mem->offset = 0;
+		mem->size = 0;
+		mem->index = 0;
 		DRM_DEBUG("Video memory allocation failed\n");
-		retval = DRM_ERR(ENOMEM);
+		retval = -ENOMEM;
 	}
-	DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, sizeof(mem));
 
 	return retval;
 }
 
-int via_mem_free(DRM_IOCTL_ARGS)
+int via_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
-	DRM_DEVICE;
 	drm_via_private_t *dev_priv = dev->dev_private;
-	drm_via_mem_t mem;
+	drm_via_mem_t *mem = data;
 	int ret;
 
-	DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t __user *) data,
-				 sizeof(mem));
-
 	mutex_lock(&dev->struct_mutex);
-	ret = drm_sman_free_key(&dev_priv->sman, mem.index);
+	ret = drm_sman_free_key(&dev_priv->sman, mem->index);
 	mutex_unlock(&dev->struct_mutex);
-	DRM_DEBUG("free = 0x%lx\n", mem.index);
+	DRM_DEBUG("free = 0x%lx\n", mem->index);
 
 	return ret;
 }
 
 
-void via_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
+void via_reclaim_buffers_locked(struct drm_device * dev,
+				struct drm_file *file_priv)
 {
 	drm_via_private_t *dev_priv = dev->dev_private;
-	struct drm_file *priv = filp->private_data;
 
 	mutex_lock(&dev->struct_mutex);
-	if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) {
+	if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)file_priv)) {
 		mutex_unlock(&dev->struct_mutex);
 		return;
 	}
@@ -203,7 +188,7 @@ void via_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
 		dev->driver->dma_quiescent(dev);
 	}
 
-	drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)priv);
+	drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv);
 	mutex_unlock(&dev->struct_mutex);
 	return;
 }
diff --git a/drivers/char/drm/via_verifier.c b/drivers/char/drm/via_verifier.c
index 832d483..46a5791 100644
--- a/drivers/char/drm/via_verifier.c
+++ b/drivers/char/drm/via_verifier.c
@@ -1026,12 +1026,12 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size,
 		case state_error:
 		default:
 			*hc_state = saved_state;
-			return DRM_ERR(EINVAL);
+			return -EINVAL;
 		}
 	}
 	if (state == state_error) {
 		*hc_state = saved_state;
-		return DRM_ERR(EINVAL);
+		return -EINVAL;
 	}
 	return 0;
 }
@@ -1082,11 +1082,11 @@ via_parse_command_stream(struct drm_device * dev, const uint32_t * buf,
 			break;
 		case state_error:
 		default:
-			return DRM_ERR(EINVAL);
+			return -EINVAL;
 		}
 	}
 	if (state == state_error) {
-		return DRM_ERR(EINVAL);
+		return -EINVAL;
 	}
 	return 0;
 }
diff --git a/drivers/char/drm/via_video.c b/drivers/char/drm/via_video.c
index 300ac61..c15e75b 100644
--- a/drivers/char/drm/via_video.c
+++ b/drivers/char/drm/via_video.c
@@ -65,10 +65,9 @@ void via_release_futex(drm_via_private_t * dev_priv, int context)
 	}
 }
 
-int via_decoder_futex(DRM_IOCTL_ARGS)
+int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
-	DRM_DEVICE;
-	drm_via_futex_t fx;
+	drm_via_futex_t *fx = data;
 	volatile int *lock;
 	drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
 	drm_via_sarea_t *sAPriv = dev_priv->sarea_priv;
@@ -76,21 +75,18 @@ int via_decoder_futex(DRM_IOCTL_ARGS)
 
 	DRM_DEBUG("%s\n", __FUNCTION__);
 
-	DRM_COPY_FROM_USER_IOCTL(fx, (drm_via_futex_t __user *) data,
-				 sizeof(fx));
-
-	if (fx.lock > VIA_NR_XVMC_LOCKS)
+	if (fx->lock > VIA_NR_XVMC_LOCKS)
 		return -EFAULT;
 
-	lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx.lock);
+	lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx->lock);
 
-	switch (fx.func) {
+	switch (fx->func) {
 	case VIA_FUTEX_WAIT:
-		DRM_WAIT_ON(ret, dev_priv->decoder_queue[fx.lock],
-			    (fx.ms / 10) * (DRM_HZ / 100), *lock != fx.val);
+		DRM_WAIT_ON(ret, dev_priv->decoder_queue[fx->lock],
+			    (fx->ms / 10) * (DRM_HZ / 100), *lock != fx->val);
 		return ret;
 	case VIA_FUTEX_WAKE:
-		DRM_WAKEUP(&(dev_priv->decoder_queue[fx.lock]));
+		DRM_WAKEUP(&(dev_priv->decoder_queue[fx->lock]));
 		return 0;
 	}
 	return 0;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -r1.171 -r1.172
--- kernel.spec	19 Sep 2007 22:19:45 -0000	1.171
+++ kernel.spec	19 Sep 2007 23:44:41 -0000	1.172
@@ -418,7 +418,7 @@
 Provides: kernel = %{rpmversion}-%{pkg_release}\
 Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}\
 Provides: kernel-drm = 4.3.0\
-Provides: kernel-drm-nouveau = 6\
+Provides: kernel-drm-nouveau = 10\
 Requires(pre): %{kernel_prereq}\
 Conflicts: %{kernel_dot_org_conflicts}\
 Conflicts: %{package_conflicts}\
@@ -575,7 +575,6 @@
 Patch36: linux-2.6-utrace-ptrace-compat-s390.patch
 Patch37: linux-2.6-utrace-ptrace-compat-avr32.patch
 
-Patch40: nouveau-drm.patch
 Patch41: linux-2.6-sysrq-c.patch
 Patch42: linux-2.6-x86-tune-generic.patch
 Patch70: linux-2.6-x86_64-silence-up-apic-errors.patch
@@ -673,6 +672,10 @@
 
 Patch1600: linux-2.6-x86-edd-maxdrive.patch 
 
+#nouveau
+Patch1800: drm-mm-git.patch
+Patch1801: nouveau-drm.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root-%{_target_cpu}
@@ -993,7 +996,8 @@
 ApplyPatch linux-2.6-proc-self-maps-fix.patch
 
 # Nouveau DRM
-#ApplyPatch nouveau-drm.patch
+ApplyPatch drm-mm-git.patch
+ApplyPatch nouveau-drm.patch
 
 # enable sysrq-c on all kernels, not only kexec
 ApplyPatch linux-2.6-sysrq-c.patch
@@ -1800,6 +1804,10 @@
 
 
 %changelog
+* Thu Sep 20 2007 Dave Airlie <airlied at redhat.com>
+- drm-mm-git.patch - pull in DRM git queue
+- nouveau-drm.patch - update nouveau patch on top of drm git queue
+
 * Wed Sep 19 2007 Chuck Ebbert <cebbert at redhat.com>
 - Linux 2.6.23-rc6-git8
 - Enable Secure Computing (CONFIG_SECCOMP) (#295841)

nouveau-drm.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.4 -r 1.5 nouveau-drm.patch
Index: nouveau-drm.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/nouveau-drm.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- nouveau-drm.patch	12 Apr 2007 19:16:23 -0000	1.4
+++ nouveau-drm.patch	19 Sep 2007 23:44:41 -0000	1.5
@@ -1,56 +1,179 @@
+From f4e9f548d49b0bc9fbbfbee635f96e79a2f472ae Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied at voynix.(none)>
+Date: Thu, 6 Sep 2007 00:10:19 +1000
+Subject: [PATCH] drm: add nouveau latest code
+
+---
+ drivers/char/drm/Kconfig            |    5 +
+ drivers/char/drm/Makefile           |   12 +
+ drivers/char/drm/drmP.h             |    4 +-
+ drivers/char/drm/drm_bufs.c         |    6 +-
+ drivers/char/drm/drm_irq.c          |    3 +-
+ drivers/char/drm/drm_pciids.h       |  262 ++++
+ drivers/char/drm/nouveau_dma.c      |  177 +++
+ drivers/char/drm/nouveau_dma.h      |   98 ++
+ drivers/char/drm/nouveau_drm.h      |  166 ++
+ drivers/char/drm/nouveau_drv.c      |   96 ++
+ drivers/char/drm/nouveau_drv.h      |  584 +++++++
+ drivers/char/drm/nouveau_fifo.c     |  557 +++++++
+ drivers/char/drm/nouveau_ioc32.c    |   72 +
+ drivers/char/drm/nouveau_irq.c      |  430 ++++++
+ drivers/char/drm/nouveau_mem.c      |  616 ++++++++
+ drivers/char/drm/nouveau_notifier.c |  173 +++
+ drivers/char/drm/nouveau_object.c   | 1148 ++++++++++++++
+ drivers/char/drm/nouveau_reg.h      |  538 +++++++
+ drivers/char/drm/nouveau_sgdma.c    |  311 ++++
+ drivers/char/drm/nouveau_state.c    |  569 +++++++
+ drivers/char/drm/nv04_fb.c          |   24 +
+ drivers/char/drm/nv04_fifo.c        |  129 ++
+ drivers/char/drm/nv04_graph.c       |  415 +++++
+ drivers/char/drm/nv04_instmem.c     |  160 ++
+ drivers/char/drm/nv04_mc.c          |   23 +
+ drivers/char/drm/nv04_timer.c       |   45 +
+ drivers/char/drm/nv10_fb.c          |   26 +
+ drivers/char/drm/nv10_fifo.c        |  160 ++
+ drivers/char/drm/nv10_graph.c       |  777 ++++++++++
+ drivers/char/drm/nv20_graph.c       |  249 +++
+ drivers/char/drm/nv30_graph.c       | 2911 +++++++++++++++++++++++++++++++++++
+ drivers/char/drm/nv40_fb.c          |   56 +
+ drivers/char/drm/nv40_fifo.c        |  208 +++
+ drivers/char/drm/nv40_graph.c       | 1906 +++++++++++++++++++++++
+ drivers/char/drm/nv40_mc.c          |   39 +
+ drivers/char/drm/nv50_fifo.c        |  327 ++++
+ drivers/char/drm/nv50_graph.c       |  316 ++++
+ drivers/char/drm/nv50_instmem.c     |  320 ++++
+ drivers/char/drm/nv50_mc.c          |   43 +
+ 39 files changed, 13957 insertions(+), 4 deletions(-)
+ create mode 100644 drivers/char/drm/nouveau_dma.c
+ create mode 100644 drivers/char/drm/nouveau_dma.h
+ create mode 100644 drivers/char/drm/nouveau_drm.h
+ create mode 100644 drivers/char/drm/nouveau_drv.c
+ create mode 100644 drivers/char/drm/nouveau_drv.h
+ create mode 100644 drivers/char/drm/nouveau_fifo.c
+ create mode 100644 drivers/char/drm/nouveau_ioc32.c
+ create mode 100644 drivers/char/drm/nouveau_irq.c
+ create mode 100644 drivers/char/drm/nouveau_mem.c
+ create mode 100644 drivers/char/drm/nouveau_notifier.c
+ create mode 100644 drivers/char/drm/nouveau_object.c
+ create mode 100644 drivers/char/drm/nouveau_reg.h
+ create mode 100644 drivers/char/drm/nouveau_sgdma.c
+ create mode 100644 drivers/char/drm/nouveau_state.c
+ create mode 100644 drivers/char/drm/nv04_fb.c
+ create mode 100644 drivers/char/drm/nv04_fifo.c
+ create mode 100644 drivers/char/drm/nv04_graph.c
+ create mode 100644 drivers/char/drm/nv04_instmem.c
+ create mode 100644 drivers/char/drm/nv04_mc.c
+ create mode 100644 drivers/char/drm/nv04_timer.c
+ create mode 100644 drivers/char/drm/nv10_fb.c
+ create mode 100644 drivers/char/drm/nv10_fifo.c
+ create mode 100644 drivers/char/drm/nv10_graph.c
+ create mode 100644 drivers/char/drm/nv20_graph.c
+ create mode 100644 drivers/char/drm/nv30_graph.c
+ create mode 100644 drivers/char/drm/nv40_fb.c
+ create mode 100644 drivers/char/drm/nv40_fifo.c
+ create mode 100644 drivers/char/drm/nv40_graph.c
+ create mode 100644 drivers/char/drm/nv40_mc.c
+ create mode 100644 drivers/char/drm/nv50_fifo.c
+ create mode 100644 drivers/char/drm/nv50_graph.c
+ create mode 100644 drivers/char/drm/nv50_instmem.c
+ create mode 100644 drivers/char/drm/nv50_mc.c
+
 diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
-index ef833a1..065f499 100644
+index 0b7ffa5..0220619 100644
 --- a/drivers/char/drm/Kconfig
 +++ b/drivers/char/drm/Kconfig
-@@ -106,3 +106,9 @@ config DRM_SAVAGE
+@@ -106,3 +106,8 @@ config DRM_SAVAGE
  	  Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
  	  chipset. If M is selected the module will be called savage.
  
 +config DRM_NOUVEAU
 +	tristate "Nvidia video cards"
-+	depends on DRM && PCI
++	depends on DRM
 +	help
-+	  Choose this option if you want to enable nouveau reverse engineered
-+          driver for nvidia chipset. The module will be called nouveau.
++		Choose this for nvidia open source 3d driver
 diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
-index 6915a05..20b79d5 100644
+index 6915a05..f798916 100644
 --- a/drivers/char/drm/Makefile
 +++ b/drivers/char/drm/Makefile
-@@ -14,6 +14,14 @@ mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
+@@ -14,6 +14,16 @@ mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
  i810-objs   := i810_drv.o i810_dma.o
  i830-objs   := i830_drv.o i830_dma.o i830_irq.o
  i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
 +nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
-+                nouveau_object.o nouveau_irq.o \
++		nouveau_object.o nouveau_irq.o nouveau_notifier.o \
++		nouveau_sgdma.o nouveau_dma.o \
 +		nv04_timer.o \
-+		nv04_mc.o nv40_mc.o \
++		nv04_mc.o nv40_mc.o nv50_mc.o \
 +		nv04_fb.o nv10_fb.o nv40_fb.o \
++		nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \
 +		nv04_graph.o nv10_graph.o nv20_graph.o nv30_graph.o \
-+		nv40_graph.o
-+
++		nv40_graph.o nv50_graph.o \
++		nv04_instmem.o nv50_instmem.o
  radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
  sis-objs    := sis_drv.o sis_mm.o
  savage-objs := savage_drv.o savage_bci.o savage_state.o
-@@ -25,6 +33,7 @@ radeon-objs += radeon_ioc32.o
+@@ -25,6 +35,7 @@ radeon-objs += radeon_ioc32.o
  mga-objs    += mga_ioc32.o
  r128-objs   += r128_ioc32.o
  i915-objs   += i915_ioc32.o
-+nouveau-objs += nouveau_ioc32.o
++nouveau-objs   += nouveau_ioc32.o
  endif
  
  obj-$(CONFIG_DRM)	+= drm.o
-@@ -38,5 +47,6 @@ obj-$(CONFIG_DRM_I915)  += i915.o
+@@ -35,6 +46,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga.o
+ obj-$(CONFIG_DRM_I810)	+= i810.o
+ obj-$(CONFIG_DRM_I830)	+= i830.o
+ obj-$(CONFIG_DRM_I915)  += i915.o
++obj-$(CONFIG_DRM_NOUVEAU)   += nouveau.o
  obj-$(CONFIG_DRM_SIS)   += sis.o
  obj-$(CONFIG_DRM_SAVAGE)+= savage.o
  obj-$(CONFIG_DRM_VIA)	+=via.o
-+obj-$(CONFIG_DRM_NOUVEAU) += nouveau.o
- 
- 
+diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
+index 9dd0760..d539c96 100644
+--- a/drivers/char/drm/drmP.h
++++ b/drivers/char/drm/drmP.h
+@@ -967,7 +967,8 @@ extern unsigned long drm_get_resource_start(struct drm_device *dev,
+ 					    unsigned int resource);
+ extern unsigned long drm_get_resource_len(struct drm_device *dev,
+ 					  unsigned int resource);
+-
++struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
++					   drm_local_map_t *map);
+ 				/* DMA support (drm_dma.h) */
+ extern int drm_dma_setup(struct drm_device *dev);
+ extern void drm_dma_takedown(struct drm_device *dev);
+@@ -979,6 +980,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
+ extern int drm_control(struct drm_device *dev, void *data,
+ 		       struct drm_file *file_priv);
+ extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
++extern int drm_irq_install(struct drm_device * dev);
+ extern int drm_irq_uninstall(struct drm_device *dev);
+ extern void drm_driver_irq_preinstall(struct drm_device *dev);
+ extern void drm_driver_irq_postinstall(struct drm_device *dev);
 diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
-index a6828cc..f3da5c4 100644
+index 856774f..7890e08 100644
 --- a/drivers/char/drm/drm_bufs.c
 +++ b/drivers/char/drm/drm_bufs.c
-@@ -400,6 +400,7 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
+@@ -49,8 +49,8 @@ unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource
+ 
+ EXPORT_SYMBOL(drm_get_resource_len);
+ 
+-static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
+-					     drm_local_map_t *map)
++struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
++					   drm_local_map_t *map)
+ {
+ 	struct drm_map_list *entry;
+ 	list_for_each_entry(entry, &dev->maplist, head) {
+@@ -63,6 +63,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
+ 
+ 	return NULL;
+ }
++EXPORT_SYMBOL(drm_find_matching_map);
[...12804 lines suppressed...]
++	/* Assume that praying isn't enough, check that we can re-read the
++	 * entire fake channel back from the PRAMIN BAR */
++	for (i = 0; i < c_size; i+=4) {
++		if (NV_READ(NV_RAMIN + i) != NV_RI32(i)) {
++			DRM_ERROR("Error reading back PRAMIN at 0x%08x\n", i);
++			return -EINVAL;
++		}
++	}
++
++	/* Global PRAMIN heap */
++	if (nouveau_mem_init_heap(&dev_priv->ramin_heap,
++				  c_size, dev_priv->ramin->size - c_size)) {
++		dev_priv->ramin_heap = NULL;
++		DRM_ERROR("Failed to init RAMIN heap\n");
++	}
++
++	/*XXX: incorrect, but needed to make hash func "work" */
++	dev_priv->ramht_offset = 0x10000;
++	dev_priv->ramht_bits   = 9;
++	dev_priv->ramht_size   = (1 << dev_priv->ramht_bits);
++	return 0;
++}
++
++void
++nv50_instmem_takedown(struct drm_device *dev)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	struct nouveau_channel *chan = dev_priv->fifos[0];
++	int i;
++
++	DRM_DEBUG("\n");
++
++	if (!priv)
++		return;
++
++	/* Restore state from before init */
++	for (i = 0x1700; i <= 0x1710; i+=4)
++		NV_WRITE(i, priv->save1700[(i-0x1700)/4]);
++
++	nouveau_gpuobj_ref_del(dev, &priv->pramin_bar);
++	nouveau_gpuobj_ref_del(dev, &priv->pramin_pt);
++
++	/* Destroy dummy channel */
++	if (chan) {
++		nouveau_gpuobj_del(dev, &chan->vm_pd);
++		nouveau_gpuobj_ref_del(dev, &chan->ramfc);
++		nouveau_gpuobj_ref_del(dev, &chan->ramin);
++		nouveau_mem_takedown(&chan->ramin_heap);
++
++		dev_priv->fifos[0] = dev_priv->fifos[127] = NULL;
++		drm_free(chan, sizeof(*chan), DRM_MEM_DRIVER);
++	}
++
++	dev_priv->Engine.instmem.priv = NULL;
++	drm_free(priv, sizeof(*priv), DRM_MEM_DRIVER);
++}
++
++int
++nv50_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj, uint32_t *sz)
++{
++	if (gpuobj->im_backing)
++		return -EINVAL;
++
++	*sz = (*sz + (NV50_INSTMEM_PAGE_SIZE-1)) & ~(NV50_INSTMEM_PAGE_SIZE-1);
++	if (*sz == 0)
++		return -EINVAL;
++
++	gpuobj->im_backing = nouveau_mem_alloc(dev, NV50_INSTMEM_PAGE_SIZE,
++					       *sz, NOUVEAU_MEM_FB,
++					       (struct drm_file *)-2);
++	if (!gpuobj->im_backing) {
++		DRM_ERROR("Couldn't allocate vram to back PRAMIN pages\n");
++		return -ENOMEM;
++	}
++
++	return 0;
++}
++
++void
++nv50_instmem_clear(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++
++	if (gpuobj && gpuobj->im_backing) {
++		if (gpuobj->im_bound)
++			dev_priv->Engine.instmem.unbind(dev, gpuobj);
++		nouveau_mem_free(dev, gpuobj->im_backing);
++		gpuobj->im_backing = NULL;
++	}	
++}
++
++int
++nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	uint32_t pte, pte_end, vram;
++
++	if (!gpuobj->im_backing || !gpuobj->im_pramin || gpuobj->im_bound)
++		return -EINVAL;
++
++	DRM_DEBUG("st=0x%0llx sz=0x%0llx\n",
++		  gpuobj->im_pramin->start, gpuobj->im_pramin->size);
++
++	pte     = (gpuobj->im_pramin->start >> 12) << 3;
++	pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
++	vram    = gpuobj->im_backing->start;
++
++	DRM_DEBUG("pramin=0x%llx, pte=%d, pte_end=%d\n",
++		  gpuobj->im_pramin->start, pte, pte_end);
++	DRM_DEBUG("first vram page: 0x%llx\n",
++		  gpuobj->im_backing->start);
++
++	while (pte < pte_end) {
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 0)/4, vram | 1);
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
++
++		pte += 8;
++		vram += NV50_INSTMEM_PAGE_SIZE;
++	}
++
++	gpuobj->im_bound = 1;
++	return 0;
++}
++
++int
++nv50_instmem_unbind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	uint32_t pte, pte_end;
++
++	if (gpuobj->im_bound == 0)
++		return -EINVAL;
++
++	pte     = (gpuobj->im_pramin->start >> 12) << 3;
++	pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
++	while (pte < pte_end) {
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 0)/4, 0x00000009);
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
++		pte += 8;
++	}
++
++	gpuobj->im_bound = 0;
++	return 0;
++}
++
+diff --git a/drivers/char/drm/nv50_mc.c b/drivers/char/drm/nv50_mc.c
+new file mode 100644
+index 0000000..b111826
+--- /dev/null
++++ b/drivers/char/drm/nv50_mc.c
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2007 Ben Skeggs.
++ * All Rights Reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files (the
++ * "Software"), to deal in the Software without restriction, including
++ * without limitation 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 THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
++ * LIABLE FOR ANY CLAIM, DAMAGES OR 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.
++ *
++ */
++
++#include "drmP.h"
++#include "drm.h"
++#include "nouveau_drv.h"
++
++int
++nv50_mc_init(struct drm_device *dev)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++
++	NV_WRITE(NV03_PMC_ENABLE, 0xFFFFFFFF);
++
++	return 0;
++}
++
++void nv50_mc_takedown(struct drm_device *dev)
++{
++}
+-- 
+1.5.2.5
+




More information about the fedora-extras-commits mailing list