Parts of drivers/char/drm/ is severely broken in 2.6.12-rc1-mm1 - this is
fair enough since it /is/ marked as broken. So, why am I writing this
mail? Well, I /tried/ to build some of the stuff in there, saw it blow up,
then tried to fix it, then gave up trying to fix it, got it into a state
where it's still completely broken and will blow up pretty bad if you try
to use it, but at least it now builds. I have absolutely no idea if any of
the changes I made will be useful to anyone, but I thought I'd at least
submit a patch with the changes I made, and if bits of it are useful, then
good, if not - ohh well..
See further below for some of the warnings and errors I initially got that
prompted my to try and fix it.
Here's a patch with the changes I made - very ugly, very broken, possibly
worse than it was, but perhaps there are some bits that are useful - you
never know. :
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drmP.h
linux-2.6.12-rc1-mm1/drivers/char/drm/drmP.h
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drmP.h 2005-03-21
23:15:34.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/drmP.h2005-03-24
00:17:38.0 +0100
@@ -423,6 +423,7 @@ typedef struct drm_file {
struct drm_file *next;
struct drm_file *prev;
struct drm_head *head;
+ struct drm_device *dev;
int remove_auth_on_close;
unsigned long lock_count;
void *driver_priv;
@@ -737,6 +738,7 @@ typedef struct drm_device {
structdrm_driver *driver;
drm_local_map_t *agp_buffer_map;
drm_head_t primary; /**< primary screen head */
+ u32 driver_features;
} drm_device_t;
static __inline__ int drm_core_check_feature(struct drm_device *dev, int
feature)
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drm_memory.h
linux-2.6.12-rc1-mm1/drivers/char/drm/drm_memory.h
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drm_memory.h 2005-03-02
08:37:49.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/drm_memory.h 2005-03-24
00:03:53.0 +0100
@@ -33,6 +33,9 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifndef __DRM_MEMORY_H
+#define __DRM_MEMORY_H
+
#include
#include
#include
@@ -194,4 +197,4 @@ static inline void drm_ioremapfree(void
iounmap(pt);
}
-
+#endif /* __DRM_MEMORY_H */
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drm_os_linux.h
linux-2.6.12-rc1-mm1/drivers/char/drm/drm_os_linux.h
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/drm_os_linux.h 2005-03-21
23:12:26.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/drm_os_linux.h2005-03-24
00:18:57.0 +0100
@@ -89,7 +89,7 @@ static __inline__ int mtrr_del (int reg,
copy_to_user(arg1, arg2, arg3)
/* Macros for copyfrom user, but checking readability only once */
#define DRM_VERIFYAREA_READ( uaddr, size ) \
- verify_area( VERIFY_READ, uaddr, size )
+ (access_ok( VERIFY_READ, uaddr, size ) ? 0 : -EFAULT)
#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
__copy_from_user(arg1, arg2, arg3)
#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma.h
linux-2.6.12-rc1-mm1/drivers/char/drm/gamma.h
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma.h 1970-01-01
01:00:00.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/gamma.h 2005-03-23
23:35:20.0 +0100
@@ -0,0 +1,4 @@
+#ifndef __GAMMA_H__
+#define __GAMMA_H__
+#define DRM(x) gamma_##x
+#endif
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma_context.h
linux-2.6.12-rc1-mm1/drivers/char/drm/gamma_context.h
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma_context.h 2005-03-02
08:38:06.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/gamma_context.h 2005-03-24
00:01:26.0 +0100
@@ -190,12 +190,14 @@ int DRM(context_switch_complete)(drm_dev
DRM_ERROR("Lock isn't held after context switch\n");
}
+/*
if (!dma || !(dma->next_buffer && dma->next_buffer->while_locked)) {
if (DRM(lock_free)(dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
DRM_ERROR("Cannot free lock\n");
}
}
+*/
clear_bit(0, &dev->context_flag);
wake_up_interruptible(&dev->context_wait);
diff -uprN linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma_dma.c
linux-2.6.12-rc1-mm1/drivers/char/drm/gamma_dma.c
--- linux-2.6.12-rc1-mm1-orig/drivers/char/drm/gamma_dma.c 2005-03-02
08:38:26.0 +0100
+++ linux-2.6.12-rc1-mm1/drivers/char/drm/gamma_dma.c 2005-03-24
00:16:43.0 +0100
@@ -136,10 +136,10 @@ irqreturn_t gamma_driver_irq_handler( DR
/* Free previous buffer */
if (test_and_set_bit(0, &dev->dma_flag))