From: Damien Lespiau <damien.lespiau@intel.com>
To: arun.siluvery@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC] drm/i915: Add variable gem object size support to i915
Date: Wed, 25 Jun 2014 11:51:33 +0100 [thread overview]
Message-ID: <20140625105133.GA3938@strange.amr.corp.intel.com> (raw)
In-Reply-To: <1398697289-5607-1-git-send-email-arun.siluvery@linux.intel.com>
On Mon, Apr 28, 2014 at 04:01:29PM +0100, arun.siluvery@linux.intel.com wrote:
> From: "Siluvery, Arun" <arun.siluvery@intel.com>
>
> This patch adds support to have gem objects of variable size.
> The size of the gem object obj->size is always constant and this fact
> is tightly coupled in the driver; this implementation allows to vary
> its effective size using an interface similar to fallocate().
>
> A new ioctl() is introduced to mark a range as scratch/usable.
> Once marked as scratch, associated backing store is released and the
> region is filled with scratch pages. The region can also be unmarked
> at a later point in which case new backing pages are created.
> The range can be anywhere within the object space, it can have multiple
> ranges possibly overlapping forming a large contiguous range.
>
> There is only one single scratch page and Kernel allows to write to this
> page; userspace need to keep track of scratch page range otherwise any
> subsequent writes to these pages will overwrite previous content.
>
> This feature is useful where the exact size of the object is not clear
> at the time of its creation, in such case we usually create an object
> with more than the required size but end up using it partially.
> In devices where there are tight memory constraints it would be useful
> to release that additional space which is currently unused. Using this
> interface the region can be simply marked as scratch which releases
> its backing store thus reducing the memory pressure on the kernel.
>
> Many thanks to Daniel, ChrisW, Tvrtko, Bob for the idea and feedback
> on this implementation.
>
> v2: fix holes in error handling and use consistent data types (Tvrtko)
> - If page allocation fails simply return error; do not try to invoke
> shrinker to free backing store.
> - Release new pages created by us in case of error during page allocation
> or sg_table update.
> - Use 64-bit data types for start and length values to avoid truncation.
>
(This is not necessarily things one would need to take into account for
this work, just a few thoughts).
One thing I'm wondering is how fitting the "size" parameter really is
when talking about inherently 2D buffers.
For instance, let's take a Y-tiled texture with MIPLAYOUT_RIGHT, if we
want to allocate mip map levels 0 and 1, and use the ioctl "naively" to
reserve the LOD1 region in one go, we'll end up over allocating the
space below LOD1 (if I'm not mistaken that is).
This can be mitigated by several calls to this fallocate ioctl, to
reserve columns of pages (in the case above, columns for the LOD1
region).
So, how about trying to reduce this ioctl overhead by providing a list
of (start, length) in the ioctl structure?
--
Damien
next prev parent reply other threads:[~2014-06-25 10:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 15:01 [RFC] drm/i915: Add variable gem object size support to i915 arun.siluvery
2014-05-09 21:18 ` Volkin, Bradley D
2014-05-10 13:42 ` Siluvery, Arun
2014-05-12 16:32 ` Volkin, Bradley D
2014-05-12 16:19 ` Daniel Vetter
2014-05-12 17:02 ` Eric Anholt
2014-05-23 14:54 ` Siluvery, Arun
2014-06-25 10:51 ` Damien Lespiau [this message]
2014-06-25 11:14 ` Damien Lespiau
2014-06-25 11:46 ` Siluvery, Arun
2014-06-25 12:57 ` Damien Lespiau
2014-06-25 13:26 ` Tvrtko Ursulin
2014-06-25 13:34 ` Damien Lespiau
2014-07-07 8:34 ` Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2014-04-25 12:48 arun.siluvery
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=20140625105133.GA3938@strange.amr.corp.intel.com \
--to=damien.lespiau@intel.com \
--cc=arun.siluvery@linux.intel.com \
--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