blob: 669c8d505677820ce7d1bbf89e6ca4856bb10d9e [file] [log] [blame]
Jani Nikula696173b2019-04-05 14:00:15 +03001/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2019 Intel Corporation
4 */
5
6#ifndef __INTEL_PM_H__
7#define __INTEL_PM_H__
8
9#include <linux/types.h>
10
Stanislav Lisovskiycac91e62020-05-22 16:18:43 +030011#include "display/intel_bw.h"
Ville Syrjälä47a14952021-01-22 22:56:30 +020012#include "display/intel_display.h"
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +020013#include "display/intel_global_state.h"
14
Ville Syrjälä47a14952021-01-22 22:56:30 +020015#include "i915_drv.h"
Jani Nikulaecbb5fb2019-04-29 15:29:37 +030016#include "i915_reg.h"
17
Jani Nikula696173b2019-04-05 14:00:15 +030018struct drm_device;
19struct drm_i915_private;
20struct i915_request;
Maarten Lankhorst855e0d62019-06-28 10:55:13 +020021struct intel_atomic_state;
Jani Nikula696173b2019-04-05 14:00:15 +030022struct intel_crtc;
23struct intel_crtc_state;
24struct intel_plane;
Jani Nikula696173b2019-04-05 14:00:15 +030025struct skl_ddb_entry;
26struct skl_pipe_wm;
27struct skl_wm_level;
28
29void intel_init_clock_gating(struct drm_i915_private *dev_priv);
30void intel_suspend_hw(struct drm_i915_private *dev_priv);
31int ilk_wm_max_level(const struct drm_i915_private *dev_priv);
32void intel_update_watermarks(struct intel_crtc *crtc);
33void intel_init_pm(struct drm_i915_private *dev_priv);
34void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
35void intel_pm_setup(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030036void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv);
37void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv);
38void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv);
39void skl_wm_get_hw_state(struct drm_i915_private *dev_priv);
Stanislav Lisovskiy0f0f9ae2020-02-03 01:06:29 +020040u8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030041void skl_pipe_ddb_get_hw_state(struct intel_crtc *crtc,
42 struct skl_ddb_entry *ddb_y,
43 struct skl_ddb_entry *ddb_uv);
Stanislav Lisovskiycd191542020-05-20 18:00:58 +030044void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv);
Stanislav Lisovskiycd191542020-05-20 18:00:58 +030045u32 skl_ddb_dbuf_slice_mask(struct drm_i915_private *dev_priv,
46 const struct skl_ddb_entry *entry);
Jani Nikula696173b2019-04-05 14:00:15 +030047void skl_pipe_wm_get_hw_state(struct intel_crtc *crtc,
48 struct skl_pipe_wm *out);
49void g4x_wm_sanitize(struct drm_i915_private *dev_priv);
50void vlv_wm_sanitize(struct drm_i915_private *dev_priv);
Stanislav Lisovskiyd8d5afe2020-05-13 12:38:13 +030051bool intel_can_enable_sagv(struct drm_i915_private *dev_priv,
52 const struct intel_bw_state *bw_state);
Stanislav Lisovskiy680e1af2020-04-15 17:39:04 +030053void intel_sagv_pre_plane_update(struct intel_atomic_state *state);
54void intel_sagv_post_plane_update(struct intel_atomic_state *state);
Ville Syrjälä5516e892021-02-26 17:32:03 +020055const struct skl_wm_level *skl_plane_wm_level(const struct skl_pipe_wm *pipe_wm,
56 enum plane_id plane_id,
57 int level);
58const struct skl_wm_level *skl_plane_trans_wm(const struct skl_pipe_wm *pipe_wm,
59 enum plane_id plane_id);
Jani Nikula696173b2019-04-05 14:00:15 +030060bool skl_wm_level_equals(const struct skl_wm_level *l1,
61 const struct skl_wm_level *l2);
62bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
63 const struct skl_ddb_entry *entries,
64 int num_entries, int ignore_idx);
65void skl_write_plane_wm(struct intel_plane *plane,
66 const struct intel_crtc_state *crtc_state);
67void skl_write_cursor_wm(struct intel_plane *plane,
68 const struct intel_crtc_state *crtc_state);
Ville Syrjälä60aca572019-11-27 21:05:51 +020069bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030070void intel_init_ipc(struct drm_i915_private *dev_priv);
71void intel_enable_ipc(struct drm_i915_private *dev_priv);
72
Jani Nikulad13616d2019-06-06 15:22:00 +030073bool intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable);
Jani Nikulaecbb5fb2019-04-29 15:29:37 +030074
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +020075struct intel_dbuf_state {
76 struct intel_global_state base;
77
Ville Syrjälä47a14952021-01-22 22:56:30 +020078 struct skl_ddb_entry ddb[I915_MAX_PIPES];
Ville Syrjäläef79d622021-01-22 22:56:32 +020079 unsigned int weight[I915_MAX_PIPES];
80 u8 slices[I915_MAX_PIPES];
Ville Syrjälä47a14952021-01-22 22:56:30 +020081
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +020082 u8 enabled_slices;
83 u8 active_pipes;
84};
85
86int intel_dbuf_init(struct drm_i915_private *dev_priv);
87
88struct intel_dbuf_state *
89intel_atomic_get_dbuf_state(struct intel_atomic_state *state);
90
91#define to_intel_dbuf_state(x) container_of((x), struct intel_dbuf_state, base)
92#define intel_atomic_get_old_dbuf_state(state) \
93 to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
94#define intel_atomic_get_new_dbuf_state(state) \
95 to_intel_dbuf_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
96
97int intel_dbuf_init(struct drm_i915_private *dev_priv);
Ville Syrjäläc7c0e7e2020-02-25 19:11:15 +020098void intel_dbuf_pre_plane_update(struct intel_atomic_state *state);
99void intel_dbuf_post_plane_update(struct intel_atomic_state *state);
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +0200100
Jani Nikula696173b2019-04-05 14:00:15 +0300101#endif /* __INTEL_PM_H__ */