diff mbox

[2/3] drm/i915: Support for the clflush of pre-populated pages

Message ID 1440417496-3175-3-git-send-email-ankitprasad.r.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

ankitprasad.r.sharma@intel.com Aug. 24, 2015, 11:58 a.m. UTC
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>

This patch provides a support for the User to immediately flush
out the cachelines for the pre-populated pages of an object, at the
time of its creation. This will not lead to any redundancy and would
further reduce the time for which the 'struct_mutex' is kept locked in
execbuffer path, as cache flush of the newly allocated pages is anyways
done when the object is submitted to GPU.

Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 2 +-
 drivers/gpu/drm/i915/i915_gem.c | 3 +++
 include/uapi/drm/i915_drm.h     | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

Comments

Chris Wilson Aug. 24, 2015, 12:43 p.m. UTC | #1
On Mon, Aug 24, 2015 at 05:28:15PM +0530, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> 
> This patch provides a support for the User to immediately flush
> out the cachelines for the pre-populated pages of an object, at the
> time of its creation. This will not lead to any redundancy and would
> further reduce the time for which the 'struct_mutex' is kept locked in
> execbuffer path, as cache flush of the newly allocated pages is anyways
> done when the object is submitted to GPU.
> 
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 955aa16..eb0b31d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -171,7 +171,7 @@  static int i915_getparam(struct drm_device *dev, void *data,
 		value = HAS_RESOURCE_STREAMER(dev);
 		break;
 	case I915_PARAM_CREATE_VERSION:
-		value = 3;
+		value = 4;
 		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3904feb..dc3435f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -422,6 +422,9 @@  i915_gem_create(struct drm_file *file,
 		if (ret)
 			return ret;
 
+		if (flags & I915_CREATE_FLUSH)
+			i915_gem_object_flush_cpu_write_domain(obj);
+
 		mutex_lock(&dev->struct_mutex);
 		list_add_tail(&obj->global_list, &dev_priv->mm.unbound_list);
 		mutex_unlock(&dev->struct_mutex);
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 26ea715..547305a 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -469,7 +469,8 @@  struct drm_i915_gem_create {
 	__u32 flags;
 #define I915_CREATE_PLACEMENT_STOLEN 	(1<<0) /* Cannot use CPU mmaps */
 #define I915_CREATE_POPULATE		(1<<1) /* Pre-populate object pages */
-#define __I915_CREATE_UNKNOWN_FLAGS	-(I915_CREATE_POPULATE << 1)
+#define I915_CREATE_FLUSH		(1<<2) /* Clflush prepopulated pages */
+#define __I915_CREATE_UNKNOWN_FLAGS	-(I915_CREATE_FLUSH << 1)
 };
 
 struct drm_i915_gem_pread {