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

libdrm: Changes to 'upstream-experimental'



 configure.ac               |    2 
 include/drm/i915_drm.h     |    8 +
 include/drm/nouveau_drm.h  |    8 +
 intel/intel_bufmgr.c       |   14 ---
 intel/intel_bufmgr.h       |    6 -
 intel/intel_bufmgr_fake.c  |   18 ++++
 intel/intel_bufmgr_gem.c   |  184 +++++++++++++++++++++++++--------------------
 nouveau/nouveau_bo.c       |   12 ++
 nouveau/nouveau_bo.h       |    6 +
 nouveau/nouveau_channel.c  |    5 -
 nouveau/nouveau_channel.h  |    2 
 nouveau/nouveau_device.c   |    5 +
 nouveau/nouveau_drmif.h    |    1 
 nouveau/nouveau_grobj.c    |    2 
 nouveau/nouveau_notifier.c |    2 
 nouveau/nouveau_private.h  |    7 -
 nouveau/nouveau_pushbuf.c  |    8 -
 radeon/radeon_bo_gem.c     |    2 
 radeon/radeon_cs_gem.c     |    2 
 tests/gem_flink.c          |    2 
 tests/gem_mmap.c           |    2 
 tests/gem_readwrite.c      |    4 
 xf86drm.c                  |   27 +-----
 23 files changed, 194 insertions(+), 135 deletions(-)

New commits:
commit 760c01a6af12c013bca0ad1f17c793ca813be4cc
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 10 12:10:46 2010 +0000

    configure: Bump version to 2.4.23
    
    To export new kernel API for Intel's 2010Q4 release.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 179f29f..b064665 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.22, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.23, [dri-devel@lists.sourceforge.net], libdrm)
 AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])

commit 000a0972c21ca1a17609e638907607470ee21751
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 10 12:10:13 2010 +0000

    tests: Update for ENOENT returns from unknown handles
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/tests/gem_flink.c b/tests/gem_flink.c
index ff999d2..8dc8832 100644
--- a/tests/gem_flink.c
+++ b/tests/gem_flink.c
@@ -96,7 +96,7 @@ test_bad_flink(int fd)
 
 	flink.handle = 0x10101010;
 	ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
-	assert(ret == -1 && errno == EBADF);
+	assert(ret == -1 && errno == ENOENT);
 }
 
 static void
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index d24005b..2239789 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
 	mmap.size = 4096;
 	printf("Testing mmaping of bad object.\n");
 	ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap);
-	assert(ret == -1 && errno == EBADF);
+	assert(ret == -1 && errno == ENOENT);
 
 	memset(&create, 0, sizeof(create));
 	create.size = OBJECT_SIZE;
diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c
index 4f5cde6..07dc853 100644
--- a/tests/gem_readwrite.c
+++ b/tests/gem_readwrite.c
@@ -127,11 +127,11 @@ int main(int argc, char **argv)
 
 	printf("Testing read of bad buffer handle\n");
 	ret = do_read(fd, 1234, buf, 0, 1024);
-	assert(ret == -1 && errno == EBADF);
+	assert(ret == -1 && errno == ENOENT);
 
 	printf("Testing write of bad buffer handle\n");
 	ret = do_write(fd, 1234, buf, 0, 1024);
-	assert(ret == -1 && errno == EBADF);
+	assert(ret == -1 && errno == ENOENT);
 
 	close(fd);
 

commit 537703fd4805e9cd352965fce642670986822d22
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 7 20:34:22 2010 +0000

    intel: Reorder need_fence vs fenced_command to avoid fences on gen4
    
    gen4+ hardware doesn't use fences for GPU access and the older kernel
    doesn't expect userspace to make such a mistake. So don't.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32190
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 797dcb3..c5bb588 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1303,7 +1303,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 	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 = need_fence;
+	int fenced_command;
 
 	if (bo_gem->has_error)
 		return -ENOMEM;
@@ -1313,13 +1313,14 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 		return -ENOMEM;
 	}
 
-	if (target_bo_gem->tiling_mode == I915_TILING_NONE)
-		need_fence = 0;
-
 	/* We never use HW fences for rendering on 965+ */
 	if (bufmgr_gem->gen >= 4)
 		need_fence = 0;
 
+	fenced_command = need_fence;
+	if (target_bo_gem->tiling_mode == I915_TILING_NONE)
+		need_fence = 0;
+
 	/* Create a new relocation list if needed */
 	if (bo_gem->relocs == NULL && drm_intel_setup_reloc_list(bo))
 		return -ENOMEM;

commit 39e5e982242cd2b611a9dfc1e9b63f857d52da61
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Dec 7 14:26:09 2010 +1000

    drm: don't do the create the node ourselves if we have udev.
    
    this can remove nodes it shouldn't, let udev run the show.
    
    this is needed for reliably GPU switch.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/xf86drm.c b/xf86drm.c
index 896b9ba..799fcdd 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -370,6 +370,7 @@ wait_for_udev:
     if (fd >= 0)
 	return fd;
 
+#if !defined(UDEV)
     /* Check if the device node is not what we expect it to be, and recreate it
      * and try again if so.
      */
@@ -391,6 +392,7 @@ wait_for_udev:
 
     drmMsg("drmOpenDevice: Open failed\n");
     remove(buf);
+#endif
     return -errno;
 }
 

commit af3d282afbd3360245c2ef2d3552b2530f67481d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 3 10:48:12 2010 +0000

    intel: If the command is fenced inform the kernel
    
    ... but only account for a fenced used if the object is tiled.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 20fe075..797dcb3 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1303,6 +1303,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 	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 = need_fence;
 
 	if (bo_gem->has_error)
 		return -ENOMEM;
@@ -1356,7 +1357,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 	bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo;
 	if (target_bo != bo)
 		drm_intel_gem_bo_reference(target_bo);
-	if (need_fence)
+	if (fenced_command)
 		bo_gem->reloc_target_info[bo_gem->reloc_count].flags =
 			DRM_INTEL_RELOC_FENCE;
 	else

commit 8420743301a36dc1316fadf53bf8e1478068400a
Author: Marek Olšák <maraeo@gmail.com>
Date:   Thu Dec 2 04:12:16 2010 +0100

    radeon: silence valgrind warnings by zeroing memory

diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
index 081ccb9..719fba7 100644
--- a/radeon/radeon_bo_gem.c
+++ b/radeon/radeon_bo_gem.c
@@ -252,7 +252,7 @@ static int bo_set_tiling(struct radeon_bo_int *boi, uint32_t tiling_flags,
 static int bo_get_tiling(struct radeon_bo_int *boi, uint32_t *tiling_flags,
                          uint32_t *pitch)
 {
-    struct drm_radeon_gem_set_tiling args;
+    struct drm_radeon_gem_set_tiling args = {};
     int r;
 
     args.handle = boi->handle;
diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index 81bd393..9834bcf 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -517,7 +517,7 @@ static struct radeon_cs_funcs radeon_cs_gem_funcs = {
 
 static int radeon_get_device_id(int fd, uint32_t *device_id)
 {
-    struct drm_radeon_info info;
+    struct drm_radeon_info info = {};
     int r;
 
     *device_id = 0;

commit 1443bea488f6ad47cb4469c01b35aea0377822c0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Nov 25 16:59:20 2010 +0000

    intel: Add a forward declaration of struct drm_clip_rect
    
    ... so that intel_bufmgr.h can be compiled standalone.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 9df5168..e1b4c45 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -36,6 +36,8 @@
 
 #include <stdint.h>
 
+struct drm_clip_rect;
+
 typedef struct _drm_intel_bufmgr drm_intel_bufmgr;
 typedef struct _drm_intel_bo drm_intel_bo;
 
@@ -109,9 +111,9 @@ void drm_intel_bo_wait_rendering(drm_intel_bo *bo);
 void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug);
 void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
 int drm_intel_bo_exec(drm_intel_bo *bo, int used,
-		      drm_clip_rect_t * cliprects, int num_cliprects, int DR4);
+		      struct drm_clip_rect *cliprects, int num_cliprects, int DR4);
 int drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
-			drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
+			struct drm_clip_rect *cliprects, int num_cliprects, int DR4,
 			int ring_flag);
 int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);
 

commit 51b895041c65f7ec9ecda48e79279dde29258b07
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Nov 22 09:50:06 2010 +0000

    intel: Compute in-aperture size for relaxed fenced objects
    
    For relaxed fencing the object may only consume the small set of active
    pages, but still requires a fence region once bound into the aperture.
    This is the size we need to use when computing the maximum possible
    aperture space that could be used by a single batchbuffer and so avoid
    hitting ENOSPC.
    
    Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index aea7bdb..20fe075 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -467,8 +467,23 @@ drm_intel_bo_gem_set_in_aperture_size(drm_intel_bufmgr_gem *bufmgr_gem,
 	 * aperture. Optimal packing is for wimps.
 	 */
 	size = bo_gem->bo.size;
-	if (bufmgr_gem->gen < 4 && bo_gem->tiling_mode != I915_TILING_NONE)
-		size *= 2;
+	if (bufmgr_gem->gen < 4 && bo_gem->tiling_mode != I915_TILING_NONE) {
+		int min_size;
+
+		if (bufmgr_gem->has_relaxed_fencing) {
+			if (bufmgr_gem->gen == 3)
+				min_size = 1024*1024;
+			else
+				min_size = 512*1024;
+
+			while (min_size < size)
+				min_size *= 2;
+		} else
+			min_size = size;
+
+		/* Account for worst-case alignment. */
+		size = 2 * min_size;
+	}
 
 	bo_gem->reloc_tree_size = size;
 }

commit d17681d538ce86a3f8d6d1c7407df3ceb2bcc499
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Sat Nov 20 14:32:45 2010 +0100

    nouveau: Add implicit pushbuf flush before gpuobj destruction.
    
    It makes sure that GPU object destruction is executed in order with
    respect to the previous FIFO commands.
    
    Signed-off-by: Francisco Jerez <currojerez@riseup.net>
    Acked-by: Ben Skeggs <bskeggs@redhat.com>

diff --git a/nouveau/nouveau_grobj.c b/nouveau/nouveau_grobj.c
index 2b6e53a..df2ffb9 100644
--- a/nouveau/nouveau_grobj.c
+++ b/nouveau/nouveau_grobj.c
@@ -99,6 +99,8 @@ nouveau_grobj_free(struct nouveau_grobj **grobj)
 	if (nvgrobj->base.grclass) {
 		struct drm_nouveau_gpuobj_free f;
 
+		FIRE_RING(&chan->base);
+
 		f.channel = chan->drm.channel;
 		f.handle  = nvgrobj->base.handle;
 		drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GPUOBJ_FREE,
diff --git a/nouveau/nouveau_notifier.c b/nouveau/nouveau_notifier.c
index f8cfd8b..513fa63 100644
--- a/nouveau/nouveau_notifier.c
+++ b/nouveau/nouveau_notifier.c
@@ -80,6 +80,8 @@ nouveau_notifier_free(struct nouveau_notifier **notifier)
 	nvchan = nouveau_channel(nvnotify->base.channel);
 	nvdev   = nouveau_device(nvchan->base.device);
 
+	FIRE_RING(&nvchan->base);
+
 	f.channel = nvchan->drm.channel;
 	f.handle  = nvnotify->base.handle;
 	drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GPUOBJ_FREE, &f, sizeof(f));		

commit 877b2ce15b80975b4dac42657bdfb0a3da833e1c
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 9 13:51:45 2010 -0800

    intel: Fix drm_intel_gem_bo_wait_rendering to wait for read-only usage too.
    
    Both the consumers of this API (sync objects and client throttling)
    were expecting this behavior.  The kernel used to actually behave the
    desired (but incorrect) way for us anyway, but that got fixed a while
    back.

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 2b7bd47..aea7bdb 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1204,11 +1204,11 @@ drm_intel_gem_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
 	return ret;
 }
 
-/** Waits for all GPU rendering to the object to have completed. */
+/** Waits for all GPU rendering with the object to have completed. */
 static void
 drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
 {
-	drm_intel_gem_bo_start_gtt_access(bo, 0);
+	drm_intel_gem_bo_start_gtt_access(bo, 1);
 }
 
 /**

commit 49447a9b957047db2549b8a929e763bbd87808ba
Author: Albert Damen <albrt@gmx.net>
Date:   Sun Nov 7 15:54:32 2010 +0100

    intel: initialize bufmgr.bo_mrb_exec unconditionally
    
    If bufmgr.bo_mrb_exec is not set, drm_intel_bo_mrb_exec returns ENODEV
    even though drm_intel_gem_bo_mrb_exec2 will work fine for the RENDER ring.
    Fixes xf86-video-intel after commit 'add BLT ring support' (5bed685f76)
    with kernels without BSD or BLT ring support (2.6.34 and before).
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31443
    Signed-off-by: Albert Damen <albrt@gmx.net>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 2da3a8a..2b7bd47 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -2184,8 +2184,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	/* Use the new one if available */
 	if (exec2) {
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
-		if (bufmgr_gem->has_bsd|bufmgr_gem->has_blt)
-			bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
+		bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
 	} else
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;
 	bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy;

commit a52e61b5c888444435929a2770f14109c3a94f2f
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 2 11:21:56 2010 -0700

    intel: Drop silly asserts on mappings present at unmap time.
    
    The intent of these was to catch mismatched map/unmap.  What it
    actually did was check whether there was ever a mapping of that type
    (including in a previous life of the buffer through the userland BO
    cache), not whether they were mismatched.  We don't even actually want
    to catch mismatched map/unmap, unless we also do refcounting, since at
    one point Mesa would do map/map/use/unmap/unmap.  Just remove this
    code instead.

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 8b0deaf..2da3a8a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1087,14 +1087,11 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
 int drm_intel_gem_bo_unmap_gtt(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;
 	int ret = 0;
 
 	if (bo == NULL)
 		return 0;
 
-	assert(bo_gem->gtt_virtual != NULL);
-
 	pthread_mutex_lock(&bufmgr_gem->lock);
 	bo->virtual = NULL;
 	pthread_mutex_unlock(&bufmgr_gem->lock);
@@ -1112,8 +1109,6 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 	if (bo == NULL)
 		return 0;
 
-	assert(bo_gem->mem_virtual != NULL);
-
 	pthread_mutex_lock(&bufmgr_gem->lock);
 
 	/* Cause a flush to happen if the buffer's pinned for scanout, so the

commit 4abb65f95c79c9a2ec2cc1147a753704b5cdd22e
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 2 11:19:21 2010 -0700

    intel: Remove gratuitous assert on bo_reference.
    
    This couldn't be triggered except by overflow, since there's an assert
    in unreference to catch the usual failure of over-unreferencing.

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index e0d15c4..8b0deaf 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -351,7 +351,6 @@ drm_intel_gem_bo_reference(drm_intel_bo *bo)
 {
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 
-	assert(atomic_read(&bo_gem->refcount) > 0);
 	atomic_inc(&bo_gem->refcount);
 }
 

commit f45305c1aaf5d8053b047ff6c4ac177e26ae6d17
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Nov 1 06:54:58 2010 -0700

    intel: Shove the fake bufmgr subdata implementation into the fake bufmgr.

diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index 2b4e888..f93a870 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -94,19 +94,7 @@ int
 drm_intel_bo_subdata(drm_intel_bo *bo, unsigned long offset,
 		     unsigned long size, const void *data)
 {
-	int ret;
-
-	if (bo->bufmgr->bo_subdata)
-		return bo->bufmgr->bo_subdata(bo, offset, size, data);
-	if (size == 0 || data == NULL)
-		return 0;
-
-	ret = drm_intel_bo_map(bo, 1);
-	if (ret)
-		return ret;
-	memcpy((unsigned char *)bo->virtual + offset, data, size);
-	drm_intel_bo_unmap(bo);
-	return 0;
+	return bo->bufmgr->bo_subdata(bo, offset, size, data);
 }
 
 int
diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index bc4a2ff..d9b5cfd 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -1121,6 +1121,23 @@ static int drm_intel_fake_bo_unmap(drm_intel_bo *bo)
 	return ret;
 }
 
+static int
+drm_intel_fake_bo_subdata(drm_intel_bo *bo, unsigned long offset,
+			  unsigned long size, const void *data)
+{
+	int ret;
+
+	if (size == 0 || data == NULL)
+		return 0;
+
+	ret = drm_intel_bo_map(bo, 1);
+	if (ret)
+		return ret;
+	memcpy((unsigned char *)bo->virtual + offset, data, size);
+	drm_intel_bo_unmap(bo);
+	return 0;
+}
+
 static void
  drm_intel_fake_kick_all_locked(drm_intel_bufmgr_fake *bufmgr_fake)
 {
@@ -1599,6 +1616,7 @@ drm_intel_bufmgr *drm_intel_bufmgr_fake_init(int fd,
 	bufmgr_fake->bufmgr.bo_unreference = drm_intel_fake_bo_unreference;
 	bufmgr_fake->bufmgr.bo_map = drm_intel_fake_bo_map;
 	bufmgr_fake->bufmgr.bo_unmap = drm_intel_fake_bo_unmap;
+	bufmgr_fake->bufmgr.bo_subdata = drm_intel_fake_bo_subdata;
 	bufmgr_fake->bufmgr.bo_wait_rendering =
 	    drm_intel_fake_bo_wait_rendering;
 	bufmgr_fake->bufmgr.bo_emit_reloc = drm_intel_fake_emit_reloc;

commit 6560b4766c37603f5167859513bdc300f89a4761
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Sep 20 14:14:14 2010 -0700

    intel: Remove stale comment.

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 37a3691..e0d15c4 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1336,8 +1336,6 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 		target_bo_gem->reloc_tree_fences = 1;
 	bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences;
 
-	/* Flag the target to disallow further relocations in it. */
-
 	bo_gem->relocs[bo_gem->reloc_count].offset = offset;
 	bo_gem->relocs[bo_gem->reloc_count].delta = target_offset;
 	bo_gem->relocs[bo_gem->reloc_count].target_handle =

commit d0a4f2e292e5b347f7e5ee2cdbe4f077986eb9da
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Sun Oct 31 02:22:29 2010 +0200

    nouveau: Avoid unnecessary call to CPU_FINI.
    
    nouveau_bo_unmap called the CPU_FINI IOCTL even if it was a NOSYNC
    mapping. It caused no harmful effects (actually CPU_FINI is a no-op on
    recent enough kernels) besides the precious CPU cycles being wasted.
    
    Signed-off-by: Francisco Jerez <currojerez@riseup.net>

diff --git a/nouveau/nouveau_bo.c b/nouveau/nouveau_bo.c
index c1432b0..d6bb22d 100644
--- a/nouveau/nouveau_bo.c
+++ b/nouveau/nouveau_bo.c
@@ -434,6 +434,8 @@ nouveau_bo_map_range(struct nouveau_bo *bo, uint32_t delta, uint32_t size,
 					      (flags & NOUVEAU_BO_NOWAIT), 0);
 			if (ret)
 				return ret;
+
+			nvbo->map_refcnt++;
 		}
 
 		bo->map = (char *)nvbo->map + delta;
@@ -458,13 +460,14 @@ nouveau_bo_unmap(struct nouveau_bo *bo)
 {
 	struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
 
-	if (bo->map && !nvbo->sysmem) {
+	if (bo->map && !nvbo->sysmem && nvbo->map_refcnt) {
 		struct nouveau_device_priv *nvdev = nouveau_device(bo->device);
 		struct drm_nouveau_gem_cpu_fini req;
 
 		req.handle = nvbo->handle;
 		drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_FINI,
 				&req, sizeof(req));
+		nvbo->map_refcnt--;
 	}
 
 	bo->map = NULL;
diff --git a/nouveau/nouveau_private.h b/nouveau/nouveau_private.h
index 4c53534..124fe87 100644
--- a/nouveau/nouveau_private.h
+++ b/nouveau/nouveau_private.h
@@ -115,6 +115,7 @@ struct nouveau_bo_priv {
 	uint32_t global_handle;
 	drm_handle_t handle;
 	uint64_t map_handle;
+	int map_refcnt;
 	void *map;
 
 	/* Last known information from kernel on buffer status */

commit 362457715faacd3101929e5f0d8ae250d0ad09df
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Oct 29 10:49:54 2010 +0100

    intel: enable relaxed fence allocation for i915
    
    The kernel has always allowed userspace to underallocate objects
    supplied for fencing. However, the kernel only allocated the object size
    for the fence in the GTT and so caused tiling corruption. More recently
    the kernel does allocate the full fence region in the GTT for an
    under-sized object and so advertises that clients may finally make use
    of this feature. The biggest benefit is for texture-heavy GL games on
    i945 such as World of Padman which go from needing over 1GiB of RAM to
    play to fitting in the GTT!
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index bd93061..19da2c0 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -278,6 +278,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXECBUF2          9
 #define I915_PARAM_HAS_BSD		 10
 #define I915_PARAM_HAS_BLT		 11
+#define I915_PARAM_HAS_RELAXED_FENCING	 12
 
 typedef struct drm_i915_getparam {
 	int param;
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index c5847a8..37a3691 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -99,9 +99,10 @@ typedef struct _drm_intel_bufmgr_gem {
 	int available_fences;
 	int pci_device;
 	int gen;
-	char has_bsd;
-	char has_blt;
-	char bo_reuse;
+	unsigned int has_bsd : 1;
+	unsigned int has_blt : 1;
+	unsigned int has_relaxed_fencing : 1;
+	unsigned int bo_reuse : 1;
 	char fenced_relocs;
 } drm_intel_bufmgr_gem;
 
@@ -243,6 +244,10 @@ drm_intel_gem_bo_tile_size(drm_intel_bufmgr_gem *bufmgr_gem, unsigned long size,
 		return size;
 	}
 
+	/* Do we need to allocate every page for the fence? */
+	if (bufmgr_gem->has_relaxed_fencing)
+		return ROUND_UP_TO(size, 4096);
+
 	for (i = min_size; i < size; i <<= 1)
 		;
 
@@ -2128,6 +2133,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	bufmgr_gem->has_blt = ret == 0;
 
+	gp.param = I915_PARAM_HAS_RELAXED_FENCING;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	bufmgr_gem->has_relaxed_fencing = ret == 0;
+
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
 		gp.value = &bufmgr_gem->available_fences;

commit 0a1ff35c70730160973715b82112cd97c62ac13e
Author: Adam Jackson <ajax@redhat.com>
Date:   Wed Oct 27 18:44:53 2010 -0400

    s/drmStrdup/strdup/
    
    _DRM_MALLOC hasn't been a relevant concern since we split libdrm out
    from xserver.
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>

diff --git a/xf86drm.c b/xf86drm.c
index e48b9c9..896b9ba 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -155,23 +155,6 @@ void drmFree(void *pt)
 	free(pt);
 }
 
-/* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */
-static char *drmStrdup(const char *s)
-{
-    char *retval;
-
-    if (!s)
-        return NULL;
-
-    retval = malloc(strlen(s)+1);
-    if (!retval)
-        return NULL;
-
-    strcpy(retval, s);
-
-    return retval;
-}
-
 /**
  * Call ioctl, restarting if it is interupted
  */
@@ -726,11 +709,11 @@ static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s)
     d->version_minor      = s->version_minor;
     d->version_patchlevel = s->version_patchlevel;
     d->name_len           = s->name_len;
-    d->name               = drmStrdup(s->name);
+    d->name               = strdup(s->name);
     d->date_len           = s->date_len;
-    d->date               = drmStrdup(s->date);
+    d->date               = strdup(s->date);
     d->desc_len           = s->desc_len;
-    d->desc               = drmStrdup(s->desc);
+    d->desc               = strdup(s->desc);
 }
 
 
@@ -2543,5 +2526,5 @@ char *drmGetDeviceNameFromFd(int fd)
 	if (i == DRM_MAX_MINOR)
 		return NULL;
 
-	return drmStrdup(name);
+	return strdup(name);
 }

commit 057fab3382c02af54126ce395c43d4e6dce9439a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 26 11:35:11 2010 +0100

    intel: Prepare for BLT ring split.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 7594413..bd93061 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -206,6 +206,7 @@ typedef struct _drm_i915_sarea {
 #define DRM_IOCTL_I915_SET_VBLANK_PIPE	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
 #define DRM_IOCTL_I915_GET_VBLANK_PIPE	DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
 #define DRM_IOCTL_I915_VBLANK_SWAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
+#define DRM_IOCTL_I915_HWS_ADDR		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
 #define DRM_IOCTL_I915_GEM_INIT		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
 #define DRM_IOCTL_I915_GEM_EXECBUFFER	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
 #define DRM_IOCTL_I915_GEM_EXECBUFFER2	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
@@ -276,6 +277,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_PAGEFLIPPING	 8
 #define I915_PARAM_HAS_EXECBUF2          9
 #define I915_PARAM_HAS_BSD		 10
+#define I915_PARAM_HAS_BLT		 11
 
 typedef struct drm_i915_getparam {
 	int param;
@@ -617,8 +619,11 @@ struct drm_i915_gem_execbuffer2 {
 	__u32 num_cliprects;
 	/** This is a struct drm_clip_rect *cliprects */
 	__u64 cliprects_ptr;
+#define I915_EXEC_RING_MASK              (7<<0)
+#define I915_EXEC_DEFAULT                (0<<0)
 #define I915_EXEC_RENDER                 (1<<0)
-#define I915_EXEC_BSD                    (1<<1)
+#define I915_EXEC_BSD                    (2<<0)
+#define I915_EXEC_BLT                    (3<<0)
 	__u64 flags;
 	__u64 rsvd1;
 	__u64 rsvd2;
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 60174e1..c5847a8 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -99,6 +99,8 @@ typedef struct _drm_intel_bufmgr_gem {
 	int available_fences;
 	int pci_device;
 	int gen;
+	char has_bsd;
+	char has_blt;
 	char bo_reuse;
 	char fenced_relocs;
 } drm_intel_bufmgr_gem;
@@ -1545,8 +1547,21 @@ drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
 	struct drm_i915_gem_execbuffer2 execbuf;
 	int ret, i;
 
-	if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD))
+	switch (ring_flag) {
+	default:
 		return -EINVAL;
+	case I915_EXEC_BLT:
+		if (!bufmgr_gem->has_blt)
+			return -EINVAL;
+		break;
+	case I915_EXEC_BSD:
+		if (!bufmgr_gem->has_bsd)
+			return -EINVAL;
+		break;
+	case I915_EXEC_RENDER:
+	case I915_EXEC_DEFAULT:
+		break;
+	}
 
 	pthread_mutex_lock(&bufmgr_gem->lock);
 	/* Update indices and set up the validate list. */
@@ -2054,7 +2069,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;
-	int exec2 = 0, has_bsd = 0;
+	int exec2 = 0;
 
 	bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
 	if (bufmgr_gem == NULL)
@@ -2107,8 +2122,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 
 	gp.param = I915_PARAM_HAS_BSD;
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
-	if (!ret)
-		has_bsd = 1;
+	bufmgr_gem->has_bsd = ret == 0;
+
+	gp.param = I915_PARAM_HAS_BLT;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	bufmgr_gem->has_blt = ret == 0;
 
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
@@ -2165,7 +2183,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	/* Use the new one if available */
 	if (exec2) {
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
-		if (has_bsd)
+		if (bufmgr_gem->has_bsd|bufmgr_gem->has_blt)
 			bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
 	} else
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;

commit c5286f4a871e054b63dee8a60a6f06574c4ca1b8
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Thu Oct 21 23:02:43 2010 +0200

    nouveau: Define the HAS_PAGEFLIP getparam.
    
    Signed-off-by: Francisco Jerez <currojerez@riseup.net>

diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index f115eab..b18cad0 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -81,6 +81,7 @@ struct drm_nouveau_gpuobj_free {
 #define NOUVEAU_GETPARAM_GRAPH_UNITS     13
 #define NOUVEAU_GETPARAM_PTIMER_TIME     14
 #define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
+#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
 struct drm_nouveau_getparam {
 	uint64_t param;
 	uint64_t value;

commit 09b1062628f2cbddb3ebae20e7b3b8a0a93acebf
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Tue Sep 28 22:45:27 2010 +0200

    nouveau: Let the user choose the push buffer size.
    
    Signed-off-by: Francisco Jerez <currojerez@riseup.net>
    Acked-by: Ben Skeggs <bskeggs@redhat.com>

diff --git a/nouveau/nouveau_channel.c b/nouveau/nouveau_channel.c
index 40a0b34..ded5424 100644
--- a/nouveau/nouveau_channel.c
+++ b/nouveau/nouveau_channel.c
@@ -28,7 +28,8 @@
 
 int
 nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
-		      uint32_t tt_ctxdma, struct nouveau_channel **chan)
+		      uint32_t tt_ctxdma, int pushbuf_size,
+		      struct nouveau_channel **chan)
 {
 	struct nouveau_device_priv *nvdev = nouveau_device(dev);
 	struct nouveau_channel_priv *nvchan;
@@ -90,7 +91,7 @@ nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
 		return ret;
 	}
 
-	ret = nouveau_pushbuf_init(&nvchan->base);
+	ret = nouveau_pushbuf_init(&nvchan->base, pushbuf_size);
 	if (ret) {
 		nouveau_channel_free((void *)&nvchan);
 		return ret;
diff --git a/nouveau/nouveau_channel.h b/nouveau/nouveau_channel.h
index ddcf8e4..d61a4c0 100644
--- a/nouveau/nouveau_channel.h
+++ b/nouveau/nouveau_channel.h
@@ -49,7 +49,7 @@ struct nouveau_channel {
 
 int
 nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt,
-		      struct nouveau_channel **);
+		      int pushbuf_size, struct nouveau_channel **);
 
 void
 nouveau_channel_free(struct nouveau_channel **);
diff --git a/nouveau/nouveau_private.h b/nouveau/nouveau_private.h
index 5a952f7..4c53534 100644
--- a/nouveau/nouveau_private.h
+++ b/nouveau/nouveau_private.h
@@ -37,8 +37,8 @@
 #include "nouveau_pushbuf.h"
 #include "nouveau_reloc.h"
 
-#define CALPB_BUFFERS 4
-#define CALPB_BUFSZ   16384
+#define CALPB_BUFFERS 3
+
 struct nouveau_pushbuf_priv {
 	uint32_t cal_suffix0;
 	uint32_t cal_suffix1;
@@ -64,7 +64,7 @@ struct nouveau_pushbuf_priv {
 #define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
 
 int
-nouveau_pushbuf_init(struct nouveau_channel *);
+nouveau_pushbuf_init(struct nouveau_channel *, int buf_size);
 void
 nouveau_pushbuf_fini(struct nouveau_channel *);
 
diff --git a/nouveau/nouveau_pushbuf.c b/nouveau/nouveau_pushbuf.c
index 28b8018..90836bc 100644
--- a/nouveau/nouveau_pushbuf.c
+++ b/nouveau/nouveau_pushbuf.c
@@ -78,7 +78,7 @@ nouveau_pushbuf_fini_call(struct nouveau_channel *chan)
 }
 
 static int
-nouveau_pushbuf_init_call(struct nouveau_channel *chan)
+nouveau_pushbuf_init_call(struct nouveau_channel *chan, int buf_size)
 {
 	struct drm_nouveau_gem_pushbuf req;
 	struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
@@ -101,7 +101,7 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
 
 	for (i = 0; i < CALPB_BUFFERS; i++) {
 		ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP,
-				     0, CALPB_BUFSZ, &nvpb->buffer[i]);
+				     0, buf_size, &nvpb->buffer[i]);
 		if (ret) {
 			nouveau_pushbuf_fini_call(chan);
 			return ret;
@@ -114,13 +114,13 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
 }
 
 int
-nouveau_pushbuf_init(struct nouveau_channel *chan)
+nouveau_pushbuf_init(struct nouveau_channel *chan, int buf_size)
 {
 	struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
 	struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
 	int ret;
 
-	ret = nouveau_pushbuf_init_call(chan);
+	ret = nouveau_pushbuf_init_call(chan, buf_size);


Reply to: