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)
{
int brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns);
uint32_t brw_create_hw_context(struct brw_bufmgr *bufmgr);
+
+#define BRW_CONTEXT_LOW_PRIORITY ((I915_CONTEXT_MIN_USER_PRIORITY-1)/2)
+#define BRW_CONTEXT_MEDIUM_PRIORITY (I915_CONTEXT_DEFAULT_PRIORITY)
+#define BRW_CONTEXT_HIGH_PRIORITY ((I915_CONTEXT_MAX_USER_PRIORITY+1)/2)
+
+int brw_hw_context_set_priority(struct brw_bufmgr *bufmgr,
+ uint32_t ctx_id,
+ int priority);
+
void brw_destroy_hw_context(struct brw_bufmgr *bufmgr, uint32_t ctx_id);
int brw_bo_gem_export_to_prime(struct brw_bo *bo, int *prime_fd);
intelDestroyContext(driContextPriv);
return false;
}
+
+ int hw_priority = BRW_CONTEXT_MEDIUM_PRIORITY;
+ switch (priority) {
+ case __DRI_CTX_PRIORITY_LOW:
+ hw_priority = BRW_CONTEXT_LOW_PRIORITY;
+ break;
+ case __DRI_CTX_PRIORITY_HIGH:
+ hw_priority = BRW_CONTEXT_HIGH_PRIORITY;
+ break;
+ }
+ if (hw_priority != I915_CONTEXT_DEFAULT_PRIORITY &&
+ brw_hw_context_set_priority(brw->bufmgr, brw->hw_ctx, hw_priority)) {
+ fprintf(stderr,
+ "Failed to set priority [%d:%d] for hardware context.\n",
+ priority, hw_priority);
+ intelDestroyContext(driContextPriv);
+ return false;
+ }
}
if (brw_init_pipe_control(brw, devinfo)) {