#include "i915_drv.h"
#include "i915_reg.h"
#include "i9xx_wm.h"
#include "intel_atomic.h"
#include "intel_display.h"
#include "intel_display_trace.h"
#include "intel_mchbar_regs.h"
#include "intel_wm.h"
#include "skl_watermark.h"
#include "vlv_sideband.h"
struct intel_wm_config { … };
struct cxsr_latency { … };
static const struct cxsr_latency cxsr_latency_table[] = …;
static const struct cxsr_latency *pnv_get_cxsr_latency(struct drm_i915_private *i915)
{ … }
static void chv_set_memory_dvfs(struct drm_i915_private *dev_priv, bool enable)
{ … }
static void chv_set_memory_pm5(struct drm_i915_private *dev_priv, bool enable)
{ … }
#define FW_WM …
static bool _intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable)
{ … }
bool intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable)
{ … }
static const int pessimal_latency_ns = …;
#define VLV_FIFO_START(dsparb, dsparb2, lo_shift, hi_shift) …
static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
{ … }
static int i9xx_get_fifo_size(struct drm_i915_private *dev_priv,
enum i9xx_plane_id i9xx_plane)
{ … }
static int i830_get_fifo_size(struct drm_i915_private *dev_priv,
enum i9xx_plane_id i9xx_plane)
{ … }
static int i845_get_fifo_size(struct drm_i915_private *dev_priv,
enum i9xx_plane_id i9xx_plane)
{ … }
static const struct intel_watermark_params pnv_display_wm = …;
static const struct intel_watermark_params pnv_display_hplloff_wm = …;
static const struct intel_watermark_params pnv_cursor_wm = …;
static const struct intel_watermark_params pnv_cursor_hplloff_wm = …;
static const struct intel_watermark_params i965_cursor_wm_info = …;
static const struct intel_watermark_params i945_wm_info = …;
static const struct intel_watermark_params i915_wm_info = …;
static const struct intel_watermark_params i830_a_wm_info = …;
static const struct intel_watermark_params i830_bc_wm_info = …;
static const struct intel_watermark_params i845_wm_info = …;
static unsigned int intel_wm_method1(unsigned int pixel_rate,
unsigned int cpp,
unsigned int latency)
{ … }
static unsigned int intel_wm_method2(unsigned int pixel_rate,
unsigned int htotal,
unsigned int width,
unsigned int cpp,
unsigned int latency)
{ … }
static unsigned int intel_calculate_wm(struct drm_i915_private *i915,
int pixel_rate,
const struct intel_watermark_params *wm,
int fifo_size, int cpp,
unsigned int latency_ns)
{ … }
static bool is_disabling(int old, int new, int threshold)
{ … }
static bool is_enabling(int old, int new, int threshold)
{ … }
static bool intel_crtc_active(struct intel_crtc *crtc)
{ … }
static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv)
{ … }
static void pnv_update_wm(struct drm_i915_private *dev_priv)
{ … }
static unsigned int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
{ … }
static void g4x_write_wm_values(struct drm_i915_private *dev_priv,
const struct g4x_wm_values *wm)
{ … }
#define FW_WM_VLV …
static void vlv_write_wm_values(struct drm_i915_private *dev_priv,
const struct vlv_wm_values *wm)
{ … }
#undef FW_WM_VLV
static void g4x_setup_wm_latency(struct drm_i915_private *dev_priv)
{ … }
static int g4x_plane_fifo_size(enum plane_id plane_id, int level)
{ … }
static int g4x_fbc_fifo_size(int level)
{ … }
static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
int level)
{ … }
static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
int level, enum plane_id plane_id, u16 value)
{ … }
static bool g4x_raw_fbc_wm_set(struct intel_crtc_state *crtc_state,
int level, u16 value)
{ … }
static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
u32 pri_val);
static bool g4x_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state)
{ … }
static bool g4x_raw_plane_wm_is_valid(const struct intel_crtc_state *crtc_state,
enum plane_id plane_id, int level)
{ … }
static bool g4x_raw_crtc_wm_is_valid(const struct intel_crtc_state *crtc_state,
int level)
{ … }
static void g4x_invalidate_wms(struct intel_crtc *crtc,
struct g4x_wm_state *wm_state, int level)
{ … }
static bool g4x_compute_fbc_en(const struct g4x_wm_state *wm_state,
int level)
{ … }
static int _g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
{ … }
static int g4x_compute_pipe_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static int g4x_compute_intermediate_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void g4x_merge_wm(struct drm_i915_private *dev_priv,
struct g4x_wm_values *wm)
{ … }
static void g4x_program_watermarks(struct drm_i915_private *dev_priv)
{ … }
static void g4x_initial_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void g4x_optimize_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static unsigned int vlv_wm_method2(unsigned int pixel_rate,
unsigned int htotal,
unsigned int width,
unsigned int cpp,
unsigned int latency)
{ … }
static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv)
{ … }
static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
int level)
{ … }
static bool vlv_need_sprite0_fifo_workaround(unsigned int active_planes)
{ … }
static int vlv_compute_fifo(struct intel_crtc_state *crtc_state)
{ … }
static void vlv_invalidate_wms(struct intel_crtc *crtc,
struct vlv_wm_state *wm_state, int level)
{ … }
static u16 vlv_invert_wm_value(u16 wm, u16 fifo_size)
{ … }
static bool vlv_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
int level, enum plane_id plane_id, u16 value)
{ … }
static bool vlv_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state)
{ … }
static bool vlv_raw_plane_wm_is_valid(const struct intel_crtc_state *crtc_state,
enum plane_id plane_id, int level)
{ … }
static bool vlv_raw_crtc_wm_is_valid(const struct intel_crtc_state *crtc_state, int level)
{ … }
static int _vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
{ … }
static int vlv_compute_pipe_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
#define VLV_FIFO …
static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
#undef VLV_FIFO
static int vlv_compute_intermediate_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void vlv_merge_wm(struct drm_i915_private *dev_priv,
struct vlv_wm_values *wm)
{ … }
static void vlv_program_watermarks(struct drm_i915_private *dev_priv)
{ … }
static void vlv_initial_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void vlv_optimize_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void i965_update_wm(struct drm_i915_private *dev_priv)
{ … }
#undef FW_WM
static struct intel_crtc *intel_crtc_for_plane(struct drm_i915_private *i915,
enum i9xx_plane_id i9xx_plane)
{ … }
static void i9xx_update_wm(struct drm_i915_private *dev_priv)
{ … }
static void i845_update_wm(struct drm_i915_private *dev_priv)
{ … }
static unsigned int ilk_wm_method1(unsigned int pixel_rate,
unsigned int cpp,
unsigned int latency)
{ … }
static unsigned int ilk_wm_method2(unsigned int pixel_rate,
unsigned int htotal,
unsigned int width,
unsigned int cpp,
unsigned int latency)
{ … }
static u32 ilk_wm_fbc(u32 pri_val, u32 horiz_pixels, u8 cpp)
{ … }
struct ilk_wm_maximums { … };
static u32 ilk_compute_pri_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
u32 mem_value, bool is_lp)
{ … }
static u32 ilk_compute_spr_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
u32 mem_value)
{ … }
static u32 ilk_compute_cur_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
u32 mem_value)
{ … }
static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state,
u32 pri_val)
{ … }
static unsigned int
ilk_display_fifo_size(const struct drm_i915_private *dev_priv)
{ … }
static unsigned int
ilk_plane_wm_reg_max(const struct drm_i915_private *dev_priv,
int level, bool is_sprite)
{ … }
static unsigned int
ilk_cursor_wm_reg_max(const struct drm_i915_private *dev_priv, int level)
{ … }
static unsigned int ilk_fbc_wm_reg_max(const struct drm_i915_private *dev_priv)
{ … }
static unsigned int ilk_plane_wm_max(const struct drm_i915_private *dev_priv,
int level,
const struct intel_wm_config *config,
enum intel_ddb_partitioning ddb_partitioning,
bool is_sprite)
{ … }
static unsigned int ilk_cursor_wm_max(const struct drm_i915_private *dev_priv,
int level,
const struct intel_wm_config *config)
{ … }
static void ilk_compute_wm_maximums(const struct drm_i915_private *dev_priv,
int level,
const struct intel_wm_config *config,
enum intel_ddb_partitioning ddb_partitioning,
struct ilk_wm_maximums *max)
{ … }
static void ilk_compute_wm_reg_maximums(const struct drm_i915_private *dev_priv,
int level,
struct ilk_wm_maximums *max)
{ … }
static bool ilk_validate_wm_level(struct drm_i915_private *i915,
int level,
const struct ilk_wm_maximums *max,
struct intel_wm_level *result)
{ … }
static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
const struct intel_crtc *crtc,
int level,
struct intel_crtc_state *crtc_state,
const struct intel_plane_state *pristate,
const struct intel_plane_state *sprstate,
const struct intel_plane_state *curstate,
struct intel_wm_level *result)
{ … }
static void hsw_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ … }
static void snb_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ … }
static void ilk_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ … }
static void intel_fixup_spr_wm_latency(struct drm_i915_private *dev_priv,
u16 wm[5])
{ … }
static void intel_fixup_cur_wm_latency(struct drm_i915_private *dev_priv,
u16 wm[5])
{ … }
static bool ilk_increase_wm_latency(struct drm_i915_private *dev_priv,
u16 wm[5], u16 min)
{ … }
static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv)
{ … }
static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv)
{ … }
static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv)
{ … }
static bool ilk_validate_pipe_wm(struct drm_i915_private *dev_priv,
struct intel_pipe_wm *pipe_wm)
{ … }
static int ilk_compute_pipe_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static int ilk_compute_intermediate_wm(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void ilk_merge_wm_level(struct drm_i915_private *dev_priv,
int level,
struct intel_wm_level *ret_wm)
{ … }
static void ilk_wm_merge(struct drm_i915_private *dev_priv,
const struct intel_wm_config *config,
const struct ilk_wm_maximums *max,
struct intel_pipe_wm *merged)
{ … }
static int ilk_wm_lp_to_level(int wm_lp, const struct intel_pipe_wm *pipe_wm)
{ … }
static unsigned int ilk_wm_lp_latency(struct drm_i915_private *dev_priv,
int level)
{ … }
static void ilk_compute_wm_results(struct drm_i915_private *dev_priv,
const struct intel_pipe_wm *merged,
enum intel_ddb_partitioning partitioning,
struct ilk_wm_values *results)
{ … }
static struct intel_pipe_wm *
ilk_find_best_result(struct drm_i915_private *dev_priv,
struct intel_pipe_wm *r1,
struct intel_pipe_wm *r2)
{ … }
#define WM_DIRTY_PIPE(pipe) …
#define WM_DIRTY_LP(wm_lp) …
#define WM_DIRTY_LP_ALL …
#define WM_DIRTY_FBC …
#define WM_DIRTY_DDB …
static unsigned int ilk_compute_wm_dirty(struct drm_i915_private *dev_priv,
const struct ilk_wm_values *old,
const struct ilk_wm_values *new)
{ … }
static bool _ilk_disable_lp_wm(struct drm_i915_private *dev_priv,
unsigned int dirty)
{ … }
static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
struct ilk_wm_values *results)
{ … }
bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv)
{ … }
static void ilk_compute_wm_config(struct drm_i915_private *dev_priv,
struct intel_wm_config *config)
{ … }
static void ilk_program_watermarks(struct drm_i915_private *dev_priv)
{ … }
static void ilk_initial_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void ilk_optimize_watermarks(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{ … }
static void ilk_pipe_wm_get_hw_state(struct intel_crtc *crtc)
{ … }
static int ilk_sanitize_watermarks_add_affected(struct drm_atomic_state *state)
{ … }
void ilk_wm_sanitize(struct drm_i915_private *dev_priv)
{ … }
#define _FW_WM …
#define _FW_WM_VLV …
static void g4x_read_wm_values(struct drm_i915_private *dev_priv,
struct g4x_wm_values *wm)
{ … }
static void vlv_read_wm_values(struct drm_i915_private *dev_priv,
struct vlv_wm_values *wm)
{ … }
#undef _FW_WM
#undef _FW_WM_VLV
static void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv)
{ … }
static void g4x_wm_sanitize(struct drm_i915_private *dev_priv)
{ … }
static void g4x_wm_get_hw_state_and_sanitize(struct drm_i915_private *i915)
{ … }
static void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv)
{ … }
static void vlv_wm_sanitize(struct drm_i915_private *dev_priv)
{ … }
static void vlv_wm_get_hw_state_and_sanitize(struct drm_i915_private *i915)
{ … }
static void ilk_init_lp_watermarks(struct drm_i915_private *dev_priv)
{ … }
static void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv)
{ … }
static const struct intel_wm_funcs ilk_wm_funcs = …;
static const struct intel_wm_funcs vlv_wm_funcs = …;
static const struct intel_wm_funcs g4x_wm_funcs = …;
static const struct intel_wm_funcs pnv_wm_funcs = …;
static const struct intel_wm_funcs i965_wm_funcs = …;
static const struct intel_wm_funcs i9xx_wm_funcs = …;
static const struct intel_wm_funcs i845_wm_funcs = …;
static const struct intel_wm_funcs nop_funcs = …;
void i9xx_wm_init(struct drm_i915_private *dev_priv)
{ … }