[PATCH i-g-t] tools/intel_dp_compliance: Enabling XE driver support
Almahallawy, Khaled
khaled.almahallawy at intel.com
Wed Jul 9 22:32:57 UTC 2025
Thank You for the patch
Tested using PHY CTS setup using MTL/i915 and PTL/XE and the flow is
still working.
Tested-by: Khaled Almahallawy <khaled.almahallawy at intel.com>
On Wed, 2025-07-09 at 10:37 +0530, Disantkumar Mistry wrote:
> i915 and XE driver has different api for mapping buffer. Enabling XE
> driver
> support by selecting XE driver specific map buffer api for XE
> devices.
>
> Signed-off-by: Disantkumar Mistry
> <disantkumar.isvarbhai.mistry at intel.com>
> ----
> v2:
> - Updated commit description
> ---
> tools/igt_dp_compliance.h | 1 +
> tools/intel_dp_compliance.c | 43 +++++++++++++++++++++++++----------
> --
> 2 files changed, 30 insertions(+), 14 deletions(-)
>
> diff --git a/tools/igt_dp_compliance.h b/tools/igt_dp_compliance.h
> index 226a13662871..b4357ca55733 100644
> --- a/tools/igt_dp_compliance.h
> +++ b/tools/igt_dp_compliance.h
> @@ -33,6 +33,7 @@
> #else
> #include <glib.h>
> #endif
> +#include <xe/xe_ioctl.h>
>
> extern int drm_fd;
>
> diff --git a/tools/intel_dp_compliance.c
> b/tools/intel_dp_compliance.c
> index 99196a450b45..2b2ffd402dc6 100644
> --- a/tools/intel_dp_compliance.c
> +++ b/tools/intel_dp_compliance.c
> @@ -349,7 +349,14 @@ static void dump_info(void)
> igt_dump_connectors_fd(drm_fd);
> igt_dump_crtcs_fd(drm_fd);
> }
> -
> +static void *map_buffer(int fd, uint32_t handle, size_t size)
> +{
> + if (is_xe_device(fd))
> + return xe_bo_mmap_ext(fd, handle, size, PROT_READ |
> PROT_WRITE);
> + else
> + return gem_mmap__device_coherent(fd, handle, 0,
> size,
> + PROT_READ | PROT_WRITE);
> +}
> static int setup_framebuffers(struct connector *dp_conn)
> {
>
> @@ -361,15 +368,19 @@ static int setup_framebuffers(struct connector
> *dp_conn)
> igt_assert(dp_conn->fb);
>
> /* Map the mapping of GEM object into the virtual address
> space */
> - dp_conn->pixmap = gem_mmap__device_coherent(drm_fd,
> +
> + dp_conn->pixmap = map_buffer(drm_fd,
> dp_conn-
> >fb_video_pattern.gem_handle,
> - 0, dp_conn-
> >fb_video_pattern.size,
> - PROT_READ | PROT_WRITE);
> + dp_conn-
> >fb_video_pattern.size);
> +
> if (dp_conn->pixmap == NULL)
> return -1;
>
> - gem_set_domain(drm_fd, dp_conn->fb_video_pattern.gem_handle,
> +
> + if (is_i915_device(drm_fd))
> + gem_set_domain(drm_fd, dp_conn-
> >fb_video_pattern.gem_handle,
> I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> +
> dp_conn->fb_size = dp_conn->fb_video_pattern.size;
>
> /* After filling the device memory with 0s it needs to be
> unmapped */
> @@ -391,15 +402,17 @@ static int setup_failsafe_framebuffer(struct
> connector *dp_conn)
> igt_assert(dp_conn->failsafe_fb);
>
> /* Map the mapping of GEM object into the virtual address
> space */
> - dp_conn->failsafe_pixmap = gem_mmap__device_coherent(drm_fd,
> + dp_conn->failsafe_pixmap = map_buffer(drm_fd,
> dp_conn-
> >fb_failsafe_pattern.gem_handle,
> - 0, dp_conn-
> >fb_failsafe_pattern.size,
> - PROT_READ |
> PROT_WRITE);
> + dp_conn-
> >fb_failsafe_pattern.size);
> +
> if (dp_conn->failsafe_pixmap == NULL)
> return -1;
>
> - gem_set_domain(drm_fd, dp_conn-
> >fb_failsafe_pattern.gem_handle,
> - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> +
> + if (is_i915_device(drm_fd))
> + gem_set_domain(drm_fd, dp_conn-
> >fb_failsafe_pattern.gem_handle,
> + I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> dp_conn->failsafe_size = dp_conn->fb_failsafe_pattern.size;
>
> /* After filling the device framebuffer the mapped memory
> needs to be freed */
> @@ -428,14 +441,16 @@ static int
> setup_video_pattern_framebuffer(struct connector *dp_conn)
> igt_assert(dp_conn->test_pattern.fb);
>
> /* Map the mapping of GEM object into the virtual address
> space */
> - dp_conn->test_pattern.pixmap =
> gem_mmap__device_coherent(drm_fd,
> +
> + dp_conn->test_pattern.pixmap = map_buffer(drm_fd,
> dp_conn-
> >test_pattern.fb_pattern.gem_handle,
> - 0, dp_conn-
> >test_pattern.fb_pattern.size,
> - PROT_READ |
> PROT_WRITE);
> + dp_conn-
> >test_pattern.fb_pattern.size);
> +
> if (dp_conn->test_pattern.pixmap == NULL)
> return -1;
>
> - gem_set_domain(drm_fd, dp_conn-
> >test_pattern.fb_pattern.gem_handle,
> + if (is_i915_device(drm_fd))
> + gem_set_domain(drm_fd, dp_conn-
> >test_pattern.fb_pattern.gem_handle,
> I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
>
> dp_conn->test_pattern.size = dp_conn-
> >test_pattern.fb_pattern.size;
More information about the igt-dev
mailing list