mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 05:28:05 +02:00
tu: Clamp priority in DRM submitqueue creation
The kernel driver has a range of valid priority values that can
be supplied to it, submitting any priority value outside these
bounds will result in `-EINVAL`. To avoid this, the priority
value is now clamped to the range that the kernel supports.
Fixes: 0c6fbfca0c
Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18389>
This commit is contained in:
parent
c3f51a5dcf
commit
c82249aa68
1 changed files with 4 additions and 1 deletions
|
|
@ -164,9 +164,12 @@ tu_drm_submitqueue_new(const struct tu_device *dev,
|
|||
int priority,
|
||||
uint32_t *queue_id)
|
||||
{
|
||||
uint64_t nr_rings = 1;
|
||||
tu_drm_get_param(dev->physical_device, MSM_PARAM_NR_RINGS, &nr_rings);
|
||||
|
||||
struct drm_msm_submitqueue req = {
|
||||
.flags = 0,
|
||||
.prio = priority,
|
||||
.prio = MIN2(priority, MAX2(nr_rings, 1) - 1),
|
||||
};
|
||||
|
||||
int ret = drmCommandWriteRead(dev->fd,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue