intel/common: Retry GEM_CONTEXT_CREATE when PXP have not finished initialization

If PXP initialization is not completed and application requested a
protected context the GEM_CONTEXT_CREATE will wait up to 250ms for
PXP to finish initialization but if that do not happens it will
return a error and set errno to EIO.
This patch add the missing retry handling.

Cc: mesa-stable
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>
(cherry picked from commit 008ac818ba)
This commit is contained in:
José Roberto de Souza 2024-10-22 09:21:25 -07:00 committed by Eric Engestrom
parent aff18d4898
commit 9a34afca0f
2 changed files with 12 additions and 2 deletions

View file

@ -4144,7 +4144,7 @@
"description": "intel/common: Retry GEM_CONTEXT_CREATE when PXP have not finished initialization",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -176,7 +176,17 @@ i915_gem_create_context_engines(int fd,
&low_latency_param.base);
}
if (intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, &create) == -1)
int ret;
bool retry;
do {
ret = intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, &create);
retry = ret == -1 && errno == EIO &&
(flags & INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG);
if (retry)
usleep(1000);
} while (retry);
if (ret)
return false;
*context_id = create.ctx_id;