From d084d189d03dc89a3161a131f1b386840c06ad61 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 20 Feb 2010 20:07:10 +0100 Subject: [PATCH] nv30, nv40: unify identical nv[34]0_transfer.c --- src/gallium/drivers/nv30/Makefile | 1 - src/gallium/drivers/nv30/nv30_context.c | 2 +- src/gallium/drivers/nv30/nv30_context.h | 1 - src/gallium/drivers/nv40/Makefile | 1 - src/gallium/drivers/nv40/nv40_context.c | 2 +- src/gallium/drivers/nv40/nv40_context.h | 1 - src/gallium/drivers/nvfx/Makefile | 3 +- src/gallium/drivers/nvfx/nvfx_context.h | 3 ++ .../nv30_transfer.c => nvfx/nvfx_transfer.c} | 38 +++++++++---------- 9 files changed, 26 insertions(+), 26 deletions(-) rename src/gallium/drivers/{nv30/nv30_transfer.c => nvfx/nvfx_transfer.c} (82%) diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile index 27f19da75cc..f18295cefc2 100644 --- a/src/gallium/drivers/nv30/Makefile +++ b/src/gallium/drivers/nv30/Makefile @@ -21,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 diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index 74be578705c..ee2c465bc6d 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -76,7 +76,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv) nv30_init_query_functions(nvfx); nv30_init_surface_functions(nvfx); nv30_init_state_functions(nvfx); - nv30_init_transfer_functions(nvfx); + nvfx_init_transfer_functions(nvfx); /* Create, configure, and install fallback swtnl path */ nvfx->draw = draw_create(); diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 8032bcd9797..9f28d49706f 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -6,7 +6,6 @@ extern void nv30_init_state_functions(struct nvfx_context *nvfx); extern void nv30_init_surface_functions(struct nvfx_context *nvfx); extern void nv30_init_query_functions(struct nvfx_context *nvfx); -extern void nv30_init_transfer_functions(struct nvfx_context *nvfx); extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile index 031c943de52..8d09ef807f8 100644 --- a/src/gallium/drivers/nv40/Makefile +++ b/src/gallium/drivers/nv40/Makefile @@ -21,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 diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index cb249dd5d76..9934b582eef 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -76,7 +76,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv) nv40_init_query_functions(nvfx); nv40_init_surface_functions(nvfx); nv40_init_state_functions(nvfx); - nv40_init_transfer_functions(nvfx); + nvfx_init_transfer_functions(nvfx); /* Create, configure, and install fallback swtnl path */ nvfx->draw = draw_create(); diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index f9c0a9eb29e..e7c6d5ad86d 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -6,7 +6,6 @@ extern void nv40_init_state_functions(struct nvfx_context *nvfx); extern void nv40_init_surface_functions(struct nvfx_context *nvfx); extern void nv40_init_query_functions(struct nvfx_context *nvfx); -extern void nv40_init_transfer_functions(struct nvfx_context *nvfx); extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile index 6959efa390f..699cbedbc84 100644 --- a/src/gallium/drivers/nvfx/Makefile +++ b/src/gallium/drivers/nvfx/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = nvfx C_SOURCES = \ - nvfx_clear.c + nvfx_clear.c \ + nvfx_transfer.c include ../../Makefile.template diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 0aaa4964e2b..38d1142ff97 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -185,4 +185,7 @@ struct nvfx_state_entry { extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil); +/* nvfx_transfer.c */ +extern void nvfx_init_transfer_functions(struct nvfx_context *nvfx); + #endif diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c similarity index 82% rename from src/gallium/drivers/nv30/nv30_transfer.c rename to src/gallium/drivers/nvfx/nvfx_transfer.c index 3d71df52b90..409b354d582 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -5,18 +5,18 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "nouveau/nouveau_winsys.h" -#include "nv30_context.h" +#include "nvfx_context.h" #include "nvfx_screen.h" #include "nvfx_state.h" -struct nv30_transfer { +struct nvfx_transfer { struct pipe_transfer base; struct pipe_surface *surface; boolean direct; }; static void -nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height, +nvfx_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height, struct pipe_texture *template) { memset(template, 0, sizeof(struct pipe_texture)); @@ -33,17 +33,17 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h } static struct pipe_transfer * -nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, +nvfx_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { struct pipe_screen *pscreen = pcontext->screen; struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; - struct nv30_transfer *tx; + struct nvfx_transfer *tx; struct pipe_texture tx_tex_template, *tx_tex; - tx = CALLOC_STRUCT(nv30_transfer); + tx = CALLOC_STRUCT(nvfx_transfer); if (!tx) return NULL; @@ -72,7 +72,7 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, tx->direct = false; - nv30_compatible_transfer_tex(pt, w, h, &tx_tex_template); + nvfx_compatible_transfer_tex(pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); if (!tx_tex) @@ -118,10 +118,10 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } static void -nv30_transfer_del(struct pipe_context *pcontext, +nvfx_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx) { - struct nv30_transfer *tx = (struct nv30_transfer *)ptx; + struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = pcontext->screen; @@ -147,10 +147,10 @@ nv30_transfer_del(struct pipe_context *pcontext, } static void * -nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) +nvfx_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct pipe_screen *pscreen = pcontext->screen; - struct nv30_transfer *tx = (struct nv30_transfer *)ptx; + struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, @@ -163,20 +163,20 @@ nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) } static void -nv30_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) +nvfx_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { - struct pipe_screen *pscreen = pcontext->screen; - struct nv30_transfer *tx = (struct nv30_transfer *)ptx; + struct pipe_screen *pscreen = pcontext->screen; + struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; pipe_buffer_unmap(pscreen, mt->buffer); } void -nv30_init_transfer_functions(struct nvfx_context *nvfx) +nvfx_init_transfer_functions(struct nvfx_context *nvfx) { - nvfx->pipe.get_tex_transfer = nv30_transfer_new; - nvfx->pipe.tex_transfer_destroy = nv30_transfer_del; - nvfx->pipe.transfer_map = nv30_transfer_map; - nvfx->pipe.transfer_unmap = nv30_transfer_unmap; + nvfx->pipe.get_tex_transfer = nvfx_transfer_new; + nvfx->pipe.tex_transfer_destroy = nvfx_transfer_del; + nvfx->pipe.transfer_map = nvfx_transfer_map; + nvfx->pipe.transfer_unmap = nvfx_transfer_unmap; } -- 2.30.2