[PATCH i-g-t] tools/intel_dp_compliance: Enabling XE driver support
Kamil Konieczny
kamil.konieczny at linux.intel.com
Thu Jul 10 11:25:46 UTC 2025
Hi Disantkumar,
On 2025-07-09 at 10:37:44 +0530, Disantkumar Mistry wrote:
> i915 and XE driver has different api for mapping buffer. Enabling XE driver
s/driver has/drivers have/
> 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>
This is igt lib so here:
#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);
> }
> -
Keep this empty line.
> +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);
Align or use one-liner code.
> +}
Add newline here.
> 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);
> +
While you changing this, align it. Use checkpatch.pl with options
from CONTRIBUTING.md
> 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);
Align.
> +
> 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,
Align.
> - 0, dp_conn->fb_failsafe_pattern.size,
> - PROT_READ | PROT_WRITE);
> + dp_conn->fb_failsafe_pattern.size);
Align.
> +
> 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);
Align and add newline.
> 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,
Align.
> - 0, dp_conn->test_pattern.fb_pattern.size,
> - PROT_READ | PROT_WRITE);
> + dp_conn->test_pattern.fb_pattern.size);
Align.
> +
> 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);
Align.
Regards,
Kamil
>
> dp_conn->test_pattern.size = dp_conn->test_pattern.fb_pattern.size;
> --
> 2.49.0
>
More information about the igt-dev
mailing list