Commit 24304d81 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Extract intel_wm_plane_visible()

All platforms that lack double buffered watermarks will need to
handle the legacy cursor updates in the same way. So let's extract the
logic to determine the plane visibility into a small helper. For
simplicity we'll make the function DTRT for any plane, but only apply
the special sauce for cursor planes.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314151050.12194-1-ville.syrjala@linux.intel.comTested-by: default avatarDorota Czaplejewicz <dorota.czaplejewicz@collabora.co.uk>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent 24f8e00a
...@@ -655,6 +655,29 @@ static unsigned long intel_calculate_wm(unsigned long clock_in_khz, ...@@ -655,6 +655,29 @@ static unsigned long intel_calculate_wm(unsigned long clock_in_khz,
return wm_size; return wm_size;
} }
static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state)
{
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
/* FIXME check the 'enable' instead */
if (!crtc_state->base.active)
return false;
/*
* Treat cursor with fb as always visible since cursor updates
* can happen faster than the vrefresh rate, and the current
* watermark code doesn't handle that correctly. Cursor updates
* which set/clear the fb or change the cursor size are going
* to get throttled by intel_legacy_cursor_update() to work
* around this problem with the watermark code.
*/
if (plane->id == PLANE_CURSOR)
return plane_state->base.fb != NULL;
else
return plane_state->base.visible;
}
static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv) static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv)
{ {
struct intel_crtc *crtc, *enabled = NULL; struct intel_crtc *crtc, *enabled = NULL;
...@@ -1961,7 +1984,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, ...@@ -1961,7 +1984,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
uint32_t method1, method2; uint32_t method1, method2;
int cpp; int cpp;
if (!cstate->base.active || !pstate->base.visible) if (!intel_wm_plane_visible(cstate, pstate))
return 0; return 0;
cpp = pstate->base.fb->format->cpp[0]; cpp = pstate->base.fb->format->cpp[0];
...@@ -1990,7 +2013,7 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate, ...@@ -1990,7 +2013,7 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate,
uint32_t method1, method2; uint32_t method1, method2;
int cpp; int cpp;
if (!cstate->base.active || !pstate->base.visible) if (!intel_wm_plane_visible(cstate, pstate))
return 0; return 0;
cpp = pstate->base.fb->format->cpp[0]; cpp = pstate->base.fb->format->cpp[0];
...@@ -2013,15 +2036,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate, ...@@ -2013,15 +2036,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
{ {
int cpp; int cpp;
/* if (!intel_wm_plane_visible(cstate, pstate))
* Treat cursor with fb as always visible since cursor updates
* can happen faster than the vrefresh rate, and the current
* watermark code doesn't handle that correctly. Cursor updates
* which set/clear the fb or change the cursor size are going
* to get throttled by intel_legacy_cursor_update() to work
* around this problem with the watermark code.
*/
if (!cstate->base.active || !pstate->base.fb)
return 0; return 0;
cpp = pstate->base.fb->format->cpp[0]; cpp = pstate->base.fb->format->cpp[0];
...@@ -2038,7 +2053,7 @@ static uint32_t ilk_compute_fbc_wm(const struct intel_crtc_state *cstate, ...@@ -2038,7 +2053,7 @@ static uint32_t ilk_compute_fbc_wm(const struct intel_crtc_state *cstate,
{ {
int cpp; int cpp;
if (!cstate->base.active || !pstate->base.visible) if (!intel_wm_plane_visible(cstate, pstate))
return 0; return 0;
cpp = pstate->base.fb->format->cpp[0]; cpp = pstate->base.fb->format->cpp[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment