public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/4] intel: Remove stale comment.
@ 2011-10-28 20:17 Eric Anholt
  2011-10-28 20:17 ` [PATCH 2/4] intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done Eric Anholt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Anholt @ 2011-10-28 20:17 UTC (permalink / raw)
  To: intel-gfx

This used to be next to some map refcounting code, but that is long dead.
---
 intel/intel_bufmgr_gem.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

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;
 
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done.
  2011-10-28 20:17 [PATCH 1/4] intel: Remove stale comment Eric Anholt
@ 2011-10-28 20:17 ` Eric Anholt
  2011-10-28 20:17 ` [PATCH 3/4] intel: Share the implementation of BO unmap between CPU and GTT mappings Eric Anholt
  2011-10-28 20:17 ` [PATCH 4/4] configure: version bump for 2.4.27 release Eric Anholt
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2011-10-28 20:17 UTC (permalink / raw)
  To: intel-gfx

---
 intel/intel_bufmgr_gem.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

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);
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] intel: Share the implementation of BO unmap between CPU and GTT mappings.
  2011-10-28 20:17 [PATCH 1/4] intel: Remove stale comment Eric Anholt
  2011-10-28 20:17 ` [PATCH 2/4] intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done Eric Anholt
@ 2011-10-28 20:17 ` Eric Anholt
  2011-10-28 20:17 ` [PATCH 4/4] configure: version bump for 2.4.27 release Eric Anholt
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2011-10-28 20:17 UTC (permalink / raw)
  To: intel-gfx

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.
---
 intel/intel_bufmgr_gem.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

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)
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] configure: version bump for 2.4.27 release.
  2011-10-28 20:17 [PATCH 1/4] intel: Remove stale comment Eric Anholt
  2011-10-28 20:17 ` [PATCH 2/4] intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done Eric Anholt
  2011-10-28 20:17 ` [PATCH 3/4] intel: Share the implementation of BO unmap between CPU and GTT mappings Eric Anholt
@ 2011-10-28 20:17 ` Eric Anholt
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2011-10-28 20:17 UTC (permalink / raw)
  To: intel-gfx

Push the new Intel API for use by mesa.
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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])
 
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-28 20:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 20:17 [PATCH 1/4] intel: Remove stale comment Eric Anholt
2011-10-28 20:17 ` [PATCH 2/4] intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done Eric Anholt
2011-10-28 20:17 ` [PATCH 3/4] intel: Share the implementation of BO unmap between CPU and GTT mappings Eric Anholt
2011-10-28 20:17 ` [PATCH 4/4] configure: version bump for 2.4.27 release Eric Anholt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox