Skip to content

Commit 2316a86

Browse files
Nirmoy Dasalexdeucher
authored andcommitted
drm/amdgpu: change hw sched list on ctx priority override
Switch to appropriate sched list for an entity on priority override. Signed-off-by: Nirmoy Das <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent b37aced commit 2316a86

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,29 @@ struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
515515
return fence;
516516
}
517517

518+
static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx,
519+
struct amdgpu_ctx_entity *aentity,
520+
int hw_ip,
521+
enum drm_sched_priority priority)
522+
{
523+
struct amdgpu_device *adev = ctx->adev;
524+
enum gfx_pipe_priority hw_prio;
525+
struct drm_gpu_scheduler **scheds = NULL;
526+
unsigned num_scheds;
527+
528+
/* set sw priority */
529+
drm_sched_entity_set_priority(&aentity->entity, priority);
530+
531+
/* set hw priority */
532+
if (hw_ip == AMDGPU_HW_IP_COMPUTE) {
533+
hw_prio = amdgpu_ctx_sched_prio_to_compute_prio(priority);
534+
scheds = adev->gfx.compute_prio_sched[hw_prio];
535+
num_scheds = adev->gfx.num_compute_sched[hw_prio];
536+
drm_sched_entity_modify_sched(&aentity->entity, scheds,
537+
num_scheds);
538+
}
539+
}
540+
518541
void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx,
519542
enum drm_sched_priority priority)
520543
{
@@ -527,13 +550,11 @@ void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx,
527550
ctx->init_priority : ctx->override_priority;
528551
for (i = 0; i < AMDGPU_HW_IP_NUM; ++i) {
529552
for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) {
530-
struct drm_sched_entity *entity;
531-
532553
if (!ctx->entities[i][j])
533554
continue;
534555

535-
entity = &ctx->entities[i][j]->entity;
536-
drm_sched_entity_set_priority(entity, ctx_prio);
556+
amdgpu_ctx_set_entity_priority(ctx, ctx->entities[i][j],
557+
i, ctx_prio);
537558
}
538559
}
539560
}

0 commit comments

Comments
 (0)