drm/i915/display: check if compressed_llb was allocated

If we hit the error path here we unconditionally call
i915_gem_stolen_remove_node, even though we only allocate the
compressed_llb on older platforms. Therefore we should first check that
we actually allocated the node before trying to remove it.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/3709
Fixes: 46b2c40e0a ("drm/i915/fbc: Allocate llb before cfb")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210701090326.1056452-1-matthew.auld@intel.com
This commit is contained in:
Matthew Auld 2021-07-01 10:03:26 +01:00
parent 3352d86dcd
commit 01fa662091
1 changed files with 2 additions and 1 deletions

View File

@ -516,7 +516,8 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv,
return 0;
err_llb:
i915_gem_stolen_remove_node(dev_priv, &fbc->compressed_llb);
if (drm_mm_node_allocated(&fbc->compressed_llb))
i915_gem_stolen_remove_node(dev_priv, &fbc->compressed_llb);
err:
if (drm_mm_initialized(&dev_priv->mm.stolen))
drm_info_once(&dev_priv->drm, "not enough stolen space for compressed buffer (need %d more bytes), disabling. Hint: you may be able to increase stolen memory size in the BIOS to avoid this.\n", size);