Skip to content

Commit 038c95a

Browse files
mwiniarsickle
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]>
1 parent c0dcb20 commit 038c95a

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
@@ -1185,14 +1185,14 @@ validate_exec_list(struct drm_device *dev,
11851185
if (exec[i].offset !=
11861186
gen8_canonical_addr(exec[i].offset & PAGE_MASK))
11871187
return -EINVAL;
1188-
1189-
/* From drm_mm perspective address space is continuous,
1190-
* so from this point we're always using non-canonical
1191-
* form internally.
1192-
*/
1193-
exec[i].offset = gen8_noncanonical_addr(exec[i].offset);
11941188
}
11951189

1190+
/* From drm_mm perspective address space is continuous,
1191+
* so from this point we're always using non-canonical
1192+
* form internally.
1193+
*/
1194+
exec[i].offset = gen8_noncanonical_addr(exec[i].offset);
1195+
11961196
if (exec[i].alignment && !is_power_of_2(exec[i].alignment))
11971197
return -EINVAL;
11981198

0 commit comments

Comments
 (0)