public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [RFC 0/3] Add new ioctl to resize gem object for deferred allocation
@ 2014-03-27 15:28 arun.siluvery
  2014-03-27 15:28 ` [RFC 1/3] drm/i915: Prepare gem object to handle resize arun.siluvery
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: arun.siluvery @ 2014-03-27 15:28 UTC (permalink / raw)
  To: intel-gfx

From: "Siluvery, Arun" <arun.siluvery@intel.com>

This patch series adds a new ioctl to resize a gem object.

This is required in cases where the actual size of the object is not known
at the time of creation and there is chance that we may need more space later.

A typical use case is memory allocation for mipmaps where you cannot know
whether higher level mipmaps are required or not. If the object is resizeable
we can initially allocate only for level0 and when we know that higher levels
are required we can resize and allocate the rest. This is desirable in case of
low memory devices.

The usage scenario is,
1. Driver allocates original single-level texture.
2. GPU blit for level 0 data added to command buffer by driver.
3. OpenGL Driver requests resize of texture with all mip levels.
4. GPU blit for level 1 data added to command buffer by driver.
5. Command buffer submitted.

The size of gem object is constant and this fact is tightly coupled in i915, so
Daniel suggested an alternative approach. In this approach a scratch page is 
used for lazy allocation.

When the object is created, a new parameter is added to specify the size for
which the backing store is required initially along with the total size. 
A scratch page is also created for lazy allocation. The scatter/gather table
is created for the total size but the entries whose backing store is not created
point to the scratch page. A stop marker is introduced to denote the end of
real pages.

When the resize request is received, new pages are created and dummy entries
are updated with real entries.

In the mipmap usecase there ever will be only one resize request so single
stop marker is sufficient to handle this.

There is a basic i-g-t to test this, I will send it as a separate patch.

This is a not a complete implementation, I am sending this mainly to get
feedback. Please review and let me know how this is going in the right 
direction, how it can be improved, missing things and any other suggestions.

regards
Arun


Siluvery, Arun (3):
  drm/i915: Prepare gem object to handle resize
  drm/i915: Handle gem object resize using scratch page for lazy
    allocation
  drm/i915: Create new ioctl to request gem object resize

 drivers/gpu/drm/i915/i915_dma.c |   2 +
 drivers/gpu/drm/i915/i915_drv.h |   9 ++
 drivers/gpu/drm/i915/i915_gem.c | 191 +++++++++++++++++++++++++++++++++++++++-
 include/uapi/drm/i915_drm.h     |  33 +++++++
 4 files changed, 234 insertions(+), 1 deletion(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-07 14:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 15:28 [RFC 0/3] Add new ioctl to resize gem object for deferred allocation arun.siluvery
2014-03-27 15:28 ` [RFC 1/3] drm/i915: Prepare gem object to handle resize arun.siluvery
2014-03-27 15:28 ` [RFC 2/3] drm/i915: Handle gem object resize using scratch page for lazy allocation arun.siluvery
2014-03-27 15:28 ` [RFC 3/3] drm/i915: Create new ioctl to request gem object resize arun.siluvery
2014-03-27 22:23 ` [RFC 0/3] Add new ioctl to resize gem object for deferred allocation Chris Wilson
2014-04-04 10:45   ` Siluvery, Arun
2014-04-07 13:18   ` Siluvery, Arun
2014-04-07 14:54     ` Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox