drm/i915: fix the CFB size check
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Fri, 16 Oct 2015 19:44:43 +0000 (16:44 -0300)
committerPaulo Zanoni <paulo.r.zanoni@intel.com>
Thu, 3 Dec 2015 13:13:45 +0000 (11:13 -0200)
In function find_compression_threshold() we try to over-allocate CFB
space in order to reduce reallocations and fragmentation, and we're
not considering that at the CFB size check. Consider it.

There is also a longer-term plan to kill
dev_priv->fbc.uncompressed_size, but this will come later.

v2: Use drm_mm_node_allocated() (Chris).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/
drivers/gpu/drm/i915/intel_fbc.c

index 11fc5281e8ef291a47b920fe7d6d0bc6109cd1d3..9eb94c04ce695bc96db6fa214606e68240d78895 100644 (file)
@@ -720,7 +720,8 @@ static int intel_fbc_setup_cfb(struct intel_crtc *crtc)
        size = intel_fbc_calculate_cfb_size(crtc);
        cpp = drm_format_plane_cpp(fb->pixel_format, 0);
 
-       if (size <= dev_priv->fbc.uncompressed_size)
+       if (drm_mm_node_allocated(&dev_priv->fbc.compressed_fb) &&
+           size <= dev_priv->fbc.compressed_fb.size * dev_priv->fbc.threshold)
                return 0;
 
        /* Release any current block */