intel: New libdrm interface to create unbound wc user mappings for objects
PATCH 1/1 intel: New libdrm interface to create unbound wc user mappings for objects
From: Akash Goel <[email protected]>
A new libdrm interface 'drm_intel_gem_bo_map_wc' is provided by this patch. Through this interface Gfx clients can create write combining virtual mappings of the Gem object. It will provide the same funtionality of 'mmap_gtt' interface without the constraints of limited aperture space, but provided clients handles the linear to tile conversion on their own. This patch is intended for improving the CPU write operation performance, as with such mapping, writes are almost 50% faster than with mmap_gtt. Also it avoids the Cache flush after update from CPU side, when object is passed on to GPU, which will be the case if regular mmap interface is used. This type of mapping is specially useful in case of sub-region update, i.e. when only a portion of the object is to be updated. Also there is a support for the unsynchronized version of this interface named 'drm_intel_gem_bo_map_wc_unsynchronized', through which wc virtual mappings, but unsynchronized one, can be created of the Gem object. To ensure the cache coherency, before using this mapping, the GTT domain has been reused here. This provides the required Cache flush if the object is in CPU domain or synchronization against the concurrent rendering
The drm_i915_gem_mmap structure (for the DRM_I915_GEM_MMAP_IOCTL) has been extended with a new flags field (defaulting to 0 for existent users). In order for userspace to detect the extended ioctl, a new parameter I915_PARAM_MMAP_VERSION has been added for versioning the ioctl interface.
v2: Aligned with the v2 of the corresponding kernel patch (Chris)
v3: Added the unmap calls for the wc mapping (Damien)
Added the param feature check before creating the wc mapping & reduced the vma limit (Chris)
v4: Removed the extraneous unlock call from map_wc function (Damien)
--- include/drm/i915_drm.h | 9 +++ intel/intel_bufmgr.h | 3 + intel/intel_bufmgr_gem.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+)
include/drm/i915_drm.h +9 -0
@@ -340,6 +340,7 @@ typedef struct drm_i915_irq_wait {#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26#define I915_PARAM_HAS_WT 27#define I915_PARAM_CMD_PARSER_VERSION 28 +#define I915_PARAM_MMAP_VERSION 29 typedef struct drm_i915_getparam { int param;
@@ -487,6 +488,14 @@ struct drm_i915_gem_mmap {* This is a fixed-size type for 32/64 compatibility. */ __u64 addr_ptr; + +/** +* Flags for extended behaviour. +* +* Added in version 2. +*/ +__u64 flags; +#define I915_MMAP_WC 0x1 };struct drm_i915_gem_mmap_gtt {
intel/intel_bufmgr.h +3 -0
@@ -177,6 +177,9 @@ void drm_intel_bufmgr_gem_set_vma_cache_size(drm_intel_bufmgr *bufmgr,int drm_intel_gem_bo_map_unsynchronized (drm_intel_bo *bo);int drm_intel_gem_bo_map_gtt (drm_intel_bo *bo);int drm_intel_gem_bo_unmap_gtt (drm_intel_bo *bo); +int drm_intel_gem_bo_map_wc_unsynchronized (drm_intel_bo *bo); +int drm_intel_gem_bo_map_wc (drm_intel_bo *bo); +int drm_intel_gem_bo_unmap_wc (drm_intel_bo *bo);int drm_intel_gem_bo_get_reloc_count (drm_intel_bo *bo);void drm_intel_gem_bo_clear_relocs (drm_intel_bo *bo,int start);
intel/intel_bufmgr_gem.c +149 -0
221 lines not on this page · raw message
Signature · 6 lines
1.9.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx