Re: [PATCH 4/5] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon

Chris Wilson
2013-11-13T22:07:30Z

On Wed, Nov 13, 2013 at 10:20:47AM -0800, Jesse Barnes wrote:
> Retrieve current framebuffer config info from the regs and create an fb
> object for the buffer the BIOS or boot loader left us. This should
> allow for smooth transitions to userspace apps once we finish the
> initial configuration construction.
>
> v2: check for non-native modes and adjust (Jesse)
> fixup aperture and cmap frees (Imre)
> use unlocked unref if init_bios fails (Jesse)
> fix curly brace around DSPADDR check (Imre)
> comment failure path for pin_and_fence (Imre)
> v3: fixup fixup of aperture frees (Chris)
> v4: update to current bits (locking & pin_and_fence hack) (Jesse)
> v5: move fb config fetch to display code (Jesse)
> re-order hw state readout on initial load to suit fb inherit (Jesse)
> re-add pin_and_fence in fbdev code to make sure we refcount properly (Je
> v6: rename to plane_config (Daniel)
> check for valid object when initializing BIOS fb (Jesse)
> split from plane_config readout and other display changes (Jesse)

Weirdness... What happened to calling fbdev_init_bios() prior to
clobbering the GTT and outputs?

>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 5 +
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_drv.h | 2 +
> drivers/gpu/drm/i915/intel_fbdev.c | 187 +++++++++++++++++++++++++++++++++++--
> 4 files changed, 189 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 30f4fe7..bcad343 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -154,6 +154,11 @@ module_param_named(prefault_disable, i915_prefault_disable, bool, 0600);
> MODULE_PARM_DESC(prefault_disable,
> "Disable page prefaulting for pread/pwrite/reloc (default:false). For developers only.");
>
> +bool i915_use_bios_fb __read_mostly = 1;
> +module_param_named(use_bios_fb, i915_use_bios_fb, bool, 0600);

mode 0400, there is no point in allowing it to be changed at runtime. Is
a parameter justified? Do we really foresee circumstances where we want
fbcon to reallocate?

> +MODULE_PARM_DESC(use_bios_fb,
> + "Use BIOS allocated framebuffer for fbcon (default: true)");
> +
> static struct drm_driver driver;
> #if IS_ENABLED(CONFIG_AGP_INTEL)
> extern int intel_agp_enabled;

> +void intel_fbdev_init_bios(struct drm_device *dev)
> +{
[snip]
> +out_unref_obj:
> + mutex_unlock(&dev->struct_mutex);
> + drm_gem_object_unreference_unlocked(&plane_config->obj->base);

Would be cleaner to reverse these two lines and use
drm_gem_object_unreference()
-Chris

--
Chris Wilson, Intel Open Source Technology Centre