[igt-dev] [PATCH i-g-t 04/17] Add basic PXP testing of buffer and context alloc

Petri Latvala petri.latvala at intel.com
Mon May 17 10:26:34 UTC 2021


On Sat, May 15, 2021 at 04:01:29PM -0700, Alan Previn wrote:
> Test PXP capability support as well as the allocation of protected
> buffers and protected contexts.
> 
> Signed-off-by: Alan Previn <alan.previn.teres.alexis at intel.com>
> ---
>  tests/i915/gem_pxp.c | 381 +++++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build    |   1 +
>  2 files changed, 382 insertions(+)
>  create mode 100644 tests/i915/gem_pxp.c
> 
> diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
> new file mode 100644
> index 00000000..be7b2749
> --- /dev/null
> +++ b/tests/i915/gem_pxp.c
> @@ -0,0 +1,381 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2021 Intel Corporation
> + */
> +
> +#include <sys/ioctl.h>
> +
> +#include "igt.h"
> +#include "i915/gem.h"
> +
> +IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
> +/* Note: PXP = "Protected Xe Path" */
> +
> +static bool is_pxp_hw_supported(int i915)
> +{
> +	uint32_t devid = intel_get_drm_devid(i915);
> +
> +	if (IS_TIGERLAKE(devid) || IS_ROCKETLAKE(devid) || IS_ALDERLAKE_S(devid))
> +		return true;
> +
> +	return false;
> +}
> +
> +static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
> +{
> +	int ret;
> +
> +	struct drm_i915_gem_create_ext_protected_content protected_ext = {
> +		.base = { .name = I915_GEM_CREATE_EXT_PROTECTED_CONTENT },
> +		.flags = 0,
> +	};
> +
> +	struct drm_i915_gem_create_ext create_ext = {
> +		.size = size,
> +		.extensions = 0,
> +	};
> +
> +	if (protected_is_true)
> +		create_ext.extensions = (uintptr_t)&protected_ext;
> +
> +	ret = ioctl(i915, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);


Why the naked ioctl on a DRM ioctl instead of the many wrappers we
have in lib? (do_ioctl, do_ioctl_err, igt_ioctl, ...)


-- 
Petri Latvala


More information about the igt-dev mailing list