Skip to content

Commit 5ce511a

Browse files
Tvrtko Ursulinlucasdemarchi
authored andcommitted
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 <[email protected]> Cc: Lucas De Marchi <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 1ec31d3 commit 5ce511a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,7 @@ struct bo_setup_state {
991991
/* State: */
992992
u32 *buffer;
993993
u32 *ptr;
994+
unsigned int written;
994995
};
995996

996997
static int setup_bo(struct bo_setup_state *state)
@@ -1023,6 +1024,7 @@ static int setup_bo(struct bo_setup_state *state)
10231024
goto fail;
10241025

10251026
state->ptr += len;
1027+
state->written += len;
10261028
}
10271029

10281030
return 0;
@@ -1039,7 +1041,7 @@ static void finish_bo(struct bo_setup_state *state)
10391041

10401042
xe_map_memcpy_to(gt_to_xe(state->lrc->gt), &state->lrc->bo->vmap,
10411043
state->offset, state->buffer,
1042-
(state->ptr - state->buffer) * sizeof(u32));
1044+
state->written * sizeof(u32));
10431045
kfree(state->buffer);
10441046
}
10451047

@@ -1063,6 +1065,7 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
10631065
return ret;
10641066

10651067
*state.ptr++ = MI_BATCH_BUFFER_END;
1068+
state.written++;
10661069

10671070
finish_bo(&state);
10681071

0 commit comments

Comments
 (0)