Skip to content

Commit

Permalink
drm/i915/uapi: tweak error capture on recoverable contexts
Browse files Browse the repository at this point in the history
A non-recoverable context must be used if the user wants proper error
capture on discrete platforms. In the future the kernel may want to blit
the contents of some objects when later doing the capture stage. Also
extend to newer integrated platforms.

v2(Thomas):
  - Also extend to newer integrated platforms, for capture buffer memory
    allocation purposes.
v3 (Reported-by: kernel test robot <[email protected]>):
  - Fix build on !CONFIG_DRM_I915_CAPTURE_ERROR

Testcase: igt@gem_exec_capture@capture-recoverable
Signed-off-by: Matthew Auld <[email protected]>
Cc: Thomas Hellström <[email protected]>
Cc: Lionel Landwerlin <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Jordan Justen <[email protected]>
Cc: Kenneth Graunke <[email protected]>
Cc: Akeem G Abodunrin <[email protected]>
Reviewed-by: Thomas Hellström <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
matt-auld committed Jul 1, 2022
1 parent d42a738 commit 71b1669
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ eb_find_first_request_added(struct i915_execbuffer *eb)
#if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)

/* Stage with GFP_KERNEL allocations before we enter the signaling critical path */
static void eb_capture_stage(struct i915_execbuffer *eb)
static int eb_capture_stage(struct i915_execbuffer *eb)
{
const unsigned int count = eb->buffer_count;
unsigned int i = count, j;
Expand All @@ -1964,6 +1964,10 @@ static void eb_capture_stage(struct i915_execbuffer *eb)
if (!(flags & EXEC_OBJECT_CAPTURE))
continue;

if (i915_gem_context_is_recoverable(eb->gem_context) &&
(IS_DGFX(eb->i915) || GRAPHICS_VER_FULL(eb->i915) > IP_VER(12, 0)))
return -EINVAL;

for_each_batch_create_order(eb, j) {
struct i915_capture_list *capture;

Expand All @@ -1976,6 +1980,8 @@ static void eb_capture_stage(struct i915_execbuffer *eb)
eb->capture_lists[j] = capture;
}
}

return 0;
}

/* Commit once we're in the critical path */
Expand Down Expand Up @@ -2017,8 +2023,9 @@ static void eb_capture_list_clear(struct i915_execbuffer *eb)

#else

static void eb_capture_stage(struct i915_execbuffer *eb)
static int eb_capture_stage(struct i915_execbuffer *eb)
{
return 0;
}

static void eb_capture_commit(struct i915_execbuffer *eb)
Expand Down Expand Up @@ -3410,7 +3417,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
}

ww_acquire_done(&eb.ww.ctx);
eb_capture_stage(&eb);
err = eb_capture_stage(&eb);
if (err)
goto err_vma;

out_fence = eb_requests_create(&eb, in_fence, out_fence_fd);
if (IS_ERR(out_fence)) {
Expand Down

0 comments on commit 71b1669

Please sign in to comment.