igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride
Date: Thu, 20 Sep 2018 17:04:59 -0700	[thread overview]
Message-ID: <1537488299.2746.31.camel@intel.com> (raw)
In-Reply-To: <20180719150415.935-6-ville.syrjala@linux.intel.com>

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We prented to allow the caller to specify the stride explicitly for
> the
> fb. But we don't actually use that user specified stride when we
> calculate the require bo size. Fix that oversight.
> 

Requires simple rebase.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d9673228..6748357ad16b 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -215,11 +215,12 @@ static unsigned planar_height(struct
> format_desc_struct *format, unsigned height
>  
>  static void calc_fb_size_planar(int fd, int width, int height,
>  				struct format_desc_struct *format,
> -				uint64_t tiling, unsigned *size_ret,
> -				unsigned *stride_ret, unsigned
> *offsets)
> +				uint64_t tiling, unsigned stride,
> +				unsigned *size_ret, unsigned
> *stride_ret,
> +				unsigned *offsets)
>  {
>  	int plane;
> -	unsigned stride = 0, tile_width, tile_height;
> +	unsigned max_stride = 0, tile_width, tile_height;
>  
>  	*size_ret = 0;
>  
> @@ -229,10 +230,13 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  		igt_get_fb_tile_size(fd, tiling, format-
> >plane_bpp[plane], &tile_width, &tile_height);
>  
>  		plane_stride = ALIGN(planar_stride(format, width,
> plane), tile_width);
> -		if (stride < plane_stride)
> -			stride = plane_stride;
> +		if (max_stride < plane_stride)
> +			max_stride = plane_stride;
>  	}
>  
> +	if (!stride)
> +		stride = max_stride;
> +
>  	for (plane = 0; plane < format->num_planes; plane++) {
>  		if (offsets)
>  			offsets[plane] = *size_ret;
> @@ -251,9 +255,9 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>  
>  static void calc_fb_size_packed(int fd, int width, int height,
>  				struct format_desc_struct *format,
> uint64_t tiling,
> -				unsigned *size_ret, unsigned
> *stride_ret)
> +				unsigned stride, unsigned *size_ret,
> unsigned *stride_ret)
>  {
> -	unsigned int tile_width, tile_height, stride, size;
> +	unsigned int tile_width, tile_height, size;
>  	int byte_width = width * (format->plane_bpp[0] / 8);
>  
>  	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0],
> &tile_width, &tile_height);
> @@ -270,15 +274,18 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
>  		 * tiled. But then that failure is expected.
>  		 */
>  
> -		v = byte_width;
> -		for (stride = 512; stride < v; stride *= 2)
> -			;
> +		if (!stride) {
> +			v = byte_width;
> +			for (stride = 512; stride < v; stride *= 2)
> +				;
> +		}
>  
>  		v = stride * height;
>  		for (size = 1024*1024; size < v; size *= 2)
>  			;
>  	} else {
> -		stride = ALIGN(byte_width, tile_width);
> +		if (!stride)
> +			stride = ALIGN(byte_width, tile_width);
>  		size = stride * ALIGN(height, tile_height);
>  	}
>  
> @@ -306,9 +313,9 @@ void igt_calc_fb_size(int fd, int width, int
> height, uint32_t drm_format, uint64
>  	igt_assert(format);
>  
>  	if (format->num_planes > 1)
> -		calc_fb_size_planar(fd, width, height, format,
> tiling, size_ret, stride_ret, NULL);
> +		calc_fb_size_planar(fd, width, height, format,
> tiling, 0, size_ret, stride_ret, NULL);
>  	else
> -		calc_fb_size_packed(fd, width, height, format,
> tiling, size_ret, stride_ret);
> +		calc_fb_size_packed(fd, width, height, format,
> tiling, 0, size_ret, stride_ret);
>  }
>  
>  /**
> @@ -383,10 +390,10 @@ static int create_bo_for_fb(int fd, int width,
> int height,
>  		unsigned calculated_size, calculated_stride;
>  
>  		if (format->num_planes > 1)
> -			calc_fb_size_planar(fd, width, height,
> format, tiling,
> +			calc_fb_size_planar(fd, width, height,
> format, tiling, stride,
>  					    &calculated_size,
> &calculated_stride, offsets);
>  		else
> -			calc_fb_size_packed(fd, width, height,
> format, tiling,
> +			calc_fb_size_packed(fd, width, height,
> format, tiling, stride,
>  					    &calculated_size,
> &calculated_stride);
>  
>  		if (stride == 0)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-21  0:06 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
2018-09-20 20:56   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
2018-09-20 21:10   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
2018-09-20 23:36   ` Paulo Zanoni
2018-09-21 13:37     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
2018-08-24  3:17   ` Dhinakaran Pandiyan
2018-08-28 14:21     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
2018-09-21  0:04   ` Paulo Zanoni [this message]
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
2018-09-18 21:17   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
2018-09-21  0:15   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
2018-09-21  0:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
2018-09-21 21:58   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
2018-09-21 22:02   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
2018-09-21 22:05   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
2018-09-21 22:33   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
2018-09-21 22:45   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
2018-09-21 22:54   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
2018-09-21 23:15   ` Paulo Zanoni
2018-10-03 10:56     ` Petri Latvala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
2018-09-21 23:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
2018-09-21 23:48   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well Ville Syrjala
2018-07-19 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Patchwork
2018-07-19 17:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
2018-09-21 13:26   ` Ville Syrjälä
2018-09-21 21:39     ` Paulo Zanoni
2018-11-27 20:30       ` Kazlauskas, Nicholas
2018-11-27 21:20         ` Ville Syrjälä

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=1537488299.2746.31.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=igt-dev@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;
as well as URLs for NNTP newsgroup(s).