[Intel-gfx] [PATCH 2/3] drm/i915: Support for the clflush of pre-populated pages
ankitprasad.r.sharma at intel.com
ankitprasad.r.sharma at intel.com
Mon Aug 24 04:58:15 PDT 2015
From: Ankitprasad Sharma <ankitprasad.r.sharma at 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 at 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(-)
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 {
--
1.9.1
More information about the Intel-gfx
mailing list