Fix DRM on FreeBSD (also makes my X600 finally work)

2006-01-30 Thread Adam K Kirchhoff

FYI, this patch works here.  Now I have a working current DRI with DRM
1.22.0.

Adam


 Hi list!
 
 I am very happy to announce that I got my Radeon X600 working on both
 Linux/i386 and FreeBSD/amd64. I needed to apply Benjamin's latest
 patches and also the small attached patch for FreeBSD. The biggest
 problem (that caused the crahes on FreeBSD) was that the virtual field
 of the struct drm_sg_mem_t was never initialized.
 
 BTW, I think the PCI ID of this card (0x5b62) should be added to the
 drm_pciids.txt
 
 Thanks for your great work!
 
   Markus
 
 
 
 Index: drmP.h
 ===
 RCS file: /cvs/dri/drm/bsd-core/drmP.h,v
 retrieving revision 1.73
 diff -w -u -d -r1.73 drmP.h
 --- drmP.h8 Nov 2005 20:24:59 -   1.73
 +++ drmP.h29 Jan 2006 07:31:28 -
 @@ -341,7 +341,7 @@
  #define DRM_COPY_FROM_USER_IOCTL(kern, user, size) \
   if ( IOCPARM_LEN(cmd) != size)  \
   return EINVAL;  \
 - kern = *user;
 + memcpy(kern, user, size);
  #define DRM_COPY_TO_USER(user, kern, size) \
   copyout(kern, user, size)
  #define DRM_COPY_FROM_USER(kern, user, size) \
 Index: drm_scatter.c
 ===
 RCS file: /cvs/dri/drm/bsd-core/drm_scatter.c,v
 retrieving revision 1.11
 diff -w -u -d -r1.11 drm_scatter.c
 --- drm_scatter.c 26 Apr 2005 05:19:11 -  1.11
 +++ drm_scatter.c 29 Jan 2006 07:31:28 -
 @@ -35,7 +35,7 @@
  
  void drm_sg_cleanup(drm_sg_mem_t *entry)
  {
 - free((void *)entry-handle, M_DRM);
 + free(entry-virtual, M_DRM);
   free(entry-busaddr, M_DRM);
   free(entry, M_DRM);
  }
 @@ -72,8 +72,9 @@
   return ENOMEM;
   }
  
 - entry-handle = (long)malloc(pages  PAGE_SHIFT, M_DRM,
 + entry-virtual = malloc(pages  PAGE_SHIFT, M_DRM,
   M_WAITOK | M_ZERO);
 + entry-handle = (unsigned long)entry-virtual;
   if (entry-handle == 0) {
   drm_sg_cleanup(entry);
   return ENOMEM;
 



---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] Fix DRM on FreeBSD (also makes my X600 finally work)

2006-01-28 Thread Markus Niemistö
Hi list!

I am very happy to announce that I got my Radeon X600 working on both
Linux/i386 and FreeBSD/amd64. I needed to apply Benjamin's latest
patches and also the small attached patch for FreeBSD. The biggest
problem (that caused the crahes on FreeBSD) was that the virtual field
of the struct drm_sg_mem_t was never initialized.

BTW, I think the PCI ID of this card (0x5b62) should be added to the
drm_pciids.txt

Thanks for your great work!

Markus
Index: drmP.h
===
RCS file: /cvs/dri/drm/bsd-core/drmP.h,v
retrieving revision 1.73
diff -w -u -d -r1.73 drmP.h
--- drmP.h	8 Nov 2005 20:24:59 -	1.73
+++ drmP.h	29 Jan 2006 07:31:28 -
@@ -341,7 +341,7 @@
 #define DRM_COPY_FROM_USER_IOCTL(kern, user, size) \
 	if ( IOCPARM_LEN(cmd) != size)			\
 		return EINVAL;\
-	kern = *user;
+	memcpy(kern, user, size);
 #define DRM_COPY_TO_USER(user, kern, size) \
 	copyout(kern, user, size)
 #define DRM_COPY_FROM_USER(kern, user, size) \
Index: drm_scatter.c
===
RCS file: /cvs/dri/drm/bsd-core/drm_scatter.c,v
retrieving revision 1.11
diff -w -u -d -r1.11 drm_scatter.c
--- drm_scatter.c	26 Apr 2005 05:19:11 -	1.11
+++ drm_scatter.c	29 Jan 2006 07:31:28 -
@@ -35,7 +35,7 @@
 
 void drm_sg_cleanup(drm_sg_mem_t *entry)
 {
-	free((void *)entry-handle, M_DRM);
+	free(entry-virtual, M_DRM);
 	free(entry-busaddr, M_DRM);
 	free(entry, M_DRM);
 }
@@ -72,8 +72,9 @@
 		return ENOMEM;
 	}
 
-	entry-handle = (long)malloc(pages  PAGE_SHIFT, M_DRM,
+	entry-virtual = malloc(pages  PAGE_SHIFT, M_DRM,
 	M_WAITOK | M_ZERO);
+	entry-handle = (unsigned long)entry-virtual;
 	if (entry-handle == 0) {
 		drm_sg_cleanup(entry);
 		return ENOMEM;