public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Xin Wang <x.wang@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [PATCH 2/4] tests/xe_pat: add prime-external-import-comp PAT test
Date: Wed, 7 Jan 2026 10:01:00 +0000	[thread overview]
Message-ID: <75c0e673-8285-4447-accf-b5b4f7c049dc@intel.com> (raw)
In-Reply-To: <20260107052406.21678-3-x.wang@intel.com>

On 07/01/2026 05:24, Xin Wang wrote:
> Add a xe_pat subtest that imports a vgem dma-buf into Xe and
> verifies that binding it with any compression-enabled PAT index
> is rejected with -EINVAL.
> 
> Also keep a WB sanity bind to ensure imports still work with
> non-compressed caching.
> 
> Cc: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Xin Wang <x.wang@intel.com>

Nit: I think commit title should usually have "intel" for intel specific 
tests. Ditto on the other patches.

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> ---
>   tests/intel/xe_pat.c | 74 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 74 insertions(+)
> 
> diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
> index 5ad4922dd..8af6ad174 100644
> --- a/tests/intel/xe_pat.c
> +++ b/tests/intel/xe_pat.c
> @@ -831,6 +831,77 @@ static void prime_external_import_coh(void)
>   	drm_close_driver(fd2);
>   }
>   
> +/**
> + * SUBTEST: prime-external-import-comp
> + * Test category: functionality test
> + * Description: Validate that imported dma-bufs cannot be bound with a PAT index
> + * that enables compression (expected to fail with -EINVAL).
> + */
> +static void prime_external_import_comp(void)
> +{
> +	uint16_t dev_id;
> +	struct intel_pat_cache pat_sw_config = {};
> +	int32_t parsed;
> +	struct vgem_bo vgem_bo = {};
> +	int fd_vgem, fd_xe;
> +	int dma_buf_fd;
> +	uint32_t handle_import;
> +	uint32_t vm;
> +	int bpp = 32;
> +	int size;
> +
> +	fd_vgem = drm_open_driver(DRIVER_VGEM);
> +	fd_xe = drm_open_driver(DRIVER_XE);
> +
> +	dev_id = intel_get_drm_devid(fd_xe);
> +	igt_require(intel_get_device_info(dev_id)->graphics_ver >= 20);
> +
> +	parsed = xe_fetch_pat_sw_config(fd_xe, &pat_sw_config);
> +
> +	vgem_bo.width = 1024;
> +	vgem_bo.height = 512;
> +	vgem_bo.bpp = bpp;
> +	vgem_create(fd_vgem, &vgem_bo);
> +
> +	size = vgem_bo.width * vgem_bo.height * bpp / 8;
> +
> +	dma_buf_fd = prime_handle_to_fd(fd_vgem, vgem_bo.handle);
> +	handle_import = prime_fd_to_handle(fd_xe, dma_buf_fd);
> +
> +	vm = xe_vm_create(fd_xe, 0, 0);
> +
> +	for (int i = 0; i < parsed; i++) {
> +		uint32_t pat;
> +		bool compressed;
> +		int ret;
> +
> +		if (pat_sw_config.entries[i].rsvd)
> +			continue;
> +		pat = pat_sw_config.entries[i].pat;
> +		compressed = !!(pat & XE2_COMP_EN);
> +		if (!compressed)
> +			continue;
> +		ret = __xe_vm_bind(fd_xe, vm, 0, handle_import, 0, 0x40000,
> +				   size, DRM_XE_VM_BIND_OP_MAP, 0, NULL, 0, 0,
> +				   i, 0);
> +		xe_vm_unbind_sync(fd_xe, vm, 0, 0x40000, size);
> +		igt_assert_eq(ret, -EINVAL);
> +	}
> +
> +	/* Sanity: non-compressed WB should still be accepted for imports. */
> +	igt_assert_eq(__xe_vm_bind(fd_xe, vm, 0, handle_import, 0, 0x40000,
> +			   size, DRM_XE_VM_BIND_OP_MAP, 0, NULL, 0, 0,
> +			   intel_get_pat_idx_wb(fd_xe), 0),
> +		      0);
> +	xe_vm_unbind_sync(fd_xe, vm, 0, 0x40000, size);
> +
> +	xe_vm_destroy(fd_xe, vm);
> +	close(dma_buf_fd);
> +
> +	drm_close_driver(fd_vgem);
> +	drm_close_driver(fd_xe);
> +}
> +
>   static bool has_no_compression_hint(int fd)
>   {
>   	struct drm_xe_query_config *config = xe_config(fd);
> @@ -1384,6 +1455,9 @@ int igt_main_args("V", NULL, help_str, opt_handler, NULL)
>   	igt_subtest("prime-external-import-coh")
>   		prime_external_import_coh();
>   
> +	igt_subtest("prime-external-import-comp")
> +		prime_external_import_comp();
> +
>   	igt_subtest("bo-comp-disable-bind")
>   		bo_comp_disable_bind(fd);
>   


  reply	other threads:[~2026-01-07 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  5:24 [PATCH 0/4] xe_pat: add compression subtests Xin Wang
2026-01-07  5:24 ` [PATCH 1/4] tests/xe_pat: add userptr-comp PAT test Xin Wang
2026-01-07  9:57   ` Matthew Auld
2026-01-07  5:24 ` [PATCH 2/4] tests/xe_pat: add prime-external-import-comp " Xin Wang
2026-01-07 10:01   ` Matthew Auld [this message]
2026-01-07  5:24 ` [PATCH 3/4] tests/xe_pat: add bo-wb-comp-1way-bind " Xin Wang
2026-01-07 10:17   ` Matthew Auld
2026-01-08  6:57     ` Wang, X
2026-01-07  5:24 ` [PATCH 4/4] intel-ci: add xe_pat compression subtests Xin Wang
2026-01-07  6:48 ` ✓ Xe.CI.BAT: success for xe_pat: add " Patchwork
2026-01-07  7:08 ` ✓ i915.CI.BAT: " Patchwork
2026-01-07  8:33 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-07  9:59 ` ✗ i915.CI.Full: " 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=75c0e673-8285-4447-accf-b5b4f7c049dc@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=x.wang@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