[PATCH 10/15] drm/xe/display: Convert __xe_pin_fb_vma()
Matthew Brost
matthew.brost at intel.com
Thu Aug 14 02:35:18 UTC 2025
On Wed, Aug 13, 2025 at 12:51:16PM +0200, Thomas Hellström wrote:
> Convert __xe_pin_fb_vma() for exhaustive eviction
> using xe_validation_guard().
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
I'll leave the to someone who works in display, but patch looks correct
to me.
Matt
> ---
> drivers/gpu/drm/xe/display/xe_fb_pin.c | 27 +++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> index 4b0748e6fdd6..43c45344ea26 100644
> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> @@ -281,7 +281,8 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
> struct i915_vma *vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> struct drm_gem_object *obj = intel_fb_bo(&fb->base);
> struct xe_bo *bo = gem_to_xe_bo(obj);
> - struct drm_exec *exec = XE_VALIDATION_UNIMPLEMENTED;
> + struct xe_validation_ctx ctx;
> + struct drm_exec exec;
> int ret;
>
> if (!vma)
> @@ -309,17 +310,21 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
> * Pin the framebuffer, we can't use xe_bo_(un)pin functions as the
> * assumptions are incorrect for framebuffers
> */
> - ret = ttm_bo_reserve(&bo->ttm, false, false, NULL);
> - if (ret)
> - goto err;
> + xe_validation_guard(&ctx, &xe->val, &exec, 0, ret, false) {
> + ret = drm_exec_lock_obj(&exec, &bo->ttm.base);
> + drm_exec_retry_on_contention(&exec);
> + if (ret)
> + goto err;
>
> - if (IS_DGFX(xe))
> - ret = xe_bo_migrate(bo, XE_PL_VRAM0, exec);
> - else
> - ret = xe_bo_validate(bo, NULL, true, exec);
> - if (!ret)
> - ttm_bo_pin(&bo->ttm);
> - ttm_bo_unreserve(&bo->ttm);
> + if (IS_DGFX(xe))
> + ret = xe_bo_migrate(bo, XE_PL_VRAM0, &exec);
> + else
> + ret = xe_bo_validate(bo, NULL, true, &exec);
> + drm_exec_retry_on_contention(&exec);
> + xe_validation_retry_on_oom(&ctx, &ret);
> + if (!ret)
> + ttm_bo_pin(&bo->ttm);
> + }
> if (ret)
> goto err;
>
> --
> 2.50.1
>
More information about the Intel-xe
mailing list