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

libdrm: Changes to 'ubuntu-precise'



 .gitignore                          |    7 
 ChangeLog                           |39554 ------------------------------------
 Makefile.am                         |    2 
 configure.ac                        |    4 
 debian/changelog                    |   61 
 debian/control                      |   33 
 debian/libdrm-intel1.symbols        |    1 
 debian/libdrm2.symbols              |    1 
 debian/libkms1.install              |    1 
 debian/libkms1.lintian-overrides    |    1 
 debian/libkms1.symbols              |   16 
 debian/patches/02_kbsd_modeset.diff |   57 
 debian/patches/series               |    1 
 debian/rules                        |   25 
 freedreno/Makefile.am               |   19 
 freedreno/freedreno_bo.c            |  332 
 freedreno/freedreno_device.c        |  117 
 freedreno/freedreno_drmif.h         |    8 
 freedreno/freedreno_pipe.c          |  188 
 freedreno/freedreno_priv.h          |  107 
 freedreno/freedreno_ringbuffer.c    |  180 
 freedreno/freedreno_ringbuffer.h    |   35 
 freedreno/kgsl/kgsl_bo.c            |  313 
 freedreno/kgsl/kgsl_device.c        |   61 
 freedreno/kgsl/kgsl_drm.h           |  192 
 freedreno/kgsl/kgsl_pipe.c          |  264 
 freedreno/kgsl/kgsl_priv.h          |  115 
 freedreno/kgsl/kgsl_ringbuffer.c    |  224 
 freedreno/kgsl/msm_kgsl.h           |  519 
 freedreno/kgsl_drm.h                |  192 
 freedreno/msm/msm_bo.c              |  141 
 freedreno/msm/msm_device.c          |   61 
 freedreno/msm/msm_drm.h             |  207 
 freedreno/msm/msm_pipe.c            |  133 
 freedreno/msm/msm_priv.h            |   95 
 freedreno/msm/msm_ringbuffer.c      |  321 
 freedreno/msm_kgsl.h                |  519 
 include/drm/drm.h                   |   22 
 include/drm/drm_mode.h              |   42 
 include/drm/i915_drm.h              |  132 
 include/drm/radeon_drm.h            |   14 
 intel/intel_bufmgr.h                |   17 
 intel/intel_bufmgr_gem.c            |  174 
 intel/intel_chipset.h               |   22 
 intel/intel_decode.c                |    6 
 intel/libdrm_intel.pc.in            |    4 
 intel/test_decode.c                 |    1 
 libkms/Makefile.am                  |    5 
 libkms/exynos.c                     |  207 
 libkms/internal.h                   |    2 
 libkms/linux.c                      |    4 
 nouveau/nouveau.c                   |  108 
 nouveau/private.h                   |    3 
 nouveau/pushbuf.c                   |    3 
 radeon/r600_pci_ids.h               |   37 
 radeon/radeon_cs_gem.c              |    3 
 radeon/radeon_surface.c             |  662 
 radeon/radeon_surface.h             |    1 
 tests/getversion.c                  |    1 
 tests/kmstest/main.c                |    1 
 tests/modetest/Makefile.am          |    4 
 tests/modetest/buffers.c            |   44 
 tests/modetest/buffers.h            |    5 
 tests/modetest/modetest.c           | 1234 -
 tests/setversion.c                  |    1 
 tests/vbltest/vbltest.c             |    2 
 xf86drm.c                           |    7 
 xf86drm.h                           |   10 
 xf86drmMode.c                       |   19 
 xf86drmMode.h                       |   47 
 70 files changed, 5538 insertions(+), 41413 deletions(-)

New commits:
commit 24c4a77ac40234eab260852cb266b71ac144b52d
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Wed Mar 12 22:05:15 2014 -0400

    nouveau: safen up nouveau_device list usage against concurrent access
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index ee7893b..75dfb0e 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -85,6 +85,12 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
 
 	if (!nvdev)
 		return -ENOMEM;
+	ret = pthread_mutex_init(&nvdev->lock, NULL);
+	if (ret) {
+		free(nvdev);
+		return ret;
+	}
+
 	nvdev->base.fd = fd;
 
 	ver = drmGetVersion(fd);
@@ -161,6 +167,7 @@ nouveau_device_del(struct nouveau_device **pdev)
 		if (nvdev->close)
 			drmClose(nvdev->base.fd);
 		free(nvdev->client);
+		pthread_mutex_destroy(&nvdev->lock);
 		free(nvdev);
 		*pdev = NULL;
 	}
@@ -191,6 +198,8 @@ nouveau_client_new(struct nouveau_device *dev, struct nouveau_client **pclient)
 	int id = 0, i, ret = -ENOMEM;
 	uint32_t *clients;
 
+	pthread_mutex_lock(&nvdev->lock);
+
 	for (i = 0; i < nvdev->nr_client; i++) {
 		id = ffs(nvdev->client[i]) - 1;
 		if (id >= 0)
@@ -199,7 +208,7 @@ nouveau_client_new(struct nouveau_device *dev, struct nouveau_client **pclient)
 
 	clients = realloc(nvdev->client, sizeof(uint32_t) * (i + 1));
 	if (!clients)
-		return ret;
+		goto unlock;
 	nvdev->client = clients;
 	nvdev->client[i] = 0;
 	nvdev->nr_client++;
@@ -214,6 +223,9 @@ out:
 	}
 
 	*pclient = &pcli->base;
+
+unlock:
+	pthread_mutex_unlock(&nvdev->lock);
 	return ret;
 }
 
@@ -225,7 +237,9 @@ nouveau_client_del(struct nouveau_client **pclient)
 	if (pcli) {
 		int id = pcli->base.id;
 		nvdev = nouveau_device(pcli->base.device);
+		pthread_mutex_lock(&nvdev->lock);
 		nvdev->client[id / 32] &= ~(1 << (id % 32));
+		pthread_mutex_unlock(&nvdev->lock);
 		free(pcli->kref);
 		free(pcli);
 	}
@@ -331,12 +345,43 @@ nouveau_object_find(struct nouveau_object *obj, uint32_t pclass)
 static void
 nouveau_bo_del(struct nouveau_bo *bo)
 {
+	struct nouveau_device_priv *nvdev = nouveau_device(bo->device);
 	struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
 	struct drm_gem_close req = { bo->handle };
-	DRMLISTDEL(&nvbo->head);
+
+	pthread_mutex_lock(&nvdev->lock);
+	if (nvbo->name) {
+		if (atomic_read(&bo->refcnt)) {
+			/*
+			 * bo has been revived by a race with
+			 * nouveau_bo_prime_handle_ref, or nouveau_bo_name_ref.
+			 *
+			 * In theory there's still a race possible with
+			 * nouveau_bo_wrap, but when using this function
+			 * the lifetime of the handle is probably already
+			 * handled in another way. If there are races
+			 * you're probably using nouveau_bo_wrap wrong.
+			 */
+			pthread_mutex_unlock(&nvdev->lock);
+			return;
+		}
+		DRMLISTDEL(&nvbo->head);
+		/*
+		 * This bo has to be closed with the lock held because gem
+		 * handles are not refcounted. If a shared bo is closed and
+		 * re-opened in another thread a race against
+		 * DRM_IOCTL_GEM_OPEN or drmPrimeFDToHandle might cause the
+		 * bo to be closed accidentally while re-importing.
+		 */
+		drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
+		pthread_mutex_unlock(&nvdev->lock);
+	} else {
+		DRMLISTDEL(&nvbo->head);
+		pthread_mutex_unlock(&nvdev->lock);
+		drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
+	}
 	if (bo->map)
 		munmap(bo->map, bo->size);
-	drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
 	free(nvbo);
 }
 
@@ -363,15 +408,17 @@ nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, uint32_t align,
 		return ret;
 	}
 
+	pthread_mutex_lock(&nvdev->lock);
 	DRMLISTADD(&nvbo->head, &nvdev->bo_list);
+	pthread_mutex_unlock(&nvdev->lock);
 
 	*pbo = bo;
 	return 0;
 }
 
 int
-nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
-		struct nouveau_bo **pbo)
+nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
+		       struct nouveau_bo **pbo)
 {
 	struct nouveau_device_priv *nvdev = nouveau_device(dev);
 	struct drm_nouveau_gem_info req = { .handle = handle };
@@ -405,6 +452,18 @@ nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
 }
 
 int
+nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
+		struct nouveau_bo **pbo)
+{
+	struct nouveau_device_priv *nvdev = nouveau_device(dev);
+	int ret;
+	pthread_mutex_lock(&nvdev->lock);
+	ret = nouveau_bo_wrap_locked(dev, handle, pbo);
+	pthread_mutex_unlock(&ndev->lock);
+	return ret;
+}
+
+int
 nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
 		    struct nouveau_bo **pbo)
 {
@@ -413,18 +472,21 @@ nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
 	struct drm_gem_open req = { .name = name };
 	int ret;
 
+	pthread_mutex_lock(&nvdev->lock);
 	DRMLISTFOREACHENTRY(nvbo, &nvdev->bo_list, head) {
 		if (nvbo->name == name) {
 			*pbo = NULL;
 			nouveau_bo_ref(&nvbo->base, pbo);
+			pthread_mutex_unlock(&nvdev->lock);
 			return 0;
 		}
 	}
 
 	ret = drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req);
 	if (ret == 0) {
-		ret = nouveau_bo_wrap(dev, req.handle, pbo);
+		ret = nouveau_bo_wrap_locked(dev, req.handle, pbo);
 		nouveau_bo((*pbo))->name = name;
+		pthread_mutex_unlock(&nvdev->lock);
 	}
 
 	return ret;
@@ -435,13 +497,16 @@ nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name)
 {
 	struct drm_gem_flink req = { .handle = bo->handle };
 	struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
-	if (!nvbo->name) {
+
+	*name = nvbo->name;
+	if (!*name || *name == ~0) {
 		int ret = drmIoctl(bo->device->fd, DRM_IOCTL_GEM_FLINK, &req);
-		if (ret)
+		if (ret) {
+			*name = 0;
 			return ret;
-		nvbo->name = req.name;
+		}
+		nvbo->name = *name = req.name;
 	}
-	*name = nvbo->name;
 	return 0;
 }
 
@@ -466,19 +531,18 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
 	int ret;
 	unsigned int handle;
 
-	ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle);
-	if (ret) {
-		nouveau_bo_ref(NULL, bo);
-		return ret;
-	}
+	nouveau_bo_ref(NULL, bo);
 
-	ret = nouveau_bo_wrap(dev, handle, bo);
-	if (ret) {
-		nouveau_bo_ref(NULL, bo);
-		return ret;
+	pthread_mutex_lock(&nvdev->lock);
+	ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle);
+	if (ret == 0) {
+		ret = nouveau_bo_wrap_locked(dev, handle, bo);
+		if (!bo->name)
+			// XXX: Force locked DRM_IOCTL_GEM_CLOSE to rule out race conditions
+			bo->name = ~0;
 	}
-
-	return 0;
+	pthread_mutex_unlock(&nvdev->lock);
+	return ret;
 }
 
 int
@@ -490,6 +554,8 @@ nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
 	ret = drmPrimeHandleToFD(bo->device->fd, nvbo->base.handle, DRM_CLOEXEC, prime_fd);
 	if (ret)
 		return ret;
+	if (!nvbo->name)
+		nvbo->name = ~0;
 	return 0;
 }
 
diff --git a/nouveau/private.h b/nouveau/private.h
index 60714b8..4f337ad 100644
--- a/nouveau/private.h
+++ b/nouveau/private.h
@@ -3,6 +3,7 @@
 
 #include <xf86drm.h>
 #include <xf86atomic.h>
+#include <pthread.h>
 #include "nouveau_drm.h"
 
 #include "nouveau.h"
