Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: extract i915_gem_shrinker.h from i915_drv.h

It used to be handy that we only had a couple of headers, but over time
i915_drv.h has become unwieldy. Extract declarations to a separate
header file corresponding to the implementation module, clarifying the
modularity of the driver.

Ensure the new header is self-contained, and do so with minimal further
includes, using forward declarations as needed. Include the new header
from i915_drv.h to avoid sprinkling includes all over the place; this
can be changed as a follow-up if necessary.

No functional changes.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b8406f72ce5bfb8863a54003b756ebae8b17c9cb.1565271681.git.jani.nikula@intel.com

+32 -17
+31
drivers/gpu/drm/i915/gem/i915_gem_shrinker.h
··· 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__ */
+1 -17
drivers/gpu/drm/i915/i915_drv.h
··· 71 71 #include "display/intel_opregion.h" 72 72 73 73 #include "gem/i915_gem_context_types.h" 74 + #include "gem/i915_gem_shrinker.h" 74 75 #include "gem/i915_gem_stolen.h" 75 76 76 77 #include "gt/intel_lrc.h" ··· 2436 2435 struct drm_i915_gem_object * 2437 2436 i915_gem_object_create_internal(struct drm_i915_private *dev_priv, 2438 2437 phys_addr_t size); 2439 - 2440 - /* i915_gem_shrinker.c */ 2441 - unsigned long i915_gem_shrink(struct drm_i915_private *i915, 2442 - unsigned long target, 2443 - unsigned long *nr_scanned, 2444 - unsigned flags); 2445 - #define I915_SHRINK_UNBOUND BIT(0) 2446 - #define I915_SHRINK_BOUND BIT(1) 2447 - #define I915_SHRINK_ACTIVE BIT(2) 2448 - #define I915_SHRINK_VMAPS BIT(3) 2449 - #define I915_SHRINK_WRITEBACK BIT(4) 2450 - 2451 - unsigned long i915_gem_shrink_all(struct drm_i915_private *i915); 2452 - void i915_gem_driver_register__shrinker(struct drm_i915_private *i915); 2453 - void i915_gem_driver_unregister__shrinker(struct drm_i915_private *i915); 2454 - void i915_gem_shrinker_taints_mutex(struct drm_i915_private *i915, 2455 - struct mutex *mutex); 2456 2438 2457 2439 /* i915_gem_tiling.c */ 2458 2440 static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)