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

libdrm: Changes to 'ubuntu'



 ChangeLog                    |  271 +++++++++++++++++++++++++++++++++++++++++++
 configure.ac                 |    2 
 debian/changelog             |   19 +++
 debian/libdrm-intel1.symbols |    2 
 debian/rules                 |    2 
 intel/Makefile.am            |    3 
 intel/intel_bufmgr.c         |    2 
 intel/intel_bufmgr.h         |    2 
 intel/intel_bufmgr_gem.c     |  170 +++++++++++++++++---------
 intel/intel_debug.h          |   44 ++++++
 nouveau/nouveau_device.c     |    4 
 nouveau/nouveau_pushbuf.c    |    3 
 tests/drmtest.c              |   13 +-
 tests/modeprint/modeprint.c  |    7 -
 tests/modetest/modetest.c    |   19 ++-
 tests/vbltest/vbltest.c      |   22 ++-
 xf86drm.h                    |    8 +
 xf86drmMode.c                |    2 
 xf86drmMode.h                |    8 +
 19 files changed, 517 insertions(+), 86 deletions(-)

New commits:
commit a7e4604cb5ac0a306303bc23ec3a8656f12330af
Author: Robert Hooker <sarvatt@ubuntu.com>
Date:   Tue Nov 8 11:36:08 2011 -0500

    Bump changelog.

diff --git a/debian/changelog b/debian/changelog
index 257cb36..7f24a51 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+libdrm (2.4.27-1ubuntu1) precise; urgency=low
+
+  * Merge from Debian unstable, remaining changes:
+    - debian/rules
+    - debian/control:
+      + Build libdrm-intel1 everywhere rather than just {i386,amd64}
+        for Plymouth
+
+ -- Robert Hooker <sarvatt@ubuntu.com>  Tue, 08 Nov 2011 11:33:07 -0500
+
 libdrm (2.4.27-1) unstable; urgency=low
 
   * New upstream release:

commit 8141c4828219490f43317e92796999f77c916c46
Author: Cyril Brulebois <kibi@debian.org>
Date:   Tue Nov 1 19:31:03 2011 +0100

    Upload to unstable.

diff --git a/debian/changelog b/debian/changelog
index f9e6a87..0fa808d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,11 @@
-libdrm (2.4.27-1) UNRELEASED; urgency=low
+libdrm (2.4.27-1) unstable; urgency=low
 
   * New upstream release:
     - Push the new Intel API for use by mesa.
     - Usual bug fixes.
   * Update libdrm-intel1's symbols and shlibs accordingly.
 
- -- Cyril Brulebois <kibi@debian.org>  Tue, 01 Nov 2011 19:16:18 +0100
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 01 Nov 2011 19:30:54 +0100
 
 libdrm (2.4.26-1) unstable; urgency=low
 

commit 3020c976670166b5e2ae9bf24a05a01143429aef
Author: Cyril Brulebois <kibi@debian.org>
Date:   Tue Nov 1 19:30:17 2011 +0100

    Update libdrm-intel1's symbols and shlibs accordingly.

diff --git a/debian/changelog b/debian/changelog
index bb4d957..f9e6a87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ libdrm (2.4.27-1) UNRELEASED; urgency=low
   * New upstream release:
     - Push the new Intel API for use by mesa.
     - Usual bug fixes.
+  * Update libdrm-intel1's symbols and shlibs accordingly.
 
  -- Cyril Brulebois <kibi@debian.org>  Tue, 01 Nov 2011 19:16:18 +0100
 
diff --git a/debian/libdrm-intel1.symbols b/debian/libdrm-intel1.symbols
index c951b6b..7dee621 100644
--- a/debian/libdrm-intel1.symbols
+++ b/debian/libdrm-intel1.symbols
@@ -38,6 +38,8 @@ libdrm_intel.so.1 libdrm-intel1 #MINVER#
  drm_intel_bufmgr_gem_enable_reuse@Base 2.4.1
  drm_intel_bufmgr_gem_init@Base 2.4.1
  drm_intel_bufmgr_set_debug@Base 2.4.1
+ drm_intel_gem_bo_clear_relocs@Base 2.4.27
+ drm_intel_gem_bo_get_reloc_count@Base 2.4.27
  drm_intel_gem_bo_map_gtt@Base 2.4.3
  drm_intel_gem_bo_start_gtt_access@Base 2.4.3
  drm_intel_gem_bo_unmap_gtt@Base 2.4.9
diff --git a/debian/rules b/debian/rules
index 6ccb6a8..5257452 100755
--- a/debian/rules
+++ b/debian/rules
@@ -77,7 +77,7 @@ endif
 override_dh_makeshlibs:
 	dh_makeshlibs -plibdrm2 -V'libdrm2 (>= 2.4.25)' -- -c4
 ifeq ($(INTEL), yes)
-	dh_makeshlibs -plibdrm-intel1 -V'libdrm-intel1 (>= 2.4.26)' -- -c4
+	dh_makeshlibs -plibdrm-intel1 -V'libdrm-intel1 (>= 2.4.27)' -- -c4
 endif
 ifeq ($(NOUVEAU), yes)
 	dh_makeshlibs -plibdrm-nouveau1a -V'libdrm-nouveau1a (>= 2.4.23)' -- -c4

commit 9eea7002ebed82c306bc30e78a149d7bb2ae520f
Author: Cyril Brulebois <kibi@debian.org>
Date:   Tue Nov 1 19:16:28 2011 +0100

    Bump changelogs.

diff --git a/ChangeLog b/ChangeLog
index 968043e..bac7f78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,274 @@
+commit cc9b751e82c5a3525907bba30ba3c95246751824
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 28 13:14:44 2011 -0700
+
+    configure: version bump for 2.4.27 release.
+    
+    Push the new Intel API for use by mesa.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit d0ae6837d117881d9f1f9cc12d3f1012b6a46103
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 28 13:13:08 2011 -0700
+
+    intel: Share the implementation of BO unmap between CPU and GTT mappings.
+    
+    Before this, consumers of the libdrm API that might map a buffer
+    either way had to track which way was chosen at map time to call the
+    appropriate unmap.  This relaxes that requirement by making
+    drm_intel_bo_unmap() always appropriate.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 4cb01eeccfa6a5169edea07c339117cac1f7b261
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 28 13:12:16 2011 -0700
+
+    intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 77dc16f33d19195c7f7c569d877a6180ed1b9d54
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 28 13:02:53 2011 -0700
+
+    intel: Remove stale comment.
+    
+    This used to be next to some map refcounting code, but that is long dead.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 515cea6ac67eb458c59fececc3c67411ee6fd3c3
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 21 18:48:20 2011 -0700
+
+    intel: Add an interface for removing relocs after they're added.
+    
+    This lets us replace the current inner drawing loop of mesa:
+    
+    for each prim {
+    	compute bo list
+    	if (check_aperture_space(bo list)) {
+    		batch_flush()
+    		compute bo list
+    		if (check_aperture_space(bo list)) {
+    			whine_about_batch_size()
+    			fall back;
+    		}
+    	}
+    	upload state to BOs
+    }
+    
+    with this inner loop:
+    
+    for each prim {
+     retry:
+    	upload state to BOs
+    	if (check_aperture_space(batch)) {
+    		if (!retried) {
+    			reset_to_last_prim()
+    			batch_flush()
+    		} else {
+    			if (batch_flush())
+    				whine_about_batch_size()
+    			goto retry;
+    		}
+    	}
+    }
+    
+    This avoids having to implement code to walk over certain sets of GL
+    state twice (the "compute bo list" step).  While it's not a
+    performance improvement, it's a significant win in code complexity:
+    about -200 lines, and one place to make mistakes related to aperture
+    space instead of N places to forget some BO we should have included.
+    
+    Note how if we do a reset in the new loop , we immediately flush.  We
+    don't need to check aperture space -- the kernel will tell us if we
+    actually ran out of aperture or not.  And if we did run out of
+    aperture, it's because either the single prim was too big, or because
+    check_aperture was wrong at the point of setting up the last
+    primitive.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 2c2bdb36c5b6bd7f8eac07cf163975b361114fb1
+Author: Eric Anholt <eric@anholt.net>
+Date:   Fri Oct 21 16:53:16 2011 -0700
+
+    intel: Use stdbool.h for dealing with boolean values.
+    
+    A few of the bitfield-based booleans are left in place.  Changing them
+    to "bool" results in the same code size, so I'm erring on the side of
+    not changing things.
+    
+    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit cc088f1721eaa5f8f1ba1932723882f92e34c39a
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Wed Oct 19 17:39:54 2011 +0100
+
+    nouveau: free in error path if drmAvailable fails.
+    
+    This was reported in coverity.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit d23146f3f0ad14c8ad482a4832cae859c8d646f2
+Author: Jakob Bornecrantz <jakob@vmware.com>
+Date:   Wed Oct 19 13:32:43 2011 +0200
+
+    modetest: Call dirty fb on modeset
+    
+    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
+
+commit 680b9c4fa3dfb329bd74ec08c17cfc876ea2fc5b
+Author: Jakob Bornecrantz <jakob@vmware.com>
+Date:   Wed Oct 19 13:32:26 2011 +0200
+
+    modetest: Print extra info if we fail to create a framebuffer
+    
+    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
+
+commit 3c8adda6e1e6b0471b3d70a63d795622bbeb1580
+Author: Jakob Bornecrantz <jakob@vmware.com>
+Date:   Wed Sep 28 23:34:09 2011 +0200
+
+    modetest: Check error message from pageflip ioctl
+    
+    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
+
+commit c2925e51979fcb829962e7bf66c13cbc96c39db1
+Author: Jakob Bornecrantz <jakob@vmware.com>
+Date:   Wed Sep 28 17:27:07 2011 +0200
+
+    vbltest: Check error codes returned from libdrm
+    
+    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
+
+commit dc11db2e282c522219bb6e419eb648f3e836bdc0
+Author: Jakob Bornecrantz <jakob@vmware.com>
+Date:   Fri Sep 16 20:50:39 2011 +0200
+
+    tests: Add vmwgfx driver to probed drivers in tests
+    
+    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
+
+commit b317c96361f88a0a4ccb2faeff09b0476d142c68
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date:   Tue Oct 11 11:09:44 2011 -0700
+
+    modetest: use 24 bit depth on the framebuffer
+    
+    It's more compatible; at least the Intel driver now rejects 32 bit
+    depths since it generally can't support real 32 bit framebuffers
+    (supports 30, 36, and 64 bit, but not 32).
+
+commit c82ef03e4c92017bf5644f294ea04e30500f8d4c
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 26 16:03:20 2011 +0100
+
+    drmtest: make check should fail so hard on unable to open device
+
+commit 3a551c127439b2d5cad5c7ca817feab1ca4c78c5
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 26 15:54:13 2011 +0100
+
+    drm/test: handle usub being empty
+    
+    fixes a segfault on make check seen in tinderbox
+
+commit cfee5218b17a2741e5519ed44091171e01f0dbb2
+Author: Tapani Pälli <tapani.palli@intel.com>
+Date:   Fri Sep 23 14:17:42 2011 +0300
+
+    xf86drm.h : wrap C code for C++ compilation/linking
+    
+    To enable usage of xf86drm.h from C++ programs/frameworks.
+    
+    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
+    [ickle: also wrap xf86drmMode.h]
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 194aa1bee632c6dce19238664eb8373e3483de55
+Author: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date:   Thu Sep 22 22:20:53 2011 +0200
+
+    drm/i915: y tiling on i915G/i915GM is different
+    
+    Luckily the kernel has become extremely paranoid about such matters.
+    
+    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 630dd26fb41c64c1e61be6e929e025c1528e9046
+Author: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date:   Thu Sep 22 22:20:09 2011 +0200
+
+    drm/intel: don't clobber bufmgr->pci_device
+    
+    Otherwise it's pretty hard to differentiate the different chipset
+    variants.
+    
+    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 1459cb9252e3a07292d3e64ce961f738cd01eae4
+Author: Matt Turner <mattst88@gmail.com>
+Date:   Thu Mar 3 21:02:06 2011 -0500
+
+    modeprint.c: use PRIu64 for printing uint64_t
+    
+    Signed-off-by: Matt Turner <mattst88@gmail.com>
+
+commit 7d8381614174c6c70c5676cb230f0d9b034b27aa
+Author: Marcin Slusarz <marcin.slusarz@gmail.com>
+Date:   Sun Jun 12 16:40:40 2011 +0200
+
+    nouveau: assert argument cannot have side effects
+    
+    ... because argument is evaluated only if NDEBUG is not defined
+
+commit 763b618d55a973807823bb1a1c6e60b9e2db6d8b
+Author: Marcin Slusarz <marcin.slusarz@gmail.com>
+Date:   Sun Jun 5 18:53:16 2011 +0200
+
+    drm mode: fix drmIoctl wrapper
+    
+    Both drmIoctl and ioctl define second argument as unigned long.
+    
+    Debugging/tracing tools (like strace or valgrind) on 64-bit machines see
+    different request value for ioctls with 32nd bit set, because casting
+    signed int to unsigned long extends 32nd bit to upper word, so 0x80000000
+    becomes 0xFFFFFFFF80000000)
+    
+    Nobody noticed because higher 32 bits are chopped off on their way to kernel.
+
+commit 2acaf160df584a5ef7b5c5b84819389948cd97ad
+Author: Ben Widawsky <ben@bwidawsk.net>
+Date:   Fri Jun 24 10:52:57 2011 -0700
+
+    intel: shared header for shader debugging
+    
+    Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
+    Cc: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit ce317a6d09bb93cff73703b06e5a5bc3cc0b1c6a
+Author: Yuanhan Liu <yuanhan.liu@linux.intel.com>
+Date:   Wed Jul 20 16:08:51 2011 +0800
+
+    intel: fix the wrong method check for bo_get_subdata
+    
+    It's going to call bo_get_subdata method, but not bo_subdata
+    
+    Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
+
+commit 8d055890d90c3d92647e3d8b98d32630ef87c2c8
+Author: Chih-Wei Huang <cwhuang@linux.org.tw>
+Date:   Tue Jul 12 16:35:28 2011 +0800
+
+    Specify the return type explicitly.
+
 commit 6dd804c5a92104042b8be0a67d107946394a0b7a
 Author: Chris Wilson <chris@chris-wilson.co.uk>
 Date:   Sat Jun 4 13:01:50 2011 +0100
