[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libdrm: Changes to 'debian-unstable'



 ChangeLog                           |  270 +++++++++++++++++++++
 configure.ac                        |   15 -
 debian/changelog                    |    6 
 libdrm/Makefile.am                  |    6 
 libdrm/intel/intel_bufmgr_gem.c     |   82 +++---
 libdrm/nouveau/libdrm_nouveau.pc.in |    2 
 libdrm/nouveau/nouveau_bo.c         |  191 ++++++++++-----
 libdrm/nouveau/nouveau_bo.h         |   22 +
 libdrm/nouveau/nouveau_device.c     |    6 
 libdrm/nouveau/nouveau_device.h     |    2 
 libdrm/nouveau/nouveau_drmif.h      |    3 
 libdrm/nouveau/nouveau_private.h    |    1 
 libdrm/nouveau/nouveau_pushbuf.c    |    4 
 libdrm/nouveau/nouveau_pushbuf.h    |   23 +
 libdrm/radeon/Makefile.am           |   54 ++++
 libdrm/radeon/libdrm_radeon.pc.in   |   10 
 libdrm/radeon/radeon_bo.h           |  187 ++++++++++++++
 libdrm/radeon/radeon_bo_gem.c       |  270 +++++++++++++++++++++
 libdrm/radeon/radeon_bo_gem.h       |   43 +++
 libdrm/radeon/radeon_cs.h           |  237 ++++++++++++++++++
 libdrm/radeon/radeon_cs_gem.c       |  457 ++++++++++++++++++++++++++++++++++++
 libdrm/radeon/radeon_cs_gem.h       |   41 +++
 libdrm/radeon/radeon_cs_space.c     |  234 ++++++++++++++++++
 libdrm/radeon/radeon_track.c        |  140 +++++++++++
 libdrm/radeon/radeon_track.h        |   64 +++++
 libdrm/xf86drm.c                    |   49 +++
 shared-core/drm.h                   |  319 -------------------------
 shared-core/i915_drm.h              |   52 ----
 shared-core/nouveau_drm.h           |   35 +-
 shared-core/radeon_drm.h            |  131 ++++++++++
 tests/modetest/modetest.c           |    2 
 31 files changed, 2452 insertions(+), 506 deletions(-)

New commits:
commit 73a4b518629626d6bfefb2aa1ea6627f7fdcbc36
Author: Brice Goglin <bgoglin@debian.org>
Date:   Tue Jul 21 15:29:09 2009 +0200

    Prepare changelog for upload

diff --git a/debian/changelog b/debian/changelog
index 1d4bd97..7a53ef3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,8 @@
-libdrm (2.4.12-1) UNRELEASED; urgency=low
+libdrm (2.4.12-1) unstable; urgency=low
 
   * New upstream release.
 
- -- Brice Goglin <bgoglin@debian.org>  Tue, 21 Jul 2009 15:28:05 +0200
+ -- Brice Goglin <bgoglin@debian.org>  Tue, 21 Jul 2009 15:29:03 +0200
 
 libdrm (2.4.11-1) unstable; urgency=low
 

commit 492cd21988fb47252108d859a843a622519b84ce
Author: Brice Goglin <bgoglin@debian.org>
Date:   Tue Jul 21 15:28:57 2009 +0200

    New upstream release

diff --git a/ChangeLog b/ChangeLog
index 026de37..4ef5518 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,273 @@
+commit eea95ed8af24300e5a5d2489dfe0d73c24300651
+Author: Eric Anholt <eric@anholt.net>
+Date:   Wed Jul 15 10:04:44 2009 -0700
+
+    Bump to version 2.4.12 for release.
+
+commit 3f3c5be6f908272199ccf53f108b1124bfe0a00e
+Author: Eric Anholt <eric@anholt.net>
+Date:   Thu Jul 9 17:49:46 2009 -0700
+
+    intel: Free buffers in the BO cache that haven't been reused in a while.
+    
+    The goal of the BO cache is to keep buffers on hand for fast continuous use,
+    as in every frame of a game or every batchbuffer of the X Server.  Keeping
+    older buffers on hand not only doesn't serve this purpose, it may hurt
+    performance by resulting in disk cache getting kicked out, or even driving
+    the system to swap.
+    
+    Bug #20766.
+
+commit 80179df5f85a2fd39b2544f1b7aae61102800f0f
+Author: Dave Airlie <airlied@linux.ie>
+Date:   Fri Jul 10 02:38:13 2009 +1000
+
+    configure: move AC_USE_SYSTEM_EXTENSIONS up higher
+    
+    this was giving me a warning on automake 1.11
+
+commit f257201c11fd1aff9319aaf47556b184141ac7cb
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Thu Jul 9 11:41:47 2009 +1000
+
+    nouveau: fix pin for buffers created with bo_wrap
+
+commit 4179c5f0a69b452cf94a507c13021e4918a3e02d
+Author: Ian Romanick <ian.d.romanick@intel.com>
+Date:   Mon Jul 6 15:36:20 2009 -0700
+
+    s/AC_USE_SYSTEM_MACROS/AC_USE_SYSTEM_EXTENSIONS/
+    
+    Not sure what I was thinking.
+
+commit c5a5bbbe899400642795c1d95aef78deade9241f
+Author: Pauli Nieminen <suokkos@gmail.com>
+Date:   Mon Jul 6 23:37:20 2009 +0300
+
+    libdrm: Make chown check for return value
+    
+    If call was interrupted by signal we have to make call again.
+    
+    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
+
+commit a953b3270cef52dd2de70cc6aa08687af9d57815
+Author: Ian Romanick <ian.d.romanick@intel.com>
+Date:   Mon Jul 6 13:23:46 2009 -0700
+
+    libdrm: Set _XOPEN_SOURCE and _GNU_SOURCE
+    
+    Several POSIX extensions are used in the libdrm code (e.g., mknod and ffs).
+    Set _XOPEN_SOURCE and _GNU_SOURCE to something reasonable to ensure that
+    prototypes for these functions are available.  This is done in configure.ac
+    using AC_USE_SYSTEM_MACROS.  This requires autoconf 2.60 or later.  Eventually
+    the code should check for the existance of these defines and do something
+    reasonable if they are not available.
+    
+    Inspired by a patch by Pauli Nieminen and suggestions from Julien Cristau.
+    Thanks.
+    
+    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
+
+commit 78fa590a1d297f2e2fea98bd3f0cbf4cdb1e3a08
+Author: Eric Anholt <eric@anholt.net>
+Date:   Mon Jul 6 11:55:28 2009 -0700
+
+    intel: Fix up math errors when allocating very large BOs.
+    
+    The logbase2 would overflow and wrap the size around to 0, making the code
+    allocate a 4kb object instead.  By simplifying the code to just walk the
+    14-entry bucket array comparing sizes instead of indexing on
+    ffs(1 << logbase2(size)), we avoid silly math errors and have code of
+    approximately the same speed.
+    
+    Many thanks to Simon Farnsworth for debugging and providing a working patch.
+    Bug #27365.
+
+commit cea2d29ee49f23d560f0088a1a3dd01932a1eaf4
+Author: Edward O'Callaghan <eocallaghan@auroraux.org>
+Date:   Thu Jul 2 11:03:48 2009 -0700
+
+    intel: fix compiler warning about returning a void value.
+    
+    bug #21999
+
+commit 90ae0f2bb8d53500f5c9d06e2dc1a18d5a5d0cf5
+Author: Pauli Nieminen <suokkos@gmail.com>
+Date:   Sat Jul 4 02:18:51 2009 +0300
+
+    libdrm: Fix pci id numbers to unsigned so code won't mix signed/unsigned integers.
+
+commit 015efd1bfa72ab8b80cc45f11eb22d7f1a1085f7
+Author: Ian Romanick <ian.d.romanick@intel.com>
+Date:   Mon Jul 6 09:23:59 2009 -0700
+
+    strcasecmp is in strings.h.
+    
+    Based on patch by Pauli Nieminen.  Thanks.
+
+commit 3dda0050f16ddb4a64e66c80aebecea5383c72f1
+Author: Pauli Nieminen <suokkos@gmail.com>
+Date:   Sat Jul 4 02:18:49 2009 +0300
+
+    libdrm: Remove typedef for non-existing enum
+
+commit 39970c67b77014caac9a4c3a33765ac7a312b54e
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Jul 6 13:34:24 2009 +1000
+
+    radeon: move cs space checking code to libdrm_radeon.
+    
+    This ports a lot of the space checking code into a the common
+    library, so that the DDX and mesa can use it.
+
+commit 72a29340ea3225550db6b009f4e50c77c7b1f394
+Author: Jerome Glisse <jglisse@redhat.com>
+Date:   Fri Jul 3 15:03:03 2009 +0200
+
+    radeon: fix cs buffer realloc padding
+    
+    We always realloc at least 0x1000 dwords (page on most system)
+    when growing the cs buffer this is to avoid having to realloc
+    at each cs_begin.
+
+commit af90222c4570ca07c6983f60ebe46c35bc980495
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Fri Jul 3 21:13:22 2009 +1000
+
+    radeon: fix realloc of packets.
+    
+    This should use ndw not cdw, using cdw leads to realloc alignment going wrong
+
+commit fbac5891b91c795de61f4d7cbc1a6799474364ad
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Thu Jul 2 15:42:01 2009 +1000
+
+    radeon: add buffer naming function
+
+commit de1ed01214874dcdd6116ff2587c8710d6ed4d2d
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Tue Jun 30 12:19:28 2009 +1000
+
+    radeon: add support for write followed by read relocs.
+    
+    the DDX does this and used to handle it internally
+
+commit 790097c51330090b2b7b90429b9ab8ddf259fd8e
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Tue Jun 23 09:51:05 2009 +1000
+
+    remove some old ttm bits
+
+commit 9a33f62be1c478334572ea9384af60c37d1644a0
+Author: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
+Date:   Mon Jun 22 23:07:26 2009 +0200
+
+    drm: Strip old ttm.
+    
+    Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
+
+commit 81644198aeced288d26e17fadd8e5eb19798352f
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date:   Mon Jun 22 12:27:49 2009 -0700
+
+    modetest: use gtt unmap for object
+    
+    Match gtt map/unmap for correctness.
+
+commit 2fa2db138ba989bfa1a8cd9ab66d83fb7369249e
+Author: Dave Airlie <airlied@linux.ie>
+Date:   Wed Jun 17 17:47:42 2009 +1000
+
+    libdrm/radeon: add initial libdrm_radeon
+    
+    requires --enable-radeon-experimental-api for now
+
+commit 3d4bfe8c893d016ef43d1ebf28e4607aa1f540a4
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Wed Jun 3 13:54:43 2009 +1000
+
+    nouveau: 0.0.14 + extend bo interface to support subrange mapping
+    
+    Normal map() should operate as before, and map_range()/map_flush() should
+    give correct results but lacking any performance difference from map().
+    
+    Nothing exiting being done here yet, but the interface is a good start.
+
+commit 2cb4c64d7310904b354365c2cbc263211e9eb4a1
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Thu Jun 4 08:59:53 2009 +1000
+
+    nouveau: fix bo mapping issue
+
+commit d7c42ff4c445ed2cb23f4eb3a45858c110184773
+Author: Pekka Paalanen <pq@iki.fi>
+Date:   Wed Jun 3 22:26:43 2009 +0300
+
+    Fix build on kernels < 2.6.26
+    
+    The commit 651e3dc6dd58a79c90db7513ee2fb28360a4560d, "drm: Fix
+    compilation on 2.6.30" broke all builds on kernels before 2.6.26.
+    Variadic functions cannot be inlined.
+    
+    The variadic inline function is replaced with a variadic macro.
+    
+    Also, the function dev_name() added by that same commit is never used,
+    so it is removed.
+    
+    Signed-off-by: Pekka Paalanen <pq@iki.fi>
+
+commit 00fae87f96e1fc5198311feec81866bf9c53d0e1
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Wed Jun 3 10:24:30 2009 +1000
+
+    nouveau: fill in bo->tiled field for referenced buffers
+    
+    Fixes the dri1 gallium driver if the front buffer happens to be non-linear.
+
+commit dbffeadcfca7cb4e3905ec0b8573d10e0418295e
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Tue Jun 2 17:06:34 2009 +1000
+
+    nv50: magic fix for "3d busted without the binary driver first" issue
+    
+    No idea what this reg does.. NVIDIA put 0x802 into it on some chips, the
+    criteria aren't too clear on when they do that however.  Hopefully 0x800
+    will work everywhere...
+
+commit 651e3dc6dd58a79c90db7513ee2fb28360a4560d
+Author: Michael Buesch <mb@bu3sch.de>
+Date:   Mon May 11 00:21:14 2009 +0200
+
+    drm: Fix compilation on 2.6.30
+    
+    This fixes DRM compilation of nouveau.ko on kernel 2.6.30.
+    
+    Signed-off-by: Michael Buesch <mb@bu3sch.de>
+
+commit c65a343ed29c24f812ca919f40dfeee948b6f14a
+Author: Ben Skeggs <bskeggs@redhat.com>
+Date:   Tue May 26 14:14:04 2009 +1000
+
+    nouveau: bump for 0.0.13
+
+commit 85b9f737db0d2a845e4d7e2bbf9ad12ff9e2227c
+Author: Danny Tholen <moondrake@gmail.com>
+Date:   Thu May 7 00:11:34 2009 +0100
+
+    nouveau: backlight support for ppc laptops
+    
+    Patch allows the backlight to be manipulated under gnome on apple powerpc
+    based NV30 machines.  It works fine on my powerbook, and should also work
+    for older NV17/NV18 machines.
+    
+    Note that older powerpc specific tools (pbbuttonsd) have some problems with
+    this implementation (because the device is not yet there at the start time
+    of the daemon, and the code makes incorrect assumptions about the max
+    brightness values). However, IMHO these things can and should be addressed
+    in the daemon.
+    
+    Some style/warning fixes applied by Stuart Bennett <stuart@freedesktop.org>
+
 commit f355ad89431c49355e626613e6fc29ef2e183dab
 Author: Eric Anholt <eric@anholt.net>
 Date:   Tue May 19 10:07:16 2009 -0700
diff --git a/debian/changelog b/debian/changelog
index f3d87a5..1d4bd97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libdrm (2.4.12-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Brice Goglin <bgoglin@debian.org>  Tue, 21 Jul 2009 15:28:05 +0200
+
 libdrm (2.4.11-1) unstable; urgency=low
 
   * New upstream release.

commit eea95ed8af24300e5a5d2489dfe0d73c24300651
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Jul 15 10:04:44 2009 -0700

    Bump to version 2.4.12 for release.

diff --git a/configure.ac b/configure.ac
index 1db781c..0794a2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 AC_PREREQ(2.60)
-AC_INIT([libdrm], 2.4.11, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.12, [dri-devel@lists.sourceforge.net], libdrm)
 AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])

commit 3f3c5be6f908272199ccf53f108b1124bfe0a00e
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jul 9 17:49:46 2009 -0700

    intel: Free buffers in the BO cache that haven't been reused in a while.
    
    The goal of the BO cache is to keep buffers on hand for fast continuous use,
    as in every frame of a game or every batchbuffer of the X Server.  Keeping
    older buffers on hand not only doesn't serve this purpose, it may hurt
    performance by resulting in disk cache getting kicked out, or even driving
    the system to swap.
    
    Bug #20766.

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 70d0c85..737ceae 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -139,6 +139,8 @@ struct _drm_intel_bo_gem {
     uint32_t tiling_mode;
     uint32_t swizzle_mode;
 
+    time_t free_time;
+
     /** Array passed to the DRM containing relocation information. */
     struct drm_i915_gem_relocation_entry *relocs;
     /** Array of bos corresponding to relocs[i].target_handle */
@@ -220,7 +222,6 @@ drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem *bufmgr_gem,
     return NULL;
 }
 
-
 static void drm_intel_gem_dump_validation_list(drm_intel_bufmgr_gem *bufmgr_gem)
 {
     int i, j;
@@ -533,6 +534,30 @@ drm_intel_gem_bo_free(drm_intel_bo *bo)
     free(bo);
 }
 
+/** Frees all cached buffers significantly older than @time. */
+static void
+drm_intel_gem_cleanup_bo_cache(drm_intel_bufmgr_gem *bufmgr_gem, time_t time)
+{
+    int i;
+
+    for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++) {
+	struct drm_intel_gem_bo_bucket *bucket = &bufmgr_gem->cache_bucket[i];
+
+	while (!DRMLISTEMPTY(&bucket->head)) {
+	    drm_intel_bo_gem *bo_gem;
+
+	    bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.next, head);
+	    if (time - bo_gem->free_time <= 1)
+		break;
+
+	    DRMLISTDEL(&bo_gem->head);
+	    bucket->num_entries--;
+
+	    drm_intel_gem_bo_free(&bo_gem->bo);
+	}
+    }
+}
+
 static void
 drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 {
@@ -567,6 +592,11 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 	      bucket->num_entries < bucket->max_entries)) &&
 	    drm_intel_gem_bo_set_tiling(bo, &tiling_mode, 0) == 0)
 	{
+	    struct timespec time;
+
+	    clock_gettime(CLOCK_MONOTONIC, &time);
+	    bo_gem->free_time = time.tv_sec;
+
 	    bo_gem->name = NULL;
 	    bo_gem->validate_index = -1;
 	    bo_gem->relocs = NULL;
@@ -575,6 +605,8 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 
 	    DRMLISTADDTAIL(&bo_gem->head, &bucket->head);
 	    bucket->num_entries++;
+
+	    drm_intel_gem_cleanup_bo_cache(bufmgr_gem, time.tv_sec);
 	} else {
 	    drm_intel_gem_bo_free(bo);
 	}

commit 80179df5f85a2fd39b2544f1b7aae61102800f0f
Author: Dave Airlie <airlied@linux.ie>
Date:   Fri Jul 10 02:38:13 2009 +1000

    configure: move AC_USE_SYSTEM_EXTENSIONS up higher
    
    this was giving me a warning on automake 1.11

diff --git a/configure.ac b/configure.ac
index d747fe2..1db781c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@
 
 AC_PREREQ(2.60)
 AC_INIT([libdrm], 2.4.11, [dri-devel@lists.sourceforge.net], libdrm)
+AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 
@@ -31,7 +32,6 @@ AC_PROG_CC
 
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
-AC_USE_SYSTEM_EXTENSIONS
 
 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
 AC_SUBST(PTHREADSTUBS_CFLAGS)

commit f257201c11fd1aff9319aaf47556b184141ac7cb
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Thu Jul 9 11:41:47 2009 +1000

    nouveau: fix pin for buffers created with bo_wrap

diff --git a/libdrm/nouveau/nouveau_bo.c b/libdrm/nouveau/nouveau_bo.c
index e68533b..fea3a7d 100644
--- a/libdrm/nouveau/nouveau_bo.c
+++ b/libdrm/nouveau/nouveau_bo.c
@@ -752,11 +752,13 @@ nouveau_bo_pin(struct nouveau_bo *bo, uint32_t flags)
 		return nouveau_bo_pin_nomm(bo, flags);
 
 	/* Ensure we have a kernel object... */
-	if (!nvbo->handle) {
+	if (!nvbo->flags) {
 		if (!(flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)))
 			return -EINVAL;
 		nvbo->flags = flags;
+	}
 
+	if (!nvbo->handle) {
 		ret = nouveau_bo_kalloc(nvbo, NULL);
 		if (ret)
 			return ret;

commit 4179c5f0a69b452cf94a507c13021e4918a3e02d
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Jul 6 15:36:20 2009 -0700

    s/AC_USE_SYSTEM_MACROS/AC_USE_SYSTEM_EXTENSIONS/
    
    Not sure what I was thinking.

diff --git a/configure.ac b/configure.ac
index 1c20398..d747fe2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AC_PROG_CC
 
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
-AC_USE_SYSTEM_MACROS
+AC_USE_SYSTEM_EXTENSIONS
 
 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
 AC_SUBST(PTHREADSTUBS_CFLAGS)

commit c5a5bbbe899400642795c1d95aef78deade9241f
Author: Pauli Nieminen <suokkos@gmail.com>
Date:   Mon Jul 6 23:37:20 2009 +0300

    libdrm: Make chown check for return value
    
    If call was interrupted by signal we have to make call again.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 1a5cee4..26dd812 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -270,6 +270,36 @@ static int drmMatchBusID(const char *id1, const char *id2)
 }
 
 /**
+ * Handles error checking for chown call.
+ *
+ * \param path to file.
+ * \param id of the new owner.
+ * \param id of the new group.
+ *
+ * \return zero if success or -1 if failure.
+ *
+ * \internal
+ * Checks for failure. If failure was caused by signal call chown again.
+ * If any other failure happened then it will output error mesage using
+ * drmMsg() call.
+ */
+static int chown_check_return(const char *path, uid_t owner, gid_t group)
+{
+	int rv;
+
+	do {
+		rv = chown(path, owner, group);
+	} while (rv != 0 && errno == EINTR);
+
+	if (rv == 0)
+		return 0;
+
+	drmMsg("Failed to change owner or group for file %s! %d: %s\n",
+			path, errno, strerror(errno));
+	return -1;
+}
+
+/**
  * Open the DRM device, creating it if necessary.
  *
  * \param dev major and minor numbers of the device.
@@ -307,7 +337,7 @@ static int drmOpenDevice(long dev, int minor, int type)
 	if (!isroot)
 	    return DRM_ERR_NOT_ROOT;
 	mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE);
-	chown(DRM_DIR_NAME, 0, 0); /* root:root */
+	chown_check_return(DRM_DIR_NAME, 0, 0); /* root:root */
 	chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE);
     }
 
