drm/i915: rewrite FBC's atomic CRTC-choosing code
Subsystems (2)
PATCH 1/1 drm/i915: rewrite FBC's atomic CRTC-choosing code
Ville pointed out that intel_fbc_choose_crtc() is iterating over all planes instead of just the primary planes. There are no real consequences of this problem for HSW+, and for the other platforms it just means that in some obscure multi-screen cases we'll keep FBC disabled when we could have enabled it. Still, iterating over all planes doesn't seem to be the best thing to do.
My initial idea was to just add a check for plane->type and be done, but then I realized that in commits not involving the primary plane we would reset crtc_state->enable_fbc back to false even when FBC is enabled. That also wouldn't result in a bug due to the way the enable_fbc variable is checked, but, still, our code can be better than this.
So I went for the solution that involves tracking enable_fbc in the primary plane state instead of the CRTC state. This way, if a commit doesn't involve the primary plane for the CRTC we won't be resetting enable_fbc back to false, so the variable will always reflect the reality. And this change also makes more sense since FBC is actually tied to the single plane and not the full pipe. As a bonus, we only iterate over the CRTCs instead of iterating over all planes.
v2:
But Ville pointed that this only works properly if we have a single commit with multiple CRTCs. If we have multiple parallel commits, each with its own CRTC, we'll end with enable_fbc set to true in more than one plane.
So the solution was to rename enable_fbc to can_enable_fbc. If we just did the rename as the patch was, we'd end up with a single plane with can_enable_fbc on commits involving multiple CRTCs: we'd choose the best one, but we'd still end up with a variable that doesn't 100% reflect reality.
So in the end I adopted Ville's suggestion of the fbc_score variable. And then, instead of checking the score at intel_fbc_choose_crtc() it should be possible to check for the score at intel_fbc_enable(). This allows us to simplify intel_fbc_choose_crtc() to the point where it only needs to look at the given plane in order to assign its score instead of looking at every primary plane on the same commit.
We still only set scores of 0 and 1 and we don't really do the score-checking loop.
--- drivers/gpu/drm/i915/intel_display.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 8 ++-- drivers/gpu/drm/i915/intel_fbc.c | 85 ++++++++++++------------------------ 3 files changed, 35 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -14133,7 +14133,6 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; -intel_fbc_choose_crtc (dev_priv, state);return calc_watermark_data (state); }
@@ -14897,6 +14896,8 @@ intel_check_primary_plane(struct drm_plane *plane,return ret; } +intel_fbc_check_plane (state); +return 0 ; }
drivers/gpu/drm/i915/intel_drv.h +4 -4
@@ -402,6 +402,9 @@ struct intel_plane_state {*/ int scaler_id; +/* 0: not suitable for FBC, 1+: suitable for FBC, more is better. */ +unsigned int fbc_score; +struct drm_intel_sprite_colorkey ckey; };
@@ -648,8 +651,6 @@ struct intel_crtc_state {bool ips_enabled; -bool enable_fbc; -bool double_wide;bool dp_encoder_is_mst;
@@ -1500,8 +1501,7 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev)#endif /* intel_fbc.c */ -void intel_fbc_choose_crtc (struct drm_i915_private *dev_priv, -struct drm_atomic_state *state); +void intel_fbc_check_plane (struct intel_plane_state *plane_state);bool intel_fbc_is_active (struct drm_i915_private *dev_priv); void intel_fbc_pre_update(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
drivers/gpu/drm/i915/intel_fbc.c +29 -56
117 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: rewrite FBC's atomic CRTC-choosing code
== Series Details ==
== Series Details ==
Series: drm/i915: rewrite FBC's atomic CRTC-choosing code
URL : https://patchwork.freedesktop.org/series/15302/
State : success
== Summary ==
Series 15302v1 drm/i915: rewrite FBC's atomic CRTC-choosing code
https://patchwork.freedesktop.org/api/1.0/series/15302/revisions/1/mbox/
fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:204 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-hsw-4770 total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:244 pass:191 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7200u total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:223 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:244 pass:222 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:244 pass:211 dwarn:0 dfail:0 fail:0 skip:33
1ff093811f7fdf9b63a9fac336269f2083f1b433 drm-intel-nightly: 2016y-11m-14d-18h-30m-41s UTC integration manifest 343854e drm/i915: rewrite FBC's atomic CRTC-choosing code
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2988/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx