xref: /linux/drivers/gpu/drm/i915/gem/i915_gem_shrinker.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
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 i915_gem_ww_ctx;
13 struct mutex;
14 
15 /* i915_gem_shrinker.c */
16 unsigned long i915_gem_shrink(struct i915_gem_ww_ctx *ww,
17 			      struct drm_i915_private *i915,
18 			      unsigned long target,
19 			      unsigned long *nr_scanned,
20 			      unsigned flags);
21 #define I915_SHRINK_UNBOUND	BIT(0)
22 #define I915_SHRINK_BOUND	BIT(1)
23 #define I915_SHRINK_ACTIVE	BIT(2)
24 #define I915_SHRINK_VMAPS	BIT(3)
25 #define I915_SHRINK_WRITEBACK	BIT(4)
26 
27 unsigned long i915_gem_shrink_all(struct drm_i915_private *i915);
28 void i915_gem_driver_register__shrinker(struct drm_i915_private *i915);
29 void i915_gem_driver_unregister__shrinker(struct drm_i915_private *i915);
30 void i915_gem_shrinker_taints_mutex(struct drm_i915_private *i915,
31 				    struct mutex *mutex);
32 
33 #endif /* __I915_GEM_SHRINKER_H__ */
34