Re: [PATCH v6 1/1] drm/amdgpu: set compute queue priority at mqd_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-03-04 4:41 p.m., Luben Tuikov wrote:
> On 2020-03-03 7:50 a.m., Nirmoy Das wrote:
[snip]
>> +	case DRM_SCHED_PRIORITY_HIGH_HW:
>> +	case DRM_SCHED_PRIORITY_KERNEL:
>> +		return AMDGPU_GFX_PIPE_PRIO_HIGH;
>> +	default:
>> +		return AMDGPU_GFX_PIPE_PRIO_NORMAL;
>> +	}
> 
> This can be a map. We're mapping from one integer
> space to another. There is no reason for a jump switch.
> 
> For instance,
> 
> /* Map of the DRM scheduling priority to pipe
>  * priority.
>  */
> const enum gfx_pipe_priority s2p_prio_map[] = {
> 	[0] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[1] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[2] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[3] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[4] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[5] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> 	[6] = AMDGPU_GFX_PIPE_PRIO_HIGH,
> 	[7] = AMDGPU_GFX_PIPE_PRIO_HIGH,
> 	[8] = AMDGPU_GFX_PIPE_PRIO_NORMAL,
> };
> 
> /* Map it!
>  */
> pipe_prio = s2p_prio_map[sched_prio + 2];   ## You can view this as y = f(x + 2).

Note that you can make this into a 

static inline enum gfx_pipe_priority s2p_prio_map(enum drm_sched_priority sp)
{
	return _s2p_prio_map[sched_prio + 2];
}

Regards,
Luben

> 
> Note that if you fix enum drm_sched_priority as I described
> in an earlier review, you'd not need the additive factor of 2
> in the above linear transformation.
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux