提交 0bf73c36 编写于 作者: P Paulo Zanoni 提交者: Daniel Vetter

drm/i915: protect FBC functions with FBC checks

Now all the functions called by other files check whether FBC has been
initialized. This allows us to drop the checks on the static
functions.

v2:
 - s/HAS_FBC/dev_priv->display.enable_fbc/ everywhere but the init
   function (Chris).
Suggested-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 c80ac854
...@@ -388,9 +388,6 @@ static void intel_fbc_enable(struct drm_crtc *crtc) ...@@ -388,9 +388,6 @@ static void intel_fbc_enable(struct drm_crtc *crtc)
WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock));
if (!dev_priv->display.enable_fbc)
return;
intel_fbc_cancel_work(dev_priv); intel_fbc_cancel_work(dev_priv);
work = kzalloc(sizeof(*work), GFP_KERNEL); work = kzalloc(sizeof(*work), GFP_KERNEL);
...@@ -430,9 +427,6 @@ static void __intel_fbc_disable(struct drm_device *dev) ...@@ -430,9 +427,6 @@ static void __intel_fbc_disable(struct drm_device *dev)
intel_fbc_cancel_work(dev_priv); intel_fbc_cancel_work(dev_priv);
if (!dev_priv->display.disable_fbc)
return;
dev_priv->display.disable_fbc(dev); dev_priv->display.disable_fbc(dev);
dev_priv->fbc.crtc = NULL; dev_priv->fbc.crtc = NULL;
} }
...@@ -447,6 +441,9 @@ void intel_fbc_disable(struct drm_device *dev) ...@@ -447,6 +441,9 @@ void intel_fbc_disable(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->display.enable_fbc)
return;
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
__intel_fbc_disable(dev); __intel_fbc_disable(dev);
mutex_unlock(&dev_priv->fbc.lock); mutex_unlock(&dev_priv->fbc.lock);
...@@ -463,6 +460,9 @@ void intel_fbc_disable_crtc(struct intel_crtc *crtc) ...@@ -463,6 +460,9 @@ void intel_fbc_disable_crtc(struct intel_crtc *crtc)
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->display.enable_fbc)
return;
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
if (dev_priv->fbc.crtc == crtc) if (dev_priv->fbc.crtc == crtc)
__intel_fbc_disable(dev); __intel_fbc_disable(dev);
...@@ -661,6 +661,9 @@ void intel_fbc_cleanup_cfb(struct drm_device *dev) ...@@ -661,6 +661,9 @@ void intel_fbc_cleanup_cfb(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->display.enable_fbc)
return;
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
__intel_fbc_cleanup_cfb(dev); __intel_fbc_cleanup_cfb(dev);
mutex_unlock(&dev_priv->fbc.lock); mutex_unlock(&dev_priv->fbc.lock);
...@@ -708,9 +711,6 @@ static void __intel_fbc_update(struct drm_device *dev) ...@@ -708,9 +711,6 @@ static void __intel_fbc_update(struct drm_device *dev)
const struct drm_display_mode *adjusted_mode; const struct drm_display_mode *adjusted_mode;
unsigned int max_width, max_height; unsigned int max_width, max_height;
if (!HAS_FBC(dev))
return;
WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock));
/* disable framebuffer compression in vGPU */ /* disable framebuffer compression in vGPU */
...@@ -857,6 +857,9 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -857,6 +857,9 @@ void intel_fbc_update(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->display.enable_fbc)
return;
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
__intel_fbc_update(dev); __intel_fbc_update(dev);
mutex_unlock(&dev_priv->fbc.lock); mutex_unlock(&dev_priv->fbc.lock);
...@@ -869,6 +872,9 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, ...@@ -869,6 +872,9 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
unsigned int fbc_bits; unsigned int fbc_bits;
if (!dev_priv->display.enable_fbc)
return;
if (origin == ORIGIN_GTT) if (origin == ORIGIN_GTT)
return; return;
...@@ -895,6 +901,9 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv, ...@@ -895,6 +901,9 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
{ {
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
if (!dev_priv->display.enable_fbc)
return;
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
if (!dev_priv->fbc.busy_bits) if (!dev_priv->fbc.busy_bits)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册