public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH v2 2/3] drm/i915: Allowed memory region for GEM obj
Date: Fri, 27 Sep 2019 14:38:33 +0530	[thread overview]
Message-ID: <20190927090833.16383-1-ramalingam.c@intel.com> (raw)
In-Reply-To: <20190926052135.29911-2-ramalingam.c@intel.com>

Each GEM object is initialized with allowed memory regions for
it's migration across memory region.

In future patch we are restricting the memory regions or few objects.

This is developed on top of v3 LMEM series
https://patchwork.freedesktop.org/series/56683/

v2:
  dev_priv is retrieved from obj [Chris]

CC: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c       | 9 +++++++++
 drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 0f33da5e541d..165ae03c6774 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -51,6 +51,8 @@ void i915_gem_object_free(struct drm_i915_gem_object *obj)
 void i915_gem_object_init(struct drm_i915_gem_object *obj,
 			  const struct drm_i915_gem_object_ops *ops)
 {
+	struct drm_i915_file_private *dev_priv = to_i915(obj->base.drm);
+
 	mutex_init(&obj->mm.lock);
 
 	spin_lock_init(&obj->vma.lock);
@@ -70,6 +72,8 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
 	obj->mm.madv = I915_MADV_WILLNEED;
 	INIT_RADIX_TREE(&obj->mm.get_page.radix, GFP_KERNEL | __GFP_NOWARN);
 	mutex_init(&obj->mm.get_page.lock);
+
+	obj->memory_regions = INTEL_INFO(dev_priv)->memory_regions;
 }
 
 /**
@@ -534,6 +538,11 @@ static int i915_gem_object_region_select(struct drm_i915_private *dev_priv,
 		u32 region = uregions_copy[i];
 		enum intel_region_id id = __region_id(region);
 
+		if (!(obj->memory_regions & region)) {
+			ret = -EINVAL;
+			continue;
+		}
+
 		if (id == INTEL_MEMORY_UKNOWN) {
 			ret = -EINVAL;
 			goto err;
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
index 7b93450a860b..af5505e0bd0a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
@@ -286,6 +286,9 @@ struct drm_i915_gem_object {
 
 	/** for phys allocated objects */
 	struct drm_dma_handle *phys_handle;
+
+	/* Allowed memory regions for this obj to reside in. */
+	u32 memory_regions;
 };
 
 static inline struct drm_i915_gem_object *
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-09-27  9:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26  5:21 [PATCH 1/3] drm/i915: Create dumb buffer from LMEM Ramalingam C
2019-09-26  5:21 ` [PATCH 2/3] drm/i915: Allowed memory region for GEM obj Ramalingam C
2019-09-26  7:23   ` Chris Wilson
2019-09-27  9:08   ` Ramalingam C [this message]
2019-09-26  5:21 ` [PATCH 3/3] drm/i915: FB backing gem obj should reside in LMEM Ramalingam C
2019-09-26  8:53   ` Tvrtko Ursulin
2019-09-26  9:13     ` Chris Wilson
2019-09-27  9:12       ` Ramalingam C
2019-09-27  9:26         ` Chris Wilson
2019-09-27  9:30           ` Ramalingam C
2019-09-26  9:14     ` Ramalingam C
2019-09-26  9:58       ` Tvrtko Ursulin
2019-09-27  9:09   ` [PATCH v2 " Ramalingam C
2019-09-26  8:55 ` [PATCH 1/3] drm/i915: Create dumb buffer from LMEM Tvrtko Ursulin
2019-09-26  9:04   ` Ramalingam C
2019-09-27 10:11 ` ✗ Fi.CI.BUILD: failure for series starting with [1/3] drm/i915: Create dumb buffer from LMEM (rev3) Patchwork

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=20190927090833.16383-1-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@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