Refactor Gen11+ SAGV support
Subsystems (3)
v9 cover Refactor Gen11+ SAGV support
For Gen11+ platforms BSpec suggests disabling specific QGV points separately, depending on bandwidth limitations and current display configuration. Thus it required adding a new PCode request for disabling QGV points and some refactoring of already existing SAGV code.
Also had to refactor intel_can_enable_sagv function, as current seems to be outdated and using skl specific workarounds, also not following BSpec for Gen11+.
Stanislav Lisovskiy (2):
drm/i915: Refactor intel_can_enable_sagv
drm/i915: Restrict qgv points which don't have enough bandwidth.
drivers/gpu/drm/i915/display/intel_atomic.c | 16 + drivers/gpu/drm/i915/display/intel_atomic.h | 3 + drivers/gpu/drm/i915/display/intel_bw.c | 111 +++++-- drivers/gpu/drm/i915/display/intel_bw.h | 2 + drivers/gpu/drm/i915/display/intel_display.c | 63 +++- .../drm/i915/display/intel_display_types.h | 12 + drivers/gpu/drm/i915/i915_drv.h | 8 + drivers/gpu/drm/i915/i915_reg.h | 5 + drivers/gpu/drm/i915/intel_pm.c | 299 +++++++++++++++++- drivers/gpu/drm/i915/intel_sideband.c | 27 +- 10 files changed, 504 insertions(+), 42 deletions(-)
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v9 1/2 drm/i915: Refactor intel_can_enable_sagv
Currently intel_can_enable_sagv function contains a mix of workarounds for different platforms some of them are not valid for gens >= 11 already, so lets split it into separate functions.
v2:
- Rework watermark calculation algorithm to
attempt to calculate Level 0 watermark
with added sagv block time latency and
check if it fits in DBuf in order to
determine if SAGV can be enabled already
at this stage, just as BSpec 49325 states.
if that fails rollback to usual Level 0
latency and disable SAGV.
- Remove unneeded tabs(James Ausmus)
v3: Rebased the patch
v4: - Added back interlaced check for Gen12 and
added separate function for TGL SAGV check
(thanks to James Ausmus for spotting)
- Removed unneeded gen check
- Extracted Gen12 SAGV decision making code
to a separate function from skl_compute_wm
v5: - Added SAGV global state to dev_priv, because
we need to track all pipes, not only those in atomic state. Each pipe has now correspondent bit mask reflecting, whether it can tolerate SAGV or not(thanks to Ville Syrjala for suggestions).
- Now using active flag instead of enable in crc usage check.
--- drivers/gpu/drm/i915/display/intel_display.c | 6 + .../drm/i915/display/intel_display_types.h | 9 + drivers/gpu/drm/i915/i915_drv.h | 6 + drivers/gpu/drm/i915/intel_pm.c | 299 +++++++++++++++++- 4 files changed, 306 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +6 -0
@@ -14581,6 +14581,10 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)if (dev_priv->display.optimize_watermarks) dev_priv->display.optimize_watermarks (state, new_crtc_state); +if (state->crtc_sagv_mask &BIT (crtc->pipe)) + dev_priv->crtc_sagv_mask |=BIT (crtc->pipe); +else + dev_priv->crtc_sagv_mask &= ~BIT (crtc->pipe); }for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {
@@ -14600,6 +14604,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)drm_atomic_helper_commit_hw_done (&state->base); + +if (state->modeset) {/* As one of the primary mmio accessors, KMS has a high * likelihood of triggering bugs in unclaimed access. After we
drivers/gpu/drm/i915/display/intel_display_types.h +9 -0
@@ -490,6 +490,14 @@ struct intel_atomic_state {*/ u8 active_pipe_changes; +/* +* Contains a mask which reflects whether correspondent pipe +* can tolerate SAGV or not, so that we can make a decision +* at atomic_commit_tail stage, whether we enable it or not +* based on global state in dev_priv. +*/ +u32 crtc_sagv_mask; +u8 active_pipes;/* minimum acceptable cdclk for each pipe */ int min_cdclk[I915_MAX_PIPES ];
@@ -642,6 +650,7 @@ struct skl_plane_wm {struct skl_wm_level wm[8 ];struct skl_wm_level uv_wm[8 ];struct skl_wm_level trans_wm; +struct skl_wm_level sagv_wm0;bool is_planar; };
drivers/gpu/drm/i915/i915_drv.h +6 -0
@@ -1261,6 +1261,12 @@ struct drm_i915_private {u32 sagv_block_time_us; +/* +* Contains a bit mask, whether correspondent +* pipe allows SAGV or not. +*/ +u32 crtc_sagv_mask; +struct {/* * Raw watermark latency values:
drivers/gpu/drm/i915/intel_pm.c +285 -14
425 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v9 2/2 drm/i915: Restrict qgv points which don't have enough bandwidth.
In reply to Stanislav LisovskiyAccording to BSpec 53998, we should try to restrict qgv points, which can't provide enough bandwidth for desired display configuration.
Currently we are just comparing against all of
those and take minimum(worst case).
v2: Fixed wrong PCode reply mask, removed hardcoded
values.
v3: Forbid simultaneous legacy SAGV PCode requests and
restricting qgv points. Put the actual restriction to commit function, added serialization(thanks to Ville) to prevent commit being applied out of order in case of nonblocking and/or nomodeset commits.
v4:
- Minor code refactoring, fixed few typos(thanks to James Ausmus)
- Change the naming of qgv point
masking/unmasking functions(James Ausmus).
- Simplify the masking/unmasking operation itself,
as we don't need to mask only single point per request(James Ausmus)
- Reject and stick to highest bandwidth point if SAGV can't be enabled(BSpec)
v5:
- Add new mailbox reply codes, which seems to happen during boot time for TGL and indicate that QGV setting is not yet available.
v6:
- Increase number of supported QGV points to be in sync with BSpec.
--- drivers/gpu/drm/i915/display/intel_atomic.c | 16 +++ drivers/gpu/drm/i915/display/intel_atomic.h | 3 + drivers/gpu/drm/i915/display/intel_bw.c | 111 ++++++++++++++---- drivers/gpu/drm/i915/display/intel_bw.h | 2 + drivers/gpu/drm/i915/display/intel_display.c | 57 ++++++++- .../drm/i915/display/intel_display_types.h | 3 + drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 5 + drivers/gpu/drm/i915/intel_sideband.c | 27 ++++- 9 files changed, 198 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +16 -0
@@ -207,6 +207,22 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)return &crtc_state->base; } +int intel_atomic_serialize_global_state (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct intel_crtc *crtc; + +for_each_intel_crtc (&dev_priv->drm, crtc) { +struct intel_crtc_state *crtc_state; + + crtc_state =intel_atomic_get_crtc_state (&state->base, crtc); +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + } + +return 0 ; +} +/** * intel_crtc_destroy_state - destroy crtc state * @crtc: drm crtc
drivers/gpu/drm/i915/display/intel_atomic.h +3 -0
@@ -7,6 +7,7 @@#define __INTEL_ATOMIC_H__#include <linux/types.h> +#include "intel_display_types.h" struct drm_atomic_state ;struct drm_connector ;
@@ -38,6 +39,8 @@ void intel_crtc_destroy_state(struct drm_crtc *crtc,struct drm_atomic_state *intel_atomic_state_alloc (struct drm_device *dev);void intel_atomic_state_clear (struct drm_atomic_state *state); +int intel_atomic_serialize_global_state (struct intel_atomic_state *state); +struct intel_crtc_state *intel_atomic_get_crtc_state (struct drm_atomic_state *state,struct intel_crtc *crtc);
drivers/gpu/drm/i915/display/intel_bw.c +88 -23
153 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_bw.h +2 -0
@@ -28,5 +28,7 @@ int intel_bw_init(struct drm_i915_private *dev_priv);int intel_bw_atomic_check (struct intel_atomic_state *state);void intel_bw_crtc_update (struct intel_bw_state *bw_state,const struct intel_crtc_state *crtc_state); +int icl_pcode_restrict_qgv_points (struct drm_i915_private *dev_priv, +u32 points_mask);#endif /* __INTEL_BW_H__ */
drivers/gpu/drm/i915/display/intel_display.c +53 -4
81 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
@@ -520,6 +520,9 @@ struct intel_atomic_state {struct i915_sw_fence commit_ready;struct llist_node freed; + +/* Gen11+ only */ +u32 qgv_points_mask; };struct intel_plane_state {
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1333,6 +1333,8 @@ struct drm_i915_private {u8 num_planes; } max_bw[6 ]; +u32 qgv_points_mask; +struct drm_private_obj bw_obj;struct intel_runtime_pm runtime_pm;
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -8858,6 +8858,8 @@ enum {#define GEN6_PCODE_UNIMPLEMENTED_CMD 0xFF#define GEN7_PCODE_TIMEOUT 0x2#define GEN7_PCODE_ILLEGAL_DATA 0x3 +#define GEN11_PCODE_MAIL_BOX_LOCKED 0x6 +#define GEN11_PCODE_REJECTED 0x11#define GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x10#define GEN6_PCODE_WRITE_RC6VIDS 0x4#define GEN6_PCODE_READ_RC6VIDS 0x5
@@ -8879,6 +8881,7 @@ enum {#define ICL_PCODE_MEM_SUBSYSYSTEM_INFO 0xd#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8)) +#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define GEN6_PCODE_READ_D_COMP 0x10#define GEN6_PCODE_WRITE_D_COMP 0x11#define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17
@@ -8891,6 +8894,8 @@ enum {#define GEN9_SAGV_IS_DISABLED 0x1#define GEN9_SAGV_ENABLE 0x3#define GEN12_PCODE_READ_SAGV_BLOCK_TIME_US 0x23 +#define GEN11_PCODE_POINTS_RESTRICTED 0x0 +#define GEN11_PCODE_POINTS_RESTRICTED_MASK 0x1#define GEN6_PCODE_DATA _MMIO(0x138128)#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8#define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16
drivers/gpu/drm/i915/intel_sideband.c +26 -1
@@ -371,6 +371,29 @@ static inline int gen7_check_mailbox_status(u32 mbox) } } +static inline int gen11_check_mailbox_status (u32 mbox) +{ +switch (mbox &GEN6_PCODE_ERROR_MASK ) { +case GEN6_PCODE_SUCCESS : +return 0 ; +case GEN6_PCODE_ILLEGAL_CMD : +return -ENXIO ; +case GEN7_PCODE_TIMEOUT : +return -ETIMEDOUT ; +case GEN7_PCODE_ILLEGAL_DATA : +return -EINVAL ; +case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE : +return -EOVERFLOW ; +case GEN11_PCODE_MAIL_BOX_LOCKED : +return -EAGAIN ; +case GEN11_PCODE_REJECTED : +return -EACCES ; +default : +MISSING_CASE (mbox &GEN6_PCODE_ERROR_MASK ); +return 0 ; + } +} + static int __sandybridge_pcode_rw(struct drm_i915_private *i915, u32 mbox, u32 *val, u32 *val1, int fast_timeout_us,
@@ -408,7 +431,9 @@ static int __sandybridge_pcode_rw(struct drm_i915_private *i915,if (is_read && val1) *val1 =intel_uncore_read_fw (uncore,GEN6_PCODE_DATA1 ); -if (INTEL_GEN (i915) >6 ) +if (INTEL_GEN (i915) >=11 ) +return gen11_check_mailbox_status (mbox); +else if (INTEL_GEN (i915) >6 )return gen7_check_mailbox_status (mbox);else return gen6_check_mailbox_status (mbox);
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx