El Jueves, 8 de Septiembre de 2005 23:30, escribió:
> > Should I compile the whole kernel in drm-2.6? I'm not used to kernel
> > developping and I'm affraid I have made a mistake somewere.
>
> Yes don't copy files anywhere.. just build the kernel in the drm-2.6 and
> install it, my tree has ben's patch.. also Linus's tree has it at
> present..

Ok, I have done that, and now it works, but it was a libGL problem. Maybe 
copying drm files to 2.6.12 tree should have also worked. Well, it doesn't 
mind: if it ain't broke, don't fix it.

I'm sure that your tree doesn't have ben's patch. I updated the tree this 
morning, then added my card to drm_pciids.h compiled it but I also got: 

[drm:radeon_cp_init] *ERROR* radeon_cp_init called without lock held
[drm:drm_unlock] *ERROR* Process 8647 using kernel context

I had to manually patch drm_bufs.c to make it work. I attach the diff.
--- drm_bufs.c.orig	2005-09-08 19:04:17.000000000 +0200
+++ drm_bufs.c	2005-09-08 19:18:31.000000000 +0200
@@ -48,7 +48,7 @@
 }
 EXPORT_SYMBOL(drm_get_resource_len);
 
-static drm_local_map_t *drm_find_matching_map(drm_device_t *dev,
+static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
 					      drm_local_map_t *map)
 {
 	struct list_head *list;
@@ -57,7 +57,7 @@
 		drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
 		if (entry->map && map->type == entry->map->type &&
 		    entry->map->offset == map->offset) {
-			return entry->map;
+			return entry;
 		}
 	}
 
@@ -114,14 +114,13 @@
  * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
  * applicable and if supported by the kernel.
  */
-int drm_addmap(drm_device_t * dev, unsigned int offset,
+int drm_addmap_core(drm_device_t * dev, unsigned int offset,
 	       unsigned int size, drm_map_type_t type,
-	       drm_map_flags_t flags, drm_local_map_t ** map_ptr)
+	       drm_map_flags_t flags, drm_map_list_t ** maplist)
 {
 	drm_map_t *map;
 	drm_map_list_t *list;
 	drm_dma_handle_t *dmah;
-	drm_local_map_t *found_map;
 
 	map = drm_alloc( sizeof(*map), DRM_MEM_MAPS );
 	if ( !map )
@@ -166,17 +165,17 @@
 		 * needing to be aware of it.  Therefore, we just return success
 		 * when the server tries to create a duplicate map.
 		 */
-		found_map = drm_find_matching_map(dev, map);
-		if (found_map != NULL) {
-			if (found_map->size != map->size) {
+		list = drm_find_matching_map(dev, map);
+		if (list != NULL) {
+			if (list->map->size != map->size) {
 				DRM_DEBUG("Matching maps of type %d with "
 				   "mismatched sizes, (%ld vs %ld)\n",
-				    map->type, map->size, found_map->size);
-				found_map->size = map->size;
+				    map->type, map->size, list->map->size);
+				list->map->size = map->size;
 			}
 
 			drm_free(map, sizeof(*map), DRM_MEM_MAPS);
-			*map_ptr = found_map;
+			*maplist = list;
 			return 0;
 		}
 
@@ -264,9 +263,23 @@
 				    : map->offset, dev);
  	up(&dev->struct_sem);
 
-	*map_ptr = map;
+	*maplist = list;
 	return 0;
 }
+
+int drm_addmap(drm_device_t * dev, unsigned int offset,
+              unsigned int size, drm_map_type_t type,
+              drm_map_flags_t flags, drm_local_map_t ** map_ptr)
+{
+       drm_map_list_t *list;
+       int rc;
+
+       rc = drm_addmap_core(dev, offset, size, type, flags, &list);
+       if (!rc)
+               *map_ptr = list->map;
+       return rc;
+}
+
 EXPORT_SYMBOL(drm_addmap);
 
 int drm_addmap_ioctl(struct inode *inode, struct file *filp,
@@ -275,10 +288,9 @@
 	drm_file_t *priv = filp->private_data;
 	drm_device_t *dev = priv->head->dev;
 	drm_map_t map;
-	drm_map_t *map_ptr;
+	drm_map_list_t *maplist;
 	drm_map_t __user *argp = (void __user *)arg;
 	int err;
-	unsigned long handle = 0;
 
 	if (!(filp->f_mode & 3))
 		return -EACCES;	/* Require read/write */
@@ -287,26 +299,15 @@
 		return -EFAULT;
 	}
 
-	err = drm_addmap(dev, map.offset, map.size, map.type, map.flags,
-			 &map_ptr);
+	err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags,
+			 &maplist);
 
-	if (err) {
+	if (err) 
 		return err;
-	}
-
-	{
-		drm_map_list_t *_entry;
-		list_for_each_entry(_entry, &dev->maplist->head, head) {
-			if (_entry->map == map_ptr)
-				handle = _entry->user_token;
-		}
-		if (!handle)
-			return -EFAULT;
-	}
 
-	if (copy_to_user(argp, map_ptr, sizeof(*map_ptr)))
+	if (copy_to_user(argp, maplist->map, sizeof(drm_map_t)))
 		return -EFAULT;
-	if (put_user(handle, &argp->handle))
+	if (put_user(maplist->user_token, &argp->handle))
 		return -EFAULT;
 	return 0;
 }

Attachment: pgpzR64MSL1HT.pgp
Description: PGP signature

Reply via email to