diff --git a/debian/changelog b/debian/changelog
index d9bc994..bb4d957 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+libdrm (2.4.27-1) UNRELEASED; urgency=low
+
+  * New upstream release:
+    - Push the new Intel API for use by mesa.
+    - Usual bug fixes.
+
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 01 Nov 2011 19:16:18 +0100
+
 libdrm (2.4.26-1) unstable; urgency=low
 
   * New upstream release:

commit cc9b751e82c5a3525907bba30ba3c95246751824
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 28 13:14:44 2011 -0700

    configure: version bump for 2.4.27 release.
    
    Push the new Intel API for use by mesa.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

diff --git a/configure.ac b/configure.ac
index cd3ac23..95d64a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.26],
+        [2.4.27],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])
 

commit d0ae6837d117881d9f1f9cc12d3f1012b6a46103
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 28 13:13:08 2011 -0700

    intel: Share the implementation of BO unmap between CPU and GTT mappings.
    
    Before this, consumers of the libdrm API that might map a buffer
    either way had to track which way was chosen at map time to call the
    appropriate unmap.  This relaxes that requirement by making
    drm_intel_bo_unmap() always appropriate.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index cebf732..dd58c0c 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1134,21 +1134,6 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
 	return 0;
 }
 
-int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo)
-{
-	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
-	int ret = 0;
-
-	if (bo == NULL)
-		return 0;
-
-	pthread_mutex_lock(&bufmgr_gem->lock);
-	bo->virtual = NULL;
-	pthread_mutex_unlock(&bufmgr_gem->lock);
-
-	return ret;
-}
-
 static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -1182,6 +1167,11 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 	return ret;
 }
 
+int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo)
+{
+	return drm_intel_gem_bo_unmap(bo);
+}
+
 static int
 drm_intel_gem_bo_subdata(drm_intel_bo *bo, unsigned long offset,
 			 unsigned long size, const void *data)

commit 4cb01eeccfa6a5169edea07c339117cac1f7b261
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 28 13:12:16 2011 -0700

    intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 94549f8..cebf732 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -196,6 +196,9 @@ struct _drm_intel_bo_gem {
 	 * relocations.
 	 */
 	int reloc_tree_fences;
+
+	/** Flags that we may need to do the SW_FINSIH ioctl on unmap. */
+	bool mapped_cpu_write;
 };
 
 static unsigned int
@@ -1051,6 +1054,9 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable)
 		    strerror(errno));
 	}
 
+	if (write_enable)
+		bo_gem->mapped_cpu_write = true;
+
 	pthread_mutex_unlock(&bufmgr_gem->lock);
 
 	return 0;
@@ -1148,21 +1154,27 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 	struct drm_i915_gem_sw_finish sw_finish;
-	int ret;
+	int ret = 0;
 
 	if (bo == NULL)
 		return 0;
 
 	pthread_mutex_lock(&bufmgr_gem->lock);
 
-	/* Cause a flush to happen if the buffer's pinned for scanout, so the
-	 * results show up in a timely manner.
-	 */
-	sw_finish.handle = bo_gem->gem_handle;
-	ret = drmIoctl(bufmgr_gem->fd,
-		       DRM_IOCTL_I915_GEM_SW_FINISH,
-		       &sw_finish);
-	ret = ret == -1 ? -errno : 0;
+	if (bo_gem->mapped_cpu_write) {
+		/* Cause a flush to happen if the buffer's pinned for
+		 * scanout, so the results show up in a timely manner.
+		 * Unlike GTT set domains, this only does work if the
+		 * buffer should be scanout-related.
+		 */
+		sw_finish.handle = bo_gem->gem_handle;
+		ret = drmIoctl(bufmgr_gem->fd,
+			       DRM_IOCTL_I915_GEM_SW_FINISH,
+			       &sw_finish);
+		ret = ret == -1 ? -errno : 0;
+
+		bo_gem->mapped_cpu_write = false;
+	}
 
 	bo->virtual = NULL;
 	pthread_mutex_unlock(&bufmgr_gem->lock);

commit 77dc16f33d19195c7f7c569d877a6180ed1b9d54
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 28 13:02:53 2011 -0700

    intel: Remove stale comment.
    
    This used to be next to some map refcounting code, but that is long dead.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 54433ea..94549f8 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1010,9 +1010,6 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable)
 
 	pthread_mutex_lock(&bufmgr_gem->lock);
 
-	/* Allow recursive mapping. Mesa may recursively map buffers with
-	 * nested display loops.
-	 */
 	if (!bo_gem->mem_virtual) {
 		struct drm_i915_gem_mmap mmap_arg;
 

commit 515cea6ac67eb458c59fececc3c67411ee6fd3c3
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 21 18:48:20 2011 -0700

    intel: Add an interface for removing relocs after they're added.
    
    This lets us replace the current inner drawing loop of mesa:
    
    for each prim {
    	compute bo list
    	if (check_aperture_space(bo list)) {
    		batch_flush()
    		compute bo list
    		if (check_aperture_space(bo list)) {
    			whine_about_batch_size()
    			fall back;
    		}
    	}
    	upload state to BOs
    }
    
    with this inner loop:
    
    for each prim {
     retry:
    	upload state to BOs
    	if (check_aperture_space(batch)) {
    		if (!retried) {
    			reset_to_last_prim()
    			batch_flush()
    		} else {
    			if (batch_flush())
    				whine_about_batch_size()
    			goto retry;
    		}
    	}
    }
    
    This avoids having to implement code to walk over certain sets of GL
    state twice (the "compute bo list" step).  While it's not a
    performance improvement, it's a significant win in code complexity:
    about -200 lines, and one place to make mistakes related to aperture
    space instead of N places to forget some BO we should have included.
    
    Note how if we do a reset in the new loop , we immediately flush.  We
    don't need to check aperture space -- the kernel will tell us if we
    actually ran out of aperture or not.  And if we did run out of
    aperture, it's because either the single prim was too big, or because
    check_aperture was wrong at the point of setting up the last
    primitive.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 889ef46..abe9711 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -147,6 +147,8 @@ void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr);
 void drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr);
 int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo);
 int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo);
+int drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo);
+void drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start);
 void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable);
 
 int drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 31ea26e..54433ea 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1423,6 +1423,48 @@ drm_intel_gem_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset,
 				read_domains, write_domain, true);
 }
 
+int
+drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo)
+{
+	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
+
+	return bo_gem->reloc_count;
+}
+
+/**
+ * Removes existing relocation entries in the BO after "start".
+ *
+ * This allows a user to avoid a two-step process for state setup with
+ * counting up all the buffer objects and doing a
+ * drm_intel_bufmgr_check_aperture_space() before emitting any of the
+ * relocations for the state setup.  Instead, save the state of the
+ * batchbuffer including drm_intel_gem_get_reloc_count(), emit all the
+ * state, and then check if it still fits in the aperture.
+ *
+ * Any further drm_intel_bufmgr_check_aperture_space() queries
+ * involving this buffer in the tree are undefined after this call.
+ */
+void
+drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
+{
+	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
+	int i;
+	struct timespec time;
+
+	clock_gettime(CLOCK_MONOTONIC, &time);
+
+	assert(bo_gem->reloc_count >= start);
+	/* Unreference the cleared target buffers */
+	for (i = start; i < bo_gem->reloc_count; i++) {
+		if (bo_gem->reloc_target_info[i].bo != bo) {
+			drm_intel_gem_bo_unreference_locked_timed(bo_gem->
+								  reloc_target_info[i].bo,
+								  time.tv_sec);
+		}
+	}
+	bo_gem->reloc_count = start;
+}
+
 /**
  * Walk the tree of relocations rooted at BO and accumulate the list of
  * validations to be performed and update the relocation buffers with

commit 2c2bdb36c5b6bd7f8eac07cf163975b361114fb1
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 21 16:53:16 2011 -0700

    intel: Use stdbool.h for dealing with boolean values.
    
    A few of the bitfield-based booleans are left in place.  Changing them
    to "bool" results in the same code size, so I'm erring on the side of
    not changing things.
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 1baa0b3..31ea26e 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -51,6 +51,7 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <stdbool.h>
 
 #include "errno.h"
 #include "libdrm_lists.h"
@@ -105,7 +106,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int has_blt : 1;
 	unsigned int has_relaxed_fencing : 1;
 	unsigned int bo_reuse : 1;
-	char fenced_relocs;
+	bool fenced_relocs;
 } drm_intel_bufmgr_gem;
 
 #define DRM_INTEL_RELOC_FENCE (1<<0)
@@ -163,24 +164,24 @@ struct _drm_intel_bo_gem {
 	 * Boolean of whether this BO and its children have been included in
 	 * the current drm_intel_bufmgr_check_aperture_space() total.
 	 */
-	char included_in_check_aperture;
+	bool included_in_check_aperture;
 
 	/**
 	 * Boolean of whether this buffer has been used as a relocation
 	 * target and had its size accounted for, and thus can't have any
 	 * further relocations added to it.
 	 */
-	char used_as_reloc_target;
+	bool used_as_reloc_target;
 
 	/**
 	 * Boolean of whether we have encountered an error whilst building the relocation tree.
 	 */
-	char has_error;
+	bool has_error;
 
 	/**
 	 * Boolean of whether this buffer can be re-used
 	 */
-	char reusable;
+	bool reusable;
 
 	/**
 	 * Size in bytes of this buffer and its relocation descendents.
@@ -507,7 +508,7 @@ drm_intel_setup_reloc_list(drm_intel_bo *bo)
 	bo_gem->reloc_target_info = malloc(max_relocs *
 					   sizeof(drm_intel_reloc_target));
 	if (bo_gem->relocs == NULL || bo_gem->reloc_target_info == NULL) {
-		bo_gem->has_error = 1;
+		bo_gem->has_error = true;
 
 		free (bo_gem->relocs);
 		bo_gem->relocs = NULL;
@@ -592,12 +593,12 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr,
 	unsigned int page_size = getpagesize();
 	int ret;
 	struct drm_intel_gem_bo_bucket *bucket;
-	int alloc_from_cache;
+	bool alloc_from_cache;
 	unsigned long bo_size;
-	int for_render = 0;
+	bool for_render = false;
 
 	if (flags & BO_ALLOC_FOR_RENDER)
-		for_render = 1;
+		for_render = true;
 
 	/* Round the allocated size up to a power of two number of pages. */
 	bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, size);
@@ -616,7 +617,7 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr,
 	pthread_mutex_lock(&bufmgr_gem->lock);
 	/* Get a buffer out of the cache if available */
 retry:
-	alloc_from_cache = 0;
+	alloc_from_cache = false;
 	if (bucket != NULL && !DRMLISTEMPTY(&bucket->head)) {
 		if (for_render) {
 			/* Allocate new render-target BOs from the tail (MRU)
@@ -626,7 +627,7 @@ retry:
 			bo_gem = DRMLISTENTRY(drm_intel_bo_gem,
 					      bucket->head.prev, head);
 			DRMLISTDEL(&bo_gem->head);
-			alloc_from_cache = 1;
+			alloc_from_cache = true;
 		} else {
 			/* For non-render-target BOs (where we're probably
 			 * going to map it first thing in order to fill it
@@ -638,7 +639,7 @@ retry:
 			bo_gem = DRMLISTENTRY(drm_intel_bo_gem,
 					      bucket->head.next, head);
 			if (!drm_intel_gem_bo_busy(&bo_gem->bo)) {
-				alloc_from_cache = 1;
+				alloc_from_cache = true;
 				DRMLISTDEL(&bo_gem->head);
 			}
 		}
@@ -702,9 +703,9 @@ retry:
 	atomic_set(&bo_gem->refcount, 1);
 	bo_gem->validate_index = -1;
 	bo_gem->reloc_tree_fences = 0;
-	bo_gem->used_as_reloc_target = 0;
-	bo_gem->has_error = 0;
-	bo_gem->reusable = 1;
+	bo_gem->used_as_reloc_target = false;
+	bo_gem->has_error = false;
+	bo_gem->reusable = true;
 
 	drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem);
 
@@ -845,7 +846,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
 	bo_gem->gem_handle = open_arg.handle;
 	bo_gem->bo.handle = open_arg.handle;
 	bo_gem->global_name = handle;
-	bo_gem->reusable = 0;
+	bo_gem->reusable = false;
 
 	memset(&get_tiling, 0, sizeof(get_tiling));
 	get_tiling.handle = bo_gem->gem_handle;
@@ -938,7 +939,7 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time)
 		}
 	}
 	bo_gem->reloc_count = 0;
-	bo_gem->used_as_reloc_target = 0;
+	bo_gem->used_as_reloc_target = false;
 
 	DBG("bo_unreference final: %d (%s)\n",
 	    bo_gem->gem_handle, bo_gem->name);
@@ -1329,28 +1330,28 @@ static int
 do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 		 drm_intel_bo *target_bo, uint32_t target_offset,
 		 uint32_t read_domains, uint32_t write_domain,
-		 int need_fence)
+		 bool need_fence)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 	drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) target_bo;
-	int fenced_command;
+	bool fenced_command;
 
 	if (bo_gem->has_error)
 		return -ENOMEM;
 
 	if (target_bo_gem->has_error) {
-		bo_gem->has_error = 1;
+		bo_gem->has_error = true;
 		return -ENOMEM;
 	}
 
 	/* We never use HW fences for rendering on 965+ */
 	if (bufmgr_gem->gen >= 4)
-		need_fence = 0;
+		need_fence = false;
 
 	fenced_command = need_fence;
 	if (target_bo_gem->tiling_mode == I915_TILING_NONE)
-		need_fence = 0;
+		need_fence = false;
 
 	/* Create a new relocation list if needed */
 	if (bo_gem->relocs == NULL && drm_intel_setup_reloc_list(bo))
@@ -1368,7 +1369,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 	 */
 	assert(!bo_gem->used_as_reloc_target);
 	if (target_bo_gem != bo_gem) {
-		target_bo_gem->used_as_reloc_target = 1;
+		target_bo_gem->used_as_reloc_target = true;
 		bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size;
 	}
 	/* An object needing a fence is a tiled buffer, so it won't have
@@ -1419,7 +1420,7 @@ drm_intel_gem_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset,
 				  uint32_t read_domains, uint32_t write_domain)
 {
 	return do_bo_emit_reloc(bo, offset, target_bo, target_offset,
-				read_domains, write_domain, 1);
+				read_domains, write_domain, true);
 }
 
 /**
@@ -1800,7 +1801,7 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t * name)
 		if (ret != 0)
 			return -errno;
 		bo_gem->global_name = flink.name;
-		bo_gem->reusable = 0;
+		bo_gem->reusable = false;
 
 		DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named);
 	}
@@ -1821,7 +1822,7 @@ drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
 
-	bufmgr_gem->bo_reuse = 1;
+	bufmgr_gem->bo_reuse = true;
 }
 
 /**
@@ -1837,7 +1838,7 @@ drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr)
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
 
 	if (bufmgr_gem->bufmgr.bo_exec == drm_intel_gem_bo_exec2)
-		bufmgr_gem->fenced_relocs = 1;
+		bufmgr_gem->fenced_relocs = true;
 }
 
 /**
@@ -1855,7 +1856,7 @@ drm_intel_gem_bo_get_aperture_space(drm_intel_bo *bo)
 		return 0;
 
 	total += bo->size;
-	bo_gem->included_in_check_aperture = 1;
+	bo_gem->included_in_check_aperture = true;
 
 	for (i = 0; i < bo_gem->reloc_count; i++)
 		total +=
@@ -1903,7 +1904,7 @@ drm_intel_gem_bo_clear_aperture_space_flag(drm_intel_bo *bo)
 	if (bo == NULL || !bo_gem->included_in_check_aperture)
 		return;
 
-	bo_gem->included_in_check_aperture = 0;
+	bo_gem->included_in_check_aperture = false;
 
 	for (i = 0; i < bo_gem->reloc_count; i++)
 		drm_intel_gem_bo_clear_aperture_space_flag(bo_gem->
@@ -2020,7 +2021,7 @@ drm_intel_gem_bo_disable_reuse(drm_intel_bo *bo)
 {
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 
-	bo_gem->reusable = 0;
+	bo_gem->reusable = false;
 	return 0;
 }
 
@@ -2116,7 +2117,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, tmp;
-	int exec2 = 0;
+	bool exec2 = false;
 
 	bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
 	if (bufmgr_gem == NULL)
@@ -2167,7 +2168,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	gp.param = I915_PARAM_HAS_EXECBUF2;
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	if (!ret)
-		exec2 = 1;
+		exec2 = true;
 
 	gp.param = I915_PARAM_HAS_BSD;
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);

commit cc088f1721eaa5f8f1ba1932723882f92e34c39a
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Oct 19 17:39:54 2011 +0100

    nouveau: free in error path if drmAvailable fails.
    
    This was reported in coverity.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/nouveau/nouveau_device.c b/nouveau/nouveau_device.c
index 2ffcba6..425c5d2 100644
--- a/nouveau/nouveau_device.c
+++ b/nouveau/nouveau_device.c
@@ -46,8 +46,10 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
 	nvdev->needs_close = close;
 
 	ver = drmGetVersion(fd);


Reply to: