From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 3/3] drm/i915/dumb: return the allocated memory size
Date: Mon, 30 Dec 2019 18:53:51 +0530 [thread overview]
Message-ID: <20191230132351.17487-4-ramalingam.c@intel.com> (raw)
In-Reply-To: <20191230132351.17487-1-ramalingam.c@intel.com>
On successful allocation, instead returning the requested size
return the total size of allocated pages.
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7f39df3fab7f..5a53de797852 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -241,7 +241,9 @@ i915_gem_dumb_create(struct drm_file *file,
{
enum intel_memory_type mem_type = INTEL_MEMORY_SYSTEM;
int cpp = DIV_ROUND_UP(args->bpp, 8);
+ struct intel_memory_region *mr;
u32 format;
+ int ret;
switch (cpp) {
case 1:
@@ -270,8 +272,15 @@ i915_gem_dumb_create(struct drm_file *file,
if (HAS_LMEM(to_i915(dev)))
mem_type = INTEL_MEMORY_LOCAL;
- return i915_gem_create(file, to_i915(dev), mem_type,
- &args->size, &args->handle);
+ ret = i915_gem_create(file, to_i915(dev), mem_type,
+ &args->size, &args->handle);
+ if (ret)
+ goto out;
+
+ mr = intel_memory_region_by_type(to_i915(dev), mem_type);
+ args->size = ALIGN(args->size, mr->min_page_size);
+out:
+ return ret;
}
/**
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-12-30 13:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 13:23 [Intel-gfx] [PATCH 0/3] dumb buffer patches Ramalingam C
2019-12-30 13:23 ` [Intel-gfx] [PATCH 1/3] drm/i915: lookup for mem_region of a mem_type Ramalingam C
2019-12-30 13:23 ` [Intel-gfx] [PATCH 2/3] drm/i915: Create dumb buffer from LMEM Ramalingam C
2019-12-30 13:23 ` Ramalingam C [this message]
2019-12-31 23:50 ` [Intel-gfx] [PATCH 3/3] drm/i915/dumb: return the allocated memory size Chris Wilson
2020-01-06 6:49 ` Ramalingam C
2019-12-30 14:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success for dumb buffer patches Patchwork
2019-12-30 22:56 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20191230132351.17487-4-ramalingam.c@intel.com \
--to=ramalingam.c@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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