X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnv30%2Fnv30_miptree.c;h=d4dcacb85069fe14d6d9b084d6510ea8736e830a;hb=f04dd3d0035f57854f0715c7e0f6a0fbe6b41f15;hp=79034ac7daef3cc975dd94b2894d3bd752a76260;hpb=ced065a0797d9504950b7763cd90244ca478a723;p=mesa.git diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 79034ac7dae..d4dcacb8506 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -56,8 +56,7 @@ nv30_miptree_get_handle(struct pipe_screen *pscreen, if (!mt || !mt->base.bo) return FALSE; - stride = util_format_get_stride(mt->base.base.format, - mt->base.base.width0); + stride = mt->level[0].pitch; return nouveau_screen_bo_get_handle(pscreen, mt->base.bo, stride, handle); } @@ -148,6 +147,7 @@ void nv30_resource_resolve(struct pipe_context *pipe, const struct pipe_resolve_info *info) { +#if 0 struct nv30_context *nv30 = nv30_context(pipe); struct nv30_rect src, dst; @@ -157,6 +157,7 @@ nv30_resource_resolve(struct pipe_context *pipe, info->dst.x1 - info->dst.x0, info->dst.y1 - info->dst.y0, &dst); nv30_transfer_rect(nv30, BILINEAR, &src, &dst); +#endif } void @@ -192,9 +193,7 @@ nv30_blit(struct pipe_context *pipe, /* XXX turn off occlusion queries */ - util_blitter_save_vertex_buffers(nv30->blitter, - nv30->num_vtxbufs, - nv30->vtxbuf); + util_blitter_save_vertex_buffer_slot(nv30->blitter, nv30->vtxbuf); util_blitter_save_vertex_elements(nv30->blitter, nv30->vertex); util_blitter_save_vertex_shader(nv30->blitter, nv30->vertprog.program); util_blitter_save_rasterizer(nv30->blitter, nv30->rast); @@ -217,14 +216,16 @@ nv30_blit(struct pipe_context *pipe, util_blitter_blit(nv30->blitter, &info); } -static struct pipe_transfer * -nv30_miptree_transfer_new(struct pipe_context *pipe, struct pipe_resource *pt, +static void * +nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_resource *pt, unsigned level, unsigned usage, - const struct pipe_box *box) + const struct pipe_box *box, + struct pipe_transfer **ptransfer) { struct nv30_context *nv30 = nv30_context(pipe); struct nouveau_device *dev = nv30->screen->base.device; struct nv30_transfer *tx; + unsigned access = 0; int ret; tx = CALLOC_STRUCT(nv30_transfer); @@ -269,42 +270,24 @@ nv30_miptree_transfer_new(struct pipe_context *pipe, struct pipe_resource *pt, if (usage & PIPE_TRANSFER_READ) nv30_transfer_rect(nv30, NEAREST, &tx->img, &tx->tmp); - return &tx->base; -} - -static void -nv30_miptree_transfer_del(struct pipe_context *pipe, struct pipe_transfer *ptx) -{ - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_transfer *tx = nv30_transfer(ptx); - - if (ptx->usage & PIPE_TRANSFER_WRITE) - nv30_transfer_rect(nv30, NEAREST, &tx->tmp, &tx->img); - - nouveau_bo_ref(NULL, &tx->tmp.bo); - pipe_resource_reference(&ptx->resource, NULL); - FREE(tx); -} - -static void * -nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx) -{ - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_transfer *tx = nv30_transfer(ptx); - unsigned access = 0; - int ret; - - if (tx->tmp.bo->map) + if (tx->tmp.bo->map) { + *ptransfer = &tx->base; return tx->tmp.bo->map; + } - if (ptx->usage & PIPE_TRANSFER_READ) + if (usage & PIPE_TRANSFER_READ) access |= NOUVEAU_BO_RD; - if (ptx->usage & PIPE_TRANSFER_WRITE) + if (usage & PIPE_TRANSFER_WRITE) access |= NOUVEAU_BO_WR; ret = nouveau_bo_map(tx->tmp.bo, access, nv30->base.client); - if (ret) + if (ret) { + pipe_resource_reference(&tx->base.resource, NULL); + FREE(tx); return NULL; + } + + *ptransfer = &tx->base; return tx->tmp.bo->map; } @@ -312,13 +295,20 @@ static void nv30_miptree_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx) { + struct nv30_context *nv30 = nv30_context(pipe); + struct nv30_transfer *tx = nv30_transfer(ptx); + + if (ptx->usage & PIPE_TRANSFER_WRITE) + nv30_transfer_rect(nv30, NEAREST, &tx->tmp, &tx->img); + + nouveau_bo_ref(NULL, &tx->tmp.bo); + pipe_resource_reference(&ptx->resource, NULL); + FREE(tx); } const struct u_resource_vtbl nv30_miptree_vtbl = { nv30_miptree_get_handle, nv30_miptree_destroy, - nv30_miptree_transfer_new, - nv30_miptree_transfer_del, nv30_miptree_transfer_map, u_default_transfer_flush_region, nv30_miptree_transfer_unmap, @@ -470,7 +460,6 @@ nv30_miptree_surface_new(struct pipe_context *pipe, pipe_resource_reference(&ps->texture, pt); ps->context = pipe; ps->format = tmpl->format; - ps->usage = tmpl->usage; ps->u.tex.level = tmpl->u.tex.level; ps->u.tex.first_layer = tmpl->u.tex.first_layer; ps->u.tex.last_layer = tmpl->u.tex.last_layer;