From 1c0230b39600de56b555b757272dfc0694da2d0f Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Mon, 13 Mar 2006 11:30:41 +0000 Subject: [PATCH] Cleaned up some code, made more files compile. Renamed nv20_swtcl.* to nv10_swtcl.*, hopefully this is the last rename (this should be, as NV05 really behaves differently). --- src/mesa/drivers/dri/nouveau/Makefile | 2 +- .../drivers/dri/nouveau/nouveau_context.c | 6 +- src/mesa/drivers/dri/nouveau/nouveau_driver.c | 6 +- src/mesa/drivers/dri/nouveau/nouveau_fifo.h | 1 + src/mesa/drivers/dri/nouveau/nouveau_ioctl.c | 7 +- src/mesa/drivers/dri/nouveau/nouveau_ioctl.h | 3 +- src/mesa/drivers/dri/nouveau/nouveau_tris.c | 1 - .../nouveau/{nv20_swtcl.c => nv10_swtcl.c} | 83 +++++++++---------- .../nouveau/{nv20_swtcl.h => nv10_swtcl.h} | 10 +-- 9 files changed, 63 insertions(+), 56 deletions(-) rename src/mesa/drivers/dri/nouveau/{nv20_swtcl.c => nv10_swtcl.c} (91%) rename src/mesa/drivers/dri/nouveau/{nv20_swtcl.h => nv10_swtcl.h} (87%) diff --git a/src/mesa/drivers/dri/nouveau/Makefile b/src/mesa/drivers/dri/nouveau/Makefile index 3e40240e765..25c298132c5 100644 --- a/src/mesa/drivers/dri/nouveau/Makefile +++ b/src/mesa/drivers/dri/nouveau/Makefile @@ -16,7 +16,7 @@ DRIVER_SOURCES = \ nouveau_span.c \ nouveau_tex.c \ nouveau_tris.c \ - nv20_swtcl.c + nv10_swtcl.c C_SOURCES = \ $(COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 3558b25857e..b55e52f4872 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -44,7 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. //#include "nouveau_state.h" #include "nouveau_span.h" #include "nouveau_tex.h" -#include "nv20_swtcl.h" +#include "nv10_swtcl.h" #include "vblank.h" #include "utils.h" @@ -131,14 +131,14 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, case NV_03: case NV_04: case NV_05: - case NV_10: default: break; + case NV_10: case NV_20: case NV_30: case NV_40: case G_70: - nv20TriInitFunctions( ctx ); + nv10TriInitFunctions( ctx ); break; } nouveauDDInitStateFuncs( ctx ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 165fc4929fa..cb996acd89b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -27,6 +27,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "nouveau_context.h" #include "nouveau_ioctl.h" //#include "nouveau_state.h" +#include "nouveau_lock.h" +#include "nouveau_fifo.h" #include "nouveau_driver.h" #include "swrast/swrast.h" @@ -100,7 +102,7 @@ static const GLubyte *nouveauGetString( GLcontext *ctx, GLenum name ) agp_mode=0; break; case NV_AGP: - nmesa->screen->agp_mode; + agp_mode=nmesa->screen->agp_mode; break; } driGetRendererString( buffer, card_name, DRIVER_DATE, @@ -115,7 +117,7 @@ static const GLubyte *nouveauGetString( GLcontext *ctx, GLenum name ) static void nouveauFlush( GLcontext *ctx ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - FIRE_RING( nmesa ); + FIRE_RING(); } /* glFinish */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h index 6a21687551b..bf528a24ca6 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h @@ -90,6 +90,7 @@ extern void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size); }\ }while(0) +extern void nouveauWaitForIdle(nouveauContextPtr nmesa); #endif /* __NOUVEAU_FIFO_H__ */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_ioctl.c b/src/mesa/drivers/dri/nouveau/nouveau_ioctl.c index 959c5f465bd..32bdcef06b9 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_ioctl.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_ioctl.c @@ -24,6 +24,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +#include +#include "mtypes.h" +#include "macros.h" +#include "dd.h" +#include "swrast/swrast.h" #include "nouveau_ioctl.h" @@ -46,7 +51,7 @@ void nouveauIoctlInitFifo() // XXX needs more stuff } -void nouveauIoctlInitFunctions( struct dd_function_table *functions ) +void nouveauIoctlInitFunctions(struct dd_function_table *functions) { // nothing for now } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_ioctl.h b/src/mesa/drivers/dri/nouveau/nouveau_ioctl.h index e6a9a7e2495..3147265e90d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_ioctl.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_ioctl.h @@ -28,6 +28,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __NOUVEAU_IOCTL_H__ #define __NOUVEAU_IOCTL_H__ -extern void nouveauIoctlInitFunctions( struct dd_function_table *functions ); +extern void nouveauIoctlInitFifo(); +extern void nouveauIoctlInitFunctions(struct dd_function_table *functions); #endif /* __NOUVEAU_IOCTL_H__ */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_tris.c b/src/mesa/drivers/dri/nouveau/nouveau_tris.c index 770776390b9..607c811910c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_tris.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_tris.c @@ -117,7 +117,6 @@ void nouveauRunPipeline( GLcontext *ctx ) if (vmesa->newState) { vmesa->newRenderState |= vmesa->newState; - nouveauValidateState( ctx ); } _tnl_run_pipeline( ctx ); diff --git a/src/mesa/drivers/dri/nouveau/nv20_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c similarity index 91% rename from src/mesa/drivers/dri/nouveau/nv20_swtcl.c rename to src/mesa/drivers/dri/nouveau/nv10_swtcl.c index c493516e2a2..0b061876cb3 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -41,7 +41,7 @@ #include "tnl/t_pipeline.h" #include "nouveau_tris.h" -#include "nv20_swtcl.h" +#include "nv10_swtcl.h" #include "nouveau_context.h" #include "nouveau_span.h" #include "nouveau_ioctl.h" @@ -52,8 +52,8 @@ /* XXX hack for now */ #define channel 1 -static void nv20RenderPrimitive( GLcontext *ctx, GLenum prim ); -static void nv20RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim ); +static void nv10RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void nv10RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim ); /*********************************************************************** @@ -71,7 +71,7 @@ static void nv20RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim ); /* the size above which we fire the ring. this is a performance-tunable */ #define NOUVEAU_FIRE_SIZE (2048/4) -static inline void nv20StartPrimitive(struct nouveau_context* nmesa) +static inline void nv10StartPrimitive(struct nouveau_context* nmesa) { if (nmesa->screen->card_type==NV_10) BEGIN_RING_SIZE(channel,NV10_PRIMITIVE,1); @@ -87,7 +87,7 @@ static inline void nv20StartPrimitive(struct nouveau_context* nmesa) BEGIN_RING_PRIM(channel,NV20_BEGIN_VERTICES,NOUVEAU_MIN_PRIM_SIZE); } -static inline void nv20FinishPrimitive(struct nouveau_context *nmesa) +static inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { FINISH_RING_PRIM(); if (nmesa->screen->card_type==NV_10) @@ -101,13 +101,13 @@ static inline void nv20FinishPrimitive(struct nouveau_context *nmesa) } -static inline void nv20ExtendPrimitive(struct nouveau_context* nmesa, int size) +static inline void nv10ExtendPrimitive(struct nouveau_context* nmesa, int size) { /* when the fifo has enough stuff (2048 bytes) or there is not enough room, fire */ if ((RING_AHEAD()>=NOUVEAU_FIRE_SIZE)||(RING_AVAILABLE()vertex_size; - nv20ExtendPrimitive(nmesa, 4 * 4 * vertsize); + nv10ExtendPrimitive(nmesa, 4 * 4 * vertsize); OUT_RINGp(v0,vertsize); OUT_RINGp(v1,vertsize); @@ -132,34 +132,34 @@ static inline void nv20_draw_quad(nouveauContextPtr nmesa, OUT_RINGp(v3,vertsize); } -static inline void nv20_draw_triangle(nouveauContextPtr nmesa, +static inline void nv10_draw_triangle(nouveauContextPtr nmesa, nouveauVertexPtr v0, nouveauVertexPtr v1, nouveauVertexPtr v2) { GLuint vertsize = nmesa->vertex_size; - nv20ExtendPrimitive(nmesa, 3 * 4 * vertsize); + nv10ExtendPrimitive(nmesa, 3 * 4 * vertsize); OUT_RINGp(v0,vertsize); OUT_RINGp(v1,vertsize); OUT_RINGp(v2,vertsize); } -static inline void nv20_draw_line(nouveauContextPtr nmesa, +static inline void nv10_draw_line(nouveauContextPtr nmesa, nouveauVertexPtr v0, nouveauVertexPtr v1) { GLuint vertsize = nmesa->vertex_size; - nv20ExtendPrimitive(nmesa, 2 * 4 * vertsize); + nv10ExtendPrimitive(nmesa, 2 * 4 * vertsize); OUT_RINGp(v0,vertsize); OUT_RINGp(v1,vertsize); } -static inline void nv20_draw_point(nouveauContextPtr nmesa, +static inline void nv10_draw_point(nouveauContextPtr nmesa, nouveauVertexPtr v0) { GLuint vertsize = nmesa->vertex_size; - nv20ExtendPrimitive(nmesa, 1 * 4 * vertsize); + nv10ExtendPrimitive(nmesa, 1 * 4 * vertsize); OUT_RINGp(v0,vertsize); } @@ -174,7 +174,7 @@ static inline void nv20_draw_point(nouveauContextPtr nmesa, if (DO_FALLBACK) \ nmesa->draw_tri(nmesa, a, b, c); \ else \ - nv20_draw_triangle(nmesa, a, b, c); \ + nv10_draw_triangle(nmesa, a, b, c); \ } while (0) #define QUAD(a, b, c, d) \ @@ -184,7 +184,7 @@ static inline void nv20_draw_point(nouveauContextPtr nmesa, nmesa->draw_tri(nmesa, b, c, d); \ } \ else \ - nv20_draw_quad(nmesa, a, b, c, d); \ + nv10_draw_quad(nmesa, a, b, c, d); \ } while (0) #define LINE(v0, v1) \ @@ -192,7 +192,7 @@ static inline void nv20_draw_point(nouveauContextPtr nmesa, if (DO_FALLBACK) \ nmesa->draw_line(nmesa, v0, v1); \ else \ - nv20_draw_line(nmesa, v0, v1); \ + nv10_draw_line(nmesa, v0, v1); \ } while (0) #define POINT(v0) \ @@ -200,7 +200,7 @@ static inline void nv20_draw_point(nouveauContextPtr nmesa, if (DO_FALLBACK) \ nmesa->draw_point(nmesa, v0); \ else \ - nv20_draw_point(nmesa, v0); \ + nv10_draw_point(nmesa, v0); \ } while (0) @@ -320,7 +320,7 @@ static const GLuint hw_prim[GL_POLYGON+1] = { GL_TRIANGLES+1 }; -#define RASTERIZE(x) nv20RasterPrimitive( ctx, x, hw_prim[x] ) +#define RASTERIZE(x) nv10RasterPrimitive( ctx, x, hw_prim[x] ) #define RENDER_PRIMITIVE nmesa->renderPrimitive #define TAG(x) x #define IND NOUVEAU_FALLBACK_BIT @@ -448,7 +448,7 @@ static void init_rast_tab(void) #define RENDER_LINE(v0, v1) LINE(V(v0), V(v1)) #define RENDER_TRI( v0, v1, v2) TRI( V(v0), V(v1), V(v2)) #define RENDER_QUAD(v0, v1, v2, v3) QUAD(V(v0), V(v1), V(v2), V(v3)) -#define INIT(x) nv20RasterPrimitive(ctx, x, hw_prim[x]) +#define INIT(x) nv10RasterPrimitive(ctx, x, hw_prim[x]) #undef LOCAL_VARS #define LOCAL_VARS \ struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); \ @@ -517,7 +517,7 @@ static void nouveauFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLuint vertsize = nmesa->vertex_size; - nv20ExtendPrimitive(nmesa, (n - 2) * 3 * 4 * vertsize); + nv10ExtendPrimitive(nmesa, (n - 2) * 3 * 4 * vertsize); GLubyte *vertptr = (GLubyte *)nmesa->verts; const GLuint *start = (const GLuint *)V(elts[0]); int i; @@ -557,16 +557,16 @@ do { \ } while (0) -static void nv20ChooseRenderState(GLcontext *ctx) +static void nv10ChooseRenderState(GLcontext *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; GLuint index = 0; - nmesa->draw_point = nv20_draw_point; - nmesa->draw_line = nv20_draw_line; - nmesa->draw_tri = nv20_draw_triangle; + nmesa->draw_point = nv10_draw_point; + nmesa->draw_line = nv10_draw_line; + nmesa->draw_tri = nv10_draw_triangle; if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) { if (flags & DD_TRI_LIGHT_TWOSIDE) index |= NOUVEAU_TWOSIDE_BIT; @@ -617,7 +617,7 @@ static void nv20ChooseRenderState(GLcontext *ctx) -static inline void nv20OutputVertexFormat(struct nouveau_context* nmesa, GLuint index) +static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa, GLuint index) { GLcontext* ctx=nmesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -715,7 +715,7 @@ static inline void nv20OutputVertexFormat(struct nouveau_context* nmesa, GLuint } -static void nv20ChooseVertexState( GLcontext *ctx ) +static void nv10ChooseVertexState( GLcontext *ctx ) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -724,7 +724,7 @@ static void nv20ChooseVertexState( GLcontext *ctx ) if (index!=nmesa->render_inputs) { nmesa->render_inputs=index; - nv20OutputVertexFormat(nmesa,index); + nv10OutputVertexFormat(nmesa,index); } } @@ -734,13 +734,12 @@ static void nv20ChooseVertexState( GLcontext *ctx ) /**********************************************************************/ -static void nv20RenderStart(GLcontext *ctx) +static void nv10RenderStart(GLcontext *ctx) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); if (nmesa->newState) { nmesa->newRenderState |= nmesa->newState; - nouveauValidateState( ctx ); } if (nmesa->Fallback) { @@ -749,23 +748,23 @@ static void nv20RenderStart(GLcontext *ctx) } if (nmesa->newRenderState) { - nv20ChooseVertexState(ctx); - nv20ChooseRenderState(ctx); + nv10ChooseVertexState(ctx); + nv10ChooseRenderState(ctx); nmesa->newRenderState = 0; } } -static void nv20RenderFinish(GLcontext *ctx) +static void nv10RenderFinish(GLcontext *ctx) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); - nv20FinishPrimitive(nmesa); + nv10FinishPrimitive(nmesa); } /* System to flush dma and emit state changes based on the rasterized * primitive. */ -void nv20RasterPrimitive(GLcontext *ctx, +void nv10RasterPrimitive(GLcontext *ctx, GLenum glprim, GLuint hwprim) { @@ -782,9 +781,9 @@ void nv20RasterPrimitive(GLcontext *ctx, /* Callback for mesa: */ -static void nv20RenderPrimitive( GLcontext *ctx, GLuint prim ) +static void nv10RenderPrimitive( GLcontext *ctx, GLuint prim ) { - nv20RasterPrimitive( ctx, prim, hw_prim[prim] ); + nv10RasterPrimitive( ctx, prim, hw_prim[prim] ); } @@ -806,9 +805,9 @@ void nouveauInitTriFuncs(GLcontext *ctx) } tnl->Driver.RunPipeline = nouveauRunPipeline; - tnl->Driver.Render.Start = nv20RenderStart; - tnl->Driver.Render.Finish = nv20RenderFinish; - tnl->Driver.Render.PrimitiveNotify = nv20RenderPrimitive; + tnl->Driver.Render.Start = nv10RenderStart; + tnl->Driver.Render.Finish = nv10RenderFinish; + tnl->Driver.Render.PrimitiveNotify = nv10RenderPrimitive; tnl->Driver.Render.ResetLineStipple = nouveauResetLineStipple; tnl->Driver.Render.BuildVertices = _tnl_build_vertices; tnl->Driver.Render.CopyPV = _tnl_copy_pv; diff --git a/src/mesa/drivers/dri/nouveau/nv20_swtcl.h b/src/mesa/drivers/dri/nouveau/nv10_swtcl.h similarity index 87% rename from src/mesa/drivers/dri/nouveau/nv20_swtcl.h rename to src/mesa/drivers/dri/nouveau/nv10_swtcl.h index ed589d8bcf2..7b42967dd8e 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_swtcl.h +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.h @@ -26,14 +26,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. -#ifndef __NV20_SWTCL_H__ -#define __NV20_SWTCL_H__ +#ifndef __NV10_SWTCL_H__ +#define __NV10_SWTCL_H__ #include "mtypes.h" -extern void nv20TriInitFunctions( GLcontext *ctx ); -extern void nv20Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void nv10TriInitFunctions( GLcontext *ctx ); +extern void nv10Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( nmesa, bit, mode ) nouveauFallback( nmesa->glCtx, bit, mode ) -#endif /* __NV20_SWTCL_H__ */ +#endif /* __NV10_SWTCL_H__ */ -- 2.30.2