@@ -320,7 +350,7 @@ static int drmOpenDevice(long dev, int minor, int type)
     }
 
     if (drm_server_info) {
-	chown(buf, user, group);
+	chown_check_return(buf, user, group);
 	chmod(buf, devmode);
     }
 #else
@@ -363,7 +393,7 @@ wait_for_udev:
 	remove(buf);
 	mknod(buf, S_IFCHR | devmode, dev);
 	if (drm_server_info) {
-	    chown(buf, user, group);
+	    chown_check_return(buf, user, group);
 	    chmod(buf, devmode);
 	}
     }

commit a953b3270cef52dd2de70cc6aa08687af9d57815
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Jul 6 13:23:46 2009 -0700

    libdrm: Set _XOPEN_SOURCE and _GNU_SOURCE
    
    Several POSIX extensions are used in the libdrm code (e.g., mknod and ffs).
    Set _XOPEN_SOURCE and _GNU_SOURCE to something reasonable to ensure that
    prototypes for these functions are available.  This is done in configure.ac
    using AC_USE_SYSTEM_MACROS.  This requires autoconf 2.60 or later.  Eventually
    the code should check for the existance of these defines and do something
    reasonable if they are not available.
    
    Inspired by a patch by Pauli Nieminen and suggestions from Julien Cristau.
    Thanks.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/configure.ac b/configure.ac
index be2fbbf..1c20398 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@
 #  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.
 
-AC_PREREQ(2.57)
+AC_PREREQ(2.60)
 AC_INIT([libdrm], 2.4.11, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
@@ -31,6 +31,7 @@ AC_PROG_CC
 
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
+AC_USE_SYSTEM_MACROS
 
 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
 AC_SUBST(PTHREADSTUBS_CFLAGS)
@@ -145,7 +146,6 @@ if test "x$HAVE_LIBUDEV" = xyes; then
 fi
 AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
 
-
 AC_SUBST(WARN_CFLAGS)
 AC_OUTPUT([
 	Makefile

commit 78fa590a1d297f2e2fea98bd3f0cbf4cdb1e3a08
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jul 6 11:55:28 2009 -0700

    intel: Fix up math errors when allocating very large BOs.
    
    The logbase2 would overflow and wrap the size around to 0, making the code
    allocate a 4kb object instead.  By simplifying the code to just walk the
    14-entry bucket array comparing sizes instead of indexing on
    ffs(1 << logbase2(size)), we avoid silly math errors and have code of
    approximately the same speed.
    
    Many thanks to Simon Farnsworth for debugging and providing a working patch.
    Bug #27365.

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index e88a6c3..70d0c85 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -78,6 +78,7 @@ struct drm_intel_gem_bo_bucket {
     */
    int max_entries;
    int num_entries;
+   unsigned long size;
 };
 
 /* Only cache objects up to 64MB.  Bigger than that, and the rounding of the
@@ -203,39 +204,20 @@ drm_intel_gem_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
 static void
 drm_intel_gem_bo_unreference(drm_intel_bo *bo);
 
-static int
-logbase2(int n)
-{
-   int i = 1;
-   int log2 = 0;
-
-   while (n > i) {
-      i *= 2;
-      log2++;
-   }
-
-   return log2;
-}
-
 static struct drm_intel_gem_bo_bucket *
 drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem *bufmgr_gem,
 				 unsigned long size)
 {
     int i;
 
-    /* We only do buckets in power of two increments */
-    if ((size & (size - 1)) != 0)
-	return NULL;
-
-    /* We should only see sizes rounded to pages. */
-    assert((size % 4096) == 0);
-
-    /* We always allocate in units of pages */
-    i = ffs(size / 4096) - 1;
-    if (i >= DRM_INTEL_GEM_BO_BUCKETS)
-	return NULL;
+    for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++) {
+	struct drm_intel_gem_bo_bucket *bucket = &bufmgr_gem->cache_bucket[i];
+	if (bucket->size >= size) {
+	    return bucket;
+	}
+    }
 
-    return &bufmgr_gem->cache_bucket[i];
+    return NULL;
 }
 
 
@@ -345,10 +327,7 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, const char *name,
     unsigned long bo_size;
 
     /* Round the allocated size up to a power of two number of pages. */
-    bo_size = 1 << logbase2(size);
-    if (bo_size < page_size)
-	bo_size = page_size;
-    bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, bo_size);
+    bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, size);
 
     /* If we don't have caching at this size, don't actually round the
      * allocation up.
@@ -357,6 +336,8 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, const char *name,
 	bo_size = size;
 	if (bo_size < page_size)
 	    bo_size = page_size;
+    } else {
+	bo_size = bucket->size;
     }
 
     pthread_mutex_lock(&bufmgr_gem->lock);
@@ -1412,6 +1393,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
     struct drm_i915_gem_get_aperture aperture;
     drm_i915_getparam_t gp;
     int ret, i;
+    unsigned long size;
 
     bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
     bufmgr_gem->fd = fd;
@@ -1483,8 +1465,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
     bufmgr_gem->bufmgr.bo_disable_reuse = drm_intel_gem_bo_disable_reuse;
     bufmgr_gem->bufmgr.get_pipe_from_crtc_id = drm_intel_gem_get_pipe_from_crtc_id;
     /* Initialize the linked lists for BO reuse cache. */
-    for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++)
+    for (i = 0, size = 4096; i < DRM_INTEL_GEM_BO_BUCKETS; i++, size *= 2) {
 	DRMINITLISTHEAD(&bufmgr_gem->cache_bucket[i].head);
+	bufmgr_gem->cache_bucket[i].size = size;
+    }
 
     return &bufmgr_gem->bufmgr;
 }

commit cea2d29ee49f23d560f0088a1a3dd01932a1eaf4
Author: Edward O'Callaghan <eocallaghan@auroraux.org>
Date:   Thu Jul 2 11:03:48 2009 -0700

    intel: fix compiler warning about returning a void value.
    
    bug #21999

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index c25fc4c..e88a6c3 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -867,7 +867,7 @@ drm_intel_gem_bo_get_subdata (drm_intel_bo *bo, unsigned long offset,
 static void
 drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
 {
-    return drm_intel_gem_bo_start_gtt_access(bo, 0);
+    drm_intel_gem_bo_start_gtt_access(bo, 0);
 }
 
 /**

commit 90ae0f2bb8d53500f5c9d06e2dc1a18d5a5d0cf5
Author: Pauli Nieminen <suokkos@gmail.com>
Date:   Sat Jul 4 02:18:51 2009 +0300

    libdrm: Fix pci id numbers to unsigned so code won't mix signed/unsigned integers.

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 2b1604b..1a5cee4 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -241,22 +241,22 @@ static int drmMatchBusID(const char *id1, const char *id2)
 
     /* Try to match old/new-style PCI bus IDs. */
     if (strncasecmp(id1, "pci", 3) == 0) {
-	int o1, b1, d1, f1;
-	int o2, b2, d2, f2;
+	unsigned int o1, b1, d1, f1;
+	unsigned int o2, b2, d2, f2;
 	int ret;
 
-	ret = sscanf(id1, "pci:%04x:%02x:%02x.%d", &o1, &b1, &d1, &f1);
+	ret = sscanf(id1, "pci:%04x:%02x:%02x.%u", &o1, &b1, &d1, &f1);
 	if (ret != 4) {
 	    o1 = 0;
-	    ret = sscanf(id1, "PCI:%d:%d:%d", &b1, &d1, &f1);
+	    ret = sscanf(id1, "PCI:%u:%u:%u", &b1, &d1, &f1);
 	    if (ret != 3)
 		return 0;
 	}
 
-	ret = sscanf(id2, "pci:%04x:%02x:%02x.%d", &o2, &b2, &d2, &f2);
+	ret = sscanf(id2, "pci:%04x:%02x:%02x.%u", &o2, &b2, &d2, &f2);
 	if (ret != 4) {
 	    o2 = 0;
-	    ret = sscanf(id2, "PCI:%d:%d:%d", &b2, &d2, &f2);
+	    ret = sscanf(id2, "PCI:%u:%u:%u", &b2, &d2, &f2);
 	    if (ret != 3)
 		return 0;
 	}

commit 015efd1bfa72ab8b80cc45f11eb22d7f1a1085f7
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Jul 6 09:23:59 2009 -0700

    strcasecmp is in strings.h.
    
    Based on patch by Pauli Nieminen.  Thanks.

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 55df19a..2b1604b 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <strings.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>

commit 3dda0050f16ddb4a64e66c80aebecea5383c72f1
Author: Pauli Nieminen <suokkos@gmail.com>
Date:   Sat Jul 4 02:18:49 2009 +0300

    libdrm: Remove typedef for non-existing enum

diff --git a/shared-core/drm.h b/shared-core/drm.h
index 7758af4..42a6c23 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -855,7 +855,6 @@ typedef struct drm_set_version drm_set_version_t;
 typedef struct drm_fence_arg drm_fence_arg_t;
 typedef struct drm_mm_type_arg drm_mm_type_arg_t;
 typedef struct drm_mm_init_arg drm_mm_init_arg_t;
-typedef enum drm_bo_type drm_bo_type_t;
 #endif
 
 #endif

commit 39970c67b77014caac9a4c3a33765ac7a312b54e
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Jul 6 13:34:24 2009 +1000

    radeon: move cs space checking code to libdrm_radeon.
    
    This ports a lot of the space checking code into a the common
    library, so that the DDX and mesa can use it.

diff --git a/libdrm/radeon/Makefile.am b/libdrm/radeon/Makefile.am
index bc8a5b8..bec1beb 100644
--- a/libdrm/radeon/Makefile.am
+++ b/libdrm/radeon/Makefile.am
@@ -37,6 +37,7 @@ libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
 libdrm_radeon_la_SOURCES = \
 	radeon_bo_gem.c \
 	radeon_cs_gem.c \
+	radeon_cs_space.c \
 	radeon_track.c
 
 libdrm_radeonincludedir = ${includedir}/drm
diff --git a/libdrm/radeon/radeon_bo.h b/libdrm/radeon/radeon_bo.h
index 3cabdfc..597d0ef 100644
--- a/libdrm/radeon/radeon_bo.h
+++ b/libdrm/radeon/radeon_bo.h
@@ -68,6 +68,7 @@ struct radeon_bo_funcs {
     int (*bo_map)(struct radeon_bo *bo, int write);
     int (*bo_unmap)(struct radeon_bo *bo);
     int (*bo_wait)(struct radeon_bo *bo);
+    int (*bo_is_static)(struct radeon_bo *bo);
 };
 
 struct radeon_bo_manager {
@@ -161,6 +162,13 @@ static inline int _radeon_bo_wait(struct radeon_bo *bo,
     return bo->bom->funcs->bo_wait(bo);
 }
 
+static inline int radeon_bo_is_static(struct radeon_bo *bo)
+{
+    if (bo->bom->funcs->bo_is_static)
+	return bo->bom->funcs->bo_is_static(bo);
+    return 0;
+}
+
 #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)\
diff --git a/libdrm/radeon/radeon_bo_gem.c b/libdrm/radeon/radeon_bo_gem.c
index 05d4409..558b93a 100644
--- a/libdrm/radeon/radeon_bo_gem.c
+++ b/libdrm/radeon/radeon_bo_gem.c
@@ -204,7 +204,8 @@ static struct radeon_bo_funcs bo_gem_funcs = {
     bo_unref,
     bo_map,
     bo_unmap,
-    bo_wait
+    bo_wait,
+    NULL,
 };
 
 struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
diff --git a/libdrm/radeon/radeon_cs.h b/libdrm/radeon/radeon_cs.h
index d870961..7efec7e 100644
--- a/libdrm/radeon/radeon_cs.h
+++ b/libdrm/radeon/radeon_cs.h
@@ -57,6 +57,8 @@ struct radeon_cs_space_check {
     uint32_t new_accounted;
 };
 
+#define MAX_SPACE_BOS (32)
+
 struct radeon_cs_manager;
 
 struct radeon_cs {
@@ -73,7 +75,10 @@ struct radeon_cs {
     const char                  *section_file;
     const char                  *section_func;
     int                         section_line;
-
+    struct radeon_cs_space_check bos[MAX_SPACE_BOS];
+    int                         bo_count;
+    void                        (*space_flush_fn)(void *);
+    void                        *space_flush_data;
 };
 
 /* cs functions */
@@ -99,16 +104,14 @@ struct radeon_cs_funcs {
     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;
+    int32_t vram_limit, gart_limit;
+    int32_t vram_write_used, gart_write_used;
+    int32_t read_used;
 };
 
 static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
@@ -172,13 +175,6 @@ 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);


Reply to: