public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: sourab.gupta@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: "Cc: Daniel Vetter" <daniel.vetter@intel.com>,
	Sourab Gupta <sourab.gupta@intel.com>,
	"Cc: Jesse Barnes" <jesse.barnes@intel.com>,
	Akash Goel <akash.goel@intel.com>,
	"Cc: Chris Wilson" <chris.wilson@intel.com>
Subject: [RFC 1/3] drm/i915: Added a new 'I915_CPU_MAP_NOT_NEEDED' flag to gem_create ioctl.
Date: Wed,  5 Mar 2014 17:05:38 +0530	[thread overview]
Message-ID: <1394019340-8811-2-git-send-email-sourab.gupta@intel.com> (raw)
In-Reply-To: <1394019340-8811-1-git-send-email-sourab.gupta@intel.com>

From: Sourab Gupta <sourab.gupta@intel.com>

Adding the flag 'I915_CPU_MAP_NOT_NEEDED' to gem_create ioctl.
This is to indicate the driver that direct cpu access to this
buffer object is not needed and hence Driver can opt to use Stolen
area as a backing store for it.

Testcase: igt/gem_stolen_mem

Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>

Signed-off-by: Akash Goel <akash.goel@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |    6 ++++++
 drivers/gpu/drm/i915/i915_gem.c |   12 +++++++++---
 include/uapi/drm/i915_drm.h     |    3 ++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 05cfcc1..8a066a7 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1714,6 +1714,12 @@ struct drm_i915_gem_object {
 	unsigned int has_global_gtt_mapping:1;
 	unsigned int has_dma_mapping:1;
 
+	/*
+	 * Is the object not required to be accessed from CPU
+	 */
+	unsigned int cpu_map_not_needed:1;
+
+
 	struct sg_table *pages;
 	int pages_pin_count;
 
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3618bb0..8421b80 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -224,7 +224,9 @@ static int
 i915_gem_create(struct drm_file *file,
 		struct drm_device *dev,
 		uint64_t size,
-		uint32_t *handle_p)
+		uint32_t *handle_p,
+		uint32_t flags)
+
 {
 	struct drm_i915_gem_object *obj;
 	int ret;
@@ -245,6 +247,10 @@ i915_gem_create(struct drm_file *file,
 	if (ret)
 		return ret;
 
+        if (flags & I915_CPU_MAP_NOT_NEEDED)
+		obj->cpu_map_not_needed = 1;
+
+
 	*handle_p = handle;
 	return 0;
 }
@@ -258,7 +264,7 @@ i915_gem_dumb_create(struct drm_file *file,
 	args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
 	args->size = args->pitch * args->height;
 	return i915_gem_create(file, dev,
-			       args->size, &args->handle);
+			       args->size, &args->handle, args->flags);
 }
 
 /**
@@ -271,7 +277,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_gem_create *args = data;
 
 	return i915_gem_create(file, dev,
-			       args->size, &args->handle);
+			       args->size, &args->handle, args->flags);
 }
 
 static inline int
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 126bfaa..8625f54 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -431,7 +431,8 @@ struct drm_i915_gem_create {
 	 * Object handles are nonzero.
 	 */
 	__u32 handle;
-	__u32 pad;
+	__u32 flags;
+#define I915_CPU_MAP_NOT_NEEDED 0x1
 };
 
 struct drm_i915_gem_pread {
-- 
1.7.9.5

  reply	other threads:[~2014-03-05 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 11:35 [RFC 0/3] Increase the utilization of Stolen area on VLV sourab.gupta
2014-03-05 11:35 ` sourab.gupta [this message]
2014-03-05 11:35 ` [RFC 2/3] i915/drm: Increase the utilization of stolen memory " sourab.gupta
2014-03-05 11:35 ` [RFC 3/3] drm/i915: Add the truncation logic for Stolen objects sourab.gupta
2014-03-05 11:49   ` Chris Wilson
2014-03-05 12:26     ` Gupta, Sourab
2014-03-05 12:45       ` Chris Wilson
2014-03-05 19:24         ` Gupta, Sourab
2014-03-05 19:47           ` Daniel Vetter
2014-03-06  9:39             ` Gupta, Sourab
2014-03-06  9:48               ` Daniel Vetter
2014-03-06 10:48                 ` Gupta, Sourab
2014-03-06 11:17                   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394019340-8811-2-git-send-email-sourab.gupta@intel.com \
    --to=sourab.gupta@intel.com \
    --cc=akash.goel@intel.com \
    --cc=chris.wilson@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jesse.barnes@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox