From: Mark Collins Date: Fri, 2 Sep 2022 10:09:11 +0000 (+0000) Subject: tu: Clamp priority in DRM submitqueue creation X-Git-Tag: upstream/22.3.5~3430 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c82249aa6891e43398cc8d62d552869495292b31;p=platform%2Fupstream%2Fmesa.git 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: 0c6fbfca0c91ef012e8ab767a317c07f1f6dc5e6 Signed-off-by: Mark Collins Part-of: --- diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c index 894cb2f..903b6e5 100644 --- a/src/freedreno/vulkan/tu_drm.c +++ b/src/freedreno/vulkan/tu_drm.c @@ -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,