From 1617fca6d12e418e02d18733dd0d1964c7ecbda9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 11 Apr 2017 15:24:54 +0100 Subject: i965: Pass the EGL/DRI context priority through to the kernel Decode the EGL/DRI priority enum into the [-1023, 1023] range as interpreted by the kernel and call DRM_I915_GEM_CONTEXT_SETPARAM to adjust the priority. We use 0 as the default medium priority (also the kernel default) and so only need adjust up or down. By only doing the adjustment if not setting to medium, we can faithfully report any error whilst setting without worrying about kernel version. Signed-off-by: Chris Wilson Cc: Kenneth Graunke Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_bufmgr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mesa/drivers/dri/i965/brw_bufmgr.c') diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index 7c5a9651eba..17036b53bcd 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -1299,6 +1299,25 @@ brw_create_hw_context(struct brw_bufmgr *bufmgr) return create.ctx_id; } +int +brw_hw_context_set_priority(struct brw_bufmgr *bufmgr, + uint32_t ctx_id, + int priority) +{ + struct drm_i915_gem_context_param p = { + .ctx_id = ctx_id, + .param = I915_CONTEXT_PARAM_PRIORITY, + .value = priority, + }; + int err; + + err = 0; + if (drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &p)) + err = -errno; + + return err; +} + void brw_destroy_hw_context(struct brw_bufmgr *bufmgr, uint32_t ctx_id) { -- cgit v1.2.3