From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH 1/3] drm/i915: Create dumb buffer from LMEM
Date: Thu, 26 Sep 2019 10:51:33 +0530 [thread overview]
Message-ID: <20190926052135.29911-1-ramalingam.c@intel.com> (raw)
When LMEM is supported, dumb buffer preferred to be created from LMEM.
This is developed on top of v3 LMEM series
https://patchwork.freedesktop.org/series/56683/.
v2:
Parameters are reshuffled. [Chris]
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
cc: Matthew Auld <matthew.auld@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e458507b1558..6810a549ee98 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -44,6 +44,7 @@
#include "gem/i915_gem_clflush.h"
#include "gem/i915_gem_context.h"
#include "gem/i915_gem_ioctls.h"
+#include "gem/i915_gem_lmem.h"
#include "gem/i915_gem_pm.h"
#include "gt/intel_engine_user.h"
#include "gt/intel_gt.h"
@@ -160,6 +161,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
static int
i915_gem_create(struct drm_file *file,
struct drm_i915_private *dev_priv,
+ enum intel_region_id mem_region,
u64 *size_p,
u32 *handle_p)
{
@@ -173,7 +175,12 @@ i915_gem_create(struct drm_file *file,
return -EINVAL;
/* Allocate the new object */
- obj = i915_gem_object_create_shmem(dev_priv, size);
+ if (mem_region == INTEL_MEMORY_LMEM)
+ obj = i915_gem_object_create_lmem(dev_priv, size, 0);
+ else if (mem_region == INTEL_MEMORY_STOLEN)
+ obj = i915_gem_object_create_stolen(dev_priv, size);
+ else
+ obj = i915_gem_object_create_shmem(dev_priv, size);
if (IS_ERR(obj))
return PTR_ERR(obj);
@@ -193,6 +200,7 @@ i915_gem_dumb_create(struct drm_file *file,
struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
+ enum intel_region_id mem_region = INTEL_MEMORY_UKNOWN;
int cpp = DIV_ROUND_UP(args->bpp, 8);
u32 format;
@@ -219,7 +227,11 @@ i915_gem_dumb_create(struct drm_file *file,
args->pitch = ALIGN(args->pitch, 4096);
args->size = args->pitch * args->height;
- return i915_gem_create(file, to_i915(dev),
+
+ if (HAS_LMEM(to_i915(dev)))
+ mem_region = INTEL_MEMORY_LMEM;
+
+ return i915_gem_create(file, to_i915(dev), mem_region,
&args->size, &args->handle);
}
@@ -238,7 +250,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
i915_gem_flush_free_objects(dev_priv);
- return i915_gem_create(file, dev_priv,
+ return i915_gem_create(file, dev_priv, INTEL_MEMORY_UKNOWN,
&args->size, &args->handle);
}
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2019-09-26 5:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 5:21 Ramalingam C [this message]
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 ` [PATCH v2 " Ramalingam C
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=20190926052135.29911-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