From: Ramalingam C <ramalingam.c@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915/dumb: return the allocated memory size
Date: Mon, 6 Jan 2020 12:19:31 +0530 [thread overview]
Message-ID: <20200106064931.GB29868@intel.com> (raw)
In-Reply-To: <157783622738.11133.14762984348391872908@skylake-alporthouse-com>
On 2019-12-31 at 23:50:27 +0000, Chris Wilson wrote:
> Quoting Ramalingam C (2019-12-30 13:23:51)
> > 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);
>
> How? How did we create an object that was not a multiple of the minimum
> page size?
We round_up to PAGE_SIZE at i915_gem_create. But page size varies
between memory regions. So we might need to round up the size requested at
i915_gem_object_create_region!? So that we can consider the page size of
the region used for allocation?
>
> (Besides you should be using obj->mm.region here rather than assuming,
> so more rearrangement if this is the right approach.)
Yes this i will fix it. This is just to report the right size to dumb
buffer. If we move the round up of the size requested at i915_gem_object_create_region
this change can be removed.
-Ram
> -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-01-06 6:50 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 ` [Intel-gfx] [PATCH 3/3] drm/i915/dumb: return the allocated memory size Ramalingam C
2019-12-31 23:50 ` Chris Wilson
2020-01-06 6:49 ` Ramalingam C [this message]
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=20200106064931.GB29868@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.