Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/13] drm/i915: Split the framebuffer_info creation into a separate routine
Date: Wed, 27 Mar 2013 13:49:06 +0200	[thread overview]
Message-ID: <1364384946.11117.3.camel@intelbox> (raw)
In-Reply-To: <20130326160727.222a31ed@jbarnes-desktop>

On Tue, 2013-03-26 at 16:07 -0700, Jesse Barnes wrote:
> On Wed, 20 Mar 2013 14:23:48 +0200
> Imre Deak <imre.deak@intel.com> wrote:
> 
> > > +	if (!info->screen_base)
> > 
> > kfree(info->apertures) is missing. The same goes for
> > intel_fbdev_destroy().
> 
> Fixed in both places.
> 
> > 
> > > +		goto err_cmap;
> > > +
> > > +	/* If the object is shmemfs backed, it will have given us zeroed pages.
> > > +	 * If the object is stolen however, it will be full of whatever
> > > +	 * garbage was left in there.
> > > +	 */
> > > +	if (ifbdev->ifb.obj->stolen)
> > > +		memset_io(info->screen_base, 0, info->screen_size);
> > > +
> > > +	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
> > > +
> > > +	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
> > > +	drm_fb_helper_fill_var(info, &ifbdev->helper, fb->width, fb->height);
> > > +
> > > +	return info;
> > > +
> > > +err_cmap:
> > > +	if (info->cmap.len)
> > > +		fb_dealloc_cmap(&info->cmap);
> > 
> > Should be fine to call w/o checking cmap.len.
> 
> Fixed in both places.
> 
> > 
> > > +err_info:
> > > +	framebuffer_release(info);
> > > +	return NULL;
> > > +}
> > > +
> > >  static int intelfb_create(struct intel_fbdev *ifbdev,
> > >  			  struct drm_fb_helper_surface_size *sizes)
> > >  {
> > >  	struct drm_device *dev = ifbdev->helper.dev;
> > > -	struct drm_i915_private *dev_priv = dev->dev_private;
> > > -	struct fb_info *info;
> > > -	struct drm_framebuffer *fb;
> > > -	struct drm_mode_fb_cmd2 mode_cmd = {};
> > > +	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
> > >  	struct drm_i915_gem_object *obj;
> > > -	struct device *device = &dev->pdev->dev;
> > > +	struct fb_info *info;
> > >  	int size, ret;
> > >  
> > >  	/* we don't do packed 24bpp */
> > >  	if (sizes->surface_bpp == 24)
> > >  		sizes->surface_bpp = 32;
> > >  
> > > -	mode_cmd.width = sizes->surface_width;
> > > +	mode_cmd.width  = sizes->surface_width;
> > >  	mode_cmd.height = sizes->surface_height;
> > >  
> > > -	mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((sizes->surface_bpp + 7) /
> > > -						      8), 64);
> > > -	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
> > > -							  sizes->surface_depth);
> > > +	mode_cmd.pitches[0] =
> > > +		intel_framebuffer_pitch_for_width(mode_cmd.width,
> > > +						  sizes->surface_bpp);
> > 
> > This changes the way pitches[0] is calculated for surface_bpp % 8 != 0,
> > but there's no mention of it in the commit message.
> 
> It just removes the open coding; we still do the rounding and alignment
> to 64 bytes.

Yea, but you get different results due to the different way of rounding
for certain bpps. For example:

sizes->surface_bpp = 4
mode_cmd.width = 1000

You get pitches[0]=1024 with the old way and 512 with the new way.

--Imre

  reply	other threads:[~2013-03-27 11:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 21:31 More fastboot bits Jesse Barnes
2013-02-19 21:31 ` [PATCH 01/13] drm/i915: Skip modifying PCH DREF if not changing clock sources Jesse Barnes
2013-03-20 12:17   ` Imre Deak
2013-03-26 22:57     ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 02/13] drm/i915: Introduce i915_gem_object_create_stolen_for_preallocated Jesse Barnes
2013-03-26 19:46   ` Daniel Vetter
2013-03-26 20:58     ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 03/13] drm/i915: Split the framebuffer_info creation into a separate routine Jesse Barnes
2013-03-20 12:23   ` Imre Deak
2013-03-26 23:07     ` Jesse Barnes
2013-03-27 11:49       ` Imre Deak [this message]
2013-03-27 13:48         ` Chris Wilson
2013-02-19 21:31 ` [PATCH 04/13] drm: add initial_config function to fb helper Jesse Barnes
2013-03-26 20:34   ` Daniel Vetter
2013-03-26 20:52     ` Chris Wilson
2013-03-26 20:57       ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 05/13] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon Jesse Barnes
2013-03-20 12:31   ` Imre Deak
2013-03-26 23:20     ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 06/13] drm/i915: Retrieve the current mode upon KMS takeover Jesse Barnes
2013-03-20 12:36   ` Imre Deak
2013-03-26 23:24     ` Jesse Barnes
2013-03-26 23:52       ` Daniel Vetter
2013-03-26 23:59         ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 07/13] drm/i915: Only preserve the BIOS modes if they are the preferred ones Jesse Barnes
2013-02-19 21:31 ` [PATCH 08/13] drm/i915: Validate that the framebuffer accommodates the current mode Jesse Barnes
2013-02-19 21:31 ` [PATCH 09/13] drm/i915: fix build in intel_display.c Jesse Barnes
2013-03-20 12:41   ` Imre Deak
2013-03-26 23:26     ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 10/13] drm/i915: check panel fit status at update_plane time Jesse Barnes
2013-03-20 12:46   ` Imre Deak
2013-02-19 21:31 ` [PATCH 11/13] drm/i915: add clock_get for ironlake+ Jesse Barnes
2013-03-20 12:48   ` Imre Deak
2013-03-26 23:29     ` Jesse Barnes
2013-02-19 21:31 ` [PATCH 12/13] drm/i915: treat no fb -> fb as simple flip instead of full mode set Jesse Barnes
2013-02-19 21:31 ` [PATCH 13/13] drm/i915: check for non-native modes when inheriting a BIOS fb Jesse Barnes
2013-03-20 12:51   ` Imre Deak
2013-03-26 23:29     ` Jesse Barnes
2013-03-20 12:15 ` More fastboot bits Imre Deak
2013-03-20 15:20   ` 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=1364384946.11117.3.camel@intelbox \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.org \
    /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