Re: [RFC v2 1/1] drm/lima: Add optional devfreq support

From: Martin Blumenstingl
Date: Tue Dec 31 2019 - 09:20:01 EST


Hi Qiang,

On Tue, Dec 31, 2019 at 3:54 AM Qiang Yu <yuq825@xxxxxxxxx> wrote:
[...]
> > diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c
> > index f522c5f99729..851c496a168b 100644
> > --- a/drivers/gpu/drm/lima/lima_sched.c
> > +++ b/drivers/gpu/drm/lima/lima_sched.c
> > @@ -5,6 +5,7 @@
> > #include <linux/slab.h>
> > #include <linux/xarray.h>
> >
> > +#include "lima_devfreq.h"
> > #include "lima_drv.h"
> > #include "lima_sched.h"
> > #include "lima_vm.h"
> > @@ -213,6 +214,8 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)
> > */
> > ret = dma_fence_get(task->fence);
> >
> > + lima_devfreq_record_busy(pipe->ldev);
> > +
> > pipe->current_task = task;
> >
> > /* this is needed for MMU to work correctly, otherwise GP/PP
> > @@ -280,6 +283,8 @@ static void lima_sched_handle_error_task(struct lima_sched_pipe *pipe,
> > pipe->current_vm = NULL;
> > pipe->current_task = NULL;
> >
> > + lima_devfreq_record_idle(pipe->ldev);
> > +
> > drm_sched_resubmit_jobs(&pipe->base);
> > drm_sched_start(&pipe->base, true);
> > }
> > @@ -348,6 +353,8 @@ void lima_sched_pipe_fini(struct lima_sched_pipe *pipe)
> >
> > void lima_sched_pipe_task_done(struct lima_sched_pipe *pipe)
> > {
> > + lima_devfreq_record_idle(pipe->ldev);
>
> This should be moved to the else {} part of the following code. As you
> have added the save
> idle record to the lima_sched_handle_error_task which is just the if
> {} part of the following
> code, so no need to call it twice for error tasks. BTW.
> lima_sched_handle_error_task is also
> used for timeout tasks, so add idle record in it is fine.
oh, that is a good catch - thank you!
I will fix that in the next version


Martin