Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] lib/igt_fb: Fix intel_buf surface init
Date: Fri, 4 Oct 2024 14:00:43 +0300	[thread overview]
Message-ID: <d8013d78-0fa7-4ede-aba9-30a6e90f27b4@gmail.com> (raw)
In-Reply-To: <20240923213620.12369-1-ville.syrjala@linux.intel.com>

For flat ccs case I don't think buf->ccs[] would become filled because 
it should later cause gpu fault if aux stuff is present in render batch 
w/ flat ccs.

Anyway the change look good
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

On 24.9.2024 0.36, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The current coed is populating buf->ccs[] and buf->surface[]
> in a rather inconsistent way.
> 
> It looks like for flat CCS platforms:
> - we populate buf->ccs[] with some nonsense even though
>    we shouldn't since the AUX stuff is completely hidden by
>    the hardware
> - we seem to stick data about the clear color into both
>    both buf->ccs[] and buf->surfaces[] when it should be in neither
> 
> For non-flat CCS platforms the code seems more reasonable,
> except it only manages to skip the clear color fumble by
> the fact that num_planes is always odd with clear color
> and thus the /2 will truncate it away.
> 
> Anyways, let's make the code make actual sense for all platforms
> by properly calculating how many main surfaces and ccs surfaces
> there should be.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   lib/igt_fb.c | 42 +++++++++++++++++++++++++++++++++++-------
>   1 file changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index b8ffd7cfb261..6deb2a221df6 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -2636,6 +2636,35 @@ static int yuv_semiplanar_bpp(uint32_t drm_format)
>   	}
>   }
>   
> +static int intel_num_surfaces(const struct igt_fb *fb)
> +{
> +	int num_surfaces;
> +
> +	if (!igt_fb_is_ccs_modifier(fb->modifier))
> +		return fb->num_planes;
> +
> +	num_surfaces = fb->num_planes;
> +
> +	if (igt_fb_is_gen12_rc_ccs_cc_modifier(fb->modifier))
> +		num_surfaces--;
> +
> +	if (!HAS_FLATCCS(intel_get_drm_devid(fb->fd)))
> +		num_surfaces /= 2;
> +
> +	return num_surfaces;
> +}
> +
> +static int intel_num_ccs_surfaces(const struct igt_fb *fb)
> +{
> +	if (!igt_fb_is_ccs_modifier(fb->modifier))
> +		return 0;
> +
> +	if (HAS_FLATCCS(intel_get_drm_devid(fb->fd)))
> +		return 0;
> +
> +	return intel_num_surfaces(fb);
> +}
> +
>   struct intel_buf *
>   igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
>                           const struct igt_fb *fb,
> @@ -2705,13 +2734,12 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
>   	if (buf->format_is_yuv_semiplanar)
>   		buf->yuv_semiplanar_bpp = yuv_semiplanar_bpp(fb->drm_format);
>   
> -	if (igt_fb_is_ccs_modifier(fb->modifier)) {
> -		num_surfaces = fb->num_planes / (HAS_FLATCCS(intel_get_drm_devid(fb->fd)) ? 1 : 2);
> -		for (i = 0; i < num_surfaces; i++)
> -			init_buf_ccs(buf, i,
> -				     fb->offsets[num_surfaces + i],
> -				     fb->strides[num_surfaces + i]);
> -	}
> +	num_surfaces = intel_num_surfaces(fb);
> +
> +	for (i = 0; i < intel_num_ccs_surfaces(fb); i++)
> +		init_buf_ccs(buf, i,
> +			     fb->offsets[num_surfaces + i],
> +			     fb->strides[num_surfaces + i]);
>   
>   	igt_assert(fb->offsets[0] == 0);
>   	for (i = 0; i < num_surfaces; i++) {


  parent reply	other threads:[~2024-10-04 11:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 21:36 [PATCH i-g-t] lib/igt_fb: Fix intel_buf surface init Ville Syrjala
2024-09-26  0:17 ` ✗ CI.xeBAT: failure for " Patchwork
2024-09-26  0:19 ` ✗ Fi.CI.BAT: " Patchwork
2024-09-26  5:30 ` ✗ CI.xeFULL: " Patchwork
2024-09-27 17:28 ` ✗ Fi.CI.BAT: failure for lib/igt_fb: Fix intel_buf surface init (rev2) Patchwork
2024-09-27 18:25 ` ✓ CI.xeBAT: success " Patchwork
2024-09-30 17:17 ` ✓ Fi.CI.BAT: success for lib/igt_fb: Fix intel_buf surface init (rev3) Patchwork
2024-09-30 17:35 ` ✗ CI.xeBAT: failure " Patchwork
2024-09-30 22:27 ` ✗ CI.xeFULL: " Patchwork
2024-10-01  2:13 ` ✗ Fi.CI.IGT: " Patchwork
2024-10-04 11:00 ` Juha-Pekka Heikkila [this message]
2024-10-11 18:18 ` ✓ Fi.CI.BAT: success for lib/igt_fb: Fix intel_buf surface init (rev4) Patchwork
2024-10-11 18:35 ` ✓ CI.xeBAT: " Patchwork
2024-10-11 23:55 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-12 13:17 ` ✗ 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=d8013d78-0fa7-4ede-aba9-30a6e90f27b4@gmail.com \
    --to=juhapekka.heikkila@gmail.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