[Intel-gfx] [RFC 0/3] Add new ioctl to resize gem object for deferred allocation

arun.siluvery at linux.intel.com arun.siluvery at linux.intel.com
Thu Mar 27 16:28:26 CET 2014


From: "Siluvery, Arun" <arun.siluvery at 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




More information about the Intel-gfx mailing list