All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Imre Deak <imre.deak@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 6/6] for-ci: Check for ccs remap support
Date: Tue, 31 Aug 2021 20:52:21 +0300	[thread overview]
Message-ID: <06800e54-a3cf-8209-3c51-a193fe88d7cd@gmail.com> (raw)
In-Reply-To: <20210827145756.3342904-7-imre.deak@intel.com>

I wonder if this was unnecessary? I think those ccs tests will only run 
on shards and there's no adlp in shards yet?

/Juha-Pekka

On 27.8.2021 17.57, Imre Deak wrote:
> Remove the power-of-two stride size restriction only if there is a
> kernel support for this.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>   lib/igt_fb.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++----
>   1 file changed, 60 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 72291f4f7..e729703d9 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -715,6 +715,55 @@ void igt_init_fb(struct igt_fb *fb, int fd, int width, int height,
>   	}
>   }
>   
> +static bool adlp_ccs_remap_supported(int drm_fd)
> +{
> +	uint64_t modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS;
> +	uint64_t size;
> +	uint32_t width = 48 * 32;	/* Min stride with remapping to 48->64 tiles */
> +	uint32_t height = 32 * 32;	/* 4 tile aligned height */
> +	uint32_t format = DRM_FORMAT_XRGB8888;
> +	uint32_t strides[4] = {};
> +	uint32_t offsets[4] = {};
> +	uint32_t bo;
> +	uint32_t fb_id;
> +	static int supported = -1;
> +
> +	if (supported != -1)
> +		return supported;
> +
> +	strides[0] = width * 4;
> +	strides[1] = roundup_power_of_two(strides[0] / 512) * 64;
> +
> +	offsets[0] = 0;
> +	/* Ensure CCS plane 1 is misaligned. */
> +	offsets[1] = ALIGN(offsets[0] + strides[0] * height, 2 * 1024 * 1024) + 4096;
> +
> +	size = offsets[1] + strides[1] * height / 32;
> +
> +	bo = gem_buffer_create_fb_obj(drm_fd, size);
> +	igt_assert(bo);
> +
> +	if (__kms_addfb(drm_fd, bo,
> +			width, height,
> +			format, modifier,
> +			strides, offsets,
> +			2,
> +			DRM_MODE_FB_MODIFIERS, &fb_id) != 0) {
> +		supported = 0;
> +		igt_debug("CCS framebuffer remapping not supported.\n");
> +
> +		return false;
> +	}
> +
> +	igt_ioctl(drm_fd, DRM_IOCTL_MODE_RMFB, &fb_id);
> +	gem_close(drm_fd, bo);
> +
> +	supported = 1;
> +	igt_debug("CCS framebuffer remapping supported\n");
> +
> +	return true;
> +}
> +
>   static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
>   {
>   	uint32_t min_stride = fb->plane_width[plane] *
> @@ -786,7 +835,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
>   				     &tile_width, &tile_height);
>   
>   		if (is_gen12_ccs_modifier(fb->modifier)) {
> -			if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)))
> +			if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd))) {
>   				/*
>   				 * The main surface stride must be aligned to the CCS AUX
>   				 * page table block size (covered by one AUX PTE). This
> @@ -796,8 +845,13 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
>   				 * tile rows.
>   				 */
>   				tile_align = (min_stride <= 8 * tile_width) ? 8 : 16;
> -			else
> +				if (!adlp_ccs_remap_supported(fb->fd)) {
> +					tile_align = roundup_power_of_two(min_stride) / 128;
> +					tile_align = max(tile_align, 8);
> +				}
> +			} else {
>   				tile_align = 4;
> +			}
>   		}
>   
>   		return ALIGN(min_stride, tile_width * tile_align);
> @@ -848,7 +902,8 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
>   		 * On ADL_P CCS color planes must be 2MB aligned, until remapping
>   		 * support is added for CCS FBs.
>   		 */
> -		if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)))
> +		if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
> +		    !adlp_ccs_remap_supported(fb->fd))
>   			size = ALIGN(size, 2 * 1024 * 1024);
>   
>   		return size;
> @@ -870,9 +925,9 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
>   		 * On ADL_P CCS color planes must be 2MB aligned, until remapping
>   		 * support is added for CCS FBs.
>   		 */
> -		if (is_i915_device(fb->fd) &&
> +		if (is_ccs_modifier(fb->modifier) &&
>   		    IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
> -		    is_ccs_modifier(fb->modifier))
> +		    !adlp_ccs_remap_supported(fb->fd))
>   			size = ALIGN(size, 2 * 1024 * 1024);
>   
>   		return size;
> 

  reply	other threads:[~2021-08-31 17:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 14:57 [igt-dev] [PATCH i-g-t 0/6] lib/igt_fb: Remove stride, offset restrictions on CCS FBs Imre Deak
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 1/6] tests/kms_ccs: Make sure to free GEM and FB objects Imre Deak
2021-08-31 17:47   ` Juha-Pekka Heikkila
2021-08-31 18:54     ` Imre Deak
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 2/6] tests/kms_ccs: Use test pattern when possible Imre Deak
2021-08-31 17:48   ` Juha-Pekka Heikkila
2021-08-31 18:51     ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 3/6] tests/kms_ccs: Fix small aux stride subtest Imre Deak
2021-08-31 17:48   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 4/6] tests/kms_ccs: Test bad params for all CCS planes Imre Deak
2021-08-31 17:49   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 5/6] lib/igt_fb: Add support for remapping CCS FBs Imre Deak
2021-08-31 17:49   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 6/6] for-ci: Check for ccs remap support Imre Deak
2021-08-31 17:52   ` Juha-Pekka Heikkila [this message]
2021-08-31 19:08     ` Imre Deak
2021-09-14  7:46   ` Zbigniew Kempczyński
2021-09-14  8:40     ` Imre Deak
2021-08-27 16:05 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Remove stride, offset restrictions on CCS FBs Patchwork
2021-08-27 19:08 ` [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=06800e54-a3cf-8209-3c51-a193fe88d7cd@gmail.com \
    --to=juhapekka.heikkila@gmail.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.