public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg v2
Date: Tue, 26 Nov 2013 09:37:35 -0800	[thread overview]
Message-ID: <20131126093735.1b4c7779@jbarnes-desktop> (raw)
In-Reply-To: <20131126172827.GU10036@intel.com>

On Tue, 26 Nov 2013 19:28:27 +0200
Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:

> On Mon, Nov 25, 2013 at 03:51:15PM -0800, Jesse Barnes wrote:
> > And move it up in the file for earlier usage.
> > 
> > v2: add pre-gen4 support as well (Chris)
> > 
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 53 ++++++++++++++++++++++++++----------
> >  1 file changed, 38 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index e85d838..321d751 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -5452,6 +5452,28 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
> >  	pipe_config->port_clock = clock.dot / 5;
> >  }
> >  
> > +static u32
> > +intel_framebuffer_pitch_for_width(struct drm_i915_private *dev_priv, int width,
> > +				  int bpp, bool tiled)
> > +{
> > +	u32 pitch = DIV_ROUND_UP(width * bpp, 8);
> > +	int align;
> > +
> > +	if (tiled) {
> > +		if (INTEL_INFO(dev_priv->dev)->gen < 4) {
> > +			/* Pre-965 needs power of two tile width */
> > +			for (align = 512; align < pitch; align <<= 1)
> > +				;
> > +		} else {
> > +			align = 512;
> > +		}
> 
> Gen2 tiles are 128 bytes wide, not 512 bytes.
> 
> So maybe something like this:
>  if (IS_GEN2()) {
>    return roundup_power_of_two(max(pitch, 128));
>  else if (IS_GEN3())
>    return roundup_power_of_two(max(pitch, 512));
>  else
>    return ALIGN(pitch, 512);
> 
> > +	} else {
> > +		align = 64;

Ah good old gen2.  Pretty sure we've just treated it as 512 wide in the
past?  But I'm not going to go digging around the DDX to see... :)

I was looking for that POT helper but didn't see it, that makes things
a little nicer.

> Also I just noticed in the docs that gen2/3 only seem to require 32byte
> alignment for linear buffers. But relaxing that would require a change
> to intel_framebuffer_init() as well, so it looks like material for
> another patch. Also would need to be tested on real hardware.

Yeah separate patch.  It'll save us gobs of memory. :)

> > -intel_framebuffer_size_for_mode(struct drm_display_mode *mode, int bpp)
> > +intel_framebuffer_size_for_mode(struct drm_i915_private *dev_priv,
> > +				struct drm_display_mode *mode, int bpp)
> >  {
> > -	u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp);
> > +	u32 pitch = intel_framebuffer_pitch_for_width(dev_priv,
> > +						      mode->hdisplay, bpp,
> > +						      false);
> >  	return ALIGN(pitch * mode->vdisplay, PAGE_SIZE);
> 
> This should also align the fb height to tile height, otherwise
> intel_framebuffer_init() might reject it.

Hm another existing bug.  Separate patch.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2013-11-26 17:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 23:51 [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg v2 Jesse Barnes
2013-11-25 23:51 ` [PATCH 2/5] drm/i915: split fb allocation and initialization v2 Jesse Barnes
2013-11-25 23:51 ` [PATCH 3/5] drm/i915: retrieve current fb config into new plane_config structure at init v4 Jesse Barnes
2013-11-26 13:57   ` Chris Wilson
2013-11-26 16:41     ` Jesse Barnes
2013-11-26 17:43   ` Daniel Vetter
2013-11-26 18:11     ` Jesse Barnes
2013-11-25 23:51 ` [PATCH 4/5] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7 Jesse Barnes
2013-11-26 14:09   ` Chris Wilson
2013-11-26 16:43     ` Jesse Barnes
2013-11-26 17:54     ` Daniel Vetter
2013-11-26 18:15       ` Jesse Barnes
2013-11-25 23:51 ` [PATCH 5/5] drm/i915: don't memset the fb buffer if preallocated Jesse Barnes
2013-11-26 14:13   ` Chris Wilson
2013-11-26 13:53 ` [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg v2 Chris Wilson
2013-11-26 17:28 ` Ville Syrjälä
2013-11-26 17:37   ` Jesse Barnes [this message]
2013-11-26 17:57 ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2013-11-15  0:04 Jesse Barnes

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=20131126093735.1b4c7779@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox