Skip to content

Commit d51a75a

Browse files
committed
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: Gustavo Sousa <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 6da8acf commit d51a75a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/gpu/drm/xe/xe_rtp.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,15 @@ EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_ctx_enable_active_tracking);
221221

222222
static void rtp_mark_active(struct xe_device *xe,
223223
struct xe_rtp_process_ctx *ctx,
224-
unsigned int first, unsigned int last)
224+
unsigned int first, unsigned int n_entries)
225225
{
226226
if (!ctx->active_entries)
227227
return;
228228

229-
if (drm_WARN_ON(&xe->drm, last > ctx->n_entries))
229+
if (drm_WARN_ON(&xe->drm, first + n_entries > ctx->n_entries))
230230
return;
231231

232-
if (first == last)
233-
bitmap_set(ctx->active_entries, first, 1);
234-
else
235-
bitmap_set(ctx->active_entries, first, last - first + 1);
232+
bitmap_set(ctx->active_entries, first, n_entries);
236233
}
237234

238235
/**
@@ -277,8 +274,7 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,
277274
}
278275

279276
if (match)
280-
rtp_mark_active(xe, ctx, entry - entries,
281-
entry - entries);
277+
rtp_mark_active(xe, ctx, entry - entries, 1);
282278
}
283279
}
284280
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_to_sr);
@@ -324,7 +320,7 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
324320
entry--;
325321

326322
rtp_mark_active(xe, ctx, first_entry - entries,
327-
entry - entries);
323+
entry - first_entry + 1);
328324
}
329325
}
330326
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process);

0 commit comments

Comments
 (0)