History

drm/i915: Add TTM offset argument to mmap.

The FIXED mapping is only used for ttm, and tells userspace that the mapping type is pre-defined. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well. Document the struct as well, so it shows up in docbook.

Maarten Lankhorst committed 5 years ago

Commit 7961c5b1 parent 15eb0834 files · +78 −14Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/drm/i915_drm.h+36−11
@@ -849,31 +849,56 @@ struct drm_i915_gem_mmap_gtt { · 848 unmodified lines
849 __u64 offset;849 __u64 offset;
850};850};
851 851
852/**
853 * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
854 *
855 * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
856 * and is used to retrieve the fake offset to mmap an object specified by &handle.
857 *
858 * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
859 * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
860 * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
861 */
852struct drm_i915_gem_mmap_offset {862struct drm_i915_gem_mmap_offset {
853 /** Handle for the object being mapped. */863 /** @handle: Handle for the object being mapped. */
854 __u32 handle;864 __u32 handle;
865 /** @pad: Must be zero */
855 __u32 pad;866 __u32 pad;
856 /**867 /**
857 * Fake offset to use for subsequent mmap call868 * @offset: The fake offset to use for subsequent mmap call
858 *869 *
859 * This is a fixed-size type for 32/64 compatibility.870 * This is a fixed-size type for 32/64 compatibility.
860 */871 */
861 __u64 offset;872 __u64 offset;
862 873
863 /**874 /**
864 * Flags for extended behaviour.875 * @flags: Flags for extended behaviour.
865 *876 *
866 * It is mandatory that one of the MMAP_OFFSET types877 * It is mandatory that one of the `MMAP_OFFSET` types
867 * (GTT, WC, WB, UC, etc) should be included.878 * should be included:
879 *
880 * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT. (Write-Combined)
881 * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
882 * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
883 * - `I915_MMAP_OFFSET_FIXED`: Use object placement to determine caching.
884 *
885 * On devices with local memory `I915_MMAP_OFFSET_FIXED` is the only valid
886 * type. On devices without local memory, this caching mode is invalid.
887 *
888 * As caching mode when specifying `I915_MMAP_OFFSET_FIXED`, WC or WB will
889 * be used, depending on the object placement on creation. WB will be used
890 * when the object can only exist in system memory, WC otherwise.
868 */891 */
869 __u64 flags;892 __u64 flags;
870#define I915_MMAP_OFFSET_GTT 0
871#define I915_MMAP_OFFSET_WC 1
872#define I915_MMAP_OFFSET_WB 2
873#define I915_MMAP_OFFSET_UC 3
874 893
875 /*894#define I915_MMAP_OFFSET_GTT 0
876 * Zero-terminated chain of extensions.895#define I915_MMAP_OFFSET_WC 1
896#define I915_MMAP_OFFSET_WB 2
897#define I915_MMAP_OFFSET_UC 3
898#define I915_MMAP_OFFSET_FIXED 4
899
900 /**
901 * @extensions: Zero-terminated chain of extensions.
877 *902 *
878 * No current extensions defined; mbz.903 * No current extensions defined; mbz.
879 */904 */