X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnouveau%2Fnv50%2Fnv50_transfer.c;h=86a8c15946989355ef174c5b026f624c5303599b;hb=89e421369c54a8edc4930352e062f03b5c66b886;hp=f71605281b633c13e14e6579514f797ee8532b41;hpb=882070cc81588a133d81e3ef8790d7375f494eff;p=mesa.git diff --git a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c index f71605281b6..86a8c159469 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c @@ -3,7 +3,7 @@ #include "nv50/nv50_context.h" -#include "nv50/nv50_defs.xml.h" +#include "nv50/g80_defs.xml.h" struct nv50_transfer { struct pipe_transfer base; @@ -24,6 +24,8 @@ nv50_m2mf_rect_setup(struct nv50_m2mf_rect *rect, rect->bo = mt->base.bo; rect->domain = mt->base.domain; rect->base = mt->level[l].offset; + if (mt->base.bo->offset != mt->base.address) + rect->base += mt->base.address - mt->base.bo->offset; rect->pitch = mt->level[l].pitch; if (util_format_is_plain(res->format)) { rect->width = w << mt->ms_x; @@ -161,7 +163,7 @@ nv50_sifc_linear_u8(struct nouveau_context *nv, offset &= ~0xff; BEGIN_NV04(push, NV50_2D(DST_FORMAT), 2); - PUSH_DATA (push, NV50_SURFACE_FORMAT_R8_UNORM); + PUSH_DATA (push, G80_SURFACE_FORMAT_R8_UNORM); PUSH_DATA (push, 1); BEGIN_NV04(push, NV50_2D(DST_PITCH), 5); PUSH_DATA (push, 262144); @@ -171,7 +173,7 @@ nv50_sifc_linear_u8(struct nouveau_context *nv, PUSH_DATA (push, dst->offset + offset); BEGIN_NV04(push, NV50_2D(SIFC_BITMAP_ENABLE), 2); PUSH_DATA (push, 0); - PUSH_DATA (push, NV50_SURFACE_FORMAT_R8_UNORM); + PUSH_DATA (push, G80_SURFACE_FORMAT_R8_UNORM); BEGIN_NV04(push, NV50_2D(SIFC_WIDTH), 10); PUSH_DATA (push, size); PUSH_DATA (push, 1); @@ -185,14 +187,7 @@ nv50_sifc_linear_u8(struct nouveau_context *nv, PUSH_DATA (push, 0); while (count) { - unsigned nr; - - if (!PUSH_SPACE(push, 16)) - break; - nr = PUSH_AVAIL(push); - assert(nr >= 16); - nr = MIN2(count, nr - 1); - nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN); + unsigned nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN); BEGIN_NI04(push, NV50_2D(SIFC_DATA), nr); PUSH_DATAp(push, src, nr); @@ -363,9 +358,14 @@ nv50_miptree_transfer_unmap(struct pipe_context *pctx, tx->rect[0].base += mt->layer_stride; tx->rect[1].base += tx->nblocksy * tx->base.stride; } + + /* Allow the copies above to finish executing before freeing the source */ + nouveau_fence_work(nv50->screen->base.fence.current, + nouveau_fence_unref_bo, tx->rect[1].bo); + } else { + nouveau_bo_ref(NULL, &tx->rect[1].bo); } - nouveau_bo_ref(NULL, &tx->rect[1].bo); pipe_resource_reference(&transfer->resource, NULL); FREE(tx); @@ -388,12 +388,9 @@ nv50_cb_push(struct nouveau_context *nv, nouveau_pushbuf_validate(push); while (words) { - unsigned nr; - - nr = PUSH_AVAIL(push); - nr = MIN2(nr - 7, words); - nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN - 1); + unsigned nr = MIN2(words, NV04_PFIFO_MAX_PACKET_LEN); + PUSH_SPACE(push, nr + 7); BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3); PUSH_DATAh(push, bo->offset + base); PUSH_DATA (push, bo->offset + base);