xref: /linux/drivers/gpu/drm/i915/gem/i915_gem_shrinker.h (revision 17cfcb68af3bc7d5e8ae08779b1853310a2949f3)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef __I915_GEM_SHRINKER_H__
7 #define __I915_GEM_SHRINKER_H__
8 
9 #include <linux/bits.h>
10 
11 struct drm_i915_private;
12 struct mutex;
13 
14 /* i915_gem_shrinker.c */
15 unsigned long i915_gem_shrink(struct drm_i915_private *i915,
16 			      unsigned long target,
17 			      unsigned long *nr_scanned,
18 			      unsigned flags);
19 #define I915_SHRINK_UNBOUND	BIT(0)
20 #define I915_SHRINK_BOUND	BIT(1)
21 #define I915_SHRINK_ACTIVE	BIT(2)
22 #define I915_SHRINK_VMAPS	BIT(3)
23 #define I915_SHRINK_WRITEBACK	BIT(4)
24 
25 unsigned long i915_gem_shrink_all(struct drm_i915_private *i915);
26 void i915_gem_driver_register__shrinker(struct drm_i915_private *i915);
27 void i915_gem_driver_unregister__shrinker(struct drm_i915_private *i915);
28 void i915_gem_shrinker_taints_mutex(struct drm_i915_private *i915,
29 				    struct mutex *mutex);
30 
31 #endif /* __I915_GEM_SHRINKER_H__ */
32