diff options
author | Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com> | 2021-09-01 15:44:01 +0530 |
---|---|---|
committer | Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com> | 2021-09-01 20:18:20 +0530 |
commit | 6457f6e63525b84740784102ab3c769a58c16168 (patch) | |
tree | 30d68a3d22118fffe46345557c0bde4b6202f7a7 /lib | |
parent | 080869f804cb86b25a38889e5ce9a870571cd8c4 (diff) |
lib/i915: Use FIXED mapping only for discrete memory
The FIXED mapping is only used for discrete, and mapping type
is pre-defined. This disables the other type of mmap
offsets when discrete memory is used.
Taken from kernel commit:
commit 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.")
Changes since V3:
- Split change in two commits - Matthew Auld
Changes since V2:
- Add previous logic check for GTT offset type - Ashutosh Dixit
- Added documentation for library API change - Daniel Vetter
Changes since V1:
- Make logic more readable - Petri Latvala
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/i915/gem_mman.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index 0406a0b9..aa9ac6f3 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -73,9 +73,27 @@ bool gem_has_legacy_mmap(int fd) return errno != EOPNOTSUPP; } +/** + * gem_has_mmap_offset_type: + * @fd: open i915 drm file descriptor + * @*t: pointer to mmap_offset + * + * This functions checks the mmap offset type is supported or not. + * For discrete memory only FIXED mmap_offset type is supported + * and for non-discrete memory all other offset type except FIXED + * are supported. + * + * Returns: True if supported or False if not. + */ bool gem_has_mmap_offset_type(int fd, const struct mmap_offset *t) { - return gem_has_mmap_offset(fd) || t->type == I915_MMAP_OFFSET_GTT; + if (gem_has_mmap_offset(fd)) + if (gem_has_lmem(fd)) + return t->type == I915_MMAP_OFFSET_FIXED; + else + return t->type != I915_MMAP_OFFSET_FIXED; + else + return t->type == I915_MMAP_OFFSET_GTT; } /** |