From ccd670cc2fc4853904c0714fd7ea52cfc8f931bb Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:58 -0600 Subject: [PATCH] nouveau: Rename the fields of vk_push Part-of: --- src/nouveau/winsys/nouveau_push.c | 32 +++++++++++----------- src/nouveau/winsys/nouveau_push.h | 56 +++++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/nouveau/winsys/nouveau_push.c b/src/nouveau/winsys/nouveau_push.c index dccf672..4475026 100644 --- a/src/nouveau/winsys/nouveau_push.c +++ b/src/nouveau/winsys/nouveau_push.c @@ -76,7 +76,7 @@ void nouveau_ws_push_destroy(struct nouveau_ws_push *push) { util_dynarray_foreach(&push->pushs, struct nouveau_ws_push_buffer, buf) { - nouveau_ws_bo_unmap(buf->bo, buf->push.orig_map); + nouveau_ws_bo_unmap(buf->bo, buf->push.start); nouveau_ws_bo_destroy(buf->bo); } @@ -93,8 +93,8 @@ nouveau_ws_push_space(struct nouveau_ws_push *push, if (!count) return &buf->push; - if (buf->push.map + count < buf->push.orig_map + (buf->bo->size / 4)) { - buf->push.end = buf->push.map + count; + if (buf->push.end + count < buf->push.start + (buf->bo->size / 4)) { + buf->push.limit = buf->push.end + count; return &buf->push; } @@ -140,8 +140,8 @@ nouveau_ws_push_append(struct nouveau_ws_push *push, /* We don't support BO refs for now */ assert(other->bos.size == 0); - memcpy(p->map, other_buf->push.orig_map, count * sizeof(*p->map)); - p->map += count; + memcpy(p->end, other_buf->push.start, count * sizeof(*p->end)); + p->end += count; p->last_size = NULL; return 0; @@ -152,16 +152,16 @@ nouveau_ws_push_valid(struct nouveau_ws_push *push) { util_dynarray_foreach(&push->pushs, struct nouveau_ws_push_buffer, buf) { struct nouveau_ws_push_buffer *buf = _nouveau_ws_push_top(push); - uint32_t *cur = buf->push.orig_map; + uint32_t *cur = buf->push.start; /* submitting empty push buffers is probably a bug */ - assert(buf->push.map != buf->push.orig_map); + assert(buf->push.end != buf->push.start); /* make sure we don't overrun the bo */ - assert(buf->push.map <= buf->push.end); + assert(buf->push.end <= buf->push.limit); /* parse all the headers to see if we get to buf->map */ - while (cur < buf->push.map) { + while (cur < buf->push.end) { uint32_t hdr = *cur; uint32_t mthd = hdr >> 29; @@ -182,7 +182,7 @@ nouveau_ws_push_valid(struct nouveau_ws_push *push) { } cur++; - assert(cur <= buf->push.map); + assert(cur <= buf->push.end); } } } @@ -191,9 +191,9 @@ static void nouveau_ws_push_dump(struct nouveau_ws_push *push, struct nouveau_ws_context *ctx) { util_dynarray_foreach(&push->pushs, struct nouveau_ws_push_buffer, buf) { - uint32_t *cur = buf->push.orig_map; + uint32_t *cur = buf->push.start; - while (cur < buf->push.map) { + while (cur < buf->push.end) { uint32_t hdr = *cur; uint32_t type = hdr >> 29; uint32_t inc; @@ -203,7 +203,7 @@ nouveau_ws_push_dump(struct nouveau_ws_push *push, struct nouveau_ws_context *ct uint32_t value = 0; bool is_immd = false; - printf("[0x%08" PRIxPTR "] HDR %x subch %i", cur - buf->push.orig_map, hdr, subchan); + printf("[0x%08" PRIxPTR "] HDR %x subch %i", cur - buf->push.start, hdr, subchan); cur++; switch (type) { @@ -340,7 +340,7 @@ nouveau_ws_push_submit( /* Can't submit a CPU push */ assert(buf->bo); - if (buf->push.map == buf->push.orig_map) + if (buf->push.end == buf->push.start) continue; req_bo[i].handle = buf->bo->handle; @@ -434,12 +434,12 @@ void nouveau_ws_push_reset(struct nouveau_ws_push *push) bool first = true; util_dynarray_foreach(&push->pushs, struct nouveau_ws_push_buffer, buf) { if (first) { - buf->push.map = buf->push.orig_map; + buf->push.end = buf->push.start; first = false; continue; } - nouveau_ws_bo_unmap(buf->bo, buf->push.orig_map); + nouveau_ws_bo_unmap(buf->bo, buf->push.start); nouveau_ws_bo_destroy(buf->bo); } diff --git a/src/nouveau/winsys/nouveau_push.h b/src/nouveau/winsys/nouveau_push.h index fc4bbcb..bf7e93b 100644 --- a/src/nouveau/winsys/nouveau_push.h +++ b/src/nouveau/winsys/nouveau_push.h @@ -19,27 +19,27 @@ struct nouveau_ws_push_bo { }; struct nv_push { - uint32_t *orig_map; - uint32_t *map; + uint32_t *start; uint32_t *end; + uint32_t *limit; uint32_t *last_size; }; static inline void nv_push_init(struct nv_push *push, uint32_t *start, size_t dw_count) { - push->orig_map = start; - push->map = start; - push->end = start + dw_count; + push->start = start; + push->end = start; + push->limit = start + dw_count; push->last_size = NULL; } static inline size_t nv_push_dw_count(struct nv_push *push) { - assert(push->orig_map <= push->map); - assert(push->map <= push->end); - return push->map - push->orig_map; + assert(push->start <= push->end); + assert(push->end <= push->limit); + return push->end - push->start; } struct nouveau_ws_push_buffer { @@ -123,9 +123,9 @@ __push_mthd_size(struct nv_push *push, int subc, uint32_t mthd, unsigned size) { __push_verify(push); - push->last_size = push->map; - *push->map = NVC0_FIFO_PKHDR_SQ(subc, mthd, size); - push->map++; + push->last_size = push->end; + *push->end = NVC0_FIFO_PKHDR_SQ(subc, mthd, size); + push->end++; } static inline void @@ -147,9 +147,9 @@ static inline void __push_immd(struct nv_push *push, int subc, uint32_t mthd, uint32_t val) { __push_verify(push); - push->last_size = push->map; - *push->map = NVC0_FIFO_PKHDR_IL(subc, mthd, val); - push->map++; + push->last_size = push->end; + *push->end = NVC0_FIFO_PKHDR_IL(subc, mthd, val); + push->end++; } #define P_IMMD(push, class, mthd, args...) do { \ @@ -173,9 +173,9 @@ static inline void __push_1inc(struct nv_push *push, int subc, uint32_t mthd) { __push_verify(push); - push->last_size = push->map; - *push->map = NVC0_FIFO_PKHDR_1I(subc, mthd, 0); - push->map++; + push->last_size = push->end; + *push->end = NVC0_FIFO_PKHDR_1I(subc, mthd, 0); + push->end++; } #define P_1INC(push, class, mthd) __push_1inc(push, SUBC_##class, class##_##mthd) @@ -190,9 +190,9 @@ static inline void __push_0inc(struct nv_push *push, int subc, uint32_t mthd) { __push_verify(push); - push->last_size = push->map; - *push->map = NVC0_FIFO_PKHDR_0I(subc, mthd, 0); - push->map++; + push->last_size = push->end; + *push->end = NVC0_FIFO_PKHDR_0I(subc, mthd, 0); + push->end++; } #define P_0INC(push, class, mthd) __push_0inc(push, SUBC_##class, class##_##mthd) @@ -225,8 +225,8 @@ P_INLINE_DATA(struct nv_push *push, uint32_t value) { if (nvk_push_update_count(push, 1)) { /* push new value */ - *push->map = value; - push->map++; + *push->end = value; + push->end++; } } @@ -235,8 +235,8 @@ P_INLINE_FLOAT(struct nv_push *push, float value) { if (nvk_push_update_count(push, 1)) { /* push new value */ - *(float *)push->map = value; - push->map++; + *(float *)push->end = value; + push->end++; } } @@ -245,8 +245,8 @@ P_INLINE_ARRAY(struct nv_push *push, const uint32_t *data, int num_dw) { if (nvk_push_update_count(push, num_dw)) { /* push new value */ - memcpy(push->map, data, num_dw * 4); - push->map += num_dw; + memcpy(push->end, data, num_dw * 4); + push->end += num_dw; } } @@ -260,7 +260,7 @@ nvk_push_val(struct nv_push *push, uint32_t idx, uint32_t val) UNUSED bool is_immd = (last_hdr_val & 0xe0000000) == 0x80000000; UNUSED uint16_t last_method = (last_hdr_val & 0x1fff) << 2; - uint16_t distance = push->map - push->last_size - 1; + uint16_t distance = push->end - push->last_size - 1; if (is_0inc) distance = 0; else if (is_1inc) @@ -271,7 +271,7 @@ nvk_push_val(struct nv_push *push, uint32_t idx, uint32_t val) assert(last_hdr_val); assert(!is_immd); assert(last_method == idx); - assert(push->map < push->end); + assert(push->end < push->limit); P_INLINE_DATA(push, val); } -- 2.7.4