Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm/v3d: CPU job submissions shouldn't affect V3D GPU clock #6611

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions drivers/gpu/drm/v3d/v3d_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ v3d_lookup_bos(struct drm_device *dev,
}

static void
v3d_job_free(struct kref *ref)
v3d_job_free_common(struct v3d_job *job,
bool is_gpu_job)
{
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
struct v3d_dev *v3d = job->v3d;
int i;

Expand All @@ -140,14 +140,31 @@ v3d_job_free(struct kref *ref)
dma_fence_put(job->irq_fence);
dma_fence_put(job->done_fence);

v3d_clock_up_put(v3d);
if (is_gpu_job)
v3d_clock_up_put(v3d);

if (job->perfmon)
v3d_perfmon_put(job->perfmon);

kfree(job);
}

static void
v3d_job_free(struct kref *ref)
{
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);

v3d_job_free_common(job, true);
}

static void
v3d_cpu_job_free(struct kref *ref)
{
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);

v3d_job_free_common(job, false);
}

static void
v3d_render_job_free(struct kref *ref)
{
Expand Down Expand Up @@ -242,8 +259,9 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
if (ret && ret != -ENOENT)
goto fail_deps;
}
if (queue != V3D_CPU)
v3d_clock_up_get(v3d);

v3d_clock_up_get(v3d);
kref_init(&job->refcount);

return 0;
Expand Down Expand Up @@ -1350,7 +1368,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
trace_v3d_submit_cpu_ioctl(&v3d->drm, cpu_job->job_type);

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
v3d_job_free, 0, &se, V3D_CPU);
v3d_cpu_job_free, 0, &se, V3D_CPU);
if (ret) {
v3d_job_deallocate((void *)&cpu_job);
goto fail;
Expand Down
Loading