From 008ac818ba475780cd93328527d5b64652414180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 22 Oct 2024 09:21:25 -0700 Subject: [PATCH] intel/common: Retry GEM_CONTEXT_CREATE when PXP have not finished initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: José Roberto de Souza Part-of: --- src/intel/common/i915/intel_gem.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/intel/common/i915/intel_gem.c b/src/intel/common/i915/intel_gem.c index 037d7d8dd66..75c3cd5c6e4 100644 --- a/src/intel/common/i915/intel_gem.c +++ b/src/intel/common/i915/intel_gem.c @@ -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;