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

Jesse Barnes
2013-11-13T22:10:33Z

On Wed, 13 Nov 2013 22:07:26 +0000
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> 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?

Hm I'll have to check on the outputs, if we're clobbering them that's
definitely not what I intended.

For the GTT though we allocate the buffer in the plane_config readout,
so it should be safe across GTT init. It does need to be freed though
if we decide against using it, so that's another bug to fix.

> > +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?

I'll drop it to be optimistic. :)

> > +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()

Ok.

Thanks,
--
Jesse Barnes, Intel Open Source Technology Center