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

Daniel Vetter daniel at ffwll.ch
Wed Aug 24 11:05:18 UTC 2016


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.
-Daniel

> +
>  	fb = __intel_framebuffer_create(dev, &mode_cmd, obj);
>  	if (IS_ERR(fb)) {
>  		i915_gem_object_put(obj);
> -- 
> 2.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list