All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Fix stride for render_copy based FB conversions
Date: Thu, 29 Apr 2021 22:51:15 +0300	[thread overview]
Message-ID: <YIsOM5lMBDBAY/F1@intel.com> (raw)
In-Reply-To: <20210429192628.4056795-3-imre.deak@intel.com>

On Thu, Apr 29, 2021 at 10:26:27PM +0300, Imre Deak wrote:
> When setting up an intel_buf for a render copy operation, the render
> buffer stride has to match the framebuffer stride. Not ensuring this may
> lead to a mismatch modeset error or an -EBUSY set_tiling IOCTL failure
> when trying to change the stride for a framebuffer object.

The stride needs to always match, otherwise we're going to be
rendering garbage. What used to be the case is that the igt_buf
thing was just given the stride and size, and it just set up
things so that the render surface covers the entire stride,
whether or not the fb is smaller or not.

So I guess this is some kind of regression because we're now
using the fb->width for something?

> 
> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  lib/igt_fb.c       |  3 ++-
>  lib/intel_bufops.c | 25 +++++++++++++++++--------
>  lib/intel_bufops.h |  3 ++-
>  3 files changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 5c1670410..209bfacf0 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -2257,7 +2257,8 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
>  						     fb->width, fb->height,
>  						     fb->plane_bpp[0], 0,
>  						     igt_fb_mod_to_tiling(fb->modifier),
> -						     compression, fb->size);
> +						     compression, fb->size,
> +						     fb->strides[0]);
>  	intel_buf_set_name(buf, name);
>  
>  	/* Make sure we close handle on destroy path */
> diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
> index 3c1cca0cf..5dece5764 100644
> --- a/lib/intel_bufops.c
> +++ b/lib/intel_bufops.c
> @@ -709,7 +709,7 @@ static void __intel_buf_init(struct buf_ops *bops,
>  			     struct intel_buf *buf,
>  			     int width, int height, int bpp, int alignment,
>  			     uint32_t req_tiling, uint32_t compression,
> -			     uint64_t bo_size)
> +			     uint64_t bo_size, int bo_stride)
>  {
>  	uint32_t tiling = req_tiling;
>  	uint64_t size;
> @@ -741,7 +741,9 @@ static void __intel_buf_init(struct buf_ops *bops,
>  		 * CCS units, that is 4 * 64 bytes. These 4 CCS units are in
>  		 * turn mapped by one L1 AUX page table entry.
>  		 */
> -		if (bops->intel_gen >= 12)
> +		if (bo_stride)
> +			buf->surface[0].stride = bo_stride;
> +		else if (bops->intel_gen >= 12)
>  			buf->surface[0].stride = ALIGN(width * (bpp / 8), 128 * 4);
>  		else
>  			buf->surface[0].stride = ALIGN(width * (bpp / 8), 128);
> @@ -765,10 +767,16 @@ static void __intel_buf_init(struct buf_ops *bops,
>  		if (tiling) {
>  			devid =  intel_get_drm_devid(bops->fd);
>  			tile_width = get_stride(devid, tiling);
> -			buf->surface[0].stride = ALIGN(width * (bpp / 8), tile_width);
> +			if (bo_stride)
> +				buf->surface[0].stride = bo_stride;
> +			else
> +				buf->surface[0].stride = ALIGN(width * (bpp / 8), tile_width);
>  			align_h = tiling == I915_TILING_X ? 8 : 32;
>  		} else {
> -			buf->surface[0].stride = ALIGN(width * (bpp / 8), alignment ?: 1);
> +			if (bo_stride)
> +				buf->surface[0].stride = bo_stride;
> +			else
> +				buf->surface[0].stride = ALIGN(width * (bpp / 8), alignment ?: 1);
>  		}
>  
>  		buf->surface[0].size = buf->surface[0].stride * height;
> @@ -816,7 +824,7 @@ void intel_buf_init(struct buf_ops *bops,
>  		    uint32_t tiling, uint32_t compression)
>  {
>  	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
> -			 tiling, compression, 0);
> +			 tiling, compression, 0, 0);
>  
>  	intel_buf_set_ownership(buf, true);
>  }
> @@ -875,7 +883,7 @@ void intel_buf_init_using_handle(struct buf_ops *bops,
>  				 uint32_t req_tiling, uint32_t compression)
>  {
>  	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
> -			 req_tiling, compression, 0);
> +			 req_tiling, compression, 0, 0);
>  }
>  
>  /**
> @@ -950,7 +958,8 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
>  							 int bpp, int alignment,
>  							 uint32_t req_tiling,
>  							 uint32_t compression,
> -							 uint64_t size)
> +							 uint64_t size,
> +							 int stride)
>  {
>  	struct intel_buf *buf;
>  
> @@ -960,7 +969,7 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
>  	igt_assert(buf);
>  
>  	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
> -			 req_tiling, compression, size);
> +			 req_tiling, compression, size, stride);
>  
>  	return buf;
>  }
> diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
> index 1a3d86925..12c2d5239 100644
> --- a/lib/intel_bufops.h
> +++ b/lib/intel_bufops.h
> @@ -151,7 +151,8 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
>  							 int bpp, int alignment,
>  							 uint32_t req_tiling,
>  							 uint32_t compression,
> -							 uint64_t size);
> +							 uint64_t size,
> +							 int stride);
>  void intel_buf_destroy(struct intel_buf *buf);
>  
>  void *intel_buf_cpu_map(struct intel_buf *buf, bool write);
> -- 
> 2.27.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-04-29 19:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 19:26 [igt-dev] [PATCH i-g-t 0/3] lib/igt_fb: A few changes to fix test runs on ADL_P Imre Deak
2021-04-29 19:26 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_ccs: Skip CCS color clear value check for randomizing subtests Imre Deak
2021-05-05  0:23   ` Rodrigo Siqueira
2021-05-05 10:27     ` Imre Deak
2021-05-05 23:07       ` Rodrigo Siqueira
2021-04-29 19:26 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Fix stride for render_copy based FB conversions Imre Deak
2021-04-29 19:51   ` Ville Syrjälä [this message]
2021-04-30  5:53     ` Zbigniew Kempczyński
2021-04-30 10:29       ` Imre Deak
2021-04-29 19:26 ` [igt-dev] [PATCH i-g-t 3/3] lib/igt_fb: Remove redundant VC4 SAND plane size alignment Imre Deak
2021-04-29 20:42 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: A few changes to fix test runs on ADL_P Patchwork
2021-04-30  0:55 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-05-04 15:00   ` Imre Deak
2021-05-04 15:13     ` Ville Syrjälä
2021-05-04 18:53       ` Imre Deak
2021-05-05  8:06         ` Saarinen, Jani
2021-05-05 21:03           ` Souza, Jose
2021-05-04  9:39 ` [igt-dev] [PATCH i-g-t 0/3] " Juha-Pekka Heikkila
2021-05-04 12:07 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: A few changes to fix test runs on ADL_P (rev2) Patchwork
2021-05-04 13:45 ` [igt-dev] ✓ 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=YIsOM5lMBDBAY/F1@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=imre.deak@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.