@@ -94,7 +95,7 @@ nouveau_bo(struct nouveau_bo *bo)
 struct nouveau_device_priv {
 	struct nouveau_device base;
 	int close;
-	atomic_t lock;
+	pthread_mutex_t lock;
 	struct nouveau_list bo_list;
 	uint32_t *client;
 	int nr_client;

commit 928d846a2dacc41d8aaf4a2c54f82b5df8e48fb7
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Fri Jan 24 13:42:11 2014 +0100

    release to unstable

diff --git a/debian/changelog b/debian/changelog
index f1b5fa8..952fe3d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-libdrm (2.4.52-1) UNRELEASED; urgency=medium
+libdrm (2.4.52-1) unstable; urgency=medium
 
   [ Julien Cristau ]
   * Remove Cyril Brulebois from Uploaders.
@@ -6,7 +6,7 @@ libdrm (2.4.52-1) UNRELEASED; urgency=medium
   [ Maarten Lankhorst ]
   * New upstream release.
 
- -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:51:56 +0100
+ -- Maarten Lankhorst <maarten.lankhorst@ubuntu.com>  Fri, 24 Jan 2014 13:41:57 +0100
 
 libdrm (2.4.51-1) unstable; urgency=medium
 

commit c963bfdc76ce02aa20210b3314422b101bb12239
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Fri Jan 24 13:40:35 2014 +0100

    New upstream release.

diff --git a/debian/changelog b/debian/changelog
index 6b22b7f..f1b5fa8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,11 @@
-libdrm (2.4.51-2) UNRELEASED; urgency=medium
+libdrm (2.4.52-1) UNRELEASED; urgency=medium
 
+  [ Julien Cristau ]
   * Remove Cyril Brulebois from Uploaders.
 
+  [ Maarten Lankhorst ]
+  * New upstream release.
+
  -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:51:56 +0100
 
 libdrm (2.4.51-1) unstable; urgency=medium

commit 46d451c9a9514df9de01df647a3f397c5b5d7d1a
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Jan 13 15:47:15 2014 -0800

    Bump the version to 2.4.52
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

diff --git a/configure.ac b/configure.ac
index d0d051a..969fb83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.51],
+        [2.4.52],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])
 

commit edf17dbdaa525fe3a9abbbfafa768c556cfd7af2
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Jan 13 14:14:36 2014 -0800

    intel: Create a new drm_intel_bo offset64 field.
    
    The existing 'offset' field is unfortunately typed as 'unsigned long',
    which is unfortunately only 4 bytes with a 32-bit userspace.
    
    Traditionally, the hardware has only supported 32-bit virtual addresses,
    so even though the kernel uses a __u64, the value would always fit.
    
    However, Broadwell supports 48-bit addressing.  So with a 64-bit kernel,
    the card virtual address may be too large to fit in the 'offset' field.
    
    Ideally, we would change the type of 'offset' to be a uint64_t---but
    this would break the libdrm ABI.  Instead, we create a new 'offset64'
    field to hold the full 64-bit value from the kernel, and store the
    32-bit truncation in the existing 'offset' field, for compatibility.
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 2eb9742..9383c72 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -61,9 +61,8 @@ struct _drm_intel_bo {
 	unsigned long align;
 
 	/**
-	 * Last seen card virtual address (offset from the beginning of the
-	 * aperture) for the object.  This should be used to fill relocation
-	 * entries when calling drm_intel_bo_emit_reloc()
+	 * Deprecated field containing (possibly the low 32-bits of) the last
+	 * seen virtual card address.  Use offset64 instead.
 	 */
 	unsigned long offset;
 
@@ -84,6 +83,13 @@ struct _drm_intel_bo {
 	 * MM-specific handle for accessing object
 	 */
 	int handle;
+
+	/**
+	 * Last seen card virtual address (offset from the beginning of the
+	 * aperture) for the object.  This should be used to fill relocation
+	 * entries when calling drm_intel_bo_emit_reloc()
+	 */
+	uint64_t offset64;
 };
 
 enum aub_dump_bmp_format {
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index e20e2c4..007a6d8 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -391,7 +391,7 @@ drm_intel_gem_dump_validation_list(drm_intel_bufmgr_gem *bufmgr_gem)
 			    (unsigned long long)bo_gem->relocs[j].offset,
 			    target_gem->gem_handle,
 			    target_gem->name,
-			    target_bo->offset,
+			    target_bo->offset64,
 			    bo_gem->relocs[j].delta);
 		}
 	}
@@ -911,6 +911,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
 
 	bo_gem->bo.size = open_arg.size;
 	bo_gem->bo.offset = 0;
+	bo_gem->bo.offset64 = 0;
 	bo_gem->bo.virtual = NULL;
 	bo_gem->bo.bufmgr = bufmgr;
 	bo_gem->name = name;
@@ -1706,7 +1707,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 	    target_bo_gem->gem_handle;
 	bo_gem->relocs[bo_gem->reloc_count].read_domains = read_domains;
 	bo_gem->relocs[bo_gem->reloc_count].write_domain = write_domain;
-	bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset;
+	bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset64;
 
 	bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo;
 	if (target_bo != bo)
@@ -1857,11 +1858,12 @@ drm_intel_update_buffer_offsets(drm_intel_bufmgr_gem *bufmgr_gem)
 		drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 
 		/* Update the buffer offset */
-		if (bufmgr_gem->exec_objects[i].offset != bo->offset) {
+		if (bufmgr_gem->exec_objects[i].offset != bo->offset64) {
 			DBG("BO %d (%s) migrated: 0x%08lx -> 0x%08llx\n",
-			    bo_gem->gem_handle, bo_gem->name, bo->offset,
+			    bo_gem->gem_handle, bo_gem->name, bo->offset64,
 			    (unsigned long long)bufmgr_gem->exec_objects[i].
 			    offset);
+			bo->offset64 = bufmgr_gem->exec_objects[i].offset;
 			bo->offset = bufmgr_gem->exec_objects[i].offset;
 		}
 	}
@@ -1877,10 +1879,11 @@ drm_intel_update_buffer_offsets2 (drm_intel_bufmgr_gem *bufmgr_gem)
 		drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
 
 		/* Update the buffer offset */
-		if (bufmgr_gem->exec2_objects[i].offset != bo->offset) {
+		if (bufmgr_gem->exec2_objects[i].offset != bo->offset64) {
 			DBG("BO %d (%s) migrated: 0x%08lx -> 0x%08llx\n",
-			    bo_gem->gem_handle, bo_gem->name, bo->offset,
+			    bo_gem->gem_handle, bo_gem->name, bo->offset64,
 			    (unsigned long long)bufmgr_gem->exec2_objects[i].offset);
+			bo->offset64 = bufmgr_gem->exec2_objects[i].offset;
 			bo->offset = bufmgr_gem->exec2_objects[i].offset;
 		}
 	}
@@ -2388,6 +2391,7 @@ drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment)
 	if (ret != 0)
 		return -errno;
 
+	bo->offset64 = pin.offset;
 	bo->offset = pin.offset;
 	return 0;
 }

