summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>2025-07-11 17:01:49 +0100
committerLucas De Marchi <lucas.demarchi@intel.com>2025-07-14 08:06:14 -0700
commit5ce511ad2b1e2c449e26dba11ac5027c1a142e19 (patch)
tree74ff4099c337e19584607f8f1a33c0bb1272e260
parent1ec31d355c2d225f50dfb70dcaab07bf3afee0ed (diff)
drm/xe: Track number of written dwords from workaround batch buffer emission
Indirect context setup will need to get to the number of written dwords. Lets add it as an output parameter so it can be accessed from the finish helper regardless of whether code is writing directly or via an shadow buffer. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20250711160153.49833-5-tvrtko.ursulin@igalia.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
-rw-r--r--drivers/gpu/drm/xe/xe_lrc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index bd5dde28fa4b..16921605fa6d 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -991,6 +991,7 @@ struct bo_setup_state {
/* State: */
u32 *buffer;
u32 *ptr;
+ unsigned int written;
};
static int setup_bo(struct bo_setup_state *state)
@@ -1023,6 +1024,7 @@ static int setup_bo(struct bo_setup_state *state)
goto fail;
state->ptr += len;
+ state->written += len;
}
return 0;
@@ -1039,7 +1041,7 @@ static void finish_bo(struct bo_setup_state *state)
xe_map_memcpy_to(gt_to_xe(state->lrc->gt), &state->lrc->bo->vmap,
state->offset, state->buffer,
- (state->ptr - state->buffer) * sizeof(u32));
+ state->written * sizeof(u32));
kfree(state->buffer);
}
@@ -1063,6 +1065,7 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
return ret;
*state.ptr++ = MI_BATCH_BUFFER_END;
+ state.written++;
finish_bo(&state);