Home | History | Annotate | Line # | Download | only in i915
      1 /*	$NetBSD: i915_priolist_types.h,v 1.3 2021/12/19 11:38:37 riastradh Exp $	*/
      2 
      3 /*
      4  * SPDX-License-Identifier: MIT
      5  *
      6  * Copyright  2018 Intel Corporation
      7  */
      8 
      9 #ifndef _I915_PRIOLIST_TYPES_H_
     10 #define _I915_PRIOLIST_TYPES_H_
     11 
     12 #include <linux/list.h>
     13 #include <linux/rbtree.h>
     14 
     15 #include <uapi/drm/i915_drm.h>
     16 
     17 enum {
     18 	I915_PRIORITY_MIN = I915_CONTEXT_MIN_USER_PRIORITY - 1,
     19 	I915_PRIORITY_NORMAL = I915_CONTEXT_DEFAULT_PRIORITY,
     20 	I915_PRIORITY_MAX = I915_CONTEXT_MAX_USER_PRIORITY + 1,
     21 
     22 	/* A preemptive pulse used to monitor the health of each engine */
     23 	I915_PRIORITY_HEARTBEAT,
     24 
     25 	/* Interactive workload, scheduled for immediate pageflipping */
     26 	I915_PRIORITY_DISPLAY,
     27 };
     28 
     29 #define I915_USER_PRIORITY_SHIFT 2
     30 #define I915_USER_PRIORITY(x) ((x) * (1 << I915_USER_PRIORITY_SHIFT))
     31 
     32 #define I915_PRIORITY_COUNT BIT(I915_USER_PRIORITY_SHIFT)
     33 #define I915_PRIORITY_MASK (I915_PRIORITY_COUNT - 1)
     34 
     35 #define I915_PRIORITY_WAIT		((u8)BIT(0))
     36 #define I915_PRIORITY_NOSEMAPHORE	((u8)BIT(1))
     37 
     38 /* Smallest priority value that cannot be bumped. */
     39 #define I915_PRIORITY_INVALID (INT_MIN | (u8)I915_PRIORITY_MASK)
     40 
     41 /*
     42  * Requests containing performance queries must not be preempted by
     43  * another context. They get scheduled with their default priority and
     44  * once they reach the execlist ports we ensure that they stick on the
     45  * HW until finished by pretending that they have maximum priority,
     46  * i.e. nothing can have higher priority and force us to usurp the
     47  * active request.
     48  */
     49 #define I915_PRIORITY_UNPREEMPTABLE INT_MAX
     50 #define I915_PRIORITY_BARRIER INT_MAX
     51 
     52 #define __NO_PREEMPTION (I915_PRIORITY_WAIT)
     53 
     54 struct i915_priolist {
     55 	struct list_head requests[I915_PRIORITY_COUNT];
     56 	struct rb_node node;
     57 	unsigned long used;
     58 	int priority;
     59 };
     60 
     61 #endif /* _I915_PRIOLIST_TYPES_H_ */
     62