1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2022 Intel Corporation 4 */ 5 6 #ifndef __SKL_WATERMARK_H__ 7 #define __SKL_WATERMARK_H__ 8 9 #include <linux/types.h> 10 11 #include "intel_display_limits.h" 12 #include "intel_global_state.h" 13 #include "intel_wm_types.h" 14 15 struct drm_i915_private; 16 struct intel_atomic_state; 17 struct intel_bw_state; 18 struct intel_crtc; 19 struct intel_crtc_state; 20 struct intel_plane; 21 22 u8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *i915); 23 24 void intel_sagv_pre_plane_update(struct intel_atomic_state *state); 25 void intel_sagv_post_plane_update(struct intel_atomic_state *state); 26 bool intel_can_enable_sagv(struct drm_i915_private *i915, 27 const struct intel_bw_state *bw_state); 28 bool intel_has_sagv(struct drm_i915_private *i915); 29 30 u32 skl_ddb_dbuf_slice_mask(struct drm_i915_private *i915, 31 const struct skl_ddb_entry *entry); 32 33 void skl_write_plane_wm(struct intel_plane *plane, 34 const struct intel_crtc_state *crtc_state); 35 void skl_write_cursor_wm(struct intel_plane *plane, 36 const struct intel_crtc_state *crtc_state); 37 38 bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb, 39 const struct skl_ddb_entry *entries, 40 int num_entries, int ignore_idx); 41 42 void intel_wm_state_verify(struct intel_atomic_state *state, 43 struct intel_crtc *crtc); 44 45 void skl_watermark_ipc_init(struct drm_i915_private *i915); 46 void skl_watermark_ipc_update(struct drm_i915_private *i915); 47 bool skl_watermark_ipc_enabled(struct drm_i915_private *i915); 48 void skl_watermark_debugfs_register(struct drm_i915_private *i915); 49 50 unsigned int skl_watermark_max_latency(struct drm_i915_private *i915, 51 int initial_wm_level); 52 void skl_wm_init(struct drm_i915_private *i915); 53 54 struct intel_dbuf_state { 55 struct intel_global_state base; 56 57 struct skl_ddb_entry ddb[I915_MAX_PIPES]; 58 unsigned int weight[I915_MAX_PIPES]; 59 u8 slices[I915_MAX_PIPES]; 60 u8 enabled_slices; 61 u8 active_pipes; 62 u8 mdclk_cdclk_ratio; 63 bool joined_mbus; 64 }; 65 66 struct intel_dbuf_state * 67 intel_atomic_get_dbuf_state(struct intel_atomic_state *state); 68 69 #define to_intel_dbuf_state(global_state) \ 70 container_of_const((global_state), struct intel_dbuf_state, base) 71 72 #define intel_atomic_get_old_dbuf_state(state) \ 73 to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->display.dbuf.obj)) 74 #define intel_atomic_get_new_dbuf_state(state) \ 75 to_intel_dbuf_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->display.dbuf.obj)) 76 77 int intel_dbuf_init(struct drm_i915_private *i915); 78 int intel_dbuf_state_set_mdclk_cdclk_ratio(struct intel_atomic_state *state, 79 int ratio); 80 81 void intel_dbuf_pre_plane_update(struct intel_atomic_state *state); 82 void intel_dbuf_post_plane_update(struct intel_atomic_state *state); 83 void intel_dbuf_mdclk_cdclk_ratio_update(struct drm_i915_private *i915, 84 int ratio, bool joined_mbus); 85 void intel_dbuf_mbus_pre_ddb_update(struct intel_atomic_state *state); 86 void intel_dbuf_mbus_post_ddb_update(struct intel_atomic_state *state); 87 88 #endif /* __SKL_WATERMARK_H__ */ 89 90