intel: Add function to check if PXP is supported in Xe KMD

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30723>
This commit is contained in:
José Roberto de Souza 2024-07-15 11:49:29 -07:00 committed by Marge Bot
parent 63861472ff
commit a13a6656dd
3 changed files with 22 additions and 2 deletions

View file

@ -155,8 +155,7 @@ intel_gem_supports_protected_context(int fd, enum intel_kmd_type kmd_type)
case INTEL_KMD_TYPE_I915:
return i915_gem_supports_protected_context(fd);
case INTEL_KMD_TYPE_XE:
/* TODO: so far Xe don't have support for protected contexts/engines */
return false;
return xe_gem_supports_protected_exec_queue(fd);
default:
unreachable("Missing");
return false;

View file

@ -27,6 +27,9 @@
#include "common/intel_gem.h"
#include "common/xe/intel_engine.h"
#include "util/os_time.h"
#include "util/timespec.h"
bool
xe_gem_read_render_timestamp(int fd, uint64_t *value)
{
@ -103,3 +106,20 @@ intel_xe_gem_add_ext(uint64_t *ptr, uint32_t ext_name, void *data)
ext->name = ext_name;
*ptr = (uintptr_t)ext;
}
bool
xe_gem_supports_protected_exec_queue(int fd)
{
struct drm_xe_query_pxp_status pxp_status = {};
struct drm_xe_device_query query = {
.query = DRM_XE_DEVICE_QUERY_PXP_STATUS,
.size = sizeof(pxp_status),
.data = (uintptr_t)&pxp_status,
};
/* returning as supported even when PXP is still in progress.
* exec_queue_create with PXP set will return EBUSY until PXP
* initialization is completed
*/
return intel_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query) == 0;
}

View file

@ -39,5 +39,6 @@ xe_gem_read_correlate_cpu_gpu_timestamp(int fd,
uint64_t *gpu_timestamp,
uint64_t *cpu_delta);
bool xe_gem_can_render_on_fd(int fd);
bool xe_gem_supports_protected_exec_queue(int fd);
void intel_xe_gem_add_ext(uint64_t *ptr, uint32_t ext_name, void *data);