rpms/libdrm/devel libdrm-radeon.patch, 1.7, 1.8 libdrm.spec, 1.68, 1.69

Dave Airlie airlied at fedoraproject.org
Mon Apr 6 05:42:06 UTC 2009


Author: airlied

Update of /cvs/pkgs/rpms/libdrm/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21160

Modified Files:
	libdrm-radeon.patch libdrm.spec 
Log Message:
* Mon Apr 06 2009 Dave Airlie <airlied at redhat.com<> 2.4.5-4
- libdrm-radeon: API busting to latest upstream
- bump kernel requires


libdrm-radeon.patch:

Index: libdrm-radeon.patch
===================================================================
RCS file: /cvs/pkgs/rpms/libdrm/devel/libdrm-radeon.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- libdrm-radeon.patch	24 Feb 2009 16:37:29 -0000	1.7
+++ libdrm-radeon.patch	6 Apr 2009 05:41:36 -0000	1.8
@@ -22,23 +22,11 @@
  
  libdrm_la_LTLIBRARIES = libdrm.la
  libdrm_ladir = $(libdir)
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/libdrm_radeon.pc.in
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/libdrm_radeon.pc.in	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,10 @@
-+prefix=@prefix@
-+exec_prefix=@exec_prefix@
-+libdir=@libdir@
-+includedir=@includedir@
-+
-+Name: libdrm_radeon
-+Description: Userspace interface to kernel DRM services for radeon
-+Version: 1.0.1
-+Libs: -L${libdir} -ldrm_radeon
-+Cflags: -I${includedir} -I${includedir}/drm
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/Makefile.am
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/Makefile.am	2009-02-18 09:27:49.000000000 +1000
+diff --git a/libdrm/radeon/Makefile.am b/libdrm/radeon/Makefile.am
+new file mode 100644
+index 0000000..bc8a5b8
+--- /dev/null
++++ b/libdrm/radeon/Makefile.am
 @@ -0,0 +1,53 @@
 +# Copyright © 2008 Jérôme Glisse
 +#
