All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 6/8] drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping
Date: Fri, 10 May 2019 10:40:55 +0200	[thread overview]
Message-ID: <20190510084055.GI17751@phenom.ffwll.local> (raw)
In-Reply-To: <20190509122159.24376-7-ville.syrjala@linux.intel.com>

On Thu, May 09, 2019 at 03:21:57PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Align dumb buffer stride to 4k if the fb will be big enough to
> require gtt remapping.
> 
> v2: Leave the stride alone for buffers that look to be for the cursor
> v3: Make it not a hack (Daniel)
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yeah I think this is a reasonable heuristics.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_gem.c      | 26 +++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/intel_display.c |  1 -
>  drivers/gpu/drm/i915/intel_display.h |  2 ++
>  3 files changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4e474bcf4c22..7cafd5612f71 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -52,6 +52,7 @@
>  #include "i915_trace.h"
>  #include "i915_vgpu.h"
>  
> +#include "intel_display.h"
>  #include "intel_drv.h"
>  #include "intel_frontbuffer.h"
>  #include "intel_pm.h"
> @@ -560,8 +561,31 @@ i915_gem_dumb_create(struct drm_file *file,
>  		     struct drm_device *dev,
>  		     struct drm_mode_create_dumb *args)
>  {
> +	int cpp = DIV_ROUND_UP(args->bpp, 8);
> +	u32 format;
> +
> +	switch (cpp) {
> +	case 1:
> +		format = DRM_FORMAT_C8;
> +		break;
> +	case 2:
> +		format = DRM_FORMAT_RGB565;
> +		break;
> +	case 4:
> +		format = DRM_FORMAT_XRGB8888;
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
>  	/* have to work out size/pitch and return them */
> -	args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
> +	args->pitch = ALIGN(args->width * cpp, 64);
> +
> +	/* align stride to page size so that we can remap */
> +	if (args->pitch > intel_plane_fb_max_stride(to_i915(dev), format,
> +						    DRM_FORMAT_MOD_LINEAR))
> +		args->pitch = ALIGN(args->pitch, 4096);
> +
>  	args->size = args->pitch * args->height;
>  	return i915_gem_create(file, to_i915(dev),
>  			       &args->size, &args->handle);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 94faac9e3666..fa317c40d548 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2498,7 +2498,6 @@ bool is_ccs_modifier(u64 modifier)
>  	       modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
>  }
>  
> -static
>  u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
>  			      u32 pixel_format, u64 modifier)
>  {
> diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h
> index 500eec90928d..1e6533fbd061 100644
> --- a/drivers/gpu/drm/i915/intel_display.h
> +++ b/drivers/gpu/drm/i915/intel_display.h
> @@ -436,6 +436,8 @@ void intel_link_compute_m_n(u16 bpp, int nlanes,
>  			    bool constant_n);
>  bool is_ccs_modifier(u64 modifier);
>  void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
> +u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
> +			      u32 pixel_format, u64 modifier);
>  bool intel_plane_can_remap(const struct intel_plane_state *plane_state);
>  
>  #endif
> -- 
> 2.21.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-10  8:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 12:21 [PATCH v4 0/8] drm/i915: GTT remapping for display Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 1/8] drm/i915: Add a new "remapped" gtt_view Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 2/8] drm/i915/selftests: Add mock selftest for remapped vmas Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 3/8] drm/i915/selftests: Add live vma selftest Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 4/8] drm/i915: Shuffle stride checking code around Ville Syrjala
2019-05-10  8:37   ` Daniel Vetter
2019-05-09 12:21 ` [PATCH v4 5/8] drm/i915: Overcome display engine stride limits via GTT remapping Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 6/8] drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping Ville Syrjala
2019-05-10  8:40   ` Daniel Vetter [this message]
2019-05-09 12:21 ` [PATCH v4 7/8] drm/i915: Bump fb stride limit to 128KiB for gen4+ and 256KiB for gen7+ Ville Syrjala
2019-05-09 12:21 ` [PATCH v4 8/8] drm/i915: Bump gen7+ fb size limits to 16kx16k Ville Syrjala
2019-05-16 16:33   ` Maarten Lankhorst
2019-05-20 15:14     ` Ville Syrjälä
2019-05-09 14:54 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display Patchwork
2019-05-09 14:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-05-09 15:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-09 23:36 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190510084055.GI17751@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.