[PATCH 1/1] i915/gem/i915_gem_execbuffer: Disallow passing alignment

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Oct 8 07:36:36 UTC 2021


Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index c75afc8784e3..93bb5b3b5d82 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -497,6 +497,14 @@ static bool platform_has_relocs_enabled(const struct i915_execbuffer *eb)
 	return false;
 }
 
+static bool platform_allows_pass_alignment(const struct i915_execbuffer *eb)
+{
+	if (GRAPHICS_VER(eb->i915) < 9)
+		return true;
+
+	return false;
+}
+
 static int
 eb_validate_vma(struct i915_execbuffer *eb,
 		struct drm_i915_gem_exec_object2 *entry,
@@ -505,6 +513,9 @@ eb_validate_vma(struct i915_execbuffer *eb,
 	if (entry->relocation_count && !platform_has_relocs_enabled(eb))
 		return -EINVAL;
 
+	if (entry->alignment && !platform_allows_pass_alignment(eb))
+		return -EINVAL;
+
 	if (unlikely(entry->flags & eb->invalid_flags))
 		return -EINVAL;
 
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list