Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v3 6/8] drm/xe/rtp: Simplify marking active workarounds
Date: Fri, 26 Jul 2024 18:59:05 -0700	[thread overview]
Message-ID: <20240727015907.899192-7-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240727015907.899192-1-lucas.demarchi@intel.com>

Stop doing the calculation both in rtp_mark_active() and in its caller.
The caller easily knows the number of entries to mark, so just pass it
forward. That also simplifies rtp_mark_active() since now it doesn't
have a special case when handling 1 entry.

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_rtp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c
index 1c641cc0f5a1..86727f34ca25 100644
--- a/drivers/gpu/drm/xe/xe_rtp.c
+++ b/drivers/gpu/drm/xe/xe_rtp.c
@@ -221,18 +221,15 @@ EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_ctx_enable_active_tracking);
 
 static void rtp_mark_active(struct xe_device *xe,
 			    struct xe_rtp_process_ctx *ctx,
-			    unsigned int first, unsigned int last)
+			    unsigned int first, unsigned int n_entries)
 {
 	if (!ctx->active_entries)
 		return;
 
-	if (drm_WARN_ON(&xe->drm, last > ctx->n_entries))
+	if (drm_WARN_ON(&xe->drm, first + n_entries > ctx->n_entries))
 		return;
 
-	if (first == last)
-		bitmap_set(ctx->active_entries, first, 1);
-	else
-		bitmap_set(ctx->active_entries, first, last - first + 1);
+	bitmap_set(ctx->active_entries, first, n_entries);
 }
 
 /**
@@ -277,8 +274,7 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,
 		}
 
 		if (match)
-			rtp_mark_active(xe, ctx, entry - entries,
-					entry - entries);
+			rtp_mark_active(xe, ctx, entry - entries, 1);
 	}
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_to_sr);
@@ -324,7 +320,7 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
 		entry--;
 
 		rtp_mark_active(xe, ctx, first_entry - entries,
-				entry - entries);
+				entry - first_entry + 1);
 	}
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process);
-- 
2.43.0


  parent reply	other threads:[~2024-07-27  1:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-27  1:58 [PATCH v3 0/8] Fix rtp when processing OOB workarounds Lucas De Marchi
2024-07-27  1:59 ` [PATCH v3 1/8] drm/xe/kunit: Test WAs for BMG Lucas De Marchi
2024-07-29 14:28   ` Gustavo Sousa
2024-07-27  1:59 ` [PATCH v3 2/8] drm/xe/kunit: Rename count to count_sr_entries Lucas De Marchi
2024-07-27  1:59 ` [PATCH v3 3/8] drm/xe/kunit: Test active rtp entries Lucas De Marchi
2024-07-27  1:59 ` [PATCH v3 4/8] drm/xe/kunit: Rename rtp test cases Lucas De Marchi
2024-07-27  1:59 ` [PATCH v3 5/8] drm/xe/kunit: Test rtp with no actions Lucas De Marchi
2024-07-27  1:59 ` Lucas De Marchi [this message]
2024-07-27  1:59 ` [PATCH v3 7/8] drm/xe/rtp: Expand max rules/actions per entry again Lucas De Marchi
2024-07-29 14:38   ` Gustavo Sousa
2024-07-29 14:42     ` Lucas De Marchi
2024-07-27  1:59 ` [PATCH v3 8/8] drm/xe: Migrate OOB WAs to OR rules Lucas De Marchi
2024-07-29 17:03   ` Gustavo Sousa
2024-07-27  2:57 ` ✓ CI.Patch_applied: success for Fix rtp when processing OOB workarounds (rev4) Patchwork
2024-07-27  2:57 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-27  2:58 ` ✓ CI.KUnit: success " Patchwork
2024-07-27  3:10 ` ✓ CI.Build: " Patchwork
2024-07-27  3:12 ` ✓ CI.Hooks: " Patchwork
2024-07-27  3:14 ` ✓ CI.checksparse: " Patchwork
2024-07-27 13:21 ` ✗ CI.FULL: failure " Patchwork
2024-07-29  5:34 ` ✓ CI.BAT: success " Patchwork

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=20240727015907.899192-7-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@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