commit 02f93c21e6e1c3dad9d99349989daa84a8c0b5fb
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Jan 15 00:38:39 2014 -0800

    intel: Track whether a buffer is idle to avoid trips to the kernel.
    
    I've seen a number of apps spending unreasonable amounts of time in
    drm_intel_bo_busy during the buffer mapping process.
    
    We can't track idleness in general, in the case of buffers shared
    across processes.  But this should significantly reduce our overhead
    for checking for busy on things like VBOs.
    
    Improves (unoptimized) glamor x11perf -f8text by 0.243334% +/-
    0.161498% (n=1549), which has formerly been spending about .5% of its
    time hitting the kernel for drm_intel_gem_bo_busy().
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index ad722dd..e20e2c4 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -212,6 +212,15 @@ struct _drm_intel_bo_gem {
 	bool reusable;
 
 	/**
+	 * Boolean of whether the GPU is definitely not accessing the buffer.
+	 *
+	 * This is only valid when reusable, since non-reusable
+	 * buffers are those that have been shared wth other
+	 * processes, so we don't know their state.
+	 */
+	bool idle;
+
+	/**
 	 * Size in bytes of this buffer and its relocation descendents.
 	 *
 	 * Used to avoid costly tree walking in
@@ -567,11 +576,19 @@ drm_intel_gem_bo_busy(drm_intel_bo *bo)
 	struct drm_i915_gem_busy busy;
 	int ret;
 
+	if (bo_gem->reusable && bo_gem->idle)
+		return false;
+
 	VG_CLEAR(busy);
 	busy.handle = bo_gem->gem_handle;
 
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_BUSY, &busy);
-
+	if (ret == 0) {
+		bo_gem->idle = !busy.busy;
+		return busy.busy;
+	} else {
+		return false;
+	}
 	return (ret == 0 && busy.busy);
 }
 
@@ -2219,6 +2236,8 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
 		drm_intel_bo *bo = bufmgr_gem->exec_bos[i];
 		drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 
+		bo_gem->idle = false;
+
 		/* Disconnect the buffer from the validate list */
 		bo_gem->validate_index = -1;
 		bufmgr_gem->exec_bos[i] = NULL;
@@ -2314,6 +2333,8 @@ skip_execution:
 		drm_intel_bo *bo = bufmgr_gem->exec_bos[i];
 		drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
 
+		bo_gem->idle = false;
+
 		/* Disconnect the buffer from the validate list */
 		bo_gem->validate_index = -1;
 		bufmgr_gem->exec_bos[i] = NULL;

commit 734de7093db296912da0027e4fa1094f60787c11
Author: Eric Anholt <eric@anholt.net>
Date:   Sat Dec 28 22:06:51 2013 -0800

    drm: Initialize or valgrind-clear modesetting ioctl arguments.
    
    Fixes valgrind complaints in the modesetting driver.  I tried to
    follow each ioctl's pattern for whether it was initializing just the
    in values, or both in and out values.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

diff --git a/Makefile.am b/Makefile.am
index f726036..826c30d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,6 +59,8 @@ libdrm_la_LDFLAGS = -version-number 2:4:0 -no-undefined
 libdrm_la_LIBADD = @CLOCK_LIB@
 
 libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
+AM_CFLAGS = \
+	$(VALGRIND_CFLAGS)
 
 libdrm_la_SOURCES =				\
 	xf86drm.c				\
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 6b60c35..dd7966e 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -41,6 +41,10 @@
 #include <sys/ioctl.h>
 #include <stdio.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "xf86drmMode.h"
 #include "xf86drm.h"
 #include <drm.h>
@@ -49,6 +53,16 @@
 #include <unistd.h>
 #include <errno.h>
 
+#ifdef HAVE_VALGRIND
+#include <valgrind.h>
+#include <memcheck.h>
+#define VG(x) x
+#else
+#define VG(x)
+#endif
+
+#define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s)))
+
 #define U642VOID(x) ((void *)(unsigned long)(x))
 #define VOID2U64(x) ((uint64_t)(unsigned long)(x))
 
@@ -245,6 +259,7 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
 	struct drm_mode_fb_cmd f;
 	int ret;
 
+	VG_CLEAR(f);
 	f.width  = width;
 	f.height = height;
 	f.pitch  = pitch;
@@ -335,6 +350,7 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
 	struct drm_mode_crtc crtc;
 	drmModeCrtcPtr r;
 
+	VG_CLEAR(crtc);
 	crtc.crtc_id = crtcId;
 
 	if (drmIoctl(fd, DRM_IOCTL_MODE_GETCRTC, &crtc))
@@ -368,6 +384,7 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
 {
 	struct drm_mode_crtc crtc;
 
+	VG_CLEAR(crtc);
 	crtc.x             = x;
 	crtc.y             = y;
 	crtc.crtc_id       = crtcId;
@@ -436,6 +453,7 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
 	drmModeEncoderPtr r = NULL;
 
 	enc.encoder_id = encoder_id;
+	enc.crtc_id = 0;
 	enc.encoder_type = 0;
 	enc.possible_crtcs = 0;
 	enc.possible_clones = 0;
@@ -580,6 +598,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
 	struct drm_mode_get_property prop;
 	drmModePropertyPtr r;
 
+	VG_CLEAR(prop);
 	prop.prop_id = property_id;
 	prop.count_enum_blobs = 0;
 	prop.count_values = 0;

commit 64f469520e94cff4957f1afa150d29a0ce0c0335
Author: Julien Cristau <jcristau@debian.org>
Date:   Mon Jan 20 13:52:07 2014 +0100

    Remove Cyril Brulebois from Uploaders.

diff --git a/debian/changelog b/debian/changelog
index 696da55..6b22b7f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libdrm (2.4.51-2) UNRELEASED; urgency=medium
+
+  * Remove Cyril Brulebois from Uploaders.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:51:56 +0100
+
 libdrm (2.4.51-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/control b/debian/control
index 59f4b7c..0bd1bae 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,6 @@
 Source: libdrm
 Priority: optional
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
-Uploaders: Cyril Brulebois <kibi@debian.org>
 Build-Depends:
  debhelper (>= 9),
  dh-autoreconf,

commit a22245badafa033bc53f2d0ba70d321c1ee36a9f
Author: Julien Cristau <jcristau@debian.org>
Date:   Mon Jan 20 13:45:52 2014 +0100

    Upload to unstable

diff --git a/debian/changelog b/debian/changelog
index 3475e34..696da55 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,8 @@
-libdrm (2.4.51-1) UNRELEASED; urgency=medium
+libdrm (2.4.51-1) unstable; urgency=medium
 
   * New upstream release.
 
- -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:45:23 +0100
+ -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:45:50 +0100
 
 libdrm (2.4.50-1) unstable; urgency=low
 

commit 39cb650458e36b4bdfb9f5bc1b0fadf43e91add0
Author: Julien Cristau <jcristau@debian.org>
Date:   Mon Jan 20 13:45:40 2014 +0100

    Bump changelog

diff --git a/debian/changelog b/debian/changelog
index dca1dc1..3475e34 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libdrm (2.4.51-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 20 Jan 2014 13:45:23 +0100
+
 libdrm (2.4.50-1) unstable; urgency=low
 
   * New upstream release.

commit e1559095c1c3e1b56b33cb9280553fc33d1fd9a9
Author: Julien Cristau <jcristau@debian.org>
Date:   Mon Jan 20 13:41:10 2014 +0100

    Delete changelog, not shipped in upstream tarballs

diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 3c3a9ae..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,40372 +0,0 @@
-commit 4c5de721c4ef96ef412fd6af4cb415f04a7515f6
-Author: Marek Olšák <marek.olsak@amd.com>
-Date:   Tue Dec 3 19:50:22 2013 +0100
-
-    Bump the version to 2.4.50
-
-commit c3d96897de647bd5f6d4802c108a3f65a307d61b
-Author: Keith Packard <keithp@keithp.com>
-Date:   Fri Nov 22 05:31:01 2013 -0800
-
-     intel: Track known prime buffers for re-use
-    
-    If the application sends us a file descriptor pointing at a prime
-    buffer that we've already got, we have to re-use the same bo_gem
-    structure or chaos will result.
-    
-    Track the set of all known prime objects and look to see if the kernel
-    has returned one of those for a new file descriptor.
-    
-    Also checks for prime buffers in the flink case.
-    
-    Signed-off-by: Keith Packard <keithp@keithp.com>
-    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-
-commit c8a437f4c76527b3c8385699ccee07f35fe3f166
-Author: Michel Dänzer <michel.daenzer@amd.com>
-Date:   Tue Nov 26 18:16:03 2013 +0900
-
-    radeon: Update unaligned offset for 2D->1D tiling transition on SI
-    
-    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71983
-    
-    Tested-by: Arek Ruśniak <arek.rusi@gmail.com>
-
-commit 7ddc98f92f92560e2b52287ae8cf816ca4a057de
-Author: Marek Olšák <marek.olsak@amd.com>
-Date:   Sat Nov 23 01:27:57 2013 +0100
-
-    Bump the version for release
-
-commit 3f4648902296efa3a8cc0abc941d978637f0ee28
-Author: Marek Olšák <marek.olsak@amd.com>
-Date:   Sat Nov 23 00:34:45 2013 +0100
-
-    radeon: handle P16 pipe configs for Hawaii
-
-commit f0e399d8f0c3c006687e0fc8e68268087607d5f5
-Author: Michel Dänzer <michel.daenzer@amd.com>
-Date:   Mon Nov 18 11:40:08 2013 +0100
-
-    radeon: don't overallocate stencil by 4 on SI and CIK
-    
-    Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
-
-commit 67d92404d62044972599dcef3011d17fca46eed5
-Author: Marek Olšák <marek.olsak@amd.com>
-Date:   Fri Nov 22 23:31:13 2013 +0100
-
-    radeon: implement 2D tiling for CIK
-    
-    Bug fixes and simplification by Marek.
-    We have to use the tile index of 0 for non-MSAA depth-stencil after all.
-    
-    Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
-    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-
-commit ce8af454259279c14c44bcd32c429640ca5e1691
-Author: Michel Dänzer <michel.daenzer@amd.com>
-Date:   Thu Nov 14 16:40:30 2013 +0100
-
-    radeon: fix mipmap level 0 and 1 alignment for SI and CIK
-    
-    Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
-    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-
-commit 0c3fd8708fc54b4b46f5db20d34eb29508537b08
-Author: Ian Romanick <ian.d.romanick@intel.com>
-Date:   Wed Nov 20 08:32:14 2013 -0800
-
-    intel: Use memset instead of VG_CLEAR
-    
-    The ioctl expects that certain fields will be zeroed, so we should allow
-    the helper function to actually work in non-Valgrind builds.
-    
-    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-    Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-    Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
-    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-
-commit c601444a900d67be7ab84714c2908356de359655
-Author: Thomas Hellstrom <thellstrom@vmware.com>
-Date:   Tue Nov 19 07:50:11 2013 +0100
-
-    libdrm/mode: Update the encoder and connector defines
-    
-    Update the defines to match the kernel drm_mode.h
-    
-    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-
-commit 71beb7b07950d9088d754cf7baf0421f5f264e48
-Author: Ian Romanick <ian.d.romanick@intel.com>
-Date:   Fri Nov 15 18:01:08 2013 -0800
-
-    libdrm: bump to 2.4.48
-
-commit 5a41b025042c42788977e67aea8d1bf3b59baae4
-Author: Ian Romanick <ian.d.romanick@intel.com>
-Date:   Fri Nov 15 10:24:43 2013 -0800
-
-    intel: Add support for GPU reset status query ioctl
-    
-    I would have just used the drmIoctl interface directly in Mesa, but the
-    ioctl needs some data from the drm_intel_context that is not exposed
-    outside libdrm.
-    
-    This ioctl is in the drm-intel-next tree as b635991.
-    
-    v2: Update based on Mika's kernel work.
-    
-    v3: Fix compile failures from last-minute typos.  Sigh.
-    
-    v4: Import the actual changes from the kernel i915_drm.h.  Only comments
-    on some fields of drm_i915_reset_stats differed.  There are still some
-    deltas between the kernel i915_drm.h and the one in libdrm, but those
-    can be resolved in other patches.
-    
-    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v3]
-    Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
-    Cc: Mika Kuoppala <mika.kuoppala@intel.com>
-    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
-
-commit 1a84eea45bf9d3915698a04199c594a63fcca4a2
-Author: Alex Deucher <alexander.deucher@amd.com>
-Date:   Tue Sep 24 11:30:19 2013 -0400
-
-    radeon: add hawaii pci ids
-    
-    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-
-commit efcc456030334a692e2fce7bbd279df3aee13a6d
-Author: Alex Deucher <alexander.deucher@amd.com>
-Date:   Tue Sep 24 11:27:11 2013 -0400
-
-    radeon: add hawaii chip family
-    
-    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-
-commit da738d1ed0a0941a0cd061395ad86072171b3242
-Author: Dave Airlie <airlied@redhat.com>
-Date:   Fri Nov 8 16:40:18 2013 +1000
-
-    Revert "intel: Add support for GPU reset status query ioctl"
-    
-    This reverts commit 6335e1d28c422050024bcf4100c4fb3a5bac2afb.
-    
-    No taxation without representation, in other words no userspace without kernel
-    stuff being in a stable location, either drm-next but I'll accept drm-intel-next
-    for intel specific stuff.
-
-commit 6335e1d28c422050024bcf4100c4fb3a5bac2afb
-Author: Ian Romanick <ian.d.romanick@intel.com>
-Date:   Mon Sep 10 14:15:02 2012 +0300
-
-    intel: Add support for GPU reset status query ioctl
-    
-    I would have just used the drmIoctl interface directly in Mesa, but the
-    ioctl needs some data from the drm_intel_context that is not exposed
-    outside libdrm.
-    
-    v2: Update based on Mika's kernel work.
-    
-    v3: Fix compile failures from last-minute typos.  Sigh.
-    
-    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-    Cc: Mika Kuoppala <mika.kuoppala@intel.com>
-    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
-
-commit dad3c6b9791920f2bda1193d76f260827c4cd3f1
-Author: Damien Lespiau <damien.lespiau@intel.com>
-Date:   Fri Feb 15 16:44:05 2013 +0000
-
-    intel/bdw: Update MI_BATCH_BUFFER_START for aub dumps
-    
-    The command now takes a 48bits address and is thus 1 dword longer.
-    
-    v2 (Ben): commit message: s/byte/dword (Eric)
-    
-    Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
-    Reviewed-by: Eric Anholt <eric@anholt.net>
-    Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-
-commit a0c126dcedb8be64c644321c2b2836723117064b
-Author: Kenneth Graunke <kenneth@whitecape.org>
-Date:   Fri Feb 15 09:29:46 2013 -0800
-
-    intel/bdw/aub: Update AUB trace block writes for 48-bit addressing.
-    
-    Since our aub file dumping's GTT handling is totally fake, we always put
-    everything in the low 4GB anyway and shouldn't ever need to set
-    AddressHigh to anything other than 0.


Reply to: