From 9a34afca0f56f3f05ab3d6d2f4a03e48459d515d 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: (cherry picked from commit 008ac818ba475780cd93328527d5b64652414180) --- .pick_status.json | 2 +- src/intel/common/i915/intel_gem.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9bd751a29b4..5aa160ffa77 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 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;