Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [Intel-gfx] [PATCH 1/1] i915/gem/i915_gem_execbuffer: Disallow passing alignment
Date: Mon, 22 Nov 2021 20:13:14 +0100	[thread overview]
Message-ID: <20211122191314.47254-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20211122191314.47254-1-zbigniew.kempczynski@intel.com>

Ensure passing alignment is not possible by UMD starting on gens4+.

Inspected UMD code - Mesa, Compute (NEO), Media-Driver, xf86-intel-video
seems to be alignment == 0 ready. Libdrm potentially uses alignment
but it is used in some IGTs which remains intact during libdrm removal
(there's no possibility to properly rewrite those tests due to specific
hw requirement - dual gpus).

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 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 9f7c6ecadb90..cc012d6ffa02 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -505,6 +505,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) < 4)
+		return true;
+
+	return false;
+}
+
 static int
 eb_validate_vma(struct i915_execbuffer *eb,
 		struct drm_i915_gem_exec_object2 *entry,
@@ -513,6 +521,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


  reply	other threads:[~2021-11-22 19:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 19:13 [Intel-gfx] [PATCH 0/1] Ensure zero alignment on gens < 4 Zbigniew Kempczyński
2021-11-22 19:13 ` Zbigniew Kempczyński [this message]
2021-11-22 20:26 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-11-23  1:01 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-11-23  9:49 ` [Intel-gfx] [PATCH 0/1] " Tvrtko Ursulin
2021-11-24  8:04   ` Zbigniew Kempczyński
2021-11-24  8:45     ` Tvrtko Ursulin
2021-11-24 18:07       ` Zbigniew Kempczyński
2022-02-08 21:06         ` Robert Beckett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122191314.47254-2-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox