[Intel-gfx] [PATCH 2/2] drm/i915/fbdev: Setup for using FBC tracking

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 24 11:16:46 UTC 2016


On Wed, Aug 24, 2016 at 01:05:18PM +0200, Daniel Vetter wrote:
> On Wed, Aug 24, 2016 at 08:39:52AM +0100, Chris Wilson wrote:
> > When FBC is enabled, access through the fbdev is tracked using
> > ORIGIN_GTT, i.e. native hw tracking by FBC. This requires the
> > framebuffer to be fenced, which requires us to allocate the object
> > as X-tiled.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/intel_fbdev.c | 13 +++++++++++--
> >  1 file changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> > index 8d6bfa565b50..ad3995f87485 100644
> > --- a/drivers/gpu/drm/i915/intel_fbdev.c
> > +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> > @@ -138,14 +138,17 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
> >  
> >  	mode_cmd.pitches[0] = ALIGN(mode_cmd.width *
> >  				    DIV_ROUND_UP(sizes->surface_bpp, 8), 64);
> > +	if (i915.enable_fbc)
> > +		mode_cmd.pitches[0] = ALIGN(mode_cmd.pitches[0], 512);
> > +
> >  	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
> >  							  sizes->surface_depth);
> >  
> > -	mutex_lock(&dev->struct_mutex);
> > -
> >  	size = mode_cmd.pitches[0] * mode_cmd.height;
> >  	size = PAGE_ALIGN(size);
> >  
> > +	mutex_lock(&dev->struct_mutex);
> > +
> >  	/* If the FB is too big, just don't use it since fbdev is not very
> >  	 * important and we should probably use that space with FBC or other
> >  	 * features. */
> > @@ -159,6 +162,12 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
> >  		goto out;
> >  	}
> >  
> > +	if (i915.enable_fbc) {
> > +		obj->tiling_and_stride = mode_cmd.pitches[0] | I915_TILING_X;
> > +		mode_cmd.modifier[0] = I915_FORMAT_MOD_X_TILED;
> > +		mode_cmd.flags |= DRM_MODE_FB_MODIFIERS;
> > +	}
> 
> Even more magic set-tiling calls, now also depending upon module options.
> This sounds like a rather bad idea to me.

FB_MODIFIERS are pretty magic, I know!

This was more of if you want to use fbdev + fbc, this is what we should
do. Note that this is not so much a module option, but fbc state. At
this point in fbdev's lifecycle, we should be able to use HAS_FBC()
which is equivalent to i915.enable_fbc once we've sanitized the options.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list