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 1/5] lib/igt_fb: Extract calc_plane_stride()
Date: Tue, 25 Sep 2018 15:59:58 -0700 [thread overview]
Message-ID: <1537916398.2714.27.camel@intel.com> (raw)
In-Reply-To: <20180925134741.19428-1-ville.syrjala@linux.intel.com>
Em Ter, 2018-09-25 às 16:47 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Extract the stride calculation from calc_fb_size_packed() to its own
> thing so that we can use it to calculate just the stride.
>
> v2: Rebase due to overflow fixes and roundup_power_of_two()
>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> lib/igt_fb.c | 50 +++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 486b5d3015ad..ed49a3ede874 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -226,6 +226,39 @@ static int fb_num_planes(struct
> format_desc_struct *format)
> return format->num_planes;
> }
>
> +static unsigned calc_plane_stride(int fd,
> + struct format_desc_struct *format,
> + int width, uint64_t tiling, int
> plane)
> +{
> + uint32_t min_stride = fb_plane_min_stride(format, width,
> plane);
> +
> + if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
> + intel_gen(intel_get_drm_devid(fd)) <= 3) {
> + uint32_t stride;
> +
> + /* Round the tiling up to the next power-of-two and
> the region
> + * up to the next pot fence size so that this works
> on all
> + * generations.
> + *
> + * This can still fail if the framebuffer is too
> large to be
> + * tiled. But then that failure is expected.
> + */
> +
> + stride = max(min_stride, 512);
> + stride = roundup_power_of_two(stride);
> +
> + return stride;
> + } else {
> + unsigned int tile_width, tile_height;
> +
> + igt_get_fb_tile_size(fd, tiling,
> + fb_plane_bpp(format, plane),
> + &tile_width, &tile_height);
> +
> + return ALIGN(min_stride, tile_width);
> + }
> +}
> +
> static void calc_fb_size_planar(int fd, int width, int height,
> struct format_desc_struct *format,
> uint64_t tiling, unsigned stride,
> @@ -272,12 +305,10 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
> struct format_desc_struct *format,
> uint64_t tiling,
> unsigned stride, uint64_t *size_ret,
> unsigned *stride_ret)
> {
> - unsigned int tile_width, tile_height;
> uint64_t size;
> - unsigned int byte_width = fb_plane_min_stride(format, width,
> 0);
>
> - igt_get_fb_tile_size(fd, tiling, fb_plane_bpp(format, 0),
> - &tile_width, &tile_height);
> + if (!stride)
> + stride = calc_plane_stride(fd, format, width,
> tiling, 0);
>
> if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
> intel_gen(intel_get_drm_devid(fd)) <= 3) {
> @@ -289,16 +320,13 @@ static void calc_fb_size_packed(int fd, int
> width, int height,
> * tiled. But then that failure is expected.
> */
>
> - if (!stride) {
> - stride = max(byte_width, 512);
> - stride = roundup_power_of_two(stride);
> - }
> -
> size = max((uint64_t) stride * height, 1024*1024);
> size = roundup_power_of_two(size);
> } else {
> - if (!stride)
> - stride = ALIGN(byte_width, tile_width);
> + unsigned int tile_width, tile_height;
> +
> + igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, 0),
> + &tile_width, &tile_height);
>
> size = (uint64_t) stride * ALIGN(height,
> tile_height);
> }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
prev parent reply other threads:[~2018-09-25 22:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 13:47 [igt-dev] [PATCH i-g-t 1/5] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
2018-09-25 13:47 ` [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
2018-09-25 23:37 ` Paulo Zanoni
2018-09-25 13:47 ` [igt-dev] [PATCH i-g-t 3/5] lib/igt_fb: Constify format_desc_struct Ville Syrjala
2018-09-25 13:47 ` [igt-dev] [PATCH i-g-t 4/5] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
2018-09-26 0:49 ` Paulo Zanoni
2018-09-27 13:46 ` Ville Syrjälä
2018-09-25 13:47 ` [igt-dev] [PATCH i-g-t 5/5] lib/igt_fb: Refactor blitter usage Ville Syrjala
2018-09-25 14:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] lib/igt_fb: Extract calc_plane_stride() Patchwork
2018-09-25 22:59 ` Paulo Zanoni [this message]
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=1537916398.2714.27.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 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.