Commit 32024bb8 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915/fbc: Pass i915 instead of FBC instance to FBC underrun stuff

The underrun code doesn't need to know any details about FBC, so
just pass in the whole device rather than a specific FBC instance.
We could make this a bit more fine grained by also passing in the
pipe to intel_fbc_handle_fifo_underrun_irq() and letting the FBC
code figure which FBC instance (if any) is active on said pipe.
But that seems a bit overkill for this so don't bother.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211124113652.22090-11-ville.syrjala@linux.intel.comReviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
parent 62d4874b
...@@ -2044,9 +2044,7 @@ i915_fifo_underrun_reset_write(struct file *filp, ...@@ -2044,9 +2044,7 @@ i915_fifo_underrun_reset_write(struct file *filp,
return ret; return ret;
} }
ret = intel_fbc_reset_underrun(&dev_priv->fbc); intel_fbc_reset_underrun(dev_priv);
if (ret)
return ret;
return cnt; return cnt;
} }
......
...@@ -1547,21 +1547,21 @@ static void intel_fbc_underrun_work_fn(struct work_struct *work) ...@@ -1547,21 +1547,21 @@ static void intel_fbc_underrun_work_fn(struct work_struct *work)
/* /*
* intel_fbc_reset_underrun - reset FBC fifo underrun status. * intel_fbc_reset_underrun - reset FBC fifo underrun status.
* @fbc: The FBC instance * @i915: the i915 device
* *
* See intel_fbc_handle_fifo_underrun_irq(). For automated testing we * See intel_fbc_handle_fifo_underrun_irq(). For automated testing we
* want to re-enable FBC after an underrun to increase test coverage. * want to re-enable FBC after an underrun to increase test coverage.
*/ */
int intel_fbc_reset_underrun(struct intel_fbc *fbc) void intel_fbc_reset_underrun(struct drm_i915_private *i915)
{ {
struct drm_i915_private *i915 = fbc->i915; struct intel_fbc *fbc = &i915->fbc;
int ret;
if (!HAS_FBC(i915))
return;
cancel_work_sync(&fbc->underrun_work); cancel_work_sync(&fbc->underrun_work);
ret = mutex_lock_interruptible(&fbc->lock); mutex_lock(&fbc->lock);
if (ret)
return ret;
if (fbc->underrun_detected) { if (fbc->underrun_detected) {
drm_dbg_kms(&i915->drm, drm_dbg_kms(&i915->drm,
...@@ -1571,13 +1571,11 @@ int intel_fbc_reset_underrun(struct intel_fbc *fbc) ...@@ -1571,13 +1571,11 @@ int intel_fbc_reset_underrun(struct intel_fbc *fbc)
fbc->underrun_detected = false; fbc->underrun_detected = false;
mutex_unlock(&fbc->lock); mutex_unlock(&fbc->lock);
return 0;
} }
/** /**
* intel_fbc_handle_fifo_underrun_irq - disable FBC when we get a FIFO underrun * intel_fbc_handle_fifo_underrun_irq - disable FBC when we get a FIFO underrun
* @fbc: The FBC instance * @i915: i915 device
* *
* Without FBC, most underruns are harmless and don't really cause too many * Without FBC, most underruns are harmless and don't really cause too many
* problems, except for an annoying message on dmesg. With FBC, underruns can * problems, except for an annoying message on dmesg. With FBC, underruns can
...@@ -1589,9 +1587,11 @@ int intel_fbc_reset_underrun(struct intel_fbc *fbc) ...@@ -1589,9 +1587,11 @@ int intel_fbc_reset_underrun(struct intel_fbc *fbc)
* *
* This function is called from the IRQ handler. * This function is called from the IRQ handler.
*/ */
void intel_fbc_handle_fifo_underrun_irq(struct intel_fbc *fbc) void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *i915)
{ {
if (!HAS_FBC(fbc->i915)) struct intel_fbc *fbc = &i915->fbc;
if (!HAS_FBC(i915))
return; return;
/* There's no guarantee that underrun_detected won't be set to true /* There's no guarantee that underrun_detected won't be set to true
......
...@@ -35,8 +35,8 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, ...@@ -35,8 +35,8 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
enum fb_op_origin origin); enum fb_op_origin origin);
void intel_fbc_flush(struct drm_i915_private *dev_priv, void intel_fbc_flush(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits, enum fb_op_origin origin); unsigned int frontbuffer_bits, enum fb_op_origin origin);
void intel_fbc_handle_fifo_underrun_irq(struct intel_fbc *fbc); void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *i915);
int intel_fbc_reset_underrun(struct intel_fbc *fbc); void intel_fbc_reset_underrun(struct drm_i915_private *i915);
int intel_fbc_set_false_color(struct intel_fbc *fbc, bool enable); int intel_fbc_set_false_color(struct intel_fbc *fbc, bool enable);
#endif /* __INTEL_FBC_H__ */ #endif /* __INTEL_FBC_H__ */
...@@ -434,7 +434,7 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, ...@@ -434,7 +434,7 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
drm_err(&dev_priv->drm, "CPU pipe %c FIFO underrun\n", pipe_name(pipe)); drm_err(&dev_priv->drm, "CPU pipe %c FIFO underrun\n", pipe_name(pipe));
} }
intel_fbc_handle_fifo_underrun_irq(&dev_priv->fbc); intel_fbc_handle_fifo_underrun_irq(dev_priv);
} }
/** /**
......
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