Skip to content

Commit 6e7eb17

Browse files
mwiniarsjnikula
authored andcommitted
drm/i915: Always convert incoming exec offsets to non-canonical
We're using non-canonical addresses in drm_mm, and we're making sure that userspace is using canonical addressing - both in case of softpin (verifying incoming offset) and when relocating (converting to canonical when updating offset returned to userspace). Unfortunately when considering the need for relocations, we're comparing offset from userspace (in canonical form) with drm_mm node (in non-canonical form), and as a result, we end up always relocating if our offsets are in the "problematic" range. Let's always convert the offsets to avoid the performance impact of relocations. Fixes: a5f0edf ("drm/i915: Avoid writing relocs with addresses in non-canonical form") Cc: Chris Wilson <[email protected]> Cc: Michel Thierry <[email protected]> Reported-by: Michał Pyrzowski <[email protected]> Signed-off-by: Michał Winiarski <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Chris Wilson <[email protected]> (cherry picked from commit 038c95a) Signed-off-by: Jani Nikula <[email protected]>
1 parent 83bf6d5 commit 6e7eb17

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/gpu/drm/i915/i915_gem_execbuffer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,14 +1181,14 @@ validate_exec_list(struct drm_device *dev,
11811181
if (exec[i].offset !=
11821182
gen8_canonical_addr(exec[i].offset & PAGE_MASK))
11831183
return -EINVAL;
1184-
1185-
/* From drm_mm perspective address space is continuous,
1186-
* so from this point we're always using non-canonical
1187-
* form internally.
1188-
*/
1189-
exec[i].offset = gen8_noncanonical_addr(exec[i].offset);
11901184
}
11911185

1186+
/* From drm_mm perspective address space is continuous,
1187+
* so from this point we're always using non-canonical
1188+
* form internally.
1189+
*/
1190+
exec[i].offset = gen8_noncanonical_addr(exec[i].offset);
1191+
11921192
if (exec[i].alignment && !is_power_of_2(exec[i].alignment))
11931193
return -EINVAL;
11941194

0 commit comments

Comments
 (0)