nv04-nv40: Rewrite and unify miptree and transfer code
PATCH 1/1 nv04-nv40: Rewrite and unify miptree and transfer code
This patch rewrites all the miptree layout and transfer code in the pre-NV50 Gallium drivers.
The code is also unified among them and put in the nv04 directory.
The current code is broken in several ways:
1. 3D textures are laid out first by face, then by level, which is incorrect
2. Cube maps should have 128-byte aligned faces
3. Swizzled textures have a strange alignment test that seems unnecessary
4. We store the image_offsets for each face/slice but they can be easily computed instead
5. "Swizzling" is not supported for compressed formats. They can be "swizzled" but swizzling only means that there are no gaps (pitch is level-dependant) and the layout is still linear
6. Swizzling is not supported for non-RGBA formats. All formats (except possibly depth) can be swizzled according to my testing.
The miptree layout is rewritten based on my empirical testing, which I posted in the "miptree finding" mail.
The image_offset array is removed, since it can be calculated with a simple multiplication; the only array in the miptree structure is now the one for mipmap level starts, which it seems cannot be easily computed in constant time.
Also, we now directly store a nouveau_bo instead of a pipe_buffer in the miptree structure, like nv50 does.
All the deletions are due to the nv04-nv40 unification.
Support for render temporaries is removed, and will be readded in a later patch.
Note that the current temporary code is broken, because it does not copy the temporary back on render cache flushes.
--- src/gallium/drivers/nv04/nv04_context.h | 1 - src/gallium/drivers/nv04/nv04_miptree.c | 155 +++++++++++++----- src/gallium/drivers/nv04/nv04_screen.c | 9 - src/gallium/drivers/nv04/nv04_state.h | 13 -- src/gallium/drivers/nv04/nv04_state_emit.c | 14 +- src/gallium/drivers/nv04/nv04_surface_2d.c | 14 +- src/gallium/drivers/nv04/nv04_surface_2d.h | 14 ++- src/gallium/drivers/nv04/nv04_transfer.c | 37 +++-- src/gallium/drivers/nv10/Makefile | 2 - src/gallium/drivers/nv10/nv10_context.h | 4 +- src/gallium/drivers/nv10/nv10_miptree.c | 165 ------------------- src/gallium/drivers/nv10/nv10_screen.c | 13 +-- src/gallium/drivers/nv10/nv10_state.h | 13 -- src/gallium/drivers/nv10/nv10_state_emit.c | 14 +- src/gallium/drivers/nv10/nv10_transfer.c | 178 --------------------- src/gallium/drivers/nv20/Makefile | 2 - src/gallium/drivers/nv20/nv20_context.h | 4 +- src/gallium/drivers/nv20/nv20_miptree.c | 226 -------------------------- src/gallium/drivers/nv20/nv20_screen.c | 13 +-- src/gallium/drivers/nv20/nv20_state.h | 13 -- src/gallium/drivers/nv20/nv20_state_emit.c | 12 +- src/gallium/drivers/nv20/nv20_transfer.c | 178 --------------------- src/gallium/drivers/nv30/Makefile | 2 - src/gallium/drivers/nv30/nv30_fragtex.c | 8 +- src/gallium/drivers/nv30/nv30_miptree.c | 239 ---------------------------- src/gallium/drivers/nv30/nv30_screen.c | 13 +-- src/gallium/drivers/nv30/nv30_state.h | 13 -- src/gallium/drivers/nv30/nv30_state_fb.c | 20 ++-- src/gallium/drivers/nv30/nv30_transfer.c | 178 --------------------- src/gallium/drivers/nv40/Makefile | 2 - src/gallium/drivers/nv40/nv40_fragtex.c | 12 +- src/gallium/drivers/nv40/nv40_miptree.c | 235 --------------------------- src/gallium/drivers/nv40/nv40_screen.c | 13 +-- src/gallium/drivers/nv40/nv40_state.h | 13 -- src/gallium/drivers/nv40/nv40_state_fb.c | 10 +- src/gallium/drivers/nv40/nv40_transfer.c | 178 --------------------- 36 files changed, 215 insertions(+), 1815 deletions(-) delete mode 100644 src/gallium/drivers/nv10/nv10_miptree.c delete mode 100644 src/gallium/drivers/nv10/nv10_transfer.c delete mode 100644 src/gallium/drivers/nv20/nv20_miptree.c delete mode 100644 src/gallium/drivers/nv20/nv20_transfer.c delete mode 100644 src/gallium/drivers/nv30/nv30_miptree.c delete mode 100644 src/gallium/drivers/nv30/nv30_transfer.c delete mode 100644 src/gallium/drivers/nv40/nv40_miptree.c delete mode 100644 src/gallium/drivers/nv40/nv40_transfer.c
src/gallium/drivers/nv04/nv04_context.h +0 -1
@@ -111,7 +111,6 @@ nv04_context(struct pipe_context *pipe)extern void nv04_init_state_functions (struct nv04_context *nv04);extern void nv04_init_surface_functions (struct nv04_context *nv04); -extern void nv04_screen_init_miptree_functions (struct pipe_screen *screen);/* nv04_clear.c */ extern void nv04_clear(struct pipe_context *pipe, struct pipe_surface *ps,
src/gallium/drivers/nv04/nv04_miptree.c +114 -41
219 lines not on this page · raw message
src/gallium/drivers/nv04/nv04_screen.c +0 -9
@@ -124,14 +124,6 @@ nv04_screen_destroy(struct pipe_screen *pscreen)FREE (pscreen); } -static struct pipe_buffer * -nv04_surface_buffer (struct pipe_surface *surf) -{ -struct nv04_miptree *mt = (struct nv04_miptree *)surf->texture; - -return mt->buffer; -} -struct pipe_screen *nv04_screen_create (struct pipe_winsys *ws,struct nouveau_device *dev) {
@@ -197,7 +189,6 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)/* 2D engine setup */ screen->eng2d =nv04_surface_2d_init (&screen->base); - screen->eng2d->buf = nv04_surface_buffer;/* Notifier for sync purposes */ ret =nouveau_notifier_alloc (chan,0xbeef0301 ,1 , &screen->sync);
src/gallium/drivers/nv04/nv04_state.h +0 -13
@@ -29,19 +29,6 @@ struct nv04_rasterizer_state {const struct pipe_rasterizer_state *templ; }; -struct nv04_miptree { -struct pipe_texture base; -struct nouveau_bo *bo; - -struct pipe_buffer *buffer; -uint total_size; - -struct { -uint pitch; -uint *image_offset; - } level[PIPE_MAX_TEXTURE_LEVELS ]; -}; -struct nv04_fragment_program_data {unsigned offset;unsigned index;
src/gallium/drivers/nv04/nv04_state_emit.c +6 -8
@@ -92,11 +92,10 @@ static void nv04_emit_sampler(struct nv04_context *nv04, int unit)struct nv04_screen *screen = nv04->screen;struct nouveau_channel *chan = screen->base.channel;struct nouveau_grobj *fahrenheit = screen->fahrenheit; -struct nouveau_bo *bo =nouveau_bo (nv04mt->buffer);BEGIN_RING (chan, fahrenheit,NV04_TEXTURED_TRIANGLE_OFFSET ,3 ); -OUT_RELOCl (chan, bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_RD ); -OUT_RELOCd (chan, bo, (nv04->fragtex.format | nv04->sampler[unit]->format),NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_OR |NOUVEAU_BO_RD ,1 /*VRAM*/ ,2 /*TT*/ ); +OUT_RELOCl (chan, nv04mt->bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_RD ); +OUT_RELOCd (chan, nv04mt->bo, (nv04->fragtex.format | nv04->sampler[unit]->format),NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_OR |NOUVEAU_BO_RD ,1 /*VRAM*/ ,2 /*TT*/ );OUT_RING (chan, nv04->sampler[unit]->filter); }
@@ -146,11 +145,11 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)OUT_RING (chan, rt_format); nv04mt = (struct nv04_miptree *)rt->base.texture; - bo =nouveau_bo (nv04mt->buffer); +/* FIXME pitches have to be aligned ! */ BEGIN_RING (chan, context_surfaces_3d,NV04_CONTEXT_SURFACES_3D_PITCH ,2 );OUT_RING (chan, rt->pitch|(zeta->pitch<<16 )); -OUT_RELOCl (chan, bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR ); +OUT_RELOCl (chan, nv04mt->bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );if (fb->zsbuf) { nv04mt = (struct nv04_miptree *)zeta->base.texture;BEGIN_RING (chan, context_surfaces_3d,NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA ,1 );
@@ -237,10 +236,9 @@ nv04_emit_hw_state(struct nv04_context *nv04)if (!(nv04->fp_samplers & (1 << i)))continue ;struct nv04_miptree *nv04mt = nv04->tex_miptree[i]; -struct nouveau_bo *bo =nouveau_bo (nv04mt->buffer);BEGIN_RING (chan, fahrenheit,NV04_TEXTURED_TRIANGLE_OFFSET ,2 ); -OUT_RELOCl (chan, bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_RD ); -OUT_RELOCd (chan, bo, (nv04->fragtex.format | nv04->sampler[i]->format),NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_OR |NOUVEAU_BO_RD ,1 /*VRAM*/ ,2 /*TT*/ ); +OUT_RELOCl (chan, nv04mt->bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_RD ); +OUT_RELOCd (chan, nv04mt->bo, (nv04->fragtex.format | nv04->sampler[i]->format),NOUVEAU_BO_VRAM |NOUVEAU_BO_GART |NOUVEAU_BO_OR |NOUVEAU_BO_RD ,1 /*VRAM*/ ,2 /*TT*/ ); } }
src/gallium/drivers/nv04/nv04_surface_2d.c +7 -7
@@ -125,8 +125,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,struct nouveau_channel *chan = ctx->swzsurf->channel;struct nouveau_grobj *swzsurf = ctx->swzsurf;struct nouveau_grobj *sifm = ctx->sifm; -struct nouveau_bo *src_bo =nouveau_bo (ctx->buf (src)); -struct nouveau_bo *dst_bo =nouveau_bo (ctx->buf (dst)); +struct nouveau_bo *src_bo = ((struct nv04_miptree *)src->texture)->bo; +struct nouveau_bo *dst_bo = ((struct nv04_miptree *)dst->texture)->bo;const unsigned src_pitch = ((struct nv04_surface *)src)->pitch;/* Max width & height may not be the same on all HW, but must be POT */ const unsigned max_w =1024 ;
@@ -205,8 +205,8 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, {struct nouveau_channel *chan = ctx->m2mf->channel;struct nouveau_grobj *m2mf = ctx->m2mf; -struct nouveau_bo *src_bo =nouveau_bo (ctx->buf (src)); -struct nouveau_bo *dst_bo =nouveau_bo (ctx->buf (dst)); +struct nouveau_bo *src_bo = ((struct nv04_miptree *)src->texture)->bo; +struct nouveau_bo *dst_bo = ((struct nv04_miptree *)dst->texture)->bo;unsigned src_pitch = ((struct nv04_surface *)src)->pitch;unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; unsigned dst_offset = dst->offset + dy * dst_pitch +
@@ -252,8 +252,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,struct nouveau_channel *chan = ctx->surf2d->channel;struct nouveau_grobj *surf2d = ctx->surf2d;struct nouveau_grobj *blit = ctx->blit; -struct nouveau_bo *src_bo =nouveau_bo (ctx->buf (src)); -struct nouveau_bo *dst_bo =nouveau_bo (ctx->buf (dst)); +struct nouveau_bo *src_bo = ((struct nv04_miptree *)src->texture)->bo; +struct nouveau_bo *dst_bo = ((struct nv04_miptree *)dst->texture)->bo;unsigned src_pitch = ((struct nv04_surface *)src)->pitch;unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;int format;
@@ -317,7 +317,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,struct nouveau_channel *chan = ctx->surf2d->channel;struct nouveau_grobj *surf2d = ctx->surf2d;struct nouveau_grobj *rect = ctx->rect; -struct nouveau_bo *dst_bo =nouveau_bo (ctx->buf (dst)); +struct nouveau_bo *dst_bo = ((struct nv04_miptree *)dst->texture)->bo;unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;int cs2d_format, gdirect_format;
src/gallium/drivers/nv04/nv04_surface_2d.h +12 -2
@@ -1,6 +1,18 @@ #ifndef __NV04_SURFACE_2D_H__ #define __NV04_SURFACE_2D_H__ +struct nv04_miptree { + struct pipe_texture base; + struct nouveau_bo *bo; + + unsigned linear_pitch; /* for linear textures, 0 for swizzled and compressed textures with level-dependent minimal pitch */ + unsigned face_size; /* 128-byte aligned face/total size */ + unsigned level_offset[PIPE_MAX_TEXTURE_LEVELS]; +}; + +extern void nv04_screen_init_miptree_functions(struct pipe_screen *screen); +extern void nv04_screen_init_transfer_functions(struct pipe_screen *screen); + struct nv04_surface { struct pipe_surface base; unsigned pitch;
@@ -16,8 +28,6 @@ struct nv04_surface_2d {struct nouveau_grobj *blit;struct nouveau_grobj *sifm; -struct pipe_buffer *(*buf)(struct pipe_surface *); -void (*copy)(struct nv04_surface_2d *,struct pipe_surface *dst,int dx,int dy,struct pipe_surface *src,int sx,int sy,int w,int h);
src/gallium/drivers/nv04/nv04_transfer.c +26 -11
@@ -41,6 +41,9 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv04_miptree *mt = (struct nv04_miptree *)pt;struct nv04_transfer *tx;struct pipe_texture tx_tex_template, *tx_tex; +static int no_transfer =-1 ; +if (no_transfer <0 ) + no_transfer =debug_get_bool_option ("NOUVEAU_NO_TRANSFER" , FALSE); tx =CALLOC_STRUCT (nv04_transfer);if (!tx)
@@ -51,20 +54,21 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.stride = mt->level[level].pitch; + tx->base.stride = mt->linear_pitch; +if (!tx->base.stride) + tx->base.stride =util_format_get_stride (pt->format,u_minify (pt->width0, level)); tx->base.usage = usage; tx->base.face = face; tx->base.level = level; tx->base.zslice = zslice;/* Direct access to texture */ -if ((pt->tex_usage &PIPE_TEXTURE_USAGE_DYNAMIC || -debug_get_bool_option ("NOUVEAU_NO_TRANSFER" , TRUE/*XXX:FALSE*/ )) && +if ((pt->tex_usage &PIPE_TEXTURE_USAGE_DYNAMIC || no_transfer) && pt->tex_usage &NOUVEAU_TEXTURE_USAGE_LINEAR ) { tx->direct = true; tx->surface = pscreen->get_tex_surface (pscreen, pt, -0 ,0 ,0 , + face, level, zslice,pipe_transfer_buffer_flags (&tx->base));return &tx->base; }
@@ -80,10 +84,12 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } - tx->base.stride = ((struct nv04_miptree *)tx_tex)->level[0 ].pitch; + tx->base.stride = ((struct nv04_miptree *)tx_tex)->linear_pitch; +if (!tx->base.stride) + tx->base.stride =util_format_get_stride (pt->format,u_minify (pt->width0, level)); tx->surface = pscreen->get_tex_surface (pscreen, tx_tex, - face, level, zslice, +0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));pipe_texture_reference (&tx_tex,NULL );
@@ -150,13 +156,22 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)struct nv04_transfer *tx = (struct nv04_transfer *)ptx;struct nv04_surface *ns = (struct nv04_surface *)tx->surface;struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture; -void *map =pipe_buffer_map (pscreen, mt->buffer, -pipe_transfer_buffer_flags (ptx)); +unsigned flags =0 ; +int ret; + +if (ptx->usage &PIPE_TRANSFER_WRITE ) + flags |=NOUVEAU_BO_WR ; +if (ptx->usage &PIPE_TRANSFER_READ ) + flags |=NOUVEAU_BO_RD ; + + ret =nouveau_bo_map (mt->bo, flags);if (!tx->direct) -return map + ns->base.offset; +return mt->bo->map + ns->base.offset;else -return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +return mt->bo->map + ns->base.offset + +util_format_get_2d_size (ns->base.format, ns->pitch, ptx->y) + +util_format_get_stride (ptx->texture->format, ptx->x); } static void
@@ -165,7 +180,7 @@ nv04_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)struct nv04_transfer *tx = (struct nv04_transfer *)ptx;struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture; -pipe_buffer_unmap (pscreen, mt->buffer); +nouveau_bo_unmap (mt->bo); }void
src/gallium/drivers/nv10/Makefile +0 -2
@@ -8,13 +8,11 @@ C_SOURCES = \ nv10_context.c \ nv10_fragprog.c \ nv10_fragtex.c \ - nv10_miptree.c \ nv10_prim_vbuf.c \ nv10_screen.c \ nv10_state.c \ nv10_state_emit.c \ nv10_surface.c \ - nv10_transfer.c \ nv10_vbo.c include ../../Makefile.template
src/gallium/drivers/nv10/nv10_context.h +2 -2
@@ -53,8 +53,8 @@ struct nv10_context {unsigned vp_samplers;uint32_t rt_enable; -struct pipe_buffer *rt[4 ]; -struct pipe_buffer *zeta; +struct nouveau_bo *rt[4 ]; +struct nouveau_bo *zeta;uint32_t lma_offset;struct nv10_blend_state *blend;
src/gallium/drivers/nv10/nv10_miptree.c deleted +0 -165
165 lines not on this page · raw message
src/gallium/drivers/nv10/nv10_screen.c +2 -11
@@ -122,14 +122,6 @@ nv10_screen_destroy(struct pipe_screen *pscreen)FREE (pscreen); } -static struct pipe_buffer * -nv10_surface_buffer (struct pipe_surface *surf) -{ -struct nv10_miptree *mt = (struct nv10_miptree *)surf->texture; - -return mt->buffer; -} -struct pipe_screen *nv10_screen_create (struct pipe_winsys *ws,struct nouveau_device *dev) {
@@ -156,8 +148,8 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->get_paramf = nv10_screen_get_paramf; pscreen->is_format_supported = nv10_screen_is_format_supported; -nv10_screen_init_miptree_functions (pscreen); -nv10_screen_init_transfer_functions (pscreen); +nv04_screen_init_miptree_functions (pscreen); +nv04_screen_init_transfer_functions (pscreen);/* 3D object */ if (dev->chipset >=0x20 )
@@ -183,7 +175,6 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)/* 2D engine setup */ screen->eng2d =nv04_surface_2d_init (&screen->base); - screen->eng2d->buf = nv10_surface_buffer;/* Notifier for sync purposes */ ret =nouveau_notifier_alloc (chan,0xbeef0301 ,1 , &screen->sync);
src/gallium/drivers/nv10/nv10_state.h +0 -13
@@ -124,17 +124,4 @@ struct nv10_depth_stencil_alpha_state { } alpha; }; -struct nv10_miptree { -struct pipe_texture base; -struct nouveau_bo *bo; - -struct pipe_buffer *buffer; -uint total_size; - -struct { -uint pitch; -uint *image_offset; - } level[PIPE_MAX_TEXTURE_LEVELS ]; -}; -#endif
src/gallium/drivers/nv10/nv10_state_emit.c +7 -7
@@ -119,7 +119,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)struct nv04_surface *rt, *zeta =NULL ;uint32_t rt_format, w, h;int colour_format =0 , zeta_format =0 ; -struct nv10_miptree *nv10mt =0 ; +struct nv04_miptree *nv10mt =0 ;struct nv10_screen *screen = nv10->screen;struct nouveau_channel *chan = screen->base.channel;
@@ -168,13 +168,13 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)OUT_RING (chan, rt->pitch | (rt->pitch <<16 )); } - nv10mt = (struct nv10_miptree *)rt->base.texture; - nv10->rt[0 ] = nv10mt->buffer; + nv10mt = (struct nv04_miptree *)rt->base.texture; + nv10->rt[0 ] = nv10mt->bo;if (zeta_format) { - nv10mt = (struct nv10_miptree *)zeta->base.texture; - nv10->zeta = nv10mt->buffer; + nv10mt = (struct nv04_miptree *)zeta->base.texture; + nv10->zeta = nv10mt->bo; }BEGIN_RING (chan, celsius,NV10TCL_RT_HORIZ ,3 );
@@ -290,7 +290,7 @@ nv10_emit_hw_state(struct nv10_context *nv10)*/ /* Render target */ - rt_bo =nouveau_bo (nv10->rt[0 ]); + rt_bo = nv10->rt[0 ];// XXX figre out who's who for NV10TCL_DMA_* and fill accordingly // BEGIN_RING(chan, celsius, NV10TCL_DMA_COLOR0, 1); // OUT_RELOCo(chan, rt_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -298,7 +298,7 @@ nv10_emit_hw_state(struct nv10_context *nv10)OUT_RELOCl (chan, rt_bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );if (nv10->zeta) { -struct nouveau_bo *zeta_bo =nouveau_bo (nv10->zeta); +struct nouveau_bo *zeta_bo = nv10->zeta;// XXX // BEGIN_RING(chan, celsius, NV10TCL_DMA_ZETA, 1); // OUT_RELOCo(chan, zeta_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
src/gallium/drivers/nv10/nv10_transfer.c deleted +0 -178
178 lines not on this page · raw message
src/gallium/drivers/nv20/Makefile +0 -2
@@ -8,13 +8,11 @@ C_SOURCES = \ nv20_context.c \ nv20_fragprog.c \ nv20_fragtex.c \ - nv20_miptree.c \ nv20_prim_vbuf.c \ nv20_screen.c \ nv20_state.c \ nv20_state_emit.c \ nv20_surface.c \ - nv20_transfer.c \ nv20_vbo.c # nv20_vertprog.c
src/gallium/drivers/nv20/nv20_context.h +2 -2
@@ -53,8 +53,8 @@ struct nv20_context {unsigned vp_samplers;uint32_t rt_enable; -struct pipe_buffer *rt[4 ]; -struct pipe_buffer *zeta; +struct nouveau_bo *rt[4 ]; +struct nouveau_bo *zeta;uint32_t lma_offset;struct nv20_blend_state *blend;
src/gallium/drivers/nv20/nv20_miptree.c deleted +0 -226
226 lines not on this page · raw message
src/gallium/drivers/nv20/nv20_screen.c +2 -11
@@ -122,14 +122,6 @@ nv20_screen_destroy(struct pipe_screen *pscreen)FREE (pscreen); } -static struct pipe_buffer * -nv20_surface_buffer (struct pipe_surface *surf) -{ -struct nv20_miptree *mt = (struct nv20_miptree *)surf->texture; - -return mt->buffer; -} -struct pipe_screen *nv20_screen_create (struct pipe_winsys *ws,struct nouveau_device *dev) {
@@ -156,8 +148,8 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->get_paramf = nv20_screen_get_paramf; pscreen->is_format_supported = nv20_screen_is_format_supported; -nv20_screen_init_miptree_functions (pscreen); -nv20_screen_init_transfer_functions (pscreen); +nv04_screen_init_miptree_functions (pscreen); +nv04_screen_init_transfer_functions (pscreen);/* 3D object */ if (dev->chipset >=0x25 )
@@ -179,7 +171,6 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)/* 2D engine setup */ screen->eng2d =nv04_surface_2d_init (&screen->base); - screen->eng2d->buf = nv20_surface_buffer;/* Notifier for sync purposes */ ret =nouveau_notifier_alloc (chan,0xbeef0301 ,1 , &screen->sync);
src/gallium/drivers/nv20/nv20_state.h +0 -13
@@ -126,17 +126,4 @@ struct nv20_depth_stencil_alpha_state { } alpha; }; -struct nv20_miptree { -struct pipe_texture base; -struct nouveau_bo *bo; - -struct pipe_buffer *buffer; -uint total_size; - -struct { -uint pitch; -uint *image_offset; - } level[PIPE_MAX_TEXTURE_LEVELS ]; -}; -#endif
src/gallium/drivers/nv20/nv20_state_emit.c +6 -6
@@ -132,7 +132,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)struct nv04_surface *rt, *zeta =NULL ;uint32_t rt_format, w, h;int colour_format =0 , zeta_format =0 ; -struct nv20_miptree *nv20mt =0 ; +struct nv04_miptree *nv20mt =0 ;struct nv20_screen *screen = nv20->screen;struct nouveau_channel *chan = screen->base.channel;struct nouveau_grobj *kelvin = screen->kelvin;
@@ -180,13 +180,13 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)OUT_RING (chan, rt->pitch | (rt->pitch <<16 )); } - nv20mt = (struct nv20_miptree *)rt->base.texture; - nv20->rt[0 ] = nv20mt->buffer; + nv20mt = (struct nv04_miptree *)rt->base.texture; + nv20->rt[0 ] = nv20mt->bo;if (zeta_format) { nv20mt = (struct nv20_miptree *)zeta->base.texture; - nv20->zeta = nv20mt->buffer; + nv20->zeta = nv20mt->bo; }BEGIN_RING (chan, kelvin,NV20TCL_RT_HORIZ ,3 );
@@ -388,14 +388,14 @@ nv20_emit_hw_state(struct nv20_context *nv20)*/ /* Render target */ - rt_bo =nouveau_bo (nv20->rt[0 ]); + rt_bo = nv20->rt[0 ];BEGIN_RING (chan, kelvin,NV20TCL_DMA_COLOR ,1 );OUT_RELOCo (chan, rt_bo,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );BEGIN_RING (chan, kelvin,NV20TCL_COLOR_OFFSET ,1 );OUT_RELOCl (chan, rt_bo,0 ,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );if (nv20->zeta) { -struct nouveau_bo *zeta_bo =nouveau_bo (nv20->zeta); +struct nouveau_bo *zeta_bo = nv20->zeta;BEGIN_RING (chan, kelvin,NV20TCL_DMA_ZETA ,1 );OUT_RELOCo (chan, zeta_bo,NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );BEGIN_RING (chan, kelvin,NV20TCL_ZETA_OFFSET ,1 );
src/gallium/drivers/nv20/nv20_transfer.c deleted +0 -178
178 lines not on this page · raw message
src/gallium/drivers/nv30/Makefile +0 -2
@@ -9,7 +9,6 @@ C_SOURCES = \ nv30_draw.c \ nv30_fragprog.c \ nv30_fragtex.c \ - nv30_miptree.c \ nv30_query.c \ nv30_screen.c \ nv30_state.c \
@@ -22,7 +21,6 @@ C_SOURCES = \ nv30_state_viewport.c \ nv30_state_zsa.c \ nv30_surface.c \ - nv30_transfer.c \ nv30_vbo.c \ nv30_vertprog.c
src/gallium/drivers/nv30/nv30_fragtex.c +5 -3
@@ -59,9 +59,9 @@ static struct nouveau_stateobj * nv30_fragtex_build(struct nv30_context *nv30, int unit) {struct nv30_sampler_state *ps = nv30->tex_sampler[unit]; -struct nv30_miptree *nv30mt = nv30->tex_miptree[unit]; -struct pipe_texture *pt = &nv30mt->base; -struct nouveau_bo *bo =nouveau_bo (nv30mt->buffer); +struct nv04_miptree *mt = nv30->tex_miptree[unit]; +struct pipe_texture *pt = &mt->base; +struct nouveau_bo *bo = mt->bo;struct nv30_texture_format *tf;struct nouveau_stateobj *so;uint32_t txf, txs;
@@ -96,6 +96,8 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)return NULL ; } +/* FIXME: specify whether textures are swizzled or not somehow */ + txs = tf->swizzle; so =so_new (1 ,8 ,2 );
src/gallium/drivers/nv30/nv30_miptree.c deleted +0 -239
239 lines not on this page · raw message
src/gallium/drivers/nv30/nv30_screen.c +2 -11
@@ -144,14 +144,6 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,return FALSE; } -static struct pipe_buffer * -nv30_surface_buffer (struct pipe_surface *surf) -{ -struct nv30_miptree *mt = (struct nv30_miptree *)surf->texture; - -return mt->buffer; -} -static void nv30_screen_destroy (struct pipe_screen *pscreen) {
@@ -203,8 +195,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->get_paramf = nv30_screen_get_paramf; pscreen->is_format_supported = nv30_screen_surface_format_supported; -nv30_screen_init_miptree_functions (pscreen); -nv30_screen_init_transfer_functions (pscreen); +nv04_screen_init_miptree_functions (pscreen); +nv04_screen_init_transfer_functions (pscreen);/* 3D object */ switch (dev->chipset &0xf0 ) {
@@ -236,7 +228,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)/* 2D engine setup */ screen->eng2d =nv04_surface_2d_init (&screen->base); - screen->eng2d->buf = nv30_surface_buffer;/* Notifier for sync purposes */ ret =nouveau_notifier_alloc (chan,0xbeef0301 ,1 , &screen->sync);
src/gallium/drivers/nv30/nv30_state.h +0 -13
@@ -70,17 +70,4 @@ struct nv30_fragment_program { struct nouveau_stateobj *so; }; -struct nv30_miptree { -struct pipe_texture base; -struct nouveau_bo *bo; - -struct pipe_buffer *buffer; -uint total_size; - -struct { -uint pitch; -uint *image_offset; - } level[PIPE_MAX_TEXTURE_LEVELS ]; -}; -#endif
src/gallium/drivers/nv30/nv30_state_fb.c +10 -10
@@ -14,7 +14,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)unsigned rt_flags =NOUVEAU_BO_RDWR |NOUVEAU_BO_VRAM ;unsigned w = fb->width;unsigned h = fb->height; -struct nv30_miptree *nv30mt; +struct nv04_miptree *mt;int colour_bits =32 , zeta_bits =32 ;for (i =0 ; i < fb->nr_cbufs; i++) {
@@ -109,34 +109,34 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) pitch |= (pitch <<16 ); } - nv30mt = (struct nv30_miptree *) rt0->base.texture; + mt = (struct nv04_miptree *) rt0->base.texture;so_method (so, rankine,NV34TCL_DMA_COLOR0 ,1 ); -so_reloc (so,nouveau_bo (nv30mt->buffer),0 , rt_flags |NOUVEAU_BO_OR , +so_reloc (so, mt->bo,0 , rt_flags |NOUVEAU_BO_OR , chan->vram->handle, chan->gart->handle);so_method (so, rankine,NV34TCL_COLOR0_PITCH ,2 );so_data (so, pitch); -so_reloc (so,nouveau_bo (nv30mt->buffer), rt0->base.offset, +so_reloc (so, mt->bo, rt0->base.offset, rt_flags |NOUVEAU_BO_LOW ,0 ,0 ); }if (rt_enable &NV34TCL_RT_ENABLE_COLOR1 ) { - nv30mt = (struct nv30_miptree *)rt[1 ]->base.texture; + mt = (struct nv30_miptree *)rt[1 ]->base.texture;so_method (so, rankine,NV34TCL_DMA_COLOR1 ,1 ); -so_reloc (so,nouveau_bo (nv30mt->buffer),0 , rt_flags |NOUVEAU_BO_OR , +so_reloc (so, mt->bo,0 , rt_flags |NOUVEAU_BO_OR , chan->vram->handle, chan->gart->handle);so_method (so, rankine,NV34TCL_COLOR1_OFFSET ,2 ); -so_reloc (so,nouveau_bo (nv30mt->buffer), rt[1 ]->base.offset, +so_reloc (so, mt->bo, rt[1 ]->base.offset, rt_flags |NOUVEAU_BO_LOW ,0 ,0 );so_data (so, rt[1 ]->pitch); }if (zeta_format) { - nv30mt = (struct nv30_miptree *)zeta->base.texture; + mt = (struct nv30_miptree *)zeta->base.texture;so_method (so, rankine,NV34TCL_DMA_ZETA ,1 ); -so_reloc (so,nouveau_bo (nv30mt->buffer),0 , rt_flags |NOUVEAU_BO_OR , +so_reloc (so, mt->bo,0 , rt_flags |NOUVEAU_BO_OR , chan->vram->handle, chan->gart->handle);so_method (so, rankine,NV34TCL_ZETA_OFFSET ,1 ); -so_reloc (so,nouveau_bo (nv30mt->buffer), zeta->base.offset, +so_reloc (so, mt->bo, zeta->base.offset, rt_flags |NOUVEAU_BO_LOW ,0 ,0 );/* TODO: allocate LMA depth buffer */ }
src/gallium/drivers/nv30/nv30_transfer.c deleted +0 -178
178 lines not on this page · raw message
src/gallium/drivers/nv40/Makefile +0 -2
@@ -9,7 +9,6 @@ C_SOURCES = \ nv40_draw.c \ nv40_fragprog.c \ nv40_fragtex.c \ - nv40_miptree.c \ nv40_query.c \ nv40_screen.c \ nv40_state.c \
@@ -22,7 +21,6 @@ C_SOURCES = \ nv40_state_viewport.c \ nv40_state_zsa.c \ nv40_surface.c \ - nv40_transfer.c \ nv40_vbo.c \ nv40_vertprog.c
src/gallium/drivers/nv40/nv40_fragtex.c +6 -6
@@ -62,9 +62,9 @@ static struct nouveau_stateobj * nv40_fragtex_build(struct nv40_context *nv40, int unit) {struct nv40_sampler_state *ps = nv40->tex_sampler[unit]; -struct nv40_miptree *nv40mt = nv40->tex_miptree[unit]; -struct nouveau_bo *bo =nouveau_bo (nv40mt->buffer); -struct pipe_texture *pt = &nv40mt->base; +struct nv04_miptree *mt = nv40->tex_miptree[unit]; +struct nouveau_bo *bo = mt->bo; +struct pipe_texture *pt = &mt->base;struct nv40_texture_format *tf;struct nouveau_stateobj *so;uint32_t txf, txs, txp;
@@ -99,10 +99,10 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)return NULL ; } -if (!(pt->tex_usage &NOUVEAU_TEXTURE_USAGE_LINEAR )) { +if (!mt->linear_pitch) txp =0 ; - }else { - txp = nv40mt->level[0 ].pitch; +else { + txp = mt->linear_pitch; txf |=NV40TCL_TEX_FORMAT_LINEAR ; }
src/gallium/drivers/nv40/nv40_miptree.c deleted +0 -235
235 lines not on this page · raw message
src/gallium/drivers/nv40/nv40_screen.c +2 -11
@@ -128,14 +128,6 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen,return FALSE; } -static struct pipe_buffer * -nv40_surface_buffer (struct pipe_surface *surf) -{ -struct nv40_miptree *mt = (struct nv40_miptree *)surf->texture; - -return mt->buffer; -} -static void nv40_screen_destroy (struct pipe_screen *pscreen) {
@@ -189,8 +181,8 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->get_paramf = nv40_screen_get_paramf; pscreen->is_format_supported = nv40_screen_surface_format_supported; -nv40_screen_init_miptree_functions (pscreen); -nv40_screen_init_transfer_functions (pscreen); +nv04_screen_init_miptree_functions (pscreen); +nv04_screen_init_transfer_functions (pscreen);/* 3D object */ switch (dev->chipset &0xf0 ) {
@@ -220,7 +212,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)/* 2D engine setup */ screen->eng2d =nv04_surface_2d_init (&screen->base); - screen->eng2d->buf = nv40_surface_buffer;/* Notifier for sync purposes */ ret =nouveau_notifier_alloc (chan,0xbeef0301 ,1 , &screen->sync);
src/gallium/drivers/nv40/nv40_state.h +0 -13
@@ -73,17 +73,4 @@ struct nv40_fragment_program { struct nouveau_stateobj *so; }; -struct nv40_miptree { -struct pipe_texture base; -struct nouveau_bo *bo; - -struct pipe_buffer *buffer; -uint total_size; - -struct { -uint pitch; -uint *image_offset; - } level[PIPE_MAX_TEXTURE_LEVELS ]; -}; -#endif
src/gallium/drivers/nv40/nv40_state_fb.c +4 -6
@@ -1,15 +1,13 @@#include "nv40_context.h" #include "nouveau/nouveau_util.h" -static struct pipe_buffer * -nv40_do_surface_buffer (struct pipe_surface *surface) +static struct nouveau_bo * +nv40_surface_buffer (struct pipe_surface *surface) { -struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture; -return mt->buffer; +struct nv04_miptree *mt = (struct nv04_miptree *)surface->texture; +return mt->bo; } -#define nv40_surface_buffer (ps) nouveau_bo(nv40_do_surface_buffer(ps)) -static boolean nv40_state_framebuffer_validate (struct nv40_context *nv40) {
src/gallium/drivers/nv40/nv40_transfer.c deleted +0 -178
178 lines not on this page · raw message
Signature · 1 line
1.6.3.3