Commit d51a75ac authored by Lucas De Marchi's avatar Lucas De Marchi

drm/xe/rtp: Simplify marking active workarounds

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: default avatarGustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240727015907.899192-7-lucas.demarchi@intel.comSigned-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
parent 6da8acfd
...@@ -221,18 +221,15 @@ EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_ctx_enable_active_tracking); ...@@ -221,18 +221,15 @@ EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_ctx_enable_active_tracking);
static void rtp_mark_active(struct xe_device *xe, static void rtp_mark_active(struct xe_device *xe,
struct xe_rtp_process_ctx *ctx, struct xe_rtp_process_ctx *ctx,
unsigned int first, unsigned int last) unsigned int first, unsigned int n_entries)
{ {
if (!ctx->active_entries) if (!ctx->active_entries)
return; return;
if (drm_WARN_ON(&xe->drm, last > ctx->n_entries)) if (drm_WARN_ON(&xe->drm, first + n_entries > ctx->n_entries))
return; return;
if (first == last) bitmap_set(ctx->active_entries, first, n_entries);
bitmap_set(ctx->active_entries, first, 1);
else
bitmap_set(ctx->active_entries, first, last - first + 1);
} }
/** /**
...@@ -277,8 +274,7 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx, ...@@ -277,8 +274,7 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,
} }
if (match) if (match)
rtp_mark_active(xe, ctx, entry - entries, rtp_mark_active(xe, ctx, entry - entries, 1);
entry - entries);
} }
} }
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_to_sr); EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_to_sr);
...@@ -324,7 +320,7 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx, ...@@ -324,7 +320,7 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
entry--; entry--;
rtp_mark_active(xe, ctx, first_entry - entries, rtp_mark_active(xe, ctx, first_entry - entries,
entry - entries); entry - first_entry + 1);
} }
} }
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process); EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment