Skip to content

Commit

Permalink
drm/i915/fbc: extract intel_fbc_can_enable()
Browse files Browse the repository at this point in the history
Extract that part of the code to a new function and call this function
only once during intel_fbc_choose_crtc() instead of once per plane.
Those checks are independent from planes/CRTCs.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1478883461-20201-4-git-send-email-paulo.r.zanoni@intel.com
  • Loading branch information
Paulo Zanoni committed Nov 14, 2016
1 parent ba67fab commit ee2be30
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/gpu/drm/i915/intel_fbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,8 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
return true;
}

static bool intel_fbc_can_choose(struct intel_crtc *crtc)
static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv)
{
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
struct intel_fbc *fbc = &dev_priv->fbc;

if (intel_vgpu_active(dev_priv)) {
Expand All @@ -874,6 +873,14 @@ static bool intel_fbc_can_choose(struct intel_crtc *crtc)
return false;
}

return true;
}

static bool intel_fbc_can_choose(struct intel_crtc *crtc)
{
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
struct intel_fbc *fbc = &dev_priv->fbc;

if (fbc_on_pipe_a_only(dev_priv) && crtc->pipe != PIPE_A) {
fbc->no_fbc_reason = "no enabled pipes can have FBC";
return false;
Expand Down Expand Up @@ -1085,6 +1092,9 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
if (!fbc_crtc_present && fbc->crtc != NULL)
goto out;

if (!intel_fbc_can_enable(dev_priv))
goto out;

/* Simply choose the first CRTC that is compatible and has a visible
* plane. We could go for fancier schemes such as checking the plane
* size, but this would just affect the few platforms that don't tie FBC
Expand Down

0 comments on commit ee2be30

Please sign in to comment.