turnip: Fix unitialized cs->device

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12856>
This commit is contained in:
Rob Clark 2021-09-14 11:16:59 -07:00 committed by Marge Bot
parent 68d4d09b56
commit 6ac1d8dc4c
2 changed files with 7 additions and 4 deletions

View File

@ -45,10 +45,12 @@ tu_cs_init(struct tu_cs *cs,
* Initialize a command stream as a wrapper to an external buffer.
*/
void
tu_cs_init_external(struct tu_cs *cs, uint32_t *start, uint32_t *end)
tu_cs_init_external(struct tu_cs *cs, struct tu_device *device,
uint32_t *start, uint32_t *end)
{
memset(cs, 0, sizeof(*cs));
cs->device = device;
cs->mode = TU_CS_MODE_EXTERNAL;
cs->start = cs->reserved_end = cs->cur = start;
cs->end = end;
@ -252,7 +254,7 @@ tu_cs_begin_sub_stream(struct tu_cs *cs, uint32_t size, struct tu_cs *sub_cs)
if (result != VK_SUCCESS)
return result;
tu_cs_init_external(sub_cs, cs->cur, cs->reserved_end);
tu_cs_init_external(sub_cs, cs->device, cs->cur, cs->reserved_end);
tu_cs_begin(sub_cs);
result = tu_cs_reserve_space(sub_cs, size);
assert(result == VK_SUCCESS);

View File

@ -36,7 +36,8 @@ tu_cs_init(struct tu_cs *cs,
uint32_t initial_size);
void
tu_cs_init_external(struct tu_cs *cs, uint32_t *start, uint32_t *end);
tu_cs_init_external(struct tu_cs *cs, struct tu_device *device,
uint32_t *start, uint32_t *end);
void
tu_cs_finish(struct tu_cs *cs);
@ -79,7 +80,7 @@ tu_cs_draw_state(struct tu_cs *sub_cs, struct tu_cs *cs, uint32_t size)
/* TODO: clean this up */
tu_cs_alloc(sub_cs, size, 1, &memory);
tu_cs_init_external(cs, memory.map, memory.map + size);
tu_cs_init_external(cs, sub_cs->device, memory.map, memory.map + size);
tu_cs_begin(cs);
tu_cs_reserve_space(cs, size);