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

drm/i915/bw: make struct intel_bw_state opaque

With all the code touching struct intel_bw_state moved inside
intel_bw.c, we move the struct definition there too, and make the type
opaque. to_intel_bw_state() needs to be turned into a proper
function. All of this nicely reduces includes from intel_bw.h.

Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/743ba67e4e3c5dac4f5e58ab4d2357edea601d09.1750847509.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+43 -41
+40
drivers/gpu/drm/i915/display/intel_bw.c
··· 21 21 #include "intel_uncore.h" 22 22 #include "skl_watermark.h" 23 23 24 + struct intel_dbuf_bw { 25 + unsigned int max_bw[I915_MAX_DBUF_SLICES]; 26 + u8 active_planes[I915_MAX_DBUF_SLICES]; 27 + }; 28 + 29 + struct intel_bw_state { 30 + struct intel_global_state base; 31 + struct intel_dbuf_bw dbuf_bw[I915_MAX_PIPES]; 32 + 33 + /* 34 + * Contains a bit mask, used to determine, whether correspondent 35 + * pipe allows SAGV or not. 36 + */ 37 + u8 pipe_sagv_reject; 38 + 39 + /* bitmask of active pipes */ 40 + u8 active_pipes; 41 + 42 + /* 43 + * From MTL onwards, to lock a QGV point, punit expects the peak BW of 44 + * the selected QGV point as the parameter in multiples of 100MB/s 45 + */ 46 + u16 qgv_point_peakbw; 47 + 48 + /* 49 + * Current QGV points mask, which restricts 50 + * some particular SAGV states, not to confuse 51 + * with pipe_sagv_mask. 52 + */ 53 + u16 qgv_points_mask; 54 + 55 + unsigned int data_rate[I915_MAX_PIPES]; 56 + u8 num_active_planes[I915_MAX_PIPES]; 57 + }; 58 + 24 59 /* Parameters for Qclk Geyserville (QGV) */ 25 60 struct intel_qgv_point { 26 61 u16 dclk, t_rp, t_rdpre, t_rc, t_ras, t_rcd; ··· 905 870 data_rate = DIV_ROUND_UP(data_rate * 105, 100); 906 871 907 872 return data_rate; 873 + } 874 + 875 + struct intel_bw_state *to_intel_bw_state(struct intel_global_state *obj_state) 876 + { 877 + return container_of(obj_state, struct intel_bw_state, base); 908 878 } 909 879 910 880 struct intel_bw_state *
+3 -41
drivers/gpu/drm/i915/display/intel_bw.h
··· 8 8 9 9 #include <drm/drm_atomic.h> 10 10 11 - #include "intel_display_limits.h" 12 - #include "intel_display_power.h" 13 - #include "intel_global_state.h" 14 - 15 11 struct intel_atomic_state; 12 + struct intel_bw_state; 16 13 struct intel_crtc; 17 14 struct intel_crtc_state; 18 15 struct intel_display; 16 + struct intel_global_state; 19 17 20 - struct intel_dbuf_bw { 21 - unsigned int max_bw[I915_MAX_DBUF_SLICES]; 22 - u8 active_planes[I915_MAX_DBUF_SLICES]; 23 - }; 24 - 25 - struct intel_bw_state { 26 - struct intel_global_state base; 27 - struct intel_dbuf_bw dbuf_bw[I915_MAX_PIPES]; 28 - 29 - /* 30 - * Contains a bit mask, used to determine, whether correspondent 31 - * pipe allows SAGV or not. 32 - */ 33 - u8 pipe_sagv_reject; 34 - 35 - /* bitmask of active pipes */ 36 - u8 active_pipes; 37 - 38 - /* 39 - * From MTL onwards, to lock a QGV point, punit expects the peak BW of 40 - * the selected QGV point as the parameter in multiples of 100MB/s 41 - */ 42 - u16 qgv_point_peakbw; 43 - 44 - /* 45 - * Current QGV points mask, which restricts 46 - * some particular SAGV states, not to confuse 47 - * with pipe_sagv_mask. 48 - */ 49 - u16 qgv_points_mask; 50 - 51 - unsigned int data_rate[I915_MAX_PIPES]; 52 - u8 num_active_planes[I915_MAX_PIPES]; 53 - }; 54 - 55 - #define to_intel_bw_state(global_state) \ 56 - container_of_const((global_state), struct intel_bw_state, base) 18 + struct intel_bw_state *to_intel_bw_state(struct intel_global_state *obj_state); 57 19 58 20 struct intel_bw_state * 59 21 intel_atomic_get_old_bw_state(struct intel_atomic_state *state);