@@ -93,10 +81,213 @@
 +pkgconfig_DATA = libdrm_radeon.pc
 +
 +EXTRA_DIST = libdrm_radeon.pc.in
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_bo_gem.c
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_bo_gem.c	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,223 @@
+diff --git a/libdrm/radeon/libdrm_radeon.pc.in b/libdrm/radeon/libdrm_radeon.pc.in
+new file mode 100644
+index 0000000..3306844
+--- /dev/null
++++ b/libdrm/radeon/libdrm_radeon.pc.in
+@@ -0,0 +1,10 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: libdrm_radeon
++Description: Userspace interface to kernel DRM services for radeon
++Version: 1.0.1
++Libs: -L${libdir} -ldrm_radeon
++Cflags: -I${includedir} -I${includedir}/drm
+diff --git a/libdrm/radeon/radeon_bo.h b/libdrm/radeon/radeon_bo.h
+new file mode 100644
+index 0000000..3cabdfc
+--- /dev/null
++++ b/libdrm/radeon/radeon_bo.h
+@@ -0,0 +1,179 @@
++/* 
++ * Copyright © 2008 Jérôme Glisse
++ * 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, sub license, 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 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
++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
++ * 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.
++ *
++ * The above copyright notice and this permission notice (including the
++ * next paragraph) shall be included in all copies or substantial portions
++ * of the Software.
++ */
++/*
++ * Authors:
++ *      Jérôme Glisse <glisse at freedesktop.org>
++ */
++#ifndef RADEON_BO_H
++#define RADEON_BO_H
++
++#include <stdio.h>
++#include <stdint.h>
++#include "radeon_track.h"
++
++/* bo object */
++#define RADEON_BO_FLAGS_MACRO_TILE  1
++#define RADEON_BO_FLAGS_MICRO_TILE  2
++
++struct radeon_bo_manager;
++
++struct radeon_bo {
++    uint32_t                    alignment;
++    uint32_t                    handle;
++    uint32_t                    size;
++    uint32_t                    domains;
++    uint32_t                    flags;
++    unsigned                    cref;
++#ifdef RADEON_BO_TRACK
++    struct radeon_track         *track;
++#endif
++    void                        *ptr;
++    struct radeon_bo_manager    *bom;
++    uint32_t                    space_accounted;
++};
++
++/* bo functions */
++struct radeon_bo_funcs {
++    struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
++                                 uint32_t handle,
++                                 uint32_t size,
++                                 uint32_t alignment,
++                                 uint32_t domains,
++                                 uint32_t flags);
++    void (*bo_ref)(struct radeon_bo *bo);
++    struct radeon_bo *(*bo_unref)(struct radeon_bo *bo);
++    int (*bo_map)(struct radeon_bo *bo, int write);
++    int (*bo_unmap)(struct radeon_bo *bo);
++    int (*bo_wait)(struct radeon_bo *bo);
++};
++
++struct radeon_bo_manager {
++    struct radeon_bo_funcs  *funcs;
++    int                     fd;
++    struct radeon_tracker   tracker;
++};
++    
++static inline void _radeon_bo_debug(struct radeon_bo *bo,
++                                    const char *op,
++                                    const char *file,
++                                    const char *func,
++                                    int line)
++{
++    fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X [%s %s %d]\n",
++            op, bo, bo->handle, bo->size, bo->cref, file, func, line);
++}
++
++static inline struct radeon_bo *_radeon_bo_open(struct radeon_bo_manager *bom,
++                                                uint32_t handle,
++                                                uint32_t size,
++                                                uint32_t alignment,
++                                                uint32_t domains,
++                                                uint32_t flags,
++                                                const char *file,
++                                                const char *func,
++                                                int line)
++{
++    struct radeon_bo *bo;
++
++    bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags);
++#ifdef RADEON_BO_TRACK
++    if (bo) {
++        bo->track = radeon_tracker_add_track(&bom->tracker, bo->handle);
++        radeon_track_add_event(bo->track, file, func, "open", line);
++    }
++#endif
++    return bo;
++}
++
++static inline void _radeon_bo_ref(struct radeon_bo *bo,
++                                  const char *file,
++                                  const char *func,
++                                  int line)
++{
++    bo->cref++;
++#ifdef RADEON_BO_TRACK
++    radeon_track_add_event(bo->track, file, func, "ref", line); 
++#endif
++    bo->bom->funcs->bo_ref(bo);
++}
++
++static inline struct radeon_bo *_radeon_bo_unref(struct radeon_bo *bo,
++                                                 const char *file,
++                                                 const char *func,
++                                                 int line)
++{
++    bo->cref--;
++#ifdef RADEON_BO_TRACK
++    radeon_track_add_event(bo->track, file, func, "unref", line);
++    if (bo->cref <= 0) {
++        radeon_tracker_remove_track(&bo->bom->tracker, bo->track);
++        bo->track = NULL;
++    }
++#endif
++    return bo->bom->funcs->bo_unref(bo);
++}
++
++static inline int _radeon_bo_map(struct radeon_bo *bo,
++                                 int write,
++                                 const char *file,
++                                 const char *func,
++                                 int line)
++{
++    return bo->bom->funcs->bo_map(bo, write);
++}
++
++static inline int _radeon_bo_unmap(struct radeon_bo *bo,
++                                   const char *file,
++                                   const char *func,
++                                   int line)
++{
++    return bo->bom->funcs->bo_unmap(bo);
++}
++
++static inline int _radeon_bo_wait(struct radeon_bo *bo,
++                                  const char *file,
++                                  const char *func,
++                                  int line)
++{
++    return bo->bom->funcs->bo_wait(bo);
++}
++
++#define radeon_bo_open(bom, h, s, a, d, f)\
++    _radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_ref(bo)\
++    _radeon_bo_ref(bo, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_unref(bo)\
++    _radeon_bo_unref(bo, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_map(bo, w)\
++    _radeon_bo_map(bo, w, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_unmap(bo)\
++    _radeon_bo_unmap(bo, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_debug(bo, opcode)\
++    _radeon_bo_debug(bo, opcode, __FILE__, __FUNCTION__, __LINE__)
++#define radeon_bo_wait(bo) \
++    _radeon_bo_wait(bo, __FILE__, __func__, __LINE__)
++
++#endif
+diff --git a/libdrm/radeon/radeon_bo_gem.c b/libdrm/radeon/radeon_bo_gem.c
+new file mode 100644
+index 0000000..70f4b6b
+--- /dev/null
++++ b/libdrm/radeon/radeon_bo_gem.c
+@@ -0,0 +1,237 @@
 +/* 
 + * Copyright © 2008 Dave Airlie
 + * Copyright © 2008 Jérôme Glisse
@@ -128,6 +319,9 @@
 + *      Dave Airlie
 + *      Jérôme Glisse <glisse at freedesktop.org>
 + */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
 +#include <stdio.h>
 +#include <stdint.h>
 +#include <stdlib.h>
@@ -193,7 +387,7 @@
 +        args.size = size;
 +        args.alignment = alignment;
 +        args.initial_domain = bo->base.domains;
-+        args.no_backing_store = 0;
++        args.flags = 0;
 +        args.handle = 0;
 +        r = drmCommandWriteRead(bom->fd, DRM_RADEON_GEM_CREATE,
 +                                &args, sizeof(args));
@@ -243,6 +437,7 @@
 +    struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
 +    struct drm_radeon_gem_mmap args;
 +    int r;
++    void *ptr;
 +
 +    if (bo_gem->map_count++ != 0) {
 +        return 0;
@@ -255,12 +450,16 @@
 +                            DRM_RADEON_GEM_MMAP,
 +                            &args,
 +                            sizeof(args));
-+    if (!r) {
-+        bo->ptr = (void *)(unsigned long)args.addr_ptr;
-+    } else {
++    if (r) {
 +        fprintf(stderr, "error mapping %p 0x%08X (error = %d)\n",
 +                bo, bo->handle, r);
++        return r;
 +    }
++    ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, bo->bom->fd, args.addr_ptr);
++    if (ptr == MAP_FAILED)
++        return -errno;
++    bo->ptr = ptr;
++
 +    return r;
 +}
 +
@@ -278,12 +477,12 @@
 +
 +static int bo_wait(struct radeon_bo *bo)
 +{
-+    struct drm_radeon_gem_wait_rendering args;
++    struct drm_radeon_gem_wait_idle args;
 +    int ret;
 +
 +    args.handle = bo->handle;
 +    do {
-+        ret = drmCommandWriteRead(bo->bom->fd, DRM_RADEON_GEM_WAIT_RENDERING,
++        ret = drmCommandWriteRead(bo->bom->fd, DRM_RADEON_GEM_WAIT_IDLE,
 +                                  &args, sizeof(args));
 +    } while (ret == -EAGAIN);
 +    return ret;
@@ -320,10 +519,18 @@
 +    }
 +    free(bomg);
 +}
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_bo_gem.h
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_bo_gem.h	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,40 @@
++
++uint32_t radeon_gem_name_bo(struct radeon_bo *bo)
++{
++    struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
++    return bo_gem->name;
++}
+diff --git a/libdrm/radeon/radeon_bo_gem.h b/libdrm/radeon/radeon_bo_gem.h
+new file mode 100644
+index 0000000..980a6a4
+--- /dev/null
++++ b/libdrm/radeon/radeon_bo_gem.h
+@@ -0,0 +1,41 @@
 +/* 
 + * Copyright © 2008 Dave Airlie
 + * Copyright © 2008 Jérôme Glisse
@@ -363,30 +570,33 @@
 +struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd);
 +void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom);
 +
++uint32_t radeon_gem_name_bo(struct radeon_bo *bo);
 +#endif
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_bo.h
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_bo.h	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,179 @@
+diff --git a/libdrm/radeon/radeon_cs.h b/libdrm/radeon/radeon_cs.h
+new file mode 100644
+index 0000000..d870961
+--- /dev/null
++++ b/libdrm/radeon/radeon_cs.h
+@@ -0,0 +1,208 @@
 +/* 
++ * Copyright © 2008 Nicolai Haehnle
 + * Copyright © 2008 Jérôme Glisse
 + * All Rights Reserved.
 + * 
-+ * Permission is hereby granted, free of charge, to any person obtaining
-+ * a copy of this software and associated documentation files (the
++ * 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, sub license, 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 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
-+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
-+ * 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 
++ * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
++ * THE COPYRIGHT HOLDERS, AUTHORS 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.
 + *
 + * The above copyright notice and this permission notice (including the
@@ -395,162 +605,193 @@
 + */
 +/*
 + * Authors:
++ *      Aapo Tahkola <aet at rasterburn.org>
++ *      Nicolai Haehnle <prefect_ at gmx.net>
 + *      Jérôme Glisse <glisse at freedesktop.org>
 + */
-+#ifndef RADEON_BO_H
-+#define RADEON_BO_H
++#ifndef RADEON_CS_H
++#define RADEON_CS_H
 +
-+#include <stdio.h>
 +#include <stdint.h>
-+#include "radeon_track.h"
++#include <string.h>
++#include "drm.h"
++#include "radeon_drm.h"
++#include "radeon_bo.h"
 +
-+/* bo object */
-+#define RADEON_BO_FLAGS_MACRO_TILE  1
-+#define RADEON_BO_FLAGS_MICRO_TILE  2
++struct radeon_cs_reloc {
++    struct radeon_bo    *bo;
++    uint32_t            read_domain;
++    uint32_t            write_domain;
++    uint32_t            flags;
++};
 +
-+struct radeon_bo_manager;
 +
-+struct radeon_bo {
-+    uint32_t                    alignment;
-+    uint32_t                    handle;
-+    uint32_t                    size;
-+    uint32_t                    domains;
-+    uint32_t                    flags;
-+    unsigned                    cref;
-+#ifdef RADEON_BO_TRACK
-+    struct radeon_track         *track;
-+#endif
-+    void                        *ptr;
-+    struct radeon_bo_manager    *bom;
-+    uint32_t                    space_accounted;
++#define RADEON_CS_SPACE_OK 0
++#define RADEON_CS_SPACE_OP_TO_BIG 1
++#define RADEON_CS_SPACE_FLUSH 2
++
++struct radeon_cs_space_check {
++    struct radeon_bo *bo;
++    uint32_t read_domains;
++    uint32_t write_domain;
++    uint32_t new_accounted;
 +};
 +
-+/* bo functions */
-+struct radeon_bo_funcs {
-+    struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
-+                                 uint32_t handle,
-+                                 uint32_t size,
-+                                 uint32_t alignment,
-+                                 uint32_t domains,
-+                                 uint32_t flags);
-+    void (*bo_ref)(struct radeon_bo *bo);
-+    struct radeon_bo *(*bo_unref)(struct radeon_bo *bo);
-+    int (*bo_map)(struct radeon_bo *bo, int write);
-+    int (*bo_unmap)(struct radeon_bo *bo);
-+    int (*bo_wait)(struct radeon_bo *bo);
++struct radeon_cs_manager;
++
++struct radeon_cs {
++    struct radeon_cs_manager    *csm;
++    void                        *relocs;
++    uint32_t                    *packets;
++    unsigned                    crelocs;
++    unsigned                    relocs_total_size;
++    unsigned                    cdw;
++    unsigned                    ndw;
++    int                         section;
++    unsigned                    section_ndw;
++    unsigned                    section_cdw;
++    const char                  *section_file;
++    const char                  *section_func;
++    int                         section_line;
++
 +};
 +
-+struct radeon_bo_manager {
-+    struct radeon_bo_funcs  *funcs;
++/* cs functions */
++struct radeon_cs_funcs {
++    struct radeon_cs *(*cs_create)(struct radeon_cs_manager *csm,
++                                   uint32_t ndw);
++    int (*cs_write_reloc)(struct radeon_cs *cs,
++                          struct radeon_bo *bo,
++                          uint32_t read_domain,
++                          uint32_t write_domain,
++                          uint32_t flags);
++    int (*cs_begin)(struct radeon_cs *cs,
++                    uint32_t ndw,
++                    const char *file,
++                    const char *func,
++                    int line);
++    int (*cs_end)(struct radeon_cs *cs,
++                  const char *file,
++                  const char *func,
++                  int line);
++    int (*cs_emit)(struct radeon_cs *cs);
++    int (*cs_destroy)(struct radeon_cs *cs);
++    int (*cs_erase)(struct radeon_cs *cs);
++    int (*cs_need_flush)(struct radeon_cs *cs);
++    void (*cs_print)(struct radeon_cs *cs, FILE *file);
++    int (*cs_space_check)(struct radeon_cs *cs, struct radeon_cs_space_check *bos,
++			  int num_bo);
++};
++
++struct radeon_cs_manager {
++    struct radeon_cs_funcs  *funcs;
 +    int                     fd;
-+    struct radeon_tracker   tracker;
++    uint32_t vram_limit, gart_limit;
++    uint32_t vram_write_used, gart_write_used;
++    uint32_t read_used;
 +};
-+    
-+static inline void _radeon_bo_debug(struct radeon_bo *bo,
-+                                    const char *op,
-+                                    const char *file,
-+                                    const char *func,
-+                                    int line)
++
++static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
++                                                 uint32_t ndw)
 +{
-+    fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X [%s %s %d]\n",
-+            op, bo, bo->handle, bo->size, bo->cref, file, func, line);
++    return csm->funcs->cs_create(csm, ndw);
 +}
 +
-+static inline struct radeon_bo *_radeon_bo_open(struct radeon_bo_manager *bom,
-+                                                uint32_t handle,
-+                                                uint32_t size,
-+                                                uint32_t alignment,
-+                                                uint32_t domains,
-+                                                uint32_t flags,
-+                                                const char *file,
-+                                                const char *func,
-+                                                int line)
++static inline int radeon_cs_write_reloc(struct radeon_cs *cs,
++                                        struct radeon_bo *bo,
++                                        uint32_t read_domain,
++                                        uint32_t write_domain,
++                                        uint32_t flags)
 +{
-+    struct radeon_bo *bo;
-+
-+    bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags);
-+#ifdef RADEON_BO_TRACK
-+    if (bo) {
-+        bo->track = radeon_tracker_add_track(&bom->tracker, bo->handle);
-+        radeon_track_add_event(bo->track, file, func, "open", line);
-+    }
-+#endif
-+    return bo;
++    return cs->csm->funcs->cs_write_reloc(cs,
++                                          bo,
++                                          read_domain,
++                                          write_domain,
++                                          flags);
 +}
 +
-+static inline void _radeon_bo_ref(struct radeon_bo *bo,
++static inline int radeon_cs_begin(struct radeon_cs *cs,
++                                  uint32_t ndw,
 +                                  const char *file,
 +                                  const char *func,
 +                                  int line)
 +{
-+    bo->cref++;
-+#ifdef RADEON_BO_TRACK
-+    radeon_track_add_event(bo->track, file, func, "ref", line); 
-+#endif
-+    bo->bom->funcs->bo_ref(bo);
++    return cs->csm->funcs->cs_begin(cs, ndw, file, func, line);
 +}
 +
-+static inline struct radeon_bo *_radeon_bo_unref(struct radeon_bo *bo,
-+                                                 const char *file,
-+                                                 const char *func,
-+                                                 int line)
++static inline int radeon_cs_end(struct radeon_cs *cs,
++                                const char *file,
++                                const char *func,
++                                int line)
 +{
-+    bo->cref--;
-+#ifdef RADEON_BO_TRACK
-+    radeon_track_add_event(bo->track, file, func, "unref", line);
-+    if (bo->cref <= 0) {
-+        radeon_tracker_remove_track(&bo->bom->tracker, bo->track);
-+        bo->track = NULL;
-+    }
-+#endif
-+    return bo->bom->funcs->bo_unref(bo);
++    return cs->csm->funcs->cs_end(cs, file, func, line);
 +}
 +
-+static inline int _radeon_bo_map(struct radeon_bo *bo,
-+                                 int write,
-+                                 const char *file,
-+                                 const char *func,
-+                                 int line)
++static inline int radeon_cs_emit(struct radeon_cs *cs)
 +{
-+    return bo->bom->funcs->bo_map(bo, write);
++    return cs->csm->funcs->cs_emit(cs);
 +}
 +
-+static inline int _radeon_bo_unmap(struct radeon_bo *bo,
-+                                   const char *file,
-+                                   const char *func,
-+                                   int line)
++static inline int radeon_cs_destroy(struct radeon_cs *cs)
 +{
-+    return bo->bom->funcs->bo_unmap(bo);
++    return cs->csm->funcs->cs_destroy(cs);
 +}
 +
-+static inline int _radeon_bo_wait(struct radeon_bo *bo,
-+                                  const char *file,
-+                                  const char *func,
-+                                  int line)
++static inline int radeon_cs_erase(struct radeon_cs *cs)
 +{
-+    return bo->bom->funcs->bo_wait(bo);
++    return cs->csm->funcs->cs_erase(cs);
 +}
 +
-+#define radeon_bo_open(bom, h, s, a, d, f)\
-+    _radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_ref(bo)\
-+    _radeon_bo_ref(bo, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_unref(bo)\
-+    _radeon_bo_unref(bo, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_map(bo, w)\
-+    _radeon_bo_map(bo, w, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_unmap(bo)\
-+    _radeon_bo_unmap(bo, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_debug(bo, opcode)\
-+    _radeon_bo_debug(bo, opcode, __FILE__, __FUNCTION__, __LINE__)
-+#define radeon_bo_wait(bo) \
-+    _radeon_bo_wait(bo, __FILE__, __func__, __LINE__)
++static inline int radeon_cs_need_flush(struct radeon_cs *cs)
++{
++    return cs->csm->funcs->cs_need_flush(cs);
++}
++
++static inline void radeon_cs_print(struct radeon_cs *cs, FILE *file)
++{
++    cs->csm->funcs->cs_print(cs, file);
++}
++
++static inline int radeon_cs_space_check(struct radeon_cs *cs,
++					    struct radeon_cs_space_check *bos,
++					    int num_bo)
++{
++    return cs->csm->funcs->cs_space_check(cs, bos, num_bo);
++}
++
++static inline void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
++{
++    
++    if (domain == RADEON_GEM_DOMAIN_VRAM)
++	cs->csm->vram_limit = limit;
++    else
++	cs->csm->gart_limit = limit;
++}
++
++static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
++{
++    cs->packets[cs->cdw++] = dword;
++    if (cs->section) {
++        cs->section_cdw++;
++    }
++}
++
++static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
++{
++    memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
++    cs->cdw += 2;
++    if (cs->section) {
++        cs->section_cdw += 2;
++    }
++}
 +
 +#endif
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_cs_gem.c
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_cs_gem.c	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,537 @@
+diff --git a/libdrm/radeon/radeon_cs_gem.c b/libdrm/radeon/radeon_cs_gem.c
+new file mode 100644
+index 0000000..b9f6f4b
+--- /dev/null
++++ b/libdrm/radeon/radeon_cs_gem.c
+@@ -0,0 +1,544 @@
 +/* 
 + * Copyright © 2008 Jérôme Glisse
 + * All Rights Reserved.
@@ -582,6 +823,7 @@
 + *      Nicolai Haehnle <prefect_ at gmx.net>
 + *      Jérôme Glisse <glisse at freedesktop.org>
 + */
++#include <assert.h>
 +#include <errno.h>
 +#include <stdlib.h>
 +#include <sys/mman.h>
@@ -670,6 +912,8 @@
 +    uint32_t idx;
 +    unsigned i;
 +
++    assert(bo->space_accounted);
++
 +    /* check domains */
 +    if ((read_domain && write_domain) || (!read_domain && !write_domain)) {
 +        /* in one CS a bo can only be in read or write domain but not
@@ -822,8 +1066,9 @@
 +    r = drmCommandWriteRead(cs->csm->fd, DRM_RADEON_CS,
 +                            &csg->cs, sizeof(struct drm_radeon_cs));
 +    for (i = 0; i < csg->base.crelocs; i++) {
-+        radeon_bo_unref(csg->relocs_bo[i]);
-+        csg->relocs_bo[i] = NULL;
++	    csg->relocs_bo[i]->space_accounted = 0;
++	    radeon_bo_unref(csg->relocs_bo[i]);
++	    csg->relocs_bo[i] = NULL;
 +    }
 +
 +    cs->csm->read_used = 0;
@@ -988,11 +1233,14 @@
 +      write_domain = bos[i].write_domain;
 +		
 +      /* already accounted this bo */
-+      if (write_domain && (write_domain == bo->space_accounted))
-+	  continue;
-+
-+      if (read_domains && ((read_domains << 16) == bo->space_accounted))
-+	  continue;
++      if (write_domain && (write_domain == bo->space_accounted)) {
++	      bos[i].new_accounted = bo->space_accounted;
++	      continue;
++      }
++      if (read_domains && ((read_domains << 16) == bo->space_accounted)) {
++	      bos[i].new_accounted = bo->space_accounted;
++	      continue;
++      }
 +      
 +      if (bo->space_accounted == 0) {
 +	  if (write_domain == RADEON_GEM_DOMAIN_VRAM)
@@ -1029,32 +1277,32 @@
 +	      return RADEON_CS_SPACE_FLUSH;
 +	  }
 +      }
-+	}
++    }
 +	
-+	if (this_op_read < 0)
-+		this_op_read = 0;
++    if (this_op_read < 0)
++	    this_op_read = 0;
 +
-+	/* check sizes - operation first */
-+	if ((this_op_read + this_op_gart_write > csm->gart_limit) ||
-+	    (this_op_vram_write > csm->vram_limit)) {
++    /* check sizes - operation first */
++    if ((this_op_read + this_op_gart_write > csm->gart_limit) ||
++	(this_op_vram_write > csm->vram_limit)) {
 +	    return RADEON_CS_SPACE_OP_TO_BIG;
-+	}
-+
-+	if (((csm->vram_write_used + this_op_vram_write) > csm->vram_limit) ||
-+	    ((csm->read_used + csm->gart_write_used + this_op_gart_write + this_op_read) > csm->gart_limit)) {
-+		return RADEON_CS_SPACE_FLUSH;
-+	}
-+
-+	csm->gart_write_used += this_op_gart_write;
-+	csm->vram_write_used += this_op_vram_write;
-+	csm->read_used += this_op_read;
-+	/* commit */
-+	for (i = 0; i < num_bo; i++) {
-+		bo = bos[i].bo;
-+		bo->space_accounted = bos[i].new_accounted;
-+	}
-+
-+	return RADEON_CS_SPACE_OK;
++    }
++    
++    if (((csm->vram_write_used + this_op_vram_write) > csm->vram_limit) ||
++	((csm->read_used + csm->gart_write_used + this_op_gart_write + this_op_read) > csm->gart_limit)) {
++	    return RADEON_CS_SPACE_FLUSH;
++    }
++    
++    csm->gart_write_used += this_op_gart_write;
++    csm->vram_write_used += this_op_vram_write;
++    csm->read_used += this_op_read;
++    /* commit */
++    for (i = 0; i < num_bo; i++) {
++	    bo = bos[i].bo;
++	    bo->space_accounted = bos[i].new_accounted;
++    }
++    
++    return RADEON_CS_SPACE_OK;
 +}
 +
 +static struct radeon_cs_funcs radeon_cs_gem_funcs = {
@@ -1088,9 +1336,11 @@
 +{
 +    free(csm);
 +}
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_cs_gem.h
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_cs_gem.h	2009-02-18 09:27:49.000000000 +1000
+diff --git a/libdrm/radeon/radeon_cs_gem.h b/libdrm/radeon/radeon_cs_gem.h
+new file mode 100644
+index 0000000..5efd146
+--- /dev/null
++++ b/libdrm/radeon/radeon_cs_gem.h
 @@ -0,0 +1,41 @@
 +/* 
 + * Copyright © 2008 Nicolai Haehnle
@@ -1133,221 +1383,11 @@
 +void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm);
 +
 +#endif
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_cs.h
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_cs.h	2009-02-18 09:27:49.000000000 +1000
-@@ -0,0 +1,208 @@
-+/* 
-+ * Copyright © 2008 Nicolai Haehnle
-+ * Copyright © 2008 Jérôme Glisse
-+ * 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
-+ * THE COPYRIGHT HOLDERS, AUTHORS 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.
-+ *
-+ * The above copyright notice and this permission notice (including the
-+ * next paragraph) shall be included in all copies or substantial portions
-+ * of the Software.
-+ */
-+/*
-+ * Authors:
-+ *      Aapo Tahkola <aet at rasterburn.org>
-+ *      Nicolai Haehnle <prefect_ at gmx.net>
-+ *      Jérôme Glisse <glisse at freedesktop.org>
-+ */
-+#ifndef RADEON_CS_H
-+#define RADEON_CS_H
-+
-+#include <stdint.h>
-+#include <string.h>
-+#include "drm.h"
-+#include "radeon_drm.h"
-+#include "radeon_bo.h"
-+
-+struct radeon_cs_reloc {
-+    struct radeon_bo    *bo;
-+    uint32_t            read_domain;
-+    uint32_t            write_domain;
-+    uint32_t            flags;
-+};
-+
-+
-+#define RADEON_CS_SPACE_OK 0
-+#define RADEON_CS_SPACE_OP_TO_BIG 1
-+#define RADEON_CS_SPACE_FLUSH 2
-+
-+struct radeon_cs_space_check {
-+    struct radeon_bo *bo;
-+    uint32_t read_domains;
-+    uint32_t write_domain;
-+    uint32_t new_accounted;
-+};
-+
-+struct radeon_cs_manager;
-+
-+struct radeon_cs {
-+    struct radeon_cs_manager    *csm;
-+    void                        *relocs;
-+    uint32_t                    *packets;
-+    unsigned                    crelocs;
-+    unsigned                    relocs_total_size;
-+    unsigned                    cdw;
-+    unsigned                    ndw;
-+    int                         section;
-+    unsigned                    section_ndw;
-+    unsigned                    section_cdw;
-+    const char                  *section_file;
-+    const char                  *section_func;
-+    int                         section_line;
-+
-+};
-+
-+/* cs functions */
-+struct radeon_cs_funcs {
-+    struct radeon_cs *(*cs_create)(struct radeon_cs_manager *csm,
-+                                   uint32_t ndw);
-+    int (*cs_write_reloc)(struct radeon_cs *cs,
-+                          struct radeon_bo *bo,
-+                          uint32_t read_domain,
-+                          uint32_t write_domain,
-+                          uint32_t flags);
-+    int (*cs_begin)(struct radeon_cs *cs,
-+                    uint32_t ndw,
-+                    const char *file,
-+                    const char *func,
-+                    int line);
-+    int (*cs_end)(struct radeon_cs *cs,
-+                  const char *file,
-+                  const char *func,
-+                  int line);
-+    int (*cs_emit)(struct radeon_cs *cs);
-+    int (*cs_destroy)(struct radeon_cs *cs);
-+    int (*cs_erase)(struct radeon_cs *cs);
-+    int (*cs_need_flush)(struct radeon_cs *cs);
-+    void (*cs_print)(struct radeon_cs *cs, FILE *file);
-+    int (*cs_space_check)(struct radeon_cs *cs, struct radeon_cs_space_check *bos,
-+			  int num_bo);
-+};
-+
-+struct radeon_cs_manager {
-+    struct radeon_cs_funcs  *funcs;
-+    int                     fd;
-+    uint32_t vram_limit, gart_limit;
-+    uint32_t vram_write_used, gart_write_used;
-+    uint32_t read_used;
-+};
-+
-+static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
-+                                                 uint32_t ndw)
-+{
-+    return csm->funcs->cs_create(csm, ndw);
-+}
-+
-+static inline int radeon_cs_write_reloc(struct radeon_cs *cs,
-+                                        struct radeon_bo *bo,
-+                                        uint32_t read_domain,
-+                                        uint32_t write_domain,
-+                                        uint32_t flags)
-+{
-+    return cs->csm->funcs->cs_write_reloc(cs,
-+                                          bo,
-+                                          read_domain,
-+                                          write_domain,
-+                                          flags);
-+}
-+
-+static inline int radeon_cs_begin(struct radeon_cs *cs,
-+                                  uint32_t ndw,
-+                                  const char *file,
-+                                  const char *func,
-+                                  int line)
-+{
-+    return cs->csm->funcs->cs_begin(cs, ndw, file, func, line);
-+}
-+
-+static inline int radeon_cs_end(struct radeon_cs *cs,
-+                                const char *file,
-+                                const char *func,
-+                                int line)
-+{
-+    return cs->csm->funcs->cs_end(cs, file, func, line);
-+}
-+
-+static inline int radeon_cs_emit(struct radeon_cs *cs)
-+{
-+    return cs->csm->funcs->cs_emit(cs);
-+}
-+
-+static inline int radeon_cs_destroy(struct radeon_cs *cs)
-+{
-+    return cs->csm->funcs->cs_destroy(cs);
-+}
-+
-+static inline int radeon_cs_erase(struct radeon_cs *cs)
-+{
-+    return cs->csm->funcs->cs_erase(cs);
-+}
-+
-+static inline int radeon_cs_need_flush(struct radeon_cs *cs)
-+{
-+    return cs->csm->funcs->cs_need_flush(cs);
-+}
-+
-+static inline void radeon_cs_print(struct radeon_cs *cs, FILE *file)
-+{
-+    cs->csm->funcs->cs_print(cs, file);
-+}
-+
-+static inline int radeon_cs_space_check(struct radeon_cs *cs,
-+					    struct radeon_cs_space_check *bos,
-+					    int num_bo)
-+{
-+    return cs->csm->funcs->cs_space_check(cs, bos, num_bo);
-+}
-+
-+static inline void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
-+{
-+    
-+    if (domain == RADEON_GEM_DOMAIN_VRAM)
-+	cs->csm->vram_limit = limit;
-+    else
-+	cs->csm->gart_limit = limit;
-+}
-+
-+static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
-+{
-+    cs->packets[cs->cdw++] = dword;
-+    if (cs->section) {
-+        cs->section_cdw++;
-+    }
-+}
-+
-+static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
-+{
-+    memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
-+    cs->cdw += 2;
-+    if (cs->section) {
-+        cs->section_cdw += 2;
-+    }
-+}
-+
-+#endif
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_track.c
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_track.c	2009-02-18 09:27:49.000000000 +1000
+diff --git a/libdrm/radeon/radeon_track.c b/libdrm/radeon/radeon_track.c
+new file mode 100644
+index 0000000..1623906
+--- /dev/null
++++ b/libdrm/radeon/radeon_track.c
 @@ -0,0 +1,140 @@
 +/* 
 + * Copyright © 2008 Jérôme Glisse
@@ -1489,9 +1529,11 @@
 +        free(tmp);
 +    }
 +}
-diff -up /dev/null libdrm-2.4.4/libdrm/radeon/radeon_track.h
---- /dev/null	2009-02-17 18:26:02.221005894 +1000
-+++ libdrm-2.4.4/libdrm/radeon/radeon_track.h	2009-02-18 09:27:49.000000000 +1000
+diff --git a/libdrm/radeon/radeon_track.h b/libdrm/radeon/radeon_track.h
+new file mode 100644
+index 0000000..838d1f3
+--- /dev/null
++++ b/libdrm/radeon/radeon_track.h
 @@ -0,0 +1,64 @@
 +/* 
 + * Copyright © 2008 Jérôme Glisse
@@ -1557,48 +1599,28 @@
 +                          FILE *file);
 +
 +#endif
-diff -up libdrm-2.4.4/shared-core/radeon_drm.h.radeon libdrm-2.4.4/shared-core/radeon_drm.h
---- libdrm-2.4.4/shared-core/radeon_drm.h.radeon	2008-10-10 05:02:11.000000000 +1000
-+++ libdrm-2.4.4/shared-core/radeon_drm.h	2009-02-18 09:27:49.000000000 +1000
-@@ -453,8 +453,18 @@ typedef struct {
- 	int pfCurrentPage;	/* which buffer is being displayed? */
- 	int crtc2_base;		/* CRTC2 frame offset */
- 	int tiling_enabled;	/* set by drm, read by 2d + 3d clients */
-+
-+	unsigned int last_fence;
-+
-+	uint32_t front_handle;
-+	uint32_t back_handle;
-+	uint32_t depth_handle;
-+	uint32_t front_pitch;
-+	uint32_t back_pitch;
-+	uint32_t depth_pitch;
- } drm_radeon_sarea_t;
- 
-+
- /* WARNING: If you change any of these defines, make sure to change the
-  * defines in the Xserver file (xf86drmRadeon.h)
-  *
-@@ -493,6 +503,18 @@ typedef struct {
+diff --git a/shared-core/radeon_drm.h b/shared-core/radeon_drm.h
+index ffaa46e..e9f2afa 100644
+--- a/shared-core/radeon_drm.h
++++ b/shared-core/radeon_drm.h
+@@ -492,6 +492,16 @@ typedef struct {
+ #define DRM_RADEON_SETPARAM   0x19
  #define DRM_RADEON_SURF_ALLOC 0x1a
  #define DRM_RADEON_SURF_FREE  0x1b
++/* KMS ioctl */
++#define DRM_RADEON_GEM_INFO		0x1c
++#define DRM_RADEON_GEM_CREATE		0x1d
++#define DRM_RADEON_GEM_MMAP		0x1e
++#define DRM_RADEON_GEM_PREAD		0x21
++#define DRM_RADEON_GEM_PWRITE		0x22
++#define DRM_RADEON_GEM_SET_DOMAIN	0x23
++#define DRM_RADEON_GEM_WAIT_IDLE	0x24
++#define DRM_RADEON_CS			0x26
++#define DRM_RADEON_INFO			0x27
  
-+#define DRM_RADEON_GEM_INFO   0x1c
-+#define DRM_RADEON_GEM_CREATE 0x1d
-+#define DRM_RADEON_GEM_MMAP   0x1e
-+#define DRM_RADEON_GEM_PIN    0x1f
-+#define DRM_RADEON_GEM_UNPIN  0x20
-+#define DRM_RADEON_GEM_PREAD  0x21
-+#define DRM_RADEON_GEM_PWRITE 0x22
-+#define DRM_RADEON_GEM_SET_DOMAIN 0x23
-+#define DRM_RADEON_GEM_WAIT_RENDERING 0x24
-+
-+#define DRM_RADEON_CS       0x26
-+
  #define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
  #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_START)
- #define DRM_IOCTL_RADEON_CP_STOP    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
-@@ -521,6 +543,17 @@ typedef struct {
+@@ -521,6 +531,17 @@ typedef struct {
  #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
  #define DRM_IOCTL_RADEON_SURF_FREE  DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
  
@@ -1616,82 +1638,71 @@
  typedef struct drm_radeon_init {
  	enum {
  		RADEON_INIT_CP = 0x01,
-@@ -677,6 +710,8 @@ typedef struct drm_radeon_indirect {
+@@ -677,6 +698,7 @@ typedef struct drm_radeon_indirect {
  #define RADEON_PARAM_VBLANK_CRTC           13   /* VBLANK CRTC */
  #define RADEON_PARAM_FB_LOCATION           14   /* FB location */
  #define RADEON_PARAM_NUM_GB_PIPES          15   /* num GB pipes */
-+#define RADEON_PARAM_KERNEL_MM             16
-+#define RADEON_PARAM_DEVICE_ID            17
++#define RADEON_PARAM_DEVICE_ID             16
  
  typedef struct drm_radeon_getparam {
  	int param;
-@@ -732,6 +767,7 @@ typedef struct drm_radeon_setparam {
+@@ -728,7 +750,6 @@ typedef struct drm_radeon_setparam {
+ #define RADEON_SETPARAM_FB_LOCATION    1	/* determined framebuffer location */
+ #define RADEON_SETPARAM_SWITCH_TILING  2	/* enable/disable color tiling */
+ #define RADEON_SETPARAM_PCIGART_LOCATION 3	/* PCI Gart Location */
+-
  #define RADEON_SETPARAM_NEW_MEMMAP 4		/* Use new memory map */
  #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5    /* PCI GART Table Size */
  #define RADEON_SETPARAM_VBLANK_CRTC 6           /* VBLANK CRTC */
-+#define RADEON_SETPARAM_MM_INIT 7		/* Initialise the mm */
- /* 1.14: Clients can allocate/free a surface
-  */
- typedef struct drm_radeon_surface_alloc {
-@@ -747,4 +783,106 @@ typedef struct drm_radeon_surface_free {
+@@ -747,4 +768,112 @@ typedef struct drm_radeon_surface_free {
  #define	DRM_RADEON_VBLANK_CRTC1		1
  #define	DRM_RADEON_VBLANK_CRTC2		2
  
-+#define RADEON_GEM_DOMAIN_CPU 0x1   // Cached CPU domain
-+#define RADEON_GEM_DOMAIN_GTT 0x2   // GTT or cache flushed
-+#define RADEON_GEM_DOMAIN_VRAM 0x4  // VRAM domain
++/*
++ * Kernel modesetting world below.
++ */
++#define RADEON_GEM_DOMAIN_CPU		0x1
++#define RADEON_GEM_DOMAIN_GTT		0x2
++#define RADEON_GEM_DOMAIN_VRAM		0x4
 +
-+/* return to userspace start/size of gtt and vram apertures */
 +struct drm_radeon_gem_info {
-+	uint64_t gart_start;
-+	uint64_t gart_size;
-+	uint64_t vram_start;
-+	uint64_t vram_size;
-+	uint64_t vram_visible;
++	uint64_t	gart_size;
++	uint64_t	vram_size;
++	uint64_t	vram_visible;
 +};
 +
++#define RADEON_GEM_NO_BACKING_STORE 1
++
 +struct drm_radeon_gem_create {
-+	uint64_t size;
-+	uint64_t alignment;
-+	uint32_t handle;
-+	uint32_t initial_domain; // to allow VRAM to be created
-+	uint32_t no_backing_store; // for VRAM objects - select whether they need backing store
-+	// pretty much front/back/depth don't need it - other things do
++	uint64_t	size;
++	uint64_t	alignment;
++	uint32_t	handle;
++	uint32_t	initial_domain;
++	uint32_t	flags;
 +};
 +
 +struct drm_radeon_gem_mmap {
-+	uint32_t handle;
-+	uint32_t pad;
-+	uint64_t offset;
-+	uint64_t size;
-+	uint64_t addr_ptr;
++	uint32_t	handle;
++	uint32_t	pad;
++	uint64_t	offset;
++	uint64_t	size;
++	uint64_t	addr_ptr;
 +};
 +
 +struct drm_radeon_gem_set_domain {
-+	uint32_t handle;
-+	uint32_t read_domains;
-+	uint32_t write_domain;
++	uint32_t	handle;
++	uint32_t		read_domains;
++	uint32_t		write_domain;
 +};
 +
-+struct drm_radeon_gem_wait_rendering {
-+	uint32_t handle;
-+};
-+
-+struct drm_radeon_gem_pin {
-+	uint32_t handle;
-+	uint32_t pin_domain;
-+	uint64_t alignment;
-+	uint64_t offset;
-+};
-+
-+struct drm_radeon_gem_unpin {
-+	uint32_t handle;
-+	uint32_t pad;
++struct drm_radeon_gem_wait_idle {
++	uint32_t	handle;
++	uint32_t	pad;
 +};
 +
 +struct drm_radeon_gem_busy {
-+	uint32_t handle;
-+	uint32_t busy;
++	uint32_t	handle;
++	uint32_t	busy;
 +};
 +
 +struct drm_radeon_gem_pread {
@@ -1703,7 +1714,8 @@
 +	/** Length of data to read */
 +	uint64_t size;
 +	/** Pointer to write the data into. */
-+	uint64_t data_ptr;	/* void *, but pointers are not 32/64 compatible */
++	/* void *, but pointers are not 32/64 compatible */
++	uint64_t data_ptr;
 +};
 +
 +struct drm_radeon_gem_pwrite {
@@ -1715,28 +1727,43 @@
 +	/** Length of data to write */
 +	uint64_t size;
 +	/** Pointer to read the data from. */
-+	uint64_t data_ptr;	/* void *, but pointers are not 32/64 compatible */
++	/* void *, but pointers are not 32/64 compatible */
++	uint64_t data_ptr;
 +};
 +
-+
-+/* New interface which obsolete all previous interface.
-+ */
-+
-+#define RADEON_CHUNK_ID_RELOCS 0x01
-+#define RADEON_CHUNK_ID_IB     0x02
++#define RADEON_CHUNK_ID_RELOCS	0x01
++#define RADEON_CHUNK_ID_IB	0x02
 +
 +struct drm_radeon_cs_chunk {
-+	uint32_t chunk_id;
-+	uint32_t length_dw;
-+	uint64_t chunk_data;
++	uint32_t		chunk_id;
++	uint32_t		length_dw;
++	uint64_t		chunk_data;
 +};
 +
-+struct drm_radeon_cs {
-+	uint32_t	num_chunks;
-+	uint32_t        cs_id;
-+	uint64_t	chunks; /* this points to uint64_t * which point to
-+				   cs chunks */
++struct drm_radeon_cs_reloc {
++	uint32_t		handle;
++	uint32_t		read_domains;
++	uint32_t		write_domain;
++	uint32_t		flags;
 +};
 +
++struct drm_radeon_cs {
++	uint32_t		num_chunks;
++	uint32_t		cs_id;
++	/* this points to uint64_t * which point to cs chunks */
++	uint64_t		chunks;
++	/* updates to the limits after this CS ioctl */
++	uint64_t		gart_limit;
++	uint64_t		vram_limit;
++};
++
++#define RADEON_INFO_DEVICE_ID		0x00
++#define RADEON_INFO_NUM_GB_PIPES	0x01
++
++struct drm_radeon_info {
++	uint32_t		request;
++	uint32_t		pad;
++	uint64_t		value;
++};
 +
  #endif


Index: libdrm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libdrm/devel/libdrm.spec,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- libdrm.spec	26 Mar 2009 20:40:30 -0000	1.68
+++ libdrm.spec	6 Apr 2009 05:41:36 -0000	1.69
@@ -3,7 +3,7 @@
 Summary: Direct Rendering Manager runtime library
 Name: libdrm
 Version: 2.4.5
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://dri.sourceforge.net
@@ -13,6 +13,7 @@
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires: udev
+Requires: kernel >= 2.6.29.1-52.fc11
 
 BuildRequires: pkgconfig automake autoconf libtool
 BuildRequires: kernel-headers >= 2.6.29-0.145.rc6.fc11
@@ -29,7 +30,6 @@
 # 2.4.5 didn't dist nouveau_private.h and nouveau_dma.h, so add them like this
 Patch9: nouveau-missing-headers.patch
 
-Patch10: radeon-bo-name.patch
 # nouveau fixes from drm.git
 Patch11: nouveau-updates.patch
 # intel gtt map fixes
@@ -55,7 +55,6 @@
 %patch4 -p1 -b .no-bc
 %patch8 -p1 -b .radeon
 %patch9 -p1 -b .nouveau
-%patch10 -p1 -b .boname
 %patch11 -p1 -b .nouveau-updates
 %patch12 -p1 -b .intel-gtt
 
@@ -117,6 +116,10 @@
 %{_libdir}/pkgconfig/libdrm_nouveau.pc
 
 %changelog
+* Mon Apr 06 2009 Dave Airlie <airlied at redhat.com<> 2.4.5-4
+- libdrm-radeon: API busting to latest upstream
+- bump kernel requires
+
 * Thu Mar 26 2009 Adam Jackson <ajax at redhat.com> 2.4.5-3
 - libdrm-intel-gtt.patch: Fix GTT maps for intel.
 




More information about the scm-commits mailing list