[PATCH 1/7] drm/xe: Add xe_lrc_is_idle() helper
Matthew Brost
matthew.brost at intel.com
Fri Nov 8 22:58:09 UTC 2024
On Fri, Nov 08, 2024 at 05:06:21PM -0500, Dong, Zhanjun wrote:
>
>
> On 2024-11-08 12:43 p.m., Matthew Brost wrote:
> > Add helper to compare ring head and tail to determine if LRC is idle.
> >
> > Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_guc_submit.c | 2 +-
> > drivers/gpu/drm/xe/xe_lrc.c | 13 +++++++++++++
> > drivers/gpu/drm/xe/xe_lrc.h | 2 ++
> > 3 files changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> > index 9e0f86f3778b..e7257c681278 100644
> > --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> > +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> > @@ -1705,7 +1705,7 @@ static void guc_exec_queue_stop(struct xe_guc *guc, struct xe_exec_queue *q)
> > ban = true;
> > }
> > } else if (xe_exec_queue_is_lr(q) &&
> > - (xe_lrc_ring_head(q->lrc[0]) != xe_lrc_ring_tail(q->lrc[0]))) {
> > + !xe_lrc_ring_is_idle(q->lrc[0])) {
> > ban = true;
> > }
> > diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> > index 4b65da77c6e0..e219657535cf 100644
> > --- a/drivers/gpu/drm/xe/xe_lrc.c
> > +++ b/drivers/gpu/drm/xe/xe_lrc.c
> > @@ -1763,3 +1763,16 @@ u32 xe_lrc_update_timestamp(struct xe_lrc *lrc, u32 *old_ts)
> > return lrc->ctx_timestamp;
> > }
> > +
> > +/**
> > + * xe_lrc_is_idle() - LRC is idle
> Mismatched function name here. xe_lrc_ring_is_idle?
>
Yea, CI caught that too. Have it fixed locally and will be included in
next rev.
Matt
> Regards,
> Zhanjun
> > + * @lrc: Pointer to the lrc.
> > + *
> > + * Compare LRC ring head and tail to determine if idle.
> > + *
> > + * Return: True is ring is idle, False otherwise
> > + */
> > +bool xe_lrc_ring_is_idle(struct xe_lrc *lrc)
> > +{
> > + return xe_lrc_ring_head(lrc) == xe_lrc_ring_tail(lrc);
> > +}
> > diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
> > index 40d8f6906d3e..9d64cedc4d14 100644
> > --- a/drivers/gpu/drm/xe/xe_lrc.h
> > +++ b/drivers/gpu/drm/xe/xe_lrc.h
> > @@ -78,6 +78,8 @@ u32 xe_lrc_ring_head(struct xe_lrc *lrc);
> > u32 xe_lrc_ring_space(struct xe_lrc *lrc);
> > void xe_lrc_write_ring(struct xe_lrc *lrc, const void *data, size_t size);
> > +bool xe_lrc_ring_is_idle(struct xe_lrc *lrc);
> > +
> > u32 xe_lrc_indirect_ring_ggtt_addr(struct xe_lrc *lrc);
> > u32 xe_lrc_ggtt_addr(struct xe_lrc *lrc);
> > u32 *xe_lrc_regs(struct xe_lrc *lrc);
>
More information about the Intel-xe
mailing list