Introduce a new create ioctl for user specified
Subsystems (3)
cover Introduce a new create ioctl for user specified
From: Sourab Gupta <[email protected]>
This patch series introduces a new gem create ioctl for user specified placement.
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
Chris Wilson (3):
drm/i915: Clearing buffer objects via blitter engine drm/i915: Introduce a new create ioctl for user specified placement drm/i915: Add support for stealing purgable stolen pages
Deepak S (1):
drm/i915: Clearing buffer objects via blitter engine for Gen8
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 18 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_exec.c | 139 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_stolen.c | 121 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 8 files changed, 623 insertions(+), 82 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_exec.c
Signature · 1 line
1.8.5.1
PATCH 1/4 drm/i915: Clearing buffer objects via blitter engine
From: Chris Wilson <[email protected]>
This patch adds support for clearing buffer objects via blitter engines. This is particularly useful for clearing out the memory from stolen region.
testcase: igt/gem_create2
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/i915_gem_exec.c | 120 +++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 drivers/gpu/drm/i915/i915_gem_exec.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -22,6 +22,7 @@ i915-y += i915_cmd_parser.o \ i915_gem_debug.o \ i915_gem_dmabuf.o \ i915_gem_evict.o \ + i915_gem_exec.o \ i915_gem_execbuffer.o \ i915_gem_gtt.o \ i915_gem.o \
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2480,6 +2480,9 @@ int __must_check i915_gem_evict_something(struct drm_device *dev,int i915_gem_evict_vm (struct i915_address_space *vm,bool do_idle);int i915_gem_evict_everything (struct drm_device *dev); +/* i915_gem_exec.c */ +int i915_gem_exec_clear_object (struct drm_i915_gem_object *obj); +/* belongs in i915_gem_gtt.h */ static inline void i915_gem_chipset_flush (struct drm_device *dev) {
drivers/gpu/drm/i915/i915_gem_exec.c new file +120 -0
120 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 drm/i915: Clearing buffer objects via blitter engine for Gen8
In reply to [email protected]From: Deepak S <[email protected]>
On Gen8, COLOR BLT commands are different. Add gen8 specific command to clearing buffer objects via blitter engines.
--- drivers/gpu/drm/i915/i915_gem_exec.c | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem_exec.c +29 -10
@@ -29,6 +29,8 @@#include <drm/i915_drm.h> #include "i915_drv.h" +#define GEN8_COLOR_BLT_CMD (2<<29 | 0x50<<22) +#define COLOR_BLT_CMD (2<<29 | 0x40<<22)#define BLT_WRITE_ALPHA (1<<21)#define BLT_WRITE_RGB (1<<20)
@@ -100,18 +102,35 @@ int i915_gem_exec_clear_object(struct drm_i915_gem_object *obj)if (ret) goto unpin; - ret =intel_ring_begin (ring,6 ); -if (ret) - goto unpin; +if (IS_GEN8 (dev)) { + ret =intel_ring_begin (ring,8 ); +if (ret) + goto unpin; -intel_ring_emit (ring,COLOR_BLT_CMD |BLT_WRITE_RGBA | (5 -2 )); -intel_ring_emit (ring,BPP_32 |ROP_FILL_COPY |PAGE_SIZE ); -intel_ring_emit (ring, obj->base.size >>PAGE_SHIFT <<16 |PAGE_SIZE ); -intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj)); -intel_ring_emit (ring,0 ); -intel_ring_emit (ring,MI_NOOP ); +intel_ring_emit (ring,GEN8_COLOR_BLT_CMD |BLT_WRITE_RGBA | (7 -2 )); +intel_ring_emit (ring,BPP_32 |ROP_FILL_COPY |PAGE_SIZE ); +intel_ring_emit (ring,0 ); +intel_ring_emit (ring, obj->base.size >>PAGE_SHIFT <<16 |PAGE_SIZE /4 ); +intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj)); +intel_ring_emit (ring,0 ); +intel_ring_emit (ring,0 ); +intel_ring_emit (ring,MI_NOOP ); + +__intel_ring_advance (ring); + }else { + ret =intel_ring_begin (ring,6 ); +if (ret) + goto unpin; -__intel_ring_advance (ring); +intel_ring_emit (ring,COLOR_BLT_CMD |BLT_WRITE_RGBA | (5 -2 )); +intel_ring_emit (ring,BPP_32 |ROP_FILL_COPY |PAGE_SIZE ); +intel_ring_emit (ring, obj->base.size >>PAGE_SHIFT <<16 |PAGE_SIZE ); +intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj)); +intel_ring_emit (ring,0 ); +intel_ring_emit (ring,MI_NOOP ); + +__intel_ring_advance (ring); + }i915_gem_exec_dirty_object (obj, ring); unpin:
Signature · 1 line
1.8.5.1
PATCH v4 3/4 drm/i915: Introduce a new create ioctl for user specified placement
In reply to [email protected]From: Chris Wilson <[email protected]>
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
v2: Expand the struct slightly to include cache domains, and ensure that all memory allocated by the kernel for userspace is zeroed.
v3: Ben suggested the idea of binding the object at a known offset into the target context upon creation.
v4: Revert the removal of DRM_AUTH from some ioctls, which got squashed in by mistake (Damien)
testcase: igt/gem_create2
--- drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 15 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 5 files changed, 370 insertions(+), 71 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +3 -2
@@ -2010,8 +2010,8 @@ const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_GEM_MMAP_GTT , i915_gem_mmap_gtt_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_SET_DOMAIN , i915_gem_set_domain_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_SW_FINISH , i915_gem_sw_finish_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (I915_GEM_SET_TILING , i915_gem_set_tiling,DRM_UNLOCKED |DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (I915_GEM_GET_TILING , i915_gem_get_tiling,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (I915_GEM_SET_TILING , i915_gem_set_tiling_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (I915_GEM_GET_TILING , i915_gem_get_tiling_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_GET_APERTURE , i915_gem_get_aperture_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GET_PIPE_FROM_CRTC_ID , intel_get_pipe_from_crtc_id,DRM_UNLOCKED ), DRM_IOCTL_DEF_DRV(I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
@@ -2025,6 +2025,7 @@ const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_REG_READ , i915_reg_read_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GET_RESET_STATS , i915_get_reset_stats_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_USERPTR , i915_gem_userptr_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), + DRM_IOCTL_DEF_DRV(I915_GEM_CREATE2, i915_gem_create2_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), };int i915_max_ioctl =ARRAY_SIZE (i915_ioctls);
drivers/gpu/drm/i915/i915_drv.h +11 -4
@@ -2157,6 +2157,8 @@ int i915_gem_init_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int i915_gem_create_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +int i915_gem_create2_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);int i915_gem_pread_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
@@ -2191,10 +2193,10 @@ int i915_gem_entervt_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int i915_gem_leavevt_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); -int i915_gem_set_tiling (struct drm_device *dev,void *data, -struct drm_file *file_priv); -int i915_gem_get_tiling (struct drm_device *dev,void *data, -struct drm_file *file_priv); +int i915_gem_set_tiling_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv); +int i915_gem_get_tiling_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);int i915_gem_init_userptr (struct drm_device *dev);int i915_gem_userptr_ioctl (struct drm_device *dev,void *data,struct drm_file *file);
@@ -2319,6 +2321,8 @@ static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv)void i915_gem_reset (struct drm_device *dev);bool i915_gem_clflush_object (struct drm_i915_gem_object *obj,bool force); +int __must_check i915_gem_object_set_tiling (struct drm_i915_gem_object *obj, +int tiling_mode,int pitch);int __must_check i915_gem_object_finish_gpu (struct drm_i915_gem_object *obj);int __must_check i915_gem_init (struct drm_device *dev);int __must_check i915_gem_init_hw (struct drm_device *dev);
@@ -2351,6 +2355,9 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj,int i915_gem_open (struct drm_device *dev,struct drm_file *file);void i915_gem_release (struct drm_device *dev,struct drm_file *file); +bool +i915_tiling_ok (struct drm_device *dev,int stride,int size,int tiling_mode); +uint32_t i915_gem_get_gtt_size (struct drm_device *dev,uint32_t size,int tiling_mode);uint32_t
drivers/gpu/drm/i915/i915_gem.c +189 -19
247 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_tiling.c +60 -46
135 lines not on this page · raw message
include/uapi/drm/i915_drm.h +107 -0
125 lines not on this page · raw message
Signature · 1 line
1.8.5.1
PATCH v2 4/4 drm/i915: Add support for stealing purgable stolen pages
In reply to [email protected]From: Chris Wilson <[email protected]>
If we run out of stolen memory when trying to allocate an object, see if we can reap enough purgeable objects to free up enough contiguous free space for the allocation. This is in principle very much like evicting objects to free up enough contiguous space in the vma when binding a new object - and you will be forgiven for thinking that the code looks very similar.
At the moment, we do not allow userspace to allocate objects in stolen, so there is neither the memory pressure to trigger stolen eviction nor any purgeable objects inside the stolen arena. However, this will change in the near future, and so better management and defragmentation of stolen memory will become a real issue.
v2: Remember to remove the drm_mm_node.
testcase: igt/gem_create2
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 121 ++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +110 -11
@@ -340,18 +340,29 @@ cleanup:return NULL ; } -struct drm_i915_gem_object * -i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +static bool mark_free (struct drm_i915_gem_object *obj,struct list_head *unwind) +{ +if (obj->stolen ==NULL ) +return false; + +if (obj->madv !=I915_MADV_DONTNEED ) +return false; + +if (i915_gem_obj_is_pinned (obj)) +return false; + +list_add (&obj->obj_exec_link, unwind); +return drm_mm_scan_add_block (obj->stolen); +} + +static struct drm_mm_node * +stolen_alloc (struct drm_i915_private *dev_priv,u32 size) { -struct drm_i915_private *dev_priv = dev->dev_private; -struct drm_i915_gem_object *obj;struct drm_mm_node *stolen; +struct drm_i915_gem_object *obj; +struct list_head unwind, evict;int ret; -if (!drm_mm_initialized (&dev_priv->mm.stolen)) -return NULL ; - -DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size);if (size ==0 )return NULL ;
@@ -361,11 +372,99 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size) ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size,4096 ,DRM_MM_SEARCH_DEFAULT ); -if (ret) { -kfree (stolen); -return NULL ; +if (ret ==0 ) +return stolen; + +/* No more stolen memory available, or too fragmented. +* Try evicting purgeable objects and search again. +*/ + +drm_mm_init_scan (&dev_priv->mm.stolen, size,4096 ,0 ); +INIT_LIST_HEAD (&unwind); + +list_for_each_entry (obj, &dev_priv->mm.unbound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +list_for_each_entry (obj, &dev_priv->mm.bound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +found: +INIT_LIST_HEAD (&evict); +while (!list_empty (&unwind)) { + obj =list_first_entry (&unwind, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (drm_mm_scan_remove_block (obj->stolen)) { +list_add (&obj->obj_exec_link, &evict); +drm_gem_object_reference (&obj->base); + } } + ret =0 ; +while (!list_empty (&evict)) { + obj =list_first_entry (&evict, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (ret ==0 ) { +struct i915_vma *vma, *vma_next; + +list_for_each_entry_safe (vma, vma_next, + &obj->vma_list, + vma_link) +if (i915_vma_unbind (vma)) +break ; + +/* Stolen pins its pages to prevent the +* normal shrinker from processing stolen +* objects. +*/ +i915_gem_object_unpin_pages (obj); + + ret =i915_gem_object_put_pages (obj); +if (ret ==0 ) { +i915_gem_object_release_stolen (obj); + obj->madv = __I915_MADV_PURGED; + }else +i915_gem_object_pin_pages (obj); + } + +drm_gem_object_unreference (&obj->base); + } + +if (ret ==0 ) + ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size, +4096 ,DRM_MM_SEARCH_DEFAULT ); +if (ret ==0 ) +return stolen; + +kfree (stolen); +return NULL ; +} + +struct drm_i915_gem_object * +i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_gem_object *obj; +struct drm_mm_node *stolen; + +lockdep_assert_held (&dev->struct_mutex); + +if (!drm_mm_initialized (&dev_priv->mm.stolen)) +return NULL ; + +DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size); + + stolen =stolen_alloc (dev_priv, size); +if (stolen ==NULL ) +return NULL ; + obj =_i915_gem_object_create_stolen (dev, stolen);if (obj)return obj;
Signature · 1 line
1.8.5.1
Quoted 38 lines · Sourab
From: Sourab Gupta <[email protected]>
This patch series introduces a new gem create ioctl for user specified placement.
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
Chris Wilson (3):
drm/i915: Clearing buffer objects via blitter engine drm/i915: Introduce a new create ioctl for user specified placement drm/i915: Add support for stealing purgable stolen pagesDeepak S (1):
drm/i915: Clearing buffer objects via blitter engine for Gen8
Quoted 11 lines
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 18 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_exec.c | 139 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_stolen.c | 121 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 8 files changed, 623 insertions(+), 82 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_exec.c
Hi,
Can somebody please review this patch series, alongwith the libdrm changes(http://lists.freedesktop.org/archives/intel-gfx/2014-June/047296.html) and igt (http://lists.freedesktop.org/archives/intel-gfx/2014-June/047295.html)
Thanks,
Sourab
Quoted 51 lines · sourab gupta
Quoted 38 lines · Sourab
From: Sourab Gupta <[email protected]>
This patch series introduces a new gem create ioctl for user specified placement.
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
Chris Wilson (3):
drm/i915: Clearing buffer objects via blitter engine drm/i915: Introduce a new create ioctl for user specified placement drm/i915: Add support for stealing purgable stolen pagesDeepak S (1):
drm/i915: Clearing buffer objects via blitter engine for Gen8Quoted 11 lines
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 18 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_exec.c | 139 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_stolen.c | 121 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 8 files changed, 623 insertions(+), 82 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_exec.c
Quoted 6 lines
Hi,
Can somebody please review this patch series, alongwith the libdrm changes(http://lists.freedesktop.org/archives/intel-gfx/2014-June/047296.html) and igt (http://lists.freedesktop.org/archives/intel-gfx/2014-June/047295.html)Thanks,
Sourab
Hi,
Can you please review this patch series.
Thanks,
Sourab
Quoted 56 lines · Sourab
Quoted 55 lines · sourab gupta
Quoted 38 lines · Sourab
From: Sourab Gupta <[email protected]>
This patch series introduces a new gem create ioctl for user specified placement.
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
Chris Wilson (3):
drm/i915: Clearing buffer objects via blitter engine drm/i915: Introduce a new create ioctl for user specified placement drm/i915: Add support for stealing purgable stolen pagesDeepak S (1):
drm/i915: Clearing buffer objects via blitter engine for Gen8Quoted 11 lines
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 18 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_exec.c | 139 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_stolen.c | 121 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 8 files changed, 623 insertions(+), 82 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_exec.cHi,
Can somebody please review this patch series, alongwith the libdrm changes(http://lists.freedesktop.org/archives/intel-gfx/2014-June/047296.html) and igt (http://lists.freedesktop.org/archives/intel-gfx/2014-June/047295.html)
Quoted 5 lines
Quoted 2 lines
Thanks,
SourabHi,
Can you please review this patch series.
So on a quick look the kernel side looks sane. The async blitter clear will have integration issues with the execlist stuff, so having a cpu clear might be useful and adding the blt clear as a second step. Please coordinate with the execlist owner.
What's definitely missing is igt coverage. I think we need at least:
- Basic ioctl coverage for create2, including cross-checking with older ioctls.
- Testcase for stolen memory including checking that impossible operations are all caught correctly.
- Exercising the stolen reaping of purgeable objects.
- Checking that stolen objects are properly cleared.
See http://blog.ffwll.ch/2013/11/testing-requirements-for-drmi915.html for general testing requirements and
http://blog.ffwll.ch/2013/11/botching-up-ioctls.html for the special considerations ioctls require.
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 56 lines · Daniel Vetter
Quoted 55 lines · Sourab
Quoted 54 lines · sourab gupta
Quoted 47 lines · Sourab
From: Sourab Gupta <[email protected]>
This patch series introduces a new gem create ioctl for user specified placement.
Despite being a unified memory architecture (UMA) some bits of memory are more equal than others. In particular we have the thorny issue of stolen memory, memory stolen from the system by the BIOS and reserved for igfx use. Stolen memory is required for some functions of the GPU and display engine, but in general it goes wasted. Whilst we cannot return it back to the system, we need to find some other method for utilising it. As we do not support direct access to the physical address in the stolen region, it behaves like a different class of memory, closer in kin to local GPU memory. This strongly suggests that we need a placement model like TTM if we are to fully utilize these discrete chunks of differing memory.
This new create ioctl therefore exists to allow the user to create these second class buffer objects from stolen memory. At the moment direct access by the CPU through mmaps and pread/pwrite are verboten on the objects, and so the user must be aware of the limitations of the objects created. Yet, those limitations rarely reduce the desired functionality in many use cases and so the user should be able to easily fill the stolen memory and so help to reduce overall memory pressure.
The most obvious use case for stolen memory is for the creation of objects for the display engine which already have very similar restrictions on access. However, we want a reasonably general ioctl in order to cater for diverse scenarios beyond the author's imagination.
Chris Wilson (3):
drm/i915: Clearing buffer objects via blitter engine drm/i915: Introduce a new create ioctl for user specified placement drm/i915: Add support for stealing purgable stolen pagesDeepak S (1):
drm/i915: Clearing buffer objects via blitter engine for Gen8drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_dma.c | 5 +- drivers/gpu/drm/i915/i915_drv.h | 18 ++- drivers/gpu/drm/i915/i915_gem.c | 208 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_exec.c | 139 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_stolen.c | 121 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem_tiling.c | 106 +++++++++-------- include/uapi/drm/i915_drm.h | 107 +++++++++++++++++ 8 files changed, 623 insertions(+), 82 deletions(-)Quoted 2 lines
create mode 100644
drivers/gpu/drm/i915/i915_gem_exec.cHi,
Can somebody please review this patch series, alongwith the libdrm changes(http://lists.freedesktop.org/archives/intel-gfx/2014-June/047296.html) and igt (http://lists.freedesktop.org/archives/intel-gfx/2014-June/047295.html)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Thanks,
SourabHi,
Can you please review this patch series.So on a quick look the kernel side looks sane. The async blitter clear will have integration issues with the execlist stuff, so having a cpu clear might be useful and adding the blt clear as a second step. Please coordinate with the execlist owner.
+ Thomas to help us with this.
Quoted 14 lines
What's definitely missing is igt coverage. I think we need at least:
- Basic ioctl coverage for create2, including cross-checking with older ioctls.
- Testcase for stolen memory including checking that impossible operations are all caught correctly.
- Exercising the stolen reaping of purgeable objects.
- Checking that stolen objects are properly cleared.See http://blog.ffwll.ch/2013/11/testing-requirements-for-drmi915.html for general testing requirements and
http://blog.ffwll.ch/2013/11/botching-up-ioctls.html for the special considerations ioctls require.Thanks, Daniel