summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralanh <alanh>2003-12-09 15:33:35 +0000
committeralanh <alanh>2003-12-09 15:33:35 +0000
commit0861da665f9f5cc2387c54687327f545db823144 (patch)
treee960aa760a782681aa53803ef4e71c2c2e98ef68
parent1afc96e28e8ee6b87df0d5ba95cd624a9e12bcde (diff)
merge newmesa branch to the trunknewmesa-0-0-1-20031209-merge
-rw-r--r--xc/config/cf/host.def11
-rw-r--r--xc/extras/expat/conftools/ac_c_bigendian_cross.m42
-rwxr-xr-xxc/extras/expat/conftools/mkinstalldirs2
-rw-r--r--xc/include/GL/glxproto.h6
-rw-r--r--xc/lib/GL/GL/Imakefile58
-rw-r--r--xc/lib/GL/Imakefile10
-rw-r--r--xc/lib/GL/dri/Imakefile6
-rw-r--r--xc/lib/GL/dri/dri_util.c1
-rw-r--r--xc/lib/GL/dri/dri_util.h2
-rw-r--r--xc/lib/GL/glx/Imakefile30
-rw-r--r--xc/lib/GL/glx/glxcmds.c1
-rw-r--r--xc/lib/GL/include/GL/internal/glcore.h463
-rw-r--r--xc/lib/GL/mesa/Imakefile (renamed from xc/lib/GL/mesa/src/Imakefile)18
-rw-r--r--xc/lib/GL/mesa/Imakefile.inc42
-rw-r--r--xc/lib/GL/mesa/array_cache/Imakefile (renamed from xc/lib/GL/mesa/src/array_cache/Imakefile)10
-rw-r--r--xc/lib/GL/mesa/array_cache/Imakefile.inc (renamed from xc/lib/GL/mesa/src/array_cache/Imakefile.inc)10
-rw-r--r--xc/lib/GL/mesa/drivers/dri/Imakefile (renamed from xc/lib/GL/mesa/src/drv/Imakefile)2
-rw-r--r--xc/lib/GL/mesa/drivers/dri/common/Imakefile (renamed from xc/lib/GL/mesa/src/drv/common/Imakefile)24
-rw-r--r--xc/lib/GL/mesa/drivers/dri/common/Imakefile.inc80
-rw-r--r--xc/lib/GL/mesa/drivers/dri/ffb/Imakefile (renamed from xc/lib/GL/mesa/src/drv/ffb/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc)43
-rw-r--r--xc/lib/GL/mesa/drivers/dri/gamma/Imakefile (renamed from xc/lib/GL/mesa/src/drv/gamma/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc)48
-rw-r--r--xc/lib/GL/mesa/drivers/dri/i810/Imakefile (renamed from xc/lib/GL/mesa/src/drv/i810/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/i810/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/i810/Imakefile.inc)30
-rw-r--r--xc/lib/GL/mesa/drivers/dri/i830/Imakefile (renamed from xc/lib/GL/mesa/src/drv/i830/Imakefile)27
-rw-r--r--xc/lib/GL/mesa/drivers/dri/i830/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/i830/Imakefile.inc)32
-rw-r--r--xc/lib/GL/mesa/drivers/dri/mga/Imakefile (renamed from xc/lib/GL/mesa/src/drv/mga/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/mga/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/mga/Imakefile.inc)46
-rw-r--r--xc/lib/GL/mesa/drivers/dri/r128/Imakefile (renamed from xc/lib/GL/mesa/src/drv/r128/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/r128/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/r128/Imakefile.inc)32
-rw-r--r--xc/lib/GL/mesa/drivers/dri/r200/Imakefile (renamed from xc/lib/GL/mesa/src/drv/r200/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/r200/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/r200/Imakefile.inc)37
-rw-r--r--xc/lib/GL/mesa/drivers/dri/radeon/Imakefile (renamed from xc/lib/GL/mesa/src/drv/radeon/Imakefile)29
-rw-r--r--xc/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc)42
-rw-r--r--xc/lib/GL/mesa/drivers/dri/sis/Imakefile (renamed from xc/lib/GL/mesa/src/drv/sis/Imakefile)27
-rw-r--r--xc/lib/GL/mesa/drivers/dri/sis/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/sis/Imakefile.inc)38
-rw-r--r--xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile (renamed from xc/lib/GL/mesa/src/drv/tdfx/Imakefile)27
-rw-r--r--xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc (renamed from xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc)36
-rw-r--r--xc/lib/GL/mesa/drivers/osmesa/Imakefile (renamed from xc/lib/GL/mesa/src/OSmesa/Imakefile)31
-rw-r--r--xc/lib/GL/mesa/drivers/x11/Imakefile (renamed from xc/lib/GL/mesa/src/X/Imakefile)2
-rw-r--r--xc/lib/GL/mesa/drivers/x11/Imakefile.inc (renamed from xc/lib/GL/mesa/src/X/Imakefile.inc)24
-rw-r--r--xc/lib/GL/mesa/main/Imakefile59
-rw-r--r--xc/lib/GL/mesa/main/Imakefile.inc492
-rw-r--r--xc/lib/GL/mesa/math/Imakefile (renamed from xc/lib/GL/mesa/src/math/Imakefile)14
-rw-r--r--xc/lib/GL/mesa/math/Imakefile.inc (renamed from xc/lib/GL/mesa/src/math/Imakefile.inc)34
-rw-r--r--xc/lib/GL/mesa/sparc/Imakefile (renamed from xc/lib/GL/mesa/src/SPARC/Imakefile)0
-rw-r--r--xc/lib/GL/mesa/sparc/Imakefile.inc (renamed from xc/lib/GL/mesa/src/SPARC/Imakefile.inc)12
-rw-r--r--xc/lib/GL/mesa/src/Imakefile.inc495
-rw-r--r--xc/lib/GL/mesa/src/OSmesa/OSMesa-def.cpp29
-rw-r--r--xc/lib/GL/mesa/src/drv/common/Imakefile.inc72
-rw-r--r--xc/lib/GL/mesa/src/drv/common/depthtmp.h176
-rw-r--r--xc/lib/GL/mesa/src/drv/common/hwlog.c134
-rw-r--r--xc/lib/GL/mesa/src/drv/common/hwlog.h101
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mm.c196
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mm.h82
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mmx.h560
-rw-r--r--xc/lib/GL/mesa/src/drv/common/spantmp.h259
-rw-r--r--xc/lib/GL/mesa/src/drv/common/stenciltmp.h147
-rw-r--r--xc/lib/GL/mesa/src/drv/common/texmem.c1235
-rw-r--r--xc/lib/GL/mesa/src/drv/common/texmem.h295
-rw-r--r--xc/lib/GL/mesa/src/drv/common/utils.c183
-rw-r--r--xc/lib/GL/mesa/src/drv/common/utils.h54
-rw-r--r--xc/lib/GL/mesa/src/drv/common/vblank.c350
-rw-r--r--xc/lib/GL/mesa/src/drv/common/vblank.h64
-rw-r--r--xc/lib/GL/mesa/src/drv/common/xmlconfig.c858
-rw-r--r--xc/lib/GL/mesa/src/drv/common/xmlconfig.h125
-rw-r--r--xc/lib/GL/mesa/src/drv/common/xmlpool.h258
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c156
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c354
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h9
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_context.h309
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c116
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c214
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h28
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_fog.c73
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c112
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h18
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h81
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h33
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_points.c94
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_points.h15
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h55
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h648
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_span.c142
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_span.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_state.c1247
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_state.h13
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c221
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c51
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h34
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c946
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h29
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h239
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c241
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h45
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h177
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c429
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c593
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h30
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_client.h6185
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_context.c209
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_context.h405
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c128
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c551
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c59
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_lock.h88
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h328
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h659
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_render.c316
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c142
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_screen.h30
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_span.c342
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_state.c1734
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c427
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c535
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c216
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c653
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tris.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tritmp.h495
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c380
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_vb.h60
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c286
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h636
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810context.c532
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810context.h256
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810ioctl.c510
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810ioctl.h49
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810render.c214
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810screen.c278
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810screen.h99
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810span.c170
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810span.h6
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810state.c1019
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810state.h15
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tex.c543
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tex.h78
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810texmem.c178
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810texstate.c746
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tris.c867
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tris.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810vb.c505
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810vb.h62
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h675
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_context.c588
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_context.h310
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_debug.c377
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_debug.h48
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c841
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h105
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_render.c267
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_screen.c361
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_screen.h107
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_span.c370
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_span.h46
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_state.c1799
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_state.h68
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tex.c578
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tex.h71
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_texmem.c214
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_texstate.c1582
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tris.c880
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tris.h37
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_vb.c592
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_vb.h63
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_texcombine.c672
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_texstate.c901
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c791
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h152
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgacontext.h375
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadd.c97
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadd.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.c677
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.h114
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgapixel.c656
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgapixel.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaregs.h1395
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgarender.c207
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaspan.c313
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaspan.h34
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgastate.c1239
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgastate.h39
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.c549
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.h51
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatexmem.c278
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatris.c906
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatris.h52
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgavb.c497
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgavb.h65
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.c370
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.h272
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_dd.c148
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_dd.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c810
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h146
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_lock.c123
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_lock.h111
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_screen.c368
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_screen.h88
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_span.c475
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_span.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_state.c1239
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_state.h54
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tex.c612
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tex.h88
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_texmem.c302
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_texobj.h69
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_texstate.c646
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tris.c721
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tris.h48
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_vb.c525
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_vb.h74
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c337
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_context.c634
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_context.h931
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c923
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h191
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_lock.c118
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_lock.h112
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos.c12
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos.h47
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c503
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h378
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c339
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_pixel.c492
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_pixel.h43
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_reg.h1438
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_sanity.c1324
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_sanity.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_screen.c468
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_screen.h103
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_span.c432
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_span.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_state.c2202
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_state.h69
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_state_init.c706
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c1290
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h80
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tcl.c542
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tcl.h67
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tex.c1018
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tex.h50
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_texmem.c504
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_texstate.c1780
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c1124
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h126
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c900
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c230
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c437
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S492
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_context.c622
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_context.h845
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c1179
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h188
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c127
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h113
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos.c12
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h47
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c591
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h368
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c335
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c1042
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c442
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h107
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_span.c415
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_span.h45
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_state.c2187
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_state.h77
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c552
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c1254
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h77
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c527
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h70
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c748
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h53
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c377
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c1605
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c1089
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h124
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c905
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c232
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c437
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S492
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_alloc.c249
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_alloc.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_clear.c448
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_common2.h142
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_context.c524
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_context.h439
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_dd.c176
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_dd.h42
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_debug.c156
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_debug.h45
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_fog.c190
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_lock.c76
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_lock.h87
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_reg.h858
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_screen.c277
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_screen.h62
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_span.c311
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_span.h40
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_state.c884
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_state.h57
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_stencil.c185
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_stencil.h40
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_tex.c472
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_tex.h41
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_texstate.c672
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_tris.c954
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_tris.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_tritmp.h150
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_vb.c463
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_vb.h62
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/BUGS64
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S84
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h314
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h63
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c897
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h1027
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c330
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h47
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h606
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c90
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h149
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c689
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h80
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c802
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h54
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c331
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h73
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c1399
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h48
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c1466
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h64
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c1473
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h165
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c970
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h84
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c2107
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c1258
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h42
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c365
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h68
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h442
-rw-r--r--xc/lib/GL/mesa/src/tnl/Imakefile.inc152
-rw-r--r--xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc38
-rw-r--r--xc/lib/GL/mesa/swrast/Imakefile (renamed from xc/lib/GL/mesa/src/swrast/Imakefile)18
-rw-r--r--xc/lib/GL/mesa/swrast/Imakefile.inc (renamed from xc/lib/GL/mesa/src/swrast/Imakefile.inc)100
-rw-r--r--xc/lib/GL/mesa/swrast_setup/Imakefile (renamed from xc/lib/GL/mesa/src/swrast_setup/Imakefile)18
-rw-r--r--xc/lib/GL/mesa/swrast_setup/Imakefile.inc (renamed from xc/lib/GL/mesa/src/swrast_setup/Imakefile.inc)16
-rw-r--r--xc/lib/GL/mesa/tnl/Imakefile (renamed from xc/lib/GL/mesa/src/tnl/Imakefile)20
-rw-r--r--xc/lib/GL/mesa/tnl/Imakefile.inc143
-rw-r--r--xc/lib/GL/mesa/tnl_dd/Imakefile (renamed from xc/lib/GL/mesa/src/tnl_dd/Imakefile)32
-rw-r--r--xc/lib/GL/mesa/tnl_dd/Imakefile.inc40
-rw-r--r--xc/lib/GL/mesa/x86/Imakefile (renamed from xc/lib/GL/mesa/src/X86/Imakefile)15
-rw-r--r--xc/lib/GL/mesa/x86/Imakefile.inc (renamed from xc/lib/GL/mesa/src/X86/Imakefile.inc)46
-rw-r--r--xc/programs/Xserver/GL/dri/Imakefile6
-rw-r--r--xc/programs/Xserver/GL/glx/Imakefile2
-rw-r--r--xc/programs/Xserver/GL/mesa/GLcore/Imakefile41
-rw-r--r--xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile42
-rw-r--r--xc/programs/Xserver/GL/mesa/Imakefile43
-rw-r--r--xc/programs/Xserver/GL/mesa/X/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/X/Imakefile)11
-rw-r--r--xc/programs/Xserver/GL/mesa/X/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/X/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glx.c (renamed from xc/programs/Xserver/GL/mesa/src/X/xf86glx.c)4
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glx_util.c (renamed from xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c)0
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glx_util.h (renamed from xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h)0
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glxint.h (renamed from xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h)0
-rw-r--r--xc/programs/Xserver/GL/mesa/array_cache/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile)12
-rw-r--r--xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/GL/mesa/main/Imakefile54
-rw-r--r--xc/programs/Xserver/GL/mesa/main/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/math/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/GL/mesa/math/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/math/Imakefile)10
-rw-r--r--xc/programs/Xserver/GL/mesa/math/module/Imakefile6
-rw-r--r--xc/programs/Xserver/GL/mesa/src/Imakefile52
-rw-r--r--xc/programs/Xserver/GL/mesa/src/module/Imakefile6
-rw-r--r--xc/programs/Xserver/GL/mesa/swrast/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/swrast/Imakefile)12
-rw-r--r--xc/programs/Xserver/GL/mesa/swrast/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile)10
-rw-r--r--xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/GL/mesa/tnl/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/tnl/Imakefile)14
-rw-r--r--xc/programs/Xserver/GL/mesa/tnl/module/Imakefile (renamed from xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile)0
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h1
390 files changed, 1772 insertions, 124031 deletions
diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def
index eca7234eb..eef062296 100644
--- a/xc/config/cf/host.def
+++ b/xc/config/cf/host.def
@@ -4,6 +4,9 @@
*/
#define XFree86CustomVersion "DRI trunk"
+/* You need this now */
+#define MesaSrcDir /X11R6/SourceForge/Mesanew/Mesa-newtree
+
/* Don't use any special flags by default, but leave this here commented out
* so people see how to if they want
@@ -32,7 +35,7 @@
#elif defined(i386Architecture)
#define XF86CardDrivers tdfx i810 mga ati glint vga sis
-#define DriDrivers r200 tdfx mga i810 r128 radeon gamma i830 ffb sis
+#define DriDrivers r200 mga i810 r128 radeon gamma i830 sis tdfx ffb
#else
@@ -91,8 +94,10 @@
#define XnestServer NO
#define XVirtualFramebufferServer NO
-/* we don't have libexpat sources in DRI CVS, so assume that it's installed */
-#define HasExpat YES
+/* we do have libexpat sources in DRI CVS and want to build static to
+ * link with libGL to isolate link problems with systems that don't have it */
+#define HasExpat NO
+#define NormalLibExpat YES
/*
* Don't change anything below or the build will fail.
diff --git a/xc/extras/expat/conftools/ac_c_bigendian_cross.m4 b/xc/extras/expat/conftools/ac_c_bigendian_cross.m4
index f68c1086f..0b913fbbf 100644
--- a/xc/extras/expat/conftools/ac_c_bigendian_cross.m4
+++ b/xc/extras/expat/conftools/ac_c_bigendian_cross.m4
@@ -7,7 +7,7 @@ dnl The implementation will create a binary, and instead of running
dnl the binary it will be grep'ed for some symbols that will look
dnl different for different endianess of the binary.
dnl
-dnl @version $Id: ac_c_bigendian_cross.m4,v 1.1 2003/12/08 22:02:49 alanh Exp $
+dnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2003/12/09 15:33:35 alanh Exp $
dnl @author Guido Draheim <guidod@gmx.de>
dnl
AC_DEFUN([AC_C_BIGENDIAN_CROSS],
diff --git a/xc/extras/expat/conftools/mkinstalldirs b/xc/extras/expat/conftools/mkinstalldirs
index df86ba918..83da42cbe 100755
--- a/xc/extras/expat/conftools/mkinstalldirs
+++ b/xc/extras/expat/conftools/mkinstalldirs
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.1 2003/12/08 22:02:49 alanh Exp $
+# $Id: mkinstalldirs,v 1.2 2003/12/09 15:33:35 alanh Exp $
errstatus=0
diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h
index 39ff22d84..169564a36 100644
--- a/xc/include/GL/glxproto.h
+++ b/xc/include/GL/glxproto.h
@@ -74,9 +74,15 @@
#define __GLX_MAX_CONTEXT_PROPS 3
+#ifndef GLX_VENDOR
#define GLX_VENDOR 0x1
+#endif
+#ifndef GLX_VERSION
#define GLX_VERSION 0x2
+#endif
+#ifndef GLX_EXTENSIONS
#define GLX_EXTENSIONS 0x3
+#endif
/*****************************************************************************/
diff --git a/xc/lib/GL/GL/Imakefile b/xc/lib/GL/GL/Imakefile
index 3a7baf6d9..cbbb6d0e2 100644
--- a/xc/lib/GL/GL/Imakefile
+++ b/xc/lib/GL/GL/Imakefile
@@ -21,18 +21,18 @@ XCOMM $XFree86: xc/lib/GL/GL/Imakefile,v 1.18 2003/06/30 01:45:10 torrey Exp $
BASEREQUIREDLIBS = SharedGLReqs
#endif
-#include "../mesa/src/array_cache/Imakefile.inc"
-#include "../mesa/src/math/Imakefile.inc"
-#include "../mesa/src/swrast/Imakefile.inc"
-#include "../mesa/src/swrast_setup/Imakefile.inc"
-#include "../mesa/src/tnl/Imakefile.inc"
-#include "../mesa/src/tnl_dd/Imakefile.inc"
-#include "../mesa/src/Imakefile.inc"
+#include "../mesa/array_cache/Imakefile.inc"
+#include "../mesa/math/Imakefile.inc"
+#include "../mesa/swrast/Imakefile.inc"
+#include "../mesa/swrast_setup/Imakefile.inc"
+#include "../mesa/tnl/Imakefile.inc"
+#include "../mesa/tnl_dd/Imakefile.inc"
+#include "../mesa/Imakefile.inc"
#ifdef i386Architecture
-#include "../mesa/src/X86/Imakefile.inc"
+#include "../mesa/x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../mesa/src/SPARC/Imakefile.inc"
+#include "../mesa/sparc/Imakefile.inc"
#endif
XCOMM
@@ -72,7 +72,7 @@ NormalLintTarget($(PROFSRC))
MESAPOBJS = $(COREMESAPOBJS) $(MESA_ASM_POBJS)
#if GlxUseBuiltInDRIDriver
-#include "../mesa/src/drv/common/Imakefile.inc"
+#include "../mesa/drivers/dri/common/Imakefile.inc"
#endif
@@ -82,8 +82,8 @@ XCOMM nothing
#elif GlxBuiltInGamma
-#define MesaDrvGammaBuildDir $(GLXLIBSRC)/mesa/src/drv/gamma/
-#include "../mesa/src/drv/gamma/Imakefile.inc"
+#define MesaDrvGammaBuildDir $(GLXLIBSRC)/mesa/drivers/dri/gamma/
+#include "../mesa/drivers/dri/gamma/Imakefile.inc"
DRVOBJS = $(GAMMAOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(GAMMAUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -92,8 +92,8 @@ XCOMM nothing
#elif GlxBuiltInTdfx
-#define MesaDrvTdfxBuildDir $(GLXLIBSRC)/mesa/src/drv/tdfx/
-#include "../mesa/src/drv/tdfx/Imakefile.inc"
+#define MesaDrvTdfxBuildDir $(GLXLIBSRC)/mesa/drivers/dri/tdfx/
+#include "../mesa/drivers/dri/tdfx/Imakefile.inc"
DRVOBJS = $(TDFXOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(TDFXUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -104,8 +104,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInI810
-#define MesaDrvI810BuildDir $(GLXLIBSRC)/mesa/src/drv/i810/
-#include "../mesa/src/drv/i810/Imakefile.inc"
+#define MesaDrvI810BuildDir $(GLXLIBSRC)/mesa/drivers/dri/i810/
+#include "../mesa/drivers/dri/i810/Imakefile.inc"
DRVOBJS = $(I810OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(I810UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -113,8 +113,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
DRVPOBJS = $(I810POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRMPOBJS)
#elif GlxBuiltInI830
-#define MesaDrvI830BuildDir $(GLXLIBSRC)/mesa/src/drv/i830/
-#include "../mesa/src/drv/i830/Imakefile.inc"
+#define MesaDrvI830BuildDir $(GLXLIBSRC)/mesa/drivers/dri/i830/
+#include "../mesa/drivers/dri/i830/Imakefile.inc"
DRVOBJS = $(I830OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(I830UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -123,8 +123,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInMga
-#define MesaDrvMgaBuildDir $(GLXLIBSRC)/mesa/src/drv/mga/
-#include "../mesa/src/drv/mga/Imakefile.inc"
+#define MesaDrvMgaBuildDir $(GLXLIBSRC)/mesa/drivers/dri/mga/
+#include "../mesa/drivers/dri/mga/Imakefile.inc"
DRVOBJS = $(MGAOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(MGAUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -133,8 +133,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInR128
-#define MesaDrvR128BuildDir $(GLXLIBSRC)/mesa/src/drv/r128/
-#include "../mesa/src/drv/r128/Imakefile.inc"
+#define MesaDrvR128BuildDir $(GLXLIBSRC)/mesa/drivers/dri/r128/
+#include "../mesa/drivers/dri/r128/Imakefile.inc"
DRVOBJS = $(R128OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(R128UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -143,8 +143,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInRadeon
-#define MesaDrvRadeonBuildDir $(GLXLIBSRC)/mesa/src/drv/radeon/
-#include "../mesa/src/drv/radeon/Imakefile.inc"
+#define MesaDrvRadeonBuildDir $(GLXLIBSRC)/mesa/drivers/dri/radeon/
+#include "../mesa/drivers/dri/radeon/Imakefile.inc"
DRVOBJS = $(RADEONOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(RADEONUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -153,8 +153,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInFfb
-#define MesaDrvFfbBuildDir $(GLXLIBSRC)/mesa/src/drv/ffb/
-#include "../mesa/src/drv/ffb/Imakefile.inc"
+#define MesaDrvFfbBuildDir $(GLXLIBSRC)/mesa/drivers/dri/ffb/
+#include "../mesa/drivers/dri/ffb/Imakefile.inc"
DRVOBJS = $(FFBOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(FFBUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -163,8 +163,8 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInSIS
-#define MesaDrvSisBuildDir $(GLXLIBSRC)/mesa/src/drv/sis/
-#include "../mesa/src/drv/sis/Imakefile.inc"
+#define MesaDrvSisBuildDir $(GLXLIBSRC)/mesa/drivers/dri/sis/
+#include "../mesa/drivers/dri/sis/Imakefile.inc"
DRVOBJS = $(SISOBJS) $(MESAOBJS) $(DRMOBJS)
DRVUOBJS = $(SISUOBJS) $(MESAUOBJS) $(DRMUOBJS)
@@ -173,7 +173,7 @@ OTHERREQUIREDLIBS = -lglide3 -ldl
#elif GlxBuiltInXMesa
-#include "../mesa/src/X/Imakefile.inc"
+#include "../mesa/drivers/x11/Imakefile.inc"
DRVOBJS = $(MESAOBJS) $(XMESA_OBJS)
DRVUOBJS = $(MESAUOBJS) $(XMESA_UOBJS)
diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile
index 754cc9a83..896144370 100644
--- a/xc/lib/GL/Imakefile
+++ b/xc/lib/GL/Imakefile
@@ -71,7 +71,7 @@ LIBGLBUILDDIR = GL
#if BuildOSMesaLib || \
(BuildXF86DRI && \
(defined(DriDrivers) || GlxDriverUsesMesa || GlxBuiltInXMesa))
- MESADIRS = mesa/src
+ MESADIRS = mesa
#endif
/*
@@ -79,7 +79,7 @@ LIBGLBUILDDIR = GL
* BuildOSMesaLib
*/
#if BuildOSMesaLib
- OSMESADIRS = mesa/src/OSmesa
+ OSMESADIRS = mesa/drivers/osmesa
#endif
/*
@@ -95,11 +95,7 @@ LIBGLBUILDDIR = GL
* BuildXF86DRI && defined(DriDrivers)
*/
#if BuildXF86DRI && defined(DriDrivers)
- DRIVERDIRS = mesa/src/drv
-#endif
-
-#if defined(DarwinArchitecture) && BuildAppleDRI
- DRIDIRS = apple
+ DRIVERDIRS = mesa/drivers/dri
#endif
/*
diff --git a/xc/lib/GL/dri/Imakefile b/xc/lib/GL/dri/Imakefile
index ffd57a382..a3a817812 100644
--- a/xc/lib/GL/dri/Imakefile
+++ b/xc/lib/GL/dri/Imakefile
@@ -17,10 +17,12 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#if !GlxUseSGISI
DRI_SRCS = dri_glx.c
DRI_OBJS = dri_glx.o
- DRI_INCS = -I. -I$(GLXLIBSRC)/glx -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \
+ DRI_INCS = -I. -I$(GLXLIBSRC)/glx \
-I$(XINCLUDESRC) -I$(SERVERSRC)/GL/dri \
-I$(GLXLIBSRC)/include \
- -I$(MESASRCDIR)/include -I$(MESASRCDIR)/src
+ -I$(MESASRCDIR)/include \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi
#endif
#if GlxUseBuiltInDRIDriver
diff --git a/xc/lib/GL/dri/dri_util.c b/xc/lib/GL/dri/dri_util.c
index 23da96bb9..ebfa6e561 100644
--- a/xc/lib/GL/dri/dri_util.c
+++ b/xc/lib/GL/dri/dri_util.c
@@ -26,7 +26,6 @@
#include <Xext.h>
#include <extutil.h>
#include <stdio.h>
-#include "glxclient.h"
#include "xf86dri.h"
#include "sarea.h"
#include "dri_util.h"
diff --git a/xc/lib/GL/dri/dri_util.h b/xc/lib/GL/dri/dri_util.h
index e82cf0f8e..88f6db9d1 100644
--- a/xc/lib/GL/dri/dri_util.h
+++ b/xc/lib/GL/dri/dri_util.h
@@ -55,6 +55,8 @@
#include <inttypes.h>
#include "glxclient.h" /* for GLXDrawable */
+/* temporary */
+typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
#include "xf86dri.h" /* for XF86DRIClipRectPtr */
#include "sarea.h" /* for XF86DRISAREAPtr */
#include "GL/internal/glcore.h" /* for __GLcontextModes */
diff --git a/xc/lib/GL/glx/Imakefile b/xc/lib/GL/glx/Imakefile
index 43ba12143..041672a29 100644
--- a/xc/lib/GL/glx/Imakefile
+++ b/xc/lib/GL/glx/Imakefile
@@ -33,13 +33,13 @@ XCOMM glw
# Files from Mesa
-LinkSourceFile(glapi.c, $(MESASRCDIR)/src)
-LinkSourceFile(glthread.c, $(MESASRCDIR)/src)
-#if defined(i386Architecture)
-LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86)
+LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi)
+LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi)
+#ifdef i386Architecture
+LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/mesa/x86)
#endif
-#if defined(SparcArchitecture) && !defined(OpenBSDArchitecture)
-LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC)
+#ifdef SparcArchitecture
+LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/mesa/sparc)
#endif
@@ -97,10 +97,10 @@ LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC)
GLX_DEFS = GlxDefines
#ifdef i386Architecture
- ASM_DIR = X86
+ ASM_DIR = x86
#endif
#ifdef SparcArchitecture
- ASM_DIR = SPARC
+ ASM_DIR = sparc
#endif
#if BuildXF86DRI
@@ -125,16 +125,14 @@ LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC)
OBJS = $(GLX_OBJS) $(ASM_OBJS)
DEFINES = $(GLX_DEFS) $(ASM_DEFS) $(XMESA_DEFINES)
- INCLUDES = -I$(INCLUDESRC) \
- -I$(XINCLUDESRC) \
+ INCLUDES = -I$(XINCLUDESRC) \
+ -I$(MESASRCDIR)/include \
-I$(EXTINCSRC) \
- -I$(INCLUDESRC)/GL \
-I$(GLXLIBSRC)/glx \
- -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/X \
- -I$(MESASRCDIR)/src/$(ASM_DIR) \
- -I$(MESASRCDIR)/include \
- -I$(GLXLIBSRC)/include \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/drivers/x11 \
+ -I$(MESASRCDIR)/src/mesa/$(ASM_DIR) \
$(DRI_INCS)
#include <Library.tmpl>
diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c
index 5178f7071..3256d5e8d 100644
--- a/xc/lib/GL/glx/glxcmds.c
+++ b/xc/lib/GL/glx/glxcmds.c
@@ -41,7 +41,6 @@
#include <inttypes.h>
#include "packsingle.h"
-#include "glxclient.h"
#include <extutil.h>
#include <Xext.h>
#include <assert.h>
diff --git a/xc/lib/GL/include/GL/internal/glcore.h b/xc/lib/GL/include/GL/internal/glcore.h
deleted file mode 100644
index 4c9c637af..000000000
--- a/xc/lib/GL/include/GL/internal/glcore.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.10 2003/06/30 01:45:11 torrey Exp $ */
-#ifndef __gl_core_h_
-#define __gl_core_h_
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-**
-*/
-
-#ifndef XFree86LOADER
-#include <sys/types.h>
-#endif
-
-#ifdef CAPI
-#undef CAPI
-#endif
-#define CAPI
-
-#define GL_CORE_SGI 1
-#define GL_CORE_MESA 2
-#define GL_CORE_APPLE 4
-
-typedef struct __GLcontextRec __GLcontext;
-typedef struct __GLinterfaceRec __GLinterface;
-
-/*
-** This file defines the interface between the GL core and the surrounding
-** "operating system" that supports it (currently the GLX or WGL extensions).
-**
-** Members (data and function pointers) are documented as imported or
-** exported according to how they are used by the core rendering functions.
-** Imported members are initialized by the "operating system" and used by
-** the core functions. Exported members are initialized by the core functions
-** and used by the "operating system".
-*/
-
-/*
-** Mode and limit information for a context. This information is
-** kept around in the context so that values can be used during
-** command execution, and for returning information about the
-** context to the application.
-*/
-typedef struct __GLcontextModesRec {
- struct __GLcontextModesRec * next;
-
- GLboolean rgbMode;
- GLboolean floatMode;
- GLboolean colorIndexMode;
- GLuint doubleBufferMode;
- GLuint stereoMode;
-
- GLboolean haveAccumBuffer;
- GLboolean haveDepthBuffer;
- GLboolean haveStencilBuffer;
-
- GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
- GLuint redMask, greenMask, blueMask, alphaMask;
- GLint rgbBits; /* total bits for rgb */
- GLint indexBits; /* total bits for colorindex */
-
- GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
- GLint depthBits;
- GLint stencilBits;
-
- GLint numAuxBuffers;
-
- GLint level;
-
- GLint pixmapMode;
-
- /* GLX */
- GLint visualID;
- GLint visualType; /**< One of the GLX X visual types. (i.e.,
- * \c GLX_TRUE_COLOR, etc.)
- */
-
- /* EXT_visual_rating / GLX 1.2 */
- GLint visualRating;
-
- /* EXT_visual_info / GLX 1.2 */
- GLint transparentPixel;
- /* colors are floats scaled to ints */
- GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
- GLint transparentIndex;
-
- /* ARB_multisample / SGIS_multisample */
- GLint sampleBuffers;
- GLint samples;
-
- /* SGIX_fbconfig / GLX 1.3 */
- GLint drawableType;
- GLint renderType;
- GLint xRenderable;
- GLint fbconfigID;
-
- /* SGIX_pbuffer / GLX 1.3 */
- GLint maxPbufferWidth;
- GLint maxPbufferHeight;
- GLint maxPbufferPixels;
- GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
- GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
-
- /* SGIX_visual_select_group */
- GLint visualSelectGroup;
-
- /* OML_swap_method */
- GLint swapMethod;
-
- GLint screen;
-} __GLcontextModes;
-
-/************************************************************************/
-
-/*
-** Structure used for allocating and freeing drawable private memory.
-** (like software buffers, for example).
-**
-** The memory allocation routines are provided by the surrounding
-** "operating system" code, and they are to be used for allocating
-** software buffers and things which are associated with the drawable,
-** and used by any context which draws to that drawable. There are
-** separate memory allocation functions for drawables and contexts
-** since drawables and contexts can be created and destroyed independently
-** of one another, and the "operating system" may want to use separate
-** allocation arenas for each.
-**
-** The freePrivate function is filled in by the core routines when they
-** allocates software buffers, and stick them in "private". The freePrivate
-** function will destroy anything allocated to this drawable (to be called
-** when the drawable is destroyed).
-*/
-typedef struct __GLdrawableRegionRec __GLdrawableRegion;
-typedef struct __GLdrawableBufferRec __GLdrawableBuffer;
-typedef struct __GLdrawablePrivateRec __GLdrawablePrivate;
-
-typedef struct __GLregionRectRec {
- /* lower left (inside the rectangle) */
- GLint x0, y0;
- /* upper right (outside the rectangle) */
- GLint x1, y1;
-} __GLregionRect;
-
-struct __GLdrawableRegionRec {
- GLint numRects;
- __GLregionRect *rects;
- __GLregionRect boundingRect;
-};
-
-/************************************************************************/
-
-/* masks for the buffers */
-#define __GL_FRONT_BUFFER_MASK 0x00000001
-#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001
-#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002
-#define __GL_BACK_BUFFER_MASK 0x00000004
-#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004
-#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008
-#define __GL_ACCUM_BUFFER_MASK 0x00000010
-#define __GL_DEPTH_BUFFER_MASK 0x00000020
-#define __GL_STENCIL_BUFFER_MASK 0x00000040
-#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i))
-
-#define __GL_ALL_BUFFER_MASK 0xffffffff
-
-/* what Resize routines return if resize resorted to fallback case */
-#define __GL_BUFFER_FALLBACK 0x10
-
-typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf,
- __GLdrawablePrivate *glPriv, GLint bits);
-typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf,
- __GLdrawablePrivate *glPriv, GLint bits,
- __GLbufFallbackInitFn back);
-
-/*
-** A drawable buffer
-**
-** This data structure describes the context side of a drawable.
-**
-** According to the spec there could be multiple contexts bound to the same
-** drawable at the same time (from different threads). In order to avoid
-** multiple-access conflicts, locks are used to serialize access. When a
-** thread needs to access (read or write) a member of the drawable, it takes
-** a lock first. Some of the entries in the drawable are treated "mostly
-** constant", so we take the freedom of allowing access to them without
-** taking a lock (for optimization reasons).
-**
-** For more details regarding locking, see buffers.h in the GL core
-*/
-struct __GLdrawableBufferRec {
- /*
- ** Buffer dimensions
- */
- GLint width, height, depth;
-
- /*
- ** Framebuffer base address
- */
- void *base;
-
- /*
- ** Framebuffer size (in bytes)
- */
- GLuint size;
-
- /*
- ** Size (in bytes) of each element in the framebuffer
- */
- GLuint elementSize;
- GLuint elementSizeLog2;
-
- /*
- ** Element skip from one scanline to the next.
- ** If the buffer is part of another buffer (for example, fullscreen
- ** front buffer), outerWidth is the width of that buffer.
- */
- GLint outerWidth;
-
- /*
- ** outerWidth * elementSize
- */
- GLint byteWidth;
-
- /*
- ** Allocation/deallocation is done based on this handle. A handle
- ** is conceptually different from the framebuffer 'base'.
- */
- void *handle;
-
- /* imported */
- GLboolean (*resize)(__GLdrawableBuffer *buf,
- GLint x, GLint y, GLuint width, GLuint height,
- __GLdrawablePrivate *glPriv, GLuint bufferMask);
- void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
- void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
- void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
- GLuint val, GLint x, GLint y, GLint w, GLint h);
- void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
-
- /* exported */
- void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
- void *private;
-
- /* private */
- void *other; /* implementation private data */
- __GLbufMainInitFn mainInit;
- __GLbufFallbackInitFn fallbackInit;
-};
-
-/*
-** The context side of the drawable private
-*/
-struct __GLdrawablePrivateRec {
- /*
- ** Drawable Modes
- */
- __GLcontextModes *modes;
-
- /*
- ** Drawable size
- */
- GLuint width, height;
-
- /*
- ** Origin in screen coordinates of the drawable
- */
- GLint xOrigin, yOrigin;
-#ifdef __GL_ALIGNED_BUFFERS
- /*
- ** Drawable offset from screen origin
- */
- GLint xOffset, yOffset;
-
- /*
- ** Alignment restriction
- */
- GLint xAlignment, yAlignment;
-#endif
- /*
- ** Should we invert the y axis?
- */
- GLint yInverted;
-
- /*
- ** Mask specifying which buffers are renderable by the hw
- */
- GLuint accelBufferMask;
-
- /*
- ** the buffers themselves
- */
- __GLdrawableBuffer frontBuffer;
- __GLdrawableBuffer backBuffer;
- __GLdrawableBuffer accumBuffer;
- __GLdrawableBuffer depthBuffer;
- __GLdrawableBuffer stencilBuffer;
-#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0)
- __GLdrawableBuffer *auxBuffer;
-#endif
-
- __GLdrawableRegion ownershipRegion;
-
- /*
- ** Lock for the drawable private structure
- */
- void *lock;
-#ifdef DEBUG
- /* lock debugging info */
- int lockRefCount;
- int lockLine[10];
- char *lockFile[10];
-#endif
-
- /* imported */
- void *(*malloc)(size_t size);
- void *(*calloc)(size_t numElem, size_t elemSize);
- void *(*realloc)(void *oldAddr, size_t newSize);
- void (*free)(void *addr);
-
- GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv,
- GLint x, GLint y, GLsizei width, GLsizei height);
- void (*setClipRect)(__GLdrawablePrivate *glPriv,
- GLint x, GLint y, GLsizei width, GLsizei height);
- void (*updateClipRegion)(__GLdrawablePrivate *glPriv);
- GLboolean (*resize)(__GLdrawablePrivate *glPriv);
- void (*getDrawableSize)(__GLdrawablePrivate *glPriv,
- GLint *x, GLint *y, GLuint *width, GLuint *height);
-
- void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc);
- void (*unlockDP)(__GLdrawablePrivate *glPriv);
-
- /* exported */
- void *private;
- void (*freePrivate)(__GLdrawablePrivate *);
-
- /* client data */
- void *other;
-};
-
-/*
-** Macros to lock/unlock the drawable private
-*/
-#if defined(DEBUG)
-#define __GL_LOCK_DP(glPriv,gc) \
- (*(glPriv)->lockDP)(glPriv,gc); \
- (glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \
- (glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \
- (glPriv)->lockRefCount++
-#define __GL_UNLOCK_DP(glPriv) \
- (glPriv)->lockRefCount--; \
- (glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \
- (glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \
- (*(glPriv)->unlockDP)(glPriv)
-#else /* DEBUG */
-#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc)
-#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv)
-#endif /* DEBUG */
-
-
-/*
-** Procedures which are imported by the GL from the surrounding
-** "operating system". Math functions are not considered part of the
-** "operating system".
-*/
-typedef struct __GLimportsRec {
- /* Memory management */
- void * (*malloc)(__GLcontext *gc, size_t size);
- void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize);
- void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize);
- void (*free)(__GLcontext *gc, void *addr);
-
- /* Error handling */
- void (*warning)(__GLcontext *gc, char *fmt);
- void (*fatal)(__GLcontext *gc, char *fmt);
-
- /* other system calls */
- char *(CAPI *getenv)(__GLcontext *gc, const char *var);
- int (CAPI *atoi)(__GLcontext *gc, const char *str);
- int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...);
- void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode);
- int (CAPI *fclose)(__GLcontext *gc, void *stream);
- int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...);
-
- /* Drawing surface management */
- __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc);
- __GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc);
-
- /* Operating system dependent data goes here */
- void *other;
-} __GLimports;
-
-/************************************************************************/
-
-/*
-** Procedures which are exported by the GL to the surrounding "operating
-** system" so that it can manage multiple GL context's.
-*/
-typedef struct __GLexportsRec {
- /* Context management (return GL_FALSE on failure) */
- GLboolean (*destroyContext)(__GLcontext *gc);
- GLboolean (*loseCurrent)(__GLcontext *gc);
- /* oldglPriv isn't used anymore, kept for backwards compatibility */
- GLboolean (*makeCurrent)(__GLcontext *gc);
- GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare);
- GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask);
- GLboolean (*forceCurrent)(__GLcontext *gc);
-
- /* Drawing surface notification callbacks */
- GLboolean (*notifyResize)(__GLcontext *gc);
- void (*notifyDestroy)(__GLcontext *gc);
- void (*notifySwapBuffers)(__GLcontext *gc);
-
- /* Dispatch table override control for external agents like libGLS */
- struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc);
- void (*beginDispatchOverride)(__GLcontext *gc);
- void (*endDispatchOverride)(__GLcontext *gc);
-} __GLexports;
-
-/************************************************************************/
-
-/*
-** This must be the first member of a __GLcontext structure. This is the
-** only part of a context that is exposed to the outside world; everything
-** else is opaque.
-*/
-struct __GLinterfaceRec {
- __GLimports imports;
- __GLexports exports;
-};
-
-extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *);
-extern void __glCoreNopDispatch(void);
-
-#endif /* __gl_core_h_ */
diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/Imakefile
index 57330df6a..72698e6e3 100644
--- a/xc/lib/GL/mesa/src/Imakefile
+++ b/xc/lib/GL/mesa/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.32 2002/11/25 14:04:50 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.30tsi Exp $
#include <Threads.tmpl>
@@ -32,17 +32,14 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#if defined(i386Architecture) && MesaUseX86Asm
#define MesaX86BuildDir /**/
-#include "X86/Imakefile.inc"
-ASM_SUBDIRS = X86
+ASM_SUBDIRS = x86
#endif
#ifdef SparcArchitecture
#define MesaSparcBuildDir /**/
-#include "SPARC/Imakefile.inc"
-ASM_SUBDIRS = SPARC
+ASM_SUBDIRS = sparc
#endif
#define MesaBuildDir /**/
#define NeedToLinkMesaSrc
-#include "Imakefile.inc"
#ifdef UseCompaqMathLibrary
MATH_DEFINES = -DCCPML
@@ -51,22 +48,17 @@ ASM_SUBDIRS = SPARC
DEFINES = $(ALLOC_DEFINES) GlxDefines \
$(MESA_ASM_DEFINES) $(MATH_DEFINES)
INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- -I$(MESASRCDIR)/src -I$(GLXLIBSRC)/dri \
+ -I$(GLXLIBSRC)/dri \
-I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include
- SRCS = $(COREMESABASESRCS)
- OBJS = $(COREMESABASEOBJS)
#include <Library.tmpl>
LibraryObjectRule()
-SubdirLibraryRule($(OBJS))
-NormalLintTarget($(SRCS))
-
#define IHaveSubdirs
#define PassCDebugFlags
-SUBDIRS = $(ASM_SUBDIRS) math array_cache swrast swrast_setup tnl /*tnl_dd*/ X
+SUBDIRS = $(ASM_SUBDIRS) array_cache main math swrast swrast_setup tnl tnl_dd
MakeSubdirs($(SUBDIRS))
diff --git a/xc/lib/GL/mesa/Imakefile.inc b/xc/lib/GL/mesa/Imakefile.inc
new file mode 100644
index 000000000..8afabfa6a
--- /dev/null
+++ b/xc/lib/GL/mesa/Imakefile.inc
@@ -0,0 +1,42 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile.inc,v 1.7tsi Exp $
+
+#ifndef MesaBuildDir
+#define MesaBuildDir $(GLXLIBSRC)/mesa/
+#endif
+
+MESABUILDDIR = MesaBuildDir
+
+COREMESASRCS = $(COREMESABASESRCS) \
+ $(MESA_AC_SRCS) \
+ $(MESA_MATH_SRCS) \
+ $(MESA_SWRAST_SRCS) \
+ $(MESA_SWR_SETUP_SRCS) \
+ $(MESA_TNL_SRCS)
+
+COREMESAOBJS = $(COREMESABASEOBJS) \
+ $(MESA_AC_OBJS) \
+ $(MESA_MATH_OBJS) \
+ $(MESA_SWRAST_OBJS) \
+ $(MESA_SWR_SETUP_OBJS) \
+ $(MESA_TNL_OBJS)
+
+COREMESAUOBJS = $(COREMESABASEUOBJS) \
+ $(MESA_AC_UOBJS) \
+ $(MESA_MATH_UOBJS) \
+ $(MESA_SWRAST_UOBJS) \
+ $(MESA_SWR_SETUP_UOBJS) \
+ $(MESA_TNL_UOBJS)
+
+COREMESADOBJS = $(COREMESABASEDOBJS) \
+ $(MESA_AC_DOBJS) \
+ $(MESA_MATH_DOBJS) \
+ $(MESA_SWRAST_DOBJS) \
+ $(MESA_SWR_SETUP_DOBJS) \
+ $(MESA_TNL_DOBJS)
+
+COREMESAPOBJS = $(COREMESABASEPOBJS) \
+ $(MESA_AC_POBJS) \
+ $(MESA_MATH_POBJS) \
+ $(MESA_SWRAST_POBJS) \
+ $(MESA_SWR_SETUP_POBJS) \
+ $(MESA_TNL_POBJS)
diff --git a/xc/lib/GL/mesa/src/array_cache/Imakefile b/xc/lib/GL/mesa/array_cache/Imakefile
index cffb06cba..13a7b333b 100644
--- a/xc/lib/GL/mesa/src/array_cache/Imakefile
+++ b/xc/lib/GL/mesa/array_cache/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/array_cache/Imakefile,v 1.9 2002/11/25 14:04:50 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/array_cache/Imakefile,v 1.8 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -41,9 +41,11 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-I$(INCLUDESRC)/GL -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/array_cache \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa \
-I$(MESASRCDIR)/include \
-I../../../include -I$(XINCLUDESRC)
diff --git a/xc/lib/GL/mesa/src/array_cache/Imakefile.inc b/xc/lib/GL/mesa/array_cache/Imakefile.inc
index d3ee37046..9a5044791 100644
--- a/xc/lib/GL/mesa/src/array_cache/Imakefile.inc
+++ b/xc/lib/GL/mesa/array_cache/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/array_cache/Imakefile.inc,v 1.2 2002/11/14 21:01:16 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/array_cache/Imakefile.inc,v 1.1tsi Exp $
#ifndef MesaACBuildDir
-#define MesaACBuildDir $(GLXLIBSRC)/mesa/src/array_cache/
+#define MesaACBuildDir $(GLXLIBSRC)/mesa/array_cache/
#endif
MESAACBUILDDIR = MesaACBuildDir
@@ -10,8 +10,10 @@ MESAACBUILDDIR = MesaACBuildDir
$(MESAACBUILDDIR)ac_import.c
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(ac_context.c, $(MESASRCDIR)/src/array_cache)
-LinkSourceFile(ac_import.c, $(MESASRCDIR)/src/array_cache)
+LinkSourceFile(acache.h, $(MESASRCDIR)/src/mesa/array_cache)
+LinkSourceFile(ac_context.c, $(MESASRCDIR)/src/mesa/array_cache)
+LinkSourceFile(ac_context.h, $(MESASRCDIR)/src/mesa/array_cache)
+LinkSourceFile(ac_import.c, $(MESASRCDIR)/src/mesa/array_cache)
#endif
MESA_AC_OBJS = $(MESAACBUILDDIR)ac_context.o \
diff --git a/xc/lib/GL/mesa/src/drv/Imakefile b/xc/lib/GL/mesa/drivers/dri/Imakefile
index 8c7068088..0bec10abd 100644
--- a/xc/lib/GL/mesa/src/drv/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.19 2001/03/23 20:56:33 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.18 2001/03/23 19:18:38 dawes Exp $
#ifdef DriDrivers
diff --git a/xc/lib/GL/mesa/src/drv/common/Imakefile b/xc/lib/GL/mesa/drivers/dri/common/Imakefile
index 0f244f73d..8580ec955 100644
--- a/xc/lib/GL/mesa/src/drv/common/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/common/Imakefile
@@ -16,22 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile,v 1.6 2001/04/03 02:29:3
#define DoProfileLib NO
#endif
+#define NeedToLinkMesaSrc
#define MesaDrvCommonBuildDir /**/
#include "Imakefile.inc"
-#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
-#endif
-#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
-#endif
-
- DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
- INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) $(EXPATINCLUDES)
+XCOMM #if defined(i386Architecture) && MesaUseX86Asm
+XCOMM #include "../../../x86/Imakefile.inc"
+XCOMM #endif
+XCOMM #ifdef SparcArchitecture
+XCOMM #include "../../../sparc/Imakefile.inc"
+XCOMM #endif
- SRCS = $(MMSRC) $(UTILSSRC) $(TEXMEMSRC) $(VBLANKSRC) $(XMLCONFIGSRC)
- OBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ) $(VBLANKOBJ) $(XMLCONFIGOBJ)
+ DEFINES = $(ALLOC_DEFINES) $(COMMON_DRI_DEFINES) $(MESA_ASM_DEFINES)
+ INCLUDES = $(COMMON_X_INCLUDES) $(COMMON_MESA_INCLUDES) \
+ $(COMMON_DRI_INCLUDES) $(COMMON_EXPATINCLUDES)
+ SRCS = $(COMMONSRCS)
+ OBJS = $(COMMONOBJS)
+
#include <Library.tmpl>
LibraryObjectRule()
diff --git a/xc/lib/GL/mesa/drivers/dri/common/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/common/Imakefile.inc
new file mode 100644
index 000000000..6a779a906
--- /dev/null
+++ b/xc/lib/GL/mesa/drivers/dri/common/Imakefile.inc
@@ -0,0 +1,80 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile.inc,v 1.3 2003/05/27 16:34:32 tsi Exp $
+
+#ifndef MesaDrvSrcDir
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
+#endif
+
+MESADRVSRCDIR = MesaDrvSrcDir
+
+#ifndef MesaDrvCommonBuildDir
+#define MesaDrvCommonBuildDir $(MESADRVSRCDIR)/common/
+#endif
+
+MESADRVCOMMONBUILDDIR = MesaDrvCommonBuildDir
+
+#if Malloc0ReturnsNull
+ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
+#endif
+
+#if BuildXF86DRI
+ COMMON_DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ COMMON_DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
+ -I$(GLXLIBSRC)/glx \
+ -I$(GLXLIBSRC)/include \
+ -I$(SERVERSRC)/GL/dri \
+ -I$(XF86OSSRC) \
+ -I$(XF86COMSRC) \
+ -I$(GLXLIBSRC)/dri/drm \
+ -I$(GLXLIBSRC)/include
+#endif
+
+COMMON_MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESADRVSRCDIR)/common \
+ -I$(MESASRCDIR)/include
+ COMMON_X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
+
+ COMMONSRCS = $(MESADRVCOMMONBUILDDIR)mm.c \
+ $(MESADRVCOMMONBUILDDIR)utils.c \
+ $(MESADRVCOMMONBUILDDIR)vblank.c \
+ $(MESADRVCOMMONBUILDDIR)texmem.c \
+ $(MESADRVCOMMONBUILDDIR)xmlconfig.c
+
+ COMMONOBJS = $(MESADRVCOMMONBUILDDIR)mm.o \
+ $(MESADRVCOMMONBUILDDIR)utils.o \
+ $(MESADRVCOMMONBUILDDIR)vblank.o \
+ $(MESADRVCOMMONBUILDDIR)texmem.o \
+ $(MESADRVCOMMONBUILDDIR)xmlconfig.o
+
+ COMMONUOBJS = $(MESADRVCOMMONBUILDDIR)unshared/mm.o \
+ $(MESADRVCOMMONBUILDDIR)unshared/utils.o \
+ $(MESADRVCOMMONBUILDDIR)unshared/vblank.o \
+ $(MESADRVCOMMONBUILDDIR)unshared/texmem.o \
+ $(MESADRVCOMMONBUILDDIR)unshared/xmlconfig.o
+
+ COMMONDOBJS = $(MESADRVCOMMONBUILDDIR)debugger/mm.o \
+ $(MESADRVCOMMONBUILDDIR)debugger/utils.o \
+ $(MESADRVCOMMONBUILDDIR)debugger/vblank.o \
+ $(MESADRVCOMMONBUILDDIR)debugger/texmem.o \
+ $(MESADRVCOMMONBUILDDIR)debugger/xmlconfig.o
+
+ COMMONPOBJS = $(MESADRVCOMMONBUILDDIR)profiled/mm.o \
+ $(MESADRVCOMMONBUILDDIR)profiled/utils.o \
+ $(MESADRVCOMMONBUILDDIR)profiled/vblank.o \
+ $(MESADRVCOMMONBUILDDIR)profiled/texmem.o \
+ $(MESADRVCOMMONBUILDDIR)profiled/xmlconfig.o
+
+#ifdef NeedToLinkMesaSrc
+LinkSourceFile(mm.c, $(MESADRVSRCDIR)/common)
+LinkSourceFile(mm.h, $(MESADRVSRCDIR)/common)
+LinkSourceFile(texmem.c, $(MESADRVSRCDIR)/common)
+LinkSourceFile(texmem.h, $(MESADRVSRCDIR)/common)
+LinkSourceFile(utils.c, $(MESADRVSRCDIR)/common)
+LinkSourceFile(utils.h, $(MESADRVSRCDIR)/common)
+LinkSourceFile(vblank.c, $(MESADRVSRCDIR)/common)
+LinkSourceFile(vblank.h, $(MESADRVSRCDIR)/common)
+LinkSourceFile(xmlconfig.c, $(MESADRVSRCDIR)/common)
+LinkSourceFile(xmlconfig.h, $(MESADRVSRCDIR)/common)
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/ffb/Imakefile b/xc/lib/GL/mesa/drivers/dri/ffb/Imakefile
index 829d59c03..b8463babd 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/ffb/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.17 2002/11/25 14:04:50 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.15 2002/02/23 00:45:48 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.17 2002/11/25 14:04:50
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) \
@@ -44,8 +47,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.17 2002/11/25 14:04:50
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -58,7 +59,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.17 2002/11/25 14:04:50
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(FFBOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc
index 5c8738c5d..527745977 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc,v 1.5 2003/05/27 16:34:32 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc,v 1.3 2002/02/22 21:32:58 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,21 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
- -I$(XF86DRIVERSRC)/ati \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(XF86OSSRC)/shared/drm/kernel \
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/ffb
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -111,17 +112,39 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#ifdef NeedToLinkMesaSrc
LinkSourceFile(ffb_bitmap.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_bitmap.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_clear.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_clear.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_context.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_dd.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_dd.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_depth.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_depth.h, $(MESADRVSRCDIR)/ffb)
/* LinkSourceFile(ffb_fog.c, $(MESADRVSRCDIR)/ffb) */
+LinkSourceFile(ffb_fifo.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_lines.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_lines.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_linetmp.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_lock.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_points.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_points.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_pointtmp.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_rendertmp.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_span.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_span.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_state.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_state.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_stencil.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_stencil.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_tex.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_tex.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_tris.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_tris.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_tritmp.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_vb.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_vb.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_vbtmp.h, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_vtxfmt.h, $(MESADRVSRCDIR)/ffb)
LinkSourceFile(ffb_xmesa.c, $(MESADRVSRCDIR)/ffb)
+LinkSourceFile(ffb_xmesa.h, $(MESADRVSRCDIR)/ffb)
#endif
diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile b/xc/lib/GL/mesa/drivers/dri/gamma/Imakefile
index 52b7aa6dc..edbd4b980 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/gamma/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.27 2002/11/25 14:04:50 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.25 2002/02/23 00:45:49 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.27 2002/11/25 14:04:5
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
@@ -44,8 +47,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.27 2002/11/25 14:04:5
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -58,7 +59,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.27 2002/11/25 14:04:5
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(GAMMAOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc
index 05d749ebc..ccc81a94e 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc,v 1.4 2003/05/27 16:34:33 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,22 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/glint \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/gamma
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -111,11 +113,27 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVGAMMABUILDDIR)profiled/gamma_xmesa.o
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(gamma_gl.c, $(MESADRVSRCDIR)/gamma)
-LinkSourceFile(gamma_xmesa.c, $(MESADRVSRCDIR)/gamma)
-LinkSourceFile(gamma_init.c, $(MESADRVSRCDIR)/gamma)
-LinkSourceFile(gamma_matrix.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_context.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_context.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_client.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_dd.c, $(MESADRVSRCDIR)/gamma)
LinkSourceFile(gamma_inithw.c, $(MESADRVSRCDIR)/gamma)
-LinkSourceFile(gamma_texture.c, $(MESADRVSRCDIR)/gamma)
-LinkSourceFile(gamma_dlist.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_lock.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_lock.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_macros.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_render.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_regs.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_screen.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_screen.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_span.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_state.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_tex.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_texmem.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_texstate.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_tris.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_tris.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_tritmp.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_vb.c, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_vb.h, $(MESADRVSRCDIR)/gamma)
+LinkSourceFile(gamma_xmesa.c, $(MESADRVSRCDIR)/gamma)
#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile b/xc/lib/GL/mesa/drivers/dri/i810/Imakefile
index d66b44935..bfa7bd339 100644
--- a/xc/lib/GL/mesa/src/drv/i810/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/i810/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.25 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.23tsi Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.25 2002/11/25 14:04:51
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
@@ -44,8 +47,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.25 2002/11/25 14:04:51
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -58,7 +59,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.25 2002/11/25 14:04:51
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(I810OBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/i810/Imakefile.inc
index 65805c4e3..e133cb937 100644
--- a/xc/lib/GL/mesa/src/drv/i810/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/i810/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile.inc,v 1.4 2003/05/27 16:34:33 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,22 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/i810 \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/i810
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -95,16 +97,24 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVI810BUILDDIR)profiled/i810vb.o
#ifdef NeedToLinkMesaSrc
+LinkSourceFile(i810_3d_reg.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810context.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810context.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810ioctl.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810ioctl.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810render.c, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810screen.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810screen.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810span.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810span.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810state.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810state.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810tex.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810tex.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810texmem.c, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810texstate.c, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810tris.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810tris.h, $(MESADRVSRCDIR)/i810)
LinkSourceFile(i810vb.c, $(MESADRVSRCDIR)/i810)
+LinkSourceFile(i810vb.h, $(MESADRVSRCDIR)/i810)
#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/i830/Imakefile b/xc/lib/GL/mesa/drivers/dri/i830/Imakefile
index 9413bf7fd..2507397b1 100644
--- a/xc/lib/GL/mesa/src/drv/i830/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/i830/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile,v 1.7 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile,v 1.5tsi Exp $
#include <Threads.tmpl>
@@ -16,18 +16,21 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile,v 1.7 2002/11/25 14:04:51
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
@@ -41,8 +44,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile,v 1.7 2002/11/25 14:04:51
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -55,7 +56,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile,v 1.7 2002/11/25 14:04:51
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(I830OBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/i830/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/i830/Imakefile.inc
index ba49bb66d..de97b2880 100644
--- a/xc/lib/GL/mesa/src/drv/i830/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/i830/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile.inc,v 1.3 2003/05/27 16:34:33 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i830/Imakefile.inc,v 1.1 2001/10/04 18:28:21 alanh Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,23 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
- -I$(GLXLIBSRC)/dri \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/i810 \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
+ -I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/i830
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -99,17 +102,26 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVI830BUILDDIR)profiled/i830_vb.o
#ifdef NeedToLinkMesaSrc
+LinkSourceFile(i830_3d_reg.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_context.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_context.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_debug.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_debug.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_ioctl.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_ioctl.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_render.c, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_screen.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_screen.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_span.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_span.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_state.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_state.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_tex.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_tex.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_texmem.c, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_texstate.c, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_tris.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_tris.h, $(MESADRVSRCDIR)/i830)
LinkSourceFile(i830_vb.c, $(MESADRVSRCDIR)/i830)
+LinkSourceFile(i830_vb.h, $(MESADRVSRCDIR)/i830)
#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/drivers/dri/mga/Imakefile
index db8117ead..c385705fd 100644
--- a/xc/lib/GL/mesa/src/drv/mga/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/mga/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.24 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.22 2002/02/23 00:45:50 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.24 2002/11/25 14:04:51
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
@@ -45,8 +48,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.24 2002/11/25 14:04:51
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ) $(VBLANKOBJ) $(XMLCONFIGOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -59,7 +60,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.24 2002/11/25 14:04:51
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(MGAOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/mga/Imakefile.inc
index 54844ddc1..50ac1062c 100644
--- a/xc/lib/GL/mesa/src/drv/mga/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/mga/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile.inc,v 1.4 2003/05/27 16:34:33 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/src/drv
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,22 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/mga \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/mga
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -41,9 +43,9 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVMGABUILDDIR)mgaspan.c \
$(MESADRVMGABUILDDIR)mgastate.c \
$(MESADRVMGABUILDDIR)mgatex.c \
+ $(MESADRVMGABUILDDIR)mga_texcombine.c \
$(MESADRVMGABUILDDIR)mgatexmem.c \
$(MESADRVMGABUILDDIR)mga_texstate.c \
- $(MESADRVMGABUILDDIR)mga_texcombine.c \
$(MESADRVMGABUILDDIR)mgatris.c \
$(MESADRVMGABUILDDIR)mgavb.c \
$(MESADRVMGABUILDDIR)mga_xmesa.c \
@@ -55,9 +57,9 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVMGABUILDDIR)mgaspan.o \
$(MESADRVMGABUILDDIR)mgastate.o \
$(MESADRVMGABUILDDIR)mgatex.o \
+ $(MESADRVMGABUILDDIR)mga_texcombine.o \
$(MESADRVMGABUILDDIR)mgatexmem.o \
$(MESADRVMGABUILDDIR)mga_texstate.o \
- $(MESADRVMGABUILDDIR)mga_texcombine.o \
$(MESADRVMGABUILDDIR)mgatris.o \
$(MESADRVMGABUILDDIR)mgavb.o \
$(MESADRVMGABUILDDIR)mga_xmesa.o
@@ -69,9 +71,9 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVMGABUILDDIR)unshared/mgaspan.o \
$(MESADRVMGABUILDDIR)unshared/mgastate.o \
$(MESADRVMGABUILDDIR)unshared/mgatex.o \
+ $(MESADRVMGABUILDDIR)unshared/mga_texcombine.o \
$(MESADRVMGABUILDDIR)unshared/mgatexmem.o \
$(MESADRVMGABUILDDIR)unshared/mga_texstate.o \
- $(MESADRVMGABUILDDIR)unshared/mga_texcombine.o \
$(MESADRVMGABUILDDIR)unshared/mgatris.o \
$(MESADRVMGABUILDDIR)unshared/mgavb.o \
$(MESADRVMGABUILDDIR)unshared/mga_xmesa.o
@@ -83,9 +85,9 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVMGABUILDDIR)debugger/mgaspan.o \
$(MESADRVMGABUILDDIR)debugger/mgastate.o \
$(MESADRVMGABUILDDIR)debugger/mgatex.o \
+ $(MESADRVMGABUILDDIR)debugger/mga_texcombine.o \
$(MESADRVMGABUILDDIR)debugger/mgatexmem.o \
$(MESADRVMGABUILDDIR)debugger/mga_texstate.o \
- $(MESADRVMGABUILDDIR)debugger/mga_texcombine.o \
$(MESADRVMGABUILDDIR)debugger/mgatris.o \
$(MESADRVMGABUILDDIR)debugger/mgavb.o \
$(MESADRVMGABUILDDIR)debugger/mga_xmesa.o
@@ -97,26 +99,36 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVMGABUILDDIR)profiled/mgaspan.o \
$(MESADRVMGABUILDDIR)profiled/mgastate.o \
$(MESADRVMGABUILDDIR)profiled/mgatex.o \
+ $(MESADRVMGABUILDDIR)profiled/mga_texcombine.o \
$(MESADRVMGABUILDDIR)profiled/mgatexmem.o \
$(MESADRVMGABUILDDIR)profiled/mga_texstate.o \
- $(MESADRVMGABUILDDIR)profiled/mga_texcombine.o \
$(MESADRVMGABUILDDIR)profiled/mgatris.o \
$(MESADRVMGABUILDDIR)profiled/mgavb.o \
$(MESADRVMGABUILDDIR)profiled/mga_xmesa.o
#ifdef NeedToLinkMesaSrc
+LinkSourceFile(mgacontext.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgadd.c, $(MESADRVSRCDIR)/mga)
-LinkSourceFile(mgarender.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgadd.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgaioctl.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgaioctl.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgapixel.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgapixel.h, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgarender.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgaregs.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgaspan.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgaspan.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgastate.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgastate.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgatex.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgatex.h, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mga_texcombine.c, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgatexmem.c, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mga_texstate.c, $(MESADRVSRCDIR)/mga)
-LinkSourceFile(mga_texcombine.c, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgatris.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgatris.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mgavb.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mgavb.h, $(MESADRVSRCDIR)/mga)
LinkSourceFile(mga_xmesa.c, $(MESADRVSRCDIR)/mga)
+LinkSourceFile(mga_xmesa.h, $(MESADRVSRCDIR)/mga)
#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/drivers/dri/r128/Imakefile
index e9ee6730d..cb44cbc43 100644
--- a/xc/lib/GL/mesa/src/drv/r128/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/r128/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.21 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.19 2002/02/23 00:45:50 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.21 2002/11/25 14:04:51
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
@@ -44,8 +47,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.21 2002/11/25 14:04:51
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ) $(VBLANKOBJ) $(XMLCONFIGOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -58,7 +59,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.21 2002/11/25 14:04:51
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(R128OBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/r128/Imakefile.inc
index 9dae3dd32..96db65086 100644
--- a/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/r128/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.5 2003/05/27 16:34:33 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.3 2001/05/02 15:06:04 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,23 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
- -I$(XF86DRIVERSRC)/ati \
-I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(XF86OSSRC)/shared/drm/kernel \
+ -I$(XF86DRIVERSRC)/ati \
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/r128
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -101,15 +104,26 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#ifdef NeedToLinkMesaSrc
LinkSourceFile(r128_context.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_context.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_dd.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_dd.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_ioctl.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_ioctl.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_lock.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_lock.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_screen.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_screen.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_span.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_span.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_state.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_state.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_tex.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_tex.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_texmem.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_texobj.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_texstate.c, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_tris.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_tris.h, $(MESADRVSRCDIR)/r128)
LinkSourceFile(r128_vb.c, $(MESADRVSRCDIR)/r128)
+LinkSourceFile(r128_vb.h, $(MESADRVSRCDIR)/r128)
#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/Imakefile b/xc/lib/GL/mesa/drivers/dri/r200/Imakefile
index edc85aa00..a5fc730a8 100644
--- a/xc/lib/GL/mesa/src/drv/r200/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/r200/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.2 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.9 2002/02/23 00:45:50 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.2 2002/11/25 14:04:51
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES)
@@ -43,8 +46,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.2 2002/11/25 14:04:51
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ) $(VBLANKOBJ) $(XMLCONFIGOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -57,7 +58,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.2 2002/11/25 14:04:51
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(R200OBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(EXPATLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/r200/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/r200/Imakefile.inc
index 9b918addd..3bb2d92a8 100644
--- a/xc/lib/GL/mesa/src/drv/r200/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/r200/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile.inc,v 1.3 2003/05/27 16:34:34 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile.inc,v 1.2 2001/05/02 15:06:04 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,21 +16,23 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
+ -I$(XF86COMSRC) \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/ati \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include \
- -I$(XTOP)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/r200
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -159,22 +161,37 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#ifdef NeedToLinkMesaSrc
LinkSourceFile(r200_context.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_context.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_cmdbuf.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_ioctl.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_ioctl.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_lock.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_lock.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_maos.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_maos.h, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_maos_vbtmp.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_pixel.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_pixel.h, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_reg.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_screen.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_screen.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_span.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_span.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_sanity.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_sanity.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_state.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_state.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_state_init.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_swtcl.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_swtcl.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_tcl.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_tcl.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_tex.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_tex.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_texmem.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_texstate.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_vtxfmt.c, $(MESADRVSRCDIR)/r200)
+LinkSourceFile(r200_vtxfmt.h, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_vtxfmt_c.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_vtxfmt_x86.c, $(MESADRVSRCDIR)/r200)
LinkSourceFile(r200_vtxtmp_x86.S, $(MESADRVSRCDIR)/r200)
diff --git a/xc/lib/GL/mesa/src/drv/radeon/Imakefile b/xc/lib/GL/mesa/drivers/dri/radeon/Imakefile
index 52b78e761..0fdaa556d 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/radeon/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.11 2002/11/25 14:04:51 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.9 2002/02/23 00:45:50 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.11 2002/11/25 14:04:
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES)
@@ -43,8 +46,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.11 2002/11/25 14:04:
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(MMOBJ) $(UTILSOBJ) $(TEXMEMOBJ) $(VBLANKOBJ) $(XMLCONFIGOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -57,7 +58,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.11 2002/11/25 14:04:
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(RADEONOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc
index 37e563495..070d6c499 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc,v 1.5 2003/05/27 16:34:34 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc,v 1.3 2002/02/22 21:45:00 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,26 +16,29 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
- -I$(XF86DRIVERSRC)/ati \
-I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include \
- -I$(XTOP)/include
+ -I$(XF86OSSRC)/shared/drm/kernel \
+ -I$(XF86DRIVERSRC)/ati \
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/radeon
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
RADEONSRCS = $(MESADRVRADEONBUILDDIR)radeon_context.c \
+ $(MESADRVRADEONBUILDDIR)radeon_compat.c \
$(MESADRVRADEONBUILDDIR)radeon_ioctl.c \
$(MESADRVRADEONBUILDDIR)radeon_lock.c \
$(MESADRVRADEONBUILDDIR)radeon_maos.c \
@@ -56,6 +59,7 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVRADEONBUILDDIR)radeon_vtxfmt_c.c
RADEONOBJS = $(MESADRVRADEONBUILDDIR)radeon_context.o \
+ $(MESADRVRADEONBUILDDIR)radeon_compat.o \
$(MESADRVRADEONBUILDDIR)radeon_ioctl.o \
$(MESADRVRADEONBUILDDIR)radeon_lock.o \
$(MESADRVRADEONBUILDDIR)radeon_maos.o \
@@ -79,6 +83,7 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#endif
RADEONUOBJS = $(MESADRVRADEONBUILDDIR)unshared/radeon_context.o \
+ $(MESADRVRADEONBUILDDIR)unshared/radeon_compat.o \
$(MESADRVRADEONBUILDDIR)unshared/radeon_ioctl.o \
$(MESADRVRADEONBUILDDIR)unshared/radeon_lock.o \
$(MESADRVRADEONBUILDDIR)unshared/radeon_maos.o \
@@ -102,6 +107,7 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#endif
RADEONDOBJS = $(MESADRVRADEONBUILDDIR)debugger/radeon_context.o \
+ $(MESADRVRADEONBUILDDIR)debugger/radeon_compat.o \
$(MESADRVRADEONBUILDDIR)debugger/radeon_ioctl.o \
$(MESADRVRADEONBUILDDIR)debugger/radeon_lock.o \
$(MESADRVRADEONBUILDDIR)debugger/radeon_maos.o \
@@ -125,6 +131,7 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#endif
RADEONPOBJS = $(MESADRVRADEONBUILDDIR)profiled/radeon_context.o \
+ $(MESADRVRADEONBUILDDIR)profiled/radeon_compat.o \
$(MESADRVRADEONBUILDDIR)profiled/radeon_ioctl.o \
$(MESADRVRADEONBUILDDIR)profiled/radeon_lock.o \
$(MESADRVRADEONBUILDDIR)profiled/radeon_maos.o \
@@ -149,20 +156,35 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
#ifdef NeedToLinkMesaSrc
LinkSourceFile(radeon_context.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_context.h, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_compat.c, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_ioctl.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_ioctl.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_lock.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_lock.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_maos.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_maos.h, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_maos_vbtmp.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_sanity.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_sanity.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_screen.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_screen.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_span.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_span.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_state.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_state.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_state_init.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_subset.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_swtcl.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_swtcl.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_tcl.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_tcl.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_tex.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_tex.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_texmem.c, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_texstate.c, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_vtxfmt.c, $(MESADRVSRCDIR)/radeon)
+LinkSourceFile(radeon_vtxfmt.h, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_vtxfmt_c.c, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_vtxfmt_x86.c, $(MESADRVSRCDIR)/radeon)
LinkSourceFile(radeon_vtxtmp_x86.S, $(MESADRVSRCDIR)/radeon)
diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile b/xc/lib/GL/mesa/drivers/dri/sis/Imakefile
index 83298d327..3feb467a4 100644
--- a/xc/lib/GL/mesa/src/drv/sis/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/sis/Imakefile
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.22 2002/11/25 14:04:52
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING
XCOMM DEBUG_DEFINES = -DSIS_DEBUG
@@ -47,8 +50,6 @@ XCOMM DEBUG_DEFINES = -DSIS_DEBUG
$(GLXLIBSRC)/dri/drm/xf86drmRandom.o \
$(GLXLIBSRC)/dri/drm/xf86drmSL.o
- COMMONOBJS = $(UTILSOBJ) $(XMLCONFIGOBJ)
-
#ifdef GlxSoProf
LOSRCS = ../../../../lowpc.c
HISRCS = ../../../../highpc.c
@@ -61,7 +62,7 @@ XCOMM DEBUG_DEFINES = -DSIS_DEBUG
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(COMMONOBJS) $(SISOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/sis/Imakefile.inc
index 1be3f0ebb..631a00420 100644
--- a/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/sis/Imakefile.inc
@@ -1,7 +1,7 @@
XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile.inc,v 1.1 2001/03/23 19:18:43 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -18,19 +18,22 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#if BuildXF86DRI
DRI_DEFINES = GlxDefines $(SIS_DEFINES) -DX_BYTE_ORDER=$(X_BYTE_ORDER)
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/sis \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESASRCDIR)/include \
- -I$(MESADRVSRCDIR)/common -I$(MESADRVSRCDIR)/sis
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
+ -I$(MESADRVSRCDIR)/common \
+ -I$(MESADRVSRCDIR)/sis
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
#if 0
@@ -127,18 +130,33 @@ LinkSourceFile(sis_debug.c, $(MESADRVSRCDIR)/sis)
#ifdef NeedToLinkMesaSrc
LinkSourceFile(sis_alloc.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_alloc.h, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_common2.h, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_context.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_dd.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_dd.h, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_debug.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_debug.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_lock.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_lock.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_context.c, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_fog.c, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_clear.c, $(MESADRVSRCDIR)/sis)
-LinkSourceFile(sis_screen.c $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_reg.h, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_screen.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_screen.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_state.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_state.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_stencil.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_stencil.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_span.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_span.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_tex.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_tex.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_texstate.c, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_tris.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_tris.h, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_tritmp.h, $(MESADRVSRCDIR)/sis)
LinkSourceFile(sis_vb.c, $(MESADRVSRCDIR)/sis)
+LinkSourceFile(sis_vb.h, $(MESADRVSRCDIR)/sis)
#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile
index 7e3c3ade2..85b97e70e 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
+++ b/xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.32 2002/11/25 14:04:52 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.30 2002/02/23 00:45:51 dawes Exp $
#include <Threads.tmpl>
@@ -16,21 +16,24 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.32 2002/11/25 14:04:52
#define DoProfileLib NO
#endif
+#define MesaDrvCommonBuildDir ../common/
#include "../common/Imakefile.inc"
-#include "Imakefile.inc"
-#include "../../array_cache/Imakefile.inc"
-#include "../../math/Imakefile.inc"
-#include "../../swrast/Imakefile.inc"
-#include "../../swrast_setup/Imakefile.inc"
-#include "../../tnl/Imakefile.inc"
-#include "../../tnl_dd/Imakefile.inc"
-#include "../../Imakefile.inc"
+#include "../../../array_cache/Imakefile.inc"
+#include "../../../main/Imakefile.inc"
+#include "../../../math/Imakefile.inc"
+#include "../../../swrast/Imakefile.inc"
+#include "../../../swrast_setup/Imakefile.inc"
+#include "../../../tnl/Imakefile.inc"
+#include "../../../tnl_dd/Imakefile.inc"
+#include "../../../Imakefile.inc"
#if defined(i386Architecture) && MesaUseX86Asm
-#include "../../X86/Imakefile.inc"
+#include "../../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../../SPARC/Imakefile.inc"
+#include "../../../sparc/Imakefile.inc"
#endif
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES)
INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES)
@@ -55,7 +58,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.32 2002/11/25 14:04:52
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(TDFXOBJS) $(HIOBJS)
-REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) StaticLibrary($(BUILDLIBDIR),expat)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc b/xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc
index 2c6ca55e8..51531e376 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.5 2003/05/27 16:34:34 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.1 2001/03/23 19:18:44 dawes Exp $
#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
+#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri
#endif
MESADRVSRCDIR = MesaDrvSrcDir
@@ -16,20 +16,22 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
+ DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder
DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
+ -I$(XINCLUDESRC) \
-I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
+ -I$(GLXLIBSRC)/include \
-I$(SERVERSRC)/GL/dri \
-I$(XF86OSSRC) \
+ -I$(XF86OSSRC)/shared/drm/kernel \
-I$(XF86DRIVERSRC)/tdfx \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
+ -I$(GLXLIBSRC)/dri/drm
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
-I$(MESADRVSRCDIR)/common \
-I$(MESADRVSRCDIR)/tdfx
X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
@@ -105,17 +107,33 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_vb.o
#ifdef NeedToLinkMesaSrc
+LinkSourceFile(dri_glide.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_context.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_context.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_dd.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_dd.h, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_glide.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_lock.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_lock.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_pixels.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_pixels.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_render.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_render.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_screen.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_screen.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_span.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_span.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_state.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_state.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_tex.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_tex.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_texman.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_texman.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_texstate.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_texstate.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_tris.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_tris.h, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_vb.c, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_vb.h, $(MESADRVSRCDIR)/tdfx)
+LinkSourceFile(tdfx_vbtmp.h, $(MESADRVSRCDIR)/tdfx)
#endif
diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/drivers/osmesa/Imakefile
index 66f34d80b..f20e4904c 100644
--- a/xc/lib/GL/mesa/src/OSmesa/Imakefile
+++ b/xc/lib/GL/mesa/drivers/osmesa/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.18 2003/03/25 04:18:08 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.16 2002/11/25 14:04:50 eich Exp $
#include <Threads.tmpl>
@@ -8,27 +8,30 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.18 2003/03/25 04:18:08 d
#define DoDebugLib DebugLibGlx
#define DoProfileLib ProfileLibGlx
-#include "../array_cache/Imakefile.inc"
-#include "../math/Imakefile.inc"
-#include "../swrast/Imakefile.inc"
-#include "../swrast_setup/Imakefile.inc"
-#include "../tnl/Imakefile.inc"
-#include "../tnl_dd/Imakefile.inc"
-#include "../Imakefile.inc"
+#include "../../array_cache/Imakefile.inc"
+#include "../../math/Imakefile.inc"
+#include "../../main/Imakefile.inc"
+#include "../../swrast/Imakefile.inc"
+#include "../../swrast_setup/Imakefile.inc"
+#include "../../tnl/Imakefile.inc"
+#include "../../tnl_dd/Imakefile.inc"
+#include "../../Imakefile.inc"
#if defined(i386Architecture) && !SystemV4 && MesaUseX86Asm
-#include "../X86/Imakefile.inc"
+#include "../../x86/Imakefile.inc"
#endif
#ifdef SparcArchitecture
-#include "../SPARC/Imakefile.inc"
+#include "../../sparc/Imakefile.inc"
#endif
-LinkSourceFile(osmesa.c, $(MESASRCDIR)/src/OSmesa)
+LinkSourceFile(osmesa.c, $(MESASRCDIR)/src/mesa/drivers/osmesa)
#if Malloc0ReturnsNull
ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src/OSmesa -I$(MESASRCDIR)/src \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/main \
-I$(MESASRCDIR)/include
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES)
@@ -66,11 +69,7 @@ SubdirLibraryRule($(OBJS))
NormalLintTarget($(SRCS))
LIBNAME = OSMesa
-#if !defined(OS2Architecture)
SOREV = 4.0
-#else
-SOREV =
-#endif
#if DoNormalLib
diff --git a/xc/lib/GL/mesa/src/X/Imakefile b/xc/lib/GL/mesa/drivers/x11/Imakefile
index cfdc45f8c..ab9a91970 100644
--- a/xc/lib/GL/mesa/src/X/Imakefile
+++ b/xc/lib/GL/mesa/drivers/x11/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.13 2002/11/22 22:55:59 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.12tsi Exp $
#include <Threads.tmpl>
diff --git a/xc/lib/GL/mesa/src/X/Imakefile.inc b/xc/lib/GL/mesa/drivers/x11/Imakefile.inc
index 7c3575290..c11f375d6 100644
--- a/xc/lib/GL/mesa/src/X/Imakefile.inc
+++ b/xc/lib/GL/mesa/drivers/x11/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile.inc,v 1.4 2002/11/14 21:01:16 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile.inc,v 1.3tsi Exp $
#ifndef MesaXBuildDir
-#define MesaXBuildDir $(GLXLIBSRC)/mesa/src/X/
+#define MesaXBuildDir $(GLXLIBSRC)/src/mesa/drivers/x11/
#endif
MESAXBUILDDIR = MesaXBuildDir
@@ -22,17 +22,17 @@ XMESA_GLX_SRCS = $(MESAXBUILDDIR)fakeglx.c \
#ifdef NeedToLinkMesaSrc
#ifndef MesaInXServer
-LinkSourceFile(fakeglx.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(glxapi.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(glxapi.h, $(MESASRCDIR)/src/X)
-LinkSourceFile(realglx.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(xfonts.c, $(MESASRCDIR)/src/X)
+LinkSourceFile(fakeglx.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(glxapi.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(glxapi.h, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(realglx.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(xfonts.c, $(MESASRCDIR)/src/mesa/drivers/x11)
#endif
-LinkSourceFile(xm_api.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(xm_dd.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(xm_line.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(xm_span.c, $(MESASRCDIR)/src/X)
-LinkSourceFile(xm_tri.c, $(MESASRCDIR)/src/X)
+LinkSourceFile(xm_api.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(xm_dd.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(xm_line.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(xm_span.c, $(MESASRCDIR)/src/mesa/drivers/x11)
+LinkSourceFile(xm_tri.c, $(MESASRCDIR)/src/mesa/drivers/x11)
#endif
#ifndef MesaInXServer
diff --git a/xc/lib/GL/mesa/main/Imakefile b/xc/lib/GL/mesa/main/Imakefile
new file mode 100644
index 000000000..f0dcdb4b3
--- /dev/null
+++ b/xc/lib/GL/mesa/main/Imakefile
@@ -0,0 +1,59 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.30tsi Exp $
+
+#include <Threads.tmpl>
+
+/*
+ * Need both shared and unshared Mesa objects in the following cases:
+ * GlxDriverUsesMesa
+ * GlxBuiltInXMesa
+ * BuildOSMesaLib
+ *
+ * In other cases, only the shared version is needed to link in to loadable
+ * driver modules.
+ */
+
+#if BuildOSMesaLib || (BuildXF86DRI && (GlxDriverUsesMesa || GlxBuiltInXMesa))
+#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC)
+#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC)
+#define DoExtraLib SharedLibGlx
+#define DoDebugLib DebugLibGlx
+#define DoProfileLib ProfileLibGlx
+#else
+#define DoNormalLib SharedLibGlxWithoutPIC
+#define DoSharedLib !SharedLibGlxWithoutPIC
+#define DoExtraLib NO
+#define DoDebugLib NO
+#define DoProfileLib NO
+#endif
+
+#if Malloc0ReturnsNull
+ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
+#endif
+
+#define MesaBuildDir /**/
+#define NeedToLinkMesaSrc
+#include "Imakefile.inc"
+
+#ifdef UseCompaqMathLibrary
+ MATH_DEFINES = -DCCPML
+#endif
+
+ DEFINES = $(ALLOC_DEFINES) GlxDefines \
+ $(MESA_ASM_DEFINES) $(MATH_DEFINES)
+ INCLUDES = /*-I$(INCLUDESRC) -I$(EXTINCSRC) */ -I$(XINCLUDESRC) \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa -I$(GLXLIBSRC)/dri \
+ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include
+ SRCS = $(COREMESABASESRCS)
+ OBJS = $(COREMESABASEOBJS)
+
+#include <Library.tmpl>
+
+LibraryObjectRule()
+
+SubdirLibraryRule($(OBJS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/lib/GL/mesa/main/Imakefile.inc b/xc/lib/GL/mesa/main/Imakefile.inc
new file mode 100644
index 000000000..c22585711
--- /dev/null
+++ b/xc/lib/GL/mesa/main/Imakefile.inc
@@ -0,0 +1,492 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile.inc,v 1.7tsi Exp $
+
+#ifndef MesaBuildDir
+#define MesaBuildDir $(GLXLIBSRC)/mesa/main/
+#endif
+
+MESABUILDDIR = MesaBuildDir
+
+#ifdef NeedAllMesaSrc
+ DISPATCHSRCS = $(MESABUILDDIR)dispatch.c
+ GLAPISRCS = $(MESABUILDDIR)glapi.c
+ GLTHREADSRCS = $(MESABUILDDIR)glthread.c
+#endif
+
+MESA_CORE_INCLUDES = -I$(MESASRCDIR)/src/array_cache \
+ -I$(MESASRCDIR)/src/math \
+ -I$(MESASRCDIR)/src/swrast -I$(MESASRCDIR)/src/swrast_setup \
+ -I$(MESASRCDIR)/src/tnl -I$(MESASRCDIR)/src/tnl_dd
+
+COREMESABASESRCS = \
+ $(MESABUILDDIR)api_arrayelt.c \
+ $(MESABUILDDIR)api_loopback.c \
+ $(MESABUILDDIR)api_noop.c \
+ $(MESABUILDDIR)api_validate.c \
+ $(MESABUILDDIR)accum.c \
+ $(MESABUILDDIR)arbparse.c \
+ $(MESABUILDDIR)arbprogram.c \
+ $(MESABUILDDIR)arbfragparse.c \
+ $(MESABUILDDIR)arbvertparse.c \
+ $(MESABUILDDIR)attrib.c \
+ $(MESABUILDDIR)blend.c \
+ $(MESABUILDDIR)bufferobj.c \
+ $(MESABUILDDIR)buffers.c \
+ $(MESABUILDDIR)clip.c \
+ $(MESABUILDDIR)colortab.c \
+ $(MESABUILDDIR)context.c \
+ $(MESABUILDDIR)convolve.c \
+ $(MESABUILDDIR)debug.c \
+ $(MESABUILDDIR)depth.c \
+ $(MESABUILDDIR)dlist.c \
+ $(MESABUILDDIR)drawpix.c \
+ $(MESABUILDDIR)enable.c \
+ $(MESABUILDDIR)enums.c \
+ $(MESABUILDDIR)eval.c \
+ $(MESABUILDDIR)extensions.c \
+ $(MESABUILDDIR)feedback.c \
+ $(MESABUILDDIR)fog.c \
+ $(MESABUILDDIR)get.c \
+ $(MESABUILDDIR)hash.c \
+ $(MESABUILDDIR)hint.c \
+ $(MESABUILDDIR)histogram.c \
+ $(MESABUILDDIR)image.c \
+ $(MESABUILDDIR)imports.c \
+ $(MESABUILDDIR)light.c \
+ $(MESABUILDDIR)lines.c \
+ $(MESABUILDDIR)matrix.c \
+ $(MESABUILDDIR)nvprogram.c \
+ $(MESABUILDDIR)nvfragparse.c \
+ $(MESABUILDDIR)nvvertexec.c \
+ $(MESABUILDDIR)nvvertparse.c \
+ $(MESABUILDDIR)occlude.c \
+ $(MESABUILDDIR)pixel.c \
+ $(MESABUILDDIR)points.c \
+ $(MESABUILDDIR)polygon.c \
+ $(MESABUILDDIR)program.c \
+ $(MESABUILDDIR)rastpos.c \
+ $(MESABUILDDIR)state.c \
+ $(MESABUILDDIR)stencil.c \
+ $(MESABUILDDIR)texcompress.c \
+ $(MESABUILDDIR)texformat.c \
+ $(MESABUILDDIR)teximage.c \
+ $(MESABUILDDIR)texobj.c \
+ $(MESABUILDDIR)texstate.c \
+ $(MESABUILDDIR)texstore.c \
+ $(MESABUILDDIR)texutil.c \
+ $(MESABUILDDIR)varray.c \
+ $(MESABUILDDIR)vtxfmt.c
+
+#ifdef NeedToLinkMesaSrc
+LinkSourceFile(api_arrayelt.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_arrayelt.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_eval.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_loopback.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_loopback.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_noop.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_noop.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_validate.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(api_validate.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(accum.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(accum.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbparse.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbprogram.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbfragparse.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbfragparse.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbparse.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbparse_syn.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbprogram.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbvertparse.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(arbvertparse.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(attrib.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(attrib.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(blend.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(blend.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(bufferobj.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(bufferobj.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(buffers.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(buffers.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(clip.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(clip.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(colormac.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(colortab.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(colortab.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(config.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(context.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(context.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(convolve.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(convolve.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(dd.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(debug.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(debug.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(depth.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(depth.h, $(MESASRCDIR)/src/mesa/main)
+#ifdef NeedAllMesaSrc
+LinkSourceFile(dispatch.c, $(MESASRCDIR)/src/mesa/main)
+#endif
+LinkSourceFile(dlist.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(dlist.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(drawpix.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(drawpix.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(enable.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(enable.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(enums.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(enums.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(eval.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(eval.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(extensions.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(extensions.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(feedback.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(feedback.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(fog.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(fog.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(get.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(get.h, $(MESASRCDIR)/src/mesa/main)
+#ifdef NeedAllMesaSrc
+LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi)
+LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi)
+#endif
+LinkSourceFile(glheader.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(hash.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(hash.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(hint.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(hint.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(histogram.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(histogram.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(image.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(image.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(imports.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(imports.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(light.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(light.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(lines.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(lines.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(macros.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(matrix.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(matrix.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(mtypes.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvfragparse.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvfragprog.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvprogram.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvprogram.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvfragparse.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvvertexec.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvvertexec.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvvertparse.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvvertparse.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(nvvertprog.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(occlude.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(occlude.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(pixel.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(pixel.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(points.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(points.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(polygon.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(polygon.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(program.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(program.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(rastpos.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(rastpos.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(simple_list.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(state.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(state.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(stencil.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(stencil.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texcompress.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texcompress.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texformat.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texformat.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texformat_tmp.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(teximage.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(teximage.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texobj.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texobj.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texstate.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texstate.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texstore.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texstore.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texutil.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texutil.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(texutil_tmp.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(varray.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(varray.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(version.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(vtxfmt.c, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(vtxfmt.h, $(MESASRCDIR)/src/mesa/main)
+LinkSourceFile(vtxfmt_tmp.h, $(MESASRCDIR)/src/mesa/main)
+#endif
+
+#ifdef NeedAllMesaSrc
+ DISPATCHOBJS = $(MESABUILDDIR)dispatch.o
+ GLAPIOBJS = $(MESABUILDDIR)glapi.o
+ GLTHREADOBJS = $(MESABUILDDIR)glthread.o
+#endif
+
+COREMESABASEOBJS = \
+ $(DISPATCHOBJS) \
+ $(GLAPIOBJS) \
+ $(GLTHREADOBJS) \
+ $(MESABUILDDIR)api_arrayelt.o \
+ $(MESABUILDDIR)api_loopback.o \
+ $(MESABUILDDIR)api_noop.o \
+ $(MESABUILDDIR)api_validate.o \
+ $(MESABUILDDIR)accum.o \
+ $(MESABUILDDIR)arbparse.o \
+ $(MESABUILDDIR)arbprogram.o \
+ $(MESABUILDDIR)arbfragparse.o \
+ $(MESABUILDDIR)arbvertparse.o \
+ $(MESABUILDDIR)attrib.o \
+ $(MESABUILDDIR)blend.o \
+ $(MESABUILDDIR)bufferobj.o \
+ $(MESABUILDDIR)buffers.o \
+ $(MESABUILDDIR)clip.o \
+ $(MESABUILDDIR)colortab.o \
+ $(MESABUILDDIR)context.o \
+ $(MESABUILDDIR)convolve.o \
+ $(MESABUILDDIR)debug.o \
+ $(MESABUILDDIR)depth.o \
+ $(MESABUILDDIR)dlist.o \
+ $(MESABUILDDIR)drawpix.o \
+ $(MESABUILDDIR)enable.o \
+ $(MESABUILDDIR)enums.o \
+ $(MESABUILDDIR)eval.o \
+ $(MESABUILDDIR)extensions.o \
+ $(MESABUILDDIR)feedback.o \
+ $(MESABUILDDIR)fog.o \
+ $(MESABUILDDIR)get.o \
+ $(MESABUILDDIR)hash.o \
+ $(MESABUILDDIR)hint.o \
+ $(MESABUILDDIR)histogram.o \
+ $(MESABUILDDIR)image.o \
+ $(MESABUILDDIR)imports.o \
+ $(MESABUILDDIR)light.o \
+ $(MESABUILDDIR)lines.o \
+ $(MESABUILDDIR)matrix.o \
+ $(MESABUILDDIR)nvprogram.o \
+ $(MESABUILDDIR)nvfragparse.o \
+ $(MESABUILDDIR)nvvertexec.o \
+ $(MESABUILDDIR)nvvertparse.o \
+ $(MESABUILDDIR)occlude.o \
+ $(MESABUILDDIR)pixel.o \
+ $(MESABUILDDIR)points.o \
+ $(MESABUILDDIR)polygon.o \
+ $(MESABUILDDIR)program.o \
+ $(MESABUILDDIR)rastpos.o \
+ $(MESABUILDDIR)state.o \
+ $(MESABUILDDIR)stencil.o \
+ $(MESABUILDDIR)texcompress.o \
+ $(MESABUILDDIR)texformat.o \
+ $(MESABUILDDIR)teximage.o \
+ $(MESABUILDDIR)texobj.o \
+ $(MESABUILDDIR)texstate.o \
+ $(MESABUILDDIR)texstore.o \
+ $(MESABUILDDIR)texutil.o \
+ $(MESABUILDDIR)varray.o \
+ $(MESABUILDDIR)vtxfmt.o
+
+#ifdef NeedAllMesaSrc
+ DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o
+ GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o
+ GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o
+#endif
+
+#if defined(DoSharedLib) && DoSharedLib
+COREMESABASEUOBJS = \
+ $(DISPATCHUOBJS) \
+ $(GLAPIUOBJS) \
+ $(GLTHREADUOBJS) \
+ $(MESABUILDDIR)unshared/api_arrayelt.o \
+ $(MESABUILDDIR)unshared/api_loopback.o \
+ $(MESABUILDDIR)unshared/api_noop.o \
+ $(MESABUILDDIR)unshared/api_validate.o \
+ $(MESABUILDDIR)unshared/accum.o \
+ $(MESABUILDDIR)unshared/arbparse.o \
+ $(MESABUILDDIR)unshared/arbprogram.o \
+ $(MESABUILDDIR)unshared/arbfragparse.o \
+ $(MESABUILDDIR)unshared/arbvertparse.o \
+ $(MESABUILDDIR)unshared/attrib.o \
+ $(MESABUILDDIR)unshared/blend.o \
+ $(MESABUILDDIR)unshared/bufferobj.o \
+ $(MESABUILDDIR)unshared/buffers.o \
+ $(MESABUILDDIR)unshared/clip.o \
+ $(MESABUILDDIR)unshared/colortab.o \
+ $(MESABUILDDIR)unshared/context.o \
+ $(MESABUILDDIR)unshared/convolve.o \
+ $(MESABUILDDIR)unshared/debug.o \
+ $(MESABUILDDIR)unshared/depth.o \
+ $(MESABUILDDIR)unshared/dlist.o \
+ $(MESABUILDDIR)unshared/drawpix.o \
+ $(MESABUILDDIR)unshared/enable.o \
+ $(MESABUILDDIR)unshared/enums.o \
+ $(MESABUILDDIR)unshared/eval.o \
+ $(MESABUILDDIR)unshared/extensions.o \
+ $(MESABUILDDIR)unshared/feedback.o \
+ $(MESABUILDDIR)unshared/fog.o \
+ $(MESABUILDDIR)unshared/get.o \
+ $(MESABUILDDIR)unshared/hash.o \
+ $(MESABUILDDIR)unshared/hint.o \
+ $(MESABUILDDIR)unshared/histogram.o \
+ $(MESABUILDDIR)unshared/image.o \
+ $(MESABUILDDIR)unshared/imports.o \
+ $(MESABUILDDIR)unshared/light.o \
+ $(MESABUILDDIR)unshared/lines.o \
+ $(MESABUILDDIR)unshared/matrix.o \
+ $(MESABUILDDIR)unshared/nvprogram.o \
+ $(MESABUILDDIR)unshared/nvfragparse.o \
+ $(MESABUILDDIR)unshared/nvvertexec.o \
+ $(MESABUILDDIR)unshared/nvvertparse.o \
+ $(MESABUILDDIR)unshared/occlude.o \
+ $(MESABUILDDIR)unshared/pixel.o \
+ $(MESABUILDDIR)unshared/points.o \
+ $(MESABUILDDIR)unshared/polygon.o \
+ $(MESABUILDDIR)unshared/program.o \
+ $(MESABUILDDIR)unshared/rastpos.o \
+ $(MESABUILDDIR)unshared/state.o \
+ $(MESABUILDDIR)unshared/stencil.o \
+ $(MESABUILDDIR)unshared/texcompress.o \
+ $(MESABUILDDIR)unshared/texformat.o \
+ $(MESABUILDDIR)unshared/teximage.o \
+ $(MESABUILDDIR)unshared/texobj.o \
+ $(MESABUILDDIR)unshared/texstate.o \
+ $(MESABUILDDIR)unshared/texstore.o \
+ $(MESABUILDDIR)unshared/texutil.o \
+ $(MESABUILDDIR)unshared/varray.o \
+ $(MESABUILDDIR)unshared/vtxfmt.o
+#else
+COREMESABASEUOBJS = $(COREMESABASEOBJS)
+#endif
+
+#ifdef NeedAllMesaSrc
+ DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o
+ GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o
+ GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o
+#endif
+
+COREMESABASEDOBJS = \
+ $(DISPATCHDOBJS) \
+ $(GLAPIDOBJS) \
+ $(GLTHREADDOBJS) \
+ $(MESABUILDDIR)debugger/api_arrayelt.o \
+ $(MESABUILDDIR)debugger/api_loopback.o \
+ $(MESABUILDDIR)debugger/api_noop.o \
+ $(MESABUILDDIR)debugger/api_validate.o \
+ $(MESABUILDDIR)debugger/accum.o \
+ $(MESABUILDDIR)debugger/arbparse.o \
+ $(MESABUILDDIR)debugger/arbprogram.o \
+ $(MESABUILDDIR)debugger/arbfragparse.o \
+ $(MESABUILDDIR)debugger/arbvertparse.o \
+ $(MESABUILDDIR)debugger/attrib.o \
+ $(MESABUILDDIR)debugger/blend.o \
+ $(MESABUILDDIR)debugger/bufferobj.o \
+ $(MESABUILDDIR)debugger/buffers.o \
+ $(MESABUILDDIR)debugger/clip.o \
+ $(MESABUILDDIR)debugger/colortab.o \
+ $(MESABUILDDIR)debugger/context.o \
+ $(MESABUILDDIR)debugger/convolve.o \
+ $(MESABUILDDIR)debugger/debug.o \
+ $(MESABUILDDIR)debugger/depth.o \
+ $(MESABUILDDIR)debugger/dlist.o \
+ $(MESABUILDDIR)debugger/drawpix.o \
+ $(MESABUILDDIR)debugger/enable.o \
+ $(MESABUILDDIR)debugger/enums.o \
+ $(MESABUILDDIR)debugger/eval.o \
+ $(MESABUILDDIR)debugger/extensions.o \
+ $(MESABUILDDIR)debugger/feedback.o \
+ $(MESABUILDDIR)debugger/fog.o \
+ $(MESABUILDDIR)debugger/get.o \
+ $(MESABUILDDIR)debugger/hash.o \
+ $(MESABUILDDIR)debugger/hint.o \
+ $(MESABUILDDIR)debugger/histogram.o \
+ $(MESABUILDDIR)debugger/image.o \
+ $(MESABUILDDIR)debugger/imports.o \
+ $(MESABUILDDIR)debugger/light.o \
+ $(MESABUILDDIR)debugger/lines.o \
+ $(MESABUILDDIR)debugger/matrix.o \
+ $(MESABUILDDIR)debugger/nvprogram.o \
+ $(MESABUILDDIR)debugger/nvfragparse.o \
+ $(MESABUILDDIR)debugger/nvvertexec.o \
+ $(MESABUILDDIR)debugger/nvvertparse.o \
+ $(MESABUILDDIR)debugger/occlude.o \
+ $(MESABUILDDIR)debugger/pixel.o \
+ $(MESABUILDDIR)debugger/points.o \
+ $(MESABUILDDIR)debugger/polygon.o \
+ $(MESABUILDDIR)debugger/program.o \
+ $(MESABUILDDIR)debugger/rastpos.o \
+ $(MESABUILDDIR)debugger/state.o \
+ $(MESABUILDDIR)debugger/stencil.o \
+ $(MESABUILDDIR)debugger/texcompress.o \
+ $(MESABUILDDIR)debugger/texformat.o \
+ $(MESABUILDDIR)debugger/teximage.o \
+ $(MESABUILDDIR)debugger/texobj.o \
+ $(MESABUILDDIR)debugger/texstate.o \
+ $(MESABUILDDIR)debugger/texstore.o \
+ $(MESABUILDDIR)debugger/texutil.o \
+ $(MESABUILDDIR)debugger/varray.o \
+ $(MESABUILDDIR)debugger/vtxfmt.o
+
+#ifdef NeedAllMesaSrc
+ DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o
+ GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o
+ GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o
+#endif
+
+COREMESABASEPOBJS = \
+ $(DISPATCHPOBJS) \
+ $(GLAPIPOBJS) \
+ $(GLTHREADPOBJS) \
+ $(MESABUILDDIR)profiled/api_arrayelt.o \
+ $(MESABUILDDIR)profiled/api_loopback.o \
+ $(MESABUILDDIR)profiled/api_noop.o \
+ $(MESABUILDDIR)profiled/api_validate.o \
+ $(MESABUILDDIR)profiled/accum.o \
+ $(MESABUILDDIR)profiled/arbparse.o \
+ $(MESABUILDDIR)profiled/arbprogram.o \
+ $(MESABUILDDIR)profiled/arbfragparse.o \
+ $(MESABUILDDIR)profiled/arbvertparse.o \
+ $(MESABUILDDIR)profiled/attrib.o \
+ $(MESABUILDDIR)profiled/blend.o \
+ $(MESABUILDDIR)profiled/bufferobj.o \
+ $(MESABUILDDIR)profiled/buffers.o \
+ $(MESABUILDDIR)profiled/clip.o \
+ $(MESABUILDDIR)profiled/colortab.o \
+ $(MESABUILDDIR)profiled/context.o \
+ $(MESABUILDDIR)profiled/convolve.o \
+ $(MESABUILDDIR)profiled/debug.o \
+ $(MESABUILDDIR)profiled/depth.o \
+ $(MESABUILDDIR)profiled/dlist.o \
+ $(MESABUILDDIR)profiled/drawpix.o \
+ $(MESABUILDDIR)profiled/enable.o \
+ $(MESABUILDDIR)profiled/enums.o \
+ $(MESABUILDDIR)profiled/eval.o \
+ $(MESABUILDDIR)profiled/extensions.o \
+ $(MESABUILDDIR)profiled/feedback.o \
+ $(MESABUILDDIR)profiled/fog.o \
+ $(MESABUILDDIR)profiled/get.o \
+ $(MESABUILDDIR)profiled/hash.o \
+ $(MESABUILDDIR)profiled/hint.o \
+ $(MESABUILDDIR)profiled/histogram.o \
+ $(MESABUILDDIR)profiled/image.o \
+ $(MESABUILDDIR)profiled/imports.o \
+ $(MESABUILDDIR)profiled/light.o \
+ $(MESABUILDDIR)profiled/lines.o \
+ $(MESABUILDDIR)profiled/matrix.o \
+ $(MESABUILDDIR)profiled/nvprogram.o \
+ $(MESABUILDDIR)profiled/nvfragparse.o \
+ $(MESABUILDDIR)profiled/nvvertexec.o \
+ $(MESABUILDDIR)profiled/nvvertparse.o \
+ $(MESABUILDDIR)profiled/occlude.o \
+ $(MESABUILDDIR)profiled/pixel.o \
+ $(MESABUILDDIR)profiled/points.o \
+ $(MESABUILDDIR)profiled/polygon.o \
+ $(MESABUILDDIR)profiled/program.o \
+ $(MESABUILDDIR)profiled/rastpos.o \
+ $(MESABUILDDIR)profiled/state.o \
+ $(MESABUILDDIR)profiled/stencil.o \
+ $(MESABUILDDIR)profiled/texcompress.o \
+ $(MESABUILDDIR)profiled/texformat.o \
+ $(MESABUILDDIR)profiled/teximage.o \
+ $(MESABUILDDIR)profiled/texobj.o \
+ $(MESABUILDDIR)profiled/texstate.o \
+ $(MESABUILDDIR)profiled/texstore.o \
+ $(MESABUILDDIR)profiled/texutil.o \
+ $(MESABUILDDIR)profiled/varray.o \
+ $(MESABUILDDIR)profiled/vtxfmt.o
diff --git a/xc/lib/GL/mesa/src/math/Imakefile b/xc/lib/GL/mesa/math/Imakefile
index c4e8b21f6..c0333c02a 100644
--- a/xc/lib/GL/mesa/src/math/Imakefile
+++ b/xc/lib/GL/mesa/math/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/math/Imakefile,v 1.9 2002/11/25 14:04:52 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/math/Imakefile,v 1.8 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -43,7 +43,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if defined(i386Architecture) && MesaUseX86Asm
- ASM_DIR = X86
+ ASM_DIR = x86
ASM_SRCS =
ASM_OBJS =
#if MesaUseMMX
@@ -59,7 +59,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef SparcArchitecture
- ASM_DIR = SPARC
+ ASM_DIR = sparc
ASM_SRCS =
ASM_OBJS =
ASM_DEFS = -DUSE_SPARC_ASM
@@ -69,9 +69,11 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
MATHDEF = -DCCPML
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/$(ASM_DIR) \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/$(ASM_DIR) \
-I$(MESASRCDIR)/include \
-I../../../include -I$(XINCLUDESRC)
diff --git a/xc/lib/GL/mesa/src/math/Imakefile.inc b/xc/lib/GL/mesa/math/Imakefile.inc
index 8af316635..cd1dcc427 100644
--- a/xc/lib/GL/mesa/src/math/Imakefile.inc
+++ b/xc/lib/GL/mesa/math/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/math/Imakefile.inc,v 1.2 2002/11/14 21:01:17 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/math/Imakefile.inc,v 1.1tsi Exp $
#ifndef MesaMathBuildDir
-#define MesaMathBuildDir $(GLXLIBSRC)/mesa/src/math/
+#define MesaMathBuildDir $(GLXLIBSRC)/mesa/math/
#endif
MESAMATHBUILDDIR = MesaMathBuildDir
@@ -16,14 +16,28 @@ MESAMATHBUILDDIR = MesaMathBuildDir
$(MESAMATHBUILDDIR)m_xform.c
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(m_debug_clip.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_debug_norm.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_debug_xform.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_eval.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_matrix.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_translate.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_vector.c, $(MESASRCDIR)/src/math)
-LinkSourceFile(m_xform.c, $(MESASRCDIR)/src/math)
+LinkSourceFile(mathmod.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_clip_tmp.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_copy_tmp.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_debug_clip.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_debug.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_debug_util.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_debug_norm.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_debug_xform.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_dotprod_tmp.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_eval.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_eval.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_matrix.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_matrix.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_norm_tmp.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_translate.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_translate.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_trans_tmp.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_vector.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_vector.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_xform.c, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_xform.h, $(MESASRCDIR)/src/mesa/math)
+LinkSourceFile(m_xform_tmp.h, $(MESASRCDIR)/src/mesa/math)
#endif
MESA_MATH_OBJS = $(MESAMATHBUILDDIR)m_debug_clip.o \
diff --git a/xc/lib/GL/mesa/src/SPARC/Imakefile b/xc/lib/GL/mesa/sparc/Imakefile
index 32176f3fd..32176f3fd 100644
--- a/xc/lib/GL/mesa/src/SPARC/Imakefile
+++ b/xc/lib/GL/mesa/sparc/Imakefile
diff --git a/xc/lib/GL/mesa/src/SPARC/Imakefile.inc b/xc/lib/GL/mesa/sparc/Imakefile.inc
index 444c2c551..6bd006749 100644
--- a/xc/lib/GL/mesa/src/SPARC/Imakefile.inc
+++ b/xc/lib/GL/mesa/sparc/Imakefile.inc
@@ -1,7 +1,7 @@
XCOMM $XFree86: xc/lib/GL/mesa/src/SPARC/Imakefile.inc,v 1.2 2002/11/14 21:01:16 tsi Exp $
#ifndef MesaSPARCBuildDir
-#define MesaSPARCBuildDir $(GLXLIBSRC)/mesa/src/SPARC/
+#define MesaSPARCBuildDir $(GLXLIBSRC)/mesa/sparc/
#endif
MESASPARCBUILDDIR = MesaSPARCBuildDir
@@ -11,11 +11,11 @@ MESA_SPARC_SRCS = $(MESASPARCBUILDDIR)sparc.c \
$(MESASPARCBUILDDIR)clip.S
#ifdef NeedToLinkMesaSrc
-/* If $(MESASRCDIR)/src/SPARC isn't in the INCLUDES, it should be. */
-LinkSourceFile(sparc.c, $(MESASRCDIR)/src/SPARC)
-LinkSourceFile(xform.S, $(MESASRCDIR)/src/SPARC)
-LinkSourceFile(clip.S, $(MESASRCDIR)/src/SPARC)
-LinkSourceFile(norm.S, $(MESASRCDIR)/src/SPARC)
+/* If $(MESASRCDIR)/src/mesa/sparc isn't in the INCLUDES, it should be. */
+LinkSourceFile(sparc.c, $(MESASRCDIR)/src/mesa/sparc)
+LinkSourceFile(xform.S, $(MESASRCDIR)/src/mesa/sparc)
+LinkSourceFile(clip.S, $(MESASRCDIR)/src/mesa/sparc)
+LinkSourceFile(norm.S, $(MESASRCDIR)/src/mesa/sparc)
#endif
MESA_SPARC_OBJS = $(MESASPARCBUILDDIR)sparc.o \
diff --git a/xc/lib/GL/mesa/src/Imakefile.inc b/xc/lib/GL/mesa/src/Imakefile.inc
deleted file mode 100644
index 741d4c99c..000000000
--- a/xc/lib/GL/mesa/src/Imakefile.inc
+++ /dev/null
@@ -1,495 +0,0 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile.inc,v 1.8 2002/11/14 21:01:16 tsi Exp $
-
-#ifndef MesaBuildDir
-#define MesaBuildDir $(GLXLIBSRC)/mesa/src/
-#endif
-
-MESABUILDDIR = MesaBuildDir
-
-#ifdef NeedAllMesaSrc
- DISPATCHSRCS = $(MESABUILDDIR)dispatch.c
- GLAPISRCS = $(MESABUILDDIR)glapi.c
-GLAPINOOPSRCS = $(MESABUILDDIR)glapinoop.c
- GLTHREADSRCS = $(MESABUILDDIR)glthread.c
-#endif
-
-MESA_CORE_INCLUDES = -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/swrast -I$(MESASRCDIR)/src/swrast_setup \
- -I$(MESASRCDIR)/src/tnl -I$(MESASRCDIR)/src/tnl_dd
-
-
-COREMESABASESRCS = \
- $(MESABUILDDIR)accum.c \
- $(MESABUILDDIR)api_arrayelt.c \
- $(MESABUILDDIR)api_eval.c \
- $(MESABUILDDIR)api_loopback.c \
- $(MESABUILDDIR)api_noop.c \
- $(MESABUILDDIR)api_validate.c \
- $(MESABUILDDIR)attrib.c \
- $(MESABUILDDIR)blend.c \
- $(MESABUILDDIR)buffers.c \
- $(MESABUILDDIR)clip.c \
- $(MESABUILDDIR)colortab.c \
- $(MESABUILDDIR)context.c \
- $(MESABUILDDIR)convolve.c \
- $(MESABUILDDIR)debug.c \
- $(MESABUILDDIR)depth.c \
- $(DISPATCHSRCS) \
- $(MESABUILDDIR)dlist.c \
- $(MESABUILDDIR)drawpix.c \
- $(MESABUILDDIR)enable.c \
- $(MESABUILDDIR)enums.c \
- $(MESABUILDDIR)eval.c \
- $(MESABUILDDIR)extensions.c \
- $(MESABUILDDIR)feedback.c \
- $(MESABUILDDIR)fog.c \
- $(MESABUILDDIR)get.c \
- $(GLAPISRCS) \
- $(GLTHREADSRCS) \
- $(MESABUILDDIR)hash.c \
- $(MESABUILDDIR)hint.c \
- $(MESABUILDDIR)histogram.c \
- $(MESABUILDDIR)image.c \
- $(MESABUILDDIR)imports.c \
- $(MESABUILDDIR)light.c \
- $(MESABUILDDIR)lines.c \
- $(MESABUILDDIR)matrix.c \
- $(MESABUILDDIR)mmath.c \
- $(MESABUILDDIR)pixel.c \
- $(MESABUILDDIR)points.c \
- $(MESABUILDDIR)polygon.c \
- $(MESABUILDDIR)rastpos.c \
- $(MESABUILDDIR)state.c \
- $(MESABUILDDIR)stencil.c \
- $(MESABUILDDIR)texcompress.c \
- $(MESABUILDDIR)texformat.c \
- $(MESABUILDDIR)teximage.c \
- $(MESABUILDDIR)texobj.c \
- $(MESABUILDDIR)texstate.c \
- $(MESABUILDDIR)texstore.c \
- $(MESABUILDDIR)texutil.c \
- $(MESABUILDDIR)varray.c \
- $(MESABUILDDIR)vtxfmt.c \
- $(MESABUILDDIR)vpexec.c \
- $(MESABUILDDIR)vpexec.h \
- $(MESABUILDDIR)vpparse.c \
- $(MESABUILDDIR)vpparse.h \
- $(MESABUILDDIR)vpstate.c \
- $(MESABUILDDIR)vpstate.h
-
-
-COREMESASRCS = $(COREMESABASESRCS) \
- $(MESABUILDDIR)array_cache/ac_context.c \
- $(MESABUILDDIR)array_cache/ac_import.c \
- $(MESABUILDDIR)math/m_debug_clip.c \
- $(MESABUILDDIR)math/m_debug_norm.c \
- $(MESABUILDDIR)math/m_debug_vertex.c \
- $(MESABUILDDIR)math/m_debug_xform.c \
- $(MESABUILDDIR)math/m_eval.c \
- $(MESABUILDDIR)math/m_matrix.c \
- $(MESABUILDDIR)math/m_translate.c \
- $(MESABUILDDIR)math/m_vector.c \
- $(MESABUILDDIR)math/m_vertices.c \
- $(MESABUILDDIR)math/m_xform.c \
- $(MESABUILDDIR)swrast/s_aaline.c \
- $(MESABUILDDIR)swrast/s_aatriangle.c \
- $(MESABUILDDIR)swrast/s_accum.c \
- $(MESABUILDDIR)swrast/s_alpha.c \
- $(MESABUILDDIR)swrast/s_alphabuf.c \
- $(MESABUILDDIR)swrast/s_bitmap.c \
- $(MESABUILDDIR)swrast/s_blend.c \
- $(MESABUILDDIR)swrast/s_buffers.c \
- $(MESABUILDDIR)swrast/s_copypix.c \
- $(MESABUILDDIR)swrast/s_context.c \
- $(MESABUILDDIR)swrast/s_depth.c \
- $(MESABUILDDIR)swrast/s_drawpix.c \
- $(MESABUILDDIR)swrast/s_feedback.c \
- $(MESABUILDDIR)swrast/s_fog.c \
- $(MESABUILDDIR)swrast/s_histogram.c \
- $(MESABUILDDIR)swrast/s_imaging.c \
- $(MESABUILDDIR)swrast/s_lines.c \
- $(MESABUILDDIR)swrast/s_logic.c \
- $(MESABUILDDIR)swrast/s_masking.c \
- $(MESABUILDDIR)swrast/s_pixeltex.c \
- $(MESABUILDDIR)swrast/s_points.c \
- $(MESABUILDDIR)swrast/s_readpix.c \
- $(MESABUILDDIR)swrast/s_span.c \
- $(MESABUILDDIR)swrast/s_stencil.c \
- $(MESABUILDDIR)swrast/s_texture.c \
- $(MESABUILDDIR)swrast/s_texstore.c \
- $(MESABUILDDIR)swrast/s_triangle.c \
- $(MESABUILDDIR)swrast/s_zoom.c \
- $(MESABUILDDIR)swrast_setup/ss_context.c \
- $(MESABUILDDIR)swrast_setup/ss_triangle.c \
- $(MESABUILDDIR)swrast_setup/ss_vb.c \
- $(MESABUILDDIR)tnl/t_array_api.c \
- $(MESABUILDDIR)tnl/t_array_import.c \
- $(MESABUILDDIR)tnl/t_context.c \
- $(MESABUILDDIR)tnl/t_eval_api.c \
- $(MESABUILDDIR)tnl/t_imm_alloc.c \
- $(MESABUILDDIR)tnl/t_imm_api.c \
- $(MESABUILDDIR)tnl/t_imm_debug.c \
- $(MESABUILDDIR)tnl/t_imm_dlist.c \
- $(MESABUILDDIR)tnl/t_imm_elt.c \
- $(MESABUILDDIR)tnl/t_imm_eval.c \
- $(MESABUILDDIR)tnl/t_imm_exec.c \
- $(MESABUILDDIR)tnl/t_imm_fixup.c \
- $(MESABUILDDIR)tnl/t_pipeline.c \
- $(MESABUILDDIR)tnl/t_vb_fog.c \
- $(MESABUILDDIR)tnl/t_vb_light.c \
- $(MESABUILDDIR)tnl/t_vb_normals.c \
- $(MESABUILDDIR)tnl/t_vb_points.c \
- $(MESABUILDDIR)tnl/t_vb_program.c \
- $(MESABUILDDIR)tnl/t_vb_render.c \
- $(MESABUILDDIR)tnl/t_vb_texgen.c \
- $(MESABUILDDIR)tnl/t_vb_texmat.c \
- $(MESABUILDDIR)tnl/t_vb_vertex.c
-
-#ifdef NeedToLinkMesaSrc
-LinkSourceFile(accum.c, $(MESASRCDIR)/src)
-LinkSourceFile(api_arrayelt.c, $(MESASRCDIR)/src)
-LinkSourceFile(api_eval.c, $(MESASRCDIR)/src)
-LinkSourceFile(api_loopback.c, $(MESASRCDIR)/src)
-LinkSourceFile(api_noop.c, $(MESASRCDIR)/src)
-LinkSourceFile(api_validate.c, $(MESASRCDIR)/src)
-LinkSourceFile(attrib.c, $(MESASRCDIR)/src)
-LinkSourceFile(blend.c, $(MESASRCDIR)/src)
-LinkSourceFile(buffers.c, $(MESASRCDIR)/src)
-LinkSourceFile(clip.c, $(MESASRCDIR)/src)
-LinkSourceFile(colortab.c, $(MESASRCDIR)/src)
-LinkSourceFile(context.c, $(MESASRCDIR)/src)
-LinkSourceFile(convolve.c, $(MESASRCDIR)/src)
-LinkSourceFile(debug.c, $(MESASRCDIR)/src)
-LinkSourceFile(depth.c, $(MESASRCDIR)/src)
-#ifdef NeedAllMesaSrc
-LinkSourceFile(dispatch.c, $(MESASRCDIR)/src)
-#endif
-LinkSourceFile(dlist.c, $(MESASRCDIR)/src)
-LinkSourceFile(drawpix.c, $(MESASRCDIR)/src)
-LinkSourceFile(enable.c, $(MESASRCDIR)/src)
-LinkSourceFile(enums.c, $(MESASRCDIR)/src)
-LinkSourceFile(eval.c, $(MESASRCDIR)/src)
-LinkSourceFile(extensions.c, $(MESASRCDIR)/src)
-LinkSourceFile(feedback.c, $(MESASRCDIR)/src)
-LinkSourceFile(fog.c, $(MESASRCDIR)/src)
-LinkSourceFile(get.c, $(MESASRCDIR)/src)
-#ifdef NeedAllMesaSrc
-LinkSourceFile(glapi.c, $(MESASRCDIR)/src)
-LinkSourceFile(glthread.c, $(MESASRCDIR)/src)
-#endif
-LinkSourceFile(hash.c, $(MESASRCDIR)/src)
-LinkSourceFile(hint.c, $(MESASRCDIR)/src)
-LinkSourceFile(histogram.c, $(MESASRCDIR)/src)
-LinkSourceFile(image.c, $(MESASRCDIR)/src)
-LinkSourceFile(imports.c, $(MESASRCDIR)/src)
-LinkSourceFile(light.c, $(MESASRCDIR)/src)
-LinkSourceFile(lines.c, $(MESASRCDIR)/src)
-LinkSourceFile(matrix.c, $(MESASRCDIR)/src)
-LinkSourceFile(mmath.c, $(MESASRCDIR)/src)
-LinkSourceFile(pixel.c, $(MESASRCDIR)/src)
-LinkSourceFile(points.c, $(MESASRCDIR)/src)
-LinkSourceFile(polygon.c, $(MESASRCDIR)/src)
-LinkSourceFile(rastpos.c, $(MESASRCDIR)/src)
-LinkSourceFile(state.c, $(MESASRCDIR)/src)
-LinkSourceFile(stencil.c, $(MESASRCDIR)/src)
-LinkSourceFile(texcompress.c, $(MESASRCDIR)/src)
-LinkSourceFile(texformat.c, $(MESASRCDIR)/src)
-LinkSourceFile(teximage.c, $(MESASRCDIR)/src)
-LinkSourceFile(texobj.c, $(MESASRCDIR)/src)
-LinkSourceFile(texstate.c, $(MESASRCDIR)/src)
-LinkSourceFile(texstore.c, $(MESASRCDIR)/src)
-LinkSourceFile(texutil.c, $(MESASRCDIR)/src)
-LinkSourceFile(varray.c, $(MESASRCDIR)/src)
-LinkSourceFile(vtxfmt.c, $(MESASRCDIR)/src)
-LinkSourceFile(vpexec.c, $(MESASRCDIR)/src)
-LinkSourceFile(vpexec.h, $(MESASRCDIR)/src)
-LinkSourceFile(vpparse.c, $(MESASRCDIR)/src)
-LinkSourceFile(vpparse.h, $(MESASRCDIR)/src)
-LinkSourceFile(vpstate.c, $(MESASRCDIR)/src)
-LinkSourceFile(vpstate.h, $(MESASRCDIR)/src)
-
-#endif
-
-#ifdef NeedAllMesaSrc
- DISPATCHOBJS = $(MESABUILDDIR)dispatch.o
- GLAPIOBJS = $(MESABUILDDIR)glapi.o
-GLAPINOOPOBJS = $(MESABUILDDIR)glapinoop.o
- GLTHREADOBJS = $(MESABUILDDIR)glthread.o
-#endif
-
-COREMESABASEOBJS = \
- $(MESABUILDDIR)accum.o \
- $(MESABUILDDIR)api_arrayelt.o \
- $(MESABUILDDIR)api_eval.o \
- $(MESABUILDDIR)api_loopback.o \
- $(MESABUILDDIR)api_noop.o \
- $(MESABUILDDIR)api_validate.o \
- $(MESABUILDDIR)attrib.o \
- $(MESABUILDDIR)blend.o \
- $(MESABUILDDIR)buffers.o \
- $(MESABUILDDIR)clip.o \
- $(MESABUILDDIR)colortab.o \
- $(MESABUILDDIR)context.o \
- $(MESABUILDDIR)convolve.o \
- $(MESABUILDDIR)debug.o \
- $(MESABUILDDIR)depth.o \
- $(DISPATCHOBJS) \
- $(MESABUILDDIR)dlist.o \
- $(MESABUILDDIR)drawpix.o \
- $(MESABUILDDIR)enable.o \
- $(MESABUILDDIR)enums.o \
- $(MESABUILDDIR)eval.o \
- $(MESABUILDDIR)extensions.o \
- $(MESABUILDDIR)feedback.o \
- $(MESABUILDDIR)fog.o \
- $(MESABUILDDIR)get.o \
- $(GLAPIOBJS) \
- $(GLTHREADOBJS) \
- $(MESABUILDDIR)hash.o \
- $(MESABUILDDIR)hint.o \
- $(MESABUILDDIR)histogram.o \
- $(MESABUILDDIR)image.o \
- $(MESABUILDDIR)imports.o \
- $(MESABUILDDIR)light.o \
- $(MESABUILDDIR)lines.o \
- $(MESABUILDDIR)matrix.o \
- $(MESABUILDDIR)mmath.o \
- $(MESABUILDDIR)pixel.o \
- $(MESABUILDDIR)points.o \
- $(MESABUILDDIR)polygon.o \
- $(MESABUILDDIR)rastpos.o \
- $(MESABUILDDIR)state.o \
- $(MESABUILDDIR)stencil.o \
- $(MESABUILDDIR)texcompress.o \
- $(MESABUILDDIR)texformat.o \
- $(MESABUILDDIR)teximage.o \
- $(MESABUILDDIR)texobj.o \
- $(MESABUILDDIR)texstate.o \
- $(MESABUILDDIR)texstore.o \
- $(MESABUILDDIR)texutil.o \
- $(MESABUILDDIR)varray.o \
- $(MESABUILDDIR)vtxfmt.o \
- $(MESABUILDDIR)vpexec.o \
- $(MESABUILDDIR)vpparse.o \
- $(MESABUILDDIR)vpstate.o
-
-
-COREMESAOBJS = $(COREMESABASEOBJS) \
- $(MESA_AC_OBJS) \
- $(MESA_MATH_OBJS) \
- $(MESA_SWRAST_OBJS) \
- $(MESA_SWR_SETUP_OBJS) \
- $(MESA_TNL_OBJS)
-
-#ifdef NeedAllMesaSrc
- DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o
- GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o
-GLAPINOOPUOBJS = $(MESABUILDDIR)unshared/glapinoop.o
- GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o
-#endif
-
-#if defined(DoSharedLib) && DoSharedLib
-COREMESABASEUOBJS = $(MESABUILDDIR)unshared/accum.o \
- $(MESABUILDDIR)unshared/api_arrayelt.o \
- $(MESABUILDDIR)unshared/api_eval.o \
- $(MESABUILDDIR)unshared/api_loopback.o \
- $(MESABUILDDIR)unshared/api_noop.o \
- $(MESABUILDDIR)unshared/api_validate.o \
- $(MESABUILDDIR)unshared/attrib.o \
- $(MESABUILDDIR)unshared/blend.o \
- $(MESABUILDDIR)unshared/buffers.o \
- $(MESABUILDDIR)unshared/clip.o \
- $(MESABUILDDIR)unshared/colortab.o \
- $(MESABUILDDIR)unshared/context.o \
- $(MESABUILDDIR)unshared/convolve.o \
- $(MESABUILDDIR)unshared/debug.o \
- $(MESABUILDDIR)unshared/depth.o \
- $(DISPATCHUOBJS) \
- $(MESABUILDDIR)unshared/dlist.o \
- $(MESABUILDDIR)unshared/drawpix.o \
- $(MESABUILDDIR)unshared/enable.o \
- $(MESABUILDDIR)unshared/enums.o \
- $(MESABUILDDIR)unshared/eval.o \
- $(MESABUILDDIR)unshared/extensions.o \
- $(MESABUILDDIR)unshared/feedback.o \
- $(MESABUILDDIR)unshared/fog.o \
- $(MESABUILDDIR)unshared/get.o \
- $(GLAPIUOBJS) \
- $(GLTHREADUOBJS) \
- $(MESABUILDDIR)unshared/hash.o \
- $(MESABUILDDIR)unshared/hint.o \
- $(MESABUILDDIR)unshared/histogram.o \
- $(MESABUILDDIR)unshared/image.o \
- $(MESABUILDDIR)unshared/imports.o \
- $(MESABUILDDIR)unshared/light.o \
- $(MESABUILDDIR)unshared/lines.o \
- $(MESABUILDDIR)unshared/matrix.o \
- $(MESABUILDDIR)unshared/mmath.o \
- $(MESABUILDDIR)unshared/pixel.o \
- $(MESABUILDDIR)unshared/points.o \
- $(MESABUILDDIR)unshared/polygon.o \
- $(MESABUILDDIR)unshared/rastpos.o \
- $(MESABUILDDIR)unshared/state.o \
- $(MESABUILDDIR)unshared/stencil.o \
- $(MESABUILDDIR)unshared/texcompress.o \
- $(MESABUILDDIR)unshared/texformat.o \
- $(MESABUILDDIR)unshared/teximage.o \
- $(MESABUILDDIR)unshared/texobj.o \
- $(MESABUILDDIR)unshared/texstate.o \
- $(MESABUILDDIR)unshared/texstore.o \
- $(MESABUILDDIR)unshared/texutil.o \
- $(MESABUILDDIR)unshared/varray.o \
- $(MESABUILDDIR)unshared/vtxfmt.o \
- $(MESABUILDDIR)unshared/vpexec.o \
- $(MESABUILDDIR)unshared/vpparse.o \
- $(MESABUILDDIR)unshared/vpstate.o
-#else
-COREMESABASEUOBJS = $(COREMESABASEOBJS)
-#endif
-
-COREMESAUOBJS = $(COREMESABASEUOBJS) \
- $(MESA_AC_UOBJS) \
- $(MESA_MATH_UOBJS) \
- $(MESA_SWRAST_UOBJS) \
- $(MESA_SWR_SETUP_UOBJS) \
- $(MESA_TNL_UOBJS)
-
-#ifdef NeedAllMesaSrc
- DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o
- GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o
-GLAPINOOPDOBJS = $(MESABUILDDIR)debugger/glapinoop.o
- GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o
-#endif
-
-COREMESABASEDOBJS = $(MESABUILDDIR)debugger/accum.o \
- $(MESABUILDDIR)debugger/api_arrayelt.o \
- $(MESABUILDDIR)debugger/api_eval.o \
- $(MESABUILDDIR)debugger/api_loopback.o \
- $(MESABUILDDIR)debugger/api_noop.o \
- $(MESABUILDDIR)debugger/api_validate.o \
- $(MESABUILDDIR)debugger/attrib.o \
- $(MESABUILDDIR)debugger/blend.o \
- $(MESABUILDDIR)debugger/buffers.o \
- $(MESABUILDDIR)debugger/clip.o \
- $(MESABUILDDIR)debugger/colortab.o \
- $(MESABUILDDIR)debugger/context.o \
- $(MESABUILDDIR)debugger/convolve.o \
- $(MESABUILDDIR)debugger/debug.o \
- $(MESABUILDDIR)debugger/depth.o \
- $(DISPATCHDOBJS) \
- $(MESABUILDDIR)debugger/dlist.o \
- $(MESABUILDDIR)debugger/drawpix.o \
- $(MESABUILDDIR)debugger/enable.o \
- $(MESABUILDDIR)debugger/enums.o \
- $(MESABUILDDIR)debugger/eval.o \
- $(MESABUILDDIR)debugger/extensions.o \
- $(MESABUILDDIR)debugger/feedback.o \
- $(MESABUILDDIR)debugger/fog.o \
- $(MESABUILDDIR)debugger/get.o \
- $(GLAPIDOBJS) \
- $(GLTHREADDOBJS) \
- $(MESABUILDDIR)debugger/hash.o \
- $(MESABUILDDIR)debugger/hint.o \
- $(MESABUILDDIR)debugger/histogram.o \
- $(MESABUILDDIR)debugger/image.o \
- $(MESABUILDDIR)debugger/imports.o \
- $(MESABUILDDIR)debugger/light.o \
- $(MESABUILDDIR)debugger/lines.o \
- $(MESABUILDDIR)debugger/matrix.o \
- $(MESABUILDDIR)debugger/mmath.o \
- $(MESABUILDDIR)debugger/pixel.o \
- $(MESABUILDDIR)debugger/points.o \
- $(MESABUILDDIR)debugger/polygon.o \
- $(MESABUILDDIR)debugger/rastpos.o \
- $(MESABUILDDIR)debugger/state.o \
- $(MESABUILDDIR)debugger/stencil.o \
- $(MESABUILDDIR)debugger/texcompress.o \
- $(MESABUILDDIR)debugger/texformat.o \
- $(MESABUILDDIR)debugger/teximage.o \
- $(MESABUILDDIR)debugger/texobj.o \
- $(MESABUILDDIR)debugger/texstate.o \
- $(MESABUILDDIR)debugger/texstore.o \
- $(MESABUILDDIR)debugger/texutil.o \
- $(MESABUILDDIR)debugger/varray.o \
- $(MESABUILDDIR)debugger/vtxfmt.o \
- $(MESABUILDDIR)debugger/vpexec.o \
- $(MESABUILDDIR)debugger/vpparse.o \
- $(MESABUILDDIR)debugger/vpstate.o
-
-COREMESADOBJS = $(COREMESABASEDOBJS) \
- $(MESA_AC_DOBJS) \
- $(MESA_MATH_DOBJS) \
- $(MESA_SWRAST_DOBJS) \
- $(MESA_SWR_SETUP_DOBJS) \
- $(MESA_TNL_DOBJS)
-
-#ifdef NeedAllMesaSrc
- DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o
- GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o
-GLAPINOOPPOBJS = $(MESABUILDDIR)profiled/glapinoop.o
- GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o
-#endif
-
-COREMESABASEPOBJS = $(MESABUILDDIR)profiled/accum.o \
- $(MESABUILDDIR)profiled/api_arrayelt.o \
- $(MESABUILDDIR)profiled/api_eval.o \
- $(MESABUILDDIR)profiled/api_loopback.o \
- $(MESABUILDDIR)profiled/api_noop.o \
- $(MESABUILDDIR)profiled/api_validate.o \
- $(MESABUILDDIR)profiled/attrib.o \
- $(MESABUILDDIR)profiled/blend.o \
- $(MESABUILDDIR)profiled/buffers.o \
- $(MESABUILDDIR)profiled/clip.o \
- $(MESABUILDDIR)profiled/colortab.o \
- $(MESABUILDDIR)profiled/context.o \
- $(MESABUILDDIR)profiled/convolve.o \
- $(MESABUILDDIR)profiled/debug.o \
- $(MESABUILDDIR)profiled/depth.o \
- $(DISPATCHPOBJS) \
- $(MESABUILDDIR)profiled/dlist.o \
- $(MESABUILDDIR)profiled/drawpix.o \
- $(MESABUILDDIR)profiled/enable.o \
- $(MESABUILDDIR)profiled/enums.o \
- $(MESABUILDDIR)profiled/eval.o \
- $(MESABUILDDIR)profiled/extensions.o \
- $(MESABUILDDIR)profiled/feedback.o \
- $(MESABUILDDIR)profiled/fog.o \
- $(MESABUILDDIR)profiled/get.o \
- $(GLAPIPOBJS) \
- $(GLTHREADPOBJS) \
- $(MESABUILDDIR)profiled/hash.o \
- $(MESABUILDDIR)profiled/hint.o \
- $(MESABUILDDIR)profiled/histogram.o \
- $(MESABUILDDIR)profiled/image.o \
- $(MESABUILDDIR)profiled/imports.o \
- $(MESABUILDDIR)profiled/light.o \
- $(MESABUILDDIR)profiled/lines.o \
- $(MESABUILDDIR)profiled/matrix.o \
- $(MESABUILDDIR)profiled/mmath.o \
- $(MESABUILDDIR)profiled/pixel.o \
- $(MESABUILDDIR)profiled/points.o \
- $(MESABUILDDIR)profiled/polygon.o \
- $(MESABUILDDIR)profiled/rastpos.o \
- $(MESABUILDDIR)profiled/state.o \
- $(MESABUILDDIR)profiled/stencil.o \
- $(MESABUILDDIR)profiled/texcompress.o \
- $(MESABUILDDIR)profiled/texformat.o \
- $(MESABUILDDIR)profiled/teximage.o \
- $(MESABUILDDIR)profiled/texobj.o \
- $(MESABUILDDIR)profiled/texstate.o \
- $(MESABUILDDIR)profiled/texstore.o \
- $(MESABUILDDIR)profiled/texutil.o \
- $(MESABUILDDIR)profiled/varray.o \
- $(MESABUILDDIR)profiled/vtxfmt.o \
- $(MESABUILDDIR)profiled/vpexec.o \
- $(MESABUILDDIR)profiled/vpparse.o \
- $(MESABUILDDIR)profiled/vpstate.o
-
-COREMESAPOBJS = $(COREMESABASEPOBJS) \
- $(MESA_AC_POBJS) \
- $(MESA_MATH_POBJS) \
- $(MESA_SWRAST_POBJS) \
- $(MESA_SWR_SETUP_POBJS) \
- $(MESA_TNL_POBJS)
-
diff --git a/xc/lib/GL/mesa/src/OSmesa/OSMesa-def.cpp b/xc/lib/GL/mesa/src/OSmesa/OSMesa-def.cpp
deleted file mode 100644
index 51d51139b..000000000
--- a/xc/lib/GL/mesa/src/OSmesa/OSMesa-def.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-LIBRARY libOSmesa
-VERSION LIBRARY_VERSION
-EXPORTS
- OSMesaCreateContext
- OSMesaDestroyContext
- OSMesaGetColorBuffer
- OSMesaGetCurrentContext
- OSMesaGetDepthBuffer
- OSMesaGetIntegerv
- OSMesaMakeCurrent
- OSMesaPixelStore
-#ifndef __UNIXOS2__
- _glapi_Context
- _glapi_noop_enable_warnings
- _glapi_add_entrypoint
- _glapi_get_dispatch_table_size
- _glapi_set_dispatch
- _glapi_check_multithread
- _glapi_set_context
- glTexCoordPointer
- glColorPointer
- glNormalPointer
- glVertexPointer
- glDrawElements
-#else
- OSMesaCreateContextExt
-#endif /* __UNIXOS2__ */
-
-/* $XFree86: xc/lib/GL/mesa/src/OSmesa/OSMesa-def.cpp,v 1.2 2003/03/25 04:18:08 dawes Exp $ */
diff --git a/xc/lib/GL/mesa/src/drv/common/Imakefile.inc b/xc/lib/GL/mesa/src/drv/common/Imakefile.inc
deleted file mode 100644
index 2c65e9d2e..000000000
--- a/xc/lib/GL/mesa/src/drv/common/Imakefile.inc
+++ /dev/null
@@ -1,72 +0,0 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile.inc,v 1.3 2003/05/27 16:34:32 tsi Exp $
-
-#ifndef MesaDrvSrcDir
-#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv
-#endif
-
-MESADRVSRCDIR = MesaDrvSrcDir
-
-#ifndef MesaDrvCommonBuildDir
-#define MesaDrvCommonBuildDir $(MESADRVSRCDIR)/common/
-#endif
-MESADRVCOMMONBUILDDIR = MesaDrvCommonBuildDir
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=$(X_BYTE_ORDER)
- DRI_INCLUDES = -I$(GLXLIBSRC)/dri \
- -I$(GLXLIBSRC)/glx \
- -I$(INCLUDESRC) \
- -I$(INCLUDESRC)/GL \
- -I$(SERVERSRC)/GL/dri \
- -I$(XF86OSSRC) \
- -I$(XF86COMSRC) \
- -I$(GLXLIBSRC)/dri/drm \
- -I$(GLXLIBSRC)/include
-#endif
-
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESADRVSRCDIR)/common
- X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC)
-
- MMSRC = $(MESADRVCOMMONBUILDDIR)mm.c
- UTILSSRC = $(MESADRVCOMMONBUILDDIR)utils.c
- TEXMEMSRC = $(MESADRVCOMMONBUILDDIR)texmem.c
- VBLANKSRC = $(MESADRVCOMMONBUILDDIR)vblank.c
- XMLCONFIGSRC = $(MESADRVCOMMONBUILDDIR)xmlconfig.c
-
- MMOBJ = $(MESADRVCOMMONBUILDDIR)mm.o
- UTILSOBJ = $(MESADRVCOMMONBUILDDIR)utils.o
- TEXMEMOBJ = $(MESADRVCOMMONBUILDDIR)texmem.o
- VBLANKOBJ = $(MESADRVCOMMONBUILDDIR)vblank.o
- XMLCONFIGOBJ = $(MESADRVCOMMONBUILDDIR)xmlconfig.o
-
- MMUOBJ = $(MESADRVCOMMONBUILDDIR)unshared/mm.o
- UTILSUOBJ = $(MESADRVCOMMONBUILDDIR)unshared/utils.o
- TEXMEMUOBJ = $(MESADRVCOMMONBUILDDIR)unshared/texmem.o
- VBLANKUOBJ = $(MESADRVCOMMONBUILDDIR)unshared/vblank.o
-XMLCONFIGUOBJ = $(MESADRVCOMMONBUILDDIR)unshared/xmlconfig.o
-
- MMDOBJ = $(MESADRVCOMMONBUILDDIR)debugger/mm.o
- UTILSDOBJ = $(MESADRVCOMMONBUILDDIR)debugger/utils.o
- TEXMEMDOBJ = $(MESADRVCOMMONBUILDDIR)debugger/texmem.o
- VBLANKDOBJ = $(MESADRVCOMMONBUILDDIR)debugger/vblank.o
-XMLCONFIGDOBJ = $(MESADRVCOMMONBUILDDIR)debugger/xmlconfig.o
-
- MMPOBJ = $(MESADRVCOMMONBUILDDIR)profiled/mm.o
- UTILSPOBJ = $(MESADRVCOMMONBUILDDIR)profiled/utils.o
- TEXMEMPOBJ = $(MESADRVCOMMONBUILDDIR)profiled/texmem.o
- VBLANKPOBJ = $(MESADRVCOMMONBUILDDIR)profiled/vblank.o
-XMLCONFIGPOBJ = $(MESADRVCOMMONBUILDDIR)profiled/xmlconfig.o
-
-#ifdef NeedToLinkMesaSrc
-LinkSourceFile(hwlog.c, $(MESADRVSRCDIR)/common)
-LinkSourceFile(mm.c, $(MESADRVSRCDIR)/common)
-LinkSourceFile(texmem.c, $(MESADRVSRCDIR)/common)
-LinkSourceFile(utils.c, $(MESADRVSRCDIR)/common)
-LinkSourceFile(vblank.c, $(MESADRVSRCDIR)/common)
-LinkSourceFile(xmlconfig.c, $(MESADRVSRCDIR)/common)
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/depthtmp.h b/xc/lib/GL/mesa/src/drv/common/depthtmp.h
deleted file mode 100644
index f3da61e51..000000000
--- a/xc/lib/GL/mesa/src/drv/common/depthtmp.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-
-#ifndef HAVE_HW_DEPTH_SPANS
-#define HAVE_HW_DEPTH_SPANS 0
-#endif
-#ifndef HAVE_HW_DEPTH_PIXELS
-#define HAVE_HW_DEPTH_PIXELS 0
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK() HW_LOCK()
-#endif
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK() HW_UNLOCK()
-#endif
-
-static void TAG(WriteDepthSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth *depth,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint x1;
- GLint n1;
- LOCAL_DEPTH_VARS;
-
- y = Y_FLIP( y );
-
-#if HAVE_HW_DEPTH_SPANS
- (void) x1; (void) n1;
-
- if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n",
- (int)n, (int)x );
-
- WRITE_DEPTH_SPAN();
-#else
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN( x, y, n, x1, n1, i );
-
- if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1 );
-
- if ( mask ) {
- for ( ; i < n1 ; i++, x1++ ) {
- if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] );
- }
- } else {
- for ( ; i < n1 ; i++, x1++ ) {
- WRITE_DEPTH( x1, y, depth[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteDepthPixels)( GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLdepth depth[],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint i;
- LOCAL_DEPTH_VARS;
-
- if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" );
-
-#if HAVE_HW_DEPTH_PIXELS
- (void) i;
-
- WRITE_DEPTH_PIXELS();
-#else
- HW_CLIPLOOP()
- {
- for ( i = 0 ; i < n ; i++ ) {
- if ( mask[i] ) {
- const int fy = Y_FLIP( y[i] );
- if ( CLIPPIXEL( x[i], fy ) )
- WRITE_DEPTH( x[i], fy, depth[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_WRITE_UNLOCK();
-}
-
-
-/* Read depth spans and pixels
- */
-static void TAG(ReadDepthSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLdepth depth[] )
-{
- HW_READ_LOCK()
- {
- GLint x1, n1;
- LOCAL_DEPTH_VARS;
-
- y = Y_FLIP( y );
-
- if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" );
-
-#if HAVE_HW_DEPTH_SPANS
- (void) x1; (void) n1;
-
- READ_DEPTH_SPAN();
-#else
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN( x, y, n, x1, n1, i );
- for ( ; i < n1 ; i++ )
- READ_DEPTH( depth[i], (x1+i), y );
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_READ_UNLOCK();
-}
-
-static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLdepth depth[] )
-{
- HW_READ_LOCK()
- {
- GLint i;
- LOCAL_DEPTH_VARS;
-
- if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" );
-
-#if HAVE_HW_DEPTH_PIXELS
- (void) i;
-
- READ_DEPTH_PIXELS();
-#else
- HW_CLIPLOOP()
- {
- for ( i = 0 ; i < n ;i++ ) {
- int fy = Y_FLIP( y[i] );
- if ( CLIPPIXEL( x[i], fy ) )
- READ_DEPTH( depth[i], x[i], fy );
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_READ_UNLOCK();
-}
-
-
-#if HAVE_HW_DEPTH_SPANS
-#undef WRITE_DEPTH_SPAN
-#undef WRITE_DEPTH_PIXELS
-#undef READ_DEPTH_SPAN
-#undef READ_DEPTH_PIXELS
-#else
-#undef WRITE_DEPTH
-#undef READ_DEPTH
-#endif
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.c b/xc/lib/GL/mesa/src/drv/common/hwlog.c
deleted file mode 100644
index a38789760..000000000
--- a/xc/lib/GL/mesa/src/drv/common/hwlog.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- *
- * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.c,v 1.3 2001/08/18 02:51:03 dawes Exp $ */
-
-#include "hwlog.h"
-hwlog_t hwlog = { 0,0,0, "[???] "};
-
-
-/* Should be shared, but is this a good place for it?
- */
-#include <sys/time.h>
-#include <stdarg.h>
-
-
-#ifdef HW_LOG_ENABLED
-static int usec( void )
-{
- struct timeval tv;
- struct timezone tz;
-
- gettimeofday( &tv, &tz );
-
- return (tv.tv_sec & 2047) * 1000000 + tv.tv_usec;
-}
-
-int hwOpenLog(const char *filename, char *prefix)
-{
- hwCloseLog();
- hwSetLogLevel(0);
- hwlog.prefix=prefix;
- if (!filename)
- return -1;
- if ((hwlog.file = fopen(filename,"w")) == NULL)
- return -1;
- return 0;
-}
-
-void hwCloseLog()
-{
- if (hwlog.file) {
- fclose(hwlog.file);
- hwlog.file = NULL;
- }
-}
-
-int hwIsLogReady()
-{
- return (hwlog.file != NULL);
-}
-
-void hwSetLogLevel(int level)
-{
- hwlog.level = level;
-}
-
-int hwGetLogLevel()
-{
- return hwlog.level;
-}
-
-void hwLog(int level, const char *format, ...)
-{
- va_list ap;
- va_start(ap,format);
- hwLogv(level,format,ap);
- va_end(ap);
-}
-
-void hwLogv(int l, const char *format, va_list ap)
-{
- if (hwlog.file && (l <= hwlog.level)) {
- vfprintf(hwlog.file,format,ap);
- fflush(hwlog.file);
- }
-}
-
-void hwMsg(int l, const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
-
- if (l <= hwlog.level) {
- if (hwIsLogReady()) {
- int t = usec();
-
- hwLog(l, "%6i:", t - hwlog.timeTemp);
- hwlog.timeTemp = t;
- hwLogv(l, format, ap);
- } else {
- fprintf(stderr, hwlog.prefix);
- vfprintf(stderr, format, ap);
- }
- }
-
- va_end(ap);
-}
-
-#endif
-
-void hwError(const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
-
- fprintf(stderr, hwlog.prefix);
- vfprintf(stderr, format, ap);
- hwLogv(0, format, ap);
-
- va_end(ap);
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.h b/xc/lib/GL/mesa/src/drv/common/hwlog.h
deleted file mode 100644
index 6c5a18555..000000000
--- a/xc/lib/GL/mesa/src/drv/common/hwlog.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- *
- * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.h,v 1.5 2001/10/31 23:22:57 tsi Exp $ */
-
-/* Usage:
- * - use mgaError for error messages. Always write to X error and log file.
- * - use mgaMsg for debugging. Can be disabled by undefining MGA_LOG_ENABLED.
- */
-
-#ifndef HWLOG_INC
-#define HWLOG_INC
-
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#define DBG_LEVEL_BASE 1
-#define DBG_LEVEL_VERBOSE 10
-#define DBG_LEVEL_ENTEREXIT 20
-
-typedef struct
-{
- FILE *file;
- int level;
- unsigned int timeTemp;
- char *prefix;
-} hwlog_t;
-
-extern hwlog_t hwlog;
-
-
-#ifdef HW_LOG_ENABLED
-
-/* open and close log file. */
-int hwOpenLog(const char *filename, char *prefix);
-void hwCloseLog(void);
-
-/* return 1 if log file is succesfully opened */
-int hwIsLogReady(void);
-
-/* set current log level to 'level'. Messages with level less than or equal
- the current log level will be written to the log file. */
-void hwSetLogLevel(int level);
-int hwGetLogLevel(void);
-
-/* hwLog and hwLogv write a message to the log file. */
-/* do not call these directly, use hwMsg() instead */
-void hwLog(int level, const char *format, ...);
-void hwLogv(int level, const char *format, va_list ap);
-
-int usec( void );
-
-/* hwMsg writes a message to the log file or to the standard X error file. */
-void hwMsg(int level, const char *format, ...);
-
-
-#else
-
-
-static __inline__ int hwOpenLog(const char *f, char *prefix) { hwlog.prefix=prefix; return -1; }
-#define hwIsLogReady() (0)
-#define hwGetLogLevel() (-1)
-#define hwLogLevel(n) (0)
-#define hwLog()
-#define hwMsg()
-
-#define hwCloseLog()
-#define hwSetLogLevel(x)
-#define hwLogv(l,f,a)
-
-
-#endif
-
-void hwError(const char *format, ...);
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/mm.c b/xc/lib/GL/mesa/src/drv/common/mm.c
deleted file mode 100644
index 6572ccd99..000000000
--- a/xc/lib/GL/mesa/src/drv/common/mm.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Wittawat Yamwong
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/mm.c,v 1.4 2002/10/30 12:51:27 alanh Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "mm.h"
-
-
-void mmDumpMemInfo( memHeap_t *heap )
-{
- TMemBlock *p;
-
- fprintf(stderr, "Memory heap %p:\n", (void *)heap);
- if (heap == 0) {
- fprintf(stderr, " heap == 0\n");
- } else {
- p = (TMemBlock *)heap;
- while (p) {
- fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
- p->free ? '.':'U',
- p->reserved ? 'R':'.');
- p = p->next;
- }
- }
- fprintf(stderr, "End of memory blocks\n");
-}
-
-memHeap_t *mmInit(int ofs,
- int size)
-{
- PMemBlock blocks;
-
- if (size <= 0) {
- return 0;
- }
- blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock));
- if (blocks) {
- blocks->ofs = ofs;
- blocks->size = size;
- blocks->free = 1;
- return (memHeap_t *)blocks;
- } else
- return 0;
-}
-
-
-static TMemBlock* SliceBlock(TMemBlock *p,
- int startofs, int size,
- int reserved, int alignment)
-{
- TMemBlock *newblock;
-
- /* break left */
- if (startofs > p->ofs) {
- newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock));
- if (!newblock)
- return NULL;
- newblock->ofs = startofs;
- newblock->size = p->size - (startofs - p->ofs);
- newblock->free = 1;
- newblock->next = p->next;
- p->size -= newblock->size;
- p->next = newblock;
- p = newblock;
- }
-
- /* break right */
- if (size < p->size) {
- newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock));
- if (!newblock)
- return NULL;
- newblock->ofs = startofs + size;
- newblock->size = p->size - size;
- newblock->free = 1;
- newblock->next = p->next;
- p->size = size;
- p->next = newblock;
- }
-
- /* p = middle block */
- p->align = alignment;
- p->free = 0;
- p->reserved = reserved;
- return p;
-}
-
-PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch)
-{
- int mask,startofs,endofs;
- TMemBlock *p;
-
- if (!heap || align2 < 0 || size <= 0)
- return NULL;
- mask = (1 << align2)-1;
- startofs = 0;
- p = (TMemBlock *)heap;
- while (p) {
- if ((p)->free) {
- startofs = (p->ofs + mask) & ~mask;
- if ( startofs < startSearch ) {
- startofs = startSearch;
- }
- endofs = startofs+size;
- if (endofs <= (p->ofs+p->size))
- break;
- }
- p = p->next;
- }
- if (!p)
- return NULL;
- p = SliceBlock(p,startofs,size,0,mask+1);
- p->heap = heap;
- return p;
-}
-
-static __inline__ int Join2Blocks(TMemBlock *p)
-{
- if (p->free && p->next && p->next->free) {
- TMemBlock *q = p->next;
- p->size += q->size;
- p->next = q->next;
- free(q);
- return 1;
- }
- return 0;
-}
-
-int mmFreeMem(PMemBlock b)
-{
- TMemBlock *p,*prev;
-
- if (!b)
- return 0;
- if (!b->heap) {
- fprintf(stderr, "no heap\n");
- return -1;
- }
- p = b->heap;
- prev = NULL;
- while (p && p != b) {
- prev = p;
- p = p->next;
- }
- if (!p || p->free || p->reserved) {
- if (!p)
- fprintf(stderr, "block not found in heap\n");
- else if (p->free)
- fprintf(stderr, "block already free\n");
- else
- fprintf(stderr, "block is reserved\n");
- return -1;
- }
- p->free = 1;
- Join2Blocks(p);
- if (prev)
- Join2Blocks(prev);
- return 0;
-}
-
-
-void mmDestroy(memHeap_t *heap)
-{
- TMemBlock *p,*q;
-
- if (!heap)
- return;
- p = (TMemBlock *)heap;
- while (p) {
- q = p->next;
- free(p);
- p = q;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/mm.h b/xc/lib/GL/mesa/src/drv/common/mm.h
deleted file mode 100644
index d52871d39..000000000
--- a/xc/lib/GL/mesa/src/drv/common/mm.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef MM_INC
-#define MM_INC
-
-struct mem_block_t {
- struct mem_block_t *next;
- struct mem_block_t *heap;
- int ofs,size;
- int align;
- int free:1;
- int reserved:1;
-};
-typedef struct mem_block_t TMemBlock;
-typedef struct mem_block_t *PMemBlock;
-
-/* a heap is just the first block in a chain */
-typedef struct mem_block_t memHeap_t;
-
-static __inline__ int mmBlockSize(PMemBlock b)
-{ return b->size; }
-
-static __inline__ int mmOffset(PMemBlock b)
-{ return b->ofs; }
-
-/*
- * input: total size in bytes
- * return: a heap pointer if OK, NULL if error
- */
-memHeap_t *mmInit( int ofs, int size );
-
-/*
- * Allocate 'size' bytes with 2^align2 bytes alignment,
- * restrict the search to free memory after 'startSearch'
- * depth and back buffers should be in different 4mb banks
- * to get better page hits if possible
- * input: size = size of block
- * align2 = 2^align2 bytes alignment
- * startSearch = linear offset from start of heap to begin search
- * return: pointer to the allocated block, 0 if error
- */
-PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2,
- int startSearch );
-
-/*
- * Free block starts at offset
- * input: pointer to a block
- * return: 0 if OK, -1 if error
- */
-int mmFreeMem( PMemBlock b );
-
-/*
- * destroy MM
- */
-void mmDestroy( memHeap_t *mmInit );
-
-/* For debuging purpose. */
-void mmDumpMemInfo( memHeap_t *mmInit );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/mmx.h b/xc/lib/GL/mesa/src/drv/common/mmx.h
deleted file mode 100644
index 49ce7e3e3..000000000
--- a/xc/lib/GL/mesa/src/drv/common/mmx.h
+++ /dev/null
@@ -1,560 +0,0 @@
-/* mmx.h
-
- MultiMedia eXtensions GCC interface library for IA32.
-
- To use this library, simply include this header file
- and compile with GCC. You MUST have inlining enabled
- in order for mmx_ok() to work; this can be done by
- simply using -O on the GCC command line.
-
- Compiling with -DMMX_TRACE will cause detailed trace
- output to be sent to stderr for each mmx operation.
- This adds lots of code, and obviously slows execution to
- a crawl, but can be very useful for debugging.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
- LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR ANY PARTICULAR PURPOSE.
-
- 1997-98 by H. Dietz and R. Fisher
-
- History:
- 97-98* R.Fisher Early versions
- 980501 R.Fisher Original Release
- 980611* H.Dietz Rewrite, correctly implementing inlines, and
- R.Fisher including direct register accesses.
- 980616 R.Fisher Release of 980611 as 980616.
- 980714 R.Fisher Minor corrections to Makefile, etc.
- 980715 R.Fisher mmx_ok() now prevents optimizer from using
- clobbered values.
- mmx_ok() now checks if cpuid instruction is
- available before trying to use it.
- 980726* R.Fisher mm_support() searches for AMD 3DNow, Cyrix
- Extended MMX, and standard MMX. It returns a
- value which is positive if any of these are
- supported, and can be masked with constants to
- see which. mmx_ok() is now a call to this
- 980726* R.Fisher Added i2r support for shift functions
- 980919 R.Fisher Fixed AMD extended feature recognition bug.
- 980921 R.Fisher Added definition/check for _MMX_H.
- Added "float s[2]" to mmx_t for use with
- 3DNow and EMMX. So same mmx_t can be used.
- 981013 R.Fisher Fixed cpuid function 1 bug (looked at wrong reg)
- Fixed psllq_i2r error in mmxtest.c
-
- * Unreleased (internal or interim) versions
-
- Notes:
- It appears that the latest gas has the pand problem fixed, therefore
- I'll undefine BROKEN_PAND by default.
- String compares may be quicker than the multiple test/jumps in vendor
- test sequence in mmx_ok(), but I'm not concerned with that right now.
-
- Acknowledgments:
- Jussi Laako for pointing out the errors ultimately found to be
- connected to the failure to notify the optimizer of clobbered values.
- Roger Hardiman for reminding us that CPUID isn't everywhere, and that
- someone may actually try to use this on a machine without CPUID.
- Also for suggesting code for checking this.
- Robert Dale for pointing out the AMD recognition bug.
- Jimmy Mayfield and Carl Witty for pointing out the Intel recognition
- bug.
- Carl Witty for pointing out the psllq_i2r test bug.
-*/
-
-#ifndef _MMX_H
-#define _MMX_H
-
-//#define MMX_TRACE
-
-/* Warning: at this writing, the version of GAS packaged
- with most Linux distributions does not handle the
- parallel AND operation mnemonic correctly. If the
- symbol BROKEN_PAND is defined, a slower alternative
- coding will be used. If execution of mmxtest results
- in an illegal instruction fault, define this symbol.
-*/
-#undef BROKEN_PAND
-
-
-/* The type of an value that fits in an MMX register
- (note that long long constant values MUST be suffixed
- by LL and unsigned long long values by ULL, lest
- they be truncated by the compiler)
-*/
-typedef union {
- long long q; /* Quadword (64-bit) value */
- unsigned long long uq; /* Unsigned Quadword */
- int d[2]; /* 2 Doubleword (32-bit) values */
- unsigned int ud[2]; /* 2 Unsigned Doubleword */
- short w[4]; /* 4 Word (16-bit) values */
- unsigned short uw[4]; /* 4 Unsigned Word */
- char b[8]; /* 8 Byte (8-bit) values */
- unsigned char ub[8]; /* 8 Unsigned Byte */
- float s[2]; /* Single-precision (32-bit) value */
-} mmx_t;
-
-/* Helper functions for the instruction macros that follow...
- (note that memory-to-register, m2r, instructions are nearly
- as efficient as register-to-register, r2r, instructions;
- however, memory-to-memory instructions are really simulated
- as a convenience, and are only 1/3 as efficient)
-*/
-#ifdef MMX_TRACE
-
-/* Include the stuff for printing a trace to stderr...
-*/
-
-#include <stdio.h>
-
-#define mmx_i2r(op, imm, reg) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (imm); \
- fprintf(stderr, #op "_i2r(" #imm "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (imm)); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_m2r(op, mem, reg) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (mem); \
- fprintf(stderr, #op "_m2r(" #mem "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem)); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_r2m(op, reg, mem) \
- { \
- mmx_t mmx_trace; \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #op "_r2m(" #reg "=0x%016llx, ", mmx_trace.q); \
- mmx_trace = (mem); \
- fprintf(stderr, #mem "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=X" (mem) \
- : /* nothing */ ); \
- mmx_trace = (mem); \
- fprintf(stderr, #mem "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_r2r(op, regs, regd) \
- { \
- mmx_t mmx_trace; \
- __asm__ __volatile__ ("movq %%" #regs ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #op "_r2r(" #regs "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #regd ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #regd "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd); \
- __asm__ __volatile__ ("movq %%" #regd ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #regd "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_m2m(op, mems, memd) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (mems); \
- fprintf(stderr, #op "_m2m(" #mems "=0x%016llx, ", mmx_trace.q); \
- mmx_trace = (memd); \
- fprintf(stderr, #memd "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %0, %%mm0\n\t" \
- #op " %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (memd) \
- : "X" (mems)); \
- mmx_trace = (memd); \
- fprintf(stderr, #memd "=0x%016llx\n", mmx_trace.q); \
- }
-
-#else
-
-/* These macros are a lot simpler without the tracing...
-*/
-
-#define mmx_i2r(op, imm, reg) \
- __asm__ __volatile__ (#op " $" #imm ", %%" #reg \
- : /* nothing */ \
- : /* nothing */);
-
-#define mmx_m2r(op, mem, reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem))
-
-#define mmx_r2m(op, reg, mem) \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=X" (mem) \
- : /* nothing */ )
-
-#define mmx_r2r(op, regs, regd) \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd)
-
-#define mmx_m2m(op, mems, memd) \
- __asm__ __volatile__ ("movq %0, %%mm0\n\t" \
- #op " %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (memd) \
- : "X" (mems))
-
-#endif
-
-
-/* 1x64 MOVe Quadword
- (this is both a load and a store...
- in fact, it is the only way to store)
-*/
-#define movq_m2r(var, reg) mmx_m2r(movq, var, reg)
-#define movq_r2m(reg, var) mmx_r2m(movq, reg, var)
-#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd)
-#define movq(vars, vard) \
- __asm__ __volatile__ ("movq %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (vard) \
- : "X" (vars))
-
-
-/* 1x32 MOVe Doubleword
- (like movq, this is both load and store...
- but is most useful for moving things between
- mmx registers and ordinary registers)
-*/
-#define movd_m2r(var, reg) mmx_m2r(movd, var, reg)
-#define movd_r2m(reg, var) mmx_r2m(movd, reg, var)
-#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd)
-#define movd(vars, vard) \
- __asm__ __volatile__ ("movd %1, %%mm0\n\t" \
- "movd %%mm0, %0" \
- : "=X" (vard) \
- : "X" (vars))
-
-
-/* 2x32, 4x16, and 8x8 Parallel ADDs
-*/
-#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg)
-#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd)
-#define paddd(vars, vard) mmx_m2m(paddd, vars, vard)
-
-#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg)
-#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd)
-#define paddw(vars, vard) mmx_m2m(paddw, vars, vard)
-
-#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg)
-#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd)
-#define paddb(vars, vard) mmx_m2m(paddb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic
-*/
-#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg)
-#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd)
-#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard)
-
-#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg)
-#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd)
-#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic
-*/
-#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg)
-#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd)
-#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard)
-
-#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg)
-#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd)
-#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel SUBs
-*/
-#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg)
-#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd)
-#define psubd(vars, vard) mmx_m2m(psubd, vars, vard)
-
-#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg)
-#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd)
-#define psubw(vars, vard) mmx_m2m(psubw, vars, vard)
-
-#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg)
-#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd)
-#define psubb(vars, vard) mmx_m2m(psubb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic
-*/
-#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg)
-#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd)
-#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard)
-
-#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg)
-#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd)
-#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic
-*/
-#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg)
-#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd)
-#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard)
-
-#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg)
-#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd)
-#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard)
-
-
-/* 4x16 Parallel MULs giving Low 4x16 portions of results
-*/
-#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg)
-#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd)
-#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard)
-
-
-/* 4x16 Parallel MULs giving High 4x16 portions of results
-*/
-#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg)
-#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd)
-#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard)
-
-
-/* 4x16->2x32 Parallel Mul-ADD
- (muls like pmullw, then adds adjacent 16-bit fields
- in the multiply result to make the final 2x32 result)
-*/
-#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg)
-#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd)
-#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard)
-
-
-/* 1x64 bitwise AND
-*/
-#ifdef BROKEN_PAND
-#define pand_m2r(var, reg) \
- { \
- mmx_m2r(pandn, (mmx_t) -1LL, reg); \
- mmx_m2r(pandn, var, reg); \
- }
-#define pand_r2r(regs, regd) \
- { \
- mmx_m2r(pandn, (mmx_t) -1LL, regd); \
- mmx_r2r(pandn, regs, regd) \
- }
-#define pand(vars, vard) \
- { \
- movq_m2r(vard, mm0); \
- mmx_m2r(pandn, (mmx_t) -1LL, mm0); \
- mmx_m2r(pandn, vars, mm0); \
- movq_r2m(mm0, vard); \
- }
-#else
-#define pand_m2r(var, reg) mmx_m2r(pand, var, reg)
-#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd)
-#define pand(vars, vard) mmx_m2m(pand, vars, vard)
-#endif
-
-
-/* 1x64 bitwise AND with Not the destination
-*/
-#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg)
-#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd)
-#define pandn(vars, vard) mmx_m2m(pandn, vars, vard)
-
-
-/* 1x64 bitwise OR
-*/
-#define por_m2r(var, reg) mmx_m2r(por, var, reg)
-#define por_r2r(regs, regd) mmx_r2r(por, regs, regd)
-#define por(vars, vard) mmx_m2m(por, vars, vard)
-
-
-/* 1x64 bitwise eXclusive OR
-*/
-#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg)
-#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd)
-#define pxor(vars, vard) mmx_m2m(pxor, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality
- (resulting fields are either 0 or -1)
-*/
-#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg)
-#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd)
-#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard)
-
-#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg)
-#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd)
-#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard)
-
-#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg)
-#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd)
-#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than
- (resulting fields are either 0 or -1)
-*/
-#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg)
-#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd)
-#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard)
-
-#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg)
-#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd)
-#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard)
-
-#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg)
-#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd)
-#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard)
-
-
-/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical
-*/
-#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg)
-#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg)
-#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd)
-#define psllq(vars, vard) mmx_m2m(psllq, vars, vard)
-
-#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg)
-#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg)
-#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd)
-#define pslld(vars, vard) mmx_m2m(pslld, vars, vard)
-
-#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg)
-#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg)
-#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd)
-#define psllw(vars, vard) mmx_m2m(psllw, vars, vard)
-
-
-/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical
-*/
-#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg)
-#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg)
-#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd)
-#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard)
-
-#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg)
-#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg)
-#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd)
-#define psrld(vars, vard) mmx_m2m(psrld, vars, vard)
-
-#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg)
-#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg)
-#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd)
-#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard)
-
-
-/* 2x32 and 4x16 Parallel Shift Right Arithmetic
-*/
-#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg)
-#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg)
-#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd)
-#define psrad(vars, vard) mmx_m2m(psrad, vars, vard)
-
-#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg)
-#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg)
-#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd)
-#define psraw(vars, vard) mmx_m2m(psraw, vars, vard)
-
-
-/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate
- (packs source and dest fields into dest in that order)
-*/
-#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg)
-#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd)
-#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard)
-
-#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg)
-#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd)
-#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard)
-
-
-/* 4x16->8x8 PACK and Unsigned Saturate
- (packs source and dest fields into dest in that order)
-*/
-#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg)
-#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd)
-#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard)
-
-
-/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low
- (interleaves low half of dest with low half of source
- as padding in each result field)
-*/
-#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg)
-#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd)
-#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard)
-
-#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg)
-#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd)
-#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard)
-
-#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg)
-#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd)
-#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard)
-
-
-/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High
- (interleaves high half of dest with high half of source
- as padding in each result field)
-*/
-#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg)
-#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd)
-#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard)
-
-#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg)
-#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd)
-#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard)
-
-#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg)
-#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd)
-#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard)
-
-
-/* Empty MMx State
- (used to clean-up when going from mmx to float use
- of the registers that are shared by both; note that
- there is no float-to-mmx operation needed, because
- only the float tag word info is corruptible)
-*/
-#ifdef MMX_TRACE
-
-#define emms() \
- { \
- fprintf(stderr, "emms()\n"); \
- __asm__ __volatile__ ("emms"); \
- }
-
-#else
-
-#define emms() __asm__ __volatile__ ("emms")
-
-#endif
-
-#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/common/spantmp.h b/xc/lib/GL/mesa/src/drv/common/spantmp.h
deleted file mode 100644
index 888be0465..000000000
--- a/xc/lib/GL/mesa/src/drv/common/spantmp.h
+++ /dev/null
@@ -1,259 +0,0 @@
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK() HW_LOCK()
-#endif
-
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK() HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK() HW_LOCK()
-#endif
-
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK() HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_CLIPLOOP
-#define HW_READ_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-#ifndef HW_WRITE_CLIPLOOP
-#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-
-static void TAG(WriteRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBSpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- for (i=0;i<n;i++)
- {
- if (mask[i]) {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_RGBA( x[i], fy,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint x1;
- GLint n1;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- y = Y_FLIP( y );
-
- if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_PIXEL( x1, y, p );
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint i;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL( x[i], fy ))
- WRITE_PIXEL( x[i], fy, p );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(ReadRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- HW_READ_LOCK()
- {
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;n1>0;i++,x1++,n1--)
- READ_RGBA( rgba[i], x1, y );
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- HW_READ_LOCK()
- {
- GLint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
-
- HW_READ_CLIPLOOP()
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-
-
-#undef WRITE_PIXEL
-#undef WRITE_RGBA
-#undef READ_RGBA
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h
deleted file mode 100644
index 365e9811a..000000000
--- a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK() HW_LOCK()
-#endif
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK() HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK() HW_LOCK()
-#endif
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK() HW_UNLOCK()
-#endif
-
-static void TAG(WriteStencilSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLstencil *stencil,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint x1;
- GLint n1;
- LOCAL_STENCIL_VARS;
-
- y = Y_FLIP(y);
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;i<n1;i++,x1++)
- if (mask[i])
- WRITE_STENCIL( x1, y, stencil[i] );
- }
- else
- {
- for (;i<n1;i++,x1++)
- WRITE_STENCIL( x1, y, stencil[i] );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteStencilPixels)( GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLstencil stencil[],
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- GLint i;
- LOCAL_STENCIL_VARS;
-
- if (DBG) fprintf(stderr, "WriteStencilPixels\n");
-
- HW_CLIPLOOP()
- {
- for (i=0;i<n;i++)
- {
- if (mask[i]) {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_STENCIL( x[i], fy, stencil[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-/* Read stencil spans and pixels
- */
-static void TAG(ReadStencilSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLstencil stencil[])
-{
- HW_READ_LOCK()
- {
- GLint x1,n1;
- LOCAL_STENCIL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadStencilSpan\n");
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;i<n1;i++)
- READ_STENCIL( stencil[i], (x1+i), y );
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLstencil stencil[] )
-{
- HW_READ_LOCK()
- {
- GLint i;
- LOCAL_STENCIL_VARS;
-
- if (DBG) fprintf(stderr, "ReadStencilPixels\n");
-
- HW_CLIPLOOP()
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_STENCIL( stencil[i], x[i], fy );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-
-
-#undef WRITE_STENCIL
-#undef READ_STENCIL
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/common/texmem.c b/xc/lib/GL/mesa/src/drv/common/texmem.c
deleted file mode 100644
index 4ed05219d..000000000
--- a/xc/lib/GL/mesa/src/drv/common/texmem.c
+++ /dev/null
@@ -1,1235 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2002, 2003
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- * Kevin E. Martin <kem@users.sourceforge.net>
- * Gareth Hughes <gareth@nvidia.com>
- */
-/* $XFree86:$ */
-
-/** \file texmem.c
- * Implements all of the device-independent texture memory management.
- *
- * Currently, only a simple LRU texture memory management policy is
- * implemented. In the (hopefully very near) future, better policies will be
- * implemented. The idea is that the DRI should be able to run in one of two
- * modes. In the default mode the DRI will dynamically attempt to discover
- * the best texture management policy for the running application. In the
- * other mode, the user (via some sort of as yet TBD mechanism) will select
- * a texture management policy that is known to work well with the
- * application.
- */
-
-#include "texmem.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "macros.h"
-
-#include <assert.h>
-
-
-
-static unsigned dummy_swap_counter;
-
-
-/**
- * Calculate \f$\log_2\f$ of a value. This is a particularly poor
- * implementation of this function. However, since system performance is in
- * no way dependent on this function, the slowness of the implementation is
- * irrelevent.
- *
- * \param n Value whose \f$\log_2\f$ is to be calculated
- */
-
-static unsigned
-driLog2( unsigned n )
-{
- unsigned log2;
-
-
- for ( log2 = 1 ; n > 1 ; log2++ ) {
- n >>= 1;
- }
-
- return log2;
-}
-
-
-
-
-/**
- * Determine if a texture is resident in textureable memory. Depending on
- * the driver, this may or may not be on-card memory. It could be AGP memory
- * or anyother type of memory from which the hardware can directly read
- * texels.
- *
- * This function is intended to be used as the \c IsTextureResident function
- * in the device's \c dd_function_table.
- *
- * \param ctx GL context pointer (currently unused)
- * \param texObj Texture object to be tested
- */
-
-GLboolean
-driIsTextureResident( GLcontext * ctx,
- struct gl_texture_object * texObj )
-{
- driTextureObject * t;
-
-
- t = (driTextureObject *) texObj->DriverData;
- return( (t != NULL) && (t->memBlock != NULL) );
-}
-
-
-
-
-/**
- * (Re)initialize the global circular LRU list. The last element
- * in the array (\a heap->nrRegions) is the sentinal. Keeping it
- * at the end of the array allows the other elements of the array
- * to be addressed rationally when looking up objects at a particular
- * location in texture memory.
- *
- * \param heap Texture heap to be reset
- */
-
-static void resetGlobalLRU( driTexHeap * heap )
-{
- drmTextureRegionPtr list = heap->global_regions;
- unsigned sz = 1U << heap->logGranularity;
- unsigned i;
-
- for (i = 0 ; (i+1) * sz <= heap->size ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = heap->nrRegions;
- list[i].prev = i-1;
- list[i].next = heap->nrRegions;
- list[heap->nrRegions].prev = i;
- list[heap->nrRegions].next = 0;
- heap->global_age[0] = 0;
-}
-
-/**
- * Print out debugging information about the local texture LRU.
- *
- * \param heap Texture heap to be printed
- * \param callername Name of calling function
- */
-static void printLocalLRU( driTexHeap * heap, const char *callername )
-{
- driTextureObject *t;
- unsigned sz = 1U << heap->logGranularity;
-
- fprintf( stderr, "%s in %s:\nLocal LRU, heap %d:\n",
- __FUNCTION__, callername, heap->heapId );
-
- foreach ( t, &heap->texture_objects ) {
- if (!t->memBlock)
- continue;
- if (!t->tObj) {
- fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n",
- (void *)t,
- t->memBlock->ofs / sz,
- t->memBlock->ofs,
- t->memBlock->size );
- } else {
- fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n",
- (void *)t,
- t->memBlock->ofs,
- t->memBlock->size );
- }
- }
- foreach ( t, heap->swapped_objects ) {
- if (!t->tObj) {
- fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t );
- } else {
- fprintf( stderr, "Swapped Texture (%p)\n", (void *)t );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-/**
- * Print out debugging information about the global texture LRU.
- *
- * \param heap Texture heap to be printed
- * \param callername Name of calling function
- */
-static void printGlobalLRU( driTexHeap * heap, const char *callername )
-{
- drmTextureRegionPtr list = heap->global_regions;
- int i, j;
-
- fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n",
- __FUNCTION__, callername, heap->heapId, (void *)list );
-
- for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) {
- fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n",
- j, list[j].age, list[j].next, list[j].prev, list[j].in_use );
- j = list[j].next;
- if ( j == heap->nrRegions ) break;
- }
-
- if ( j != heap->nrRegions ) {
- fprintf( stderr, "Loop detected in global LRU\n" );
- for ( i = 0 ; i < heap->nrRegions ; i++ ) {
- fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n",
- i, list[i].age, list[i].next, list[i].prev, list[i].in_use );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-
-/**
- * Called by the client whenever it touches a local texture.
- *
- * \param t Texture object that the client has accessed
- */
-
-void driUpdateTextureLRU( driTextureObject * t )
-{
- driTexHeap * heap;
- drmTextureRegionPtr list;
- unsigned shift;
- unsigned start;
- unsigned end;
- unsigned i;
-
-
- heap = t->heap;
- if ( heap != NULL ) {
- shift = heap->logGranularity;
- start = t->memBlock->ofs >> shift;
- end = (t->memBlock->ofs + t->memBlock->size - 1) >> shift;
-
-
- heap->local_age = ++heap->global_age[0];
- list = heap->global_regions;
-
-
- /* Update the context's local LRU
- */
-
- move_to_head( & heap->texture_objects, t );
-
-
- for (i = start ; i <= end ; i++) {
- list[i].in_use = 1;
- list[i].age = heap->local_age;
-
- /* remove_from_list(i)
- */
- list[(unsigned)list[i].next].prev = list[i].prev;
- list[(unsigned)list[i].prev].next = list[i].next;
-
- /* insert_at_head(list, i)
- */
- list[i].prev = heap->nrRegions;
- list[i].next = list[heap->nrRegions].next;
- list[(unsigned)list[heap->nrRegions].next].prev = i;
- list[heap->nrRegions].next = i;
- }
-
- if ( 0 ) {
- printGlobalLRU( heap, __FUNCTION__ );
- printLocalLRU( heap, __FUNCTION__ );
- }
- }
-}
-
-
-
-
-/**
- * Keep track of swapped out texture objects.
- *
- * \param t Texture object to be "swapped" out of its texture heap
- */
-
-void driSwapOutTextureObject( driTextureObject * t )
-{
- unsigned face;
-
-
- if ( t->memBlock != NULL ) {
- assert( t->heap != NULL );
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
-
- if (t->timestamp > t->heap->timestamp)
- t->heap->timestamp = t->timestamp;
-
- t->heap->texture_swaps[0]++;
- move_to_tail( t->heap->swapped_objects, t );
- t->heap = NULL;
- }
- else {
- assert( t->heap == NULL );
- }
-
-
- for ( face = 0 ; face < 6 ; face++ ) {
- t->dirty_images[face] = ~0;
- }
-}
-
-
-
-
-/**
- * Destroy hardware state associated with texture \a t. Calls the
- * \a destroy_texture_object method associated with the heap from which
- * \a t was allocated.
- *
- * \param t Texture object to be destroyed
- */
-
-void driDestroyTextureObject( driTextureObject * t )
-{
- driTexHeap * heap;
-
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n",
- __FILE__, __LINE__,
- (void *)t,
- (void *)((t != NULL) ? t->tObj : NULL),
- (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL ));
- }
-
- if ( t != NULL ) {
- if ( t->memBlock ) {
- heap = t->heap;
- assert( heap != NULL );
-
- heap->texture_swaps[0]++;
-
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
-
- if (t->timestamp > t->heap->timestamp)
- t->heap->timestamp = t->timestamp;
-
- heap->destroy_texture_object( heap->driverContext, t );
- t->heap = NULL;
- }
-
- if ( t->tObj != NULL ) {
- assert( t->tObj->DriverData == t );
- t->tObj->DriverData = NULL;
- }
-
- remove_from_list( t );
- FREE( t );
- }
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t );
- }
-}
-
-
-
-
-/**
- * Update the local heap's representation of texture memory based on
- * data in the SAREA. This is done each time it is detected that some other
- * direct rendering client has held the lock. This pertains to both our local
- * textures and the textures belonging to other clients. Keep track of other
- * client's textures by pushing a placeholder texture onto the LRU list --
- * these are denoted by \a tObj being \a NULL.
- *
- * \param heap Heap whose state is to be updated
- * \param offset Byte offset in the heap that has been stolen
- * \param size Size, in bytes, of the stolen block
- * \param in_use Non-zero if the block is in-use by another context
- */
-
-static void driTexturesGone( driTexHeap * heap, int offset, int size,
- int in_use )
-{
- driTextureObject * t;
- driTextureObject * tmp;
-
-
- foreach_s ( t, tmp, & heap->texture_objects ) {
- if ( (t->memBlock->ofs < (offset + size))
- && ((t->memBlock->ofs + t->memBlock->size) > offset) ) {
- /* It overlaps - kick it out. If the texture object is just a
- * place holder, then destroy it all together. Otherwise, mark
- * it as being swapped out.
- */
-
- if ( t->tObj != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- if ( in_use &&
- offset == t->memBlock->ofs && size == t->memBlock->size ) {
- /* Matching placeholder already exists */
- return;
- } else {
- driDestroyTextureObject( t );
- }
- }
- }
- }
-
-
- if ( in_use ) {
- t = (driTextureObject *) CALLOC( heap->texture_object_size );
- if ( t == NULL ) return;
-
- t->memBlock = mmAllocMem( heap->memory_heap, size, 0, offset );
- if ( t->memBlock == NULL ) {
- fprintf( stderr, "Couldn't alloc placeholder: heap %u sz %x ofs %x\n", heap->heapId,
- (int)size, (int)offset );
- mmDumpMemInfo( heap->memory_heap );
- return;
- }
- t->heap = heap;
- insert_at_head( & heap->texture_objects, t );
- }
-}
-
-
-
-
-/**
- * Called by the client on lock contention to determine whether textures have
- * been stolen. If another client has modified a region in which we have
- * textures, then we need to figure out which of our textures have been
- * removed and update our global LRU.
- *
- * \param heap Texture heap to be updated
- */
-
-void driAgeTextures( driTexHeap * heap )
-{
- drmTextureRegionPtr list = heap->global_regions;
- unsigned sz = 1U << (heap->logGranularity);
- unsigned i, nr = 0;
-
-
- /* Have to go right round from the back to ensure stuff ends up
- * LRU in the local list... Fix with a cursor pointer.
- */
-
- for (i = list[heap->nrRegions].prev ;
- i != heap->nrRegions && nr < heap->nrRegions ;
- i = list[i].prev, nr++) {
- /* If switching texturing schemes, then the SAREA might not have been
- * properly cleared, so we need to reset the global texture LRU.
- */
-
- if ( (i * sz) > heap->size ) {
- nr = heap->nrRegions;
- break;
- }
-
- if (list[i].age > heap->local_age)
- driTexturesGone( heap, i * sz, sz, list[i].in_use);
- }
-
- /* Loop or uninitialized heap detected. Reset.
- */
-
- if (nr == heap->nrRegions) {
- driTexturesGone( heap, 0, heap->size, 0);
- resetGlobalLRU( heap );
- }
-
- if ( 0 ) {
- printGlobalLRU( heap, __FUNCTION__ );
- printLocalLRU( heap, __FUNCTION__ );
- }
-
- heap->local_age = heap->global_age[0];
-}
-
-
-
-
-/**
- * Allocate memory from a texture heap to hold a texture object. This
- * routine will attempt to allocate memory for the texture from the heaps
- * specified by \c heap_array in order. That is, first it will try to
- * allocate from \c heap_array[0], then \c heap_array[1], and so on.
- *
- * \param heap_array Array of pointers to texture heaps to use
- * \param nr_heaps Number of heap pointer in \a heap_array
- * \param t Texture object for which space is needed
- * \return The ID of the heap from which memory was allocated, or -1 if
- * memory could not be allocated.
- *
- * \bug The replacement policy implemented by this function is horrible.
- */
-
-
-int
-driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
- driTextureObject * t )
-{
- driTexHeap * heap;
- driTextureObject * temp;
- driTextureObject * cursor;
- unsigned id;
-
-
- /* In case it already has texture space, initialize heap. This also
- * prevents GCC from issuing a warning that heap might be used
- * uninitialized.
- */
-
- heap = t->heap;
-
-
- /* Run through each of the existing heaps and try to allocate a buffer
- * to hold the texture.
- */
-
- for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) {
- heap = heap_array[ id ];
- if ( heap != NULL ) {
- t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
- heap->alignmentShift, 0 );
- }
- }
-
-
- /* Kick textures out until the requested texture fits.
- */
-
- if ( t->memBlock == NULL ) {
- for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) {
- heap = heap_array[ id ];
- if ( t->totalSize <= heap->size ) {
-
- for ( cursor = heap->texture_objects.prev, temp = cursor->prev;
- cursor != &heap->texture_objects ;
- cursor = temp, temp = cursor->prev ) {
-
- /* The the LRU element. If the texture is bound to one of
- * the texture units, then we cannot kick it out.
- */
- if ( cursor->bound /* || cursor->reserved */ ) {
- continue;
- }
-
- /* If this is a placeholder, there's no need to keep it */
- if (cursor->tObj)
- driSwapOutTextureObject( cursor );
- else
- driDestroyTextureObject( cursor );
-
- t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
- heap->alignmentShift, 0 );
-
- if (t->memBlock)
- break;
- }
- } /* if ( t->totalSize <= heap->size ) ... */
- }
- }
-
-
- if ( t->memBlock != NULL ) {
- /* id and heap->heapId may or may not be the same value here.
- */
-
- assert( heap != NULL );
- assert( (t->heap == NULL) || (t->heap == heap) );
-
- t->heap = heap;
- return heap->heapId;
- }
- else {
- assert( t->heap == NULL );
-
- fprintf( stderr, "[%s:%d] unable to allocate texture\n",
- __FUNCTION__, __LINE__ );
- return -1;
- }
-}
-
-
-
-
-
-
-/**
- * Set the location where the texture-swap counter is stored.
- */
-
-void
-driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter )
-{
- heap->texture_swaps = (counter == NULL) ? & dummy_swap_counter : counter;
-}
-
-
-
-
-/**
- * Create a new heap for texture data.
- *
- * \param heap_id Device-dependent heap identifier. This value
- * will returned by driAllocateTexture when memory
- * is allocated from this heap.
- * \param context Device-dependent driver context. This is
- * supplied as the first parameter to the
- * \c destroy_tex_obj function.
- * \param size Size, in bytes, of the texture region
- * \param alignmentShift Alignment requirement for textures. If textures
- * must be allocated on a 4096 byte boundry, this
- * would be 12.
- * \param nr_regions Number of regions into which this texture space
- * should be partitioned
- * \param global_regions Array of \c drmTextureRegion structures in the SAREA
- * \param global_age Pointer to the global texture age in the SAREA
- * \param swapped_objects Pointer to the list of texture objects that are
- * not in texture memory (i.e., have been swapped
- * out).
- * \param texture_object_size Size, in bytes, of a device-dependent texture
- * object
- * \param destroy_tex_obj Function used to destroy a device-dependent
- * texture object
- *
- * \sa driDestroyTextureHeap
- */
-
-driTexHeap *
-driCreateTextureHeap( unsigned heap_id, void * context, unsigned size,
- unsigned alignmentShift, unsigned nr_regions,
- drmTextureRegionPtr global_regions, unsigned * global_age,
- driTextureObject * swapped_objects,
- unsigned texture_object_size,
- destroy_texture_object_t * destroy_tex_obj
- )
-{
- driTexHeap * heap;
- unsigned l;
-
-
- if ( 0 )
- fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n",
- __FUNCTION__,
- heap_id, (void *)context, size, alignmentShift, nr_regions );
-
- heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) );
- if ( heap != NULL ) {
- l = driLog2( (size - 1) / nr_regions );
- if ( l < alignmentShift )
- {
- l = alignmentShift;
- }
-
- heap->logGranularity = l;
- heap->size = size & ~((1L << l) - 1);
-
- heap->memory_heap = mmInit( 0, heap->size );
- if ( heap->memory_heap != NULL ) {
- heap->heapId = heap_id;
- heap->driverContext = context;
-
- heap->alignmentShift = alignmentShift;
- heap->nrRegions = nr_regions;
- heap->global_regions = global_regions;
- heap->global_age = global_age;
- heap->swapped_objects = swapped_objects;
- heap->texture_object_size = texture_object_size;
- heap->destroy_texture_object = destroy_tex_obj;
-
- /* Force global heap init */
- if (heap->global_age == 0)
- heap->local_age = ~0;
- else
- heap->local_age = 0;
-
- make_empty_list( & heap->texture_objects );
- driSetTextureSwapCounterLocation( heap, NULL );
- }
- else {
- FREE( heap );
- heap = NULL;
- }
- }
-
-
- if ( 0 )
- fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap );
-
- return heap;
-}
-
-
-
-
-/** Destroys a texture heap
- *
- * \param heap Texture heap to be destroyed
- */
-
-void
-driDestroyTextureHeap( driTexHeap * heap )
-{
- driTextureObject * t;
- driTextureObject * temp;
-
-
- if ( heap != NULL ) {
- foreach_s( t, temp, & heap->texture_objects ) {
- driDestroyTextureObject( t );
- }
- foreach_s( t, temp, heap->swapped_objects ) {
- driDestroyTextureObject( t );
- }
-
- mmDestroy( heap->memory_heap );
- FREE( heap );
- }
-}
-
-
-
-
-/****************************************************************************/
-/**
- * Determine how many texels (including all mipmap levels) would be required
- * for a texture map of size \f$2^^\c base_size_log2\f$ would require.
- *
- * \param base_size_log2 \f$log_2\f$ of the size of a side of the texture
- * \param dimensions Number of dimensions of the texture. Either 2 or 3.
- * \param faces Number of faces of the texture. Either 1 or 6 (for cube maps).
- * \return Number of texels
- */
-
-static unsigned
-texels_this_map_size( int base_size_log2, unsigned dimensions, unsigned faces )
-{
- unsigned texels;
-
-
- assert( (faces == 1) || (faces == 6) );
- assert( (dimensions == 2) || (dimensions == 3) );
-
- texels = 0;
- if ( base_size_log2 >= 0 ) {
- texels = (1U << (dimensions * base_size_log2));
-
- /* See http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg03636.html
- * for the complete explaination of why this formulation is used.
- * Basically, the smaller mipmap levels sum to 0.333 the size of the
- * level 0 map. The total size is therefore the size of the map
- * multipled by 1.333. The +2 is there to round up.
- */
-
- texels = (texels * 4 * faces + 2) / 3;
- }
-
- return texels;
-}
-
-
-
-
-struct maps_per_heap {
- unsigned c[32];
-};
-
-static void
-fill_in_maximums( driTexHeap * const * heaps, unsigned nr_heaps,
- unsigned max_bytes_per_texel, unsigned max_size,
- unsigned mipmaps_at_once, unsigned dimensions,
- unsigned faces, struct maps_per_heap * max_textures )
-{
- unsigned heap;
- unsigned log2_size;
- unsigned mask;
-
-
- /* Determine how many textures of each size can be stored in each
- * texture heap.
- */
-
- for ( heap = 0 ; heap < nr_heaps ; heap++ ) {
- if ( heaps[ heap ] == NULL ) {
- (void) memset( max_textures[ heap ].c, 0,
- sizeof( max_textures[ heap ].c ) );
- continue;
- }
-
- mask = (1U << heaps[ heap ]->logGranularity) - 1;
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] heap[%u] = %u bytes, mask = 0x%08x\n",
- __FILE__, __LINE__,
- heap, heaps[ heap ]->size, mask );
- }
-
- for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) {
- unsigned total;
-
-
- /* Determine the total number of bytes required by a texture of
- * size log2_size.
- */
-
- total = texels_this_map_size( log2_size, dimensions, faces )
- - texels_this_map_size( log2_size - mipmaps_at_once,
- dimensions, faces );
- total *= max_bytes_per_texel;
- total = (total + mask) & ~mask;
-
- /* The number of textures of a given size that will fit in a heap
- * is equal to the size of the heap divided by the size of the
- * texture.
- */
-
- max_textures[ heap ].c[ log2_size ] = heaps[ heap ]->size / total;
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] "
- "= 0x%08x / 0x%08x "
- "= %u (%u)\n",
- __FILE__, __LINE__,
- heap, log2_size,
- heaps[ heap ]->size, total,
- heaps[ heap ]->size / total,
- max_textures[ heap ].c[ log2_size ] );
- }
- }
- }
-}
-
-
-static unsigned
-get_max_size( unsigned nr_heaps,
- unsigned texture_units,
- unsigned max_size,
- int all_textures_one_heap,
- struct maps_per_heap * max_textures )
-{
- unsigned heap;
- unsigned log2_size;
-
-
- /* Determine the largest texture size such that a texture of that size
- * can be bound to each texture unit at the same time. Some hardware
- * may require that all textures be in the same texture heap for
- * multitexturing.
- */
-
- for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) {
- unsigned total = 0;
-
- for ( heap = 0 ; heap < nr_heaps ; heap++ )
- {
- total += max_textures[ heap ].c[ log2_size ];
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] = %u, "
- "total = %u\n", __FILE__, __LINE__, heap, log2_size,
- max_textures[ heap ].c[ log2_size ], total );
- }
-
- if ( (max_textures[ heap ].c[ log2_size ] >= texture_units)
- || (!all_textures_one_heap && (total >= texture_units)) ) {
- /* The number of mipmap levels is the log-base-2 of the
- * maximum texture size plus 1. If the maximum texture size
- * is 1x1, the log-base-2 is 0 and 1 mipmap level (the base
- * level) is available.
- */
-
- return log2_size + 1;
- }
- }
- }
-
- /* This should NEVER happen. It should always be possible to have at
- * *least* a 1x1 texture in memory!
- */
- assert( log2_size != 0 );
- return 0;
-}
-
-#define SET_MAX(f,v) \
- do { if ( max_sizes[v] != 0 ) { limits-> f = max_sizes[v]; } } while( 0 )
-
-#define SET_MAX_RECT(f,v) \
- do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << max_sizes[v]; } } while( 0 )
-
-
-/**
- * Given the amount of texture memory, the number of texture units, and the
- * maximum size of a texel, calculate the maximum texture size the driver can
- * advertise.
- *
- * \param heaps Texture heaps for this card
- * \param nr_heap Number of texture heaps
- * \param limits OpenGL contants. MaxTextureUnits must be set.
- * \param max_bytes_per_texel Maximum size of a single texel, in bytes
- * \param max_2D_size \f$\log_2\f$ of the maximum 2D texture size (i.e.,
- * 1024x1024 textures, this would be 10)
- * \param max_3D_size \f$\log_2\f$ of the maximum 3D texture size (i.e.,
- * 1024x1024x1024 textures, this would be 10)
- * \param max_cube_size \f$\log_2\f$ of the maximum cube texture size (i.e.,
- * 1024x1024 textures, this would be 10)
- * \param max_rect_size \f$\log_2\f$ of the maximum texture rectangle size
- * (i.e., 1024x1024 textures, this would be 10). This is a power-of-2
- * even though texture rectangles need not be a power-of-2.
- * \param mipmaps_at_once Total number of mipmaps that can be used
- * at one time. For most hardware this will be \f$\c max_size + 1\f$.
- * For hardware that does not support mipmapping, this will be 1.
- * \param all_textures_one_heap True if the hardware requires that all
- * textures be in a single texture heap for multitexturing.
- */
-
-void
-driCalculateMaxTextureLevels( driTexHeap * const * heaps,
- unsigned nr_heaps,
- struct gl_constants * limits,
- unsigned max_bytes_per_texel,
- unsigned max_2D_size,
- unsigned max_3D_size,
- unsigned max_cube_size,
- unsigned max_rect_size,
- unsigned mipmaps_at_once,
- int all_textures_one_heap )
-{
- struct maps_per_heap max_textures[8];
- unsigned i;
- const unsigned dimensions[4] = { 2, 3, 2, 2 };
- const unsigned faces[4] = { 1, 1, 6, 1 };
- unsigned max_sizes[4];
- unsigned mipmaps[4];
-
-
- max_sizes[0] = max_2D_size;
- max_sizes[1] = max_3D_size;
- max_sizes[2] = max_cube_size;
- max_sizes[3] = max_rect_size;
-
- mipmaps[0] = mipmaps_at_once;
- mipmaps[1] = mipmaps_at_once;
- mipmaps[2] = 1;
- mipmaps[3] = mipmaps_at_once;
-
-
- /* Calculate the maximum number of texture levels in two passes. The
- * first pass determines how many textures of each power-of-two size
- * (including all mipmap levels for that size) can fit in each texture
- * heap. The second pass finds the largest texture size that allows
- * a texture of that size to be bound to every texture unit.
- */
-
- for ( i = 0 ; i < 4 ; i++ ) {
- if ( max_sizes[ i ] != 0 ) {
- fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel,
- max_sizes[ i ], mipmaps[ i ],
- dimensions[ i ], faces[ i ],
- max_textures );
-
- max_sizes[ i ] = get_max_size( nr_heaps,
- limits->MaxTextureUnits,
- max_sizes[ i ],
- all_textures_one_heap,
- max_textures );
- }
- }
-
- SET_MAX( MaxTextureLevels, 0 );
- SET_MAX( Max3DTextureLevels, 1 );
- SET_MAX( MaxCubeTextureLevels, 2 );
- SET_MAX_RECT( MaxTextureRectSize, 3 );
-}
-
-
-
-
-/**
- * Perform initial binding of default textures objects on a per unit, per
- * texture target basis.
- *
- * \param ctx Current OpenGL context
- * \param swapped List of swapped-out textures
- * \param targets Bit-mask of value texture targets
- */
-
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
- GLuint targets )
-{
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
- unsigned i;
-
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- ctx->Texture.CurrentUnit = i;
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current1D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current2D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current3D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) {
- texObj = ctx->Texture.Unit[i].CurrentCubeMap;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) {
- texObj = ctx->Texture.Unit[i].CurrentRect;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
- }
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-
-
-/**
- * Verify that the specified texture is in the specificed heap.
- *
- * \param tex Texture to be tested.
- * \param heap Texture memory heap to be tested.
- * \return True if the texture is in the heap, false otherwise.
- */
-
-static GLboolean
-check_in_heap( const driTextureObject * tex, const driTexHeap * heap )
-{
-#if 1
- return tex->heap == heap;
-#else
- driTextureObject * curr;
-
- foreach( curr, & heap->texture_objects ) {
- if ( curr == tex ) {
- break;
- }
- }
-
- return curr == tex;
-#endif
-}
-
-
-
-/****************************************************************************/
-/**
- * Validate the consistency of a set of texture heaps.
- * Original version by Keith Whitwell in r200/r200_sanity.c.
- */
-
-GLboolean
-driValidateTextureHeaps( driTexHeap * const * texture_heaps,
- unsigned nr_heaps, const driTextureObject * swapped )
-{
- driTextureObject *t;
- unsigned i;
-
- for ( i = 0 ; i < nr_heaps ; i++ ) {
- int last_end = 0;
- unsigned textures_in_heap = 0;
- unsigned blocks_in_mempool = 0;
- const driTexHeap * heap = texture_heaps[i];
- const memHeap_t * p = heap->memory_heap;
-
- /* Check each texture object has a MemBlock, and is linked into
- * the correct heap.
- *
- * Check the texobj base address corresponds to the MemBlock
- * range. Check the texobj size (recalculate???) fits within
- * the MemBlock.
- *
- * Count the number of texobj's using this heap.
- */
-
- foreach ( t, &heap->texture_objects ) {
- if ( !check_in_heap( t, heap ) ) {
- fprintf( stderr, "%s memory block for texture object @ %p not "
- "found in heap #%d\n",
- __FUNCTION__, (void *)t, i );
- return GL_FALSE;
- }
-
-
- if ( t->totalSize > t->memBlock->size ) {
- fprintf( stderr, "%s: Memory block for texture object @ %p is "
- "only %u bytes, but %u are required\n",
- __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size );
- return GL_FALSE;
- }
-
- textures_in_heap++;
- }
-
- /* Validate the contents of the heap:
- * - Ordering
- * - Overlaps
- * - Bounds
- */
-
- while ( p != NULL ) {
- if (p->reserved) {
- fprintf( stderr, "%s: Block (%08x,%x), is reserved?!\n",
- __FUNCTION__, p->ofs, p->size );
- return GL_FALSE;
- }
-
- if (p->ofs != last_end) {
- fprintf( stderr, "%s: blocks_in_mempool = %d, last_end = %d, p->ofs = %d\n",
- __FUNCTION__, blocks_in_mempool, last_end, p->ofs );
- return GL_FALSE;
- }
-
- if (!p->reserved && !p->free) {
- blocks_in_mempool++;
- }
-
- last_end = p->ofs + p->size;
- p = p->next;
- }
-
- if (textures_in_heap != blocks_in_mempool) {
- fprintf( stderr, "%s: Different number of textures objects (%u) and "
- "inuse memory blocks (%u)\n",
- __FUNCTION__, textures_in_heap, blocks_in_mempool );
- return GL_FALSE;
- }
-
-#if 0
- fprintf( stderr, "%s: textures_in_heap = %u\n",
- __FUNCTION__, textures_in_heap );
-#endif
- }
-
-
- /* Check swapped texobj's have zero memblocks
- */
- i = 0;
- foreach ( t, swapped ) {
- if ( t->memBlock != NULL ) {
- fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n",
- __FUNCTION__, (void *)t, (void *)t->memBlock );
- return GL_FALSE;
- }
- i++;
- }
-
-#if 0
- fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i );
-#endif
-
- return GL_TRUE;
-}
-
-
-
-
-/****************************************************************************/
-/**
- * Compute which mipmap levels that really need to be sent to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- */
-
-void
-driCalculateTextureFirstLastLevel( driTextureObject * t )
-{
- struct gl_texture_object * const tObj = t->tObj;
- const struct gl_texture_image * const baseImage =
- tObj->Image[tObj->BaseLevel];
-
- /* These must be signed values. MinLod and MaxLod can be negative numbers,
- * and having firstLevel and lastLevel as signed prevents the need for
- * extra sign checks.
- */
- int firstLevel;
- int lastLevel;
-
- /* Yes, this looks overly complicated, but it's all needed.
- */
-
- switch (tObj->Target) {
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_CUBE_MAP:
- if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
- /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
- */
-
- firstLevel = lastLevel = tObj->BaseLevel;
- }
- else {
- firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, t->tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, t->tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_TEXTURE_4D_SGIS:
- firstLevel = lastLevel = 0;
- break;
- default:
- return;
- }
-
- /* save these values */
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/texmem.h b/xc/lib/GL/mesa/src/drv/common/texmem.h
deleted file mode 100644
index 9afbb0c86..000000000
--- a/xc/lib/GL/mesa/src/drv/common/texmem.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- * Kevin E. Martin <kem@users.sourceforge.net>
- * Gareth Hughes <gareth@nvidia.com>
- */
-/* $XFree86:$ */
-
-/** \file texmem.h
- * Public interface to the DRI texture memory management routines.
- *
- * \sa texmem.c
- */
-
-#ifndef DRI_TEXMEM_H
-#define DRI_TEXMEM_H
-
-#include "mtypes.h"
-#include "mm.h"
-#include "xf86drm.h"
-
-struct dri_tex_heap;
-typedef struct dri_tex_heap driTexHeap;
-
-struct dri_texture_object;
-typedef struct dri_texture_object driTextureObject;
-
-
-/**
- * Base texture object type. Each driver will extend this type with its own
- * private data members.
- */
-
-struct dri_texture_object {
- struct dri_texture_object * next;
- struct dri_texture_object * prev;
-
- driTexHeap * heap; /**< Texture heap currently stored in */
- struct gl_texture_object * tObj;/**< Pointer to Mesa texture object
- * If NULL, this texture object is a
- * "placeholder" object representing
- * texture memory in use by another context.
- * A placeholder should have a heap and a memBlock.
- */
- PMemBlock memBlock; /**< Memory block containing texture */
- unsigned bound; /**< Texture unit currently bound to */
-
- unsigned totalSize; /**< Total size of the texture,
- * including all mipmap levels
- */
-
- unsigned dirty_images[6]; /**< Flags for whether or not images
- * need to be uploaded to local or
- * AGP texture space. One flag set
- * for each cube face for cubic
- * textures. Bit zero corresponds to
- * the base-level, which may or may
- * not be the level zero mipmap.
- */
-
- unsigned timestamp; /**< Timestamp used to
- * synchronize with 3d engine
- * in hardware where textures
- * are uploaded directly to
- * the framebuffer.
- */
-
- unsigned firstLevel; /**< Image in \c tObj->Image that
- * corresponds to the base-level of
- * this texture object.
- */
-
- unsigned lastLevel; /**< Last image in \c tObj->Image used
- * by the current LOD settings of this
- * texture object. This value must be
- * greater than or equal to
- * \c firstLevel.
- */
-};
-
-
-typedef void (destroy_texture_object_t)( void * driverContext,
- driTextureObject * t );
-
-/**
- * Client-private representation of texture memory state.
- *
- * Clients will place one or more of these structs in their driver
- * context struct to manage one or more global texture heaps.
- */
-
-struct dri_tex_heap {
-
- /** Client-supplied heap identifier
- */
- unsigned heapId;
-
- /** Pointer to the client's private context
- */
- void *driverContext;
-
- /** Total size of the heap, in bytes
- */
- unsigned size;
-
- /** \brief \f$log_2\f$ of size of single heap region
- *
- * Each context takes memory from the global texture heap in
- * \f$2^{logGranularity}\f$ byte blocks. The value of
- * \a logGranularity is based on the amount of memory represented
- * by the heap and the maximum number of regions in the SAREA. Given
- * \a b bytes of texture memory an \a n regions in the SAREA,
- * \a logGranularity will be \f$\lfloor\log_2( b / n )\rfloor\f$.
- */
- unsigned logGranularity;
-
- /** \brief Required alignment of allocations in this heap
- *
- * The alignment shift is supplied to \a mmAllocMem when memory is
- * allocated from this heap. The value of \a alignmentShift will
- * typically reflect some require of the hardware. This value has
- * \b no \b relation to \a logGranularity. \a alignmentShift is a
- * per-context value.
- *
- * \sa mmAllocMem
- */
- unsigned alignmentShift;
-
- /** Number of elements in global list (the SAREA).
- */
- unsigned nrRegions;
-
- /** Pointer to SAREA \a driTexRegion array
- */
- drmTextureRegionPtr global_regions;
-
- /** Pointer to the texture state age (generation number) in the SAREA
- */
- unsigned * global_age;
-
- /** Local age (generation number) of texture state
- */
- unsigned local_age;
-
- /** Memory heap used to manage texture memory represented by
- * this texture heap.
- */
- memHeap_t * memory_heap;
-
- /** List of objects that we currently believe to be in texture
- * memory.
- */
- driTextureObject texture_objects;
-
- /** Pointer to the list of texture objects that are not in
- * texture memory.
- */
- driTextureObject * swapped_objects;
-
- /** Size of the driver-speicific texture object.
- */
- unsigned texture_object_size;
-
-
- /**
- * \brief Function to destroy driver-specific texture object data.
- *
- * This function is supplied by the driver so that the texture manager
- * can release all resources associated with a texture object. This
- * function should only release driver-specific data. That is,
- * \a driDestroyTextureObject will release the texture memory
- * associated with the texture object, it will release the memory
- * for the texture object itself, and it will unlink the texture
- * object from the texture object lists.
- *
- * \param driverContext Pointer to the driver supplied context
- * \param t Texture object that is to be destroyed
- * \sa driDestroyTextureObject
- */
-
- destroy_texture_object_t * destroy_texture_object;
-
-
- /**
- */
- unsigned * texture_swaps;
-
- /**
- * Timestamp used to synchronize with 3d engine in hardware
- * where textures are uploaded directly to the
- * framebuffer.
- */
- unsigned timestamp;
-};
-
-
-
-
-/**
- * Called by the client on lock contention to determine whether textures have
- * been stolen. If another client has modified a region in which we have
- * textures, then we need to figure out which of our textures have been
- * removed and update our global LRU.
- *
- * \param heap Texture heap to be updated
- * \hideinitializer
- */
-
-#define DRI_AGE_TEXTURES( heap ) \
- do { \
- if ( ((heap) != NULL) \
- && ((heap)->local_age != (heap)->global_age[0]) ) \
- driAgeTextures( heap ); \
- } while( 0 )
-
-
-
-
-/* This should be called whenever there has been contention on the hardware
- * lock. driAgeTextures should not be called directly. Instead, clients
- * should use DRI_AGE_TEXTURES, above.
- */
-
-void driAgeTextures( driTexHeap * heap );
-
-void driUpdateTextureLRU( driTextureObject * t );
-void driSwapOutTextureObject( driTextureObject * t );
-void driDestroyTextureObject( driTextureObject * t );
-int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
- driTextureObject * t );
-
-GLboolean driIsTextureResident( GLcontext * ctx,
- struct gl_texture_object * texObj );
-
-driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context,
- unsigned size, unsigned alignmentShift, unsigned nr_regions,
- drmTextureRegionPtr global_regions, unsigned * global_age,
- driTextureObject * swapped_objects, unsigned texture_object_size,
- destroy_texture_object_t * destroy_tex_obj );
-void driDestroyTextureHeap( driTexHeap * heap );
-
-void
-driCalculateMaxTextureLevels( driTexHeap * const * heaps,
- unsigned nr_heaps,
- struct gl_constants * limits,
- unsigned max_bytes_per_texel,
- unsigned max_2D_size,
- unsigned max_3D_size,
- unsigned max_cube_size,
- unsigned max_rect_size,
- unsigned mipmaps_at_once,
- int all_textures_one_heap );
-
-void
-driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter );
-
-#define DRI_TEXMGR_DO_TEXTURE_1D 0x0001
-#define DRI_TEXMGR_DO_TEXTURE_2D 0x0002
-#define DRI_TEXMGR_DO_TEXTURE_3D 0x0004
-#define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008
-#define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010
-
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
- GLuint targets );
-
-GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
- unsigned nr_heaps, const driTextureObject * swapped );
-
-extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
-
-#endif /* DRI_TEXMEM_H */
diff --git a/xc/lib/GL/mesa/src/drv/common/utils.c b/xc/lib/GL/mesa/src/drv/common/utils.c
deleted file mode 100644
index 904f16eb4..000000000
--- a/xc/lib/GL/mesa/src/drv/common/utils.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#include <string.h>
-#include <stdlib.h>
-#include "mtypes.h"
-#include "extensions.h"
-#include "utils.h"
-
-#if defined(USE_X86_ASM)
-#include "X86/common_x86_asm.h"
-#endif
-
-unsigned
-driParseDebugString( const char * debug,
- const struct dri_debug_control * control )
-{
- unsigned flag;
-
-
- flag = 0;
- if ( debug != NULL ) {
- while( control->string != NULL ) {
- if ( !strcmp( debug, "all" ) ||
- strstr( debug, control->string ) != NULL ) {
- flag |= control->flag;
- }
-
- control++;
- }
- }
-
- return flag;
-}
-
-
-
-
-unsigned
-driGetRendererString( char * buffer, const char * hardware_name,
- const char * driver_date, GLuint agp_mode )
-{
-#ifdef USE_X86_ASM
- char * x86_str = "";
- char * mmx_str = "";
- char * tdnow_str = "";
- char * sse_str = "";
-#endif
- unsigned offset;
-
-
- offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date );
-
- /* Append any AGP-specific information.
- */
- switch ( agp_mode ) {
- case 1:
- case 2:
- case 4:
- case 8:
- offset += sprintf( & buffer[ offset ], " AGP %ux", agp_mode );
- break;
-
- default:
- break;
- }
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- x86_str = " x86";
- }
-# ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- mmx_str = (cpu_has_mmxext) ? "/MMX+" : "/MMX";
- }
-# endif
-# ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- tdnow_str = (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!";
- }
-# endif
-# ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- sse_str = (cpu_has_xmm2) ? "/SSE2" : "/SSE";
- }
-# endif
-
- offset += sprintf( & buffer[ offset ], "%s%s%s%s",
- x86_str, mmx_str, tdnow_str, sse_str );
-
-#elif defined(USE_SPARC_ASM)
-
- offset += sprintf( & buffer[ offset ], " Sparc" );
-
-#endif
-
- return offset;
-}
-
-
-
-
-void driInitExtensions( GLcontext * ctx,
- const char * const extensions_to_enable[],
- GLboolean enable_imaging )
-{
- unsigned i;
-
- if ( enable_imaging ) {
- _mesa_enable_imaging_extensions( ctx );
- }
-
- for ( i = 0 ; extensions_to_enable[i] != NULL ; i++ ) {
- _mesa_enable_extension( ctx, extensions_to_enable[i] );
- }
-}
-
-
-
-
-GLboolean
-driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv,
- const char * driver_name,
- int dri_major, int dri_minor,
- int ddx_major, int ddx_minor,
- int drm_major, int drm_minor)
-{
- static const char format[] = "%s DRI driver expected %s version %d.%d.x "
- "but got version %d.%d.%d";
- int major, minor, patch;
-
- /* Check the DRI version */
- if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) {
- if (major != dri_major || minor < dri_minor) {
- __driUtilMessage(format, "DRI", driver_name, dri_major, dri_minor,
- major, minor, patch);
- return GL_FALSE;
- }
- }
-
- /* Check that the DDX driver version is compatible */
- if (sPriv->ddxMajor != ddx_major || sPriv->ddxMinor < ddx_minor) {
- __driUtilMessage(format, "DDX", driver_name, ddx_major, ddx_minor,
- sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch);
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if (sPriv->drmMajor != drm_major || sPriv->drmMinor < drm_minor) {
- __driUtilMessage(format, "DRM", driver_name, drm_major, drm_minor,
- sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch);
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/utils.h b/xc/lib/GL/mesa/src/drv/common/utils.h
deleted file mode 100644
index d6506c5b8..000000000
--- a/xc/lib/GL/mesa/src/drv/common/utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#ifndef DRI_DEBUG_H
-#define DRI_DEBUG_H
-
-#include "context.h"
-#include "dri_util.h"
-
-struct dri_debug_control
-{
- const char * string;
- unsigned flag;
-};
-
-extern unsigned driParseDebugString( const char * debug,
- const struct dri_debug_control * control );
-
-extern unsigned driGetRendererString( char * buffer,
- const char * hardware_name, const char * driver_date, GLuint agp_mode );
-
-extern void driInitExtensions( GLcontext * ctx,
- const char * const card_extensions[], GLboolean enable_imaging );
-
-extern GLboolean driCheckDriDdxDrmVersions( __DRIscreenPrivate *sPriv,
- const char * driver_name, int dri_major, int dri_minor,
- int ddx_major, int ddx_minor, int drm_major, int drm_minor );
-
-#endif /* DRI_DEBUG_H */
diff --git a/xc/lib/GL/mesa/src/drv/common/vblank.c b/xc/lib/GL/mesa/src/drv/common/vblank.c
deleted file mode 100644
index 7438dcc53..000000000
--- a/xc/lib/GL/mesa/src/drv/common/vblank.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#include "glheader.h"
-#include "xf86drm.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-
-/****************************************************************************/
-/**
- * Get the current MSC refresh counter.
- *
- * Stores the 64-bit count of vertical refreshes since some (arbitrary)
- * point in time in \c count. Unless the value wraps around, which it
- * may, it will never decrease.
- *
- * \warning This function is called from \c glXGetVideoSyncSGI, which expects
- * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which
- * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl
- * currently always returns a \c sequence of type \c unsigned.
- *
- * \param priv Pointer to the DRI screen private struct.
- * \param count Storage to hold MSC counter.
- * \return Zero is returned on success. A negative errno value
- * is returned on failure.
- */
-int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count )
-{
- drmVBlank vbl;
- int ret;
-
- /* Don't wait for anything. Just get the current refresh count. */
-
- vbl.request.type = DRM_VBLANK_RELATIVE;
- vbl.request.sequence = 0;
-
- ret = drmWaitVBlank( priv->fd, &vbl );
- *count = (int64_t)vbl.reply.sequence;
-
- return ret;
-}
-
-
-/****************************************************************************/
-/**
- * Wait for a specified refresh count. This implements most of the
- * functionality of \c glXWaitForMscOML from the GLX_OML_sync_control spec.
- * Waits for the \c target_msc refresh. If that has already passed, it
- * waits until \f$(MSC \bmod divisor)\f$ is equal to \c remainder. If
- * \c target_msc is 0, use the behavior of glXWaitVideoSyncSGI(), which
- * omits the initial check against a target MSC value.
- *
- * This function is actually something of a hack. The problem is that, at
- * the time of this writing, none of the existing DRM modules support an
- * ioctl that returns a 64-bit count (at least not on 32-bit platforms).
- * However, this function exists to support a GLX function that requires
- * the use of 64-bit counts. As such, there is a little bit of ugly
- * hackery at the end of this function to make the 32-bit count act like
- * a 64-bit count. There are still some cases where this will break, but
- * I believe it catches the most common cases.
- *
- * The real solution is to provide an ioctl that uses a 64-bit count.
- *
- * \param dpy Pointer to the \c Display.
- * \param priv Pointer to the DRI drawable private.
- * \param target_msc Desired refresh count to wait for. A value of 0
- * means to use the glXWaitVideoSyncSGI() behavior.
- * \param divisor MSC divisor if \c target_msc is already reached.
- * \param remainder Desired MSC remainder if \c target_msc is already
- * reached.
- * \param msc Buffer to hold MSC when done waiting.
- *
- * \return Zero on success or \c GLX_BAD_CONTEXT on failure.
- */
-
-int driWaitForMSC32( __DRIdrawablePrivate *priv,
- int64_t target_msc, int64_t divisor, int64_t remainder,
- int64_t * msc )
-{
- drmVBlank vbl;
-
-
- if ( divisor != 0 ) {
- unsigned int target = (unsigned int)target_msc;
- unsigned int next = target;
- unsigned int r;
- int dont_wait = (target_msc == 0);
-
- do {
- /* dont_wait means we're using the glXWaitVideoSyncSGI() behavior.
- * The first time around, just get the current count and proceed
- * to the test for (MSC % divisor) == remainder.
- */
- vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE :
- DRM_VBLANK_ABSOLUTE;
- vbl.request.sequence = next;
-
- if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
- /* FIXME: This doesn't seem like the right thing to return here.
- */
- return GLX_BAD_CONTEXT;
- }
-
- dont_wait = 0;
- if (target_msc != 0 && vbl.reply.sequence == target)
- break;
-
- /* Assuming the wait-done test fails, the next refresh to wait for
- * will be one that satisfies (MSC % divisor) == remainder. The
- * value (MSC - (MSC % divisor) + remainder) is the refresh value
- * closest to the current value that would satisfy the equation.
- * If this refresh has already happened, we add divisor to obtain
- * the next refresh after the current one that will satisfy it.
- */
- r = (vbl.reply.sequence % (unsigned int)divisor);
- next = (vbl.reply.sequence - r + (unsigned int)remainder);
- if (next <= vbl.reply.sequence) next += (unsigned int)divisor;
-
- } while ( r != (unsigned int)remainder );
- }
- else {
- /* If the \c divisor is zero, just wait until the MSC is greater
- * than or equal to \c target_msc.
- */
-
- vbl.request.type = DRM_VBLANK_ABSOLUTE;
- vbl.request.sequence = target_msc;
-
- if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
- /* FIXME: This doesn't seem like the right thing to return here.
- */
- return GLX_BAD_CONTEXT;
- }
- }
-
- *msc = (target_msc & 0xffffffff00000000LL);
- *msc |= vbl.reply.sequence;
- if ( *msc < target_msc ) {
- *msc += 0x0000000100000000LL;
- }
-
- return 0;
-}
-
-
-/****************************************************************************/
-/**
- * Gets a set of default vertical-blank-wait flags based on the internal GLX
- * API version and several configuration options.
- */
-
-GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache )
-{
- GLuint flags = 0;
- int vblank_mode;
-
- flags |= (driCompareGLXAPIVersion( 20030317 ) >= 0)
- ? VBLANK_FLAG_INTERVAL : 0;
-
- if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) )
- vblank_mode = driQueryOptioni( optionCache, "vblank_mode" );
- else
- vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
-
- switch (vblank_mode) {
- case DRI_CONF_VBLANK_NEVER:
- flags = 0;
- break;
- case DRI_CONF_VBLANK_DEF_INTERVAL_0:
- break;
- case DRI_CONF_VBLANK_DEF_INTERVAL_1:
- flags |= VBLANK_FLAG_THROTTLE;
- break;
- case DRI_CONF_VBLANK_ALWAYS_SYNC:
- flags |= VBLANK_FLAG_SYNC;
- break;
- }
-
- return flags;
-}
-
-
-/****************************************************************************/
-/**
- * Sets the default swap interval when the drawable is first bound to a
- * direct rendering context.
- */
-
-void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags )
-{
- if ( priv->pdraw->swap_interval == (unsigned)-1 ) {
- priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0;
- }
-
-}
-
-
-/****************************************************************************/
-/**
- * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to
- * wrap the error message logging. The error message should only be logged
- * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is
- * successful, \c vbl_seq will be set the sequence value in the reply.
- *
- * \param vbl Pointer to drmVBlank packet desribing how to wait.
- * \param vbl_seq Location to store the current refresh counter.
- * \param fd File descriptor use to call into the DRM.
- * \return Zero on success or -1 on failure.
- */
-
-static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
-{
- int ret;
-
-
- ret = drmWaitVBlank( fd, vbl );
- if ( ret != 0 ) {
- static GLboolean first_time = GL_TRUE;
-
- if ( first_time ) {
- fprintf(stderr,
- "%s: drmWaitVBlank returned %d, IRQs don't seem to be"
- " working correctly.\nTry running with LIBGL_THROTTLE_REFRESH"
- " and LIBL_SYNC_REFRESH unset.\n", __FUNCTION__, ret);
- first_time = GL_FALSE;
- }
-
- return -1;
- }
-
- *vbl_seq = vbl->reply.sequence;
- return 0;
-}
-
-
-/****************************************************************************/
-/**
- * Waits for the vertical blank for use with glXSwapBuffers.
- *
- * \param vbl_seq Vertical blank sequence number (MSC) after the last buffer
- * swap. Updated after this wait.
- * \param flags \c VBLANK_FLAG bits that control how long to wait.
- * \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later
- * than the "target" based on \c flags. The idea is that if
- * \c missed_deadline is set, then the application is not
- * achieving its desired framerate.
- * \return Zero on success, -1 on error.
- */
-
-int
-driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
- GLuint flags, GLboolean * missed_deadline )
-{
- drmVBlank vbl;
- unsigned original_seq;
- unsigned deadline;
- unsigned interval;
-
-
- *missed_deadline = GL_FALSE;
- if ( (flags & (VBLANK_FLAG_INTERVAL |
- VBLANK_FLAG_THROTTLE |
- VBLANK_FLAG_SYNC)) == 0 ||
- (flags & VBLANK_FLAG_NO_IRQ) != 0 ) {
- return 0;
- }
-
-
- /* VBLANK_FLAG_SYNC means to wait for at least one vertical blank. If
- * that flag is not set, do a fake wait for zero vertical blanking
- * periods so that we can get the current MSC.
- *
- * VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at
- * least one vertical blank since the last wait. Since do_wait modifies
- * vbl_seq, we have to save the original value of vbl_seq for the
- * VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later.
- */
-
- original_seq = *vbl_seq;
-
- vbl.request.sequence = ((flags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0;
- vbl.request.type = DRM_VBLANK_RELATIVE;
-
- if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
- return -1;
- }
-
-
- vbl.request.type = DRM_VBLANK_ABSOLUTE;
-
- if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
- interval = priv->pdraw->swap_interval;
- /* this must have been initialized when the drawable was first bound
- * to a direct rendering context. */
- assert ( interval != (unsigned)-1 );
- }
- else if ( (flags & VBLANK_FLAG_THROTTLE) != 0 ) {
- interval = 1;
- }
- else {
- interval = 0;
- }
-
-
- /* Wait until the next vertical blank. If the interval is zero, then
- * the deadline is one vertical blank after the previous wait.
- */
-
- vbl.request.sequence = original_seq + interval;
- if ( *vbl_seq < vbl.request.sequence ) {
- if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
- return -1;
- }
- }
-
- deadline = original_seq + ((interval == 0) ? 1 : interval);
- *missed_deadline = ( *vbl_seq > deadline );
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/vblank.h b/xc/lib/GL/mesa/src/drv/common/vblank.h
deleted file mode 100644
index d460d7a84..000000000
--- a/xc/lib/GL/mesa/src/drv/common/vblank.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#ifndef DRI_VBLANK_H
-#define DRI_VBLANK_H
-
-#include "context.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-#define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting
- */
-#define VBLANK_FLAG_THROTTLE (1U << 1) /* Wait 1 refresh since last call.
- */
-#define VBLANK_FLAG_SYNC (1U << 2) /* Sync to the next refresh.
- */
-#define VBLANK_FLAG_NO_IRQ (1U << 7) /* DRM has no IRQ to wait on.
- */
-
-extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
-extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
- int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
-extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
-extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags );
-extern int driWaitForVBlank( const __DRIdrawablePrivate *priv,
- GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline );
-
-#undef usleep
-#include <unistd.h> /* for usleep() */
-
-#define DO_USLEEP(nr) \
- do { \
- if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \
- if (1) usleep( nr ); \
- sched_yield(); \
- } while( 0 )
-
-#endif /* DRI_VBLANK_H */
diff --git a/xc/lib/GL/mesa/src/drv/common/xmlconfig.c b/xc/lib/GL/mesa/src/drv/common/xmlconfig.c
deleted file mode 100644
index f7758d368..000000000
--- a/xc/lib/GL/mesa/src/drv/common/xmlconfig.c
+++ /dev/null
@@ -1,858 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/**
- * \file xmlconfig.c
- * \brief Driver-independent client-side part of the XML configuration
- * \author Felix Kuehling
- */
-
-#include "glheader.h"
-
-#include <string.h>
-#include <assert.h>
-#include <expat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include "imports.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-/*
- * OS dependent ways of getting the name of the running program
- */
-#if (defined(__unix__) || defined(unix)) && !defined(USG)
-#include <sys/param.h>
-#endif
-
-#undef GET_PROGRAM_NAME
-
-#if defined(__GNU_LIBRARY__) || defined(__GLIBC__)
-# define GET_PROGRAM_NAME() program_invocation_short_name
-#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
-# include <osreldate.h>
-# if (__FreeBSD_version >= 440000)
-# include <stdlib.h>
-# define GET_PROGRAM_NAME() getprogname()
-# endif
-#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
-# include <stdlib.h>
-# define GET_PROGRAM_NAME() getprogname()
-#endif
-
-#if !defined(GET_PROGRAM_NAME)
-# if defined(OpenBSD) || defined(NetBSD)
-/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. It's
- * used as a last resort, if there is no documented facility available. */
-static const char *__getProgramName () {
- extern const char *__progname;
- return progname;
-}
-# define GET_PROGRAM_NAME() __getProgramName()
-# else
-# define GET_PROGRAM_NAME() ""
-# warning "Per application configuration won't with your OS version work."
-# endif
-#endif
-
-/** \brief Find an option in an option cache with the name as key */
-static GLuint findOption (const driOptionCache *cache, const char *name) {
- GLuint len = strlen (name);
- GLuint size = 1 << cache->tableSize, mask = size - 1;
- GLuint hash = 0;
- GLuint i, shift;
-
- /* compute a hash from the variable length name */
- for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31)
- hash += (GLuint)name[i] << shift;
- hash *= hash;
- hash = (hash >> (16-cache->tableSize/2)) & mask;
-
- /* this is just the starting point of the linear search for the option */
- for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
- /* if we hit an empty entry then the option is not defined (yet) */
- if (cache->info[hash].name == 0)
- break;
- else if (!strcmp (name, cache->info[hash].name))
- break;
- }
- /* this assertion fails if the hash table is full */
- assert (i < size);
-
- return hash;
-}
-
-/** \brief Count the real number of options in an option cache */
-static GLuint countOptions (const driOptionCache *cache) {
- GLuint size = 1 << cache->tableSize;
- GLuint i, count = 0;
- for (i = 0; i < size; ++i)
- if (cache->info[i].name)
- count++;
- return count;
-}
-
-/** \brief Like strdup but using MALLOC and with error checking. */
-#define XSTRDUP(dest,source) do { \
- GLuint len = strlen (source); \
- if (!(dest = MALLOC (len+1))) { \
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
- abort(); \
- } \
- memcpy (dest, source, len+1); \
-} while (0)
-
-static int compare (const void *a, const void *b) {
- return strcmp (*(char *const*)a, *(char *const*)b);
-}
-/** \brief Binary search in a string array. */
-static GLuint bsearchStr (const XML_Char *name,
- const XML_Char *elems[], GLuint count) {
- const XML_Char **found;
- found = bsearch (&name, elems, count, sizeof (XML_Char *), compare);
- if (found)
- return found - elems;
- else
- return count;
-}
-
-/** \brief Parse a value of a given type. */
-static GLboolean parseValue (driOptionValue *v, driOptionType type,
- const XML_Char *string) {
- const XML_Char *tail;
- /* skip leading white-space */
- string += strspn (string, " \f\n\r\t\v");
- switch (type) {
- case DRI_BOOL:
- if (!strcmp (string, "false")) {
- v->_bool = GL_FALSE;
- tail = string + 5;
- } else if (!strcmp (string, "true")) {
- v->_bool = GL_TRUE;
- tail = string + 4;
- }
- else
- return GL_FALSE;
- break;
- case DRI_ENUM: /* enum is just a special integer */
- case DRI_INT:
- v->_int = strtol (string, (char **)&tail, 0);
- break;
- case DRI_FLOAT:
- v->_float = strtod (string, (char **)&tail);
- break;
- }
-
- if (tail == string)
- return GL_FALSE; /* empty string (or containing only white-space) */
- /* skip trailing white space */
- if (*tail)
- tail += strspn (tail, " \f\n\r\t\v");
- if (*tail)
- return GL_FALSE; /* something left over that is not part of value */
-
- return GL_TRUE;
-}
-
-/** \brief Parse a list of ranges of type info->type. */
-static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
- XML_Char *cp, *range;
- GLuint nRanges, i;
- driOptionRange *ranges;
-
- XSTRDUP (cp, string);
- /* pass 1: determine the number of ranges (number of commas + 1) */
- range = cp;
- for (nRanges = 1; *range; ++range)
- if (*range == ',')
- ++nRanges;
-
- if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
-
- /* pass 2: parse all ranges into preallocated array */
- range = cp;
- for (i = 0; i < nRanges; ++i) {
- XML_Char *end, *sep;
- assert (range);
- end = strchr (range, ',');
- if (end)
- *end = '\0';
- sep = strchr (range, ':');
- if (sep) { /* non-empty interval */
- *sep = '\0';
- if (!parseValue (&ranges[i].start, info->type, range) ||
- !parseValue (&ranges[i].end, info->type, sep+1))
- break;
- if (info->type == DRI_INT &&
- ranges[i].start._int > ranges[i].end._int)
- break;
- if (info->type == DRI_FLOAT &&
- ranges[i].start._float > ranges[i].end._float)
- break;
- } else { /* empty interval */
- if (!parseValue (&ranges[i].start, info->type, range))
- break;
- ranges[i].end = ranges[i].start;
- }
- if (end)
- range = end+1;
- else
- range = NULL;
- }
- FREE (cp);
- if (i < nRanges) {
- FREE (ranges);
- return GL_FALSE;
- } else
- assert (range == NULL);
-
- info->nRanges = nRanges;
- info->ranges = ranges;
- return GL_TRUE;
-}
-
-/** \brief Check if a value is in one of info->ranges. */
-static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) {
- GLuint i;
- assert (info->type != DRI_BOOL); /* should be caught by the parser */
- if (info->nRanges == 0)
- return GL_TRUE;
- switch (info->type) {
- case DRI_ENUM: /* enum is just a special integer */
- case DRI_INT:
- for (i = 0; i < info->nRanges; ++i)
- if (v->_int >= info->ranges[i].start._int &&
- v->_int <= info->ranges[i].end._int)
- return GL_TRUE;
- break;
- case DRI_FLOAT:
- for (i = 0; i < info->nRanges; ++i)
- if (v->_float >= info->ranges[i].start._float &&
- v->_float <= info->ranges[i].end._float)
- return GL_TRUE;
- break;
- default:
- assert (0); /* should never happen */
- }
- return GL_FALSE;
-}
-
-/** \brief Output a warning message. */
-#define XML_WARNING1(msg) do {\
- __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
-} while (0)
-#define XML_WARNING(msg,args...) do { \
- __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
-} while (0)
-/** \brief Output an error message. */
-#define XML_ERROR1(msg) do { \
- __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
-} while (0)
-#define XML_ERROR(msg,args...) do { \
- __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
-} while (0)
-/** \brief Output a fatal error message and abort. */
-#define XML_FATAL1(msg) do { \
- fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
- data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
- abort();\
-} while (0)
-#define XML_FATAL(msg,args...) do { \
- fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
- data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
- abort();\
-} while (0)
-
-/** \brief Parser context for __driConfigOptions. */
-struct OptInfoData {
- const char *name;
- XML_Parser parser;
- driOptionCache *cache;
- GLboolean inDriInfo;
- GLboolean inSection;
- GLboolean inDesc;
- GLboolean inOption;
- GLboolean inEnum;
- int curOption;
-};
-
-/** \brief Elements in __driConfigOptions. */
-enum OptInfoElem {
- OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT
-};
-static const XML_Char *OptInfoElems[] = {
- "description", "driinfo", "enum", "option", "section"
-};
-
-/** \brief Parse attributes of an enum element.
- *
- * We're not actually interested in the data. Just make sure this is ok
- * for external configuration tools.
- */
-static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *value = NULL, *text = NULL;
- driOptionValue v;
- GLuint opt = data->curOption;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "value")) value = attr[i+1];
- else if (!strcmp (attr[i], "text")) text = attr[i+1];
- else XML_FATAL("illegal enum attribute: %s.", attr[i]);
- }
- if (!value) XML_FATAL1 ("value attribute missing in enum.");
- if (!text) XML_FATAL1 ("text attribute missing in enum.");
- if (!parseValue (&v, data->cache->info[opt].type, value))
- XML_FATAL ("illegal enum value: %s.", value);
- if (!checkValue (&v, &data->cache->info[opt]))
- XML_FATAL ("enum value out of valid range: %s.", value);
-}
-
-/** \brief Parse attributes of a description element.
- *
- * We're not actually interested in the data. Just make sure this is ok
- * for external configuration tools.
- */
-static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *lang = NULL, *text = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "lang")) lang = attr[i+1];
- else if (!strcmp (attr[i], "text")) text = attr[i+1];
- else XML_FATAL("illegal description attribute: %s.", attr[i]);
- }
- if (!lang) XML_FATAL1 ("lang attribute missing in description.");
- if (!text) XML_FATAL1 ("text attribute missing in description.");
-}
-
-/** \brief Parse attributes of an option element. */
-static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) {
- enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT};
- static const XML_Char *optAttr[] = {"default", "name", "type", "valid"};
- const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL};
- const char *defaultVal;
- driOptionCache *cache = data->cache;
- GLuint opt, i;
- for (i = 0; attr[i]; i += 2) {
- GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT);
- if (attrName >= OA_COUNT)
- XML_FATAL ("illegal option attribute: %s", attr[i]);
- attrVal[attrName] = attr[i+1];
- }
- if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option.");
- if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option.");
- if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option.");
-
- opt = findOption (cache, attrVal[OA_NAME]);
- if (cache->info[opt].name)
- XML_FATAL ("option %s redefined.", attrVal[OA_NAME]);
- data->curOption = opt;
-
- XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]);
-
- if (!strcmp (attrVal[OA_TYPE], "bool"))
- cache->info[opt].type = DRI_BOOL;
- else if (!strcmp (attrVal[OA_TYPE], "enum"))
- cache->info[opt].type = DRI_ENUM;
- else if (!strcmp (attrVal[OA_TYPE], "int"))
- cache->info[opt].type = DRI_INT;
- else if (!strcmp (attrVal[OA_TYPE], "float"))
- cache->info[opt].type = DRI_FLOAT;
- else
- XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]);
-
- defaultVal = getenv (cache->info[opt].name);
- if (defaultVal != NULL) {
- /* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr,
- "ATTENTION: default value of option %s overridden by environment.\n",
- cache->info[opt].name);
- } else
- defaultVal = attrVal[OA_DEFAULT];
- if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal))
- XML_FATAL ("illegal default value: %s.", defaultVal);
-
- if (attrVal[OA_VALID]) {
- if (cache->info[opt].type == DRI_BOOL)
- XML_FATAL1 ("boolean option with valid attribute.");
- if (!parseRanges (&cache->info[opt], attrVal[OA_VALID]))
- XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]);
- if (!checkValue (&cache->values[opt], &cache->info[opt]))
- XML_FATAL ("default value out of valid range '%s': %s.",
- attrVal[OA_VALID], defaultVal);
- } else if (cache->info[opt].type == DRI_ENUM) {
- XML_FATAL1 ("valid attribute missing in option (mandatory for enums).");
- } else {
- cache->info[opt].nRanges = 0;
- cache->info[opt].ranges = NULL;
- }
-}
-
-/** \brief Handler for start element events. */
-static void optInfoStartElem (void *userData, const XML_Char *name,
- const XML_Char **attr) {
- struct OptInfoData *data = (struct OptInfoData *)userData;
- enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
- switch (elem) {
- case OI_DRIINFO:
- if (data->inDriInfo)
- XML_FATAL1 ("nested <driinfo> elements.");
- if (attr[0])
- XML_FATAL1 ("attributes specified on <driinfo> element.");
- data->inDriInfo = GL_TRUE;
- break;
- case OI_SECTION:
- if (!data->inDriInfo)
- XML_FATAL1 ("<section> must be inside <driinfo>.");
- if (data->inSection)
- XML_FATAL1 ("nested <section> elements.");
- if (attr[0])
- XML_FATAL1 ("attributes specified on <section> element.");
- data->inSection = GL_TRUE;
- break;
- case OI_DESCRIPTION:
- if (!data->inSection && !data->inOption)
- XML_FATAL1 ("<description> must be inside <description> or <option.");
- if (data->inDesc)
- XML_FATAL1 ("nested <description> elements.");
- data->inDesc = GL_TRUE;
- parseDescAttr (data, attr);
- break;
- case OI_OPTION:
- if (!data->inSection)
- XML_FATAL1 ("<option> must be inside <section>.");
- if (data->inDesc)
- XML_FATAL1 ("<option> nested in <description> element.");
- if (data->inOption)
- XML_FATAL1 ("nested <option> elements.");
- data->inOption = GL_TRUE;
- parseOptInfoAttr (data, attr);
- break;
- case OI_ENUM:
- if (!(data->inOption && data->inDesc))
- XML_FATAL1 ("<enum> must be inside <option> and <description>.");
- if (data->inEnum)
- XML_FATAL1 ("nested <enum> elements.");
- data->inEnum = GL_TRUE;
- parseEnumAttr (data, attr);
- break;
- default:
- XML_FATAL ("unknown element: %s.", name);
- }
-}
-
-/** \brief Handler for end element events. */
-static void optInfoEndElem (void *userData, const XML_Char *name) {
- struct OptInfoData *data = (struct OptInfoData *)userData;
- enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
- switch (elem) {
- case OI_DRIINFO:
- data->inDriInfo = GL_FALSE;
- break;
- case OI_SECTION:
- data->inSection = GL_FALSE;
- break;
- case OI_DESCRIPTION:
- data->inDesc = GL_FALSE;
- break;
- case OI_OPTION:
- data->inOption = GL_FALSE;
- break;
- case OI_ENUM:
- data->inEnum = GL_FALSE;
- break;
- default:
- assert (0); /* should have been caught by StartElem */
- }
-}
-
-void driParseOptionInfo (driOptionCache *info) {
- XML_Parser p;
- int status;
- struct OptInfoData userData;
- struct OptInfoData *data = &userData;
- GLuint nOptions;
-
- /* determine hash table size and allocate memory */
- GLuint size, log2size;
- for (size = 1, log2size = 0; size < __driNConfigOptions*3/2;
- size <<= 1, ++log2size);
- info->tableSize = log2size;
- info->info = CALLOC (size * sizeof (driOptionInfo));
- info->values = CALLOC (size * sizeof (driOptionInfo));
- if (info->info == NULL || info->values == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
-
- p = XML_ParserCreate ("UTF-8"); /* always UTF-8 */
- XML_SetElementHandler (p, optInfoStartElem, optInfoEndElem);
- XML_SetUserData (p, data);
-
- userData.name = "__driConfigOptions";
- userData.parser = p;
- userData.cache = info;
- userData.inDriInfo = GL_FALSE;
- userData.inSection = GL_FALSE;
- userData.inDesc = GL_FALSE;
- userData.inOption = GL_FALSE;
- userData.inEnum = GL_FALSE;
- userData.curOption = -1;
-
- status = XML_Parse (p, __driConfigOptions, strlen (__driConfigOptions), 1);
- if (!status)
- XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
-
- XML_ParserFree (p);
-
- /* Check if the actual number of options matches __driNConfigOptions.
- * A mismatch is not fatal (a hash table overflow would be) but we
- * want the driver developer's attention anyway. */
- nOptions = countOptions (info);
- if (nOptions != __driNConfigOptions) {
- fprintf (stderr,
- "Error: __driNConfigOptions (%u) does not match the actual number of options in\n"
- " __driConfigOptions (%u).\n",
- __driNConfigOptions, nOptions);
- }
-}
-
-/** \brief Parser context for configuration files. */
-struct OptConfData {
- const char *name;
- XML_Parser parser;
- driOptionCache *cache;
- GLint screenNum;
- const char *driverName, *execName;
- GLuint ignoringDevice;
- GLuint ignoringApp;
- GLuint inDriConf;
- GLuint inDevice;
- GLuint inApp;
- GLuint inOption;
-};
-
-/** \brief Elements in configuration files. */
-enum OptConfElem {
- OC_APPLICATION = 0, OC_DEVICE, OC_DRICONF, OC_OPTION, OC_COUNT
-};
-static const XML_Char *OptConfElems[] = {
- "application", "device", "driconf", "option"
-};
-
-/** \brief Parse attributes of a device element. */
-static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *driver = NULL, *screen = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "driver")) driver = attr[i+1];
- else if (!strcmp (attr[i], "screen")) screen = attr[i+1];
- else XML_WARNING("unkown device attribute: %s.", attr[i]);
- }
- if (driver && strcmp (driver, data->driverName))
- data->ignoringDevice = data->inDevice;
- else if (screen) {
- driOptionValue screenNum;
- if (!parseValue (&screenNum, DRI_INT, screen))
- XML_WARNING("illegal screen number: %s.", screen);
- else if (screenNum._int != data->screenNum)
- data->ignoringDevice = data->inDevice;
- }
-}
-
-/** \brief Parse attributes of an application element. */
-static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *name = NULL, *exec = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "name")) name = attr[i+1];
- else if (!strcmp (attr[i], "executable")) exec = attr[i+1];
- else XML_WARNING("unkown application attribute: %s.", attr[i]);
- }
- if (exec && strcmp (exec, data->execName))
- data->ignoringApp = data->inApp;
-}
-
-/** \brief Parse attributes of an option element. */
-static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *name = NULL, *value = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "name")) name = attr[i+1];
- else if (!strcmp (attr[i], "value")) value = attr[i+1];
- else XML_WARNING("unkown option attribute: %s.", attr[i]);
- }
- if (!name) XML_WARNING1 ("name attribute missing in option.");
- if (!value) XML_WARNING1 ("value attribute missing in option.");
- if (name && value) {
- driOptionCache *cache = data->cache;
- GLuint opt = findOption (cache, name);
- if (cache->info[opt].name == NULL)
- XML_WARNING ("undefined option: %s.", name);
- else if (getenv (cache->info[opt].name))
- /* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",
- cache->info[opt].name);
- else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
- XML_WARNING ("illegal option value: %s.", value);
- }
-}
-
-/** \brief Handler for start element events. */
-static void optConfStartElem (void *userData, const XML_Char *name,
- const XML_Char **attr) {
- struct OptConfData *data = (struct OptConfData *)userData;
- enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
- switch (elem) {
- case OC_DRICONF:
- if (data->inDriConf)
- XML_WARNING1 ("nested <driconf> elements.");
- if (attr[0])
- XML_WARNING1 ("attributes specified on <driconf> element.");
- data->inDriConf++;
- break;
- case OC_DEVICE:
- if (!data->inDriConf)
- XML_WARNING1 ("<device> should be inside <driconf>.");
- if (data->inDevice)
- XML_WARNING1 ("nested <device> elements.");
- data->inDevice++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseDeviceAttr (data, attr);
- break;
- case OC_APPLICATION:
- if (!data->inDevice)
- XML_WARNING1 ("<application> should be inside <device>.");
- if (data->inApp)
- XML_WARNING1 ("nested <application> elements.");
- data->inApp++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseAppAttr (data, attr);
- break;
- case OC_OPTION:
- if (!data->inApp)
- XML_WARNING1 ("<option> should be inside <application>.");
- if (data->inOption)
- XML_WARNING1 ("nested <option> elements.");
- data->inOption++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseOptConfAttr (data, attr);
- break;
- default:
- XML_WARNING ("unknown element: %s.", name);
- }
-}
-
-/** \brief Handler for end element events. */
-static void optConfEndElem (void *userData, const XML_Char *name) {
- struct OptConfData *data = (struct OptConfData *)userData;
- enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
- switch (elem) {
- case OC_DRICONF:
- data->inDriConf--;
- break;
- case OC_DEVICE:
- if (data->inDevice-- == data->ignoringDevice)
- data->ignoringDevice = 0;
- break;
- case OC_APPLICATION:
- if (data->inApp-- == data->ignoringApp)
- data->ignoringApp = 0;
- break;
- case OC_OPTION:
- data->inOption--;
- break;
- default:
- /* unknown element, warning was produced on start tag */;
- }
-}
-
-/** \brief Initialize an option cache based on info */
-static void initOptionCache (driOptionCache *cache, driOptionCache *info) {
- cache->info = info->info;
- cache->tableSize = info->tableSize;
- cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue));
- if (cache->values == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
- memcpy (cache->values, info->values,
- (1<<info->tableSize) * sizeof (driOptionValue));
-}
-
-/** \brief Parse the named configuration file */
-static void parseOneConfigFile (XML_Parser p) {
-#define BUF_SIZE 0x1000
- struct OptConfData *data = (struct OptConfData *)XML_GetUserData (p);
- int status;
- int fd;
-
- if ((fd = open (data->name, O_RDONLY)) == -1) {
- __driUtilMessage ("Can't open configuration file %s: %s.",
- data->name, strerror (errno));
- return;
- }
-
- while (1) {
- int bytesRead;
- void *buffer = XML_GetBuffer (p, BUF_SIZE);
- if (!buffer) {
- __driUtilMessage ("Can't allocate parser buffer.");
- break;
- }
- bytesRead = read (fd, buffer, BUF_SIZE);
- if (bytesRead == -1) {
- __driUtilMessage ("Error reading from configuration file %s: %s.",
- data->name, strerror (errno));
- break;
- }
- status = XML_ParseBuffer (p, bytesRead, bytesRead == 0);
- if (!status) {
- XML_ERROR ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
- break;
- }
- if (bytesRead == 0)
- break;
- }
-
- close (fd);
-#undef BUF_SIZE
-}
-
-void driParseConfigFiles (driOptionCache *cache, driOptionCache *info,
- GLint screenNum, const char *driverName) {
- char *filenames[2] = {"/etc/drirc", NULL};
- char *home;
- GLuint i;
- struct OptConfData userData;
-
- initOptionCache (cache, info);
-
- userData.cache = cache;
- userData.screenNum = screenNum;
- userData.driverName = driverName;
- userData.execName = GET_PROGRAM_NAME();
-
- if ((home = getenv ("HOME"))) {
- GLuint len = strlen (home);
- filenames[1] = MALLOC (len + 7+1);
- if (filenames[1] == NULL)
- __driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
- else {
- memcpy (filenames[1], home, len);
- memcpy (filenames[1] + len, "/.drirc", 7+1);
- }
- }
-
- for (i = 0; i < 2; ++i) {
- XML_Parser p;
- if (filenames[i] == NULL)
- continue;
-
- p = XML_ParserCreate (NULL); /* use encoding specified by file */
- XML_SetElementHandler (p, optConfStartElem, optConfEndElem);
- XML_SetUserData (p, &userData);
- userData.parser = p;
- userData.name = filenames[i];
- userData.ignoringDevice = 0;
- userData.ignoringApp = 0;
- userData.inDriConf = 0;
- userData.inDevice = 0;
- userData.inApp = 0;
- userData.inOption = 0;
-
- parseOneConfigFile (p);
- XML_ParserFree (p);
- }
-
- if (filenames[1])
- FREE (filenames[1]);
-}
-
-void driDestroyOptionInfo (driOptionCache *info) {
- driDestroyOptionCache (info);
- if (info->info) {
- GLuint i, size = 1 << info->tableSize;
- for (i = 0; i < size; ++i) {
- if (info->info[i].name) {
- FREE (info->info[i].name);
- if (info->info[i].ranges)
- FREE (info->info[i].ranges);
- }
- }
- FREE (info->info);
- }
-}
-
-void driDestroyOptionCache (driOptionCache *cache) {
- if (cache->values)
- FREE (cache->values);
-}
-
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
- driOptionType type) {
- GLuint i = findOption (cache, name);
- return cache->info[i].name != NULL && cache->info[i].type == type;
-}
-
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_BOOL);
- return cache->values[i]._bool;
-}
-
-GLint driQueryOptioni (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
- return cache->values[i]._int;
-}
-
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_FLOAT);
- return cache->values[i]._float;
-}
diff --git a/xc/lib/GL/mesa/src/drv/common/xmlconfig.h b/xc/lib/GL/mesa/src/drv/common/xmlconfig.h
deleted file mode 100644
index 710e328e0..000000000
--- a/xc/lib/GL/mesa/src/drv/common/xmlconfig.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/**
- * \file xmlconfig.h
- * \brief Driver-independent client-side part of the XML configuration
- * \author Felix Kuehling
- */
-
-#ifndef __XMLCONFIG_H
-#define __XMLCONFIG_H
-
-/** \brief Option data types */
-typedef enum driOptionType {
- DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT
-} driOptionType;
-
-/** \brief Option value */
-typedef union driOptionValue {
- GLboolean _bool; /**< \brief Boolean */
- GLint _int; /**< \brief Integer or Enum */
- GLfloat _float; /**< \brief Floating-point */
-} driOptionValue;
-
-/** \brief Single range of valid values
- *
- * For empty ranges (a single value) start == end */
-typedef struct driOptionRange {
- driOptionValue start; /**< \brief Start */
- driOptionValue end; /**< \brief End */
-} driOptionRange;
-
-/** \brief Information about an option */
-typedef struct driOptionInfo {
- char *name; /**< \brief Name */
- driOptionType type; /**< \brief Type */
- driOptionRange *ranges; /**< \brief Array of ranges */
- GLuint nRanges; /**< \brief Number of ranges */
-} driOptionInfo;
-
-/** \brief Option cache
- *
- * \li One in <driver>Screen caching option info and the default values
- * \li One in each <driver>Context with the actual values for that context */
-typedef struct driOptionCache {
- driOptionInfo *info;
- /**< \brief Array of option infos
- *
- * Points to the same array in the screen and all contexts */
- driOptionValue *values;
- /**< \brief Array of option values
- *
- * \li Default values in screen
- * \li Actual values in contexts
- */
- GLuint tableSize;
- /**< \brief Size of the arrays
- *
- * Depending on the hash function this may differ from __driNConfigOptions.
- * In the current implementation it's not actually a size but log2(size).
- * The value is the same in the screen and all contexts. */
-} driOptionCache;
-
-/** \brief XML document describing available options
- *
- * This must be defined in a driver-specific soure file. xmlpool.h
- * defines helper macros and common options. */
-extern const char __driConfigOptions[];
-/** \brief The number of options supported by a driver
- *
- * This is used to choose an appropriate hash table size. So any value
- * larger than the actual number of options will work. */
-extern const GLuint __driNConfigOptions;
-
-/** \brief Parse XML option info from __driConfigOptions
- *
- * To be called in <driver>CreateScreen */
-void driParseOptionInfo (driOptionCache *info);
-/** \brief Initialize option cache from info and parse configuration files
- *
- * To be called in <driver>CreateContext. screenNum and driverName select
- * device sections. */
-void driParseConfigFiles (driOptionCache *cache, driOptionCache *info,
- GLint screenNum, const char *driverName);
-/** \brief Destroy option info
- *
- * To be called in <driver>DestroyScreen */
-void driDestroyOptionInfo (driOptionCache *info);
-/** \brief Destroy option cache
- *
- * To be called in <driver>DestroyContext */
-void driDestroyOptionCache (driOptionCache *cache);
-
-/** \brief Check if there exists a certain option */
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
- driOptionType type);
-
-/** \brief Query a boolean option value */
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name);
-/** \brief Query an integer option value */
-GLint driQueryOptioni (const driOptionCache *cache, const char *name);
-/** \brief Query a floating-point option value */
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name);
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/xmlpool.h b/xc/lib/GL/mesa/src/drv/common/xmlpool.h
deleted file mode 100644
index c7db80d11..000000000
--- a/xc/lib/GL/mesa/src/drv/common/xmlpool.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- mode:C; coding: mult-utf-8-unix -*-
- *
- * !!! Important: This file is encoded in UTF-8 !!!
- *
- * Note (Emacs): You need Mule. In Debian the package is called
- * mule-ucs.
- *
- * Note (Emacs): You may have to enable multibyte characters in the
- * Mule customization group or by setting
- * default-enable-multibyte-characters to t in your .emacs:
- */
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/**
- * \file xmlpool.h
- * \brief Pool of common options
- * \author Felix Kuehling
- *
- * This file defines macros that can be used to construct driConfigOptions
- * in the drivers.
- */
-
-#ifndef __XMLPOOL_H
-#define __XMLPOOL_H
-
-/*
- * generic macros
- */
-
-/** \brief Begin __driConfigOptions */
-#define DRI_CONF_BEGIN \
-"<driinfo>\n"
-
-/** \brief End __driConfigOptions */
-#define DRI_CONF_END \
-"</driinfo>\n"
-
-/** \brief Begin a section of related options */
-#define DRI_CONF_SECTION_BEGIN \
-"<section>\n"
-
-/** \brief End a section of related options */
-#define DRI_CONF_SECTION_END \
-"</section>\n"
-
-/** \brief Begin an option definition */
-#define DRI_CONF_OPT_BEGIN(name,type,def) \
-"<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n"
-
-/** \brief Begin an option definition with restrictions on valid values */
-#define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \
-"<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n"
-
-/** \brief End an option description */
-#define DRI_CONF_OPT_END \
-"</option>\n"
-
-/** \brief A verbal description in a specified language (empty version) */
-#define DRI_CONF_DESC(lang,text) \
-"<description lang=\""#lang"\" text=\""text"\"/>\n"
-
-/** \brief A verbal description in a specified language */
-#define DRI_CONF_DESC_BEGIN(lang,text) \
-"<description lang=\""#lang"\" text=\""text"\">\n"
-
-/** \brief End a description */
-#define DRI_CONF_DESC_END \
-"</description>\n"
-
-/** \brief A verbal description of an enum value */
-#define DRI_CONF_ENUM(value,text) \
-"<enum value=\""#value"\" text=\""text"\"/>\n"
-
-/*
- * predefined option sections and options with multi-lingual descriptions
- */
-
-/** \brief Debugging options */
-#define DRI_CONF_SECTION_DEBUG \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Debugging") \
- DRI_CONF_DESC(de,"Fehlersuche")
-
-#define DRI_CONF_NO_RAST(def) \
-DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
- DRI_CONF_DESC(en,"Disable 3D acceleration") \
- DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_PERFORMANCE_BOXES(def) \
-DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
- DRI_CONF_DESC(en,"Show performance boxes") \
- DRI_CONF_DESC(de,"Zeige Performanceboxen") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DEBUG_DMA(def) \
-DRI_CONF_OPT_BEGIN(debug_dma,bool,def) \
- DRI_CONF_DESC(en,"Debug DMA buffers") \
- DRI_CONF_DESC(de,"DMA Puffer debuggen") \
-DRI_CONF_OPT_END
-
-
-/** \brief Texture-related options */
-#define DRI_CONF_SECTION_QUALITY \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Image Quality") \
- DRI_CONF_DESC(de,"Bildqualität")
-
-#define DRI_CONF_TEXTURE_DEPTH_FB 0
-#define DRI_CONF_TEXTURE_DEPTH_32 1
-#define DRI_CONF_TEXTURE_DEPTH_16 2
-#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
-#define DRI_CONF_TEXTURE_DEPTH(def) \
-DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"Texture color depth") \
- DRI_CONF_ENUM(0,"Prefer frame buffer color depth") \
- DRI_CONF_ENUM(1,"Prefer 32 bits") \
- DRI_CONF_ENUM(2,"Prefer 16 bits") \
- DRI_CONF_ENUM(3,"Force 16 bits") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Texturfarbtiefe") \
- DRI_CONF_ENUM(0,"Bevorzugt so wie Frambuffer") \
- DRI_CONF_ENUM(1,"Bevorzugt 32 Bits") \
- DRI_CONF_ENUM(2,"Bevorzugt 16 Bits") \
- DRI_CONF_ENUM(3,"Höchstens 16 Bits") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_COLOR_REDUCTION_ROUND 0
-#define DRI_CONF_COLOR_REDUCTION_DITHER 1
-#define DRI_CONF_COLOR_REDUCTION(def) \
-DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,"Default color reduction method") \
- DRI_CONF_ENUM(0,"Round or truncate") \
- DRI_CONF_ENUM(1,"Dither") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Standardmethode zur Farbreduktion") \
- DRI_CONF_ENUM(0,"Runden oder Abschneiden") \
- DRI_CONF_ENUM(1,"Rastern") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_ROUND_TRUNC 0
-#define DRI_CONF_ROUND_ROUND 1
-#define DRI_CONF_ROUND_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,"Round or truncate colors") \
- DRI_CONF_ENUM(0,"Truncate") \
- DRI_CONF_ENUM(1,"Round") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Farben runden oder abschneiden") \
- DRI_CONF_ENUM(0,"Abschneiden") \
- DRI_CONF_ENUM(1,"Runden") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DITHER_XERRORDIFF 0
-#define DRI_CONF_DITHER_XERRORDIFFRESET 1
-#define DRI_CONF_DITHER_ORDERED 2
-#define DRI_CONF_DITHER_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,"Color dithering") \
- DRI_CONF_ENUM(0,"Horizontal error diffusion") \
- DRI_CONF_ENUM(1,"Horizontal error diffusion, reset error at line start") \
- DRI_CONF_ENUM(2,"Ordered 2D dithering") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Farben rastern") \
- DRI_CONF_ENUM(0,"Horizontale Fehlerstreuung") \
- DRI_CONF_ENUM(1,"Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen") \
- DRI_CONF_ENUM(2,"Geordnete 2D Farbrasterung") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-/** \brief Performance-related options */
-#define DRI_CONF_SECTION_PERFORMANCE \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Performance") \
- DRI_CONF_DESC(de,"Leistung")
-
-#define DRI_CONF_TCL_SW 0
-#define DRI_CONF_TCL_PIPELINED 1
-#define DRI_CONF_TCL_VTXFMT 2
-#define DRI_CONF_TCL_CODEGEN 3
-#define DRI_CONF_TCL_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \
- DRI_CONF_ENUM(0,"Software") \
- DRI_CONF_ENUM(1,"TCL stage in MESA pipeline") \
- DRI_CONF_ENUM(2,"Bypass MESA's pipeline") \
- DRI_CONF_ENUM(3,"Bypass MESA's pipeline with state-based code generation") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"TCL Modus (Transformation, Clipping, Licht)") \
- DRI_CONF_ENUM(0,"Software") \
- DRI_CONF_ENUM(1,"TCL Stufe in MESA Pipeline") \
- DRI_CONF_ENUM(2,"Umgehe MESA's Pipeline") \
- DRI_CONF_ENUM(3,"Umgehe MESA's Pipeline mit zustandsbasierter Codegenerierung") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FTHROTTLE_BUSY 0
-#define DRI_CONF_FTHROTTLE_USLEEPS 1
-#define DRI_CONF_FTHROTTLE_IRQS 2
-#define DRI_CONF_FTHROTTLE_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,"Frame throttling") \
- DRI_CONF_ENUM(0,"Busy waiting") \
- DRI_CONF_ENUM(1,"Usleeps") \
- DRI_CONF_ENUM(2,"Software interrupts") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Framethrottling") \
- DRI_CONF_ENUM(0,"Aktives Warten") \
- DRI_CONF_ENUM(1,"Usleeps") \
- DRI_CONF_ENUM(2,"Sortware Interrutps") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_VBLANK_NEVER 0
-#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
-#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
-#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
-#define DRI_CONF_VBLANK_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \
- DRI_CONF_ENUM(0,"Never, FPS rulez!") \
- DRI_CONF_ENUM(1,"Application preference, default interval 0") \
- DRI_CONF_ENUM(2,"Application preference, default interval 1") \
- DRI_CONF_ENUM(3,"Application preference, always synchronize with refresh") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Synchronisation mit dem vertikalen Bildaufbau (swap intervals)") \
- DRI_CONF_ENUM(0,"Niemals, immer die maximale Framerate") \
- DRI_CONF_ENUM(1,"Anwendung entscheidet, Standardinterval 0") \
- DRI_CONF_ENUM(2,"Anwendung entscheidet, Standardinterval 1") \
- DRI_CONF_ENUM(3,"Anwendung entscheidet, immer mit Bildaufbau synchronisieren") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c
deleted file mode 100644
index 8c94bde36..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c,v 1.1 2002/02/22 21:32:58 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "ffb_context.h"
-#include "ffb_state.h"
-#include "ffb_lock.h"
-#include "ffb_bitmap.h"
-#include "swrast/swrast.h"
-#include "image.h"
-#include "macros.h"
-
-#undef FFB_BITMAP_TRACE
-
-static void
-ffb_bitmap(GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- unsigned int ppc, pixel;
- GLint row, col, row_stride;
- const GLubyte *src;
- char *buf;
-
- if (fmesa->bad_fragment_attrs != 0)
- _swrast_Bitmap(ctx, px, py, width,
- height, unpack, bitmap);
-
- pixel = (((((GLuint)(ctx->Current.RasterColor[0] * 255.0f)) & 0xff) << 0) |
- ((((GLuint)(ctx->Current.RasterColor[1] * 255.0f)) & 0xff) << 8) |
- ((((GLuint)(ctx->Current.RasterColor[2] * 255.0f)) & 0xff) << 16) |
- ((((GLuint)(ctx->Current.RasterColor[3] * 255.0f)) & 0xff) << 24));
-
-#ifdef FFB_BITMAP_TRACE
- fprintf(stderr, "ffb_bitmap: ppc(%08x) fbc(%08x) cmp(%08x) pixel(%08x)\n",
- fmesa->ppc, fmesa->fbc, fmesa->cmp, pixel);
-#endif
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty)
- ffbSyncHardware(fmesa);
-
- ppc = fmesa->ppc;
-
- FFBFifo(fmesa, 4);
- ffb->ppc = ((ppc &
- ~(FFB_PPC_TBE_MASK | FFB_PPC_ZS_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK))
- | (FFB_PPC_TBE_TRANSPARENT | FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST |
- (ctx->Color.BlendEnabled ? FFB_PPC_XS_CONST : FFB_PPC_XS_WID)));
- ffb->constz = ((GLuint) (ctx->Current.RasterPos[2] * 0x0fffffff));
- ffb->fg = pixel;
- ffb->fontinc = (0 << 16) | 32;
-
- buf = (char *)(fmesa->sfb32 + (dPriv->x << 2) + (dPriv->y << 13));
-
- row_stride = (unpack->Alignment * CEILING(width, 8 * unpack->Alignment));
- src = (const GLubyte *) (bitmap +
- (unpack->SkipRows * row_stride) +
- (unpack->SkipPixels / 8));
- if (unpack->LsbFirst == GL_TRUE) {
- for (row = 0; row < height; row++, src += row_stride) {
- const GLubyte *row_src = src;
- GLuint base_x, base_y;
-
- base_x = dPriv->x + px;
- base_y = dPriv->y + (dPriv->h - (py + row));
-
- FFBFifo(fmesa, 1);
- ffb->fontxy = (base_y << 16) | base_x;
-
- for (col = 0; col < width; col += 32, row_src += 4) {
- GLint bitnum, font_w = (width - col);
- GLuint font_data;
-
- if (font_w > 32)
- font_w = 32;
- font_data = 0;
- for (bitnum = 0; bitnum < 32; bitnum++) {
- const GLubyte val = row_src[bitnum >> 3];
-
- if (val & (1 << (bitnum & (8 - 1))))
- font_data |= (1 << (31 - bitnum));
- }
-
- FFBFifo(fmesa, 2);
- ffb->fontw = font_w;
- ffb->font = font_data;
- }
- }
- } else {
- for (row = 0; row < height; row++, src += row_stride) {
- const GLubyte *row_src = src;
- GLuint base_x, base_y;
-
- base_x = dPriv->x + px;
- base_y = dPriv->y + (dPriv->h - (py + row));
-
- FFBFifo(fmesa, 1);
- ffb->fontxy = (base_y << 16) | base_x;
-
- for (col = 0; col < width; col += 32, row_src += 4) {
- GLint font_w = (width - col);
-
- if (font_w > 32)
- font_w = 32;
- FFBFifo(fmesa, 2);
- ffb->fontw = font_w;
- ffb->font = (((unsigned int)row_src[0]) << 24 |
- ((unsigned int)row_src[1]) << 16 |
- ((unsigned int)row_src[2]) << 8 |
- ((unsigned int)row_src[3]) << 0);
- }
- }
- }
-
- FFBFifo(fmesa, 1);
- ffb->ppc = ppc;
- fmesa->ffbScreen->rp_active = 1;
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-void ffbDDInitBitmapFuncs(GLcontext *ctx)
-{
- ctx->Driver.Bitmap = ffb_bitmap;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h
deleted file mode 100644
index 4f8d2ea2a..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h,v 1.1 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_BITMAP_H
-#define _FFB_BITMAP_H
-
-extern void ffbDDInitBitmapFuncs(GLcontext *);
-
-#endif /* !(_FFB_BITMAP_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c
deleted file mode 100644
index 5285774f6..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "extensions.h"
-
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_clear.h"
-#include "ffb_lock.h"
-
-#undef CLEAR_TRACE
-
-#define BOX_AREA(__w, __h) ((int)(__w) * (int)(__h))
-
-/* Compute the page aligned box for a page mode fast fill.
- * In 'ework' this returns greater than zero if there are some odd
- * edges to take care of which are outside of the page aligned area.
- * It will place less than zero there if the box is too small,
- * indicating that a different method must be used to fill it.
- */
-#define CreatorPageFillParms(ffp, x, y, w, h, px, py, pw, ph, ework) \
-do { int xdiff, ydiff; \
- int pf_bh = ffp->pagefill_height; \
- int pf_bw = ffp->pagefill_width; \
- py = ((y + (pf_bh - 1)) & ~(pf_bh - 1)); \
- ydiff = py - y; \
- px = ffp->Pf_AlignTab[x + (pf_bw - 1)]; \
- xdiff = px - x; \
- ph = ((h - ydiff) & ~(pf_bh - 1)); \
- if(ph <= 0) \
- ework = -1; \
- else { \
- pw = ffp->Pf_AlignTab[w - xdiff]; \
- if(pw <= 0) { \
- ework = -1; \
- } else { \
- ework = (((xdiff > 0) || \
- (ydiff > 0) || \
- ((w - pw) > 0) || \
- ((h - ph) > 0))) ? 1 : 0; \
- } \
- } \
-} while(0);
-
-struct ff_fixups {
- int x, y, width, height;
-};
-
-/* Compute fixups of non-page aligned areas after a page fill.
- * Return the number of fixups needed.
- */
-static __inline__ int
-CreatorComputePageFillFixups(struct ff_fixups *fixups,
- int x, int y, int w, int h,
- int paligned_x, int paligned_y,
- int paligned_w, int paligned_h)
-{
- int nfixups = 0;
-
- /* FastFill Left */
- if(paligned_x != x) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = paligned_y;
- fixups[nfixups].width = paligned_x - x;
- fixups[nfixups].height = paligned_h;
- nfixups++;
- }
- /* FastFill Top */
- if(paligned_y != y) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = y;
- fixups[nfixups].width = w;
- fixups[nfixups].height = paligned_y - y;
- nfixups++;
- }
- /* FastFill Right */
- if((x+w) != (paligned_x+paligned_w)) {
- fixups[nfixups].x = (paligned_x+paligned_w);
- fixups[nfixups].y = paligned_y;
- fixups[nfixups].width = (x+w) - fixups[nfixups].x;
- fixups[nfixups].height = paligned_h;
- nfixups++;
- }
- /* FastFill Bottom */
- if((y+h) != (paligned_y+paligned_h)) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = (paligned_y+paligned_h);
- fixups[nfixups].width = w;
- fixups[nfixups].height = (y+h) - fixups[nfixups].y;
- nfixups++;
- }
- return nfixups;
-}
-
-static void
-ffb_do_clear(ffbContextPtr fmesa, __DRIdrawablePrivate *dPriv,
- GLboolean all, GLint cx, GLint cy, GLint cwidth,
- GLint cheight)
-{
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) fmesa->driScreen->pDevPriv;
- ffb_fbcPtr ffb = fmesa->regs;
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- int nc = dPriv->numClipRects;
-
- cy = dPriv->h - cy - cheight;
- cx += dPriv->x;
- cy += dPriv->y;
-
- while (nc--) {
- GLint x = box[nc].x1;
- GLint y = box[nc].y1;
- GLint width = box[nc].x2 - x;
- GLint height = box[nc].y2 - y;
- int paligned_y, paligned_x;
- int paligned_h, paligned_w = 0;
- int extra_work;
-
- if (!all) {
- if (x < cx) {
- width -= cx - x;
- x = cx;
- }
- if (y < cy) {
- height -= cy - y;
- y = cy;
- }
- if (x + width > cx + cwidth)
- width = cx + cwidth - x;
- if (y + height > cy + cheight)
- height = cy + cheight - y;
- if (width <= 0)
- continue;
- if (height <= 0)
- continue;
- }
-
- if (BOX_AREA(width, height) < gDRIPriv->fastfill_small_area) {
- FFBFifo(fmesa, 5);
- ffb->drawop = FFB_DRAWOP_RECTANGLE;
- ffb->by = y;
- ffb->bx = x;
- ffb->bh = height;
- ffb->bw = width;
- continue;
- }
-
- FFBFifo(fmesa, 1);
- ffb->drawop = FFB_DRAWOP_FASTFILL;
-
- if (gDRIPriv->disable_pagefill ||
- (width < (gDRIPriv->pagefill_width<<1)) ||
- (height < (gDRIPriv->pagefill_height<<1)))
- goto do_fastfill;
-
- CreatorPageFillParms(gDRIPriv,
- x, y, width, height,
- paligned_x, paligned_y,
- paligned_w, paligned_h, extra_work);
-
- if (extra_work < 0 ||
- BOX_AREA(paligned_w, paligned_h) < gDRIPriv->pagefill_small_area) {
- do_fastfill:
- FFBFifo(fmesa, 10);
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = (gDRIPriv->fastfill_width * 4);
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->dy = y;
- ffb->dx = x;
- ffb->bh = (height + (y & (gDRIPriv->fastfill_height - 1)));
- ffb->bx = (width + (x & (gDRIPriv->fastfill_width - 1)));
- continue;
- }
-
- /* Ok, page fill is possible and worth it. */
- FFBFifo(fmesa, 15);
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = gDRIPriv->fastfill_width * 4;
- ffb->by = FFB_FASTFILL_BLOCK_X;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->pagefill_height;
- ffb->bw = gDRIPriv->pagefill_width * 4;
- ffb->by = FFB_FASTFILL_PAGE;
- ffb->dy = paligned_y;
- ffb->dx = paligned_x;
- ffb->bh = paligned_h;
- ffb->bx = paligned_w;
-
- if (extra_work) {
- struct ff_fixups local_fixups[4];
- int nfixups;
-
- nfixups = CreatorComputePageFillFixups(local_fixups,
- x, y, width, height,
- paligned_x, paligned_y,
- paligned_w, paligned_h);
- FFBFifo(fmesa, 5 + (nfixups * 5));
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = gDRIPriv->fastfill_width * 4;
-
- while (--nfixups >= 0) {
- int xx, yy, ww, hh;
-
- xx = local_fixups[nfixups].x;
- yy = local_fixups[nfixups].y;
- ffb->dy = yy;
- ffb->dx = xx;
- ww = (local_fixups[nfixups].width +
- (xx & (gDRIPriv->fastfill_width - 1)));
- hh = (local_fixups[nfixups].height +
- (yy & (gDRIPriv->fastfill_height - 1)));
- if (nfixups != 0) {
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->bh = hh;
- ffb->bw = ww;
- } else {
- ffb->bh = hh;
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->bx = ww;
- }
- }
- }
- }
-}
-
-void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cwidth, GLint cheight)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- unsigned int stcmask = DD_STENCIL_BIT;
-
-#ifdef CLEAR_TRACE
- fprintf(stderr, "ffbDDClear: mask(%08x) all(%d) "
- "[x(%x)y(%x)w(%x)h(%x)]\n",
- mask, (int) all, cx, cy, cwidth, cheight);
-#endif
- if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS))
- stcmask = 0;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT | stcmask)) {
- ffb_fbcPtr ffb = fmesa->regs;
- unsigned int fbc, ppc;
-
- fbc = (FFB_FBC_XE_ON);
- ppc = (FFB_PPC_ACE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_ABE_DISABLE | FFB_PPC_VCE_DISABLE |
- FFB_PPC_APE_DISABLE | FFB_PPC_XS_WID |
- FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST);
-
- /* Y/X enables must be both on or both off. */
- if (mask & (DD_DEPTH_BIT | stcmask)) {
- fbc |= (FFB_FBC_ZE_ON | FFB_FBC_YE_ON | FFB_FBC_WB_C);
- } else
- fbc |= FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF;
-
- /* All RGB enables must be both on or both off. */
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- if (mask & DD_FRONT_LEFT_BIT) {
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_B;
- else
- fbc |= FFB_FBC_WB_A;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_A;
- else
- fbc |= FFB_FBC_WB_B;
- }
- fbc |= FFB_FBC_RGBE_ON;
- } else
- fbc |= FFB_FBC_RGBE_OFF;
-
- LOCK_HARDWARE(fmesa);
-
- if (dPriv->numClipRects) {
- FFBFifo(fmesa, 8);
- ffb->fbc = fbc;
- ffb->ppc = ppc;
- ffb->xclip = FFB_XCLIP_TEST_ALWAYS;
- ffb->cmp = 0x80808080;
- ffb->rop = FFB_ROP_NEW;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT))
- ffb->fg = fmesa->clear_pixel;
- if (mask & DD_DEPTH_BIT)
- ffb->constz = fmesa->clear_depth;
- if (mask & stcmask)
- ffb->consty = fmesa->clear_stencil;
-
- ffb_do_clear(fmesa, dPriv, all, cx, cy, cwidth, cheight);
-
- FFBFifo(fmesa, 6);
- ffb->ppc = fmesa->ppc;
- ffb->fbc = fmesa->fbc;
- ffb->xclip = fmesa->xclip;
- ffb->cmp = fmesa->cmp;
- ffb->rop = fmesa->rop;
- ffb->drawop = fmesa->drawop;
- if (mask & stcmask)
- ffb->consty = fmesa->consty;
- fmesa->ffbScreen->rp_active = 1;
- }
-
- UNLOCK_HARDWARE(fmesa);
-
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT |
- DD_DEPTH_BIT | stcmask);
- }
-
- if (mask)
- _swrast_Clear(ctx, mask, all, cx, cy, cwidth, cheight);
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h
deleted file mode 100644
index 4b707f19b..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_CLEAR_H
-#define _FFB_CLEAR_H
-
-extern void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cwidth, GLint cheight);
-
-#endif /* !(_FFB_CLEAR_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h
deleted file mode 100644
index 6e68b6dd2..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_context.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_CONTEXT_H
-#define _FFB_CONTEXT_H
-
-#include "dri_util.h"
-
-#include "mtypes.h"
-
-#include "ffb_xmesa.h"
-
-typedef struct {
- GLfloat alpha;
- GLfloat red;
- GLfloat green;
- GLfloat blue;
-} ffb_color;
-
-#define FFB_GET_ALPHA(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].alpha)
-#define FFB_GET_RED(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].red)
-#define FFB_GET_GREEN(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].green)
-#define FFB_GET_BLUE(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].blue)
-
-typedef struct {
- GLfloat x, y, z;
- ffb_color color[2];
-} ffb_vertex;
-
-#define FFB_DELAYED_VIEWPORT_VARS \
- GLfloat VP_SX = fmesa->hw_viewport[MAT_SX]; \
- GLfloat VP_TX = fmesa->hw_viewport[MAT_TX]; \
- GLfloat VP_SY = fmesa->hw_viewport[MAT_SY]; \
- GLfloat VP_TY = fmesa->hw_viewport[MAT_TY]; \
- GLfloat VP_SZ = fmesa->hw_viewport[MAT_SZ]; \
- GLfloat VP_TZ = fmesa->hw_viewport[MAT_TZ]; \
- (void) VP_SX; (void) VP_SY; (void) VP_SZ; \
- (void) VP_TX; (void) VP_TY; (void) VP_TZ
-
-#define FFB_GET_Z(VTX) \
- FFB_Z_FROM_FLOAT(VP_SZ * (VTX)->z + VP_TZ)
-#define FFB_GET_Y(VTX) \
- FFB_XY_FROM_FLOAT(VP_SY * (VTX)->y + VP_TY)
-#define FFB_GET_X(VTX) \
- FFB_XY_FROM_FLOAT(VP_SX * (VTX)->x + VP_TX)
-
-typedef void (*ffb_point_func)(GLcontext *, ffb_vertex *);
-typedef void (*ffb_line_func)(GLcontext *, ffb_vertex *, ffb_vertex *);
-typedef void (*ffb_tri_func)(GLcontext *, ffb_vertex *, ffb_vertex *,
- ffb_vertex *);
-typedef void (*ffb_quad_func)(GLcontext *, ffb_vertex *, ffb_vertex *,
- ffb_vertex *, ffb_vertex *);
-
-/* Immediate mode fast-path support. */
-typedef struct {
- GLfloat obj[4];
- GLfloat normal[4];
- GLfloat clip[4];
- GLuint mask;
- GLfloat color[4];
- GLfloat win[4];
- GLfloat eye[4];
-} ffbTnlVertex, *ffbTnlVertexPtr;
-
-typedef void (*ffb_interp_func)(GLfloat t,
- ffbTnlVertex *O,
- const ffbTnlVertex *I,
- const ffbTnlVertex *J);
-
-struct ffb_current_state {
- GLfloat color[4];
- GLfloat normal[4];
- GLfloat specular[4];
-};
-
-struct ffb_light_state {
- GLfloat base_color[3];
- GLfloat base_alpha;
-};
-
-struct ffb_vertex_state {
- struct ffb_current_state current;
- struct ffb_light_state light;
-};
-
-struct ffb_imm_vertex {
- ffbTnlVertex vertices[8];
- ffbTnlVertex *v0;
- ffbTnlVertex *v1;
- ffbTnlVertex *v2;
- ffbTnlVertex *v3;
-
- void (*save_vertex)(GLcontext *ctx, ffbTnlVertex *v);
- void (*flush_vertex)(GLcontext *ctx, ffbTnlVertex *v);
-
- ffb_interp_func interp;
-
- GLuint prim, format;
-
- GLvertexformat vtxfmt;
-};
-
-typedef struct ffb_context_t {
- GLcontext *glCtx;
- GLframebuffer *glBuffer;
-
- /* Temporaries for translating to float colors. */
- struct gl_client_array FloatColor;
- struct gl_client_array FloatSecondaryColor;
-
- ffb_fbcPtr regs;
- volatile char *sfb32;
-
- int hw_locked;
-
- int back_buffer; /* 0 = bufferA, 1 = bufferB */
-
- /* Viewport matrix. */
- GLfloat hw_viewport[16];
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F + 0.125)
-
- /* Vertices in driver format. */
- ffb_vertex *verts;
-
- /* Rasterization functions. */
- ffb_point_func draw_point;
- ffb_line_func draw_line;
- ffb_tri_func draw_tri;
- ffb_quad_func draw_quad;
-
- GLenum raster_primitive;
- GLenum render_primitive;
-
- GLfloat backface_sign;
- GLfloat depth_scale;
-
- GLfloat ffb_2_30_fixed_scale;
- GLfloat ffb_one_over_2_30_fixed_scale;
- GLfloat ffb_16_16_fixed_scale;
- GLfloat ffb_one_over_16_16_fixed_scale;
- GLfloat ffb_ubyte_color_scale;
- GLfloat ffb_zero;
-
- /* Immediate mode state. */
- struct ffb_vertex_state vtx_state;
- struct ffb_imm_vertex imm;
-
- /* Debugging knobs. */
- GLboolean debugFallbacks;
-
- /* This records state bits when a per-fragment attribute has
- * been set which prevents us from rendering in hardware.
- *
- * As attributes change, some of these bits may clear as
- * we move back within the chips capabilities. If they
- * all clear, we return to full hw rendering.
- */
- unsigned int bad_fragment_attrs;
-#define FFB_BADATTR_FOG 0x00000001 /* Bad fog possible only when < FFB2 */
-#define FFB_BADATTR_BLENDFUNC 0x00000002 /* Any non-const func based upon dst alpha */
-#define FFB_BADATTR_BLENDROP 0x00000004 /* Blend enabled and LogicOP != GL_COPY */
-#define FFB_BADATTR_BLENDEQN 0x00000008 /* Blend equation other than ADD */
-#define FFB_BADATTR_STENCIL 0x00000010 /* Stencil enabled when < FFB2+ */
-#define FFB_BADATTR_TEXTURE 0x00000020 /* Texture enabled */
-#define FFB_BADATTR_SWONLY 0x00000040 /* Environment var set */
-
- unsigned int state_dirty;
- unsigned int state_fifo_ents;
-#define FFB_STATE_FBC 0x00000001
-#define FFB_STATE_PPC 0x00000002
-#define FFB_STATE_DRAWOP 0x00000004
-#define FFB_STATE_ROP 0x00000008
-#define FFB_STATE_LPAT 0x00000010
-#define FFB_STATE_PMASK 0x00000020
-#define FFB_STATE_XPMASK 0x00000040
-#define FFB_STATE_YPMASK 0x00000080
-#define FFB_STATE_ZPMASK 0x00000100
-#define FFB_STATE_XCLIP 0x00000200
-#define FFB_STATE_CMP 0x00000400
-#define FFB_STATE_MATCHAB 0x00000800
-#define FFB_STATE_MAGNAB 0x00001000
-#define FFB_STATE_MATCHC 0x00002000
-#define FFB_STATE_MAGNC 0x00004000
-#define FFB_STATE_DCUE 0x00008000
-#define FFB_STATE_BLEND 0x00010000
-#define FFB_STATE_CLIP 0x00020000
-#define FFB_STATE_STENCIL 0x00040000
-#define FFB_STATE_APAT 0x00080000
-#define FFB_STATE_WID 0x00100000
-#define FFB_STATE_ALL 0x001fffff
-
- unsigned int state_all_fifo_ents;
-
-#define FFB_MAKE_DIRTY(FMESA, STATE_MASK, FIFO_ENTS) \
-do { if ((STATE_MASK) & ~((FMESA)->state_dirty)) { \
- (FMESA)->state_dirty |= (STATE_MASK); \
- (FMESA)->state_fifo_ents += FIFO_ENTS; \
- } \
-} while (0)
-
- /* General hw reg state. */
- unsigned int fbc;
- unsigned int ppc;
- unsigned int drawop;
- unsigned int rop;
-
- unsigned int lpat;
-#define FFB_LPAT_BAD 0xffffffff
-
- unsigned int wid;
- unsigned int pmask;
- unsigned int xpmask;
- unsigned int ypmask;
- unsigned int zpmask;
- unsigned int xclip;
- unsigned int cmp;
- unsigned int matchab;
- unsigned int magnab;
- unsigned int matchc;
- unsigned int magnc;
-
- /* Depth cue unit hw reg state. */
- unsigned int dcss; /* All FFB */
- unsigned int dcsf; /* All FFB */
- unsigned int dcsb; /* All FFB */
- unsigned int dczf; /* All FFB */
- unsigned int dczb; /* All FFB */
- unsigned int dcss1; /* >=FFB2 only */
- unsigned int dcss2; /* >=FFB2 only */
- unsigned int dcss3; /* >=FFB2 only */
- unsigned int dcs2; /* >=FFB2 only */
- unsigned int dcs3; /* >=FFB2 only */
- unsigned int dcs4; /* >=FFB2 only */
- unsigned int dcd2; /* >=FFB2 only */
- unsigned int dcd3; /* >=FFB2 only */
- unsigned int dcd4; /* >=FFB2 only */
-
- /* Blend unit hw reg state. */
- unsigned int blendc;
- unsigned int blendc1;
- unsigned int blendc2;
-
- /* ViewPort clipping hw reg state. */
- unsigned int vclipmin;
- unsigned int vclipmax;
- unsigned int vclipzmin;
- unsigned int vclipzmax;
- struct {
- unsigned int min;
- unsigned int max;
- } aux_clips[4];
-
- /* Stencil control hw reg state. >=FFB2+ only. */
- unsigned int stencil;
- unsigned int stencilctl;
- unsigned int consty; /* Stencil Ref */
-
- /* Area pattern (used for polygon stipples). */
- unsigned int pattern[32];
-
- /* Fog state. */
- float Znear, Zfar;
-
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- unsigned int clear_pixel;
- unsigned int clear_depth;
- unsigned int clear_stencil;
-
- unsigned int setupindex;
- unsigned int setupnewinputs;
- unsigned int new_gl_state;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- ffbScreenPrivate *ffbScreen;
- ffb_dri_state_t *ffb_sarea;
-} ffbContextRec, *ffbContextPtr;
-
-#define FFB_CONTEXT(ctx) ((ffbContextPtr)((ctx)->DriverCtx))
-
-/* We want the depth values written during software rendering
- * to match what the hardware is going to put there when we
- * hw render.
- *
- * The Z buffer is 28 bits deep. Smooth shaded primitives
- * specify a 2:30 signed fixed point Z value in the range 0.0
- * to 1.0 inclusive.
- *
- * So for example, when hw rendering, the largest Z value of
- * 1.0 would produce a value of 0x0fffffff in the actual Z
- * buffer, which is the maximum value.
- *
- * Mesa's depth type is a 32-bit int, so we use the following macro
- * to convert to/from FFB hw Z values. Note we also have to clear
- * out the top bits as that is where the Y (stencil) buffer is stored
- * and during hw Z buffer reads it is always there. (During writes
- * we tell the hw to discard those top 4 bits).
- */
-#define Z_TO_MESA(VAL) ((GLdepth)(((VAL) & 0x0fffffff) << (32 - 28)))
-#define Z_FROM_MESA(VAL) (((GLuint)((GLdouble)(VAL))) >> (32 - 28))
-
-#endif /* !(_FFB_CONTEXT_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c
deleted file mode 100644
index d0137000f..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c,v 1.4 2002/09/11 19:49:07 tsi Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_clear.h"
-#include "ffb_lock.h"
-#include "extensions.h"
-
-#define FFB_DATE "20021125"
-
-/* Mesa's Driver Functions */
-
-static const GLubyte *ffbDDGetString(GLcontext *ctx, GLenum name)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *) "David S. Miller";
-
- case GL_RENDERER:
- sprintf(buffer, "Mesa DRI FFB " FFB_DATE);
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2)
- strncat(buffer, " FFB2", 5);
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)
- strncat(buffer, " FFB2PLUS", 9);
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1)
- strncat(buffer, " PAC1", 5);
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC2)
- strncat(buffer, " PAC2", 5);
-
-#ifdef USE_SPARC_ASM
- strncat(buffer, " Sparc", 6);
-#endif
-
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- };
-}
-
-
-static void ffbBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- *width = fmesa->driDrawable->w;
- *height = fmesa->driDrawable->h;
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDExtensionsInit(GLcontext *ctx)
-{
- /* Nothing for now until we start to add
- * real acceleration. -DaveM
- */
-
- /* XXX Need to turn off GL_EXT_blend_func_separate for one.
- * XXX Also BlendEquation should be turned off too, what
- * XXX EXT is that assosciated with?
- */
-}
-
-static void ffbDDFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- FFBWait(fmesa, fmesa->regs);
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDInitDriverFuncs(GLcontext *ctx)
-{
- ctx->Driver.GetBufferSize = ffbBufferSize;
- ctx->Driver.GetString = ffbDDGetString;
- ctx->Driver.Clear = ffbDDClear;
-
- ctx->Driver.Finish = ffbDDFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h
deleted file mode 100644
index 4ffcbe666..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h,v 1.1 2000/06/20 05:08:38 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D.
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#ifndef _FFB_DD_H
-#define _FFB_DD_H
-
-#include "context.h"
-
-void ffbDDInitDriverFuncs(GLcontext *ctx);
-void ffbDDExtensionsInit(GLcontext *ctx);
-
-#endif /* !(_FFB_DD_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c
deleted file mode 100644
index 27f3589d1..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_depth.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.h"
-
-#undef DEPTH_TRACE
-
-static void
-FFBWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLdepth depth[], const GLubyte mask[])
-{
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBWriteDepthSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_ON |
- FFB_FBC_YE_OFF | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_ZS_VAR;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- if (mask[i]) {
- *zptr = Z_FROM_MESA(depth[i]);
- }
- zptr++;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void
-FFBWriteDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[],
- const GLdepth depth[], const GLubyte mask[])
-{
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBWriteDepthPixels: n(%d)\n", (int) n);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_ON |
- FFB_FBC_YE_OFF | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_ZS_VAR;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- if (mask[i])
- *zptr = Z_FROM_MESA(depth[i]);
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void
-FFBReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBReadDepthSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- depth[i] = Z_TO_MESA(*zptr);
- zptr++;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void
-FFBReadDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[],
- GLdepth depth[])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBReadDepthPixels: n(%d)\n", (int) n);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- depth[i] = Z_TO_MESA(*zptr);
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDInitDepthFuncs(GLcontext *ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
-
- swdd->WriteDepthSpan = FFBWriteDepthSpan;
- swdd->ReadDepthSpan = FFBReadDepthSpan;
- swdd->WriteDepthPixels = FFBWriteDepthPixels;
- swdd->ReadDepthPixels = FFBReadDepthPixels;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h
deleted file mode 100644
index a098bfcc2..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h,v 1.1 2000/06/20 05:08:38 dawes Exp $ */
-
-#ifndef _FFB_DEPTH_H
-#define _FFB_DEPTH_H
-
-extern void ffbDDInitDepthFuncs(GLcontext *ctx);
-
-#endif /* !(_FFB_DEPTH_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h
deleted file mode 100644
index 886d71b76..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_FIFO_H
-#define _FFB_FIFO_H
-
-#define FFBFifo(__fmesa, __n) \
-do { ffbScreenPrivate *__fScrn = (__fmesa)->ffbScreen; \
- int __cur_slots = __fScrn->fifo_cache; \
- if ((__cur_slots - (__n)) < 0) { \
- ffb_fbcPtr __ffb = __fmesa->regs; \
- do { __cur_slots = (((int)__ffb->ucsr & FFB_UCSR_FIFO_MASK) - 4); \
- } while ((__cur_slots - (__n)) < 0); \
- } (__fScrn)->fifo_cache = (__cur_slots - (__n)); \
-} while(0)
-
-#define FFBWait(__fmesa, __ffb) \
-do { ffbScreenPrivate *__fScrn = (__fmesa)->ffbScreen; \
- if (__fScrn->rp_active) { \
- unsigned int __regval = (__ffb)->ucsr; \
- while((__regval & FFB_UCSR_ALL_BUSY) != 0) { \
- __regval = (__ffb)->ucsr; \
- } \
- __fScrn->fifo_cache = ((int)(__regval & FFB_UCSR_FIFO_MASK)) - 4; \
- __fScrn->rp_active = 0; \
- } \
-} while(0)
-
-#endif /* !(_FFB_FIFO_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_fog.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_fog.c
deleted file mode 100644
index e6eca2390..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_fog.c
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/* FFB fog support:
- *
- * There are two levels of support for FOG in the Creator3D series.
- * Both involve a depth cue unit and 1 or 4 slope factors and scales
- * for varying the pixel intensity.
- *
- * Chips prior to FFB2 only have a single set of such settings, FFB2
- * and later have 4 settings.
- *
- * The basic depth cueing equation is:
- *
- * C_final = dcsf(z) * C_orig + (1 - dcsf(z)) * C_fog
- *
- * C_final -- The final color passed to blend unit or frame
- * buffer (if blending is disabled).
- *
- * C_orig -- The color we start with, which comes either from
- * the raster processor or cpu writes to the smart
- * framebuffer aperture.
- *
- * C_fog -- This is the "fog" color, ie. the desired color
- * at the deepest Z.
- *
- * dcsf(z) -- The depth cue scale as a function of Z.
- *
- * With pre-FFB2 chips there are four parameters to control the depth
- * cue scaling. Here is a diagram:
- *
- * 1.0 -------------
- * | | | |
- * | | | |
- * Sfront XXXXX---+---+
- * | |X | |
- * dcsf(z) | | X | |
- * | | X| |
- * Sback +---+---XXXXX
- * | | | |
- * 0.0 -------------
- * 0.0 Zf Zb 1.0
- *
- * z
- * Therefore:
- *
- * for Zf < z < Zb
- *
- * dcsf(z) = Sback + ((Sfront - Sback) / (Zf - Zb)) * (Zb - z)
- *
- * for z <= Zf
- *
- * dcsf(z) = Sfront
- *
- * for z >= Zb
- *
- * dcsf(z) = Sback
- *
- * With FFB2 and later, 3 more slope regions are provided, the first of
- * them starts at the end of the region defined above and ends at a
- * specified depth value, the next slop region starts there and ends
- * at the next specified depth value, and so on. Each of the 3 slope
- * regions also have scale and slope settings of their own.
- *
- * The C_fog color is programmed into the alpha blending unit color1
- * and color2 registers as follows:
- *
- * color1: -(C_fog)
- * color2: C_fog - bg
- *
- * If alpha blending is disabled, the bg factor is zero. Note that
- * the alpha blending color registers specify each of the RGB values
- * as 9 bit 1:8 signed numbers in the range -1.00 to 0.ff inclusive.
- * (ie. 0x100 == -1.00 and 0x0ff == +0.ff)
- */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c
deleted file mode 100644
index fec6b9306..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "mm.h"
-#include "mmath.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_lines.h"
-#include "ffb_tris.h"
-#include "ffb_lock.h"
-#include "extensions.h"
-
-#undef FFB_LINE_TRACE
-
-#define FFB_LINE_FLAT_BIT 0x01
-#define FFB_LINE_ALPHA_BIT 0x02
-#define MAX_FFB_LINE_FUNCS 0x04
-
-static ffb_line_func ffb_line_tab[MAX_FFB_LINE_FUNCS];
-
-/* If the line is not wide, we can support all of the line
- * patterning and smooth shading features of OpenGL fully.
- */
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_ALPHA_BIT|FFB_LINE_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "ffb_linetmp.h"
-
-void ffbDDLinefuncInit(void)
-{
- init();
- init_flat();
- init_alpha();
- init_alpha_flat();
-}
-
-static void ffb_dd_line( GLcontext *ctx, GLuint e0, GLuint e1 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *v0 = &fmesa->verts[e0];
- ffb_vertex *v1 = &fmesa->verts[e1];
- fmesa->draw_line( ctx, v0, v1 );
-}
-
-void ffbChooseLineState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- tnl->Driver.Render.Line = ffb_dd_line;
-
- if (flags & DD_FLATSHADE)
- ind |= FFB_LINE_FLAT_BIT;
-
- if ((flags & DD_LINE_STIPPLE) != 0 &&
- fmesa->lpat == FFB_LPAT_BAD) {
- fmesa->draw_line = ffb_fallback_line;
- return;
- }
-
- /* If blending or the alpha test is enabled we need to
- * provide alpha components to the chip, else we can
- * do without it and thus feed vertex data to the chip
- * more efficiently.
- */
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= FFB_LINE_ALPHA_BIT;
-
- fmesa->draw_line = ffb_line_tab[ind];
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h
deleted file mode 100644
index d508c243e..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_LINES_H
-#define _FFB_LINES_H
-
-#include "ffb_context.h"
-
-#define _FFB_NEW_LINE (_DD_NEW_FLATSHADE | \
- _DD_NEW_LINE_WIDTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _NEW_COLOR)
-
-extern void ffbDDLinefuncInit(void);
-extern void ffbChooseLineState(GLcontext *);
-extern void ffb_fallback_line( GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1 );
-
-#endif /* !(_FFB_LINES_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h
deleted file mode 100644
index 0951513ca..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_LINE_FLAT_BIT)
- const GLuint const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v1->color[0] );
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef FFB_LINE_TRACE
- fprintf(stderr, "FFB: ffb_line ["
-#if (IND & FFB_LINE_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_LINE_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif
-
-#if (IND & FFB_LINE_FLAT_BIT)
- FFBFifo(fmesa, 1);
- ffb->fg = const_fg;
-#ifdef FFB_LINE_TRACE
- fprintf(stderr, "FFB: ffb_line confg_fg[%08x]\n", const_fg);
-#endif
-#endif
-
-#if (IND & FFB_LINE_FLAT_BIT)
- /* (2 * 3) + 1 */
- FFBFifo(fmesa, 7);
-#else
-#if (IND & FFB_LINE_ALPHA_BIT)
- /* (2 * 7) + 1 */
- FFBFifo(fmesa, 15);
-#else
- /* (2 * 6) + 1 */
- FFBFifo(fmesa, 13);
-#endif
-#endif
-
- /* Using DDLINE or AALINE, init the line pattern state. */
- ffb->lpat = fmesa->lpat;
-
-#if !(IND & FFB_LINE_FLAT_BIT)
-#if (IND & FFB_LINE_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
-#if !(IND & FFB_LINE_FLAT_BIT)
-#if (IND & FFB_LINE_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(init)(void)
-{
- ffb_line_tab[IND] = TAG(ffb_line);
-}
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h
deleted file mode 100644
index e6295dc06..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_LOCK_H
-#define _FFB_LOCK_H
-
-#include "ffb_context.h"
-
-extern void ffbXMesaUpdateState(ffbContextPtr fmesa);
-#define FFB_UPDATE_STATE(fmesa) ffbXMesaUpdateState(fmesa)
-
-/* Lock the hardware and validate our state. */
-#if defined(__i386__)
-#define LOCK_HARDWARE(fmesa)
-#define UNLOCK_HARDWARE(fmesa)
-#else
-#define LOCK_HARDWARE(fmesa) \
- do { \
- int __ret=0; \
- DRM_CAS(fmesa->driHwLock, fmesa->hHWContext, \
- (DRM_LOCK_HELD | fmesa->hHWContext), __ret);\
- if (__ret) { \
- drmGetLock(fmesa->driFd, fmesa->hHWContext, 0); \
- FFB_UPDATE_STATE(fmesa); \
- } \
- } while (0)
-
-
-/* Unlock the hardware. */
-#define UNLOCK_HARDWARE(fmesa) \
- DRM_UNLOCK(fmesa->driFd, fmesa->driHwLock, fmesa->hHWContext);
-#endif
-
-#endif /* !(_FFB_LOCK_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c
deleted file mode 100644
index 6505530c7..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_points.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "mmath.h"
-#include "ffb_dd.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_points.h"
-#include "ffb_tris.h"
-#include "ffb_lock.h"
-
-
-#undef FFB_POINT_TRACE
-
-#define FFB_POINT_AA_BIT 0x01
-
-static ffb_point_func ffb_point_tab[0x08];
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_pointtmp.h"
-
-#define IND (FFB_POINT_AA_BIT)
-#define TAG(x) x##_aa
-#include "ffb_pointtmp.h"
-
-void ffbDDPointfuncInit(void)
-{
- init();
- init_aa();
-}
-
-static void ffb_dd_points( GLcontext *ctx, GLuint first, GLuint last )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *fverts = fmesa->verts;
- int i;
-
- if (VB->Elts == 0) {
- for ( i = first ; i < last ; i++ ) {
- if ( VB->ClipMask[i] == 0 ) {
- fmesa->draw_point( ctx, &fverts[i] );
- }
- }
- } else {
- for ( i = first ; i < last ; i++ ) {
- GLuint e = VB->Elts[i];
- if ( VB->ClipMask[e] == 0 ) {
- fmesa->draw_point( ctx, &fverts[e] );
- }
- }
- }
-}
-
-void ffbChoosePointState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- tnl->Driver.Render.Points = ffb_dd_points;
-
- if (flags & DD_POINT_SMOOTH)
- ind |= FFB_POINT_AA_BIT;
-
- fmesa->draw_point = ffb_point_tab[ind];
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_points.h
deleted file mode 100644
index 7d5c1f8a0..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_points.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_POINTS_H
-#define _FFB_POINTS_H
-
-extern void ffbDDPointfuncInit(void);
-
-#define _FFB_NEW_POINT (_DD_NEW_POINT_SIZE | \
- _DD_NEW_POINT_SMOOTH | \
- _NEW_COLOR)
-
-extern void ffbChoosePointState(GLcontext *);
-extern void ffb_fallback_point( GLcontext *ctx, ffb_vertex *v0 );
-
-#endif /* !(_FFB_POINTS_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h
deleted file mode 100644
index 310c95d89..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */
-
-static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef FFB_POINT_TRACE
- fprintf(stderr, "FFB: ffb_point ["
-#if (IND & FFB_POINT_AA_BIT)
- "AA"
-#endif
- "] X(%f) Y(%f) Z(%f)\n",
- tmp->x, tmp->y, tmp->z);
-#endif
-
-#if (IND & FFB_POINT_AA_BIT)
- FFBFifo(fmesa, 4);
-
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( tmp->color[0] );
- ffb->z = FFB_GET_Z(tmp);
- ffb->y = FFB_GET_Y(tmp) + 0x8000 /* FIX ME */;
- ffb->x = FFB_GET_X(tmp) + 0x8000 /* FIX ME */;
-#else
- {
- unsigned int const_fg, const_z, h, w;
-
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( tmp->color[0] );
- const_z = Z_FROM_MESA(FFB_Z_TO_FLOAT(FFB_GET_Z(tmp)));
- h = FFB_GET_Y(tmp) >> 16;
- w = FFB_GET_X(tmp) >> 16;
-#ifdef FFB_POINT_TRACE
- fprintf(stderr, "FFB: ffb_point fg(%08x) z(%08x) h(%08x) w(%08x)\n",
- const_fg, const_z, h, w);
-#endif
- FFBFifo(fmesa, 4);
- ffb->fg = const_fg;
- ffb->constz = const_z;
- ffb->bh = h;
- ffb->bw = w;
- }
-#endif
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-
-static void TAG(init)(void)
-{
- ffb_point_tab[IND] = TAG(ffb_draw_point);
-}
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h
deleted file mode 100644
index 9d18db5fd..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h
+++ /dev/null
@@ -1,648 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h,v 1.2 2003/01/29 23:00:40 dawes Exp $ */
-
-#define IMPL_LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffb_fbcPtr ffb = fmesa->regs; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- FFB_DELAYED_VIEWPORT_VARS; \
- (void) fmesa; (void) ffb; (void) elt
-
-#if (IND & FFB_FLAT_BIT)
-#define FFB_DECLARE_CACHED_COLOR(NAME) \
- unsigned int NAME;
-#define FFB_COMPUTE_CACHED_COLOR(NAME, VTX) \
- NAME = FFB_PACK_CONST_UBYTE_ARGB_COLOR((VTX)->color[0])
-#define FFB_CACHED_COLOR_SAME(NAME1, NAME2) \
- ((NAME1) == (NAME2))
-#define FFB_CACHED_COLOR_SET(NAME) \
- ffb->fg = (NAME)
-#define FFB_CACHED_COLOR_UPDATE(NAME1, NAME2) \
- ffb->fg = (NAME1) = (NAME2)
-#define FFB_SET_PRIM_COLOR(COLOR_VERTEX) \
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR((COLOR_VERTEX)->color[0])
-#define FFB_PRIM_COLOR_COST 1
-#define FFB_SET_VERTEX_COLOR(VTX) /**/
-#define FFB_VERTEX_COLOR_COST 0
-#else
-#define FFB_DECLARE_CACHED_COLOR(NAME) /**/
-#define FFB_COMPUTE_CACHED_COLOR(NAME, VTX) /**/
-#define FFB_CACHED_COLOR_SAME(NAME1, NAME2) 0
-#define FFB_CACHED_COLOR_SET(NAME1) /**/
-#define FFB_CACHED_COLOR_UPDATE(NAME1, NAME2) /**/
-#define FFB_SET_PRIM_COLOR(COLOR_VERTEX) /**/
-#define FFB_PRIM_COLOR_COST 0
-#if (IND & FFB_ALPHA_BIT)
-#define FFB_SET_VERTEX_COLOR(VTX) \
- ffb->alpha = FFB_GET_ALPHA(VTX); \
- ffb->red = FFB_GET_RED(VTX); \
- ffb->green = FFB_GET_GREEN(VTX); \
- ffb->blue = FFB_GET_BLUE(VTX)
-#define FFB_VERTEX_COLOR_COST 4
-#else
-#define FFB_SET_VERTEX_COLOR(VTX) \
- ffb->red = FFB_GET_RED(VTX); \
- ffb->green = FFB_GET_GREEN(VTX); \
- ffb->blue = FFB_GET_BLUE(VTX)
-#define FFB_VERTEX_COLOR_COST 3
-#endif
-#endif
-
-#define RESET_STIPPLE ffb->lpat = fmesa->lpat;
-
-#if !(IND & (FFB_TRI_CULL_BIT))
-static void TAG(ffb_vb_points)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_POINTS);
- if (ctx->_TriangleCaps & DD_POINT_SMOOTH) {
- for (i = start; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
-
- FFBFifo(fmesa, 4);
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR(v0->color[0]);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0) + 0x8000 /* FIX ME */;
- ffb->x = FFB_GET_X(v0) + 0x8000 /* FIX ME */;
- }
- } else {
- for (i = start; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
- FFBFifo(fmesa, 4);
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR(v0->color[0]);
- ffb->constz = Z_FROM_MESA(FFB_Z_TO_FLOAT(FFB_GET_Z(v0)));
- ffb->bh = FFB_GET_Y(v0) >> 16;
- ffb->bw = FFB_GET_X(v0) >> 16;
- }
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_lines)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINES);
- for (i = start + 1; i < count; i += 2) {
- ffb_vertex *v0 = &fmesa->verts[i - 1];
- ffb_vertex *v1 = &fmesa->verts[i - 0];
-
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 2) + 6));
-
- RESET_STIPPLE;
-
- FFB_SET_PRIM_COLOR(v1);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-}
-
-static void TAG(ffb_vb_line_loop)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINE_LOOP);
- if ((flags & PRIM_BEGIN) != 0) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start + 0)];
- ffb_vertex *v1 = &fmesa->verts[ELT(start + 1)];
-
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- ((FFB_VERTEX_COLOR_COST * 2) + (3 * 2))));
-
- RESET_STIPPLE;
-
- FFB_SET_PRIM_COLOR(v1);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST + 3)));
-
- FFB_SET_PRIM_COLOR(v0);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0);
- ffb->x = FFB_GET_X(v0);
- }
- if ((flags & PRIM_END) != 0) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST + 3)));
-
- FFB_SET_PRIM_COLOR(v0);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0);
- ffb->x = FFB_GET_X(v0);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_line_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- FFB_DECLARE_CACHED_COLOR(cached_fg)
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINE_STRIP);
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- ((FFB_VERTEX_COLOR_COST * 2) + (3 * 2))));
-
- RESET_STIPPLE;
-
- {
- ffb_vertex *v0 = &fmesa->verts[ELT(start + 0)];
- ffb_vertex *v1 = &fmesa->verts[ELT(start + 1)];
-
- FFB_COMPUTE_CACHED_COLOR(cached_fg, v0);
- FFB_CACHED_COLOR_SET(cached_fg);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 0)];
- FFB_DECLARE_CACHED_COLOR(new_fg)
-
- FFB_COMPUTE_CACHED_COLOR(new_fg, v1);
- if (FFB_CACHED_COLOR_SAME(cached_fg, new_fg)) {
- FFBFifo(fmesa, ((FFB_VERTEX_COLOR_COST * 1) + (3 * 1)));
- } else {
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + (3 * 1)));
- FFB_CACHED_COLOR_UPDATE(cached_fg, new_fg);
- }
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-#endif /* !(IND & (FFB_TRI_CULL_BIT)) */
-
-/* OK, now things start getting fun :-) */
-#if (IND & (FFB_TRI_CULL_BIT))
-#define FFB_AREA_DECLARE GLfloat cc, ex, ey, fx, fy;
-#define FFB_COMPUTE_AREA_TRI(V0, V1, V2) \
-{ ex = (V1)->x - (V0)->x; \
- ey = (V1)->y - (V0)->y; \
- fx = (V2)->x - (V0)->x; \
- fy = (V2)->y - (V0)->y; \
- cc = ex*fy-ey*fx; \
-}
-#define FFB_COMPUTE_AREA_QUAD(V0, V1, V2, V3) \
-{ ex = (V2)->x - (V0)->x; \
- ey = (V2)->y - (V0)->y; \
- fx = (V3)->x - (V1)->x; \
- fy = (V3)->y - (V1)->y; \
- cc = ex*fy-ey*fx; \
-}
-#else
-#define FFB_AREA_DECLARE /**/
-#define FFB_COMPUTE_AREA_TRI(V0, V1, V2) do { } while(0)
-#define FFB_COMPUTE_AREA_QUAD(V0, V1, V2, V3) do { } while(0)
-#endif
-
-#if (IND & FFB_TRI_CULL_BIT)
-#define FFB_CULL_TRI(CULL_ACTION) \
- if (cc * fmesa->backface_sign > fmesa->ffb_zero) { \
- CULL_ACTION \
- }
-#define FFB_CULL_QUAD(CULL_ACTION) \
- if (cc * fmesa->backface_sign > fmesa->ffb_zero) { \
- CULL_ACTION \
- }
-#else
-#define FFB_CULL_TRI(CULL_ACTION) do { } while (0)
-#define FFB_CULL_QUAD(CULL_ACTION) do { } while (0)
-#endif
-
-static void TAG(ffb_vb_triangles)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLES);
- for (i = start + 2; i < count; i += 3) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_tri_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- GLint parity = 0;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLE_STRIP);
- if ((flags & PRIM_PARITY) != 0)
- parity = 1;
-
- i = start + 2;
- goto something_clipped;
-
- something_clipped:
- for (; i < count; i++, parity ^= 1) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2 + parity)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1 - parity)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- i++;
- parity ^= 1;
- break;
- }
-
- for (; i < count; i++, parity ^= 1) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2 + parity)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1 - parity)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
- (void) v0; (void) v1;
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(i++; parity^=1; goto something_clipped;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + 3));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_tri_fan)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLE_FAN);
-
- i = start + 2;
- goto something_clipped;
-
- something_clipped:
- for ( ; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- i++;
- break;
- }
-
- for (; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
- (void) v0; (void) v1;
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(i++; goto something_clipped;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + 3));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->dmyf = FFB_GET_Y(v2);
- ffb->dmxf = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_poly)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_POLYGON);
-
- /* XXX Optimize XXX */
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i)];
- ffb_vertex *v2 = &fmesa->verts[ELT(start)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_quads)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_QUADS);
-
- for (i = start + 3; i < count; i += 4) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 3)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v3 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_QUAD(v0, v1, v2, v3);
- FFB_CULL_QUAD(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 4) + 12));
- FFB_SET_PRIM_COLOR(v3);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_SET_VERTEX_COLOR(v3);
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_quad_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_QUAD_STRIP);
-
- /* XXX Optimize XXX */
- for (i = start + 3; i < count; i += 2) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 3)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v3 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_QUAD(v0, v1, v2, v3);
- FFB_CULL_QUAD(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 4) + 12));
- FFB_SET_PRIM_COLOR(v3);
-
- FFB_DUMP_VERTEX(v0);
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_DUMP_VERTEX(v3);
- FFB_SET_VERTEX_COLOR(v3);
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void (*TAG(render_tab)[GL_POLYGON + 2])(GLcontext *, GLuint, GLuint, GLuint) =
-{
-#if !(IND & (FFB_TRI_CULL_BIT))
- TAG(ffb_vb_points),
- TAG(ffb_vb_lines),
- TAG(ffb_vb_line_loop),
- TAG(ffb_vb_line_strip),
-#else
- NULL,
- NULL,
- NULL,
- NULL,
-#endif
- TAG(ffb_vb_triangles),
- TAG(ffb_vb_tri_strip),
- TAG(ffb_vb_tri_fan),
- TAG(ffb_vb_quads),
- TAG(ffb_vb_quad_strip),
- TAG(ffb_vb_poly),
- ffb_vb_noop,
-};
-
-#undef IND
-#undef TAG
-
-#undef IMPL_LOCAL_VARS
-#undef FFB_DECLARE_CACHED_COLOR
-#undef FFB_COMPUTE_CACHED_COLOR
-#undef FFB_CACHED_COLOR_SAME
-#undef FFB_CACHED_COLOR_SET
-#undef FFB_CACHED_COLOR_UPDATE
-#undef FFB_SET_PRIM_COLOR
-#undef FFB_PRIM_COLOR_COST
-#undef FFB_SET_VERTEX_COLOR
-#undef FFB_VERTEX_COLOR_COST
-#undef RESET_STIPPLE
-#undef FFB_AREA_DECLARE
-#undef FFB_COMPUTE_AREA_TRI
-#undef FFB_COMPUTE_AREA_QUAD
-#undef FFB_CULL_TRI
-#undef FFB_CULL_QUAD
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_span.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_span.c
deleted file mode 100644
index 692794522..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_span.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_span.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define HW_LOCK() \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- if (!fmesa->hw_locked) \
- LOCK_HARDWARE(fmesa);
-
-#define HW_UNLOCK() \
- if (!fmesa->hw_locked) \
- UNLOCK_HARDWARE(fmesa); \
-
-#define LOCAL_VARS \
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
- GLuint height = dPriv->h; \
- GLuint p; \
- char *buf; \
- (void) p
-
-#define INIT_MONO_PIXEL(p, color) \
- p = ((color[0] << 0) | \
- (color[1] << 8) | \
- (color[2] << 16))
-
-/* We use WID clipping, so this test always passes. */
-#define CLIPPIXEL(__x, __y) (1)
-
-/* And also, due to WID clipping, we need not do anything
- * special here.
- */
-#define CLIPSPAN(__x,__y,__n,__x1,__n1,__i) \
- __n1 = __n; \
- __x1 = __x; \
-
-#define HW_CLIPLOOP() \
-do { unsigned int fbc, ppc, cmp; \
- FFBWait(fmesa, fmesa->regs); \
- fbc = fmesa->regs->fbc; ppc = fmesa->regs->ppc; cmp = fmesa->regs->cmp; \
- fmesa->regs->fbc = ((fbc & \
- ~(FFB_FBC_WB_C | FFB_FBC_ZE_MASK | FFB_FBC_RGBE_MASK)) \
- | (FFB_FBC_ZE_OFF | FFB_FBC_RGBE_MASK)); \
- fmesa->regs->ppc = ((ppc & \
- ~(FFB_PPC_XS_MASK | FFB_PPC_ABE_MASK | FFB_PPC_DCE_MASK | \
- FFB_PPC_APE_MASK | FFB_PPC_CS_MASK)) \
- | (FFB_PPC_XS_WID | FFB_PPC_ABE_DISABLE | \
- FFB_PPC_DCE_DISABLE | FFB_PPC_APE_DISABLE | \
- FFB_PPC_CS_VAR)); \
- fmesa->regs->cmp = ((cmp & ~(0xff << 16)) | (0x80 << 16)); \
- fmesa->ffbScreen->rp_active = 1; \
- FFBWait(fmesa, fmesa->regs); \
- buf = (char *)(fmesa->sfb32 + (dPriv->x << 2) + (dPriv->y << 13));\
- if (dPriv->numClipRects) {
-
-#define HW_ENDCLIPLOOP() \
- } \
- fmesa->regs->fbc = fbc; \
- fmesa->regs->ppc = ppc; \
- fmesa->regs->cmp = cmp; \
- fmesa->ffbScreen->rp_active = 1; \
-} while(0)
-
-#define Y_FLIP(__y) (height - __y)
-
-#define READ_RGBA(rgba,__x,__y) \
-do { GLuint p = *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)); \
- rgba[0] = (p >> 0) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 16) & 0xff; \
- rgba[3] = 0xff; \
-} while(0)
-
-#define WRITE_RGBA(__x, __y, __r, __g, __b, __a) \
- *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)) = \
- ((((__r) & 0xff) << 0) | \
- (((__g) & 0xff) << 8) | \
- (((__b) & 0xff) << 16))
-
-#define WRITE_PIXEL(__x, __y, __p) \
- *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)) = (__p)
-
-#define TAG(x) ffb##x##_888
-
-#include <spantmp.h>
-
-void ffbDDInitSpanFuncs(GLcontext *ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
-
- swdd->WriteRGBASpan = ffbWriteRGBASpan_888;
- swdd->WriteRGBSpan = ffbWriteRGBSpan_888;
- swdd->WriteRGBAPixels = ffbWriteRGBAPixels_888;
- swdd->WriteMonoRGBASpan = ffbWriteMonoRGBASpan_888;
- swdd->WriteMonoRGBAPixels = ffbWriteMonoRGBAPixels_888;
- swdd->ReadRGBASpan = ffbReadRGBASpan_888;
- swdd->ReadRGBAPixels = ffbReadRGBAPixels_888;
-
- /* We don't support color index mode yet, but it will be
- * very easy to do. -DaveM
- */
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_span.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_span.h
deleted file mode 100644
index 00501e823..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_span.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_span.h,v 1.1 2000/06/20 05:08:39 dawes Exp $ */
-
-#ifndef _FFB_SPAN_H
-#define _FFB_SPAN_H
-
-extern void ffbDDInitSpanFuncs(GLcontext *ctx);
-
-#endif /* !(_FFB_SPAN_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c
deleted file mode 100644
index ba9bab988..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_state.c,v 1.5 2002/10/30 12:51:27 alanh Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "colormac.h"
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_state.h"
-#include "ffb_lock.h"
-#include "extensions.h"
-#include "enums.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-#undef STATE_TRACE
-
-static unsigned int ffbComputeAlphaFunc(GLcontext *ctx)
-{
- unsigned int xclip;
- GLubyte alphaRef;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDAlphaFunc: func(%s) ref(%02x)\n",
- _mesa_lookup_enum_by_nr(ctx->Color.AlphaFunc),
- ctx->Color.AlphaRef & 0xff);
-#endif
-
- switch (ctx->Color.AlphaFunc) {
- case GL_NEVER: xclip = FFB_XCLIP_TEST_NEVER; break;
- case GL_LESS: xclip = FFB_XCLIP_TEST_LT; break;
- case GL_EQUAL: xclip = FFB_XCLIP_TEST_EQ; break;
- case GL_LEQUAL: xclip = FFB_XCLIP_TEST_LE; break;
- case GL_GREATER: xclip = FFB_XCLIP_TEST_GT; break;
- case GL_NOTEQUAL: xclip = FFB_XCLIP_TEST_NE; break;
- case GL_GEQUAL: xclip = FFB_XCLIP_TEST_GE; break;
- case GL_ALWAYS: xclip = FFB_XCLIP_TEST_ALWAYS; break;
-
- default:
- return FFB_XCLIP_TEST_ALWAYS | 0x00;
- }
-
- CLAMPED_FLOAT_TO_UBYTE(alphaRef, ctx->Color.AlphaRef);
- xclip |= (alphaRef & 0xff);
-
- return xclip;
-}
-
-static void ffbDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (ctx->Color.AlphaEnabled) {
- unsigned int xclip = ffbComputeAlphaFunc(ctx);
-
- if (fmesa->xclip != xclip) {
- fmesa->xclip = xclip;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_XCLIP, 1);
- }
- }
-}
-
-static void ffbDDBlendEquation(GLcontext *ctx, GLenum mode)
-{
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendEquation: mode(%s)\n", _mesa_lookup_enum_by_nr(mode));
-#endif
- FALLBACK( ctx, (mode != GL_FUNC_ADD_EXT), FFB_BADATTR_BLENDEQN);
-}
-
-static void ffbDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int blendc = 1 << 4;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendFunc: sfactor(%s) dfactor(%s)\n",
- _mesa_lookup_enum_by_nr(sfactor), _mesa_lookup_enum_by_nr(dfactor));
-#endif
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO:
- blendc |= (0 << 0);
- break;
-
- case GL_ONE:
- blendc |= (1 << 0);
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- blendc |= (2 << 0);
- break;
-
- case GL_SRC_ALPHA:
- blendc |= (3 << 0);
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- FALLBACK( ctx, FFB_BADATTR_BLENDFUNC, GL_TRUE );
- return;
- };
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_ZERO:
- blendc |= (0 << 2);
- break;
-
- case GL_ONE:
- blendc |= (1 << 2);
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- blendc |= (2 << 2);
- break;
-
- case GL_SRC_ALPHA:
- blendc |= (3 << 2);
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- FALLBACK( ctx, FFB_BADATTR_BLENDFUNC, GL_TRUE );
- return;
- };
-
- if (ctx->Color.BlendEnabled &&
- ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY) {
- /* We could avoid this if sfactor is GL_ONE and
- * dfactor is GL_ZERO. I do not think that is even
- * worthwhile to check because if someone is using
- * blending they use more interesting settings and
- * also it would add more state tracking to a lot
- * of the code in this file.
- */
- FALLBACK(ctx, FFB_BADATTR_BLENDROP, GL_TRUE);
- return;
- }
-
- FALLBACK( ctx, (FFB_BADATTR_BLENDFUNC|FFB_BADATTR_BLENDROP), GL_FALSE );
-
- if (blendc != fmesa->blendc) {
- fmesa->blendc = blendc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_BLEND, 1);
- }
-}
-
-static void ffbDDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA)
-{
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendFuncSeparate: sRGB(%s) dRGB(%s) sA(%s) dA(%s)\n",
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-#endif
-
- ffbDDBlendFunc(ctx, sfactorRGB, dfactorRGB);
-}
-
-static void ffbDDDepthFunc(GLcontext *ctx, GLenum func)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint cmp;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDepthFunc: func(%s)\n",
- _mesa_lookup_enum_by_nr(func));
-#endif
-
- switch (func) {
- case GL_NEVER:
- cmp = FFB_CMP_MAGN_NEVER;
- break;
- case GL_ALWAYS:
- cmp = FFB_CMP_MAGN_ALWAYS;
- break;
- case GL_LESS:
- cmp = FFB_CMP_MAGN_LT;
- break;
- case GL_LEQUAL:
- cmp = FFB_CMP_MAGN_LE;
- break;
- case GL_EQUAL:
- cmp = FFB_CMP_MAGN_EQ;
- break;
- case GL_GREATER:
- cmp = FFB_CMP_MAGN_GT;
- break;
- case GL_GEQUAL:
- cmp = FFB_CMP_MAGN_GE;
- break;
- case GL_NOTEQUAL:
- cmp = FFB_CMP_MAGN_NE;
- break;
- default:
- return;
- };
-
- if (! ctx->Depth.Test)
- cmp = FFB_CMP_MAGN_ALWAYS;
-
- cmp <<= 16;
- cmp = (fmesa->cmp & ~(0xff<<16)) | cmp;
- if (cmp != fmesa->cmp) {
- fmesa->cmp = cmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_CMP, 1);
- }
-}
-
-static void ffbDDDepthMask(GLcontext *ctx, GLboolean flag)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint fbc = fmesa->fbc;
- GLboolean enabled_now;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDepthMask: flag(%d)\n", flag);
-#endif
-
- if ((fbc & FFB_FBC_ZE_MASK) == FFB_FBC_ZE_OFF)
- enabled_now = GL_FALSE;
- else
- enabled_now = GL_TRUE;
-
- if (flag != enabled_now) {
- fbc &= ~FFB_FBC_ZE_MASK;
- if (flag) {
- fbc |= FFB_FBC_WB_C | FFB_FBC_ZE_ON;
- } else {
- fbc |= FFB_FBC_ZE_OFF;
- fbc &= ~FFB_FBC_WB_C;
- }
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-
-static void ffbDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref, GLuint mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int stencil, stencilctl, consty;
-
- /* We will properly update sw/hw state when stenciling is
- * enabled.
- */
- if (! ctx->Stencil.Enabled)
- return;
-
- stencilctl = fmesa->stencilctl;
- stencilctl &= ~(7 << 16);
-
- switch (func) {
- case GL_ALWAYS: stencilctl |= (0 << 16); break;
- case GL_GREATER: stencilctl |= (1 << 16); break;
- case GL_EQUAL: stencilctl |= (2 << 16); break;
- case GL_GEQUAL: stencilctl |= (3 << 16); break;
- case GL_NEVER: stencilctl |= (4 << 16); break;
- case GL_LEQUAL: stencilctl |= (5 << 16); break;
- case GL_NOTEQUAL: stencilctl |= (6 << 16); break;
- case GL_LESS: stencilctl |= (7 << 16); break;
-
- default:
- return;
- };
-
- consty = ref & 0xf;
-
- stencil = fmesa->stencil;
- stencil &= ~(0xf << 20);
- stencil |= (mask & 0xf) << 20;
-
- if (fmesa->stencil != stencil ||
- fmesa->stencilctl != stencilctl ||
- fmesa->consty != consty) {
- fmesa->stencil = stencil;
- fmesa->stencilctl = stencilctl;
- fmesa->consty = consty;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- }
-}
-
-static void ffbDDStencilMask(GLcontext *ctx, GLuint mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- mask &= 0xf;
- if (fmesa->ypmask != mask) {
- fmesa->ypmask = mask;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_YPMASK, 1);
- }
-}
-
-static void ffbDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int stencilctl;
-
- /* We will properly update sw/hw state when stenciling is
- * enabled.
- */
- if (! ctx->Stencil.Enabled)
- return;
-
- stencilctl = fmesa->stencilctl;
- stencilctl &= ~(0xfff00000);
-
- switch (fail) {
- case GL_ZERO: stencilctl |= (0 << 28); break;
- case GL_KEEP: stencilctl |= (1 << 28); break;
- case GL_INVERT: stencilctl |= (2 << 28); break;
- case GL_REPLACE: stencilctl |= (3 << 28); break;
- case GL_INCR: stencilctl |= (4 << 28); break;
- case GL_DECR: stencilctl |= (5 << 28); break;
-
- default:
- return;
- };
-
- switch (zfail) {
- case GL_ZERO: stencilctl |= (0 << 24); break;
- case GL_KEEP: stencilctl |= (1 << 24); break;
- case GL_INVERT: stencilctl |= (2 << 24); break;
- case GL_REPLACE: stencilctl |= (3 << 24); break;
- case GL_INCR: stencilctl |= (4 << 24); break;
- case GL_DECR: stencilctl |= (5 << 24); break;
-
- default:
- return;
- };
-
- switch (zpass) {
- case GL_ZERO: stencilctl |= (0 << 20); break;
- case GL_KEEP: stencilctl |= (1 << 20); break;
- case GL_INVERT: stencilctl |= (2 << 20); break;
- case GL_REPLACE: stencilctl |= (3 << 20); break;
- case GL_INCR: stencilctl |= (4 << 20); break;
- case GL_DECR: stencilctl |= (5 << 20); break;
-
- default:
- return;
- };
-
- if (fmesa->stencilctl != stencilctl) {
- fmesa->stencilctl = stencilctl;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- }
-}
-
-static void ffbCalcViewportRegs(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- GLuint xmin, xmax, ymin, ymax, zmin, zmax;
- unsigned int vcmin, vcmax;
-
- xmin = ctx->Viewport.X + dPriv->x;
- xmax = xmin + ctx->Viewport.Width;
- ymax = dPriv->y + dPriv->h - ctx->Viewport.Y;
- ymin = ymax - ctx->Viewport.Height;
- if (ctx->Scissor.Enabled) {
- GLuint sc_xmin, sc_xmax, sc_ymin, sc_ymax;
-
- sc_xmin = ctx->Viewport.X + dPriv->x;
- sc_xmax = sc_xmin + ctx->Viewport.Width;
- sc_ymax = dPriv->y + dPriv->h - ctx->Viewport.Y;
- sc_ymin = sc_ymax - ctx->Viewport.Height;
- if (sc_xmin > xmin)
- xmin = sc_xmin;
- if (sc_xmax < xmax)
- xmax = sc_xmax;
- if (sc_ymin > ymin)
- ymin = sc_ymin;
- if (sc_ymax < ymax)
- ymax = sc_ymax;
- }
- zmin = ((GLdouble)ctx->Viewport.Near * 0x0fffffff);
- zmax = ((GLdouble)ctx->Viewport.Far * 0x0fffffff);
-
- vcmin = ((ymin & 0xffff) << 16) | (xmin & 0xffff);
- vcmax = ((ymax & 0xffff) << 16) | (xmax & 0xffff);
- if (fmesa->vclipmin != vcmin ||
- fmesa->vclipmax != vcmax ||
- fmesa->vclipzmin != zmin ||
- fmesa->vclipzmax != zmax) {
- fmesa->vclipmin = vcmin;
- fmesa->vclipmax = vcmax;
- fmesa->vclipzmin = zmin;
- fmesa->vclipzmax = zmax;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_CLIP, (4 + (4 * 2)));
- }
-}
-
-void ffbCalcViewport(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = fmesa->hw_viewport;
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + dPriv->x + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + dPriv->h + dPriv->y + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * ((GLdouble)1.0 / (GLdouble)0x0fffffff);
- m[MAT_TZ] = v[MAT_TZ] * ((GLdouble)1.0 / (GLdouble)0x0fffffff);
-
- fmesa->depth_scale = ((GLdouble)1.0 / (GLdouble)0x0fffffff);
-
- ffbCalcViewportRegs(ctx);
-
- fmesa->setupnewinputs |= VERT_BIT_CLIP;
-}
-
-static void ffbDDViewport(GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDDepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDScissor(GLcontext *ctx, GLint cx, GLint cy,
- GLsizei cw, GLsizei ch)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDDrawBuffer(GLcontext *ctx, GLenum buffer)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int fbc = fmesa->fbc;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDrawBuffer: mode(%s)\n",
- _mesa_lookup_enum_by_nr(buffer));
-#endif
- fbc &= ~(FFB_FBC_WB_AB | FFB_FBC_RB_MASK);
- switch (buffer) {
- case FRONT_LEFT_BIT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
- else
- fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- break;
-
- case BACK_LEFT_BIT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- else
- fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
- break;
-
- case BACK_LEFT_BIT | FRONT_LEFT_BIT:
- fbc |= FFB_FBC_WB_AB;
- break;
-
- default:
- return;
- };
-
- if (fbc != fmesa->fbc) {
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-
-
-static void ffbDDReadBuffer(GLcontext *ctx, GLenum buffer)
-{
- /* no-op, unless you implement h/w glRead/CopyPixels */
-}
-
-
-/*
- * Specifies buffer for sw fallbacks (spans)
- */
-static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int fbc = fmesa->fbc;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDSetReadBuffer: mode(%s)\n",
- _mesa_lookup_enum_by_nr(buffer));
-#endif
- fbc &= ~(FFB_FBC_RB_MASK);
- switch (bufferBit) {
- case FRONT_LEFT_BIT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_RB_B;
- else
- fbc |= FFB_FBC_RB_A;
- break;
-
- case BACK_LEFT_BIT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_RB_A;
- else
- fbc |= FFB_FBC_RB_B;
- break;
-
- default:
- return;
- };
-
- if (fbc != fmesa->fbc) {
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-
-static void ffbDDClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
-
- fmesa->clear_pixel = ((c[0] << 0) |
- (c[1] << 8) |
- (c[2] << 16));
-}
-
-static void ffbDDClearDepth(GLcontext *ctx, GLclampd depth)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- fmesa->clear_depth = Z_FROM_MESA(depth * 4294967295.0f);
-}
-
-static void ffbDDClearStencil(GLcontext *ctx, GLint stencil)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- fmesa->clear_stencil = stencil & 0xf;
-}
-
-/* XXX Actually, should I be using FBC controls for this? -DaveM */
-static void ffbDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int new_pmask = 0x0;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDColorMask: r(%d) g(%d) b(%d) a(%d)\n",
- r, g, b, a);
-#endif
- if (r)
- new_pmask |= 0x000000ff;
- if (g)
- new_pmask |= 0x0000ff00;
- if (b)
- new_pmask |= 0x00ff0000;
-
- if (fmesa->pmask != new_pmask) {
- fmesa->pmask = new_pmask;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_PMASK, 1);
- }
-}
-
-static void ffbDDLogicOp(GLcontext *ctx, GLenum op)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int rop;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDLogicOp: op(%s)\n",
- _mesa_lookup_enum_by_nr(op));
-#endif
- switch (op) {
- case GL_CLEAR: rop = FFB_ROP_ZERO; break;
- case GL_SET: rop = FFB_ROP_ONES; break;
- case GL_COPY: rop = FFB_ROP_NEW; break;
- case GL_AND: rop = FFB_ROP_NEW_AND_OLD; break;
- case GL_NAND: rop = FFB_ROP_NEW_AND_NOLD; break;
- case GL_OR: rop = FFB_ROP_NEW_OR_OLD; break;
- case GL_NOR: rop = FFB_ROP_NEW_OR_NOLD; break;
- case GL_XOR: rop = FFB_ROP_NEW_XOR_OLD; break;
- case GL_NOOP: rop = FFB_ROP_OLD; break;
- case GL_COPY_INVERTED: rop = FFB_ROP_NNEW; break;
- case GL_INVERT: rop = FFB_ROP_NOLD; break;
- case GL_EQUIV: rop = FFB_ROP_NNEW_XOR_NOLD; break;
- case GL_AND_REVERSE: rop = FFB_ROP_NEW_AND_NOLD; break;
- case GL_AND_INVERTED: rop = FFB_ROP_NNEW_AND_OLD; break;
- case GL_OR_REVERSE: rop = FFB_ROP_NEW_OR_NOLD; break;
- case GL_OR_INVERTED: rop = FFB_ROP_NNEW_OR_OLD; break;
-
- default:
- return;
- };
-
- rop |= fmesa->rop & ~0xff;
- if (rop != fmesa->rop) {
- fmesa->rop = rop;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_ROP, 1);
-
- if (op == GL_COPY)
- FALLBACK( ctx, FFB_BADATTR_BLENDROP, GL_FALSE );
- }
-}
-
-#if 0
-/* XXX Also need to track near/far just like 3dfx driver.
- * XXX
- * XXX Actually, that won't work, because the 3dfx chip works by
- * XXX having 1/w coordinates fed to it for each primitive, and
- * XXX it uses this to index it's 64 entry fog table.
- */
-static void ffb_fog_linear(GLcontext *ctx, ffbContextPtr fmesa)
-{
- GLfloat c = ctx->ProjectionMatrix.m[10];
- GLfloat d = ctx->ProjectionMatrix.m[14];
- GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ];
- GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ];
- GLfloat fogEnd = ctx->Fog.End;
- GLfloat fogScale = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- GLfloat ndcz;
- GLfloat eyez;
- GLfloat Zzero, Zone;
- unsigned int zb, zf;
-
- /* Compute the Z at which f reaches 0.0, this is the full
- * saturation point.
- *
- * Thus compute Z (as seen by the chip during rendering),
- * such that:
- *
- * 0.0 = (fogEnd - eyez) * fogScale
- *
- * fogScale is usually not zero, thus we are looking for:
- *
- * fogEnd = eyez
- *
- * fogEnd = -d / (c + ((Z - tz) * szInv))
- * fogEnd * (c + ((Z - tz) * szInv)) = -d
- * (c + ((Z - tz) * szInv)) = -d / fogEnd
- * (Z - tz) * szInv = (-d / fogEnd) - c
- * (Z - tz) = ((-d / fogEnd) - c) / szInv
- * Z = (((-d / fogEnd) - c) / szInv) + tz
- */
- Zzero = (((-d / fogEnd) - c) / szInv) + tz;
-
- /* Compute the Z at which f reaches 1.0, this is where
- * the incoming frag's full intensity is shown. This
- * equation is:
- *
- * 1.0 = (fogEnd - eyez)
- *
- * We are looking for:
- *
- * 1.0 + eyez = fogEnd
- *
- * 1.0 + (-d / (c + ((Z - tz) * szInv))) = fogEnd
- * -d / (c + ((Z - tz) * szInv)) = fogEnd - 1.0
- * -d / (FogEnd - 1.0) = (c + ((Z - tz) * szInv))
- * (-d / (fogEnd - 1.0)) - c = ((Z - tz) * szInv)
- * ((-d / (fogEnd - 1.0)) - c) / szInv = (Z - tz)
- * (((-d / (fogEnd - 1.0)) - c) / szInv) + tz = Z
- */
- Zone = (((-d / (fogEnd - 1.0)) - c) / szInv) + tz;
-
- /* FFB's Zfront must be less than Zback, thus we may have
- * to invert Sf/Sb to satisfy this constraint.
- */
- if (Zzero < Zone) {
- sf = 0.0;
- sb = 1.0;
- zf = Z_FROM_MESA(Zzero);
- zb = Z_FROM_MESA(Zone);
- } else {
- sf = 1.0;
- sb = 0.0;
- zf = Z_FROM_MESA(Zone);
- zb = Z_FROM_MESA(Zzero);
- }
-}
-#endif
-
-static void ffbDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDFogfv: pname(%s)\n", _mesa_lookup_enum_by_nr(pname));
-#endif
-}
-
-static void ffbDDLineStipple(GLcontext *ctx, GLint factor, GLushort pattern)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDLineStipple: factor(%d) pattern(%04x)\n",
- factor, pattern);
-#endif
- if (ctx->Line.StippleFlag) {
- factor = ctx->Line.StippleFactor;
- pattern = ctx->Line.StipplePattern;
- if ((GLuint) factor > 15) {
- fmesa->lpat = FFB_LPAT_BAD;
- } else {
- fmesa->lpat = ((factor << FFB_LPAT_SCALEVAL_SHIFT) |
- (0 << FFB_LPAT_PATLEN_SHIFT) |
- ((pattern & 0xffff) << FFB_LPAT_PATTERN_SHIFT));
- }
- } else {
- fmesa->lpat = 0;
- }
-}
-
-void ffbXformAreaPattern(ffbContextPtr fmesa, const GLubyte *mask)
-{
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- int i, lines, xoff;
-
- lines = 0;
- i = (dPriv->y + dPriv->h) & (32 - 1);
- xoff = dPriv->x & (32 - 1);
- while (lines++ < 32) {
- GLuint raw =
- (((GLuint)mask[0] << 24) |
- ((GLuint)mask[1] << 16) |
- ((GLuint)mask[2] << 8) |
- ((GLuint)mask[3] << 0));
-
- fmesa->pattern[i] =
- (raw << xoff) | (raw >> (32 - xoff));
- i = (i - 1) & (32 - 1);
- mask += 4;
- }
-
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_APAT, 32);
-}
-
-static void ffbDDPolygonStipple(GLcontext *ctx, const GLubyte *mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDPolygonStipple: state(%d)\n",
- ctx->Polygon.StippleFlag);
-#endif
- ffbXformAreaPattern(fmesa, mask);
-}
-
-static void ffbDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int tmp;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDEnable: %s state(%d)\n",
- _mesa_lookup_enum_by_nr(cap), state);
-#endif
- switch (cap) {
- case GL_ALPHA_TEST:
- if (state)
- tmp = ffbComputeAlphaFunc(ctx);
- else
- tmp = FFB_XCLIP_TEST_ALWAYS;
-
- if (tmp != fmesa->xclip) {
- fmesa->xclip = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_XCLIP, 1);
- }
- break;
-
- case GL_BLEND:
- tmp = (fmesa->ppc & ~FFB_PPC_ABE_MASK);
- if (state) {
- tmp |= FFB_PPC_ABE_ENABLE;
- } else {
- tmp |= FFB_PPC_ABE_DISABLE;
- }
- if (fmesa->ppc != tmp) {
- fmesa->ppc = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_PPC, 1);
- ffbDDBlendFunc(ctx, 0, 0);
- }
- break;
-
- case GL_DEPTH_TEST:
- if (state)
- tmp = 0x0fffffff;
- else
- tmp = 0x00000000;
- if (tmp != fmesa->magnc) {
- unsigned int fbc = fmesa->fbc;
- fbc &= ~FFB_FBC_ZE_MASK;
- if (state)
- fbc |= FFB_FBC_ZE_ON;
- else
- fbc |= FFB_FBC_ZE_OFF;
- fmesa->fbc = fbc;
- ffbDDDepthFunc(ctx, ctx->Depth.Func);
- fmesa->magnc = tmp;
- FFB_MAKE_DIRTY(fmesa, (FFB_STATE_MAGNC | FFB_STATE_FBC), 2);
- }
- break;
-
- case GL_SCISSOR_TEST:
- ffbDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height);
- break;
-
- case GL_STENCIL_TEST:
- if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)) {
- FALLBACK( ctx, FFB_BADATTR_STENCIL, state );
- }
-
- tmp = fmesa->fbc & ~FFB_FBC_YE_MASK;
- if (state) {
- ffbDDStencilFunc(ctx,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0]);
- ffbDDStencilMask(ctx, ctx->Stencil.WriteMask[0]);
- ffbDDStencilOp(ctx,
- ctx->Stencil.FailFunc[0],
- ctx->Stencil.ZFailFunc[0],
- ctx->Stencil.ZPassFunc[0]);
- tmp |= FFB_FBC_YE_MASK;
- } else {
- fmesa->stencil = 0xf0000000;
- fmesa->stencilctl = 0x33300000;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- tmp |= FFB_FBC_YE_OFF;
- }
- if (tmp != fmesa->fbc) {
- fmesa->fbc = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
- break;
-
- case GL_FOG:
- /* Until I implement the fog support... */
- FALLBACK( ctx, FFB_BADATTR_FOG, state );
- break;
-
- case GL_LINE_STIPPLE:
- if (! state)
- fmesa->lpat = 0;
- else
- ffbDDLineStipple(ctx,
- ctx->Line.StippleFactor,
- ctx->Line.StipplePattern);
- break;
-
- case GL_POLYGON_STIPPLE:
- /* Do nothing, we interrogate the state during
- * reduced primitive changes. Since our caller
- * will set NEW_POLYGON in the ctx NewState this
- * will cause the driver rasterization functions
- * to be reevaluated, which will cause us to force
- * a reduced primitive change next rendering pass
- * and it all works out.
- */
- break;
-
- default:
- break;
- };
-}
-
-void ffbSyncHardware(ffbContextPtr fmesa)
-{
- ffb_fbcPtr ffb = fmesa->regs;
- unsigned int dirty;
- int i;
-
- FFBFifo(fmesa, fmesa->state_fifo_ents);
-
- dirty = fmesa->state_dirty;
- if (dirty & (FFB_STATE_FBC | FFB_STATE_PPC | FFB_STATE_DRAWOP |
- FFB_STATE_ROP | FFB_STATE_LPAT | FFB_STATE_WID)) {
- if (dirty & FFB_STATE_FBC)
- ffb->fbc = fmesa->fbc;
- if (dirty & FFB_STATE_PPC)
- ffb->ppc = fmesa->ppc;
- if (dirty & FFB_STATE_DRAWOP)
- ffb->drawop = fmesa->drawop;
- if (dirty & FFB_STATE_ROP)
- ffb->rop = fmesa->rop;
- if (dirty & FFB_STATE_LPAT)
- ffb->rop = fmesa->lpat;
- if (dirty & FFB_STATE_WID)
- ffb->wid = fmesa->wid;
- }
- if (dirty & (FFB_STATE_PMASK | FFB_STATE_XPMASK | FFB_STATE_YPMASK |
- FFB_STATE_ZPMASK | FFB_STATE_XCLIP | FFB_STATE_CMP |
- FFB_STATE_MATCHAB | FFB_STATE_MAGNAB | FFB_STATE_MATCHC |
- FFB_STATE_MAGNC)) {
- if (dirty & FFB_STATE_PMASK)
- ffb->pmask = fmesa->pmask;
- if (dirty & FFB_STATE_XPMASK)
- ffb->xpmask = fmesa->xpmask;
- if (dirty & FFB_STATE_YPMASK)
- ffb->ypmask = fmesa->ypmask;
- if (dirty & FFB_STATE_ZPMASK)
- ffb->zpmask = fmesa->zpmask;
- if (dirty & FFB_STATE_XCLIP)
- ffb->xclip = fmesa->xclip;
- if (dirty & FFB_STATE_CMP)
- ffb->cmp = fmesa->cmp;
- if (dirty & FFB_STATE_MATCHAB)
- ffb->matchab = fmesa->matchab;
- if (dirty & FFB_STATE_MAGNAB)
- ffb->magnab = fmesa->magnab;
- if (dirty & FFB_STATE_MATCHC)
- ffb->matchc = fmesa->matchc;
- if (dirty & FFB_STATE_MAGNC)
- ffb->magnc = fmesa->magnc;
- }
-
- if (dirty & FFB_STATE_DCUE) {
- ffb->dcss = fmesa->dcss;
- ffb->dcsf = fmesa->dcsf;
- ffb->dcsb = fmesa->dcsb;
- ffb->dczf = fmesa->dczf;
- ffb->dczb = fmesa->dczb;
- if (fmesa->ffb_sarea->flags & (FFB_DRI_FFB2 | FFB_DRI_FFB2PLUS)) {
- ffb->dcss1 = fmesa->dcss1;
- ffb->dcss2 = fmesa->dcss2;
- ffb->dcss3 = fmesa->dcss3;
- ffb->dcs2 = fmesa->dcs2;
- ffb->dcs3 = fmesa->dcs3;
- ffb->dcs4 = fmesa->dcs4;
- ffb->dcd2 = fmesa->dcd2;
- ffb->dcd3 = fmesa->dcd3;
- ffb->dcd4 = fmesa->dcd4;
- }
- }
-
- if (dirty & FFB_STATE_BLEND) {
- ffb->blendc = fmesa->blendc;
- ffb->blendc1 = fmesa->blendc1;
- ffb->blendc2 = fmesa->blendc2;
- }
-
- if (dirty & FFB_STATE_CLIP) {
- ffb->vclipmin = fmesa->vclipmin;
- ffb->vclipmax = fmesa->vclipmax;
- ffb->vclipzmin = fmesa->vclipzmin;
- ffb->vclipzmax = fmesa->vclipzmax;
- for (i = 0; i < 4; i++) {
- ffb->auxclip[i].min = fmesa->aux_clips[i].min;
- ffb->auxclip[i].max = fmesa->aux_clips[i].max;
- }
- }
-
- if ((dirty & FFB_STATE_STENCIL) &&
- (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)) {
- ffb->stencil = fmesa->stencil;
- ffb->stencilctl = fmesa->stencilctl;
- ffb->fbc = FFB_FBC_WB_C;
- ffb->rawstencilctl = (fmesa->stencilctl | (1 << 19));
- ffb->fbc = fmesa->fbc;
- ffb->consty = fmesa->consty;
- }
-
- if (dirty & FFB_STATE_APAT) {
- for (i = 0; i < 32; i++)
- ffb->pattern[i] = fmesa->pattern[i];
- }
-
- fmesa->state_dirty = 0;
- fmesa->state_fifo_ents = 0;
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void ffbDDUpdateState(GLcontext *ctx, GLuint newstate)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- /* When we are hw rendering, changing certain kinds of
- * state does not require flushing all of our context.
- */
- if (fmesa->bad_fragment_attrs == 0 &&
- (newstate & ~_NEW_COLOR) == 0)
- return;
-
- _swrast_InvalidateState( ctx, newstate );
- _swsetup_InvalidateState( ctx, newstate );
- _ac_InvalidateState( ctx, newstate );
- _tnl_InvalidateState( ctx, newstate );
-
- if (newstate & _NEW_TEXTURE)
- FALLBACK( ctx, FFB_BADATTR_TEXTURE,
- (ctx->Texture._EnabledUnits != 0));
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDUpdateState: newstate(%08x)\n", newstate);
-#endif
-
- fmesa->new_gl_state |= newstate;
-
- /* Force a reduced primitive change next rendering
- * pass.
- */
- fmesa->raster_primitive = GL_POLYGON + 1;
-
-#if 0
- /* When the modelview matrix changes, this changes what
- * the eye coordinates will be so we have to recompute
- * the depth cueing parameters.
- *
- * XXX DD_HAVE_HARDWARE_FOG.
- */
- if (ctx->Fog.Enabled && (newstate & _NEW_MODELVIEW))
- ffb_update_fog();
-#endif
-}
-
-
-void ffbDDInitStateFuncs(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- ctx->Driver.UpdateState = ffbDDUpdateState;
-
- ctx->Driver.Enable = ffbDDEnable;
- ctx->Driver.LightModelfv = NULL;
- ctx->Driver.AlphaFunc = ffbDDAlphaFunc;
- ctx->Driver.BlendEquation = ffbDDBlendEquation;
- ctx->Driver.BlendFunc = ffbDDBlendFunc;
- ctx->Driver.BlendFuncSeparate = ffbDDBlendFuncSeparate;
- ctx->Driver.DepthFunc = ffbDDDepthFunc;
- ctx->Driver.DepthMask = ffbDDDepthMask;
- ctx->Driver.Fogfv = ffbDDFogfv;
- ctx->Driver.LineStipple = ffbDDLineStipple;
- ctx->Driver.PolygonStipple = ffbDDPolygonStipple;
- ctx->Driver.Scissor = ffbDDScissor;
- ctx->Driver.CullFace = NULL;
- ctx->Driver.FrontFace = NULL;
- ctx->Driver.ColorMask = ffbDDColorMask;
- ctx->Driver.LogicOpcode = ffbDDLogicOp;
- ctx->Driver.Viewport = ffbDDViewport;
- ctx->Driver.DepthRange = ffbDDDepthRange;
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS) {
- ctx->Driver.StencilFunc = ffbDDStencilFunc;
- ctx->Driver.StencilMask = ffbDDStencilMask;
- ctx->Driver.StencilOp = ffbDDStencilOp;
- } else {
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
- }
-
- ctx->Driver.DrawBuffer = ffbDDDrawBuffer;
- ctx->Driver.ReadBuffer = ffbDDReadBuffer;
- ctx->Driver.ClearColor = ffbDDClearColor;
- ctx->Driver.ClearDepth = ffbDDClearDepth;
- ctx->Driver.ClearStencil = ffbDDClearStencil;
-
- /* We will support color index modes later... -DaveM */
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
-
-
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- {
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
- swdd->SetBuffer = ffbDDSetBuffer;
- }
-
-
-}
-
-void ffbDDInitContextHwState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- int fifo_count = 0;
- int i;
-
- fmesa->hw_locked = 0;
-
- fmesa->bad_fragment_attrs = 0;
- fmesa->state_dirty = FFB_STATE_ALL;
- fmesa->new_gl_state = ~0;
-
- fifo_count = 1;
- fmesa->fbc = (FFB_FBC_WE_FORCEON | FFB_FBC_WM_COMBINED |
- FFB_FBC_SB_BOTH | FFB_FBC_ZE_MASK |
- FFB_FBC_YE_OFF | FFB_FBC_XE_OFF |
- FFB_FBC_RGBE_MASK);
- if (ctx->Visual.doubleBufferMode) {
- /* Buffer B is the initial back buffer. */
- fmesa->back_buffer = 1;
- fmesa->fbc |= FFB_FBC_WB_BC | FFB_FBC_RB_B;
- } else {
- fmesa->back_buffer = 0;
- fmesa->fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- }
-
- fifo_count += 1;
- fmesa->ppc = (FFB_PPC_ACE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_ABE_DISABLE | FFB_PPC_VCE_3D |
- FFB_PPC_APE_DISABLE | FFB_PPC_TBE_OPAQUE |
- FFB_PPC_ZS_CONST | FFB_PPC_YS_CONST |
- FFB_PPC_XS_WID | FFB_PPC_CS_VAR);
-
- fifo_count += 3;
- fmesa->drawop = FFB_DRAWOP_RECTANGLE;
-
- /* GL_COPY is the default LogicOp. */
- fmesa->rop = (FFB_ROP_NEW << 16) | (FFB_ROP_NEW << 8) | FFB_ROP_NEW;
-
- /* No line patterning enabled. */
- fmesa->lpat = 0x00000000;
-
- /* We do not know the WID value until the first context switch. */
- fifo_count += 1;
- fmesa->wid = ~0;
-
- fifo_count += 5;
-
- /* ColorMask, all enabled. */
- fmesa->pmask = 0xffffffff;
-
- fmesa->xpmask = 0x000000ff;
- fmesa->ypmask = 0x0000000f;
- fmesa->zpmask = 0x0fffffff;
-
- /* AlphaFunc GL_ALWAYS, AlphaRef 0 */
- fmesa->xclip = FFB_XCLIP_TEST_ALWAYS | 0x00;
-
- /* This sets us up to use WID clipping (so the DRI clipping
- * rectangle is unneeded by us). All other match and magnitude
- * tests are set to pass.
- */
- fifo_count += 5;
- fmesa->cmp = ((FFB_CMP_MATCH_ALWAYS << 24) | /* MATCH C */
- (FFB_CMP_MAGN_ALWAYS << 16) | /* MAGN C */
- (FFB_CMP_MATCH_EQ << 8) | /* MATCH AB */
- (FFB_CMP_MAGN_ALWAYS << 0)); /* MAGN AB */
- fmesa->matchab = 0xff000000;
- fmesa->magnab = 0x00000000;
- fmesa->matchc = 0x00000000;
- fmesa->magnc = 0x00000000;
-
- /* Depth cue parameters, all zeros to start. */
- fifo_count += 14;
- fmesa->dcss = 0x00000000;
- fmesa->dcsf = 0x00000000;
- fmesa->dcsb = 0x00000000;
- fmesa->dczf = 0x00000000;
- fmesa->dczb = 0x00000000;
- fmesa->dcss1 = 0x00000000;
- fmesa->dcss2 = 0x00000000;
- fmesa->dcss3 = 0x00000000;
- fmesa->dcs2 = 0x00000000;
- fmesa->dcs3 = 0x00000000;
- fmesa->dcs4 = 0x00000000;
- fmesa->dcd2 = 0x00000000;
- fmesa->dcd3 = 0x00000000;
- fmesa->dcd4 = 0x00000000;
-
- /* Alpha blending unit state. */
- fifo_count += 3;
- fmesa->blendc = (1 << 0) | (0 << 2); /* src(GL_ONE) | dst(GL_ZERO) */
- fmesa->blendc1 = 0x00000000;
- fmesa->blendc2 = 0x00000000;
-
- /* ViewPort clip state. */
- fifo_count += 4 + (4 * 2);
- fmesa->vclipmin = 0x00000000;
- fmesa->vclipmax = 0xffffffff;
- fmesa->vclipzmin = 0x00000000;
- fmesa->vclipzmax = 0x0fffffff;
- for (i = 0; i < 4; i++) {
- fmesa->aux_clips[0].min = 0x00000000;
- fmesa->aux_clips[0].max = 0x00000000;
- }
-
- /* Stenciling state. */
- fifo_count += 6;
- fmesa->stencil = 0xf0000000; /* Stencil MASK, Y plane */
- fmesa->stencilctl = 0x33300000; /* All stencil tests disabled */
- fmesa->consty = 0x0;
-
- /* Area pattern, used for polygon stipples. */
- fifo_count += 32;
- for (i = 0; i < 32; i++)
- fmesa->pattern[i] = 0x00000000;
-
- fmesa->state_fifo_ents = fifo_count;
- fmesa->state_all_fifo_ents = fifo_count;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_state.h
deleted file mode 100644
index 17b6fa20a..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_state.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_STATE_H
-#define _FFB_STATE_H
-
-extern void ffbDDInitStateFuncs(GLcontext *);
-extern void ffbDDInitContextHwState(GLcontext *);
-
-extern void ffbCalcViewport(GLcontext *);
-extern void ffbXformAreaPattern(ffbContextPtr, const GLubyte *);
-extern void ffbSyncHardware(ffbContextPtr fmesa);
-
-#endif /* !(_FFB_STATE_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c
deleted file mode 100644
index a00eb3602..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_stencil.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.h"
-
-#undef STENCIL_TRACE
-
-static void
-FFBWriteStencilSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLstencil stencil[], const GLubyte mask[])
-{
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBWriteStencilSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_OFF |
- FFB_FBC_YE_ON | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_YS_VAR;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- if (mask[i])
- *zptr = (stencil[i] & 0xf) << 28;
- zptr++;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void
-FFBWriteStencilPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[],
- const GLstencil stencil[], const GLubyte mask[])
-{
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBWriteStencilPixels: n(%d)\n", (int) n);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_OFF |
- FFB_FBC_YE_ON | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_YS_VAR;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- if (mask[i])
- *zptr = (stencil[i] & 0xf) << 28;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void
-FFBReadStencilSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBReadStencilSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- stencil[i] = (*zptr >> 28) & 0xf;
- zptr++;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void
-FFBReadStencilPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[],
- GLstencil stencil[])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBReadStencilPixels: n(%d)\n", (int) n);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- stencil[i] = (*zptr >> 28) & 0xf;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDInitStencilFuncs(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS) {
- swdd->WriteStencilSpan = FFBWriteStencilSpan;
- swdd->ReadStencilSpan = FFBReadStencilSpan;
- swdd->WriteStencilPixels = FFBWriteStencilPixels;
- swdd->ReadStencilPixels = FFBReadStencilPixels;
- } else {
- swdd->WriteStencilSpan = NULL;
- swdd->ReadStencilSpan = NULL;
- swdd->WriteStencilPixels = NULL;
- swdd->ReadStencilPixels = NULL;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h
deleted file mode 100644
index af161e7c1..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h,v 1.1 2000/06/20 05:08:39 dawes Exp $ */
-
-#ifndef _FFB_STENCIL_H
-#define _FFB_STENCIL_H
-
-extern void ffbDDInitStencilFuncs(GLcontext *ctx);
-
-#endif /* !(_FFB_STENCIL_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c
deleted file mode 100644
index ba1103e2e..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include <GL/gl.h>
-#include "texformat.h"
-#include "texstore.h"
-#include "swrast/swrast.h"
-
-#include "ffb_tex.h"
-
-/* No texture unit, all software. */
-void ffbDDInitTexFuncs(GLcontext *ctx)
-{
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h
deleted file mode 100644
index dba0e08af..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D.
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#ifndef _FFB_TEX_H
-#define _FFB_TEX_H
-
-extern void ffbDDInitTexFuncs(GLcontext *ctx);
-
-#endif /* !(_FFB_DD_H) */
-
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c
deleted file mode 100644
index 63113f09c..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c
+++ /dev/null
@@ -1,946 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c,v 1.3 2002/10/30 12:51:28 alanh Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "mmath.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/s_context.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "ffb_context.h"
-#include "ffb_tris.h"
-#include "ffb_lines.h"
-#include "ffb_lock.h"
-#include "ffb_points.h"
-#include "ffb_state.h"
-#include "ffb_vb.h"
-
-#undef TRI_DEBUG
-#undef FFB_RENDER_TRACE
-#undef STATE_TRACE
-
-#ifdef TRI_DEBUG
-static void ffb_print_vertex(const ffb_vertex *v)
-{
- fprintf(stderr, "Vertex @(%p): "
- "X[%f] Y[%f] Z[%f]\n",
- v, v->x, v->y, v->z);
- fprintf(stderr, "Vertex @(%p): "
- "A[%f] R[%f] G[%f] B[%f]\n",
- v,
- v->color[0].alpha,
- v->color[0].red,
- v->color[0].green,
- v->color[0].blue);
-}
-#define FFB_DUMP_VERTEX(V) ffb_print_vertex(V)
-#else
-#define FFB_DUMP_VERTEX(V) do { } while(0)
-#endif
-
-#define FFB_ALPHA_BIT 0x01
-#define FFB_FLAT_BIT 0x02
-#define FFB_TRI_CULL_BIT 0x04
-#define MAX_FFB_RENDER_FUNCS 0x08
-
-/***********************************************************************
- * Build low-level triangle/quad rasterize functions *
- ***********************************************************************/
-
-#define FFB_TRI_FLAT_BIT 0x01
-#define FFB_TRI_ALPHA_BIT 0x02
-/*#define FFB_TRI_CULL_BIT 0x04*/
-
-static ffb_tri_func ffb_tri_tab[0x8];
-static ffb_quad_func ffb_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_cull
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_CULL_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_cull_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_cull
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_CULL_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_alpha_cull_flat
-#include "ffb_tritmp.h"
-
-static void init_tri_tab(void)
-{
- ffb_init();
- ffb_init_flat();
- ffb_init_cull();
- ffb_init_cull_flat();
- ffb_init_alpha();
- ffb_init_alpha_flat();
- ffb_init_alpha_cull();
- ffb_init_alpha_cull_flat();
-}
-
-/* Build a SWvertex from a hardware vertex. */
-static void ffb_translate_vertex(GLcontext *ctx, const ffb_vertex *src,
- SWvertex *dst)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLfloat *m = ctx->Viewport._WindowMap.m;
- const GLfloat sx = m[0];
- const GLfloat sy = m[5];
- const GLfloat sz = m[10];
- const GLfloat tx = m[12];
- const GLfloat ty = m[13];
- const GLfloat tz = m[14];
-
- dst->win[0] = sx * src->x + tx;
- dst->win[1] = sy * src->y + ty;
- dst->win[2] = sz * src->z + tz;
- dst->win[3] = 1.0;
-
- dst->color[0] = FFB_UBYTE_FROM_COLOR(src->color[0].red);
- dst->color[1] = FFB_UBYTE_FROM_COLOR(src->color[0].green);
- dst->color[2] = FFB_UBYTE_FROM_COLOR(src->color[0].blue);
- dst->color[3] = FFB_UBYTE_FROM_COLOR(src->color[0].alpha);
-}
-
-/***********************************************************************
- * Build fallback triangle/quad rasterize functions *
- ***********************************************************************/
-
-static void ffb_fallback_triangle(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1, ffb_vertex *v2)
-{
- SWvertex v[3];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
- ffb_translate_vertex(ctx, v2, &v[2]);
-
- _swrast_Triangle(ctx, &v[0], &v[1], &v[2]);
-}
-
-static void ffb_fallback_quad(GLcontext *ctx,
- ffb_vertex *v0, ffb_vertex *v1,
- ffb_vertex *v2, ffb_vertex *v3)
-{
- SWvertex v[4];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
- ffb_translate_vertex(ctx, v2, &v[2]);
- ffb_translate_vertex(ctx, v3, &v[3]);
-
- _swrast_Quad(ctx, &v[0], &v[1], &v[2], &v[3]);
-}
-
-void ffb_fallback_line(GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1)
-{
- SWvertex v[2];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
-
- _swrast_Line(ctx, &v[0], &v[1]);
-}
-
-void ffb_fallback_point(GLcontext *ctx, ffb_vertex *v0)
-{
- SWvertex v[1];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
-
- _swrast_Point(ctx, &v[0]);
-}
-
-/***********************************************************************
- * Rasterization functions for culled tris/quads *
- ***********************************************************************/
-
-static void ffb_nodraw_triangle(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1, ffb_vertex *v2)
-{
- (void) (ctx && v0 && v1 && v2);
-}
-
-static void ffb_nodraw_quad(GLcontext *ctx,
- ffb_vertex *v0, ffb_vertex *v1,
- ffb_vertex *v2, ffb_vertex *v3)
-{
- (void) (ctx && v0 && v1 && v2 && v3);
-}
-
-static void ffb_update_cullsign(GLcontext *ctx)
-{
- GLfloat backface_sign = 1;
-
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace==GL_CCW)
- backface_sign = -1;
- break;
-
- case GL_FRONT:
- if (ctx->Polygon.FrontFace!=GL_CCW)
- backface_sign = -1;
- break;
-
- default:
- break;
- };
-
- FFB_CONTEXT(ctx)->backface_sign = backface_sign;
-}
-
-/***********************************************************************
- * Choose triangle/quad rasterize functions *
- ***********************************************************************/
-
-void ffbChooseTriangleState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- if (flags & DD_TRI_SMOOTH) {
- fmesa->draw_tri = ffb_fallback_triangle;
- fmesa->draw_quad = ffb_fallback_quad;
- return;
- }
-
- if (flags & DD_FLATSHADE)
- ind |= FFB_TRI_FLAT_BIT;
-
- if (ctx->Polygon.CullFlag) {
- if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
- fmesa->draw_tri = ffb_nodraw_triangle;
- fmesa->draw_quad = ffb_nodraw_quad;
- return;
- }
-
- ind |= FFB_TRI_CULL_BIT;
- ffb_update_cullsign(ctx);
- } else
- FFB_CONTEXT(ctx)->backface_sign = 0;
-
- /* If blending or the alpha test is enabled we need to
- * provide alpha components to the chip, else we can
- * do without it and thus feed vertex data to the chip
- * more efficiently.
- */
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= FFB_TRI_ALPHA_BIT;
-
- fmesa->draw_tri = ffb_tri_tab[ind];
- fmesa->draw_quad = ffb_quad_tab[ind];
-}
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-static void ffbRenderPrimitive(GLcontext *ctx, GLenum prim);
-static void ffbRasterPrimitive(GLcontext *ctx, GLenum rprim);
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define FFB_OFFSET_BIT 0x01
-#define FFB_TWOSIDE_BIT 0x02
-#define FFB_UNFILLED_BIT 0x04
-#define FFB_MAX_TRIFUNC 0x08
-
-static struct {
- triangle_func triangle;
- quad_func quad;
-} rast_tab[FFB_MAX_TRIFUNC];
-
-#define DO_OFFSET (IND & FFB_OFFSET_BIT)
-#define DO_UNFILLED (IND & FFB_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & FFB_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_QUAD 1
-#define DO_FULL_QUAD 1
-#define DO_TRI 1
-#define DO_LINE 0
-#define DO_POINTS 0
-
-#define QUAD( a, b, c, d ) fmesa->draw_quad( ctx, a, b, c, d )
-#define TRI( a, b, c ) fmesa->draw_tri( ctx, a, b, c )
-#define LINE( a, b ) fmesa->draw_line( ctx, a, b )
-#define POINT( a ) fmesa->draw_point( ctx, a )
-
-#define HAVE_BACK_COLORS 1
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX ffb_vertex
-#define TAB rast_tab
-
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define DEPTH_SCALE (fmesa->depth_scale)
-#define VERT_X(_v) (_v->x)
-#define VERT_Y(_v) (_v->y)
-#define VERT_Z(_v) (_v->z)
-#define AREA_IS_CCW( a ) (a < fmesa->ffb_zero)
-#define GET_VERTEX(e) (&fmesa->verts[e])
-#define INSANE_VERTICES
-#define VERT_SET_Z(v,val) ((v)->z = (val))
-#define VERT_Z_ADD(v,val) ((v)->z += (val))
-
-#define VERT_COPY_RGBA1( _v ) _v->color[0] = _v->color[1]
-#define VERT_COPY_RGBA( v0, v1 ) v0->color[0] = v1->color[0]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->color[0]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->color[0] = color[idx]
-
-#define LOCAL_VARS(n) \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
- ffb_color color[n]; \
- (void) color; (void) dPriv;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (fmesa->raster_primitive != reduced_prim[x]) \
- ffbRasterPrimitive( ctx, reduced_prim[x] )
-#define RENDER_PRIMITIVE fmesa->render_primitive
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_OFFSET_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_OFFSET_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
-}
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void ffbRenderClippedPolygon(GLcontext *ctx, const GLuint *elts, GLuint n)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = fmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon. */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON](ctx, 0, n, PRIM_BEGIN|PRIM_END);
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive. */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify(ctx, prim);
-}
-
-static void ffbRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line(ctx, ii, jj);
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-static void ffb_vb_noop(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- (void)(ctx && start && count && flags);
-}
-
-#define ELT(x) x
-
-#define IND 0
-#define TAG(x) x
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT)
-#define TAG(x) x##_flat_alpha
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_alpha_tricull
-#include "ffb_rendertmp.h"
-
-#undef ELT
-#define ELT(x) elt[x]
-
-#define IND 0
-#define TAG(x) x##_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT)
-#define TAG(x) x##_flat_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT)
-#define TAG(x) x##_alpha_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT)
-#define TAG(x) x##_flat_alpha_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_alpha_tricull_elt
-#include "ffb_rendertmp.h"
-
-static void *render_tabs[MAX_FFB_RENDER_FUNCS];
-static void *render_tabs_elt[MAX_FFB_RENDER_FUNCS];
-
-static void init_render_tab(void)
-{
- int i;
-
- render_tabs[0] = render_tab;
- render_tabs[FFB_FLAT_BIT] = render_tab_flat;
- render_tabs[FFB_ALPHA_BIT] = render_tab_alpha;
- render_tabs[FFB_FLAT_BIT|FFB_ALPHA_BIT] = render_tab_flat_alpha;
- render_tabs[FFB_TRI_CULL_BIT] = render_tab_tricull;
- render_tabs[FFB_FLAT_BIT|FFB_TRI_CULL_BIT] = render_tab_flat_tricull;
- render_tabs[FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] = render_tab_alpha_tricull;
- render_tabs[FFB_FLAT_BIT|FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] =
- render_tab_flat_alpha_tricull;
-
- render_tabs_elt[0] = render_tab_elt;
- render_tabs_elt[FFB_FLAT_BIT] = render_tab_flat_elt;
- render_tabs_elt[FFB_ALPHA_BIT] = render_tab_alpha_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_ALPHA_BIT] = render_tab_flat_alpha_elt;
- render_tabs_elt[FFB_TRI_CULL_BIT] = render_tab_tricull_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_TRI_CULL_BIT] = render_tab_flat_tricull_elt;
- render_tabs_elt[FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] = render_tab_alpha_tricull_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] =
- render_tab_flat_alpha_tricull_elt;
-
- for (i = 0; i < MAX_FFB_RENDER_FUNCS; i++) {
- render_func *rf = render_tabs[i];
- render_func *rfe = render_tabs_elt[i];
-
- if (i & FFB_TRI_CULL_BIT) {
- int from_idx = (i & ~FFB_TRI_CULL_BIT);
- render_func *rf_from = render_tabs[from_idx];
- render_func *rfe_from = render_tabs_elt[from_idx];
- int j;
-
- for (j = GL_POINTS; j < GL_TRIANGLES; j++) {
- rf[j] = rf_from[j];
- rfe[j] = rfe_from[j];
- }
- }
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#ifdef FFB_RENDER_TRACE
-static void ffbPrintRenderFlags(GLuint index, GLuint render_index)
-{
- fprintf(stderr,
- "ffbChooseRenderState: "
- "index(%s%s%s) "
- "render_index(%s%s%s)\n",
- ((index & FFB_TWOSIDE_BIT) ? "twoside " : ""),
- ((index & FFB_OFFSET_BIT) ? "offset " : ""),
- ((index & FFB_UNFILLED_BIT) ? "unfilled " : ""),
- ((render_index & FFB_FLAT_BIT) ? "flat " : ""),
- ((render_index & FFB_ALPHA_BIT) ? "alpha " : ""),
- ((render_index & FFB_TRI_CULL_BIT) ? "tricull " : ""));
-}
-#endif
-
-void ffbChooseRenderState(GLcontext *ctx)
-{
- GLuint flags = ctx->_TriangleCaps;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint index = 0;
-
- /* Per-primitive fallbacks and the selection of fmesa->draw_* are
- * handled elsewhere.
- */
- if (flags & DD_TRI_LIGHT_TWOSIDE)
- index |= FFB_TWOSIDE_BIT;
-
- if (flags & DD_TRI_OFFSET)
- index |= FFB_OFFSET_BIT;
-
- if (flags & DD_TRI_UNFILLED)
- index |= FFB_UNFILLED_BIT;
-
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- GLuint render_index = 0;
-
- if (flags & DD_FLATSHADE)
- render_index |= FFB_FLAT_BIT;
-
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- render_index |= FFB_ALPHA_BIT;
-
- if (ctx->Polygon.CullFlag)
- render_index |= FFB_TRI_CULL_BIT;
-
-#ifdef FFB_RENDER_TRACE
- ffbPrintRenderFlags(index, render_index);
-#endif
- tnl->Driver.Render.PrimTabVerts = render_tabs[render_index];
- tnl->Driver.Render.PrimTabElts = render_tabs_elt[render_index];
- } else {
-#ifdef FFB_RENDER_TRACE
- ffbPrintRenderFlags(index, 0);
-#endif
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- }
-
- tnl->Driver.Render.ClippedPolygon = ffbRenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = ffbRenderClippedLine;
-}
-
-static void ffbRunPipeline(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (fmesa->bad_fragment_attrs == 0 &&
- fmesa->new_gl_state) {
- if (fmesa->new_gl_state & _FFB_NEW_TRIANGLE)
- ffbChooseTriangleState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_LINE)
- ffbChooseLineState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_POINT)
- ffbChoosePointState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_RENDER)
- ffbChooseRenderState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_VERTEX)
- ffbChooseVertexState(ctx);
-
- fmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline(ctx);
-}
-
-static void ffbRenderStart(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty != 0)
- ffbSyncHardware(fmesa);
-}
-
-static void ffbRenderFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-/* Even when doing full software rendering we need to
- * wrap render{start,finish} so that the hardware is kept
- * in sync (because multipass rendering changes the write
- * buffer etc.)
- */
-static void ffbSWRenderStart(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty != 0)
- ffbSyncHardware(fmesa);
-}
-
-static void ffbSWRenderFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-static void ffbRasterPrimitive(GLcontext *ctx, GLenum rprim)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint drawop, fbc, ppc;
- int do_sw = 0;
-
- fmesa->raster_primitive = rprim;
-
- drawop = fmesa->drawop;
- fbc = fmesa->fbc;
- ppc = fmesa->ppc & ~(FFB_PPC_ZS_MASK | FFB_PPC_CS_MASK);
-
-#ifdef STATE_TRACE
- fprintf(stderr,
- "ffbReducedPrimitiveChange: rprim(%d) ", rprim);
-#endif
- switch(rprim) {
- case GL_POINTS:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_POINTS ");
-#endif
- if (fmesa->draw_point == ffb_fallback_point) {
- do_sw = 1;
- break;
- }
-
- if (ctx->Point.SmoothFlag) {
- ppc |= (FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST);
- drawop = FFB_DRAWOP_AADOT;
- } else {
- ppc |= (FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST);
- drawop = FFB_DRAWOP_DOT;
- }
- break;
-
- case GL_LINES:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_LINES ");
-#endif
- if (fmesa->draw_line == ffb_fallback_line) {
- do_sw = 1;
- break;
- }
-
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST;
- } else {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR;
- }
- if (ctx->Line.SmoothFlag)
- drawop = FFB_DRAWOP_AALINE;
- else
- drawop = FFB_DRAWOP_DDLINE;
- break;
-
- case GL_TRIANGLES:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_POLYGON ");
-#endif
- if (fmesa->draw_tri == ffb_fallback_triangle) {
- do_sw = 1;
- break;
- }
-
- ppc &= ~FFB_PPC_APE_MASK;
- if (ctx->Polygon.StippleFlag)
- ppc |= FFB_PPC_APE_ENABLE;
- else
- ppc |= FFB_PPC_APE_DISABLE;
-
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST;
- } else {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR;
- }
- drawop = FFB_DRAWOP_TRIANGLE;
- break;
-
- default:
-#ifdef STATE_TRACE
- fprintf(stderr, "unknown %d!\n", rprim);
-#endif
- return;
- };
-
-#ifdef STATE_TRACE
- fprintf(stderr, "do_sw(%d) ", do_sw);
-#endif
- if (do_sw != 0) {
- fbc &= ~(FFB_FBC_WB_C);
- fbc &= ~(FFB_FBC_ZE_MASK | FFB_FBC_RGBE_MASK);
- fbc |= FFB_FBC_ZE_OFF | FFB_FBC_RGBE_MASK;
- ppc &= ~(FFB_PPC_XS_MASK | FFB_PPC_ABE_MASK |
- FFB_PPC_DCE_MASK | FFB_PPC_APE_MASK);
- ppc |= (FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR | FFB_PPC_XS_WID |
- FFB_PPC_ABE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_APE_DISABLE);
- } else {
- fbc |= FFB_FBC_WB_C;
- fbc &= ~(FFB_FBC_RGBE_MASK);
- fbc |= FFB_FBC_RGBE_MASK;
- ppc &= ~(FFB_PPC_ABE_MASK | FFB_PPC_XS_MASK);
- if (ctx->Color.BlendEnabled) {
- if ((rprim == GL_POINTS && !ctx->Point.SmoothFlag) ||
- (rprim != GL_POINTS && ctx->_TriangleCaps & DD_FLATSHADE))
- ppc |= FFB_PPC_ABE_ENABLE | FFB_PPC_XS_CONST;
- else
- ppc |= FFB_PPC_ABE_ENABLE | FFB_PPC_XS_VAR;
- } else {
- ppc |= FFB_PPC_ABE_DISABLE | FFB_PPC_XS_WID;
- }
- }
-#ifdef STATE_TRACE
- fprintf(stderr, "fbc(%08x) ppc(%08x)\n", fbc, ppc);
-#endif
-
- FFBFifo(fmesa, 4);
- if (fmesa->drawop != drawop)
- fmesa->regs->drawop = fmesa->drawop = drawop;
- if (fmesa->fbc != fbc)
- fmesa->regs->fbc = fmesa->fbc = fbc;
- if (fmesa->ppc != ppc)
- fmesa->regs->ppc = fmesa->ppc = ppc;
- if (do_sw != 0) {
- fmesa->regs->cmp =
- (fmesa->cmp & ~(0xff<<16)) | (0x80 << 16);
- } else
- fmesa->regs->cmp = fmesa->cmp;
-}
-
-static void ffbRenderPrimitive(GLcontext *ctx, GLenum prim)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- fmesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (fmesa->raster_primitive != rprim) {
- ffbRasterPrimitive( ctx, rprim );
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "Fog enabled",
- "Blend function",
- "Blend ROP",
- "Blend equation",
- "Stencil",
- "Texture",
- "LIBGL_SOFTWARE_RENDERING"
-};
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
-
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void ffbFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = fmesa->bad_fragment_attrs;
-
- if (mode) {
- fmesa->bad_fragment_attrs |= bit;
- if (oldfallback == 0) {
-/* FFB_FIREVERTICES(fmesa); */
- _swsetup_Wakeup( ctx );
- if (fmesa->debugFallbacks)
- fprintf(stderr, "FFB begin software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- } else {
- fmesa->bad_fragment_attrs &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
-
- tnl->Driver.Render.Start = ffbRenderStart;
- tnl->Driver.Render.PrimitiveNotify = ffbRenderPrimitive;
- tnl->Driver.Render.Finish = ffbRenderFinish;
- fmesa->new_gl_state = ~0;
-
- /* Just re-choose everything:
- */
- ffbChooseVertexState(ctx);
- ffbChooseRenderState(ctx);
- ffbChooseTriangleState(ctx);
- ffbChooseLineState(ctx);
- ffbChoosePointState(ctx);
-
- if (fmesa->debugFallbacks)
- fprintf(stderr, "FFB end software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void ffbDDInitRenderFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_tri_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = ffbRunPipeline;
- tnl->Driver.Render.Start = ffbRenderStart;
- tnl->Driver.Render.Finish = ffbRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = ffbRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
-
- swrast->Driver.SpanRenderStart = ffbSWRenderStart;
- swrast->Driver.SpanRenderFinish = ffbSWRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h
deleted file mode 100644
index 1b1a00738..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_TRIS_H
-#define _FFB_TRIS_H
-
-extern void ffbDDInitRenderFuncs( GLcontext *ctx );
-
-
-#define _FFB_NEW_RENDER (_DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_UNFILLED)
-
-extern void ffbChooseRenderState(GLcontext *ctx);
-
-
-#define _FFB_NEW_TRIANGLE (_DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _NEW_POLYGON | \
- _NEW_COLOR)
-
-extern void ffbChooseTriangleState(GLcontext *ctx);
-
-extern void ffbFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( ctx, bit, mode ) ffbFallback( ctx, bit, mode )
-
-extern void ffb_fallback_line(GLcontext *, ffb_vertex *, ffb_vertex *);
-extern void ffb_fallback_point(GLcontext *, ffb_vertex *);
-
-#endif /* !(_FFB_TRIS_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h
deleted file mode 100644
index 612ef2433..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-static void TAG(ffb_triangle)( GLcontext *ctx,
- ffb_vertex *v0,
- ffb_vertex *v1,
- ffb_vertex *v2 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_TRI_FLAT_BIT)
- GLuint const_fg;
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB: ffb_triangle ["
-#if (IND & FFB_TRI_CULL_BIT)
- " CULL"
-#endif
-#if (IND & FFB_TRI_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_TRI_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif
-
-#if (IND & FFB_TRI_CULL_BIT)
- { /* NOTE: These are not viewport transformed yet. */
- GLfloat ex = v1->x - v0->x;
- GLfloat ey = v1->y - v0->y;
- GLfloat fx = v2->x - v0->x;
- GLfloat fy = v2->y - v0->y;
- GLfloat c = ex*fy-ey*fx;
-
- /* Culled... */
- if (c * fmesa->backface_sign > fmesa->ffb_zero)
- return;
- }
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v2->color[0] );
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB_tri: const_fg %08x (B[%f] G[%f] R[%f])\n",
- const_fg,
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].blue),
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].green),
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].red));
-#endif
-#endif
-
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 1);
- ffb->fg = const_fg;
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 9);
-#else
-#if (IND & FFB_TRI_ALPHA_BIT)
- FFBFifo(fmesa, 21);
-#else
- FFBFifo(fmesa, 18);
-#endif
-#endif
-
- FFB_DUMP_VERTEX(v0);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v2);
-#endif
- ffb->red = FFB_GET_RED(v2);
- ffb->green = FFB_GET_GREEN(v2);
- ffb->blue = FFB_GET_BLUE(v2);
-#endif
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-
-static void TAG(ffb_quad)(GLcontext *ctx,
- ffb_vertex *v0,
- ffb_vertex *v1,
- ffb_vertex *v2,
- ffb_vertex *v3 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_TRI_FLAT_BIT)
- GLuint const_fg;
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB: ffb_quad ["
-#if (IND & FFB_TRI_CULL_BIT)
- " CULL"
-#endif
-#if (IND & FFB_TRI_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_TRI_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif /* TRI_DEBUG */
-
-#if (IND & FFB_TRI_CULL_BIT)
- { /* NOTE: These are not viewport transformed yet. */
- GLfloat ex = v2->x - v0->x;
- GLfloat ey = v2->y - v0->y;
- GLfloat fx = v3->x - v1->x;
- GLfloat fy = v3->y - v1->y;
- GLfloat c = ex*fy-ey*fx;
-
- /* Culled... */
- if (c * fmesa->backface_sign > fmesa->ffb_zero)
- return;
- }
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v3->color[0] );
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB_quad: const_fg %08x (B[%f] G[%f] R[%f])\n",
- const_fg,
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].blue),
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].green),
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].red));
-#endif
-#endif
-
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 13);
- ffb->fg = const_fg;
-#else
-#if (IND & FFB_TRI_ALPHA_BIT)
- FFBFifo(fmesa, 28);
-#else
- FFBFifo(fmesa, 24);
-#endif
-#endif
-
- FFB_DUMP_VERTEX(v0);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v2);
-#endif
- ffb->red = FFB_GET_RED(v2);
- ffb->green = FFB_GET_GREEN(v2);
- ffb->blue = FFB_GET_BLUE(v2);
-#endif
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_DUMP_VERTEX(v3);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v3);
-#endif
- ffb->red = FFB_GET_RED(v3);
- ffb->green = FFB_GET_GREEN(v3);
- ffb->blue = FFB_GET_BLUE(v3);
-#endif
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_init)(void)
-{
- ffb_tri_tab[IND] = TAG(ffb_triangle);
- ffb_quad_tab[IND] = TAG(ffb_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c
deleted file mode 100644
index 40820c641..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c,v 1.4 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "ffb_xmesa.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "mmath.h"
-#include "imports.h"
-#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-
-#undef VB_DEBUG
-
-static void ffb_copy_pv_oneside(GLcontext *ctx, GLuint edst, GLuint esrc)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *dst = &fmesa->verts[edst];
- ffb_vertex *src = &fmesa->verts[esrc];
-
-#ifdef VB_DEBUG
- fprintf(stderr, "ffb_copy_pv_oneside: edst(%d) esrc(%d)\n", edst, esrc);
-#endif
- dst->color[0].alpha = src->color[0].alpha;
- dst->color[0].red = src->color[0].red;
- dst->color[0].green = src->color[0].green;
- dst->color[0].blue = src->color[0].blue;
-}
-
-static void ffb_copy_pv_twoside(GLcontext *ctx, GLuint edst, GLuint esrc)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *dst = &fmesa->verts[edst];
- ffb_vertex *src = &fmesa->verts[esrc];
-
-#ifdef VB_DEBUG
- fprintf(stderr, "ffb_copy_pv_twoside: edst(%d) esrc(%d)\n", edst, esrc);
-#endif
- dst->color[0].alpha = src->color[0].alpha;
- dst->color[0].red = src->color[0].red;
- dst->color[0].green = src->color[0].green;
- dst->color[0].blue = src->color[0].blue;
- dst->color[1].alpha = src->color[1].alpha;
- dst->color[1].red = src->color[1].red;
- dst->color[1].green = src->color[1].green;
- dst->color[1].blue = src->color[1].blue;
-}
-
-#define FFB_VB_RGBA_BIT 0x01
-#define FFB_VB_XYZ_BIT 0x02
-#define FFB_VB_TWOSIDE_BIT 0x04
-#define FFB_VB_MAX 0x08
-
-typedef void (*emit_func)(GLcontext *, GLuint, GLuint);
-
-static struct {
- emit_func emit;
- interp_func interp;
-} setup_tab[FFB_VB_MAX];
-
-static void do_import(struct vertex_buffer *VB,
- struct gl_client_array *to,
- struct gl_client_array *from)
-{
- GLuint count = VB->Count;
-
- if (!to->Ptr) {
- to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLfloat), 32 );
- to->Type = GL_FLOAT;
- }
-
- /* No need to transform the same value 3000 times. */
- if (!from->StrideB) {
- to->StrideB = 0;
- count = 1;
- } else
- to->StrideB = 4 * sizeof(GLfloat);
-
- _math_trans_4f((GLfloat (*)[4]) to->Ptr,
- from->Ptr, from->StrideB,
- from->Type, from->Size,
- 0, count);
-}
-
-static __inline__ void ffbImportColors(ffbContextPtr fmesa, GLcontext *ctx, int index)
-{
- struct gl_client_array *to = &fmesa->FloatColor;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- do_import(VB, to, VB->ColorPtr[index]);
- VB->ColorPtr[index] = to;
-}
-
-#define IND (FFB_VB_XYZ_BIT)
-#define TAG(x) x##_w
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_RGBA_BIT)
-#define TAG(x) x##_g
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_t
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_wt
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_gt
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_wgt
-#include "ffb_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_w();
- init_g();
- init_wg();
- init_t();
- init_wt();
- init_gt();
- init_wgt();
-}
-
-#ifdef VB_DEBUG
-static void ffbPrintSetupFlags(char *msg, GLuint flags)
-{
- fprintf(stderr, "%s(%x): %s%s%s\n",
- msg,
- (int)flags,
- (flags & FFB_VB_XYZ_BIT) ? " xyz," : "",
- (flags & FFB_VB_RGBA_BIT) ? " rgba," : "",
- (flags & FFB_VB_TWOSIDE_BIT) ? " twoside," : "");
-}
-#endif
-
-static void ffbDDBuildVertices(GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- newinputs |= fmesa->setupnewinputs;
- fmesa->setupnewinputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[fmesa->setupindex].emit(ctx, start, count);
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= (FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT);
-
- ind &= fmesa->setupindex;
-
- if (ind)
- setup_tab[ind].emit(ctx, start, count);
- }
-}
-
-void ffbChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- int ind = FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
- ind |= FFB_VB_TWOSIDE_BIT;
-
-#ifdef VB_DEBUG
- ffbPrintSetupFlags("ffb: full setup function", ind);
-#endif
-
- fmesa->setupindex = ind;
-
- tnl->Driver.Render.BuildVertices = ffbDDBuildVertices;
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- if (ind & FFB_VB_TWOSIDE_BIT)
- tnl->Driver.Render.CopyPV = ffb_copy_pv_twoside;
- else
- tnl->Driver.Render.CopyPV = ffb_copy_pv_oneside;
-}
-
-void ffbInitVB( GLcontext *ctx )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- fmesa->verts = (ffb_vertex *)ALIGN_MALLOC(size * sizeof(ffb_vertex), 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void ffbFreeVB( GLcontext *ctx )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- if (fmesa->verts) {
- ALIGN_FREE(fmesa->verts);
- fmesa->verts = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h
deleted file mode 100644
index 9eb6759f6..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_VB_H
-#define _FFB_VB_H
-
-#include "mtypes.h"
-#include "macros.h"
-#include "tnl/t_context.h"
-#include "swrast/swrast.h"
-
-#define __FFB_2_30_FIXED_SCALE 1073741824.0f
-#define FFB_2_30_FLOAT_TO_FIXED(X) \
- (IROUND((X) * fmesa->ffb_2_30_fixed_scale))
-#define FFB_2_30_FIXED_TO_FLOAT(X) \
- (((GLfloat)(X)) * fmesa->ffb_one_over_2_30_fixed_scale)
-
-#define __FFB_16_16_FIXED_SCALE 65536.0f
-#define FFB_16_16_FLOAT_TO_FIXED(X) \
- (IROUND((X) * fmesa->ffb_16_16_fixed_scale))
-#define FFB_16_16_FIXED_TO_FLOAT(X) \
- (((GLfloat)(X)) * fmesa->ffb_one_over_16_16_fixed_scale)
-
-#define FFB_Z_FROM_FLOAT(VAL) FFB_2_30_FLOAT_TO_FIXED(VAL)
-#define FFB_Z_TO_FLOAT(VAL) FFB_2_30_FIXED_TO_FLOAT(VAL)
-#define FFB_XY_FROM_FLOAT(VAL) FFB_16_16_FLOAT_TO_FIXED(VAL)
-#define FFB_XY_TO_FLOAT(VAL) FFB_16_16_FIXED_TO_FLOAT(VAL)
-
-#define FFB_UBYTE_FROM_COLOR(VAL) ((IROUND((VAL) * fmesa->ffb_ubyte_color_scale)))
-
-#define FFB_PACK_CONST_UBYTE_ARGB_COLOR(C) \
- ((FFB_UBYTE_FROM_COLOR(C.alpha) << 24) | \
- (FFB_UBYTE_FROM_COLOR(C.blue) << 16) | \
- (FFB_UBYTE_FROM_COLOR(C.green) << 8) | \
- (FFB_UBYTE_FROM_COLOR(C.red) << 0))
-
-#define FFB_COLOR_FROM_FLOAT(VAL) FFB_2_30_FLOAT_TO_FIXED(VAL)
-
-#define _FFB_NEW_VERTEX (_DD_NEW_TRI_LIGHT_TWOSIDE)
-
-extern void ffbDDSetupInit(void);
-extern void ffbChooseVertexState(GLcontext *);
-extern void ffbInitVB( GLcontext *ctx );
-extern void ffbFreeVB( GLcontext *ctx );
-
-#endif /* !(_FFB_VB_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h
deleted file mode 100644
index ac0c6f0a8..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h,v 1.1 2002/02/22 21:32:59 dawes Exp $ */
-
-static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-#if (IND & (FFB_VB_RGBA_BIT))
- GLfloat (*col0)[4];
- GLuint col0_stride;
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- GLfloat (*col1)[4];
- GLuint col1_stride;
-#endif
-#endif
-#if (IND & FFB_VB_XYZ_BIT)
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- const GLubyte *mask = VB->ClipMask;
-#endif
- ffb_vertex *v = &fmesa->verts[start];
- int i;
-
-#ifdef VB_DEBUG
- fprintf(stderr, "FFB: ffb_emit ["
-#if (IND & (FFB_VB_XYZ_BIT))
- " XYZ"
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- " RGBA"
-#endif
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- " TWOSIDE"
-#endif
- "] start(%d) end(%d) import(%d)\n",
- start, end,
- VB->importable_data);
-#endif
-
-#if (IND & (FFB_VB_RGBA_BIT))
- if (VB->ColorPtr[0]->Type != GL_FLOAT)
- ffbImportColors(fmesa, ctx, 0);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- if (VB->ColorPtr[1]->Type != GL_FLOAT)
- ffbImportColors(fmesa, ctx, 1);
-#endif
- col0 = (GLfloat (*)[4]) VB->ColorPtr[0]->Ptr;
- col0_stride = VB->ColorPtr[0]->StrideB;
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = (GLfloat (*)[4]) VB->ColorPtr[1]->Ptr;
- col1_stride = VB->ColorPtr[1]->StrideB;
-#endif
-#endif
-
- if (VB->importable_data) {
- if (start) {
-#if (IND & (FFB_VB_XYZ_BIT))
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- col0 = (GLfloat (*)[4])((GLubyte *)col0 + start * col0_stride);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = (GLfloat (*)[4])((GLubyte *)col1 + start * col1_stride);
-#endif
-#endif
- }
- for (i = start; i < end; i++, v++) {
-#if (IND & (FFB_VB_XYZ_BIT))
- if (mask[i] == 0) {
- v->x = proj[0][0];
- v->y = proj[0][1];
- v->z = proj[0][2];
- }
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- v->color[0].alpha = CLAMP(col0[0][3], 0.0f, 1.0f);
- v->color[0].red = CLAMP(col0[0][0], 0.0f, 1.0f);
- v->color[0].green = CLAMP(col0[0][1], 0.0f, 1.0f);
- v->color[0].blue = CLAMP(col0[0][2], 0.0f, 1.0f);
- col0 = (GLfloat (*)[4])((GLubyte *)col0 + col0_stride);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- v->color[1].alpha = CLAMP(col1[0][3], 0.0f, 1.0f);
- v->color[1].red = CLAMP(col1[0][0], 0.0f, 1.0f);
- v->color[1].green = CLAMP(col1[0][1], 0.0f, 1.0f);
- v->color[1].blue = CLAMP(col1[0][2], 0.0f, 1.0f);
- col1 = (GLfloat (*)[4])((GLubyte *)col1 + col1_stride);
-#endif
-#endif
- }
- } else {
- for (i = start; i < end; i++, v++) {
-#if (IND & (FFB_VB_XYZ_BIT))
- if (mask[i] == 0) {
- v->x = proj[i][0];
- v->y = proj[i][1];
- v->z = proj[i][2];
- }
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- v->color[0].alpha = CLAMP(col0[i][3], 0.0f, 1.0f);
- v->color[0].red = CLAMP(col0[i][0], 0.0f, 1.0f);
- v->color[0].green = CLAMP(col0[i][1], 0.0f, 1.0f);
- v->color[0].blue = CLAMP(col0[i][2], 0.0f, 1.0f);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- v->color[1].alpha = CLAMP(col1[i][3], 0.0f, 1.0f);
- v->color[1].red = CLAMP(col1[i][0], 0.0f, 1.0f);
- v->color[1].green = CLAMP(col1[i][1], 0.0f, 1.0f);
- v->color[1].blue = CLAMP(col1[i][2], 0.0f, 1.0f);
-#endif
-#endif
- }
- }
-}
-
-static void TAG(interp)(GLcontext *ctx, GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary)
-{
-#if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-#endif
-#if (IND & (FFB_VB_XYZ_BIT))
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- GLfloat oow = 1.0 / dstclip[3];
-#endif
-#if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
- ffb_vertex *dst = &fmesa->verts[edst];
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- ffb_vertex *in = &fmesa->verts[eout];
- ffb_vertex *out = &fmesa->verts[ein];
-#endif
-
-#ifdef VB_DEBUG
- fprintf(stderr, "FFB: ffb_interp ["
-#if (IND & (FFB_VB_XYZ_BIT))
- " XYZ"
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- " RGBA"
-#endif
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- " TWOSIDE"
-#endif
- "] edst(%d) eout(%d) ein(%d)\n",
- edst, eout, ein);
-#endif
-
-#if (IND & (FFB_VB_XYZ_BIT))
- dst->x = dstclip[0] * oow;
- dst->y = dstclip[1] * oow;
- dst->z = dstclip[2] * oow;
-#endif
-
-#if (IND & (FFB_VB_RGBA_BIT))
- INTERP_F(t, dst->color[0].alpha, out->color[0].alpha, in->color[0].alpha);
- INTERP_F(t, dst->color[0].red, out->color[0].red, in->color[0].red);
- INTERP_F(t, dst->color[0].green, out->color[0].green, in->color[0].green);
- INTERP_F(t, dst->color[0].blue, out->color[0].blue, in->color[0].blue);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- INTERP_F(t, dst->color[1].alpha, out->color[1].alpha, in->color[1].alpha);
- INTERP_F(t, dst->color[1].red, out->color[1].red, in->color[1].red);
- INTERP_F(t, dst->color[1].green, out->color[1].green, in->color[1].green);
- INTERP_F(t, dst->color[1].blue, out->color[1].blue, in->color[1].blue);
-#endif
-#endif
-}
-
-static void TAG(init)(void)
-{
- setup_tab[IND].emit = TAG(emit);
- setup_tab[IND].interp = TAG(interp);
-}
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c
deleted file mode 100644
index 5f6d5c902..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "glheader.h"
-#include "api_noop.h"
-#include "context.h"
-#include "light.h"
-#include "macros.h"
-#include "imports.h"
-#include "mmath.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "vtxfmt.h"
-#include "ffb_xmesa.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "ffb_vtxfmt.h"
-
-#ifndef __GNUC__
-#define __inline /**/
-#endif
-
-#define TNL_VERTEX ffbTnlVertex
-
-#define LINTERP( T, A, B ) ((A) + (T) * ((B) - (A)))
-
-#define INTERP_RGBA(t, out, a, b) \
-do { \
- GLint i; \
- for ( i = 0 ; i < 4 ; i++ ) { \
- GLfloat fa = a[i]; \
- GLfloat fb = b[i]; \
- out[i] = LINTERP( t, fa, fb ); \
- } \
-} while (0)
-
-/* Color functions: */
-
-static __inline void ffb_recalc_base_color(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- struct gl_light *light;
-
- COPY_3V(fmesa->vtx_state.light.base_color, ctx->Light._BaseColor[0]);
- foreach (light, &ctx->Light.EnabledList) {
- ACC_3V(fmesa->vtx_state.light.base_color,
- light->_MatAmbient[0]);
- }
-
- fmesa->vtx_state.light.base_alpha = ctx->Light._BaseAlpha[0];
-}
-
-#define GET_CURRENT \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define CURRENT_COLOR(COMP) fmesa->vtx_state.current.color[COMP]
-#define CURRENT_SPECULAR(COMP) fmesa->vtx_state.current.specular[COMP]
-#define COLOR_IS_FLOAT
-#define RECALC_BASE_COLOR(ctx) ffb_recalc_base_color(ctx)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_capi.h"
-
-/* Normal functions: */
-
-struct ffb_norm_tab {
- void (*normal3f_multi)(GLfloat x, GLfloat y, GLfloat z);
- void (*normal3fv_multi)(const GLfloat *v);
- void (*normal3f_single)(GLfloat x, GLfloat y, GLfloat z);
- void (*normal3fv_single)(const GLfloat *v);
-};
-
-static struct ffb_norm_tab norm_tab[0x4];
-
-#define HAVE_HW_LIGHTING 0
-#define GET_CURRENT_VERTEX \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffbTnlVertexPtr v = fmesa->imm.v0
-
-#define CURRENT_NORMAL fmesa->vtx_state.current.normal
-#define BASE_COLOR fmesa->vtx_state.light.base_color
-#define BASE_ALPHA fmesa->vtx_state.light.base_alpha
-#define VERT_COLOR( COMP ) v->color[COMP]
-#define VERT_COLOR_IS_FLOAT
-
-#define IND (0)
-#define TAG(x) ffb_##x
-#define PRESERVE_NORMAL_DEFS
-#include "tnl_dd/t_dd_imm_napi.h"
-
-#define IND (NORM_RESCALE)
-#define TAG(x) ffb_##x##_rescale
-#define PRESERVE_NORMAL_DEFS
-#include "tnl_dd/t_dd_imm_napi.h"
-
-#define IND (NORM_NORMALIZE)
-#define TAG(x) ffb_##x##_normalize
-#include "tnl_dd/t_dd_imm_napi.h"
-
-static void ffb_init_norm_funcs(void)
-{
- ffb_init_norm();
- ffb_init_norm_rescale();
- ffb_init_norm_normalize();
-}
-
-static void choose_normals(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint index;
-
- if (ctx->Light.Enabled) {
- if (ctx->Transform.Normalize) {
- index = NORM_NORMALIZE;
- } else if (!ctx->Transform.RescaleNormals &&
- ctx->_ModelViewInvScale != 1.0) {
- index = NORM_RESCALE;
- } else {
- index = 0;
- }
-
- if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) {
- ctx->Exec->Normal3f = norm_tab[index].normal3f_single;
- ctx->Exec->Normal3fv = norm_tab[index].normal3fv_single;
- } else {
- ctx->Exec->Normal3f = norm_tab[index].normal3f_multi;
- ctx->Exec->Normal3fv = norm_tab[index].normal3fv_multi;
- }
- } else {
- ctx->Exec->Normal3f = _mesa_noop_Normal3f;
- ctx->Exec->Normal3fv = _mesa_noop_Normal3fv;
- }
-}
-
-static void ffb_choose_Normal3f(GLfloat x, GLfloat y, GLfloat z)
-{
- choose_normals();
- glNormal3f(x, y, z);
-}
-
-static void ffb_choose_Normal3fv(const GLfloat *v)
-{
- choose_normals();
- glNormal3fv(v);
-}
-
-/* Vertex functions: */
-
-#define GET_CURRENT_VERTEX \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffbTnlVertexPtr v = fmesa->imm.v0
-
-#define CURRENT_VERTEX v->obj
-#define SAVE_VERTEX fmesa->imm.save_vertex(ctx, v)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_vapi.h"
-
-struct ffb_vert_tab {
- void (*save_vertex)(GLcontext *ctx, ffbTnlVertexPtr v);
- void (*interpolate_vertex)(GLfloat t,
- ffbTnlVertex *O,
- const ffbTnlVertex *I,
- const ffbTnlVertex *J);
-};
-
-static struct ffb_vert_tab vert_tab[0xf];
-
-#define VTX_NORMAL 0x0
-#define VTX_RGBA 0x1
-
-#define LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define CURRENT_COLOR fmesa->vtx_state.current.color
-#define COLOR_IS_FLOAT
-#define FLUSH_VERTEX fmesa->imm.flush_vertex( ctx, v );
-
-#define IND (VTX_NORMAL)
-#define TAG(x) ffb_##x##_NORMAL
-#define PRESERVE_VERTEX_DEFS
-#include "tnl_dd/t_dd_imm_vertex.h"
-
-#define IND (VTX_RGBA)
-#define TAG(x) ffb_##x##_RGBA
-#include "tnl_dd/t_dd_imm_vertex.h"
-
-static void ffb_init_vert_funcs( void )
-{
- ffb_init_vert_NORMAL();
- ffb_init_vert_RGBA();
-}
-
-#define LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define GET_INTERP_FUNC \
- ffb_interp_func interp = fmesa->imm.interp
-
-#define FLUSH_VERTEX fmesa->imm.flush_vertex
-#define IMM_VERTEX( V ) fmesa->imm.V
-#define IMM_VERTICES( n ) fmesa->imm.vertices[n]
-
-#define EMIT_VERTEX_USES_HWREGS
-
-/* XXX Implement me XXX */
-#define EMIT_VERTEX_TRI(VTX0, VTX1, VTX2) \
- do { } while (0)
-#define EMIT_VERTEX_LINE(VTX0, VTX1) \
- do { } while (0)
-#define EMIT_VERTEX_POINT(VTX0) \
- do { } while (0)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_primtmp.h"
-
-/* Bzzt: Material changes are lost on fallback. */
-static void ffb_Materialfv(GLenum face, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- _mesa_noop_Materialfv( face, pname, params );
- ffb_recalc_base_color( ctx );
-}
-
-/* Fallback functions: */
-
-static void ffb_do_fallback(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- struct ffb_current_state *current = &fmesa->vtx_state.current;
-
- /* Tell tnl to restore its exec vtxfmt, rehook its driver callbacks
- * and revive internal state that depended on those callbacks:
- */
- _tnl_wakeup_exec(ctx);
-
- /* Replay enough vertices that the current primitive is continued
- * correctly:
- */
- if (fmesa->imm.prim != PRIM_OUTSIDE_BEGIN_END )
- glBegin(fmesa->imm.prim);
-
- if (ctx->Light.Enabled) {
- glColor4fv(ctx->Current.Color); /* Catch ColorMaterial */
- glNormal3fv(current->normal);
- } else {
- glColor4fv(current->color);
- }
-}
-
-#define PRE_LOOPBACK( FUNC ) do { \
- GET_CURRENT_CONTEXT(ctx); \
- ffb_do_fallback( ctx ); \
-} while (0)
-
-#define TAG(x) ffb_fallback_##x
-#include "vtxfmt_tmp.h"
-
-static void ffb_Begin(GLenum prim)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (prim > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (fmesa->imm.prim != PRIM_OUTSIDE_BEGIN_END) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- ctx->Driver.NeedFlush |= (FLUSH_STORED_VERTICES |
- FLUSH_UPDATE_CURRENT);
-
- fmesa->imm.prim = prim;
- fmesa->imm.v0 = &fmesa->imm.vertices[0];
- fmesa->imm.save_vertex = ffb_save_vertex_RGBA;
- fmesa->imm.flush_vertex = ffb_flush_tab[prim];
-
- /* XXX Lock hardware, update FBC, PPC, DRAWOP, etc. XXX */
-}
-
-static void ffb_End(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (fmesa->imm.prim == PRIM_OUTSIDE_BEGIN_END) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- fmesa->imm.prim = PRIM_OUTSIDE_BEGIN_END;
-
- ctx->Driver.NeedFlush &= ~(FLUSH_STORED_VERTICES |
- FLUSH_UPDATE_CURRENT);
-
- /* XXX Unlock hardware, etc. */
-}
-
-void ffbInitTnlModule(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLvertexformat *vfmt = &(fmesa->imm.vtxfmt);
-
- /* Work in progress... */
- return;
-
- ffb_init_norm_funcs();
- ffb_init_vert_funcs();
-
- MEMSET(vfmt, 0, sizeof(GLvertexformat));
-
- /* Handled fully in supported states: */
- vfmt->ArrayElement = NULL; /* FIXME: ... */
- vfmt->Color3f = ffb_choose_Color3f;
- vfmt->Color3fv = ffb_choose_Color3fv;
- vfmt->Color3ub = ffb_choose_Color3ub;
- vfmt->Color3ubv = ffb_choose_Color3ubv;
- vfmt->Color4f = ffb_choose_Color4f;
- vfmt->Color4fv = ffb_choose_Color4fv;
- vfmt->Color4ub = ffb_choose_Color4ub;
- vfmt->Color4ubv = ffb_choose_Color4ubv;
- vfmt->FogCoordfvEXT = ffb_FogCoordfvEXT;
- vfmt->FogCoordfEXT = ffb_FogCoordfEXT;
- vfmt->Materialfv = ffb_Materialfv;
- vfmt->MultiTexCoord1fARB = ffb_fallback_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = ffb_fallback_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = ffb_fallback_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = ffb_fallback_MultiTexCoord2fvARB;
- vfmt->MultiTexCoord3fARB = ffb_fallback_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = ffb_fallback_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = ffb_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = ffb_fallback_MultiTexCoord4fvARB;
- vfmt->Normal3f = ffb_choose_Normal3f;
- vfmt->Normal3fv = ffb_choose_Normal3fv;
- vfmt->SecondaryColor3ubEXT = ffb_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = ffb_SecondaryColor3ubvEXT;
- vfmt->SecondaryColor3fEXT = ffb_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = ffb_SecondaryColor3fvEXT;
- vfmt->TexCoord1f = ffb_fallback_TexCoord1f;
- vfmt->TexCoord1fv = ffb_fallback_TexCoord1fv;
- vfmt->TexCoord2f = ffb_fallback_TexCoord2f;
- vfmt->TexCoord2fv = ffb_fallback_TexCoord2fv;
- vfmt->TexCoord3f = ffb_fallback_TexCoord3f;
- vfmt->TexCoord3fv = ffb_fallback_TexCoord3fv;
- vfmt->TexCoord4f = ffb_fallback_TexCoord4f;
- vfmt->TexCoord4fv = ffb_fallback_TexCoord4fv;
-
- vfmt->Vertex2f = ffb_Vertex2f;
- vfmt->Vertex2fv = ffb_Vertex2fv;
- vfmt->Vertex3f = ffb_Vertex3f;
- vfmt->Vertex3fv = ffb_Vertex3fv;
- vfmt->Vertex4f = ffb_Vertex4f;
- vfmt->Vertex4fv = ffb_Vertex4fv;
-
- vfmt->Begin = ffb_Begin;
- vfmt->End = ffb_End;
-
- vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */
-
- vfmt->DrawArrays = NULL;
- vfmt->DrawElements = NULL;
- vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; /* discard range */
-
-
- /* Not active in supported states; just keep ctx->Current uptodate: */
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
-
- /* Active but unsupported -- fallback if we receive these:
- *
- * All of these fallbacks can be fixed with additional code, except
- * CallList, unless we build a play_immediate_noop() command which
- * turns an immediate back into glBegin/glEnd commands...
- */
- vfmt->CallList = ffb_fallback_CallList;
- vfmt->EvalCoord1f = ffb_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = ffb_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = ffb_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = ffb_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = ffb_fallback_EvalMesh1;
- vfmt->EvalMesh2 = ffb_fallback_EvalMesh2;
- vfmt->EvalPoint1 = ffb_fallback_EvalPoint1;
- vfmt->EvalPoint2 = ffb_fallback_EvalPoint2;
-
- vfmt->prefer_float_colors = GL_TRUE;
-
- fmesa->imm.prim = PRIM_OUTSIDE_BEGIN_END;
-
- /* THIS IS A HACK! */
- _mesa_install_exec_vtxfmt( ctx, vfmt );
-}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h
deleted file mode 100644
index 063bb4923..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h,v 1.1 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_VTXFMT_H
-#define _FFB_VTXFMT_H
-
-extern void ffbInitTnlModule(GLcontext *);
-
-#endif /* !(_FFB_VTXFMT_H) */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
deleted file mode 100644
index caca9d438..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.4 2002/02/22 21:32:59 dawes Exp $
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "ffb_xmesa.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "array_cache/acache.h"
-
-#include "ffb_context.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_stencil.h"
-#include "ffb_clear.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_lines.h"
-#include "ffb_points.h"
-#include "ffb_state.h"
-#include "ffb_tex.h"
-#include "ffb_lock.h"
-#include "ffb_vtxfmt.h"
-#include "ffb_bitmap.h"
-
-static GLboolean
-ffbInitDriver(__DRIscreenPrivate *sPriv)
-{
- ffbScreenPrivate *ffbScreen;
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
-
- if (getenv("LIBGL_FORCE_XSERVER"))
- return GL_FALSE;
-
- /* Allocate the private area. */
- ffbScreen = (ffbScreenPrivate *) Xmalloc(sizeof(ffbScreenPrivate));
- if (!ffbScreen)
- return GL_FALSE;
-
- /* Map FBC registers. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hFbcRegs,
- gDRIPriv->sFbcRegs,
- &gDRIPriv->mFbcRegs)) {
- Xfree(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->regs = (ffb_fbcPtr) gDRIPriv->mFbcRegs;
-
- /* Map ramdac registers. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hDacRegs,
- gDRIPriv->sDacRegs,
- &gDRIPriv->mDacRegs)) {
- drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
- Xfree(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->dac = (ffb_dacPtr) gDRIPriv->mDacRegs;
-
- /* Map "Smart" framebuffer views. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb8r,
- gDRIPriv->sSfb8r,
- &gDRIPriv->mSfb8r)) {
- drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
- drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
- Xfree(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb8r = (volatile char *) gDRIPriv->mSfb8r;
-
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb32,
- gDRIPriv->sSfb32,
- &gDRIPriv->mSfb32)) {
- drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
- drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
- drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
- Xfree(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb32 = (volatile char *) gDRIPriv->mSfb32;
-
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb64,
- gDRIPriv->sSfb64,
- &gDRIPriv->mSfb64)) {
- drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
- drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
- drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
- drmUnmap(gDRIPriv->mSfb32, gDRIPriv->sSfb32);
- Xfree(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb64 = (volatile char *) gDRIPriv->mSfb64;
-
- ffbScreen->fifo_cache = 0;
- ffbScreen->rp_active = 0;
-
- ffbScreen->sPriv = sPriv;
- sPriv->private = (void *) ffbScreen;
-
- ffbDDLinefuncInit();
- ffbDDPointfuncInit();
-
- return GL_TRUE;
-}
-
-
-static void
-ffbDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- ffbScreenPrivate *ffbScreen = sPriv->private;
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
-
- drmUnmap(gDRIPriv->mFbcRegs, gDRIPriv->sFbcRegs);
- drmUnmap(gDRIPriv->mDacRegs, gDRIPriv->sDacRegs);
- drmUnmap(gDRIPriv->mSfb8r, gDRIPriv->sSfb8r);
- drmUnmap(gDRIPriv->mSfb32, gDRIPriv->sSfb32);
- drmUnmap(gDRIPriv->mSfb64, gDRIPriv->sSfb64);
-
- Xfree(ffbScreen);
-}
-
-static const struct gl_pipeline_stage *ffb_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- /* REMOVE: fog coord stage */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
- &_tnl_render_stage,
- 0,
-};
-
-/* Create and initialize the Mesa and driver specific context data */
-static GLboolean
-ffbCreateContext(const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- ffbContextPtr fmesa;
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv;
- ffbScreenPrivate *ffbScreen;
- char *debug;
-
- /* Allocate ffb context */
- fmesa = (ffbContextPtr) CALLOC(sizeof(ffbContextRec));
- if (!fmesa)
- return GL_FALSE;
-
- /* Allocate Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((ffbContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- fmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, fmesa, GL_TRUE);
- if (!fmesa->glCtx) {
- FREE(fmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = fmesa;
- ctx = fmesa->glCtx;
-
- sPriv = driContextPriv->driScreenPriv;
- ffbScreen = (ffbScreenPrivate *) sPriv->private;
-
- /* Dri stuff. */
- fmesa->hHWContext = driContextPriv->hHWContext;
- fmesa->driFd = sPriv->fd;
- fmesa->driHwLock = &sPriv->pSAREA->lock;
-
- fmesa->ffbScreen = ffbScreen;
- fmesa->driScreen = sPriv;
- fmesa->ffb_sarea = FFB_DRISHARE(sPriv->pSAREA);
-
- /* Register and framebuffer hw pointers. */
- fmesa->regs = ffbScreen->regs;
- fmesa->sfb32 = ffbScreen->sfb32;
-
- ffbDDInitContextHwState(ctx);
-
- /* Default clear and depth colors. */
- {
- GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
-
- fmesa->clear_pixel = ((r << 0) |
- (g << 8) |
- (b << 16));
- }
- fmesa->clear_depth = Z_FROM_MESA(ctx->Depth.Clear * 4294967295.0f);
- fmesa->clear_stencil = ctx->Stencil.Clear & 0xf;
-
- /* No wide points. */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* Disable wide lines as we can't antialias them correctly in
- * hardware.
- */
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- /* Instead of having GCC emit these constants a zillion times
- * everywhere in the driver, put them here.
- */
- fmesa->ffb_2_30_fixed_scale = __FFB_2_30_FIXED_SCALE;
- fmesa->ffb_one_over_2_30_fixed_scale = (1.0 / __FFB_2_30_FIXED_SCALE);
- fmesa->ffb_16_16_fixed_scale = __FFB_16_16_FIXED_SCALE;
- fmesa->ffb_one_over_16_16_fixed_scale = (1.0 / __FFB_16_16_FIXED_SCALE);
- fmesa->ffb_ubyte_color_scale = 255.0f;
- fmesa->ffb_zero = 0.0f;
-
- fmesa->debugFallbacks = GL_FALSE;
- debug = getenv("LIBGL_DEBUG");
- if (debug && strstr(debug, "fallbacks"))
- fmesa->debugFallbacks = GL_TRUE;
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* All of this need only be done once for a new context. */
- ffbDDExtensionsInit(ctx);
- ffbDDInitDriverFuncs(ctx);
- ffbDDInitStateFuncs(ctx);
- ffbDDInitSpanFuncs(ctx);
- ffbDDInitDepthFuncs(ctx);
- ffbDDInitStencilFuncs(ctx);
- ffbDDInitRenderFuncs(ctx);
- ffbDDInitTexFuncs(ctx);
- ffbDDInitBitmapFuncs(ctx);
- ffbInitVB(ctx);
-
- ffbInitTnlModule(ctx);
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, ffb_pipeline);
-
- return GL_TRUE;
-}
-
-static void
-ffbDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
-
- if (fmesa) {
- ffbFreeVB(fmesa->glCtx);
-
- _swsetup_DestroyContext( fmesa->glCtx );
- _tnl_DestroyContext( fmesa->glCtx );
- _ac_DestroyContext( fmesa->glCtx );
- _swrast_DestroyContext( fmesa->glCtx );
-
- /* free the Mesa context */
- fmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(fmesa->glCtx);
-
- FREE(fmesa);
- }
-}
-
-/* Create and initialize the Mesa and driver specific pixmap buffer data */
-static GLboolean
-ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0);
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-#define USE_FAST_SWAP
-
-static void
-ffbSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- ffbContextPtr fmesa = (ffbContextPtr) dPriv->driContextPriv->driverPrivate;
- unsigned int fbc, wid, wid_reg_val, dac_db_bit;
- unsigned int shadow_dac_addr, active_dac_addr;
- ffb_fbcPtr ffb;
- ffb_dacPtr dac;
-
- if (fmesa == NULL ||
- fmesa->glCtx->Visual.doubleBufferMode == 0)
- return;
-
- /* Flush pending rendering commands */
- _mesa_notifySwapBuffers(fmesa->glCtx);
-
- ffb = fmesa->regs;
- dac = fmesa->ffbScreen->dac;
-
- fbc = fmesa->fbc;
- wid = fmesa->wid;
-
- /* Swap the buffer we render into and read pixels from. */
- fmesa->back_buffer ^= 1;
-
- /* If we are writing into both buffers, don't mess with
- * the WB setting.
- */
- if ((fbc & FFB_FBC_WB_AB) != FFB_FBC_WB_AB) {
- if ((fbc & FFB_FBC_WB_A) != 0)
- fbc = (fbc & ~FFB_FBC_WB_A) | FFB_FBC_WB_B;
- else
- fbc = (fbc & ~FFB_FBC_WB_B) | FFB_FBC_WB_A;
- }
-
- /* But either way, we must flip the read buffer setting. */
- if ((fbc & FFB_FBC_RB_A) != 0)
- fbc = (fbc & ~FFB_FBC_RB_A) | FFB_FBC_RB_B;
- else
- fbc = (fbc & ~FFB_FBC_RB_B) | FFB_FBC_RB_A;
-
- LOCK_HARDWARE(fmesa);
-
- if (fmesa->fbc != fbc) {
- FFBFifo(fmesa, 1);
- ffb->fbc = fmesa->fbc = fbc;
- fmesa->ffbScreen->rp_active = 1;
- }
-
- /* And swap the buffer displayed in the WID. */
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1) {
- shadow_dac_addr = FFBDAC_PAC1_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC1_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC1_WLUT_DB;
- } else {
- shadow_dac_addr = FFBDAC_PAC2_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC2_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC2_WLUT_DB;
- }
-
- FFBWait(fmesa, ffb);
-
- wid_reg_val = DACCFG_READ(dac, active_dac_addr);
- if (fmesa->back_buffer == 0)
- wid_reg_val |= dac_db_bit;
- else
- wid_reg_val &= ~dac_db_bit;
-#ifdef USE_FAST_SWAP
- DACCFG_WRITE(dac, active_dac_addr, wid_reg_val);
-#else
- DACCFG_WRITE(dac, shadow_dac_addr, wid_reg_val);
-
- /* Schedule the window transfer. */
- DACCFG_WRITE(dac, FFBDAC_CFG_WTCTRL,
- (FFBDAC_CFG_WTCTRL_TCMD | FFBDAC_CFG_WTCTRL_TE));
-
- {
- int limit = 1000000;
- while (limit--) {
- unsigned int wtctrl = DACCFG_READ(dac, FFBDAC_CFG_WTCTRL);
-
- if ((wtctrl & FFBDAC_CFG_WTCTRL_DS) == 0)
- break;
- }
- }
-#endif
-
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void ffb_init_wid(ffbContextPtr fmesa, unsigned int wid)
-{
- ffb_dacPtr dac = fmesa->ffbScreen->dac;
- unsigned int wid_reg_val, dac_db_bit, active_dac_addr;
- unsigned int shadow_dac_addr;
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1) {
- shadow_dac_addr = FFBDAC_PAC1_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC1_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC1_WLUT_DB;
- } else {
- shadow_dac_addr = FFBDAC_PAC2_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC2_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC2_WLUT_DB;
- }
-
- wid_reg_val = DACCFG_READ(dac, active_dac_addr);
- wid_reg_val &= ~dac_db_bit;
-#ifdef USE_FAST_SWAP
- DACCFG_WRITE(dac, active_dac_addr, wid_reg_val);
-#else
- DACCFG_WRITE(dac, shadow_dac_addr, wid_reg_val);
-
- /* Schedule the window transfer. */
- DACCFG_WRITE(dac, FFBDAC_CFG_WTCTRL,
- (FFBDAC_CFG_WTCTRL_TCMD | FFBDAC_CFG_WTCTRL_TE));
-
- {
- int limit = 1000000;
- while (limit--) {
- unsigned int wtctrl = DACCFG_READ(dac, FFBDAC_CFG_WTCTRL);
-
- if ((wtctrl & FFBDAC_CFG_WTCTRL_DS) == 0)
- break;
- }
- }
-#endif
-}
-
-/* Force the context `c' to be the current context and associate with it
- buffer `b' */
-static GLboolean
-ffbMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
- int first_time;
-
- fmesa->driDrawable = driDrawPriv;
-
- _mesa_make_current2(fmesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- if (!fmesa->glCtx->Viewport.Width)
- _mesa_set_viewport(fmesa->glCtx,
- 0, 0,
- driDrawPriv->w,
- driDrawPriv->h);
-
- first_time = 0;
- if (fmesa->wid == ~0) {
- first_time = 1;
- if (getenv("LIBGL_SOFTWARE_RENDERING"))
- FALLBACK( fmesa->glCtx, FFB_BADATTR_SWONLY, GL_TRUE );
- }
-
- LOCK_HARDWARE(fmesa);
- if (first_time) {
- fmesa->wid = fmesa->ffb_sarea->wid_table[driDrawPriv->index];
- ffb_init_wid(fmesa, fmesa->wid);
- }
-
- fmesa->state_dirty |= FFB_STATE_ALL;
- fmesa->state_fifo_ents = fmesa->state_all_fifo_ents;
- ffbSyncHardware(fmesa);
- UNLOCK_HARDWARE(fmesa);
-
- if (first_time) {
- /* Also, at the first switch to a new context,
- * we need to clear all the hw buffers.
- */
- ffbDDClear(fmesa->glCtx,
- (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT |
- DD_DEPTH_BIT | DD_STENCIL_BIT),
- 1, 0, 0, 0, 0);
- }
- } else {
- _mesa_make_current(NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer */
-static GLboolean
-ffbUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static GLboolean
-ffbOpenFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static GLboolean
-ffbCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-void ffbXMesaUpdateState(ffbContextPtr fmesa)
-{
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- __DRIscreenPrivate *sPriv = fmesa->driScreen;
- int stamp = dPriv->lastStamp;
-
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- if (dPriv->lastStamp != stamp) {
- GLcontext *ctx = fmesa->glCtx;
-
- ffbCalcViewport(ctx);
- if (ctx->Polygon.StippleFlag)
- ffbXformAreaPattern(fmesa,
- (const GLubyte *)ctx->PolygonStipple);
- }
-}
-
-
-static struct __DriverAPIRec ffbAPI = {
- ffbInitDriver,
- ffbDestroyScreen,
- ffbCreateContext,
- ffbDestroyContext,
- ffbCreateBuffer,
- ffbDestroyBuffer,
- ffbSwapBuffers,
- ffbMakeCurrent,
- ffbUnbindContext,
- ffbOpenFullScreen,
- ffbCloseFullScreen
-};
-
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &ffbAPI);
- return (void *) psp;
-}
-
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h
deleted file mode 100644
index 5569bd866..000000000
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_XMESA_H_
-#define _FFB_XMESA_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "mtypes.h"
-#include "ffb_drishare.h"
-#include "ffb_regs.h"
-#include "ffb_dac.h"
-#include "ffb_fifo.h"
-
-typedef struct {
- __DRIscreenPrivate *sPriv;
- ffb_fbcPtr regs;
- ffb_dacPtr dac;
- volatile char *sfb8r;
- volatile char *sfb32;
- volatile char *sfb64;
-
- int fifo_cache;
- int rp_active;
-} ffbScreenPrivate;
-
-#endif /* GLX_DIRECT_RENDERING */
-
-#endif /* !(_FFB_XMESA_H) */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_client.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_client.h
deleted file mode 100644
index 1c1a22ebc..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_client.h
+++ /dev/null
@@ -1,6185 +0,0 @@
-/* Automaticallly generated -- do not edit */
-#ifndef _GLINT_CLIENT_H_
-#define _GLINT_CLIENT_H_
-/* **********************************************************************/
-/* START OF glint_extra.h INCLUSION */
-/* **********************************************************************/
-
-/* glint_extra.h
- * Created: Fri Apr 2 23:32:05 1999 by faith@precisioninsight.com
- * Revised: Fri Apr 2 23:33:00 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_client.h,v 1.3 2002/02/22 21:33:00 dawes Exp $
- *
- */
-
-#define AreaStippleEnable 0x00001
-#define LineStippleEnable 0x00002
-#define GResetLineStipple 0x00004
-#define FastFillEnable 0x00008
-#define PrimitiveLine 0x00000
-#define PrimitiveTrapezoid 0x00040
-#define PrimitivePoint 0x00080
-#define PrimitiveRectangle 0x000C0
-#define AntialiasEnable 0x00100
-#define AntialiasingQuality 0x00200
-#define UsePointTable 0x00400
-#define SyncOnBitMask 0x00800
-#define SyncOnHostData 0x01000
-#define TextureEnable 0x02000
-#define FogEnable 0x04000
-#define CoverageEnable 0x08000
-#define SubPixelCorrectionEnable 0x10000
-#define SpanOperation 0x40000
-
-
-/* **********************************************************************/
-/* END OF glint_extra.h INCLUSION */
-/* **********************************************************************/
-
-
-#define GlintResetStatus 0x0000
-#define GlintResetStatusReg 0
-#define GlintResetStatusOff 0x0000
-#define GlintResetStatusSec 0x0000
-#define GlintResetStatusSecReg 2
-#define GlintResetStatusSecOff 0x0000
-
-#define GlintIntEnable 0x0008
-#define GlintIntEnableReg 0
-#define GlintIntEnableOff 0x0008
-#define GlintIntEnableSec 0x0008
-#define GlintIntEnableSecReg 2
-#define GlintIntEnableSecOff 0x0008
-
-#define GlintIntFlags 0x0010
-#define GlintIntFlagsReg 0
-#define GlintIntFlagsOff 0x0010
-#define GlintIntFlagsSec 0x0010
-#define GlintIntFlagsSecReg 2
-#define GlintIntFlagsSecOff 0x0010
-
-#define GlintInFIFOSpace 0x0018
-#define GlintInFIFOSpaceReg 0
-#define GlintInFIFOSpaceOff 0x0018
-#define GlintInFIFOSpaceSec 0x0018
-#define GlintInFIFOSpaceSecReg 2
-#define GlintInFIFOSpaceSecOff 0x0018
-
-#define GlintOutFIFOWords 0x0020
-#define GlintOutFIFOWordsReg 0
-#define GlintOutFIFOWordsOff 0x0020
-#define GlintOutFIFOWordsSec 0x0020
-#define GlintOutFIFOWordsSecReg 2
-#define GlintOutFIFOWordsSecOff 0x0020
-
-#define GlintDMAAddress 0x0028
-#define GlintDMAAddressReg 0
-#define GlintDMAAddressOff 0x0028
-#define GlintDMAAddressSec 0x0028
-#define GlintDMAAddressSecReg 2
-#define GlintDMAAddressSecOff 0x0028
-
-#define GlintDMACount 0x0030
-#define GlintDMACountReg 0
-#define GlintDMACountOff 0x0030
-#define GlintDMACountSec 0x0030
-#define GlintDMACountSecReg 2
-#define GlintDMACountSecOff 0x0030
-
-#define GlintErrorFlags 0x0038
-#define GlintErrorFlagsReg 0
-#define GlintErrorFlagsOff 0x0038
-#define GlintErrorFlagsSec 0x0038
-#define GlintErrorFlagsSecReg 2
-#define GlintErrorFlagsSecOff 0x0038
-
-#define GlintVClkCtl 0x0040
-#define GlintVClkCtlReg 0
-#define GlintVClkCtlOff 0x0040
-#define GlintVClkCtlSec 0x0040
-#define GlintVClkCtlSecReg 2
-#define GlintVClkCtlSecOff 0x0040
-
-#define GlintTestRegister 0x0048
-#define GlintTestRegisterReg 0
-#define GlintTestRegisterOff 0x0048
-#define GlintTestRegisterSec 0x0048
-#define GlintTestRegisterSecReg 2
-#define GlintTestRegisterSecOff 0x0048
-
-#define GlintAperture0 0x0050
-#define GlintAperture0Reg 0
-#define GlintAperture0Off 0x0050
-#define GlintAperture0Sec 0x0050
-#define GlintAperture0SecReg 2
-#define GlintAperture0SecOff 0x0050
-
-#define GlintAperture1 0x0058
-#define GlintAperture1Reg 0
-#define GlintAperture1Off 0x0058
-#define GlintAperture1Sec 0x0058
-#define GlintAperture1SecReg 2
-#define GlintAperture1SecOff 0x0058
-
-#define GlintDMAControl 0x0060
-#define GlintDMAControlReg 0
-#define GlintDMAControlOff 0x0060
-#define GlintDMAControlSec 0x0060
-#define GlintDMAControlSecReg 2
-#define GlintDMAControlSecOff 0x0060
-
-#define GlintFIFODis 0x0068
-#define GlintFIFODisReg 0
-#define GlintFIFODisOff 0x0068
-#define GlintFIFODisSec 0x0068
-#define GlintFIFODisSecReg 2
-#define GlintFIFODisSecOff 0x0068
-
-#define GlintLBMemoryCtl 0x1000
-#define GlintLBMemoryCtlReg 1
-#define GlintLBMemoryCtlOff 0x0000
-#define GlintLBMemoryCtlSec 0x1000
-#define GlintLBMemoryCtlSecReg 3
-#define GlintLBMemoryCtlSecOff 0x0000
-
-#define GlintLBMemoryEDO 0x1008
-#define GlintLBMemoryEDOReg 1
-#define GlintLBMemoryEDOOff 0x0008
-#define GlintLBMemoryEDOSec 0x1008
-#define GlintLBMemoryEDOSecReg 3
-#define GlintLBMemoryEDOSecOff 0x0008
-
-#define GlintFBMemoryCtl 0x1800
-#define GlintFBMemoryCtlReg 1
-#define GlintFBMemoryCtlOff 0x0800
-#define GlintFBMemoryCtlSec 0x1800
-#define GlintFBMemoryCtlSecReg 3
-#define GlintFBMemoryCtlSecOff 0x0800
-
-#define GlintFBModeSel 0x1808
-#define GlintFBModeSelReg 1
-#define GlintFBModeSelOff 0x0808
-#define GlintFBModeSelSec 0x1808
-#define GlintFBModeSelSecReg 3
-#define GlintFBModeSelSecOff 0x0808
-
-#define GlintFBGCWrMask 0x1810
-#define GlintFBGCWrMaskReg 1
-#define GlintFBGCWrMaskOff 0x0810
-#define GlintFBGCWrMaskSec 0x1810
-#define GlintFBGCWrMaskSecReg 3
-#define GlintFBGCWrMaskSecOff 0x0810
-
-#define GlintFBGCColorLower 0x1818
-#define GlintFBGCColorLowerReg 1
-#define GlintFBGCColorLowerOff 0x0818
-#define GlintFBGCColorLowerSec 0x1818
-#define GlintFBGCColorLowerSecReg 3
-#define GlintFBGCColorLowerSecOff 0x0818
-
-#define GlintFBTXMemCtl 0x1820
-#define GlintFBTXMemCtlReg 1
-#define GlintFBTXMemCtlOff 0x0820
-#define GlintFBTXMemCtlSec 0x1820
-#define GlintFBTXMemCtlSecReg 3
-#define GlintFBTXMemCtlSecOff 0x0820
-
-#define GlintFBWrMask 0x1830
-#define GlintFBWrMaskReg 1
-#define GlintFBWrMaskOff 0x0830
-#define GlintFBWrMaskSec 0x1830
-#define GlintFBWrMaskSecReg 3
-#define GlintFBWrMaskSecOff 0x0830
-
-#define GlintFBGCColorUpper 0x1838
-#define GlintFBGCColorUpperReg 1
-#define GlintFBGCColorUpperOff 0x0838
-#define GlintFBGCColorUpperSec 0x1838
-#define GlintFBGCColorUpperSecReg 3
-#define GlintFBGCColorUpperSecOff 0x0838
-
-#define GlintVTGHLimit 0x3000
-#define GlintVTGHLimitReg 1
-#define GlintVTGHLimitOff 0x2000
-#define GlintVTGHLimitSec 0x3000
-#define GlintVTGHLimitSecReg 3
-#define GlintVTGHLimitSecOff 0x2000
-
-#define GlintVTGHSyncStart 0x3008
-#define GlintVTGHSyncStartReg 1
-#define GlintVTGHSyncStartOff 0x2008
-#define GlintVTGHSyncStartSec 0x3008
-#define GlintVTGHSyncStartSecReg 3
-#define GlintVTGHSyncStartSecOff 0x2008
-
-#define GlintVTGHSyncEnd 0x3010
-#define GlintVTGHSyncEndReg 1
-#define GlintVTGHSyncEndOff 0x2010
-#define GlintVTGHSyncEndSec 0x3010
-#define GlintVTGHSyncEndSecReg 3
-#define GlintVTGHSyncEndSecOff 0x2010
-
-#define GlintVTGHBlankEnd 0x3018
-#define GlintVTGHBlankEndReg 1
-#define GlintVTGHBlankEndOff 0x2018
-#define GlintVTGHBlankEndSec 0x3018
-#define GlintVTGHBlankEndSecReg 3
-#define GlintVTGHBlankEndSecOff 0x2018
-
-#define GlintVTGVLimit 0x3020
-#define GlintVTGVLimitReg 1
-#define GlintVTGVLimitOff 0x2020
-#define GlintVTGVLimitSec 0x3020
-#define GlintVTGVLimitSecReg 3
-#define GlintVTGVLimitSecOff 0x2020
-
-#define GlintVTGVSyncStart 0x3028
-#define GlintVTGVSyncStartReg 1
-#define GlintVTGVSyncStartOff 0x2028
-#define GlintVTGVSyncStartSec 0x3028
-#define GlintVTGVSyncStartSecReg 3
-#define GlintVTGVSyncStartSecOff 0x2028
-
-#define GlintVTGVSyncEnd 0x3030
-#define GlintVTGVSyncEndReg 1
-#define GlintVTGVSyncEndOff 0x2030
-#define GlintVTGVSyncEndSec 0x3030
-#define GlintVTGVSyncEndSecReg 3
-#define GlintVTGVSyncEndSecOff 0x2030
-
-#define GlintVTGVBlankEnd 0x3038
-#define GlintVTGVBlankEndReg 1
-#define GlintVTGVBlankEndOff 0x2038
-#define GlintVTGVBlankEndSec 0x3038
-#define GlintVTGVBlankEndSecReg 3
-#define GlintVTGVBlankEndSecOff 0x2038
-
-#define GlintVTGHGateStart 0x3040
-#define GlintVTGHGateStartReg 1
-#define GlintVTGHGateStartOff 0x2040
-#define GlintVTGHGateStartSec 0x3040
-#define GlintVTGHGateStartSecReg 3
-#define GlintVTGHGateStartSecOff 0x2040
-
-#define GlintVTGHGateEnd 0x3048
-#define GlintVTGHGateEndReg 1
-#define GlintVTGHGateEndOff 0x2048
-#define GlintVTGHGateEndSec 0x3048
-#define GlintVTGHGateEndSecReg 3
-#define GlintVTGHGateEndSecOff 0x2048
-
-#define GlintVTGVGateStart 0x3050
-#define GlintVTGVGateStartReg 1
-#define GlintVTGVGateStartOff 0x2050
-#define GlintVTGVGateStartSec 0x3050
-#define GlintVTGVGateStartSecReg 3
-#define GlintVTGVGateStartSecOff 0x2050
-
-#define GlintVTGVGateEnd 0x3058
-#define GlintVTGVGateEndReg 1
-#define GlintVTGVGateEndOff 0x2058
-#define GlintVTGVGateEndSec 0x3058
-#define GlintVTGVGateEndSecReg 3
-#define GlintVTGVGateEndSecOff 0x2058
-
-#define GlintVTGPolarity 0x3060
-#define GlintVTGPolarityReg 1
-#define GlintVTGPolarityOff 0x2060
-#define GlintVTGPolaritySec 0x3060
-#define GlintVTGPolaritySecReg 3
-#define GlintVTGPolaritySecOff 0x2060
-
-#define GlintVTGFrameRowAddr 0x3068
-#define GlintVTGFrameRowAddrReg 1
-#define GlintVTGFrameRowAddrOff 0x2068
-#define GlintVTGFrameRowAddrSec 0x3068
-#define GlintVTGFrameRowAddrSecReg 3
-#define GlintVTGFrameRowAddrSecOff 0x2068
-
-#define GlintVTGVLineNumber 0x3070
-#define GlintVTGVLineNumberReg 1
-#define GlintVTGVLineNumberOff 0x2070
-#define GlintVTGVLineNumberSec 0x3070
-#define GlintVTGVLineNumberSecReg 3
-#define GlintVTGVLineNumberSecOff 0x2070
-
-#define GlintVTGSerialClk 0x3078
-#define GlintVTGSerialClkReg 1
-#define GlintVTGSerialClkOff 0x2078
-#define GlintVTGSerialClkSec 0x3078
-#define GlintVTGSerialClkSecReg 3
-#define GlintVTGSerialClkSecOff 0x2078
-
-#define GlintVTGModeCtl 0x3080
-#define GlintVTGModeCtlReg 1
-#define GlintVTGModeCtlOff 0x2080
-#define GlintVTGModeCtlSec 0x3080
-#define GlintVTGModeCtlSecReg 3
-#define GlintVTGModeCtlSecOff 0x2080
-
-#define GlintOutputFIFO 0x2000
-#define GlintOutputFIFOReg 1
-#define GlintOutputFIFOOff 0x1000
-#define GlintOutputFIFOSec 0x2000
-#define GlintOutputFIFOSecReg 3
-#define GlintOutputFIFOSecOff 0x1000
-
-#define GlintGInFIFOSpace 0x0018
-#define GlintGInFIFOSpaceReg 0
-#define GlintGInFIFOSpaceOff 0x0018
-
-#define GlintGDMAAddress 0x0028
-#define GlintGDMAAddressReg 0
-#define GlintGDMAAddressOff 0x0028
-
-#define GlintGDMACount 0x0030
-#define GlintGDMACountReg 0
-#define GlintGDMACountOff 0x0030
-
-#define GlintGDMAControl 0x0060
-#define GlintGDMAControlReg 0
-#define GlintGDMAControlOff 0x0060
-
-#define GlintGOutDMA 0x0080
-#define GlintGOutDMAReg 0
-#define GlintGOutDMAOff 0x0080
-
-#define GlintGOutDMACount 0x0088
-#define GlintGOutDMACountReg 0
-#define GlintGOutDMACountOff 0x0088
-
-#define GlintGResetStatus 0x0800
-#define GlintGResetStatusReg 0
-#define GlintGResetStatusOff 0x0800
-
-#define GlintGIntEnable 0x0808
-#define GlintGIntEnableReg 0
-#define GlintGIntEnableOff 0x0808
-
-#define GlintGIntFlags 0x0810
-#define GlintGIntFlagsReg 0
-#define GlintGIntFlagsOff 0x0810
-
-#define GlintGErrorFlags 0x0838
-#define GlintGErrorFlagsReg 0
-#define GlintGErrorFlagsOff 0x0838
-
-#define GlintGTestRegister 0x0848
-#define GlintGTestRegisterReg 0
-#define GlintGTestRegisterOff 0x0848
-
-#define GlintGFIFODis 0x0868
-#define GlintGFIFODisReg 0
-#define GlintGFIFODisOff 0x0868
-
-#define GlintGChipConfig 0x0870
-#define GlintGChipConfigReg 0
-#define GlintGChipConfigOff 0x0870
-
-#define GlintGCSRAperture 0x0878
-#define GlintGCSRApertureReg 0
-#define GlintGCSRApertureOff 0x0878
-
-#define GlintGPageTableAddr 0x0c00
-#define GlintGPageTableAddrReg 0
-#define GlintGPageTableAddrOff 0x0c00
-
-#define GlintGPageTableLength 0x0c08
-#define GlintGPageTableLengthReg 0
-#define GlintGPageTableLengthOff 0x0c08
-
-#define GlintGDelayTimer 0x0c38
-#define GlintGDelayTimerReg 0
-#define GlintGDelayTimerOff 0x0c38
-
-#define GlintGCommandMode 0x0c40
-#define GlintGCommandModeReg 0
-#define GlintGCommandModeOff 0x0c40
-
-#define GlintGCommandIntEnable 0x0c48
-#define GlintGCommandIntEnableReg 0
-#define GlintGCommandIntEnableOff 0x0c48
-
-#define GlintGCommandIntFlags 0x0c50
-#define GlintGCommandIntFlagsReg 0
-#define GlintGCommandIntFlagsOff 0x0c50
-
-#define GlintGCommandErrorFlags 0x0c58
-#define GlintGCommandErrorFlagsReg 0
-#define GlintGCommandErrorFlagsOff 0x0c58
-
-#define GlintGCommandStatus 0x0c60
-#define GlintGCommandStatusReg 0
-#define GlintGCommandStatusOff 0x0c60
-
-#define GlintGCommandFaultingAddr 0x0c68
-#define GlintGCommandFaultingAddrReg 0
-#define GlintGCommandFaultingAddrOff 0x0c68
-
-#define GlintGVertexFaultingAddr 0x0c70
-#define GlintGVertexFaultingAddrReg 0
-#define GlintGVertexFaultingAddrOff 0x0c70
-
-#define GlintGWriteFaultingAddr 0x0c88
-#define GlintGWriteFaultingAddrReg 0
-#define GlintGWriteFaultingAddrOff 0x0c88
-
-#define GlintGFeedbackSelectCount 0x0c98
-#define GlintGFeedbackSelectCountReg 0
-#define GlintGFeedbackSelectCountOff 0x0c98
-
-#define GlintGGammaProcessorMode 0x0cb8
-#define GlintGGammaProcessorModeReg 0
-#define GlintGGammaProcessorModeOff 0x0cb8
-
-#define GlintGVGAShadow 0x0d00
-#define GlintGVGAShadowReg 0
-#define GlintGVGAShadowOff 0x0d00
-
-#define GlintGMultGLINTAperture 0x0d08
-#define GlintGMultGLINTApertureReg 0
-#define GlintGMultGLINTApertureOff 0x0d08
-
-#define GlintGMultGLINT1 0x0d10
-#define GlintGMultGLINT1Reg 0
-#define GlintGMultGLINT1Off 0x0d10
-
-#define GlintGMultGLINT2 0x0d18
-#define GlintGMultGLINT2Reg 0
-#define GlintGMultGLINT2Off 0x0d18
-
-#define GlintStartXDom 0x8000
-#define GlintStartXDomTag 0x0000
-#define GlintStartXDomReg 1
-#define GlintStartXDomOff 0x7000
-#define GlintStartXDomSec 0x8000
-#define GlintStartXDomSecReg 3
-#define GlintStartXDomSecOff 0x7000
-
-#define GlintdXDom 0x8008
-#define GlintdXDomTag 0x0001
-#define GlintdXDomReg 1
-#define GlintdXDomOff 0x7008
-#define GlintdXDomSec 0x8008
-#define GlintdXDomSecReg 3
-#define GlintdXDomSecOff 0x7008
-
-#define GlintStartXSub 0x8010
-#define GlintStartXSubTag 0x0002
-#define GlintStartXSubReg 1
-#define GlintStartXSubOff 0x7010
-#define GlintStartXSubSec 0x8010
-#define GlintStartXSubSecReg 3
-#define GlintStartXSubSecOff 0x7010
-
-#define GlintdXSub 0x8018
-#define GlintdXSubTag 0x0003
-#define GlintdXSubReg 1
-#define GlintdXSubOff 0x7018
-#define GlintdXSubSec 0x8018
-#define GlintdXSubSecReg 3
-#define GlintdXSubSecOff 0x7018
-
-#define GlintStartY 0x8020
-#define GlintStartYTag 0x0004
-#define GlintStartYReg 1
-#define GlintStartYOff 0x7020
-#define GlintStartYSec 0x8020
-#define GlintStartYSecReg 3
-#define GlintStartYSecOff 0x7020
-
-#define GlintdY 0x8028
-#define GlintdYTag 0x0005
-#define GlintdYReg 1
-#define GlintdYOff 0x7028
-#define GlintdYSec 0x8028
-#define GlintdYSecReg 3
-#define GlintdYSecOff 0x7028
-
-#define GlintGLINTCount 0x8030
-#define GlintGLINTCountTag 0x0006
-#define GlintGLINTCountReg 1
-#define GlintGLINTCountOff 0x7030
-#define GlintGLINTCountSec 0x8030
-#define GlintGLINTCountSecReg 3
-#define GlintGLINTCountSecOff 0x7030
-
-#define GlintRender 0x8038
-#define GlintRenderTag 0x0007
-#define GlintRenderReg 1
-#define GlintRenderOff 0x7038
-#define GlintRenderSec 0x8038
-#define GlintRenderSecReg 3
-#define GlintRenderSecOff 0x7038
-
-#define GlintContinueNewLine 0x8040
-#define GlintContinueNewLineTag 0x0008
-#define GlintContinueNewLineReg 1
-#define GlintContinueNewLineOff 0x7040
-#define GlintContinueNewLineSec 0x8040
-#define GlintContinueNewLineSecReg 3
-#define GlintContinueNewLineSecOff 0x7040
-
-#define GlintContinueNewDom 0x8048
-#define GlintContinueNewDomTag 0x0009
-#define GlintContinueNewDomReg 1
-#define GlintContinueNewDomOff 0x7048
-#define GlintContinueNewDomSec 0x8048
-#define GlintContinueNewDomSecReg 3
-#define GlintContinueNewDomSecOff 0x7048
-
-#define GlintContinueNewSub 0x8050
-#define GlintContinueNewSubTag 0x000a
-#define GlintContinueNewSubReg 1
-#define GlintContinueNewSubOff 0x7050
-#define GlintContinueNewSubSec 0x8050
-#define GlintContinueNewSubSecReg 3
-#define GlintContinueNewSubSecOff 0x7050
-
-#define GlintContinue 0x8058
-#define GlintContinueTag 0x000b
-#define GlintContinueReg 1
-#define GlintContinueOff 0x7058
-#define GlintContinueSec 0x8058
-#define GlintContinueSecReg 3
-#define GlintContinueSecOff 0x7058
-
-#define GlintFlushSpan 0x8060
-#define GlintFlushSpanTag 0x000c
-#define GlintFlushSpanReg 1
-#define GlintFlushSpanOff 0x7060
-#define GlintFlushSpanSec 0x8060
-#define GlintFlushSpanSecReg 3
-#define GlintFlushSpanSecOff 0x7060
-
-#define GlintBitMaskPattern 0x8068
-#define GlintBitMaskPatternTag 0x000d
-#define GlintBitMaskPatternReg 1
-#define GlintBitMaskPatternOff 0x7068
-#define GlintBitMaskPatternSec 0x8068
-#define GlintBitMaskPatternSecReg 3
-#define GlintBitMaskPatternSecOff 0x7068
-
-#define GlintPointTable0 0x8080
-#define GlintPointTable0Tag 0x0010
-#define GlintPointTable0Reg 1
-#define GlintPointTable0Off 0x7080
-#define GlintPointTable0Sec 0x8080
-#define GlintPointTable0SecReg 3
-#define GlintPointTable0SecOff 0x7080
-
-#define GlintPointTable1 0x8088
-#define GlintPointTable1Tag 0x0011
-#define GlintPointTable1Reg 1
-#define GlintPointTable1Off 0x7088
-#define GlintPointTable1Sec 0x8088
-#define GlintPointTable1SecReg 3
-#define GlintPointTable1SecOff 0x7088
-
-#define GlintPointTable2 0x8090
-#define GlintPointTable2Tag 0x0012
-#define GlintPointTable2Reg 1
-#define GlintPointTable2Off 0x7090
-#define GlintPointTable2Sec 0x8090
-#define GlintPointTable2SecReg 3
-#define GlintPointTable2SecOff 0x7090
-
-#define GlintPointTable3 0x8098
-#define GlintPointTable3Tag 0x0013
-#define GlintPointTable3Reg 1
-#define GlintPointTable3Off 0x7098
-#define GlintPointTable3Sec 0x8098
-#define GlintPointTable3SecReg 3
-#define GlintPointTable3SecOff 0x7098
-
-#define GlintRasterizerMode 0x80a0
-#define GlintRasterizerModeTag 0x0014
-#define GlintRasterizerModeReg 1
-#define GlintRasterizerModeOff 0x70a0
-#define GlintRasterizerModeSec 0x80a0
-#define GlintRasterizerModeSecReg 3
-#define GlintRasterizerModeSecOff 0x70a0
-
-#define GlintYLimits 0x80a8
-#define GlintYLimitsTag 0x0015
-#define GlintYLimitsReg 1
-#define GlintYLimitsOff 0x70a8
-#define GlintYLimitsSec 0x80a8
-#define GlintYLimitsSecReg 3
-#define GlintYLimitsSecOff 0x70a8
-
-#define GlintScanLineOwnership 0x80b0
-#define GlintScanLineOwnershipTag 0x0016
-#define GlintScanLineOwnershipReg 1
-#define GlintScanLineOwnershipOff 0x70b0
-#define GlintScanLineOwnershipSec 0x80b0
-#define GlintScanLineOwnershipSecReg 3
-#define GlintScanLineOwnershipSecOff 0x70b0
-
-#define GlintWaitForCompletion 0x80b8
-#define GlintWaitForCompletionTag 0x0017
-#define GlintWaitForCompletionReg 1
-#define GlintWaitForCompletionOff 0x70b8
-#define GlintWaitForCompletionSec 0x80b8
-#define GlintWaitForCompletionSecReg 3
-#define GlintWaitForCompletionSecOff 0x70b8
-
-#define GlintPixelSize 0x80c0
-#define GlintPixelSizeTag 0x0018
-#define GlintPixelSizeReg 1
-#define GlintPixelSizeOff 0x70c0
-#define GlintPixelSizeSec 0x80c0
-#define GlintPixelSizeSecReg 3
-#define GlintPixelSizeSecOff 0x70c0
-
-#define GlintScissorMode 0x8180
-#define GlintScissorModeTag 0x0030
-#define GlintScissorModeReg 1
-#define GlintScissorModeOff 0x7180
-#define GlintScissorModeSec 0x8180
-#define GlintScissorModeSecReg 3
-#define GlintScissorModeSecOff 0x7180
-
-#define GlintScissorMinXY 0x8188
-#define GlintScissorMinXYTag 0x0031
-#define GlintScissorMinXYReg 1
-#define GlintScissorMinXYOff 0x7188
-#define GlintScissorMinXYSec 0x8188
-#define GlintScissorMinXYSecReg 3
-#define GlintScissorMinXYSecOff 0x7188
-
-#define GlintScissorMaxXY 0x8190
-#define GlintScissorMaxXYTag 0x0032
-#define GlintScissorMaxXYReg 1
-#define GlintScissorMaxXYOff 0x7190
-#define GlintScissorMaxXYSec 0x8190
-#define GlintScissorMaxXYSecReg 3
-#define GlintScissorMaxXYSecOff 0x7190
-
-#define GlintScreenSize 0x8198
-#define GlintScreenSizeTag 0x0033
-#define GlintScreenSizeReg 1
-#define GlintScreenSizeOff 0x7198
-#define GlintScreenSizeSec 0x8198
-#define GlintScreenSizeSecReg 3
-#define GlintScreenSizeSecOff 0x7198
-
-#define GlintAreaStippleMode 0x81a0
-#define GlintAreaStippleModeTag 0x0034
-#define GlintAreaStippleModeReg 1
-#define GlintAreaStippleModeOff 0x71a0
-#define GlintAreaStippleModeSec 0x81a0
-#define GlintAreaStippleModeSecReg 3
-#define GlintAreaStippleModeSecOff 0x71a0
-
-#define GlintLineStippleMode 0x81a8
-#define GlintLineStippleModeTag 0x0035
-#define GlintLineStippleModeReg 1
-#define GlintLineStippleModeOff 0x71a8
-#define GlintLineStippleModeSec 0x81a8
-#define GlintLineStippleModeSecReg 3
-#define GlintLineStippleModeSecOff 0x71a8
-
-#define GlintLoadLineStippleCounters 0x81b0
-#define GlintLoadLineStippleCountersTag 0x0036
-#define GlintLoadLineStippleCountersReg 1
-#define GlintLoadLineStippleCountersOff 0x71b0
-#define GlintLoadLineStippleCountersSec 0x81b0
-#define GlintLoadLineStippleCountersSecReg 3
-#define GlintLoadLineStippleCountersSecOff 0x71b0
-
-#define GlintUpdateLineStippleCounters 0x81b8
-#define GlintUpdateLineStippleCountersTag 0x0037
-#define GlintUpdateLineStippleCountersReg 1
-#define GlintUpdateLineStippleCountersOff 0x71b8
-#define GlintUpdateLineStippleCountersSec 0x81b8
-#define GlintUpdateLineStippleCountersSecReg 3
-#define GlintUpdateLineStippleCountersSecOff 0x71b8
-
-#define GlintSaveLineStippleState 0x81c0
-#define GlintSaveLineStippleStateTag 0x0038
-#define GlintSaveLineStippleStateReg 1
-#define GlintSaveLineStippleStateOff 0x71c0
-#define GlintSaveLineStippleStateSec 0x81c0
-#define GlintSaveLineStippleStateSecReg 3
-#define GlintSaveLineStippleStateSecOff 0x71c0
-
-#define GlintWindowOrigin 0x81c8
-#define GlintWindowOriginTag 0x0039
-#define GlintWindowOriginReg 1
-#define GlintWindowOriginOff 0x71c8
-#define GlintWindowOriginSec 0x81c8
-#define GlintWindowOriginSecReg 3
-#define GlintWindowOriginSecOff 0x71c8
-
-#define GlintAreaStipplePattern0 0x8200
-#define GlintAreaStipplePattern0Tag 0x0040
-#define GlintAreaStipplePattern0Reg 1
-#define GlintAreaStipplePattern0Off 0x7200
-#define GlintAreaStipplePattern0Sec 0x8200
-#define GlintAreaStipplePattern0SecReg 3
-#define GlintAreaStipplePattern0SecOff 0x7200
-
-#define GlintAreaStipplePattern1 0x8208
-#define GlintAreaStipplePattern1Tag 0x0041
-#define GlintAreaStipplePattern1Reg 1
-#define GlintAreaStipplePattern1Off 0x7208
-#define GlintAreaStipplePattern1Sec 0x8208
-#define GlintAreaStipplePattern1SecReg 3
-#define GlintAreaStipplePattern1SecOff 0x7208
-
-#define GlintAreaStipplePattern2 0x8210
-#define GlintAreaStipplePattern2Tag 0x0042
-#define GlintAreaStipplePattern2Reg 1
-#define GlintAreaStipplePattern2Off 0x7210
-#define GlintAreaStipplePattern2Sec 0x8210
-#define GlintAreaStipplePattern2SecReg 3
-#define GlintAreaStipplePattern2SecOff 0x7210
-
-#define GlintAreaStipplePattern3 0x8218
-#define GlintAreaStipplePattern3Tag 0x0043
-#define GlintAreaStipplePattern3Reg 1
-#define GlintAreaStipplePattern3Off 0x7218
-#define GlintAreaStipplePattern3Sec 0x8218
-#define GlintAreaStipplePattern3SecReg 3
-#define GlintAreaStipplePattern3SecOff 0x7218
-
-#define GlintAreaStipplePattern4 0x8220
-#define GlintAreaStipplePattern4Tag 0x0044
-#define GlintAreaStipplePattern4Reg 1
-#define GlintAreaStipplePattern4Off 0x7220
-#define GlintAreaStipplePattern4Sec 0x8220
-#define GlintAreaStipplePattern4SecReg 3
-#define GlintAreaStipplePattern4SecOff 0x7220
-
-#define GlintAreaStipplePattern5 0x8228
-#define GlintAreaStipplePattern5Tag 0x0045
-#define GlintAreaStipplePattern5Reg 1
-#define GlintAreaStipplePattern5Off 0x7228
-#define GlintAreaStipplePattern5Sec 0x8228
-#define GlintAreaStipplePattern5SecReg 3
-#define GlintAreaStipplePattern5SecOff 0x7228
-
-#define GlintAreaStipplePattern6 0x8230
-#define GlintAreaStipplePattern6Tag 0x0046
-#define GlintAreaStipplePattern6Reg 1
-#define GlintAreaStipplePattern6Off 0x7230
-#define GlintAreaStipplePattern6Sec 0x8230
-#define GlintAreaStipplePattern6SecReg 3
-#define GlintAreaStipplePattern6SecOff 0x7230
-
-#define GlintAreaStipplePattern7 0x8238
-#define GlintAreaStipplePattern7Tag 0x0047
-#define GlintAreaStipplePattern7Reg 1
-#define GlintAreaStipplePattern7Off 0x7238
-#define GlintAreaStipplePattern7Sec 0x8238
-#define GlintAreaStipplePattern7SecReg 3
-#define GlintAreaStipplePattern7SecOff 0x7238
-
-#define GlintAreaStipplePattern8 0x8240
-#define GlintAreaStipplePattern8Tag 0x0048
-#define GlintAreaStipplePattern8Reg 1
-#define GlintAreaStipplePattern8Off 0x7240
-#define GlintAreaStipplePattern8Sec 0x8240
-#define GlintAreaStipplePattern8SecReg 3
-#define GlintAreaStipplePattern8SecOff 0x7240
-
-#define GlintAreaStipplePattern9 0x8248
-#define GlintAreaStipplePattern9Tag 0x0049
-#define GlintAreaStipplePattern9Reg 1
-#define GlintAreaStipplePattern9Off 0x7248
-#define GlintAreaStipplePattern9Sec 0x8248
-#define GlintAreaStipplePattern9SecReg 3
-#define GlintAreaStipplePattern9SecOff 0x7248
-
-#define GlintAreaStipplePattern10 0x8250
-#define GlintAreaStipplePattern10Tag 0x004a
-#define GlintAreaStipplePattern10Reg 1
-#define GlintAreaStipplePattern10Off 0x7250
-#define GlintAreaStipplePattern10Sec 0x8250
-#define GlintAreaStipplePattern10SecReg 3
-#define GlintAreaStipplePattern10SecOff 0x7250
-
-#define GlintAreaStipplePattern11 0x8258
-#define GlintAreaStipplePattern11Tag 0x004b
-#define GlintAreaStipplePattern11Reg 1
-#define GlintAreaStipplePattern11Off 0x7258
-#define GlintAreaStipplePattern11Sec 0x8258
-#define GlintAreaStipplePattern11SecReg 3
-#define GlintAreaStipplePattern11SecOff 0x7258
-
-#define GlintAreaStipplePattern12 0x8260
-#define GlintAreaStipplePattern12Tag 0x004c
-#define GlintAreaStipplePattern12Reg 1
-#define GlintAreaStipplePattern12Off 0x7260
-#define GlintAreaStipplePattern12Sec 0x8260
-#define GlintAreaStipplePattern12SecReg 3
-#define GlintAreaStipplePattern12SecOff 0x7260
-
-#define GlintAreaStipplePattern13 0x8268
-#define GlintAreaStipplePattern13Tag 0x004d
-#define GlintAreaStipplePattern13Reg 1
-#define GlintAreaStipplePattern13Off 0x7268
-#define GlintAreaStipplePattern13Sec 0x8268
-#define GlintAreaStipplePattern13SecReg 3
-#define GlintAreaStipplePattern13SecOff 0x7268
-
-#define GlintAreaStipplePattern14 0x8270
-#define GlintAreaStipplePattern14Tag 0x004e
-#define GlintAreaStipplePattern14Reg 1
-#define GlintAreaStipplePattern14Off 0x7270
-#define GlintAreaStipplePattern14Sec 0x8270
-#define GlintAreaStipplePattern14SecReg 3
-#define GlintAreaStipplePattern14SecOff 0x7270
-
-#define GlintAreaStipplePattern15 0x8278
-#define GlintAreaStipplePattern15Tag 0x004f
-#define GlintAreaStipplePattern15Reg 1
-#define GlintAreaStipplePattern15Off 0x7278
-#define GlintAreaStipplePattern15Sec 0x8278
-#define GlintAreaStipplePattern15SecReg 3
-#define GlintAreaStipplePattern15SecOff 0x7278
-
-#define GlintAreaStipplePattern16 0x8280
-#define GlintAreaStipplePattern16Tag 0x0050
-#define GlintAreaStipplePattern16Reg 1
-#define GlintAreaStipplePattern16Off 0x7280
-#define GlintAreaStipplePattern16Sec 0x8280
-#define GlintAreaStipplePattern16SecReg 3
-#define GlintAreaStipplePattern16SecOff 0x7280
-
-#define GlintAreaStipplePattern17 0x8288
-#define GlintAreaStipplePattern17Tag 0x0051
-#define GlintAreaStipplePattern17Reg 1
-#define GlintAreaStipplePattern17Off 0x7288
-#define GlintAreaStipplePattern17Sec 0x8288
-#define GlintAreaStipplePattern17SecReg 3
-#define GlintAreaStipplePattern17SecOff 0x7288
-
-#define GlintAreaStipplePattern18 0x8290
-#define GlintAreaStipplePattern18Tag 0x0052
-#define GlintAreaStipplePattern18Reg 1
-#define GlintAreaStipplePattern18Off 0x7290
-#define GlintAreaStipplePattern18Sec 0x8290
-#define GlintAreaStipplePattern18SecReg 3
-#define GlintAreaStipplePattern18SecOff 0x7290
-
-#define GlintAreaStipplePattern19 0x8298
-#define GlintAreaStipplePattern19Tag 0x0053
-#define GlintAreaStipplePattern19Reg 1
-#define GlintAreaStipplePattern19Off 0x7298
-#define GlintAreaStipplePattern19Sec 0x8298
-#define GlintAreaStipplePattern19SecReg 3
-#define GlintAreaStipplePattern19SecOff 0x7298
-
-#define GlintAreaStipplePattern20 0x82a0
-#define GlintAreaStipplePattern20Tag 0x0054
-#define GlintAreaStipplePattern20Reg 1
-#define GlintAreaStipplePattern20Off 0x72a0
-#define GlintAreaStipplePattern20Sec 0x82a0
-#define GlintAreaStipplePattern20SecReg 3
-#define GlintAreaStipplePattern20SecOff 0x72a0
-
-#define GlintAreaStipplePattern21 0x82a8
-#define GlintAreaStipplePattern21Tag 0x0055
-#define GlintAreaStipplePattern21Reg 1
-#define GlintAreaStipplePattern21Off 0x72a8
-#define GlintAreaStipplePattern21Sec 0x82a8
-#define GlintAreaStipplePattern21SecReg 3
-#define GlintAreaStipplePattern21SecOff 0x72a8
-
-#define GlintAreaStipplePattern22 0x82b0
-#define GlintAreaStipplePattern22Tag 0x0056
-#define GlintAreaStipplePattern22Reg 1
-#define GlintAreaStipplePattern22Off 0x72b0
-#define GlintAreaStipplePattern22Sec 0x82b0
-#define GlintAreaStipplePattern22SecReg 3
-#define GlintAreaStipplePattern22SecOff 0x72b0
-
-#define GlintAreaStipplePattern23 0x82b8
-#define GlintAreaStipplePattern23Tag 0x0057
-#define GlintAreaStipplePattern23Reg 1
-#define GlintAreaStipplePattern23Off 0x72b8
-#define GlintAreaStipplePattern23Sec 0x82b8
-#define GlintAreaStipplePattern23SecReg 3
-#define GlintAreaStipplePattern23SecOff 0x72b8
-
-#define GlintAreaStipplePattern24 0x82c0
-#define GlintAreaStipplePattern24Tag 0x0058
-#define GlintAreaStipplePattern24Reg 1
-#define GlintAreaStipplePattern24Off 0x72c0
-#define GlintAreaStipplePattern24Sec 0x82c0
-#define GlintAreaStipplePattern24SecReg 3
-#define GlintAreaStipplePattern24SecOff 0x72c0
-
-#define GlintAreaStipplePattern25 0x82c8
-#define GlintAreaStipplePattern25Tag 0x0059
-#define GlintAreaStipplePattern25Reg 1
-#define GlintAreaStipplePattern25Off 0x72c8
-#define GlintAreaStipplePattern25Sec 0x82c8
-#define GlintAreaStipplePattern25SecReg 3
-#define GlintAreaStipplePattern25SecOff 0x72c8
-
-#define GlintAreaStipplePattern26 0x82d0
-#define GlintAreaStipplePattern26Tag 0x005a
-#define GlintAreaStipplePattern26Reg 1
-#define GlintAreaStipplePattern26Off 0x72d0
-#define GlintAreaStipplePattern26Sec 0x82d0
-#define GlintAreaStipplePattern26SecReg 3
-#define GlintAreaStipplePattern26SecOff 0x72d0
-
-#define GlintAreaStipplePattern27 0x82d8
-#define GlintAreaStipplePattern27Tag 0x005b
-#define GlintAreaStipplePattern27Reg 1
-#define GlintAreaStipplePattern27Off 0x72d8
-#define GlintAreaStipplePattern27Sec 0x82d8
-#define GlintAreaStipplePattern27SecReg 3
-#define GlintAreaStipplePattern27SecOff 0x72d8
-
-#define GlintAreaStipplePattern28 0x82e0
-#define GlintAreaStipplePattern28Tag 0x005c
-#define GlintAreaStipplePattern28Reg 1
-#define GlintAreaStipplePattern28Off 0x72e0
-#define GlintAreaStipplePattern28Sec 0x82e0
-#define GlintAreaStipplePattern28SecReg 3
-#define GlintAreaStipplePattern28SecOff 0x72e0
-
-#define GlintAreaStipplePattern29 0x82e8
-#define GlintAreaStipplePattern29Tag 0x005d
-#define GlintAreaStipplePattern29Reg 1
-#define GlintAreaStipplePattern29Off 0x72e8
-#define GlintAreaStipplePattern29Sec 0x82e8
-#define GlintAreaStipplePattern29SecReg 3
-#define GlintAreaStipplePattern29SecOff 0x72e8
-
-#define GlintAreaStipplePattern30 0x82f0
-#define GlintAreaStipplePattern30Tag 0x005e
-#define GlintAreaStipplePattern30Reg 1
-#define GlintAreaStipplePattern30Off 0x72f0
-#define GlintAreaStipplePattern30Sec 0x82f0
-#define GlintAreaStipplePattern30SecReg 3
-#define GlintAreaStipplePattern30SecOff 0x72f0
-
-#define GlintAreaStipplePattern31 0x82f8
-#define GlintAreaStipplePattern31Tag 0x005f
-#define GlintAreaStipplePattern31Reg 1
-#define GlintAreaStipplePattern31Off 0x72f8
-#define GlintAreaStipplePattern31Sec 0x82f8
-#define GlintAreaStipplePattern31SecReg 3
-#define GlintAreaStipplePattern31SecOff 0x72f8
-
-#define GlintRouterMode 0x8840
-#define GlintRouterModeTag 0x0108
-#define GlintRouterModeReg 1
-#define GlintRouterModeOff 0x7840
-#define GlintRouterModeSec 0x8840
-#define GlintRouterModeSecReg 3
-#define GlintRouterModeSecOff 0x7840
-
-#define GlintTextureAddressMode 0x8380
-#define GlintTextureAddressModeTag 0x0070
-#define GlintTextureAddressModeReg 1
-#define GlintTextureAddressModeOff 0x7380
-#define GlintTextureAddressModeSec 0x8380
-#define GlintTextureAddressModeSecReg 3
-#define GlintTextureAddressModeSecOff 0x7380
-
-#define GlintSStart 0x8388
-#define GlintSStartTag 0x0071
-#define GlintSStartReg 1
-#define GlintSStartOff 0x7388
-#define GlintSStartSec 0x8388
-#define GlintSStartSecReg 3
-#define GlintSStartSecOff 0x7388
-
-#define GlintdSdx 0x8390
-#define GlintdSdxTag 0x0072
-#define GlintdSdxReg 1
-#define GlintdSdxOff 0x7390
-#define GlintdSdxSec 0x8390
-#define GlintdSdxSecReg 3
-#define GlintdSdxSecOff 0x7390
-
-#define GlintdSdyDom 0x8398
-#define GlintdSdyDomTag 0x0073
-#define GlintdSdyDomReg 1
-#define GlintdSdyDomOff 0x7398
-#define GlintdSdyDomSec 0x8398
-#define GlintdSdyDomSecReg 3
-#define GlintdSdyDomSecOff 0x7398
-
-#define GlintTStart 0x83a0
-#define GlintTStartTag 0x0074
-#define GlintTStartReg 1
-#define GlintTStartOff 0x73a0
-#define GlintTStartSec 0x83a0
-#define GlintTStartSecReg 3
-#define GlintTStartSecOff 0x73a0
-
-#define GlintdTdx 0x83a8
-#define GlintdTdxTag 0x0075
-#define GlintdTdxReg 1
-#define GlintdTdxOff 0x73a8
-#define GlintdTdxSec 0x83a8
-#define GlintdTdxSecReg 3
-#define GlintdTdxSecOff 0x73a8
-
-#define GlintdTdyDom 0x83b0
-#define GlintdTdyDomTag 0x0076
-#define GlintdTdyDomReg 1
-#define GlintdTdyDomOff 0x73b0
-#define GlintdTdyDomSec 0x83b0
-#define GlintdTdyDomSecReg 3
-#define GlintdTdyDomSecOff 0x73b0
-
-#define GlintQStart 0x83b8
-#define GlintQStartTag 0x0077
-#define GlintQStartReg 1
-#define GlintQStartOff 0x73b8
-#define GlintQStartSec 0x83b8
-#define GlintQStartSecReg 3
-#define GlintQStartSecOff 0x73b8
-
-#define GlintdQdx 0x83c0
-#define GlintdQdxTag 0x0078
-#define GlintdQdxReg 1
-#define GlintdQdxOff 0x73c0
-#define GlintdQdxSec 0x83c0
-#define GlintdQdxSecReg 3
-#define GlintdQdxSecOff 0x73c0
-
-#define GlintdQdyDom 0x83c8
-#define GlintdQdyDomTag 0x0079
-#define GlintdQdyDomReg 1
-#define GlintdQdyDomOff 0x73c8
-#define GlintdQdyDomSec 0x83c8
-#define GlintdQdyDomSecReg 3
-#define GlintdQdyDomSecOff 0x73c8
-
-#define GlintLOD 0x83d0
-#define GlintLODTag 0x007a
-#define GlintLODReg 1
-#define GlintLODOff 0x73d0
-#define GlintLODSec 0x83d0
-#define GlintLODSecReg 3
-#define GlintLODSecOff 0x73d0
-
-#define GlintdSdy 0x83d8
-#define GlintdSdyTag 0x007b
-#define GlintdSdyReg 1
-#define GlintdSdyOff 0x73d8
-#define GlintdSdySec 0x83d8
-#define GlintdSdySecReg 3
-#define GlintdSdySecOff 0x73d8
-
-#define GlintdTdy 0x83e0
-#define GlintdTdyTag 0x007c
-#define GlintdTdyReg 1
-#define GlintdTdyOff 0x73e0
-#define GlintdTdySec 0x83e0
-#define GlintdTdySecReg 3
-#define GlintdTdySecOff 0x73e0
-
-#define GlintdQdy 0x83e8
-#define GlintdQdyTag 0x007d
-#define GlintdQdyReg 1
-#define GlintdQdyOff 0x73e8
-#define GlintdQdySec 0x83e8
-#define GlintdQdySecReg 3
-#define GlintdQdySecOff 0x73e8
-
-#define GlintTextureReadMode 0x8480
-#define GlintTextureReadModeTag 0x0090
-#define GlintTextureReadModeReg 1
-#define GlintTextureReadModeOff 0x7480
-#define GlintTextureReadModeSec 0x8480
-#define GlintTextureReadModeSecReg 3
-#define GlintTextureReadModeSecOff 0x7480
-
-#define GlintTextureFormat 0x8488
-#define GlintTextureFormatTag 0x0091
-#define GlintTextureFormatReg 1
-#define GlintTextureFormatOff 0x7488
-#define GlintTextureFormatSec 0x8488
-#define GlintTextureFormatSecReg 3
-#define GlintTextureFormatSecOff 0x7488
-
-#define GlintTextureCacheControl 0x8490
-#define GlintTextureCacheControlTag 0x0092
-#define GlintTextureCacheControlReg 1
-#define GlintTextureCacheControlOff 0x7490
-#define GlintTextureCacheControlSec 0x8490
-#define GlintTextureCacheControlSecReg 3
-#define GlintTextureCacheControlSecOff 0x7490
-
-#define GlintGLINTBorderColor 0x84a8
-#define GlintGLINTBorderColorTag 0x0095
-#define GlintGLINTBorderColorReg 1
-#define GlintGLINTBorderColorOff 0x74a8
-#define GlintGLINTBorderColorSec 0x84a8
-#define GlintGLINTBorderColorSecReg 3
-#define GlintGLINTBorderColorSecOff 0x74a8
-
-#define GlintTexelLUTIndex 0x84c0
-#define GlintTexelLUTIndexTag 0x0098
-#define GlintTexelLUTIndexReg 1
-#define GlintTexelLUTIndexOff 0x74c0
-#define GlintTexelLUTIndexSec 0x84c0
-#define GlintTexelLUTIndexSecReg 3
-#define GlintTexelLUTIndexSecOff 0x74c0
-
-#define GlintTexelLUTData 0x84c8
-#define GlintTexelLUTDataTag 0x0099
-#define GlintTexelLUTDataReg 1
-#define GlintTexelLUTDataOff 0x74c8
-#define GlintTexelLUTDataSec 0x84c8
-#define GlintTexelLUTDataSecReg 3
-#define GlintTexelLUTDataSecOff 0x74c8
-
-#define GlintTexelLUTAddress 0x84d0
-#define GlintTexelLUTAddressTag 0x009a
-#define GlintTexelLUTAddressReg 1
-#define GlintTexelLUTAddressOff 0x74d0
-#define GlintTexelLUTAddressSec 0x84d0
-#define GlintTexelLUTAddressSecReg 3
-#define GlintTexelLUTAddressSecOff 0x74d0
-
-#define GlintTexelLUTTransfer 0x84d8
-#define GlintTexelLUTTransferTag 0x009b
-#define GlintTexelLUTTransferReg 1
-#define GlintTexelLUTTransferOff 0x74d8
-#define GlintTexelLUTTransferSec 0x84d8
-#define GlintTexelLUTTransferSecReg 3
-#define GlintTexelLUTTransferSecOff 0x74d8
-
-#define GlintTextureFilterMode 0x84e0
-#define GlintTextureFilterModeTag 0x009c
-#define GlintTextureFilterModeReg 1
-#define GlintTextureFilterModeOff 0x74e0
-#define GlintTextureFilterModeSec 0x84e0
-#define GlintTextureFilterModeSecReg 3
-#define GlintTextureFilterModeSecOff 0x74e0
-
-#define GlintTextureChromaUpper 0x84e8
-#define GlintTextureChromaUpperTag 0x009d
-#define GlintTextureChromaUpperReg 1
-#define GlintTextureChromaUpperOff 0x74e8
-#define GlintTextureChromaUpperSec 0x84e8
-#define GlintTextureChromaUpperSecReg 3
-#define GlintTextureChromaUpperSecOff 0x74e8
-
-#define GlintTextureChromaLower 0x84f0
-#define GlintTextureChromaLowerTag 0x009e
-#define GlintTextureChromaLowerReg 1
-#define GlintTextureChromaLowerOff 0x74f0
-#define GlintTextureChromaLowerSec 0x84f0
-#define GlintTextureChromaLowerSecReg 3
-#define GlintTextureChromaLowerSecOff 0x74f0
-
-#define GlintTxBaseAddr0 0x8500
-#define GlintTxBaseAddr0Tag 0x00a0
-#define GlintTxBaseAddr0Reg 1
-#define GlintTxBaseAddr0Off 0x7500
-#define GlintTxBaseAddr0Sec 0x8500
-#define GlintTxBaseAddr0SecReg 3
-#define GlintTxBaseAddr0SecOff 0x7500
-
-#define GlintTxBaseAddr1 0x8508
-#define GlintTxBaseAddr1Tag 0x00a1
-#define GlintTxBaseAddr1Reg 1
-#define GlintTxBaseAddr1Off 0x7508
-#define GlintTxBaseAddr1Sec 0x8508
-#define GlintTxBaseAddr1SecReg 3
-#define GlintTxBaseAddr1SecOff 0x7508
-
-#define GlintTxBaseAddr2 0x8510
-#define GlintTxBaseAddr2Tag 0x00a2
-#define GlintTxBaseAddr2Reg 1
-#define GlintTxBaseAddr2Off 0x7510
-#define GlintTxBaseAddr2Sec 0x8510
-#define GlintTxBaseAddr2SecReg 3
-#define GlintTxBaseAddr2SecOff 0x7510
-
-#define GlintTxBaseAddr3 0x8518
-#define GlintTxBaseAddr3Tag 0x00a3
-#define GlintTxBaseAddr3Reg 1
-#define GlintTxBaseAddr3Off 0x7518
-#define GlintTxBaseAddr3Sec 0x8518
-#define GlintTxBaseAddr3SecReg 3
-#define GlintTxBaseAddr3SecOff 0x7518
-
-#define GlintTxBaseAddr4 0x8520
-#define GlintTxBaseAddr4Tag 0x00a4
-#define GlintTxBaseAddr4Reg 1
-#define GlintTxBaseAddr4Off 0x7520
-#define GlintTxBaseAddr4Sec 0x8520
-#define GlintTxBaseAddr4SecReg 3
-#define GlintTxBaseAddr4SecOff 0x7520
-
-#define GlintTxBaseAddr5 0x8528
-#define GlintTxBaseAddr5Tag 0x00a5
-#define GlintTxBaseAddr5Reg 1
-#define GlintTxBaseAddr5Off 0x7528
-#define GlintTxBaseAddr5Sec 0x8528
-#define GlintTxBaseAddr5SecReg 3
-#define GlintTxBaseAddr5SecOff 0x7528
-
-#define GlintTxBaseAddr6 0x8530
-#define GlintTxBaseAddr6Tag 0x00a6
-#define GlintTxBaseAddr6Reg 1
-#define GlintTxBaseAddr6Off 0x7530
-#define GlintTxBaseAddr6Sec 0x8530
-#define GlintTxBaseAddr6SecReg 3
-#define GlintTxBaseAddr6SecOff 0x7530
-
-#define GlintTxBaseAddr7 0x8538
-#define GlintTxBaseAddr7Tag 0x00a7
-#define GlintTxBaseAddr7Reg 1
-#define GlintTxBaseAddr7Off 0x7538
-#define GlintTxBaseAddr7Sec 0x8538
-#define GlintTxBaseAddr7SecReg 3
-#define GlintTxBaseAddr7SecOff 0x7538
-
-#define GlintTxBaseAddr8 0x8540
-#define GlintTxBaseAddr8Tag 0x00a8
-#define GlintTxBaseAddr8Reg 1
-#define GlintTxBaseAddr8Off 0x7540
-#define GlintTxBaseAddr8Sec 0x8540
-#define GlintTxBaseAddr8SecReg 3
-#define GlintTxBaseAddr8SecOff 0x7540
-
-#define GlintTxBaseAddr9 0x8548
-#define GlintTxBaseAddr9Tag 0x00a9
-#define GlintTxBaseAddr9Reg 1
-#define GlintTxBaseAddr9Off 0x7548
-#define GlintTxBaseAddr9Sec 0x8548
-#define GlintTxBaseAddr9SecReg 3
-#define GlintTxBaseAddr9SecOff 0x7548
-
-#define GlintTxBaseAddr10 0x8550
-#define GlintTxBaseAddr10Tag 0x00aa
-#define GlintTxBaseAddr10Reg 1
-#define GlintTxBaseAddr10Off 0x7550
-#define GlintTxBaseAddr10Sec 0x8550
-#define GlintTxBaseAddr10SecReg 3
-#define GlintTxBaseAddr10SecOff 0x7550
-
-#define GlintTxBaseAddr11 0x8558
-#define GlintTxBaseAddr11Tag 0x00ab
-#define GlintTxBaseAddr11Reg 1
-#define GlintTxBaseAddr11Off 0x7558
-#define GlintTxBaseAddr11Sec 0x8558
-#define GlintTxBaseAddr11SecReg 3
-#define GlintTxBaseAddr11SecOff 0x7558
-
-#define GlintTxBaseAddr12 0x8560
-#define GlintTxBaseAddr12Tag 0x00ac
-#define GlintTxBaseAddr12Reg 1
-#define GlintTxBaseAddr12Off 0x7560
-#define GlintTxBaseAddr12Sec 0x8560
-#define GlintTxBaseAddr12SecReg 3
-#define GlintTxBaseAddr12SecOff 0x7560
-
-#define GlintTexelLUT0 0x8e80
-#define GlintTexelLUT0Tag 0x01d0
-#define GlintTexelLUT0Reg 1
-#define GlintTexelLUT0Off 0x7e80
-#define GlintTexelLUT0Sec 0x8e80
-#define GlintTexelLUT0SecReg 3
-#define GlintTexelLUT0SecOff 0x7e80
-
-#define GlintTexelLUT1 0x8e88
-#define GlintTexelLUT1Tag 0x01d1
-#define GlintTexelLUT1Reg 1
-#define GlintTexelLUT1Off 0x7e88
-#define GlintTexelLUT1Sec 0x8e88
-#define GlintTexelLUT1SecReg 3
-#define GlintTexelLUT1SecOff 0x7e88
-
-#define GlintTexelLUT2 0x8e90
-#define GlintTexelLUT2Tag 0x01d2
-#define GlintTexelLUT2Reg 1
-#define GlintTexelLUT2Off 0x7e90
-#define GlintTexelLUT2Sec 0x8e90
-#define GlintTexelLUT2SecReg 3
-#define GlintTexelLUT2SecOff 0x7e90
-
-#define GlintTexelLUT3 0x8e98
-#define GlintTexelLUT3Tag 0x01d3
-#define GlintTexelLUT3Reg 1
-#define GlintTexelLUT3Off 0x7e98
-#define GlintTexelLUT3Sec 0x8e98
-#define GlintTexelLUT3SecReg 3
-#define GlintTexelLUT3SecOff 0x7e98
-
-#define GlintTexelLUT4 0x8ea0
-#define GlintTexelLUT4Tag 0x01d4
-#define GlintTexelLUT4Reg 1
-#define GlintTexelLUT4Off 0x7ea0
-#define GlintTexelLUT4Sec 0x8ea0
-#define GlintTexelLUT4SecReg 3
-#define GlintTexelLUT4SecOff 0x7ea0
-
-#define GlintTexelLUT5 0x8ea8
-#define GlintTexelLUT5Tag 0x01d5
-#define GlintTexelLUT5Reg 1
-#define GlintTexelLUT5Off 0x7ea8
-#define GlintTexelLUT5Sec 0x8ea8
-#define GlintTexelLUT5SecReg 3
-#define GlintTexelLUT5SecOff 0x7ea8
-
-#define GlintTexelLUT6 0x8eb0
-#define GlintTexelLUT6Tag 0x01d6
-#define GlintTexelLUT6Reg 1
-#define GlintTexelLUT6Off 0x7eb0
-#define GlintTexelLUT6Sec 0x8eb0
-#define GlintTexelLUT6SecReg 3
-#define GlintTexelLUT6SecOff 0x7eb0
-
-#define GlintTexelLUT7 0x8eb8
-#define GlintTexelLUT7Tag 0x01d7
-#define GlintTexelLUT7Reg 1
-#define GlintTexelLUT7Off 0x7eb8
-#define GlintTexelLUT7Sec 0x8eb8
-#define GlintTexelLUT7SecReg 3
-#define GlintTexelLUT7SecOff 0x7eb8
-
-#define GlintTexelLUT8 0x8ec0
-#define GlintTexelLUT8Tag 0x01d8
-#define GlintTexelLUT8Reg 1
-#define GlintTexelLUT8Off 0x7ec0
-#define GlintTexelLUT8Sec 0x8ec0
-#define GlintTexelLUT8SecReg 3
-#define GlintTexelLUT8SecOff 0x7ec0
-
-#define GlintTexelLUT9 0x8ec8
-#define GlintTexelLUT9Tag 0x01d9
-#define GlintTexelLUT9Reg 1
-#define GlintTexelLUT9Off 0x7ec8
-#define GlintTexelLUT9Sec 0x8ec8
-#define GlintTexelLUT9SecReg 3
-#define GlintTexelLUT9SecOff 0x7ec8
-
-#define GlintTexelLUT10 0x8ed0
-#define GlintTexelLUT10Tag 0x01da
-#define GlintTexelLUT10Reg 1
-#define GlintTexelLUT10Off 0x7ed0
-#define GlintTexelLUT10Sec 0x8ed0
-#define GlintTexelLUT10SecReg 3
-#define GlintTexelLUT10SecOff 0x7ed0
-
-#define GlintTexelLUT11 0x8ed8
-#define GlintTexelLUT11Tag 0x01db
-#define GlintTexelLUT11Reg 1
-#define GlintTexelLUT11Off 0x7ed8
-#define GlintTexelLUT11Sec 0x8ed8
-#define GlintTexelLUT11SecReg 3
-#define GlintTexelLUT11SecOff 0x7ed8
-
-#define GlintTexelLUT12 0x8ee0
-#define GlintTexelLUT12Tag 0x01dc
-#define GlintTexelLUT12Reg 1
-#define GlintTexelLUT12Off 0x7ee0
-#define GlintTexelLUT12Sec 0x8ee0
-#define GlintTexelLUT12SecReg 3
-#define GlintTexelLUT12SecOff 0x7ee0
-
-#define GlintTexelLUT13 0x8ee8
-#define GlintTexelLUT13Tag 0x01dd
-#define GlintTexelLUT13Reg 1
-#define GlintTexelLUT13Off 0x7ee8
-#define GlintTexelLUT13Sec 0x8ee8
-#define GlintTexelLUT13SecReg 3
-#define GlintTexelLUT13SecOff 0x7ee8
-
-#define GlintTexelLUT14 0x8ef0
-#define GlintTexelLUT14Tag 0x01de
-#define GlintTexelLUT14Reg 1
-#define GlintTexelLUT14Off 0x7ef0
-#define GlintTexelLUT14Sec 0x8ef0
-#define GlintTexelLUT14SecReg 3
-#define GlintTexelLUT14SecOff 0x7ef0
-
-#define GlintTexelLUT15 0x8ef8
-#define GlintTexelLUT15Tag 0x01df
-#define GlintTexelLUT15Reg 1
-#define GlintTexelLUT15Off 0x7ef8
-#define GlintTexelLUT15Sec 0x8ef8
-#define GlintTexelLUT15SecReg 3
-#define GlintTexelLUT15SecOff 0x7ef8
-
-#define GlintTexel0 0x8600
-#define GlintTexel0Tag 0x00c0
-#define GlintTexel0Reg 1
-#define GlintTexel0Off 0x7600
-#define GlintTexel0Sec 0x8600
-#define GlintTexel0SecReg 3
-#define GlintTexel0SecOff 0x7600
-
-#define GlintTexel1 0x8608
-#define GlintTexel1Tag 0x00c1
-#define GlintTexel1Reg 1
-#define GlintTexel1Off 0x7608
-#define GlintTexel1Sec 0x8608
-#define GlintTexel1SecReg 3
-#define GlintTexel1SecOff 0x7608
-
-#define GlintTexel2 0x8610
-#define GlintTexel2Tag 0x00c2
-#define GlintTexel2Reg 1
-#define GlintTexel2Off 0x7610
-#define GlintTexel2Sec 0x8610
-#define GlintTexel2SecReg 3
-#define GlintTexel2SecOff 0x7610
-
-#define GlintTexel3 0x8618
-#define GlintTexel3Tag 0x00c3
-#define GlintTexel3Reg 1
-#define GlintTexel3Off 0x7618
-#define GlintTexel3Sec 0x8618
-#define GlintTexel3SecReg 3
-#define GlintTexel3SecOff 0x7618
-
-#define GlintTexel4 0x8620
-#define GlintTexel4Tag 0x00c4
-#define GlintTexel4Reg 1
-#define GlintTexel4Off 0x7620
-#define GlintTexel4Sec 0x8620
-#define GlintTexel4SecReg 3
-#define GlintTexel4SecOff 0x7620
-
-#define GlintTexel5 0x8628
-#define GlintTexel5Tag 0x00c5
-#define GlintTexel5Reg 1
-#define GlintTexel5Off 0x7628
-#define GlintTexel5Sec 0x8628
-#define GlintTexel5SecReg 3
-#define GlintTexel5SecOff 0x7628
-
-#define GlintTexel6 0x8630
-#define GlintTexel6Tag 0x00c6
-#define GlintTexel6Reg 1
-#define GlintTexel6Off 0x7630
-#define GlintTexel6Sec 0x8630
-#define GlintTexel6SecReg 3
-#define GlintTexel6SecOff 0x7630
-
-#define GlintTexel7 0x8638
-#define GlintTexel7Tag 0x00c7
-#define GlintTexel7Reg 1
-#define GlintTexel7Off 0x7638
-#define GlintTexel7Sec 0x8638
-#define GlintTexel7SecReg 3
-#define GlintTexel7SecOff 0x7638
-
-#define GlintInterp0 0x8640
-#define GlintInterp0Tag 0x00c8
-#define GlintInterp0Reg 1
-#define GlintInterp0Off 0x7640
-#define GlintInterp0Sec 0x8640
-#define GlintInterp0SecReg 3
-#define GlintInterp0SecOff 0x7640
-
-#define GlintInterp1 0x8648
-#define GlintInterp1Tag 0x00c9
-#define GlintInterp1Reg 1
-#define GlintInterp1Off 0x7648
-#define GlintInterp1Sec 0x8648
-#define GlintInterp1SecReg 3
-#define GlintInterp1SecOff 0x7648
-
-#define GlintInterp2 0x8650
-#define GlintInterp2Tag 0x00ca
-#define GlintInterp2Reg 1
-#define GlintInterp2Off 0x7650
-#define GlintInterp2Sec 0x8650
-#define GlintInterp2SecReg 3
-#define GlintInterp2SecOff 0x7650
-
-#define GlintInterp3 0x8658
-#define GlintInterp3Tag 0x00cb
-#define GlintInterp3Reg 1
-#define GlintInterp3Off 0x7658
-#define GlintInterp3Sec 0x8658
-#define GlintInterp3SecReg 3
-#define GlintInterp3SecOff 0x7658
-
-#define GlintInterp4 0x8660
-#define GlintInterp4Tag 0x00cc
-#define GlintInterp4Reg 1
-#define GlintInterp4Off 0x7660
-#define GlintInterp4Sec 0x8660
-#define GlintInterp4SecReg 3
-#define GlintInterp4SecOff 0x7660
-
-#define GlintTextureFilter 0x8668
-#define GlintTextureFilterTag 0x00cd
-#define GlintTextureFilterReg 1
-#define GlintTextureFilterOff 0x7668
-#define GlintTextureFilterSec 0x8668
-#define GlintTextureFilterSecReg 3
-#define GlintTextureFilterSecOff 0x7668
-
-#define GlintTextureColorMode 0x8680
-#define GlintTextureColorModeTag 0x00d0
-#define GlintTextureColorModeReg 1
-#define GlintTextureColorModeOff 0x7680
-#define GlintTextureColorModeSec 0x8680
-#define GlintTextureColorModeSecReg 3
-#define GlintTextureColorModeSecOff 0x7680
-
-#define GlintTextureEnvColor 0x8688
-#define GlintTextureEnvColorTag 0x00d1
-#define GlintTextureEnvColorReg 1
-#define GlintTextureEnvColorOff 0x7688
-#define GlintTextureEnvColorSec 0x8688
-#define GlintTextureEnvColorSecReg 3
-#define GlintTextureEnvColorSecOff 0x7688
-
-#define GlintFogMode 0x8690
-#define GlintFogModeTag 0x00d2
-#define GlintFogModeReg 1
-#define GlintFogModeOff 0x7690
-#define GlintFogModeSec 0x8690
-#define GlintFogModeSecReg 3
-#define GlintFogModeSecOff 0x7690
-
-#define GlintFogColor 0x8698
-#define GlintFogColorTag 0x00d3
-#define GlintFogColorReg 1
-#define GlintFogColorOff 0x7698
-#define GlintFogColorSec 0x8698
-#define GlintFogColorSecReg 3
-#define GlintFogColorSecOff 0x7698
-
-#define GlintFStart 0x86a0
-#define GlintFStartTag 0x00d4
-#define GlintFStartReg 1
-#define GlintFStartOff 0x76a0
-#define GlintFStartSec 0x86a0
-#define GlintFStartSecReg 3
-#define GlintFStartSecOff 0x76a0
-
-#define GlintdFdx 0x86a8
-#define GlintdFdxTag 0x00d5
-#define GlintdFdxReg 1
-#define GlintdFdxOff 0x76a8
-#define GlintdFdxSec 0x86a8
-#define GlintdFdxSecReg 3
-#define GlintdFdxSecOff 0x76a8
-
-#define GlintdFdyDom 0x86b0
-#define GlintdFdyDomTag 0x00d6
-#define GlintdFdyDomReg 1
-#define GlintdFdyDomOff 0x76b0
-#define GlintdFdyDomSec 0x86b0
-#define GlintdFdyDomSecReg 3
-#define GlintdFdyDomSecOff 0x76b0
-
-#define GlintKsStart 0x86c8
-#define GlintKsStartTag 0x00d9
-#define GlintKsStartReg 1
-#define GlintKsStartOff 0x76c8
-#define GlintKsStartSec 0x86c8
-#define GlintKsStartSecReg 3
-#define GlintKsStartSecOff 0x76c8
-
-#define GlintdKsdx 0x86d0
-#define GlintdKsdxTag 0x00da
-#define GlintdKsdxReg 1
-#define GlintdKsdxOff 0x76d0
-#define GlintdKsdxSec 0x86d0
-#define GlintdKsdxSecReg 3
-#define GlintdKsdxSecOff 0x76d0
-
-#define GlintdKsdyDom 0x86d8
-#define GlintdKsdyDomTag 0x00db
-#define GlintdKsdyDomReg 1
-#define GlintdKsdyDomOff 0x76d8
-#define GlintdKsdyDomSec 0x86d8
-#define GlintdKsdyDomSecReg 3
-#define GlintdKsdyDomSecOff 0x76d8
-
-#define GlintKdStart 0x86e0
-#define GlintKdStartTag 0x00dc
-#define GlintKdStartReg 1
-#define GlintKdStartOff 0x76e0
-#define GlintKdStartSec 0x86e0
-#define GlintKdStartSecReg 3
-#define GlintKdStartSecOff 0x76e0
-
-#define GlintdKdStart 0x86e8
-#define GlintdKdStartTag 0x00dd
-#define GlintdKdStartReg 1
-#define GlintdKdStartOff 0x76e8
-#define GlintdKdStartSec 0x86e8
-#define GlintdKdStartSecReg 3
-#define GlintdKdStartSecOff 0x76e8
-
-#define GlintdKddyDom 0x86f0
-#define GlintdKddyDomTag 0x00de
-#define GlintdKddyDomReg 1
-#define GlintdKddyDomOff 0x76f0
-#define GlintdKddyDomSec 0x86f0
-#define GlintdKddyDomSecReg 3
-#define GlintdKddyDomSecOff 0x76f0
-
-#define GlintRStart 0x8780
-#define GlintRStartTag 0x00f0
-#define GlintRStartReg 1
-#define GlintRStartOff 0x7780
-#define GlintRStartSec 0x8780
-#define GlintRStartSecReg 3
-#define GlintRStartSecOff 0x7780
-
-#define GlintdRdx 0x8788
-#define GlintdRdxTag 0x00f1
-#define GlintdRdxReg 1
-#define GlintdRdxOff 0x7788
-#define GlintdRdxSec 0x8788
-#define GlintdRdxSecReg 3
-#define GlintdRdxSecOff 0x7788
-
-#define GlintdRdyDom 0x8790
-#define GlintdRdyDomTag 0x00f2
-#define GlintdRdyDomReg 1
-#define GlintdRdyDomOff 0x7790
-#define GlintdRdyDomSec 0x8790
-#define GlintdRdyDomSecReg 3
-#define GlintdRdyDomSecOff 0x7790
-
-#define GlintGStart 0x8798
-#define GlintGStartTag 0x00f3
-#define GlintGStartReg 1
-#define GlintGStartOff 0x7798
-#define GlintGStartSec 0x8798
-#define GlintGStartSecReg 3
-#define GlintGStartSecOff 0x7798
-
-#define GlintdGdx 0x87a0
-#define GlintdGdxTag 0x00f4
-#define GlintdGdxReg 1
-#define GlintdGdxOff 0x77a0
-#define GlintdGdxSec 0x87a0
-#define GlintdGdxSecReg 3
-#define GlintdGdxSecOff 0x77a0
-
-#define GlintdGdyDom 0x87a8
-#define GlintdGdyDomTag 0x00f5
-#define GlintdGdyDomReg 1
-#define GlintdGdyDomOff 0x77a8
-#define GlintdGdyDomSec 0x87a8
-#define GlintdGdyDomSecReg 3
-#define GlintdGdyDomSecOff 0x77a8
-
-#define GlintBStart 0x87b0
-#define GlintBStartTag 0x00f6
-#define GlintBStartReg 1
-#define GlintBStartOff 0x77b0
-#define GlintBStartSec 0x87b0
-#define GlintBStartSecReg 3
-#define GlintBStartSecOff 0x77b0
-
-#define GlintdBdx 0x87b8
-#define GlintdBdxTag 0x00f7
-#define GlintdBdxReg 1
-#define GlintdBdxOff 0x77b8
-#define GlintdBdxSec 0x87b8
-#define GlintdBdxSecReg 3
-#define GlintdBdxSecOff 0x77b8
-
-#define GlintdBdyDom 0x87c0
-#define GlintdBdyDomTag 0x00f8
-#define GlintdBdyDomReg 1
-#define GlintdBdyDomOff 0x77c0
-#define GlintdBdyDomSec 0x87c0
-#define GlintdBdyDomSecReg 3
-#define GlintdBdyDomSecOff 0x77c0
-
-#define GlintAStart 0x87c8
-#define GlintAStartTag 0x00f9
-#define GlintAStartReg 1
-#define GlintAStartOff 0x77c8
-#define GlintAStartSec 0x87c8
-#define GlintAStartSecReg 3
-#define GlintAStartSecOff 0x77c8
-
-#define GlintdAdx 0x87d0
-#define GlintdAdxTag 0x00fa
-#define GlintdAdxReg 1
-#define GlintdAdxOff 0x77d0
-#define GlintdAdxSec 0x87d0
-#define GlintdAdxSecReg 3
-#define GlintdAdxSecOff 0x77d0
-
-#define GlintdAdyDom 0x87d8
-#define GlintdAdyDomTag 0x00fb
-#define GlintdAdyDomReg 1
-#define GlintdAdyDomOff 0x77d8
-#define GlintdAdyDomSec 0x87d8
-#define GlintdAdyDomSecReg 3
-#define GlintdAdyDomSecOff 0x77d8
-
-#define GlintColorDDAMode 0x87e0
-#define GlintColorDDAModeTag 0x00fc
-#define GlintColorDDAModeReg 1
-#define GlintColorDDAModeOff 0x77e0
-#define GlintColorDDAModeSec 0x87e0
-#define GlintColorDDAModeSecReg 3
-#define GlintColorDDAModeSecOff 0x77e0
-
-#define GlintConstantColor 0x87e8
-#define GlintConstantColorTag 0x00fd
-#define GlintConstantColorReg 1
-#define GlintConstantColorOff 0x77e8
-#define GlintConstantColorSec 0x87e8
-#define GlintConstantColorSecReg 3
-#define GlintConstantColorSecOff 0x77e8
-
-#define GlintGLINTColor 0x87f0
-#define GlintGLINTColorTag 0x00fe
-#define GlintGLINTColorReg 1
-#define GlintGLINTColorOff 0x77f0
-#define GlintGLINTColorSec 0x87f0
-#define GlintGLINTColorSecReg 3
-#define GlintGLINTColorSecOff 0x77f0
-
-#define GlintAlphaTestMode 0x8800
-#define GlintAlphaTestModeTag 0x0100
-#define GlintAlphaTestModeReg 1
-#define GlintAlphaTestModeOff 0x7800
-#define GlintAlphaTestModeSec 0x8800
-#define GlintAlphaTestModeSecReg 3
-#define GlintAlphaTestModeSecOff 0x7800
-
-#define GlintAntialiasMode 0x8808
-#define GlintAntialiasModeTag 0x0101
-#define GlintAntialiasModeReg 1
-#define GlintAntialiasModeOff 0x7808
-#define GlintAntialiasModeSec 0x8808
-#define GlintAntialiasModeSecReg 3
-#define GlintAntialiasModeSecOff 0x7808
-
-#define GlintAlphaBlendMode 0x8810
-#define GlintAlphaBlendModeTag 0x0102
-#define GlintAlphaBlendModeReg 1
-#define GlintAlphaBlendModeOff 0x7810
-#define GlintAlphaBlendModeSec 0x8810
-#define GlintAlphaBlendModeSecReg 3
-#define GlintAlphaBlendModeSecOff 0x7810
-
-#define GlintChromaUpper 0x8f08
-#define GlintChromaUpperTag 0x01e1
-#define GlintChromaUpperReg 1
-#define GlintChromaUpperOff 0x7f08
-#define GlintChromaUpperSec 0x8f08
-#define GlintChromaUpperSecReg 3
-#define GlintChromaUpperSecOff 0x7f08
-
-#define GlintChromaLower 0x8f10
-#define GlintChromaLowerTag 0x01e2
-#define GlintChromaLowerReg 1
-#define GlintChromaLowerOff 0x7f10
-#define GlintChromaLowerSec 0x8f10
-#define GlintChromaLowerSecReg 3
-#define GlintChromaLowerSecOff 0x7f10
-
-#define GlintChromaTestMode 0x8f18
-#define GlintChromaTestModeTag 0x01e3
-#define GlintChromaTestModeReg 1
-#define GlintChromaTestModeOff 0x7f18
-#define GlintChromaTestModeSec 0x8f18
-#define GlintChromaTestModeSecReg 3
-#define GlintChromaTestModeSecOff 0x7f18
-
-#define GlintDitherMode 0x8818
-#define GlintDitherModeTag 0x0103
-#define GlintDitherModeReg 1
-#define GlintDitherModeOff 0x7818
-#define GlintDitherModeSec 0x8818
-#define GlintDitherModeSecReg 3
-#define GlintDitherModeSecOff 0x7818
-
-#define GlintFBSoftwareWriteMask 0x8820
-#define GlintFBSoftwareWriteMaskTag 0x0104
-#define GlintFBSoftwareWriteMaskReg 1
-#define GlintFBSoftwareWriteMaskOff 0x7820
-#define GlintFBSoftwareWriteMaskSec 0x8820
-#define GlintFBSoftwareWriteMaskSecReg 3
-#define GlintFBSoftwareWriteMaskSecOff 0x7820
-
-#define GlintLogicalOpMode 0x8828
-#define GlintLogicalOpModeTag 0x0105
-#define GlintLogicalOpModeReg 1
-#define GlintLogicalOpModeOff 0x7828
-#define GlintLogicalOpModeSec 0x8828
-#define GlintLogicalOpModeSecReg 3
-#define GlintLogicalOpModeSecOff 0x7828
-
-#define GlintFBWriteData 0x8830
-#define GlintFBWriteDataTag 0x0106
-#define GlintFBWriteDataReg 1
-#define GlintFBWriteDataOff 0x7830
-#define GlintFBWriteDataSec 0x8830
-#define GlintFBWriteDataSecReg 3
-#define GlintFBWriteDataSecOff 0x7830
-
-#define GlintLBReadMode 0x8880
-#define GlintLBReadModeTag 0x0110
-#define GlintLBReadModeReg 1
-#define GlintLBReadModeOff 0x7880
-#define GlintLBReadModeSec 0x8880
-#define GlintLBReadModeSecReg 3
-#define GlintLBReadModeSecOff 0x7880
-
-#define GlintLBReadFormat 0x8888
-#define GlintLBReadFormatTag 0x0111
-#define GlintLBReadFormatReg 1
-#define GlintLBReadFormatOff 0x7888
-#define GlintLBReadFormatSec 0x8888
-#define GlintLBReadFormatSecReg 3
-#define GlintLBReadFormatSecOff 0x7888
-
-#define GlintLBSourceOffset 0x8890
-#define GlintLBSourceOffsetTag 0x0112
-#define GlintLBSourceOffsetReg 1
-#define GlintLBSourceOffsetOff 0x7890
-#define GlintLBSourceOffsetSec 0x8890
-#define GlintLBSourceOffsetSecReg 3
-#define GlintLBSourceOffsetSecOff 0x7890
-
-#define GlintLBStencil 0x88a8
-#define GlintLBStencilTag 0x0115
-#define GlintLBStencilReg 1
-#define GlintLBStencilOff 0x78a8
-#define GlintLBStencilSec 0x88a8
-#define GlintLBStencilSecReg 3
-#define GlintLBStencilSecOff 0x78a8
-
-#define GlintLBDepth 0x88b0
-#define GlintLBDepthTag 0x0116
-#define GlintLBDepthReg 1
-#define GlintLBDepthOff 0x78b0
-#define GlintLBDepthSec 0x88b0
-#define GlintLBDepthSecReg 3
-#define GlintLBDepthSecOff 0x78b0
-
-#define GlintLBWindowBase 0x88b8
-#define GlintLBWindowBaseTag 0x0117
-#define GlintLBWindowBaseReg 1
-#define GlintLBWindowBaseOff 0x78b8
-#define GlintLBWindowBaseSec 0x88b8
-#define GlintLBWindowBaseSecReg 3
-#define GlintLBWindowBaseSecOff 0x78b8
-
-#define GlintLBWriteMode 0x88c0
-#define GlintLBWriteModeTag 0x0118
-#define GlintLBWriteModeReg 1
-#define GlintLBWriteModeOff 0x78c0
-#define GlintLBWriteModeSec 0x88c0
-#define GlintLBWriteModeSecReg 3
-#define GlintLBWriteModeSecOff 0x78c0
-
-#define GlintLBWriteFormat 0x88c8
-#define GlintLBWriteFormatTag 0x0119
-#define GlintLBWriteFormatReg 1
-#define GlintLBWriteFormatOff 0x78c8
-#define GlintLBWriteFormatSec 0x88c8
-#define GlintLBWriteFormatSecReg 3
-#define GlintLBWriteFormatSecOff 0x78c8
-
-#define GlintTextureData 0x88e8
-#define GlintTextureDataTag 0x011d
-#define GlintTextureDataReg 1
-#define GlintTextureDataOff 0x78e8
-#define GlintTextureDataSec 0x88e8
-#define GlintTextureDataSecReg 3
-#define GlintTextureDataSecOff 0x78e8
-
-#define GlintTextureDownloadOffset 0x88f0
-#define GlintTextureDownloadOffsetTag 0x011e
-#define GlintTextureDownloadOffsetReg 1
-#define GlintTextureDownloadOffsetOff 0x78f0
-#define GlintTextureDownloadOffsetSec 0x88f0
-#define GlintTextureDownloadOffsetSecReg 3
-#define GlintTextureDownloadOffsetSecOff 0x78f0
-
-#define GlintLBWindowOffset 0x88f8
-#define GlintLBWindowOffsetTag 0x011f
-#define GlintLBWindowOffsetReg 1
-#define GlintLBWindowOffsetOff 0x78f8
-#define GlintLBWindowOffsetSec 0x88f8
-#define GlintLBWindowOffsetSecReg 3
-#define GlintLBWindowOffsetSecOff 0x78f8
-
-#define GlintGLINTWindow 0x8980
-#define GlintGLINTWindowTag 0x0130
-#define GlintGLINTWindowReg 1
-#define GlintGLINTWindowOff 0x7980
-#define GlintGLINTWindowSec 0x8980
-#define GlintGLINTWindowSecReg 3
-#define GlintGLINTWindowSecOff 0x7980
-
-#define GlintStencilMode 0x8988
-#define GlintStencilModeTag 0x0131
-#define GlintStencilModeReg 1
-#define GlintStencilModeOff 0x7988
-#define GlintStencilModeSec 0x8988
-#define GlintStencilModeSecReg 3
-#define GlintStencilModeSecOff 0x7988
-
-#define GlintStencilData 0x8990
-#define GlintStencilDataTag 0x0132
-#define GlintStencilDataReg 1
-#define GlintStencilDataOff 0x7990
-#define GlintStencilDataSec 0x8990
-#define GlintStencilDataSecReg 3
-#define GlintStencilDataSecOff 0x7990
-
-#define GlintGLINTStencil 0x8998
-#define GlintGLINTStencilTag 0x0133
-#define GlintGLINTStencilReg 1
-#define GlintGLINTStencilOff 0x7998
-#define GlintGLINTStencilSec 0x8998
-#define GlintGLINTStencilSecReg 3
-#define GlintGLINTStencilSecOff 0x7998
-
-#define GlintDepthMode 0x89a0
-#define GlintDepthModeTag 0x0134
-#define GlintDepthModeReg 1
-#define GlintDepthModeOff 0x79a0
-#define GlintDepthModeSec 0x89a0
-#define GlintDepthModeSecReg 3
-#define GlintDepthModeSecOff 0x79a0
-
-#define GlintGLINTDepth 0x89a8
-#define GlintGLINTDepthTag 0x0135
-#define GlintGLINTDepthReg 1
-#define GlintGLINTDepthOff 0x79a8
-#define GlintGLINTDepthSec 0x89a8
-#define GlintGLINTDepthSecReg 3
-#define GlintGLINTDepthSecOff 0x79a8
-
-#define GlintZStartU 0x89b0
-#define GlintZStartUTag 0x0136
-#define GlintZStartUReg 1
-#define GlintZStartUOff 0x79b0
-#define GlintZStartUSec 0x89b0
-#define GlintZStartUSecReg 3
-#define GlintZStartUSecOff 0x79b0
-
-#define GlintZStartL 0x89b8
-#define GlintZStartLTag 0x0137
-#define GlintZStartLReg 1
-#define GlintZStartLOff 0x79b8
-#define GlintZStartLSec 0x89b8
-#define GlintZStartLSecReg 3
-#define GlintZStartLSecOff 0x79b8
-
-#define GlintdZdxU 0x89c0
-#define GlintdZdxUTag 0x0138
-#define GlintdZdxUReg 1
-#define GlintdZdxUOff 0x79c0
-#define GlintdZdxUSec 0x89c0
-#define GlintdZdxUSecReg 3
-#define GlintdZdxUSecOff 0x79c0
-
-#define GlintdZdxL 0x89c8
-#define GlintdZdxLTag 0x0139
-#define GlintdZdxLReg 1
-#define GlintdZdxLOff 0x79c8
-#define GlintdZdxLSec 0x89c8
-#define GlintdZdxLSecReg 3
-#define GlintdZdxLSecOff 0x79c8
-
-#define GlintdZdyDomU 0x89d0
-#define GlintdZdyDomUTag 0x013a
-#define GlintdZdyDomUReg 1
-#define GlintdZdyDomUOff 0x79d0
-#define GlintdZdyDomUSec 0x89d0
-#define GlintdZdyDomUSecReg 3
-#define GlintdZdyDomUSecOff 0x79d0
-
-#define GlintdZdyDomL 0x89d8
-#define GlintdZdyDomLTag 0x013b
-#define GlintdZdyDomLReg 1
-#define GlintdZdyDomLOff 0x79d8
-#define GlintdZdyDomLSec 0x89d8
-#define GlintdZdyDomLSecReg 3
-#define GlintdZdyDomLSecOff 0x79d8
-
-#define GlintFastClearDepth 0x89e0
-#define GlintFastClearDepthTag 0x013c
-#define GlintFastClearDepthReg 1
-#define GlintFastClearDepthOff 0x79e0
-#define GlintFastClearDepthSec 0x89e0
-#define GlintFastClearDepthSecReg 3
-#define GlintFastClearDepthSecOff 0x79e0
-
-#define GlintFBReadMode 0x8a80
-#define GlintFBReadModeTag 0x0150
-#define GlintFBReadModeReg 1
-#define GlintFBReadModeOff 0x7a80
-#define GlintFBReadModeSec 0x8a80
-#define GlintFBReadModeSecReg 3
-#define GlintFBReadModeSecOff 0x7a80
-
-#define GlintFBSourceOffset 0x8a88
-#define GlintFBSourceOffsetTag 0x0151
-#define GlintFBSourceOffsetReg 1
-#define GlintFBSourceOffsetOff 0x7a88
-#define GlintFBSourceOffsetSec 0x8a88
-#define GlintFBSourceOffsetSecReg 3
-#define GlintFBSourceOffsetSecOff 0x7a88
-
-#define GlintFBPixelOffset 0x8a90
-#define GlintFBPixelOffsetTag 0x0152
-#define GlintFBPixelOffsetReg 1
-#define GlintFBPixelOffsetOff 0x7a90
-#define GlintFBPixelOffsetSec 0x8a90
-#define GlintFBPixelOffsetSecReg 3
-#define GlintFBPixelOffsetSecOff 0x7a90
-
-#define GlintFBColor 0x8a98
-#define GlintFBColorTag 0x0153
-#define GlintFBColorReg 1
-#define GlintFBColorOff 0x7a98
-#define GlintFBColorSec 0x8a98
-#define GlintFBColorSecReg 3
-#define GlintFBColorSecOff 0x7a98
-
-#define GlintFBData 0x8aa0
-#define GlintFBDataTag 0x0154
-#define GlintFBDataReg 1
-#define GlintFBDataOff 0x7aa0
-#define GlintFBDataSec 0x8aa0
-#define GlintFBDataSecReg 3
-#define GlintFBDataSecOff 0x7aa0
-
-#define GlintFBSourceData 0x8aa8
-#define GlintFBSourceDataTag 0x0155
-#define GlintFBSourceDataReg 1
-#define GlintFBSourceDataOff 0x7aa8
-#define GlintFBSourceDataSec 0x8aa8
-#define GlintFBSourceDataSecReg 3
-#define GlintFBSourceDataSecOff 0x7aa8
-
-#define GlintFBWindowBase 0x8ab0
-#define GlintFBWindowBaseTag 0x0156
-#define GlintFBWindowBaseReg 1
-#define GlintFBWindowBaseOff 0x7ab0
-#define GlintFBWindowBaseSec 0x8ab0
-#define GlintFBWindowBaseSecReg 3
-#define GlintFBWindowBaseSecOff 0x7ab0
-
-#define GlintFBWriteMode 0x8ab8
-#define GlintFBWriteModeTag 0x0157
-#define GlintFBWriteModeReg 1
-#define GlintFBWriteModeOff 0x7ab8
-#define GlintFBWriteModeSec 0x8ab8
-#define GlintFBWriteModeSecReg 3
-#define GlintFBWriteModeSecOff 0x7ab8
-
-#define GlintFBHardwareWriteMask 0x8ac0
-#define GlintFBHardwareWriteMaskTag 0x0158
-#define GlintFBHardwareWriteMaskReg 1
-#define GlintFBHardwareWriteMaskOff 0x7ac0
-#define GlintFBHardwareWriteMaskSec 0x8ac0
-#define GlintFBHardwareWriteMaskSecReg 3
-#define GlintFBHardwareWriteMaskSecOff 0x7ac0
-
-#define GlintFBBlockColor 0x8ac8
-#define GlintFBBlockColorTag 0x0159
-#define GlintFBBlockColorReg 1
-#define GlintFBBlockColorOff 0x7ac8
-#define GlintFBBlockColorSec 0x8ac8
-#define GlintFBBlockColorSecReg 3
-#define GlintFBBlockColorSecOff 0x7ac8
-
-#define GlintPatternRamMode 0x8af8
-#define GlintPatternRamModeTag 0x015f
-#define GlintPatternRamModeReg 1
-#define GlintPatternRamModeOff 0x7af8
-#define GlintPatternRamModeSec 0x8af8
-#define GlintPatternRamModeSecReg 3
-#define GlintPatternRamModeSecOff 0x7af8
-
-#define GlintPatternRamData0 0x8b00
-#define GlintPatternRamData0Tag 0x0160
-#define GlintPatternRamData0Reg 1
-#define GlintPatternRamData0Off 0x7b00
-#define GlintPatternRamData0Sec 0x8b00
-#define GlintPatternRamData0SecReg 3
-#define GlintPatternRamData0SecOff 0x7b00
-
-#define GlintPatternRamData1 0x8b08
-#define GlintPatternRamData1Tag 0x0161
-#define GlintPatternRamData1Reg 1
-#define GlintPatternRamData1Off 0x7b08
-#define GlintPatternRamData1Sec 0x8b08
-#define GlintPatternRamData1SecReg 3
-#define GlintPatternRamData1SecOff 0x7b08
-
-#define GlintPatternRamData2 0x8b10
-#define GlintPatternRamData2Tag 0x0162
-#define GlintPatternRamData2Reg 1
-#define GlintPatternRamData2Off 0x7b10
-#define GlintPatternRamData2Sec 0x8b10
-#define GlintPatternRamData2SecReg 3
-#define GlintPatternRamData2SecOff 0x7b10
-
-#define GlintPatternRamData3 0x8b18
-#define GlintPatternRamData3Tag 0x0163
-#define GlintPatternRamData3Reg 1
-#define GlintPatternRamData3Off 0x7b18
-#define GlintPatternRamData3Sec 0x8b18
-#define GlintPatternRamData3SecReg 3
-#define GlintPatternRamData3SecOff 0x7b18
-
-#define GlintPatternRamData4 0x8b20
-#define GlintPatternRamData4Tag 0x0164
-#define GlintPatternRamData4Reg 1
-#define GlintPatternRamData4Off 0x7b20
-#define GlintPatternRamData4Sec 0x8b20
-#define GlintPatternRamData4SecReg 3
-#define GlintPatternRamData4SecOff 0x7b20
-
-#define GlintPatternRamData5 0x8b28
-#define GlintPatternRamData5Tag 0x0165
-#define GlintPatternRamData5Reg 1
-#define GlintPatternRamData5Off 0x7b28
-#define GlintPatternRamData5Sec 0x8b28
-#define GlintPatternRamData5SecReg 3
-#define GlintPatternRamData5SecOff 0x7b28
-
-#define GlintPatternRamData6 0x8b30
-#define GlintPatternRamData6Tag 0x0166
-#define GlintPatternRamData6Reg 1
-#define GlintPatternRamData6Off 0x7b30
-#define GlintPatternRamData6Sec 0x8b30
-#define GlintPatternRamData6SecReg 3
-#define GlintPatternRamData6SecOff 0x7b30
-
-#define GlintPatternRamData7 0x8b38
-#define GlintPatternRamData7Tag 0x0167
-#define GlintPatternRamData7Reg 1
-#define GlintPatternRamData7Off 0x7b38
-#define GlintPatternRamData7Sec 0x8b38
-#define GlintPatternRamData7SecReg 3
-#define GlintPatternRamData7SecOff 0x7b38
-
-#define GlintPatternRamData8 0x8b40
-#define GlintPatternRamData8Tag 0x0168
-#define GlintPatternRamData8Reg 1
-#define GlintPatternRamData8Off 0x7b40
-#define GlintPatternRamData8Sec 0x8b40
-#define GlintPatternRamData8SecReg 3
-#define GlintPatternRamData8SecOff 0x7b40
-
-#define GlintPatternRamData9 0x8b48
-#define GlintPatternRamData9Tag 0x0169
-#define GlintPatternRamData9Reg 1
-#define GlintPatternRamData9Off 0x7b48
-#define GlintPatternRamData9Sec 0x8b48
-#define GlintPatternRamData9SecReg 3
-#define GlintPatternRamData9SecOff 0x7b48
-
-#define GlintPatternRamData10 0x8b50
-#define GlintPatternRamData10Tag 0x016a
-#define GlintPatternRamData10Reg 1
-#define GlintPatternRamData10Off 0x7b50
-#define GlintPatternRamData10Sec 0x8b50
-#define GlintPatternRamData10SecReg 3
-#define GlintPatternRamData10SecOff 0x7b50
-
-#define GlintPatternRamData11 0x8b58
-#define GlintPatternRamData11Tag 0x016b
-#define GlintPatternRamData11Reg 1
-#define GlintPatternRamData11Off 0x7b58
-#define GlintPatternRamData11Sec 0x8b58
-#define GlintPatternRamData11SecReg 3
-#define GlintPatternRamData11SecOff 0x7b58
-
-#define GlintPatternRamData12 0x8b60
-#define GlintPatternRamData12Tag 0x016c
-#define GlintPatternRamData12Reg 1
-#define GlintPatternRamData12Off 0x7b60
-#define GlintPatternRamData12Sec 0x8b60
-#define GlintPatternRamData12SecReg 3
-#define GlintPatternRamData12SecOff 0x7b60
-
-#define GlintPatternRamData13 0x8b68
-#define GlintPatternRamData13Tag 0x016d
-#define GlintPatternRamData13Reg 1
-#define GlintPatternRamData13Off 0x7b68
-#define GlintPatternRamData13Sec 0x8b68
-#define GlintPatternRamData13SecReg 3
-#define GlintPatternRamData13SecOff 0x7b68
-
-#define GlintPatternRamData14 0x8b70
-#define GlintPatternRamData14Tag 0x016e
-#define GlintPatternRamData14Reg 1
-#define GlintPatternRamData14Off 0x7b70
-#define GlintPatternRamData14Sec 0x8b70
-#define GlintPatternRamData14SecReg 3
-#define GlintPatternRamData14SecOff 0x7b70
-
-#define GlintPatternRamData15 0x8b78
-#define GlintPatternRamData15Tag 0x016f
-#define GlintPatternRamData15Reg 1
-#define GlintPatternRamData15Off 0x7b78
-#define GlintPatternRamData15Sec 0x8b78
-#define GlintPatternRamData15SecReg 3
-#define GlintPatternRamData15SecOff 0x7b78
-
-#define GlintPatternRamData16 0x8b80
-#define GlintPatternRamData16Tag 0x0170
-#define GlintPatternRamData16Reg 1
-#define GlintPatternRamData16Off 0x7b80
-#define GlintPatternRamData16Sec 0x8b80
-#define GlintPatternRamData16SecReg 3
-#define GlintPatternRamData16SecOff 0x7b80
-
-#define GlintPatternRamData17 0x8b88
-#define GlintPatternRamData17Tag 0x0171
-#define GlintPatternRamData17Reg 1
-#define GlintPatternRamData17Off 0x7b88
-#define GlintPatternRamData17Sec 0x8b88
-#define GlintPatternRamData17SecReg 3
-#define GlintPatternRamData17SecOff 0x7b88
-
-#define GlintPatternRamData18 0x8b90
-#define GlintPatternRamData18Tag 0x0172
-#define GlintPatternRamData18Reg 1
-#define GlintPatternRamData18Off 0x7b90
-#define GlintPatternRamData18Sec 0x8b90
-#define GlintPatternRamData18SecReg 3
-#define GlintPatternRamData18SecOff 0x7b90
-
-#define GlintPatternRamData19 0x8b98
-#define GlintPatternRamData19Tag 0x0173
-#define GlintPatternRamData19Reg 1
-#define GlintPatternRamData19Off 0x7b98
-#define GlintPatternRamData19Sec 0x8b98
-#define GlintPatternRamData19SecReg 3
-#define GlintPatternRamData19SecOff 0x7b98
-
-#define GlintPatternRamData20 0x8ba0
-#define GlintPatternRamData20Tag 0x0174
-#define GlintPatternRamData20Reg 1
-#define GlintPatternRamData20Off 0x7ba0
-#define GlintPatternRamData20Sec 0x8ba0
-#define GlintPatternRamData20SecReg 3
-#define GlintPatternRamData20SecOff 0x7ba0
-
-#define GlintPatternRamData21 0x8ba8
-#define GlintPatternRamData21Tag 0x0175
-#define GlintPatternRamData21Reg 1
-#define GlintPatternRamData21Off 0x7ba8
-#define GlintPatternRamData21Sec 0x8ba8
-#define GlintPatternRamData21SecReg 3
-#define GlintPatternRamData21SecOff 0x7ba8
-
-#define GlintPatternRamData22 0x8bb0
-#define GlintPatternRamData22Tag 0x0176
-#define GlintPatternRamData22Reg 1
-#define GlintPatternRamData22Off 0x7bb0
-#define GlintPatternRamData22Sec 0x8bb0
-#define GlintPatternRamData22SecReg 3
-#define GlintPatternRamData22SecOff 0x7bb0
-
-#define GlintPatternRamData23 0x8bb8
-#define GlintPatternRamData23Tag 0x0177
-#define GlintPatternRamData23Reg 1
-#define GlintPatternRamData23Off 0x7bb8
-#define GlintPatternRamData23Sec 0x8bb8
-#define GlintPatternRamData23SecReg 3
-#define GlintPatternRamData23SecOff 0x7bb8
-
-#define GlintPatternRamData24 0x8bc0
-#define GlintPatternRamData24Tag 0x0178
-#define GlintPatternRamData24Reg 1
-#define GlintPatternRamData24Off 0x7bc0
-#define GlintPatternRamData24Sec 0x8bc0
-#define GlintPatternRamData24SecReg 3
-#define GlintPatternRamData24SecOff 0x7bc0
-
-#define GlintPatternRamData25 0x8bc8
-#define GlintPatternRamData25Tag 0x0179
-#define GlintPatternRamData25Reg 1
-#define GlintPatternRamData25Off 0x7bc8
-#define GlintPatternRamData25Sec 0x8bc8
-#define GlintPatternRamData25SecReg 3
-#define GlintPatternRamData25SecOff 0x7bc8
-
-#define GlintPatternRamData26 0x8bd0
-#define GlintPatternRamData26Tag 0x017a
-#define GlintPatternRamData26Reg 1
-#define GlintPatternRamData26Off 0x7bd0
-#define GlintPatternRamData26Sec 0x8bd0
-#define GlintPatternRamData26SecReg 3
-#define GlintPatternRamData26SecOff 0x7bd0
-
-#define GlintPatternRamData27 0x8bd8
-#define GlintPatternRamData27Tag 0x017b
-#define GlintPatternRamData27Reg 1
-#define GlintPatternRamData27Off 0x7bd8
-#define GlintPatternRamData27Sec 0x8bd8
-#define GlintPatternRamData27SecReg 3
-#define GlintPatternRamData27SecOff 0x7bd8
-
-#define GlintPatternRamData28 0x8be0
-#define GlintPatternRamData28Tag 0x017c
-#define GlintPatternRamData28Reg 1
-#define GlintPatternRamData28Off 0x7be0
-#define GlintPatternRamData28Sec 0x8be0
-#define GlintPatternRamData28SecReg 3
-#define GlintPatternRamData28SecOff 0x7be0
-
-#define GlintPatternRamData29 0x8be8
-#define GlintPatternRamData29Tag 0x017d
-#define GlintPatternRamData29Reg 1
-#define GlintPatternRamData29Off 0x7be8
-#define GlintPatternRamData29Sec 0x8be8
-#define GlintPatternRamData29SecReg 3
-#define GlintPatternRamData29SecOff 0x7be8
-
-#define GlintPatternRamData30 0x8bf0
-#define GlintPatternRamData30Tag 0x017e
-#define GlintPatternRamData30Reg 1
-#define GlintPatternRamData30Off 0x7bf0
-#define GlintPatternRamData30Sec 0x8bf0
-#define GlintPatternRamData30SecReg 3
-#define GlintPatternRamData30SecOff 0x7bf0
-
-#define GlintPatternRamData31 0x8bf8
-#define GlintPatternRamData31Tag 0x017f
-#define GlintPatternRamData31Reg 1
-#define GlintPatternRamData31Off 0x7bf8
-#define GlintPatternRamData31Sec 0x8bf8
-#define GlintPatternRamData31SecReg 3
-#define GlintPatternRamData31SecOff 0x7bf8
-
-#define GlintFBBlockColorU 0x8c68
-#define GlintFBBlockColorUTag 0x018d
-#define GlintFBBlockColorUReg 1
-#define GlintFBBlockColorUOff 0x7c68
-#define GlintFBBlockColorUSec 0x8c68
-#define GlintFBBlockColorUSecReg 3
-#define GlintFBBlockColorUSecOff 0x7c68
-
-#define GlintFBBlockColorL 0x8c70
-#define GlintFBBlockColorLTag 0x018e
-#define GlintFBBlockColorLReg 1
-#define GlintFBBlockColorLOff 0x7c70
-#define GlintFBBlockColorLSec 0x8c70
-#define GlintFBBlockColorLSecReg 3
-#define GlintFBBlockColorLSecOff 0x7c70
-
-#define GlintSuspendUntilFrameBlank 0x8c78
-#define GlintSuspendUntilFrameBlankTag 0x018f
-#define GlintSuspendUntilFrameBlankReg 1
-#define GlintSuspendUntilFrameBlankOff 0x7c78
-#define GlintSuspendUntilFrameBlankSec 0x8c78
-#define GlintSuspendUntilFrameBlankSecReg 3
-#define GlintSuspendUntilFrameBlankSecOff 0x7c78
-
-#define GlintFilterMode 0x8c00
-#define GlintFilterModeTag 0x0180
-#define GlintFilterModeReg 1
-#define GlintFilterModeOff 0x7c00
-#define GlintFilterModeSec 0x8c00
-#define GlintFilterModeSecReg 3
-#define GlintFilterModeSecOff 0x7c00
-
-#define GlintStatisticMode 0x8c08
-#define GlintStatisticModeTag 0x0181
-#define GlintStatisticModeReg 1
-#define GlintStatisticModeOff 0x7c08
-#define GlintStatisticModeSec 0x8c08
-#define GlintStatisticModeSecReg 3
-#define GlintStatisticModeSecOff 0x7c08
-
-#define GlintMinRegion 0x8c10
-#define GlintMinRegionTag 0x0182
-#define GlintMinRegionReg 1
-#define GlintMinRegionOff 0x7c10
-#define GlintMinRegionSec 0x8c10
-#define GlintMinRegionSecReg 3
-#define GlintMinRegionSecOff 0x7c10
-
-#define GlintMaxRegion 0x8c18
-#define GlintMaxRegionTag 0x0183
-#define GlintMaxRegionReg 1
-#define GlintMaxRegionOff 0x7c18
-#define GlintMaxRegionSec 0x8c18
-#define GlintMaxRegionSecReg 3
-#define GlintMaxRegionSecOff 0x7c18
-
-#define GlintResetPickResult 0x8c20
-#define GlintResetPickResultTag 0x0184
-#define GlintResetPickResultReg 1
-#define GlintResetPickResultOff 0x7c20
-#define GlintResetPickResultSec 0x8c20
-#define GlintResetPickResultSecReg 3
-#define GlintResetPickResultSecOff 0x7c20
-
-#define GlintMitHitRegion 0x8c28
-#define GlintMitHitRegionTag 0x0185
-#define GlintMitHitRegionReg 1
-#define GlintMitHitRegionOff 0x7c28
-#define GlintMitHitRegionSec 0x8c28
-#define GlintMitHitRegionSecReg 3
-#define GlintMitHitRegionSecOff 0x7c28
-
-#define GlintMaxHitRegion 0x8c30
-#define GlintMaxHitRegionTag 0x0186
-#define GlintMaxHitRegionReg 1
-#define GlintMaxHitRegionOff 0x7c30
-#define GlintMaxHitRegionSec 0x8c30
-#define GlintMaxHitRegionSecReg 3
-#define GlintMaxHitRegionSecOff 0x7c30
-
-#define GlintPickResult 0x8c38
-#define GlintPickResultTag 0x0187
-#define GlintPickResultReg 1
-#define GlintPickResultOff 0x7c38
-#define GlintPickResultSec 0x8c38
-#define GlintPickResultSecReg 3
-#define GlintPickResultSecOff 0x7c38
-
-#define GlintGLINTSync 0x8c40
-#define GlintGLINTSyncTag 0x0188
-#define GlintGLINTSyncReg 1
-#define GlintGLINTSyncOff 0x7c40
-#define GlintGLINTSyncSec 0x8c40
-#define GlintGLINTSyncSecReg 3
-#define GlintGLINTSyncSecOff 0x7c40
-
-#define GlintKsRStart 0x8c80
-#define GlintKsRStartTag 0x0190
-#define GlintKsRStartReg 1
-#define GlintKsRStartOff 0x7c80
-#define GlintKsRStartSec 0x8c80
-#define GlintKsRStartSecReg 3
-#define GlintKsRStartSecOff 0x7c80
-
-#define GlintdKsRdx 0x8c88
-#define GlintdKsRdxTag 0x0191
-#define GlintdKsRdxReg 1
-#define GlintdKsRdxOff 0x7c88
-#define GlintdKsRdxSec 0x8c88
-#define GlintdKsRdxSecReg 3
-#define GlintdKsRdxSecOff 0x7c88
-
-#define GlintdKsRdyDom 0x8c90
-#define GlintdKsRdyDomTag 0x0192
-#define GlintdKsRdyDomReg 1
-#define GlintdKsRdyDomOff 0x7c90
-#define GlintdKsRdyDomSec 0x8c90
-#define GlintdKsRdyDomSecReg 3
-#define GlintdKsRdyDomSecOff 0x7c90
-
-#define GlintKsGStart 0x8c98
-#define GlintKsGStartTag 0x0193
-#define GlintKsGStartReg 1
-#define GlintKsGStartOff 0x7c98
-#define GlintKsGStartSec 0x8c98
-#define GlintKsGStartSecReg 3
-#define GlintKsGStartSecOff 0x7c98
-
-#define GlintdKsGdx 0x8ca0
-#define GlintdKsGdxTag 0x0194
-#define GlintdKsGdxReg 1
-#define GlintdKsGdxOff 0x7ca0
-#define GlintdKsGdxSec 0x8ca0
-#define GlintdKsGdxSecReg 3
-#define GlintdKsGdxSecOff 0x7ca0
-
-#define GlintdKsGdyDom 0x8ca8
-#define GlintdKsGdyDomTag 0x0195
-#define GlintdKsGdyDomReg 1
-#define GlintdKsGdyDomOff 0x7ca8
-#define GlintdKsGdyDomSec 0x8ca8
-#define GlintdKsGdyDomSecReg 3
-#define GlintdKsGdyDomSecOff 0x7ca8
-
-#define GlintKsBStart 0x8cb0
-#define GlintKsBStartTag 0x0196
-#define GlintKsBStartReg 1
-#define GlintKsBStartOff 0x7cb0
-#define GlintKsBStartSec 0x8cb0
-#define GlintKsBStartSecReg 3
-#define GlintKsBStartSecOff 0x7cb0
-
-#define GlintdKsBdx 0x8cb8
-#define GlintdKsBdxTag 0x0197
-#define GlintdKsBdxReg 1
-#define GlintdKsBdxOff 0x7cb8
-#define GlintdKsBdxSec 0x8cb8
-#define GlintdKsBdxSecReg 3
-#define GlintdKsBdxSecOff 0x7cb8
-
-#define GlintdKsBdyDom 0x8cc0
-#define GlintdKsBdyDomTag 0x0198
-#define GlintdKsBdyDomReg 1
-#define GlintdKsBdyDomOff 0x7cc0
-#define GlintdKsBdyDomSec 0x8cc0
-#define GlintdKsBdyDomSecReg 3
-#define GlintdKsBdyDomSecOff 0x7cc0
-
-#define GlintKdRStart 0x8d00
-#define GlintKdRStartTag 0x01a0
-#define GlintKdRStartReg 1
-#define GlintKdRStartOff 0x7d00
-#define GlintKdRStartSec 0x8d00
-#define GlintKdRStartSecReg 3
-#define GlintKdRStartSecOff 0x7d00
-
-#define GlintdKdRdx 0x8d08
-#define GlintdKdRdxTag 0x01a1
-#define GlintdKdRdxReg 1
-#define GlintdKdRdxOff 0x7d08
-#define GlintdKdRdxSec 0x8d08
-#define GlintdKdRdxSecReg 3
-#define GlintdKdRdxSecOff 0x7d08
-
-#define GlintdKdRdyDom 0x8d10
-#define GlintdKdRdyDomTag 0x01a2
-#define GlintdKdRdyDomReg 1
-#define GlintdKdRdyDomOff 0x7d10
-#define GlintdKdRdyDomSec 0x8d10
-#define GlintdKdRdyDomSecReg 3
-#define GlintdKdRdyDomSecOff 0x7d10
-
-#define GlintKdGStart 0x8d18
-#define GlintKdGStartTag 0x01a3
-#define GlintKdGStartReg 1
-#define GlintKdGStartOff 0x7d18
-#define GlintKdGStartSec 0x8d18
-#define GlintKdGStartSecReg 3
-#define GlintKdGStartSecOff 0x7d18
-
-#define GlintdKdGdx 0x8d20
-#define GlintdKdGdxTag 0x01a4
-#define GlintdKdGdxReg 1
-#define GlintdKdGdxOff 0x7d20
-#define GlintdKdGdxSec 0x8d20
-#define GlintdKdGdxSecReg 3
-#define GlintdKdGdxSecOff 0x7d20
-
-#define GlintdKdGdyDom 0x8d28
-#define GlintdKdGdyDomTag 0x01a5
-#define GlintdKdGdyDomReg 1
-#define GlintdKdGdyDomOff 0x7d28
-#define GlintdKdGdyDomSec 0x8d28
-#define GlintdKdGdyDomSecReg 3
-#define GlintdKdGdyDomSecOff 0x7d28
-
-#define GlintKdBStart 0x8d30
-#define GlintKdBStartTag 0x01a6
-#define GlintKdBStartReg 1
-#define GlintKdBStartOff 0x7d30
-#define GlintKdBStartSec 0x8d30
-#define GlintKdBStartSecReg 3
-#define GlintKdBStartSecOff 0x7d30
-
-#define GlintdKdBdx 0x8d38
-#define GlintdKdBdxTag 0x01a7
-#define GlintdKdBdxReg 1
-#define GlintdKdBdxOff 0x7d38
-#define GlintdKdBdxSec 0x8d38
-#define GlintdKdBdxSecReg 3
-#define GlintdKdBdxSecOff 0x7d38
-
-#define GlintdKdBdyDom 0x8d40
-#define GlintdKdBdyDomTag 0x01a8
-#define GlintdKdBdyDomReg 1
-#define GlintdKdBdyDomOff 0x7d40
-#define GlintdKdBdyDomSec 0x8d40
-#define GlintdKdBdyDomSecReg 3
-#define GlintdKdBdyDomSecOff 0x7d40
-
-#define GlintContextDump 0x8dc0
-#define GlintContextDumpTag 0x01b8
-#define GlintContextDumpReg 1
-#define GlintContextDumpOff 0x7dc0
-
-#define GlintContextRestore 0x8dc8
-#define GlintContextRestoreTag 0x01b9
-#define GlintContextRestoreReg 1
-#define GlintContextRestoreOff 0x7dc8
-
-#define GlintContextData 0x8dd0
-#define GlintContextDataTag 0x01ba
-#define GlintContextDataReg 1
-#define GlintContextDataOff 0x7dd0
-
-#define GlintFeedbackToken 0x8f80
-#define GlintFeedbackTokenTag 0x01f0
-#define GlintFeedbackTokenReg 1
-#define GlintFeedbackTokenOff 0x7f80
-
-#define GlintFeedbackX 0x8f88
-#define GlintFeedbackXTag 0x01f1
-#define GlintFeedbackXReg 1
-#define GlintFeedbackXOff 0x7f88
-
-#define GlintFeedbackY 0x8f90
-#define GlintFeedbackYTag 0x01f2
-#define GlintFeedbackYReg 1
-#define GlintFeedbackYOff 0x7f90
-
-#define GlintFeedbackZ 0x8f98
-#define GlintFeedbackZTag 0x01f3
-#define GlintFeedbackZReg 1
-#define GlintFeedbackZOff 0x7f98
-
-#define GlintFeedbackW 0x8fa0
-#define GlintFeedbackWTag 0x01f4
-#define GlintFeedbackWReg 1
-#define GlintFeedbackWOff 0x7fa0
-
-#define GlintFeedbackRed 0x8fa8
-#define GlintFeedbackRedTag 0x01f5
-#define GlintFeedbackRedReg 1
-#define GlintFeedbackRedOff 0x7fa8
-
-#define GlintFeedbackGreen 0x8fb0
-#define GlintFeedbackGreenTag 0x01f6
-#define GlintFeedbackGreenReg 1
-#define GlintFeedbackGreenOff 0x7fb0
-
-#define GlintFeedbackBlue 0x8fb8
-#define GlintFeedbackBlueTag 0x01f7
-#define GlintFeedbackBlueReg 1
-#define GlintFeedbackBlueOff 0x7fb8
-
-#define GlintFeedbackAlpha 0x8fc0
-#define GlintFeedbackAlphaTag 0x01f8
-#define GlintFeedbackAlphaReg 1
-#define GlintFeedbackAlphaOff 0x7fc0
-
-#define GlintFeedbackS 0x8fc8
-#define GlintFeedbackSTag 0x01f9
-#define GlintFeedbackSReg 1
-#define GlintFeedbackSOff 0x7fc8
-
-#define GlintFeedbackT 0x8fd0
-#define GlintFeedbackTTag 0x01fa
-#define GlintFeedbackTReg 1
-#define GlintFeedbackTOff 0x7fd0
-
-#define GlintFeedbackR 0x8fd8
-#define GlintFeedbackRTag 0x01fb
-#define GlintFeedbackRReg 1
-#define GlintFeedbackROff 0x7fd8
-
-#define GlintFeedbackQ 0x8fe0
-#define GlintFeedbackQTag 0x01fc
-#define GlintFeedbackQReg 1
-#define GlintFeedbackQOff 0x7fe0
-
-#define GlintSelectRecord 0x8fe8
-#define GlintSelectRecordTag 0x01fd
-#define GlintSelectRecordReg 1
-#define GlintSelectRecordOff 0x7fe8
-
-#define GlintPassThrough 0x8ff0
-#define GlintPassThroughTag 0x01fe
-#define GlintPassThroughReg 1
-#define GlintPassThroughOff 0x7ff0
-
-#define GlintEndOfFeedback 0x8ff8
-#define GlintEndOfFeedbackTag 0x01ff
-#define GlintEndOfFeedbackReg 1
-#define GlintEndOfFeedbackOff 0x7ff8
-
-#define GlintV0FixedS 0x9000
-#define GlintV0FixedSTag 0x0200
-#define GlintV0FixedSReg 1
-#define GlintV0FixedSOff 0x8000
-
-#define GlintV0FixedT 0x9008
-#define GlintV0FixedTTag 0x0201
-#define GlintV0FixedTReg 1
-#define GlintV0FixedTOff 0x8008
-
-#define GlintV0FixedQ 0x9010
-#define GlintV0FixedQTag 0x0202
-#define GlintV0FixedQReg 1
-#define GlintV0FixedQOff 0x8010
-
-#define GlintV0FixedKs 0x9018
-#define GlintV0FixedKsTag 0x0203
-#define GlintV0FixedKsReg 1
-#define GlintV0FixedKsOff 0x8018
-
-#define GlintV0FixedKd 0x9020
-#define GlintV0FixedKdTag 0x0204
-#define GlintV0FixedKdReg 1
-#define GlintV0FixedKdOff 0x8020
-
-#define GlintV0FixedR 0x9028
-#define GlintV0FixedRTag 0x0205
-#define GlintV0FixedRReg 1
-#define GlintV0FixedROff 0x8028
-
-#define GlintV0FixedG 0x9030
-#define GlintV0FixedGTag 0x0206
-#define GlintV0FixedGReg 1
-#define GlintV0FixedGOff 0x8030
-
-#define GlintV0FixedB 0x9038
-#define GlintV0FixedBTag 0x0207
-#define GlintV0FixedBReg 1
-#define GlintV0FixedBOff 0x8038
-
-#define GlintV0FixedA 0x9040
-#define GlintV0FixedATag 0x0208
-#define GlintV0FixedAReg 1
-#define GlintV0FixedAOff 0x8040
-
-#define GlintV0FixedF 0x9048
-#define GlintV0FixedFTag 0x0209
-#define GlintV0FixedFReg 1
-#define GlintV0FixedFOff 0x8048
-
-#define GlintV0FixedX 0x9050
-#define GlintV0FixedXTag 0x020a
-#define GlintV0FixedXReg 1
-#define GlintV0FixedXOff 0x8050
-
-#define GlintV0FixedY 0x9058
-#define GlintV0FixedYTag 0x020b
-#define GlintV0FixedYReg 1
-#define GlintV0FixedYOff 0x8058
-
-#define GlintV0FixedZ 0x9060
-#define GlintV0FixedZTag 0x020c
-#define GlintV0FixedZReg 1
-#define GlintV0FixedZOff 0x8060
-
-#define GlintV1FixedS 0x9080
-#define GlintV1FixedSTag 0x0210
-#define GlintV1FixedSReg 1
-#define GlintV1FixedSOff 0x8080
-
-#define GlintV1FixedT 0x9088
-#define GlintV1FixedTTag 0x0211
-#define GlintV1FixedTReg 1
-#define GlintV1FixedTOff 0x8088
-
-#define GlintV1FixedQ 0x9090
-#define GlintV1FixedQTag 0x0212
-#define GlintV1FixedQReg 1
-#define GlintV1FixedQOff 0x8090
-
-#define GlintV1FixedKs 0x9098
-#define GlintV1FixedKsTag 0x0213
-#define GlintV1FixedKsReg 1
-#define GlintV1FixedKsOff 0x8098
-
-#define GlintV1FixedKd 0x90a0
-#define GlintV1FixedKdTag 0x0214
-#define GlintV1FixedKdReg 1
-#define GlintV1FixedKdOff 0x80a0
-
-#define GlintV1FixedR 0x90a8
-#define GlintV1FixedRTag 0x0215
-#define GlintV1FixedRReg 1
-#define GlintV1FixedROff 0x80a8
-
-#define GlintV1FixedG 0x90b0
-#define GlintV1FixedGTag 0x0216
-#define GlintV1FixedGReg 1
-#define GlintV1FixedGOff 0x80b0
-
-#define GlintV1FixedB 0x90b8
-#define GlintV1FixedBTag 0x0217
-#define GlintV1FixedBReg 1
-#define GlintV1FixedBOff 0x80b8
-
-#define GlintV1FixedA 0x90c0
-#define GlintV1FixedATag 0x0218
-#define GlintV1FixedAReg 1
-#define GlintV1FixedAOff 0x80c0
-
-#define GlintV1FixedF 0x90c8
-#define GlintV1FixedFTag 0x0219
-#define GlintV1FixedFReg 1
-#define GlintV1FixedFOff 0x80c8
-
-#define GlintV1FixedX 0x90d0
-#define GlintV1FixedXTag 0x021a
-#define GlintV1FixedXReg 1
-#define GlintV1FixedXOff 0x80d0
-
-#define GlintV1FixedY 0x90d8
-#define GlintV1FixedYTag 0x021b
-#define GlintV1FixedYReg 1
-#define GlintV1FixedYOff 0x80d8
-
-#define GlintV1FixedZ 0x90e0
-#define GlintV1FixedZTag 0x021c
-#define GlintV1FixedZReg 1
-#define GlintV1FixedZOff 0x80e0
-
-#define GlintV2FixedS 0x9100
-#define GlintV2FixedSTag 0x0220
-#define GlintV2FixedSReg 1
-#define GlintV2FixedSOff 0x8100
-
-#define GlintV2FixedT 0x9108
-#define GlintV2FixedTTag 0x0221
-#define GlintV2FixedTReg 1
-#define GlintV2FixedTOff 0x8108
-
-#define GlintV2FixedQ 0x9110
-#define GlintV2FixedQTag 0x0222
-#define GlintV2FixedQReg 1
-#define GlintV2FixedQOff 0x8110
-
-#define GlintV2FixedKs 0x9118
-#define GlintV2FixedKsTag 0x0223
-#define GlintV2FixedKsReg 1
-#define GlintV2FixedKsOff 0x8118
-
-#define GlintV2FixedKd 0x9120
-#define GlintV2FixedKdTag 0x0224
-#define GlintV2FixedKdReg 1
-#define GlintV2FixedKdOff 0x8120
-
-#define GlintV2FixedR 0x9128
-#define GlintV2FixedRTag 0x0225
-#define GlintV2FixedRReg 1
-#define GlintV2FixedROff 0x8128
-
-#define GlintV2FixedG 0x9130
-#define GlintV2FixedGTag 0x0226
-#define GlintV2FixedGReg 1
-#define GlintV2FixedGOff 0x8130
-
-#define GlintV2FixedB 0x9138
-#define GlintV2FixedBTag 0x0227
-#define GlintV2FixedBReg 1
-#define GlintV2FixedBOff 0x8138
-
-#define GlintV2FixedA 0x9140
-#define GlintV2FixedATag 0x0228
-#define GlintV2FixedAReg 1
-#define GlintV2FixedAOff 0x8140
-
-#define GlintV2FixedF 0x9148
-#define GlintV2FixedFTag 0x0229
-#define GlintV2FixedFReg 1
-#define GlintV2FixedFOff 0x8148
-
-#define GlintV2FixedX 0x9150
-#define GlintV2FixedXTag 0x022a
-#define GlintV2FixedXReg 1
-#define GlintV2FixedXOff 0x8150
-
-#define GlintV2FixedY 0x9158
-#define GlintV2FixedYTag 0x022b
-#define GlintV2FixedYReg 1
-#define GlintV2FixedYOff 0x8158
-
-#define GlintV2FixedZ 0x9160
-#define GlintV2FixedZTag 0x022c
-#define GlintV2FixedZReg 1
-#define GlintV2FixedZOff 0x8160
-
-#define GlintV0FloatS 0x9180
-#define GlintV0FloatSTag 0x0230
-#define GlintV0FloatSReg 1
-#define GlintV0FloatSOff 0x8180
-
-#define GlintV0FloatT 0x9188
-#define GlintV0FloatTTag 0x0231
-#define GlintV0FloatTReg 1
-#define GlintV0FloatTOff 0x8188
-
-#define GlintV0FloatQ 0x9190
-#define GlintV0FloatQTag 0x0232
-#define GlintV0FloatQReg 1
-#define GlintV0FloatQOff 0x8190
-
-#define GlintV0FloatKs 0x9198
-#define GlintV0FloatKsTag 0x0233
-#define GlintV0FloatKsReg 1
-#define GlintV0FloatKsOff 0x8198
-
-#define GlintV0FloatKd 0x91a0
-#define GlintV0FloatKdTag 0x0234
-#define GlintV0FloatKdReg 1
-#define GlintV0FloatKdOff 0x81a0
-
-#define GlintV0FloatR 0x91a8
-#define GlintV0FloatRTag 0x0235
-#define GlintV0FloatRReg 1
-#define GlintV0FloatROff 0x81a8
-
-#define GlintV0FloatG 0x91b0
-#define GlintV0FloatGTag 0x0236
-#define GlintV0FloatGReg 1
-#define GlintV0FloatGOff 0x81b0
-
-#define GlintV0FloatB 0x91b8
-#define GlintV0FloatBTag 0x0237
-#define GlintV0FloatBReg 1
-#define GlintV0FloatBOff 0x81b8
-
-#define GlintV0FloatA 0x91c0
-#define GlintV0FloatATag 0x0238
-#define GlintV0FloatAReg 1
-#define GlintV0FloatAOff 0x81c0
-
-#define GlintV0FloatF 0x91c8
-#define GlintV0FloatFTag 0x0239
-#define GlintV0FloatFReg 1
-#define GlintV0FloatFOff 0x81c8
-
-#define GlintV0FloatX 0x91d0
-#define GlintV0FloatXTag 0x023a
-#define GlintV0FloatXReg 1
-#define GlintV0FloatXOff 0x81d0
-
-#define GlintV0FloatY 0x91d8
-#define GlintV0FloatYTag 0x023b
-#define GlintV0FloatYReg 1
-#define GlintV0FloatYOff 0x81d8
-
-#define GlintV0FloatZ 0x91e0
-#define GlintV0FloatZTag 0x023c
-#define GlintV0FloatZReg 1
-#define GlintV0FloatZOff 0x81e0
-
-#define GlintV1FloatS 0x9200
-#define GlintV1FloatSTag 0x0240
-#define GlintV1FloatSReg 1
-#define GlintV1FloatSOff 0x8200
-
-#define GlintV1FloatT 0x9208
-#define GlintV1FloatTTag 0x0241
-#define GlintV1FloatTReg 1
-#define GlintV1FloatTOff 0x8208
-
-#define GlintV1FloatQ 0x9210
-#define GlintV1FloatQTag 0x0242
-#define GlintV1FloatQReg 1
-#define GlintV1FloatQOff 0x8210
-
-#define GlintV1FloatKs 0x9218
-#define GlintV1FloatKsTag 0x0243
-#define GlintV1FloatKsReg 1
-#define GlintV1FloatKsOff 0x8218
-
-#define GlintV1FloatKd 0x9220
-#define GlintV1FloatKdTag 0x0244
-#define GlintV1FloatKdReg 1
-#define GlintV1FloatKdOff 0x8220
-
-#define GlintV1FloatR 0x9228
-#define GlintV1FloatRTag 0x0245
-#define GlintV1FloatRReg 1
-#define GlintV1FloatROff 0x8228
-
-#define GlintV1FloatG 0x9230
-#define GlintV1FloatGTag 0x0246
-#define GlintV1FloatGReg 1
-#define GlintV1FloatGOff 0x8230
-
-#define GlintV1FloatB 0x9238
-#define GlintV1FloatBTag 0x0247
-#define GlintV1FloatBReg 1
-#define GlintV1FloatBOff 0x8238
-
-#define GlintV1FloatA 0x9240
-#define GlintV1FloatATag 0x0248
-#define GlintV1FloatAReg 1
-#define GlintV1FloatAOff 0x8240
-
-#define GlintV1FloatF 0x9248
-#define GlintV1FloatFTag 0x0249
-#define GlintV1FloatFReg 1
-#define GlintV1FloatFOff 0x8248
-
-#define GlintV1FloatX 0x9250
-#define GlintV1FloatXTag 0x024a
-#define GlintV1FloatXReg 1
-#define GlintV1FloatXOff 0x8250
-
-#define GlintV1FloatY 0x9258
-#define GlintV1FloatYTag 0x024b
-#define GlintV1FloatYReg 1
-#define GlintV1FloatYOff 0x8258
-
-#define GlintV1FloatZ 0x9260
-#define GlintV1FloatZTag 0x024c
-#define GlintV1FloatZReg 1
-#define GlintV1FloatZOff 0x8260
-
-#define GlintV2FloatS 0x9280
-#define GlintV2FloatSTag 0x0250
-#define GlintV2FloatSReg 1
-#define GlintV2FloatSOff 0x8280
-
-#define GlintV2FloatT 0x9288
-#define GlintV2FloatTTag 0x0251
-#define GlintV2FloatTReg 1
-#define GlintV2FloatTOff 0x8288
-
-#define GlintV2FloatQ 0x9290
-#define GlintV2FloatQTag 0x0252
-#define GlintV2FloatQReg 1
-#define GlintV2FloatQOff 0x8290
-
-#define GlintV2FloatKs 0x9298
-#define GlintV2FloatKsTag 0x0253
-#define GlintV2FloatKsReg 1
-#define GlintV2FloatKsOff 0x8298
-
-#define GlintV2FloatKd 0x92a0
-#define GlintV2FloatKdTag 0x0254
-#define GlintV2FloatKdReg 1
-#define GlintV2FloatKdOff 0x82a0
-
-#define GlintV2FloatR 0x92a8
-#define GlintV2FloatRTag 0x0255
-#define GlintV2FloatRReg 1
-#define GlintV2FloatROff 0x82a8
-
-#define GlintV2FloatG 0x92b0
-#define GlintV2FloatGTag 0x0256
-#define GlintV2FloatGReg 1
-#define GlintV2FloatGOff 0x82b0
-
-#define GlintV2FloatB 0x92b8
-#define GlintV2FloatBTag 0x0257
-#define GlintV2FloatBReg 1
-#define GlintV2FloatBOff 0x82b8
-
-#define GlintV2FloatA 0x92c0
-#define GlintV2FloatATag 0x0258
-#define GlintV2FloatAReg 1
-#define GlintV2FloatAOff 0x82c0
-
-#define GlintV2FloatF 0x92c8
-#define GlintV2FloatFTag 0x0259
-#define GlintV2FloatFReg 1
-#define GlintV2FloatFOff 0x82c8
-
-#define GlintV2FloatX 0x92d0
-#define GlintV2FloatXTag 0x025a
-#define GlintV2FloatXReg 1
-#define GlintV2FloatXOff 0x82d0
-
-#define GlintV2FloatY 0x92d8
-#define GlintV2FloatYTag 0x025b
-#define GlintV2FloatYReg 1
-#define GlintV2FloatYOff 0x82d8
-
-#define GlintV2FloatZ 0x92e0
-#define GlintV2FloatZTag 0x025c
-#define GlintV2FloatZReg 1
-#define GlintV2FloatZOff 0x82e0
-
-#define GlintDeltaMode 0x9300
-#define GlintDeltaModeTag 0x0260
-#define GlintDeltaModeReg 1
-#define GlintDeltaModeOff 0x8300
-
-#define GlintDrawTriangle 0x9308
-#define GlintDrawTriangleTag 0x0261
-#define GlintDrawTriangleReg 1
-#define GlintDrawTriangleOff 0x8308
-
-#define GlintRepeatTriangle 0x9310
-#define GlintRepeatTriangleTag 0x0262
-#define GlintRepeatTriangleReg 1
-#define GlintRepeatTriangleOff 0x8310
-
-#define GlintDrawLine01 0x9318
-#define GlintDrawLine01Tag 0x0263
-#define GlintDrawLine01Reg 1
-#define GlintDrawLine01Off 0x8318
-
-#define GlintDrawLine10 0x9320
-#define GlintDrawLine10Tag 0x0264
-#define GlintDrawLine10Reg 1
-#define GlintDrawLine10Off 0x8320
-
-#define GlintRepeatLine 0x9328
-#define GlintRepeatLineTag 0x0265
-#define GlintRepeatLineReg 1
-#define GlintRepeatLineOff 0x8328
-
-#define GlintEpilogueTag 0x9368
-#define GlintEpilogueTagTag 0x026d
-#define GlintEpilogueTagReg 1
-#define GlintEpilogueTagOff 0x8368
-
-#define GlintEpilogueData 0x9370
-#define GlintEpilogueDataTag 0x026e
-#define GlintEpilogueDataReg 1
-#define GlintEpilogueDataOff 0x8370
-
-#define GlintBroadcastMask 0x9378
-#define GlintBroadcastMaskTag 0x026f
-#define GlintBroadcastMaskReg 1
-#define GlintBroadcastMaskOff 0x8378
-
-#define GlintXBias 0x9480
-#define GlintXBiasTag 0x0290
-#define GlintXBiasReg 1
-#define GlintXBiasOff 0x8480
-
-#define GlintYBias 0x9488
-#define GlintYBiasTag 0x0291
-#define GlintYBiasReg 1
-#define GlintYBiasOff 0x8488
-
-#define GlintPointMode 0x9490
-#define GlintPointModeTag 0x0292
-#define GlintPointModeReg 1
-#define GlintPointModeOff 0x8490
-
-#define GlintPointSize 0x9498
-#define GlintPointSizeTag 0x0293
-#define GlintPointSizeReg 1
-#define GlintPointSizeOff 0x8498
-
-#define GlintAApointSize 0x94a0
-#define GlintAApointSizeTag 0x0294
-#define GlintAApointSizeReg 1
-#define GlintAApointSizeOff 0x84a0
-
-#define GlintLineMode 0x94a8
-#define GlintLineModeTag 0x0295
-#define GlintLineModeReg 1
-#define GlintLineModeOff 0x84a8
-
-#define GlintLineWidth 0x94b0
-#define GlintLineWidthTag 0x0296
-#define GlintLineWidthReg 1
-#define GlintLineWidthOff 0x84b0
-
-#define GlintLineWidthOffset 0x94b8
-#define GlintLineWidthOffsetTag 0x0297
-#define GlintLineWidthOffsetReg 1
-#define GlintLineWidthOffsetOff 0x84b8
-
-#define GlintAAlineWidth 0x94c0
-#define GlintAAlineWidthTag 0x0298
-#define GlintAAlineWidthReg 1
-#define GlintAAlineWidthOff 0x84c0
-
-#define GlintTriangleMode 0x94c8
-#define GlintTriangleModeTag 0x0299
-#define GlintTriangleModeReg 1
-#define GlintTriangleModeOff 0x84c8
-
-#define GlintRectangleMode 0x94d0
-#define GlintRectangleModeTag 0x029a
-#define GlintRectangleModeReg 1
-#define GlintRectangleModeOff 0x84d0
-
-#define GlintRectangleWidth 0x94d8
-#define GlintRectangleWidthTag 0x029b
-#define GlintRectangleWidthReg 1
-#define GlintRectangleWidthOff 0x84d8
-
-#define GlintRectangleHeight 0x94e0
-#define GlintRectangleHeightTag 0x029c
-#define GlintRectangleHeightReg 1
-#define GlintRectangleHeightOff 0x84e0
-
-#define GlintRectangle2DMode 0x94e8
-#define GlintRectangle2DModeTag 0x029d
-#define GlintRectangle2DModeReg 1
-#define GlintRectangle2DModeOff 0x84e8
-
-#define GlintRectangle2DControl 0x94f0
-#define GlintRectangle2DControlTag 0x029e
-#define GlintRectangle2DControlReg 1
-#define GlintRectangle2DControlOff 0x84f0
-
-#define GlintTransformMode 0x9508
-#define GlintTransformModeTag 0x02a1
-#define GlintTransformModeReg 1
-#define GlintTransformModeOff 0x8508
-
-#define GlintGeometryMode 0x9510
-#define GlintGeometryModeTag 0x02a2
-#define GlintGeometryModeReg 1
-#define GlintGeometryModeOff 0x8510
-
-#define GlintNormalizeMode 0x9518
-#define GlintNormalizeModeTag 0x02a3
-#define GlintNormalizeModeReg 1
-#define GlintNormalizeModeOff 0x8518
-
-#define GlintLightingMode 0x9520
-#define GlintLightingModeTag 0x02a4
-#define GlintLightingModeReg 1
-#define GlintLightingModeOff 0x8520
-
-#define GlintColorMaterialMode 0x9528
-#define GlintColorMaterialModeTag 0x02a5
-#define GlintColorMaterialModeReg 1
-#define GlintColorMaterialModeOff 0x8528
-
-#define GlintMaterialMode 0x9530
-#define GlintMaterialModeTag 0x02a6
-#define GlintMaterialModeReg 1
-#define GlintMaterialModeOff 0x8530
-
-#define GlintSelectResult 0x9580
-#define GlintSelectResultTag 0x02b0
-#define GlintSelectResultReg 1
-#define GlintSelectResultOff 0x8580
-
-#define GlintBegin 0x9590
-#define GlintBeginTag 0x02b2
-#define GlintBeginReg 1
-#define GlintBeginOff 0x8590
-
-#define GlintEnd 0x9598
-#define GlintEndTag 0x02b3
-#define GlintEndReg 1
-#define GlintEndOff 0x8598
-
-#define GlintEdgeFlag 0x95a0
-#define GlintEdgeFlagTag 0x02b4
-#define GlintEdgeFlagReg 1
-#define GlintEdgeFlagOff 0x85a0
-
-#define GlintObjectIDvalue 0x95a8
-#define GlintObjectIDvalueTag 0x02b5
-#define GlintObjectIDvalueReg 1
-#define GlintObjectIDvalueOff 0x85a8
-
-#define GlintIncrementObjectID 0x95b0
-#define GlintIncrementObjectIDTag 0x02b6
-#define GlintIncrementObjectIDReg 1
-#define GlintIncrementObjectIDOff 0x85b0
-
-#define GlintTransformCurrent 0x95b8
-#define GlintTransformCurrentTag 0x02b7
-#define GlintTransformCurrentReg 1
-#define GlintTransformCurrentOff 0x85b8
-
-#define GlintSaveCurrent 0x95c8
-#define GlintSaveCurrentTag 0x02b9
-#define GlintSaveCurrentReg 1
-#define GlintSaveCurrentOff 0x85c8
-
-#define GlintRestoreCurrent 0x95d0
-#define GlintRestoreCurrentTag 0x02ba
-#define GlintRestoreCurrentReg 1
-#define GlintRestoreCurrentOff 0x85d0
-
-#define GlintInitNames 0x95d8
-#define GlintInitNamesTag 0x02bb
-#define GlintInitNamesReg 1
-#define GlintInitNamesOff 0x85d8
-
-#define GlintPushName 0x95e0
-#define GlintPushNameTag 0x02bc
-#define GlintPushNameReg 1
-#define GlintPushNameOff 0x85e0
-
-#define GlintPopName 0x95e8
-#define GlintPopNameTag 0x02bd
-#define GlintPopNameReg 1
-#define GlintPopNameOff 0x85e8
-
-#define GlintLoadName 0x95f0
-#define GlintLoadNameTag 0x02be
-#define GlintLoadNameReg 1
-#define GlintLoadNameOff 0x85f0
-
-#define GlintGeomRectangle 0x96a0
-#define GlintGeomRectangleTag 0x02d4
-#define GlintGeomRectangleReg 1
-#define GlintGeomRectangleOff 0x86a0
-
-#define GlintDrawRectangle2D 0x97a0
-#define GlintDrawRectangle2DTag 0x02f4
-#define GlintDrawRectangle2DReg 1
-#define GlintDrawRectangle2DOff 0x87a0
-
-#define GlintNz 0x9800
-#define GlintNzTag 0x0300
-#define GlintNzReg 1
-#define GlintNzOff 0x8800
-
-#define GlintNy 0x9808
-#define GlintNyTag 0x0301
-#define GlintNyReg 1
-#define GlintNyOff 0x8808
-
-#define GlintNx 0x9810
-#define GlintNxTag 0x0302
-#define GlintNxReg 1
-#define GlintNxOff 0x8810
-
-#define GlintCa 0x9818
-#define GlintCaTag 0x0303
-#define GlintCaReg 1
-#define GlintCaOff 0x8818
-
-#define GlintCb 0x9820
-#define GlintCbTag 0x0304
-#define GlintCbReg 1
-#define GlintCbOff 0x8820
-
-#define GlintCg 0x9828
-#define GlintCgTag 0x0305
-#define GlintCgReg 1
-#define GlintCgOff 0x8828
-
-#define GlintCr3 0x9830
-#define GlintCr3Tag 0x0306
-#define GlintCr3Reg 1
-#define GlintCr3Off 0x8830
-
-#define GlintCr4 0x9838
-#define GlintCr4Tag 0x0307
-#define GlintCr4Reg 1
-#define GlintCr4Off 0x8838
-
-#define GlintTt2 0x9840
-#define GlintTt2Tag 0x0308
-#define GlintTt2Reg 1
-#define GlintTt2Off 0x8840
-
-#define GlintTs2 0x9848
-#define GlintTs2Tag 0x0309
-#define GlintTs2Reg 1
-#define GlintTs2Off 0x8848
-
-#define GlintVw 0x9850
-#define GlintVwTag 0x030a
-#define GlintVwReg 1
-#define GlintVwOff 0x8850
-
-#define GlintVz 0x9858
-#define GlintVzTag 0x030b
-#define GlintVzReg 1
-#define GlintVzOff 0x8858
-
-#define GlintVy 0x9860
-#define GlintVyTag 0x030c
-#define GlintVyReg 1
-#define GlintVyOff 0x8860
-
-#define GlintVx2 0x9868
-#define GlintVx2Tag 0x030d
-#define GlintVx2Reg 1
-#define GlintVx2Off 0x8868
-
-#define GlintVx3 0x9870
-#define GlintVx3Tag 0x030e
-#define GlintVx3Reg 1
-#define GlintVx3Off 0x8870
-
-#define GlintVx4 0x9878
-#define GlintVx4Tag 0x030f
-#define GlintVx4Reg 1
-#define GlintVx4Off 0x8878
-
-#define GlintFNz 0x9880
-#define GlintFNzTag 0x0310
-#define GlintFNzReg 1
-#define GlintFNzOff 0x8880
-
-#define GlintFNy 0x9888
-#define GlintFNyTag 0x0311
-#define GlintFNyReg 1
-#define GlintFNyOff 0x8888
-
-#define GlintFNx 0x9890
-#define GlintFNxTag 0x0312
-#define GlintFNxReg 1
-#define GlintFNxOff 0x8890
-
-#define GlintPackedColor3 0x9898
-#define GlintPackedColor3Tag 0x0313
-#define GlintPackedColor3Reg 1
-#define GlintPackedColor3Off 0x8898
-
-#define GlintPackedColor4 0x98a0
-#define GlintPackedColor4Tag 0x0314
-#define GlintPackedColor4Reg 1
-#define GlintPackedColor4Off 0x88a0
-
-#define GlintTq4 0x98a8
-#define GlintTq4Tag 0x0315
-#define GlintTq4Reg 1
-#define GlintTq4Off 0x88a8
-
-#define GlintTr4 0x98b0
-#define GlintTr4Tag 0x0316
-#define GlintTr4Reg 1
-#define GlintTr4Off 0x88b0
-
-#define GlintTt4 0x98b8
-#define GlintTt4Tag 0x0317
-#define GlintTt4Reg 1
-#define GlintTt4Off 0x88b8
-
-#define GlintTs4 0x98c0
-#define GlintTs4Tag 0x0318
-#define GlintTs4Reg 1
-#define GlintTs4Off 0x88c0
-
-#define GlintRPw 0x98c8
-#define GlintRPwTag 0x0319
-#define GlintRPwReg 1
-#define GlintRPwOff 0x88c8
-
-#define GlintRPz 0x98d0
-#define GlintRPzTag 0x031a
-#define GlintRPzReg 1
-#define GlintRPzOff 0x88d0
-
-#define GlintRPy 0x98d8
-#define GlintRPyTag 0x031b
-#define GlintRPyReg 1
-#define GlintRPyOff 0x88d8
-
-#define GlintRPx2 0x98e0
-#define GlintRPx2Tag 0x031c
-#define GlintRPx2Reg 1
-#define GlintRPx2Off 0x88e0
-
-#define GlintRPx3 0x98e8
-#define GlintRPx3Tag 0x031d
-#define GlintRPx3Reg 1
-#define GlintRPx3Off 0x88e8
-
-#define GlintRPx4 0x98f0
-#define GlintRPx4Tag 0x031e
-#define GlintRPx4Reg 1
-#define GlintRPx4Off 0x88f0
-
-#define GlintTs1 0x98f8
-#define GlintTs1Tag 0x031f
-#define GlintTs1Reg 1
-#define GlintTs1Off 0x88f8
-
-#define GlintModelViewMatrix0 0x9900
-#define GlintModelViewMatrix0Tag 0x0320
-#define GlintModelViewMatrix0Reg 1
-#define GlintModelViewMatrix0Off 0x8900
-
-#define GlintModelViewMatrix1 0x9908
-#define GlintModelViewMatrix1Tag 0x0321
-#define GlintModelViewMatrix1Reg 1
-#define GlintModelViewMatrix1Off 0x8908
-
-#define GlintModelViewMatrix2 0x9910
-#define GlintModelViewMatrix2Tag 0x0322
-#define GlintModelViewMatrix2Reg 1
-#define GlintModelViewMatrix2Off 0x8910
-
-#define GlintModelViewMatrix3 0x9918
-#define GlintModelViewMatrix3Tag 0x0323
-#define GlintModelViewMatrix3Reg 1
-#define GlintModelViewMatrix3Off 0x8918
-
-#define GlintModelViewMatrix4 0x9920
-#define GlintModelViewMatrix4Tag 0x0324
-#define GlintModelViewMatrix4Reg 1
-#define GlintModelViewMatrix4Off 0x8920
-
-#define GlintModelViewMatrix5 0x9928
-#define GlintModelViewMatrix5Tag 0x0325
-#define GlintModelViewMatrix5Reg 1
-#define GlintModelViewMatrix5Off 0x8928
-
-#define GlintModelViewMatrix6 0x9930
-#define GlintModelViewMatrix6Tag 0x0326
-#define GlintModelViewMatrix6Reg 1
-#define GlintModelViewMatrix6Off 0x8930
-
-#define GlintModelViewMatrix7 0x9938
-#define GlintModelViewMatrix7Tag 0x0327
-#define GlintModelViewMatrix7Reg 1
-#define GlintModelViewMatrix7Off 0x8938
-
-#define GlintModelViewMatrix8 0x9940
-#define GlintModelViewMatrix8Tag 0x0328
-#define GlintModelViewMatrix8Reg 1
-#define GlintModelViewMatrix8Off 0x8940
-
-#define GlintModelViewMatrix9 0x9948
-#define GlintModelViewMatrix9Tag 0x0329
-#define GlintModelViewMatrix9Reg 1
-#define GlintModelViewMatrix9Off 0x8948
-
-#define GlintModelViewMatrix10 0x9950
-#define GlintModelViewMatrix10Tag 0x032a
-#define GlintModelViewMatrix10Reg 1
-#define GlintModelViewMatrix10Off 0x8950
-
-#define GlintModelViewMatrix11 0x9958
-#define GlintModelViewMatrix11Tag 0x032b
-#define GlintModelViewMatrix11Reg 1
-#define GlintModelViewMatrix11Off 0x8958
-
-#define GlintModelViewMatrix12 0x9960
-#define GlintModelViewMatrix12Tag 0x032c
-#define GlintModelViewMatrix12Reg 1
-#define GlintModelViewMatrix12Off 0x8960
-
-#define GlintModelViewMatrix13 0x9968
-#define GlintModelViewMatrix13Tag 0x032d
-#define GlintModelViewMatrix13Reg 1
-#define GlintModelViewMatrix13Off 0x8968
-
-#define GlintModelViewMatrix14 0x9970
-#define GlintModelViewMatrix14Tag 0x032e
-#define GlintModelViewMatrix14Reg 1
-#define GlintModelViewMatrix14Off 0x8970
-
-#define GlintModelViewMatrix15 0x9978
-#define GlintModelViewMatrix15Tag 0x032f
-#define GlintModelViewMatrix15Reg 1
-#define GlintModelViewMatrix15Off 0x8978
-
-#define GlintModelViewProjectionMatrix0 0x9980
-#define GlintModelViewProjectionMatrix0Tag 0x0330
-#define GlintModelViewProjectionMatrix0Reg 1
-#define GlintModelViewProjectionMatrix0Off 0x8980
-
-#define GlintModelViewProjectionMatrix1 0x9988
-#define GlintModelViewProjectionMatrix1Tag 0x0331
-#define GlintModelViewProjectionMatrix1Reg 1
-#define GlintModelViewProjectionMatrix1Off 0x8988
-
-#define GlintModelViewProjectionMatrix2 0x9990
-#define GlintModelViewProjectionMatrix2Tag 0x0332
-#define GlintModelViewProjectionMatrix2Reg 1
-#define GlintModelViewProjectionMatrix2Off 0x8990
-
-#define GlintModelViewProjectionMatrix3 0x9998
-#define GlintModelViewProjectionMatrix3Tag 0x0333
-#define GlintModelViewProjectionMatrix3Reg 1
-#define GlintModelViewProjectionMatrix3Off 0x8998
-
-#define GlintModelViewProjectionMatrix4 0x99a0
-#define GlintModelViewProjectionMatrix4Tag 0x0334
-#define GlintModelViewProjectionMatrix4Reg 1
-#define GlintModelViewProjectionMatrix4Off 0x89a0
-
-#define GlintModelViewProjectionMatrix5 0x99a8
-#define GlintModelViewProjectionMatrix5Tag 0x0335
-#define GlintModelViewProjectionMatrix5Reg 1
-#define GlintModelViewProjectionMatrix5Off 0x89a8
-
-#define GlintModelViewProjectionMatrix6 0x99b0
-#define GlintModelViewProjectionMatrix6Tag 0x0336
-#define GlintModelViewProjectionMatrix6Reg 1
-#define GlintModelViewProjectionMatrix6Off 0x89b0
-
-#define GlintModelViewProjectionMatrix7 0x99b8
-#define GlintModelViewProjectionMatrix7Tag 0x0337
-#define GlintModelViewProjectionMatrix7Reg 1
-#define GlintModelViewProjectionMatrix7Off 0x89b8
-
-#define GlintModelViewProjectionMatrix8 0x99c0
-#define GlintModelViewProjectionMatrix8Tag 0x0338
-#define GlintModelViewProjectionMatrix8Reg 1
-#define GlintModelViewProjectionMatrix8Off 0x89c0
-
-#define GlintModelViewProjectionMatrix9 0x99c8
-#define GlintModelViewProjectionMatrix9Tag 0x0339
-#define GlintModelViewProjectionMatrix9Reg 1
-#define GlintModelViewProjectionMatrix9Off 0x89c8
-
-#define GlintModelViewProjectionMatrix10 0x99d0
-#define GlintModelViewProjectionMatrix10Tag 0x033a
-#define GlintModelViewProjectionMatrix10Reg 1
-#define GlintModelViewProjectionMatrix10Off 0x89d0
-
-#define GlintModelViewProjectionMatrix11 0x99d8
-#define GlintModelViewProjectionMatrix11Tag 0x033b
-#define GlintModelViewProjectionMatrix11Reg 1
-#define GlintModelViewProjectionMatrix11Off 0x89d8
-
-#define GlintModelViewProjectionMatrix12 0x99e0
-#define GlintModelViewProjectionMatrix12Tag 0x033c
-#define GlintModelViewProjectionMatrix12Reg 1
-#define GlintModelViewProjectionMatrix12Off 0x89e0
-
-#define GlintModelViewProjectionMatrix13 0x99e8
-#define GlintModelViewProjectionMatrix13Tag 0x033d
-#define GlintModelViewProjectionMatrix13Reg 1
-#define GlintModelViewProjectionMatrix13Off 0x89e8
-
-#define GlintModelViewProjectionMatrix14 0x99f0
-#define GlintModelViewProjectionMatrix14Tag 0x033e
-#define GlintModelViewProjectionMatrix14Reg 1
-#define GlintModelViewProjectionMatrix14Off 0x89f0
-
-#define GlintModelViewProjectionMatrix15 0x99f8
-#define GlintModelViewProjectionMatrix15Tag 0x033f
-#define GlintModelViewProjectionMatrix15Reg 1
-#define GlintModelViewProjectionMatrix15Off 0x89f8
-
-#define GlintNormalMatrix0 0x9a00
-#define GlintNormalMatrix0Tag 0x0340
-#define GlintNormalMatrix0Reg 1
-#define GlintNormalMatrix0Off 0x8a00
-
-#define GlintNormalMatrix1 0x9a08
-#define GlintNormalMatrix1Tag 0x0341
-#define GlintNormalMatrix1Reg 1
-#define GlintNormalMatrix1Off 0x8a08
-
-#define GlintNormalMatrix2 0x9a10
-#define GlintNormalMatrix2Tag 0x0342
-#define GlintNormalMatrix2Reg 1
-#define GlintNormalMatrix2Off 0x8a10
-
-#define GlintNormalMatrix3 0x9a18
-#define GlintNormalMatrix3Tag 0x0343
-#define GlintNormalMatrix3Reg 1
-#define GlintNormalMatrix3Off 0x8a18
-
-#define GlintNormalMatrix4 0x9a20
-#define GlintNormalMatrix4Tag 0x0344
-#define GlintNormalMatrix4Reg 1
-#define GlintNormalMatrix4Off 0x8a20
-
-#define GlintNormalMatrix5 0x9a28
-#define GlintNormalMatrix5Tag 0x0345
-#define GlintNormalMatrix5Reg 1
-#define GlintNormalMatrix5Off 0x8a28
-
-#define GlintNormalMatrix6 0x9a30
-#define GlintNormalMatrix6Tag 0x0346
-#define GlintNormalMatrix6Reg 1
-#define GlintNormalMatrix6Off 0x8a30
-
-#define GlintNormalMatrix7 0x9a38
-#define GlintNormalMatrix7Tag 0x0347
-#define GlintNormalMatrix7Reg 1
-#define GlintNormalMatrix7Off 0x8a38
-
-#define GlintNormalMatrix8 0x9a40
-#define GlintNormalMatrix8Tag 0x0348
-#define GlintNormalMatrix8Reg 1
-#define GlintNormalMatrix8Off 0x8a40
-
-#define GlintTextureMatrix0 0x9a80
-#define GlintTextureMatrix0Tag 0x0350
-#define GlintTextureMatrix0Reg 1
-#define GlintTextureMatrix0Off 0x8a80
-
-#define GlintTextureMatrix1 0x9a88
-#define GlintTextureMatrix1Tag 0x0351
-#define GlintTextureMatrix1Reg 1
-#define GlintTextureMatrix1Off 0x8a88
-
-#define GlintTextureMatrix2 0x9a90
-#define GlintTextureMatrix2Tag 0x0352
-#define GlintTextureMatrix2Reg 1
-#define GlintTextureMatrix2Off 0x8a90
-
-#define GlintTextureMatrix3 0x9a98
-#define GlintTextureMatrix3Tag 0x0353
-#define GlintTextureMatrix3Reg 1
-#define GlintTextureMatrix3Off 0x8a98
-
-#define GlintTextureMatrix4 0x9aa0
-#define GlintTextureMatrix4Tag 0x0354
-#define GlintTextureMatrix4Reg 1
-#define GlintTextureMatrix4Off 0x8aa0
-
-#define GlintTextureMatrix5 0x9aa8
-#define GlintTextureMatrix5Tag 0x0355
-#define GlintTextureMatrix5Reg 1
-#define GlintTextureMatrix5Off 0x8aa8
-
-#define GlintTextureMatrix6 0x9ab0
-#define GlintTextureMatrix6Tag 0x0356
-#define GlintTextureMatrix6Reg 1
-#define GlintTextureMatrix6Off 0x8ab0
-
-#define GlintTextureMatrix7 0x9ab8
-#define GlintTextureMatrix7Tag 0x0357
-#define GlintTextureMatrix7Reg 1
-#define GlintTextureMatrix7Off 0x8ab8
-
-#define GlintTextureMatrix8 0x9ac0
-#define GlintTextureMatrix8Tag 0x0358
-#define GlintTextureMatrix8Reg 1
-#define GlintTextureMatrix8Off 0x8ac0
-
-#define GlintTextureMatrix9 0x9ac8
-#define GlintTextureMatrix9Tag 0x0359
-#define GlintTextureMatrix9Reg 1
-#define GlintTextureMatrix9Off 0x8ac8
-
-#define GlintTextureMatrix10 0x9ad0
-#define GlintTextureMatrix10Tag 0x035a
-#define GlintTextureMatrix10Reg 1
-#define GlintTextureMatrix10Off 0x8ad0
-
-#define GlintTextureMatrix11 0x9ad8
-#define GlintTextureMatrix11Tag 0x035b
-#define GlintTextureMatrix11Reg 1
-#define GlintTextureMatrix11Off 0x8ad8
-
-#define GlintTextureMatrix12 0x9ae0
-#define GlintTextureMatrix12Tag 0x035c
-#define GlintTextureMatrix12Reg 1
-#define GlintTextureMatrix12Off 0x8ae0
-
-#define GlintTextureMatrix13 0x9ae8
-#define GlintTextureMatrix13Tag 0x035d
-#define GlintTextureMatrix13Reg 1
-#define GlintTextureMatrix13Off 0x8ae8
-
-#define GlintTextureMatrix14 0x9af0
-#define GlintTextureMatrix14Tag 0x035e
-#define GlintTextureMatrix14Reg 1
-#define GlintTextureMatrix14Off 0x8af0
-
-#define GlintTextureMatrix15 0x9af8
-#define GlintTextureMatrix15Tag 0x035f
-#define GlintTextureMatrix15Reg 1
-#define GlintTextureMatrix15Off 0x8af8
-
-#define GlintTexGen0 0x9b00
-#define GlintTexGen0Tag 0x0360
-#define GlintTexGen0Reg 1
-#define GlintTexGen0Off 0x8b00
-
-#define GlintTexGen1 0x9b08
-#define GlintTexGen1Tag 0x0361
-#define GlintTexGen1Reg 1
-#define GlintTexGen1Off 0x8b08
-
-#define GlintTexGen2 0x9b10
-#define GlintTexGen2Tag 0x0362
-#define GlintTexGen2Reg 1
-#define GlintTexGen2Off 0x8b10
-
-#define GlintTexGen3 0x9b18
-#define GlintTexGen3Tag 0x0363
-#define GlintTexGen3Reg 1
-#define GlintTexGen3Off 0x8b18
-
-#define GlintTexGen4 0x9b20
-#define GlintTexGen4Tag 0x0364
-#define GlintTexGen4Reg 1
-#define GlintTexGen4Off 0x8b20
-
-#define GlintTexGen5 0x9b28
-#define GlintTexGen5Tag 0x0365
-#define GlintTexGen5Reg 1
-#define GlintTexGen5Off 0x8b28
-
-#define GlintTexGen6 0x9b30
-#define GlintTexGen6Tag 0x0366
-#define GlintTexGen6Reg 1
-#define GlintTexGen6Off 0x8b30
-
-#define GlintTexGen7 0x9b38
-#define GlintTexGen7Tag 0x0367
-#define GlintTexGen7Reg 1
-#define GlintTexGen7Off 0x8b38
-
-#define GlintTexGen8 0x9b40
-#define GlintTexGen8Tag 0x0368
-#define GlintTexGen8Reg 1
-#define GlintTexGen8Off 0x8b40
-
-#define GlintTexGen9 0x9b48
-#define GlintTexGen9Tag 0x0369
-#define GlintTexGen9Reg 1
-#define GlintTexGen9Off 0x8b48
-
-#define GlintTexGen10 0x9b50
-#define GlintTexGen10Tag 0x036a
-#define GlintTexGen10Reg 1
-#define GlintTexGen10Off 0x8b50
-
-#define GlintTexGen11 0x9b58
-#define GlintTexGen11Tag 0x036b
-#define GlintTexGen11Reg 1
-#define GlintTexGen11Off 0x8b58
-
-#define GlintTexGen12 0x9b60
-#define GlintTexGen12Tag 0x036c
-#define GlintTexGen12Reg 1
-#define GlintTexGen12Off 0x8b60
-
-#define GlintTexGen13 0x9b68
-#define GlintTexGen13Tag 0x036d
-#define GlintTexGen13Reg 1
-#define GlintTexGen13Off 0x8b68
-
-#define GlintTexGen14 0x9b70
-#define GlintTexGen14Tag 0x036e
-#define GlintTexGen14Reg 1
-#define GlintTexGen14Off 0x8b70
-
-#define GlintTexGen15 0x9b78
-#define GlintTexGen15Tag 0x036f
-#define GlintTexGen15Reg 1
-#define GlintTexGen15Off 0x8b78
-
-#define GlintViewPortScaleX 0x9b80
-#define GlintViewPortScaleXTag 0x0370
-#define GlintViewPortScaleXReg 1
-#define GlintViewPortScaleXOff 0x8b80
-
-#define GlintViewPortScaleY 0x9b88
-#define GlintViewPortScaleYTag 0x0371
-#define GlintViewPortScaleYReg 1
-#define GlintViewPortScaleYOff 0x8b88
-
-#define GlintViewPortScaleZ 0x9b90
-#define GlintViewPortScaleZTag 0x0372
-#define GlintViewPortScaleZReg 1
-#define GlintViewPortScaleZOff 0x8b90
-
-#define GlintViewPortOffsetX 0x9b98
-#define GlintViewPortOffsetXTag 0x0373
-#define GlintViewPortOffsetXReg 1
-#define GlintViewPortOffsetXOff 0x8b98
-
-#define GlintViewPortOffsetY 0x9ba0
-#define GlintViewPortOffsetYTag 0x0374
-#define GlintViewPortOffsetYReg 1
-#define GlintViewPortOffsetYOff 0x8ba0
-
-#define GlintViewPortOffsetZ 0x9ba8
-#define GlintViewPortOffsetZTag 0x0375
-#define GlintViewPortOffsetZReg 1
-#define GlintViewPortOffsetZOff 0x8ba8
-
-#define GlintFogDensity 0x9bb0
-#define GlintFogDensityTag 0x0376
-#define GlintFogDensityReg 1
-#define GlintFogDensityOff 0x8bb0
-
-#define GlintFogScale 0x9bb8
-#define GlintFogScaleTag 0x0377
-#define GlintFogScaleReg 1
-#define GlintFogScaleOff 0x8bb8
-
-#define GlintFogEnd 0x9bc0
-#define GlintFogEndTag 0x0378
-#define GlintFogEndReg 1
-#define GlintFogEndOff 0x8bc0
-
-#define GlintPolygonOffsetFactor 0x9bc8
-#define GlintPolygonOffsetFactorTag 0x0379
-#define GlintPolygonOffsetFactorReg 1
-#define GlintPolygonOffsetFactorOff 0x8bc8
-
-#define GlintPolygonOffsetBias 0x9bd0
-#define GlintPolygonOffsetBiasTag 0x037a
-#define GlintPolygonOffsetBiasReg 1
-#define GlintPolygonOffsetBiasOff 0x8bd0
-
-#define GlintLineClipLengthThreshold 0x9bd8
-#define GlintLineClipLengthThresholdTag 0x037b
-#define GlintLineClipLengthThresholdReg 1
-#define GlintLineClipLengthThresholdOff 0x8bd8
-
-#define GlintTriangleClipAreaThreshold 0x9be0
-#define GlintTriangleClipAreaThresholdTag 0x037c
-#define GlintTriangleClipAreaThresholdReg 1
-#define GlintTriangleClipAreaThresholdOff 0x8be0
-
-#define GlintRasterPosXIncrement 0x9be8
-#define GlintRasterPosXIncrementTag 0x037d
-#define GlintRasterPosXIncrementReg 1
-#define GlintRasterPosXIncrementOff 0x8be8
-
-#define GlintRasterPosYIncrement 0x9bf0
-#define GlintRasterPosYIncrementTag 0x037e
-#define GlintRasterPosYIncrementReg 1
-#define GlintRasterPosYIncrementOff 0x8bf0
-
-#define GlintUserClip0X 0x9c00
-#define GlintUserClip0XTag 0x0380
-#define GlintUserClip0XReg 1
-#define GlintUserClip0XOff 0x8c00
-
-#define GlintUserClip0Y 0x9c08
-#define GlintUserClip0YTag 0x0381
-#define GlintUserClip0YReg 1
-#define GlintUserClip0YOff 0x8c08
-
-#define GlintUserClip0Z 0x9c10
-#define GlintUserClip0ZTag 0x0382
-#define GlintUserClip0ZReg 1
-#define GlintUserClip0ZOff 0x8c10
-
-#define GlintUserClip0W 0x9c18
-#define GlintUserClip0WTag 0x0383
-#define GlintUserClip0WReg 1
-#define GlintUserClip0WOff 0x8c18
-
-#define GlintUserClip1X 0x9c20
-#define GlintUserClip1XTag 0x0384
-#define GlintUserClip1XReg 1
-#define GlintUserClip1XOff 0x8c20
-
-#define GlintUserClip1Y 0x9c28
-#define GlintUserClip1YTag 0x0385
-#define GlintUserClip1YReg 1
-#define GlintUserClip1YOff 0x8c28
-
-#define GlintUserClip1Z 0x9c30
-#define GlintUserClip1ZTag 0x0386
-#define GlintUserClip1ZReg 1
-#define GlintUserClip1ZOff 0x8c30
-
-#define GlintUserClip1W 0x9c38
-#define GlintUserClip1WTag 0x0387
-#define GlintUserClip1WReg 1
-#define GlintUserClip1WOff 0x8c38
-
-#define GlintUserClip2X 0x9c40
-#define GlintUserClip2XTag 0x0388
-#define GlintUserClip2XReg 1
-#define GlintUserClip2XOff 0x8c40
-
-#define GlintUserClip2Y 0x9c48
-#define GlintUserClip2YTag 0x0389
-#define GlintUserClip2YReg 1
-#define GlintUserClip2YOff 0x8c48
-
-#define GlintUserClip2Z 0x9c50
-#define GlintUserClip2ZTag 0x038a
-#define GlintUserClip2ZReg 1
-#define GlintUserClip2ZOff 0x8c50
-
-#define GlintUserClip2W 0x9c58
-#define GlintUserClip2WTag 0x038b
-#define GlintUserClip2WReg 1
-#define GlintUserClip2WOff 0x8c58
-
-#define GlintUserClip3X 0x9c60
-#define GlintUserClip3XTag 0x038c
-#define GlintUserClip3XReg 1
-#define GlintUserClip3XOff 0x8c60
-
-#define GlintUserClip3Y 0x9c68
-#define GlintUserClip3YTag 0x038d
-#define GlintUserClip3YReg 1
-#define GlintUserClip3YOff 0x8c68
-
-#define GlintUserClip3Z 0x9c70
-#define GlintUserClip3ZTag 0x038e
-#define GlintUserClip3ZReg 1
-#define GlintUserClip3ZOff 0x8c70
-
-#define GlintUserClip3W 0x9c78
-#define GlintUserClip3WTag 0x038f
-#define GlintUserClip3WReg 1
-#define GlintUserClip3WOff 0x8c78
-
-#define GlintUserClip4X 0x9c80
-#define GlintUserClip4XTag 0x0390
-#define GlintUserClip4XReg 1
-#define GlintUserClip4XOff 0x8c80
-
-#define GlintUserClip4Y 0x9c88
-#define GlintUserClip4YTag 0x0391
-#define GlintUserClip4YReg 1
-#define GlintUserClip4YOff 0x8c88
-
-#define GlintUserClip4Z 0x9c90
-#define GlintUserClip4ZTag 0x0392
-#define GlintUserClip4ZReg 1
-#define GlintUserClip4ZOff 0x8c90
-
-#define GlintUserClip4W 0x9c98
-#define GlintUserClip4WTag 0x0393
-#define GlintUserClip4WReg 1
-#define GlintUserClip4WOff 0x8c98
-
-#define GlintUserClip5X 0x9ca0
-#define GlintUserClip5XTag 0x0394
-#define GlintUserClip5XReg 1
-#define GlintUserClip5XOff 0x8ca0
-
-#define GlintUserClip5Y 0x9ca8
-#define GlintUserClip5YTag 0x0395
-#define GlintUserClip5YReg 1
-#define GlintUserClip5YOff 0x8ca8
-
-#define GlintUserClip5Z 0x9cb0
-#define GlintUserClip5ZTag 0x0396
-#define GlintUserClip5ZReg 1
-#define GlintUserClip5ZOff 0x8cb0
-
-#define GlintUserClip5W 0x9cb8
-#define GlintUserClip5WTag 0x0397
-#define GlintUserClip5WReg 1
-#define GlintUserClip5WOff 0x8cb8
-
-#define GlintRasterPosXOffset 0x9ce8
-#define GlintRasterPosXOffsetTag 0x039d
-#define GlintRasterPosXOffsetReg 1
-#define GlintRasterPosXOffsetOff 0x8ce8
-
-#define GlintRasterPosYOffset 0x9cf0
-#define GlintRasterPosYOffsetTag 0x039e
-#define GlintRasterPosYOffsetReg 1
-#define GlintRasterPosYOffsetOff 0x8cf0
-
-#define GlintAttenuationCutOff 0x9cf8
-#define GlintAttenuationCutOffTag 0x039f
-#define GlintAttenuationCutOffReg 1
-#define GlintAttenuationCutOffOff 0x8cf8
-
-#define GlintLight0Mode 0x9d00
-#define GlintLight0ModeTag 0x03a0
-#define GlintLight0ModeReg 1
-#define GlintLight0ModeOff 0x8d00
-
-#define GlintLight0AmbientIntensityRed 0x9d08
-#define GlintLight0AmbientIntensityRedTag 0x03a1
-#define GlintLight0AmbientIntensityRedReg 1
-#define GlintLight0AmbientIntensityRedOff 0x8d08
-
-#define GlintLight0AmbientIntensityGreen 0x9d10
-#define GlintLight0AmbientIntensityGreenTag 0x03a2
-#define GlintLight0AmbientIntensityGreenReg 1
-#define GlintLight0AmbientIntensityGreenOff 0x8d10
-
-#define GlintLight0AmbientIntensityBlue 0x9d18
-#define GlintLight0AmbientIntensityBlueTag 0x03a3
-#define GlintLight0AmbientIntensityBlueReg 1
-#define GlintLight0AmbientIntensityBlueOff 0x8d18
-
-#define GlintLight0DiffuseIntensityRed 0x9d20
-#define GlintLight0DiffuseIntensityRedTag 0x03a4
-#define GlintLight0DiffuseIntensityRedReg 1
-#define GlintLight0DiffuseIntensityRedOff 0x8d20
-
-#define GlintLight0DiffuseIntensityGreen 0x9d28
-#define GlintLight0DiffuseIntensityGreenTag 0x03a5
-#define GlintLight0DiffuseIntensityGreenReg 1
-#define GlintLight0DiffuseIntensityGreenOff 0x8d28
-
-#define GlintLight0DiffuseIntensityBlue 0x9d30
-#define GlintLight0DiffuseIntensityBlueTag 0x03a6
-#define GlintLight0DiffuseIntensityBlueReg 1
-#define GlintLight0DiffuseIntensityBlueOff 0x8d30
-
-#define GlintLight0SpecularIntensityRed 0x9d38
-#define GlintLight0SpecularIntensityRedTag 0x03a7
-#define GlintLight0SpecularIntensityRedReg 1
-#define GlintLight0SpecularIntensityRedOff 0x8d38
-
-#define GlintLight0SpecularIntensityGreen 0x9d40
-#define GlintLight0SpecularIntensityGreenTag 0x03a8
-#define GlintLight0SpecularIntensityGreenReg 1
-#define GlintLight0SpecularIntensityGreenOff 0x8d40
-
-#define GlintLight0SpecularIntensityBlue 0x9d48
-#define GlintLight0SpecularIntensityBlueTag 0x03a9
-#define GlintLight0SpecularIntensityBlueReg 1
-#define GlintLight0SpecularIntensityBlueOff 0x8d48
-
-#define GlintLight0PositionX 0x9d50
-#define GlintLight0PositionXTag 0x03aa
-#define GlintLight0PositionXReg 1
-#define GlintLight0PositionXOff 0x8d50
-
-#define GlintLight0PositionY 0x9d58
-#define GlintLight0PositionYTag 0x03ab
-#define GlintLight0PositionYReg 1
-#define GlintLight0PositionYOff 0x8d58
-
-#define GlintLight0PositionZ 0x9d60
-#define GlintLight0PositionZTag 0x03ac
-#define GlintLight0PositionZReg 1
-#define GlintLight0PositionZOff 0x8d60
-
-#define GlintLight0PositionW 0x9d68
-#define GlintLight0PositionWTag 0x03ad
-#define GlintLight0PositionWReg 1
-#define GlintLight0PositionWOff 0x8d68
-
-#define GlintLight0SpotlightDirectionX 0x9d70
-#define GlintLight0SpotlightDirectionXTag 0x03ae
-#define GlintLight0SpotlightDirectionXReg 1
-#define GlintLight0SpotlightDirectionXOff 0x8d70
-
-#define GlintLight0SpotlightDirectionY 0x9d78
-#define GlintLight0SpotlightDirectionYTag 0x03af
-#define GlintLight0SpotlightDirectionYReg 1
-#define GlintLight0SpotlightDirectionYOff 0x8d78
-
-#define GlintLight0SpotlightDirectionZ 0x9d80
-#define GlintLight0SpotlightDirectionZTag 0x03b0
-#define GlintLight0SpotlightDirectionZReg 1
-#define GlintLight0SpotlightDirectionZOff 0x8d80
-
-#define GlintLight0SpotlightExponent 0x9d88
-#define GlintLight0SpotlightExponentTag 0x03b1
-#define GlintLight0SpotlightExponentReg 1
-#define GlintLight0SpotlightExponentOff 0x8d88
-
-#define GlintLight0CosSpotlightCutoffAngle 0x9d90
-#define GlintLight0CosSpotlightCutoffAngleTag 0x03b2
-#define GlintLight0CosSpotlightCutoffAngleReg 1
-#define GlintLight0CosSpotlightCutoffAngleOff 0x8d90
-
-#define GlintLight0ConstantAttenuation 0x9d98
-#define GlintLight0ConstantAttenuationTag 0x03b3
-#define GlintLight0ConstantAttenuationReg 1
-#define GlintLight0ConstantAttenuationOff 0x8d98
-
-#define GlintLight0LinearAttenuation 0x9da0
-#define GlintLight0LinearAttenuationTag 0x03b4
-#define GlintLight0LinearAttenuationReg 1
-#define GlintLight0LinearAttenuationOff 0x8da0
-
-#define GlintLight0QuadraticAttenuation 0x9da8
-#define GlintLight0QuadraticAttenuationTag 0x03b5
-#define GlintLight0QuadraticAttenuationReg 1
-#define GlintLight0QuadraticAttenuationOff 0x8da8
-
-#define GlintLight1Mode 0x9db0
-#define GlintLight1ModeTag 0x03b6
-#define GlintLight1ModeReg 1
-#define GlintLight1ModeOff 0x8db0
-
-#define GlintLight1AmbientIntensityRed 0x9db8
-#define GlintLight1AmbientIntensityRedTag 0x03b7
-#define GlintLight1AmbientIntensityRedReg 1
-#define GlintLight1AmbientIntensityRedOff 0x8db8
-
-#define GlintLight1AmbientIntensityGreen 0x9dc0
-#define GlintLight1AmbientIntensityGreenTag 0x03b8
-#define GlintLight1AmbientIntensityGreenReg 1
-#define GlintLight1AmbientIntensityGreenOff 0x8dc0
-
-#define GlintLight1AmbientIntensityBlue 0x9dc8
-#define GlintLight1AmbientIntensityBlueTag 0x03b9
-#define GlintLight1AmbientIntensityBlueReg 1
-#define GlintLight1AmbientIntensityBlueOff 0x8dc8
-
-#define GlintLight1DiffuseIntensityRed 0x9dd0
-#define GlintLight1DiffuseIntensityRedTag 0x03ba
-#define GlintLight1DiffuseIntensityRedReg 1
-#define GlintLight1DiffuseIntensityRedOff 0x8dd0
-
-#define GlintLight1DiffuseIntensityGreen 0x9dd8
-#define GlintLight1DiffuseIntensityGreenTag 0x03bb
-#define GlintLight1DiffuseIntensityGreenReg 1
-#define GlintLight1DiffuseIntensityGreenOff 0x8dd8
-
-#define GlintLight1DiffuseIntensityBlue 0x9de0
-#define GlintLight1DiffuseIntensityBlueTag 0x03bc
-#define GlintLight1DiffuseIntensityBlueReg 1
-#define GlintLight1DiffuseIntensityBlueOff 0x8de0
-
-#define GlintLight1SpecularIntensityRed 0x9de8
-#define GlintLight1SpecularIntensityRedTag 0x03bd
-#define GlintLight1SpecularIntensityRedReg 1
-#define GlintLight1SpecularIntensityRedOff 0x8de8
-
-#define GlintLight1SpecularIntensityGreen 0x9df0
-#define GlintLight1SpecularIntensityGreenTag 0x03be
-#define GlintLight1SpecularIntensityGreenReg 1
-#define GlintLight1SpecularIntensityGreenOff 0x8df0
-
-#define GlintLight1SpecularIntensityBlue 0x9df8
-#define GlintLight1SpecularIntensityBlueTag 0x03bf
-#define GlintLight1SpecularIntensityBlueReg 1
-#define GlintLight1SpecularIntensityBlueOff 0x8df8
-
-#define GlintLight1PositionX 0x9e00
-#define GlintLight1PositionXTag 0x03c0
-#define GlintLight1PositionXReg 1
-#define GlintLight1PositionXOff 0x8e00
-
-#define GlintLight1PositionY 0x9e08
-#define GlintLight1PositionYTag 0x03c1
-#define GlintLight1PositionYReg 1
-#define GlintLight1PositionYOff 0x8e08
-
-#define GlintLight1PositionZ 0x9e10
-#define GlintLight1PositionZTag 0x03c2
-#define GlintLight1PositionZReg 1
-#define GlintLight1PositionZOff 0x8e10
-
-#define GlintLight1PositionW 0x9e18
-#define GlintLight1PositionWTag 0x03c3
-#define GlintLight1PositionWReg 1
-#define GlintLight1PositionWOff 0x8e18
-
-#define GlintLight1SpotlightDirectionX 0x9e20
-#define GlintLight1SpotlightDirectionXTag 0x03c4
-#define GlintLight1SpotlightDirectionXReg 1
-#define GlintLight1SpotlightDirectionXOff 0x8e20
-
-#define GlintLight1SpotlightDirectionY 0x9e28
-#define GlintLight1SpotlightDirectionYTag 0x03c5
-#define GlintLight1SpotlightDirectionYReg 1
-#define GlintLight1SpotlightDirectionYOff 0x8e28
-
-#define GlintLight1SpotlightDirectionZ 0x9e30
-#define GlintLight1SpotlightDirectionZTag 0x03c6
-#define GlintLight1SpotlightDirectionZReg 1
-#define GlintLight1SpotlightDirectionZOff 0x8e30
-
-#define GlintLight1SpotlightExponent 0x9e38
-#define GlintLight1SpotlightExponentTag 0x03c7
-#define GlintLight1SpotlightExponentReg 1
-#define GlintLight1SpotlightExponentOff 0x8e38
-
-#define GlintLight1CosSpotlightCutoffAngle 0x9e40
-#define GlintLight1CosSpotlightCutoffAngleTag 0x03c8
-#define GlintLight1CosSpotlightCutoffAngleReg 1
-#define GlintLight1CosSpotlightCutoffAngleOff 0x8e40
-
-#define GlintLight1ConstantAttenuation 0x9e48
-#define GlintLight1ConstantAttenuationTag 0x03c9
-#define GlintLight1ConstantAttenuationReg 1
-#define GlintLight1ConstantAttenuationOff 0x8e48
-
-#define GlintLight1LinearAttenuation 0x9e50
-#define GlintLight1LinearAttenuationTag 0x03ca
-#define GlintLight1LinearAttenuationReg 1
-#define GlintLight1LinearAttenuationOff 0x8e50
-
-#define GlintLight1QuadraticAttenuation 0x9e58
-#define GlintLight1QuadraticAttenuationTag 0x03cb
-#define GlintLight1QuadraticAttenuationReg 1
-#define GlintLight1QuadraticAttenuationOff 0x8e58
-
-#define GlintLight2Mode 0x9e60
-#define GlintLight2ModeTag 0x03cc
-#define GlintLight2ModeReg 1
-#define GlintLight2ModeOff 0x8e60
-
-#define GlintLight2AmbientIntensityRed 0x9e68
-#define GlintLight2AmbientIntensityRedTag 0x03cd
-#define GlintLight2AmbientIntensityRedReg 1
-#define GlintLight2AmbientIntensityRedOff 0x8e68
-
-#define GlintLight2AmbientIntensityGreen 0x9e70
-#define GlintLight2AmbientIntensityGreenTag 0x03ce
-#define GlintLight2AmbientIntensityGreenReg 1
-#define GlintLight2AmbientIntensityGreenOff 0x8e70
-
-#define GlintLight2AmbientIntensityBlue 0x9e78
-#define GlintLight2AmbientIntensityBlueTag 0x03cf
-#define GlintLight2AmbientIntensityBlueReg 1
-#define GlintLight2AmbientIntensityBlueOff 0x8e78
-
-#define GlintLight2DiffuseIntensityRed 0x9e80
-#define GlintLight2DiffuseIntensityRedTag 0x03d0
-#define GlintLight2DiffuseIntensityRedReg 1
-#define GlintLight2DiffuseIntensityRedOff 0x8e80
-
-#define GlintLight2DiffuseIntensityGreen 0x9e88
-#define GlintLight2DiffuseIntensityGreenTag 0x03d1
-#define GlintLight2DiffuseIntensityGreenReg 1
-#define GlintLight2DiffuseIntensityGreenOff 0x8e88
-
-#define GlintLight2DiffuseIntensityBlue 0x9e90
-#define GlintLight2DiffuseIntensityBlueTag 0x03d2
-#define GlintLight2DiffuseIntensityBlueReg 1
-#define GlintLight2DiffuseIntensityBlueOff 0x8e90
-
-#define GlintLight2SpecularIntensityRed 0x9e98
-#define GlintLight2SpecularIntensityRedTag 0x03d3
-#define GlintLight2SpecularIntensityRedReg 1
-#define GlintLight2SpecularIntensityRedOff 0x8e98
-
-#define GlintLight2SpecularIntensityGreen 0x9ea0
-#define GlintLight2SpecularIntensityGreenTag 0x03d4
-#define GlintLight2SpecularIntensityGreenReg 1
-#define GlintLight2SpecularIntensityGreenOff 0x8ea0
-
-#define GlintLight2SpecularIntensityBlue 0x9ea8
-#define GlintLight2SpecularIntensityBlueTag 0x03d5
-#define GlintLight2SpecularIntensityBlueReg 1
-#define GlintLight2SpecularIntensityBlueOff 0x8ea8
-
-#define GlintLight2PositionX 0x9eb0
-#define GlintLight2PositionXTag 0x03d6
-#define GlintLight2PositionXReg 1
-#define GlintLight2PositionXOff 0x8eb0
-
-#define GlintLight2PositionY 0x9eb8
-#define GlintLight2PositionYTag 0x03d7
-#define GlintLight2PositionYReg 1
-#define GlintLight2PositionYOff 0x8eb8
-
-#define GlintLight2PositionZ 0x9ec0
-#define GlintLight2PositionZTag 0x03d8
-#define GlintLight2PositionZReg 1
-#define GlintLight2PositionZOff 0x8ec0
-
-#define GlintLight2PositionW 0x9ec8
-#define GlintLight2PositionWTag 0x03d9
-#define GlintLight2PositionWReg 1
-#define GlintLight2PositionWOff 0x8ec8
-
-#define GlintLight2SpotlightDirectionX 0x9ed0
-#define GlintLight2SpotlightDirectionXTag 0x03da
-#define GlintLight2SpotlightDirectionXReg 1
-#define GlintLight2SpotlightDirectionXOff 0x8ed0
-
-#define GlintLight2SpotlightDirectionY 0x9ed8
-#define GlintLight2SpotlightDirectionYTag 0x03db
-#define GlintLight2SpotlightDirectionYReg 1
-#define GlintLight2SpotlightDirectionYOff 0x8ed8
-
-#define GlintLight2SpotlightDirectionZ 0x9ee0
-#define GlintLight2SpotlightDirectionZTag 0x03dc
-#define GlintLight2SpotlightDirectionZReg 1
-#define GlintLight2SpotlightDirectionZOff 0x8ee0
-
-#define GlintLight2SpotlightExponent 0x9ee8
-#define GlintLight2SpotlightExponentTag 0x03dd
-#define GlintLight2SpotlightExponentReg 1
-#define GlintLight2SpotlightExponentOff 0x8ee8
-
-#define GlintLight2CosSpotlightCutoffAngle 0x9ef0
-#define GlintLight2CosSpotlightCutoffAngleTag 0x03de
-#define GlintLight2CosSpotlightCutoffAngleReg 1
-#define GlintLight2CosSpotlightCutoffAngleOff 0x8ef0
-
-#define GlintLight2ConstantAttenuation 0x9ef8
-#define GlintLight2ConstantAttenuationTag 0x03df
-#define GlintLight2ConstantAttenuationReg 1
-#define GlintLight2ConstantAttenuationOff 0x8ef8
-
-#define GlintLight2LinearAttenuation 0x9f00
-#define GlintLight2LinearAttenuationTag 0x03e0
-#define GlintLight2LinearAttenuationReg 1
-#define GlintLight2LinearAttenuationOff 0x8f00
-
-#define GlintLight2QuadraticAttenuation 0x9f08
-#define GlintLight2QuadraticAttenuationTag 0x03e1
-#define GlintLight2QuadraticAttenuationReg 1
-#define GlintLight2QuadraticAttenuationOff 0x8f08
-
-#define GlintLight3Mode 0x9f10
-#define GlintLight3ModeTag 0x03e2
-#define GlintLight3ModeReg 1
-#define GlintLight3ModeOff 0x8f10
-
-#define GlintLight3AmbientIntensityRed 0x9f18
-#define GlintLight3AmbientIntensityRedTag 0x03e3
-#define GlintLight3AmbientIntensityRedReg 1
-#define GlintLight3AmbientIntensityRedOff 0x8f18
-
-#define GlintLight3AmbientIntensityGreen 0x9f20
-#define GlintLight3AmbientIntensityGreenTag 0x03e4
-#define GlintLight3AmbientIntensityGreenReg 1
-#define GlintLight3AmbientIntensityGreenOff 0x8f20
-
-#define GlintLight3AmbientIntensityBlue 0x9f28
-#define GlintLight3AmbientIntensityBlueTag 0x03e5
-#define GlintLight3AmbientIntensityBlueReg 1
-#define GlintLight3AmbientIntensityBlueOff 0x8f28
-
-#define GlintLight3DiffuseIntensityRed 0x9f30
-#define GlintLight3DiffuseIntensityRedTag 0x03e6
-#define GlintLight3DiffuseIntensityRedReg 1
-#define GlintLight3DiffuseIntensityRedOff 0x8f30
-
-#define GlintLight3DiffuseIntensityGreen 0x9f38
-#define GlintLight3DiffuseIntensityGreenTag 0x03e7
-#define GlintLight3DiffuseIntensityGreenReg 1
-#define GlintLight3DiffuseIntensityGreenOff 0x8f38
-
-#define GlintLight3DiffuseIntensityBlue 0x9f40
-#define GlintLight3DiffuseIntensityBlueTag 0x03e8
-#define GlintLight3DiffuseIntensityBlueReg 1
-#define GlintLight3DiffuseIntensityBlueOff 0x8f40
-
-#define GlintLight3SpecularIntensityRed 0x9f48
-#define GlintLight3SpecularIntensityRedTag 0x03e9
-#define GlintLight3SpecularIntensityRedReg 1
-#define GlintLight3SpecularIntensityRedOff 0x8f48
-
-#define GlintLight3SpecularIntensityGreen 0x9f50
-#define GlintLight3SpecularIntensityGreenTag 0x03ea
-#define GlintLight3SpecularIntensityGreenReg 1
-#define GlintLight3SpecularIntensityGreenOff 0x8f50
-
-#define GlintLight3SpecularIntensityBlue 0x9f58
-#define GlintLight3SpecularIntensityBlueTag 0x03eb
-#define GlintLight3SpecularIntensityBlueReg 1
-#define GlintLight3SpecularIntensityBlueOff 0x8f58
-
-#define GlintLight3PositionX 0x9f60
-#define GlintLight3PositionXTag 0x03ec
-#define GlintLight3PositionXReg 1
-#define GlintLight3PositionXOff 0x8f60
-
-#define GlintLight3PositionY 0x9f68
-#define GlintLight3PositionYTag 0x03ed
-#define GlintLight3PositionYReg 1
-#define GlintLight3PositionYOff 0x8f68
-
-#define GlintLight3PositionZ 0x9f70
-#define GlintLight3PositionZTag 0x03ee
-#define GlintLight3PositionZReg 1
-#define GlintLight3PositionZOff 0x8f70
-
-#define GlintLight3PositionW 0x9f78
-#define GlintLight3PositionWTag 0x03ef
-#define GlintLight3PositionWReg 1
-#define GlintLight3PositionWOff 0x8f78
-
-#define GlintLight3SpotlightDirectionX 0x9f80
-#define GlintLight3SpotlightDirectionXTag 0x03f0
-#define GlintLight3SpotlightDirectionXReg 1
-#define GlintLight3SpotlightDirectionXOff 0x8f80
-
-#define GlintLight3SpotlightDirectionY 0x9f88
-#define GlintLight3SpotlightDirectionYTag 0x03f1
-#define GlintLight3SpotlightDirectionYReg 1
-#define GlintLight3SpotlightDirectionYOff 0x8f88
-
-#define GlintLight3SpotlightDirectionZ 0x9f90
-#define GlintLight3SpotlightDirectionZTag 0x03f2
-#define GlintLight3SpotlightDirectionZReg 1
-#define GlintLight3SpotlightDirectionZOff 0x8f90
-
-#define GlintLight3SpotlightExponent 0x9f98
-#define GlintLight3SpotlightExponentTag 0x03f3
-#define GlintLight3SpotlightExponentReg 1
-#define GlintLight3SpotlightExponentOff 0x8f98
-
-#define GlintLight3CosSpotlightCutoffAngle 0x9fa0
-#define GlintLight3CosSpotlightCutoffAngleTag 0x03f4
-#define GlintLight3CosSpotlightCutoffAngleReg 1
-#define GlintLight3CosSpotlightCutoffAngleOff 0x8fa0
-
-#define GlintLight3ConstantAttenuation 0x9fa8
-#define GlintLight3ConstantAttenuationTag 0x03f5
-#define GlintLight3ConstantAttenuationReg 1
-#define GlintLight3ConstantAttenuationOff 0x8fa8
-
-#define GlintLight3LinearAttenuation 0x9fb0
-#define GlintLight3LinearAttenuationTag 0x03f6
-#define GlintLight3LinearAttenuationReg 1
-#define GlintLight3LinearAttenuationOff 0x8fb0
-
-#define GlintLight3QuadraticAttenuation 0x9fb8
-#define GlintLight3QuadraticAttenuationTag 0x03f7
-#define GlintLight3QuadraticAttenuationReg 1
-#define GlintLight3QuadraticAttenuationOff 0x8fb8
-
-#define GlintLight4Mode 0x9fc0
-#define GlintLight4ModeTag 0x03f8
-#define GlintLight4ModeReg 1
-#define GlintLight4ModeOff 0x8fc0
-
-#define GlintLight4AmbientIntensityRed 0x9fc8
-#define GlintLight4AmbientIntensityRedTag 0x03f9
-#define GlintLight4AmbientIntensityRedReg 1
-#define GlintLight4AmbientIntensityRedOff 0x8fc8
-
-#define GlintLight4AmbientIntensityGreen 0x9fd0
-#define GlintLight4AmbientIntensityGreenTag 0x03fa
-#define GlintLight4AmbientIntensityGreenReg 1
-#define GlintLight4AmbientIntensityGreenOff 0x8fd0
-
-#define GlintLight4AmbientIntensityBlue 0x9fd8
-#define GlintLight4AmbientIntensityBlueTag 0x03fb
-#define GlintLight4AmbientIntensityBlueReg 1
-#define GlintLight4AmbientIntensityBlueOff 0x8fd8
-
-#define GlintLight4DiffuseIntensityRed 0x9fe0
-#define GlintLight4DiffuseIntensityRedTag 0x03fc
-#define GlintLight4DiffuseIntensityRedReg 1
-#define GlintLight4DiffuseIntensityRedOff 0x8fe0
-
-#define GlintLight4DiffuseIntensityGreen 0x9fe8
-#define GlintLight4DiffuseIntensityGreenTag 0x03fd
-#define GlintLight4DiffuseIntensityGreenReg 1
-#define GlintLight4DiffuseIntensityGreenOff 0x8fe8
-
-#define GlintLight4DiffuseIntensityBlue 0x9ff0
-#define GlintLight4DiffuseIntensityBlueTag 0x03fe
-#define GlintLight4DiffuseIntensityBlueReg 1
-#define GlintLight4DiffuseIntensityBlueOff 0x8ff0
-
-#define GlintLight4SpecularIntensityRed 0x9ff8
-#define GlintLight4SpecularIntensityRedTag 0x03ff
-#define GlintLight4SpecularIntensityRedReg 1
-#define GlintLight4SpecularIntensityRedOff 0x8ff8
-
-#define GlintLight4SpecularIntensityGreen 0xa000
-#define GlintLight4SpecularIntensityGreenTag 0x0400
-#define GlintLight4SpecularIntensityGreenReg 1
-#define GlintLight4SpecularIntensityGreenOff 0x9000
-
-#define GlintLight4SpecularIntensityBlue 0xa008
-#define GlintLight4SpecularIntensityBlueTag 0x0401
-#define GlintLight4SpecularIntensityBlueReg 1
-#define GlintLight4SpecularIntensityBlueOff 0x9008
-
-#define GlintLight4PositionX 0xa010
-#define GlintLight4PositionXTag 0x0402
-#define GlintLight4PositionXReg 1
-#define GlintLight4PositionXOff 0x9010
-
-#define GlintLight4PositionY 0xa018
-#define GlintLight4PositionYTag 0x0403
-#define GlintLight4PositionYReg 1
-#define GlintLight4PositionYOff 0x9018
-
-#define GlintLight4PositionZ 0xa020
-#define GlintLight4PositionZTag 0x0404
-#define GlintLight4PositionZReg 1
-#define GlintLight4PositionZOff 0x9020
-
-#define GlintLight4PositionW 0xa028
-#define GlintLight4PositionWTag 0x0405
-#define GlintLight4PositionWReg 1
-#define GlintLight4PositionWOff 0x9028
-
-#define GlintLight4SpotlightDirectionX 0xa030
-#define GlintLight4SpotlightDirectionXTag 0x0406
-#define GlintLight4SpotlightDirectionXReg 1
-#define GlintLight4SpotlightDirectionXOff 0x9030
-
-#define GlintLight4SpotlightDirectionY 0xa038
-#define GlintLight4SpotlightDirectionYTag 0x0407
-#define GlintLight4SpotlightDirectionYReg 1
-#define GlintLight4SpotlightDirectionYOff 0x9038
-
-#define GlintLight4SpotlightDirectionZ 0xa040
-#define GlintLight4SpotlightDirectionZTag 0x0408
-#define GlintLight4SpotlightDirectionZReg 1
-#define GlintLight4SpotlightDirectionZOff 0x9040
-
-#define GlintLight4SpotlightExponent 0xa048
-#define GlintLight4SpotlightExponentTag 0x0409
-#define GlintLight4SpotlightExponentReg 1
-#define GlintLight4SpotlightExponentOff 0x9048
-
-#define GlintLight4CosSpotlightCutoffAngle 0xa050
-#define GlintLight4CosSpotlightCutoffAngleTag 0x040a
-#define GlintLight4CosSpotlightCutoffAngleReg 1
-#define GlintLight4CosSpotlightCutoffAngleOff 0x9050
-
-#define GlintLight4ConstantAttenuation 0xa058
-#define GlintLight4ConstantAttenuationTag 0x040b
-#define GlintLight4ConstantAttenuationReg 1
-#define GlintLight4ConstantAttenuationOff 0x9058
-
-#define GlintLight4LinearAttenuation 0xa060
-#define GlintLight4LinearAttenuationTag 0x040c
-#define GlintLight4LinearAttenuationReg 1
-#define GlintLight4LinearAttenuationOff 0x9060
-
-#define GlintLight4QuadraticAttenuation 0xa068
-#define GlintLight4QuadraticAttenuationTag 0x040d
-#define GlintLight4QuadraticAttenuationReg 1
-#define GlintLight4QuadraticAttenuationOff 0x9068
-
-#define GlintLight5Mode 0xa070
-#define GlintLight5ModeTag 0x040e
-#define GlintLight5ModeReg 1
-#define GlintLight5ModeOff 0x9070
-
-#define GlintLight5AmbientIntensityRed 0xa078
-#define GlintLight5AmbientIntensityRedTag 0x040f
-#define GlintLight5AmbientIntensityRedReg 1
-#define GlintLight5AmbientIntensityRedOff 0x9078
-
-#define GlintLight5AmbientIntensityGreen 0xa080
-#define GlintLight5AmbientIntensityGreenTag 0x0410
-#define GlintLight5AmbientIntensityGreenReg 1
-#define GlintLight5AmbientIntensityGreenOff 0x9080
-
-#define GlintLight5AmbientIntensityBlue 0xa088
-#define GlintLight5AmbientIntensityBlueTag 0x0411
-#define GlintLight5AmbientIntensityBlueReg 1
-#define GlintLight5AmbientIntensityBlueOff 0x9088
-
-#define GlintLight5DiffuseIntensityRed 0xa090
-#define GlintLight5DiffuseIntensityRedTag 0x0412
-#define GlintLight5DiffuseIntensityRedReg 1
-#define GlintLight5DiffuseIntensityRedOff 0x9090
-
-#define GlintLight5DiffuseIntensityGreen 0xa098
-#define GlintLight5DiffuseIntensityGreenTag 0x0413
-#define GlintLight5DiffuseIntensityGreenReg 1
-#define GlintLight5DiffuseIntensityGreenOff 0x9098
-
-#define GlintLight5DiffuseIntensityBlue 0xa0a0
-#define GlintLight5DiffuseIntensityBlueTag 0x0414
-#define GlintLight5DiffuseIntensityBlueReg 1
-#define GlintLight5DiffuseIntensityBlueOff 0x90a0
-
-#define GlintLight5SpecularIntensityRed 0xa0a8
-#define GlintLight5SpecularIntensityRedTag 0x0415
-#define GlintLight5SpecularIntensityRedReg 1
-#define GlintLight5SpecularIntensityRedOff 0x90a8
-
-#define GlintLight5SpecularIntensityGreen 0xa0b0
-#define GlintLight5SpecularIntensityGreenTag 0x0416
-#define GlintLight5SpecularIntensityGreenReg 1
-#define GlintLight5SpecularIntensityGreenOff 0x90b0
-
-#define GlintLight5SpecularIntensityBlue 0xa0b8
-#define GlintLight5SpecularIntensityBlueTag 0x0417
-#define GlintLight5SpecularIntensityBlueReg 1
-#define GlintLight5SpecularIntensityBlueOff 0x90b8
-
-#define GlintLight5PositionX 0xa0c0
-#define GlintLight5PositionXTag 0x0418
-#define GlintLight5PositionXReg 1
-#define GlintLight5PositionXOff 0x90c0
-
-#define GlintLight5PositionY 0xa0c8
-#define GlintLight5PositionYTag 0x0419
-#define GlintLight5PositionYReg 1
-#define GlintLight5PositionYOff 0x90c8
-
-#define GlintLight5PositionZ 0xa0d0
-#define GlintLight5PositionZTag 0x041a
-#define GlintLight5PositionZReg 1
-#define GlintLight5PositionZOff 0x90d0
-
-#define GlintLight5PositionW 0xa0d8
-#define GlintLight5PositionWTag 0x041b
-#define GlintLight5PositionWReg 1
-#define GlintLight5PositionWOff 0x90d8
-
-#define GlintLight5SpotlightDirectionX 0xa0e0
-#define GlintLight5SpotlightDirectionXTag 0x041c
-#define GlintLight5SpotlightDirectionXReg 1
-#define GlintLight5SpotlightDirectionXOff 0x90e0
-
-#define GlintLight5SpotlightDirectionY 0xa0e8
-#define GlintLight5SpotlightDirectionYTag 0x041d
-#define GlintLight5SpotlightDirectionYReg 1
-#define GlintLight5SpotlightDirectionYOff 0x90e8
-
-#define GlintLight5SpotlightDirectionZ 0xa0f0
-#define GlintLight5SpotlightDirectionZTag 0x041e
-#define GlintLight5SpotlightDirectionZReg 1
-#define GlintLight5SpotlightDirectionZOff 0x90f0
-
-#define GlintLight5SpotlightExponent 0xa0f8
-#define GlintLight5SpotlightExponentTag 0x041f
-#define GlintLight5SpotlightExponentReg 1
-#define GlintLight5SpotlightExponentOff 0x90f8
-
-#define GlintLight5CosSpotlightCutoffAngle 0xa100
-#define GlintLight5CosSpotlightCutoffAngleTag 0x0420
-#define GlintLight5CosSpotlightCutoffAngleReg 1
-#define GlintLight5CosSpotlightCutoffAngleOff 0x9100
-
-#define GlintLight5ConstantAttenuation 0xa108
-#define GlintLight5ConstantAttenuationTag 0x0421
-#define GlintLight5ConstantAttenuationReg 1
-#define GlintLight5ConstantAttenuationOff 0x9108
-
-#define GlintLight5LinearAttenuation 0xa110
-#define GlintLight5LinearAttenuationTag 0x0422
-#define GlintLight5LinearAttenuationReg 1
-#define GlintLight5LinearAttenuationOff 0x9110
-
-#define GlintLight5QuadraticAttenuation 0xa118
-#define GlintLight5QuadraticAttenuationTag 0x0423
-#define GlintLight5QuadraticAttenuationReg 1
-#define GlintLight5QuadraticAttenuationOff 0x9118
-
-#define GlintLight6Mode 0xa120
-#define GlintLight6ModeTag 0x0424
-#define GlintLight6ModeReg 1
-#define GlintLight6ModeOff 0x9120
-
-#define GlintLight6AmbientIntensityRed 0xa128
-#define GlintLight6AmbientIntensityRedTag 0x0425
-#define GlintLight6AmbientIntensityRedReg 1
-#define GlintLight6AmbientIntensityRedOff 0x9128
-
-#define GlintLight6AmbientIntensityGreen 0xa130
-#define GlintLight6AmbientIntensityGreenTag 0x0426
-#define GlintLight6AmbientIntensityGreenReg 1
-#define GlintLight6AmbientIntensityGreenOff 0x9130
-
-#define GlintLight6AmbientIntensityBlue 0xa138
-#define GlintLight6AmbientIntensityBlueTag 0x0427
-#define GlintLight6AmbientIntensityBlueReg 1
-#define GlintLight6AmbientIntensityBlueOff 0x9138
-
-#define GlintLight6DiffuseIntensityRed 0xa140
-#define GlintLight6DiffuseIntensityRedTag 0x0428
-#define GlintLight6DiffuseIntensityRedReg 1
-#define GlintLight6DiffuseIntensityRedOff 0x9140
-
-#define GlintLight6DiffuseIntensityGreen 0xa148
-#define GlintLight6DiffuseIntensityGreenTag 0x0429
-#define GlintLight6DiffuseIntensityGreenReg 1
-#define GlintLight6DiffuseIntensityGreenOff 0x9148
-
-#define GlintLight6DiffuseIntensityBlue 0xa150
-#define GlintLight6DiffuseIntensityBlueTag 0x042a
-#define GlintLight6DiffuseIntensityBlueReg 1
-#define GlintLight6DiffuseIntensityBlueOff 0x9150
-
-#define GlintLight6SpecularIntensityRed 0xa158
-#define GlintLight6SpecularIntensityRedTag 0x042b
-#define GlintLight6SpecularIntensityRedReg 1
-#define GlintLight6SpecularIntensityRedOff 0x9158
-
-#define GlintLight6SpecularIntensityGreen 0xa160
-#define GlintLight6SpecularIntensityGreenTag 0x042c
-#define GlintLight6SpecularIntensityGreenReg 1
-#define GlintLight6SpecularIntensityGreenOff 0x9160
-
-#define GlintLight6SpecularIntensityBlue 0xa168
-#define GlintLight6SpecularIntensityBlueTag 0x042d
-#define GlintLight6SpecularIntensityBlueReg 1
-#define GlintLight6SpecularIntensityBlueOff 0x9168
-
-#define GlintLight6PositionX 0xa170
-#define GlintLight6PositionXTag 0x042e
-#define GlintLight6PositionXReg 1
-#define GlintLight6PositionXOff 0x9170
-
-#define GlintLight6PositionY 0xa178
-#define GlintLight6PositionYTag 0x042f
-#define GlintLight6PositionYReg 1
-#define GlintLight6PositionYOff 0x9178
-
-#define GlintLight6PositionZ 0xa180
-#define GlintLight6PositionZTag 0x0430
-#define GlintLight6PositionZReg 1
-#define GlintLight6PositionZOff 0x9180
-
-#define GlintLight6PositionW 0xa188
-#define GlintLight6PositionWTag 0x0431
-#define GlintLight6PositionWReg 1
-#define GlintLight6PositionWOff 0x9188
-
-#define GlintLight6SpotlightDirectionX 0xa190
-#define GlintLight6SpotlightDirectionXTag 0x0432
-#define GlintLight6SpotlightDirectionXReg 1
-#define GlintLight6SpotlightDirectionXOff 0x9190
-
-#define GlintLight6SpotlightDirectionY 0xa198
-#define GlintLight6SpotlightDirectionYTag 0x0433
-#define GlintLight6SpotlightDirectionYReg 1
-#define GlintLight6SpotlightDirectionYOff 0x9198
-
-#define GlintLight6SpotlightDirectionZ 0xa1a0
-#define GlintLight6SpotlightDirectionZTag 0x0434
-#define GlintLight6SpotlightDirectionZReg 1
-#define GlintLight6SpotlightDirectionZOff 0x91a0
-
-#define GlintLight6SpotlightExponent 0xa1a8
-#define GlintLight6SpotlightExponentTag 0x0435
-#define GlintLight6SpotlightExponentReg 1
-#define GlintLight6SpotlightExponentOff 0x91a8
-
-#define GlintLight6CosSpotlightCutoffAngle 0xa1b0
-#define GlintLight6CosSpotlightCutoffAngleTag 0x0436
-#define GlintLight6CosSpotlightCutoffAngleReg 1
-#define GlintLight6CosSpotlightCutoffAngleOff 0x91b0
-
-#define GlintLight6ConstantAttenuation 0xa1b8
-#define GlintLight6ConstantAttenuationTag 0x0437
-#define GlintLight6ConstantAttenuationReg 1
-#define GlintLight6ConstantAttenuationOff 0x91b8
-
-#define GlintLight6LinearAttenuation 0xa1c0
-#define GlintLight6LinearAttenuationTag 0x0438
-#define GlintLight6LinearAttenuationReg 1
-#define GlintLight6LinearAttenuationOff 0x91c0
-
-#define GlintLight6QuadraticAttenuation 0xa1c8
-#define GlintLight6QuadraticAttenuationTag 0x0439
-#define GlintLight6QuadraticAttenuationReg 1
-#define GlintLight6QuadraticAttenuationOff 0x91c8
-
-#define GlintLight7Mode 0xa1d0
-#define GlintLight7ModeTag 0x043a
-#define GlintLight7ModeReg 1
-#define GlintLight7ModeOff 0x91d0
-
-#define GlintLight7AmbientIntensityRed 0xa1d8
-#define GlintLight7AmbientIntensityRedTag 0x043b
-#define GlintLight7AmbientIntensityRedReg 1
-#define GlintLight7AmbientIntensityRedOff 0x91d8
-
-#define GlintLight7AmbientIntensityGreen 0xa1e0
-#define GlintLight7AmbientIntensityGreenTag 0x043c
-#define GlintLight7AmbientIntensityGreenReg 1
-#define GlintLight7AmbientIntensityGreenOff 0x91e0
-
-#define GlintLight7AmbientIntensityBlue 0xa1e8
-#define GlintLight7AmbientIntensityBlueTag 0x043d
-#define GlintLight7AmbientIntensityBlueReg 1
-#define GlintLight7AmbientIntensityBlueOff 0x91e8
-
-#define GlintLight7DiffuseIntensityRed 0xa1f0
-#define GlintLight7DiffuseIntensityRedTag 0x043e
-#define GlintLight7DiffuseIntensityRedReg 1
-#define GlintLight7DiffuseIntensityRedOff 0x91f0
-
-#define GlintLight7DiffuseIntensityGreen 0xa1f8
-#define GlintLight7DiffuseIntensityGreenTag 0x043f
-#define GlintLight7DiffuseIntensityGreenReg 1
-#define GlintLight7DiffuseIntensityGreenOff 0x91f8
-
-#define GlintLight7DiffuseIntensityBlue 0xa200
-#define GlintLight7DiffuseIntensityBlueTag 0x0440
-#define GlintLight7DiffuseIntensityBlueReg 1
-#define GlintLight7DiffuseIntensityBlueOff 0x9200
-
-#define GlintLight7SpecularIntensityRed 0xa208
-#define GlintLight7SpecularIntensityRedTag 0x0441
-#define GlintLight7SpecularIntensityRedReg 1
-#define GlintLight7SpecularIntensityRedOff 0x9208
-
-#define GlintLight7SpecularIntensityGreen 0xa210
-#define GlintLight7SpecularIntensityGreenTag 0x0442
-#define GlintLight7SpecularIntensityGreenReg 1
-#define GlintLight7SpecularIntensityGreenOff 0x9210
-
-#define GlintLight7SpecularIntensityBlue 0xa218
-#define GlintLight7SpecularIntensityBlueTag 0x0443
-#define GlintLight7SpecularIntensityBlueReg 1
-#define GlintLight7SpecularIntensityBlueOff 0x9218
-
-#define GlintLight7PositionX 0xa220
-#define GlintLight7PositionXTag 0x0444
-#define GlintLight7PositionXReg 1
-#define GlintLight7PositionXOff 0x9220
-
-#define GlintLight7PositionY 0xa228
-#define GlintLight7PositionYTag 0x0445
-#define GlintLight7PositionYReg 1
-#define GlintLight7PositionYOff 0x9228
-
-#define GlintLight7PositionZ 0xa230
-#define GlintLight7PositionZTag 0x0446
-#define GlintLight7PositionZReg 1
-#define GlintLight7PositionZOff 0x9230
-
-#define GlintLight7PositionW 0xa238
-#define GlintLight7PositionWTag 0x0447
-#define GlintLight7PositionWReg 1
-#define GlintLight7PositionWOff 0x9238
-
-#define GlintLight7SpotlightDirectionX 0xa240
-#define GlintLight7SpotlightDirectionXTag 0x0448
-#define GlintLight7SpotlightDirectionXReg 1
-#define GlintLight7SpotlightDirectionXOff 0x9240
-
-#define GlintLight7SpotlightDirectionY 0xa248
-#define GlintLight7SpotlightDirectionYTag 0x0449
-#define GlintLight7SpotlightDirectionYReg 1
-#define GlintLight7SpotlightDirectionYOff 0x9248
-
-#define GlintLight7SpotlightDirectionZ 0xa250
-#define GlintLight7SpotlightDirectionZTag 0x044a
-#define GlintLight7SpotlightDirectionZReg 1
-#define GlintLight7SpotlightDirectionZOff 0x9250
-
-#define GlintLight7SpotlightExponent 0xa258
-#define GlintLight7SpotlightExponentTag 0x044b
-#define GlintLight7SpotlightExponentReg 1
-#define GlintLight7SpotlightExponentOff 0x9258
-
-#define GlintLight7CosSpotlightCutoffAngle 0xa260
-#define GlintLight7CosSpotlightCutoffAngleTag 0x044c
-#define GlintLight7CosSpotlightCutoffAngleReg 1
-#define GlintLight7CosSpotlightCutoffAngleOff 0x9260
-
-#define GlintLight7ConstantAttenuation 0xa268
-#define GlintLight7ConstantAttenuationTag 0x044d
-#define GlintLight7ConstantAttenuationReg 1
-#define GlintLight7ConstantAttenuationOff 0x9268
-
-#define GlintLight7LinearAttenuation 0xa270
-#define GlintLight7LinearAttenuationTag 0x044e
-#define GlintLight7LinearAttenuationReg 1
-#define GlintLight7LinearAttenuationOff 0x9270
-
-#define GlintLight7QuadraticAttenuation 0xa278
-#define GlintLight7QuadraticAttenuationTag 0x044f
-#define GlintLight7QuadraticAttenuationReg 1
-#define GlintLight7QuadraticAttenuationOff 0x9278
-
-#define GlintLight8Mode 0xa280
-#define GlintLight8ModeTag 0x0450
-#define GlintLight8ModeReg 1
-#define GlintLight8ModeOff 0x9280
-
-#define GlintLight8AmbientIntensityRed 0xa288
-#define GlintLight8AmbientIntensityRedTag 0x0451
-#define GlintLight8AmbientIntensityRedReg 1
-#define GlintLight8AmbientIntensityRedOff 0x9288
-
-#define GlintLight8AmbientIntensityGreen 0xa290
-#define GlintLight8AmbientIntensityGreenTag 0x0452
-#define GlintLight8AmbientIntensityGreenReg 1
-#define GlintLight8AmbientIntensityGreenOff 0x9290
-
-#define GlintLight8AmbientIntensityBlue 0xa298
-#define GlintLight8AmbientIntensityBlueTag 0x0453
-#define GlintLight8AmbientIntensityBlueReg 1
-#define GlintLight8AmbientIntensityBlueOff 0x9298
-
-#define GlintLight8DiffuseIntensityRed 0xa2a0
-#define GlintLight8DiffuseIntensityRedTag 0x0454
-#define GlintLight8DiffuseIntensityRedReg 1
-#define GlintLight8DiffuseIntensityRedOff 0x92a0
-
-#define GlintLight8DiffuseIntensityGreen 0xa2a8
-#define GlintLight8DiffuseIntensityGreenTag 0x0455
-#define GlintLight8DiffuseIntensityGreenReg 1
-#define GlintLight8DiffuseIntensityGreenOff 0x92a8
-
-#define GlintLight8DiffuseIntensityBlue 0xa2b0
-#define GlintLight8DiffuseIntensityBlueTag 0x0456
-#define GlintLight8DiffuseIntensityBlueReg 1
-#define GlintLight8DiffuseIntensityBlueOff 0x92b0
-
-#define GlintLight8SpecularIntensityRed 0xa2b8
-#define GlintLight8SpecularIntensityRedTag 0x0457
-#define GlintLight8SpecularIntensityRedReg 1
-#define GlintLight8SpecularIntensityRedOff 0x92b8
-
-#define GlintLight8SpecularIntensityGreen 0xa2c0
-#define GlintLight8SpecularIntensityGreenTag 0x0458
-#define GlintLight8SpecularIntensityGreenReg 1
-#define GlintLight8SpecularIntensityGreenOff 0x92c0
-
-#define GlintLight8SpecularIntensityBlue 0xa2c8
-#define GlintLight8SpecularIntensityBlueTag 0x0459
-#define GlintLight8SpecularIntensityBlueReg 1
-#define GlintLight8SpecularIntensityBlueOff 0x92c8
-
-#define GlintLight8PositionX 0xa2d0
-#define GlintLight8PositionXTag 0x045a
-#define GlintLight8PositionXReg 1
-#define GlintLight8PositionXOff 0x92d0
-
-#define GlintLight8PositionY 0xa2d8
-#define GlintLight8PositionYTag 0x045b
-#define GlintLight8PositionYReg 1
-#define GlintLight8PositionYOff 0x92d8
-
-#define GlintLight8PositionZ 0xa2e0
-#define GlintLight8PositionZTag 0x045c
-#define GlintLight8PositionZReg 1
-#define GlintLight8PositionZOff 0x92e0
-
-#define GlintLight8PositionW 0xa2e8
-#define GlintLight8PositionWTag 0x045d
-#define GlintLight8PositionWReg 1
-#define GlintLight8PositionWOff 0x92e8
-
-#define GlintLight8SpotlightDirectionX 0xa2f0
-#define GlintLight8SpotlightDirectionXTag 0x045e
-#define GlintLight8SpotlightDirectionXReg 1
-#define GlintLight8SpotlightDirectionXOff 0x92f0
-
-#define GlintLight8SpotlightDirectionY 0xa2f8
-#define GlintLight8SpotlightDirectionYTag 0x045f
-#define GlintLight8SpotlightDirectionYReg 1
-#define GlintLight8SpotlightDirectionYOff 0x92f8
-
-#define GlintLight8SpotlightDirectionZ 0xa300
-#define GlintLight8SpotlightDirectionZTag 0x0460
-#define GlintLight8SpotlightDirectionZReg 1
-#define GlintLight8SpotlightDirectionZOff 0x9300
-
-#define GlintLight8SpotlightExponent 0xa308
-#define GlintLight8SpotlightExponentTag 0x0461
-#define GlintLight8SpotlightExponentReg 1
-#define GlintLight8SpotlightExponentOff 0x9308
-
-#define GlintLight8CosSpotlightCutoffAngle 0xa310
-#define GlintLight8CosSpotlightCutoffAngleTag 0x0462
-#define GlintLight8CosSpotlightCutoffAngleReg 1
-#define GlintLight8CosSpotlightCutoffAngleOff 0x9310
-
-#define GlintLight8ConstantAttenuation 0xa318
-#define GlintLight8ConstantAttenuationTag 0x0463
-#define GlintLight8ConstantAttenuationReg 1
-#define GlintLight8ConstantAttenuationOff 0x9318
-
-#define GlintLight8LinearAttenuation 0xa320
-#define GlintLight8LinearAttenuationTag 0x0464
-#define GlintLight8LinearAttenuationReg 1
-#define GlintLight8LinearAttenuationOff 0x9320
-
-#define GlintLight8QuadraticAttenuation 0xa328
-#define GlintLight8QuadraticAttenuationTag 0x0465
-#define GlintLight8QuadraticAttenuationReg 1
-#define GlintLight8QuadraticAttenuationOff 0x9328
-
-#define GlintLight9Mode 0xa330
-#define GlintLight9ModeTag 0x0466
-#define GlintLight9ModeReg 1
-#define GlintLight9ModeOff 0x9330
-
-#define GlintLight9AmbientIntensityRed 0xa338
-#define GlintLight9AmbientIntensityRedTag 0x0467
-#define GlintLight9AmbientIntensityRedReg 1
-#define GlintLight9AmbientIntensityRedOff 0x9338
-
-#define GlintLight9AmbientIntensityGreen 0xa340
-#define GlintLight9AmbientIntensityGreenTag 0x0468
-#define GlintLight9AmbientIntensityGreenReg 1
-#define GlintLight9AmbientIntensityGreenOff 0x9340
-
-#define GlintLight9AmbientIntensityBlue 0xa348
-#define GlintLight9AmbientIntensityBlueTag 0x0469
-#define GlintLight9AmbientIntensityBlueReg 1
-#define GlintLight9AmbientIntensityBlueOff 0x9348
-
-#define GlintLight9DiffuseIntensityRed 0xa350
-#define GlintLight9DiffuseIntensityRedTag 0x046a
-#define GlintLight9DiffuseIntensityRedReg 1
-#define GlintLight9DiffuseIntensityRedOff 0x9350
-
-#define GlintLight9DiffuseIntensityGreen 0xa358
-#define GlintLight9DiffuseIntensityGreenTag 0x046b
-#define GlintLight9DiffuseIntensityGreenReg 1
-#define GlintLight9DiffuseIntensityGreenOff 0x9358
-
-#define GlintLight9DiffuseIntensityBlue 0xa360
-#define GlintLight9DiffuseIntensityBlueTag 0x046c
-#define GlintLight9DiffuseIntensityBlueReg 1
-#define GlintLight9DiffuseIntensityBlueOff 0x9360
-
-#define GlintLight9SpecularIntensityRed 0xa368
-#define GlintLight9SpecularIntensityRedTag 0x046d
-#define GlintLight9SpecularIntensityRedReg 1
-#define GlintLight9SpecularIntensityRedOff 0x9368
-
-#define GlintLight9SpecularIntensityGreen 0xa370
-#define GlintLight9SpecularIntensityGreenTag 0x046e
-#define GlintLight9SpecularIntensityGreenReg 1
-#define GlintLight9SpecularIntensityGreenOff 0x9370
-
-#define GlintLight9SpecularIntensityBlue 0xa378
-#define GlintLight9SpecularIntensityBlueTag 0x046f
-#define GlintLight9SpecularIntensityBlueReg 1
-#define GlintLight9SpecularIntensityBlueOff 0x9378
-
-#define GlintLight9PositionX 0xa380
-#define GlintLight9PositionXTag 0x0470
-#define GlintLight9PositionXReg 1
-#define GlintLight9PositionXOff 0x9380
-
-#define GlintLight9PositionY 0xa388
-#define GlintLight9PositionYTag 0x0471
-#define GlintLight9PositionYReg 1
-#define GlintLight9PositionYOff 0x9388
-
-#define GlintLight9PositionZ 0xa390
-#define GlintLight9PositionZTag 0x0472
-#define GlintLight9PositionZReg 1
-#define GlintLight9PositionZOff 0x9390
-
-#define GlintLight9PositionW 0xa398
-#define GlintLight9PositionWTag 0x0473
-#define GlintLight9PositionWReg 1
-#define GlintLight9PositionWOff 0x9398
-
-#define GlintLight9SpotlightDirectionX 0xa3a0
-#define GlintLight9SpotlightDirectionXTag 0x0474
-#define GlintLight9SpotlightDirectionXReg 1
-#define GlintLight9SpotlightDirectionXOff 0x93a0
-
-#define GlintLight9SpotlightDirectionY 0xa3a8
-#define GlintLight9SpotlightDirectionYTag 0x0475
-#define GlintLight9SpotlightDirectionYReg 1
-#define GlintLight9SpotlightDirectionYOff 0x93a8
-
-#define GlintLight9SpotlightDirectionZ 0xa3b0
-#define GlintLight9SpotlightDirectionZTag 0x0476
-#define GlintLight9SpotlightDirectionZReg 1
-#define GlintLight9SpotlightDirectionZOff 0x93b0
-
-#define GlintLight9SpotlightExponent 0xa3b8
-#define GlintLight9SpotlightExponentTag 0x0477
-#define GlintLight9SpotlightExponentReg 1
-#define GlintLight9SpotlightExponentOff 0x93b8
-
-#define GlintLight9CosSpotlightCutoffAngle 0xa3c0
-#define GlintLight9CosSpotlightCutoffAngleTag 0x0478
-#define GlintLight9CosSpotlightCutoffAngleReg 1
-#define GlintLight9CosSpotlightCutoffAngleOff 0x93c0
-
-#define GlintLight9ConstantAttenuation 0xa3c8
-#define GlintLight9ConstantAttenuationTag 0x0479
-#define GlintLight9ConstantAttenuationReg 1
-#define GlintLight9ConstantAttenuationOff 0x93c8
-
-#define GlintLight9LinearAttenuation 0xa3d0
-#define GlintLight9LinearAttenuationTag 0x047a
-#define GlintLight9LinearAttenuationReg 1
-#define GlintLight9LinearAttenuationOff 0x93d0
-
-#define GlintLight9QuadraticAttenuation 0xa3d8
-#define GlintLight9QuadraticAttenuationTag 0x047b
-#define GlintLight9QuadraticAttenuationReg 1
-#define GlintLight9QuadraticAttenuationOff 0x93d8
-
-#define GlintLight10Mode 0xa3e0
-#define GlintLight10ModeTag 0x047c
-#define GlintLight10ModeReg 1
-#define GlintLight10ModeOff 0x93e0
-
-#define GlintLight10AmbientIntensityRed 0xa3e8
-#define GlintLight10AmbientIntensityRedTag 0x047d
-#define GlintLight10AmbientIntensityRedReg 1
-#define GlintLight10AmbientIntensityRedOff 0x93e8
-
-#define GlintLight10AmbientIntensityGreen 0xa3f0
-#define GlintLight10AmbientIntensityGreenTag 0x047e
-#define GlintLight10AmbientIntensityGreenReg 1
-#define GlintLight10AmbientIntensityGreenOff 0x93f0
-
-#define GlintLight10AmbientIntensityBlue 0xa3f8
-#define GlintLight10AmbientIntensityBlueTag 0x047f
-#define GlintLight10AmbientIntensityBlueReg 1
-#define GlintLight10AmbientIntensityBlueOff 0x93f8
-
-#define GlintLight10DiffuseIntensityRed 0xa400
-#define GlintLight10DiffuseIntensityRedTag 0x0480
-#define GlintLight10DiffuseIntensityRedReg 1
-#define GlintLight10DiffuseIntensityRedOff 0x9400
-
-#define GlintLight10DiffuseIntensityGreen 0xa408
-#define GlintLight10DiffuseIntensityGreenTag 0x0481
-#define GlintLight10DiffuseIntensityGreenReg 1
-#define GlintLight10DiffuseIntensityGreenOff 0x9408
-
-#define GlintLight10DiffuseIntensityBlue 0xa410
-#define GlintLight10DiffuseIntensityBlueTag 0x0482
-#define GlintLight10DiffuseIntensityBlueReg 1
-#define GlintLight10DiffuseIntensityBlueOff 0x9410
-
-#define GlintLight10SpecularIntensityRed 0xa418
-#define GlintLight10SpecularIntensityRedTag 0x0483
-#define GlintLight10SpecularIntensityRedReg 1
-#define GlintLight10SpecularIntensityRedOff 0x9418
-
-#define GlintLight10SpecularIntensityGreen 0xa420
-#define GlintLight10SpecularIntensityGreenTag 0x0484
-#define GlintLight10SpecularIntensityGreenReg 1
-#define GlintLight10SpecularIntensityGreenOff 0x9420
-
-#define GlintLight10SpecularIntensityBlue 0xa428
-#define GlintLight10SpecularIntensityBlueTag 0x0485
-#define GlintLight10SpecularIntensityBlueReg 1
-#define GlintLight10SpecularIntensityBlueOff 0x9428
-
-#define GlintLight10PositionX 0xa430
-#define GlintLight10PositionXTag 0x0486
-#define GlintLight10PositionXReg 1
-#define GlintLight10PositionXOff 0x9430
-
-#define GlintLight10PositionY 0xa438
-#define GlintLight10PositionYTag 0x0487
-#define GlintLight10PositionYReg 1
-#define GlintLight10PositionYOff 0x9438
-
-#define GlintLight10PositionZ 0xa440
-#define GlintLight10PositionZTag 0x0488
-#define GlintLight10PositionZReg 1
-#define GlintLight10PositionZOff 0x9440
-
-#define GlintLight10PositionW 0xa448
-#define GlintLight10PositionWTag 0x0489
-#define GlintLight10PositionWReg 1
-#define GlintLight10PositionWOff 0x9448
-
-#define GlintLight10SpotlightDirectionX 0xa450
-#define GlintLight10SpotlightDirectionXTag 0x048a
-#define GlintLight10SpotlightDirectionXReg 1
-#define GlintLight10SpotlightDirectionXOff 0x9450
-
-#define GlintLight10SpotlightDirectionY 0xa458
-#define GlintLight10SpotlightDirectionYTag 0x048b
-#define GlintLight10SpotlightDirectionYReg 1
-#define GlintLight10SpotlightDirectionYOff 0x9458
-
-#define GlintLight10SpotlightDirectionZ 0xa460
-#define GlintLight10SpotlightDirectionZTag 0x048c
-#define GlintLight10SpotlightDirectionZReg 1
-#define GlintLight10SpotlightDirectionZOff 0x9460
-
-#define GlintLight10SpotlightExponent 0xa468
-#define GlintLight10SpotlightExponentTag 0x048d
-#define GlintLight10SpotlightExponentReg 1
-#define GlintLight10SpotlightExponentOff 0x9468
-
-#define GlintLight10CosSpotlightCutoffAngle 0xa470
-#define GlintLight10CosSpotlightCutoffAngleTag 0x048e
-#define GlintLight10CosSpotlightCutoffAngleReg 1
-#define GlintLight10CosSpotlightCutoffAngleOff 0x9470
-
-#define GlintLight10ConstantAttenuation 0xa478
-#define GlintLight10ConstantAttenuationTag 0x048f
-#define GlintLight10ConstantAttenuationReg 1
-#define GlintLight10ConstantAttenuationOff 0x9478
-
-#define GlintLight10LinearAttenuation 0xa480
-#define GlintLight10LinearAttenuationTag 0x0490
-#define GlintLight10LinearAttenuationReg 1
-#define GlintLight10LinearAttenuationOff 0x9480
-
-#define GlintLight10QuadraticAttenuation 0xa488
-#define GlintLight10QuadraticAttenuationTag 0x0491
-#define GlintLight10QuadraticAttenuationReg 1
-#define GlintLight10QuadraticAttenuationOff 0x9488
-
-#define GlintLight11Mode 0xa490
-#define GlintLight11ModeTag 0x0492
-#define GlintLight11ModeReg 1
-#define GlintLight11ModeOff 0x9490
-
-#define GlintLight11AmbientIntensiveRed 0xa498
-#define GlintLight11AmbientIntensiveRedTag 0x0493
-#define GlintLight11AmbientIntensiveRedReg 1
-#define GlintLight11AmbientIntensiveRedOff 0x9498
-
-#define GlintLight11AmbientIntensityGreen 0xa4a0
-#define GlintLight11AmbientIntensityGreenTag 0x0494
-#define GlintLight11AmbientIntensityGreenReg 1
-#define GlintLight11AmbientIntensityGreenOff 0x94a0
-
-#define GlintLight11AmbientIntensityBlue 0xa4a8
-#define GlintLight11AmbientIntensityBlueTag 0x0495
-#define GlintLight11AmbientIntensityBlueReg 1
-#define GlintLight11AmbientIntensityBlueOff 0x94a8
-
-#define GlintLight11DiffuseIntensityRed 0xa4b0
-#define GlintLight11DiffuseIntensityRedTag 0x0496
-#define GlintLight11DiffuseIntensityRedReg 1
-#define GlintLight11DiffuseIntensityRedOff 0x94b0
-
-#define GlintLight11DiffuseIntensityGreen 0xa4b8
-#define GlintLight11DiffuseIntensityGreenTag 0x0497
-#define GlintLight11DiffuseIntensityGreenReg 1
-#define GlintLight11DiffuseIntensityGreenOff 0x94b8
-
-#define GlintLight11DiffuseIntensityBlue 0xa4c0
-#define GlintLight11DiffuseIntensityBlueTag 0x0498
-#define GlintLight11DiffuseIntensityBlueReg 1
-#define GlintLight11DiffuseIntensityBlueOff 0x94c0
-
-#define GlintLight11SpecularIntensityRed 0xa4c8
-#define GlintLight11SpecularIntensityRedTag 0x0499
-#define GlintLight11SpecularIntensityRedReg 1
-#define GlintLight11SpecularIntensityRedOff 0x94c8
-
-#define GlintLight11SpecularIntensityGreen 0xa4d0
-#define GlintLight11SpecularIntensityGreenTag 0x049a
-#define GlintLight11SpecularIntensityGreenReg 1
-#define GlintLight11SpecularIntensityGreenOff 0x94d0
-
-#define GlintLight11SpecularIntensityBlue 0xa4d8
-#define GlintLight11SpecularIntensityBlueTag 0x049b
-#define GlintLight11SpecularIntensityBlueReg 1
-#define GlintLight11SpecularIntensityBlueOff 0x94d8
-
-#define GlintLight11PositionX 0xa4e0
-#define GlintLight11PositionXTag 0x049c
-#define GlintLight11PositionXReg 1
-#define GlintLight11PositionXOff 0x94e0
-
-#define GlintLight11PositionY 0xa4e8
-#define GlintLight11PositionYTag 0x049d
-#define GlintLight11PositionYReg 1
-#define GlintLight11PositionYOff 0x94e8
-
-#define GlintLight11PositionZ 0xa4f0
-#define GlintLight11PositionZTag 0x049e
-#define GlintLight11PositionZReg 1
-#define GlintLight11PositionZOff 0x94f0
-
-#define GlintLight11PositionW 0xa4f8
-#define GlintLight11PositionWTag 0x049f
-#define GlintLight11PositionWReg 1
-#define GlintLight11PositionWOff 0x94f8
-
-#define GlintLight11SpotlightDirectionX 0xa500
-#define GlintLight11SpotlightDirectionXTag 0x04a0
-#define GlintLight11SpotlightDirectionXReg 1
-#define GlintLight11SpotlightDirectionXOff 0x9500
-
-#define GlintLight11SpotlightDirectionY 0xa508
-#define GlintLight11SpotlightDirectionYTag 0x04a1
-#define GlintLight11SpotlightDirectionYReg 1
-#define GlintLight11SpotlightDirectionYOff 0x9508
-
-#define GlintLight11SpotlightDirectionZ 0xa510
-#define GlintLight11SpotlightDirectionZTag 0x04a2
-#define GlintLight11SpotlightDirectionZReg 1
-#define GlintLight11SpotlightDirectionZOff 0x9510
-
-#define GlintLight11SpotlightExponent 0xa518
-#define GlintLight11SpotlightExponentTag 0x04a3
-#define GlintLight11SpotlightExponentReg 1
-#define GlintLight11SpotlightExponentOff 0x9518
-
-#define GlintLight11CosSpotlightCutoffAngle 0xa520
-#define GlintLight11CosSpotlightCutoffAngleTag 0x04a4
-#define GlintLight11CosSpotlightCutoffAngleReg 1
-#define GlintLight11CosSpotlightCutoffAngleOff 0x9520
-
-#define GlintLight11ConstantAttenuation 0xa528
-#define GlintLight11ConstantAttenuationTag 0x04a5
-#define GlintLight11ConstantAttenuationReg 1
-#define GlintLight11ConstantAttenuationOff 0x9528
-
-#define GlintLight11LinearAttenuation 0xa530
-#define GlintLight11LinearAttenuationTag 0x04a6
-#define GlintLight11LinearAttenuationReg 1
-#define GlintLight11LinearAttenuationOff 0x9530
-
-#define GlintLight11QuadraticAttenuation 0xa538
-#define GlintLight11QuadraticAttenuationTag 0x04a7
-#define GlintLight11QuadraticAttenuationReg 1
-#define GlintLight11QuadraticAttenuationOff 0x9538
-
-#define GlintLight12Mode 0xa540
-#define GlintLight12ModeTag 0x04a8
-#define GlintLight12ModeReg 1
-#define GlintLight12ModeOff 0x9540
-
-#define GlintLight12AmbientIntensityRed 0xa548
-#define GlintLight12AmbientIntensityRedTag 0x04a9
-#define GlintLight12AmbientIntensityRedReg 1
-#define GlintLight12AmbientIntensityRedOff 0x9548
-
-#define GlintLight12AmbientIntensityGreen 0xa550
-#define GlintLight12AmbientIntensityGreenTag 0x04aa
-#define GlintLight12AmbientIntensityGreenReg 1
-#define GlintLight12AmbientIntensityGreenOff 0x9550
-
-#define GlintLight12AmbientIntensityBlue 0xa558
-#define GlintLight12AmbientIntensityBlueTag 0x04ab
-#define GlintLight12AmbientIntensityBlueReg 1
-#define GlintLight12AmbientIntensityBlueOff 0x9558
-
-#define GlintLight12DiffuseIntensityRed 0xa560
-#define GlintLight12DiffuseIntensityRedTag 0x04ac
-#define GlintLight12DiffuseIntensityRedReg 1
-#define GlintLight12DiffuseIntensityRedOff 0x9560
-
-#define GlintLight12DiffuseIntensityGreen 0xa568
-#define GlintLight12DiffuseIntensityGreenTag 0x04ad
-#define GlintLight12DiffuseIntensityGreenReg 1
-#define GlintLight12DiffuseIntensityGreenOff 0x9568
-
-#define GlintLight12DiffuseIntensityBlue 0xa570
-#define GlintLight12DiffuseIntensityBlueTag 0x04ae
-#define GlintLight12DiffuseIntensityBlueReg 1
-#define GlintLight12DiffuseIntensityBlueOff 0x9570
-
-#define GlintLight12SpecularIntensityRed 0xa578
-#define GlintLight12SpecularIntensityRedTag 0x04af
-#define GlintLight12SpecularIntensityRedReg 1
-#define GlintLight12SpecularIntensityRedOff 0x9578
-
-#define GlintLight12SpecularIntensityGreen 0xa580
-#define GlintLight12SpecularIntensityGreenTag 0x04b0
-#define GlintLight12SpecularIntensityGreenReg 1
-#define GlintLight12SpecularIntensityGreenOff 0x9580
-
-#define GlintLight12SpecularIntensityBlue 0xa588
-#define GlintLight12SpecularIntensityBlueTag 0x04b1
-#define GlintLight12SpecularIntensityBlueReg 1
-#define GlintLight12SpecularIntensityBlueOff 0x9588
-
-#define GlintLight12PositionX 0xa590
-#define GlintLight12PositionXTag 0x04b2
-#define GlintLight12PositionXReg 1
-#define GlintLight12PositionXOff 0x9590
-
-#define GlintLight12PositionY 0xa598
-#define GlintLight12PositionYTag 0x04b3
-#define GlintLight12PositionYReg 1
-#define GlintLight12PositionYOff 0x9598
-
-#define GlintLight12PositionZ 0xa5a0
-#define GlintLight12PositionZTag 0x04b4
-#define GlintLight12PositionZReg 1
-#define GlintLight12PositionZOff 0x95a0
-
-#define GlintLight12PositionW 0xa5a8
-#define GlintLight12PositionWTag 0x04b5
-#define GlintLight12PositionWReg 1
-#define GlintLight12PositionWOff 0x95a8
-
-#define GlintLight12SpotlightDirectionX 0xa5b0
-#define GlintLight12SpotlightDirectionXTag 0x04b6
-#define GlintLight12SpotlightDirectionXReg 1
-#define GlintLight12SpotlightDirectionXOff 0x95b0
-
-#define GlintLight12SpotlightDirectionY 0xa5b8
-#define GlintLight12SpotlightDirectionYTag 0x04b7
-#define GlintLight12SpotlightDirectionYReg 1
-#define GlintLight12SpotlightDirectionYOff 0x95b8
-
-#define GlintLight12SpotlightDirectionZ 0xa5c0
-#define GlintLight12SpotlightDirectionZTag 0x04b8
-#define GlintLight12SpotlightDirectionZReg 1
-#define GlintLight12SpotlightDirectionZOff 0x95c0
-
-#define GlintLight12SpotlightExponent 0xa5c8
-#define GlintLight12SpotlightExponentTag 0x04b9
-#define GlintLight12SpotlightExponentReg 1
-#define GlintLight12SpotlightExponentOff 0x95c8
-
-#define GlintLight12CosSpotlightCutoffAngle 0xa5d0
-#define GlintLight12CosSpotlightCutoffAngleTag 0x04ba
-#define GlintLight12CosSpotlightCutoffAngleReg 1
-#define GlintLight12CosSpotlightCutoffAngleOff 0x95d0
-
-#define GlintLight12ConstantAttenuation 0xa5d8
-#define GlintLight12ConstantAttenuationTag 0x04bb
-#define GlintLight12ConstantAttenuationReg 1
-#define GlintLight12ConstantAttenuationOff 0x95d8
-
-#define GlintLight12LinearAttenuation 0xa5e0
-#define GlintLight12LinearAttenuationTag 0x04bc
-#define GlintLight12LinearAttenuationReg 1
-#define GlintLight12LinearAttenuationOff 0x95e0
-
-#define GlintLight12QuadraticAttenuation 0xa5e8
-#define GlintLight12QuadraticAttenuationTag 0x04bd
-#define GlintLight12QuadraticAttenuationReg 1
-#define GlintLight12QuadraticAttenuationOff 0x95e8
-
-#define GlintLight13Mode 0xa5f0
-#define GlintLight13ModeTag 0x04be
-#define GlintLight13ModeReg 1
-#define GlintLight13ModeOff 0x95f0
-
-#define GlintLight13AmbientIntensityRed 0xa5f8
-#define GlintLight13AmbientIntensityRedTag 0x04bf
-#define GlintLight13AmbientIntensityRedReg 1
-#define GlintLight13AmbientIntensityRedOff 0x95f8
-
-#define GlintLight13AmbientIntensityGreen 0xa600
-#define GlintLight13AmbientIntensityGreenTag 0x04c0
-#define GlintLight13AmbientIntensityGreenReg 1
-#define GlintLight13AmbientIntensityGreenOff 0x9600
-
-#define GlintLight13AmbientIntensityBlue 0xa608
-#define GlintLight13AmbientIntensityBlueTag 0x04c1
-#define GlintLight13AmbientIntensityBlueReg 1
-#define GlintLight13AmbientIntensityBlueOff 0x9608
-
-#define GlintLight13DiffuseIntensityRed 0xa610
-#define GlintLight13DiffuseIntensityRedTag 0x04c2
-#define GlintLight13DiffuseIntensityRedReg 1
-#define GlintLight13DiffuseIntensityRedOff 0x9610
-
-#define GlintLight13DiffuseIntensityGreen 0xa618
-#define GlintLight13DiffuseIntensityGreenTag 0x04c3
-#define GlintLight13DiffuseIntensityGreenReg 1
-#define GlintLight13DiffuseIntensityGreenOff 0x9618
-
-#define GlintLight13DiffuseIntensityBlue 0xa620
-#define GlintLight13DiffuseIntensityBlueTag 0x04c4
-#define GlintLight13DiffuseIntensityBlueReg 1
-#define GlintLight13DiffuseIntensityBlueOff 0x9620
-
-#define GlintLight13SpecularIntensityRed 0xa628
-#define GlintLight13SpecularIntensityRedTag 0x04c5
-#define GlintLight13SpecularIntensityRedReg 1
-#define GlintLight13SpecularIntensityRedOff 0x9628
-
-#define GlintLight13SpecularIntensityGreen 0xa630
-#define GlintLight13SpecularIntensityGreenTag 0x04c6
-#define GlintLight13SpecularIntensityGreenReg 1
-#define GlintLight13SpecularIntensityGreenOff 0x9630
-
-#define GlintLight13SpecularIntensityBlue 0xa638
-#define GlintLight13SpecularIntensityBlueTag 0x04c7
-#define GlintLight13SpecularIntensityBlueReg 1
-#define GlintLight13SpecularIntensityBlueOff 0x9638
-
-#define GlintLight13PositionX 0xa640
-#define GlintLight13PositionXTag 0x04c8
-#define GlintLight13PositionXReg 1
-#define GlintLight13PositionXOff 0x9640
-
-#define GlintLight13PositionY 0xa648
-#define GlintLight13PositionYTag 0x04c9
-#define GlintLight13PositionYReg 1
-#define GlintLight13PositionYOff 0x9648
-
-#define GlintLight13PositionZ 0xa650
-#define GlintLight13PositionZTag 0x04ca
-#define GlintLight13PositionZReg 1
-#define GlintLight13PositionZOff 0x9650
-
-#define GlintLight13PositionW 0xa658
-#define GlintLight13PositionWTag 0x04cb
-#define GlintLight13PositionWReg 1
-#define GlintLight13PositionWOff 0x9658
-
-#define GlintLight13SpotlightDirectionX 0xa660
-#define GlintLight13SpotlightDirectionXTag 0x04cc
-#define GlintLight13SpotlightDirectionXReg 1
-#define GlintLight13SpotlightDirectionXOff 0x9660
-
-#define GlintLight13SpotlightDirectionY 0xa668
-#define GlintLight13SpotlightDirectionYTag 0x04cd
-#define GlintLight13SpotlightDirectionYReg 1
-#define GlintLight13SpotlightDirectionYOff 0x9668
-
-#define GlintLight13SpotlightDirectionZ 0xa670
-#define GlintLight13SpotlightDirectionZTag 0x04ce
-#define GlintLight13SpotlightDirectionZReg 1
-#define GlintLight13SpotlightDirectionZOff 0x9670
-
-#define GlintLight13SpotlightExponent 0xa678
-#define GlintLight13SpotlightExponentTag 0x04cf
-#define GlintLight13SpotlightExponentReg 1
-#define GlintLight13SpotlightExponentOff 0x9678
-
-#define GlintLight13CosSpotlightCutoffAngle 0xa680
-#define GlintLight13CosSpotlightCutoffAngleTag 0x04d0
-#define GlintLight13CosSpotlightCutoffAngleReg 1
-#define GlintLight13CosSpotlightCutoffAngleOff 0x9680
-
-#define GlintLight13ConstantAttenuation 0xa688
-#define GlintLight13ConstantAttenuationTag 0x04d1
-#define GlintLight13ConstantAttenuationReg 1
-#define GlintLight13ConstantAttenuationOff 0x9688
-
-#define GlintLight13LinearAttenuation 0xa690
-#define GlintLight13LinearAttenuationTag 0x04d2
-#define GlintLight13LinearAttenuationReg 1
-#define GlintLight13LinearAttenuationOff 0x9690
-
-#define GlintLight13QuadraticAttenuation 0xa698
-#define GlintLight13QuadraticAttenuationTag 0x04d3
-#define GlintLight13QuadraticAttenuationReg 1
-#define GlintLight13QuadraticAttenuationOff 0x9698
-
-#define GlintLight14Mode 0xa6a0
-#define GlintLight14ModeTag 0x04d4
-#define GlintLight14ModeReg 1
-#define GlintLight14ModeOff 0x96a0
-
-#define GlintLight14AmbientIntensityRed 0xa6a8
-#define GlintLight14AmbientIntensityRedTag 0x04d5
-#define GlintLight14AmbientIntensityRedReg 1
-#define GlintLight14AmbientIntensityRedOff 0x96a8
-
-#define GlintLight14AmbientIntensityGreen 0xa6b0
-#define GlintLight14AmbientIntensityGreenTag 0x04d6
-#define GlintLight14AmbientIntensityGreenReg 1
-#define GlintLight14AmbientIntensityGreenOff 0x96b0
-
-#define GlintLight14AmbientIntensityBlue 0xa6b8
-#define GlintLight14AmbientIntensityBlueTag 0x04d7
-#define GlintLight14AmbientIntensityBlueReg 1
-#define GlintLight14AmbientIntensityBlueOff 0x96b8
-
-#define GlintLight14DiffuseIntensityRed 0xa6c0
-#define GlintLight14DiffuseIntensityRedTag 0x04d8
-#define GlintLight14DiffuseIntensityRedReg 1
-#define GlintLight14DiffuseIntensityRedOff 0x96c0
-
-#define GlintLight14DiffuseIntensityGreen 0xa6c8
-#define GlintLight14DiffuseIntensityGreenTag 0x04d9
-#define GlintLight14DiffuseIntensityGreenReg 1
-#define GlintLight14DiffuseIntensityGreenOff 0x96c8
-
-#define GlintLight14DiffuseIntensityBlue 0xa6d0
-#define GlintLight14DiffuseIntensityBlueTag 0x04da
-#define GlintLight14DiffuseIntensityBlueReg 1
-#define GlintLight14DiffuseIntensityBlueOff 0x96d0
-
-#define GlintLight14SpecularIntensityRed 0xa6d8
-#define GlintLight14SpecularIntensityRedTag 0x04db
-#define GlintLight14SpecularIntensityRedReg 1
-#define GlintLight14SpecularIntensityRedOff 0x96d8
-
-#define GlintLight14SpecularIntensityGreen 0xa6e0
-#define GlintLight14SpecularIntensityGreenTag 0x04dc
-#define GlintLight14SpecularIntensityGreenReg 1
-#define GlintLight14SpecularIntensityGreenOff 0x96e0
-
-#define GlintLight14SpecularIntensityBlue 0xa6e8
-#define GlintLight14SpecularIntensityBlueTag 0x04dd
-#define GlintLight14SpecularIntensityBlueReg 1
-#define GlintLight14SpecularIntensityBlueOff 0x96e8
-
-#define GlintLight14PositionX 0xa6f0
-#define GlintLight14PositionXTag 0x04de
-#define GlintLight14PositionXReg 1
-#define GlintLight14PositionXOff 0x96f0
-
-#define GlintLight14PositionY 0xa6f8
-#define GlintLight14PositionYTag 0x04df
-#define GlintLight14PositionYReg 1
-#define GlintLight14PositionYOff 0x96f8
-
-#define GlintLight14PositionZ 0xa700
-#define GlintLight14PositionZTag 0x04e0
-#define GlintLight14PositionZReg 1
-#define GlintLight14PositionZOff 0x9700
-
-#define GlintLight14PositionW 0xa708
-#define GlintLight14PositionWTag 0x04e1
-#define GlintLight14PositionWReg 1
-#define GlintLight14PositionWOff 0x9708
-
-#define GlintLight14SpotlightDirectionX 0xa710
-#define GlintLight14SpotlightDirectionXTag 0x04e2
-#define GlintLight14SpotlightDirectionXReg 1
-#define GlintLight14SpotlightDirectionXOff 0x9710
-
-#define GlintLight14SpotlightDirectionY 0xa718
-#define GlintLight14SpotlightDirectionYTag 0x04e3
-#define GlintLight14SpotlightDirectionYReg 1
-#define GlintLight14SpotlightDirectionYOff 0x9718
-
-#define GlintLight14SpotlightDirectionZ 0xa720
-#define GlintLight14SpotlightDirectionZTag 0x04e4
-#define GlintLight14SpotlightDirectionZReg 1
-#define GlintLight14SpotlightDirectionZOff 0x9720
-
-#define GlintLight14SpotlightExponent 0xa728
-#define GlintLight14SpotlightExponentTag 0x04e5
-#define GlintLight14SpotlightExponentReg 1
-#define GlintLight14SpotlightExponentOff 0x9728
-
-#define GlintLight14CosSpotlightCutoffAngle 0xa730
-#define GlintLight14CosSpotlightCutoffAngleTag 0x04e6
-#define GlintLight14CosSpotlightCutoffAngleReg 1
-#define GlintLight14CosSpotlightCutoffAngleOff 0x9730
-
-#define GlintLight14ConstantAttenuation 0xa738
-#define GlintLight14ConstantAttenuationTag 0x04e7
-#define GlintLight14ConstantAttenuationReg 1
-#define GlintLight14ConstantAttenuationOff 0x9738
-
-#define GlintLight14LinearAttenuation 0xa740
-#define GlintLight14LinearAttenuationTag 0x04e8
-#define GlintLight14LinearAttenuationReg 1
-#define GlintLight14LinearAttenuationOff 0x9740
-
-#define GlintLight14QuadraticAttenuation 0xa748
-#define GlintLight14QuadraticAttenuationTag 0x04e9
-#define GlintLight14QuadraticAttenuationReg 1
-#define GlintLight14QuadraticAttenuationOff 0x9748
-
-#define GlintLight15Mode 0xa750
-#define GlintLight15ModeTag 0x04ea
-#define GlintLight15ModeReg 1
-#define GlintLight15ModeOff 0x9750
-
-#define GlintLight15AmbientIntensityRed 0xa758
-#define GlintLight15AmbientIntensityRedTag 0x04eb
-#define GlintLight15AmbientIntensityRedReg 1
-#define GlintLight15AmbientIntensityRedOff 0x9758
-
-#define GlintLight15AmbientIntensityGreen 0xa760
-#define GlintLight15AmbientIntensityGreenTag 0x04ec
-#define GlintLight15AmbientIntensityGreenReg 1
-#define GlintLight15AmbientIntensityGreenOff 0x9760
-
-#define GlintLight15AmbientIntensityBlue 0xa768
-#define GlintLight15AmbientIntensityBlueTag 0x04ed
-#define GlintLight15AmbientIntensityBlueReg 1
-#define GlintLight15AmbientIntensityBlueOff 0x9768
-
-#define GlintLight15DiffuseIntensityRed 0xa770
-#define GlintLight15DiffuseIntensityRedTag 0x04ee
-#define GlintLight15DiffuseIntensityRedReg 1
-#define GlintLight15DiffuseIntensityRedOff 0x9770
-
-#define GlintLight15DiffuseIntensityGreen 0xa778
-#define GlintLight15DiffuseIntensityGreenTag 0x04ef
-#define GlintLight15DiffuseIntensityGreenReg 1
-#define GlintLight15DiffuseIntensityGreenOff 0x9778
-
-#define GlintLight15DiffuseIntensityBlue 0xa780
-#define GlintLight15DiffuseIntensityBlueTag 0x04f0
-#define GlintLight15DiffuseIntensityBlueReg 1
-#define GlintLight15DiffuseIntensityBlueOff 0x9780
-
-#define GlintLight15SpecularIntensityRed 0xa788
-#define GlintLight15SpecularIntensityRedTag 0x04f1
-#define GlintLight15SpecularIntensityRedReg 1
-#define GlintLight15SpecularIntensityRedOff 0x9788
-
-#define GlintLight15SpecularIntensityGreen 0xa790
-#define GlintLight15SpecularIntensityGreenTag 0x04f2
-#define GlintLight15SpecularIntensityGreenReg 1
-#define GlintLight15SpecularIntensityGreenOff 0x9790
-
-#define GlintLight15SpecularIntensityBlue 0xa798
-#define GlintLight15SpecularIntensityBlueTag 0x04f3
-#define GlintLight15SpecularIntensityBlueReg 1
-#define GlintLight15SpecularIntensityBlueOff 0x9798
-
-#define GlintLight15PositionX 0xa7a0
-#define GlintLight15PositionXTag 0x04f4
-#define GlintLight15PositionXReg 1
-#define GlintLight15PositionXOff 0x97a0
-
-#define GlintLight15PositionY 0xa7a8
-#define GlintLight15PositionYTag 0x04f5
-#define GlintLight15PositionYReg 1
-#define GlintLight15PositionYOff 0x97a8
-
-#define GlintLight15PositionZ 0xa7b0
-#define GlintLight15PositionZTag 0x04f6
-#define GlintLight15PositionZReg 1
-#define GlintLight15PositionZOff 0x97b0
-
-#define GlintLight15PositionW 0xa7b8
-#define GlintLight15PositionWTag 0x04f7
-#define GlintLight15PositionWReg 1
-#define GlintLight15PositionWOff 0x97b8
-
-#define GlintLight15SpotlightDirectionX 0xa7c0
-#define GlintLight15SpotlightDirectionXTag 0x04f8
-#define GlintLight15SpotlightDirectionXReg 1
-#define GlintLight15SpotlightDirectionXOff 0x97c0
-
-#define GlintLight15SpotlightDirectionY 0xa7c8
-#define GlintLight15SpotlightDirectionYTag 0x04f9
-#define GlintLight15SpotlightDirectionYReg 1
-#define GlintLight15SpotlightDirectionYOff 0x97c8
-
-#define GlintLight15SpotlightDirectionZ 0xa7d0
-#define GlintLight15SpotlightDirectionZTag 0x04fa
-#define GlintLight15SpotlightDirectionZReg 1
-#define GlintLight15SpotlightDirectionZOff 0x97d0
-
-#define GlintLight15SpotlightExponent 0xa7d8
-#define GlintLight15SpotlightExponentTag 0x04fb
-#define GlintLight15SpotlightExponentReg 1
-#define GlintLight15SpotlightExponentOff 0x97d8
-
-#define GlintLight15CosSpotlightCutoffAngle 0xa7e0
-#define GlintLight15CosSpotlightCutoffAngleTag 0x04fc
-#define GlintLight15CosSpotlightCutoffAngleReg 1
-#define GlintLight15CosSpotlightCutoffAngleOff 0x97e0
-
-#define GlintLight15ConstantAttenuation 0xa7e8
-#define GlintLight15ConstantAttenuationTag 0x04fd
-#define GlintLight15ConstantAttenuationReg 1
-#define GlintLight15ConstantAttenuationOff 0x97e8
-
-#define GlintLight15LinearAttenuation 0xa7f0
-#define GlintLight15LinearAttenuationTag 0x04fe
-#define GlintLight15LinearAttenuationReg 1
-#define GlintLight15LinearAttenuationOff 0x97f0
-
-#define GlintLight15QuadraticAttenuation 0xa7f8
-#define GlintLight15QuadraticAttenuationTag 0x04ff
-#define GlintLight15QuadraticAttenuationReg 1
-#define GlintLight15QuadraticAttenuationOff 0x97f8
-
-#define GlintSceneAmbientColorRed 0xa800
-#define GlintSceneAmbientColorRedTag 0x0500
-#define GlintSceneAmbientColorRedReg 1
-#define GlintSceneAmbientColorRedOff 0x9800
-
-#define GlintSceneAmbientColorGreen 0xa808
-#define GlintSceneAmbientColorGreenTag 0x0501
-#define GlintSceneAmbientColorGreenReg 1
-#define GlintSceneAmbientColorGreenOff 0x9808
-
-#define GlintSceneAmbientColorBlue 0xa810
-#define GlintSceneAmbientColorBlueTag 0x0502
-#define GlintSceneAmbientColorBlueReg 1
-#define GlintSceneAmbientColorBlueOff 0x9810
-
-#define GlintFrontAmbientColorRed 0xa880
-#define GlintFrontAmbientColorRedTag 0x0510
-#define GlintFrontAmbientColorRedReg 1
-#define GlintFrontAmbientColorRedOff 0x9880
-
-#define GlintFrontAmbientColorGreen 0xa888
-#define GlintFrontAmbientColorGreenTag 0x0511
-#define GlintFrontAmbientColorGreenReg 1
-#define GlintFrontAmbientColorGreenOff 0x9888
-
-#define GlintFrontAmbientColorBlue 0xa890
-#define GlintFrontAmbientColorBlueTag 0x0512
-#define GlintFrontAmbientColorBlueReg 1
-#define GlintFrontAmbientColorBlueOff 0x9890
-
-#define GlintFrontDiffuseColorRed 0xa898
-#define GlintFrontDiffuseColorRedTag 0x0513
-#define GlintFrontDiffuseColorRedReg 1
-#define GlintFrontDiffuseColorRedOff 0x9898
-
-#define GlintFrontDiffuseColorGreen 0xa8a0
-#define GlintFrontDiffuseColorGreenTag 0x0514
-#define GlintFrontDiffuseColorGreenReg 1
-#define GlintFrontDiffuseColorGreenOff 0x98a0
-
-#define GlintFrontDiffuseColorBlue 0xa8a8
-#define GlintFrontDiffuseColorBlueTag 0x0515
-#define GlintFrontDiffuseColorBlueReg 1
-#define GlintFrontDiffuseColorBlueOff 0x98a8
-
-#define GlintFrontAlpha 0xa8b0
-#define GlintFrontAlphaTag 0x0516
-#define GlintFrontAlphaReg 1
-#define GlintFrontAlphaOff 0x98b0
-
-#define GlintFrontSpecularColorRed 0xa8b8
-#define GlintFrontSpecularColorRedTag 0x0517
-#define GlintFrontSpecularColorRedReg 1
-#define GlintFrontSpecularColorRedOff 0x98b8
-
-#define GlintFrontSpecularColorGreen 0xa8c0
-#define GlintFrontSpecularColorGreenTag 0x0518
-#define GlintFrontSpecularColorGreenReg 1
-#define GlintFrontSpecularColorGreenOff 0x98c0
-
-#define GlintFrontSpecularColorBlue 0xa8c8
-#define GlintFrontSpecularColorBlueTag 0x0519
-#define GlintFrontSpecularColorBlueReg 1
-#define GlintFrontSpecularColorBlueOff 0x98c8
-
-#define GlintFrontEmissiveColorRed 0xa8d0
-#define GlintFrontEmissiveColorRedTag 0x051a
-#define GlintFrontEmissiveColorRedReg 1
-#define GlintFrontEmissiveColorRedOff 0x98d0
-
-#define GlintFrontEmissiveColorGreen 0xa8d8
-#define GlintFrontEmissiveColorGreenTag 0x051b
-#define GlintFrontEmissiveColorGreenReg 1
-#define GlintFrontEmissiveColorGreenOff 0x98d8
-
-#define GlintFrontEmissiveColorBlue 0xa8e0
-#define GlintFrontEmissiveColorBlueTag 0x051c
-#define GlintFrontEmissiveColorBlueReg 1
-#define GlintFrontEmissiveColorBlueOff 0x98e0
-
-#define GlintFrontSpecularExponent 0xa8e8
-#define GlintFrontSpecularExponentTag 0x051d
-#define GlintFrontSpecularExponentReg 1
-#define GlintFrontSpecularExponentOff 0x98e8
-
-#define GlintBackAmbientColorRed 0xa900
-#define GlintBackAmbientColorRedTag 0x0520
-#define GlintBackAmbientColorRedReg 1
-#define GlintBackAmbientColorRedOff 0x9900
-
-#define GlintBackAmbientColorGreen 0xa908
-#define GlintBackAmbientColorGreenTag 0x0521
-#define GlintBackAmbientColorGreenReg 1
-#define GlintBackAmbientColorGreenOff 0x9908
-
-#define GlintBackAmbientColorBlue 0xa910
-#define GlintBackAmbientColorBlueTag 0x0522
-#define GlintBackAmbientColorBlueReg 1
-#define GlintBackAmbientColorBlueOff 0x9910
-
-#define GlintBackDiffuseColorRed 0xa918
-#define GlintBackDiffuseColorRedTag 0x0523
-#define GlintBackDiffuseColorRedReg 1
-#define GlintBackDiffuseColorRedOff 0x9918
-
-#define GlintBackDiffuseColorGreen 0xa920
-#define GlintBackDiffuseColorGreenTag 0x0524
-#define GlintBackDiffuseColorGreenReg 1
-#define GlintBackDiffuseColorGreenOff 0x9920
-
-#define GlintBackDiffuseColorBlue 0xa928
-#define GlintBackDiffuseColorBlueTag 0x0525
-#define GlintBackDiffuseColorBlueReg 1
-#define GlintBackDiffuseColorBlueOff 0x9928
-
-#define GlintBackAlpha 0xa930
-#define GlintBackAlphaTag 0x0526
-#define GlintBackAlphaReg 1
-#define GlintBackAlphaOff 0x9930
-
-#define GlintBackSpecularColorRed 0xa938
-#define GlintBackSpecularColorRedTag 0x0527
-#define GlintBackSpecularColorRedReg 1
-#define GlintBackSpecularColorRedOff 0x9938
-
-#define GlintBackSpecularColorGreen 0xa940
-#define GlintBackSpecularColorGreenTag 0x0528
-#define GlintBackSpecularColorGreenReg 1
-#define GlintBackSpecularColorGreenOff 0x9940
-
-#define GlintBackSpecularColorBlue 0xa948
-#define GlintBackSpecularColorBlueTag 0x0529
-#define GlintBackSpecularColorBlueReg 1
-#define GlintBackSpecularColorBlueOff 0x9948
-
-#define GlintBackEmissiveColorRed 0xa950
-#define GlintBackEmissiveColorRedTag 0x052a
-#define GlintBackEmissiveColorRedReg 1
-#define GlintBackEmissiveColorRedOff 0x9950
-
-#define GlintBackEmissiveColorGreen 0xa958
-#define GlintBackEmissiveColorGreenTag 0x052b
-#define GlintBackEmissiveColorGreenReg 1
-#define GlintBackEmissiveColorGreenOff 0x9958
-
-#define GlintBackEmissiveColorBlue 0xa960
-#define GlintBackEmissiveColorBlueTag 0x052c
-#define GlintBackEmissiveColorBlueReg 1
-#define GlintBackEmissiveColorBlueOff 0x9960
-
-#define GlintBackSpecularExponent 0xa968
-#define GlintBackSpecularExponentTag 0x052d
-#define GlintBackSpecularExponentReg 1
-#define GlintBackSpecularExponentOff 0x9968
-
-#define GlintDMAAddr 0xa980
-#define GlintDMAAddrTag 0x0530
-#define GlintDMAAddrReg 1
-#define GlintDMAAddrOff 0x9980
-
-#define GlintGammaDMACount 0xa988
-#define GlintGammaDMACountTag 0x0531
-#define GlintGammaDMACountReg 1
-#define GlintGammaDMACountOff 0x9988
-
-#define GlintCommandInterrupt 0xa990
-#define GlintCommandInterruptTag 0x0532
-#define GlintCommandInterruptReg 1
-#define GlintCommandInterruptOff 0x9990
-
-#define GlintDMACall 0xa998
-#define GlintDMACallTag 0x0533
-#define GlintDMACallReg 1
-#define GlintDMACallOff 0x9998
-
-#define GlintDMAReturn 0xa9a0
-#define GlintDMAReturnTag 0x0534
-#define GlintDMAReturnReg 1
-#define GlintDMAReturnOff 0x99a0
-
-#define GlintDMARectangularRead 0xa9a8
-#define GlintDMARectangularReadTag 0x0535
-#define GlintDMARectangularReadReg 1
-#define GlintDMARectangularReadOff 0x99a8
-
-#define GlintDMARectangleReadAddress 0xa9b0
-#define GlintDMARectangleReadAddressTag 0x0536
-#define GlintDMARectangleReadAddressReg 1
-#define GlintDMARectangleReadAddressOff 0x99b0
-
-#define GlintDMARectangleReadLinePitch 0xa9b8
-#define GlintDMARectangleReadLinePitchTag 0x0537
-#define GlintDMARectangleReadLinePitchReg 1
-#define GlintDMARectangleReadLinePitchOff 0x99b8
-
-#define GlintDMARectangleReadTarget 0xa9c0
-#define GlintDMARectangleReadTargetTag 0x0538
-#define GlintDMARectangleReadTargetReg 1
-#define GlintDMARectangleReadTargetOff 0x99c0
-
-#define GlintDMARectangleWrite 0xa9c8
-#define GlintDMARectangleWriteTag 0x0539
-#define GlintDMARectangleWriteReg 1
-#define GlintDMARectangleWriteOff 0x99c8
-
-#define GlintDMARectangleWriteAddress 0xa9d0
-#define GlintDMARectangleWriteAddressTag 0x053a
-#define GlintDMARectangleWriteAddressReg 1
-#define GlintDMARectangleWriteAddressOff 0x99d0
-
-#define GlintDMARectangleWriteLinePitch 0xa9d8
-#define GlintDMARectangleWriteLinePitchTag 0x053b
-#define GlintDMARectangleWriteLinePitchReg 1
-#define GlintDMARectangleWriteLinePitchOff 0x99d8
-
-#define GlintDMAOutputAddress 0xa9e0
-#define GlintDMAOutputAddressTag 0x053c
-#define GlintDMAOutputAddressReg 1
-#define GlintDMAOutputAddressOff 0x99e0
-
-#define GlintDMAOutputCount 0xa9e8
-#define GlintDMAOutputCountTag 0x053d
-#define GlintDMAOutputCountReg 1
-#define GlintDMAOutputCountOff 0x99e8
-
-#define GlintDMAReadGLINTSource 0xa9f0
-#define GlintDMAReadGLINTSourceTag 0x053e
-#define GlintDMAReadGLINTSourceReg 1
-#define GlintDMAReadGLINTSourceOff 0x99f0
-
-#define GlintDMAFeedback 0xaa10
-#define GlintDMAFeedbackTag 0x0542
-#define GlintDMAFeedbackReg 1
-#define GlintDMAFeedbackOff 0x9a10
-
-#define GlintTransformModeAnd 0xaa80
-#define GlintTransformModeAndTag 0x0550
-#define GlintTransformModeAndReg 1
-#define GlintTransformModeAndOff 0x9a80
-
-#define GlintTransformModeOr 0xaa88
-#define GlintTransformModeOrTag 0x0551
-#define GlintTransformModeOrReg 1
-#define GlintTransformModeOrOff 0x9a88
-
-#define GlintGeometryModeAnd 0xaa90
-#define GlintGeometryModeAndTag 0x0552
-#define GlintGeometryModeAndReg 1
-#define GlintGeometryModeAndOff 0x9a90
-
-#define GlintGeometryModeOr 0xaa98
-#define GlintGeometryModeOrTag 0x0553
-#define GlintGeometryModeOrReg 1
-#define GlintGeometryModeOrOff 0x9a98
-
-#define GlintNormalizeModeAnd 0xaaa0
-#define GlintNormalizeModeAndTag 0x0554
-#define GlintNormalizeModeAndReg 1
-#define GlintNormalizeModeAndOff 0x9aa0
-
-#define GlintNormalizeModeOr 0xaaa8
-#define GlintNormalizeModeOrTag 0x0555
-#define GlintNormalizeModeOrReg 1
-#define GlintNormalizeModeOrOff 0x9aa8
-
-#define GlintLightingModeAnd 0xaab0
-#define GlintLightingModeAndTag 0x0556
-#define GlintLightingModeAndReg 1
-#define GlintLightingModeAndOff 0x9ab0
-
-#define GlintLightingModeOr 0xaab8
-#define GlintLightingModeOrTag 0x0557
-#define GlintLightingModeOrReg 1
-#define GlintLightingModeOrOff 0x9ab8
-
-#define GlintColorMaterialModeAnd 0xaac0
-#define GlintColorMaterialModeAndTag 0x0558
-#define GlintColorMaterialModeAndReg 1
-#define GlintColorMaterialModeAndOff 0x9ac0
-
-#define GlintColorMaterialModeOr 0xaac8
-#define GlintColorMaterialModeOrTag 0x0559
-#define GlintColorMaterialModeOrReg 1
-#define GlintColorMaterialModeOrOff 0x9ac8
-
-#define GlintDeltaModeAnd 0xaad0
-#define GlintDeltaModeAndTag 0x055a
-#define GlintDeltaModeAndReg 1
-#define GlintDeltaModeAndOff 0x9ad0
-
-#define GlintDeltaModeOr 0xaad8
-#define GlintDeltaModeOrTag 0x055b
-#define GlintDeltaModeOrReg 1
-#define GlintDeltaModeOrOff 0x9ad8
-
-#define GlintPointModeAnd 0xaae0
-#define GlintPointModeAndTag 0x055c
-#define GlintPointModeAndReg 1
-#define GlintPointModeAndOff 0x9ae0
-
-#define GlintPointModeOr 0xaae8
-#define GlintPointModeOrTag 0x055d
-#define GlintPointModeOrReg 1
-#define GlintPointModeOrOff 0x9ae8
-
-#define GlintLineModeAnd 0xaaf0
-#define GlintLineModeAndTag 0x055e
-#define GlintLineModeAndReg 1
-#define GlintLineModeAndOff 0x9af0
-
-#define GlintLineModeOr 0xaaf8
-#define GlintLineModeOrTag 0x055f
-#define GlintLineModeOrReg 1
-#define GlintLineModeOrOff 0x9af8
-
-#define GlintTriangleModeAnd 0xab00
-#define GlintTriangleModeAndTag 0x0560
-#define GlintTriangleModeAndReg 1
-#define GlintTriangleModeAndOff 0x9b00
-
-#define GlintTriangleModeOr 0xab08
-#define GlintTriangleModeOrTag 0x0561
-#define GlintTriangleModeOrReg 1
-#define GlintTriangleModeOrOff 0x9b08
-
-#define GlintMaterialModeAnd 0xab10
-#define GlintMaterialModeAndTag 0x0562
-#define GlintMaterialModeAndReg 1
-#define GlintMaterialModeAndOff 0x9b10
-
-#define GlintMaterialModeOr 0xab18
-#define GlintMaterialModeOrTag 0x0563
-#define GlintMaterialModeOrReg 1
-#define GlintMaterialModeOrOff 0x9b18
-
-#define GlintWindowAnd 0xab80
-#define GlintWindowAndTag 0x0570
-#define GlintWindowAndReg 1
-#define GlintWindowAndOff 0x9b80
-
-#define GlintWindowOr 0xab88
-#define GlintWindowOrTag 0x0571
-#define GlintWindowOrReg 1
-#define GlintWindowOrOff 0x9b88
-
-#define GlintLBReadModeAnd 0xab90
-#define GlintLBReadModeAndTag 0x0572
-#define GlintLBReadModeAndReg 1
-#define GlintLBReadModeAndOff 0x9b90
-
-#define GlintLBReadModeOr 0xab98
-#define GlintLBReadModeOrTag 0x0573
-#define GlintLBReadModeOrReg 1
-#define GlintLBReadModeOrOff 0x9b98
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c
deleted file mode 100644
index f7db2adea..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- *
- */
-#include "gamma_context.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#if defined(USE_X86_ASM)
-#include "X86/common_x86_asm.h"
-#endif
-#include "simple_list.h"
-#include "mm.h"
-
-
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-extern const struct gl_pipeline_stage _gamma_render_stage;
-
-static const struct gl_pipeline_stage *gamma_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 1
- &_gamma_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- gammaContextPtr gmesa;
- gammaScreenPtr gammascrn;
- GLINTSAREADRIPtr saPriv=(GLINTSAREADRIPtr)(((char*)sPriv->pSAREA)+
- sizeof(XF86DRISAREARec));
-
- gmesa = (gammaContextPtr) CALLOC( sizeof(*gmesa) );
- if ( !gmesa ) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((gammaContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- gmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) gmesa, GL_TRUE);
- if (!gmesa->glCtx) {
- FREE(gmesa);
- return GL_FALSE;
- }
-
- gmesa->driContext = driContextPriv;
- gmesa->driScreen = sPriv;
- gmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- gmesa->hHWContext = driContextPriv->hHWContext;
- gmesa->driHwLock = &sPriv->pSAREA->lock;
- gmesa->driFd = sPriv->fd;
- gmesa->sarea = saPriv;
-
- gammascrn = gmesa->gammaScreen = (gammaScreenPtr)(sPriv->private);
-
- ctx = gmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 13; /* 4K by 4K? Is that right? */
- ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */
-
- ctx->Const.MinLineWidth = 0.0;
- ctx->Const.MaxLineWidth = 255.0;
-
- ctx->Const.MinLineWidthAA = 0.0;
- ctx->Const.MaxLineWidthAA = 65536.0;
-
- ctx->Const.MinPointSize = 0.0;
- ctx->Const.MaxPointSize = 255.0;
-
- ctx->Const.MinPointSizeAA = 0.5; /* 4x4 quality mode */
- ctx->Const.MaxPointSizeAA = 16.0;
- ctx->Const.PointSizeGranularity = 0.25;
-
- gmesa->texHeap = mmInit( 0, gmesa->gammaScreen->textureSize );
-
- make_empty_list(&gmesa->TexObjList);
- make_empty_list(&gmesa->SwappedOut);
-
- gmesa->CurrentTexObj[0] = 0;
- gmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */
-
- gmesa->RenderIndex = ~0;
-
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, gamma_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- gammaInitVB( ctx );
- gammaDDInitExtensions( ctx );
- gammaDDInitDriverFuncs( ctx );
- gammaDDInitStateFuncs( ctx );
- gammaDDInitSpanFuncs( ctx );
- gammaDDInitTextureFuncs( ctx );
- gammaDDInitTriFuncs( ctx );
- gammaDDInitState( gmesa );
-
- driContextPriv->driverPrivate = (void *)gmesa;
-
- GET_FIRST_DMA(gmesa->driFd, gmesa->hHWContext,
- 1, &gmesa->bufIndex, &gmesa->bufSize,
- &gmesa->buf, &gmesa->bufCount, gammascrn);
-
-#ifdef DO_VALIDATE
- GET_FIRST_DMA(gmesa->driFd, gmesa->hHWContext,
- 1, &gmesa->WCbufIndex, &gmesa->WCbufSize,
- &gmesa->WCbuf, &gmesa->WCbufCount, gammascrn);
-#endif
-
- switch (glVisual->depthBits) {
- case 16:
- gmesa->DeltaMode = DM_Depth16;
- gmesa->depth_scale = 1.0f / 0xffff;
- break;
- case 24:
- gmesa->DeltaMode = DM_Depth24;
- gmesa->depth_scale = 1.0f / 0xffffff;
- break;
- case 32:
- gmesa->DeltaMode = DM_Depth32;
- gmesa->depth_scale = 1.0f / 0xffffffff;
- break;
- default:
- break;
- }
-
- gmesa->DepthSize = glVisual->depthBits;
- gmesa->Flags = GAMMA_FRONT_BUFFER;
- gmesa->Flags |= (glVisual->doubleBufferMode ? GAMMA_BACK_BUFFER : 0);
- gmesa->Flags |= (gmesa->DepthSize > 0 ? GAMMA_DEPTH_BUFFER : 0);
-
- gmesa->EnabledFlags = GAMMA_FRONT_BUFFER;
- gmesa->EnabledFlags |= (glVisual->doubleBufferMode ? GAMMA_BACK_BUFFER : 0);
-
-
- if (gmesa->Flags & GAMMA_BACK_BUFFER) {
- gmesa->readOffset = gmesa->drawOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- } else {
- gmesa->readOffset = gmesa->drawOffset = 0;
- }
-
- gammaInitHW( gmesa );
-
- driContextPriv->driverPrivate = (void *)gmesa;
-
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h
deleted file mode 100644
index 84b54e2a6..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_context.h,v 1.6 2002/12/16 16:18:50 dawes Exp $ */
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#ifndef _GAMMA_CONTEXT_H_
-#define _GAMMA_CONTEXT_H_
-
-#include "dri_util.h"
-#include "colormac.h"
-#include "gamma_regs.h"
-#include "gamma_macros.h"
-#include "gamma_screen.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "glint_dri.h"
-#include "mm.h"
-
-typedef union {
- unsigned int i;
- float f;
-} dmaBufRec, *dmaBuf;
-
-/* Flags for context */
-#define GAMMA_FRONT_BUFFER 0x00000001
-#define GAMMA_BACK_BUFFER 0x00000002
-#define GAMMA_DEPTH_BUFFER 0x00000004
-#define GAMMA_STENCIL_BUFFER 0x00000008
-#define GAMMA_ACCUM_BUFFER 0x00000010
-
-#define GAMMA_MAX_TEXTURE_SIZE 2048
-
-/* These are the minimum requirements and should probably be increased */
-#define MAX_MODELVIEW_STACK 16
-#define MAX_PROJECTION_STACK 2
-#define MAX_TEXTURE_STACK 2
-
-extern void gammaDDUpdateHWState(GLcontext *ctx);
-extern gammaScreenPtr gammaCreateScreen(__DRIscreenPrivate *sPriv);
-extern void gammaDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-#define GAMMA_UPLOAD_ALL 0xffffffff
-#define GAMMA_UPLOAD_CLIPRECTS 0x00000002
-#define GAMMA_UPLOAD_ALPHA 0x00000004
-#define GAMMA_UPLOAD_BLEND 0x00000008
-#define GAMMA_UPLOAD_DEPTH 0x00000010
-#define GAMMA_UPLOAD_VIEWPORT 0x00000020
-#define GAMMA_UPLOAD_SHADE 0x00000040
-#define GAMMA_UPLOAD_CLIP 0x00000080
-#define GAMMA_UPLOAD_MASKS 0x00000100
-#define GAMMA_UPLOAD_WINDOW 0x00000200 /* defunct */
-#define GAMMA_UPLOAD_GEOMETRY 0x00000400
-#define GAMMA_UPLOAD_POLYGON 0x00000800
-#define GAMMA_UPLOAD_DITHER 0x00001000
-#define GAMMA_UPLOAD_LOGICOP 0x00002000
-#define GAMMA_UPLOAD_FOG 0x00004000
-#define GAMMA_UPLOAD_LIGHT 0x00008000
-#define GAMMA_UPLOAD_CONTEXT 0x00010000
-#define GAMMA_UPLOAD_TEX0 0x00020000
-#define GAMMA_UPLOAD_STIPPLE 0x00040000
-#define GAMMA_UPLOAD_TRANSFORM 0x00080000
-#define GAMMA_UPLOAD_LINEMODE 0x00100000
-#define GAMMA_UPLOAD_POINTMODE 0x00200000
-#define GAMMA_UPLOAD_TRIMODE 0x00400000
-
-#define GAMMA_NEW_CLIP 0x00000001
-#define GAMMA_NEW_WINDOW 0x00000002
-#define GAMMA_NEW_CONTEXT 0x00000004
-#define GAMMA_NEW_TEXTURE 0x00000008 /* defunct */
-#define GAMMA_NEW_ALPHA 0x00000010
-#define GAMMA_NEW_DEPTH 0x00000020
-#define GAMMA_NEW_MASKS 0x00000040
-#define GAMMA_NEW_POLYGON 0x00000080
-#define GAMMA_NEW_CULL 0x00000100
-#define GAMMA_NEW_LOGICOP 0x00000200
-#define GAMMA_NEW_FOG 0x00000400
-#define GAMMA_NEW_LIGHT 0x00000800
-#define GAMMA_NEW_STIPPLE 0x00001000
-#define GAMMA_NEW_ALL 0xffffffff
-
-#define GAMMA_FALLBACK_TRI 0x00000001
-#define GAMMA_FALLBACK_TEXTURE 0x00000002
-
-#define FLUSH_BATCH(gmesa) do { \
- /*FLUSH_DMA_BUFFER(gmesa);*/ \
-} while(0)
-
-struct gamma_context;
-typedef struct gamma_context gammaContextRec;
-typedef struct gamma_context *gammaContextPtr;
-typedef struct gamma_texture_object_t *gammaTextureObjectPtr;
-
-#define VALID_GAMMA_TEXTURE_OBJECT(tobj) (tobj)
-
-#define GAMMA_TEX_MAXLEVELS 12
-
-/* For shared texture space managment, these texture objects may also
- * be used as proxies for regions of texture memory containing other
- * client's textures. Such proxy textures (not to be confused with GL
- * proxy textures) are subject to the same LRU aging we use for our
- * own private textures, and thus we have a mechanism where we can
- * fairly decide between kicking out our own textures and those of
- * other clients.
- *
- * Non-local texture objects have a valid MemBlock to describe the
- * region managed by the other client, and can be identified by
- * 't->globj == 0'
- */
-struct gamma_texture_object_t {
- struct gamma_texture_object_t *next, *prev;
-
- GLuint age;
- struct gl_texture_object *globj;
-
- int Pitch;
- int Height;
- int texelBytes;
- int totalSize;
- int bound;
-
- PMemBlock MemBlock;
- char * BufAddr;
-
- GLuint min_level;
- GLuint max_level;
- GLuint dirty_images;
-
- GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[GAMMA_TEX_MAXLEVELS];
-
- CARD32 TextureBaseAddr[GAMMA_TEX_MAXLEVELS];
- CARD32 TextureAddressMode;
- CARD32 TextureColorMode;
- CARD32 TextureFilterMode;
- CARD32 TextureFormat;
- CARD32 TextureReadMode;
- CARD32 TextureBorderColor;
-};
-
-#define GAMMA_NO_PALETTE 0x0
-#define GAMMA_USE_PALETTE 0x1
-#define GAMMA_UPDATE_PALETTE 0x2
-#define GAMMA_FALLBACK_PALETTE 0x4
-
-void gammaUpdateTextureState( GLcontext *ctx );
-
-void gammaDestroyTexObj( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaSwapOutTexObj( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaUploadTexImages( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-
-void gammaResetGlobalLRU( gammaContextPtr gmesa );
-void gammaUpdateTexLRU( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaTexturesGone( gammaContextPtr gmesa,
- GLuint start, GLuint end,
- GLuint in_use );
-
-void gammaEmitHwState( gammaContextPtr gmesa );
-void gammaDDInitExtensions( GLcontext *ctx );
-void gammaDDInitDriverFuncs( GLcontext *ctx );
-void gammaDDInitSpanFuncs( GLcontext *ctx );
-void gammaDDInitState( gammaContextPtr gmesa );
-void gammaInitHW( gammaContextPtr gmesa );
-void gammaDDInitStateFuncs( GLcontext *ctx );
-void gammaDDInitTextureFuncs( GLcontext *ctx );
-void gammaDDInitTriFuncs( GLcontext *ctx );
-
-void gammaUpdateWindow( GLcontext *ctx );
-void gammaUpdateViewportOffset( GLcontext *ctx );
-
-void gammaPrintLocalLRU( gammaContextPtr gmesa );
-void gammaPrintGlobalLRU( gammaContextPtr gmesa );
-
-extern void gammaFallback( gammaContextPtr gmesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) gammaFallback( imesa, bit, mode )
-
-/* Use the templated vertex formats. Only one of these is used in gamma.
- */
-#define TAG(x) gamma##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*gamma_quad_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_tri_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_line_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_point_func)( gammaContextPtr,
- const gammaVertex * );
-
-
-struct gamma_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- GLINTSAREADRIPtr sarea;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Mirrors of some DRI state
- */
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
-
- dmaBuf buf; /* DMA buffer for regular cmds */
- int bufIndex;
- int bufSize;
- int bufCount;
-
- dmaBuf WCbuf; /* DMA buffer for window changed cmds */
- int WCbufIndex;
- int WCbufSize;
- int WCbufCount;
-
- gammaScreenPtr gammaScreen; /* Screen private DRI data */
-
- int drawOffset;
- int readOffset;
-
- gamma_point_func draw_point;
- gamma_line_func draw_line;
- gamma_tri_func draw_tri;
- gamma_quad_func draw_quad;
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
-
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLubyte *verts;
-
- GLfloat hw_viewport[16];
- GLuint hw_primitive;
- GLenum render_primitive;
-
- GLfloat depth_scale;
-
- gammaTextureObjectPtr CurrentTexObj[2];
- struct gamma_texture_object_t TexObjList;
- struct gamma_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- memHeap_t *texHeap;
-
- unsigned int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- unsigned int lastStamp;
-
-
- CARD32 ClearColor;
- CARD32 Color;
- CARD32 DitherMode;
- CARD32 ClearDepth;
- CARD32 FogMode;
- CARD32 AreaStippleMode;
- CARD32 LBReadFormat;
- CARD32 LBWriteFormat;
- CARD32 LineMode;
- CARD32 PointMode;
- CARD32 TriangleMode;
- CARD32 AntialiasMode;
- GLfloat ViewportScaleX;
- GLfloat ViewportScaleY;
- GLfloat ViewportScaleZ;
- GLfloat ViewportOffsetX;
- GLfloat ViewportOffsetY;
- GLfloat ViewportOffsetZ;
- int MatrixMode;
- int DepthMode;
- int TransformMode;
- int LBReadMode;
- int FBReadMode;
- int FBWindowBase;
- int LBWindowBase;
- int ColorDDAMode;
- int GeometryMode;
- int AlphaTestMode;
- int AlphaBlendMode;
- int AB_FBReadMode;
- int AB_FBReadMode_Save;
- int DeltaMode;
- int ColorMaterialMode;
- int FBHardwareWriteMask;
- int MaterialMode;
- int NormalizeMode;
- int LightingMode;
- int Light0Mode;
- int Light1Mode;
- int Light2Mode;
- int Light3Mode;
- int Light4Mode;
- int Light5Mode;
- int Light6Mode;
- int Light7Mode;
- int Light8Mode;
- int Light9Mode;
- int Light10Mode;
- int Light11Mode;
- int Light12Mode;
- int Light13Mode;
- int Light14Mode;
- int Light15Mode;
- int LogicalOpMode;
- int ScissorMode;
- int ScissorMaxXY;
- int ScissorMinXY;
- int Window; /* GID part probably should be in draw priv */
- int WindowOrigin;
- int x, y, w, h; /* Probably should be in drawable priv */
- int FrameCount; /* Probably should be in drawable priv */
- int NotClipped; /* Probably should be in drawable priv */
- int WindowChanged; /* Probably should be in drawabl... */
- int Flags;
- int EnabledFlags;
- int DepthSize;
- int Begin;
- GLenum ErrorValue;
- int Texture1DEnabled;
- int Texture2DEnabled;
-
- float ModelView[16];
- float Proj[16];
- float ModelViewProj[16];
- float Texture[16];
-
- float ModelViewStack[(MAX_MODELVIEW_STACK-1)*16];
- int ModelViewCount;
- float ProjStack[(MAX_PROJECTION_STACK-1)*16];
- int ProjCount;
- float TextureStack[(MAX_TEXTURE_STACK-1)*16];
- int TextureCount;
-};
-
-static __inline GLuint gammaPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return PACK_COLOR_565( r, g, b );
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define GAMMA_CONTEXT(ctx) ((gammaContextPtr)(ctx->DriverCtx))
-
-#endif /* _GAMMA_CONTEXT_H_ */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c
deleted file mode 100644
index 5bd84026e..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#include "gamma_context.h"
-#include "gamma_vb.h"
-#include "gamma_lock.h"
-#if defined(USE_X86_ASM)
-#include "X86/common_x86_asm.h"
-#endif
-
-#include "context.h"
-#include "swrast/swrast.h"
-
-#define GAMMA_DATE "20021125"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void gammaDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- GAMMAHW_LOCK( gmesa );
- *width = gmesa->driDrawable->w;
- *height = gmesa->driDrawable->h;
- GAMMAHW_UNLOCK( gmesa );
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *gammaDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"VA Linux Systems, Inc.";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI Gamma " GAMMA_DATE );
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
- }
-#ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- strncat( buffer, "/MMX", 4 );
- }
-#endif
-#ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- strncat( buffer, "/3DNow!", 7 );
- }
-#endif
-#ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- strncat( buffer, "/SSE", 4 );
- }
-#endif
-#endif
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Enable the extensions supported by this driver.
- */
-void gammaDDInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void gammaDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = gammaDDGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = gammaDDGetString;
-
- ctx->Driver.Error = NULL;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c
deleted file mode 100644
index 47eb802b4..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c,v 1.9 2002/10/30 12:51:29 alanh Exp $ */
-
-#include "gamma_context.h"
-#include "glint_dri.h"
-
-void gammaInitHW( gammaContextPtr gmesa )
-{
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)gmesa->driScreen->pDevPriv;
- int i;
-
- if (gDRIPriv->numMultiDevices == 2) {
- /* Set up each MX's ScanLineOwnership for OpenGL */
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, BroadcastMask, 1);
- WRITE(gmesa->buf, ScanLineOwnership, 5); /* Use bottom left as [0,0] */
- WRITE(gmesa->buf, BroadcastMask, 2);
- WRITE(gmesa->buf, ScanLineOwnership, 1); /* Use bottom left as [0,0] */
- /* Broadcast to both MX's */
- WRITE(gmesa->buf, BroadcastMask, 3);
- FLUSH_DMA_BUFFER(gmesa);
- }
-
- gmesa->AlphaBlendMode = (AlphaBlendModeDisable |
- AB_Src_One |
- AB_Dst_Zero |
- AB_NoAlphaBufferPresent |
- AB_ColorFmt_8888 |
- AB_ColorOrder_RGB |
- AB_OpenGLType |
- AB_AlphaDst_FBData |
- AB_ColorConversionScale |
- AB_AlphaConversionScale);
-
- gmesa->DitherMode = DitherModeEnable | DM_ColorOrder_RGB;
-
- switch (gmesa->gammaScreen->cpp) {
- case 2:
- gmesa->DitherMode |= DM_ColorFmt_5555;
- gmesa->AlphaBlendMode |= AB_ColorFmt_5555;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PixelSize, 1);
- break;
- case 4:
- gmesa->DitherMode |= DM_ColorFmt_8888;
- gmesa->AlphaBlendMode |= AB_ColorFmt_8888;
- WRITE(gmesa->buf, PixelSize, 0);
- break;
- }
-
- /* FIXME for stencil, gid, etc */
- switch (gmesa->DepthSize) {
- case 16:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth16 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos16 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos24 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos32 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth16 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos16 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos24 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos32 );
- break;
- case 24:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth24 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos24 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos32 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos36 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth24 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos24 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos32 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos36 );
- break;
- case 32:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth32 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos32 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos40 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos44 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth32 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos32 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos40 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos44 );
- break;
- }
-
- gmesa->FBHardwareWriteMask = 0xffffffff;
- gmesa->FogMode = FogModeDisable;
- gmesa->ClearDepth = 0xffffffff;
- gmesa->AreaStippleMode = AreaStippleModeDisable;
- gmesa->x = 0;
- gmesa->y = 0;
- gmesa->w = 0;
- gmesa->h = 0;
- gmesa->FrameCount = 0;
- gmesa->MatrixMode = GL_MODELVIEW;
- gmesa->ModelViewCount = 0;
- gmesa->ProjCount = 0;
- gmesa->TextureCount = 0;
- gmesa->PointMode = PM_AntialiasQuality_4x4;
- gmesa->LineMode = LM_AntialiasQuality_4x4;
- gmesa->TriangleMode = TM_AntialiasQuality_4x4;
- gmesa->AntialiasMode = AntialiasModeDisable;
-
- for (i = 0; i < 16; i++)
- if (i % 5 == 0)
- gmesa->ModelView[i] =
- gmesa->Proj[i] =
- gmesa->ModelViewProj[i] =
- gmesa->Texture[i] = 1.0;
- else
- gmesa->ModelView[i] =
- gmesa->Proj[i] =
- gmesa->ModelViewProj[i] =
- gmesa->Texture[i] = 0.0;
-
- gmesa->LBReadMode = (LBReadSrcDisable |
- LBReadDstDisable |
- LBDataTypeDefault |
- LBWindowOriginBot |
- gDRIPriv->pprod);
- gmesa->FBReadMode = (FBReadSrcDisable |
- FBReadDstDisable |
- FBDataTypeDefault |
- FBWindowOriginBot |
- gDRIPriv->pprod);
-
- if (gDRIPriv->numMultiDevices == 2) {
- gmesa->LBReadMode |= LBScanLineInt2;
- gmesa->FBReadMode |= FBScanLineInt2;
- gmesa->LBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight/2 - 1);
- gmesa->FBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight/2 - 1);
- } else {
- gmesa->LBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight - 1);
- gmesa->FBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight - 1);
- }
-
- gmesa->Begin = (B_AreaStippleDisable |
- B_LineStippleDisable |
- B_AntiAliasDisable |
- B_TextureDisable |
- B_FogDisable |
- B_SubPixelCorrectEnable |
- B_PrimType_Null);
-
- gmesa->ColorDDAMode = (ColorDDAEnable |
- ColorDDAGouraud);
-
- gmesa->GeometryMode = (GM_TextureDisable |
- GM_FogDisable |
- GM_FogExp |
- GM_FrontPolyFill |
- GM_BackPolyFill |
- GM_FrontFaceCCW |
- GM_PolyCullDisable |
- GM_PolyCullBack |
- GM_ClipShortLinesDisable |
- GM_ClipSmallTrisDisable |
- GM_RenderMode |
- GM_Feedback2D |
- GM_CullFaceNormDisable |
- GM_AutoFaceNormDisable |
- GM_GouraudShading |
- GM_UserClipNone |
- GM_PolyOffsetPointDisable |
- GM_PolyOffsetLineDisable |
- GM_PolyOffsetFillDisable |
- GM_InvertFaceNormCullDisable);
-
- gmesa->AlphaTestMode = (AlphaTestModeDisable |
- AT_Always);
-
- gmesa->AB_FBReadMode_Save = gmesa->AB_FBReadMode = 0;
-
- gmesa->Window = (WindowEnable | /* For GID testing */
- W_PassIfEqual |
- (0 << 5)); /* GID part is set from draw priv (below) */
-
- gmesa->NotClipped = GL_FALSE;
- gmesa->WindowChanged = GL_TRUE;
-
- gmesa->Texture1DEnabled = GL_FALSE;
- gmesa->Texture2DEnabled = GL_FALSE;
-
- gmesa->DepthMode |= (DepthModeDisable |
- DM_WriteMask |
- DM_Less);
-
- gmesa->DeltaMode |= (DM_SubPixlCorrectionEnable |
- DM_SmoothShadingEnable |
- DM_Target500TXMX);
-
- gmesa->LightingMode = LightingModeDisable | LightingModeSpecularEnable;
- gmesa->Light0Mode = LNM_Off;
- gmesa->Light1Mode = LNM_Off;
- gmesa->Light2Mode = LNM_Off;
- gmesa->Light3Mode = LNM_Off;
- gmesa->Light4Mode = LNM_Off;
- gmesa->Light5Mode = LNM_Off;
- gmesa->Light6Mode = LNM_Off;
- gmesa->Light7Mode = LNM_Off;
- gmesa->Light8Mode = LNM_Off;
- gmesa->Light9Mode = LNM_Off;
- gmesa->Light10Mode = LNM_Off;
- gmesa->Light11Mode = LNM_Off;
- gmesa->Light12Mode = LNM_Off;
- gmesa->Light13Mode = LNM_Off;
- gmesa->Light14Mode = LNM_Off;
- gmesa->Light15Mode = LNM_Off;
-
- gmesa->LogicalOpMode = LogicalOpModeDisable;
-
- gmesa->MaterialMode = MaterialModeDisable;
-
- gmesa->ScissorMode = UserScissorDisable | ScreenScissorDisable;
-
- gmesa->TransformMode = XM_UseModelViewProjMatrix |
- XM_TexGenModeS_None |
- XM_TexGenModeT_None |
- XM_TexGenModeR_None |
- XM_TexGenModeQ_None;
-
- CHECK_DMA_BUFFER(gmesa, 20);
- WRITE(gmesa->buf, LineStippleMode, 0);
- WRITE(gmesa->buf, RouterMode, 0);
- WRITE(gmesa->buf, TextureAddressMode, 0);
- WRITE(gmesa->buf, TextureReadMode, 0);
- WRITE(gmesa->buf, TextureFilterMode, 0);
- WRITE(gmesa->buf, TextureColorMode, 0);
- WRITE(gmesa->buf, StencilMode, 0);
- WRITE(gmesa->buf, PatternRamMode, 0);
- WRITE(gmesa->buf, ChromaTestMode, 0);
- WRITE(gmesa->buf, StatisticMode, 0);
- WRITE(gmesa->buf, AreaStippleMode, gmesa->AreaStippleMode);
- WRITE(gmesa->buf, ScissorMode, gmesa->ScissorMode);
- WRITE(gmesa->buf, FogMode, gmesa->FogMode);
- WRITE(gmesa->buf, AntialiasMode, gmesa->AntialiasMode);
- WRITE(gmesa->buf, LogicalOpMode, gmesa->LogicalOpMode);
- WRITE(gmesa->buf, TriangleMode, gmesa->TriangleMode);
- WRITE(gmesa->buf, PointMode, gmesa->PointMode);
- WRITE(gmesa->buf, LineMode, gmesa->LineMode);
- WRITE(gmesa->buf, LBWriteFormat, gmesa->LBWriteFormat);
- WRITE(gmesa->buf, LBReadFormat, gmesa->LBReadFormat);
-
- /* Framebuffer initialization */
- CHECK_DMA_BUFFER(gmesa, 10);
- WRITE(gmesa->buf, FBSourceData, 0);
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER) {
- if (gDRIPriv->numMultiDevices == 2) {
- WRITE(gmesa->buf, FBPixelOffset,
- (gmesa->driScreen->fbHeight/2)*gmesa->driScreen->fbWidth);
- } else {
- WRITE(gmesa->buf, FBPixelOffset,
- gmesa->driScreen->fbHeight*gmesa->driScreen->fbWidth);
- }
- } else
- WRITE(gmesa->buf, FBPixelOffset, 0);
- WRITE(gmesa->buf, FBSourceOffset, 0);
- WRITE(gmesa->buf, FBHardwareWriteMask, 0xffffffff);
- WRITE(gmesa->buf, FBSoftwareWriteMask, 0xffffffff);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, FBWindowBase, gmesa->FBWindowBase);
- WRITE(gmesa->buf, ScreenSize, ((gmesa->driScreen->fbHeight << 16) |
- (gmesa->driScreen->fbWidth)));
- WRITE(gmesa->buf, WindowOrigin, 0x00000000);
-
- /* Localbuffer initialization */
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, LBSourceOffset, 0);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- WRITE(gmesa->buf, LBWindowOffset, 0);
- WRITE(gmesa->buf, LBWindowBase, gmesa->LBWindowBase);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
-
- CHECK_DMA_BUFFER(gmesa, 11);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- WRITE(gmesa->buf, FBBlockColor, 0x00000000);
- WRITE(gmesa->buf, ConstantColor, 0x00000000);
- WRITE(gmesa->buf, AlphaTestMode, gmesa->AlphaTestMode);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- WRITE(gmesa->buf, DitherMode, gmesa->DitherMode);
- if (gDRIPriv->numMultiDevices == 2)
- WRITE(gmesa->buf, RasterizerMode, RM_MultiGLINT | RM_BiasCoordNearHalf);
- else
- WRITE(gmesa->buf, RasterizerMode, RM_BiasCoordNearHalf);
- WRITE(gmesa->buf, GLINTWindow, gmesa->Window);
- WRITE(gmesa->buf, FastClearDepth, gmesa->ClearDepth);
- WRITE(gmesa->buf, GLINTDepth, gmesa->ClearDepth);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, EdgeFlag, EdgeFlagEnable);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewMatrix0, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix1, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix2, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix3, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix4, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix5, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix6, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix7, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix8, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix9, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix10, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix11, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix12, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix13, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix14, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix0, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix1, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix2, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix3, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix4, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix5, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix6, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix7, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix8, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix9, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix10, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix11, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix12, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix13, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix14, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, TextureMatrix0, 1.0);
- WRITEF(gmesa->buf, TextureMatrix1, 0.0);
- WRITEF(gmesa->buf, TextureMatrix2, 0.0);
- WRITEF(gmesa->buf, TextureMatrix3, 0.0);
- WRITEF(gmesa->buf, TextureMatrix4, 0.0);
- WRITEF(gmesa->buf, TextureMatrix5, 1.0);
- WRITEF(gmesa->buf, TextureMatrix6, 0.0);
- WRITEF(gmesa->buf, TextureMatrix7, 0.0);
- WRITEF(gmesa->buf, TextureMatrix8, 0.0);
- WRITEF(gmesa->buf, TextureMatrix9, 0.0);
- WRITEF(gmesa->buf, TextureMatrix10, 1.0);
- WRITEF(gmesa->buf, TextureMatrix11, 0.0);
- WRITEF(gmesa->buf, TextureMatrix12, 0.0);
- WRITEF(gmesa->buf, TextureMatrix13, 0.0);
- WRITEF(gmesa->buf, TextureMatrix14, 0.0);
- WRITEF(gmesa->buf, TextureMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, TexGen0, 0.0);
- WRITEF(gmesa->buf, TexGen1, 0.0);
- WRITEF(gmesa->buf, TexGen2, 0.0);
- WRITEF(gmesa->buf, TexGen3, 0.0);
- WRITEF(gmesa->buf, TexGen4, 0.0);
- WRITEF(gmesa->buf, TexGen5, 0.0);
- WRITEF(gmesa->buf, TexGen6, 0.0);
- WRITEF(gmesa->buf, TexGen7, 0.0);
- WRITEF(gmesa->buf, TexGen8, 0.0);
- WRITEF(gmesa->buf, TexGen9, 0.0);
- WRITEF(gmesa->buf, TexGen10, 0.0);
- WRITEF(gmesa->buf, TexGen11, 0.0);
- WRITEF(gmesa->buf, TexGen12, 0.0);
- WRITEF(gmesa->buf, TexGen13, 0.0);
- WRITEF(gmesa->buf, TexGen14, 0.0);
- WRITEF(gmesa->buf, TexGen15, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, NormalMatrix0, 1.0);
- WRITEF(gmesa->buf, NormalMatrix1, 0.0);
- WRITEF(gmesa->buf, NormalMatrix2, 0.0);
- WRITEF(gmesa->buf, NormalMatrix3, 0.0);
- WRITEF(gmesa->buf, NormalMatrix4, 1.0);
- WRITEF(gmesa->buf, NormalMatrix5, 0.0);
- WRITEF(gmesa->buf, NormalMatrix6, 0.0);
- WRITEF(gmesa->buf, NormalMatrix7, 0.0);
- WRITEF(gmesa->buf, NormalMatrix8, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITEF(gmesa->buf, FogDensity, 0.0);
- WRITEF(gmesa->buf, FogEnd, 0.0);
- WRITEF(gmesa->buf, FogScale, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, LineClipLengthThreshold, 0.0);
- WRITEF(gmesa->buf, TriangleClipAreaThreshold, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- WRITE(gmesa->buf, NormalizeMode, NormalizeModeDisable);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, ColorMaterialMode, ColorMaterialModeDisable);
- WRITE(gmesa->buf, MaterialMode, MaterialModeDisable);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FrontSpecularExponent, 0); /* fixed point */
- WRITE(gmesa->buf, BackSpecularExponent, 0); /* fixed point */
-
- CHECK_DMA_BUFFER(gmesa, 29);
- WRITEF(gmesa->buf, FrontAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, FrontAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, FrontAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, FrontDiffuseColorRed, 0.8);
- WRITEF(gmesa->buf, FrontDiffuseColorGreen, 0.8);
- WRITEF(gmesa->buf, FrontDiffuseColorBlue, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorRed, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorGreen, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorBlue, 0.8);
- WRITEF(gmesa->buf, FrontSpecularColorRed, 0.0);
- WRITEF(gmesa->buf, FrontSpecularColorGreen, 0.0);
- WRITEF(gmesa->buf, FrontSpecularColorBlue, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorRed, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorGreen, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorBlue, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorRed, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorGreen, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorBlue, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorRed, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorGreen, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorBlue, 0.0);
- WRITEF(gmesa->buf, SceneAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, SceneAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, SceneAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, FrontAlpha, 1.0);
- WRITEF(gmesa->buf, BackAlpha, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITE(gmesa->buf, PointSize, 1);
- WRITEF(gmesa->buf, AApointSize, 1.0);
- WRITE(gmesa->buf, LineWidth, 1);
- WRITEF(gmesa->buf, AAlineWidth, 1.0);
- WRITE(gmesa->buf, LineWidthOffset, 0);
- WRITE(gmesa->buf, TransformMode, gmesa->TransformMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITE(gmesa->buf, Light0Mode, LNM_Off);
- WRITE(gmesa->buf, Light1Mode, LNM_Off);
- WRITE(gmesa->buf, Light2Mode, LNM_Off);
- WRITE(gmesa->buf, Light3Mode, LNM_Off);
- WRITE(gmesa->buf, Light4Mode, LNM_Off);
- WRITE(gmesa->buf, Light5Mode, LNM_Off);
- WRITE(gmesa->buf, Light6Mode, LNM_Off);
- WRITE(gmesa->buf, Light7Mode, LNM_Off);
- WRITE(gmesa->buf, Light8Mode, LNM_Off);
- WRITE(gmesa->buf, Light9Mode, LNM_Off);
- WRITE(gmesa->buf, Light10Mode, LNM_Off);
- WRITE(gmesa->buf, Light11Mode, LNM_Off);
- WRITE(gmesa->buf, Light12Mode, LNM_Off);
- WRITE(gmesa->buf, Light13Mode, LNM_Off);
- WRITE(gmesa->buf, Light14Mode, LNM_Off);
- WRITE(gmesa->buf, Light15Mode, LNM_Off);
-
- CHECK_DMA_BUFFER(gmesa, 22);
- WRITEF(gmesa->buf, Light0AmbientIntensityBlue, 0.0);
- WRITEF(gmesa->buf, Light0AmbientIntensityGreen, 0.0);
- WRITEF(gmesa->buf, Light0AmbientIntensityRed, 0.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityBlue, 1.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityGreen, 1.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityRed, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityBlue, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityGreen, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityRed, 1.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionZ, 0.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionY, 0.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionX, -1.0);
- WRITEF(gmesa->buf, Light0SpotlightExponent, 0.0);
- WRITEF(gmesa->buf, Light0PositionZ, 0.0);
- WRITEF(gmesa->buf, Light0PositionY, 0.0);
- WRITEF(gmesa->buf, Light0PositionX, 1.0);
- WRITEF(gmesa->buf, Light0PositionW, 0.0);
- WRITEF(gmesa->buf, Light0CosSpotlightCutoffAngle, -1.0);
- WRITEF(gmesa->buf, Light0ConstantAttenuation, 1.0);
- WRITEF(gmesa->buf, Light0LinearAttenuation, 0.0);
- WRITEF(gmesa->buf, Light0QuadraticAttenuation,0.0);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, XBias, 0.0);
- WRITEF(gmesa->buf, YBias, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, ViewPortScaleX, gmesa->driScreen->fbWidth/4);
- WRITEF(gmesa->buf, ViewPortScaleY, gmesa->driScreen->fbHeight/4);
- WRITEF(gmesa->buf, ViewPortScaleZ, 1.0f);
- WRITEF(gmesa->buf, ViewPortOffsetX, gmesa->x);
- WRITEF(gmesa->buf, ViewPortOffsetY, gmesa->y);
- WRITEF(gmesa->buf, ViewPortOffsetZ, 0.0f);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITEF(gmesa->buf, Nz, 1.0);
- WRITEF(gmesa->buf, Ny, 0.0);
- WRITEF(gmesa->buf, Nx, 0.0);
-
- /* Send the initialization commands to the HW */
- FLUSH_DMA_BUFFER(gmesa);
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c
deleted file mode 100644
index 4c0970f09..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include "gamma_context.h"
-#include "gamma_lock.h"
-
-#ifdef DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable;
- __DRIscreenPrivate *sPriv = gmesa->driScreen;
-
- drmGetLock( gmesa->driFd, gmesa->hHWContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( gmesa->lastStamp != dPriv->lastStamp ) {
- gmesa->lastStamp = dPriv->lastStamp;
- gmesa->new_state |= GAMMA_NEW_WINDOW | GAMMA_NEW_CLIP;
- }
-
- gmesa->numClipRects = dPriv->numClipRects;
- gmesa->pClipRects = dPriv->pClipRects;
-
-#if 0
- gmesa->dirty = ~0;
-
- if ( sarea->ctxOwner != gmesa->hHWContext ) {
- sarea->ctxOwner = gmesa->hHWContext;
- gmesa->dirty = GAMMA_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < gmesa->lastTexHeap ; i++ ) {
- if ( sarea->texAge[i] != gmesa->lastTexAge[i] ) {
- gammaAgeTextures( gmesa, i );
- }
- }
-#endif
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.h
deleted file mode 100644
index 8b66e19aa..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __GAMMA_LOCK_H__
-#define __GAMMA_LOCK_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void gammaGetLock( gammaContextPtr gmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( gmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( gmesa->driHwLock, gmesa->hHWContext, \
- (DRM_LOCK_HELD | gmesa->hHWContext), __ret ); \
- if ( __ret ) \
- gammaGetLock( gmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( gmesa ) \
- do { \
- DRM_UNLOCK( gmesa->driFd, \
- gmesa->driHwLock, \
- gmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
-
-#define GAMMAHW_LOCK( gmesa ) \
- DRM_UNLOCK(gmesa->driFd, gmesa->driHwLock, gmesa->hHWContext); \
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
- gmesa->driScreen->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-
-#define GAMMAHW_UNLOCK( gmesa ) \
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
- gmesa->driScreen->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
-#endif /* __GAMMA_LOCK_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h
deleted file mode 100644
index bf9cf5f11..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h,v 1.5 2002/02/22 21:33:02 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _GAMMA_MACROS_H_
-#define _GAMMA_MACROS_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-#define DEBUG_DRMDMA
-#define DEBUG_ERRORS
-#define DEBUG_COMMANDS_NOT
-#define DEBUG_VERBOSE_NOT
-#define DEBUG_VERBOSE_EXTRA_NOT
-
-#define RANDOMIZE_COLORS_NOT
-#define TURN_OFF_CLEARS_NOT
-#define CULL_ALL_PRIMS_NOT
-#define TURN_OFF_DEPTH_NOT
-#define TURN_OFF_BLEND_NOT
-#define FAST_CLEAR_4_NOT
-#define FORCE_DEPTH32_NOT
-#define DONT_SEND_DMA_NOT
-#define TURN_OFF_FCP_NOT
-#define TURN_OFF_TEXTURES_NOT
-#define DO_VALIDATE
-
-#define GAMMA_DMA_BUFFER_SIZE 4096
-
-#if 0
-#define GAMMA_DMA_SEND_FLAGS DRM_DMA_PRIORITY
-#define GAMMA_DMA_SEND_FLAGS DRM_DMA_BLOCK
-#else
-/* MUST use non-blocking dma flags for drawable lock routines */
-#define GAMMA_DMA_SEND_FLAGS 0
-#endif
-
-#if 0
-#define GAMMA_DMA_GET_FLAGS \
- (DRM_DMA_SMALLER_OK | DRM_DMA_LARGER_OK | DRM_DMA_WAIT)
-#else
-#define GAMMA_DMA_GET_FLAGS DRM_DMA_WAIT
-#endif
-
-#if defined(DEBUG_DRMDMA) || defined(DEBUG_COMMANDS) || defined(DEBUG_VERBOSE)
-#include <stdio.h>
-#endif
-
-/* Note: The argument to DEBUG_GLCMDS() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_VERBOSE
-#define DEBUG_GLCMDS(s) printf s
-#else
-#define DEBUG_GLCMDS(s)
-#endif
-
-/* Note: The argument to DEBUG_DMACMDS() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_DRMDMA
-#define DEBUG_DMACMDS(s) printf s
-#else
-#define DEBUG_DMACMDS(s)
-#endif
-
-/* Note: The argument to DEBUG_WRITE() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_COMMANDS
-#define DEBUG_WRITE(s) printf s
-#else
-#define DEBUG_WRITE(s)
-#endif
-
-/* Note: The argument to DEBUG_ERROR() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_ERRORS
-#define DEBUG_ERROR(s) printf s
-#else
-#define DEBUG_ERROR(s)
-#endif
-
-#define WRITEV(buf,val1,val2,val3,val4) \
-do { \
- buf++->i = 0x9C008300; \
- buf++->f = val1; \
- buf++->f = val2; \
- buf++->f = val3; \
- buf++->f = val4; \
-} while (0)
-
-#define WRITE(buf,reg,val) \
-do { \
- buf++->i = Glint##reg##Tag; \
- buf++->i = val; \
- DEBUG_WRITE(("WRITE(buf, %s, 0x%08x);\n", #reg, (int)val)); \
-} while (0)
-
-#define WRITEF(buf,reg,val) \
-do { \
- buf++->i = Glint##reg##Tag; \
- buf++->f = val; \
- DEBUG_WRITE(("WRITEF(buf, %s, %f);\n", #reg, (float)val)); \
-} while (0)
-
-#define CHECK_WC_DMA_BUFFER(gcp,n) \
-do { \
- (gcp)->WCbufCount += (n<<1); \
-} while (0)
-
-#define CHECK_DMA_BUFFER(gcp,n) \
-do { \
- if ((gcp)->bufCount+(n<<1) >= (gcp)->bufSize) \
- PROCESS_DMA_BUFFER(gcp); \
- (gcp)->bufCount += (n<<1); \
-} while (0)
-
-#define CHECK_DMA_BUFFER2(gcp,n) \
-do { \
- if ((gcp)->bufCount+n >= (gcp)->bufSize) \
- PROCESS_DMA_BUFFER(gcp); \
- (gcp)->bufCount += n; \
-} while (0)
-
-#define FLUSH_DMA_BUFFER(gcp) \
-do { \
- if (gcp->bufCount) \
- PROCESS_DMA_BUFFER(gcp); \
-} while (0)
-
-#ifdef DONT_SEND_DMA
-#define GET_DMA(fd, hHWCtx, n, idx, size)
-#define SEND_DMA(fd, hHWCtx,n, idx, cnt)
-#else
-#define GET_DMA(fd, hHWCtx, n, idx, size) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
- \
- dma.context = (hHWCtx); \
- dma.send_count = 0; \
- dma.send_list = NULL; \
- dma.send_sizes = NULL; \
- dma.flags = GAMMA_DMA_GET_FLAGS; \
- dma.request_count = (n); \
- dma.request_size = GAMMA_DMA_BUFFER_SIZE; \
- dma.request_list = (idx); \
- dma.request_sizes = (size); \
- \
- do { \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_DMACMDS(("drmDMA returned %d\n", retcode)); \
- } \
- } while (!(dma).granted_count); \
- \
- for (i = 0; i < (n); i++) { \
- (size)[i] >>= 2; /* Convert from bytes to words */ \
- } \
-} while (0)
-
-#define SEND_DMA(fd, hHWCtx, n, idx, cnt) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
- \
- for (i = 0; i < (n); i++) { \
- (cnt)[i] <<= 2; /* Convert from words to bytes */ \
- } \
- \
- dma.context = (hHWCtx); \
- dma.send_count = 1; \
- dma.send_list = (idx); \
- dma.send_sizes = (cnt); \
- dma.flags = GAMMA_DMA_SEND_FLAGS; \
- dma.request_count = 0; \
- dma.request_size = 0; \
- dma.request_list = NULL; \
- dma.request_sizes = NULL; \
- \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_DMACMDS(("drmDMA returned %d\n", retcode)); \
- } \
- \
- for (i = 0; i < (n); i++) { \
- (cnt)[i] = 0; \
- } \
-} while (0)
-#endif
-
-#define GET_FIRST_DMA(fd, hHWCtx, n, idx, size, buf, cnt, gPriv) \
-do { \
- int i; \
- \
- GET_DMA(fd, hHWCtx, n, idx, size); \
- \
- for (i = 0; i < (n); i++) { \
- (buf)[i] = (dmaBuf)(gPriv)->bufs->list[(idx)[i]].address; \
- (cnt)[i] = 0; \
- } \
-} while (0)
-
-#define PROCESS_DMA_BUFFER_TOP_HALF(gcp) \
-do { \
- SEND_DMA((gcp)->driFd, \
- (gcp)->hHWContext, 1, &(gcp)->bufIndex, &(gcp)->bufCount); \
-} while (0)
-
-#define PROCESS_DMA_BUFFER_BOTTOM_HALF(gcp) \
-do { \
- GET_DMA((gcp)->driFd, \
- (gcp)->hHWContext, 1, &(gcp)->bufIndex, &(gcp)->bufSize); \
- \
- (gcp)->buf = \
- (dmaBuf)(gcp)->gammaScreen->bufs->list[(gcp)->bufIndex].address; \
-} while (0)
-
-#define PROCESS_DMA_BUFFER(gcp) \
-do { \
- VALIDATE_DRAWABLE_INFO(gcp); \
- PROCESS_DMA_BUFFER_TOP_HALF(gcp); \
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gcp); \
-} while (0)
-
-#ifdef DO_VALIDATE
-#define VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp) \
-do { \
- /*__DRIscreenPrivate *psp = gcp->driScreen;*/ \
- __DRIdrawablePrivate *pdp = gcp->driDrawable; \
- \
- if (*(pdp->pStamp) != pdp->lastStamp) { \
- int old_index = pdp->index; \
- while (*(pdp->pStamp) != pdp->lastStamp) { \
- DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \
- } \
- if (pdp->index != old_index) { \
- gcp->Window &= ~W_GIDMask; \
- gcp->Window |= (pdp->index << 5); \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, GLINTWindow, gcp->Window|(gcp->FrameCount<<9));\
- } \
- \
- gammaUpdateViewportOffset( gcp->glCtx); \
- \
- if (pdp->numClipRects == 1 && \
- pdp->pClipRects->x1 == pdp->x && \
- pdp->pClipRects->x2 == (pdp->x+pdp->w) && \
- pdp->pClipRects->y1 == pdp->y && \
- pdp->pClipRects->y2 == (pdp->y+pdp->h)) { \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, Rectangle2DControl, 0); \
- gcp->NotClipped = GL_TRUE; \
- } else { \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, Rectangle2DControl, 1); \
- gcp->NotClipped = GL_FALSE; \
- } \
- gcp->WindowChanged = GL_TRUE; \
- \
- if (gcp->WCbufCount) { \
- SEND_DMA((gcp)->gammaScreen->driScreen->fd, \
- (gcp)->hHWContext, 1, &(gcp)->WCbufIndex, \
- &(gcp)->WCbufCount); \
- (gcp)->WCbufIndex = -1; \
- } \
- } \
-} while (0)
-
-#define VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gcp) \
-do { \
- if ((gcp)->WCbufIndex < 0) { \
- GET_DMA((gcp)->gammaScreen->driScreen->fd, \
- (gcp)->hHWContext, 1, &(gcp)->WCbufIndex, \
- &(gcp)->WCbufSize); \
- \
- (gcp)->WCbuf = \
- (dmaBuf)(gcp)->gammaScreen->bufs-> \
- list[(gcp)->WCbufIndex].address; \
- } \
-} while (0)
-
-#define VALIDATE_DRAWABLE_INFO(gcp) \
-do { \
- __DRIscreenPrivate *psp = gcp->driScreen; \
-if (gcp->driDrawable) { \
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp); \
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gcp); \
-} \
-} while (0)
-#else
-#define VALIDATE_DRAWABLE_INFO(gcp)
-#endif
-
-#define CALC_LOG2(l2,s) \
-do { \
- int __s = s; \
- l2 = 0; \
- while (__s > 1) { ++l2; __s >>= 1; } \
-} while (0)
-
-#endif
-
-#endif /* _GAMMA_MACROS_H_ */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h
deleted file mode 100644
index 2edda0722..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h
+++ /dev/null
@@ -1,659 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h,v 1.5 2002/02/22 21:33:02 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _GAMMA_REGS_H_
-#define _GAMMA_REGS_H_
-
-#include "gamma_client.h"
-
-/**************** MX FLAGS ****************/
-/* FBReadMode */
-#define FBReadSrcDisable 0x00000000
-#define FBReadSrcEnable 0x00000200
-#define FBReadDstDisable 0x00000000
-#define FBReadDstEnable 0x00000400
-#define FBDataTypeDefault 0x00000000
-#define FBDataTypeColor 0x00008000
-#define FBWindowOriginTop 0x00000000
-#define FBWindowOriginBot 0x00010000
-#define FBScanLineInt1 0x00000000
-#define FBScanLineInt2 0x00800000
-#define FBScanLineInt4 0x01000000
-#define FBScanLineInt8 0x01800000
-#define FBSrcAddrConst 0x00000000
-#define FBSrcAddrIndex 0x10000000
-#define FBSrcAddrCoord 0x20000000
-
-/* LBReadMode */
-#define LBPartialProdMask 0x000001ff
-#define LBReadSrcDisable 0x00000000
-#define LBReadSrcEnable 0x00000200
-#define LBReadDstDisable 0x00000000
-#define LBReadDstEnable 0x00000400
-#define LBDataTypeDefault 0x00000000
-#define LBDataTypeStencil 0x00010000
-#define LBDataTypeDepth 0x00020000
-#define LBWindowOriginTop 0x00000000
-#define LBWindowOriginBot 0x00040000
-#define LBScanLineInt1 0x00000000
-#define LBScanLineInt2 0x00100000
-#define LBScanLineInt4 0x00200000
-#define LBScanLineInt8 0x00300000
-
-/* ColorDDAMode */
-#define ColorDDADisable 0x00000000
-#define ColorDDAEnable 0x00000001
-#define ColorDDAFlat 0x00000000
-#define ColorDDAGouraud 0x00000002
-#define ColorDDAShadingMask 0x00000002
-
-/* AlphaTestMode */
-#define AlphaTestModeDisable 0x00000000
-#define AlphaTestModeEnable 0x00000001
-#define AT_Never 0x00000000
-#define AT_Less 0x00000002
-#define AT_Equal 0x00000004
-#define AT_LessEqual 0x00000006
-#define AT_Greater 0x00000008
-#define AT_NotEqual 0x0000000a
-#define AT_GreaterEqual 0x0000000c
-#define AT_Always 0x0000000e
-#define AT_CompareMask 0x0000000e
-#define AT_RefValueMask 0x00000ff0
-
-/* AlphaBlendMode */
-#define AlphaBlendModeDisable 0x00000000
-#define AlphaBlendModeEnable 0x00000001
-#define AB_Src_Zero 0x00000000
-#define AB_Src_One 0x00000002
-#define AB_Src_DstColor 0x00000004
-#define AB_Src_OneMinusDstColor 0x00000006
-#define AB_Src_SrcAlpha 0x00000008
-#define AB_Src_OneMinusSrcAlpha 0x0000000a
-#define AB_Src_DstAlpha 0x0000000c
-#define AB_Src_OneMinusDstAlpha 0x0000000e
-#define AB_Src_SrcAlphaSaturate 0x00000010
-#define AB_SrcBlendMask 0x0000001e
-#define AB_Dst_Zero 0x00000000
-#define AB_Dst_One 0x00000020
-#define AB_Dst_SrcColor 0x00000040
-#define AB_Dst_OneMinusSrcColor 0x00000060
-#define AB_Dst_SrcAlpha 0x00000080
-#define AB_Dst_OneMinusSrcAlpha 0x000000a0
-#define AB_Dst_DstAlpha 0x000000c0
-#define AB_Dst_OneMinusDstAlpha 0x000000e0
-#define AB_DstBlendMask 0x000000e0
-#define AB_ColorFmt_8888 0x00000000
-#define AB_ColorFmt_5555 0x00000100
-#define AB_ColorFmt_4444 0x00000200
-#define AB_ColorFmt_4444Front 0x00000300
-#define AB_ColorFmt_4444Back 0x00000400
-#define AB_ColorFmt_332Front 0x00000500
-#define AB_ColorFmt_332Back 0x00000600
-#define AB_ColorFmt_121Front 0x00000700
-#define AB_ColorFmt_121Back 0x00000800
-#define AB_ColorFmt_555Back 0x00000d00
-#define AB_ColorFmt_CI8 0x00000e00
-#define AB_ColorFmt_CI4 0x00000f00
-#define AB_AlphaBufferPresent 0x00000000
-#define AB_NoAlphaBufferPresent 0x00001000
-#define AB_ColorOrder_BGR 0x00000000
-#define AB_ColorOrder_RGB 0x00002000
-#define AB_OpenGLType 0x00000000
-#define AB_QuickDraw3DType 0x00004000
-#define AB_AlphaDst_FBData 0x00000000
-#define AB_AlphaDst_FBSourceData 0x00008000
-#define AB_ColorConversionScale 0x00000000
-#define AB_ColorConversionShift 0x00010000
-#define AB_AlphaConversionScale 0x00000000
-#define AB_AlphaConversionShift 0x00020000
-
-/* AntialiasMode */
-#define AntialiasModeDisable 0x00000000
-#define AntialiasModeEnable 0x00000001
-
-/* AreaStippleMode */
-#define AreaStippleModeDisable 0x00000000
-#define AreaStippleModeEnable 0x00000001
-#define ASM_X32 0x00000008
-#define ASM_Y32 0x00000040
-
-/* DepthMode */
-#define DepthModeDisable 0x00000000
-#define DepthModeEnable 0x00000001
-#define DM_WriteMask 0x00000002
-#define DM_SourceFragment 0x00000000
-#define DM_SourceLBData 0x00000004
-#define DM_SourceDepthRegister 0x00000008
-#define DM_SourceLBSourceData 0x0000000c
-#define DM_SourceMask 0x0000000c
-#define DM_Never 0x00000000
-#define DM_Less 0x00000010
-#define DM_Equal 0x00000020
-#define DM_LessEqual 0x00000030
-#define DM_Greater 0x00000040
-#define DM_NotEqual 0x00000050
-#define DM_GreaterEqual 0x00000060
-#define DM_Always 0x00000070
-#define DM_CompareMask 0x00000070
-
-/* FBWriteMode */
-#define FBWriteModeDisable 0x00000000
-#define FBWriteModeEnable 0x00000001
-#define FBW_UploadColorData 0x00000008
-
-/* FogMode */
-#define FogModeDisable 0x00000000
-#define FogModeEnable 0x00000001
-
-/* LBWriteMode */
-#define LBWriteModeDisable 0x00000000
-#define LBWriteModeEnable 0x00000001
-#define LBW_UploadNone 0x00000000
-#define LBW_UploadDepth 0x00000002
-#define LBW_UploadStencil 0x00000004
-
-/* LBRead/Write Format */
-#define LBRF_DepthWidth15 0x03 /* only permedia */
-#define LBRF_DepthWidth16 0x00
-#define LBRF_DepthWidth24 0x01
-#define LBRF_DepthWidth32 0x02
-#define LBRF_StencilWidth0 (0 << 2)
-#define LBRF_StencilWidth4 (1 << 2)
-#define LBRF_StencilWidth8 (2 << 2)
-#define LBRF_StencilPos16 (0 << 4)
-#define LBRF_StencilPos20 (1 << 4)
-#define LBRF_StencilPos24 (2 << 4)
-#define LBRF_StencilPos28 (3 << 4)
-#define LBRF_StencilPos32 (4 << 4)
-#define LBRF_FrameCount0 (0 << 7)
-#define LBRF_FrameCount4 (1 << 7)
-#define LBRF_FrameCount8 (2 << 7)
-#define LBRF_FrameCountPos16 (0 << 9)
-#define LBRF_FrameCountPos20 (1 << 9)
-#define LBRF_FrameCountPos24 (2 << 9)
-#define LBRF_FrameCountPos28 (3 << 9)
-#define LBRF_FrameCountPos32 (4 << 9)
-#define LBRF_FrameCountPos36 (5 << 9)
-#define LBRF_FrameCountPos40 (6 << 9)
-#define LBRF_GIDWidth0 (0 << 12)
-#define LBRF_GIDWidth4 (1 << 12)
-#define LBRF_GIDPos16 (0 << 13)
-#define LBRF_GIDPos20 (1 << 13)
-#define LBRF_GIDPos24 (2 << 13)
-#define LBRF_GIDPos28 (3 << 13)
-#define LBRF_GIDPos32 (4 << 13)
-#define LBRF_GIDPos36 (5 << 13)
-#define LBRF_GIDPos40 (6 << 13)
-#define LBRF_GIDPos44 (7 << 13)
-#define LBRF_GIDPos48 (8 << 13)
-#define LBRF_Compact32 (1 << 17)
-
-/* StencilMode */
-#define StencilDisable 0x00000000
-#define StencilEnable 0x00000001
-
-/* RouterMode */
-#define R_Order_TextureDepth 0x00000000
-#define R_Order_DepthTexture 0x00000001
-
-/* ScissorMode */
-#define UserScissorDisable 0x00000000
-#define UserScissorEnable 0x00000001
-#define ScreenScissorDisable 0x00000000
-#define ScreenScissorEnable 0x00000002
-
-/* DitherMode */
-#define DitherModeDisable 0x00000000
-#define DitherModeEnable 0x00000001
-#define DM_DitherDisable 0x00000000
-#define DM_DitherEnable 0x00000002
-#define DM_ColorFmt_8888 0x00000000
-#define DM_ColorFmt_5555 0x00000004
-#define DM_ColorFmt_4444 0x00000008
-#define DM_ColorFmt_4444Front 0x0000000c
-#define DM_ColorFmt_4444Back 0x00000010
-#define DM_ColorFmt_332Front 0x00000014
-#define DM_ColorFmt_332Back 0x00000018
-#define DM_ColorFmt_121Front 0x0000001c
-#define DM_ColorFmt_121Back 0x00000020
-#define DM_ColorFmt_555Back 0x00000024
-#define DM_ColorFmt_CI8 0x00000028
-#define DM_ColorFmt_CI4 0x0000002c
-#define DM_XOffsetMask 0x000000c0
-#define DM_YOffsetMask 0x00000300
-#define DM_ColorOrder_BGR 0x00000000
-#define DM_ColorOrder_RGB 0x00000400
-#define DM_AlphaDitherDefault 0x00000000
-#define DM_AlphaDitherNone 0x00004000
-#define DM_Truncate 0x00000000
-#define DM_Round 0x00008000
-
-/* RasterizerMode */
-#define RM_MirrorBitMask 0x00000001
-#define RM_InvertBitMask 0x00000002
-#define RM_FractionAdjNo 0x00000000
-#define RM_FractionAdjZero 0x00000004
-#define RM_FractionAdjHalf 0x00000008
-#define RM_FractionAdjNearHalf 0x0000000c
-#define RM_BiasCoordZero 0x00000000
-#define RM_BiasCoordHalf 0x00000010
-#define RM_BiasCoordNearHalf 0x00000020
-#define RM_BitMaskByteSwap_ABCD 0x00000000
-#define RM_BitMaskByteSwap_BADC 0x00000080
-#define RM_BitMaskByteSwap_CDAB 0x00000100
-#define RM_BitMaskByteSwap_DCBA 0x00000180
-#define RM_BitMaskPacked 0x00000000
-#define RM_BitMaskEveryScanline 0x00000200
-#define RM_BitMaskOffsetMask 0x00007c00
-#define RM_HostDataByteSwap_ABCD 0x00000000
-#define RM_HostDataByteSwap_BADC 0x00008000
-#define RM_HostDataByteSwap_CDAB 0x00010000
-#define RM_HostDataByteSwap_DCBA 0x00018000
-#define RM_SingleGLINT 0x00000000
-#define RM_MultiGLINT 0x00020000
-#define RM_YLimitsEnable 0x00040000
-
-/* Window */
-#define WindowDisable 0x00000000
-#define WindowEnable 0x00000001
-#define W_AlwaysPass 0x00000000
-#define W_NeverPass 0x00000002
-#define W_PassIfEqual 0x00000004
-#define W_PassIfNotEqual 0x00000006
-#define W_CompareMask 0x00000006
-#define W_ForceLBUpdate 0x00000008
-#define W_LBUpdateFromSource 0x00000000
-#define W_LBUpdateFromRegisters 0x00000010
-#define W_GIDMask 0x000001e0
-#define W_FrameCountMask 0x0001fe00
-#define W_StencilFCP 0x00020000
-#define W_DepthFCP 0x00040000
-#define W_OverrideWriteFiltering 0x00080000
-
-/* TextureAddressMode */
-#define TextureAddressModeDisable 0x00000000
-#define TextureAddressModeEnable 0x00000001
-#define TAM_SWrap_Clamp 0x00000000
-#define TAM_SWrap_Repeat 0x00000002
-#define TAM_SWrap_Mirror 0x00000004
-#define TAM_SWrap_Mask 0x00000006
-#define TAM_TWrap_Clamp 0x00000000
-#define TAM_TWrap_Repeat 0x00000008
-#define TAM_TWrap_Mirror 0x00000010
-#define TAM_TWrap_Mask 0x00000018
-#define TAM_Operation_2D 0x00000000
-#define TAM_Operation_3D 0x00000020
-#define TAM_InhibitDDAInit 0x00000040
-#define TAM_LODDisable 0x00000000
-#define TAM_LODEnable 0x00000080
-#define TAM_DY_Disable 0x00000000
-#define TAM_DY_Enable 0x00000100
-#define TAM_WidthMask 0x00001e00
-#define TAM_HeightMask 0x0001e000
-#define TAM_TexMapType_1D 0x00000000
-#define TAM_TexMapType_2D 0x00020000
-#define TAM_TexMapType_Mask 0x00020000
-
-/* TextureReadMode */
-#define TextureReadModeDisable 0x00000000
-#define TextureReadModeEnable 0x00000001
-#define TRM_WidthMask 0x0000001e
-#define TRM_HeightMask 0x000001e0
-#define TRM_Depth1 0x00000000
-#define TRM_Depth2 0x00000200
-#define TRM_Depth4 0x00000400
-#define TRM_Depth8 0x00000600
-#define TRM_Depth16 0x00000800
-#define TRM_Depth32 0x00000a00
-#define TRM_DepthMask 0x00000e00
-#define TRM_Border 0x00001000
-#define TRM_Patch 0x00002000
-#define TRM_Mag_Nearest 0x00000000
-#define TRM_Mag_Linear 0x00004000
-#define TRM_Mag_Mask 0x00004000
-#define TRM_Min_Nearest 0x00000000
-#define TRM_Min_Linear 0x00008000
-#define TRM_Min_NearestMMNearest 0x00010000
-#define TRM_Min_NearestMMLinear 0x00018000
-#define TRM_Min_LinearMMNearest 0x00020000
-#define TRM_Min_LinearMMLinear 0x00028000
-#define TRM_Min_Mask 0x00038000
-#define TRM_UWrap_Clamp 0x00000000
-#define TRM_UWrap_Repeat 0x00040000
-#define TRM_UWrap_Mirror 0x00080000
-#define TRM_UWrap_Mask 0x000c0000
-#define TRM_VWrap_Clamp 0x00000000
-#define TRM_VWrap_Repeat 0x00100000
-#define TRM_VWrap_Mirror 0x00200000
-#define TRM_VWrap_Mask 0x00300000
-#define TRM_TexMapType_1D 0x00000000
-#define TRM_TexMapType_2D 0x00400000
-#define TRM_TexMapType_Mask 0x00400000
-#define TRM_MipMapDisable 0x00000000
-#define TRM_MipMapEnable 0x00800000
-#define TRM_PrimaryCacheDisable 0x00000000
-#define TRM_PrimaryCacheEnable 0x01000000
-#define TRM_FBSourceAddr_None 0x00000000
-#define TRM_FBSourceAddr_Index 0x02000000
-#define TRM_FBSourceAddr_Coord 0x04000000
-#define TRM_BorderClamp 0x08000000
-
-/* TextureColorMode */
-#define TextureColorModeDisable 0x00000000
-#define TextureColorModeEnable 0x00000001
-#define TCM_Modulate 0x00000000
-#define TCM_Decal 0x00000002
-#define TCM_Blend 0x00000004
-#define TCM_Replace 0x00000006
-#define TCM_ApplicationMask 0x0000000e
-#define TCM_OpenGLType 0x00000000
-#define TCM_QuickDraw3DType 0x00000010
-#define TCM_KdDDA_Disable 0x00000000
-#define TCM_KdDDA_Enable 0x00000020
-#define TCM_KsDDA_Disable 0x00000000
-#define TCM_KsDDA_Enable 0x00000040
-#define TCM_BaseFormat_Alpha 0x00000000
-#define TCM_BaseFormat_Lum 0x00000080
-#define TCM_BaseFormat_LumAlpha 0x00000100
-#define TCM_BaseFormat_Intensity 0x00000180
-#define TCM_BaseFormat_RGB 0x00000200
-#define TCM_BaseFormat_RGBA 0x00000280
-#define TCM_BaseFormatMask 0x00000380
-#define TCM_LoadMode_None 0x00000000
-#define TCM_LoadMode_Ks 0x00000400
-#define TCM_LoadMode_Kd 0x00000800
-
-/* TextureCacheControl */
-#define TCC_Invalidate 0x00000001
-#define TCC_Disable 0x00000000
-#define TCC_Enable 0x00000002
-
-/* TextureFilterMode */
-#define TextureFilterModeDisable 0x00000000
-#define TextureFilterModeEnable 0x00000001
-#define TFM_AlphaMapEnable 0x00000002
-#define TFM_AlphaMapSense 0x00000004
-
-/* TextureFormat */
-#define TF_LittleEndian 0x00000000
-#define TF_BigEndian 0x00000001
-#define TF_16Bit_565 0x00000000
-#define TF_16Bit_555 0x00000002
-#define TF_ColorOrder_BGR 0x00000000
-#define TF_ColorOrder_RGB 0x00000004
-#define TF_Compnents_1 0x00000000
-#define TF_Compnents_2 0x00000008
-#define TF_Compnents_3 0x00000010
-#define TF_Compnents_4 0x00000018
-#define TF_CompnentsMask 0x00000018
-#define TF_OutputFmt_Texel 0x00000000
-#define TF_OutputFmt_Color 0x00000020
-#define TF_OutputFmt_BitMask 0x00000040
-#define TF_OutputFmtMask 0x00000060
-#define TF_MirrorEnable 0x00000080
-#define TF_InvertEnable 0x00000100
-#define TF_ByteSwapEnable 0x00000200
-#define TF_LUTOffsetMask 0x0003fc00
-#define TF_OneCompFmt_Lum 0x00000000
-#define TF_OneCompFmt_Alpha 0x00040000
-#define TF_OneCompFmt_Intensity 0x00080000
-#define TF_OneCompFmt_Mask 0x000c0000
-/**************** MX FLAGS ****************/
-
-/************** GAMMA FLAGS ***************/
-/* GeometryMode */
-#define GM_TextureDisable 0x00000000
-#define GM_TextureEnable 0x00000001
-#define GM_FogDisable 0x00000000
-#define GM_FogEnable 0x00000002
-#define GM_FogLinear 0x00000000
-#define GM_FogExp 0x00000004
-#define GM_FogExpSquared 0x00000008
-#define GM_FogMask 0x0000000C
-#define GM_FrontPolyPoint 0x00000000
-#define GM_FrontPolyLine 0x00000010
-#define GM_FrontPolyFill 0x00000020
-#define GM_BackPolyPoint 0x00000000
-#define GM_BackPolyLine 0x00000040
-#define GM_BackPolyFill 0x00000080
-#define GM_FB_PolyMask 0x000000F0
-#define GM_FrontFaceCW 0x00000000
-#define GM_FrontFaceCCW 0x00000100
-#define GM_FFMask 0x00000100
-#define GM_PolyCullDisable 0x00000000
-#define GM_PolyCullEnable 0x00000200
-#define GM_PolyCullFront 0x00000000
-#define GM_PolyCullBack 0x00000400
-#define GM_PolyCullBoth 0x00000800
-#define GM_PolyCullMask 0x00000c00
-#define GM_ClipShortLinesDisable 0x00000000
-#define GM_ClipShortLinesEnable 0x00001000
-#define GM_ClipSmallTrisDisable 0x00000000
-#define GM_ClipSmallTrisEnable 0x00002000
-#define GM_RenderMode 0x00000000
-#define GM_SelectMode 0x00004000
-#define GM_FeedbackMode 0x00008000
-#define GM_Feedback2D 0x00000000
-#define GM_Feedback3D 0x00010000
-#define GM_Feedback3DColor 0x00020000
-#define GM_Feedback3DColorTexture 0x00030000
-#define GM_Feedback4DColorTexture 0x00040000
-#define GM_CullFaceNormDisable 0x00000000
-#define GM_CullFaceNormEnable 0x00080000
-#define GM_AutoFaceNormDisable 0x00000000
-#define GM_AutoFaceNormEnable 0x00100000
-#define GM_GouraudShading 0x00000000
-#define GM_FlatShading 0x00200000
-#define GM_ShadingMask 0x00200000
-#define GM_UserClipNone 0x00000000
-#define GM_UserClip0 0x00400000
-#define GM_UserClip1 0x00800000
-#define GM_UserClip2 0x01000000
-#define GM_UserClip3 0x02000000
-#define GM_UserClip4 0x04000000
-#define GM_UserClip5 0x08000000
-#define GM_PolyOffsetPointDisable 0x00000000
-#define GM_PolyOffsetPointEnable 0x10000000
-#define GM_PolyOffsetLineDisable 0x00000000
-#define GM_PolyOffsetLineEnable 0x20000000
-#define GM_PolyOffsetFillDisable 0x00000000
-#define GM_PolyOffsetFillEnable 0x40000000
-#define GM_InvertFaceNormCullDisable 0x00000000
-#define GM_InvertFaceNormCullEnable 0x80000000
-
-/* Begin */
-#define B_AreaStippleDisable 0x00000000
-#define B_AreaStippleEnable 0x00000001
-#define B_LineStippleDisable 0x00000000
-#define B_LineStippleEnable 0x00000002
-#define B_AntiAliasDisable 0x00000000
-#define B_AntiAliasEnable 0x00000100
-#define B_TextureDisable 0x00000000
-#define B_TextureEnable 0x00002000
-#define B_FogDisable 0x00000000
-#define B_FogEnable 0x00004000
-#define B_SubPixelCorrectDisable 0x00000000
-#define B_SubPixelCorrectEnable 0x00010000
-#define B_PrimType_Null 0x00000000
-#define B_PrimType_Points 0x10000000
-#define B_PrimType_Lines 0x20000000
-#define B_PrimType_LineLoop 0x30000000
-#define B_PrimType_LineStrip 0x40000000
-#define B_PrimType_Triangles 0x50000000
-#define B_PrimType_TriangleStrip 0x60000000
-#define B_PrimType_TriangleFan 0x70000000
-#define B_PrimType_Quads 0x80000000
-#define B_PrimType_QuadStrip 0x90000000
-#define B_PrimType_Polygon 0xa0000000
-#define B_PrimType_Mask 0xf0000000
-
-/* EdgeFlag */
-#define EdgeFlagDisable 0x00000000
-#define EdgeFlagEnable 0x00000001
-
-/* NormalizeMode */
-#define NormalizeModeDisable 0x00000000
-#define NormalizeModeEnable 0x00000001
-#define FaceNormalDisable 0x00000000
-#define FaceNormalEnable 0x00000002
-#define InvertAutoFaceNormal 0x00000004
-
-/* LightingMode */
-#define LightingModeDisable 0x00000000
-#define LightingModeEnable 0x00000001
-#define LightingModeTwoSides 0x00000004
-#define LightingModeLocalViewer 0x00000008
-#define LightingModeSpecularEnable 0x00008000
-
-/* Light0Mode */
-#define Light0ModeDisable 0x00000000
-#define Light0ModeEnable 0x00000001
-#define Light0ModeSpotLight 0x00000002
-#define Light0ModeAttenuation 0x00000004
-#define Light0ModeLocal 0x00000008
-
-/* Light0Mode */
-#define Light1ModeDisable 0x00000000
-#define Light1ModeEnable 0x00000001
-#define Light1ModeSpotLight 0x00000002
-#define Light1ModeAttenuation 0x00000004
-#define Light1ModeLocal 0x00000008
-
-/* ColorMaterialMode */
-#define ColorMaterialModeDisable 0x00000000
-#define ColorMaterialModeEnable 0x00000001
-#define ColorMaterialModeFront 0x00000000
-#define ColorMaterialModeBack 0x00000002
-#define ColorMaterialModeFrontAndBack 0x00000004
-#define ColorMaterialModeEmission 0x00000000
-#define ColorMaterialModeAmbient 0x00000008
-#define ColorMaterialModeDiffuse 0x00000010
-#define ColorMaterialModeSpecular 0x00000018
-#define ColorMaterialModeAmbAndDiff 0x00000020
-#define ColorMaterialModeMask 0x0000003e
-
-/* MaterialMode */
-#define MaterialModeDisable 0x00000000
-#define MaterialModeEnable 0x00000001
-#define MaterialModeTwoSides 0x00000080
-
-/* DeltaMode */
-#define DM_Target300SX 0x00000000
-#define DM_Target500TXMX 0x00000001
-#define DM_Depth16 0x00000004
-#define DM_Depth24 0x00000008
-#define DM_Depth32 0x0000000c
-#define DM_FogEnable 0x00000010
-#define DM_TextureEnable 0x00000020
-#define DM_SmoothShadingEnable 0x00000040
-#define DM_DepthEnable 0x00000080
-#define DM_SpecularEnable 0x00000100
-#define DM_DiffuseEnable 0x00000200
-#define DM_SubPixlCorrectionEnable 0x00000400
-#define DM_DiamondExit 0x00000800
-#define DM_NoDraw 0x00001000
-#define DM_ClampEnable 0x00002000
-#define DM_TextureParameterAsGiven 0x00000000
-#define DM_TextureParameterClamped 0x00004000
-#define DM_TextureParameterNormalized 0x00008000
-#define DM_BiasCoords 0x00080000
-#define DM_ColorDiffuse 0x00100000
-#define DM_ColorSpecular 0x00200000
-#define DM_FlatShadingMethod 0x00400000
-
-/* PointMode */
-#define PM_AntialiasDisable 0x00000000
-#define PM_AntialiasEnable 0x00000001
-#define PM_AntialiasQuality_4x4 0x00000000
-#define PM_AntialiasQuality_8x8 0x00000002
-
-/* LogicalOpMode */
-#define LogicalOpModeDisable 0x00000000
-#define LogicalOpModeEnable 0x00000001
-#define LogicalOpModeMask 0x0000001e
-
-/* LineMode */
-#define LM_StippleDisable 0x00000000
-#define LM_StippleEnable 0x00000001
-#define LM_RepeatFactorMask 0x000003fe
-#define LM_StippleMask 0x03fffc00
-#define LM_MirrorDisable 0x00000000
-#define LM_MirrorEnable 0x04000000
-#define LM_AntialiasDisable 0x00000000
-#define LM_AntialiasEnable 0x08000000
-#define LM_AntialiasQuality_4x4 0x00000000
-#define LM_AntialiasQuality_8x8 0x10000000
-
-/* TriangleMode */
-#define TM_AntialiasDisable 0x00000000
-#define TM_AntialiasEnable 0x00000001
-#define TM_AntialiasQuality_4x4 0x00000000
-#define TM_AntialiasQuality_8x8 0x00000002
-#define TM_UseTriPacketInterface 0x00000004
-
-/* TransformMode */
-#define XM_UseModelViewMatrix 0x00000001
-#define XM_UseModelViewProjMatrix 0x00000002
-#define XM_XformNormals 0x00000004
-#define XM_XformFaceNormals 0x00000008
-#define XM_XformTexture 0x00000010
-#define XM_XMask 0x00000013
-#define XM_TexGenModeS_None 0x00000000
-#define XM_TexGenModeS_ObjLinear 0x00000020
-#define XM_TexGenModeS_EyeLinear 0x00000040
-#define XM_TexGenModeS_SphereMap 0x00000060
-#define XM_TexGenModeT_None 0x00000000
-#define XM_TexGenModeT_ObjLinear 0x00000080
-#define XM_TexGenModeT_EyeLinear 0x00000100
-#define XM_TexGenModeT_SphereMap 0x00000180
-#define XM_TexGenModeR_None 0x00000000
-#define XM_TexGenModeR_ObjLinear 0x00000200
-#define XM_TexGenModeR_EyeLinear 0x00000400
-#define XM_TexGenModeR_SphereMap 0x00000600
-#define XM_TexGenModeQ_None 0x00000000
-#define XM_TexGenModeQ_ObjLinear 0x00000800
-#define XM_TexGenModeQ_EyeLinear 0x00001000
-#define XM_TexGenModeQQSphereMap 0x00001800
-#define XM_TexGenS 0x00002000
-#define XM_TexGenT 0x00004000
-#define XM_TexGenR 0x00008000
-#define XM_TexGenQ 0x00010000
-
-/* LightNMode */
-#define LNM_Off 0x00000000
-#define LNM_On 0x00000001
-/************** GAMMA FLAGS ***************/
-
-#endif /* _GAMMA_REGS_H_ */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c
deleted file mode 100644
index b8bf61715..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- *
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "gamma_context.h"
-#include "gamma_tris.h"
-#include "gamma_vb.h"
-
-
-/* !! Should template this eventually !! */
-
-static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*coord)[4];
- GLuint coord_stride;
- GLubyte (*col)[4];
- GLuint col_stride;
- int i;
- GLuint tc0_stride = 0;
- GLfloat (*tc0)[4] = 0;
- GLuint tc0_size = 0;
-
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- gamma_import_float_colors( ctx );
-
- col = VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- tc0_stride = VB->TexCoordPtr[0]->stride;
- tc0 = VB->TexCoordPtr[0]->data;
- tc0_size = VB->TexCoordPtr[0]->size;
- coord = VB->ClipPtr->data;
- coord_stride = VB->ClipPtr->stride;
- } else {
- coord = VB->NdcPtr->data;
- coord_stride = VB->NdcPtr->stride;
- }
-
- if (VB->importable_data) {
- if (start) {
- coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
- STRIDE_4UB(col, start * col_stride);
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, Tq4, tc0[0][3]);
- WRITEF(gmesa->buf, Tr4, tc0[0][2]);
- WRITEF(gmesa->buf, Tt4, tc0[0][0]);
- WRITEF(gmesa->buf, Ts4, tc0[0][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vw, coord[0][3]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx4, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITEF(gmesa->buf, Tt2, tc0[0][0]);
- WRITEF(gmesa->buf, Ts2, tc0[0][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vw, coord[0][3]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx4, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- } else {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx3, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- }
- } else {
- if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, Tq4, tc0[i][3]);
- WRITEF(gmesa->buf, Tr4, tc0[i][2]);
- WRITEF(gmesa->buf, Tt4, tc0[i][0]);
- WRITEF(gmesa->buf, Ts4, tc0[i][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
- WRITEF(gmesa->buf, Vw, coord[i][3]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITEF(gmesa->buf, Tt2, tc0[i][0]);
- WRITEF(gmesa->buf, Ts2, tc0[i][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
- WRITEF(gmesa->buf, Vw, coord[i][3]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx3, coord[i][0]);
- }
- }
- }
-}
-
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 1
-#define HAVE_QUAD_STRIPS 1
-#define HAVE_POLYGONS 1
-
-#define HAVE_ELTS 0
-
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
-}
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- B_PrimType_Points,
- B_PrimType_Lines,
- B_PrimType_LineLoop,
- B_PrimType_LineStrip,
- B_PrimType_Triangles,
- B_PrimType_TriangleStrip,
- B_PrimType_TriangleFan,
- B_PrimType_Quads,
- B_PrimType_QuadStrip,
- B_PrimType_Polygon
-};
-
-static __inline void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim )
-{
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, gmesa->Begin | hw_prim[prim]);
-}
-
-static __inline void gammaEndPrimitive( gammaContextPtr gmesa )
-{
- GLcontext *ctx = gmesa->glCtx;
-
- if ( ctx->Line.SmoothFlag ||
- ctx->Polygon.SmoothFlag ||
- ctx->Point.SmoothFlag ) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
- }
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-#define LOCAL_VARS gammaContextPtr gmesa = GAMMA_CONTEXT(ctx)
-#define INIT( prim ) gammaStartPrimitive( gmesa, prim )
-#define FINISH gammaEndPrimitive( gmesa )
-#define NEW_PRIMITIVE() /* GAMMA_STATECHANGE( gmesa, 0 ) */
-#define NEW_BUFFER() /* GAMMA_FIREVERTICES( gmesa ) */
-#define GET_CURRENT_VB_MAX_VERTS() \
- (gmesa->bufSize - gmesa->bufCount) / 2
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- GAMMA_DMA_BUFFER_SIZE / 2
-#define EMIT_VERTS( ctx, j, nr ) gamma_emit(ctx, j, (j)+(nr))
-
-#define TAG(x) gamma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean gamma_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
- render_func *tab;
-
- /* GH: THIS IS A HACK!!! */
- if (VB->ClipOrMask || gmesa->RenderIndex != 0)
- return GL_TRUE; /* don't handle clipping here */
-
- /* We don't do elts */
- if (VB->Elts)
- return GL_TRUE;
-
- tab = TAG(render_tab_verts);
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-static void gamma_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _gamma_render_stage =
-{
- "gamma render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- gamma_check_render, /* check - initially set to alloc data */
- gamma_run_render /* run */
-};
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c
deleted file mode 100644
index 85cd1e516..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#include "gamma_context.h"
-#include "gamma_vb.h"
-#include "glint_dri.h"
-
-#include "imports.h"
-
-gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )
-{
- gammaScreenPtr gammaScreen;
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)sPriv->pDevPriv;
- int i;
-
-#if 0
- /* Check the DRI externsion version */
- if ( sPriv->driMajor != 3 || sPriv->driMinor != 1 ) {
- __driUtilMessage( "Gamma DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
- return NULL;
- }
-
- /* Check that the DDX driver version is compatible */
- if ( sPriv->ddxMajor != 4 ||
- sPriv->ddxMinor != 0 ||
- sPriv->ddxPatch < 0 ) {
- __driUtilMessage( "r128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch );
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if ( sPriv->drmMajor != 2 ||
- sPriv->drmMinor != 1 ||
- sPriv->drmPatch < 0 ) {
- __driUtilMessage( "r128 DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch );
- return GL_FALSE;
- }
-#endif
-
- /* Allocate the private area */
- gammaScreen = (gammaScreenPtr) CALLOC( sizeof(*gammaScreen) );
- if ( !gammaScreen ) return NULL;
-
- gammaScreen->regionCount = 4; /* Magic number. Can we fix this? */
-
- gammaScreen->regions = Xmalloc(gammaScreen->regionCount *
- sizeof(gammaRegion));
-
- gammaScreen->regions[0].handle = gDRIPriv->registers0.handle;
- gammaScreen->regions[0].size = gDRIPriv->registers0.size;
- gammaScreen->regions[1].handle = gDRIPriv->registers1.handle;
- gammaScreen->regions[1].size = gDRIPriv->registers1.size;
- gammaScreen->regions[2].handle = gDRIPriv->registers2.handle;
- gammaScreen->regions[2].size = gDRIPriv->registers2.size;
- gammaScreen->regions[3].handle = gDRIPriv->registers3.handle;
- gammaScreen->regions[3].size = gDRIPriv->registers3.size;
-
- /* Next, map all the regions */
- for (i = 0; i < gammaScreen->regionCount; i++) {
- if (drmMap(sPriv->fd,
- gammaScreen->regions[i].handle,
- gammaScreen->regions[i].size,
- &gammaScreen->regions[i].map)) {
- while (--i > 0) {
- (void)drmUnmap(gammaScreen->regions[i].map,
- gammaScreen->regions[i].size);
- }
- return GL_FALSE;
- }
- }
-
- /* Get the list of dma buffers */
- gammaScreen->bufs = drmMapBufs(sPriv->fd);
-
- if (!gammaScreen->bufs) {
- while (gammaScreen->regionCount > 0) {
- (void)drmUnmap(gammaScreen->regions[gammaScreen->regionCount].map,
- gammaScreen->regions[gammaScreen->regionCount].size);
- gammaScreen->regionCount--;
- }
- return GL_FALSE;
- }
-
- gammaScreen->textureSize = gDRIPriv->textureSize;
- gammaScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
- gammaScreen->cpp = gDRIPriv->cpp;
- gammaScreen->frontOffset = gDRIPriv->frontOffset;
- gammaScreen->frontPitch = gDRIPriv->frontPitch;
- gammaScreen->backOffset = gDRIPriv->backOffset;
- gammaScreen->backPitch = gDRIPriv->backPitch;
- gammaScreen->backX = gDRIPriv->backX;
- gammaScreen->backY = gDRIPriv->backY;
- gammaScreen->depthOffset = gDRIPriv->depthOffset;
- gammaScreen->depthPitch = gDRIPriv->depthPitch;
-
- gammaScreen->driScreen = sPriv;
-
- return gammaScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void gammaDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- gammaScreenPtr gammaScreen = (gammaScreenPtr)sPriv->private;
-
- /* First, unmap the dma buffers */
- drmUnmapBufs( gammaScreen->bufs );
-
- /* Next, unmap all the regions */
- while (gammaScreen->regionCount > 0) {
- (void)drmUnmap(gammaScreen->regions[gammaScreen->regionCount].map,
- gammaScreen->regions[gammaScreen->regionCount].size);
- gammaScreen->regionCount--;
- }
- FREE(gammaScreen->regions);
- FREE(gammaScreen);
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.h
deleted file mode 100644
index 6f3cf1e5b..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.h
+++ /dev/null
@@ -1,30 +0,0 @@
-typedef struct _gammaRegion {
- drmHandle handle;
- drmSize size;
- drmAddress map;
-} gammaRegion, *gammaRegionPtr;
-
-typedef struct {
-
- int regionCount; /* Count of register regions */
- gammaRegion *regions; /* Vector of mapped region info */
-
- drmBufMapPtr bufs; /* Map of DMA buffers */
-
- __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */
-
- int cpp;
- int frontPitch;
- int frontOffset;
-
- int backPitch;
- int backOffset;
- int backX;
- int backY;
-
- int depthOffset;
- int depthPitch;
-
- int textureSize;
- int logTextureGranularity;
-} gammaScreenRec, *gammaScreenPtr;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c
deleted file mode 100644
index 8d523c4b6..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_span.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include "gamma_context.h"
-#include "gamma_lock.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- gammaScreenPtr gammascrn = gmesa->gammaScreen; \
- __DRIscreenPrivate *sPriv = gmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
- GLuint pitch = sPriv->fbWidth * gammascrn->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- gmesa->drawOffset + \
- (dPriv->x * gammascrn->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- gmesa->readOffset + \
- (dPriv->x * gammascrn->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- gammaScreenPtr gammascrn = gmesa->gammaScreen; \
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
- __DRIscreenPrivate *sPriv = gmesa->driScreen; \
- GLuint pitch = gammascrn->depthPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- gammascrn->depthOffset + \
- dPriv->x * gammascrn->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK() \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- FLUSH_DMA_BUFFER(gmesa); \
- gammaGetLock( gmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); \
- GAMMAHW_LOCK( gmesa );
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK() GAMMAHW_UNLOCK( gmesa )
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 8) & 0xf8; \
- rgba[1] = (p >> 3) & 0xfc; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 0xff; \
- if ( rgba[0] & 0x08 ) rgba[0] |= 0x07; \
- if ( rgba[1] & 0x04 ) rgba[1] |= 0x03; \
- if ( rgba[2] & 0x08 ) rgba[2] |= 0x07; \
- } while (0)
-
-#define TAG(x) gamma##x##_RGB565
-#include "spantmp.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) gamma##x##_ARGB8888
-#include "spantmp.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch);
-
-#define TAG(x) gamma##x##_16
-#include "depthtmp.h"
-
-
-
-#if 0 /* Unused */
-/* 32 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch);
-
-#define TAG(x) gamma##x##_32
-#include "depthtmp.h"
-#endif
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xff; \
- tmp |= (d) & 0xffffff00; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff;
-
-
-#define TAG(x) gamma##x##_24_8
-#include "depthtmp.h"
-
-#if 0
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff00; \
- tmp |= d & 0xff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff;
-
-#define TAG(x) gamma##x##_24_8
-#include "stenciltmp.h"
-
-static void gammaReadRGBASpan8888( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gammaScreenPtr gammascrn = gmesa->gammaScreen;
- CARD32 dwords1, dwords2, i = 0;
- char *src = (char *)rgba[0];
- GLuint read = n * gammascrn->cpp; /* Number of bytes we are expecting */
- CARD32 data;
-
- FLUSH_DMA_BUFFER(gmesa);
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode & ~(LBReadSrcEnable | LBReadDstEnable));
- WRITE(gmesa->buf, ColorDDAMode, ColorDDAEnable);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeDisable);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode & ~FBReadSrcEnable) | FBReadDstEnable | FBDataTypeColor);
- WRITE(gmesa->buf, FilterMode, 0x200); /* Pass FBColorData */
- WRITE(gmesa->buf, FBWriteMode, FBW_UploadColorData | FBWriteModeDisable);
- WRITE(gmesa->buf, StartXSub, (x+n)<<16);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, GLINTCount, 1);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, Render, PrimitiveTrapezoid);
- FLUSH_DMA_BUFFER(gmesa);
-
-moredata:
-
- dwords1 = *(volatile CARD32*)(void *)(((CARD8*)gammascrn->regions[0].map) + (GlintOutFIFOWords));
- dwords2 = *(volatile CARD32*)(void *)(((CARD8*)gammascrn->regions[2].map) + (GlintOutFIFOWords));
-
- if (dwords1) {
- memcpy(src, (char*)gammascrn->regions[1].map + 0x1000, dwords1 << 2);
- src += dwords1 << 2;
- read -= dwords1 << 2;
- }
- if (dwords2) {
- memcpy(src, (char*)gammascrn->regions[3].map + 0x1000, dwords2 << 2);
- src += dwords2 << 2;
- read -= dwords2 << 2;
- }
-
- if (read)
- goto moredata;
-
-done:
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, FilterMode, 0x400);
-}
-#endif
-
-static void gammaSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- gmesa->readOffset = 0;
- break;
- case BACK_LEFT_BIT:
- gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- break;
- }
-}
-
-
-void gammaDDInitSpanFuncs( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = gammaSetBuffer;
-
- switch ( gmesa->gammaScreen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = gammaWriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = gammaWriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = gammaWriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = gammaWriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = gammaWriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = gammaReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = gammaReadRGBAPixels_RGB565;
- break;
-
- case 4:
- swdd->WriteRGBASpan = gammaWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = gammaWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = gammaWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = gammaWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = gammaWriteMonoRGBAPixels_ARGB8888;
-#if 1
- swdd->ReadRGBASpan = gammaReadRGBASpan_ARGB8888;
-#else
- swdd->ReadRGBASpan = gammaReadRGBASpan8888;
-#endif
- swdd->ReadRGBAPixels = gammaReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-
- switch ( gmesa->glCtx->Visual.depthBits ) {
- case 16:
- swdd->ReadDepthSpan = gammaReadDepthSpan_16;
- swdd->WriteDepthSpan = gammaWriteDepthSpan_16;
- swdd->ReadDepthPixels = gammaReadDepthPixels_16;
- swdd->WriteDepthPixels = gammaWriteDepthPixels_16;
- break;
-
- case 24:
- swdd->ReadDepthSpan = gammaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = gammaWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = gammaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = gammaWriteDepthPixels_24_8;
-
-#if 0
- swdd->ReadStencilSpan = gammaReadStencilSpan_24_8;
- swdd->WriteStencilSpan = gammaWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = gammaReadStencilPixels_24_8;
- swdd->WriteStencilPixels = gammaWriteStencilPixels_24_8;
-#endif
- break;
-
- default:
- break;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c
deleted file mode 100644
index 8a7672067..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c
+++ /dev/null
@@ -1,1734 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_state.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver
- */
-
-#include "gamma_context.h"
-#include "gamma_macros.h"
-#include "macros.h"
-#include "glint_dri.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-
-#define ENABLELIGHTING 0
-
-/* =============================================================
- * Alpha blending
- */
-
-static void gammaUpdateAlphaMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 a = gmesa->AlphaTestMode;
- CARD32 b = gmesa->AlphaBlendMode;
- CARD32 f = gmesa->AB_FBReadMode_Save = 0;
- GLubyte refByte = (GLint) (ctx->Color.AlphaRef * 255.0);
-
- a &= ~(AT_CompareMask | AT_RefValueMask);
- b &= ~(AB_SrcBlendMask | AB_DstBlendMask);
-
- a |= refByte << 4;
-
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- a |= AT_Never;
- break;
- case GL_LESS:
- a |= AT_Less;
- break;
- case GL_EQUAL:
- a |= AT_Equal;
- break;
- case GL_LEQUAL:
- a |= AT_LessEqual;
- break;
- case GL_GEQUAL:
- a |= AT_GreaterEqual;
- break;
- case GL_GREATER:
- a |= AT_Greater;
- break;
- case GL_NOTEQUAL:
- a |= AT_NotEqual;
- break;
- case GL_ALWAYS:
- a |= AT_Always;
- break;
- }
-
- if ( ctx->Color.AlphaEnabled ) {
- f |= FBReadDstEnable;
- a |= AlphaTestModeEnable;
- } else {
- a &= ~AlphaTestModeEnable;
- }
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- b |= AB_Src_Zero;
- break;
- case GL_ONE:
- b |= AB_Src_One;
- break;
- case GL_DST_COLOR:
- b |= AB_Src_DstColor;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= AB_Src_OneMinusDstColor;
- break;
- case GL_SRC_ALPHA:
- b |= AB_Src_SrcAlpha;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= AB_Src_OneMinusSrcAlpha;
- break;
- case GL_DST_ALPHA:
- b |= AB_Src_DstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= AB_Src_OneMinusDstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_SRC_ALPHA_SATURATE:
- b |= AB_Src_SrcAlphaSaturate;
- break;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- b |= AB_Dst_Zero;
- break;
- case GL_ONE:
- b |= AB_Dst_One;
- break;
- case GL_SRC_COLOR:
- b |= AB_Dst_SrcColor;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= AB_Dst_OneMinusSrcColor;
- break;
- case GL_SRC_ALPHA:
- b |= AB_Dst_SrcAlpha;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= AB_Dst_OneMinusSrcAlpha;
- break;
- case GL_DST_ALPHA:
- b |= AB_Dst_DstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= AB_Dst_OneMinusDstAlpha;
- f |= FBReadSrcEnable;
- break;
- }
-
- if ( ctx->Color.BlendEnabled ) {
- f |= FBReadDstEnable;
- b |= AlphaBlendModeEnable;
- } else {
- b &= ~AlphaBlendModeEnable;
- }
-
- if ( gmesa->AlphaTestMode != a ) {
- gmesa->AlphaTestMode = a;
- gmesa->dirty |= GAMMA_UPLOAD_ALPHA;
- }
- if ( gmesa->AlphaBlendMode != b) {
- gmesa->AlphaBlendMode = b;
- gmesa->dirty |= GAMMA_UPLOAD_BLEND;
- }
- gmesa->AB_FBReadMode_Save = f;
-}
-
-static void gammaDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- (void) ref;
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-static void gammaDDBlendEquation( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-static void gammaDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-static void gammaDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-
-static void gammaDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)gmesa->driScreen->pDevPriv;
- GLuint temp = 0;
-
- FLUSH_BATCH( gmesa );
-
- /* Update and emit any new state. We need to do this here to catch
- * changes to the masks.
- * FIXME: Just update the masks?
- */
- if ( gmesa->new_state )
- gammaDDUpdateHWState( ctx );
-
-#ifdef DO_VALIDATE
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-#endif
-
- if (mask & DD_DEPTH_BIT) {
- /* Turn off writes the FB */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeDisable);
-
- mask &= ~DD_DEPTH_BIT;
-
- /*
- * Turn Rectangle2DControl off when the window is not clipped
- * (i.e., the GID tests are not necessary). This dramatically
- * increases the performance of the depth clears.
- */
- if (!gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
- }
-
- temp = (gmesa->LBReadMode & LBPartialProdMask) | LBWindowOriginBot;
- if (gDRIPriv->numMultiDevices == 2) temp |= LBScanLineInt2;
-
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, LBReadMode, temp);
- WRITE(gmesa->buf, DeltaMode, DM_DepthEnable);
- WRITE(gmesa->buf, DepthMode, (DepthModeEnable |
- DM_Always |
- DM_SourceDepthRegister |
- DM_WriteMask));
- WRITE(gmesa->buf, GLINTDepth, gmesa->ClearDepth);
-
- /* Increment the frame count */
- gmesa->FrameCount++;
-#ifdef FAST_CLEAR_4
- gmesa->FrameCount &= 0x0f;
-#else
- gmesa->FrameCount &= 0xff;
-#endif
-
- /* Force FCP to be written */
- WRITE(gmesa->buf, GLINTWindow, (WindowEnable |
- W_PassIfEqual |
- (gmesa->Window & W_GIDMask) |
- W_DepthFCP |
- W_LBUpdateFromRegisters |
- W_OverrideWriteFiltering |
- (gmesa->FrameCount << 9)));
-
- /* Clear part of the depth and FCP buffers */
- {
- int y = gmesa->driScreen->fbHeight - gmesa->driDrawable->y - gmesa->driDrawable->h;
- int x = gmesa->driDrawable->x;
- int w = gmesa->driDrawable->w;
- int h = gmesa->driDrawable->h;
-#ifndef TURN_OFF_FCP
- float hsub = h;
-
- if (gmesa->WindowChanged) {
- gmesa->WindowChanged = GL_FALSE;
- } else {
-#ifdef FAST_CLEAR_4
- hsub /= 16;
-#else
- hsub /= 256;
-#endif
-
- /* Handle the case where the height < # of FCPs */
- if (hsub < 1.0) {
- if (gmesa->FrameCount > h)
- gmesa->FrameCount = 0;
- h = 1;
- y += gmesa->FrameCount;
- } else {
- h = (gmesa->FrameCount+1)*hsub;
- h -= (int)(gmesa->FrameCount*hsub);
- y += gmesa->FrameCount*hsub;
- }
- }
-#endif
- if (h && w) {
-#if 0
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, Rectangle2DMode, ((h & 0xfff)<<12) |
- (w & 0xfff) );
- WRITE(gmesa->buf, DrawRectangle2D, ((y & 0xffff)<<16) |
- (x & 0xffff) );
-#else
- CHECK_DMA_BUFFER(gmesa, 8);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, StartXSub, (x+w)<<16);
- WRITE(gmesa->buf, GLINTCount, h);
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, Render, 0x00000040); /* NOT_DONE */
-#endif
- }
- }
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, GLINTWindow, gmesa->Window);
- WRITE(gmesa->buf, FastClearDepth, gmesa->ClearDepth);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
-
- /* Turn on Depth FCP */
- if (gmesa->Window & W_DepthFCP) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, WindowOr, (gmesa->FrameCount << 9));
- }
-
- /* Turn off GID clipping if window is not clipped */
- if (gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 0);
- }
- }
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- int y = gmesa->driScreen->fbHeight - gmesa->driDrawable->y - gmesa->driDrawable->h;
- int x = gmesa->driDrawable->x;
- int w = gmesa->driDrawable->w;
- int h = gmesa->driDrawable->h;
-
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
-
- if (x < 0) { w -= -x; x = 0; }
-
- /* Turn on GID clipping if window is clipped */
- if (!gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
- }
-
- CHECK_DMA_BUFFER(gmesa, 18);
- WRITE(gmesa->buf, FBBlockColor, gmesa->ClearColor);
- WRITE(gmesa->buf, ColorDDAMode, ColorDDADisable);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, DepthMode, 0);
- WRITE(gmesa->buf, DeltaMode, 0);
- WRITE(gmesa->buf, AlphaBlendMode, 0);
-#if 1
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, StartXSub, (x+w)<<16);
- WRITE(gmesa->buf, GLINTCount, h);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, Render, 0x00000048); /* NOT_DONE */
-#else
- WRITE(gmesa->buf, Rectangle2DMode, (((h & 0xfff)<<12) |
- (w & 0xfff)));
- WRITE(gmesa->buf, DrawRectangle2D, (((y & 0xffff)<<16) |
- (x & 0xffff)));
-#endif
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
-
- /* Turn off GID clipping if window is clipped */
- if (gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 0);
- }
- }
-
-#ifdef DO_VALIDATE
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
-#endif
-
- if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void gammaUpdateZMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 z = gmesa->DepthMode;
- CARD32 delta = gmesa->DeltaMode;
- CARD32 window = gmesa->Window;
- CARD32 lbread = gmesa->LBReadMode;
-
- z &= ~DM_CompareMask;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- z |= DM_Never;
- break;
- case GL_ALWAYS:
- z |= DM_Always;
- break;
- case GL_LESS:
- z |= DM_Less;
- break;
- case GL_LEQUAL:
- z |= DM_LessEqual;
- break;
- case GL_EQUAL:
- z |= DM_Equal;
- break;
- case GL_GEQUAL:
- z |= DM_GreaterEqual;
- break;
- case GL_GREATER:
- z |= DM_Greater;
- break;
- case GL_NOTEQUAL:
- z |= DM_NotEqual;
- break;
- }
-
- if ( ctx->Depth.Test ) {
- z |= DepthModeEnable;
- delta |= DM_DepthEnable;
- window |= W_DepthFCP;
- lbread |= LBReadDstEnable;
- } else {
- z &= ~DepthModeEnable;
- delta &= ~DM_DepthEnable;
- window &= ~W_DepthFCP;
- lbread &= ~LBReadDstEnable;
- }
-
- if ( ctx->Depth.Mask ) {
- z |= DM_WriteMask;
- } else {
- z &= ~DM_WriteMask;
- }
-
-#if 0
- if ( gmesa->DepthMode != z ){
-#endif
- gmesa->DepthMode = z;
- gmesa->DeltaMode = delta;
- gmesa->Window = window;
- gmesa->LBReadMode = lbread;
- gmesa->dirty |= GAMMA_UPLOAD_DEPTH;
-#if 0
- }
-#endif
-}
-
-static void gammaDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
-}
-
-static void gammaDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
-}
-
-static void gammaDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( gmesa->DepthSize ) {
- case 16:
- gmesa->ClearDepth = d * 0x0000ffff;
- break;
- case 24:
- gmesa->ClearDepth = d * 0x00ffffff;
- break;
- case 32:
- gmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-static void gammaDDFinish( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_DMA_BUFFER(gmesa);
-}
-
-static void gammaDDFlush( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_DMA_BUFFER(gmesa);
-}
-
-/* =============================================================
- * Fog
- */
-
-static void gammaUpdateFogAttrib( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 f = gmesa->FogMode;
- CARD32 g = gmesa->GeometryMode;
- CARD32 d = gmesa->DeltaMode;
-
- if (ctx->Fog.Enabled) {
- f |= FogModeEnable;
- g |= GM_FogEnable;
- d |= DM_FogEnable;
- } else {
- f &= ~FogModeEnable;
- g &= ~GM_FogEnable;
- d &= ~DM_FogEnable;
- }
-
- g &= ~GM_FogMask;
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- g |= GM_FogLinear;
- break;
- case GL_EXP:
- g |= GM_FogExp;
- break;
- case GL_EXP2:
- g |= GM_FogExpSquared;
- break;
- }
-
- if ( gmesa->FogMode != f ) {
- gmesa->FogMode = f;
- gmesa->dirty |= GAMMA_UPLOAD_FOG;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-
- if ( gmesa->DeltaMode != d ) {
- gmesa->DeltaMode = d;
- gmesa->dirty |= GAMMA_UPLOAD_DEPTH;
- }
-}
-
-static void gammaDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_FOG;
-}
-
-/* =============================================================
- * Lines
- */
-static void gammaDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, LineWidth, (GLuint)width);
- WRITEF(gmesa->buf, AAlineWidth, width);
- WRITE(gmesa->buf, LineWidthOffset, (GLuint)(width-1)/2);
-}
-
-static void gammaDDLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- gmesa->LineMode &= ~(LM_StippleMask | LM_RepeatFactorMask);
- gmesa->LineMode |= ((GLuint)(factor - 1) << 1) | ((GLuint)pattern << 10);
-
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
-}
-
-
-
-/* =============================================================
- * Points
- */
-static void gammaDDPointSize( GLcontext *ctx, GLfloat size )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, PointSize, (GLuint)size);
- WRITEF(gmesa->buf, AApointSize, size);
-}
-
-/* =============================================================
- * Polygon
- */
-
-static void gammaUpdatePolygon( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 g = gmesa->GeometryMode;
-
- g &= ~(GM_PolyOffsetFillEnable | GM_PolyOffsetPointEnable |
- GM_PolyOffsetLineEnable);
-
- if (ctx->Polygon.OffsetFill) g |= GM_PolyOffsetFillEnable;
- if (ctx->Polygon.OffsetPoint) g |= GM_PolyOffsetPointEnable;
- if (ctx->Polygon.OffsetLine) g |= GM_PolyOffsetLineEnable;
-
- g &= ~GM_FB_PolyMask;
-
- switch (ctx->Polygon.FrontMode) {
- case GL_FILL:
- g |= GM_FrontPolyFill;
- break;
- case GL_LINE:
- g |= GM_FrontPolyLine;
- break;
- case GL_POINT:
- g |= GM_FrontPolyPoint;
- break;
- }
-
- switch (ctx->Polygon.BackMode) {
- case GL_FILL:
- g |= GM_BackPolyFill;
- break;
- case GL_LINE:
- g |= GM_BackPolyLine;
- break;
- case GL_POINT:
- g |= GM_BackPolyPoint;
- break;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_POLYGON;
-}
-
-static void gammaDDPolygonMode( GLcontext *ctx, GLenum face, GLenum mode)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_POLYGON;
-}
-
-static void gammaUpdateStipple( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- if (ctx->Polygon.StippleFlag) {
- gmesa->AreaStippleMode |= AreaStippleModeEnable/* | ASM_X32 | ASM_Y32*/;
- } else {
- gmesa->AreaStippleMode &= ~AreaStippleModeEnable;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_STIPPLE;
-}
-
-static void gammaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_STIPPLE;
-}
-
-/* =============================================================
- * Clipping
- */
-
-static void gammaUpdateClipping( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLint x1, y1, x2, y2;
-
- if ( gmesa->driDrawable ) {
- x1 = gmesa->driDrawable->x + ctx->Scissor.X;
- y1 = gmesa->driScreen->fbHeight -
- (gmesa->driDrawable->y +
- gmesa->driDrawable->h) + ctx->Scissor.Y;
- x2 = x1 + ctx->Scissor.Width;
- y2 = y1 + ctx->Scissor.Height;
-
- gmesa->ScissorMinXY = x1 | (y1 << 16);
- gmesa->ScissorMaxXY = x2 | (y2 << 16);
- if (ctx->Scissor.Enabled)
- gmesa->ScissorMode |= UserScissorEnable;
- else
- gmesa->ScissorMode &= ~UserScissorEnable;
-
- gmesa->dirty |= GAMMA_UPLOAD_CLIP;
- }
-}
-
-static void gammaDDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CLIP;
-}
-
-/* =============================================================
- * Culling
- */
-
-static void gammaUpdateCull( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 g = gmesa->GeometryMode;
-
- g &= ~(GM_PolyCullMask | GM_FFMask);
-
- if (ctx->Polygon.FrontFace == GL_CCW) {
- g |= GM_FrontFaceCCW;
- } else {
- g |= GM_FrontFaceCW;
- }
-
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- g |= GM_PolyCullFront;
- break;
- case GL_BACK:
- g |= GM_PolyCullBack;
- break;
- case GL_FRONT_AND_BACK:
- g |= GM_PolyCullBoth;
- break;
- }
-
- if ( ctx->Polygon.CullFlag ) {
- g |= GM_PolyCullEnable;
- } else {
- g &= ~GM_PolyCullEnable;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-}
-
-static void gammaDDCullFace( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
-}
-
-static void gammaDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
-}
-
-/* =============================================================
- * Masks
- */
-
-static void gammaUpdateMasks( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
-
- GLuint mask = gammaPackColor( gmesa->gammaScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if (gmesa->gammaScreen->cpp == 2) mask |= mask << 16;
-
- if ( gmesa->FBHardwareWriteMask != mask ) {
- gmesa->FBHardwareWriteMask = mask;
- gmesa->dirty |= GAMMA_UPLOAD_MASKS;
- }
-}
-
-static void gammaDDColorMask( GLcontext *ctx, GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_MASKS;
-}
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-#if ENABLELIGHTING
-static void gammaDDLightfv(GLcontext *ctx, GLenum light, GLenum pname,
- const GLfloat *params, GLint nParams)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLfloat l,x,y,z,w;
-
- switch(light) {
- case GL_LIGHT0:
- switch (pname) {
- case GL_AMBIENT:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0AmbientIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0AmbientIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0AmbientIntensityRed, params[0]);
- break;
- case GL_DIFFUSE:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0DiffuseIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0DiffuseIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0DiffuseIntensityRed, params[0]);
- break;
- case GL_SPECULAR:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0SpecularIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0SpecularIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0SpecularIntensityRed, params[0]);
- break;
- case GL_POSITION:
- /* Normalize <x,y,z> */
- x = params[0]; y = params[1]; z = params[2]; w = params[3];
- l = sqrt(x*x + y*y + z*z + w*w);
- w /= l;
- x /= l;
- y /= l;
- z /= l;
- if (params[3] != 0.0) {
- gmesa->Light0Mode |= Light0ModeAttenuation;
- gmesa->Light0Mode |= Light0ModeLocal;
- } else {
- gmesa->Light0Mode &= ~Light0ModeAttenuation;
- gmesa->Light0Mode &= ~Light0ModeLocal;
- }
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, Light0Mode, gmesa->Light0Mode);
- WRITEF(gmesa->buf, Light0PositionW, w);
- WRITEF(gmesa->buf, Light0PositionZ, z);
- WRITEF(gmesa->buf, Light0PositionY, y);
- WRITEF(gmesa->buf, Light0PositionX, x);
- break;
- case GL_SPOT_DIRECTION:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* WRITEF(gmesa->buf, Light0SpotlightDirectionW, params[3]); */
- WRITEF(gmesa->buf, Light0SpotlightDirectionZ, params[2]);
- WRITEF(gmesa->buf, Light0SpotlightDirectionY, params[1]);
- WRITEF(gmesa->buf, Light0SpotlightDirectionX, params[0]);
- break;
- case GL_SPOT_EXPONENT:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0SpotlightExponent, params[0]);
- break;
- case GL_SPOT_CUTOFF:
- if (params[0] != 180.0)
- gmesa->Light0Mode |= Light0ModeSpotLight;
- else
- gmesa->Light0Mode &= ~Light0ModeSpotLight;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, Light0Mode, gmesa->Light0Mode);
- WRITEF(gmesa->buf, Light0CosSpotlightCutoffAngle, cos(params[0]*DEG2RAD));
- break;
- case GL_CONSTANT_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0ConstantAttenuation, params[0]);
- break;
- case GL_LINEAR_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0LinearAttenuation, params[0]);
- break;
- case GL_QUADRATIC_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0QuadraticAttenuation, params[0]);
- break;
- }
- break;
- }
-}
-
-static void gammaDDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *params )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, SceneAmbientColorBlue, params[2]);
- WRITEF(gmesa->buf, SceneAmbientColorGreen, params[1]);
- WRITEF(gmesa->buf, SceneAmbientColorRed, params[0]);
- break;
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- if (params[0] != 0.0)
- gmesa->LightingMode |= LightingModeLocalViewer;
- else
- gmesa->LightingMode &= ~LightingModeLocalViewer;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- break;
- case GL_LIGHT_MODEL_TWO_SIDE:
- if (params[0] == 1.0f) {
- gmesa->LightingMode |= LightingModeTwoSides;
- gmesa->MaterialMode |= MaterialModeTwoSides;
- } else {
- gmesa->LightingMode &= ~LightingModeTwoSides;
- gmesa->MaterialMode &= ~MaterialModeTwoSides;
- }
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, MaterialMode, gmesa->MaterialMode);
- break;
- }
-}
-#endif
-
-static void gammaDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- CARD32 g = gmesa->GeometryMode;
- CARD32 c = gmesa->ColorDDAMode;
-
- g &= ~GM_ShadingMask;
- c &= ~ColorDDAShadingMask;
-
- switch ( mode ) {
- case GL_FLAT:
- g |= GM_FlatShading;
- c |= ColorDDAFlat;
- break;
- case GL_SMOOTH:
- g |= GM_GouraudShading;
- c |= ColorDDAGouraud;
- break;
- default:
- return;
- }
-
- if ( gmesa->ColorDDAMode != c ) {
- FLUSH_BATCH( gmesa );
- gmesa->ColorDDAMode = c;
-
- gmesa->dirty |= GAMMA_UPLOAD_SHADE;
- }
-
- if ( gmesa->GeometryMode != g ) {
- FLUSH_BATCH( gmesa );
- gmesa->GeometryMode = g;
-
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-}
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void gammaDDClearColor( GLcontext *ctx, const GLfloat color[4])
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLubyte c[4];
- UNCLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- gmesa->ClearColor = gammaPackColor( gmesa->gammaScreen->cpp,
- c[0], c[1], c[2], c[3] );
-
- if (gmesa->gammaScreen->cpp == 2) gmesa->ClearColor |= gmesa->ClearColor<<16;
-}
-
-
-static void gammaDDLogicalOpcode( GLcontext *ctx, GLenum opcode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- if ( ctx->Color.ColorLogicOpEnabled ) {
- gmesa->LogicalOpMode = opcode << 1 | LogicalOpModeEnable;
- } else {
- gmesa->LogicalOpMode = LogicalOpModeDisable;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_LOGICOP;
-}
-
-static void gammaDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- gmesa->drawOffset = gmesa->readOffset = 0;
- break;
- case GL_BACK_LEFT:
- gmesa->drawOffset = gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- break;
- }
-}
-
-static void gammaDDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* XXX anything? */
-}
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void gammaUpdateWindow( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat sy = v[MAT_SY];
- GLfloat ty = v[MAT_TY] + yoffset;
- GLfloat sz = v[MAT_SZ] * gmesa->depth_scale;
- GLfloat tz = v[MAT_TZ] * gmesa->depth_scale;
-
- gmesa->dirty |= GAMMA_UPLOAD_VIEWPORT;
-
- gmesa->ViewportScaleX = sx;
- gmesa->ViewportScaleY = sy;
- gmesa->ViewportScaleZ = sz;
- gmesa->ViewportOffsetX = tx;
- gmesa->ViewportOffsetY = ty;
- gmesa->ViewportOffsetZ = tz;
-}
-
-
-
-static void gammaDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- gammaUpdateWindow( ctx );
-}
-
-static void gammaDDDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- gammaUpdateWindow( ctx );
-}
-
-void gammaUpdateViewportOffset( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat ty = v[MAT_TY] + yoffset;
-
- if ( gmesa->ViewportOffsetX != tx ||
- gmesa->ViewportOffsetY != ty )
- {
- gmesa->ViewportOffsetX = tx;
- gmesa->ViewportOffsetY = ty;
-
- gmesa->new_state |= GAMMA_NEW_WINDOW;
- }
-
- gmesa->new_state |= GAMMA_NEW_CLIP;
-}
-
-#if 0
-/*
- * Matrix
- */
-
-static void gammaLoadHWMatrix(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- const GLfloat *m;
-
- gmesa->TransformMode &= ~XM_XformTexture;
-
- switch (ctx->Transform.MatrixMode) {
- case GL_MODELVIEW:
- gmesa->TransformMode |= XM_UseModelViewMatrix;
- m = ctx->ModelviewMatrixStack.Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewMatrix0, m[0]);
- WRITEF(gmesa->buf, ModelViewMatrix1, m[1]);
- WRITEF(gmesa->buf, ModelViewMatrix2, m[2]);
- WRITEF(gmesa->buf, ModelViewMatrix3, m[3]);
- WRITEF(gmesa->buf, ModelViewMatrix4, m[4]);
- WRITEF(gmesa->buf, ModelViewMatrix5, m[5]);
- WRITEF(gmesa->buf, ModelViewMatrix6, m[6]);
- WRITEF(gmesa->buf, ModelViewMatrix7, m[7]);
- WRITEF(gmesa->buf, ModelViewMatrix8, m[8]);
- WRITEF(gmesa->buf, ModelViewMatrix9, m[9]);
- WRITEF(gmesa->buf, ModelViewMatrix10, m[10]);
- WRITEF(gmesa->buf, ModelViewMatrix11, m[11]);
- WRITEF(gmesa->buf, ModelViewMatrix12, m[12]);
- WRITEF(gmesa->buf, ModelViewMatrix13, m[13]);
- WRITEF(gmesa->buf, ModelViewMatrix14, m[14]);
- WRITEF(gmesa->buf, ModelViewMatrix15, m[15]);
- break;
- case GL_PROJECTION:
- m = ctx->ProjectionMatrixStack.Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix0, m[0]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix1, m[1]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix2, m[2]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix3, m[3]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix4, m[4]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix5, m[5]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix6, m[6]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix7, m[7]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix8, m[8]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix9, m[9]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix10, m[10]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix11, m[11]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix12, m[12]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix13, m[13]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix14, m[14]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix15, m[15]);
- break;
- case GL_TEXTURE:
- m = ctx->TextureMatrixStack[0].Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- gmesa->TransformMode |= XM_XformTexture;
- WRITEF(gmesa->buf, TextureMatrix0, m[0]);
- WRITEF(gmesa->buf, TextureMatrix1, m[1]);
- WRITEF(gmesa->buf, TextureMatrix2, m[2]);
- WRITEF(gmesa->buf, TextureMatrix3, m[3]);
- WRITEF(gmesa->buf, TextureMatrix4, m[4]);
- WRITEF(gmesa->buf, TextureMatrix5, m[5]);
- WRITEF(gmesa->buf, TextureMatrix6, m[6]);
- WRITEF(gmesa->buf, TextureMatrix7, m[7]);
- WRITEF(gmesa->buf, TextureMatrix8, m[8]);
- WRITEF(gmesa->buf, TextureMatrix9, m[9]);
- WRITEF(gmesa->buf, TextureMatrix10, m[10]);
- WRITEF(gmesa->buf, TextureMatrix11, m[11]);
- WRITEF(gmesa->buf, TextureMatrix12, m[12]);
- WRITEF(gmesa->buf, TextureMatrix13, m[13]);
- WRITEF(gmesa->buf, TextureMatrix14, m[14]);
- WRITEF(gmesa->buf, TextureMatrix15, m[15]);
- break;
-
- default:
- /* ERROR!!! -- how did this happen? */
- break;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_TRANSFORM;
-}
-#endif
-
-/* =============================================================
- * State enable/disable
- */
-
-static void gammaDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- case GL_BLEND:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_ALPHA;
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- do {
- CARD32 d = gmesa->DitherMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- d |= DM_DitherEnable;
- } else {
- d &= ~DM_DitherEnable;
- }
-
- if ( gmesa->DitherMode != d ) {
- gmesa->DitherMode = d;
- gmesa->dirty |= GAMMA_UPLOAD_DITHER;
- }
- } while (0);
- break;
-
-#if 0
- case GL_FOG:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_FOG;
- break;
-#endif
-
- case GL_INDEX_LOGIC_OP:
- case GL_COLOR_LOGIC_OP:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_LOGICOP;
- break;
-
-#if ENABLELIGHTING
- case GL_LIGHTING:
- do {
- CARD32 l = gmesa->LightingMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- l |= LightingModeEnable;
- } else {
- l &= ~LightingModeEnable;
- }
-
- if ( gmesa->LightingMode != l ) {
- gmesa->LightingMode = l;
- gmesa->dirty |= GAMMA_UPLOAD_LIGHT;
- }
- } while (0);
- break;
-
- case GL_COLOR_MATERIAL:
- do {
- CARD32 m = gmesa->MaterialMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- m |= MaterialModeEnable;
- } else {
- m &= ~MaterialModeEnable;
- }
-
- if ( gmesa->MaterialMode != m ) {
- gmesa->MaterialMode = m;
- gmesa->dirty |= GAMMA_UPLOAD_LIGHT;
- }
- } while (0);
- break;
-#endif
-
- case GL_LINE_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->LineMode |= LM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->LineMode &= ~LM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
- break;
-
- case GL_POINT_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->PointMode |= PM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->PointMode &= ~PM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_POINTMODE;
- break;
-
- case GL_POLYGON_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->TriangleMode |= TM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->TriangleMode &= ~TM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_TRIMODE;
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CLIP;
- break;
-
- case GL_POLYGON_OFFSET_FILL:
- case GL_POLYGON_OFFSET_POINT:
- case GL_POLYGON_OFFSET_LINE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_POLYGON;
- break;
-
- case GL_LINE_STIPPLE:
- FLUSH_BATCH( gmesa );
- if ( state )
- gmesa->LineMode |= LM_StippleEnable;
- else
- gmesa->LineMode &= ~LM_StippleEnable;
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
- break;
-
- case GL_POLYGON_STIPPLE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_STIPPLE;
- break;
-
- default:
- return;
- }
-}
-
-/* =============================================================
- * State initialization, management
- */
-
-
-/*
- * Load the current context's state into the hardware.
- *
- * NOTE: Be VERY careful about ensuring the context state is marked for
- * upload, the only place it shouldn't be uploaded is when the setup
- * state has changed in ReducedPrimitiveChange as this comes right after
- * a state update.
- *
- * Blits of any type should always upload the context and masks after
- * they are done.
- */
-void gammaEmitHwState( gammaContextPtr gmesa )
-{
- if (!gmesa->driDrawable) return;
-
- if (!gmesa->dirty) return;
-
-#ifdef DO_VALIDATE
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-#endif
-
- if (gmesa->dirty & GAMMA_UPLOAD_VIEWPORT) {
- gmesa->dirty &= ~GAMMA_UPLOAD_VIEWPORT;
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, ViewPortOffsetX, gmesa->ViewportOffsetX);
- WRITEF(gmesa->buf, ViewPortOffsetY, gmesa->ViewportOffsetY);
- WRITEF(gmesa->buf, ViewPortOffsetZ, gmesa->ViewportOffsetZ);
- WRITEF(gmesa->buf, ViewPortScaleX, gmesa->ViewportScaleX);
- WRITEF(gmesa->buf, ViewPortScaleY, gmesa->ViewportScaleY);
- WRITEF(gmesa->buf, ViewPortScaleZ, gmesa->ViewportScaleZ);
- }
- if ( (gmesa->dirty & GAMMA_UPLOAD_POINTMODE) ||
- (gmesa->dirty & GAMMA_UPLOAD_LINEMODE) ||
- (gmesa->dirty & GAMMA_UPLOAD_TRIMODE) ) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AntialiasMode, gmesa->AntialiasMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_POINTMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_POINTMODE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PointMode, gmesa->PointMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LINEMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LINEMODE;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LineMode, gmesa->LineMode);
- WRITE(gmesa->buf, LineStippleMode, gmesa->LineMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TRIMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_TRIMODE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TriangleMode, gmesa->TriangleMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_FOG) {
- GLchan c[3], col;
- UNCLAMPED_FLOAT_TO_RGB_CHAN( c, gmesa->glCtx->Fog.Color );
- col = gammaPackColor(4, c[0], c[1], c[2], 0);
- gmesa->dirty &= ~GAMMA_UPLOAD_FOG;
- CHECK_DMA_BUFFER(gmesa, 5);
-#if 0
- WRITE(gmesa->buf, FogMode, gmesa->FogMode);
- WRITE(gmesa->buf, FogColor, col);
- WRITEF(gmesa->buf, FStart, gmesa->glCtx->Fog.Start);
-#endif
- WRITEF(gmesa->buf, FogEnd, gmesa->glCtx->Fog.End);
- WRITEF(gmesa->buf, FogDensity, gmesa->glCtx->Fog.Density);
- WRITEF(gmesa->buf, FogScale,
- 1.0f/(gmesa->glCtx->Fog.End - gmesa->glCtx->Fog.Start));
- }
- if (gmesa->dirty & GAMMA_UPLOAD_DITHER) {
- gmesa->dirty &= ~GAMMA_UPLOAD_DITHER;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, DitherMode, gmesa->DitherMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LOGICOP) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LOGICOP;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, LogicalOpMode, gmesa->LogicalOpMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_CLIP) {
- gmesa->dirty &= ~GAMMA_UPLOAD_CLIP;
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, ScissorMinXY, gmesa->ScissorMinXY);
- WRITE(gmesa->buf, ScissorMaxXY, gmesa->ScissorMaxXY);
- WRITE(gmesa->buf, ScissorMode, gmesa->ScissorMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_MASKS) {
- gmesa->dirty &= ~GAMMA_UPLOAD_MASKS;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FBHardwareWriteMask, gmesa->FBHardwareWriteMask);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_ALPHA) {
- gmesa->dirty &= ~GAMMA_UPLOAD_ALPHA;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AlphaTestMode, gmesa->AlphaTestMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_BLEND) {
- gmesa->dirty &= ~GAMMA_UPLOAD_BLEND;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- }
- CHECK_DMA_BUFFER(gmesa, 1);
- if (gmesa->glCtx->Color.BlendEnabled || gmesa->glCtx->Color.AlphaEnabled) {
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode | gmesa->AB_FBReadMode_Save);
- } else {
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LIGHT) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LIGHT;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, MaterialMode, gmesa->MaterialMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_SHADE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_SHADE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_POLYGON) {
- gmesa->dirty &= ~GAMMA_UPLOAD_POLYGON;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, PolygonOffsetBias, gmesa->glCtx->Polygon.OffsetUnits);
- WRITEF(gmesa->buf, PolygonOffsetFactor, gmesa->glCtx->Polygon.OffsetFactor);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_STIPPLE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_STIPPLE;
- CHECK_DMA_BUFFER(gmesa, 33);
- WRITE(gmesa->buf, AreaStippleMode, gmesa->AreaStippleMode);
- WRITE(gmesa->buf, AreaStipplePattern0, gmesa->glCtx->PolygonStipple[0]);
- WRITE(gmesa->buf, AreaStipplePattern1, gmesa->glCtx->PolygonStipple[1]);
- WRITE(gmesa->buf, AreaStipplePattern2, gmesa->glCtx->PolygonStipple[2]);
- WRITE(gmesa->buf, AreaStipplePattern3, gmesa->glCtx->PolygonStipple[3]);
- WRITE(gmesa->buf, AreaStipplePattern4, gmesa->glCtx->PolygonStipple[4]);
- WRITE(gmesa->buf, AreaStipplePattern5, gmesa->glCtx->PolygonStipple[5]);
- WRITE(gmesa->buf, AreaStipplePattern6, gmesa->glCtx->PolygonStipple[6]);
- WRITE(gmesa->buf, AreaStipplePattern7, gmesa->glCtx->PolygonStipple[7]);
- WRITE(gmesa->buf, AreaStipplePattern8, gmesa->glCtx->PolygonStipple[8]);
- WRITE(gmesa->buf, AreaStipplePattern9, gmesa->glCtx->PolygonStipple[9]);
- WRITE(gmesa->buf, AreaStipplePattern10, gmesa->glCtx->PolygonStipple[10]);
- WRITE(gmesa->buf, AreaStipplePattern11, gmesa->glCtx->PolygonStipple[11]);
- WRITE(gmesa->buf, AreaStipplePattern12, gmesa->glCtx->PolygonStipple[12]);
- WRITE(gmesa->buf, AreaStipplePattern13, gmesa->glCtx->PolygonStipple[13]);
- WRITE(gmesa->buf, AreaStipplePattern14, gmesa->glCtx->PolygonStipple[14]);
- WRITE(gmesa->buf, AreaStipplePattern15, gmesa->glCtx->PolygonStipple[15]);
- WRITE(gmesa->buf, AreaStipplePattern16, gmesa->glCtx->PolygonStipple[16]);
- WRITE(gmesa->buf, AreaStipplePattern17, gmesa->glCtx->PolygonStipple[17]);
- WRITE(gmesa->buf, AreaStipplePattern18, gmesa->glCtx->PolygonStipple[18]);
- WRITE(gmesa->buf, AreaStipplePattern19, gmesa->glCtx->PolygonStipple[19]);
- WRITE(gmesa->buf, AreaStipplePattern20, gmesa->glCtx->PolygonStipple[20]);
- WRITE(gmesa->buf, AreaStipplePattern21, gmesa->glCtx->PolygonStipple[21]);
- WRITE(gmesa->buf, AreaStipplePattern22, gmesa->glCtx->PolygonStipple[22]);
- WRITE(gmesa->buf, AreaStipplePattern23, gmesa->glCtx->PolygonStipple[23]);
- WRITE(gmesa->buf, AreaStipplePattern24, gmesa->glCtx->PolygonStipple[24]);
- WRITE(gmesa->buf, AreaStipplePattern25, gmesa->glCtx->PolygonStipple[25]);
- WRITE(gmesa->buf, AreaStipplePattern26, gmesa->glCtx->PolygonStipple[26]);
- WRITE(gmesa->buf, AreaStipplePattern27, gmesa->glCtx->PolygonStipple[27]);
- WRITE(gmesa->buf, AreaStipplePattern28, gmesa->glCtx->PolygonStipple[28]);
- WRITE(gmesa->buf, AreaStipplePattern29, gmesa->glCtx->PolygonStipple[29]);
- WRITE(gmesa->buf, AreaStipplePattern30, gmesa->glCtx->PolygonStipple[30]);
- WRITE(gmesa->buf, AreaStipplePattern31, gmesa->glCtx->PolygonStipple[31]);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_DEPTH) {
- gmesa->dirty &= ~GAMMA_UPLOAD_DEPTH;
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, GLINTWindow,gmesa->Window | (gmesa->FrameCount << 9));
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_GEOMETRY) {
- gmesa->dirty &= ~GAMMA_UPLOAD_GEOMETRY;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TRANSFORM) {
- gmesa->dirty &= ~GAMMA_UPLOAD_TRANSFORM;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TransformMode, gmesa->TransformMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TEX0) {
- gammaTextureObjectPtr curTex = gmesa->CurrentTexObj[0];
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX0;
- if (curTex) {
- CHECK_DMA_BUFFER(gmesa, 21);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode | GM_TextureEnable);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode | DM_TextureEnable);
- WRITE(gmesa->buf, TextureAddressMode, curTex->TextureAddressMode);
- WRITE(gmesa->buf, TextureReadMode, curTex->TextureReadMode);
- WRITE(gmesa->buf, TextureColorMode, curTex->TextureColorMode);
- WRITE(gmesa->buf, TextureFilterMode, curTex->TextureFilterMode);
- WRITE(gmesa->buf, TextureFormat, curTex->TextureFormat);
- WRITE(gmesa->buf, GLINTBorderColor, curTex->TextureBorderColor);
- WRITE(gmesa->buf, TxBaseAddr0, curTex->TextureBaseAddr[0]);
- WRITE(gmesa->buf, TxBaseAddr1, curTex->TextureBaseAddr[1]);
- WRITE(gmesa->buf, TxBaseAddr2, curTex->TextureBaseAddr[2]);
- WRITE(gmesa->buf, TxBaseAddr3, curTex->TextureBaseAddr[3]);
- WRITE(gmesa->buf, TxBaseAddr4, curTex->TextureBaseAddr[4]);
- WRITE(gmesa->buf, TxBaseAddr5, curTex->TextureBaseAddr[5]);
- WRITE(gmesa->buf, TxBaseAddr6, curTex->TextureBaseAddr[6]);
- WRITE(gmesa->buf, TxBaseAddr7, curTex->TextureBaseAddr[7]);
- WRITE(gmesa->buf, TxBaseAddr8, curTex->TextureBaseAddr[8]);
- WRITE(gmesa->buf, TxBaseAddr9, curTex->TextureBaseAddr[9]);
- WRITE(gmesa->buf, TxBaseAddr10, curTex->TextureBaseAddr[10]);
- WRITE(gmesa->buf, TxBaseAddr11, curTex->TextureBaseAddr[11]);
- WRITE(gmesa->buf, TxBaseAddr12, curTex->TextureBaseAddr[12]);
- WRITE(gmesa->buf, TextureCacheControl, (TCC_Enable | TCC_Invalidate));
- } else {
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, TextureAddressMode, TextureAddressModeDisable);
- WRITE(gmesa->buf, TextureReadMode, TextureReadModeDisable);
- WRITE(gmesa->buf, TextureFilterMode, TextureFilterModeDisable);
- WRITE(gmesa->buf, TextureColorMode, TextureColorModeDisable);
- }
- }
-#ifdef DO_VALIDATE
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
-#endif
-}
-
-void gammaDDUpdateHWState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- int new_state = gmesa->new_state;
-
- if ( new_state )
- {
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state = 0;
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & GAMMA_NEW_ALPHA )
- gammaUpdateAlphaMode( ctx );
-
- if ( new_state & GAMMA_NEW_DEPTH )
- gammaUpdateZMode( ctx );
-
- if ( new_state & GAMMA_NEW_FOG )
- gammaUpdateFogAttrib( ctx );
-
- if ( new_state & GAMMA_NEW_CLIP )
- gammaUpdateClipping( ctx );
-
- if ( new_state & GAMMA_NEW_POLYGON )
- gammaUpdatePolygon( ctx );
-
- if ( new_state & GAMMA_NEW_CULL )
- gammaUpdateCull( ctx );
-
- if ( new_state & GAMMA_NEW_MASKS )
- gammaUpdateMasks( ctx );
-
- if ( new_state & GAMMA_NEW_WINDOW )
- gammaUpdateWindow( ctx );
-
- if ( new_state & GAMMA_NEW_STIPPLE )
- gammaUpdateStipple( ctx );
- }
-
- /* HACK ! */
-
- gammaEmitHwState( gmesa );
-}
-
-
-static void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- GAMMA_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void gammaDDInitState( gammaContextPtr gmesa )
-{
- gmesa->new_state = 0;
-}
-
-/* Initialize the driver's state functions.
- */
-void gammaDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = gammaDDUpdateState;
-
- ctx->Driver.Clear = gammaDDClear;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = gammaDDClearColor;
- ctx->Driver.DrawBuffer = gammaDDDrawBuffer;
- ctx->Driver.ReadBuffer = gammaDDReadBuffer;
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = gammaDDColorMask;
-
- ctx->Driver.AlphaFunc = gammaDDAlphaFunc;
- ctx->Driver.BlendEquation = gammaDDBlendEquation;
- ctx->Driver.BlendFunc = gammaDDBlendFunc;
- ctx->Driver.BlendFuncSeparate = gammaDDBlendFuncSeparate;
- ctx->Driver.ClearDepth = gammaDDClearDepth;
- ctx->Driver.CullFace = gammaDDCullFace;
- ctx->Driver.FrontFace = gammaDDFrontFace;
- ctx->Driver.DepthFunc = gammaDDDepthFunc;
- ctx->Driver.DepthMask = gammaDDDepthMask;
- ctx->Driver.DepthRange = gammaDDDepthRange;
- ctx->Driver.Enable = gammaDDEnable;
- ctx->Driver.Finish = gammaDDFinish;
- ctx->Driver.Flush = gammaDDFlush;
-#if 0
- ctx->Driver.Fogfv = gammaDDFogfv;
-#endif
- ctx->Driver.Hint = NULL;
- ctx->Driver.LineWidth = gammaDDLineWidth;
- ctx->Driver.LineStipple = gammaDDLineStipple;
-#if ENABLELIGHTING
- ctx->Driver.Lightfv = gammaDDLightfv;
- ctx->Driver.LightModelfv = gammaDDLightModelfv;
-#endif
- ctx->Driver.LogicOpcode = gammaDDLogicalOpcode;
- ctx->Driver.PointSize = gammaDDPointSize;
- ctx->Driver.PolygonMode = gammaDDPolygonMode;
- ctx->Driver.PolygonStipple = gammaDDPolygonStipple;
- ctx->Driver.Scissor = gammaDDScissor;
- ctx->Driver.ShadeModel = gammaDDShadeModel;
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
- ctx->Driver.Viewport = gammaDDViewport;
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c
deleted file mode 100644
index 5cc8cdaf9..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "gamma_context.h"
-#include "colormac.h"
-
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-#if 0
-static GLuint gammaComputeLodBias(GLfloat bias)
-{
- return bias;
-}
-#endif
-
-static void gammaSetTexWrapping(gammaTextureObjectPtr t,
- GLenum wraps, GLenum wrapt)
-{
- CARD32 t1 = t->TextureAddressMode;
- CARD32 t2 = t->TextureReadMode;
-
- t1 &= ~(TAM_SWrap_Mask | TAM_TWrap_Mask);
- t2 &= ~(TRM_UWrap_Mask | TRM_VWrap_Mask);
-
- if (wraps != GL_CLAMP) {
- t1 |= TAM_SWrap_Repeat;
- t2 |= TRM_UWrap_Repeat;
- }
-
- if (wrapt != GL_CLAMP) {
- t1 |= TAM_TWrap_Repeat;
- t2 |= TRM_VWrap_Repeat;
- }
-
- t->TextureAddressMode = t1;
- t->TextureReadMode = t2;
-}
-
-
-static void gammaSetTexFilter(gammaContextPtr gmesa,
- gammaTextureObjectPtr t,
- GLenum minf, GLenum magf,
- GLfloat bias)
-{
- CARD32 t1 = t->TextureAddressMode;
- CARD32 t2 = t->TextureReadMode;
-
- t2 &= ~(TRM_Mag_Mask | TRM_Min_Mask);
-
- switch (minf) {
- case GL_NEAREST:
- t1 &= ~TAM_LODEnable;
- t2 &= ~TRM_MipMapEnable;
- t2 |= TRM_Min_Nearest;
- break;
- case GL_LINEAR:
- t1 &= ~TAM_LODEnable;
- t2 &= ~TRM_MipMapEnable;
- t2 |= TRM_Min_Linear;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t2 |= TRM_Min_NearestMMNearest;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t2 |= TRM_Min_LinearMMNearest;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t2 |= TRM_Min_NearestMMLinear;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t2 |= TRM_Min_LinearMMLinear;
- break;
- default:
- break;
- }
-
- switch (magf) {
- case GL_NEAREST:
- t2 |= TRM_Mag_Nearest;
- break;
- case GL_LINEAR:
- t2 |= TRM_Mag_Linear;
- break;
- default:
- break;
- }
-
- t->TextureAddressMode = t1;
- t->TextureReadMode = t2;
-}
-
-
-static void gammaSetTexBorderColor(gammaContextPtr gmesa,
- gammaTextureObjectPtr t,
- GLubyte color[4])
-{
- t->TextureBorderColor = PACK_COLOR_8888(color[0], color[1], color[2], color[3]);
-}
-
-
-static void gammaTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- if (!t)
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting gmesa->new_state means that
- * gammaUpdateTextureState() will be called before any triangles are
- * rendered. If a statechange has occurred, it will be detected at
- * that point, and buffered vertices flushed.
- */
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- }
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative for Radeon. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- gammaSwapOutTexObj( gmesa, t );
- break;
-
- default:
- return;
- }
-
- if (t == gmesa->CurrentTexObj[0])
- gmesa->dirty |= GAMMA_UPLOAD_TEX0;
-
-#if 0
- if (t == gmesa->CurrentTexObj[1]) {
- gmesa->dirty |= GAMMA_UPLOAD_TEX1;
- }
-#endif
-}
-
-
-static void gammaTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- /* Only one env color. Need a fallback if env colors are different
- * and texture setup references env color in both units.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a, col;
- CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
- CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- (b << 0));
-
- break;
- }
- case GL_TEXTURE_ENV_MODE:
- gmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
-#if 0 /* ?!?!?! */
- {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- (void) t;
- /* XXX Looks like there's something missing here */
- }
-#endif
- break;
-
- default:
- break;
- }
-}
-
-#if 0
-static void gammaTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, pack, texObj, texImage );
-}
-#endif
-
-#if 0
-static void gammaTexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, pack, texObj,
- texImage);
-}
-#endif
-
-static void gammaTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void gammaTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-static void gammaBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
-
- if (!t) {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- t = CALLOC_STRUCT(gamma_texture_object_t);
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->globj = tObj;
-
- t->TextureAddressMode = TextureAddressModeEnable | TAM_Operation_3D |
- TAM_DY_Enable | TAM_LODEnable;
- t->TextureReadMode = TextureReadModeEnable | TRM_PrimaryCacheEnable |
- TRM_MipMapEnable | TRM_BorderClamp | TRM_Border;
- t->TextureColorMode = TextureColorModeEnable;
- t->TextureFilterMode = TextureFilterModeEnable;
-
- if (target == GL_TEXTURE_2D) {
- t->TextureAddressMode |= TAM_TexMapType_2D;
- t->TextureReadMode |= TRM_TexMapType_2D;
- } else
- if (target == GL_TEXTURE_1D) {
- t->TextureAddressMode |= TAM_TexMapType_1D;
- t->TextureReadMode |= TRM_TexMapType_1D;
- }
-
- t->TextureColorMode = TextureColorModeEnable;
-
- t->TextureFilterMode = TextureFilterModeEnable;
-
-#ifdef MESA_LITTLE_ENDIAN
- t->TextureFormat = (TF_LittleEndian |
-#else
- t->TextureFormat = (TF_BigEndian |
-#endif
- TF_ColorOrder_RGB |
- TF_OutputFmt_Texel);
-
- t->dirty_images = ~0;
-
- tObj->DriverData = t;
- make_empty_list( t );
-
- gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
- }
-}
-
-
-static void gammaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
-
- if (t) {
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
-#if 0
- if (gmesa)
- GAMMA_FIREVERTICES( gmesa );
-#endif
- gammaDestroyTexObj( gmesa, t );
- tObj->DriverData = 0;
- }
-}
-
-static GLboolean gammaIsTextureResident( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
- return t && t->MemBlock;
-}
-
-static void gammaInitTextureObjects( GLcontext *ctx )
-{
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
-
- ctx->Texture.CurrentUnit = 0;
-
- texObj = ctx->Texture.Unit[0].Current1D;
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[0].Current2D;
- gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
-
-#if 0
- ctx->Texture.CurrentUnit = 1;
-
- texObj = ctx->Texture.Unit[1].Current1D;
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[1].Current2D;
- gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-void gammaDDInitTextureFuncs( GLcontext *ctx )
-{
- ctx->Driver.TexEnv = gammaTexEnv;
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = gammaTexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = gammaTexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.BindTexture = gammaBindTexture;
- ctx->Driver.DeleteTexture = gammaDeleteTexture;
- ctx->Driver.TexParameter = gammaTexParameter;
- ctx->Driver.UpdateTexturePalette = 0;
- ctx->Driver.IsTextureResident = gammaIsTextureResident;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- gammaInitTextureObjects( ctx );
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c
deleted file mode 100644
index 506b5c4c8..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "colormac.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "glint_dri.h"
-#include "gamma_context.h"
-#include "gamma_lock.h"
-
-void gammaDestroyTexObj(gammaContextPtr gmesa, gammaTextureObjectPtr t)
-{
- if (!t) return;
-
- /* This is sad - need to sync *in case* we upload a texture
- * to this newly free memory...
- */
- if (t->MemBlock) {
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (gmesa && t->age > gmesa->dirtyAge)
- gmesa->dirtyAge = t->age;
- }
-
- if (t->globj)
- t->globj->DriverData = 0;
-
- if (gmesa) {
- if (gmesa->CurrentTexObj[0] == t) {
- gmesa->CurrentTexObj[0] = 0;
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX0;
- }
-
-#if 0
- if (gmesa->CurrentTexObj[1] == t) {
- gmesa->CurrentTexObj[1] = 0;
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX1;
- }
-#endif
- }
-
- remove_from_list(t);
- free(t);
-}
-
-
-void gammaSwapOutTexObj(gammaContextPtr gmesa, gammaTextureObjectPtr t)
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (t->MemBlock) {
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (t->age > gmesa->dirtyAge)
- gmesa->dirtyAge = t->age;
- }
-
- t->dirty_images = ~0;
- move_to_tail(&(gmesa->SwappedOut), t);
-}
-
-
-
-/* Upload an image from mesa's internal copy.
- */
-static void gammaUploadTexLevel( gammaContextPtr gmesa, gammaTextureObjectPtr t, int level )
-{
- const struct gl_texture_image *image = t->image[level].image;
- int i,j;
- int l2d;
-#if 0
- int offset = 0;
-#endif
- int words, depthLog2;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- l2d = 5; /* 32bits per texel == 1<<5 */
-
- if (level == 0) {
- t->TextureAddressMode &= ~(TAM_WidthMask | TAM_HeightMask);
- t->TextureAddressMode |= (image->WidthLog2 << 9) |
- (image->HeightLog2 << 13);
- t->TextureReadMode &= ~(TRM_WidthMask | TRM_HeightMask |
- TRM_DepthMask | TRM_Border |
- TRM_Patch);
- t->TextureReadMode |= (image->WidthLog2 << 1) |
- (image->HeightLog2 << 5) |
- (l2d << 9);
- t->TextureFormat &= ~(TF_CompnentsMask | TF_OneCompFmt_Mask);
- }
-
- t->TextureBaseAddr[level] = /* ??? */
- (unsigned long)(t->image[level].offset + t->BufAddr) << 5;
-
- CALC_LOG2(depthLog2, 1<<l2d);
- words = (image->Width * image->Height) >> (5-depthLog2);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, LBWindowBase, t->TextureBaseAddr[level] >> 5);
- WRITE(gmesa->buf, TextureCacheControl, (TCC_Enable | TCC_Invalidate));
- WRITE(gmesa->buf, WaitForCompletion, 0);
- FLUSH_DMA_BUFFER(gmesa);
-
- switch (t->image[level].internalFormat) {
- case GL_RGB:
- case 3:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_3;
-
-#if 0 /* This is the texture download code we SHOULD be using */
- /* In the routines below, but this causes an DMA overrun - WHY ? */
- while (offset < words) {
- int count = gmesa->bufSize;
- int i;
- count -= 3;
- if (count > words-offset) count = words-offset;
-
- gmesa->buf->i = GlintTextureDownloadOffsetTag;
- gmesa->buf++;
- gmesa->buf->i = offset;
- gmesa->buf++;
- gmesa->buf->i = (GlintTextureDataTag | ((count-1) << 16));
- gmesa->buf++;
-
- for (i = 0; i < count; i++) {
- gmesa->buf->i = PACK_COLOR_565(src[0],src[1],src[2]);
- gmesa->buf++;
- src += 3;
- }
-
- gmesa->bufCount = count+3; /* texture data + 3 values */
- offset += count;
-
- FLUSH_DMA_BUFFER(gmesa);
- }
-#else
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_565(src[0],src[1],src[2]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 3;
- }
- FLUSH_DMA_BUFFER(gmesa);
-#endif
- }
- break;
-
- case GL_RGBA:
- case 4:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_4;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[1],src[2],src[3]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 4;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_LUMINANCE:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Lum;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_888(src[0],src[0],src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src ++;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_INTENSITY:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Intensity;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[0],src[0],src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src ++;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_LUMINANCE_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_2;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[0],src[0],src[1]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 2;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Alpha;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(255,255,255,src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 1;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- /* TODO: Translate color indices *now*:
- */
- case GL_COLOR_INDEX:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[level].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- for (i = 0 ; i < image->Width ; i++) {
- dst[i] = src[0];
- src += 1;
- }
- }
- }
- break;
-
- default:
- fprintf(stderr, "Not supported texture format %s\n",
- _mesa_lookup_enum_by_nr(image->Format));
- }
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, WaitForCompletion, 0);
- WRITE(gmesa->buf, LBWindowBase, gmesa->LBWindowBase);
-}
-
-void gammaPrintLocalLRU( gammaContextPtr gmesa )
-{
- gammaTextureObjectPtr t;
- int sz = 1 << (gmesa->gammaScreen->logTextureGranularity);
-
- foreach( t, &gmesa->TexObjList ) {
- if (!t->globj)
- fprintf(stderr, "Placeholder %d at %x sz %x\n",
- t->MemBlock->ofs / sz,
- t->MemBlock->ofs,
- t->MemBlock->size);
- else
- fprintf(stderr, "Texture at %x sz %x\n",
- t->MemBlock->ofs,
- t->MemBlock->size);
-
- }
-}
-
-void gammaPrintGlobalLRU( gammaContextPtr gmesa )
-{
- int i, j;
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
-
- for (i = 0, j = GAMMA_NR_TEX_REGIONS ; i < GAMMA_NR_TEX_REGIONS ; i++) {
- fprintf(stderr, "list[%d] age %d next %d prev %d\n",
- j, list[j].age, list[j].next, list[j].prev);
- j = list[j].next;
- if (j == GAMMA_NR_TEX_REGIONS) break;
- }
-
- if (j != GAMMA_NR_TEX_REGIONS)
- fprintf(stderr, "Loop detected in global LRU\n");
-}
-
-
-void gammaResetGlobalLRU( gammaContextPtr gmesa )
-{
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
- int sz = 1 << gmesa->gammaScreen->logTextureGranularity;
- int i;
-
- /* (Re)initialize the global circular LRU list. The last element
- * in the array (GAMMA_NR_TEX_REGIONS) is the sentinal. Keeping it
- * at the end of the array allows it to be addressed rationally
- * when looking up objects at a particular location in texture
- * memory.
- */
- for (i = 0 ; (i+1) * sz <= gmesa->gammaScreen->textureSize ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = GAMMA_NR_TEX_REGIONS;
- list[i].prev = i-1;
- list[i].next = GAMMA_NR_TEX_REGIONS;
- list[GAMMA_NR_TEX_REGIONS].prev = i;
- list[GAMMA_NR_TEX_REGIONS].next = 0;
- gmesa->sarea->texAge = 0;
-}
-
-
-void gammaUpdateTexLRU( gammaContextPtr gmesa, gammaTextureObjectPtr t )
-{
- int i;
- int logsz = gmesa->gammaScreen->logTextureGranularity;
- int start = t->MemBlock->ofs >> logsz;
- int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz;
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
-
- gmesa->texAge = ++gmesa->sarea->texAge;
-
- /* Update our local LRU
- */
- move_to_head( &(gmesa->TexObjList), t );
-
- /* Update the global LRU
- */
- for (i = start ; i <= end ; i++) {
-
- list[i].in_use = 1;
- list[i].age = gmesa->texAge;
-
- /* remove_from_list(i)
- */
- list[(unsigned)list[i].next].prev = list[i].prev;
- list[(unsigned)list[i].prev].next = list[i].next;
-
- /* insert_at_head(list, i)
- */
- list[i].prev = GAMMA_NR_TEX_REGIONS;
- list[i].next = list[GAMMA_NR_TEX_REGIONS].next;
- list[(unsigned)list[GAMMA_NR_TEX_REGIONS].next].prev = i;
- list[GAMMA_NR_TEX_REGIONS].next = i;
- }
-}
-
-
-/* Called for every shared texture region which has increased in age
- * since we last held the lock.
- *
- * Figures out which of our textures have been ejected by other clients,
- * and pushes a placeholder texture onto the LRU list to represent
- * the other client's textures.
- */
-void gammaTexturesGone( gammaContextPtr gmesa,
- GLuint offset,
- GLuint size,
- GLuint in_use )
-{
- gammaTextureObjectPtr t, tmp;
-
- foreach_s ( t, tmp, &gmesa->TexObjList ) {
-
- if (t->MemBlock->ofs >= offset + size ||
- t->MemBlock->ofs + t->MemBlock->size <= offset)
- continue;
-
- /* It overlaps - kick it off. Need to hold onto the currently bound
- * objects, however.
- */
- gammaSwapOutTexObj( gmesa, t );
- }
-
- if (in_use) {
- t = (gammaTextureObjectPtr) calloc(1,sizeof(*t));
- if (!t) return;
-
- t->MemBlock = mmAllocMem( gmesa->texHeap, size, 0, offset);
- insert_at_head( &gmesa->TexObjList, t );
- }
-
- /* Reload any lost textures referenced by current vertex buffer.
- */
-#if 0
- if (gmesa->vertex_buffer) {
- int i, j;
-
- fprintf(stderr, "\n\nreload tex\n");
-
- for (i = 0 ; i < gmesa->statenr ; i++) {
- for (j = 0 ; j < 2 ; j++) {
- gammaTextureObjectPtr t = gmesa->state_tex[j][i];
- if (t) {
- if (t->MemBlock == 0)
- gammaUploadTexImages( gmesa, t );
- }
- }
- }
-
- /* Hard to do this with the lock held:
- */
-/* GAMMA_FIREVERTICES( gmesa ); */
- }
-#endif
-}
-
-
-
-
-
-/* This is called with the lock held. May have to eject our own and/or
- * other client's texture objects to make room for the upload.
- */
-void gammaUploadTexImages( gammaContextPtr gmesa, gammaTextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-
- /* /fprintf(stderr, "%s\n", __FUNCTION__); */
-#if 0
- LOCK_HARDWARE( gmesa );
-#endif
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->MemBlock) {
- while (1)
- {
- t->MemBlock = mmAllocMem( gmesa->texHeap, t->totalSize, 12, 0 );
- if (t->MemBlock)
- break;
-
- if (gmesa->TexObjList.prev == gmesa->CurrentTexObj[0] ||
- gmesa->TexObjList.prev == gmesa->CurrentTexObj[1]) {
- fprintf(stderr, "Hit bound texture in upload\n");
- gammaPrintLocalLRU( gmesa );
- return;
- }
-
- if (gmesa->TexObjList.prev == &(gmesa->TexObjList)) {
- fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize);
- mmDumpMemInfo( gmesa->texHeap );
- return;
- }
-
- gammaSwapOutTexObj( gmesa, gmesa->TexObjList.prev );
- }
-
- ofs = t->MemBlock->ofs;
- t->BufAddr = (char *)(unsigned long)(gmesa->LBWindowBase + ofs); /* ??? */
-
- if (t == gmesa->CurrentTexObj[0])
- gmesa->dirty |= GAMMA_UPLOAD_TEX0;
-
-#if 0
- if (t == gmesa->CurrentTexObj[1])
- gmesa->dirty |= GAMMA_UPLOAD_TEX1;
-#endif
-
- gammaUpdateTexLRU( gmesa, t );
- }
-
-#if 0
- if (gmesa->dirtyAge >= GET_DISPATCH_AGE(gmesa))
- gammaWaitAgeLocked( gmesa, gmesa->dirtyAge );
-#endif
-
- numLevels = t->lastLevel - t->firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->dirty_images & (1<<i))
- gammaUploadTexLevel( gmesa, t, i );
-
- t->dirty_images = 0;
-
-#if 0
- UNLOCK_HARDWARE( gmesa );
-#endif
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c
deleted file mode 100644
index dfd82b489..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "gamma_context.h"
-
-static void gammaSetTexImages( gammaContextPtr gmesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, log_pitch;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
- GLint log2Width, log2Height;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- t->texelBytes = 2;
-
- /* Compute which mipmap levels we really want to send to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- * Yes, this looks overly complicated, but it's all needed.
- */
- if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST) {
- firstLevel = lastLevel = tObj->BaseLevel;
- }
- else {
- firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- /* save these values */
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-
- numLevels = lastLevel - firstLevel + 1;
-
- log2Width = tObj->Image[firstLevel]->WidthLog2;
- log2Height = tObj->Image[firstLevel]->HeightLog2;
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- width = tObj->Image[firstLevel]->Width * t->texelBytes;
- for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 )
- log_pitch++;
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( height = i = 0 ; i < numLevels ; i++ ) {
- t->image[i].image = tObj->Image[firstLevel + i];
- t->image[i].offset = height * pitch;
- t->image[i].internalFormat = baseImage->Format;
- height += t->image[i].image->Height;
- t->TextureBaseAddr[i] = /* ??? */
- (unsigned long)(t->image[i].offset + t->BufAddr) << 5;
-
- }
-
- t->Pitch = pitch;
- t->totalSize = height*pitch;
- t->max_level = i-1;
- gmesa->dirty |= GAMMA_UPLOAD_TEX0 /* | GAMMA_UPLOAD_TEX1*/;
-
- gammaUploadTexImages( gmesa, t );
-}
-
-static void gammaUpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLuint format = tObj->Image[tObj->BaseLevel]->Format;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
- GLuint tc;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- tc = t->TextureColorMode & ~(TCM_BaseFormatMask | TCM_ApplicationMask);
-
- switch (format) {
- case GL_RGB:
- tc |= TCM_BaseFormat_RGB;
- break;
- case GL_LUMINANCE:
- tc |= TCM_BaseFormat_Lum;
- break;
- case GL_ALPHA:
- tc |= TCM_BaseFormat_Alpha;
- break;
- case GL_LUMINANCE_ALPHA:
- tc |= TCM_BaseFormat_LumAlpha;
- break;
- case GL_INTENSITY:
- tc |= TCM_BaseFormat_Intensity;
- break;
- case GL_RGBA:
- tc |= TCM_BaseFormat_RGBA;
- break;
- case GL_COLOR_INDEX:
- break;
- }
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- tc |= TCM_Replace;
- break;
- case GL_MODULATE:
- tc |= TCM_Modulate;
- break;
- case GL_ADD:
- /* do nothing ???*/
- break;
- case GL_DECAL:
- tc |= TCM_Decal;
- break;
- case GL_BLEND:
- tc |= TCM_Blend;
- break;
- default:
- fprintf(stderr, "unknown tex env mode");
- return;
- }
-
- t->TextureColorMode = tc;
-}
-
-
-
-
-static void gammaUpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->dirty_images) {
- gammaSetTexImages( gmesa, tObj );
- if (!t->MemBlock) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
- }
-
-#if 0
- if (tObj->Image[tObj->BaseLevel]->Border > 0) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
-#endif
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (gmesa->CurrentTexObj[unit] != t) {
- gmesa->dirty |= GAMMA_UPLOAD_TEX0 /* << unit */;
- gmesa->CurrentTexObj[unit] = t;
- gammaUpdateTexLRU( gmesa, t ); /* done too often */
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[tObj->BaseLevel]->Format != gmesa->TexEnvImageFmt[unit]) {
- gmesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format;
- gammaUpdateTexEnv( ctx, unit );
- }
- }
- else if (texUnit->_ReallyEnabled) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- }
- else /*if (gmesa->CurrentTexObj[unit])*/ {
- gmesa->CurrentTexObj[unit] = 0;
- gmesa->TexEnvImageFmt[unit] = 0;
- gmesa->dirty &= ~(GAMMA_UPLOAD_TEX0<<unit);
- }
-}
-
-
-void gammaUpdateTextureState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_FALSE );
- gammaUpdateTexUnit( ctx, 0 );
-#if 0
- gammaUpdateTexUnit( ctx, 1 );
-#endif
-}
-
-
-
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c
deleted file mode 100644
index f03910302..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#include "gamma_context.h"
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-
-/***********************************************************************
- * Build hardware rasterization functions *
- ***********************************************************************/
-
-#define GAMMA_RAST_ALPHA_BIT 0x01
-#define GAMMA_RAST_TEX_BIT 0x02
-#define GAMMA_RAST_FLAT_BIT 0x04
-
-static gamma_point_func gamma_point_tab[0x8];
-static gamma_line_func gamma_line_tab[0x8];
-static gamma_tri_func gamma_tri_tab[0x8];
-static gamma_quad_func gamma_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_TEX_BIT)
-#define TAG(x) x##_tex
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_TEX_BIT)
-#define TAG(x) x##_alpha_tex
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_TEX_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_tex_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_TEX_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_alpha_tex_flat
-#include "gamma_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- gamma_init();
- gamma_init_alpha();
- gamma_init_tex();
- gamma_init_alpha_tex();
- gamma_init_flat();
- gamma_init_alpha_flat();
- gamma_init_tex_flat();
- gamma_init_alpha_tex_flat();
-}
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-gamma_fallback_quad( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2,
- const gammaVertex *v3 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[4];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- gamma_translate_vertex( ctx, v2, &v[2] );
- gamma_translate_vertex( ctx, v3, &v[3] );
- _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] );
-}
-
-static void
-gamma_fallback_tri( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[3];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- gamma_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-static void
-gamma_fallback_line( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[2];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-#if 0
-static void
-gamma_fallback_point( gammaContextPtr gmesa,
- const gammaVertex *v0 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[1];
- gamma_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-#endif
-
-
-/***********************************************************************
- * Choose rasterization functions *
- ***********************************************************************/
-
-#define _GAMMA_NEW_RASTER_STATE (_NEW_FOG | \
- _NEW_TEXTURE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _DD_NEW_LINE_STIPPLE)
-
-#define LINE_FALLBACK (0)
-#define TRI_FALLBACK (0)
-
-static void gammaChooseRasterState(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- if ( ctx->Line.SmoothFlag ||
- ctx->Polygon.SmoothFlag ||
- ctx->Point.SmoothFlag )
- gmesa->Begin |= B_AntiAliasEnable;
- else
- gmesa->Begin &= ~B_AntiAliasEnable;
-
- if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
- ind |= GAMMA_RAST_TEX_BIT;
- gmesa->Begin |= B_TextureEnable;
- } else
- gmesa->Begin &= ~B_TextureEnable;
-
- if (flags & DD_LINE_STIPPLE)
- gmesa->Begin |= B_LineStippleEnable;
- else
- gmesa->Begin &= ~B_LineStippleEnable;
-
- if (flags & DD_TRI_STIPPLE)
- gmesa->Begin |= B_AreaStippleEnable;
- else
- gmesa->Begin &= ~B_AreaStippleEnable;
-
- if (ctx->Fog.Enabled)
- gmesa->Begin |= B_FogEnable;
- else
- gmesa->Begin &= ~B_FogEnable;
-
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= GAMMA_RAST_ALPHA_BIT;
-
- if ( flags & DD_FLATSHADE )
- ind |= GAMMA_RAST_FLAT_BIT;
-
- gmesa->draw_line = gamma_line_tab[ind];
- gmesa->draw_tri = gamma_tri_tab[ind];
- gmesa->draw_quad = gamma_quad_tab[ind];
- gmesa->draw_point = gamma_point_tab[ind];
-
- /* Hook in fallbacks for specific primitives. CURRENTLY DISABLED
- */
- if (flags & LINE_FALLBACK)
- gmesa->draw_line = gamma_fallback_line;
-
- if (flags & TRI_FALLBACK) {
- gmesa->draw_tri = gamma_fallback_tri;
- gmesa->draw_quad = gamma_fallback_quad;
- }
-}
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- gmesa->draw_tri( gmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- gmesa->draw_quad( gmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- gmesa->draw_line( gmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- gmesa->draw_point( gmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define GAMMA_OFFSET_BIT 0x01
-#define GAMMA_TWOSIDE_BIT 0x02
-#define GAMMA_UNFILLED_BIT 0x04
-#define GAMMA_FALLBACK_BIT 0x08
-#define GAMMA_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[GAMMA_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & GAMMA_FALLBACK_BIT)
-#define DO_OFFSET 0 /* (IND & GAMMA_OFFSET_BIT) */
-#define DO_UNFILLED 0 /* (IND & GAMMA_UNFILLED_BIT) */
-#define DO_TWOSIDE (IND & GAMMA_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX gammaVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (gmesa->verts + (e<<gmesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) COPY_4V( v->ub4[4], c)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-
-#define LOCAL_VARS(n) \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- GLuint color[n]; \
- (void) color;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- B_PrimType_Points,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles
-};
-
-static void gammaResetLineStipple( GLcontext *ctx );
-static void gammaRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void gammaRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-#define RASTERIZE(x) if (gmesa->hw_primitive != hw_prim[x]) \
- gammaRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE gmesa->render_primitive
-#define TAG(x) x
-#define IND GAMMA_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_OFFSET_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_OFFSET_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-
-static void init_render_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (gammaVertex *)(gammaverts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- gmesa->draw_point( gmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- gmesa->draw_line( gmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- gmesa->draw_tri( gmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- gmesa->draw_quad( gmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) gammaRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- const GLuint shift = gmesa->vertex_stride_shift; \
- const char *gammaverts = (char *)gmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) stipple;
-#define RESET_STIPPLE if ( stipple ) gammaResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) gamma_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void gammaRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = gmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void gammaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _GAMMA_NEW_RENDERSTATE (_DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET)
-
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void gammaChooseRenderState(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= GAMMA_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= GAMMA_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= GAMMA_UNFILLED_BIT;
- }
-
- if (gmesa->RenderIndex != index) {
- gmesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (gmesa->RenderIndex == 0)
- tnl->Driver.Render.PrimTabVerts = gamma_render_tab_verts;
- else
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = gammaRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = gammaRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in gammarender.c.
- */
-
-static void gammaRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- if (gmesa->hw_primitive != hwprim)
- gmesa->hw_primitive = hwprim;
-}
-
-static void gammaRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gmesa->render_primitive = prim;
-}
-
-static void gammaRunPipeline( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- if ( gmesa->new_state )
- gammaDDUpdateHWState( ctx );
-
- if (gmesa->new_gl_state) {
- if (gmesa->new_gl_state & _NEW_TEXTURE)
- gammaUpdateTextureState( ctx );
-
- if (!gmesa->Fallback) {
- if (gmesa->new_gl_state & _GAMMA_NEW_VERTEX)
- gammaChooseVertexState( ctx );
-
- if (gmesa->new_gl_state & _GAMMA_NEW_RASTER_STATE)
- gammaChooseRasterState( ctx );
-
- if (gmesa->new_gl_state & _GAMMA_NEW_RENDERSTATE)
- gammaChooseRenderState( ctx );
- }
-
- gmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void gammaRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- gammaCheckTexSizes( ctx );
-}
-
-static void gammaRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void gammaResetLineStipple( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- /* Reset the hardware stipple counter.
- */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, UpdateLineStippleCounters, 0);
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void gammaFallback( gammaContextPtr gmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = gmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = gmesa->Fallback;
-
- if (mode) {
- gmesa->Fallback |= bit;
- if (oldfallback == 0) {
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- gmesa->RenderIndex = ~0;
- }
- }
- else {
- gmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = gammaRenderStart;
- tnl->Driver.Render.PrimitiveNotify = gammaRenderPrimitive;
- tnl->Driver.Render.Finish = gammaRenderFinish;
- tnl->Driver.Render.BuildVertices = gammaBuildVertices;
- tnl->Driver.Render.ResetLineStipple = gammaResetLineStipple;
- gmesa->new_gl_state |= (_GAMMA_NEW_RENDERSTATE|
- _GAMMA_NEW_RASTER_STATE|
- _GAMMA_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void gammaDDInitTriFuncs( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- gmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = gammaRunPipeline;
- tnl->Driver.Render.Start = gammaRenderStart;
- tnl->Driver.Render.Finish = gammaRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = gammaRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = gammaResetLineStipple;
- tnl->Driver.Render.BuildVertices = gammaBuildVertices;
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.h
deleted file mode 100644
index 02bec2869..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#ifndef _GAMMA_TRIS_H
-#define _GAMMA_TRIS_H
-
-extern void gammaDDTrifuncInit(void);
-extern void gammaDDChooseTriRenderState(GLcontext *);
-
-
-
-#endif /* !(_GAMMA_TRIS_H) */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tritmp.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_tritmp.h
deleted file mode 100644
index d0dbd1d6e..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tritmp.h
+++ /dev/null
@@ -1,495 +0,0 @@
-static void TAG(gamma_point)( gammaContextPtr gmesa,
- const gammaVertex *v0 )
-{
- CARD32 vColor;
- CARD32 vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Points;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_line)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1 )
-{
- CARD32 vColor;
- CARD32 vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Lines;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_triangle)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2 )
-{
- CARD32 vColor;
- CARD32 vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Triangles;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v2->v.u0);
- WRITEF(gmesa->buf, Ts2, v2->v.v0);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_quad)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2,
- const gammaVertex *v3 )
-{
- CARD32 vColor;
- CARD32 vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Quads;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v3->v.color.alpha << 24) |
- (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v2->v.u0);
- WRITEF(gmesa->buf, Ts2, v2->v.v0);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v3->v.color.alpha << 24) |
- (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v3->v.u0);
- WRITEF(gmesa->buf, Ts2, v3->v.v0);
- WRITEF(gmesa->buf, Vw, v3->v.w);
- WRITEF(gmesa->buf, Vz, v3->v.z);
- WRITEF(gmesa->buf, Vy, v3->v.y);
- WRITEF(gmesa->buf, Vx4, v3->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v3->v.w);
- WRITEF(gmesa->buf, Vz, v3->v.z);
- WRITEF(gmesa->buf, Vy, v3->v.y);
- WRITEF(gmesa->buf, Vx4, v3->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_init)(void)
-{
- gamma_point_tab[IND] = TAG(gamma_point);
- gamma_line_tab[IND] = TAG(gamma_line);
- gamma_tri_tab[IND] = TAG(gamma_triangle);
- gamma_quad_tab[IND] = TAG(gamma_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c
deleted file mode 100644
index 2e2f9ede4..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c,v 1.4 2003/03/26 20:43:48 tsi Exp $ */
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "gamma_context.h"
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-
-#define GAMMA_TEX0_BIT 0x1
-#define GAMMA_RGBA_BIT 0x2
-#define GAMMA_XYZW_BIT 0x4
-#define GAMMA_PTEX_BIT 0x8
-#define GAMMA_FOG_BIT 0x10
-#define GAMMA_SPEC_BIT 0x20
-#define GAMMA_MAX_SETUP 0x40
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[GAMMA_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 0
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & GAMMA_XYZW_BIT)
-#define DO_RGBA (IND & GAMMA_RGBA_BIT)
-#define DO_SPEC (IND & GAMMA_SPEC_BIT)
-#define DO_FOG (IND & GAMMA_FOG_BIT)
-#define DO_TEX0 (IND & GAMMA_TEX0_BIT)
-#define DO_TEX1 0
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & GAMMA_PTEX_BIT)
-
-#define VERTEX gammaVertex
-#define VERTEX_COLOR gamma_color_t
-#define GET_VIEWPORT_MAT() 0
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() GAMMA_CONTEXT(ctx)->vertex_format
-#define GET_VERTEX_STORE() GAMMA_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() GAMMA_CONTEXT(ctx)->vertex_stride_shift
-#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &GAMMA_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &GAMMA_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 1
-#define HAVE_HW_DIVIDE 1
-#define HAVE_RGBA_COLOR 0 /* we're BGRA */
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 0
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define PTEX_FALLBACK() /* never needed */
-
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS gamma_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS gamma_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) gamma_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_TEX0_BIT|GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT|\
- GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT|\
- GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|\
- GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|\
- GAMMA_TEX0_BIT|GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgpt0();
- init_wgst0();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgfpt0();
- init_wgfst0();
- init_wgfspt0();
- init_t0();
- init_f();
- init_ft0();
- init_g();
- init_gs();
- init_gt0();
- init_gst0();
- init_gf();
- init_gfs();
- init_gft0();
- init_gfst0();
-}
-
-void gammaCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
-
- if (!setup_tab[gmesa->SetupIndex].check_tex_sizes(ctx)) {
- /* Invalidate stored verts
- */
- gmesa->SetupNewInputs = ~0;
- gmesa->SetupIndex |= GAMMA_PTEX_BIT;
-
- if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[gmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[gmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void gammaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)gmesa->verts + (start<<gmesa->vertex_stride_shift));
- GLuint stride = 1<<gmesa->vertex_stride_shift;
-
- newinputs |= gmesa->SetupNewInputs;
- gmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= GAMMA_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= GAMMA_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= GAMMA_TEX0_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= GAMMA_FOG_BIT;
-
- if (gmesa->SetupIndex & GAMMA_PTEX_BIT)
- ind = ~0;
-
- ind &= gmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void gammaChooseVertexState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = GAMMA_XYZW_BIT|GAMMA_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= GAMMA_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= GAMMA_FOG_BIT;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- _tnl_need_projected_coords( ctx, GL_FALSE );
- ind |= GAMMA_TEX0_BIT;
- } else
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- gmesa->SetupIndex = ind;
-
- if (setup_tab[ind].vertex_format != gmesa->vertex_format) {
- gmesa->vertex_format = setup_tab[ind].vertex_format;
- gmesa->vertex_size = setup_tab[ind].vertex_size;
- gmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = gamma_interp_extras;
- tnl->Driver.Render.CopyPV = gamma_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-}
-
-
-void gammaInitVB( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- gmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- gmesa->vertex_stride_shift = 6; /* FIXME - only one vertex setup */
- }
- }
-}
-
-
-void gammaFreeVB( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- if (gmesa->verts) {
- ALIGN_FREE(gmesa->verts);
- gmesa->verts = 0;
- }
-
- if (gmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(gmesa->UbyteSecondaryColor.Ptr);
- gmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (gmesa->UbyteColor.Ptr) {
- ALIGN_FREE(gmesa->UbyteColor.Ptr);
- gmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.h
deleted file mode 100644
index feda25c4c..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#ifndef GAMMAVB_INC
-#define GAMMAVB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _GAMMA_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-
-extern void gammaChooseVertexState( GLcontext *ctx );
-extern void gammaCheckTexSizes( GLcontext *ctx );
-extern void gammaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void gamma_import_float_colors( GLcontext *ctx );
-extern void gamma_import_float_spec_colors( GLcontext *ctx );
-
-extern void gamma_translate_vertex( GLcontext *ctx,
- const gammaVertex *src,
- SWvertex *dst );
-
-extern void gammaInitVB( GLcontext *ctx );
-extern void gammaFreeVB( GLcontext *ctx );
-
-extern void gamma_print_vertex( GLcontext *ctx, const gammaVertex *v );
-extern void gammaPrintSetupFlags(char *msg, GLuint flags );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
deleted file mode 100644
index bab5ed431..000000000
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.14 2002/10/30 12:51:30 alanh Exp $ */
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver
- */
-
-#include "gamma_context.h"
-#include "gamma_vb.h"
-#include "context.h"
-#include "matrix.h"
-#include "glint_dri.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-static GLboolean
-gammaInitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = (void *) gammaCreateScreen( sPriv );
-
- if (!sPriv->private) {
- gammaDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void
-gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- gammaContextPtr gmesa = (gammaContextPtr)driContextPriv->driverPrivate;
-
- if (gmesa) {
- _swsetup_DestroyContext( gmesa->glCtx );
- _tnl_DestroyContext( gmesa->glCtx );
- _ac_DestroyContext( gmesa->glCtx );
- _swrast_DestroyContext( gmesa->glCtx );
-
- gammaFreeVB( gmesa->glCtx );
-
- /* free the Mesa context */
- gmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(gmesa->glCtx);
-
- Xfree(gmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0
- );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- gammaContextPtr gmesa;
- __DRIscreenPrivate *driScrnPriv;
- GLcontext *ctx;
-
- gmesa = (gammaContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = gmesa->glCtx;
- driScrnPriv = gmesa->driScreen;
-
- _mesa_notifySwapBuffers(ctx);
-
- VALIDATE_DRAWABLE_INFO(gmesa);
-
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&driScrnPriv->pSAREA->drawable_lock,
- driScrnPriv->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER) {
- int src, dst, x0, y0, x1, h;
- int i;
- int nRect = dPriv->numClipRects;
- XF86DRIClipRectPtr pRect = dPriv->pClipRects;
- __DRIscreenPrivate *driScrnPriv = gmesa->driScreen;
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)driScrnPriv->pDevPriv;
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode |
- FBReadSrcEnable));
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeDisable);
-
- for (i = 0; i < nRect; i++, pRect++) {
- x0 = pRect->x1;
- x1 = pRect->x2;
- h = pRect->y2 - pRect->y1;
-
- y0 = driScrnPriv->fbHeight - (pRect->y1+h);
- if (gDRIPriv->numMultiDevices == 2)
- src = (y0/2)*driScrnPriv->fbWidth+x0;
- else
- src = y0*driScrnPriv->fbWidth+x0;
-
- y0 += driScrnPriv->fbHeight;
- if (gDRIPriv->numMultiDevices == 2)
- dst = (y0/2)*driScrnPriv->fbWidth+x0;
- else
- dst = y0*driScrnPriv->fbWidth+x0;
-
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITE(gmesa->buf, StartXDom, x0<<16); /* X0dest */
- WRITE(gmesa->buf, StartY, y0<<16); /* Y0dest */
- WRITE(gmesa->buf, StartXSub, x1<<16); /* X1dest */
- WRITE(gmesa->buf, GLINTCount, h); /* H */
- WRITE(gmesa->buf, dY, 1<<16); /* ydir */
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, FBSourceOffset, (dst-src));
- WRITE(gmesa->buf, Render, 0x00040048); /* NOT_DONE */
- }
-
- /*
- ** NOTE: FBSourceOffset (above) is backwards from what is
- ** described in the manual (i.e., dst-src instead of src-dst)
- ** due to our using the bottom-left window origin instead of the
- ** top-left window origin.
- */
-
- /* Restore FBReadMode */
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode |
- gmesa->AB_FBReadMode));
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- }
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER)
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&driScrnPriv->pSAREA->drawable_lock,
- driScrnPriv->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER)
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
- } else {
- _mesa_problem(NULL, "gammaSwapBuffers: drawable has no context!\n");
- }
-}
-
-static GLboolean
-gammaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- gammaContextPtr oldGammaCtx = ctx ? GAMMA_CONTEXT(ctx) : NULL;
- gammaContextPtr newGammaCtx = (gammaContextPtr) driContextPriv->driverPrivate;
-
- if ( newGammaCtx != oldGammaCtx ) {
- newGammaCtx->dirty = ~0;
- }
-
- if (newGammaCtx->driDrawable != driDrawPriv) {
- newGammaCtx->driDrawable = driDrawPriv;
- gammaUpdateWindow ( newGammaCtx->glCtx );
- gammaUpdateViewportOffset( newGammaCtx->glCtx );
- }
-
-#if 0
- newGammaCtx->Window &= ~W_GIDMask;
- newGammaCtx->Window |= (driDrawPriv->index << 5);
- CHECK_DMA_BUFFER(newGammaCtx,1);
- WRITE(newGammaCtx->buf, GLINTWindow, newGammaCtx->Window);
-#endif
-
-newGammaCtx->new_state |= GAMMA_NEW_WINDOW; /* FIXME */
-
- _mesa_make_current2( newGammaCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (!newGammaCtx->glCtx->Viewport.Width) {
- _mesa_set_viewport(newGammaCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- } else {
- _mesa_make_current( 0, 0 );
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-gammaUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static GLboolean
-gammaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static GLboolean
-gammaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-
-static struct __DriverAPIRec gammaAPI = {
- gammaInitDriver,
- gammaDestroyScreen,
- gammaCreateContext,
- gammaDestroyContext,
- gammaCreateBuffer,
- gammaDestroyBuffer,
- gammaSwapBuffers,
- gammaMakeCurrent,
- gammaUnbindContext,
- gammaOpenFullScreen,
- gammaCloseFullScreen
-};
-
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &gammaAPI);
- return (void *) psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h b/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h
deleted file mode 100644
index dade1a826..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h
+++ /dev/null
@@ -1,636 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h,v 1.7 2002/02/22 21:33:03 dawes Exp $ */
-
-#ifndef I810_3D_REG_H
-#define I810_3D_REG_H
-
-#include "i810_reg.h"
-
-/* Registers not used in the X server
- */
-
-#define I810_NOP_ID 0x2094
-#define I810_NOP_ID_MASK ((1<<22)-1)
-
-
-/* 3D instructions
- */
-
-
-/* GFXRENDERSTATE_PV_PIXELIZATION_RULE, p149
- *
- * Format:
- * 0: GFX_OP_PV_RULE | PV_*
- *
- */
-#define GFX_OP_PV_RULE ((0x3<<29)|(0x7<<24))
-#define PV_SMALL_TRI_FILTER_ENABLE (0x1<<11)
-#define PV_UPDATE_PIXRULE (0x1<<10)
-#define PV_PIXRULE_ENABLE (0x1<<9)
-#define PV_UPDATE_LINELIST (0x1<<8)
-#define PV_LINELIST_MASK (0x3<<6)
-#define PV_LINELIST_PV0 (0x0<<6)
-#define PV_LINELIST_PV1 (0x1<<6)
-#define PV_UPDATE_TRIFAN (0x1<<5)
-#define PV_TRIFAN_MASK (0x3<<3)
-#define PV_TRIFAN_PV0 (0x0<<3)
-#define PV_TRIFAN_PV1 (0x1<<3)
-#define PV_TRIFAN_PV2 (0x2<<3)
-#define PV_UPDATE_TRISTRIP (0x1<<2)
-#define PV_TRISTRIP_MASK (0x3<<0)
-#define PV_TRISTRIP_PV0 (0x0<<0)
-#define PV_TRISTRIP_PV1 (0x1<<0)
-#define PV_TRISTRIP_PV2 (0x2<<0)
-
-
-/* GFXRENDERSTATE_SCISSOR_ENABLE, p146
- *
- * Format:
- * 0: GFX_OP_SCISSOR | SC_*
- */
-#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
-#define SC_UPDATE_SCISSOR (0x1<<1)
-#define SC_ENABLE_MASK (0x1<<0)
-#define SC_ENABLE (0x1<<0)
-
-/* GFXRENDERSTATE_SCISSOR_INFO, p147
- *
- * Format:
- * 0: GFX_OP_SCISSOR_INFO
- * 1: SCI_MIN_*
- * 2: SCI_MAX_*
- */
-#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
-#define SCI_YMIN_MASK (0xffff<<16)
-#define SCI_XMIN_MASK (0xffff<<0)
-#define SCI_YMAX_MASK (0xffff<<16)
-#define SCI_XMAX_MASK (0xffff<<0)
-
-/* GFXRENDERSTATE_DRAWING_RECT_INFO, p144
- *
- * Format:
- * 0: GFX_OP_DRAWRECT_INFO
- * 1: DR1_*
- * 2: DR2_*
- * 3: DR3_*
- * 4: DR4_*
- */
-#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
-#define DR1_RECT_CLIP_ENABLE (0x0<<31)
-#define DR1_RECT_CLIP_DISABLE (0x1<<31)
-#define DR1_X_DITHER_BIAS_MASK (0x3<<26)
-#define DR1_X_DITHER_BIAS_SHIFT 26
-#define DR1_Y_DITHER_BIAS_MASK (0x3<<24)
-#define DR1_Y_DITHER_BIAS_SHIFT 24
-#define DR2_YMIN_MASK (0xffff<<16)
-#define DR2_XMIN_MASK (0xffff<<0)
-#define DR3_YMAX_MASK (0xffff<<16)
-#define DR3_XMAX_MASK (0xffff<<0)
-#define DR4_YORG_MASK (0x3ff<<16)
-#define DR4_XORG_MASK (0x7ff<<0)
-
-
-/* GFXRENDERSTATE_LINEWIDTH_CULL_SHADE_MODE, p140
- *
- * Format:
- * 0: GFX_OP_LINEWIDTH_CULL_SHADE_MODE | LCS_*
- */
-#define GFX_OP_LINEWIDTH_CULL_SHADE_MODE ((0x3<<29)|(0x2<<24))
-#define LCS_UPDATE_ZMODE (0x1<<20)
-#define LCS_Z_MASK (0xf<<16)
-#define LCS_Z_NEVER (0x1<<16)
-#define LCS_Z_LESS (0x2<<16)
-#define LCS_Z_EQUAL (0x3<<16)
-#define LCS_Z_LEQUAL (0x4<<16)
-#define LCS_Z_GREATER (0x5<<16)
-#define LCS_Z_NOTEQUAL (0x6<<16)
-#define LCS_Z_GEQUAL (0x7<<16)
-#define LCS_Z_ALWAYS (0x8<<16)
-#define LCS_UPDATE_LINEWIDTH (0x1<<15)
-#define LCS_LINEWIDTH_MASK (0x7<<12)
-#define LCS_LINEWIDTH_SHIFT 12
-#define LCS_LINEWIDTH_0_5 (0x1<<12)
-#define LCS_LINEWIDTH_1_0 (0x2<<12)
-#define LCS_LINEWIDTH_2_0 (0x4<<12)
-#define LCS_LINEWIDTH_3_0 (0x6<<12)
-#define LCS_UPDATE_ALPHA_INTERP (0x1<<11)
-#define LCS_ALPHA_FLAT (0x1<<10)
-#define LCS_ALPHA_INTERP (0x0<<10)
-#define LCS_UPDATE_FOG_INTERP (0x1<<9)
-#define LCS_FOG_INTERP (0x0<<8)
-#define LCS_FOG_FLAT (0x1<<8)
-#define LCS_UPDATE_SPEC_INTERP (0x1<<7)
-#define LCS_SPEC_INTERP (0x0<<6)
-#define LCS_SPEC_FLAT (0x1<<6)
-#define LCS_UPDATE_RGB_INTERP (0x1<<5)
-#define LCS_RGB_INTERP (0x0<<4)
-#define LCS_RGB_FLAT (0x1<<4)
-#define LCS_UPDATE_CULL_MODE (0x1<<3)
-#define LCS_CULL_MASK (0x7<<0)
-#define LCS_CULL_DISABLE (0x1<<0)
-#define LCS_CULL_CW (0x2<<0)
-#define LCS_CULL_CCW (0x3<<0)
-#define LCS_CULL_BOTH (0x4<<0)
-
-#define LCS_INTERP_FLAT (LCS_ALPHA_FLAT|LCS_RGB_FLAT|LCS_SPEC_FLAT)
-#define LCS_UPDATE_INTERP (LCS_UPDATE_ALPHA_INTERP| \
- LCS_UPDATE_RGB_INTERP| \
- LCS_UPDATE_SPEC_INTERP)
-
-
-/* GFXRENDERSTATE_BOOLEAN_ENA_1, p142
- *
- */
-#define GFX_OP_BOOL_1 ((0x3<<29)|(0x3<<24))
-#define B1_UPDATE_SPEC_SETUP_ENABLE (1<<19)
-#define B1_SPEC_SETUP_ENABLE (1<<18)
-#define B1_UPDATE_ALPHA_SETUP_ENABLE (1<<17)
-#define B1_ALPHA_SETUP_ENABLE (1<<16)
-#define B1_UPDATE_CI_KEY_ENABLE (1<<15)
-#define B1_CI_KEY_ENABLE (1<<14)
-#define B1_UPDATE_CHROMAKEY_ENABLE (1<<13)
-#define B1_CHROMAKEY_ENABLE (1<<12)
-#define B1_UPDATE_Z_BIAS_ENABLE (1<<11)
-#define B1_Z_BIAS_ENABLE (1<<10)
-#define B1_UPDATE_SPEC_ENABLE (1<<9)
-#define B1_SPEC_ENABLE (1<<8)
-#define B1_UPDATE_FOG_ENABLE (1<<7)
-#define B1_FOG_ENABLE (1<<6)
-#define B1_UPDATE_ALPHA_TEST_ENABLE (1<<5)
-#define B1_ALPHA_TEST_ENABLE (1<<4)
-#define B1_UPDATE_BLEND_ENABLE (1<<3)
-#define B1_BLEND_ENABLE (1<<2)
-#define B1_UPDATE_Z_TEST_ENABLE (1<<1)
-#define B1_Z_TEST_ENABLE (1<<0)
-
-/* GFXRENDERSTATE_BOOLEAN_ENA_2, p143
- *
- */
-#define GFX_OP_BOOL_2 ((0x3<<29)|(0x4<<24))
-#define B2_UPDATE_MAP_CACHE_ENABLE (1<<17)
-#define B2_MAP_CACHE_ENABLE (1<<16)
-#define B2_UPDATE_ALPHA_DITHER_ENABLE (1<<15)
-#define B2_ALPHA_DITHER_ENABLE (1<<14)
-#define B2_UPDATE_FOG_DITHER_ENABLE (1<<13)
-#define B2_FOG_DITHER_ENABLE (1<<12)
-#define B2_UPDATE_SPEC_DITHER_ENABLE (1<<11)
-#define B2_SPEC_DITHER_ENABLE (1<<10)
-#define B2_UPDATE_RGB_DITHER_ENABLE (1<<9)
-#define B2_RGB_DITHER_ENABLE (1<<8)
-#define B2_UPDATE_FB_WRITE_ENABLE (1<<3)
-#define B2_FB_WRITE_ENABLE (1<<2)
-#define B2_UPDATE_ZB_WRITE_ENABLE (1<<1)
-#define B2_ZB_WRITE_ENABLE (1<<0)
-
-
-/* GFXRENDERSTATE_FOG_COLOR, p144
- */
-#define GFX_OP_FOG_COLOR ((0x3<<29)|(0x15<<24))
-#define FOG_RED_SHIFT 16
-#define FOG_GREEN_SHIFT 8
-#define FOG_BLUE_SHIFT 0
-#define FOG_RESERVED_MASK ((0x7<<16)|(0x3<<8)|(0x3))
-
-
-/* GFXRENDERSTATE_Z_BIAS_ALPHA_FUNC_REF, p139
- */
-#define GFX_OP_ZBIAS_ALPHAFUNC ((0x3<<29)|(0x14<<24))
-#define ZA_UPDATE_ZBIAS (1<<22)
-#define ZA_ZBIAS_SHIFT 14
-#define ZA_ZBIAS_MASK (0xff<<14)
-#define ZA_UPDATE_ALPHAFUNC (1<<13)
-#define ZA_ALPHA_MASK (0xf<<9)
-#define ZA_ALPHA_NEVER (1<<9)
-#define ZA_ALPHA_LESS (2<<9)
-#define ZA_ALPHA_EQUAL (3<<9)
-#define ZA_ALPHA_LEQUAL (4<<9)
-#define ZA_ALPHA_GREATER (5<<9)
-#define ZA_ALPHA_NOTEQUAL (6<<9)
-#define ZA_ALPHA_GEQUAL (7<<9)
-#define ZA_ALPHA_ALWAYS (8<<9)
-#define ZA_UPDATE_ALPHAREF (1<<8)
-#define ZA_ALPHAREF_MASK (0xff<<0)
-#define ZA_ALPHAREF_SHIFT 0
-#define ZA_ALPHAREF_RESERVED (0x7<<0)
-
-
-/* GFXRENDERSTATE_SRC_DST_BLEND_MONO, p136
- */
-#define GFX_OP_SRC_DEST_MONO ((0x3<<29)|(0x8<<24))
-#define SDM_UPDATE_MONO_ENABLE (1<<13)
-#define SDM_MONO_ENABLE (1<<12)
-#define SDM_UPDATE_SRC_BLEND (1<<11)
-#define SDM_SRC_MASK (0xf<<6)
-#define SDM_SRC_ZERO (0x1<<6)
-#define SDM_SRC_ONE (0x2<<6)
-#define SDM_SRC_SRC_COLOR (0x3<<6)
-#define SDM_SRC_INV_SRC_COLOR (0x4<<6)
-#define SDM_SRC_SRC_ALPHA (0x5<<6)
-#define SDM_SRC_INV_SRC_ALPHA (0x6<<6)
-#define SDM_SRC_DST_COLOR (0x9<<6)
-#define SDM_SRC_INV_DST_COLOR (0xa<<6)
-#define SDM_SRC_BOTH_SRC_ALPHA (0xc<<6)
-#define SDM_SRC_BOTH_INV_SRC_ALPHA (0xd<<6)
-#define SDM_UPDATE_DST_BLEND (1<<5)
-#define SDM_DST_MASK (0xf<<0)
-#define SDM_DST_ZERO (0x1<<0)
-#define SDM_DST_ONE (0x2<<0)
-#define SDM_DST_SRC_COLOR (0x3<<0)
-#define SDM_DST_INV_SRC_COLOR (0x4<<0)
-#define SDM_DST_SRC_ALPHA (0x5<<0)
-#define SDM_DST_INV_SRC_ALPHA (0x6<<0)
-#define SDM_DST_DST_COLOR (0x9<<0)
-#define SDM_DST_INV_DST_COLOR (0xa<<0)
-#define SDM_DST_BOTH_SRC_ALPHA (0xc<<0)
-#define SDM_DST_BOTH_INV_SRC_ALPHA (0xd<<0)
-
-
-/* GFXRENDERSTATE_COLOR_FACTOR, p134
- *
- * Format:
- * 0: GFX_OP_COLOR_FACTOR
- * 1: ARGB8888 color factor
- */
-#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
-
-/* GFXRENDERSTATE_MAP_ALPHA_BLEND_STAGES, p132
- */
-#define GFX_OP_MAP_ALPHA_STAGES ((0x3<<29)|(0x1<<24))
-#define MA_STAGE_SHIFT 20
-#define MA_STAGE_0 (0<<20)
-#define MA_STAGE_1 (1<<20)
-#define MA_STAGE_2 (2<<20)
-#define MA_UPDATE_ARG1 (1<<18)
-#define MA_ARG1_MASK ((0x7<<15)|(0x1<<13))
-#define MA_ARG1_ALPHA_FACTOR (0x1<<15)
-#define MA_ARG1_ITERATED_ALPHA (0x3<<15)
-#define MA_ARG1_CURRENT_ALPHA (0x5<<15)
-#define MA_ARG1_TEX0_ALPHA (0x6<<15)
-#define MA_ARG1_TEX1_ALPHA (0x7<<15)
-#define MA_ARG1_INVERT (0x1<<13)
-#define MA_ARG1_DONT_INVERT (0x0<<13)
-#define MA_UPDATE_ARG2 (1<<12)
-#define MA_ARG2_MASK ((0x7<<8)|(0x1<<6))
-#define MA_ARG2_ALPHA_FACTOR (0x1<<8)
-#define MA_ARG2_ITERATED_ALPHA (0x3<<8)
-#define MA_ARG2_CURRENT_ALPHA (0x5<<8)
-#define MA_ARG2_TEX0_ALPHA (0x6<<8)
-#define MA_ARG2_TEX1_ALPHA (0x7<<8)
-#define MA_ARG2_INVERT (0x1<<6)
-#define MA_ARG2_DONT_INVERT (0x0<<6)
-#define MA_UPDATE_OP (1<<5)
-#define MA_OP_MASK (0xf)
-#define MA_OP_ARG1 (0x1)
-#define MA_OP_ARG2 (0x2)
-#define MA_OP_MODULATE (0x3)
-#define MA_OP_MODULATE_X2 (0x4)
-#define MA_OP_MODULATE_X4 (0x5)
-#define MA_OP_ADD (0x6)
-#define MA_OP_ADD_SIGNED (0x7)
-#define MA_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MA_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MA_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MA_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-
-
-/* GFXRENDERSTATE_MAP_COLOR_BLEND_STAGES, p129
- */
-#define GFX_OP_MAP_COLOR_STAGES ((0x3<<29)|(0x0<<24))
-#define MC_STAGE_SHIFT 20
-#define MC_STAGE_0 (0<<20)
-#define MC_STAGE_1 (1<<20)
-#define MC_STAGE_2 (2<<20)
-#define MC_UPDATE_DEST (1<<19)
-#define MC_DEST_MASK (1<<18)
-#define MC_DEST_CURRENT (0<<18)
-#define MC_DEST_ACCUMULATOR (1<<18)
-#define MC_UPDATE_ARG1 (1<<17)
-#define MC_ARG1_MASK ((0x7<<14)|(0x1<<13)|(0x1<<12))
-#define MC_ARG1_ONE (0x0<<14)
-#define MC_ARG1_COLOR_FACTOR (0x1<<14)
-#define MC_ARG1_ACCUMULATOR (0x2<<14)
-#define MC_ARG1_ITERATED_COLOR (0x3<<14)
-#define MC_ARG1_SPECULAR_COLOR (0x4<<14)
-#define MC_ARG1_CURRENT_COLOR (0x5<<14)
-#define MC_ARG1_TEX0_COLOR (0x6<<14)
-#define MC_ARG1_TEX1_COLOR (0x7<<14)
-#define MC_ARG1_DONT_REPLICATE_ALPHA (0x0<<13)
-#define MC_ARG1_REPLICATE_ALPHA (0x1<<13)
-#define MC_ARG1_DONT_INVERT (0x0<<12)
-#define MC_ARG1_INVERT (0x1<<12)
-#define MC_UPDATE_ARG2 (1<<11)
-#define MC_ARG2_MASK ((0x7<<8)|(0x1<<7)|(0x1<<6))
-#define MC_ARG2_ONE (0x0<<8)
-#define MC_ARG2_COLOR_FACTOR (0x1<<8)
-#define MC_ARG2_ACCUMULATOR (0x2<<8)
-#define MC_ARG2_ITERATED_COLOR (0x3<<8)
-#define MC_ARG2_SPECULAR_COLOR (0x4<<8)
-#define MC_ARG2_CURRENT_COLOR (0x5<<8)
-#define MC_ARG2_TEX0_COLOR (0x6<<8)
-#define MC_ARG2_TEX1_COLOR (0x7<<8)
-#define MC_ARG2_DONT_REPLICATE_ALPHA (0x0<<7)
-#define MC_ARG2_REPLICATE_ALPHA (0x1<<7)
-#define MC_ARG2_DONT_INVERT (0x0<<6)
-#define MC_ARG2_INVERT (0x1<<6)
-#define MC_UPDATE_OP (1<<5)
-#define MC_OP_MASK (0xf)
-#define MC_OP_DISABLE (0x0)
-#define MC_OP_ARG1 (0x1)
-#define MC_OP_ARG2 (0x2)
-#define MC_OP_MODULATE (0x3)
-#define MC_OP_MODULATE_X2 (0x4)
-#define MC_OP_MODULATE_X4 (0x5)
-#define MC_OP_ADD (0x6)
-#define MC_OP_ADD_SIGNED (0x7)
-#define MC_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MC_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MC_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MC_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-#define MC_OP_LIN_BLEND_TEX0_COLOR (0x12)
-#define MC_OP_LIN_BLEND_TEX1_COLOR (0x13)
-#define MC_OP_SUBTRACT (0x14)
-
-/* GFXRENDERSTATE_MAP_PALETTE_LOAD, p128
- *
- * Format:
- * 0: GFX_OP_MAP_PALETTE_LOAD
- * 1: 16bpp color[0]
- * ...
- * 256: 16bpp color[255]
- */
-#define GFX_OP_MAP_PALETTE_LOAD ((0x3<<29)|(0x1d<<24)|(0x82<<16)|0xff)
-
-/* GFXRENDERSTATE_MAP_LOD_CONTROL, p127
- */
-#define GFX_OP_MAP_LOD_CTL ((0x3<<29)|(0x1c<<24)|(0x4<<19))
-#define MLC_MAP_ID_SHIFT 16
-#define MLC_MAP_0 (0<<16)
-#define MLC_MAP_1 (1<<16)
-#define MLC_UPDATE_DITHER_WEIGHT (1<<10)
-#define MLC_DITHER_WEIGHT_MASK (0x3<<8)
-#define MLC_DITHER_WEIGHT_FULL (0x0<<8)
-#define MLC_DITHER_WEIGHT_50 (0x1<<8)
-#define MLC_DITHER_WEIGHT_25 (0x2<<8)
-#define MLC_DITHER_WEIGHT_12 (0x3<<8)
-#define MLC_UPDATE_LOD_BIAS (1<<7)
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-/* GFXRENDERSTATE_MAP_LOD_LIMITS, p126
- */
-#define GFX_OP_MAP_LOD_LIMITS ((0x3<<29)|(0x1c<<24)|(0x3<<19))
-#define MLL_MAP_ID_SHIFT 16
-#define MLL_MAP_0 (0<<16)
-#define MLL_MAP_1 (1<<16)
-#define MLL_UPDATE_MAX_MIP (1<<13)
-#define MLL_MAX_MIP_SHIFT 5
-#define MLL_MAX_MIP_MASK (0xff<<5)
-#define MLL_MAX_MIP_ONE (0x10<<5)
-#define MLL_UPDATE_MIN_MIP (1<<4)
-#define MLL_MIN_MIP_SHIFT 0
-#define MLL_MIN_MIP_MASK (0xf<<0)
-
-/* GFXRENDERSTATE_MAP_FILTER, p124
- */
-#define GFX_OP_MAP_FILTER ((0x3<<29)|(0x1c<<24)|(0x2<<19))
-#define MF_MAP_ID_SHIFT 16
-#define MF_MAP_0 (0<<16)
-#define MF_MAP_1 (1<<16)
-#define MF_UPDATE_ANISOTROPIC (1<<12)
-#define MF_ANISOTROPIC_MASK (1<<10)
-#define MF_ANISOTROPIC_ENABLE (1<<10)
-#define MF_UPDATE_MIP_FILTER (1<<9)
-#define MF_MIP_MASK (0x3<<6)
-#define MF_MIP_NONE (0x0<<6)
-#define MF_MIP_NEAREST (0x1<<6)
-#define MF_MIP_DITHER (0x2<<6)
-#define MF_MIP_LINEAR (0x3<<6)
-#define MF_UPDATE_MAG_FILTER (1<<5)
-#define MF_MAG_MASK (1<<3)
-#define MF_MAG_LINEAR (1<<3)
-#define MF_MAG_NEAREST (0<<3)
-#define MF_UPDATE_MIN_FILTER (1<<2)
-#define MF_MIN_MASK (1<<0)
-#define MF_MIN_LINEAR (1<<0)
-#define MF_MIN_NEAREST (0<<0)
-
-/* GFXRENDERSTATE_MAP_INFO, p118
- */
-#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2)
-#define MI1_MAP_ID_SHIFT 28
-#define MI1_MAP_0 (0<<28)
-#define MI1_MAP_1 (1<<28)
-#define MI1_FMT_MASK (0x7<<24)
-#define MI1_FMT_8CI (0x0<<24)
-#define MI1_FMT_8BPP (0x1<<24)
-#define MI1_FMT_16BPP (0x2<<24)
-#define MI1_FMT_422 (0x5<<24)
-#define MI1_PF_MASK (0x3<<21)
-#define MI1_PF_8CI_RGB565 (0x0<<21)
-#define MI1_PF_8CI_ARGB1555 (0x1<<21)
-#define MI1_PF_8CI_ARGB4444 (0x2<<21)
-#define MI1_PF_8CI_AY88 (0x3<<21)
-#define MI1_PF_16BPP_RGB565 (0x0<<21)
-#define MI1_PF_16BPP_ARGB1555 (0x1<<21)
-#define MI1_PF_16BPP_ARGB4444 (0x2<<21)
-#define MI1_PF_16BPP_AY88 (0x3<<21)
-#define MI1_PF_422_YCRCB_SWAP_Y (0x0<<21)
-#define MI1_PF_422_YCRCB (0x1<<21)
-#define MI1_PF_422_YCRCB_SWAP_UV (0x2<<21)
-#define MI1_PF_422_YCRCB_SWAP_YUV (0x3<<21)
-#define MI1_OUTPUT_CHANNEL_MASK (0x3<<19)
-#define MI1_COLOR_CONV_ENABLE (1<<18)
-#define MI1_VERT_STRIDE_MASK (1<<17)
-#define MI1_VERT_STRIDE_1 (1<<17)
-#define MI1_VERT_OFFSET_MASK (1<<16)
-#define MI1_VERT_OFFSET_1 (1<<16)
-#define MI1_ENABLE_FENCE_REGS (1<<10)
-#define MI1_TILED_SURFACE (1<<9)
-#define MI1_TILE_WALK_X (0<<8)
-#define MI1_TILE_WALK_Y (1<<8)
-#define MI1_PITCH_MASK (0xf<<0)
-#define MI2_DIMENSIONS_ARE_LOG2 (1<<31)
-#define MI2_DIMENSIONS_ARE_EXACT (0<<31)
-#define MI2_HEIGHT_SHIFT 16
-#define MI2_HEIGHT_MASK (0x1ff<<16)
-#define MI2_WIDTH_SHIFT 0
-#define MI2_WIDTH_MASK (0x1ff<<0)
-#define MI3_BASE_ADDR_MASK (~0xf)
-
-/* GFXRENDERSTATE_MAP_COORD_SETS, p116
- */
-#define GFX_OP_MAP_COORD_SETS ((0x3<<29)|(0x1c<<24)|(0x1<<19))
-#define MCS_COORD_ID_SHIFT 16
-#define MCS_COORD_0 (0<<16)
-#define MCS_COORD_1 (1<<16)
-#define MCS_UPDATE_NORMALIZED (1<<15)
-#define MCS_NORMALIZED_COORDS_MASK (1<<14)
-#define MCS_NORMALIZED_COORDS (1<<14)
-#define MCS_UPDATE_V_STATE (1<<7)
-#define MCS_V_STATE_MASK (0x3<<4)
-#define MCS_V_WRAP (0x0<<4)
-#define MCS_V_MIRROR (0x1<<4)
-#define MCS_V_CLAMP (0x2<<4)
-#define MCS_V_WRAP_SHORTEST (0x3<<4)
-#define MCS_UPDATE_U_STATE (1<<3)
-#define MCS_U_STATE_MASK (0x3<<0)
-#define MCS_U_WRAP (0x0<<0)
-#define MCS_U_MIRROR (0x1<<0)
-#define MCS_U_CLAMP (0x2<<0)
-#define MCS_U_WRAP_SHORTEST (0x3<<0)
-
-/* GFXRENDERSTATE_MAP_TEXELS, p115
- */
-#define GFX_OP_MAP_TEXELS ((0x3<<29)|(0x1c<<24)|(0x0<<19))
-#define MT_UPDATE_TEXEL1_STATE (1<<15)
-#define MT_TEXEL1_DISABLE (0<<14)
-#define MT_TEXEL1_ENABLE (1<<14)
-#define MT_TEXEL1_COORD0 (0<<11)
-#define MT_TEXEL1_COORD1 (1<<11)
-#define MT_TEXEL1_MAP0 (0<<8)
-#define MT_TEXEL1_MAP1 (1<<8)
-#define MT_UPDATE_TEXEL0_STATE (1<<7)
-#define MT_TEXEL0_DISABLE (0<<6)
-#define MT_TEXEL0_ENABLE (1<<6)
-#define MT_TEXEL0_COORD0 (0<<3)
-#define MT_TEXEL0_COORD1 (1<<3)
-#define MT_TEXEL0_MAP0 (0<<0)
-#define MT_TEXEL0_MAP1 (1<<0)
-
-/* GFXRENDERSTATE_VERTEX_FORMAT, p110
- */
-#define GFX_OP_VERTEX_FMT ((0x3<<29)|(0x5<<24))
-#define VF_TEXCOORD_COUNT_SHIFT 8
-#define VF_TEXCOORD_COUNT_0 (0<<8)
-#define VF_TEXCOORD_COUNT_1 (1<<8)
-#define VF_TEXCOORD_COUNT_2 (2<<8)
-#define VF_SPEC_FOG_ENABLE (1<<7)
-#define VF_RGBA_ENABLE (1<<6)
-#define VF_Z_OFFSET_ENABLE (1<<5)
-#define VF_XYZ (0x1<<1)
-#define VF_XYZW (0x2<<1)
-#define VF_XY (0x3<<1)
-#define VF_XYW (0x4<<1)
-
-
-#define VERT_X_MASK (~0xf)
-#define VERT_X_EDGE_V2V0 (1<<2)
-#define VERT_X_EDGE_V1V2 (1<<1)
-#define VERT_X_EDGE_V0V1 (1<<0)
-
-/* Not enabled fields should not be sent to hardware:
- */
-typedef struct {
- union {
- float x;
- unsigned int edge_flags;
- } x;
- float y;
- float z;
- float z_bias;
- float oow;
- unsigned int argb;
- unsigned int fog_spec_rgb; /* spec g and r ignored. */
- float tu0;
- float tv0;
- float tu1;
- float tv1;
-} i810_full_vertex;
-
-
-
-/* GFXCMDPARSER_BATCH_BUFFER, p105
- *
- * Not clear whether start address must be shifted or not. Not clear
- * whether address is physical system memory, or subject to GTT
- * translation. Because the address appears to be 32 bits long,
- * perhaps it refers to physical system memory...
- */
-#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1)
-#define BB1_START_ADDR_MASK (~0x7)
-#define BB1_PROTECTED (1<<0)
-#define BB1_UNPROTECTED (0<<0)
-#define BB2_END_ADDR_MASK (~0x7)
-
-/* Hardware seems to barf on buffers larger than this (in strange ways)...
- */
-#define MAX_BATCH (512*1024)
-
-
-/* GFXCMDPARSER_Z_BUFFER_INFO, p98
- *
- * Base address is in GTT space, and must be 4K aligned
- */
-#define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23))
-#define ZB_BASE_ADDR_SHIFT 0
-#define ZB_BASE_ADDR_MASK (~((1<<12)-1))
-#define ZB_PITCH_512B (0x0<<0)
-#define ZB_PITCH_1K (0x1<<0)
-#define ZB_PITCH_2K (0x2<<0)
-#define ZB_PITCH_4K (0x3<<0)
-
-/* GFXCMDPARSER_FRONT_BUFFER_INFO, p97
- *
- * Format:
- * 0: CMD_OP_FRONT_BUFFER_INFO | (pitch<<FB0_PITCH_SHIFT) | FB0_*
- * 1: FB1_*
- */
-#define CMD_OP_FRONT_BUFFER_INFO ((0x0<<29)|(0x14<<23))
-#define FB0_PITCH_SHIFT 8
-#define FB0_FLIP_SYNC (0<<6)
-#define FB0_FLIP_ASYNC (1<<6)
-#define FB0_BASE_ADDR_SHIFT 0
-#define FB0_BASE_ADDR_MASK 0x03FFFFF8
-
-/* GFXCMDPARSER_DEST_BUFFER_INFO, p96
- *
- * Format:
- */
-#define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23))
-#define DB1_BASE_ADDR_SHIFT 0
-#define DB1_BASE_ADDR_MASK 0x03FFF000
-#define DB1_PITCH_512B (0x0<<0)
-#define DB1_PITCH_1K (0x1<<0)
-#define DB1_PITCH_2K (0x2<<0)
-#define DB1_PITCH_4K (0x4<<0)
-
-
-/* GFXRENDERSTATE_DEST_BUFFER_VARIABLES, p152
- *
- * Format:
- * 0: GFX_OP_DESTBUFFER_VARS
- * 1: DEST_*
- */
-#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
-#define DV_HORG_BIAS_MASK (0xf<<20)
-#define DV_HORG_BIAS_OGL (0x0<<20)
-#define DV_VORG_BIAS_MASK (0xf<<16)
-#define DV_VORG_BIAS_OGL (0x0<<16)
-#define DV_PF_MASK (0x7<<8)
-#define DV_PF_INDEX (0x0<<8)
-#define DV_PF_555 (0x1<<8)
-#define DV_PF_565 (0x2<<8)
-
-#define GFX_OP_ANTIALIAS ((0x3<<29)|(0x6<<24))
-#define AA_UPDATE_EDGEFLAG (1<<13)
-#define AA_ENABLE_EDGEFLAG (1<<12)
-#define AA_UPDATE_POLYWIDTH (1<<11)
-#define AA_POLYWIDTH_05 (1<<9)
-#define AA_POLYWIDTH_10 (2<<9)
-#define AA_POLYWIDTH_20 (3<<9)
-#define AA_POLYWIDTH_40 (4<<9)
-#define AA_UPDATE_LINEWIDTH (1<<8)
-#define AA_LINEWIDTH_05 (1<<6)
-#define AA_LINEWIDTH_10 (2<<6)
-#define AA_LINEWIDTH_20 (3<<6)
-#define AA_LINEWIDTH_40 (4<<6)
-#define AA_UPDATE_BB_EXPANSION (1<<5)
-#define AA_BB_EXPANSION_SHIFT 2
-#define AA_UPDATE_AA_ENABLE (1<<1)
-#define AA_ENABLE (1<<0)
-
-#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-#define I810_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810context.c b/xc/lib/GL/mesa/src/drv/i810/i810context.c
deleted file mode 100644
index da1764cef..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810context.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810context.c,v 1.3 2002/10/30 12:51:33 alanh Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810span.h"
-#include "i810tris.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-#include "utils.h"
-#ifndef I810_DEBUG
-int I810_DEBUG = (0);
-#endif
-
-static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
-{
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"Keith Whitwell";
- case GL_RENDERER:
- return (GLubyte *)"Mesa DRI I810 20021125";
- default:
- return 0;
- }
-}
-
-static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(imesa);
- *width = imesa->driDrawable->w;
- *height = imesa->driDrawable->h;
- UNLOCK_HARDWARE(imesa);
-}
-
-/* Extension strings exported by the i810 driver.
- */
-static const char * const card_extensions[] =
-{
- "GL_ARB_multitexture",
- "GL_ARB_texture_env_add",
- "GL_ARB_texture_mirrored_repeat",
- "GL_EXT_stencil_wrap",
- "GL_EXT_texture_edge_clamp",
- "GL_EXT_texture_env_add",
- "GL_EXT_texture_lod_bias",
- "GL_IBM_texture_mirrored_repeat",
- "GL_MESA_ycbcr_texture",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_edge_clamp",
- NULL
-};
-
-extern const struct gl_pipeline_stage _i810_render_stage;
-
-static const struct gl_pipeline_stage *i810_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 1
- &_i810_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { NULL, 0 }
-};
-
-GLboolean
-i810CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- i810ContextPtr imesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
- I810SAREAPtr saPriv = (I810SAREAPtr)
- (((GLubyte *)sPriv->pSAREA) + i810Screen->sarea_priv_offset);
-
- /* Allocate i810 context */
- imesa = (i810ContextPtr) CALLOC_STRUCT(i810_context_t);
- if (!imesa) {
- return GL_FALSE;
- }
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((i810ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void*) imesa, GL_TRUE);
- if (!imesa->glCtx) {
- FREE(imesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = imesa;
-
- imesa->i810Screen = i810Screen;
- imesa->driScreen = sPriv;
- imesa->sarea = saPriv;
- imesa->glBuffer = NULL;
-
- (void) memset( imesa->texture_heaps, 0, sizeof( imesa->texture_heaps ) );
- make_empty_list( & imesa->swapped );
-
- imesa->nr_heaps = 1;
- imesa->texture_heaps[0] = driCreateTextureHeap( 0, imesa,
- i810Screen->textureSize,
- 12,
- I810_NR_TEX_REGIONS,
- imesa->sarea->texList,
- & imesa->sarea->texAge,
- & imesa->swapped,
- sizeof( struct i810_texture_object_t ),
- (destroy_texture_object_t *) i810DestroyTexObj );
-
-
-
- /* Set the maximum texture size small enough that we can guarentee
- * that both texture units can bind a maximal texture and have them
- * in memory at once.
- */
-
-
-
- ctx = imesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
-
-
- /* FIXME: driCalcualteMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
- */
- driCalculateMaxTextureLevels( imesa->texture_heaps,
- imesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 12,
- GL_FALSE );
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 3.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Driver.GetBufferSize = i810BufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = i810GetString;
-
- /* Who owns who?
- */
- ctx->DriverCtx = (void *) imesa;
- imesa->glCtx = ctx;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, i810_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- /* Dri stuff
- */
- imesa->hHWContext = driContextPriv->hHWContext;
- imesa->driFd = sPriv->fd;
- imesa->driHwLock = &sPriv->pSAREA->lock;
-
- imesa->stipple_in_hw = 1;
- imesa->RenderIndex = ~0;
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- imesa->upload_cliprects = GL_TRUE;
-
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
-
- _math_matrix_ctr( &imesa->ViewportMatrix );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- i810InitStateFuncs( ctx );
- i810InitTextureFuncs( ctx );
- i810InitTriFuncs( ctx );
- i810InitSpanFuncs( ctx );
- i810InitIoctlFuncs( ctx );
- i810InitVB( ctx );
- i810InitState( ctx );
-
-#if DO_DEBUG
- I810_DEBUG = driParseDebugString( getenv( "I810_DEBUG" ),
- debug_control );
- I810_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
- return GL_TRUE;
-}
-
-void
-i810DestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
-
- assert(imesa); /* should never be null */
- if (imesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( imesa->glCtx );
- _tnl_DestroyContext( imesa->glCtx );
- _ac_DestroyContext( imesa->glCtx );
- _swrast_DestroyContext( imesa->glCtx );
-
- i810FreeVB( imesa->glCtx );
-
- /* free the Mesa context */
- imesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(imesa->glCtx);
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & imesa->swapped ) );
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( imesa->texture_heaps[ i ] );
- imesa->texture_heaps[ i ] = NULL;
- }
- }
-
- Xfree(imesa);
- }
-}
-
-
-void i810XMesaSetFrontClipRects( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
-
- i810EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-void i810XMesaSetBackClipRects( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0)
- {
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
- } else {
- imesa->numClipRects = dPriv->numBackClipRects;
- imesa->pClipRects = dPriv->pBackClipRects;
- imesa->drawX = dPriv->backX;
- imesa->drawY = dPriv->backY;
- }
-
- i810EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-static void i810XMesaWindowMoved( i810ContextPtr imesa )
-{
- switch (imesa->glCtx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
- i810XMesaSetFrontClipRects( imesa );
- break;
- case BACK_LEFT_BIT:
- i810XMesaSetBackClipRects( imesa );
- break;
- case GL_FRONT_LEFT:
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- i810XMesaSetFrontClipRects( imesa );
- }
-}
-
-
-GLboolean
-i810UnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
- if (imesa) {
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;
- if (imesa->CurrentTexObj[1]) imesa->dirty |= I810_UPLOAD_TEX1;
- }
-
- return GL_TRUE;
-}
-
-
-GLboolean
-i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
-
- /* Shouldn't the readbuffer be stored also?
- */
- imesa->driDrawable = driDrawPriv;
-
- _mesa_make_current2(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- /* Are these necessary?
- */
- i810XMesaWindowMoved( imesa );
- if (!imesa->glCtx->Viewport.Width)
- _mesa_set_viewport(imesa->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- else {
- _mesa_make_current(0,0);
- }
-
- return GL_TRUE;
-}
-
-static void
-i810UpdatePageFlipping( i810ContextPtr imesa )
-{
- GLcontext *ctx = imesa->glCtx;
- int front = 0;
-
- switch (ctx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
- front = 1;
- break;
- case BACK_LEFT_BIT:
- front = 0;
- break;
- default:
- return;
- }
-
- if ( imesa->sarea->pf_current_page == 1 )
- front ^= 1;
-
- if (front) {
- imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->fbOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- } else {
- imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->backOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = imesa->i810Screen->back.map;
- imesa->readMap = imesa->i810Screen->back.map;
- }
-
- imesa->dirty |= I810_UPLOAD_BUFFERS;
-}
-
-void i810GetLock( i810ContextPtr imesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- __DRIscreenPrivate *sPriv = imesa->driScreen;
- I810SAREAPtr sarea = imesa->sarea;
- int me = imesa->hHWContext;
- unsigned i;
-
- drmGetLock(imesa->driFd, imesa->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
- if (sarea->ctxOwner != me) {
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;
- if (imesa->CurrentTexObj[1]) imesa->dirty |= I810_UPLOAD_TEX1;
- sarea->ctxOwner = me;
- }
-
- /* Shared texture managment - if another client has played with
- * texture space, figure out which if any of our textures have been
- * ejected, and update our global LRU.
- */
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( imesa->texture_heaps[ i ] );
- }
-
- if (imesa->lastStamp != dPriv->lastStamp) {
- i810UpdatePageFlipping( imesa );
- i810XMesaWindowMoved( imesa );
- imesa->lastStamp = dPriv->lastStamp;
- }
-}
-
-
-void
-i810SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- i810ContextPtr imesa;
- GLcontext *ctx;
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = imesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( imesa->sarea->pf_active ) {
- i810PageFlip( dPriv );
- } else {
- i810CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "i810SwapBuffers: drawable has no context!\n");
- }
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810context.h b/xc/lib/GL/mesa/src/drv/i810/i810context.h
deleted file mode 100644
index b24bd7ca3..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810context.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810context.h,v 1.9 2002/12/16 16:18:51 dawes Exp $ */
-
-#ifndef I810CONTEXT_INC
-#define I810CONTEXT_INC
-
-typedef struct i810_context_t i810Context;
-typedef struct i810_context_t *i810ContextPtr;
-typedef struct i810_texture_object_t *i810TextureObjectPtr;
-
-#include "mtypes.h"
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810tex.h"
-
-
-/* Reasons to disable hardware rasterization.
- */
-#define I810_FALLBACK_TEXTURE 0x1
-#define I810_FALLBACK_DRAW_BUFFER 0x2
-#define I810_FALLBACK_READ_BUFFER 0x4
-#define I810_FALLBACK_COLORMASK 0x8
-#define I810_FALLBACK_SPECULAR 0x20
-#define I810_FALLBACK_LOGICOP 0x40
-#define I810_FALLBACK_RENDERMODE 0x80
-#define I810_FALLBACK_STENCIL 0x100
-#define I810_FALLBACK_BLEND_EQ 0x200
-#define I810_FALLBACK_BLEND_FUNC 0x400
-
-
-#ifndef PCI_CHIP_I810
-#define PCI_CHIP_I810 0x7121
-#define PCI_CHIP_I810_DC100 0x7123
-#define PCI_CHIP_I810_E 0x7125
-#define PCI_CHIP_I815 0x1132
-#endif
-
-#define IS_I810(imesa) (imesa->i810Screen->deviceID == PCI_CHIP_I810 || \
- imesa->i810Screen->deviceID == PCI_CHIP_I810_DC100 || \
- imesa->i810Screen->deviceID == PCI_CHIP_I810_E)
-#define IS_I815(imesa) (imesa->i810Screen->deviceID == PCI_CHIP_I815)
-
-
-#define I810_UPLOAD_TEX(i) (I810_UPLOAD_TEX0<<(i))
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) i810##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*i810_tri_func)( i810ContextPtr, i810Vertex *, i810Vertex *,
- i810Vertex * );
-typedef void (*i810_line_func)( i810ContextPtr, i810Vertex *, i810Vertex * );
-typedef void (*i810_point_func)( i810ContextPtr, i810Vertex * );
-
-struct i810_context_t {
- GLint refcount;
- GLcontext *glCtx;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[1];
- driTextureObject swapped;
-
- struct i810_texture_object_t *CurrentTexObj[2];
-
-
- /* Bit flag to keep track of fallbacks.
- */
- GLuint Fallback;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* State for i810vb.c and i810tris.c.
- */
- GLuint new_state; /* _NEW_* flags */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint hw_primitive;
- GLubyte *verts;
-
- drmBufPtr vertex_buffer;
- char *vertex_addr;
- GLuint vertex_low;
- GLuint vertex_high;
- GLuint vertex_last_prim;
-
- GLboolean upload_cliprects;
-
-
- /* Fallback rasterization functions
- */
- i810_point_func draw_point;
- i810_line_func draw_line;
- i810_tri_func draw_tri;
-
- /* Hardware state
- */
- GLuint dirty; /* I810_UPLOAD_* */
- GLuint Setup[I810_CTX_SETUP_SIZE];
- GLuint BufferSetup[I810_DEST_SETUP_SIZE];
- int vertex_size;
- int vertex_stride_shift;
- unsigned int lastStamp;
- GLboolean stipple_in_hw;
-
- GLenum TexEnvImageFmt[2];
-
- /* State which can't be computed completely on the fly:
- */
- GLuint LcsCullMode;
- GLuint LcsLineWidth;
- GLuint LcsPointSize;
-
- /* Funny mesa mirrors
- */
- GLushort ClearColor;
-
- /* DRI stuff
- */
- GLuint needClip;
- GLframebuffer *glBuffer;
- GLboolean doPageFlip;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- XF86DRIClipRectPtr pClipRects;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
-
-
- GLboolean scissor;
- XF86DRIClipRectRec draw_rect;
- XF86DRIClipRectRec scissor_rect;
-
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- i810ScreenPrivate *i810Screen;
- I810SAREAPtr sarea;
-};
-
-
-#define I810_CONTEXT(ctx) ((i810ContextPtr)(ctx->DriverCtx))
-
-#define GET_DISPATCH_AGE( imesa ) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE( imesa ) imesa->sarea->last_enqueue
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( imesa ) \
- do { \
- char __ret=0; \
- DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
- (DRM_LOCK_HELD|imesa->hHWContext), __ret); \
- if (__ret) \
- i810GetLock( imesa, 0 ); \
- } while (0)
-
-
-
-/* Release the kernel lock.
- */
-#define UNLOCK_HARDWARE(imesa) \
- DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext);
-
-
-/* This is the wrong way to do it, I'm sure. Otherwise the drm
- * bitches that I've already got the heavyweight lock. At worst,
- * this is 3 ioctls. The best solution probably only gets me down
- * to 2 ioctls in the worst case.
- */
-#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
- LOCK_HARDWARE( imesa ); \
- i810RegetLockQuiescent( imesa ); \
-} while(0)
-
-
-extern void i810GetLock( i810ContextPtr imesa, GLuint flags );
-extern void i810EmitHwStateLocked( i810ContextPtr imesa );
-extern void i810EmitScissorValues( i810ContextPtr imesa, int box_nr, int emit );
-extern void i810EmitDrawingRectangle( i810ContextPtr imesa );
-extern void i810XMesaSetBackClipRects( i810ContextPtr imesa );
-extern void i810XMesaSetFrontClipRects( i810ContextPtr imesa );
-
-#define SUBPIXEL_X -.5
-#define SUBPIXEL_Y -.5
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int I810_DEBUG;
-#else
-#define I810_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c
deleted file mode 100644
index d769d58d5..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-
-#include <unistd.h> /* for usleep() */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810ioctl.h"
-#include "i810state.h"
-
-static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa )
-{
- drmI810DMA dma;
- drmBufPtr buf;
- int retcode, i = 0;
-
- while (1) {
- retcode = drmCommandWriteRead(imesa->driFd, DRM_I810_GETBUF,
- &dma, sizeof(drmI810DMA));
-
- if (dma.granted == 1 && retcode == 0)
- break;
-
- if (++i > 1000) {
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
- i = 0;
- }
- }
-
- buf = &(imesa->i810Screen->bufs->list[dma.request_idx]);
- buf->idx = dma.request_idx;
- buf->used = 0;
- buf->total = dma.request_size;
- buf->address = (drmAddress)dma.virtual;
-
- return buf;
-}
-
-
-
-#define DEPTH_SCALE ((1<<16)-1)
-
-static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- drmI810Clear clear;
- int i;
-
- clear.flags = 0;
- clear.clear_color = imesa->ClearColor;
- clear.clear_depth = (GLuint) (ctx->Depth.Clear * DEPTH_SCALE);
-
- I810_FIREVERTICES( imesa );
-
- if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0) {
- clear.flags |= I810_FRONT;
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0) {
- clear.flags |= I810_BACK;
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask & DD_DEPTH_BIT) {
- if (ctx->Depth.Mask)
- clear.flags |= I810_DEPTH;
- mask &= ~DD_DEPTH_BIT;
- }
-
- if (clear.flags) {
- LOCK_HARDWARE( imesa );
-
- /* flip top to bottom */
- cy = dPriv->h-cy-ch;
- cx += imesa->drawX;
- cy += imesa->drawY;
-
- for (i = 0 ; i < imesa->numClipRects ; )
- {
- int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects);
- XF86DRIClipRectPtr box = imesa->pClipRects;
- XF86DRIClipRectPtr b = imesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = *(XF86DRIClipRectPtr)&box[i];
- n++;
- }
- }
-
- imesa->sarea->nbox = n;
- drmCommandWrite(imesa->driFd, DRM_I810_CLEAR,
- &clear, sizeof(drmI810Clear));
- }
-
- UNLOCK_HARDWARE( imesa );
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void i810CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- i810ContextPtr imesa;
- XF86DRIClipRectPtr pbox;
- int nbox, i, tmp;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I810_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- pbox = dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)imesa->sarea->boxes;
-
- imesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
-
- drmCommandNone(imesa->driFd, DRM_I810_SWAP);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i810WaitAge(imesa, imesa->lastSwap);
- }
-
- imesa->lastSwap = tmp;
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-/*
- * XXX implement when full-screen extension is done.
- */
-void i810PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- i810ContextPtr imesa;
- int tmp, ret;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I810_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- if (dPriv->pClipRects) {
- *(XF86DRIClipRectRec *)imesa->sarea->boxes = dPriv->pClipRects[0];
- imesa->sarea->nbox = 1;
- }
- ret = drmCommandNone(imesa->driFd, DRM_I810_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( imesa );
- exit(1);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i810WaitAge(imesa, imesa->lastSwap);
- }
-
- /* i810SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );*/
- i810DrawBuffer( imesa->glCtx, imesa->glCtx->Color.DrawBuffer );
- imesa->upload_cliprects = GL_TRUE;
- imesa->lastSwap = tmp;
- return;
-}
-
-
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void i810DmaFinish( i810ContextPtr imesa )
-{
- I810_FIREVERTICES( imesa );
-
- LOCK_HARDWARE( imesa );
- i810RegetLockQuiescent( imesa );
- UNLOCK_HARDWARE( imesa );
-}
-
-
-void i810RegetLockQuiescent( i810ContextPtr imesa )
-{
- drmUnlock(imesa->driFd, imesa->hHWContext);
- i810GetLock( imesa, DRM_LOCK_QUIESCENT );
-}
-
-void i810WaitAgeLocked( i810ContextPtr imesa, int age )
-{
- int i = 0, j;
-
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- for (j = 0 ; j < 1000 ; j++)
- ;
- }
-
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
-}
-
-
-void i810WaitAge( i810ContextPtr imesa, int age )
-{
- int i = 0, j;
-
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- for (j = 0 ; j < 1000 ; j++)
- ;
- }
-
- i = 0;
- while (++i < 1000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- usleep(1000);
- }
-
- LOCK_HARDWARE(imesa);
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
- UNLOCK_HARDWARE(imesa);
-}
-
-
-
-
-static int intersect_rect( XF86DRIClipRectPtr out,
- XF86DRIClipRectPtr a,
- XF86DRIClipRectPtr b )
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (out->x1 >= out->x2) return 0;
-
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->y2 < out->y2) out->y2 = b->y2;
- if (out->y1 >= out->y2) return 0;
- return 1;
-}
-
-
-static void emit_state( i810ContextPtr imesa )
-{
- GLuint dirty = imesa->dirty;
- I810SAREAPtr sarea = imesa->sarea;
-
- if (dirty & I810_UPLOAD_BUFFERS) {
- memcpy( sarea->BufferState, imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- }
-
- if (dirty & I810_UPLOAD_CTX) {
- memcpy( sarea->ContextState, imesa->Setup,
- sizeof(imesa->Setup) );
- }
-
- if (dirty & I810_UPLOAD_TEX0) {
- memcpy(sarea->TexState[0],
- imesa->CurrentTexObj[0]->Setup,
- sizeof(imesa->CurrentTexObj[0]->Setup));
- }
-
- if (dirty & I810_UPLOAD_TEX1) {
- GLuint *setup = sarea->TexState[1];
-
- memcpy( setup,
- imesa->CurrentTexObj[1]->Setup,
- sizeof(imesa->CurrentTexObj[1]->Setup));
-
- /* Need this for the case where both units are bound to the same
- * texobj.
- */
- setup[I810_TEXREG_MI1] ^= (MI1_MAP_0 ^ MI1_MAP_1);
- setup[I810_TEXREG_MLC] ^= (MLC_MAP_0 ^ MLC_MAP_1);
- setup[I810_TEXREG_MLL] ^= (MLL_MAP_0 ^ MLL_MAP_1);
- setup[I810_TEXREG_MCS] ^= (MCS_COORD_0 ^ MCS_COORD_1);
- setup[I810_TEXREG_MF] ^= (MF_MAP_0 ^ MF_MAP_1);
- }
-
- sarea->dirty = dirty;
- imesa->dirty = 0;
-}
-
-
-static void age_imesa( i810ContextPtr imesa, int age )
-{
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->base.timestamp = age;
- if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->base.timestamp = age;
-}
-
-
-void i810FlushPrimsLocked( i810ContextPtr imesa )
-{
- XF86DRIClipRectPtr pbox = (XF86DRIClipRectPtr)imesa->pClipRects;
- int nbox = imesa->numClipRects;
- drmBufPtr buffer = imesa->vertex_buffer;
- I810SAREAPtr sarea = imesa->sarea;
- drmI810Vertex vertex;
- int i;
-
- if (I810_DEBUG & DEBUG_STATE)
- i810PrintDirty( __FUNCTION__, imesa->dirty );
-
- if (imesa->dirty)
- emit_state( imesa );
-
- vertex.idx = buffer->idx;
- vertex.used = imesa->vertex_low;
- vertex.discard = 0;
- sarea->vertex_prim = imesa->hw_primitive;
-
- if (!nbox) {
- vertex.used = 0;
- }
- else if (nbox > I810_NR_SAREA_CLIPRECTS) {
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (!nbox || !imesa->upload_cliprects)
- {
- if (nbox == 1)
- sarea->nbox = 0;
- else
- sarea->nbox = nbox;
-
- vertex.discard = 1;
- drmCommandWrite(imesa->driFd, DRM_I810_VERTEX,
- &vertex, sizeof(drmI810Vertex));
- age_imesa(imesa, sarea->last_enqueue);
- }
- else
- {
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, nbox);
- XF86DRIClipRectPtr b = sarea->boxes;
-
- if (imesa->scissor) {
- sarea->nbox = 0;
-
- for ( ; i < nr ; i++) {
- b->x1 = pbox[i].x1 - imesa->drawX;
- b->y1 = pbox[i].y1 - imesa->drawY;
- b->x2 = pbox[i].x2 - imesa->drawX;
- b->y2 = pbox[i].y2 - imesa->drawY;
-
- if (intersect_rect(b, b, &imesa->scissor_rect)) {
- sarea->nbox++;
- b++;
- }
- }
-
- /* Culled?
- */
- if (!sarea->nbox) {
- if (nr < nbox) continue;
- vertex.used = 0;
- }
- } else {
- sarea->nbox = nr - i;
- for ( ; i < nr ; i++, b++) {
- b->x1 = pbox[i].x1 - imesa->drawX;
- b->y1 = pbox[i].y1 - imesa->drawY;
- b->x2 = pbox[i].x2 - imesa->drawX;
- b->y2 = pbox[i].y2 - imesa->drawY;
- }
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- vertex.discard = 1;
-
- drmCommandWrite(imesa->driFd, DRM_I810_VERTEX,
- &vertex, sizeof(drmI810Vertex));
- age_imesa(imesa, imesa->sarea->last_enqueue);
- }
- }
-
- /* Reset imesa vars:
- */
- imesa->vertex_buffer = 0;
- imesa->vertex_addr = 0;
- imesa->vertex_low = 0;
- imesa->vertex_high = 0;
- imesa->vertex_last_prim = 0;
- imesa->dirty = 0;
- imesa->upload_cliprects = GL_FALSE;
-}
-
-void i810FlushPrimsGetBuffer( i810ContextPtr imesa )
-{
- LOCK_HARDWARE(imesa);
-
- if (imesa->vertex_buffer)
- i810FlushPrimsLocked( imesa );
-
- imesa->vertex_buffer = i810_get_buffer_ioctl( imesa );
- imesa->vertex_high = imesa->vertex_buffer->total;
- imesa->vertex_addr = (char *)imesa->vertex_buffer->address;
- imesa->vertex_low = 4; /* leave room for instruction header */
- imesa->vertex_last_prim = imesa->vertex_low;
- UNLOCK_HARDWARE(imesa);
-}
-
-
-void i810FlushPrims( i810ContextPtr imesa )
-{
- if (imesa->vertex_buffer) {
- LOCK_HARDWARE( imesa );
- i810FlushPrimsLocked( imesa );
- UNLOCK_HARDWARE( imesa );
- }
-}
-
-
-
-int i810_check_copy(int fd)
-{
- return(drmCommandNone(fd, DRM_I810_DOCOPY));
-}
-
-static void i810Flush( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- I810_FIREVERTICES( imesa );
-}
-
-static void i810Finish( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- i810DmaFinish( imesa );
-}
-
-void i810InitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Flush = i810Flush;
- ctx->Driver.Clear = i810Clear;
- ctx->Driver.Finish = i810Finish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h
deleted file mode 100644
index e287b57b1..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.h,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-
-#ifndef I810_IOCTL_H
-#define I810_IOCTL_H
-
-#include "i810context.h"
-
-void i810EmitPrim( i810ContextPtr imesa );
-void i810FlushPrims( i810ContextPtr mmesa );
-void i810FlushPrimsLocked( i810ContextPtr mmesa );
-void i810FlushPrimsGetBuffer( i810ContextPtr imesa );
-
-void i810WaitAgeLocked( i810ContextPtr imesa, int age );
-void i810WaitAge( i810ContextPtr imesa, int age );
-void i810DmaFinish( i810ContextPtr imesa );
-void i810RegetLockQuiescent( i810ContextPtr imesa );
-void i810InitIoctlFuncs( GLcontext *ctx );
-void i810CopyBuffer( const __DRIdrawablePrivate *dpriv );
-void i810PageFlip( const __DRIdrawablePrivate *dpriv );
-int i810_check_copy(int fd);
-
-#define I810_STATECHANGE(imesa, flag) \
-do { \
- if (imesa->vertex_low != imesa->vertex_last_prim) \
- i810FlushPrims(imesa); \
- imesa->dirty |= flag; \
-} while (0) \
-
-
-#define I810_FIREVERTICES(imesa) \
-do { \
- if (imesa->vertex_buffer) { \
- i810FlushPrims(imesa); \
- } \
-} while (0)
-
-static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high)
- i810FlushPrimsGetBuffer( imesa );
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810render.c b/xc/lib/GL/mesa/src/drv/i810/i810render.c
deleted file mode 100644
index 8d388d88b..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810render.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Intel i810 DRI driver for Mesa 3.5
- *
- * Copyright (C) 1999-2000 Keith Whitwell All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL KEITH WHITWELL BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Author:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tris.h"
-#include "i810state.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PR_LINES,
- 0,
- PR_LINESTRIP,
- PR_TRIANGLES,
- PR_TRISTRIP_0,
- PR_TRIFAN,
- 0,
- 0,
- PR_POLYGON
-};
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-/* Fallback to normal rendering.
- */
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
- count, flags );
- I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
-}
-
-
-
-#define LOCAL_VARS i810ContextPtr imesa = I810_CONTEXT(ctx)
-#define INIT( prim ) do { \
- I810_STATECHANGE(imesa, 0); \
- i810RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
-} while (0)
-#define NEW_PRIMITIVE() I810_STATECHANGE( imesa, 0 )
-#define NEW_BUFFER() I810_FIREVERTICES( imesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (I810_DMA_BUF_SZ-4) / (imesa->vertex_size * 4)
-
-
-#define EMIT_VERTS( ctx, j, nr ) \
- i810_emit_contiguous_verts(ctx, j, (j)+(nr))
-
-
-#define TAG(x) i810_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean i810_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
-
- /* Don't handle clipping or indexed vertices.
- */
- if (VB->ClipOrMask || imesa->RenderIndex != 0 || VB->Elts) {
- return GL_TRUE;
- }
-
- imesa->SetupNewInputs = VERT_BIT_CLIP;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- i810_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _i810_render_stage =
-{
- "i810 render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- i810_check_render, /* check - initially set to alloc data */
- i810_run_render /* run */
-};
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810screen.c b/xc/lib/GL/mesa/src/drv/i810/i810screen.c
deleted file mode 100644
index 9f0a4dba7..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810screen.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810screen.c,v 1.2 2002/10/30 12:51:33 alanh Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810span.h"
-#include "i810tris.h"
-#include "i810ioctl.h"
-
-
-
-/* static int i810_malloc_proxy_buf(drmBufMapPtr buffers) */
-/* { */
-/* char *buffer; */
-/* drmBufPtr buf; */
-/* int i; */
-
-/* buffer = Xmalloc(I810_DMA_BUF_SZ); */
-/* if(buffer == NULL) return -1; */
-/* for(i = 0; i < I810_DMA_BUF_NR; i++) { */
-/* buf = &(buffers->list[i]); */
-/* buf->address = (drmAddress)buffer; */
-/* } */
-/* return 0; */
-/* } */
-
-static drmBufMapPtr i810_create_empty_buffers(void)
-{
- drmBufMapPtr retval;
-
- retval = (drmBufMapPtr)Xmalloc(sizeof(drmBufMap));
- if(retval == NULL) return NULL;
- memset(retval, 0, sizeof(drmBufMap));
- retval->list = (drmBufPtr)Xmalloc(sizeof(drmBuf) * I810_DMA_BUF_NR);
- if(retval->list == NULL) {
- Xfree(retval);
- return NULL;
- }
- memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR);
- return retval;
-}
-
-
-static GLboolean
-i810InitDriver(__DRIscreenPrivate *sPriv)
-{
- i810ScreenPrivate *i810Screen;
- I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv;
-
- /* Check the DRI externsion version */
- if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
- __driUtilMessage( "i810 DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
- return GL_FALSE;
- }
-
- /* Check that the DDX driver version is compatible */
- if (sPriv->ddxMajor != 1 ||
- sPriv->ddxMinor < 0) {
- __driUtilMessage("i810 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch);
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if (sPriv->drmMajor != 1 ||
- sPriv->drmMinor < 2) {
- __driUtilMessage("i810 DRI driver expected DRM driver version 1.2.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch);
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- i810Screen = (i810ScreenPrivate *)Xmalloc(sizeof(i810ScreenPrivate));
- if (!i810Screen) {
- __driUtilMessage("i810InitDriver: alloc i810ScreenPrivate struct failed");
- return GL_FALSE;
- }
-
- i810Screen->driScrnPriv = sPriv;
- sPriv->private = (void *)i810Screen;
-
- i810Screen->deviceID=gDRIPriv->deviceID;
- i810Screen->width=gDRIPriv->width;
- i810Screen->height=gDRIPriv->height;
- i810Screen->mem=gDRIPriv->mem;
- i810Screen->cpp=gDRIPriv->cpp;
- i810Screen->fbStride=gDRIPriv->fbStride;
- i810Screen->fbOffset=gDRIPriv->fbOffset;
-
- if (gDRIPriv->bitsPerPixel == 15)
- i810Screen->fbFormat = DV_PF_555;
- else
- i810Screen->fbFormat = DV_PF_565;
-
- i810Screen->backOffset=gDRIPriv->backOffset;
- i810Screen->depthOffset=gDRIPriv->depthOffset;
- i810Screen->backPitch = gDRIPriv->auxPitch;
- i810Screen->backPitchBits = gDRIPriv->auxPitchBits;
- i810Screen->textureOffset=gDRIPriv->textureOffset;
- i810Screen->textureSize=gDRIPriv->textureSize;
- i810Screen->logTextureGranularity = gDRIPriv->logTextureGranularity;
-
- i810Screen->bufs = i810_create_empty_buffers();
- if (i810Screen->bufs == NULL) {
- __driUtilMessage("i810InitDriver: i810_create_empty_buffers() failed");
- Xfree(i810Screen);
- return GL_FALSE;
- }
-
- i810Screen->back.handle = gDRIPriv->backbuffer;
- i810Screen->back.size = gDRIPriv->backbufferSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->back.handle,
- i810Screen->back.size,
- (drmAddress *)&i810Screen->back.map) != 0) {
- Xfree(i810Screen);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap failed");
- return GL_FALSE;
- }
-
- i810Screen->depth.handle = gDRIPriv->depthbuffer;
- i810Screen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->depth.handle,
- i810Screen->depth.size,
- (drmAddress *)&i810Screen->depth.map) != 0) {
- Xfree(i810Screen);
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap (2) failed");
- return GL_FALSE;
- }
-
- i810Screen->tex.handle = gDRIPriv->textures;
- i810Screen->tex.size = gDRIPriv->textureSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->tex.handle,
- i810Screen->tex.size,
- (drmAddress *)&i810Screen->tex.map) != 0) {
- Xfree(i810Screen);
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap (3) failed");
- return GL_FALSE;
- }
-
- i810Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- return GL_TRUE;
-}
-
-static void
-i810DestroyScreen(__DRIscreenPrivate *sPriv)
-{
- i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
-
- /* Need to unmap all the bufs and maps here:
- */
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
- drmUnmap(i810Screen->tex.map, i810Screen->tex.size);
-
- Xfree(i810Screen);
- sPriv->private = NULL;
-}
-
-
-static GLboolean
-i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-static GLboolean
-i810OpenCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static const struct __DriverAPIRec i810API = {
- .InitDriver = i810InitDriver,
- .DestroyScreen = i810DestroyScreen,
- .CreateContext = i810CreateContext,
- .DestroyContext = i810DestroyContext,
- .CreateBuffer = i810CreateBuffer,
- .DestroyBuffer = i810DestroyBuffer,
- .SwapBuffers = i810SwapBuffers,
- .MakeCurrent = i810MakeCurrent,
- .UnbindContext = i810UnbindContext,
- .OpenFullScreen = i810OpenCloseFullScreen,
- .CloseFullScreen = i810OpenCloseFullScreen,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &i810API);
- return (void *) psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810screen.h b/xc/lib/GL/mesa/src/drv/i810/i810screen.h
deleted file mode 100644
index 4625bc5e9..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810screen.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef _I810_INIT_H_
-#define _I810_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-
-typedef struct {
- drmHandle handle;
- drmSize size;
- char *map;
-} i810Region, *i810RegionPtr;
-
-typedef struct {
- i810Region front;
- i810Region back;
- i810Region depth;
- i810Region tex;
-
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int bitsPerPixel;
-
- int fbFormat;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int backPitch;
- int backPitchBits;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- drmBufMapPtr bufs;
- unsigned int sarea_priv_offset;
-} i810ScreenPrivate;
-
-
-extern GLboolean
-i810CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-i810DestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i810UnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-i810SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c
deleted file mode 100644
index dc8f4d1cb..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810span.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810span.h"
-#include "i810ioctl.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-#define LOCAL_VARS \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
- GLuint height = dPriv->h; \
- GLushort p; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * 2 + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * 2 + \
- dPriv->y * pitch); \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(i810Screen->depth.map + \
- dPriv->x * 2 + \
- dPriv->y * pitch)
-
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
- _y >= miny && _y < maxy)
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK() \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- I810_FIREVERTICES(imesa); \
- i810DmaFinish(imesa); \
- LOCK_HARDWARE_QUIESCENT(imesa);
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- while (_nc--) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK() \
- UNLOCK_HARDWARE(imesa);
-
-
-
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i810##x##_565
-#include "spantmp.h"
-
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch);
-
-#define TAG(x) i810##x##_16
-#include "depthtmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- (void) buffer;
-
- switch(bufferBit) {
- case FRONT_LEFT_BIT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = imesa->i810Screen->back.map;
- else
- imesa->readMap = (char*)imesa->driScreen->pFB;
- break;
- case BACK_LEFT_BIT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = (char*)imesa->driScreen->pFB;
- else
- imesa->readMap = imesa->i810Screen->back.map;
- break;
- default:
- ASSERT(0);
- break;
- }
- imesa->drawMap = imesa->readMap;
-}
-
-
-void i810InitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = i810SetBuffer;
-
- swdd->WriteRGBASpan = i810WriteRGBASpan_565;
- swdd->WriteRGBSpan = i810WriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = i810WriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = i810WriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = i810ReadRGBASpan_565;
- swdd->ReadRGBAPixels = i810ReadRGBAPixels_565;
-
- swdd->ReadDepthSpan = i810ReadDepthSpan_16;
- swdd->WriteDepthSpan = i810WriteDepthSpan_16;
- swdd->ReadDepthPixels = i810ReadDepthPixels_16;
- swdd->WriteDepthPixels = i810WriteDepthPixels_16;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.h b/xc/lib/GL/mesa/src/drv/i810/i810span.h
deleted file mode 100644
index a7b809bf1..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810span.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _I810_SPAN_H
-#define _I810_SPAN_H
-
-extern void i810InitSpanFuncs( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810state.c b/xc/lib/GL/mesa/src/drv/i810/i810state.c
deleted file mode 100644
index 23432b2c0..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810state.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810state.c,v 1.9 2002/10/30 12:51:33 alanh Exp $ */
-
-#include <stdio.h>
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-#include "colormac.h"
-
-#include "texmem.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810vb.h"
-#include "i810tris.h"
-#include "i810ioctl.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-static __inline__ GLuint i810PackColor(GLuint format,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
-
- if (I810_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case DV_PF_555:
- return PACK_COLOR_1555( a, r, g, b );
- case DV_PF_565:
- return PACK_COLOR_565( r, g, b );
- default:
- fprintf(stderr, "unknown format %d\n", (int)format);
- return 0;
- }
-}
-
-
-static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF);
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- switch (ctx->Color.AlphaFunc) {
- case GL_NEVER: a |= ZA_ALPHA_NEVER; break;
- case GL_LESS: a |= ZA_ALPHA_LESS; break;
- case GL_GEQUAL: a |= ZA_ALPHA_GEQUAL; break;
- case GL_LEQUAL: a |= ZA_ALPHA_LEQUAL; break;
- case GL_GREATER: a |= ZA_ALPHA_GREATER; break;
- case GL_NOTEQUAL: a |= ZA_ALPHA_NOTEQUAL; break;
- case GL_EQUAL: a |= ZA_ALPHA_EQUAL; break;
- case GL_ALWAYS: a |= ZA_ALPHA_ALWAYS; break;
- default: return;
- }
-
- a |= ((refByte & 0xfc) << ZA_ALPHAREF_SHIFT);
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ZA] &= ~(ZA_ALPHA_MASK|ZA_ALPHAREF_MASK);
- imesa->Setup[I810_CTXREG_ZA] |= a;
-}
-
-static void i810BlendEquation(GLcontext *ctx, GLenum mode)
-{
- /* Can only do GL_ADD equation in hardware */
- FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_BLEND_EQ, mode != GL_FUNC_ADD_EXT);
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-}
-
-static void i810BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND;
- GLboolean fallback = GL_FALSE;
-
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO: a |= SDM_SRC_ZERO; break;
- case GL_SRC_ALPHA: a |= SDM_SRC_SRC_ALPHA; break;
- case GL_ONE: a |= SDM_SRC_ONE; break;
- case GL_DST_COLOR: a |= SDM_SRC_DST_COLOR; break;
- case GL_ONE_MINUS_DST_COLOR: a |= SDM_SRC_INV_DST_COLOR; break;
- case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_SRC_INV_SRC_ALPHA; break;
- case GL_DST_ALPHA: a |= SDM_SRC_ONE; break;
- case GL_ONE_MINUS_DST_ALPHA: a |= SDM_SRC_ZERO; break;
- case GL_SRC_ALPHA_SATURATE: /*a |= SDM_SRC_SRC_ALPHA; break;*/
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- return;
- }
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_SRC_ALPHA: a |= SDM_DST_SRC_ALPHA; break;
- case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_DST_INV_SRC_ALPHA; break;
- case GL_ZERO: a |= SDM_DST_ZERO; break;
- case GL_ONE: a |= SDM_DST_ONE; break;
- case GL_SRC_COLOR: a |= SDM_DST_SRC_COLOR; break;
- case GL_ONE_MINUS_SRC_COLOR: a |= SDM_DST_INV_SRC_COLOR; break;
- case GL_DST_ALPHA: a |= SDM_DST_ONE; break;
- case GL_ONE_MINUS_DST_ALPHA: a |= SDM_DST_ZERO; break;
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- return;
- }
-
- FALLBACK( imesa, I810_FALLBACK_BLEND_FUNC, fallback);
- if (!fallback) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_SDM] &= ~(SDM_SRC_MASK|SDM_DST_MASK);
- imesa->Setup[I810_CTXREG_SDM] |= a;
- }
-}
-
-
-/* Shouldn't be called as the extension is disabled.
- */
-static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- if (dfactorRGB != dfactorA || sfactorRGB != sfactorA) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBlendEquation (disabled)");
- }
-
- i810BlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
-
-
-static void i810DepthFunc(GLcontext *ctx, GLenum func)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- int zmode;
-
- switch(func) {
- case GL_NEVER: zmode = LCS_Z_NEVER; break;
- case GL_ALWAYS: zmode = LCS_Z_ALWAYS; break;
- case GL_LESS: zmode = LCS_Z_LESS; break;
- case GL_LEQUAL: zmode = LCS_Z_LEQUAL; break;
- case GL_EQUAL: zmode = LCS_Z_EQUAL; break;
- case GL_GREATER: zmode = LCS_Z_GREATER; break;
- case GL_GEQUAL: zmode = LCS_Z_GEQUAL; break;
- case GL_NOTEQUAL: zmode = LCS_Z_NOTEQUAL; break;
- default: return;
- }
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_Z_MASK;
- imesa->Setup[I810_CTXREG_LCS] |= zmode;
-}
-
-static void i810DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
-
- if (flag)
- imesa->Setup[I810_CTXREG_B2] |= B2_ZB_WRITE_ENABLE;
- else
- imesa->Setup[I810_CTXREG_B2] &= ~B2_ZB_WRITE_ENABLE;
-}
-
-
-/* =============================================================
- * Polygon stipple
- *
- * The i810 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- imesa->reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++)
- if (*m++ != p[j]) {
- imesa->stipple_in_hw = 0;
- return;
- }
-
- newMask = ((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12);
-
- if (newMask == 0xffff) {
- /* this is needed to make conform pass */
- imesa->stipple_in_hw = 0;
- return;
- }
-
- imesa->Setup[I810_CTXREG_ST1] &= ~0xffff;
- imesa->Setup[I810_CTXREG_ST1] |= newMask;
- imesa->stipple_in_hw = 1;
-
- if (active)
- imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE;
-}
-
-
-
-/* =============================================================
- * Hardware clipping
- */
-
-
-static void i810Scissor( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (ctx->Scissor.Enabled) {
- I810_FIREVERTICES(imesa); /* don't pipeline cliprect changes */
- imesa->upload_cliprects = GL_TRUE;
- }
-
- imesa->scissor_rect.x1 = x;
- imesa->scissor_rect.y1 = imesa->driDrawable->h - (y + h);
- imesa->scissor_rect.x2 = x + w;
- imesa->scissor_rect.y2 = imesa->driDrawable->h - y;
-}
-
-
-static void i810LogicOp( GLcontext *ctx, GLenum opcode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled && opcode != GL_COPY) );
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void i810RenderMode( GLcontext *ctx, GLenum mode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- FALLBACK( imesa, I810_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-void i810DrawBuffer(GLcontext *ctx, GLenum mode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- int front = 0;
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- front=1;
- break;
- case BACK_LEFT_BIT:
- front = 0;
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- if ( imesa->sarea->pf_current_page == 1 )
- front ^= 1;
-
- FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_FALSE );
- I810_FIREVERTICES(imesa);
- I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
-
- if (front)
- {
- imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->fbOffset |
- imesa->i810Screen->backPitchBits);
- i810XMesaSetFrontClipRects( imesa );
- }
- else
- {
- imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->backOffset |
- imesa->i810Screen->backPitchBits);
- i810XMesaSetBackClipRects( imesa );
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void i810ReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* XXX anything? */
-}
-
-
-static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- imesa->ClearColor = i810PackColor( imesa->i810Screen->fbFormat,
- c[0], c[1], c[2], c[3] );
-}
-
-
-/* =============================================================
- * Culling - the i810 isn't quite as clean here as the rest of
- * its interfaces, but it's not bad.
- */
-static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint mode = LCS_CULL_BOTH;
-
- if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = LCS_CULL_CW;
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (LCS_CULL_CW ^ LCS_CULL_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (LCS_CULL_CW ^ LCS_CULL_CCW);
- }
-
- imesa->LcsCullMode = mode;
-
- if (ctx->Polygon.CullFlag)
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_CULL_MASK;
- imesa->Setup[I810_CTXREG_LCS] |= mode;
- }
-}
-
-
-static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- int width = (int)ctx->Line._Width;
-
- imesa->LcsLineWidth = 0;
- if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
- if (width & 2) imesa->LcsLineWidth |= LCS_LINEWIDTH_2_0;
-
- if (imesa->reduced_primitive == GL_LINES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsLineWidth;
- }
-}
-
-static void i810PointSize( GLcontext *ctx, GLfloat sz )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- int size = (int)ctx->Point._Size;
-
- imesa->LcsPointSize = 0;
- if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
- if (size & 2) imesa->LcsPointSize |= LCS_LINEWIDTH_2_0;
-
- if (imesa->reduced_primitive == GL_POINTS) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsPointSize;
- }
-}
-
-/* =============================================================
- * Color masks
- */
-
-static void i810ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint tmp = 0;
-
- if (r && g && b) {
- tmp = imesa->Setup[I810_CTXREG_B2] | B2_FB_WRITE_ENABLE;
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_FALSE );
- } else if (!r && !g && !b) {
- tmp = imesa->Setup[I810_CTXREG_B2] & ~B2_FB_WRITE_ENABLE;
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_FALSE );
- } else {
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_TRUE );
- return;
- }
-
- if (tmp != imesa->Setup[I810_CTXREG_B2]) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B2] = tmp;
- imesa->dirty |= I810_UPLOAD_CTX;
- }
-}
-
-/* Seperate specular not fully implemented on the i810.
- */
-static void i810LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
- {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- FALLBACK( imesa, I810_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR));
- }
-}
-
-/* But the 815 has it...
- */
-static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
- {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- imesa->Setup[I810_CTXREG_B1] |= B1_SPEC_ENABLE;
- else
- imesa->Setup[I810_CTXREG_B1] &= ~B1_SPEC_ENABLE;
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i810ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (mode == GL_FLAT)
- imesa->Setup[I810_CTXREG_LCS] |= LCS_INTERP_FLAT;
- else
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_INTERP_FLAT;
-}
-
-
-
-/* =============================================================
- * Fog
- */
-static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_FOG] = ((GFX_OP_FOG_COLOR | color) &
- ~FOG_RESERVED_MASK);
- }
-}
-
-
-/* =============================================================
- */
-static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- switch(cap) {
- case GL_ALPHA_TEST:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_ALPHA_TEST_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_ALPHA_TEST_ENABLE;
- break;
- case GL_BLEND:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_BLEND_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_BLEND_ENABLE;
-
- /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_DEPTH_TEST:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_Z_TEST_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_Z_TEST_ENABLE;
- break;
- case GL_SCISSOR_TEST:
- /* XXX without these next two lines, conform's scissor test fails */
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
- I810_FIREVERTICES(imesa); /* don't pipeline cliprect changes */
- imesa->upload_cliprects = GL_TRUE;
- imesa->scissor = state;
- break;
- case GL_POLYGON_STIPPLE:
- if (imesa->stipple_in_hw && imesa->reduced_primitive == GL_TRIANGLES)
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE;
- }
- break;
- case GL_LINE_SMOOTH:
- /* Need to fatten the lines by .5, or they disappear...
- */
- if (imesa->reduced_primitive == GL_LINES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_0_5;
- if (state) {
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] |= LCS_LINEWIDTH_0_5;
- }
- }
- break;
- case GL_POINT_SMOOTH:
- if (imesa->reduced_primitive == GL_POINTS) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_0_5;
- if (state) {
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] |= LCS_LINEWIDTH_0_5;
- }
- }
- break;
- case GL_POLYGON_SMOOTH:
- if (imesa->reduced_primitive == GL_TRIANGLES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- }
- break;
- case GL_FOG:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_FOG_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_FOG_ENABLE;
- break;
- case GL_CULL_FACE:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_CULL_MASK;
- if (state)
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsCullMode;
- else
- imesa->Setup[I810_CTXREG_LCS] |= LCS_CULL_DISABLE;
- break;
- case GL_TEXTURE_2D:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (ctx->Texture.CurrentUnit == 0) {
- imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL0_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL0_ENABLE;
- } else {
- imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL1_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL1_ENABLE;
- }
- break;
- case GL_COLOR_LOGIC_OP:
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (state && ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_STENCIL_TEST:
- FALLBACK( imesa, I810_FALLBACK_STENCIL, state );
- break;
- default:
- ;
- }
-}
-
-
-
-
-
-
-
-/* =============================================================
- */
-
-
-
-
-void i810EmitDrawingRectangle( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i810ScreenPrivate *i810Screen = imesa->i810Screen;
- int x0 = imesa->drawX;
- int y0 = imesa->drawY;
- int x1 = x0 + dPriv->w;
- int y1 = y0 + dPriv->h;
- GLuint dr2, dr3, dr4;
-
-
- /* Coordinate origin of the window - may be offscreen.
- */
- dr4 = imesa->BufferSetup[I810_DESTREG_DR4] = ((y0<<16) |
- (((unsigned)x0)&0xFFFF));
-
- /* Clip to screen.
- */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i810Screen->width-1) x1 = i810Screen->width-1;
- if (y1 > i810Screen->height-1) y1 = i810Screen->height-1;
-
-
- /* Onscreen drawing rectangle.
- */
- dr2 = imesa->BufferSetup[I810_DESTREG_DR2] = ((y0<<16) | x0);
- dr3 = imesa->BufferSetup[I810_DESTREG_DR3] = (((y1+1)<<16) | (x1+1));
-
-
- imesa->dirty |= I810_UPLOAD_BUFFERS;
-}
-
-
-
-static void i810CalcViewport( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = imesa->ViewportMatrix.m;
-
- /* See also i810_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + imesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * (1.0 / 0xffff);
- m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff);
-}
-
-static void i810Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- i810CalcViewport( ctx );
-}
-
-static void i810DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- i810CalcViewport( ctx );
-}
-
-
-
-void i810PrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%x): %s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & I810_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & I810_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & I810_UPLOAD_CTX) ? "upload-ctx, " : "",
- (state & I810_UPLOAD_BUFFERS) ? "upload-bufs, " : ""
- );
-}
-
-
-
-void i810InitState( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- i810ScreenPrivate *i810Screen = imesa->i810Screen;
-
- memset(imesa->Setup, 0, sizeof(imesa->Setup));
-
- imesa->Setup[I810_CTXREG_VF] = 0;
-
- imesa->Setup[I810_CTXREG_MT] = (GFX_OP_MAP_TEXELS |
- MT_UPDATE_TEXEL1_STATE |
- MT_TEXEL1_COORD1 |
- MT_TEXEL1_MAP1 |
- MT_TEXEL1_DISABLE |
- MT_UPDATE_TEXEL0_STATE |
- MT_TEXEL0_COORD0 |
- MT_TEXEL0_MAP0 |
- MT_TEXEL0_DISABLE);
-
- imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_ARG1_DONT_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_ARG1 );
-
- imesa->Setup[I810_CTXREG_MC1] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ONE |
- MC_ARG1_DONT_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_DISABLE );
-
-
- imesa->Setup[I810_CTXREG_MC2] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_2 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_CURRENT_COLOR |
- MC_ARG1_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_DISABLE );
-
-
- imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_MA1] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_MA2] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_2 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_SDM] = ( GFX_OP_SRC_DEST_MONO |
- SDM_UPDATE_MONO_ENABLE |
- 0 |
- SDM_UPDATE_SRC_BLEND |
- SDM_SRC_ONE |
- SDM_UPDATE_DST_BLEND |
- SDM_DST_ZERO );
-
- /* Use for colormask:
- */
- imesa->Setup[I810_CTXREG_CF0] = GFX_OP_COLOR_FACTOR;
- imesa->Setup[I810_CTXREG_CF1] = 0xffffffff;
-
- imesa->Setup[I810_CTXREG_ZA] = (GFX_OP_ZBIAS_ALPHAFUNC |
- ZA_UPDATE_ALPHAFUNC |
- ZA_ALPHA_ALWAYS |
- ZA_UPDATE_ZBIAS |
- 0 |
- ZA_UPDATE_ALPHAREF |
- 0x0);
-
- imesa->Setup[I810_CTXREG_FOG] = (GFX_OP_FOG_COLOR |
- (0xffffff & ~FOG_RESERVED_MASK));
-
- /* Choose a pipe
- */
- imesa->Setup[I810_CTXREG_B1] = ( GFX_OP_BOOL_1 |
- B1_UPDATE_SPEC_SETUP_ENABLE |
- 0 |
- B1_UPDATE_ALPHA_SETUP_ENABLE |
- B1_ALPHA_SETUP_ENABLE |
- B1_UPDATE_CI_KEY_ENABLE |
- 0 |
- B1_UPDATE_CHROMAKEY_ENABLE |
- 0 |
- B1_UPDATE_Z_BIAS_ENABLE |
- 0 |
- B1_UPDATE_SPEC_ENABLE |
- 0 |
- B1_UPDATE_FOG_ENABLE |
- 0 |
- B1_UPDATE_ALPHA_TEST_ENABLE |
- 0 |
- B1_UPDATE_BLEND_ENABLE |
- 0 |
- B1_UPDATE_Z_TEST_ENABLE |
- 0 );
-
- imesa->Setup[I810_CTXREG_B2] = ( GFX_OP_BOOL_2 |
- B2_UPDATE_MAP_CACHE_ENABLE |
- B2_MAP_CACHE_ENABLE |
- B2_UPDATE_ALPHA_DITHER_ENABLE |
- 0 |
- B2_UPDATE_FOG_DITHER_ENABLE |
- 0 |
- B2_UPDATE_SPEC_DITHER_ENABLE |
- 0 |
- B2_UPDATE_RGB_DITHER_ENABLE |
- B2_RGB_DITHER_ENABLE |
- B2_UPDATE_FB_WRITE_ENABLE |
- B2_FB_WRITE_ENABLE |
- B2_UPDATE_ZB_WRITE_ENABLE |
- B2_ZB_WRITE_ENABLE );
-
- imesa->Setup[I810_CTXREG_LCS] = ( GFX_OP_LINEWIDTH_CULL_SHADE_MODE |
- LCS_UPDATE_ZMODE |
- LCS_Z_LESS |
- LCS_UPDATE_LINEWIDTH |
- LCS_LINEWIDTH_1_0 |
- LCS_UPDATE_ALPHA_INTERP |
- LCS_ALPHA_INTERP |
- LCS_UPDATE_FOG_INTERP |
- 0 |
- LCS_UPDATE_SPEC_INTERP |
- 0 |
- LCS_UPDATE_RGB_INTERP |
- LCS_RGB_INTERP |
- LCS_UPDATE_CULL_MODE |
- LCS_CULL_DISABLE);
-
- imesa->LcsCullMode = LCS_CULL_CW;
- imesa->LcsLineWidth = LCS_LINEWIDTH_1_0;
- imesa->LcsPointSize = LCS_LINEWIDTH_1_0;
-
- imesa->Setup[I810_CTXREG_PV] = ( GFX_OP_PV_RULE |
- PV_UPDATE_PIXRULE |
- PV_PIXRULE_ENABLE |
- PV_UPDATE_LINELIST |
- PV_LINELIST_PV1 |
- PV_UPDATE_TRIFAN |
- PV_TRIFAN_PV2 |
- PV_UPDATE_TRISTRIP |
- PV_TRISTRIP_PV2 );
-
-
- imesa->Setup[I810_CTXREG_ST0] = GFX_OP_STIPPLE;
- imesa->Setup[I810_CTXREG_ST1] = 0;
-
- imesa->Setup[I810_CTXREG_AA] = ( GFX_OP_ANTIALIAS |
- AA_UPDATE_EDGEFLAG |
- 0 |
- AA_UPDATE_POLYWIDTH |
- AA_POLYWIDTH_05 |
- AA_UPDATE_LINEWIDTH |
- AA_LINEWIDTH_05 |
- AA_UPDATE_BB_EXPANSION |
- 0 |
- AA_UPDATE_AA_ENABLE |
- 0 );
-
- memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
- imesa->BufferSetup[I810_DESTREG_DI0] = CMD_OP_DESTBUFFER_INFO;
-
- if (imesa->glCtx->Visual.doubleBufferMode && imesa->sarea->pf_current_page == 0) {
- /* use back buffer by default */
- imesa->drawMap = i810Screen->back.map;
- imesa->readMap = i810Screen->back.map;
- imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->backOffset |
- i810Screen->backPitchBits);
- } else {
- /* use front buffer by default */
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->fbOffset |
- i810Screen->backPitchBits);
- }
-
- imesa->BufferSetup[I810_DESTREG_DV0] = GFX_OP_DESTBUFFER_VARS;
- imesa->BufferSetup[I810_DESTREG_DV1] = (DV_HORG_BIAS_OGL |
- DV_VORG_BIAS_OGL |
- i810Screen->fbFormat);
-
- imesa->BufferSetup[I810_DESTREG_DR0] = GFX_OP_DRAWRECT_INFO;
- imesa->BufferSetup[I810_DESTREG_DR1] = DR1_RECT_CLIP_ENABLE;
-}
-
-
-static void i810InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- I810_CONTEXT(ctx)->new_state |= new_state;
-}
-
-
-void i810InitStateFuncs(GLcontext *ctx)
-{
- /* Callbacks for internal Mesa events.
- */
- ctx->Driver.UpdateState = i810InvalidateState;
-
- /* API callbacks
- */
- ctx->Driver.AlphaFunc = i810AlphaFunc;
- ctx->Driver.BlendEquation = i810BlendEquation;
- ctx->Driver.BlendFunc = i810BlendFunc;
- ctx->Driver.BlendFuncSeparate = i810BlendFuncSeparate;
- ctx->Driver.ClearColor = i810ClearColor;
- ctx->Driver.ColorMask = i810ColorMask;
- ctx->Driver.CullFace = i810CullFaceFrontFace;
- ctx->Driver.DepthFunc = i810DepthFunc;
- ctx->Driver.DepthMask = i810DepthMask;
- ctx->Driver.Enable = i810Enable;
- ctx->Driver.Fogfv = i810Fogfv;
- ctx->Driver.FrontFace = i810CullFaceFrontFace;
- ctx->Driver.LineWidth = i810LineWidth;
- ctx->Driver.LogicOpcode = i810LogicOp;
- ctx->Driver.PolygonStipple = i810PolygonStipple;
- ctx->Driver.RenderMode = i810RenderMode;
- ctx->Driver.Scissor = i810Scissor;
- ctx->Driver.DrawBuffer = i810DrawBuffer;
- ctx->Driver.ReadBuffer = i810ReadBuffer;
- ctx->Driver.ShadeModel = i810ShadeModel;
- ctx->Driver.DepthRange = i810DepthRange;
- ctx->Driver.Viewport = i810Viewport;
- ctx->Driver.PointSize = i810PointSize;
-
- if (IS_I815(I810_CONTEXT(ctx))) {
- ctx->Driver.LightModelfv = i810LightModelfv_i815;
- } else {
- ctx->Driver.LightModelfv = i810LightModelfv;
- }
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810state.h b/xc/lib/GL/mesa/src/drv/i810/i810state.h
deleted file mode 100644
index 118b07549..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810state.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _I810_STATE_H
-#define _I810_STATE_H
-
-#include "i810context.h"
-
-extern void i810InitState( GLcontext *ctx );
-extern void i810InitStateFuncs( GLcontext *ctx );
-extern void i810PrintDirty( const char *msg, GLuint state );
-extern void i810DrawBuffer(GLcontext *ctx, GLenum mode );
-
-extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode )
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tex.c b/xc/lib/GL/mesa/src/drv/i810/i810tex.c
deleted file mode 100644
index a85f9598f..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810tex.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tex.c,v 1.9 2002/10/30 12:51:33 alanh Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-static GLuint i810ComputeLodBias(GLfloat bias)
-{
- int b = (int) (bias * 16.0) + 12;
- if (b > 63)
- b = 63;
- else if (b < -64)
- b = -64;
- return (GLuint) (b & MLC_LOD_BIAS_MASK);
-}
-
-
-static void i810SetTexWrapping(i810TextureObjectPtr tex,
- GLenum swrap, GLenum twrap)
-{
- tex->Setup[I810_TEXREG_MCS] &= ~(MCS_U_STATE_MASK| MCS_V_STATE_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_WRAP;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_CLAMP;
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_MIRROR;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_WRAP;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_CLAMP;
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_MIRROR;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-}
-
-
-static void i810SetTexFilter(i810ContextPtr imesa,
- i810TextureObjectPtr t,
- GLenum minf, GLenum magf,
- GLfloat bias)
-{
- t->Setup[I810_TEXREG_MF] &= ~(MF_MIN_MASK|
- MF_MAG_MASK|
- MF_MIP_MASK);
- t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
-
- switch (minf) {
- case GL_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_NONE;
- break;
- case GL_LINEAR:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_NEAREST;
- if (magf == GL_LINEAR) {
- /*bias -= 0.5;*/ /* this doesn't work too good */
- }
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- if (IS_I815(imesa))
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_LINEAR;
- else
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_DITHER;
- /*
- if (magf == GL_LINEAR) {
- bias -= 0.5;
- }
- */
- bias -= 0.5; /* always biasing here looks better */
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- if (IS_I815(imesa))
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_LINEAR;
- else
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_DITHER;
- break;
- default:
- return;
- }
-
- switch (magf) {
- case GL_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MAG_NEAREST;
- break;
- case GL_LINEAR:
- t->Setup[I810_TEXREG_MF] |= MF_MAG_LINEAR;
- break;
- default:
- return;
- }
-
- t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(bias);
-}
-
-
-static void i810SetTexBorderColor(i810TextureObjectPtr t,
- GLubyte color[4])
-{
- /* Need a fallback.
- */
-}
-static i810TextureObjectPtr i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
-{
- i810TextureObjectPtr t;
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- t = CALLOC_STRUCT( i810_texture_object_t );
- texObj->DriverData = t;
- if ( t != NULL ) {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->Setup[I810_TEXREG_MI0] = GFX_OP_MAP_INFO;
- t->Setup[I810_TEXREG_MI1] = MI1_MAP_0;
- t->Setup[I810_TEXREG_MI2] = MI2_DIMENSIONS_ARE_LOG2;
- t->Setup[I810_TEXREG_MLC] = (GFX_OP_MAP_LOD_CTL |
- MLC_MAP_0 |
- /*MLC_DITHER_WEIGHT_FULL |*/
- MLC_DITHER_WEIGHT_12 |
- MLC_UPDATE_LOD_BIAS |
- 0x0);
- t->Setup[I810_TEXREG_MCS] = (GFX_OP_MAP_COORD_SETS |
- MCS_COORD_0 |
- MCS_UPDATE_NORMALIZED |
- MCS_NORMALIZED_COORDS |
- MCS_UPDATE_V_STATE |
- MCS_V_WRAP |
- MCS_UPDATE_U_STATE |
- MCS_U_WRAP);
- t->Setup[I810_TEXREG_MF] = (GFX_OP_MAP_FILTER |
- MF_MAP_0 |
- MF_UPDATE_ANISOTROPIC |
- MF_UPDATE_MIP_FILTER |
- MF_UPDATE_MAG_FILTER |
- MF_UPDATE_MIN_FILTER);
-
- make_empty_list( & t->base );
-
- i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
- /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
- i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias );
- i810SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static void i810TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
- if (!t)
- return;
-
- if ( target != GL_TEXTURE_2D )
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting imesa->new_state means that
- * i810UpdateTextureState() will be called before any triangles are
- * rendered. If a statechange has occurred, it will be detected at
- * that point, and buffered vertices flushed.
- */
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- i810SetTexFilter( imesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- }
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- i810SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- i810SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative for Radeon. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- if (t == imesa->CurrentTexObj[0]) {
- I810_STATECHANGE( imesa, I810_UPLOAD_TEX0 );
- }
-
- if (t == imesa->CurrentTexObj[1]) {
- I810_STATECHANGE( imesa, I810_UPLOAD_TEX1 );
- }
-}
-
-
-static void i810TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- /* Only one env color. Need a fallback if env colors are different
- * and texture setup references env color in both units.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a, col;
- CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
- CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- (b << 0));
-
- if (imesa->Setup[I810_CTXREG_CF1] != col) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_CF1] = col;
- }
- break;
- }
- case GL_TEXTURE_ENV_MODE:
- imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
- {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
- t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
- t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
- }
- break;
-
- default:
- break;
- }
-}
-
-
-
-#if 0
-static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- i810TextureObjectPtr t = (i810TextureObjectPtr) texObj->DriverData;
- if (t) {
- i810SwapOutTexObj( imesa, t );
- }
-}
-
-static void i810TexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
-}
-#endif
-
-
-static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i810AllocTexObj( ctx, texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-
-}
-
-static void i810TexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject *t = (driTextureObject *)texObj->DriverData;
-
- if (t) {
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
-}
-
-
-static void i810BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- if (!tObj->DriverData) {
- i810AllocTexObj( ctx, tObj );
- }
-}
-
-
-static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
- if (t) {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- if (imesa)
- I810_FIREVERTICES( imesa );
- driDestroyTextureObject( t );
- }
-}
-
-static const struct gl_texture_format *
-i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
-
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_rgb565;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_argb4444;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-void i810InitTextureFuncs( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- ctx->Driver.TexEnv = i810TexEnv;
- ctx->Driver.ChooseTextureFormat = i810ChooseTextureFormat;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = i810TexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = i810TexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.BindTexture = i810BindTexture;
- ctx->Driver.DeleteTexture = i810DeleteTexture;
- ctx->Driver.TexParameter = i810TexParameter;
- ctx->Driver.UpdateTexturePalette = 0;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- driInitTextureObjects( ctx, &imesa->swapped, DRI_TEXMGR_DO_TEXTURE_2D);
-
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tex.h b/xc/lib/GL/mesa/src/drv/i810/i810tex.h
deleted file mode 100644
index f0b4b8812..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810tex.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-
-#ifndef I810TEX_INC
-#define I810TEX_INC
-
-#include "mtypes.h"
-#include "mm.h"
-
-#include "i810context.h"
-#include "i810_3d_reg.h"
-#include "texmem.h"
-
-#define I810_TEX_MAXLEVELS 11
-
-/* For shared texture space managment, these texture objects may also
- * be used as proxies for regions of texture memory containing other
- * client's textures. Such proxy textures (not to be confused with GL
- * proxy textures) are subject to the same LRU aging we use for our
- * own private textures, and thus we have a mechanism where we can
- * fairly decide between kicking out our own textures and those of
- * other clients.
- *
- * Non-local texture objects have a valid MemBlock to describe the
- * region managed by the other client, and can be identified by
- * 't->globj == 0'
- */
-struct i810_texture_object_t {
- driTextureObject base;
-
- int Pitch;
- int Height;
- int texelBytes;
- char *BufAddr;
-
- GLuint max_level;
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[I810_TEX_MAXLEVELS];
-
- GLuint Setup[I810_TEX_SETUP_SIZE];
- GLuint dirty;
-
-};
-
-void i810UpdateTextureState( GLcontext *ctx );
-void i810InitTextureFuncs( GLcontext *ctx );
-
-void i810DestroyTexObj( i810ContextPtr imesa, i810TextureObjectPtr t );
-int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810texmem.c b/xc/lib/GL/mesa/src/drv/i810/i810texmem.c
deleted file mode 100644
index 87f535dc2..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810texmem.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- * Texmem interface changes (C) 2003 Dave Airlie
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "colormac.h"
-#include "mm.h"
-#include "texformat.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t)
-{
- /* See if it was the driver's current object.
- */
- if ( imesa != NULL ) {
- if (imesa->CurrentTexObj[0] == t) {
- imesa->CurrentTexObj[0] = 0;
- imesa->dirty &= ~I810_UPLOAD_TEX0;
- }
-
- if (imesa->CurrentTexObj[1] == t) {
- imesa->CurrentTexObj[1] = 0;
- imesa->dirty &= ~I810_UPLOAD_TEX1;
- }
- }
-}
-
-
-
-/* From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- */
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
-{
-int d0, d1, d2;
-__asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
-return (to);
-}
-
-/* Upload an image from mesa's internal copy.
- */
-static void i810UploadTexLevel( i810ContextPtr imesa,
- i810TextureObjectPtr t, int hwlevel )
-{
- const struct gl_texture_image *image = t->image[hwlevel].image;
- int j;
-
- if (!image || !image->Data)
- return;
-
- if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- memcpy( dst, src, t->Pitch * image->Height );
- }
- else switch (image->TexFormat->TexelBytes) {
- case 1:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- __memcpy(dst, src, image->Width );
- src += image->Width;
- }
- }
- break;
-
- case 2:
- {
- GLushort *dst = (GLushort *)(t->BufAddr + t->image[hwlevel].offset);
- GLushort *src = (GLushort *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) {
- __memcpy(dst, src, image->Width * 2 );
- src += image->Width;
- }
- }
- break;
-
- default:
- fprintf(stderr, "%s: Not supported texel size %d\n",
- __FUNCTION__, image->TexFormat->TexelBytes);
- }
-}
-
-/* This is called with the lock held. May have to eject our own and/or
- * other client's texture objects to make room for the upload.
- */
-int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->base.memBlock) {
- int heap;
-
- heap = driAllocateTexture( imesa->texture_heaps, imesa->nr_heaps,
- (driTextureObject *) t);
-
- if ( heap == -1 ) {
- return -1;
- }
-
- ofs = t->base.memBlock->ofs;
- t->BufAddr = imesa->i810Screen->tex.map + ofs;
- t->Setup[I810_TEXREG_MI3] = imesa->i810Screen->textureOffset + ofs;
-
- if (t == imesa->CurrentTexObj[0])
- I810_STATECHANGE(imesa, I810_UPLOAD_TEX0);
-
- if (t == imesa->CurrentTexObj[1])
- I810_STATECHANGE(imesa, I810_UPLOAD_TEX1);
-
- /* i810UpdateTexLRU( imesa, t );*/
- }
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (imesa->texture_heaps[0]->timestamp >= GET_DISPATCH_AGE(imesa))
- i810WaitAgeLocked( imesa, imesa->texture_heaps[0]->timestamp );
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->base.dirty_images[0] & (1<<i))
- i810UploadTexLevel( imesa, t, i );
-
- t->base.dirty_images[0] = 0;
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810texstate.c b/xc/lib/GL/mesa/src/drv/i810/i810texstate.c
deleted file mode 100644
index 05f685c58..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810texstate.c
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-
-
-static void i810SetTexImages( i810ContextPtr imesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, textureFormat, log_pitch;
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint numLevels;
- GLint log2Width, log2Height;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- switch (baseImage->Format) {
- case GL_RGB:
- case GL_LUMINANCE:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_RGB565;
- break;
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB4444;
- break;
- case GL_COLOR_INDEX:
- textureFormat = MI1_FMT_8CI | MI1_PF_8CI_ARGB4444;
- t->texelBytes = 1;
- break;
- case GL_YCBCR_MESA:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_422 | MI1_PF_422_YCRCB_SWAP_Y
- | MI1_COLOR_CONV_ENABLE;
- break;
-
- default:
- fprintf(stderr, "i810SetTexImages: bad image->Format\n" );
- return;
- }
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- log2Width = tObj->Image[t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[t->base.firstLevel]->HeightLog2;
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- width = tObj->Image[t->base.firstLevel]->Width * t->texelBytes;
- for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 )
- log_pitch++;
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( height = i = 0 ; i < numLevels ; i++ ) {
- t->image[i].image = tObj->Image[t->base.firstLevel + i];
- t->image[i].offset = height * pitch;
- t->image[i].internalFormat = baseImage->Format;
- height += t->image[i].image->Height;
- }
-
- t->Pitch = pitch;
- t->base.totalSize = height*pitch;
- t->max_level = i-1;
- t->dirty = I810_UPLOAD_TEX0 | I810_UPLOAD_TEX1;
- t->Setup[I810_TEXREG_MI1] = (MI1_MAP_0 | textureFormat | log_pitch);
- t->Setup[I810_TEXREG_MI2] = (MI2_DIMENSIONS_ARE_LOG2 |
- (log2Height << 16) | log2Width);
- t->Setup[I810_TEXREG_MLL] = (GFX_OP_MAP_LOD_LIMITS |
- MLL_MAP_0 |
- MLL_UPDATE_MAX_MIP |
- MLL_UPDATE_MIN_MIP |
- ((numLevels - 1) << MLL_MIN_MIP_SHIFT));
-
- LOCK_HARDWARE( imesa );
- i810UploadTexImagesLocked( imesa, t );
- UNLOCK_HARDWARE( imesa );
-}
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define I810_DISABLE 0
-#define I810_PASSTHRU 1
-#define I810_REPLACE 2
-#define I810_MODULATE 3
-#define I810_DECAL 4
-#define I810_BLEND 5
-#define I810_ALPHA_BLEND 6
-#define I810_ADD 7
-#define I810_MAX_COMBFUNC 8
-
-
-static GLuint i810_color_combine[][I810_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ), /* actually passthru */
-
- /* Passthru
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_TEX0_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_COLOR ),
-
- /* GL_BLEND according to alpha
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_ADD ),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage (Note: disables all subsequent stages)
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ONE |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_DISABLE ),
-
-
- /* Passthru
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_CURRENT_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_TEX1_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_COLOR ),
-
- /* GL_BLEND according to alpha
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_ADD ),
- }
-};
-
-static GLuint i810_alpha_combine[][I810_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* Passthru
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG2 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ALPHA_FACTOR |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_BLEND according to alpha (same as above)
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ADD ),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* Passthru
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG2 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ALPHA_FACTOR |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_BLEND according to alpha (same as above)
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ADD ),
- }
-
-};
-
-
-
-static void i810UpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLuint format = tObj->Image[tObj->BaseLevel]->Format;
- GLuint color_combine, alpha_combine;
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA) {
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_REPLACE];
- } else if (format == GL_LUMINANCE || format == GL_RGB) {
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- } else {
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_REPLACE];
- }
- break;
-
- case GL_MODULATE:
- if (format == GL_ALPHA) {
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- } else {
- color_combine = i810_color_combine[unit][I810_MODULATE];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- }
- break;
-
- case GL_DECAL:
- switch (format) {
- case GL_RGBA:
- color_combine = i810_color_combine[unit][I810_ALPHA_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGB:
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- case GL_BLEND:
- switch (format) {
- case GL_RGB:
- case GL_LUMINANCE:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_BLEND];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- case GL_ADD:
- switch (format) {
- case GL_RGB:
- case GL_LUMINANCE:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_ADD];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- default:
- return;
- }
-
- if (alpha_combine != imesa->Setup[I810_CTXREG_MA0 + unit] ||
- color_combine != imesa->Setup[I810_CTXREG_MC0 + unit])
- {
- I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
- imesa->Setup[I810_CTXREG_MA0 + unit] = alpha_combine;
- imesa->Setup[I810_CTXREG_MC0 + unit] = color_combine;
- }
-}
-
-
-
-
-static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- i810TextureObjectPtr t = (i810TextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- I810_FIREVERTICES(imesa);
- i810SetTexImages( imesa, tObj );
- if (!t->base.memBlock) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
- }
-
- if (tObj->Image[tObj->BaseLevel]->Border > 0) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (imesa->CurrentTexObj[unit] != t) {
- I810_STATECHANGE(imesa, (I810_UPLOAD_TEX0<<unit));
- imesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1U << unit);
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked */
-
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[tObj->BaseLevel]->Format != imesa->TexEnvImageFmt[unit]) {
- imesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format;
- i810UpdateTexEnv( ctx, unit );
- }
- }
- else if (texUnit->_ReallyEnabled) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- }
- else /*if (imesa->CurrentTexObj[unit])*/ {
- imesa->CurrentTexObj[unit] = 0;
- imesa->TexEnvImageFmt[unit] = 0;
- imesa->dirty &= ~(I810_UPLOAD_TEX0<<unit);
- imesa->Setup[I810_CTXREG_MA0 + unit] =
- i810_alpha_combine[unit][I810_DISABLE];
- imesa->Setup[I810_CTXREG_MC0 + unit] =
- i810_color_combine[unit][I810_DISABLE];
- I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
- }
-}
-
-
-void i810UpdateTextureState( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_FALSE );
- i810UpdateTexUnit( ctx, 0 );
- i810UpdateTexUnit( ctx, 1 );
-}
-
-
-
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.c b/xc/lib/GL/mesa/src/drv/i810/i810tris.c
deleted file mode 100644
index 364b57115..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810tris.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "enums.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810tris.h"
-#include "i810state.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) \
- vb[j] = ((GLuint *)v)[j]; \
- vb += vertsize; \
-} while (0)
-#endif
-
-static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1,
- i810VertexPtr v2 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 3 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static void __inline__ i810_draw_quad( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1,
- i810VertexPtr v2,
- i810VertexPtr v3 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 6 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-
-static __inline__ void i810_draw_point( i810ContextPtr imesa,
- i810VertexPtr tmp )
-{
- GLfloat sz = imesa->glCtx->Point._Size * .5;
- int vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- /* Draw a point as a horizontal line.
- */
- *(float *)&vb[0] = tmp->v.x - sz + 0.125;
- for (j = 1 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
- vb += vertsize;
-
- *(float *)&vb[0] = tmp->v.x + sz + 0.125;
- for (j = 1 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
- vb += vertsize;
-}
-
-
-static __inline__ void i810_draw_line( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (0) fprintf(stderr, "hw TRI\n"); \
- if (DO_FALLBACK) \
- imesa->draw_tri( imesa, a, b, c ); \
- else \
- i810_draw_triangle( imesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (0) fprintf(stderr, "hw QUAD\n"); \
- if (DO_FALLBACK) { \
- imesa->draw_tri( imesa, a, b, d ); \
- imesa->draw_tri( imesa, b, c, d ); \
- } else \
- i810_draw_quad( imesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (0) fprintf(stderr, "hw LINE\n"); \
- if (DO_FALLBACK) \
- imesa->draw_line( imesa, v0, v1 ); \
- else \
- i810_draw_line( imesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (0) fprintf(stderr, "hw POINT\n"); \
- if (DO_FALLBACK) \
- imesa->draw_point( imesa, v0 ); \
- else \
- i810_draw_point( imesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define I810_OFFSET_BIT 0x01
-#define I810_TWOSIDE_BIT 0x02
-#define I810_UNFILLED_BIT 0x04
-#define I810_FALLBACK_BIT 0x08
-#define I810_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[I810_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & I810_FALLBACK_BIT)
-#define DO_OFFSET (IND & I810_OFFSET_BIT)
-#define DO_UNFILLED (IND & I810_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & I810_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX i810Vertex
-#define TAB rast_tab
-
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define I810_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define I810_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-
-#define DEPTH_SCALE (1.0/0xffff)
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) I810_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) I810_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (imesa->vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PR_LINES,
- PR_LINES,
- PR_LINES,
- PR_LINES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES
-};
-
-#define RASTERIZE(x) if (imesa->hw_primitive != hw_prim[x]) \
- i810RasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE imesa->render_primitive
-#define TAG(x) x
-#define IND I810_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_UNFILLED_BIT| \
- I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-i810_fallback_tri( i810ContextPtr imesa,
- i810Vertex *v0,
- i810Vertex *v1,
- i810Vertex *v2 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[3];
- i810_translate_vertex( ctx, v0, &v[0] );
- i810_translate_vertex( ctx, v1, &v[1] );
- i810_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-i810_fallback_line( i810ContextPtr imesa,
- i810Vertex *v0,
- i810Vertex *v1 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[2];
- i810_translate_vertex( ctx, v0, &v[0] );
- i810_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-i810_fallback_point( i810ContextPtr imesa,
- i810Vertex *v0 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[1];
- i810_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (i810Vertex *)(vertptr + ((x)<<vertshift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#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) i810RenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertshift = imesa->vertex_stride_shift; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) i810_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) i810_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = imesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
- PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void i810RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint vertshift = imesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-
-#define _I810_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#define POINT_FALLBACK (0)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|\
- DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void i810ChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (I810_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= I810_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= I810_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= I810_UNFILLED_BIT;
- }
-
- imesa->draw_point = i810_draw_point;
- imesa->draw_line = i810_draw_line;
- imesa->draw_tri = i810_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- imesa->draw_point = i810_fallback_point;
-
- if (flags & LINE_FALLBACK)
- imesa->draw_line = i810_fallback_line;
-
- if (flags & TRI_FALLBACK)
- imesa->draw_tri = i810_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !imesa->stipple_in_hw)
- imesa->draw_tri = i810_fallback_tri;
-
- index |= I810_FALLBACK_BIT;
- }
- }
-
- if (imesa->RenderIndex != index) {
- imesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = i810_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = i810_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = i810FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = i810RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = i810RenderClippedPoly;
- }
- }
-}
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in i810render.c.
- */
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- imesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (imesa->reduced_primitive != rprim ||
- hw_prim[prim] != imesa->hw_primitive) {
- i810RasterPrimitive( ctx, rprim, hw_prim[prim] );
- }
-}
-
-static void i810RunPipeline( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (imesa->new_state) {
- if (imesa->new_state & _NEW_TEXTURE)
- i810UpdateTextureState( ctx ); /* may modify imesa->new_state */
-
- if (!imesa->Fallback) {
- if (imesa->new_state & _I810_NEW_VERTEX)
- i810ChooseVertexState( ctx );
-
- if (imesa->new_state & _I810_NEW_RENDERSTATE)
- i810ChooseRenderState( ctx );
- }
-
- imesa->new_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void i810RenderStart( GLcontext *ctx )
-{
- /* Check for projective textureing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- i810CheckTexSizes( ctx );
-}
-
-static void i810RenderFinish( GLcontext *ctx )
-{
- if (I810_CONTEXT(ctx)->RenderIndex & I810_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-
-/* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-void i810RasterPrimitive( GLcontext *ctx,
- GLenum rprim,
- GLuint hwprim )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint st1 = imesa->Setup[I810_CTXREG_ST1];
- GLuint aa = imesa->Setup[I810_CTXREG_AA];
- GLuint lcs = imesa->Setup[I810_CTXREG_LCS];
-
- st1 &= ~ST1_ENABLE;
- aa &= ~AA_ENABLE;
-
- if (I810_DEBUG & DEBUG_PRIMS) {
- /* Prints reduced prim, and hw prim */
- char *prim_name = "Unknown";
-
- switch(hwprim) {
- case PR_LINES:
- prim_name = "Lines";
- break;
- case PR_LINESTRIP:
- prim_name = "LineStrip";
- break;
- case PR_TRIANGLES:
- prim_name = "Triangles";
- break;
- case PR_TRISTRIP_0:
- prim_name = "TriStrip_0";
- break;
- case PR_TRIFAN:
- prim_name = "TriFan";
- break;
- case PR_POLYGON:
- prim_name = "Polygons";
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s : rprim(%s), hwprim(%s)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim),
- prim_name);
- }
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (ctx->Polygon.StippleFlag)
- st1 |= ST1_ENABLE;
- if (ctx->Polygon.SmoothFlag)
- aa |= AA_ENABLE;
- break;
- case GL_LINES:
- lcs &= ~(LCS_LINEWIDTH_3_0|LCS_LINEWIDTH_0_5);
- lcs |= imesa->LcsLineWidth;
- if (ctx->Line.SmoothFlag) {
- aa |= AA_ENABLE;
- lcs |= LCS_LINEWIDTH_0_5;
- }
- break;
- case GL_POINTS:
- lcs &= ~(LCS_LINEWIDTH_3_0|LCS_LINEWIDTH_0_5);
- lcs |= imesa->LcsPointSize;
- if (ctx->Point.SmoothFlag) {
- aa |= AA_ENABLE;
- lcs |= LCS_LINEWIDTH_0_5;
- }
- break;
- default:
- return;
- }
-
- imesa->reduced_primitive = rprim;
-
- if (st1 != imesa->Setup[I810_CTXREG_ST1] ||
- aa != imesa->Setup[I810_CTXREG_AA] ||
- lcs != imesa->Setup[I810_CTXREG_LCS])
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->hw_primitive = hwprim;
- imesa->Setup[I810_CTXREG_LCS] = lcs;
- imesa->Setup[I810_CTXREG_ST1] = st1;
- imesa->Setup[I810_CTXREG_AA] = aa;
- }
- else if (hwprim != imesa->hw_primitive) {
- I810_STATECHANGE(imesa, 0);
- imesa->hw_primitive = hwprim;
- }
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = imesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = imesa->Fallback;
-
- if (0) fprintf(stderr, "%s old %x bit %x mode %d\n", __FUNCTION__,
- imesa->Fallback, bit, mode );
-
- if (mode) {
- imesa->Fallback |= bit;
- if (oldfallback == 0) {
- I810_FIREVERTICES(imesa);
- if (I810_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %s\n", getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- imesa->RenderIndex = ~0;
- }
- }
- else {
- imesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (I810_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = i810RenderStart;
- tnl->Driver.Render.PrimitiveNotify = i810RenderPrimitive;
- tnl->Driver.Render.Finish = i810RenderFinish;
- tnl->Driver.Render.BuildVertices = i810BuildVertices;
- imesa->new_state |= (_I810_NEW_RENDERSTATE|_I810_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void i810InitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = i810RunPipeline;
- tnl->Driver.Render.Start = i810RenderStart;
- tnl->Driver.Render.Finish = i810RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = i810RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = i810BuildVertices;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.h b/xc/lib/GL/mesa/src/drv/i810/i810tris.h
deleted file mode 100644
index 06c8b3fcd..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810tris.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.10 2002/02/22 21:33:04 dawes Exp $ */
-
-#ifndef I810TRIS_INC
-#define I810TRIS_INC
-
-#include "mtypes.h"
-
-extern void i810PrintRenderState( const char *msg, GLuint state );
-extern void i810InitTriFuncs( GLcontext *ctx );
-extern void i810RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810vb.c b/xc/lib/GL/mesa/src/drv/i810/i810vb.c
deleted file mode 100644
index ada7f6db8..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810vb.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.c,v 1.13 2003/03/26 20:43:48 tsi Exp $ */
-
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-#include "i810tris.h"
-#include "i810state.h"
-
-
-#define I810_TEX1_BIT 0x1
-#define I810_TEX0_BIT 0x2
-#define I810_RGBA_BIT 0x4
-#define I810_SPEC_BIT 0x8
-#define I810_FOG_BIT 0x10
-#define I810_XYZW_BIT 0x20
-#define I810_PTEX_BIT 0x40
-#define I810_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[I810_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_0 | \
- VF_RGBA_ENABLE | \
- VF_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_0 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define TEX0_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_1 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define TEX1_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_2 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & I810_XYZW_BIT)
-#define DO_RGBA (IND & I810_RGBA_BIT)
-#define DO_SPEC (IND & I810_SPEC_BIT)
-#define DO_FOG (IND & I810_FOG_BIT)
-#define DO_TEX0 (IND & I810_TEX0_BIT)
-#define DO_TEX1 (IND & I810_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & I810_PTEX_BIT)
-
-#define VERTEX i810Vertex
-#define VERTEX_COLOR i810_color_t
-#define GET_VIEWPORT_MAT() I810_CONTEXT(ctx)->ViewportMatrix.m
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() I810_CONTEXT(ctx)->Setup[I810_CTXREG_VF]
-#define GET_VERTEX_STORE() I810_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() I810_CONTEXT(ctx)->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &I810_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &I810_CONTEXT(ctx)->UbyteSecondaryColor
-#define INVALIDATE_STORED_VERTICES()
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS GLfloat h = I810_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z * (float)0xffff
-
-#define PTEX_FALLBACK() FALLBACK(I810_CONTEXT(ctx), I810_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS i810_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS i810_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) i810_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT|I810_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|\
- I810_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT|I810_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-void i810PrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & I810_XYZW_BIT) ? " xyzw," : "",
- (flags & I810_RGBA_BIT) ? " rgba," : "",
- (flags & I810_SPEC_BIT) ? " spec," : "",
- (flags & I810_FOG_BIT) ? " fog," : "",
- (flags & I810_TEX0_BIT) ? " tex-0," : "",
- (flags & I810_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-
-void i810CheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT( ctx );
-
- if (!setup_tab[imesa->SetupIndex].check_tex_sizes(ctx)) {
- /* Invalidate stored verts
- */
- imesa->SetupNewInputs = ~0;
- imesa->SetupIndex |= I810_PTEX_BIT;
-
- if (!imesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[imesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[imesa->SetupIndex].copy_pv;
- }
- if (imesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- }
- }
-}
-
-void i810BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)imesa->verts + (start<<imesa->vertex_stride_shift));
- GLuint stride = 1<<imesa->vertex_stride_shift;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- newinputs |= imesa->SetupNewInputs;
- imesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= I810_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= I810_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= I810_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= I810_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= I810_FOG_BIT;
-
- if (imesa->SetupIndex & I810_PTEX_BIT)
- ind = ~0;
-
- ind &= imesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void i810ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint ind = I810_XYZW_BIT|I810_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= I810_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= I810_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= I810_TEX1_BIT|I810_TEX0_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= I810_TEX0_BIT;
-
- imesa->SetupIndex = ind;
-
- if (I810_DEBUG & (DEBUG_VERTS|DEBUG_STATE))
- i810PrintSetupFlags( __FUNCTION__, ind );
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = i810_interp_extras;
- tnl->Driver.Render.CopyPV = i810_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != imesa->Setup[I810_CTXREG_VF]) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_VF] = setup_tab[ind].vertex_format;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-
-void i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint vertex_size = imesa->vertex_size * 4;
- GLuint *dest = i810AllocDmaLow( imesa, (count-start) * vertex_size);
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-}
-
-
-
-void i810InitVB( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- imesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void i810FreeVB( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- if (imesa->verts) {
- ALIGN_FREE(imesa->verts);
- imesa->verts = 0;
- }
-
- if (imesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(imesa->UbyteSecondaryColor.Ptr);
- imesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (imesa->UbyteColor.Ptr) {
- ALIGN_FREE(imesa->UbyteColor.Ptr);
- imesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810vb.h b/xc/lib/GL/mesa/src/drv/i810/i810vb.h
deleted file mode 100644
index 30e58357e..000000000
--- a/xc/lib/GL/mesa/src/drv/i810/i810vb.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.h,v 1.4 2002/02/22 21:33:04 dawes Exp $ */
-
-#ifndef I810VB_INC
-#define I810VB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _I810_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void i810ChooseVertexState( GLcontext *ctx );
-extern void i810CheckTexSizes( GLcontext *ctx );
-extern void i810BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void i810_translate_vertex( GLcontext *ctx,
- const i810Vertex *src,
- SWvertex *dst );
-
-extern void i810InitVB( GLcontext *ctx );
-extern void i810FreeVB( GLcontext *ctx );
-
-extern void i810_print_vertex( GLcontext *ctx, const i810Vertex *v );
-extern void i810PrintSetupFlags(char *msg, GLuint flags );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h b/xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h
deleted file mode 100644
index eab109209..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h
+++ /dev/null
@@ -1,675 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
-#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define CMD_3D (0x3<<29)
-
-/* 3DPRIMITIVE, p104 */
-#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
-#define PRIM3D_INDIRECT_SEQ ((1<<23) | PRIM3D_INLINE)
-#define PRIM3D_INDICES ((1<<23) | PRIM3D_INLINE | (1<<17))
-
-#define PRIM3D_INLINE_CNT(used) ((used / 4) - 2)
-#define PRIM3D_INDICES_CNT(num_indices) ((num_indices + 1) / 2)
-#define PRIM3D_INDIRECT_CNT(verts) (verts)
-
-#define PRIM3D_TRILIST 0
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-
-/* STATE3D_ANTI_ALIASING, p 123 */
-#define STATE3D_AA_CMD (CMD_3D | (0x06<<24))
-
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-
-#define AA_LINE_ENABLE ((1<<1) | 1)
-#define AA_LINE_DISABLE (1<<1)
-
-/* STATE3D_BUFFER_INFO, p 124 */
-#define STATE3D_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) ((x)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-/* STATE3D_COLOR_FACTOR_0, p127 */
-#define STATE3D_COLOR_FACTOR_CMD(stage) (CMD_3D | (0x1d<<24) | ((0x90 + (stage))<<16))
-
-/* STATE3D_CONSTANT_BLEND_COLOR, p128 */
-#define STATE3D_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-/* STATE3D_DEFAULT_DIFFUSE, p128 */
-#define STATE3D_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-/* STATE3D_DEFAULT_SPECULAR, p129 */
-#define STATE3D_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-/* STATE3D_DEFAULT_Z, p129 */
-#define STATE3D_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-/* STATE3D_DEST_BUFFER_VARIABLES, p130 */
-#define STATE3D_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_IS_Z 0
-#define DEPTH_IS_W (1<<6)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 0
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-/* STATE3D_DRAWING_RECTANGLE, p133 */
-#define STATE3D_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-/* STATE3D_ENABLES_1, p136 */
-#define STATE3D_ENABLES_1_CMD (CMD_3D|(0x3<<24))
-#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22))
-#define ENABLE_LOGIC_OP ((1<<23)|(1<<22))
-#define DISABLE_LOGIC_OP (1<<23)
-#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_TEST (1<<21)
-#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10))
-#define DISABLE_DEPTH_BIAS (1<<11)
-#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8))
-#define ENABLE_SPEC_ADD ((1<<9)|(1<<8))
-#define DISABLE_SPEC_ADD (1<<9)
-#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6))
- /* prefixed I830 because ENABLE_FOG defined elsewhere */
-#define I830_ENABLE_FOG ((1<<7)|(1<<6))
-#define I830_DISABLE_FOG (1<<7)
-#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4))
-#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4))
-#define DISABLE_ALPHA_TEST (1<<5)
-#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2))
-#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2))
-#define DISABLE_COLOR_BLEND (1<<3)
-#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1)
-#define ENABLE_DEPTH_TEST ((1<<1)|1)
-#define DISABLE_DEPTH_TEST (1<<1)
-
-/* STATE3D_ENABLES_2, p138 */
-#define STATE3D_ENABLES_2_CMD (CMD_3D|(0x4<<24))
-#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_WRITE (1<<21)
-#define ENABLE_TEX_CACHE ((1<<17)|(1<<16))
-#define DISABLE_TEX_CACHE (1<<17)
-#define ENABLE_DITHER ((1<<9)|(1<<8))
-#define DISABLE_DITHER (1<<9)
-#define ENABLE_COLOR_MASK (1<<10)
-#define WRITEMASK_ALPHA (1<<7)
-#define WRITEMASK_ALPHA_SHIFT 7
-#define WRITEMASK_RED (1<<6)
-#define WRITEMASK_RED_SHIFT 6
-#define WRITEMASK_GREEN (1<<5)
-#define WRITEMASK_GREEN_SHIFT 5
-#define WRITEMASK_BLUE (1<<4)
-#define WRITEMASK_BLUE_SHIFT 4
-#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7))
-#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2))
-#define DISABLE_COLOR_WRITE (1<<3)
-#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3
-#define ENABLE_DEPTH_WRITE ((1<<1)|1)
-#define DISABLE_DEPTH_WRITE (1<<1)
-
-/* STATE3D_FOG_COLOR, p139 */
-#define STATE3D_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* STATE3D_FOG_MODE, p140 */
-#define STATE3D_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FOGFUNC_ENABLE (1<<31)
-#define FOGFUNC_VERTEX 0
-#define FOGFUNC_PIXEL_EXP (1<<28)
-#define FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FOGSRC_INDEX_Z (1<<27)
-#define FOGSRC_INDEX_W ((1<<27)|(1<<25))
-#define FOG_LINEAR_CONST (1<<24)
-#define FOG_CONST_1(x) ((x)<<4)
-#define ENABLE_FOG_DENSITY (1<<23)
-/* Dword 2 */
-#define FOG_CONST_2(x) (x)
-/* Dword 3 */
-#define FOG_DENSITY(x) (x)
-
-/* STATE3D_INDEPENDENT_ALPHA_BLEND, p142 */
-#define STATE3D_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22))
-#define DISABLE_INDPT_ALPHA_BLEND (1<<23)
-#define ALPHA_BLENDFUNC_MASK 0x3f0000
-#define ENABLE_ALPHA_BLENDFUNC (1<<21)
-#define ABLENDFUNC_ADD 0
-#define ABLENDFUNC_SUB (1<<16)
-#define ABLENDFUNC_RVSE_SUB (2<<16)
-#define ABLENDFUNC_MIN (3<<16)
-#define ABLENDFUNC_MAX (4<<16)
-#define SRC_DST_ABLEND_MASK 0xfff
-#define ENABLE_SRC_ABLEND_FACTOR (1<<11)
-#define SRC_ABLEND_FACT(x) ((x)<<6)
-#define ENABLE_DST_ABLEND_FACTOR (1<<5)
-#define DST_ABLEND_FACT(x) (x)
-
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-
-/* STATE3D_MAP_BLEND_ARG, p152 */
-#define STATE3D_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
-
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#define TEXBLEND_ARG0 0
-#define TEXBLEND_ARG1 (1<<15)
-#define TEXBLEND_ARG2 (2<<15)
-#define TEXBLEND_ARG3 (3<<15)
-#define TEXBLENDARG_MODIFY_PARMS (1<<6)
-#define TEXBLENDARG_REPLICATE_ALPHA (1<<5)
-#define TEXBLENDARG_INV_ARG (1<<4)
-#define TEXBLENDARG_ONE 0
-#define TEXBLENDARG_FACTOR 0x01
-#define TEXBLENDARG_ACCUM 0x02
-#define TEXBLENDARG_DIFFUSE 0x03
-#define TEXBLENDARG_SPEC 0x04
-#define TEXBLENDARG_CURRENT 0x05
-#define TEXBLENDARG_TEXEL0 0x06
-#define TEXBLENDARG_TEXEL1 0x07
-#define TEXBLENDARG_TEXEL2 0x08
-#define TEXBLENDARG_TEXEL3 0x09
-#define TEXBLENDARG_FACTOR_N 0x0e
-
-/* STATE3D_MAP_BLEND_OP, p155 */
-#define STATE3D_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20))
-#if 0
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#endif
-#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17)
-#define TEXOP_OUTPUT_CURRENT 0
-#define TEXOP_OUTPUT_ACCUM (1<<15)
-#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11))
-#define DISABLE_TEX_CNTRL_STAGE (1<<12)
-#define TEXOP_SCALE_SHIFT 9
-#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT)
-#define TEXOP_MODIFY_PARMS (1<<8)
-#define TEXOP_LAST_STAGE (1<<7)
-#define TEXBLENDOP_KILLPIXEL 0x02
-#define TEXBLENDOP_ARG1 0x01
-#define TEXBLENDOP_ARG2 0x02
-#define TEXBLENDOP_MODULATE 0x03
-#define TEXBLENDOP_ADD 0x06
-#define TEXBLENDOP_ADDSIGNED 0x07
-#define TEXBLENDOP_BLEND 0x08
-#define TEXBLENDOP_BLEND_AND_ADD 0x09
-#define TEXBLENDOP_SUBTRACT 0x0a
-#define TEXBLENDOP_DOT3 0x0b
-#define TEXBLENDOP_DOT4 0x0c
-#define TEXBLENDOP_MODULATE_AND_ADD 0x0d
-#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e
-#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f
-
-/* STATE3D_MAP_BUMP_TABLE, p160 TODO */
-/* STATE3D_MAP_COLOR_CHROMA_KEY, p161 TODO */
-
-/* STATE3D_MAP_COORD_SET_BINDINGS, p162 */
-#define STATE3D_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16))
-#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12))
-#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4))
-#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1)
-
-#define TEXBIND_SET3(x) ((x)<<12)
-#define TEXBIND_SET2(x) ((x)<<8)
-#define TEXBIND_SET1(x) ((x)<<4)
-#define TEXBIND_SET0(x) (x)
-
-#define TEXCOORDSRC_KEEP 0
-#define TEXCOORDSRC_DEFAULT 0x01
-#define TEXCOORDSRC_VTXSET_0 0x08
-#define TEXCOORDSRC_VTXSET_1 0x09
-#define TEXCOORDSRC_VTXSET_2 0x0a
-#define TEXCOORDSRC_VTXSET_3 0x0b
-#define TEXCOORDSRC_VTXSET_4 0x0c
-#define TEXCOORDSRC_VTXSET_5 0x0d
-#define TEXCOORDSRC_VTXSET_6 0x0e
-#define TEXCOORDSRC_VTXSET_7 0x0f
-
-#define MAP_UNIT(unit) ((unit)<<16)
-#define MAP_UNIT_MASK (3<<16)
-
-/* STATE3D_MAP_COORD_SETS, p164 */
-#define STATE3D_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19))
-#define ENABLE_TEXCOORD_PARAMS (1<<15)
-#define TEXCOORDS_ARE_NORMAL (1<<14)
-#define TEXCOORDS_ARE_IN_TEXELUNITS 0
-#define TEXCOORDTYPE_CARTESIAN 0
-#define TEXCOORDTYPE_HOMOGENEOUS (1<<11)
-#define TEXCOORDTYPE_VECTOR (2<<11)
-#define ENABLE_ADDR_V_CNTL (1<<7)
-#define ENABLE_ADDR_U_CNTL (1<<3)
-#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4)
-#define TEXCOORD_ADDR_U_MODE(x) (x)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP 2
-#define TEXCOORDMODE_WRAP_SHORTEST 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORD_ADDR_V_MASK 0x70
-#define TEXCOORD_ADDR_U_MASK 0x7
-
-/* STATE3D_MAP_CUBE, p168 TODO */
-#define STATE3D_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19))
-#define CUBE_NEGX_ENABLE (1<<5)
-#define CUBE_POSX_ENABLE (1<<4)
-#define CUBE_NEGY_ENABLE (1<<3)
-#define CUBE_POSY_ENABLE (1<<2)
-#define CUBE_NEGZ_ENABLE (1<<1)
-#define CUBE_POSZ_ENABLE (1<<0)
-
-
-/* STATE3D_MODES_1, p190 */
-#define STATE3D_MODES_1_CMD (CMD_3D|(0x08<<24))
-#define BLENDFUNC_MASK 0x3f0000
-#define ENABLE_COLR_BLND_FUNC (1<<21)
-#define BLENDFUNC_ADD 0
-#define BLENDFUNC_SUB (1<<16)
-#define BLENDFUNC_RVRSE_SUB (2<<16)
-#define BLENDFUNC_MIN (3<<16)
-#define BLENDFUNC_MAX (4<<16)
-#define SRC_DST_BLND_MASK 0xfff
-#define ENABLE_SRC_BLND_FACTOR (1<<11)
-#define ENABLE_DST_BLND_FACTOR (1<<5)
-#define SRC_BLND_FACT(x) ((x)<<6)
-#define DST_BLND_FACT(x) (x)
-
-/* Use the blendfact defines for BLND_FACTOR macros */
-#if 0
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#endif
-
-/* STATE3D_MODES_2, p192 */
-#define STATE3D_MODES_2_CMD (CMD_3D|(0x0f<<24))
-#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22)
-#define GLOBAL_DEPTH_BIAS(x) ((x)<<14)
-#define ENABLE_ALPHA_TEST_FUNC (1<<13)
-#define ENABLE_ALPHA_REF_VALUE (1<<8)
-#define ALPHA_TEST_FUNC(x) ((x)<<9)
-#define ALPHA_REF_VALUE(x) (x)
-
-#define ALPHA_TEST_REF_MASK 0x3fff
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-/* STATE3D_MODES_3, p193 */
-#define STATE3D_MODES_3_CMD (CMD_3D|(0x02<<24))
-#define DEPTH_TEST_FUNC_MASK 0x1f0000
-#define ENABLE_DEPTH_TEST_FUNC (1<<20)
-/* Uses COMPAREFUNC */
-#define DEPTH_TEST_FUNC(x) ((x)<<16)
-#define ENABLE_ALPHA_SHADE_MODE (1<<11)
-#define ENABLE_FOG_SHADE_MODE (1<<9)
-#define ENABLE_SPEC_SHADE_MODE (1<<7)
-#define ENABLE_COLOR_SHADE_MODE (1<<5)
-#define ALPHA_SHADE_MODE(x) ((x)<<10)
-#define FOG_SHADE_MODE(x) ((x)<<8)
-#define SPEC_SHADE_MODE(x) ((x)<<6)
-#define COLOR_SHADE_MODE(x) ((x)<<4)
-#define CULLMODE_MASK 0xf
-#define ENABLE_CULL_MODE (1<<3)
-#define CULLMODE_BOTH 0
-#define CULLMODE_NONE 1
-#define CULLMODE_CW 2
-#define CULLMODE_CCW 3
-
-#define SHADE_MODE_LINEAR 0
-#define SHADE_MODE_FLAT 0x1
-
-/* STATE3D_MODES_4, p195 */
-#define STATE3D_MODES_4_CMD (CMD_3D|(0x16<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) ((x)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) (x)
-
-/* STATE3D_MODES_5, p196 */
-#define STATE3D_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define ENABLE_SPRITE_POINT_TEX (1<<23)
-#define SPRITE_POINT_TEX_ON (1<<22)
-#define SPRITE_POINT_TEX_OFF 0
-#define FLUSH_RENDER_CACHE (1<<18)
-#define FLUSH_TEXTURE_CACHE (1<<16)
-#define FIXED_LINE_WIDTH_MASK 0xfc00
-#define ENABLE_FIXED_LINE_WIDTH (1<<15)
-#define FIXED_LINE_WIDTH(x) ((x)<<10)
-#define FIXED_POINT_WIDTH_MASK 0x3ff
-#define ENABLE_FIXED_POINT_WIDTH (1<<9)
-#define FIXED_POINT_WIDTH(x) (x)
-
-/* STATE3D_RASTERIZATION_RULES, p198 */
-#define STATE3D_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-#define TRI_STRIP_PROVOKE_VRTX(x) (x)
-
-/* STATE3D_SCISSOR_ENABLE, p200 */
-#define STATE3D_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* STATE3D_SCISSOR_RECTANGLE_0, p201 */
-#define STATE3D_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* STATE3D_STENCIL_TEST, p202 */
-#define STATE3D_STENCIL_TEST_CMD (CMD_3D|(0x09<<24))
-#define ENABLE_STENCIL_PARMS (1<<23)
-#define STENCIL_OPS_MASK (0xffc000)
-#define STENCIL_FAIL_OP(x) ((x)<<20)
-#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
-#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
-#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
-#define ENABLE_STENCIL_TEST_FUNC (1<<13)
-/* Uses COMPAREFUNC */
-#define STENCIL_TEST_FUNC(x) ((x)<<9)
-#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff)
-#define ENABLE_STENCIL_REF_VALUE (1<<8)
-#define STENCIL_REF_VALUE(x) (x)
-
-/* STATE3D_VERTEX_FORMAT, p204 */
-#define STATE3D_VERTEX_FORMAT_CMD (CMD_3D|(0x05<<24))
-#define VRTX_HAS_POINT_WIDTH (1<<12)
-#define VRTX_TEX_COORD_COUNT(x) ((x)<<8)
-#define VRTX_HAS_SPEC (1<<7)
-#define VRTX_HAS_DIFFUSE (1<<6)
-#define VRTX_HAS_DEPTH_OFS (1<<5)
-#define VRTX_HAS_XYZ (1<<1)
-#define VRTX_HAS_XYZW (2<<1)
-#define VRTX_HAS_XY (3<<1)
-#define VRTX_HAS_XYW (4<<1)
-
-/* STATE3D_VERTEX_FORMAT_2, p206 */
-#define STATE3D_VERTEX_FORMAT_2_CMD (CMD_3D|(0x0a<<24))
-#define VRTX_TEX_SET_7_FMT(x) ((x)<<14)
-#define VRTX_TEX_SET_6_FMT(x) ((x)<<12)
-#define VRTX_TEX_SET_5_FMT(x) ((x)<<10)
-#define VRTX_TEX_SET_4_FMT(x) ((x)<<8)
-#define VRTX_TEX_SET_3_FMT(x) ((x)<<6)
-#define VRTX_TEX_SET_2_FMT(x) ((x)<<4)
-#define VRTX_TEX_SET_1_FMT(x) ((x)<<2)
-#define VRTX_TEX_SET_0_FMT(x) (x)
-
-#define TEXCOORDFMT_2D 0
-#define TEXCOORDFMT_3D 1
-#define TEXCOORDFMT_4D 2
-#define TEXCOORDFMT_1D 3
-
-/*New stuff picked up along the way */
-
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-
-/* STATE3D_VERTEX_TRANSFORM, p207 */
-#define STATE3D_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0)
-#define STATE3D_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6)
-/* Dword 1 */
-#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28))
-#define DISABLE_PERSP_DIVIDE (1<<29)
-#define VRTX_TRANS_LOAD_MATRICES 0x7421
-#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000
-/* Dword 2 -> 7 are matrix elements */
-
-/* STATE3D_W_STATE, p209 */
-#define STATE3D_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1)
-/* Dword 1 */
-#define MAGIC_W_STATE_DWORD1 0x00000008
-/* Dword 2 */
-#define WFAR_VALUE(x) (x)
-
-/* if defining I830_ENABLE_4_TEXTURES, do it in i830_drm.h, too */
-
-#define I830PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define I830PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define I830PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define I830PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-/* Stipple command, carried over from the i810, apparently:
- */
-#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-
-
-#define STATE3D_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16))
-#define LOAD_TEXTURE_MAP0 (1<<11)
-
-#define TM0S0_ADDRESS_MASK 0xfffffffc
-#define TM0S0_USE_FENCE (1<<1)
-
-#define TM0S1_HEIGHT_SHIFT 21
-#define TM0S1_WIDTH_SHIFT 10
-#define TM0S1_PALETTE_SELECT (1<<9)
-#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6)
-#define TM0S1_MAPSURF_FORMAT_SHIFT 6
-#define MAPSURF_8BIT_INDEXED (0<<6)
-#define MAPSURF_8BIT (1<<6)
-#define MAPSURF_16BIT (2<<6)
-#define MAPSURF_32BIT (3<<6)
-#define MAPSURF_411 (4<<6)
-#define MAPSURF_422 (5<<6)
-#define MAPSURF_COMPRESSED (6<<6)
-#define MAPSURF_4BIT_INDEXED (7<<6)
-#define TM0S1_MT_FORMAT_MASK (0x7 << 3)
-#define TM0S1_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */
-#define MT_8BIT_IDX_ARGB1555 (1<<3)
-#define MT_8BIT_IDX_ARGB4444 (2<<3)
-#define MT_8BIT_IDX_AY88 (3<<3)
-#define MT_8BIT_IDX_ABGR8888 (4<<3)
-#define MT_8BIT_IDX_BUMP_88DVDU (5<<3)
-#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3)
-#define MT_8BIT_IDX_ARGB8888 (7<<3)
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_DIB_ARGB1555_8888 (4<<3)
-#define MT_16BIT_BUMP_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_DIB_RGB565_8888 (7<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
-#define MT_32BIT_DIB_8888 (7<<3)
-#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define TM0S1_COLORSPACE_CONVERSION (1 << 2)
-#define TM0S1_TILED_SURFACE (1 << 1)
-#define TM0S1_TILE_WALK (1 << 0)
-
-#define TM0S2_PITCH_SHIFT 21
-#define TM0S2_CUBE_FACE_ENA_SHIFT 15
-#define TM0S2_MAP_FORMAT (1<<14)
-#define TM0S2_VERTICAL_LINE_STRIDE (1<<13)
-#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12)
-#define TM0S2_OUTPUT_CHAN_SHIFT 10
-#define TM0S2_OUTPUT_CHAN_MASK (3<<10)
-
-#define TM0S3_MIP_FILTER_MASK (0x3<<30)
-#define TM0S3_MIP_FILTER_SHIFT 30
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define TM0S3_MAG_FILTER_MASK (0x3<<28)
-#define TM0S3_MAG_FILTER_SHIFT 28
-#define TM0S3_MIN_FILTER_MASK (0x3<<26)
-#define TM0S3_MIN_FILTER_SHIFT 26
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-
-#define TM0S3_LOD_BIAS_SHIFT 17
-#define TM0S3_LOD_BIAS_MASK (0x1ff<<17)
-#define TM0S3_MAX_MIP_SHIFT 9
-#define TM0S3_MAX_MIP_MASK (0xff<<9)
-#define TM0S3_MIN_MIP_SHIFT 3
-#define TM0S3_MIN_MIP_MASK (0x3f<<3)
-#define TM0S3_KILL_PIXEL (1<<2)
-#define TM0S3_KEYED_FILTER (1<<1)
-#define TM0S3_CHROMA_KEY (1<<0)
-
-
-/* STATE3D_MAP_TEXEL_STREAM, p188 */
-#define STATE3D_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19))
-#define DISABLE_TEX_STREAM_BUMP (1<<12)
-#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11))
-#define TEX_MODIFY_UNIT_0 0
-#define TEX_MODIFY_UNIT_1 (1<<8)
-#define ENABLE_TEX_STREAM_COORD_SET (1<<7)
-#define TEX_STREAM_COORD_SET(x) ((x)<<4)
-#define ENABLE_TEX_STREAM_MAP_IDX (1<<3)
-#define TEX_STREAM_MAP_IDX(x) (x)
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_context.c b/xc/lib/GL/mesa/src/drv/i830/i830_context.c
deleted file mode 100644
index 254fa2846..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_context.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/**************************************************************************
- *
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * **************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.c,v 1.9 2003/02/06 04:18:00 dawes Exp $ */
-
-/*
- * Authors:
- * Jeff Hartmann <jhartmann@2d3d.com>
- * Graeme Fisher <graeme@2d3d.co.za>
- * Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Heavily Based on I810 driver written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_span.h"
-#include "i830_tris.h"
-#include "i830_vb.h"
-#include "i830_ioctl.h"
-
-
-#include "utils.h"
-#ifndef I830_DEBUG
-int I830_DEBUG = (0);
-#endif
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-#define DRIVER_DATE "20021115"
-
-static const GLubyte *i830DDGetString( GLcontext *ctx, GLenum name )
-{
- const char * chipset;
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
- case PCI_CHIP_845_G:
- return (GLubyte *)"2d3D, Inc";
-
- case PCI_CHIP_I830_M:
- return (GLubyte *)"VA Linux, Inc";
-
- case PCI_CHIP_I855_GM:
- case PCI_CHIP_I865_G:
- default:
- return (GLubyte *)"Tungsten Graphics, Inc";
- }
- break;
-
- case GL_RENDERER:
- switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
- case PCI_CHIP_845_G:
- chipset = "Intel(R) 845G"; break;
- case PCI_CHIP_I830_M:
- chipset = "Intel(R) 830M"; break;
- case PCI_CHIP_I855_GM:
- chipset = "Intel(R) 852GM/855GM"; break;
- case PCI_CHIP_I865_G:
- chipset = "Intel(R) 865G"; break;
- default:
- chipset = "Unknown Intel Chipset"; break;
- }
-
- (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- }
-}
-
-static void i830BufferSize(GLframebuffer *buffer,
- GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(imesa);
- *width = imesa->driDrawable->w;
- *height = imesa->driDrawable->h;
- UNLOCK_HARDWARE(imesa);
-}
-
-
-/* Extension strings exported by the i830 driver.
- */
-static const char * const card_extensions[] =
-{
- "GL_ARB_multisample",
- "GL_ARB_multitexture",
- "GL_ARB_texture_border_clamp",
- "GL_ARB_texture_compression",
- "GL_ARB_texture_env_add",
- "GL_ARB_texture_env_combine",
- "GL_ARB_texture_env_dot3",
- "GL_ARB_texture_mirrored_repeat",
- "GL_EXT_blend_color",
- "GL_EXT_blend_func_separate",
- "GL_EXT_blend_minmax",
- "GL_EXT_blend_subtract",
- "GL_EXT_fog_coord",
- "GL_EXT_secondary_color",
- "GL_EXT_stencil_wrap",
- "GL_EXT_texture_edge_clamp",
- "GL_EXT_texture_env_add",
- "GL_EXT_texture_env_combine",
- "GL_EXT_texture_env_dot3",
- "GL_EXT_texture_filter_anisotropic",
- "GL_EXT_texture_lod_bias",
- "GL_IBM_texture_mirrored_repeat",
- "GL_INGR_blend_func_separate",
- "GL_MESA_ycbcr_texture",
- "GL_NV_texture_rectangle",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_border_clamp",
- "GL_SGIS_texture_edge_clamp",
- NULL
-};
-
-
-extern const struct gl_pipeline_stage _i830_render_stage;
-
-static const struct gl_pipeline_stage *i830_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 1
- &_i830_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { NULL, 0 }
-};
-
-
-GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx , *shareCtx;
- i830ContextPtr imesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- i830ScreenPrivate *screen = (i830ScreenPrivate *)sPriv->private;
- I830SAREAPtr saPriv=(I830SAREAPtr)
- (((GLubyte *)sPriv->pSAREA)+screen->sarea_priv_offset);
-
- /* Allocate i830 context */
- imesa = (i830ContextPtr) CALLOC_STRUCT(i830_context_t);
- if (!imesa) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((i830ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void*) imesa, GL_TRUE);
- if (!imesa->glCtx) {
- FREE(imesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = imesa;
-
-
- imesa->i830Screen = screen;
- imesa->driScreen = sPriv;
- imesa->sarea = saPriv;
- imesa->glBuffer = NULL;
-
-
- (void) memset( imesa->texture_heaps, 0, sizeof( imesa->texture_heaps ) );
- make_empty_list( & imesa->swapped );
-
- imesa->nr_heaps = 1;
- imesa->texture_heaps[0] = driCreateTextureHeap( 0, imesa,
- screen->textureSize,
- 12,
- I830_NR_TEX_REGIONS,
- imesa->sarea->texList,
- & imesa->sarea->texAge,
- & imesa->swapped,
- sizeof( struct i830_texture_object_t ),
- (destroy_texture_object_t *) i830DestroyTexObj );
-
-
- /* Set the maximum texture size small enough that we can guarantee
- * that both texture units can bind a maximal texture and have them
- * in memory at once.
- */
-
- ctx = imesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
-
- /* FIXME: driCalcualteMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
- */
- driCalculateMaxTextureLevels( imesa->texture_heaps,
- imesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 12,
- GL_FALSE );
-
- ctx->Const.MaxTextureMaxAnisotropy = 2.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 255.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Driver.GetBufferSize = i830BufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = i830DDGetString;
-
- /* Who owns who? */
- ctx->DriverCtx = (void *) imesa;
- imesa->glCtx = ctx;
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline: */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, i830_pipeline );
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- /* Dri stuff */
- imesa->hHWContext = driContextPriv->hHWContext;
- imesa->driFd = sPriv->fd;
- imesa->driHwLock = &sPriv->pSAREA->lock;
- imesa->vertex_format = 0;
-
- imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
-
- switch(mesaVis->depthBits) {
- case 16:
- imesa->depth_scale = 1.0/0xffff;
- imesa->depth_clear_mask = ~0;
- imesa->ClearDepth = 0xffff;
- break;
- case 24:
- imesa->depth_scale = 1.0/0xffffff;
- imesa->depth_clear_mask = 0x00ffffff;
- imesa->stencil_clear_mask = 0xff000000;
- imesa->ClearDepth = 0x00ffffff;
- break;
- case 32: /* Not supported */
- default:
- break;
- }
- /* Completely disable stenciling for now, there are some serious issues
- * with stencil.
- */
-#if 0
- imesa->hw_stencil = 0;
-#endif
-
- imesa->RenderIndex = ~0;
- imesa->dirty = ~0;
- imesa->upload_cliprects = GL_TRUE;
-
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
-
- imesa->do_irqs = (imesa->i830Screen->irq_active &&
- !getenv("I830_NO_IRQS"));
-
- _math_matrix_ctr (&imesa->ViewportMatrix);
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- i830DDInitStateFuncs( ctx );
- i830DDInitTextureFuncs( ctx );
- i830InitTriFuncs (ctx);
- i830DDInitSpanFuncs( ctx );
- i830DDInitIoctlFuncs( ctx );
- i830InitVB (ctx);
- i830DDInitState (ctx);
-
-#if DO_DEBUG
- I830_DEBUG = driParseDebugString( getenv( "I830_DEBUG" ),
- debug_control );
- I830_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
- if (getenv("I830_NO_RAST") ||
- getenv("INTEL_NO_RAST")) {
- fprintf(stderr, "disabling 3D rasterization\n");
- FALLBACK(imesa, I830_FALLBACK_USER, 1);
- }
-
-
- return GL_TRUE;
-}
-
-void i830DestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
-
- assert(imesa); /* should never be null */
- if (imesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext (imesa->glCtx);
- _tnl_DestroyContext (imesa->glCtx);
- _ac_DestroyContext (imesa->glCtx);
- _swrast_DestroyContext (imesa->glCtx);
-
- i830FreeVB (imesa->glCtx);
-
- /* free the Mesa context */
- imesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(imesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & imesa->swapped ) );
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( imesa->texture_heaps[ i ] );
- imesa->texture_heaps[ i ] = NULL;
- }
- }
-
- Xfree (imesa);
- }
-}
-
-void i830XMesaSetFrontClipRects( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
-
- i830EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-void i830XMesaSetBackClipRects( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0) {
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
- } else {
- imesa->numClipRects = dPriv->numBackClipRects;
- imesa->pClipRects = dPriv->pBackClipRects;
- imesa->drawX = dPriv->backX;
- imesa->drawY = dPriv->backY;
- }
-
- i830EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-static void i830XMesaWindowMoved( i830ContextPtr imesa )
-{
- switch (imesa->glCtx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
- i830XMesaSetFrontClipRects( imesa );
- break;
- case BACK_LEFT_BIT:
- i830XMesaSetBackClipRects( imesa );
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- i830XMesaSetFrontClipRects( imesa );
- }
-}
-
-GLboolean i830UnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
- if (imesa) {
- /* Might want to change this so texblend isn't always updated */
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_STIPPLE |
- I830_UPLOAD_TEXBLEND0 |
- I830_UPLOAD_TEXBLEND1);
-
- if (imesa->CurrentTexObj[0]) imesa->dirty |= I830_UPLOAD_TEX0;
- if (imesa->CurrentTexObj[1]) imesa->dirty |= I830_UPLOAD_TEX1;
- }
- return GL_TRUE;
-}
-
-GLboolean i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
-
- if (driContextPriv) {
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
-
- if ( imesa->driDrawable != driDrawPriv ) {
- /* Shouldn't the readbuffer be stored also? */
- imesa->driDrawable = driDrawPriv;
- i830XMesaWindowMoved( imesa );
- }
-
- _mesa_make_current2(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- if (!imesa->glCtx->Viewport.Width)
- _mesa_set_viewport(imesa->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- } else {
- _mesa_make_current(0,0);
- }
-
- return GL_TRUE;
-}
-
-void i830GetLock( i830ContextPtr imesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- __DRIscreenPrivate *sPriv = imesa->driScreen;
- I830SAREAPtr sarea = imesa->sarea;
- int me = imesa->hHWContext;
- unsigned i;
-
- drmGetLock(imesa->driFd, imesa->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv);
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
-
- if (sarea->ctxOwner != me) {
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_STIPPLE);
-
- if(imesa->CurrentTexObj[0]) imesa->dirty |= I830_UPLOAD_TEX0;
- if(imesa->CurrentTexObj[1]) imesa->dirty |= I830_UPLOAD_TEX1;
- if(imesa->TexBlendWordsUsed[0]) imesa->dirty |= I830_UPLOAD_TEXBLEND0;
- if(imesa->TexBlendWordsUsed[1]) imesa->dirty |= I830_UPLOAD_TEXBLEND1;
-
- sarea->perf_boxes = imesa->perf_boxes | I830_BOX_LOST_CONTEXT;
- sarea->ctxOwner = me;
- }
-
- /* Shared texture managment - if another client has played with
- * texture space, figure out which if any of our textures have been
- * ejected, and update our global LRU.
- */
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( imesa->texture_heaps[ i ] );
- }
-
- if (imesa->lastStamp != dPriv->lastStamp) {
- i830XMesaWindowMoved( imesa );
- imesa->lastStamp = dPriv->lastStamp;
- }
-
- sarea->last_quiescent = -1; /* just kill it for now */
-}
-
-void i830SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- i830ContextPtr imesa;
- GLcontext *ctx;
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = imesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( 0 /*imesa->doPageFlip*/ ) { /* doPageFlip is never set !!! */
- i830PageFlip( dPriv );
- } else {
- i830CopyBuffer( dPriv );
- }
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_context.h b/xc/lib/GL/mesa/src/drv/i830/i830_context.h
deleted file mode 100644
index 2bb71cb71..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_context.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i830
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/* Adapted for use in the I830M driver:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.h,v 1.7 2003/02/06 04:18:01 dawes Exp $ */
-
-#ifndef I830CONTEXT_INC
-#define I830CONTEXT_INC
-
-typedef struct i830_context_t i830Context;
-typedef struct i830_context_t *i830ContextPtr;
-typedef struct i830_texture_object_t *i830TextureObjectPtr;
-
-
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_tex.h"
-
-#define TAG(x) i830##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-#define DV_PF_555 (1<<8)
-#define DV_PF_565 (2<<8)
-#define DV_PF_8888 (3<<8)
-
-#define I830_TEX_MAXLEVELS 10
-
-#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
-#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
-
-
-typedef void (*i830_tri_func)(i830ContextPtr, i830Vertex *, i830Vertex *,
- i830Vertex *);
-typedef void (*i830_line_func)(i830ContextPtr, i830Vertex *, i830Vertex *);
-typedef void (*i830_point_func)(i830ContextPtr, i830Vertex *);
-
-#define I830_FALLBACK_TEXTURE 0x1
-#define I830_FALLBACK_DRAW_BUFFER 0x2
-#define I830_FALLBACK_READ_BUFFER 0x4
-#define I830_FALLBACK_COLORMASK 0x8
-#define I830_FALLBACK_RENDERMODE 0x10
-#define I830_FALLBACK_STENCIL 0x20
-#define I830_FALLBACK_STIPPLE 0x40
-#define I830_FALLBACK_USER 0x80
-
-struct i830_context_t
-{
- GLint refcount;
- GLcontext *glCtx;
-
- /*From I830 stuff*/
- int TextureMode;
- GLuint renderindex;
- GLuint TexBlendWordsUsed[I830_TEXBLEND_COUNT];
- GLuint TexBlend[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
- GLuint Init_TexBlend[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
- GLuint Init_TexBlendWordsUsed[I830_TEXBLEND_COUNT];
- GLuint Init_TexBlendColorPipeNum[I830_TEXBLEND_COUNT];
- GLuint TexBlendColorPipeNum[I830_TEXBLEND_COUNT];
- GLuint Init_BufferSetup[I830_DEST_SETUP_SIZE];
- GLuint LodBias[2];
-
- GLenum palette_format;
- GLuint palette[256];
-
-
- GLuint Init_Setup[I830_CTX_SETUP_SIZE];
- GLuint vertex_prim;
- drmBufPtr vertex_dma_buffer;
-
- GLboolean mask_red;
- GLboolean mask_green;
- GLboolean mask_blue;
- GLboolean mask_alpha;
-
- GLubyte clear_red;
- GLubyte clear_green;
- GLubyte clear_blue;
- GLubyte clear_alpha;
-
- GLfloat depth_scale;
- int depth_clear_mask;
- int stencil_clear_mask;
- int ClearDepth;
- int hw_stencil;
-
- GLuint MonoColor;
-
- GLuint LastTexEnabled;
- GLuint TexEnabledMask;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[1];
- driTextureObject swapped;
-
- struct i830_texture_object_t *CurrentTexObj[2];
-
- /* Rasterization and vertex state:
- */
- GLuint Fallback;
- GLuint NewGLState;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* State for i830vb.c and i830tris.c.
- */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint hw_primitive;
- GLuint vertex_format;
- char *verts;
-
- drmBufPtr vertex_buffer;
- char *vertex_addr;
- GLuint vertex_low;
- GLuint vertex_high;
- GLuint vertex_last_prim;
-
- GLboolean upload_cliprects;
-
-
- /* Fallback rasterization functions
- */
- i830_point_func draw_point;
- i830_line_func draw_line;
- i830_tri_func draw_tri;
-
- /* Hardware state
- */
- GLuint dirty; /* I810_UPLOAD_* */
- GLuint Setup[I830_CTX_SETUP_SIZE];
- GLuint BufferSetup[I830_DEST_SETUP_SIZE];
- GLuint StippleSetup[I830_STP_SETUP_SIZE];
- int vertex_size;
- int vertex_stride_shift;
- unsigned int lastStamp;
- GLboolean hw_stipple;
-
- GLenum TexEnvImageFmt[2];
-
- /* State which can't be computed completely on the fly:
- */
- GLuint LcsCullMode;
- GLuint LcsLineWidth;
- GLuint LcsPointSize;
-
- /* Funny mesa mirrors
- */
- GLuint ClearColor;
-
- /* DRI stuff
- */
- GLuint needClip;
- GLframebuffer *glBuffer;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- XF86DRIClipRectPtr pClipRects;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int perf_boxes;
-
- int do_irqs;
-
- GLboolean scissor;
- XF86DRIClipRectRec draw_rect;
- XF86DRIClipRectRec scissor_rect;
-
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- i830ScreenPrivate *i830Screen;
- I830SAREAPtr sarea;
-};
-
-
-#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
-#define VALID_I830_TEXTURE_OBJECT(tobj) (tobj)
-
-#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
-#define I830_DRIVER_DATA(vb) ((i830VertexBufferPtr)((vb)->driver_data))
-#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( imesa ) \
-do { \
- char __ret=0; \
- DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
- (DRM_LOCK_HELD|imesa->hHWContext), __ret); \
- if (__ret) \
- i830GetLock( imesa, 0 ); \
-}while (0)
-
-
- /* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(imesa) \
-do { \
- imesa->perf_boxes |= imesa->sarea->perf_boxes; \
- DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext); \
-} while (0)
-
- /* This is the wrong way to do it, I'm sure. Otherwise the drm
- * bitches that I've already got the heavyweight lock. At worst,
- * this is 3 ioctls. The best solution probably only gets me down
- * to 2 ioctls in the worst case.
- */
-#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
- LOCK_HARDWARE( imesa ); \
- i830RegetLockQuiescent( imesa ); \
-} while(0)
-
-
-
-extern void i830GetLock(i830ContextPtr imesa, GLuint flags);
-extern void i830EmitHwStateLocked(i830ContextPtr imesa);
-extern void i830EmitDrawingRectangle(i830ContextPtr imesa);
-extern void i830XMesaSetBackClipRects(i830ContextPtr imesa);
-extern void i830XMesaSetFrontClipRects(i830ContextPtr imesa);
-extern void i830DDExtensionsInit(GLcontext *ctx);
-extern void i830DDInitDriverFuncs(GLcontext *ctx);
-extern void i830DDUpdateHwState(GLcontext *ctx);
-
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int I830_DEBUG;
-#else
-#define I830_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-
-
-#define PCI_CHIP_845_G 0x2562
-#define PCI_CHIP_I830_M 0x3577
-#define PCI_CHIP_I855_GM 0x3582
-#define PCI_CHIP_I865_G 0x2572
-
-
-#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_debug.c b/xc/lib/GL/mesa/src/drv/i830/i830_debug.c
deleted file mode 100644
index 66c698ba3..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_debug.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_vb.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-#include "i830_debug.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-#define TINY_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX0_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(1) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX1_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D))
-
-#define NON_PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D))
-
-void i830DumpContextState( i830ContextPtr imesa )
-{
- GLuint *Context = imesa->Setup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "STATE1 : 0x%08x\n", Context[I830_CTXREG_STATE1]);
- fprintf(stderr, "STATE2 : 0x%08x\n", Context[I830_CTXREG_STATE2]);
- fprintf(stderr, "STATE3 : 0x%08x\n", Context[I830_CTXREG_STATE3]);
- fprintf(stderr, "STATE4 : 0x%08x\n", Context[I830_CTXREG_STATE4]);
- fprintf(stderr, "STATE5 : 0x%08x\n", Context[I830_CTXREG_STATE5]);
- fprintf(stderr, "IALPHAB : 0x%08x\n", Context[I830_CTXREG_IALPHAB]);
- fprintf(stderr, "STENCILTST : 0x%08x\n", Context[I830_CTXREG_STENCILTST]);
- fprintf(stderr, "ENABLES_1 : 0x%08x\n", Context[I830_CTXREG_ENABLES_1]);
- fprintf(stderr, "ENABLES_2 : 0x%08x\n", Context[I830_CTXREG_ENABLES_2]);
- fprintf(stderr, "AA : 0x%08x\n", Context[I830_CTXREG_AA]);
- fprintf(stderr, "FOGCOLOR : 0x%08x\n", Context[I830_CTXREG_FOGCOLOR]);
- fprintf(stderr, "BCOLOR0 : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR0]);
- fprintf(stderr, "BCOLOR : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR]);
- fprintf(stderr, "VF : 0x%08x\n", Context[I830_CTXREG_VF]);
- fprintf(stderr, "VF2 : 0x%08x\n", Context[I830_CTXREG_VF2]);
- fprintf(stderr, "MCSB0 : 0x%08x\n", Context[I830_CTXREG_MCSB0]);
- fprintf(stderr, "MCSB1 : 0x%08x\n", Context[I830_CTXREG_MCSB1]);
-}
-
-void i830DumpBufferState( i830ContextPtr imesa )
-{
- GLuint *Buffer = imesa->BufferSetup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "CBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_CBUFADDR]);
- fprintf(stderr, "DBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_DBUFADDR]);
- fprintf(stderr, "DV0 : 0x%08x\n", Buffer[I830_DESTREG_DV0]);
- fprintf(stderr, "DV1 : 0x%08x\n", Buffer[I830_DESTREG_DV1]);
- fprintf(stderr, "SENABLE : 0x%08x\n", Buffer[I830_DESTREG_SENABLE]);
- fprintf(stderr, "SR0 : 0x%08x\n", Buffer[I830_DESTREG_SR0]);
- fprintf(stderr, "SR1 : 0x%08x\n", Buffer[I830_DESTREG_SR1]);
- fprintf(stderr, "SR2 : 0x%08x\n", Buffer[I830_DESTREG_SR2]);
- fprintf(stderr, "DR0 : 0x%08x\n", Buffer[I830_DESTREG_DR0]);
- fprintf(stderr, "DR1 : 0x%08x\n", Buffer[I830_DESTREG_DR1]);
- fprintf(stderr, "DR2 : 0x%08x\n", Buffer[I830_DESTREG_DR2]);
- fprintf(stderr, "DR3 : 0x%08x\n", Buffer[I830_DESTREG_DR3]);
- fprintf(stderr, "DR4 : 0x%08x\n", Buffer[I830_DESTREG_DR4]);
-}
-
-void i830DumpStippleState( i830ContextPtr imesa )
-{
- GLuint *Buffer = imesa->BufferSetup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "ST1 : 0x%08x\n", Buffer[I830_STPREG_ST1]);
-}
-
-void i830DumpTextureState( i830ContextPtr imesa, int unit )
-{
- i830TextureObjectPtr t = imesa->CurrentTexObj[unit];
-
- if(t) {
- fprintf(stderr, "%s : unit %d\n", __FUNCTION__, unit);
- fprintf(stderr, "TM0LI : 0x%08x\n", t->Setup[I830_TEXREG_TM0LI]);
- fprintf(stderr, "TM0S0 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S0]);
- fprintf(stderr, "TM0S1 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S1]);
- fprintf(stderr, "TM0S2 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S2]);
- fprintf(stderr, "TM0S3 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S3]);
- fprintf(stderr, "TM0S4 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S4]);
- fprintf(stderr, "NOP0 : 0x%08x\n", t->Setup[I830_TEXREG_NOP0]);
- fprintf(stderr, "NOP1 : 0x%08x\n", t->Setup[I830_TEXREG_NOP1]);
- fprintf(stderr, "NOP2 : 0x%08x\n", t->Setup[I830_TEXREG_NOP2]);
- fprintf(stderr, "MCS : 0x%08x\n", t->Setup[I830_TEXREG_MCS]);
- }
-}
-
-void i830DumpTextureBlendState( i830ContextPtr imesa, int unit )
-{
- GLuint *TexBlend = imesa->TexBlend[unit];
- GLuint length = imesa->TexBlendWordsUsed[unit];
- int i;
-
- fprintf(stderr, "%s : unit %d : length %d\n", __FUNCTION__, unit, length);
- for(i = 0; i < length; i++) {
- fprintf(stderr, "[%d] : 0x%08x\n", i, TexBlend[i]);
- }
-}
-
-void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex )
-{
- I830SAREAPtr sarea = imesa->sarea;
- char *prim_name;
- int size = 0;
- int vfmt_size = 0;
- int hw_nr_vertex = 0;
- int hw_start_vertex = 0;
-
- /* Do a bunch of sanity checks on the vertices sent to the hardware */
-
- size = vertex.used - 4;
- if(imesa->vertex_size && (size % imesa->vertex_size) != 0) {
- fprintf(stderr, "\n\nVertex size does not match imesa "
- "internal state\n");
- fprintf(stderr, "Buffer size : %d\n", size);
- fprintf(stderr, "Vertex size : %d\n", imesa->vertex_size);
- }
-
- /* Check to see if the vertex format is good, and get its size */
- if (sarea->ContextState[I830_CTXREG_VF] == TINY_VERTEX_FORMAT) {
- vfmt_size = 16; /* 4 dwords */
- } else if (sarea->ContextState[I830_CTXREG_VF] ==
- NOTEX_VERTEX_FORMAT) {
- vfmt_size = 24; /* 6 dwords */
- } else if (sarea->ContextState[I830_CTXREG_VF] ==
- TEX0_VERTEX_FORMAT) {
- vfmt_size = 32; /* 8 dwords */
- if (sarea->ContextState[I830_CTXREG_VF2] != NON_PROJ_VF2) {
- fprintf(stderr, "\n\nTex 0 vertex format, but proj "
- "texturing\n");
- }
- } else if(sarea->ContextState[I830_CTXREG_VF] ==
- TEX1_VERTEX_FORMAT) {
- if (sarea->ContextState[I830_CTXREG_VF2] == NON_PROJ_VF2)
- vfmt_size = 40; /* 10 dwords */
- else
- vfmt_size = 48; /* 12 dwords */
- } else {
- fprintf(stderr, "\n\nUnknown vertex format : vf : %08x "
- "vf2 : %08x\n",
- sarea->ContextState[I830_CTXREG_VF],
- sarea->ContextState[I830_CTXREG_VF2]);
- }
-
- if(vfmt_size && (size % vfmt_size) != 0) {
- fprintf(stderr, "\n\nVertex size does not match hardware "
- "internal state\n");
- fprintf(stderr, "Buffer size : %d\n", size);
- fprintf(stderr, "Vertex size : %d\n", vfmt_size);
- }
-
- switch(sarea->vertex_prim) {
- case PRIM3D_POINTLIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 1;
- prim_name = "PointList";
- break;
-
- case PRIM3D_LINELIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 2;
- prim_name = "LineList";
- break;
-
- case PRIM3D_LINESTRIP:
- hw_start_vertex = 2;
- hw_nr_vertex = 1;
- prim_name = "LineStrip";
- break;
-
- case PRIM3D_TRILIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 3;
- prim_name = "TriList";
- break;
-
- case PRIM3D_TRISTRIP:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "TriStrip";
- break;
-
- case PRIM3D_TRIFAN:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "TriFan";
- break;
-
- case PRIM3D_POLY:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "Polygons";
- break;
- default:
- prim_name = "Unknown";
- fprintf(stderr, "\n\nUnknown primitive type : %08x\n",
- sarea->vertex_prim);
- }
-
- if (hw_nr_vertex && vfmt_size) {
- int temp_size = size - (hw_start_vertex * vfmt_size);
- int remaining = (temp_size % (hw_nr_vertex * vfmt_size));
-
- if (remaining != 0) {
- fprintf(stderr, "\n\nThis buffer contains an improper"
- " multiple of vertices for this primitive : %s\n",
- prim_name);
- fprintf(stderr, "Number of vertices in buffer : %d\n",
- size / vfmt_size);
- fprintf(stderr, "temp_size : %d\n", temp_size);
- fprintf(stderr, "remaining vertices : %d",
- remaining / vfmt_size);
- }
- }
- if (1) {
- fprintf(stderr, "\n\nPrim name (%s), vertices (%d)\n",
- prim_name,
- size / vfmt_size);
- }
-}
-
-void i830EmitHwStateLockedDebug( i830ContextPtr imesa )
-{
- int i;
-
- if ((imesa->dirty & I830_UPLOAD_TEX0_IMAGE) && imesa->CurrentTexObj[0]) {
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[0]);
- }
-
- if ((imesa->dirty & I830_UPLOAD_TEX1_IMAGE) && imesa->CurrentTexObj[1]) {
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[1]);
- }
-
- if (imesa->dirty & I830_UPLOAD_CTX) {
- memcpy( imesa->sarea->ContextState,
- imesa->Setup, sizeof(imesa->Setup) );
- i830DumpContextState(imesa);
- }
-
- for(i = 0; i < I830_TEXTURE_COUNT; i++) {
- if ((imesa->dirty & I830_UPLOAD_TEX_N(i)) && imesa->CurrentTexObj[i]) {
- imesa->sarea->dirty |= I830_UPLOAD_TEX_N(i);
- memcpy(imesa->sarea->TexState[i],
- imesa->CurrentTexObj[i]->Setup,
- sizeof(imesa->sarea->TexState[i]));
- i830DumpTextureState(imesa, i);
- }
- }
- /* Need to figure out if texturing state, or enable changed. */
-
- for(i = 0; i < I830_TEXBLEND_COUNT; i++) {
- if (imesa->dirty & I830_UPLOAD_TEXBLEND_N(i)) {
- imesa->sarea->dirty |= I830_UPLOAD_TEXBLEND_N(i);
- memcpy(imesa->sarea->TexBlendState[i],imesa->TexBlend[i],
- imesa->TexBlendWordsUsed[i] * 4);
- imesa->sarea->TexBlendStateWordsUsed[i] =
- imesa->TexBlendWordsUsed[i];
- i830DumpTextureBlendState(imesa, i);
- }
- }
-
- if (imesa->dirty & I830_UPLOAD_BUFFERS) {
- memcpy( imesa->sarea->BufferState,imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- i830DumpBufferState(imesa);
- }
-
- if (imesa->dirty & I830_UPLOAD_STIPPLE) {
- fprintf(stderr, "UPLOAD_STIPPLE\n");
- memcpy( imesa->sarea->StippleState,imesa->StippleSetup,
- sizeof(imesa->StippleSetup) );
- i830DumpStippleState(imesa);
- }
-
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_SHARED) {
- memcpy( imesa->sarea->Palette[0],imesa->palette,
- sizeof(imesa->sarea->Palette[0]));
- } else {
- i830TextureObjectPtr p;
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(0)) {
- p = imesa->CurrentTexObj[0];
- memcpy( imesa->sarea->Palette[0],p->palette,
- sizeof(imesa->sarea->Palette[0]));
- }
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(1)) {
- p = imesa->CurrentTexObj[1];
- memcpy( imesa->sarea->Palette[1],
- p->palette,
- sizeof(imesa->sarea->Palette[1]));
- }
- }
- imesa->sarea->dirty |= (imesa->dirty & ~(I830_UPLOAD_TEX_MASK |
- I830_UPLOAD_TEXBLEND_MASK));
-
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_debug.h b/xc/lib/GL/mesa/src/drv/i830/i830_debug.h
deleted file mode 100644
index deb84f7b0..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_debug.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.h,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-/* Defines for sanity checking and debug output */
-#ifndef I830DEBUG_INC
-#define I830DEBUG_INC
-
-
-void i830DumpContextState( i830ContextPtr imesa );
-void i830DumpStippleState( i830ContextPtr imesa );
-void i830DumpBufferState( i830ContextPtr imesa );
-void i830DumpTextureState( i830ContextPtr imesa, int unit );
-void i830DumpTextureBlendState( i830ContextPtr imesa, int unit );
-void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex );
-void i830EmitHwStateLockedDebug( i830ContextPtr imesa );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c b/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c
deleted file mode 100644
index 607b813e5..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c
+++ /dev/null
@@ -1,841 +0,0 @@
-
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c,v 1.5 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- * Graeme Fisher <graeme@2d3d.co.za>
- * Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_ioctl.h"
-#include "i830_state.h"
-#include "i830_debug.h"
-
-#include "drm.h"
-
-static drmBufPtr i830_get_buffer_ioctl( i830ContextPtr imesa )
-{
- drmI830DMA dma;
- drmBufPtr buf;
- int retcode,i = 0;
- while (1) {
- retcode = drmCommandWriteRead(imesa->driFd,
- DRM_I830_GETBUF,
- &dma,
- sizeof(drmI830DMA));
- if (dma.granted == 1 && retcode == 0)
- break;
-
- if (++i > 1000) {
- imesa->sarea->perf_boxes |= I830_BOX_WAIT;
- retcode = drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
- i = 0;
- }
- }
-
- buf = &(imesa->i830Screen->bufs->list[dma.request_idx]);
- buf->idx = dma.request_idx;
- buf->used = 0;
- buf->total = dma.request_size;
- buf->address = (drmAddress)dma.virtual;
-
- return buf;
-}
-
-static void i830ClearDrawQuad(i830ContextPtr imesa, float left,
- float right,
- float bottom, float top, GLubyte red,
- GLubyte green, GLubyte blue, GLubyte alpha)
-{
- GLuint *vb = i830AllocDmaLowLocked( imesa, 128 );
- i830Vertex tmp;
- int i;
-
- /* PRIM3D_TRIFAN */
-
- /* initial vertex, left bottom */
- tmp.v.x = left;
- tmp.v.y = bottom;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = 0.0f;
- tmp.v.v0 = 0.0f;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += 8;
- tmp.v.x = right;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += 8;
- tmp.v.y = top;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += 8;
- tmp.v.x = left;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-}
-
-static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- I830SAREAPtr sarea = imesa->sarea;
- GLuint old_vertex_prim;
- GLuint old_dirty;
- int x0, y0, x1, y1;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "Clearing with triangles\n");
-
- old_dirty = imesa->dirty & ~I830_UPLOAD_CLIPRECTS;
- /* Discard all the dirty flags except the cliprect one, reset later */
- imesa->dirty &= I830_UPLOAD_CLIPRECTS;
-
- if(!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-
- /* Clip to Screen */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i830Screen->width-1) x1 = i830Screen->width-1;
- if (y1 > i830Screen->height-1) y1 = i830Screen->height-1;
-
- LOCK_HARDWARE(imesa);
- memcpy(sarea->ContextState,
- imesa->Init_Setup,
- sizeof(imesa->Setup) );
- memcpy(sarea->BufferState,
- imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- sarea->StippleState[I830_STPREG_ST1] = 0;
-
- old_vertex_prim = imesa->hw_primitive;
- imesa->hw_primitive = PRIM3D_TRIFAN;
-
- if(mask & DD_FRONT_LEFT_BIT) {
- GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
- tmp |= (DISABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (imesa->mask_red << WRITEMASK_RED_SHIFT) |
- (imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
- (imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
- (imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
- sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
-
- if(0)
- fprintf(stderr, "fcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
- imesa->mask_red, imesa->mask_green, imesa->mask_blue,
- imesa->mask_alpha);
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
-
- if(0)
- fprintf(stderr, "fcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
- "r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
- x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
- i830FlushPrimsLocked( imesa );
- }
-
- if(mask & DD_BACK_LEFT_BIT) {
- GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
- tmp |= (DISABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (imesa->mask_red << WRITEMASK_RED_SHIFT) |
- (imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
- (imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
- (imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
-
- if(0)
- fprintf(stderr, "bcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
- imesa->mask_red, imesa->mask_green, imesa->mask_blue,
- imesa->mask_alpha);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
-
- if(0)
- fprintf(stderr, "bcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
- "r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
- x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
- i830FlushPrimsLocked( imesa );
- }
-
- if(mask & DD_STENCIL_BIT) {
- GLuint s_mask = ctx->Stencil.WriteMask[0];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- sarea->ContextState[I830_CTXREG_ENABLES_1] |= (ENABLE_STENCIL_TEST |
- ENABLE_DEPTH_TEST);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] &= ~(ENABLE_STENCIL_WRITE |
- ENABLE_DEPTH_WRITE |
- ENABLE_COLOR_WRITE);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] |=
- (ENABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (1 << WRITEMASK_RED_SHIFT) |
- (1 << WRITEMASK_GREEN_SHIFT) |
- (1 << WRITEMASK_BLUE_SHIFT) |
- (1 << WRITEMASK_ALPHA_SHIFT) |
- ENABLE_COLOR_WRITE);
-
- sarea->ContextState[I830_CTXREG_STATE4] &=
- ~MODE4_ENABLE_STENCIL_WRITE_MASK;
-
- sarea->ContextState[I830_CTXREG_STATE4] |=
- (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(s_mask));
-
- sarea->ContextState[I830_CTXREG_STENCILTST] &=
- ~(STENCIL_OPS_MASK |
- STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
-
- sarea->ContextState[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_PARMS |
- ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_REPLACE) |
- STENCIL_REF_VALUE((ctx->Stencil.Clear & 0xff)) |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS));
-
- if(0)
- fprintf(stderr, "Enables_1 (0x%x) Enables_2 (0x%x) StenTst (0x%x)\n"
- "Modes_4 (0x%x)\n",
- sarea->ContextState[I830_CTXREG_ENABLES_1],
- sarea->ContextState[I830_CTXREG_ENABLES_2],
- sarea->ContextState[I830_CTXREG_STENCILTST],
- sarea->ContextState[I830_CTXREG_STATE4]);
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- 255, 255, 255, 255);
- i830FlushPrimsLocked( imesa );
- }
-
- UNLOCK_HARDWARE(imesa);
- imesa->dirty = old_dirty;
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- imesa->hw_primitive = old_vertex_prim;
-}
-
-static void i830Clear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- drmI830Clear clear;
- GLbitfield tri_mask = 0;
- int i;
- GLint cx, cy;
-
- /* flip top to bottom */
- cy = dPriv->h-cy1-ch;
- cx = cx1 + imesa->drawX;
- cy += imesa->drawY;
-
- if(0) fprintf(stderr, "\nClearColor : 0x%08x\n", imesa->ClearColor);
-
- clear.flags = 0;
- clear.clear_color = imesa->ClearColor;
- clear.clear_depth = 0;
- clear.clear_colormask = 0;
- clear.clear_depthmask = 0;
-
- I830_FIREVERTICES( imesa );
-
- if (mask & DD_FRONT_LEFT_BIT) {
- if(colorMask == ~0) {
- clear.flags |= I830_FRONT;
- } else {
- tri_mask |= DD_FRONT_LEFT_BIT;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if (mask & DD_BACK_LEFT_BIT) {
- if(colorMask == ~0) {
- clear.flags |= I830_BACK;
- } else {
- tri_mask |= DD_BACK_LEFT_BIT;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask & DD_DEPTH_BIT) {
- clear.flags |= I830_DEPTH;
- clear.clear_depthmask = imesa->depth_clear_mask;
- clear.clear_depth = (GLuint)(ctx->Depth.Clear * imesa->ClearDepth);
- mask &= ~DD_DEPTH_BIT;
- }
-
- if((mask & DD_STENCIL_BIT) && imesa->hw_stencil) {
- if (ctx->Stencil.WriteMask[0] != 0xff) {
- tri_mask |= DD_STENCIL_BIT;
- } else {
- clear.flags |= I830_DEPTH;
- clear.clear_depthmask |= imesa->stencil_clear_mask;
- clear.clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
- }
- mask &= ~DD_STENCIL_BIT;
- }
-
- /* First check for clears that need to happen with triangles */
- if(tri_mask) {
- i830ClearWithTris(ctx, tri_mask, all, cx, cy, cw, ch);
- }
-
- if (clear.flags) {
- LOCK_HARDWARE( imesa );
-
- for (i = 0 ; i < imesa->numClipRects ; )
- {
- int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, imesa->numClipRects);
- XF86DRIClipRectRec *box = imesa->pClipRects;
- drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = *(drm_clip_rect_t *)&box[i];
- n++;
- }
- }
-
- imesa->sarea->nbox = n;
- drmCommandWrite(imesa->driFd, DRM_I830_CLEAR,
- &clear, sizeof(drmI830Clear));
- }
-
- UNLOCK_HARDWARE( imesa );
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx1, cy1, cw, ch );
-}
-
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void i830CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- i830ContextPtr imesa;
- XF86DRIClipRectPtr pbox;
- int nbox, i, tmp;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- imesa->sarea->perf_boxes |= imesa->perf_boxes;
- imesa->perf_boxes = 0;
-
- pbox = dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)imesa->sarea->boxes;
-
- imesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
- drmCommandNone(imesa->driFd, DRM_I830_SWAP);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i830WaitAge(imesa, imesa->lastSwap);
- }
-
- imesa->lastSwap = tmp;
- imesa->upload_cliprects = GL_TRUE;
-}
-
-/* Flip the front & back buffes
- */
-void i830PageFlip( const __DRIdrawablePrivate *dPriv )
-{
-#if 0
- i830ContextPtr imesa;
- int tmp, ret;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- imesa->sarea->perf_boxes |= imesa->perf_boxes;
- imesa->perf_boxes = 0;
-
- if (dPriv->pClipRects) {
- *(XF86DRIClipRectRec *)imesa->sarea->boxes = dPriv->pClipRects[0];
- imesa->sarea->nbox = 1;
- }
-
- ret = drmCommandNone(imesa->driFd, DRM_I830_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( imesa );
- exit(1);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i830WaitAge(imesa, imesa->lastSwap);
- }
-
- i830SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );
- imesa->upload_cliprects = GL_TRUE;
- imesa->lastSwap = tmp;
-#endif
-}
-
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void i830DmaFinish( i830ContextPtr imesa )
-{
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE_QUIESCENT( imesa );
- UNLOCK_HARDWARE( imesa );
-}
-
-void i830RegetLockQuiescent( i830ContextPtr imesa )
-{
- drmUnlock(imesa->driFd, imesa->hHWContext);
- i830GetLock( imesa, DRM_LOCK_QUIESCENT );
-}
-
-void i830WaitAgeLocked( i830ContextPtr imesa, int age )
-{
- int i = 0;
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age) return;
- imesa->sarea->perf_boxes |= I830_BOX_WAIT;
- UNLOCK_HARDWARE( imesa );
- if (I830_DEBUG & DEBUG_SLEEP) fprintf(stderr, ".");
- usleep(1);
- LOCK_HARDWARE( imesa );
- }
- /* If that didn't work, just do a flush:
- */
- drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
-}
-
-void i830WaitAge( i830ContextPtr imesa, int age )
-{
- int i = 0;
- if (GET_DISPATCH_AGE(imesa) >= age) return;
-
- while (1) {
- drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age) return;
- imesa->perf_boxes |= I830_BOX_WAIT;
-
- if (imesa->do_irqs) {
- drmI830IrqEmit ie;
- drmI830IrqWait iw;
- int ret;
-
- ie.irq_seq = &iw.irq_seq;
-
- LOCK_HARDWARE( imesa );
- ret = drmCommandWriteRead( imesa->driFd, DRM_I830_IRQ_EMIT, &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- UNLOCK_HARDWARE(imesa);
-
- ret = drmCommandWrite( imesa->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- } else {
- if (++i > 5000) usleep(1);
- }
- }
-}
-
-static void age_imesa( i830ContextPtr imesa, int age )
-{
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->base.timestamp = age;
- if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->base.timestamp = age;
-}
-
-void i830FlushPrimsLocked( i830ContextPtr imesa )
-{
- XF86DRIClipRectPtr pbox = (XF86DRIClipRectPtr)imesa->pClipRects;
- int nbox = imesa->numClipRects;
- drmBufPtr buffer = imesa->vertex_buffer;
- I830SAREAPtr sarea = imesa->sarea;
- drmI830Vertex vertex;
- int i, nr;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s dirty: %08x\n", __FUNCTION__, imesa->dirty);
-
-
- vertex.idx = buffer->idx;
- vertex.used = imesa->vertex_low;
- vertex.discard = 0;
- sarea->vertex_prim = imesa->hw_primitive;
-
- /* Reset imesa vars:
- */
- imesa->vertex_buffer = 0;
- imesa->vertex_addr = 0;
- imesa->vertex_low = 0;
- imesa->vertex_high = 0;
- imesa->vertex_last_prim = 0;
-
- if (imesa->dirty) {
- if (I830_DEBUG & DEBUG_SANITY)
- i830EmitHwStateLockedDebug(imesa);
- else
- i830EmitHwStateLocked(imesa);
- }
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,"%s: Vertex idx %d used %d discard %d\n",
- __FUNCTION__, vertex.idx, vertex.used, vertex.discard);
-
- if (!nbox) {
- vertex.used = 0;
- vertex.discard = 1;
- if (drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
- &vertex, sizeof(drmI830Vertex))) {
- fprintf(stderr, "DRM_I830_VERTEX: %d\n", -errno);
- UNLOCK_HARDWARE(imesa);
- exit(1);
- }
- return;
- }
-
- for (i = 0 ; i < nbox ; i = nr ) {
- XF86DRIClipRectPtr b = sarea->boxes;
- int j;
-
- nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, nbox);
- sarea->nbox = nr - i;
-
- for ( j = i ; j < nr ; j++) {
- b[j-i] = pbox[j];
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- vertex.discard = 1;
-
- /* Do a bunch of sanity checks on the vertices sent to the hardware */
- if (I830_DEBUG & DEBUG_SANITY) {
- i830VertexSanity(imesa, vertex);
-
- for ( j = 0 ; j < sarea->nbox ; j++) {
- fprintf(stderr, "box %d/%d %d,%d %d,%d\n",
- j, sarea->nbox, b[j].x1, b[j].y1, b[j].x2, b[j].y2);
- }
- }
-
- drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
- &vertex, sizeof(drmI830Vertex));
- age_imesa(imesa, imesa->sarea->last_enqueue);
- }
-
- imesa->dirty = 0;
- imesa->upload_cliprects = GL_FALSE;
-}
-
-void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa )
-{
- if (imesa->vertex_buffer)
- i830FlushPrimsLocked( imesa );
- imesa->vertex_buffer = i830_get_buffer_ioctl( imesa );
- imesa->vertex_addr = (char *)imesa->vertex_buffer->address;
-
- /* leave room for instruction header & footer:
- */
- imesa->vertex_high = imesa->vertex_buffer->total - 4;
- imesa->vertex_low = 4;
- imesa->vertex_last_prim = imesa->vertex_low;
-}
-
-void i830FlushPrimsGetBuffer( i830ContextPtr imesa )
-{
- LOCK_HARDWARE(imesa);
- i830FlushPrimsGetBufferLocked( imesa );
- UNLOCK_HARDWARE(imesa);
-}
-
-
-void i830FlushPrims( i830ContextPtr imesa )
-{
- if (imesa->vertex_buffer) {
- LOCK_HARDWARE( imesa );
- i830FlushPrimsLocked( imesa );
- UNLOCK_HARDWARE( imesa );
- }
-}
-
-int i830_check_copy(int fd)
-{
- return drmCommandNone(fd, DRM_I830_DOCOPY);
-}
-
-static void i830DDFlush( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- I830_FIREVERTICES( imesa );
-}
-
-static void i830DDFinish( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- i830DmaFinish( imesa );
-}
-
-void i830DDInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Flush = i830DDFlush;
- ctx->Driver.Clear = i830Clear;
- ctx->Driver.Finish = i830DDFinish;
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h b/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h
deleted file mode 100644
index 4c64b8d7a..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h
+++ /dev/null
@@ -1,105 +0,0 @@
-
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h,v 1.3 2002/10/30 12:51:35 alanh Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- * Graeme Fisher <graeme@2d3d.co.za>
- * Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef I830_IOCTL_H
-#define I830_IOCTL_H
-
-#include "i830_context.h"
-
-GLuint *i830AllocDwords (i830ContextPtr imesa, int dwords);
-void i830EmitPrim( i830ContextPtr imesa );
-void i830FlushPrims( i830ContextPtr mmesa );
-void i830FlushPrimsLocked( i830ContextPtr mmesa );
-void i830FlushPrimsGetBuffer( i830ContextPtr imesa );
-void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa );
-void i830WaitAgeLocked( i830ContextPtr imesa, int age );
-void i830WaitAge( i830ContextPtr imesa, int age );
-void i830DmaFinish( i830ContextPtr imesa );
-void i830RegetLockQuiescent( i830ContextPtr imesa );
-void i830DDInitIoctlFuncs( GLcontext *ctx );
-void i830CopyBuffer( const __DRIdrawablePrivate *dpriv );
-void i830PageFlip( const __DRIdrawablePrivate *dpriv );
-int i830_check_copy(int fd);
-
-#define I830_STATECHANGE(imesa, flag) \
-do { \
- if (imesa->vertex_low != imesa->vertex_last_prim) \
- i830FlushPrims(imesa); \
- imesa->dirty |= flag; \
-} while (0)
-
-
-#define I830_FIREVERTICES(imesa) \
-do { \
- if (imesa->vertex_buffer) { \
- i830FlushPrims(imesa); \
-} \
-} while (0)
-
-
-static __inline GLuint *i830AllocDmaLow( i830ContextPtr imesa, int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high) {
- i830FlushPrimsGetBuffer( imesa );
- }
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-static __inline GLuint *i830AllocDmaLowLocked( i830ContextPtr imesa,
- int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high) {
- i830FlushPrimsGetBufferLocked( imesa );
- }
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_render.c b/xc/lib/GL/mesa/src/drv/i830/i830_render.c
deleted file mode 100644
index 5df05dfde..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_render.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Intel i810 DRI driver for Mesa 3.5
- *
- * Copyright (C) 1999-2000 Keith Whitwell All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL KEITH WHITWELL BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Author:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_render.c,v 1.2 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tris.h"
-#include "i830_state.h"
-#include "i830_vb.h"
-#include "i830_ioctl.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0 /* Has it, but can't use because subpixel has to
- * be adjusted for points on the I830/I845G
- */
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
-};
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-static const int scale_prim[GL_POLYGON+1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
-};
-
-/* Fallback to normal rendering. Should now never be called.
- */
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
- count, flags );
- I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
-}
-
-
-#define LOCAL_VARS i830ContextPtr imesa = I830_CONTEXT(ctx)
-#define INIT( prim ) do { \
- I830_STATECHANGE(imesa, 0); \
- i830RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
-} while (0)
-
-#define NEW_PRIMITIVE() I830_STATECHANGE( imesa, 0 )
-#define NEW_BUFFER() I830_FIREVERTICES( imesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (I830_DMA_BUF_SZ-8) / (imesa->vertex_size * 4)
-
-#define EMIT_VERTS( ctx, j, nr ) \
- i830_emit_contiguous_verts(ctx, j, (j)+(nr))
-
-#define TAG(x) i830_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-/* Heuristic for i830, which can only emit a single primitive per dma
- * buffer, and has only a small number of dma buffers.
- */
-static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
-{
- int nr_prims = 0;
- int nr_rprims = 0;
- int nr_rverts = 0;
- int rprim = 0;
- int i = 0, length, flags = 0;
-
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
- if (!length)
- continue;
-
- if (!hw_prim[flags & PRIM_MODE_MASK])
- return GL_FALSE;
-
- nr_prims++;
- nr_rverts += length * scale_prim[flags & PRIM_MODE_MASK];
-
- if (reduced_prim[flags&PRIM_MODE_MASK] != rprim) {
- nr_rprims++;
- rprim = reduced_prim[flags&PRIM_MODE_MASK];
- }
- }
-
- nr_prims += i / bufsz;
- nr_rprims += nr_rverts / bufsz;
-
- if ((nr_prims > nr_rprims * 2) ||
- (nr_prims > nr_rprims + 3))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean i830_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
- /* Don't handle clipping or indexed vertices.
- */
- if (VB->ClipOrMask || imesa->RenderIndex != 0 || VB->Elts ||
- !choose_render( VB, GET_SUBSEQUENT_VB_MAX_VERTS() )) {
- return GL_TRUE;
- }
-
- imesa->SetupNewInputs = VERT_BIT_CLIP;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- i830_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-static void i830_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _i830_render_stage =
-{
- "i830 render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- i830_check_render, /* check - initially set to alloc data */
- i830_run_render /* run */
-};
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_screen.c b/xc/lib/GL/mesa/src/drv/i830/i830_screen.c
deleted file mode 100644
index caefb37f7..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_screen.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/**************************************************************************
- *
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * **************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_screen.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_span.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-
-#include "i830_dri.h"
-
-
-static int i830_malloc_proxy_buf(drmBufMapPtr buffers)
-{
- char *buffer;
- drmBufPtr buf;
- int i;
-
- buffer = Xmalloc(I830_DMA_BUF_SZ);
- if(buffer == NULL) return -1;
- for(i = 0; i < I830_DMA_BUF_NR; i++) {
- buf = &(buffers->list[i]);
- buf->address = (drmAddress)buffer;
- }
-
- return 0;
-}
-
-static drmBufMapPtr i830_create_empty_buffers(void)
-{
- drmBufMapPtr retval;
-
- retval = (drmBufMapPtr)Xmalloc(sizeof(drmBufMap));
- if(retval == NULL) return NULL;
- memset(retval, 0, sizeof(drmBufMap));
- retval->list = (drmBufPtr)Xmalloc(sizeof(drmBuf) * I830_DMA_BUF_NR);
- if(retval->list == NULL) {
- Xfree(retval);
- return NULL;
- }
-
- memset(retval->list, 0, sizeof(drmBuf) * I830_DMA_BUF_NR);
- return retval;
-}
-
-static void i830PrintDRIInfo(i830ScreenPrivate *i830Screen,
- __DRIscreenPrivate *sPriv,
- I830DRIPtr gDRIPriv)
-{
- GLuint size = (gDRIPriv->ringSize +
- i830Screen->textureSize +
- i830Screen->depth.size +
- i830Screen->back.size +
- sPriv->fbSize +
- I830_DMA_BUF_NR * I830_DMA_BUF_SZ +
- 32768 /* Context Memory */ +
- 16*4096 /* Ring buffer */ +
- 64*1024 /* Scratch buffer */ +
- 4096 /* Cursor */);
- GLuint size_low = (gDRIPriv->ringSize +
- i830Screen->textureSize +
- sPriv->fbSize +
- I830_DMA_BUF_NR * I830_DMA_BUF_SZ +
- 32768 /* Context Memory */ +
- 16*4096 /* Ring buffer */ +
- 64*1024 /* Scratch buffer */);
-
- fprintf(stderr, "\nFront size : 0x%x\n", sPriv->fbSize);
- fprintf(stderr, "Front offset : 0x%x\n", i830Screen->fbOffset);
- fprintf(stderr, "Back size : 0x%x\n", i830Screen->back.size);
- fprintf(stderr, "Back offset : 0x%x\n", i830Screen->backOffset);
- fprintf(stderr, "Depth size : 0x%x\n", i830Screen->depth.size);
- fprintf(stderr, "Depth offset : 0x%x\n", i830Screen->depthOffset);
- fprintf(stderr, "Texture size : 0x%x\n", i830Screen->textureSize);
- fprintf(stderr, "Texture offset : 0x%x\n", i830Screen->textureOffset);
- fprintf(stderr, "Ring offset : 0x%x\n", gDRIPriv->ringOffset);
- fprintf(stderr, "Ring size : 0x%x\n", gDRIPriv->ringSize);
- fprintf(stderr, "Memory : 0x%x\n", gDRIPriv->mem);
- fprintf(stderr, "Used Memory : low(0x%x) high(0x%x)\n", size_low, size);
-}
-
-static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
-{
- i830ScreenPrivate *i830Screen;
- I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
-
- /* Check the DRI externsion version */
- if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
- __driUtilMessage( "i830 DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
- return GL_FALSE;
- }
-
- /* Check that the DDX driver version is compatible */
- if (sPriv->ddxMajor != 1 || sPriv->ddxMinor < 0) {
- __driUtilMessage("i830 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch);
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if (sPriv->drmMajor != 1 || sPriv->drmMinor < 3) {
- __driUtilMessage("i830 DRI driver expected DRM driver version 1.3.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch);
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- i830Screen = (i830ScreenPrivate *)Xmalloc(sizeof(i830ScreenPrivate));
- if (!i830Screen) {
- fprintf(stderr,"\nERROR! Allocating private area failed\n");
- return GL_FALSE;
- }
-
- i830Screen->driScrnPriv = sPriv;
- sPriv->private = (void *)i830Screen;
-
- i830Screen->deviceID = gDRIPriv->deviceID;
- i830Screen->width = gDRIPriv->width;
- i830Screen->height = gDRIPriv->height;
- i830Screen->mem = gDRIPriv->mem;
- i830Screen->cpp = gDRIPriv->cpp;
- i830Screen->fbStride = gDRIPriv->fbStride;
- i830Screen->fbOffset = gDRIPriv->fbOffset;
-
- switch (gDRIPriv->bitsPerPixel) {
- case 15: i830Screen->fbFormat = DV_PF_555; break;
- case 16: i830Screen->fbFormat = DV_PF_565; break;
- case 32: i830Screen->fbFormat = DV_PF_8888; break;
- }
-
- i830Screen->backOffset = gDRIPriv->backOffset;
- i830Screen->depthOffset = gDRIPriv->depthOffset;
- i830Screen->backPitch = gDRIPriv->auxPitch;
- i830Screen->backPitchBits = gDRIPriv->auxPitchBits;
- i830Screen->textureOffset = gDRIPriv->textureOffset;
- i830Screen->textureSize = gDRIPriv->textureSize;
- i830Screen->logTextureGranularity = gDRIPriv->logTextureGranularity;
-
-
- i830Screen->bufs = i830_create_empty_buffers();
- if(i830Screen->bufs == NULL) {
- fprintf(stderr,"\nERROR: Failed to create empty buffers in %s \n",
- __FUNCTION__);
- Xfree(i830Screen);
- return GL_FALSE;
- }
-
- /* Check if you need to create a fake buffer */
- if(i830_check_copy(sPriv->fd) == 1) {
- i830_malloc_proxy_buf(i830Screen->bufs);
- i830Screen->use_copy_buf = 1;
- } else {
- i830Screen->use_copy_buf = 0;
- }
-
- i830Screen->back.handle = gDRIPriv->backbuffer;
- i830Screen->back.size = gDRIPriv->backbufferSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->back.handle,
- i830Screen->back.size,
- (drmAddress *)&i830Screen->back.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- Xfree(i830Screen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->depth.handle = gDRIPriv->depthbuffer;
- i830Screen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->depth.handle,
- i830Screen->depth.size,
- (drmAddress *)&i830Screen->depth.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- Xfree(i830Screen);
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->tex.handle = gDRIPriv->textures;
- i830Screen->tex.size = gDRIPriv->textureSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->tex.handle,
- i830Screen->tex.size,
- (drmAddress *)&i830Screen->tex.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- Xfree(i830Screen);
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- if (0) i830PrintDRIInfo(i830Screen, sPriv, gDRIPriv);
-
- i830Screen->drmMinor = sPriv->drmMinor;
-
- if (sPriv->drmMinor >= 3) {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &i830Screen->irq_active;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
-
-#if 0
- if (sPriv->drmMinor >= 3) {
- int ret;
- drmI830SetParam sp;
-
- sp.param = I830_SETPARAM_PERF_BOXES;
- sp.value = (getenv("I830_DO_BOXES") != 0);
-
- ret = drmCommandWrite( sPriv->fd, DRM_I830_SETPARAM,
- &sp, sizeof(sp));
- if (ret)
- fprintf(stderr, "Couldn't set perfboxes: %d\n", ret);
- }
-#endif
-
- return GL_TRUE;
-}
-
-
-static void i830DestroyScreen(__DRIscreenPrivate *sPriv)
-{
- i830ScreenPrivate *i830Screen = (i830ScreenPrivate *)sPriv->private;
-
- /* Need to unmap all the bufs and maps here:
- */
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
- drmUnmap(i830Screen->tex.map, i830Screen->tex.size);
- Xfree(i830Screen);
- sPriv->private = NULL;
-}
-
-static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- } else {
-#if 0
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-#else
- GLboolean swStencil = mesaVis->stencilBits > 0;
-#endif
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void i830DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static GLboolean i830OpenCloseFullScreen (__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static const struct __DriverAPIRec i830API = {
- .InitDriver = i830InitDriver,
- .DestroyScreen = i830DestroyScreen,
- .CreateContext = i830CreateContext,
- .DestroyContext = i830DestroyContext,
- .CreateBuffer = i830CreateBuffer,
- .DestroyBuffer = i830DestroyBuffer,
- .SwapBuffers = i830SwapBuffers,
- .MakeCurrent = i830MakeCurrent,
- .UnbindContext = i830UnbindContext,
- .OpenFullScreen = i830OpenCloseFullScreen,
- .CloseFullScreen = i830OpenCloseFullScreen,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &i830API);
- return (void *) psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_screen.h b/xc/lib/GL/mesa/src/drv/i830/i830_screen.h
deleted file mode 100644
index 8153828ff..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_screen.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#ifndef _I830_INIT_H_
-#define _I830_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-
-
-typedef struct {
- drmHandle handle;
- drmSize size;
- char *map;
-} i830Region, *i830RegionPtr;
-
-typedef struct
-{
-
- i830Region front;
- i830Region back;
- i830Region depth;
- i830Region tex;
-
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int bitsPerPixel;
-
- int fbFormat;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int backPitch;
- int backPitchBits;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- drmBufMapPtr bufs;
- int use_copy_buf;
- unsigned int sarea_priv_offset;
-
- int drmMinor;
- int irq_active;
-}i830ScreenPrivate;
-
-
-extern GLboolean
-i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-i830DestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i830UnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-i830SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_span.c b/xc/lib/GL/mesa/src/drv/i830/i830_span.c
deleted file mode 100644
index 34830bf58..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_span.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_span.c,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_span.h"
-#include "i830_ioctl.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- GLushort p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(i830Screen->depth.map + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define INIT_MONO_PIXEL(p,color)\
- p = PACK_COLOR_565(color[0],color[1],color[2])
-
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
- _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-
-#define HW_LOCK()
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- while (_nc--) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i830##x##_565
-#include "spantmp.h"
-
-
-
-
-/* 15 bit, 555 rgb color spanline and pixel functions
- */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \
- ((g & 0xf8) << 3) | \
- ((b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 3) & 0xf8; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i830##x##_555
-#include "spantmp.h"
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch);
-
-
-#define TAG(x) i830##x##_16
-#include "depthtmp.h"
-
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- GLuint p = I830_CONTEXT( ctx )->MonoColor; \
- (void) read_buf; (void) buf; (void) p
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p,color)\
- p = PACK_COLOR_888(color[0],color[1],color[2])
-
-/* 32 bit, 8888 argb color spanline and pixel functions
- */
-#define WRITE_RGBA(_x, _y, r, g, b, a) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((r << 16) | \
- (g << 8) | \
- (b << 0) | \
- (a << 24) )
-
-#define WRITE_PIXEL(_x, _y, p) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-
-#define READ_RGBA(rgba, _x, _y) \
- do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
- } while (0)
-
-#define TAG(x) i830##x##_8888
-#include "spantmp.h"
-
-/* 24 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = 0xffffff & d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xffffff;
-
-#define TAG(x) i830##x##_24
-#include "depthtmp.h"
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xff000000; \
- tmp |= (d) & 0xffffff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xffffff;
-
-
-#define TAG(x) i830##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff; \
- tmp |= (d<<24); \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) >> 24;
-
-#define TAG(x) i830##x##_24_8
-#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (bufferBit == FRONT_LEFT_BIT) {
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- } else if (bufferBit == BACK_LEFT_BIT) {
- imesa->drawMap = imesa->i830Screen->back.map;
- imesa->readMap = imesa->i830Screen->back.map;
- } else {
- ASSERT(0);
- }
-}
-
-
-
-/* Move locking out to get reasonable span performance.
- */
-void i830SpanRenderStart( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- I830_FIREVERTICES(imesa);
- LOCK_HARDWARE(imesa);
- i830RegetLockQuiescent( imesa );
-}
-
-void i830SpanRenderFinish( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( imesa );
-}
-
-void i830DDInitSpanFuncs( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
-
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = i830SetBuffer;
-
- switch (i830Screen->fbFormat) {
- case DV_PF_555:
- swdd->WriteRGBASpan = i830WriteRGBASpan_555;
- swdd->WriteRGBSpan = i830WriteRGBSpan_555;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_555;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_555;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_555;
- swdd->ReadRGBASpan = i830ReadRGBASpan_555;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_555;
-
- swdd->ReadDepthSpan = i830ReadDepthSpan_16;
- swdd->WriteDepthSpan = i830WriteDepthSpan_16;
- swdd->ReadDepthPixels = i830ReadDepthPixels_16;
- swdd->WriteDepthPixels = i830WriteDepthPixels_16;
- break;
-
- case DV_PF_565:
- swdd->WriteRGBASpan = i830WriteRGBASpan_565;
- swdd->WriteRGBSpan = i830WriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = i830ReadRGBASpan_565;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_565;
-
- swdd->ReadDepthSpan = i830ReadDepthSpan_16;
- swdd->WriteDepthSpan = i830WriteDepthSpan_16;
- swdd->ReadDepthPixels = i830ReadDepthPixels_16;
- swdd->WriteDepthPixels = i830WriteDepthPixels_16;
- break;
-
- case DV_PF_8888:
- swdd->WriteRGBASpan = i830WriteRGBASpan_8888;
- swdd->WriteRGBSpan = i830WriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = i830ReadRGBASpan_8888;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_8888;
-
- if(imesa->hw_stencil) {
- swdd->ReadDepthSpan = i830ReadDepthSpan_24_8;
- swdd->WriteDepthSpan = i830WriteDepthSpan_24_8;
- swdd->ReadDepthPixels = i830ReadDepthPixels_24_8;
- swdd->WriteDepthPixels = i830WriteDepthPixels_24_8;
-
- swdd->WriteStencilSpan = i830WriteStencilSpan_24_8;
- swdd->ReadStencilSpan = i830ReadStencilSpan_24_8;
- swdd->WriteStencilPixels = i830WriteStencilPixels_24_8;
- swdd->ReadStencilPixels = i830ReadStencilPixels_24_8;
- } else {
- swdd->ReadDepthSpan = i830ReadDepthSpan_24;
- swdd->WriteDepthSpan = i830WriteDepthSpan_24;
- swdd->ReadDepthPixels = i830ReadDepthPixels_24;
- swdd->WriteDepthPixels = i830WriteDepthPixels_24;
- }
- break;
- }
-
- swdd->SpanRenderStart = i830SpanRenderStart;
- swdd->SpanRenderFinish = i830SpanRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_span.h b/xc/lib/GL/mesa/src/drv/i830/i830_span.h
deleted file mode 100644
index 0135468ff..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_span.h,v 1.2 2002/09/11 00:29:26 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef _I830_SPAN_H
-#define _I830_SPAN_H
-
-extern void i830DDInitSpanFuncs( GLcontext *ctx );
-
-extern void i830SpanRenderFinish( GLcontext *ctx );
-extern void i830SpanRenderStart( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_state.c b/xc/lib/GL/mesa/src/drv/i830/i830_state.c
deleted file mode 100644
index 004b49ace..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_state.c
+++ /dev/null
@@ -1,1799 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_state.c,v 1.6 2003/01/28 22:47:06 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "texmem.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_vb.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-static __inline__ GLuint i830PackColor(GLuint format,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case DV_PF_555:
- return I830PACKCOLOR1555(r,g,b,a);
- case DV_PF_565:
- return I830PACKCOLOR565(r,g,b);
- case DV_PF_8888:
- return I830PACKCOLOR8888(r,g,b,a);
- default:
- fprintf(stderr, "unknown format %d\n", (int)format);
- return 0;
- }
-}
-
-static void i830StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
-
- mask = mask & 0xff;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
- imesa->Setup[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- imesa->Setup[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE(ref) |
- STENCIL_TEST_FUNC(test));
-}
-
-static void i830StencilMask(GLcontext *ctx, GLuint mask)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-static void i830StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int fop, dfop, dpop;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- fop = 0; dfop = 0; dpop = 0;
-
- switch(fail) {
- case GL_KEEP:
- fop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- fop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- fop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- fop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- fop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- fop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- fop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- fop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zfail) {
- case GL_KEEP:
- dfop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dfop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dfop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dfop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dfop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dfop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dfop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dfop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zpass) {
- case GL_KEEP:
- dpop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dpop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dpop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dpop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dpop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dpop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dpop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dpop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
-
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- imesa->Setup[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(fop) |
- STENCIL_PASS_DEPTH_FAIL_OP(dfop) |
- STENCIL_PASS_DEPTH_PASS_OP(dpop));
-}
-
-static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
- GLuint refByte = (GLint) (ref * 255.0);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK;
- imesa->Setup[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
- ENABLE_ALPHA_REF_VALUE |
- ALPHA_TEST_FUNC(test) |
- ALPHA_REF_VALUE(refByte));
-}
-
-/* This function makes sure that the proper enables are
- * set for LogicOp, Independant Alpha Blend, and Blending.
- * It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- */
-static void i830EvalLogicOpBlendState(GLcontext *ctx)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- if (ctx->Color.ColorLogicOpEnabled) {
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~ENABLE_INDPT_ALPHA_BLEND;
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- } else if (ctx->Color.BlendEnabled) {
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (ENABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~ENABLE_INDPT_ALPHA_BLEND;
- if (imesa->Setup[I830_CTXREG_IALPHAB] & SRC_DST_ABLEND_MASK) {
- imesa->Setup[I830_CTXREG_IALPHAB] |= ENABLE_INDPT_ALPHA_BLEND;
- } else {
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- }
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~ENABLE_INDPT_ALPHA_BLEND;
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- }
-}
-
-static void i830BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLubyte r, g, b, a;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- FLOAT_COLOR_TO_UBYTE_COLOR(r, color[RCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(g, color[GCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(b, color[BCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(a, color[ACOMP]);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_BLENDCOLR] = ((a << 24) |
- (r << 16) |
- (g << 8) |
- b);
-}
-
-static void i830BlendEquation(GLcontext *ctx, GLenum mode)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int func = ENABLE_ALPHA_BLENDFUNC;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(mode));
-
- /* This will catch a logicop blend equation */
- i830EvalLogicOpBlendState(ctx);
-
- switch(mode) {
- case GL_FUNC_ADD_EXT:
- func |= BLENDFUNC_ADD;
- break;
- case GL_MIN_EXT:
- func |= BLENDFUNC_MIN;
- break;
- case GL_MAX_EXT:
- func |= BLENDFUNC_MAX;
- break;
- case GL_FUNC_SUBTRACT_EXT:
- func |= BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT_EXT:
- func |= BLENDFUNC_RVRSE_SUB;
- break;
- default: return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE1] &= ~BLENDFUNC_MASK;
- imesa->Setup[I830_CTXREG_STATE1] |= func;
- if (0) fprintf(stderr, "%s : STATE1 : 0x%08x\n",
- __FUNCTION__,
- imesa->Setup[I830_CTXREG_STATE1]);
-}
-
-static void i830BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int func = (ENABLE_SRC_BLND_FACTOR|ENABLE_DST_BLND_FACTOR);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s %s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(sfactor),
- _mesa_lookup_enum_by_nr(dfactor));
-
- switch(sfactor) {
- case GL_ZERO:
- func |= SRC_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_SRC_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE:
- func |= SRC_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_DST_COLOR:
- func |= SRC_BLND_FACT(BLENDFACT_DST_COLR);
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func |= SRC_BLND_FACT(BLENDFACT_INV_DST_COLR);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_DST_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_SRC_ALPHA_SATURATE:
- func |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA_SATURATE);
- break;
- case GL_CONSTANT_COLOR_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default:
- return;
- }
-
- switch(dfactor) {
- case GL_SRC_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_ZERO:
- func |= DST_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_ONE:
- func |= DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_SRC_COLOR:
- func |= DST_BLND_FACT(BLENDFACT_SRC_COLR);
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func |= DST_BLND_FACT(BLENDFACT_INV_SRC_COLR);
- break;
- case GL_DST_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_CONSTANT_COLOR_EXT:
- func |= DST_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- func |= DST_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- func |= DST_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- func |= DST_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~SRC_DST_ABLEND_MASK;
- imesa->Setup[I830_CTXREG_STATE1] &= ~SRC_DST_BLND_MASK;
- imesa->Setup[I830_CTXREG_STATE1] |= func;
- /* Insure Independant Alpha Blend is really disabled. */
- i830EvalLogicOpBlendState(ctx);
-}
-
-static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int funcA = (ENABLE_SRC_ABLEND_FACTOR|ENABLE_DST_ABLEND_FACTOR);
- int funcRGB = (ENABLE_SRC_BLND_FACTOR|ENABLE_DST_BLND_FACTOR);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch(sfactorA) {
- case GL_ZERO:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_ZERO);
- break;
- case GL_SRC_ALPHA:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_ONE);
- break;
- case GL_DST_COLOR:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_DST_COLR);
- break;
- case GL_ONE_MINUS_DST_COLOR:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_INV_DST_COLR);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_DST_ALPHA:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_SRC_ALPHA_SATURATE:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_SRC_ALPHA_SATURATE);
- break;
- case GL_CONSTANT_COLOR_EXT:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- funcA |= SRC_ABLEND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default: return;
- }
-
- switch(dfactorA) {
- case GL_SRC_ALPHA:
- funcA |= DST_ABLEND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- funcA |= DST_ABLEND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_ZERO:
- funcA |= DST_ABLEND_FACT(BLENDFACT_ZERO);
- break;
- case GL_ONE:
- funcA |= DST_ABLEND_FACT(BLENDFACT_ONE);
- break;
- case GL_SRC_COLOR:
- funcA |= DST_ABLEND_FACT(BLENDFACT_SRC_COLR);
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- funcA |= DST_ABLEND_FACT(BLENDFACT_INV_SRC_COLR);
- break;
- case GL_DST_ALPHA:
- funcA |= DST_ABLEND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- funcA |= DST_ABLEND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_CONSTANT_COLOR_EXT:
- funcA |= DST_ABLEND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- funcA |= DST_ABLEND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- funcA |= DST_ABLEND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- funcA |= DST_ABLEND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default: return;
- }
-
- switch(sfactorRGB) {
- case GL_ZERO:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_SRC_ALPHA:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_DST_COLOR:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_DST_COLR);
- break;
- case GL_ONE_MINUS_DST_COLOR:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_INV_DST_COLR);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_DST_ALPHA:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_SRC_ALPHA_SATURATE:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA_SATURATE);
- break;
- case GL_CONSTANT_COLOR_EXT:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- funcRGB |= SRC_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default: return;
- }
-
- switch(dfactorRGB) {
- case GL_SRC_ALPHA:
- funcRGB |= DST_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- funcRGB |= DST_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_ZERO:
- funcRGB |= DST_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_ONE:
- funcRGB |= DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_SRC_COLOR:
- funcRGB |= DST_BLND_FACT(BLENDFACT_SRC_COLR);
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- funcRGB |= DST_BLND_FACT(BLENDFACT_INV_SRC_COLR);
- break;
- case GL_DST_ALPHA:
- funcRGB |= DST_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- funcRGB |= DST_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_CONSTANT_COLOR_EXT:
- funcRGB |= DST_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- funcRGB |= DST_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- funcRGB |= DST_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- funcRGB |= DST_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default: return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~SRC_DST_ABLEND_MASK;
- imesa->Setup[I830_CTXREG_IALPHAB] |= funcA;
- imesa->Setup[I830_CTXREG_STATE1] &= ~SRC_DST_BLND_MASK;
- imesa->Setup[I830_CTXREG_STATE1] |= funcRGB;
-
- /* Insure Independant Alpha Blend is really enabled if
- * Blending is already enabled.
- */
- i830EvalLogicOpBlendState(ctx);
-}
-
-static void i830DepthFunc(GLcontext *ctx, GLenum func)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default: return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(test));
-}
-
-static void i830DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
-
- if (flag && ctx->Depth.Test)
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE;
- else
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i830 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i830PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- imesa->reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- imesa->hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- imesa->hw_stipple = 0;
- return;
- }
-
- imesa->StippleSetup[I830_STPREG_ST1] &= ~0xffff;
- imesa->StippleSetup[I830_STPREG_ST1] |= newMask;
- imesa->hw_stipple = 1;
-
- if (active)
- imesa->StippleSetup[I830_STPREG_ST1] |= ST1_ENABLE;
-}
-
-static void i830PolygonStippleFallback( GLcontext *ctx, const GLubyte *mask )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- imesa->hw_stipple = 0;
- (void) i830PolygonStipple;
-}
-
-/* =============================================================
- * Hardware clipping
- */
-static void i830Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int x1 = x;
- int y1 = imesa->driDrawable->h - (y + h);
- int x2 = x + w - 1;
- int y2 = y1 + h - 1;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- if (x2 >= imesa->i830Screen->width) x2 = imesa->i830Screen->width-1;
- if (y2 >= imesa->i830Screen->height) y2 = imesa->i830Screen->height-1;
- if (x1 >= imesa->i830Screen->width) x1 = imesa->i830Screen->width-1;
- if (y1 >= imesa->i830Screen->height) y1 = imesa->i830Screen->height-1;
-
-
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- imesa->BufferSetup[I830_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i830LogicOp(GLcontext *ctx, GLenum opcode)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int tmp = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* FIXME: This should be a look-up table, like the r200 driver. */
- switch(opcode) {
- case GL_CLEAR:
- tmp = LOGICOP_CLEAR;
- break;
- case GL_AND:
- tmp = LOGICOP_AND;
- break;
- case GL_AND_REVERSE:
- tmp = LOGICOP_AND_RVRSE;
- break;
- case GL_COPY:
- tmp = LOGICOP_COPY;
- break;
- case GL_COPY_INVERTED:
- tmp = LOGICOP_COPY_INV;
- break;
- case GL_AND_INVERTED:
- tmp = LOGICOP_AND_INV;
- break;
- case GL_NOOP:
- tmp = LOGICOP_NOOP;
- break;
- case GL_XOR:
- tmp = LOGICOP_XOR;
- break;
- case GL_OR:
- tmp = LOGICOP_OR;
- break;
- case GL_OR_INVERTED:
- tmp = LOGICOP_OR_INV;
- break;
- case GL_NOR:
- tmp = LOGICOP_NOR;
- break;
- case GL_EQUIV:
- tmp = LOGICOP_EQUIV;
- break;
- case GL_INVERT:
- tmp = LOGICOP_INV;
- break;
- case GL_OR_REVERSE:
- tmp = LOGICOP_OR_RVRSE;
- break;
- case GL_NAND:
- tmp = LOGICOP_NAND;
- break;
- case GL_SET:
- tmp = LOGICOP_SET;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-
- /* Make sure all the enables are correct */
- i830EvalLogicOpBlendState(ctx);
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void i830RenderMode( GLcontext *ctx, GLenum mode )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- FALLBACK( imesa, I830_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-static void i830DrawBuffer(GLcontext *ctx, GLenum mode )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- I830_FIREVERTICES(imesa);
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = imesa->i830Screen->fbOffset;
- i830XMesaSetFrontClipRects( imesa );
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BACK_LEFT_BIT:
- I830_FIREVERTICES(imesa);
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] =
- imesa->i830Screen->backOffset;
- i830XMesaSetBackClipRects( imesa );
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that i830SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-static void i830ReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-static void i830ClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_red, color[0]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_green, color[1]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_blue, color[2]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_alpha, color[3]);
-
- imesa->ClearColor = i830PackColor(imesa->i830Screen->fbFormat,
- imesa->clear_red,
- imesa->clear_green,
- imesa->clear_blue,
- imesa->clear_alpha);
-}
-
-static void i830CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint mode = CULLMODE_BOTH;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- }
-
- imesa->LcsCullMode = mode;
-
- if (ctx->Polygon.CullFlag) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- imesa->Setup[I830_CTXREG_STATE3] |= ENABLE_CULL_MODE | mode;
- }
-}
-
-static void i830LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- int width;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = FloatToInt(widthf * 2);
- CLAMP_SELF(width, 1, 15);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE5] &= ~FIXED_LINE_WIDTH_MASK;
- imesa->Setup[I830_CTXREG_STATE5] |= (ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(width));
-}
-
-static void i830PointSize(GLcontext *ctx, GLfloat size)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLint point_size = FloatToInt(size);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 256);
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK;
- imesa->Setup[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(point_size));
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i830ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint tmp = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- imesa->mask_red = !r;
- imesa->mask_green = !g;
- imesa->mask_blue = !b;
- imesa->mask_alpha = !a;
-
- tmp = (imesa->Setup[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) |
- ENABLE_COLOR_MASK |
- ENABLE_COLOR_WRITE |
- ((!r) << WRITEMASK_RED_SHIFT) |
- ((!g) << WRITEMASK_GREEN_SHIFT) |
- ((!b) << WRITEMASK_BLUE_SHIFT) |
- ((!a) << WRITEMASK_ALPHA_SHIFT);
-
- if (tmp != imesa->Setup[I830_CTXREG_ENABLES_2]) {
- I830_FIREVERTICES(imesa);
- imesa->dirty |= I830_UPLOAD_CTX;
- imesa->Setup[I830_CTXREG_ENABLES_2] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD;
-}
-
-static void i830LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i830ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
-
-#define SHADE_MODE_MASK ((1<<10)|(1<<8)|(1<<6)|(1<<4))
-
- imesa->Setup[I830_CTXREG_STATE3] &= ~SHADE_MODE_MASK;
-
- if (mode == GL_FLAT) {
- imesa->Setup[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_FLAT) |
- FOG_SHADE_MODE(SHADE_MODE_FLAT) |
- SPEC_SHADE_MODE(SHADE_MODE_FLAT) |
- COLOR_SHADE_MODE(SHADE_MODE_FLAT));
- } else {
- imesa->Setup[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR));
- }
-}
-
-/* =============================================================
- * Fog
- */
-static void i830Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_FOGCOLOR] = (STATE3D_FOG_COLOR_CMD | color);
- }
-}
-
-/* =============================================================
- */
-
-static void i830Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- switch(cap) {
- case GL_LIGHTING:
- case GL_COLOR_SUM_EXT:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_ALPHA_TEST_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_ALPHA_TEST;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_ALPHA_TEST;
-
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- case GL_INDEX_LOGIC_OP:
- i830EvalLogicOpBlendState(ctx);
- break;
-
- case GL_DITHER:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_DITHER;
-
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_DITHER;
- else
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_DITHER;
- break;
-
- case GL_DEPTH_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
-
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
-
- /* Also turn off depth writes when GL_DEPTH_TEST is disabled:
- */
- i830DepthMask( ctx, state );
- break;
-
- case GL_SCISSOR_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
-
- if (state)
- imesa->BufferSetup[I830_DESTREG_SENABLE] =
- (STATE3D_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- imesa->BufferSetup[I830_DESTREG_SENABLE] =
- (STATE3D_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- imesa->upload_cliprects = GL_TRUE;
- break;
-
- case GL_LINE_SMOOTH:
- if (imesa->reduced_primitive == GL_LINES) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_AA] &= ~AA_LINE_ENABLE;
- if (state)
- imesa->Setup[I830_CTXREG_AA] |= AA_LINE_ENABLE;
- else
- imesa->Setup[I830_CTXREG_AA] |= AA_LINE_DISABLE;
- }
- break;
-
- case GL_FOG:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_FOG_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= I830_ENABLE_FOG;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= I830_DISABLE_FOG;
- break;
-
- case GL_CULL_FACE:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_CULL_MODE |
- imesa->LcsCullMode);
- else
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_CULL_MODE |
- CULLMODE_NONE);
- break;
-
- case GL_TEXTURE_2D:
-/* I830_STATECHANGE(imesa, I830_UPLOAD_CTX); */
-/* imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK; */
- break;
-
- case GL_STENCIL_TEST:
- if (imesa->hw_stencil) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
-
- if (state) {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
- }
- } else {
- FALLBACK( imesa, I830_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_POLYGON_STIPPLE:
-#if 0
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (imesa->hw_stipple && imesa->reduced_primitive == GL_TRIANGLES)
- {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] &= ~ST1_ENABLE;
- if (state)
- imesa->StippleSetup[I830_STPREG_ST1] |= ST1_ENABLE;
- }
-#endif
- break;
-
- default:
- ;
- }
-}
-
-
-void i830EmitDrawingRectangle( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- int x0 = imesa->drawX;
- int y0 = imesa->drawY;
- int x1 = x0 + dPriv->w;
- int y1 = y0 + dPriv->h;
-
- /* Don't set drawing rectangle */
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s x0(%d) x1(%d) y0(%d) y1(%d)\n", __FUNCTION__,
- x0, x1, y0, y1);
-
- /* Coordinate origin of the window - may be offscreen.
- */
- imesa->BufferSetup[I830_DESTREG_DR4] = ((y0<<16) |
- (((unsigned)x0)&0xFFFF));
-
- /* Clip to screen.
- */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i830Screen->width-1) x1 = i830Screen->width-1;
- if (y1 > i830Screen->height-1) y1 = i830Screen->height-1;
-
-
- /* Onscreen drawing rectangle.
- */
- imesa->BufferSetup[I830_DESTREG_DR2] = ((y0<<16) | x0);
- imesa->BufferSetup[I830_DESTREG_DR3] = (((y1+1)<<16) | (x1+1));
-
-
- /* Just add in our dirty flag, since we might be called when locked */
- /* Might want to modify how this is done. */
- imesa->dirty |= I830_UPLOAD_BUFFERS;
-
- if (0)
- fprintf(stderr, "[%s] DR2(0x%08x) DR3(0x%08x) DR4(0x%08x)\n",
- __FUNCTION__,
- imesa->BufferSetup[I830_DESTREG_DR2],
- imesa->BufferSetup[I830_DESTREG_DR3],
- imesa->BufferSetup[I830_DESTREG_DR4]);
-}
-
-/* This could be done in hardware, will do once I have the driver
- * up and running.
- */
-static void i830CalcViewport( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = imesa->ViewportMatrix.m;
-
- /* See also i830_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + imesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * imesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * imesa->depth_scale;
-}
-
-static void i830Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- i830CalcViewport( ctx );
-}
-
-static void i830DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- i830CalcViewport( ctx );
-}
-
-void i830PrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%x): %s%s%s%s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & I830_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & I830_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & I830_UPLOAD_CTX) ? "upload-ctx, " : "",
- (state & I830_UPLOAD_BUFFERS) ? "upload-bufs, " : "",
- (state & I830_UPLOAD_TEXBLEND0) ? "upload-blend0, " : "",
- (state & I830_UPLOAD_TEXBLEND1) ? "upload-blend1, " : "",
- (state & I830_UPLOAD_STIPPLE) ? "stipple, " : ""
- );
-}
-
-/* Push the state into the sarea and/or texture memory.
- */
-void i830EmitHwStateLocked( i830ContextPtr imesa )
-{
- int i;
-
- if (I830_DEBUG & DEBUG_STATE)
- i830PrintDirty( __FUNCTION__, imesa->dirty );
-
- if ((imesa->dirty & I830_UPLOAD_TEX0_IMAGE) && imesa->CurrentTexObj[0])
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[0]);
- if ((imesa->dirty & I830_UPLOAD_TEX1_IMAGE) && imesa->CurrentTexObj[1])
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[1]);
- if (imesa->dirty & I830_UPLOAD_CTX) {
- memcpy( imesa->sarea->ContextState,
- imesa->Setup, sizeof(imesa->Setup) );
- }
-
- for (i = 0; i < I830_TEXTURE_COUNT; i++) {
- if ((imesa->dirty & I830_UPLOAD_TEX_N(i)) && imesa->CurrentTexObj[i]) {
- imesa->sarea->dirty |= I830_UPLOAD_TEX_N(i);
- memcpy(imesa->sarea->TexState[i],
- imesa->CurrentTexObj[i]->Setup,
- sizeof(imesa->sarea->TexState[i]));
-
- imesa->sarea->TexState[i][I830_TEXREG_TM0S3] &= ~TM0S3_LOD_BIAS_MASK;
- imesa->sarea->TexState[i][I830_TEXREG_TM0S3] |= imesa->LodBias[i];
-
- /* Update the LRU usage */
- if (imesa->CurrentTexObj[i]->base.memBlock)
- driUpdateTextureLRU( (driTextureObject *)
- imesa->CurrentTexObj[i] );
- }
- }
- /* Need to figure out if texturing state, or enable changed. */
-
- for (i = 0; i < I830_TEXBLEND_COUNT; i++) {
- if (imesa->dirty & I830_UPLOAD_TEXBLEND_N(i)) {
- imesa->sarea->dirty |= I830_UPLOAD_TEXBLEND_N(i);
- memcpy(imesa->sarea->TexBlendState[i],imesa->TexBlend[i],
- imesa->TexBlendWordsUsed[i] * 4);
- imesa->sarea->TexBlendStateWordsUsed[i] =
- imesa->TexBlendWordsUsed[i];
- }
- }
-
- if (imesa->dirty & I830_UPLOAD_BUFFERS) {
- memcpy( imesa->sarea->BufferState,imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- }
-
- if (imesa->dirty & I830_UPLOAD_STIPPLE) {
- memcpy( imesa->sarea->StippleState,imesa->StippleSetup,
- sizeof(imesa->StippleSetup) );
- }
-
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_SHARED) {
- memcpy( imesa->sarea->Palette[0],imesa->palette,
- sizeof(imesa->sarea->Palette[0]));
- } else {
- i830TextureObjectPtr p;
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(0)) {
- p = imesa->CurrentTexObj[0];
- memcpy( imesa->sarea->Palette[0],p->palette,
- sizeof(imesa->sarea->Palette[0]));
- }
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(1)) {
- p = imesa->CurrentTexObj[1];
- memcpy( imesa->sarea->Palette[1],
- p->palette,
- sizeof(imesa->sarea->Palette[1]));
- }
- }
-
- imesa->sarea->dirty |= (imesa->dirty & ~(I830_UPLOAD_TEX_MASK |
- I830_UPLOAD_TEXBLEND_MASK));
-
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = 0;
-}
-
-
-void i830DDInitState( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- int i, j;
-
- imesa->clear_red = 0;
- imesa->clear_green = 0;
- imesa->clear_blue = 0;
- imesa->clear_alpha = 0;
-
- imesa->mask_red = GL_FALSE;
- imesa->mask_green = GL_FALSE;
- imesa->mask_blue = GL_FALSE;
- imesa->mask_alpha = GL_FALSE;
-
- /* Zero all texture state */
- for (i = 0; i < I830_TEXBLEND_COUNT; i++) {
- for (j = 0; j < I830_TEXBLEND_SIZE; j++) {
- imesa->TexBlend[i][j] = 0;
- imesa->Init_TexBlend[i][j] = 0;
- }
- imesa->TexBlendWordsUsed[i] = 0;
- imesa->Init_TexBlendWordsUsed[i] = 0;
- imesa->TexBlendColorPipeNum[i] = 0;
- imesa->Init_TexBlendColorPipeNum[i] = 0;
- }
-
- /* Set default blend state */
- imesa->TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
- imesa->TexBlend[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
-
- imesa->TexBlendWordsUsed[0] = 4;
- imesa->TexBlendColorPipeNum[0] = 0;
-
- imesa->Init_TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- imesa->Init_TexBlend[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->Init_TexBlend[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->Init_TexBlend[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->Init_TexBlendWordsUsed[0] = 4;
- imesa->Init_TexBlendColorPipeNum[0] = 0;
-
- memset(imesa->Setup, 0, sizeof(imesa->Setup));
-
- imesa->Setup[I830_CTXREG_VF] = (STATE3D_VERTEX_FORMAT_CMD |
- VRTX_TEX_COORD_COUNT(1) |
- VRTX_HAS_DIFFUSE |
- VRTX_HAS_SPEC |
- VRTX_HAS_XYZW);
- imesa->vertex_format = 0;
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
-
- imesa->Setup[I830_CTXREG_AA] = (STATE3D_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0 |
- AA_LINE_DISABLE);
-
- imesa->Setup[I830_CTXREG_ENABLES_1] = (STATE3D_ENABLES_1_CMD |
- DISABLE_LOGIC_OP |
- DISABLE_STENCIL_TEST |
- DISABLE_DEPTH_BIAS |
- DISABLE_SPEC_ADD |
- I830_DISABLE_FOG |
- DISABLE_ALPHA_TEST |
- DISABLE_COLOR_BLEND |
- DISABLE_DEPTH_TEST);
-
- if (imesa->hw_stencil) {
- imesa->Setup[I830_CTXREG_ENABLES_2] = (STATE3D_ENABLES_2_CMD |
- ENABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_2] = (STATE3D_ENABLES_2_CMD |
- DISABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- }
-
- imesa->Setup[I830_CTXREG_STATE1] = (STATE3D_MODES_1_CMD |
- ENABLE_COLR_BLND_FUNC |
- BLENDFUNC_ADD |
- ENABLE_SRC_BLND_FACTOR |
- SRC_BLND_FACT(BLENDFACT_ONE) |
- ENABLE_DST_BLND_FACTOR |
- DST_BLND_FACT(BLENDFACT_ZERO) );
-
- imesa->Setup[I830_CTXREG_STATE2] = (STATE3D_MODES_2_CMD |
- ENABLE_GLOBAL_DEPTH_BIAS |
- GLOBAL_DEPTH_BIAS(0) |
- ENABLE_ALPHA_TEST_FUNC |
- ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ALPHA_REF_VALUE(0) );
-
- imesa->Setup[I830_CTXREG_STATE3] = (STATE3D_MODES_3_CMD |
- ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(COMPAREFUNC_LESS) |
- ENABLE_ALPHA_SHADE_MODE |
- ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_FOG_SHADE_MODE |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_SPEC_SHADE_MODE |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_COLOR_SHADE_MODE |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_CULL_MODE |
- CULLMODE_NONE);
-
- imesa->Setup[I830_CTXREG_STATE4] = (STATE3D_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
- imesa->Setup[I830_CTXREG_STENCILTST] = (STATE3D_STENCIL_TEST_CMD |
- ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ENABLE_STENCIL_REF_VALUE |
- STENCIL_REF_VALUE(0) );
-
- imesa->Setup[I830_CTXREG_STATE5] = (STATE3D_MODES_5_CMD |
- FLUSH_TEXTURE_CACHE |
- ENABLE_SPRITE_POINT_TEX |
- SPRITE_POINT_TEX_OFF |
- ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(0x2) | /* 1.0 */
- ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(1) );
-
- imesa->Setup[I830_CTXREG_IALPHAB] = (STATE3D_INDPT_ALPHA_BLEND_CMD |
- DISABLE_INDPT_ALPHA_BLEND |
- ENABLE_ALPHA_BLENDFUNC |
- ABLENDFUNC_ADD);
-
- imesa->Setup[I830_CTXREG_FOGCOLOR] = (STATE3D_FOG_COLOR_CMD |
- FOG_COLOR_RED(0) |
- FOG_COLOR_GREEN(0) |
- FOG_COLOR_BLUE(0));
-
- imesa->Setup[I830_CTXREG_BLENDCOLR0] = (STATE3D_CONST_BLEND_COLOR_CMD);
-
- imesa->Setup[I830_CTXREG_BLENDCOLR] = 0;
-
- imesa->Setup[I830_CTXREG_MCSB0] = STATE3D_MAP_COORD_SETBIND_CMD;
- imesa->Setup[I830_CTXREG_MCSB1] = (TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) |
- TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) |
- TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) |
- TEXBIND_SET0(TEXCOORDSRC_VTXSET_0));
-
- imesa->LcsCullMode = CULLMODE_CW; /* GL default */
-
- memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
- memset(imesa->StippleSetup, 0, sizeof(imesa->StippleSetup));
-
-
- if (imesa->glCtx->Visual.doubleBufferMode &&
- imesa->sarea->pf_current_page == 0) {
- imesa->drawMap = i830Screen->back.map;
- imesa->readMap = i830Screen->back.map;
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
- imesa->BufferSetup[I830_DESTREG_DBUFADDR] = 0;
- } else {
- /* use front buffer by default */
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
- imesa->BufferSetup[I830_DESTREG_DBUFADDR] = 0;
- }
-
- imesa->BufferSetup[I830_DESTREG_DV0] = STATE3D_DST_BUF_VARS_CMD;
-
- switch (i830Screen->fbFormat) {
- case DV_PF_555:
- case DV_PF_565:
- imesa->BufferSetup[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- i830Screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- imesa->BufferSetup[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- i830Screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
- imesa->BufferSetup[I830_DESTREG_SENABLE] = (STATE3D_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- imesa->BufferSetup[I830_DESTREG_SR0] = STATE3D_SCISSOR_RECT_0_CMD;
- imesa->BufferSetup[I830_DESTREG_SR1] = 0;
- imesa->BufferSetup[I830_DESTREG_SR2] = 0;
-
- imesa->BufferSetup[I830_DESTREG_DR0] = STATE3D_DRAW_RECT_CMD;
- imesa->BufferSetup[I830_DESTREG_DR1] = 0;
- imesa->BufferSetup[I830_DESTREG_DR2] = 0;
- imesa->BufferSetup[I830_DESTREG_DR3] = (((i830Screen->height)<<16) |
- (i830Screen->width));
- imesa->BufferSetup[I830_DESTREG_DR4] = 0;
-
- memcpy( imesa->Init_Setup,
- imesa->Setup,
- sizeof(imesa->Setup) );
- memcpy( imesa->Init_BufferSetup,
- imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
-
-}
-
-static void i830InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- I830_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-void i830DDInitStateFuncs(GLcontext *ctx)
-{
- /* Callbacks for internal Mesa events.
- */
- ctx->Driver.UpdateState = i830InvalidateState;
-
- /* API callbacks
- */
- ctx->Driver.AlphaFunc = i830AlphaFunc;
- ctx->Driver.BlendEquation = i830BlendEquation;
- ctx->Driver.BlendFunc = i830BlendFunc;
- ctx->Driver.BlendFuncSeparate = i830BlendFuncSeparate;
- ctx->Driver.BlendColor = i830BlendColor;
- ctx->Driver.ClearColor = i830ClearColor;
- ctx->Driver.ColorMask = i830ColorMask;
- ctx->Driver.CullFace = i830CullFaceFrontFace;
- ctx->Driver.DepthFunc = i830DepthFunc;
- ctx->Driver.DepthMask = i830DepthMask;
- ctx->Driver.Enable = i830Enable;
- ctx->Driver.Fogfv = i830Fogfv;
- ctx->Driver.FrontFace = i830CullFaceFrontFace;
- ctx->Driver.LineWidth = i830LineWidth;
- ctx->Driver.PointSize = i830PointSize;
- ctx->Driver.LogicOpcode = i830LogicOp;
- ctx->Driver.PolygonStipple = i830PolygonStippleFallback;
- ctx->Driver.RenderMode = i830RenderMode;
- ctx->Driver.Scissor = i830Scissor;
- ctx->Driver.DrawBuffer = i830DrawBuffer;
- ctx->Driver.ReadBuffer = i830ReadBuffer;
- ctx->Driver.ShadeModel = i830ShadeModel;
- ctx->Driver.DepthRange = i830DepthRange;
- ctx->Driver.Viewport = i830Viewport;
- ctx->Driver.LightModelfv = i830LightModelfv;
-
- ctx->Driver.StencilFunc = i830StencilFunc;
- ctx->Driver.StencilMask = i830StencilMask;
- ctx->Driver.StencilOp = i830StencilOp;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_state.h b/xc/lib/GL/mesa/src/drv/i830/i830_state.h
deleted file mode 100644
index b65165124..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_state.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_state.h,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#ifndef _I830_STATE_H
-#define _I830_STATE_H
-
-#include "i830_context.h"
-#include "colormac.h"
-#define FloatToInt(F) ((int)(F))
-
-/*
- * * This function/macro is sensitive to precision. Test carefully
- * * if you change it.
- * */
-#define FLOAT_COLOR_TO_UBYTE_COLOR(b, f) \
- do { \
- union {GLfloat r; GLuint i; } tmp; \
- tmp.r = f; \
- b = ((tmp.i >= IEEE_ONE) \
- ? ((GLint)tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \
- : (tmp.r = tmp.r*(255.0F/256.0F) + 32768.0F, \
- (GLubyte)tmp.i)); \
- } while (0)
-
-
-
-extern void i830DDInitState( GLcontext *ctx );
-extern void i830DDInitStateFuncs( GLcontext *ctx );
-
-extern void i830PrintDirty( const char *msg, GLuint state );
-extern void i830SetDrawBuffer(GLcontext *ctx, GLenum mode );
-
-extern void i830Fallback( i830ContextPtr imesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) i830Fallback( imesa, bit, mode )
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tex.c b/xc/lib/GL/mesa/src/drv/i830/i830_tex.c
deleted file mode 100644
index a1e5fa327..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tex.c
+++ /dev/null
@@ -1,578 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tex.c,v 1.5 2003/05/07 21:56:31 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-static void i830ComputeLodBias( i830ContextPtr imesa, unsigned unit,
- GLfloat bias )
-{
- int b;
-
- b = (int) (bias * 16.0);
- if(b > 63) b = 63;
- else if (b < -64) b = -64;
- imesa->LodBias[ unit ] = ((b << TM0S3_LOD_BIAS_SHIFT) &
- TM0S3_LOD_BIAS_MASK);
-}
-
-
-/**
- * Set the texture wrap modes.
- *
- * The i830M (and related graphics cores) do not support GL_CLAMP. The Intel
- * drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void i830SetTexWrapping(i830TextureObjectPtr tex,
- GLenum swrap, GLenum twrap)
-{
- tex->Setup[I830_TEXREG_MCS] &= ~(TEXCOORD_ADDR_U_MASK|TEXCOORD_ADDR_V_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-}
-
-static void i830SetTexMaxAnisotropy( i830TextureObjectPtr t, GLfloat max )
-{
- t->max_anisotropy = max;
-}
-
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- * \param bias LOD bias for this texture unit.
- */
-
-static void i830SetTexFilter( i830TextureObjectPtr t,
- GLenum minf, GLenum magf )
-{
- int minFilt = 0, mipFilt = 0, magFilt = 0;
-
- if(I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( t->max_anisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (minf) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- _mesa_problem(NULL, "%s: Unsupported min. filter %d", __FUNCTION__,
- (int) minf );
- break;
- }
-
- switch (magf) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- _mesa_problem(NULL, "%s: Unsupported mag. filter %d", __FUNCTION__,
- (int) magf );
- break;
- }
- }
-
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIP_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAG_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((minFilt << TM0S3_MIN_FILTER_SHIFT) |
- (mipFilt << TM0S3_MIP_FILTER_SHIFT) |
- (magFilt << TM0S3_MAG_FILTER_SHIFT));
-}
-
-static void i830SetTexBorderColor(i830TextureObjectPtr t, GLubyte color[4])
-{
- if(I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- t->Setup[I830_TEXREG_TM0S4] =
- I830PACKCOLOR8888(color[0],color[1],color[2],color[3]);
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static i830TextureObjectPtr i830AllocTexObj( struct gl_texture_object *texObj )
-{
- i830TextureObjectPtr t;
-
- t = CALLOC_STRUCT( i830_texture_object_t );
- texObj->DriverData = t;
- if ( t != NULL ) {
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
-
- t->Setup[I830_TEXREG_TM0LI] = STATE3D_LOAD_STATE_IMMEDIATE_2;
- t->Setup[I830_TEXREG_TM0S0] = TM0S0_USE_FENCE;
- t->Setup[I830_TEXREG_TM0S1] = 0;
- t->Setup[I830_TEXREG_TM0S2] = 0;
- t->Setup[I830_TEXREG_TM0S3] = 0;
-
- t->Setup[I830_TEXREG_NOP0] = 0;
- t->Setup[I830_TEXREG_NOP1] = 0;
- t->Setup[I830_TEXREG_NOP2] = 0;
-
- t->Setup[I830_TEXREG_MCS] = (STATE3D_MAP_COORD_SET_CMD |
- MAP_UNIT(0) |
- ENABLE_TEXCOORD_PARAMS |
- TEXCOORDS_ARE_NORMAL |
- TEXCOORDTYPE_CARTESIAN |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP));
-
- make_empty_list( & t->base );
-
- i830SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
- i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- i830SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- i830SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static void i830TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- GLuint unit = ctx->Texture.CurrentUnit;
- if (!t)
- return;
-
- if ( target != GL_TEXTURE_2D )
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting imesa->NewGLState means that
- * i830UpdateTextureState() will be called before any triangles are
- * rendered. If a statechange has occurred, it will be detected at
- * that point, and buffered vertices flushed.
- */
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- i830SetTexMaxAnisotropy( t, tObj->MaxAnisotropy );
- i830SetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- i830SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- i830SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* The i830 and its successors can do a lot of this without
- * reloading the textures. A project for someone?
- */
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- if (t == imesa->CurrentTexObj[unit]) {
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX0 );
- }
-}
-
-
-static void i830TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- /* Only one env color. Need a fallback if env colors are different
- * and texture setup references env color in both units.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR:
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB_EXT:
- case GL_COMBINE_ALPHA_EXT:
- case GL_SOURCE0_RGB_EXT:
- case GL_SOURCE1_RGB_EXT:
- case GL_SOURCE2_RGB_EXT:
- case GL_SOURCE0_ALPHA_EXT:
- case GL_SOURCE1_ALPHA_EXT:
- case GL_SOURCE2_ALPHA_EXT:
- case GL_OPERAND0_RGB_EXT:
- case GL_OPERAND1_RGB_EXT:
- case GL_OPERAND2_RGB_EXT:
- case GL_OPERAND0_ALPHA_EXT:
- case GL_OPERAND1_ALPHA_EXT:
- case GL_OPERAND2_ALPHA_EXT:
- case GL_RGB_SCALE_EXT:
- case GL_ALPHA_SCALE:
- imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
- i830ComputeLodBias( imesa, unit, *param );
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX_N(unit) );
- break;
-
- default:
- break;
- }
-}
-
-static void i830TexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i830AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void i830TexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
-}
-
-
-static void i830BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- if (!tObj->DriverData) {
- i830AllocTexObj( tObj );
- }
-}
-
-
-static void i830DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t != NULL ) {
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- if ( imesa ) {
- I830_FIREVERTICES( imesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-
-static const struct gl_texture_format *
-i830ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- const GLboolean do32bpt = ( imesa->i830Screen->cpp == 4 &&
- imesa->i830Screen->textureSize > 4*1024*1024);
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-void i830DDInitTextureFuncs( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- ctx->Driver.TexEnv = i830TexEnv;
- ctx->Driver.ChooseTextureFormat = i830ChooseTextureFormat;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = i830TexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = i830TexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.BindTexture = i830BindTexture;
- ctx->Driver.DeleteTexture = i830DeleteTexture;
- ctx->Driver.TexParameter = i830TexParameter;
- ctx->Driver.UpdateTexturePalette = NULL;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- driInitTextureObjects( ctx, & imesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_2D
- | DRI_TEXMGR_DO_TEXTURE_RECT );
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tex.h b/xc/lib/GL/mesa/src/drv/i830/i830_tex.h
deleted file mode 100644
index dbfcbe396..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tex.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use in the I830M driver:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#ifndef I830TEX_INC
-#define I830TEX_INC
-
-#include "mtypes.h"
-#include "i830_context.h"
-#include "i830_3d_reg.h"
-#include "texmem.h"
-
-#define I830_TEX_MAXLEVELS 10
-
-struct i830_texture_object_t
-{
- driTextureObject base;
-
- int texelBytes;
- int Pitch;
- int Height;
- char *BufAddr;
- GLenum palette_format;
- GLuint palette[256];
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[6][I830_TEX_MAXLEVELS];
-
- /* Support for multitexture.
- */
-
- GLuint current_unit;
- GLuint Setup[I830_TEX_SETUP_SIZE];
- GLuint dirty;
-
- GLfloat max_anisotropy;
-};
-
-void i830UpdateTextureState( GLcontext *ctx );
-void i830DDInitTextureFuncs( GLcontext *ctx );
-void i830UpdateTexUnitProj( GLcontext *ctx, GLuint unit, GLboolean state );
-
-void i830DestroyTexObj( i830ContextPtr imesa, i830TextureObjectPtr t );
-int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c b/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c
deleted file mode 100644
index 6cb553134..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_texmem.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-
-void i830DestroyTexObj(i830ContextPtr imesa, i830TextureObjectPtr t)
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
- if ( imesa != NULL ) {
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == imesa->CurrentTexObj[ i ] ) {
- imesa->CurrentTexObj[ i ] = NULL;
- imesa->dirty &= ~(I830_UPLOAD_TEX0 << i);
- }
- }
- }
-}
-
-/* From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- */
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
-{
-int d0, d1, d2;
-__asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
-return (to);
-}
-
-
-/* Upload an image from mesa's internal copy.
- */
-static void i830UploadTexLevel( i830ContextPtr imesa,
- i830TextureObjectPtr t, int hwlevel )
-{
- const struct gl_texture_image *image = t->image[0][hwlevel].image;
- int j;
-
- if (!image || !image->Data)
- return;
-
- if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- memcpy( dst, src, t->Pitch * image->Height );
- }
- else switch (image->TexFormat->TexelBytes) {
- case 1:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- __memcpy(dst, src, image->Width );
- src += image->Width;
- }
- }
- break;
-
- case 2:
- {
- GLushort *dst = (GLushort *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLushort *src = (GLushort *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) {
- __memcpy(dst, src, image->Width * 2 );
- src += image->Width;
- }
- }
- break;
-
- case 4:
- {
- GLuint *dst = (GLuint *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLuint *src = (GLuint *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/4)) {
- __memcpy(dst, src, image->Width * 4 );
- src += image->Width;
- }
- }
- break;
-
- default:
- fprintf(stderr, "%s: Not supported texel size %d\n",
- __FUNCTION__, image->TexFormat->TexelBytes);
- }
-}
-
-
-/* This is called with the lock held. May have to eject our own and/or
- * other client's texture objects to make room for the upload.
- */
-
-int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t )
-{
- int ofs;
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( imesa->texture_heaps, imesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- return -1;
- }
-
- /* Set the base offset of the texture image */
- ofs = t->base.memBlock->ofs;
- t->BufAddr = imesa->i830Screen->tex.map + ofs;
- t->Setup[I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE |
- (imesa->i830Screen->textureOffset + ofs));
-
- if (t == imesa->CurrentTexObj[0])
- imesa->dirty |= I830_UPLOAD_TEX0;
-
- if (t == imesa->CurrentTexObj[1])
- imesa->dirty |= I830_UPLOAD_TEX1;
-#if 0
- if (t == imesa->CurrentTexObj[2])
- I830_STATECHANGE(imesa, I830_UPLOAD_TEX2);
-
- if (t == imesa->CurrentTexObj[3])
- I830_STATECHANGE(imesa, I830_UPLOAD_TEX3);
-#endif
- }
-
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (imesa->texture_heaps[0]->timestamp >= GET_DISPATCH_AGE(imesa))
- i830WaitAgeLocked( imesa, imesa->texture_heaps[0]->timestamp );
-
- /* Upload any images that are new */
- if (t->base.dirty_images[0]) {
- int i;
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- for (i = 0 ; i < numLevels ; i++) {
- if ( (t->base.dirty_images[0] & (1 << (i+t->base.firstLevel))) != 0 ) {
- i830UploadTexLevel( imesa, t, i );
- }
- }
- t->base.dirty_images[0] = 0;
- imesa->sarea->perf_boxes |= I830_BOX_TEXTURE_LOAD;
- }
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c b/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c
deleted file mode 100644
index 4d211176f..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c
+++ /dev/null
@@ -1,1582 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_texstate.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "texutil.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
-
-static void i830SetTexImages( i830ContextPtr imesa,
- struct gl_texture_object *tObj )
-{
- GLuint total_height, pitch, i, textureFormat;
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint numLevels;
-
- switch( baseImage->TexFormat->MesaFormat ) {
- case MESA_FORMAT_L8:
- t->texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
- break;
-
- case MESA_FORMAT_I8:
- t->texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
- break;
-
- case MESA_FORMAT_AL88:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
- break;
-
- case MESA_FORMAT_RGB565:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
-
- case MESA_FORMAT_ARGB1555:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- break;
-
- case MESA_FORMAT_ARGB4444:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
- break;
-
- case MESA_FORMAT_ARGB8888:
- t->texelBytes = 4;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
-
- case MESA_FORMAT_YCBCR_REV:
- t->texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL |
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- case MESA_FORMAT_YCBCR:
- t->texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY | /* ??? */
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- default:
- fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
- free( t );
- return;
- }
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- /* Pitch would be subject to additional rules if texture memory were
- * tiled. Currently it isn't.
- */
- if (0) {
- pitch = 128;
- while (pitch < tObj->Image[t->base.firstLevel]->Width * t->texelBytes)
- pitch *= 2;
- }
- else {
- pitch = tObj->Image[t->base.firstLevel]->Width * t->texelBytes;
- pitch = (pitch + 3) & ~3;
- }
-
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( total_height = i = 0 ; i < numLevels ; i++ ) {
- t->image[0][i].image = tObj->Image[t->base.firstLevel + i];
- if (!t->image[0][i].image)
- break;
-
- t->image[0][i].offset = total_height * pitch;
- t->image[0][i].internalFormat = baseImage->Format;
- total_height += t->image[0][i].image->Height;
- }
-
- t->Pitch = pitch;
- t->base.totalSize = total_height*pitch;
- t->Setup[I830_TEXREG_TM0S1] =
- (((tObj->Image[t->base.firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((tObj->Image[t->base.firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) |
- textureFormat);
- t->Setup[I830_TEXREG_TM0S2] =
- ((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT));
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAX_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((numLevels - 1)*4) << TM0S3_MIN_MIP_SHIFT;
- t->dirty = I830_UPLOAD_TEX0 | I830_UPLOAD_TEX1;
-
- LOCK_HARDWARE( imesa );
- i830UploadTexImagesLocked( imesa, t );
- UNLOCK_HARDWARE( imesa );
-}
-
-/* ================================================================
- * Texture combine functions
- */
-static __inline__ GLuint GetTexelOp(GLint unit)
-{
- switch(unit) {
- case 0: return TEXBLENDARG_TEXEL0;
- case 1: return TEXBLENDARG_TEXEL1;
- case 2: return TEXBLENDARG_TEXEL2;
- case 3: return TEXBLENDARG_TEXEL3;
- default: return TEXBLENDARG_TEXEL0;
- }
-}
-
-static void i830SetBlend_GL1_2(i830ContextPtr imesa, int curTex,
- GLenum envMode, GLenum format)
-{
- GLuint texel_op = GetTexelOp(curTex);
-
- if(I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s %s %s unit (%d) texel_op(0x%x)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(envMode),
- curTex,
- texel_op);
-
- switch(envMode) {
- case GL_REPLACE:
- switch(format) {
- case GL_ALPHA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
-
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
- break;
-
- case GL_MODULATE:
- switch(format) {
- case GL_ALPHA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 5;
- break;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 5;
- break;
-
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 6;
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
- break;
-
- case GL_DECAL:
- switch(format) {
- case GL_RGB:
- case GL_YCBCR_MESA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
-
- case GL_RGBA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_REPLICATE_ALPHA |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 6;
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
- break;
-
- case GL_BLEND:
- switch(format) {
- case GL_ALPHA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 5;
- break;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 6;
- break;
-
- case GL_INTENSITY:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][6] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- imesa->TexBlend[curTex][7] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 8;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][6] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 7;
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
- break;
-
- case GL_ADD:
- switch(format) {
- case GL_ALPHA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 5;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 5;
- break;
-
- case GL_INTENSITY:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 6;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][4] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- imesa->TexBlend[curTex][5] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 6;
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
- break;
- default:
- /* Always set to passthru if something is funny */
- imesa->TexBlend[curTex][0] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][1] = (STATE3D_MAP_BLEND_OP_CMD(curTex) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[curTex][2] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[curTex][3] = (STATE3D_MAP_BLEND_ARG_CMD(curTex) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[curTex] = 0;
- imesa->TexBlendWordsUsed[curTex] = 4;
- break;
- }
-
- if (I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-}
-
-static void i830SetTexEnvCombine(i830ContextPtr imesa,
- const struct gl_texture_unit *texUnit,
- GLint unit)
-{
- GLuint blendop;
- GLuint ablendop;
- GLuint args_RGB[3];
- GLuint args_A[3];
- GLuint texel_op = GetTexelOp(unit);
- GLuint rgb_shift = texUnit->CombineScaleShiftRGB;
- GLuint alpha_shift = texUnit->CombineScaleShiftA;
- int i;
-
- if(I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch(texUnit->CombineModeRGB) {
- case GL_REPLACE:
- blendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- blendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- blendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- blendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- blendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- blendop = TEXBLENDOP_SUBTRACT;
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- rgb_shift = 0;
- alpha_shift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- blendop = TEXBLENDOP_DOT3;
- break;
- default:
- return;
- }
-
- blendop |= (rgb_shift << TEXOP_SCALE_SHIFT);
-
- switch(texUnit->CombineModeA) {
- case GL_REPLACE:
- ablendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- ablendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- ablendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- ablendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- ablendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- ablendop = TEXBLENDOP_SUBTRACT;
- break;
- default:
- return;
- }
-
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGBA) ) {
- ablendop = TEXBLENDOP_DOT3;
- }
-
- ablendop |= (alpha_shift << TEXOP_SCALE_SHIFT);
-
- /* Handle RGB args */
- for(i = 0; i < 3; i++) {
- switch(texUnit->CombineSourceRGB[i]) {
- case GL_TEXTURE:
- args_RGB[i] = texel_op;
- break;
- case GL_CONSTANT:
- args_RGB[i] = TEXBLENDARG_FACTOR_N;
- break;
- case GL_PRIMARY_COLOR:
- args_RGB[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_RGB[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return;
-
- }
-
- switch(texUnit->CombineOperandRGB[i]) {
- case GL_SRC_COLOR:
- args_RGB[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- args_RGB[i] |= TEXBLENDARG_INV_ARG;
- break;
- case GL_SRC_ALPHA:
- args_RGB[i] |= TEXBLENDARG_REPLICATE_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_RGB[i] |= (TEXBLENDARG_REPLICATE_ALPHA |
- TEXBLENDARG_INV_ARG);
- break;
- default:
- return;
- }
- }
-
- /* Handle A args */
- for(i = 0; i < 3; i++) {
- switch(texUnit->CombineSourceA[i]) {
- case GL_TEXTURE:
- args_A[i] = texel_op;
- break;
- case GL_CONSTANT:
- args_A[i] = TEXBLENDARG_FACTOR_N;
- break;
- case GL_PRIMARY_COLOR:
- args_A[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_A[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return;
-
- }
-
- switch(texUnit->CombineOperandA[i]) {
- case GL_SRC_ALPHA:
- args_A[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_A[i] |= TEXBLENDARG_INV_ARG;
- break;
- default:
- return;
- }
- }
-
- /* Native Arg1 == Arg0 in GL_EXT_texture_env_combine spec */
- /* Native Arg2 == Arg1 in GL_EXT_texture_env_combine spec */
- /* Native Arg0 == Arg2 in GL_EXT_texture_env_combine spec */
-
- /* When we render we need to figure out which is the last really enabled
- * tex unit, and put last stage on it
- */
-
- imesa->TexBlendColorPipeNum[unit] = 0;
-
- /* Build color pipeline */
-
- imesa->TexBlend[unit][0] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_MODIFY_PARMS |
- blendop);
- imesa->TexBlend[unit][1] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[0]);
- imesa->TexBlend[unit][2] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[1]);
- imesa->TexBlend[unit][3] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[2]);
-
- /* Build Alpha pipeline */
- imesa->TexBlend[unit][4] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_MODIFY_PARMS |
- ablendop);
- imesa->TexBlend[unit][5] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[0]);
- imesa->TexBlend[unit][6] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[1]);
- imesa->TexBlend[unit][7] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[2]);
-
- {
- GLubyte r, g, b, a;
- GLfloat *fc = texUnit->EnvColor;
-
- FLOAT_COLOR_TO_UBYTE_COLOR(r, fc[RCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(g, fc[GCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(b, fc[BCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(a, fc[ACOMP]);
-
- imesa->TexBlend[unit][8] = STATE3D_COLOR_FACTOR_CMD(unit);
- imesa->TexBlend[unit][9] = ((a << 24) |
- (r << 16) |
- (g << 8) |
- b);
- }
- imesa->TexBlendWordsUsed[unit] = 10;
-}
-
-
-
-
-static void i830UpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint col;
-
- imesa->TexBlendWordsUsed[unit] = 0;
-
- if (0) fprintf(stderr, "i830UpdateTexEnv called : %s\n",
- _mesa_lookup_enum_by_nr(texUnit->EnvMode));
-
- if(texUnit->EnvMode == GL_COMBINE) {
- i830SetTexEnvCombine(imesa,
- texUnit,
- unit);
- } else {
- i830SetBlend_GL1_2(imesa,
- unit,
- texUnit->EnvMode,
- t->image[0][0].internalFormat);
-
- /* add blend color */
- {
- GLubyte r, g, b, a;
- GLfloat *fc = texUnit->EnvColor;
-
- FLOAT_COLOR_TO_UBYTE_COLOR(r, fc[RCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(g, fc[GCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(b, fc[BCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(a, fc[ACOMP]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- b);
- }
-
- {
- int i;
-
- i = imesa->TexBlendWordsUsed[unit];
- imesa->TexBlend[unit][i++] = STATE3D_COLOR_FACTOR_CMD(unit);
- imesa->TexBlend[unit][i++] = col;
-
- imesa->TexBlendWordsUsed[unit] = i;
- }
- }
-
- I830_STATECHANGE( imesa, I830_UPLOAD_TEXBLEND_N(unit) );
-}
-
-
-/* This is bogus -- can't load the same texture object on two units.
- */
-static void i830TexSetUnit( i830TextureObjectPtr t, GLuint unit )
-{
- if(I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s unit(%d)\n", __FUNCTION__, unit);
-
- t->Setup[I830_TEXREG_TM0LI] = (STATE3D_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << unit) | 4);
-
- I830_SET_FIELD(t->Setup[I830_TEXREG_MCS], MAP_UNIT_MASK, MAP_UNIT(unit));
-
- t->current_unit = unit;
- t->base.bound |= (1U << unit);
-}
-
-#define TEXCOORDTYPE_MASK (~((1<<13)|(1<<12)|(1<<11)))
-
-
-static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS] & TEXCOORDTYPE_MASK;
-
- /* Handle projective texturing */
- if (imesa->vertex_format & (1<<31)) {
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- } else {
- mcs |= TEXCOORDTYPE_CARTESIAN;
- }
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- i830SetTexImages( imesa, tObj );
- if (!t->base.memBlock) {
- return GL_FALSE;
- }
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (imesa->CurrentTexObj[unit] != t ||
- mcs != t->Setup[I830_TEXREG_MCS]) {
-
- if ( imesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- imesa->CurrentTexObj[unit]->base.bound &= ~(1U << unit);
- }
-
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
- imesa->CurrentTexObj[unit] = t;
- i830TexSetUnit(t, unit);
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- *
- * KW: doesn't work -- change from tex0 only to tex0+tex1 gets
- * missed (need to update last stage flag?). Call
- * i830UpdateTexEnv always.
- */
- if (tObj->Image[tObj->BaseLevel]->Format !=
- imesa->TexEnvImageFmt[unit]) {
- imesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format;
- }
- i830UpdateTexEnv( ctx, unit );
- imesa->TexEnabledMask |= I830_TEX_UNIT_ENABLED(unit);
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_NORMAL;
- mcs |= TEXCOORDS_ARE_IN_TEXELUNITS;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_IN_TEXELUNITS;
- mcs |= TEXCOORDS_ARE_NORMAL;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean disable_tex0( GLcontext *ctx )
-{
- const int unit = 0;
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- /* This is happening too often. I need to conditionally send diffuse
- * state to the card. Perhaps a diffuse dirty flag of some kind.
- * Will need to change this logic if more than 2 texture units are
- * used. We need to only do this up to the last unit enabled, or unit
- * one if nothing is enabled.
- */
-
- if ( imesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- imesa->CurrentTexObj[unit]->base.bound &= ~(1U << unit);
- imesa->CurrentTexObj[unit] = NULL;
- }
-
- imesa->TexEnvImageFmt[unit] = 0;
- imesa->dirty &= ~(I830_UPLOAD_TEX_N(unit));
-
- imesa->TexBlend[unit][0] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[unit][1] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[unit][2] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[unit][3] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[unit] = 0;
- imesa->TexBlendWordsUsed[unit] = 4;
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEXBLEND_N(unit)));
-
- return GL_TRUE;
-}
-
-static GLboolean i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- imesa->TexEnabledMask &= ~(I830_TEX_UNIT_ENABLED(unit));
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_2d( ctx, unit ));
- }
- else if (texUnit->_ReallyEnabled == TEXTURE_RECT_BIT) {
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_rect( ctx, unit ));
- }
- else if (texUnit->_ReallyEnabled) {
- return GL_FALSE;
- }
- else if (unit == 0) {
- return disable_tex0( ctx );
- }
- else {
- return GL_TRUE;
- }
-}
-
-
-/* Called from vb code to update projective texturing properly */
-void i830UpdateTexUnitProj( GLcontext *ctx, GLuint unit, GLboolean state )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t;
- GLuint mcs;
-
- if (!tObj) return;
-
- t = (i830TextureObjectPtr)tObj->DriverData;
- mcs = (t->Setup[I830_TEXREG_MCS] &
- TEXCOORDTYPE_MASK &
- ~TEXCOORDS_ARE_NORMAL);
-
- /* Handle projective texturing */
- if (state) {
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- } else {
- mcs |= TEXCOORDTYPE_CARTESIAN;
- }
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
- mcs |= TEXCOORDS_ARE_NORMAL;
- }
- else if (texUnit->_ReallyEnabled == TEXTURE_RECT_BIT) {
- mcs |= TEXCOORDS_ARE_IN_TEXELUNITS;
- }
- else
- return;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-}
-
-/* Only deal with unit 0 and 1 for right now */
-void i830UpdateTextureState( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int pipe_num = 0;
- GLboolean ok;
-
- ok = (i830UpdateTexUnit( ctx, 0 ) &&
- i830UpdateTexUnit( ctx, 1 ) &&
- i830UpdateTexUnit( ctx, 2 ) &&
- i830UpdateTexUnit( ctx, 3 ));
-
- FALLBACK( imesa, I830_FALLBACK_TEXTURE, !ok );
-
-
- /* Make sure last stage is set correctly */
- if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(3)) {
- pipe_num = imesa->TexBlendColorPipeNum[3];
- imesa->TexBlend[3][pipe_num] |= TEXOP_LAST_STAGE;
- } else if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(2)) {
- pipe_num = imesa->TexBlendColorPipeNum[2];
- imesa->TexBlend[2][pipe_num] |= TEXOP_LAST_STAGE;
- } else if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(1)) {
- pipe_num = imesa->TexBlendColorPipeNum[1];
- imesa->TexBlend[1][pipe_num] |= TEXOP_LAST_STAGE;
- } else {
- pipe_num = imesa->TexBlendColorPipeNum[0];
- imesa->TexBlend[0][pipe_num] |= TEXOP_LAST_STAGE;
- }
-}
-
-
-
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tris.c b/xc/lib/GL/mesa/src/drv/i830/i830_tris.c
deleted file mode 100644
index 66720c1ef..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tris.c
+++ /dev/null
@@ -1,880 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tris.c,v 1.4 2002/12/10 01:26:54 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Original Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_tris.h"
-#include "i830_state.h"
-#include "i830_vb.h"
-#include "i830_ioctl.h"
-#include "i830_span.h"
-
-static void i830RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) \
- vb[j] = ((GLuint *)v)[j]; \
- vb += vertsize; \
-} while (0)
-#endif
-
-static void __inline__ i830_draw_triangle( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1,
- i830VertexPtr v2 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 3 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static void __inline__ i830_draw_quad( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1,
- i830VertexPtr v2,
- i830VertexPtr v3 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 6 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-
-static __inline__ void i830_draw_point( i830ContextPtr imesa,
- i830VertexPtr tmp )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 4 * vertsize );
- int j;
-
- /* Adjust for sub pixel position */
- *(float *)&vb[0] = tmp->v.x - 0.125;
- *(float *)&vb[1] = tmp->v.y - 0.125;
- for (j = 2 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
-}
-
-
-static __inline__ void i830_draw_line( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_tri( imesa, a, b, c ); \
- else \
- i830_draw_triangle( imesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- imesa->draw_tri( imesa, a, b, d ); \
- imesa->draw_tri( imesa, b, c, d ); \
- } else \
- i830_draw_quad( imesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_line( imesa, v0, v1 ); \
- else \
- i830_draw_line( imesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_point( imesa, v0 ); \
- else \
- i830_draw_point( imesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define I830_OFFSET_BIT 0x01
-#define I830_TWOSIDE_BIT 0x02
-#define I830_UNFILLED_BIT 0x04
-#define I830_FALLBACK_BIT 0x08
-#define I830_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[I830_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & I830_FALLBACK_BIT)
-#define DO_OFFSET (IND & I830_OFFSET_BIT)
-#define DO_UNFILLED (IND & I830_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & I830_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX i830Vertex
-#define TAB rast_tab
-
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define I830_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define I830_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-
-#define DEPTH_SCALE (imesa->depth_scale)
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) I830_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) I830_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (imesa->vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
-};
-
-#define RASTERIZE(x) if (imesa->hw_primitive != hw_prim[x]) \
- i830RasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE imesa->render_primitive
-#define TAG(x) x
-#define IND I830_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_UNFILLED_BIT| \
- I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-i830_fallback_tri( i830ContextPtr imesa,
- i830Vertex *v0,
- i830Vertex *v1,
- i830Vertex *v2 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[3];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- i830_translate_vertex( ctx, v0, &v[0] );
- i830_translate_vertex( ctx, v1, &v[1] );
- i830_translate_vertex( ctx, v2, &v[2] );
- i830SpanRenderStart( ctx );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
- i830SpanRenderFinish( ctx );
-}
-
-
-static void
-i830_fallback_line( i830ContextPtr imesa,
- i830Vertex *v0,
- i830Vertex *v1 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[2];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- i830_translate_vertex( ctx, v0, &v[0] );
- i830_translate_vertex( ctx, v1, &v[1] );
- i830SpanRenderStart( ctx );
- _swrast_Line( ctx, &v[0], &v[1] );
- i830SpanRenderFinish( ctx );
-}
-
-
-static void
-i830_fallback_point( i830ContextPtr imesa,
- i830Vertex *v0 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[1];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- i830_translate_vertex( ctx, v0, &v[0] );
- i830SpanRenderStart( ctx );
- _swrast_Point( ctx, &v[0] );
- i830SpanRenderFinish( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (i830Vertex *)(vertptr + ((x)<<vertshift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#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) i830RenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertshift = imesa->vertex_stride_shift; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) i830_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) i830_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void i830RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = imesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
- PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void i830RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void i830FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint vertshift = imesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _I830_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#define POINT_FALLBACK (0)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|\
- DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void i830ChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (I830_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= I830_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= I830_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= I830_UNFILLED_BIT;
- }
-
- imesa->draw_point = i830_draw_point;
- imesa->draw_line = i830_draw_line;
- imesa->draw_tri = i830_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- imesa->draw_point = i830_fallback_point;
-
- if (flags & LINE_FALLBACK)
- imesa->draw_line = i830_fallback_line;
-
- if (flags & TRI_FALLBACK)
- imesa->draw_tri = i830_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !imesa->hw_stipple) {
- imesa->draw_tri = i830_fallback_tri;
- }
-
- index |= I830_FALLBACK_BIT;
- }
- }
-
- if (imesa->RenderIndex != index) {
- imesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = i830_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = i830_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = i830FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = i830RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = i830RenderClippedPoly;
- }
- }
-}
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in i810render.c.
- */
-static void i830RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- imesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (imesa->reduced_primitive != rprim ||
- hw_prim[prim] != imesa->hw_primitive) {
- i830RasterPrimitive( ctx, rprim, hw_prim[prim] );
- }
-}
-
-static void i830RunPipeline( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (imesa->NewGLState) {
- if (imesa->NewGLState & _NEW_TEXTURE) {
- I830_FIREVERTICES( imesa );
- i830UpdateTextureState( ctx ); /* may modify imesa->NewGLState */
- }
-
- if (!imesa->Fallback) {
- if (imesa->NewGLState & _I830_NEW_VERTEX)
- i830ChooseVertexState( ctx );
-
- if (imesa->NewGLState & _I830_NEW_RENDERSTATE)
- i830ChooseRenderState( ctx );
- }
-
- imesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void i830RenderStart( GLcontext *ctx )
-{
- /* Check for projective textureing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
-
- i830CheckTexSizes( ctx );
-}
-
-static void i830RenderFinish( GLcontext *ctx )
-{
- if (I830_CONTEXT(ctx)->RenderIndex & I830_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-
-/* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-void i830RasterPrimitive( GLcontext *ctx,
- GLenum rprim,
- GLuint hwprim )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint aa = imesa->Setup[I830_CTXREG_AA];
- GLuint st1 = imesa->StippleSetup[I830_STPREG_ST1];
-
- aa &= ~AA_LINE_ENABLE;
-
- if (I830_DEBUG & DEBUG_PRIMS) {
- /* Prints reduced prim, and hw prim */
- char *prim_name = "Unknown";
-
- switch(hwprim) {
- case PRIM3D_POINTLIST:
- prim_name = "PointList";
- break;
- case PRIM3D_LINELIST:
- prim_name = "LineList";
- break;
- case PRIM3D_LINESTRIP:
- prim_name = "LineStrip";
- break;
- case PRIM3D_TRILIST:
- prim_name = "TriList";
- break;
- case PRIM3D_TRISTRIP:
- prim_name = "TriStrip";
- break;
- case PRIM3D_TRIFAN:
- prim_name = "TriFan";
- break;
- case PRIM3D_POLY:
- prim_name = "Polygons";
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s : rprim(%s), hwprim(%s)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim),
- prim_name);
- }
-
- switch (rprim) {
- case GL_TRIANGLES:
- aa |= AA_LINE_DISABLE;
- if (ctx->Polygon.StippleFlag)
- st1 |= ST1_ENABLE;
- else
- st1 &= ~ST1_ENABLE;
- break;
- case GL_LINES:
- st1 &= ~ST1_ENABLE;
- if (ctx->Line.SmoothFlag) {
- aa |= AA_LINE_ENABLE;
- } else {
- aa |= AA_LINE_DISABLE;
- }
- break;
- case GL_POINTS:
- st1 &= ~ST1_ENABLE;
- aa |= AA_LINE_DISABLE;
- break;
- default:
- return;
- }
-
- imesa->reduced_primitive = rprim;
-
- if (aa != imesa->Setup[I830_CTXREG_AA]) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_AA] = aa;
- }
-
-#if 0
- if (st1 != imesa->StippleSetup[I830_STPREG_ST1]) {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] = st1;
- }
-#endif
-
- if (hwprim != imesa->hw_primitive) {
- I830_STATECHANGE(imesa, 0);
- imesa->hw_primitive = hwprim;
- }
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void i830Fallback( i830ContextPtr imesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = imesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = imesa->Fallback;
-
- if (mode) {
- imesa->Fallback |= bit;
- if (oldfallback == 0) {
- I830_FIREVERTICES(imesa);
- if (I830_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %s\n", getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- imesa->RenderIndex = ~0;
- }
- }
- else {
- imesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (I830_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = i830RenderStart;
- tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
- tnl->Driver.Render.Finish = i830RenderFinish;
- tnl->Driver.Render.BuildVertices = i830BuildVertices;
- imesa->NewGLState |= (_I830_NEW_RENDERSTATE|_I830_NEW_VERTEX);
- }
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void i830InitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = i830RunPipeline;
- tnl->Driver.Render.Start = i830RenderStart;
- tnl->Driver.Render.Finish = i830RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = i830BuildVertices;
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tris.h b/xc/lib/GL/mesa/src/drv/i830/i830_tris.h
deleted file mode 100644
index ae4f0a5df..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tris.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use in the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tris.h,v 1.3 2002/09/09 19:18:48 dawes Exp $ */
-
-#ifndef I830TRIS_INC
-#define I830TRIS_INC
-
-#include "mtypes.h"
-
-extern void i830PrintRenderState( const char *msg, GLuint state );
-extern void i830InitTriFuncs( GLcontext *ctx );
-extern void i830RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_vb.c b/xc/lib/GL/mesa/src/drv/i830/i830_vb.c
deleted file mode 100644
index a7ac054c2..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_vb.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_vb.c,v 1.5 2002/12/10 01:26:54 dawes Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_vb.h"
-#include "i830_ioctl.h"
-#include "i830_tris.h"
-#include "i830_state.h"
-
-#define I830_TEX1_BIT 0x1
-#define I830_TEX0_BIT 0x2
-#define I830_RGBA_BIT 0x4
-#define I830_SPEC_BIT 0x8
-#define I830_FOG_BIT 0x10
-#define I830_XYZW_BIT 0x20
-#define I830_PTEX_BIT 0x40
-#define I830_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[I830_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX0_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(1) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX1_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-
-/* I'm cheating here hardcore : if bit 31 is set I know to emit
- * a vf2 state == TEXCOORDFMT_3D. We never mix 2d/3d texcoords,
- * so this solution works for now.
- */
-
-#define PROJ_TEX1_VERTEX_FORMAT ((1<<31) | \
- STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-/* Might want to do these later */
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & I830_XYZW_BIT)
-#define DO_RGBA (IND & I830_RGBA_BIT)
-#define DO_SPEC (IND & I830_SPEC_BIT)
-#define DO_FOG (IND & I830_FOG_BIT)
-#define DO_TEX0 (IND & I830_TEX0_BIT)
-#define DO_TEX1 (IND & I830_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & I830_PTEX_BIT)
-
-#define VERTEX i830Vertex
-#define VERTEX_COLOR i830_color_t
-#define GET_VIEWPORT_MAT() I830_CONTEXT(ctx)->ViewportMatrix.m
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() I830_CONTEXT(ctx)->vertex_format
-#define GET_VERTEX_STORE() ((GLubyte *)I830_CONTEXT(ctx)->verts)
-#define GET_VERTEX_STRIDE_SHIFT() I830_CONTEXT(ctx)->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteSecondaryColor
-#define INVALIDATE_STORED_VERTICES()
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define UNVIEWPORT_VARS GLfloat h = I830_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z * (float)I830_CONTEXT(ctx)->ClearDepth
-
-#define PTEX_FALLBACK() FALLBACK(I830_CONTEXT(ctx), I830_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS i830_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS i830_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) i830_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-/* Add functions for proj texturing for t0 and t1 */
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX1_BIT|I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
- /* Add proj texturing on t1 */
- init_wgpt0t1();
- init_wgspt0t1();
- init_wgfpt0t1();
- init_wgfspt0t1();
-}
-
-
-
-void i830PrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & I830_XYZW_BIT) ? " xyzw," : "",
- (flags & I830_RGBA_BIT) ? " rgba," : "",
- (flags & I830_SPEC_BIT) ? " spec," : "",
- (flags & I830_FOG_BIT) ? " fog," : "",
- (flags & I830_TEX0_BIT) ? " tex-0," : "",
- (flags & I830_TEX1_BIT) ? " tex-1," : "",
- (flags & I830_PTEX_BIT) ? " ptex," : "");
-}
-
-void i830CheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- if (!setup_tab[imesa->SetupIndex].check_tex_sizes(ctx)) {
- int ind = imesa->SetupIndex |= I830_PTEX_BIT;
-
- if(setup_tab[ind].vertex_format != imesa->vertex_format) {
- int vfmt = setup_tab[ind].vertex_format;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_VF] = ~(1<<31) & vfmt;
-
- if (vfmt & (1<<31)) {
- /* Proj texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D));
- i830UpdateTexUnitProj( ctx, 0, GL_TRUE );
- i830UpdateTexUnitProj( ctx, 1, GL_TRUE );
-
- } else {
- /* Normal texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
- i830UpdateTexUnitProj( ctx, 0, GL_FALSE );
- i830UpdateTexUnitProj( ctx, 1, GL_FALSE );
- }
- imesa->vertex_format = vfmt;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-
- if (!imesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[imesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[imesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void i830BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)
- imesa->verts + (start<<imesa->vertex_stride_shift));
- GLuint stride = 1<<imesa->vertex_stride_shift;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- newinputs |= imesa->SetupNewInputs;
- imesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= I830_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= I830_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= I830_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= I830_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= I830_FOG_BIT;
-
-#if 0
- if (imesa->SetupIndex & I830_PTEX_BIT)
- ind = ~0;
-#endif
-
- ind &= imesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void i830ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint ind = I830_XYZW_BIT|I830_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= I830_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= I830_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= I830_TEX1_BIT|I830_TEX0_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= I830_TEX0_BIT;
-
- imesa->SetupIndex = ind;
-
- if (I830_DEBUG & (DEBUG_VERTS|DEBUG_STATE))
- i830PrintSetupFlags( __FUNCTION__, ind );
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = i830_interp_extras;
- tnl->Driver.Render.CopyPV = i830_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != imesa->vertex_format) {
- int vfmt = setup_tab[ind].vertex_format;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_VF] = ~(1<<31) & vfmt;
-
- if (vfmt & (1<<31)) {
- /* Proj texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D));
- i830UpdateTexUnitProj( ctx, 0, GL_TRUE );
- i830UpdateTexUnitProj( ctx, 1, GL_TRUE );
- } else {
- /* Normal texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
- i830UpdateTexUnitProj( ctx, 0, GL_FALSE );
- i830UpdateTexUnitProj( ctx, 1, GL_FALSE );
- }
- imesa->vertex_format = vfmt;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-
-void i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint vertex_size = imesa->vertex_size * 4;
- GLuint *dest = i830AllocDmaLow( imesa, (count-start) * vertex_size);
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-}
-
-
-
-void i830InitVB( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- imesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void i830FreeVB( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (imesa->verts) {
- ALIGN_FREE(imesa->verts);
- imesa->verts = 0;
- }
-
- if (imesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(imesa->UbyteSecondaryColor.Ptr);
- imesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (imesa->UbyteColor.Ptr) {
- ALIGN_FREE(imesa->UbyteColor.Ptr);
- imesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_vb.h b/xc/lib/GL/mesa/src/drv/i830/i830_vb.h
deleted file mode 100644
index 523354465..000000000
--- a/xc/lib/GL/mesa/src/drv/i830/i830_vb.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use in the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_vb.h,v 1.1 2002/09/09 19:18:49 dawes Exp $ */
-
-#ifndef I830VB_INC
-#define I830VB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _I830_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void i830ChooseVertexState( GLcontext *ctx );
-extern void i830CheckTexSizes( GLcontext *ctx );
-extern void i830BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void i830_translate_vertex( GLcontext *ctx,
- const i830Vertex *src,
- SWvertex *dst );
-
-extern void i830InitVB( GLcontext *ctx );
-extern void i830FreeVB( GLcontext *ctx );
-
-extern void i830_print_vertex( GLcontext *ctx, const i830Vertex *v );
-extern void i830PrintSetupFlags(char *msg, GLuint flags );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_texcombine.c b/xc/lib/GL/mesa/src/drv/mga/mga_texcombine.c
deleted file mode 100644
index ca7322a59..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mga_texcombine.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
- * Copyright (c) 2003 Ville Syrjala
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ville Syrjala <syrjala@sci.fi>
- */
-
-#include "glheader.h"
-
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-
-/*
- * GL_ARB_texture_env_combine
- * GL_EXT_texture_env_combine
- * GL_ARB_texture_env_crossbar
- * GL_ATI_texture_env_combine3
- */
-
-#define ARG_DISABLE 0xffffffff
-#define MGA_ARG1 0
-#define MGA_ARG2 1
-#define MGA_ALPHA 2
-
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- GLuint numColorArgs = 0, numAlphaArgs = 0;
- GLuint arg1[3], arg2[3], alpha[3];
- int args[3];
- int i;
-
- switch (texUnit->CombineModeRGB) {
- case GL_REPLACE:
- numColorArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numColorArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numColorArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->CombineModeA) {
- case GL_REPLACE:
- numAlphaArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numAlphaArgs = 2;
- break;
- default:
- return GL_FALSE;
- }
-
- /* Start fresh :) */
- *reg = 0;
-
- /* COLOR */
- for (i = 0; i < 3; i++) {
- arg1[i] = 0;
- arg2[i] = 0;
- alpha[i] = 0;
- }
-
- for (i = 0;i < numColorArgs; i++) {
- switch (texUnit->CombineSourceRGB[i]) {
- case GL_TEXTURE:
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- break;
- case GL_TEXTURE0:
- if (source == 0) {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- } else {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_prevtex;
- }
- break;
- case GL_TEXTURE1:
- if (source == 0) {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE0) */
- arg2[i] |= TD0_color_arg2_prevstage;
- alpha[i] |= TD0_color_alpha_prevstage;
- } else {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- }
- break;
- case GL_CONSTANT:
- if (mmesa->fcol_used &&
- mmesa->envcolor[source] != mmesa->envcolor[!source])
- return GL_FALSE;
-
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_color_arg2_fcol;
- alpha[i] |= TD0_color_alpha_fcol;
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- mmesa->fcol_used = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE1) */
- if (unit == 0 || (mmesa->setup.tdualstage0 &
- ((TD0_color_sel_mul & TD0_color_sel_add) |
- (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
- arg2[i] |= TD0_color_arg2_diffuse;
- alpha[i] |= TD0_color_alpha_diffuse;
- } else {
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_PREVIOUS:
- arg1[i] |= ARG_DISABLE;
- if (unit == 0) {
- arg2[i] |= TD0_color_arg2_diffuse;
- alpha[i] |= TD0_color_alpha_diffuse;
- } else {
- arg2[i] |= TD0_color_arg2_prevstage;
- alpha[i] |= TD0_color_alpha_prevstage;
- }
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->CombineOperandRGB[i]) {
- case GL_SRC_COLOR:
- arg1[i] |= 0;
- arg2[i] |= 0;
- if (texUnit->CombineSourceRGB[i] == GL_CONSTANT &&
- RGBA_EQUAL( mmesa->envcolor[source] )) {
- alpha[i] |= 0;
- } else {
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- arg1[i] |= TD0_color_arg1_inv_enable;
- arg2[i] |= TD0_color_arg2_inv_enable;
- if (texUnit->CombineSourceRGB[i] == GL_CONSTANT &&
- RGBA_EQUAL( mmesa->envcolor[source] )) {
- alpha[i] |= (TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- } else {
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_SRC_ALPHA:
- arg1[i] |= TD0_color_arg1_replicatealpha_enable;
- arg2[i] |= TD0_color_arg2_replicatealpha_enable;
- alpha[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- arg1[i] |= (TD0_color_arg1_replicatealpha_enable |
- TD0_color_arg1_inv_enable);
- arg2[i] |= (TD0_color_arg2_replicatealpha_enable |
- TD0_color_arg2_inv_enable);
- alpha[i] |= (TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- break;
- }
- }
-
- switch (texUnit->CombineModeRGB) {
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- /* Special handling for ATI_texture_env_combine3.
- * If Arg1 == Arg0 or Arg1 == Arg2 we can use arg1 or arg2 as input for
- * both multiplier and adder.
- */
- /* Arg1 == arg1 */
- if (arg1[1] == arg1[0]) {
- if ((arg1[1] | arg2[2]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
- break;
- } else
- if ((arg1[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg1[1] | alpha[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
- break;
- }
- }
- if (arg1[1] == arg1[2]) {
- if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[0];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
- break;
- } else
- if ((arg1[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
- break;
- }
- }
- /* fallthrough */
- case GL_MODULATE_SUBTRACT_ATI:
- /* Arg1 == arg2 */
- if (arg2[1] == arg2[0]) {
- if ((arg2[1] | arg1[2]) != ARG_DISABLE) {
- *reg |= arg2[1] | arg1[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
- break;
- } else
- if ((arg2[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg2[1] | alpha[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
- break;
- }
- }
- if (arg2[1] == arg2[2]) {
- if ((arg2[1] | arg1[0]) != ARG_DISABLE) {
- *reg |= arg2[1] | arg1[0];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
- break;
- } else
- if ((arg2[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg2[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
- break;
- }
- }
- /* fallthrough */
- default:
- /* Find working combo of arg1, arg2 and alpha.
- *
- * Keep the Arg0 != alpha cases first since there's
- * no way to get alpha out by itself (GL_REPLACE).
- *
- * Keep the Arg2 == alpha cases first because only alpha has the
- * capabilities to function as Arg2 (GL_INTERPOLATE). Also good for
- * GL_ADD, GL_ADD_SIGNED, GL_SUBTRACT since we can't get alpha to the
- * adder.
- *
- * Keep the Arg1 == alpha cases last for GL_MODULATE_ADD_ATI,
- * GL_MODULATE_SIGNED_ADD_ATI. Again because we can't get alpha to the
- * adder.
- *
- * GL_MODULATE_SUBTRACT_ATI needs special treatment since it requires
- * that Arg1 == arg2. This requirement clashes with those of other modes.
- */
- if ((arg1[0] | arg2[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[1] | alpha[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
- } else
- if ((arg1[1] | arg2[0] | alpha[2]) != ARG_DISABLE &&
- texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
- *reg |= arg1[1] | arg2[0] | alpha[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
- } else
- if ((arg1[1] | arg2[2] | alpha[0]) != ARG_DISABLE &&
- texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
- *reg |= arg1[1] | arg2[2] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
- } else
- if ((arg1[2] | arg2[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg1[2] | arg2[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
- } else
- if ((arg1[0] | arg2[2] | alpha[1]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[2] | alpha[1];
- args[0] = MGA_ARG1; args[1] = MGA_ALPHA; args[2] = MGA_ARG2;
- } else
- if ((arg1[2] | arg2[0] | alpha[1]) != ARG_DISABLE) {
- *reg |= arg1[2] | arg2[0] | alpha[1];
- args[0] = MGA_ARG2; args[1] = MGA_ALPHA; args[2] = MGA_ARG1;
- } else {
- /* nothing suitable */
- return GL_FALSE;
- }
- }
-
- switch (texUnit->CombineModeRGB) {
- case GL_REPLACE:
- if (texUnit->CombineScaleShiftRGB) {
- return GL_FALSE;
- }
-
- if (args[0] == MGA_ARG1) {
- *reg |= TD0_color_sel_arg1;
- } else if (args[0] == MGA_ARG2) {
- *reg |= TD0_color_sel_arg2;
- } else if (args[0] == MGA_ALPHA) {
- /* Can't get alpha out by itself */
- return GL_FALSE;
- }
- break;
- case GL_MODULATE:
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_modbright_2x;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- *reg |= TD0_color_modbright_4x;
- }
-
- *reg |= TD0_color_sel_mul;
-
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- if (args[0] == MGA_ARG1 || args[1] == MGA_ARG1) {
- *reg |= TD0_color_arg2mul_alpha2;
- } else if (args[0] == MGA_ARG2 || args[1] == MGA_ARG2) {
- *reg |= TD0_color_arg1mul_alpha1;
- }
- }
- break;
- case GL_ADD_SIGNED:
- *reg |= TD0_color_addbias_enable;
- /* fallthrough */
- case GL_ADD:
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_add |
- TD0_color_sel_add);
- break;
- case GL_INTERPOLATE:
- if (args[2] != MGA_ALPHA) {
- /* Only alpha can function as Arg2 */
- return GL_FALSE;
- }
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add);
-
- /* Have to do this with xor since GL_ONE_MINUS_SRC_ALPHA may have
- * already touched this bit.
- */
- *reg ^= TD0_color_alpha1inv_enable;
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2 |
- TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- }
-
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* Linear blending mode needs dualtex enabled */
- *(reg+1) = (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- mmesa->force_dualtex = GL_TRUE;
- }
- break;
- case GL_SUBTRACT:
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_sub |
- TD0_color_sel_add);
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1_inv_enable |
- TD0_color_arg2_inv_enable);
- }
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- *reg |= TD0_color_addbias_enable;
- /* fallthrough */
- case GL_MODULATE_ADD_ATI:
- if (args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_add |
- TD0_color_sel_add);
-
- if (args[1] == args[0] || args[1] == args[2]) {
- *reg |= TD0_color_arg1add_mulout;
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
- *reg |= TD0_color_arg1mul_alpha1;
-
- if (args[1] == MGA_ARG1) {
- /* Swap adder arguments */
- *reg ^= (TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout);
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) {
- /* Swap multiplier arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2);
- }
- }
- } else {
- *reg |= (TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout);
-
- if (args[1] == MGA_ARG1) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout);
- }
- }
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- if (args[1] != MGA_ARG2) {
- /* Can't swap arguments */
- return GL_FALSE;
- }
- if (texUnit->CombineScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_sub |
- TD0_color_sel_add);
-
- if (args[1] == args[0] || args[1] == args[2]) {
- *reg |= TD0_color_arg1add_mulout;
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
- *reg |= TD0_color_arg1mul_alpha1;
- } else {
- *reg |= (TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout);
- }
- break;
- }
-
-
- /* ALPHA */
- for (i = 0; i < 2; i++) {
- arg1[i] = 0;
- arg2[i] = 0;
- }
-
- for (i = 0; i < numAlphaArgs; i++) {
- switch (texUnit->CombineSourceA[i]) {
- case GL_TEXTURE:
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- break;
- case GL_TEXTURE0:
- if (source == 0) {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- } else {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_alpha_arg2_prevtex;
- }
- break;
- case GL_TEXTURE1:
- if (source == 0) {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE0) */
- arg2[i] |= TD0_alpha_arg2_prevstage;
- } else {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- }
- break;
- case GL_CONSTANT:
- if (mmesa->fcol_used &&
- mmesa->envcolor[source] != mmesa->envcolor[!source])
- return GL_FALSE;
-
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_alpha_arg2_fcol;
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- mmesa->fcol_used = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE1) */
- if (unit == 0 || (mmesa->setup.tdualstage0 &
- ((TD0_color_sel_mul & TD0_color_sel_add) |
- (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
- arg2[i] |= TD0_alpha_arg2_diffuse;
- } else {
- arg2[i] |= ARG_DISABLE;
- }
- break;
- case GL_PREVIOUS:
- arg1[i] |= ARG_DISABLE;
- if (unit == 0) {
- arg2[i] |= TD0_alpha_arg2_diffuse;
- } else {
- arg2[i] |= TD0_alpha_arg2_prevstage;
- }
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->CombineOperandA[i]) {
- case GL_SRC_ALPHA:
- arg1[i] |= 0;
- arg2[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- arg1[i] |= TD0_alpha_arg1_inv_enable;
- arg2[i] |= TD0_alpha_arg2_inv_enable;
- break;
- }
- }
-
- /* Find a working combo of arg1 and arg2 */
- if ((arg1[0] | arg2[1]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[1];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2;
- } else
- if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[0];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1;
- } else {
- /* nothing suitable */
- return GL_FALSE;
- }
-
- switch (texUnit->CombineModeA) {
- case GL_REPLACE:
- if (texUnit->CombineScaleShiftA) {
- return GL_FALSE;
- }
-
- if (args[0] == MGA_ARG1) {
- *reg |= TD0_alpha_sel_arg1;
- } else if (args[0] == MGA_ARG2) {
- *reg |= TD0_alpha_sel_arg2;
- }
- break;
- case GL_MODULATE:
- if (texUnit->CombineScaleShiftA == 1) {
- *reg |= TD0_alpha_modbright_2x;
- } else if (texUnit->CombineScaleShiftA == 2) {
- *reg |= TD0_alpha_modbright_4x;
- }
-
- *reg |= TD0_alpha_sel_mul;
- break;
- case GL_ADD_SIGNED:
- *reg |= TD0_alpha_addbias_enable;
- /* fallthrough */
- case GL_ADD:
- if (texUnit->CombineScaleShiftA == 1) {
- *reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->CombineScaleShiftA == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- break;
- case GL_SUBTRACT:
- if (texUnit->CombineScaleShiftA == 1) {
- *reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->CombineScaleShiftA == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_alpha_add_disable |
- TD0_alpha_sel_add);
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_alpha_arg1_inv_enable |
- TD0_alpha_arg2_inv_enable);
- }
- break;
- }
-
- return GL_TRUE;
-}
-
-
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c b/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c
deleted file mode 100644
index e22a69e05..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (c) Copyright IBM Corporation 2002
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-/* $XFree86:$ */
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "imports.h"
-
-#include "simple_list.h"
-#include "texformat.h"
-
-#define MGA_USE_TABLE_FOR_FORMAT
-#ifdef MGA_USE_TABLE_FOR_FORMAT
-#define TMC_nr_tformat (MESA_FORMAT_YCBCR_REV + 1)
-static const unsigned TMC_tformat[ TMC_nr_tformat ] =
-{
- [MESA_FORMAT_ARGB8888] = TMC_tformat_tw32,
- [MESA_FORMAT_RGB565] = TMC_tformat_tw16,
- [MESA_FORMAT_ARGB4444] = TMC_tformat_tw12,
- [MESA_FORMAT_ARGB1555] = TMC_tformat_tw15,
- [MESA_FORMAT_AL88] = TMC_tformat_tw8al,
- [MESA_FORMAT_I8] = TMC_tformat_tw8a,
- [MESA_FORMAT_CI8] = TMC_tformat_tw8 ,
- [MESA_FORMAT_YCBCR] = TMC_tformat_tw422uyvy,
- [MESA_FORMAT_YCBCR_REV] = TMC_tformat_tw422,
-};
-#endif
-
-static void
-mgaSetTexImages( mgaContextPtr mmesa,
- const struct gl_texture_object * tObj )
-{
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- struct gl_texture_image *baseImage = tObj->Image[ tObj->BaseLevel ];
- GLint totalSize;
- GLint width, height;
- GLint i;
- GLint numLevels;
- GLint log2Width, log2Height;
- GLuint txformat = 0;
- GLint ofs;
-
- /* Set the hardware texture format
- */
-#ifndef MGA_USE_TABLE_FOR_FORMAT
- switch (baseImage->TexFormat->MesaFormat) {
-
- case MESA_FORMAT_ARGB8888: txformat = TMC_tformat_tw32; break;
- case MESA_FORMAT_RGB565: txformat = TMC_tformat_tw16; break;
- case MESA_FORMAT_ARGB4444: txformat = TMC_tformat_tw12; break;
- case MESA_FORMAT_ARGB1555: txformat = TMC_tformat_tw15; break;
- case MESA_FORMAT_AL88: txformat = TMC_tformat_tw8al; break;
- case MESA_FORMAT_I8: txformat = TMC_tformat_tw8a; break;
- case MESA_FORMAT_CI8: txformat = TMC_tformat_tw8; break;
- case MESA_FORMAT_YCBCR: txformat = TMC_tformat_tw422uyvy; break;
- case MESA_FORMAT_YCBCR_REV: txformat = TMC_tformat_tw422; break;
-
- default:
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-#else
- if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat)
- || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) )
- {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
- txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ];
-
-#endif /* MGA_USE_TABLE_FOR_FORMAT */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- log2Width = 0;
- log2Height = 0;
- } else {
- log2Width = tObj->Image[t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[t->base.firstLevel]->HeightLog2;
- }
-
- width = tObj->Image[t->base.firstLevel]->Width;
- height = tObj->Image[t->base.firstLevel]->Height;
-
- numLevels = MIN2( t->base.lastLevel - t->base.firstLevel + 1,
- MGA_IS_G200(mmesa) ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS);
-
-
- totalSize = 0;
- for ( i = 0 ; i < numLevels ; i++ ) {
- const struct gl_texture_image * const texImage =
- tObj->Image[ i + t->base.firstLevel ];
- int size;
-
- if (texImage == NULL)
- break;
-
- size = texImage->Width * texImage->Height *
- baseImage->TexFormat->TexelBytes;
-
- t->offsets[i] = totalSize;
- t->base.dirty_images[0] |= (1<<i);
-
- /* All mipmaps must be 32-byte aligned */
- totalSize += (size + 31) & ~31;
-
- /* Since G400 calculates the offsets in hardware
- * it can't handle more than one < 32 byte mipmap.
- *
- * Further testing has indicated that it can't
- * handle any < 32 byte mipmaps.
- */
- if (MGA_IS_G400( mmesa ) && size <= 32) {
- i++;
- break;
- }
- }
-
- /* save these values */
- numLevels = i;
- t->base.lastLevel = t->base.firstLevel + numLevels - 1;
- t->base.totalSize = totalSize;
-
- /* setup hardware register values */
- t->setup.texctl &= (TMC_tformat_MASK & TMC_tpitch_MASK
- & TMC_tpitchext_MASK);
- t->setup.texctl |= txformat;
-
-
- /* Set the texture width. In order to support non-power of 2 textures and
- * textures larger than 1024 texels wide, "linear" pitch must be used. For
- * the linear pitch, if the width is 2048, a value of zero is used.
- */
-
- t->setup.texctl |= TMC_tpitchlin_enable;
- t->setup.texctl |= MGA_FIELD( TMC_tpitchext, width & (2048 - 1) );
-
-
- /* G400 specifies the number of mip levels in a strange way. Since there
- * are up to 11 levels, it requires 4 bits. Three of the bits are at the
- * high end of TEXFILTER. The other bit is in the middle. Weird.
- */
- numLevels--;
- t->setup.texfilter &= TF_mapnb_MASK & TF_mapnbhigh_MASK & TF_reserved_MASK;
- t->setup.texfilter |= MGA_FIELD( TF_mapnb, numLevels & 0x7 );
- t->setup.texfilter |= MGA_FIELD( TF_mapnbhigh, (numLevels >> 3) & 0x1 );
-
- /* warp texture registers */
- ofs = MGA_IS_G200(mmesa) ? 28 : 11;
-
- t->setup.texwidth = (MGA_FIELD(TW_twmask, width - 1) |
- MGA_FIELD(TW_rfw, (10 - log2Width - 8) & 63 ) |
- MGA_FIELD(TW_tw, (log2Width + ofs ) | 0x40 ));
-
- t->setup.texheight = (MGA_FIELD(TH_thmask, height - 1) |
- MGA_FIELD(TH_rfh, (10 - log2Height - 8) & 63 ) |
- MGA_FIELD(TH_th, (log2Height + ofs ) | 0x40 ));
-
- mgaUploadTexImages( mmesa, t );
-}
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- GLenum format = tObj->Image[tObj->BaseLevel]->Format;
-
- if (tObj != ctx->Texture.Unit[0].Current2D &&
- tObj != ctx->Texture.Unit[0].CurrentRect)
- return;
-
-
- t->setup.texctl &= ~TMC_tmodulate_enable;
- t->setup.texctl2 &= ~(TMC_decalblend_enable |
- TMC_idecal_enable |
- TMC_decaldis_enable);
-
- switch (ctx->Texture.Unit[0].EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA)
- t->setup.texctl2 |= TMC_idecal_enable;
-
- if (format == GL_RGB || format == GL_LUMINANCE)
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- else
- mmesa->hw.alpha_sel = AC_alphasel_fromtex;
- break;
-
- case GL_MODULATE:
- t->setup.texctl |= TMC_tmodulate_enable;
-
- if (format == GL_ALPHA)
- t->setup.texctl2 |= (TMC_idecal_enable |
- TMC_decaldis_enable);
-
- if (format == GL_RGB || format == GL_LUMINANCE)
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- else
- mmesa->hw.alpha_sel = AC_alphasel_modulated;
- break;
-
- case GL_DECAL:
- if (format == GL_RGB || format == GL_RGBA)
- t->setup.texctl2 |= TMC_decalblend_enable;
- else
- t->setup.texctl2 |= TMC_idecal_enable;
-
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- break;
-
- case GL_BLEND:
- if (format == GL_ALPHA) {
- t->setup.texctl2 |= TMC_idecal_enable;
- mmesa->hw.alpha_sel = AC_alphasel_modulated;
- } else {
- t->texenv_fallback = GL_TRUE;
- }
- break;
-
- default:
- break;
- }
-}
-
-
-#define MGA_REPLACE 0
-#define MGA_MODULATE 1
-#define MGA_DECAL 2
-#define MGA_ADD 3
-#define MGA_MAX_COMBFUNC 4
-
-static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = Af
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_MODULATE
- * Cv = Cf Cs
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_mul |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_DECAL
- * Cv = Cs
- * Av = Af
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf + Cs
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = Ap
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_MODULATE
- * Cv = Cp Cs
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_mul |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_DECAL
- * Cv = Cs
- * Av = Ap
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp + Cs
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
- },
-};
-
-static const GLuint g400_color_alpha_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = As
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cf Cs
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_mul |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL
- * tmp = Cf ( 1 - As )
- * Cv = tmp + Cs As
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_alpha_currtex |
- TD0_color_alpha1inv_enable |
- TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf + Cs
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = As
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cp Cs
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_mul |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL
- * tmp = Cp ( 1 - As )
- * Cv = tmp + Cs As
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_alpha_currtex |
- TD0_color_alpha1inv_enable |
- TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp + Cs
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
- },
-};
-
-static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cf
- * Av = As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cf
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL (undefined)
- * Cv = Cf
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cp
- * Av = As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cp
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL (undefined)
- * Cv = Cp
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
- },
-};
-
-static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- GLenum format = tObj->Image[tObj->BaseLevel]->Format;
-
- *reg = 0;
-
- if (format == GL_ALPHA) {
- /* Cv = Cf */
- *reg |= (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2);
- /* Av = Af As */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- return GL_TRUE;
- }
-
- /* C1 = Cf ( 1 - Cs ) */
- *reg |= (TD0_color_arg1_inv_enable |
- TD0_color_arg2_diffuse |
- TD0_color_sel_mul);
-
- if (format == GL_RGB || format == GL_LUMINANCE) {
- /* A1 = Af */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2);
- } else
- if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
- /* A1 = Af As */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- } else
- if (format == GL_INTENSITY) {
- /* A1 = Af ( 1 - As ) */
- *reg |= (TD0_alpha_arg1_inv_enable |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- }
-
- if (RGB_ZERO(mmesa->envcolor[source]) &&
- (format != GL_INTENSITY || ALPHA_ZERO(mmesa->envcolor[source])))
- return GL_TRUE; /* all done */
-
- if (ctx->Texture._EnabledUnits == 0x03)
- return GL_FALSE; /* need both units */
-
- mmesa->force_dualtex = GL_TRUE;
- reg = &mmesa->setup.tdualstage1;
- *reg = 0;
-
- if (RGB_ZERO(mmesa->envcolor[source])) {
- /* Cv = C1 */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2);
- } else
- if (RGB_ONE(mmesa->envcolor[source])) {
- /* Cv = C1 + Cs */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add);
- } else
- if (RGBA_EQUAL(mmesa->envcolor[source])) {
- /* Cv = C1 + Cc Cs */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_alpha_fcol |
- TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add);
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- } else {
- return GL_FALSE;
- }
-
- if (format != GL_INTENSITY || ALPHA_ZERO(mmesa->envcolor[source])) {
- /* Av = A1 */
- *reg |= (TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- } else
- if (ALPHA_ONE(mmesa->envcolor[source])) {
- /* Av = A1 + As */
- *reg |= (TD0_alpha_arg2_prevstage |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- } else {
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- GLenum format = tObj->Image[tObj->BaseLevel]->Format;
-
- if (tObj != ctx->Texture.Unit[source].Current2D &&
- tObj != ctx->Texture.Unit[source].CurrentRect)
- return;
-
- switch (ctx->Texture.Unit[source].EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_REPLACE];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_REPLACE];
- } else {
- *reg = g400_color_alpha_combine[unit][MGA_REPLACE];
- }
- break;
-
- case GL_MODULATE:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_MODULATE];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_MODULATE];
- } else {
- *reg = g400_color_alpha_combine[unit][MGA_MODULATE];
- }
- break;
-
- case GL_DECAL:
- if (format == GL_RGB) {
- *reg = g400_color_combine[unit][MGA_DECAL];
- } else if (format == GL_RGBA) {
- *reg = g400_color_alpha_combine[unit][MGA_DECAL];
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* Linear blending mode needs dual texturing enabled */
- *(reg+1) = (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- mmesa->force_dualtex = GL_TRUE;
- }
- } else {
- /* Undefined */
- *reg = g400_alpha_combine[unit][MGA_DECAL];
- }
- break;
-
- case GL_ADD:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_ADD];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_ADD];
- } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
- *reg = g400_color_alpha_combine[unit][MGA_ADD];
- } else if (format == GL_INTENSITY) {
- /* Cv = Cf + Cs
- * Av = Af + As
- */
- if (unit == 0) {
- *reg = (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- } else {
- *reg = (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- }
- }
- break;
-
- case GL_BLEND:
- if (!mgaUpdateTextureEnvBlend(ctx, unit))
- t->texenv_fallback = GL_TRUE;
- break;
-
- case GL_COMBINE:
- if (!mgaUpdateTextureEnvCombine(ctx, unit))
- t->texenv_fallback = GL_TRUE;
- break;
- default:
- break;
- }
-}
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- /* Texture unit disabled */
-
- if ( mmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- mmesa->CurrentTexObj[unit]->base.bound &= ~(1UL << unit);
- mmesa->CurrentTexObj[unit] = NULL;
- }
-
- if ( unit != 0 && !mmesa->force_dualtex ) {
- mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- }
-
- if ( ctx->Texture._EnabledUnits == 0 ) {
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
-}
-
-static GLboolean enable_tex( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- FLUSH_BATCH( mmesa );
- mgaSetTexImages( mmesa, tObj );
- if ( t->base.memBlock == NULL ) {
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- struct gl_texture_object *tObj = texUnit->_Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( mmesa->CurrentTexObj[unit] != t ) {
- if ( mmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- mmesa->CurrentTexObj[unit]->base.bound &= ~(1UL << unit);
- }
-
- mmesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1UL << unit);
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* done too often */
- }
-
- /* register setup */
- if ( unit == 1 ) {
- mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- }
-
- t->texenv_fallback = GL_FALSE;
-
- /* Set this before mgaUpdateTextureEnvG400() since
- * GL_ARB_texture_env_crossbar may have to disable texturing.
- */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_texture_trap;
-
- /* FIXME: The Radeon has some cached state so that it can avoid calling
- * FIXME: UpdateTextureEnv in some cases. Is that possible here?
- */
- if (MGA_IS_G400(mmesa)) {
- /* G400: Regardless of texture env mode, we use the alpha from the
- * texture unit (AC_alphasel_fromtex) since it will have already
- * been modulated by the incoming fragment color, if needed.
- * We don't want (AC_alphasel_modulate) since that'll effectively
- * do the modulation twice.
- */
- mmesa->hw.alpha_sel = AC_alphasel_fromtex;
-
- mgaUpdateTextureEnvG400( ctx, unit );
- } else {
- mgaUpdateTextureEnvG200( ctx, unit );
- }
-
- t->setup.texctl2 &= TMC_dualtex_MASK;
- if (ctx->Texture._EnabledUnits == 0x03 || mmesa->force_dualtex) {
- t->setup.texctl2 |= TMC_dualtex_enable;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
-
- FALLBACK( ctx, MGA_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback && !t->texenv_fallback;
-}
-
-
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
-
-
- if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT ||
- texUnit->_ReallyEnabled == TEXTURE_RECT_BIT ) {
- return(enable_tex( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-/* The G400 is now programmed quite differently wrt texture environment.
- */
-void mgaUpdateTextureState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLboolean ok;
- unsigned i;
-
- mmesa->force_dualtex = GL_FALSE;
- mmesa->fcol_used = GL_FALSE;
-
- /* This works around a quirk with the MGA hardware. If only OpenGL
- * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used. The
- * hardware TEXTURE1 can ONLY be used when hardware TEXTURE0 is also used.
- */
-
- mmesa->tmu_source[0] = 0;
- mmesa->tmu_source[1] = 1;
-
- if ((ctx->Texture._EnabledUnits & 0x03) == 0x02) {
- /* only texture 1 enabled */
- mmesa->tmu_source[0] = 1;
- mmesa->tmu_source[1] = 0;
- }
-
- for ( i = 0, ok = GL_TRUE
- ; (i < ctx->Const.MaxTextureUnits) && ok
- ; i++ ) {
- ok = updateTextureUnit( ctx, i );
- }
-
- FALLBACK( ctx, MGA_FALLBACK_TEXTURE, !ok );
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
deleted file mode 100644
index c294dc3d4..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
+++ /dev/null
@@ -1,791 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.19 2003/03/26 20:43:49 tsi Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "mga_common.h"
-#include "mga_xmesa.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgaspan.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mgapixel.h"
-#include "mga_xmesa.h"
-#include "mga_dri.h"
-
-
-#include "utils.h"
-#include "vblank.h"
-#include "glxextensions.h"
-
-/* MGA configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 3;
-
-#ifndef MGA_DEBUG
-int MGA_DEBUG = 0;
-#endif
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static GLboolean
-mgaInitDriver(__DRIscreenPrivate *sPriv)
-{
- mgaScreenPrivate *mgaScreen;
- MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
-
- if ( ! driCheckDriDdxDrmVersions( sPriv, "MGA", 4, 0, 1, 0, 3, 0 ) )
- return GL_FALSE;
-
- /* Allocate the private area */
- mgaScreen = (mgaScreenPrivate *)MALLOC(sizeof(mgaScreenPrivate));
- if (!mgaScreen) {
- __driUtilMessage("Couldn't malloc screen struct");
- return GL_FALSE;
- }
-
- mgaScreen->sPriv = sPriv;
- sPriv->private = (void *)mgaScreen;
-
- if (sPriv->drmMinor >= 1) {
- int ret;
- drmMGAGetParam gp;
-
- gp.param = MGA_PARAM_IRQ_NR;
- gp.value = &mgaScreen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_MGA_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmMgaGetParam (MGA_PARAM_IRQ_NR): %d\n", ret);
- XFree(mgaScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
- }
-
- mgaScreen->linecomp_sane = (sPriv->ddxMajor > 1) || (sPriv->ddxMinor > 1)
- || ((sPriv->ddxMinor == 1) && (sPriv->ddxPatch > 0));
- if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
- void * const psc = sPriv->psc->screenConfigs;
-
- if ( glx_enable_extension != NULL ) {
- if ( mgaScreen->linecomp_sane ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
- }
-
- if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
- serverInfo->chipset != MGA_CARD_TYPE_G400) {
- XFree(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Unrecognized chipset");
- return GL_FALSE;
- }
-
-
- mgaScreen->chipset = serverInfo->chipset;
- mgaScreen->width = serverInfo->width;
- mgaScreen->height = serverInfo->height;
- mgaScreen->mem = serverInfo->mem;
- mgaScreen->cpp = serverInfo->cpp;
-
- mgaScreen->agpMode = serverInfo->agpMode;
-
- mgaScreen->frontPitch = serverInfo->frontPitch;
- mgaScreen->frontOffset = serverInfo->frontOffset;
- mgaScreen->backOffset = serverInfo->backOffset;
- mgaScreen->backPitch = serverInfo->backPitch;
- mgaScreen->depthOffset = serverInfo->depthOffset;
- mgaScreen->depthPitch = serverInfo->depthPitch;
-
- mgaScreen->mmio.handle = serverInfo->registers.handle;
- mgaScreen->mmio.size = serverInfo->registers.size;
- if ( drmMap( sPriv->fd,
- mgaScreen->mmio.handle, mgaScreen->mmio.size,
- &mgaScreen->mmio.map ) < 0 ) {
- FREE( mgaScreen );
- sPriv->private = NULL;
- __driUtilMessage( "Couldn't map MMIO registers" );
- return GL_FALSE;
- }
-
- mgaScreen->primary.handle = serverInfo->primary.handle;
- mgaScreen->primary.size = serverInfo->primary.size;
- mgaScreen->buffers.handle = serverInfo->buffers.handle;
- mgaScreen->buffers.size = serverInfo->buffers.size;
-
-#if 0
- mgaScreen->agp.handle = serverInfo->agp;
- mgaScreen->agp.size = serverInfo->agpSize;
-
- if (drmMap(sPriv->fd,
- mgaScreen->agp.handle,
- mgaScreen->agp.size,
- (drmAddress *)&mgaScreen->agp.map) != 0)
- {
- Xfree(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map agp region");
- return GL_FALSE;
- }
-#endif
-
- mgaScreen->textureOffset[MGA_CARD_HEAP] = serverInfo->textureOffset;
- mgaScreen->textureOffset[MGA_AGP_HEAP] = (serverInfo->agpTextureOffset |
- PDEA_pagpxfer_enable | 1);
-
- mgaScreen->textureSize[MGA_CARD_HEAP] = serverInfo->textureSize;
- mgaScreen->textureSize[MGA_AGP_HEAP] = serverInfo->agpTextureSize;
-
- mgaScreen->logTextureGranularity[MGA_CARD_HEAP] =
- serverInfo->logTextureGranularity;
- mgaScreen->logTextureGranularity[MGA_AGP_HEAP] =
- serverInfo->logAgpTextureGranularity;
-
- mgaScreen->texVirtual[MGA_CARD_HEAP] = (char *)(mgaScreen->sPriv->pFB +
- serverInfo->textureOffset);
- if (drmMap(sPriv->fd,
- serverInfo->agpTextureOffset,
- serverInfo->agpTextureSize,
- (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0)
- {
- Xfree(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map agptexture region");
- return GL_FALSE;
- }
-
-#if 0
- mgaScreen->texVirtual[MGA_AGP_HEAP] = (mgaScreen->agp.map +
- serverInfo->agpTextureOffset);
-#endif
-
- mgaScreen->mAccess = serverInfo->mAccess;
-
- /* For calculating setupdma addresses.
- */
- mgaScreen->dmaOffset = serverInfo->buffers.handle;
-
- mgaScreen->bufs = drmMapBufs(sPriv->fd);
- if (!mgaScreen->bufs) {
- /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
- XFree(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map dma buffers");
- return GL_FALSE;
- }
- mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&mgaScreen->optionCache);
-
- return GL_TRUE;
-}
-
-
-static void
-mgaDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf(stderr, "mgaDestroyScreen\n");
-
- /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
-
- /* free all option information */
- driDestroyOptionInfo (&mgaScreen->optionCache);
-
- Xfree(mgaScreen);
- sPriv->private = NULL;
-}
-
-
-extern const struct gl_pipeline_stage _mga_render_stage;
-
-static const struct gl_pipeline_stage *mga_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 0
- &_mga_render_stage, /* ADD: unclipped rastersetup-to-dma */
- /* Need new ioctl for wacceptseq */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const char * const g400_extensions[] =
-{
- "GL_ARB_multitexture",
- "GL_ARB_texture_env_add",
- "GL_EXT_texture_env_add",
- "GL_ARB_texture_env_combine",
- "GL_EXT_texture_env_combine",
- "GL_ARB_texture_env_crossbar",
- "GL_ATI_texture_env_combine3",
- "GL_EXT_texture_edge_clamp",
- "GL_SGIS_texture_edge_clamp",
-#if defined (MESA_packed_depth_stencil)
- "GL_MESA_packed_depth_stencil",
-#endif
- NULL
-};
-
-static const char * const card_extensions[] =
-{
- "GL_ARB_multisample",
- "GL_ARB_texture_compression",
- "GL_EXT_blend_logic_op",
- "GL_EXT_fog_coord",
- /* paletted_textures currently doesn't work, but we could fix them later */
-#if 0
- "GL_EXT_shared_texture_palette",
- "GL_EXT_paletted_texture",
-#endif
- "GL_EXT_secondary_color",
- "GL_EXT_stencil_wrap",
- "GL_MESA_ycbcr_texture",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_lod",
- "GL_NV_texture_rectangle",
- NULL
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_VERBOSE_FALLBACK },
- { "tex", DEBUG_VERBOSE_TEXTURE },
- { "ioctl", DEBUG_VERBOSE_IOCTL },
- { "verb", DEBUG_VERBOSE_MSG },
- { "dri", DEBUG_VERBOSE_DRI },
- { NULL, 0 }
-};
-
-
-static int
-get_ust_nop( int64_t * ust )
-{
- *ust = 1;
- return 0;
-}
-
-
-static GLboolean
-mgaCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- int i;
- unsigned maxlevels;
- GLcontext *ctx, *shareCtx;
- mgaContextPtr mmesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
- MGASAREAPrivPtr saPriv=(MGASAREAPrivPtr)(((char*)sPriv->pSAREA)+
- mgaScreen->sarea_priv_offset);
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf(stderr, "mgaCreateContext\n");
-
- /* allocate mga context */
- mmesa = (mgaContextPtr) CALLOC(sizeof(mgaContext));
- if (!mmesa) {
- return GL_FALSE;
- }
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) mmesa, GL_TRUE);
- if (!mmesa->glCtx) {
- FREE(mmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = mmesa;
-
- /* Init mga state */
- mmesa->hHWContext = driContextPriv->hHWContext;
- mmesa->driFd = sPriv->fd;
- mmesa->driHwLock = &sPriv->pSAREA->lock;
-
- mmesa->mgaScreen = mgaScreen;
- mmesa->driScreen = sPriv;
- mmesa->sarea = (void *)saPriv;
-
- /* Parse configuration files */
- driParseConfigFiles (&mmesa->optionCache, &mgaScreen->optionCache,
- sPriv->myNum, "mga");
-
- (void) memset( mmesa->texture_heaps, 0, sizeof( mmesa->texture_heaps ) );
- make_empty_list( & mmesa->swapped );
-
- mmesa->nr_heaps = mgaScreen->texVirtual[MGA_AGP_HEAP] ? 2 : 1;
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- mmesa->texture_heaps[i] = driCreateTextureHeap( i, mmesa,
- mgaScreen->textureSize[i],
- 6,
- MGA_NR_TEX_REGIONS,
- mmesa->sarea->texList[i],
- & mmesa->sarea->texAge[i],
- & mmesa->swapped,
- sizeof( mgaTextureObject_t ),
- (destroy_texture_object_t *) mgaDestroyTexObj );
- }
-
- /* Set the maximum texture size small enough that we can guarentee
- * that both texture units can bind a maximal texture and have them
- * on the card at once.
- */
- ctx = mmesa->glCtx;
- if ( mgaScreen->chipset == MGA_CARD_TYPE_G200 ) {
- ctx->Const.MaxTextureUnits = 1;
- maxlevels = G200_TEX_MAXLEVELS;
-
- }
- else {
- ctx->Const.MaxTextureUnits = 2;
- maxlevels = G400_TEX_MAXLEVELS;
- }
-
- driCalculateMaxTextureLevels( mmesa->texture_heaps,
- mmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 11, /* max texture rect size is 2048x2048 */
- maxlevels,
- GL_FALSE );
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- mmesa->texture_depth = driQueryOptioni (&mmesa->optionCache,
- "texture_depth");
- if (mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- mmesa->texture_depth = ( mesaVis->rgbBits >= 24 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
- mmesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
-
- switch (mesaVis->depthBits) {
- case 16:
- mmesa->depth_scale = 1.0/(GLdouble)0xffff;
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffff;
- break;
- case 24:
- mmesa->depth_scale = 1.0/(GLdouble)0xffffff;
- if (mmesa->hw_stencil) {
- mmesa->depth_clear_mask = 0xffffff00;
- mmesa->stencil_clear_mask = 0x000000ff;
- } else
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffffff00;
- break;
- case 32:
- mmesa->depth_scale = 1.0/(GLdouble)0xffffffff;
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffffffff;
- break;
- };
-
- mmesa->haveHwStipple = GL_FALSE;
- mmesa->RenderIndex = -1; /* impossible value */
- mmesa->dirty = ~0;
- mmesa->vertex_format = 0;
- mmesa->CurrentTexObj[0] = 0;
- mmesa->CurrentTexObj[1] = 0;
- mmesa->tmu_source[0] = 0;
- mmesa->tmu_source[1] = 1;
-
- mmesa->texAge[0] = 0;
- mmesa->texAge[1] = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
-
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, mga_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- mmesa->primary_offset = mmesa->mgaScreen->primary.handle;
-
- ctx->DriverCtx = (void *) mmesa;
- mmesa->glCtx = ctx;
-
- driInitExtensions( ctx, card_extensions, GL_FALSE );
-
- if (MGA_IS_G400(MGA_CONTEXT(ctx))) {
- driInitExtensions( ctx, g400_extensions, GL_FALSE );
- }
-
- mgaDDInitStateFuncs( ctx );
- mgaDDInitTextureFuncs( ctx );
- mgaDDInitSpanFuncs( ctx );
- mgaDDInitDriverFuncs( ctx );
- mgaDDInitIoctlFuncs( ctx );
- mgaDDInitPixelFuncs( ctx );
- mgaDDInitTriFuncs( ctx );
-
- mgaInitVB( ctx );
- mgaInitState( mmesa );
-
- driContextPriv->driverPrivate = (void *) mmesa;
-
-#if DO_DEBUG
- MGA_DEBUG = driParseDebugString( getenv( "MGA_DEBUG" ),
- debug_control );
-#endif
-
- mmesa->vblank_flags = ((mmesa->mgaScreen->irq == 0)
- || !mmesa->mgaScreen->linecomp_sane)
- ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
-
- mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
- if ( mmesa->get_ust == NULL ) {
- mmesa->get_ust = get_ust_nop;
- }
-
- (*mmesa->get_ust)( & mmesa->swap_ust );
-
- return GL_TRUE;
-}
-
-static void
-mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf( stderr, "[%s:%d] mgaDestroyContext start\n",
- __FILE__, __LINE__ );
-
- assert(mmesa); /* should never be null */
- if (mmesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (mmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( mmesa->glCtx );
- _tnl_DestroyContext( mmesa->glCtx );
- _ac_DestroyContext( mmesa->glCtx );
- _swrast_DestroyContext( mmesa->glCtx );
-
- mgaFreeVB( mmesa->glCtx );
-
- /* free the Mesa context */
- mmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(mmesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & mmesa->swapped ) );
-
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( mmesa->texture_heaps[ i ] );
- mmesa->texture_heaps[ i ] = NULL;
- }
- }
-
- /* free the option cache */
- driDestroyOptionCache (&mmesa->optionCache);
-
- FREE(mmesa);
- }
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf( stderr, "[%s:%d] mgaDestroyContext done\n",
- __FILE__, __LINE__ );
-}
-
-
-static GLboolean
-mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE ); /* software alpha buffer? */
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-mgaSwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- mgaContextPtr mmesa;
- GLcontext *ctx;
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = mmesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx );
- mgaCopyBuffer( dPriv );
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
-
-static GLboolean
-mgaUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
- if (mmesa)
- mmesa->dirty = ~0;
-
- return GL_TRUE;
-}
-
-static GLboolean
-mgaOpenCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-
-/* This looks buggy to me - the 'b' variable isn't used anywhere...
- * Hmm - It seems that the drawable is already hooked in to
- * driDrawablePriv.
- *
- * But why are we doing context initialization here???
- */
-static GLboolean
-mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
-
- if (mmesa->driDrawable != driDrawPriv) {
- driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags );
- mmesa->driDrawable = driDrawPriv;
- mmesa->dirty = ~0;
- mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
- mmesa->mesa_drawable = driDrawPriv;
- }
-
- mmesa->driReadable = driReadPriv;
-
- _mesa_make_current2(mmesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- if (!mmesa->glCtx->Viewport.Width)
- _mesa_set_viewport(mmesa->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
-
- }
- else {
- _mesa_make_current(NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-
-void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- MGASAREAPrivPtr sarea = mmesa->sarea;
- int me = mmesa->hHWContext;
- int i;
-
- drmGetLock(mmesa->driFd, mmesa->hHWContext, flags);
-
- if (*(dPriv->pStamp) != mmesa->lastStamp) {
- mmesa->lastStamp = *(dPriv->pStamp);
- mmesa->SetupNewInputs |= VERT_BIT_CLIP;
- mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
- mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-
- mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT;
-
- if (sarea->ctxOwner != me) {
- mmesa->dirty |= (MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0 |
- MGA_UPLOAD_TEX1 | MGA_UPLOAD_PIPE);
- sarea->ctxOwner=me;
- }
-
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( mmesa->texture_heaps[ i ] );
- }
-
- sarea->last_quiescent = -1; /* just kill it for now */
-}
-
-
-static const struct __DriverAPIRec mgaAPI = {
- .InitDriver = mgaInitDriver,
- .DestroyScreen = mgaDestroyScreen,
- .CreateContext = mgaCreateContext,
- .DestroyContext = mgaDestroyContext,
- .CreateBuffer = mgaCreateBuffer,
- .DestroyBuffer = mgaDestroyBuffer,
- .SwapBuffers = mgaSwapBuffers,
- .MakeCurrent = mgaMakeCurrent,
- .UnbindContext = mgaUnbindContext,
- .OpenFullScreen = mgaOpenCloseFullScreen,
- .CloseFullScreen = mgaOpenCloseFullScreen,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &mgaAPI);
- return (void *) psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- mgaContextPtr mmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = mmesa->swap_count;
- sInfo->swap_ust = mmesa->swap_ust;
- sInfo->swap_missed_count = mmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, mmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h
deleted file mode 100644
index d372abe01..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h,v 1.12 2002/12/16 16:18:52 dawes Exp $ */
-
-#ifndef _MGA_INIT_H_
-#define _MGA_INIT_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "mtypes.h"
-#include "mgaregs.h"
-#include "mga_common.h"
-#include "xmlconfig.h"
-
-typedef struct mga_screen_private_s {
-
- int chipset;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- GLint agpMode;
- unsigned int irq; /* IRQ number (0 means none) */
- GLboolean linecomp_sane; /* GL_TRUE if line comp. programmed correctly
- * by the DDX driver.
- */
-
- unsigned int mAccess;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
- int depthCpp;
-
- unsigned int dmaOffset;
-
- unsigned int textureOffset[DRM_MGA_NR_TEX_HEAPS];
- unsigned int textureSize[DRM_MGA_NR_TEX_HEAPS];
- int logTextureGranularity[DRM_MGA_NR_TEX_HEAPS];
- char *texVirtual[DRM_MGA_NR_TEX_HEAPS];
-
-
- __DRIscreenPrivate *sPriv;
- drmBufMapPtr bufs;
-
- drmRegion mmio;
- drmRegion status;
- drmRegion primary;
- drmRegion buffers;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} mgaScreenPrivate;
-
-
-#include "mgacontext.h"
-
-extern void mgaGetLock( mgaContextPtr mmesa, GLuint flags );
-extern void mgaEmitHwStateLocked( mgaContextPtr mmesa );
-extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit );
-
-#define GET_DISPATCH_AGE( mmesa ) mmesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE( mmesa ) mmesa->sarea->last_enqueue
-
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( mmesa ) \
- do { \
- char __ret=0; \
- DRM_CAS(mmesa->driHwLock, mmesa->hHWContext, \
- (DRM_LOCK_HELD|mmesa->hHWContext), __ret); \
- if (__ret) \
- mgaGetLock( mmesa, 0 ); \
- } while (0)
-
-
-/*
- */
-#define LOCK_HARDWARE_QUIESCENT( mmesa ) do { \
- LOCK_HARDWARE( mmesa ); \
- UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \
-} while (0)
-
-
-/* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(mmesa) \
- DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext);
-
-
-/* Freshen our snapshot of the drawables
- */
-#define REFRESH_DRAWABLE_INFO( mmesa ) \
-do { \
- LOCK_HARDWARE( mmesa ); \
- mmesa->lastX = mmesa->drawX; \
- mmesa->lastY = mmesa->drawY; \
- UNLOCK_HARDWARE( mmesa ); \
-} while (0)
-
-
-#define GET_DRAWABLE_LOCK( mmesa ) while(0)
-#define RELEASE_DRAWABLE_LOCK( mmesa ) while(0)
-
-
-/* The 2D driver macros are busted -- we can't use them here as they
- * rely on the 2D driver data structures rather than taking an explicit
- * base address.
- */
-#define MGA_BASE( reg ) ((unsigned long)(mmesa->mgaScreen->mmio.map))
-#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg)
-
-#define MGA_DEREF( reg ) *(volatile CARD32 *)MGA_ADDR( reg )
-#define MGA_READ( reg ) MGA_DEREF( reg )
-#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0)
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h
deleted file mode 100644
index 15cb84531..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.7 2002/12/16 16:18:52 dawes Exp $*/
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef MGALIB_INC
-#define MGALIB_INC
-
-#include <inttypes.h>
-#include "dri_util.h"
-#include "mtypes.h"
-#include "xf86drm.h"
-#include "mm.h"
-#include "mga_sarea.h"
-#include "texmem.h"
-#include "macros.h"
-#include "xmlconfig.h"
-
-#define MGA_SET_FIELD(reg,mask,val) reg = ((reg) & (mask)) | ((val) & ~(mask))
-#define MGA_FIELD(field,val) (((val) << (field ## _SHIFT)) & ~(field ## _MASK))
-#define MGA_GET_FIELD(field, val) ((val & ~(field ## _MASK)) >> (field ## _SHIFT))
-
-#define MGA_IS_G200(mmesa) (mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G200)
-#define MGA_IS_G400(mmesa) (mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G400)
-
-
-/* SoftwareFallback
- * - texture env GL_BLEND -- can be fixed
- * - 1D and 3D textures
- * - incomplete textures
- * - GL_DEPTH_FUNC == GL_NEVER not in h/w
- */
-#define MGA_FALLBACK_TEXTURE 0x1
-#define MGA_FALLBACK_DRAW_BUFFER 0x2
-#define MGA_FALLBACK_READ_BUFFER 0x4
-#define MGA_FALLBACK_BLEND 0x8
-#define MGA_FALLBACK_RENDERMODE 0x10
-#define MGA_FALLBACK_STENCIL 0x20
-#define MGA_FALLBACK_DEPTH 0x40
-#define MGA_FALLBACK_BORDER_MODE 0x80
-
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) mga##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef struct mga_context_t mgaContext;
-typedef struct mga_context_t *mgaContextPtr;
-
-typedef void (*mga_tri_func)( mgaContextPtr, mgaVertex *, mgaVertex *,
- mgaVertex * );
-typedef void (*mga_line_func)( mgaContextPtr, mgaVertex *, mgaVertex * );
-typedef void (*mga_point_func)( mgaContextPtr, mgaVertex * );
-
-
-
-/* Texture environment color
- */
-#define RGB_ZERO(c) (((c) & 0xffffff) == 0x000000)
-#define RGB_ONE(c) (((c) & 0xffffff) == 0xffffff)
-#define ALPHA_ZERO(c) (((c) >> 24) == 0x00)
-#define ALPHA_ONE(c) (((c) >> 24) == 0xff)
-#define RGBA_EQUAL(c) ((c) == PACK_COLOR_8888( (c) & 0xff, (c) & 0xff, \
- (c) & 0xff, (c) & 0xff ))
-
-struct mga_texture_object_s;
-struct mga_screen_private_s;
-
-#define G200_TEX_MAXLEVELS 5
-#define G400_TEX_MAXLEVELS 11
-
-typedef struct mga_texture_object_s
-{
- driTextureObject base;
-
- /* The G200 only has the ability to use 5 mipmap levels (including the
- * base level). The G400 does not have this restriction, but it still
- * only has 5 offset pointers in the hardware. The trick on the G400 is
- * upto the first 4 offset pointers point to mipmap levels. The last
- * offset pointer tells how large the preceeding mipmap is. This value is
- * then used to determine where the remaining mipmaps are.
- *
- * For example, if the first offsets[0] through offsets[2] are used as
- * pointers, then offset[3] will be the size of the mipmap pointed to by
- * offsets[2]. So mipmap level 3 will be at (offsets[2]+offsets[3]). For
- * each successive mipmap level, offsets[3] is divided by 4 and added to
- * the previous address. So mipmap level 4 will be at
- * (offsets[2]+offsets[3]+(offsets[3] / 4)).
- *
- * The last pointer is selected by setting TO_texorgoffsetsel in its
- * pointer. In the previous example, offset[2] would have
- * TO_texorgoffsetsel or'ed in before writing it to the hardware.
- *
- * In the current driver all of the mipmaps are packed together linearly
- * with mipmap level 0. Therefore offsets[0] points to the base of the
- * texture (and has TO_texorgoffsetsel or'ed in), and offsets[1] is the
- * size of the base texture.
- *
- * There is a possible optimization available here. At times the driver
- * may not be able to allocate a single block of memory for the complete
- * texture without ejecting some other textures from memory. It may be
- * possible to put some of the lower mipmap levels (i.e., the larger
- * mipmaps) in memory separate from the higher levels.
- *
- * The implementation should be fairly obvious, but getting "right" would
- * likely be non-trivial. A first allocation for the entire texture would
- * be attempted with a flag that says "don't eject other textures." If
- * that failed, an additional allocation would be attmpted for just the
- * base map. The process would repeat with the block of lower maps. The
- * tricky parts would be in detecting when some of the levels had been
- * ejected from texture memory by other textures and preventing the
- * 4th allocation (for all the smallest mipmap levels) from kicking out
- * any of the first three.
- *
- * This array holds G400_TEX_MAXLEVELS pointers to remove an if-statement
- * in a loop in mgaSetTexImages. Values past G200_TEX_MAXLEVELS are not
- * used.
- */
- GLuint offsets[G400_TEX_MAXLEVELS];
-
- int texelBytes;
- GLuint age;
-
- mga_texture_regs_t setup;
-
- /* If one texture dimension wraps with GL_CLAMP and the other with
- * GL_CLAMP_TO_EDGE, we have to fallback to software. We would also have
- * to fallback for GL_CLAMP_TO_BORDER.
- */
- GLboolean border_fallback;
- /* Depending on multitxturing and environment color
- * GL_BLEND may have to be a software fallback.
- */
- GLboolean texenv_fallback;
-} mgaTextureObject_t;
-
-struct mga_hw_state {
- GLuint specen;
- GLuint cull;
- GLuint cull_dualtex;
- GLuint stencil;
- GLuint stencilctl;
- GLuint stencil_enable;
- GLuint zmode;
- GLuint rop;
- GLuint alpha_func;
- GLuint alpha_func_enable;
- GLuint blend_func;
- GLuint blend_func_enable;
- GLuint alpha_sel;
-};
-
-struct mga_context_t {
-
- GLcontext *glCtx;
- unsigned int lastStamp; /* fullscreen breaks dpriv->laststamp,
- * need to shadow it here. */
-
- /* Hardware state management
- */
- struct mga_hw_state hw;
-
- /* Bookkeeping for texturing
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ MGA_NR_TEX_HEAPS ];
- driTextureObject swapped;
-
- struct mga_texture_object_s *CurrentTexObj[2];
-
-
- /* Map GL texture units onto hardware.
- */
- GLuint tmu_source[2];
-
- int texture_depth;
-
- /* Manage fallbacks
- */
- GLuint Fallback;
-
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Texture environment color.
- */
- unsigned int envcolor[2];
- GLboolean fcol_used;
- GLboolean force_dualtex;
-
- /* Rasterization state
- */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
-
- GLuint hw_primitive;
- GLenum raster_primitive;
- GLenum render_primitive;
-
- GLubyte *verts;
- GLint vertex_stride_shift;
- GLuint vertex_format;
- GLuint vertex_size;
-
- /* Fallback rasterization functions
- */
- mga_point_func draw_point;
- mga_line_func draw_line;
- mga_tri_func draw_tri;
-
-
- /* Manage driver and hardware state
- */
- GLuint NewGLState;
- GLuint dirty;
-
- mga_context_regs_t setup;
-
- GLuint ClearColor;
- GLuint ClearDepth;
- GLuint poly_stipple;
- GLfloat depth_scale;
-
- GLuint depth_clear_mask;
- GLuint stencil_clear_mask;
- GLuint hw_stencil;
- GLuint haveHwStipple;
- GLfloat hw_viewport[16];
-
- /* Dma buffers
- */
- drmBufPtr vertex_dma_buffer;
- drmBufPtr iload_buffer;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- uint64_t swap_ust;
- uint64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
- PFNGLXGETUSTPROC get_ust;
-
- /* Drawable, cliprect and scissor information
- */
- int dirty_cliprects; /* which sets of cliprects are uptodate? */
- int draw_buffer; /* which buffer are we rendering to */
- unsigned int drawOffset; /* draw buffer address in space */
- int readOffset;
- int drawX, drawY; /* origin of drawable in draw buffer */
- int lastX, lastY; /* detect DSTORG bug */
- GLuint numClipRects; /* cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
- XF86DRIClipRectRec draw_rect;
- XF86DRIClipRectRec scissor_rect;
- int scissor;
-
- XF86DRIClipRectRec tmp_boxes[2][MGA_NR_SAREA_CLIPRECTS];
-
-
- /* Texture aging and DMA based aging.
- */
- unsigned int texAge[MGA_NR_TEX_HEAPS];/* texture LRU age */
- unsigned int dirtyAge; /* buffer age for synchronization */
-
- GLuint primary_offset;
-
- /* Mirrors of some DRI state.
- */
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
- __DRIdrawablePrivate *driDrawable;
- __DRIdrawablePrivate *driReadable;
-
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
- __DRIscreenPrivate *driScreen;
- struct mga_screen_private_s *mgaScreen;
- MGASAREAPrivPtr sarea;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define MGA_CONTEXT(ctx) ((mgaContextPtr)(ctx->DriverCtx))
-
-
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int MGA_DEBUG;
-#else
-#define MGA_DEBUG 0
-#endif
-
-#define DEBUG_VERBOSE_MSG 0x01
-#define DEBUG_VERBOSE_DRI 0x02
-#define DEBUG_VERBOSE_IOCTL 0x04
-#define DEBUG_VERBOSE_TEXTURE 0x08
-#define DEBUG_VERBOSE_FALLBACK 0x10
-
-static __inline__ GLuint mgaPackColor(GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
- switch (cpp) {
- case 2:
- return PACK_COLOR_565( r, g, b );
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-
-/*
- * Subpixel offsets for window coordinates:
- */
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F + 0.125)
-
-
-#define MGA_WA_TRIANGLES 0x18000000
-#define MGA_WA_TRISTRIP_T0 0x02010200
-#define MGA_WA_TRIFAN_T0 0x01000408
-#define MGA_WA_TRISTRIP_T0T1 0x02010400
-#define MGA_WA_TRIFAN_T0T1 0x01000810
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c
deleted file mode 100644
index d2f11d8d4..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.14 2002/10/30 12:51:35 alanh Exp $ */
-
-
-#include "mtypes.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgaspan.h"
-#include "mgatex.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mga_xmesa.h"
-#include "utils.h"
-
-#define DRIVER_DATE "20030328"
-
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-
-static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- static char buffer[128];
- unsigned offset;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *) "VA Linux Systems Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer,
- MGA_IS_G400(mmesa) ? "G400" :
- MGA_IS_G200(mmesa) ? "G200" : "MGA",
- DRIVER_DATE,
- mmesa->mgaScreen->agpMode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-
-static void mgaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE( mmesa );
- *width = mmesa->driDrawable->w;
- *height = mmesa->driDrawable->h;
- UNLOCK_HARDWARE( mmesa );
-}
-
-void mgaDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = mgaBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = mgaDDGetString;
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.h b/xc/lib/GL/mesa/src/drv/mga/mgadd.h
deleted file mode 100644
index 919fd742d..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgadd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.h,v 1.3 2002/10/30 12:51:35 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef MGADD_INC
-#define MGADD_INC
-
-#include "context.h"
-
-void mgaDDInitDriverFuncs( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
deleted file mode 100644
index 2709a40c6..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.16 2002/12/16 16:18:52 dawes Exp $ */
-
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgavb.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-#include "mga_common.h"
-
-#include "vblank.h"
-
-
-static void mga_iload_dma_ioctl(mgaContextPtr mmesa,
- unsigned long dest,
- int length)
-{
- drmBufPtr buf = mmesa->iload_buffer;
- drmMGAIload iload;
- int ret, i;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "DRM_IOCTL_MGA_ILOAD idx %d dst %x length %d\n",
- buf->idx, (int) dest, length);
-
- if ( (length & MGA_ILOAD_MASK) != 0 ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "%s: Invalid ILOAD datasize (%d), must be "
- "multiple of %u.\n", __FUNCTION__, length, MGA_ILOAD_ALIGN );
- exit( 1 );
- }
-
- iload.idx = buf->idx;
- iload.dstorg = dest;
- iload.length = length;
-
- i = 0;
- do {
- ret = drmCommandWrite( mmesa->driFd, DRM_MGA_ILOAD,
- &iload, sizeof(drmMGAIload) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- if ( ret < 0 ) {
- printf("send iload retcode = %d\n", ret);
- exit(1);
- }
-
- mmesa->iload_buffer = 0;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "finished iload dma put\n");
-
-}
-
-drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa )
-{
- int idx = 0;
- int size = 0;
- drmDMAReq dma;
- int retcode;
- drmBufPtr buf;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "Getting dma buffer\n");
-
- dma.context = mmesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = MGA_BUFFER_SIZE;
- dma.request_list = &idx;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "drmDMA (get) ctx %d count %d size 0x%x\n",
- dma.context, dma.request_count,
- dma.request_size);
-
- while (1) {
- retcode = drmDMA(mmesa->driFd, &dma);
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "retcode %d sz %d idx %d count %d\n",
- retcode,
- dma.request_sizes[0],
- dma.request_list[0],
- dma.granted_count);
-
- if (retcode == 0 &&
- dma.request_sizes[0] &&
- dma.granted_count)
- break;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "\n\nflush");
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
-
- buf = &(mmesa->mgaScreen->bufs->list[idx]);
- buf->used = 0;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr,
- "drmDMA (get) returns size[0] 0x%x idx[0] %d\n"
- "dma_buffer now: buf idx: %d size: %d used: %d addr %p\n",
- dma.request_sizes[0], dma.request_list[0],
- buf->idx, buf->total,
- buf->used, buf->address);
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "finished getbuffer\n");
-
- return buf;
-}
-
-
-
-
-static void
-mgaDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- GLuint flags = 0;
- GLuint clear_color = mmesa->ClearColor;
- GLuint clear_depth = 0;
- GLuint color_mask = 0;
- GLuint depth_mask = 0;
- int ret;
- int i;
- static int nrclears;
- drmMGAClearRec clear;
-
- FLUSH_BATCH( mmesa );
-
- if ( mask & DD_FRONT_LEFT_BIT ) {
- flags |= MGA_FRONT;
- color_mask = mmesa->setup.plnwt;
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if ( mask & DD_BACK_LEFT_BIT ) {
- flags |= MGA_BACK;
- color_mask = mmesa->setup.plnwt;
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) {
- flags |= MGA_DEPTH;
- clear_depth = (mmesa->ClearDepth & mmesa->depth_clear_mask);
- depth_mask |= mmesa->depth_clear_mask;
- mask &= ~DD_DEPTH_BIT;
- }
-
- if ( (mask & DD_STENCIL_BIT) && mmesa->hw_stencil ) {
- flags |= MGA_DEPTH;
- clear_depth |= (ctx->Stencil.Clear & mmesa->stencil_clear_mask);
- depth_mask |= mmesa->stencil_clear_mask;
- mask &= ~DD_STENCIL_BIT;
- }
-
- if ( flags ) {
- LOCK_HARDWARE( mmesa );
-
- if ( mmesa->dirty_cliprects )
- mgaUpdateRects( mmesa, (MGA_FRONT | MGA_BACK) );
-
- /* flip top to bottom */
- cy = dPriv->h-cy-ch;
- cx += mmesa->drawX;
- cy += mmesa->drawY;
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr, "Clear, bufs %x nbox %d\n",
- (int)flags, (int)mmesa->numClipRects );
-
- for (i = 0 ; i < mmesa->numClipRects ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, mmesa->numClipRects);
- XF86DRIClipRectPtr box = mmesa->pClipRects;
- XF86DRIClipRectPtr b = mmesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = *(XF86DRIClipRectPtr)&box[i];
- n++;
- }
- }
-
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr,
- "DRM_IOCTL_MGA_CLEAR flag 0x%x color %x depth %x nbox %d\n",
- flags, clear_color, clear_depth, mmesa->sarea->nbox );
-
- mmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = clear_color;
- clear.clear_depth = clear_depth;
- clear.color_mask = color_mask;
- clear.depth_mask = depth_mask;
- ret = drmCommandWrite( mmesa->driFd, DRM_MGA_CLEAR,
- &clear, sizeof(drmMGAClearRec));
- if ( ret ) {
- fprintf( stderr, "send clear retcode = %d\n", ret );
- exit( 1 );
- }
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr, "finished clear %d\n", ++nrclears );
- }
-
- UNLOCK_HARDWARE( mmesa );
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS|MGA_UPLOAD_CONTEXT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
-{
- unsigned wait = 0;
- GLuint last_frame, last_wrap;
-
-
- last_frame = mmesa->sarea->last_frame.head;
- last_wrap = mmesa->sarea->last_frame.wrap;
-
- /* FIXME: Add a timeout to this loop...
- */
- while ( 1 ) {
- if ( last_wrap < mmesa->sarea->last_wrap ||
- ( last_wrap == mmesa->sarea->last_wrap &&
- last_frame <= (MGA_READ( MGAREG_PRIMADDRESS ) -
- mmesa->primary_offset) ) ) {
- break;
- }
- if ( 0 ) {
- wait++;
- fprintf( stderr, " last: head=0x%06x wrap=%d\n",
- last_frame, last_wrap );
- fprintf( stderr, " head: head=0x%06lx wrap=%d\n",
- (long)(MGA_READ( MGAREG_PRIMADDRESS ) - mmesa->primary_offset),
- mmesa->sarea->last_wrap );
- }
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
-
- UNLOCK_HARDWARE( mmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( mmesa );
- }
- if ( wait )
- fprintf( stderr, "\n" );
-}
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- mgaContextPtr mmesa;
- XF86DRIClipRectPtr pbox;
- GLint nbox;
- GLint ret;
- GLint i;
- GLboolean missed_target;
-
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
-
- FLUSH_BATCH( mmesa );
-
- LOCK_HARDWARE( mmesa );
- mgaWaitForFrameCompletion( mmesa );
- UNLOCK_HARDWARE( mmesa );
- driWaitForVBlank( dPriv, & mmesa->vbl_seq, mmesa->vblank_flags,
- & missed_target );
- if ( missed_target ) {
- mmesa->swap_missed_count++;
- (void) (*mmesa->get_ust)( & mmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( mmesa );
-
- /* Use the frontbuffer cliprects
- */
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
-
- pbox = dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- XF86DRIClipRectPtr b = mmesa->sarea->boxes;
-
- mmesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
-
- if (0)
- fprintf(stderr, "DRM_IOCTL_MGA_SWAP\n");
-
- ret = drmCommandNone( mmesa->driFd, DRM_MGA_SWAP );
- if ( ret ) {
- printf("send swap retcode = %d\n", ret);
- exit(1);
- }
- }
-
- UNLOCK_HARDWARE( mmesa );
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
- mmesa->swap_count++;
- (void) (*mmesa->get_ust)( & mmesa->swap_ust );
-}
-
-
-/* This is overkill
- */
-void mgaDDFinish( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
-
- if (1/*mmesa->sarea->last_quiescent != mmesa->sarea->last_enqueue*/) {
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "mgaRegetLockQuiescent\n");
-
- LOCK_HARDWARE( mmesa );
- UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH );
- UNLOCK_HARDWARE( mmesa );
-
- mmesa->sarea->last_quiescent = mmesa->sarea->last_enqueue;
- }
-}
-
-void mgaWaitAgeLocked( mgaContextPtr mmesa, int age )
-{
- if (GET_DISPATCH_AGE(mmesa) < age) {
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
- }
-}
-
-
-void mgaWaitAge( mgaContextPtr mmesa, int age )
-{
- if (GET_DISPATCH_AGE(mmesa) < age) {
- LOCK_HARDWARE(mmesa);
- if (GET_DISPATCH_AGE(mmesa) < age) {
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
- }
- UNLOCK_HARDWARE(mmesa);
- }
-}
-
-
-static GLboolean intersect_rect( XF86DRIClipRectPtr out,
- const XF86DRIClipRectPtr a,
- const XF86DRIClipRectPtr b )
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (b->y2 < out->y2) out->y2 = b->y2;
-
- return ((out->x1 < out->x2) && (out->y1 < out->y2));
-}
-
-
-
-
-static void age_mmesa( mgaContextPtr mmesa, int age )
-{
- if (mmesa->CurrentTexObj[0]) mmesa->CurrentTexObj[0]->age = age;
- if (mmesa->CurrentTexObj[1]) mmesa->CurrentTexObj[1]->age = age;
-}
-
-#ifdef __i386__
-static int __break_vertex = 0;
-#endif
-
-void mgaFlushVerticesLocked( mgaContextPtr mmesa )
-{
- XF86DRIClipRectPtr pbox = mmesa->pClipRects;
- int nbox = mmesa->numClipRects;
- drmBufPtr buffer = mmesa->vertex_dma_buffer;
- drmMGAVertex vertex;
- int i;
-
- mmesa->vertex_dma_buffer = 0;
-
- if (!buffer)
- return;
-
- if (mmesa->dirty_cliprects & mmesa->draw_buffer)
- mgaUpdateRects( mmesa, mmesa->draw_buffer );
-
- if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS)
- mgaEmitHwStateLocked( mmesa );
-
- /* FIXME: Workaround bug in kernel module.
- */
- mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT;
-
- if (!nbox)
- buffer->used = 0;
-
- if (nbox >= MGA_NR_SAREA_CLIPRECTS)
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-
-#if 0
- if (!buffer->used || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS))
- {
- if (nbox == 1)
- mmesa->sarea->nbox = 0;
- else
- mmesa->sarea->nbox = nbox;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "Firing vertex -- case a nbox %d\n", nbox);
-
- vertex.idx = buffer->idx;
- vertex.used = buffer->used;
- vertex.discard = 1;
- drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX,
- &vertex, sizeof(drmMGAVertex) );
-
- age_mmesa(mmesa, mmesa->sarea->last_enqueue);
- }
- else
-#endif
- {
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox);
- XF86DRIClipRectPtr b = mmesa->sarea->boxes;
- int discard = 0;
-
- if (mmesa->scissor) {
- mmesa->sarea->nbox = 0;
-
- for ( ; i < nr ; i++) {
- *b = pbox[i];
- if (intersect_rect(b, b, &mmesa->scissor_rect)) {
- mmesa->sarea->nbox++;
- b++;
- }
- }
-
- /* Culled?
- */
- if (!mmesa->sarea->nbox) {
- if (nr < nbox) continue;
- buffer->used = 0;
- }
- } else {
- mmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- discard = 1;
-
- mmesa->sarea->dirty |= MGA_UPLOAD_CLIPRECTS;
-
- vertex.idx = buffer->idx;
- vertex.used = buffer->used;
- vertex.discard = discard;
- drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX,
- &vertex, sizeof(drmMGAVertex) );
-
- age_mmesa(mmesa, mmesa->sarea->last_enqueue);
- }
- }
-
- /* Do we really need to do this ? */
-#ifdef __i386__
- if ( __break_vertex ) {
- __asm__ __volatile__ ( "int $3" );
- }
-#endif
-
- mmesa->dirty &= ~MGA_UPLOAD_CLIPRECTS;
-}
-
-void mgaFlushVertices( mgaContextPtr mmesa )
-{
- LOCK_HARDWARE( mmesa );
- mgaFlushVerticesLocked( mmesa );
- UNLOCK_HARDWARE( mmesa );
-}
-
-
-void mgaFireILoadLocked( mgaContextPtr mmesa,
- GLuint offset, GLuint length )
-{
- if (!mmesa->iload_buffer) {
- fprintf(stderr, "mgaFireILoad: no buffer\n");
- return;
- }
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "mgaFireILoad idx %d ofs 0x%x length %d\n",
- mmesa->iload_buffer->idx, (int)offset, (int)length );
-
- mga_iload_dma_ioctl( mmesa, offset, length );
-}
-
-void mgaGetILoadBufferLocked( mgaContextPtr mmesa )
-{
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "mgaGetIloadBuffer (buffer now %p)\n",
- mmesa->iload_buffer);
-
- mmesa->iload_buffer = mga_get_buffer_ioctl( mmesa );
-}
-
-drmBufPtr mgaGetBufferLocked( mgaContextPtr mmesa )
-{
- return mga_get_buffer_ioctl( mmesa );
-}
-
-
-
-void mgaDDFlush( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
-
- FLUSH_BATCH( mmesa );
-
- /* This may be called redundantly - dispatch_age may trail what
- * has actually been sent and processed by the hardware.
- */
- if (1 || GET_DISPATCH_AGE( mmesa ) < mmesa->sarea->last_enqueue) {
- LOCK_HARDWARE( mmesa );
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
- UNLOCK_HARDWARE( mmesa );
- }
-}
-
-
-
-
-void mgaReleaseBufLocked( mgaContextPtr mmesa, drmBufPtr buffer )
-{
- drmMGAVertex vertex;
-
- if (!buffer) return;
-
- vertex.idx = buffer->idx;
- vertex.used = 0;
- vertex.discard = 1;
- drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX,
- &vertex, sizeof(drmMGAVertex) );
-}
-
-int mgaFlushDMA( int fd, drmLockFlags flags )
-{
- drmMGALock lock;
- int ret, i = 0;
-
- memset( &lock, 0, sizeof(drmMGALock) );
-
- if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= DRM_LOCK_QUIESCENT;
- if ( flags & DRM_LOCK_FLUSH ) lock.flags |= DRM_LOCK_FLUSH;
- if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= DRM_LOCK_FLUSH_ALL;
-
- do {
- ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(drmMGALock) );
- } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- if ( ret == 0 )
- return 0;
- if ( errno != EBUSY )
- return -errno;
-
- if ( lock.flags & DRM_LOCK_QUIESCENT ) {
- /* Only keep trying if we need quiescence.
- */
- lock.flags &= ~(DRM_LOCK_FLUSH | DRM_LOCK_FLUSH_ALL);
-
- do {
- ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(drmMGALock) );
- } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );
- }
-
- if ( ret == 0 ) {
- return 0;
- } else {
- return -errno;
- }
-}
-
-void mgaDDInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = mgaDDClear;
- ctx->Driver.Flush = mgaDDFlush;
- ctx->Driver.Finish = mgaDDFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
deleted file mode 100644
index 9e57d48ce..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.11 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGA_IOCTL_H
-#define MGA_IOCTL_H
-
-#include "mgacontext.h"
-#include "mga_xmesa.h"
-
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv );
-void mgaWaitForVBlank( mgaContextPtr mmesa );
-
-GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords );
-
-
-void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
-drmBufPtr mgaGetBufferLocked( mgaContextPtr mmesa );
-
-
-void mgaFireILoadLocked( mgaContextPtr mmesa,
- GLuint offset, GLuint length );
-
-void mgaWaitAgeLocked( mgaContextPtr mmesa, int age );
-void mgaWaitAge( mgaContextPtr mmesa, int age );
-
-void mgaFlushVertices( mgaContextPtr mmesa );
-void mgaFlushVerticesLocked( mgaContextPtr mmesa );
-void mgaReleaseBufLocked( mgaContextPtr mmesa, drmBufPtr buffer );
-int mgaFlushDMA( int fd, drmLockFlags flags );
-
-void mgaDDFlush( GLcontext *ctx );
-void mgaDDFinish( GLcontext *ctx );
-
-void mgaDDInitIoctlFuncs( GLcontext *ctx );
-
-#define FLUSH_BATCH(mmesa) do { \
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) \
- fprintf(stderr, "FLUSH_BATCH in %s\n", __FUNCTION__); \
- if (mmesa->vertex_dma_buffer) mgaFlushVertices(mmesa); \
-} while (0)
-
-#define MGA_STATECHANGE(mmesa, flag) do { \
- FLUSH_BATCH(mmesa); \
- mmesa->dirty |= flag; \
-} while (0)
-
-
-extern drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa );
-
-static __inline
-GLuint *mgaAllocDmaLow( mgaContextPtr mmesa, int bytes )
-{
- GLuint *head;
-
- if (!mmesa->vertex_dma_buffer) {
- LOCK_HARDWARE( mmesa );
- mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa );
- UNLOCK_HARDWARE( mmesa );
- } else if (mmesa->vertex_dma_buffer->used + bytes >
- mmesa->vertex_dma_buffer->total) {
- LOCK_HARDWARE( mmesa );
- mgaFlushVerticesLocked( mmesa );
- mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa );
- UNLOCK_HARDWARE( mmesa );
- }
-
- head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address +
- mmesa->vertex_dma_buffer->used);
-
- mmesa->vertex_dma_buffer->used += bytes;
- return head;
-}
-
-
-#define UPDATE_LOCK( mmesa, flags ) \
-do { \
- GLint ret = mgaFlushDMA( mmesa->driFd, flags ); \
- if ( ret < 0 ) { \
- drmCommandNone( mmesa->driFd, DRM_MGA_RESET ); \
- UNLOCK_HARDWARE( mmesa ); \
- fprintf( stderr, "%s: flush return = %s (%d), flags = 0x%08x\n", \
- __FUNCTION__, strerror( -ret ), -ret, \
- (unsigned)(flags) ); \
- exit( 1 ); \
- } \
-} while (0)
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c
deleted file mode 100644
index 07e0c3a75..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * Copyright 2000 Compaq Computer Inc. and VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.9 2002/11/05 17:46:08 tsi Exp $ */
-
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "texutil.h"
-#include "mgadd.h"
-#include "mgacontext.h"
-#include "mgaioctl.h"
-#include "mgapixel.h"
-#include "mgastate.h"
-
-#include "mga_common.h"
-
-#include "swrast/swrast.h"
-#include "imports.h"
-
-#define IS_AGP_MEM( mmesa, p ) \
- ((unsigned long)mmesa->mgaScreen->buffers.map <= ((unsigned long)p) && \
- (unsigned long)mmesa->mgaScreen->buffers.map + \
- (unsigned long)mmesa->mgaScreen->buffers.size > ((unsigned long)p))
-#define AGP_OFFSET( mmesa, p ) \
- (((unsigned long)p) - (unsigned long)mmesa->mgaScreen->buffers.map)
-
-
-#if defined(MESA_packed_depth_stencil)
-static GLboolean
-check_depth_stencil_24_8( const GLcontext *ctx, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz,
- GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- return ( type == GL_UNSIGNED_INT_24_8_MESA &&
- ctx->Visual->DepthBits == 24 &&
- ctx->Visual->StencilBits == 8 &&
- mmesa->mgaScreen->cpp == 4 &&
- mmesa->hw_stencil &&
- !ctx->Pixel.IndexShift &&
- !ctx->Pixel.IndexOffset &&
- !ctx->Pixel.MapStencilFlag &&
- ctx->Pixel.DepthBias == 0.0 &&
- ctx->Pixel.DepthScale == 1.0 &&
- !packing->SwapBytes &&
- pitch % 32 == 0 &&
- pitch < 4096 );
-}
-#endif
-
-
-static GLboolean
-check_depth( const GLcontext *ctx, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if ( IS_AGP_MEM( mmesa, pixels ) &&
- !( ( type == GL_UNSIGNED_INT && mmesa->mgaScreen->cpp == 4 ) ||
- ( type == GL_UNSIGNED_SHORT && mmesa->mgaScreen->cpp == 2 ) ) )
- return GL_FALSE;
-
- return ( ctx->Pixel.DepthBias == 0.0 &&
- ctx->Pixel.DepthScale == 1.0 &&
- !packing->SwapBytes &&
- pitch % 32 == 0 &&
- pitch < 4096 );
-}
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint cpp = mmesa->mgaScreen->cpp;
-
- /* Can't do conversions on agp reads/draws.
- */
- if ( IS_AGP_MEM( mmesa, pixels ) &&
- !( pitch % 32 == 0 && pitch < 4096 &&
- ( ( type == GL_UNSIGNED_BYTE &&
- cpp == 4 && format == GL_BGRA ) ||
- ( type == GL_UNSIGNED_INT_8_8_8_8 &&
- cpp == 4 && format == GL_BGRA ) ||
- ( type == GL_UNSIGNED_SHORT_5_6_5_REV &&
- cpp == 2 && format == GL_RGB ) ) ) )
- return GL_FALSE;
-
- return (!ctx->_ImageTransferState &&
- !packing->SwapBytes &&
- !packing->LsbFirst);
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- return (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
- ) &&
- ctx->Current.RasterPosValid &&
- ctx->Pixel.ZoomX == 1.0F &&
- (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F));
-}
-
-static GLboolean
-check_depth_per_fragment_ops( const GLcontext *ctx )
-{
- return ( ctx->Current.RasterPosValid &&
- ctx->Color.ColorMask[RCOMP] == 0 &&
- ctx->Color.ColorMask[BCOMP] == 0 &&
- ctx->Color.ColorMask[GCOMP] == 0 &&
- ctx->Color.ColorMask[ACOMP] == 0 &&
- ctx->Pixel.ZoomX == 1.0F &&
- ( ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F ) );
-}
-
-/* In addition to the requirements for depth:
- */
-#if defined(MESA_packed_depth_stencil)
-static GLboolean
-check_stencil_per_fragment_ops( const GLcontext *ctx )
-{
- return ( !ctx->Pixel.IndexShift &&
- !ctx->Pixel.IndexOffset );
-}
-#endif
-
-
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *skipPixels, GLint *skipRows,
- GLint *size )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- *width = MIN2(*width, MAX_WIDTH); /* redundant? */
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *skipPixels += (buffer->_Xmin - *x);
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *skipRows += (buffer->_Ymin - *y);
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * mmesa->mgaScreen->frontPitch +
- (*x + *width - 1) * mmesa->mgaScreen->cpp);
-
- return GL_TRUE;
-}
-
-static GLboolean
-mgaTryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLint size, skipPixels, skipRows;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- GLboolean ok;
-
- GLuint planemask;
- GLuint source;
-#if 0
- drmMGABlit blit;
- GLuint dest;
- GLint source_pitch, dest_pitch;
- GLint delta_sx, delta_sy;
- GLint delta_dx, delta_dy;
- GLint blit_height, ydir;
-#endif
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer,
- &x, &y, &width, &height,
- &skipPixels, &skipRows, &size)) {
- return GL_TRUE;
- }
-
- /* Only accelerate reading to agp buffers.
- */
- if ( !IS_AGP_MEM(mmesa, (char *)pixels) ||
- !IS_AGP_MEM(mmesa, (char *)pixels + size) )
- return GL_FALSE;
-
- switch (format) {
-#if defined(MESA_packed_depth_stencil)
- case GL_DEPTH_STENCIL_MESA:
- ok = check_depth_stencil_24_8(ctx, type, pack, pixels, size, pitch);
- planemask = ~0;
- source = mmesa->mgaScreen->depthOffset;
- break;
-#endif
-
- case GL_DEPTH_COMPONENT:
- ok = check_depth(ctx, type, pack, pixels, size, pitch);
-
- /* Can't accelerate at this depth -- planemask does the wrong
- * thing; it doesn't clear the low order bits in the
- * destination, instead it leaves them untouched.
- *
- * Could get the acclerator to solid fill the destination with
- * zeros first... Or get the cpu to do it...
- */
- if (ctx->Visual.depthBits == 24)
- return GL_FALSE;
-
- planemask = ~0;
- source = mmesa->mgaScreen->depthOffset;
- break;
-
- case GL_RGB:
- case GL_BGRA:
- ok = check_color(ctx, type, format, pack, pixels, size, pitch);
- planemask = ~0;
- source = (mmesa->draw_buffer == MGA_FRONT ?
- mmesa->mgaScreen->frontOffset :
- mmesa->mgaScreen->backOffset);
- break;
-
- default:
- return GL_FALSE;
- }
-
- if (!ok) {
- return GL_FALSE;
- }
-
-
- LOCK_HARDWARE( mmesa );
-
-#if 0
- {
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- int nbox, retcode, i;
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
-
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
- nbox = dPriv->numClipRects;
-
- y = dPriv->h - y - height;
- x += mmesa->drawX;
- y += mmesa->drawY;
-
- dest = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels)) |
- DO_dstmap_sys | DO_dstacc_agp);
- source_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp;
- dest_pitch = pitch;
- delta_sx = 0;
- delta_sy = 0;
- delta_dx = -x;
- delta_dy = -y;
- blit_height = 2*y + height;
- ydir = -1;
-
- if (0) fprintf(stderr, "XX doing readpixel blit src_pitch %d dst_pitch %d\n",
- source_pitch, dest_pitch);
-
-
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- XF86DRIClipRectRec *box = dPriv->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int n = 0;
-
- for ( ; i < nr ; i++) {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- b->x1 = bx;
- b->y1 = by;
- b->x2 = bx + bw;
- b->y2 = by + bh;
- b++;
- n++;
- }
-
- mmesa->sarea->nbox = n;
-
- if (n && (retcode = drmCommandWrite( mmesa->driFd, DRM_MGA_BLIT,
- &blit, sizeof(drmMGABlit)))) {
- fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode);
- UNLOCK_HARDWARE( mmesa );
- exit(1);
- }
- }
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
-#endif
-
- UNLOCK_HARDWARE( mmesa );
-
- return GL_TRUE;
-}
-
-static void
-mgaDDReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (!mgaTryReadPixels( ctx, x, y, width, height, format, type, pack, pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint dest, GLuint planemask)
-{
-#if 0
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- drmMGABlit blit;
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- XF86DRIClipRectPtr pbox = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int retcode, i;
-
- y = dPriv->h - y - height;
- x += mmesa->drawX;
- y += mmesa->drawY;
-
- blit.dest = dest;
- blit.planemask = planemask;
- blit.source = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels))
- | SO_srcmap_sys | SO_srcacc_agp);
- blit.dest_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp;
- blit.source_pitch = pitch;
- blit.delta_sx = -x;
- blit.delta_sy = -y;
- blit.delta_dx = 0;
- blit.delta_dy = 0;
- if (ctx->Pixel.ZoomY == -1) {
- blit.height = height;
- blit.ydir = 1;
- } else {
- blit.height = height;
- blit.ydir = -1;
- }
-
- if (0) fprintf(stderr,
- "doing drawpixel blit src_pitch %d dst_pitch %d\n",
- blit.source_pitch, blit.dest_pitch);
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- XF86DRIClipRectRec *box = mmesa->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int n = 0;
-
- for ( ; i < nr ; i++) {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- b->x1 = bx;
- b->y1 = by;
- b->x2 = bx + bw;
- b->y2 = by + bh;
- b++;
- n++;
- }
-
- mmesa->sarea->nbox = n;
-
- if (n && (retcode = drmCommandWrite( mmesa->driFd, DRM_MGA_BLIT,
- &blit, sizeof(drmMGABlit)))) {
- fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode);
- UNLOCK_HARDWARE( mmesa );
- exit(1);
- }
- }
-#endif
-}
-
-
-
-
-static GLboolean
-mgaTryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLint size, skipPixels, skipRows;
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint dest, planemask;
- GLuint cpp = mmesa->mgaScreen->cpp;
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &skipPixels, &skipRows, &size)) {
- return GL_TRUE;
- }
-
-
- switch (format) {
-#if defined(MESA_packed_depth_stencil)
- case GL_DEPTH_STENCIL_MESA:
- dest = mmesa->mgaScreen->depthOffset;
- planemask = ~0;
- if (!check_depth_stencil_24_8(ctx, type, unpack, pixels, size, pitch) ||
- !check_depth_per_fragment_ops(ctx) ||
- !check_stencil_per_fragment_ops(ctx))
- return GL_FALSE;
- break;
-#endif
-
- case GL_DEPTH_COMPONENT:
- dest = mmesa->mgaScreen->depthOffset;
-
- if (ctx->Visual.depthBits == 24)
- planemask = ~0xff;
- else
- planemask = ~0;
-
- if (!check_depth(ctx, type, unpack, pixels, size, pitch) ||
- !check_depth_per_fragment_ops(ctx))
- return GL_FALSE;
- break;
-
- case GL_RGB:
- case GL_BGRA:
- dest = (mmesa->draw_buffer == MGA_FRONT ?
- mmesa->mgaScreen->frontOffset :
- mmesa->mgaScreen->backOffset);
-
- planemask = mgaPackColor(cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (cpp == 2)
- planemask |= planemask << 16;
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
- break;
-
- default:
- return GL_FALSE;
- }
-
- LOCK_HARDWARE_QUIESCENT( mmesa );
-
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
- if ( IS_AGP_MEM(mmesa, (char *)pixels) &&
- IS_AGP_MEM(mmesa, (char *)pixels + size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels,
- dest, planemask );
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
- else
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them.
- */
-/* drmBufPtr buf = mgaGetBufferLocked(mmesa); */
- GLuint bufferpitch = (width*cpp+31)&~31;
-
- char *address = 0; /* mmesa->mgaScreen->agp.map; */
-
- do {
-/* GLuint rows = MIN2( height, MGA_DMA_BUF_SZ / bufferpitch ); */
- GLuint rows = height;
-
-
- if (0) fprintf(stderr, "trying to upload %d rows (pitch %d)\n",
- rows, bufferpitch);
-
- /* The texture conversion code is so slow that there is only
- * negligble speedup when the buffers/images don't exactly
- * match:
- */
-#if 0
- if (cpp == 2) {
- if (!_mesa_convert_texsubimage2d( MESA_FORMAT_RGB565,
- 0, 0, width, rows,
- bufferpitch, format, type,
- unpack, pixels, address )) {
-/* mgaReleaseBufLocked( mmesa, buf ); */
- UNLOCK_HARDWARE(mmesa);
- return GL_FALSE;
- }
- } else {
- if (!_mesa_convert_texsubimage2d( MESA_FORMAT_ARGB8888,
- 0, 0, width, rows,
- bufferpitch, format, type,
- unpack, pixels, address )) {
-/* mgaReleaseBufLocked( mmesa, buf ); */
- UNLOCK_HARDWARE(mmesa);
- return GL_FALSE;
- }
- }
-#else
- MEMCPY( address, pixels, rows*bufferpitch );
-#endif
-
- do_draw_pix( ctx, x, y, width, rows,
- bufferpitch/cpp, address, dest, planemask );
-
- /* Fix me -- use multiple buffers to avoid flush.
- */
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
-
- pixels = (void *)((char *) pixels + rows * pitch);
- height -= rows;
- y += rows;
- } while (height);
-
-/* mgaReleaseBufLocked( mmesa, buf ); */
- }
-
- UNLOCK_HARDWARE( mmesa );
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-
- return GL_TRUE;
-}
-
-static void
-mgaDDDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (!mgaTryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-
-/* Stub functions - not a real allocator, always returns pointer to
- * the same block of agp space which isn't used for anything else at
- * present.
- */
-void mgaDDInitPixelFuncs( GLcontext *ctx )
-{
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- if (getenv("MGA_BLIT_PIXELS")) {
- ctx->Driver.ReadPixels = mgaDDReadPixels; /* requires agp dest */
- ctx->Driver.DrawPixels = mgaDDDrawPixels; /* works with agp/normal mem */
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h b/xc/lib/GL/mesa/src/drv/mga/mgapixel.h
deleted file mode 100644
index c44fd769a..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2001 Compaq Computer Inc. VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.5 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGA_PIXELS_H
-#define MGA_PIXELS_H
-
-#include "mtypes.h"
-
-extern void mgaDDInitPixelFuncs( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaregs.h b/xc/lib/GL/mesa/src/drv/mga/mgaregs.h
deleted file mode 100644
index e1291ca01..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgaregs.h
+++ /dev/null
@@ -1,1395 +0,0 @@
-/* author: stephen crowley, crow@debian.org */
-
-/*
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * STEPHEN CROWLEY, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaregs.h,v 1.6 2003/01/12 03:55:46 tsi Exp $ */
-
-#ifndef _MGAREGS_H_
-#define _MGAREGS_H_
-
-/*************** (START) AUTOMATICLY GENERATED REGISTER FILE *****************/
-/*
- * Generated on Wed Jan 26 13:44:46 MST 2000
- */
-
-
-
-/*
- * Power Graphic Mode Memory Space Registers
- */
-
-#define MGAREG_MGA_EXEC 0x0100
-#define MGAREG_AGP_PLL 0x1e4c
-
-# define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */
-# define AGP_PLL_agp2xpllen_disable 0x0
-# define AGP_PLL_agp2xpllen_enable 0x1
-
-#define MGAREG_CFG_OR 0x1e4c
-
-# define CFG_OR_comp_or_MASK 0xfffffff7 /* bit 3 */
-# define CFG_OR_comp_or_disable 0x0
-# define CFG_OR_comp_or_enable 0x8
-# define CFG_OR_compfreq_MASK 0xffffff0f /* bits 4-7 */
-# define CFG_OR_compfreq_SHIFT 4
-# define CFG_OR_comporup_MASK 0xfffff0ff /* bits 8-11 */
-# define CFG_OR_comporup_SHIFT 8
-# define CFG_OR_compordn_MASK 0xffff0fff /* bits 12-15 */
-# define CFG_OR_compordn_SHIFT 12
-# define CFG_OR_e2pq_MASK 0xfffeffff /* bit 16 */
-# define CFG_OR_e2pq_disable 0x0
-# define CFG_OR_e2pq_enable 0x10000
-# define CFG_OR_e2pqbypcsn_MASK 0xfffdffff /* bit 17 */
-# define CFG_OR_e2pqbypcsn_disable 0x0
-# define CFG_OR_e2pqbypcsn_enable 0x20000
-# define CFG_OR_e2pqbypd_MASK 0xfffbffff /* bit 18 */
-# define CFG_OR_e2pqbypd_disable 0x0
-# define CFG_OR_e2pqbypd_enable 0x40000
-# define CFG_OR_e2pbypclk_MASK 0xfff7ffff /* bit 19 */
-# define CFG_OR_e2pbypclk_disable 0x0
-# define CFG_OR_e2pbypclk_enable 0x80000
-# define CFG_OR_e2pbyp_MASK 0xffefffff /* bit 20 */
-# define CFG_OR_e2pbyp_disable 0x0
-# define CFG_OR_e2pbyp_enable 0x100000
-# define CFG_OR_rate_cap_or_MASK 0xff1fffff /* bits 21-23 */
-# define CFG_OR_rate_cap_or_SHIFT 21
-# define CFG_OR_rq_or_MASK 0xe0ffffff /* bits 24-28 */
-# define CFG_OR_rq_or_SHIFT 24
-
-#define MGAREG_ALPHACTRL 0x2c7c
-
-# define AC_src_MASK 0xfffffff0 /* bits 0-3 */
-# define AC_src_zero 0x0 /* val 0, shift 0 */
-# define AC_src_one 0x1 /* val 1, shift 0 */
-# define AC_src_dst_color 0x2 /* val 2, shift 0 */
-# define AC_src_om_dst_color 0x3 /* val 3, shift 0 */
-# define AC_src_src_alpha 0x4 /* val 4, shift 0 */
-# define AC_src_om_src_alpha 0x5 /* val 5, shift 0 */
-# define AC_src_dst_alpha 0x6 /* val 6, shift 0 */
-# define AC_src_om_dst_alpha 0x7 /* val 7, shift 0 */
-# define AC_src_src_alpha_sat 0x8 /* val 8, shift 0 */
-# define AC_dst_MASK 0xffffff0f /* bits 4-7 */
-# define AC_dst_zero 0x0 /* val 0, shift 4 */
-# define AC_dst_one 0x10 /* val 1, shift 4 */
-# define AC_dst_src_color 0x20 /* val 2, shift 4 */
-# define AC_dst_om_src_color 0x30 /* val 3, shift 4 */
-# define AC_dst_src_alpha 0x40 /* val 4, shift 4 */
-# define AC_dst_om_src_alpha 0x50 /* val 5, shift 4 */
-# define AC_dst_dst_alpha 0x60 /* val 6, shift 4 */
-# define AC_dst_om_dst_alpha 0x70 /* val 7, shift 4 */
-# define AC_amode_MASK 0xfffffcff /* bits 8-9 */
-# define AC_amode_FCOL 0x0 /* val 0, shift 8 */
-# define AC_amode_alpha_channel 0x100 /* val 1, shift 8 */
-# define AC_amode_video_alpha 0x200 /* val 2, shift 8 */
-# define AC_amode_RSVD 0x300 /* val 3, shift 8 */
-# define AC_astipple_MASK 0xfffff7ff /* bit 11 */
-# define AC_astipple_disable 0x0
-# define AC_astipple_enable 0x800
-# define AC_aten_MASK 0xffffefff /* bit 12 */
-# define AC_aten_disable 0x0
-# define AC_aten_enable 0x1000
-# define AC_atmode_MASK 0xffff1fff /* bits 13-15 */
-# define AC_atmode_noacmp 0x0 /* val 0, shift 13 */
-# define AC_atmode_ae 0x4000 /* val 2, shift 13 */
-# define AC_atmode_ane 0x6000 /* val 3, shift 13 */
-# define AC_atmode_alt 0x8000 /* val 4, shift 13 */
-# define AC_atmode_alte 0xa000 /* val 5, shift 13 */
-# define AC_atmode_agt 0xc000 /* val 6, shift 13 */
-# define AC_atmode_agte 0xe000 /* val 7, shift 13 */
-# define AC_atref_MASK 0xff00ffff /* bits 16-23 */
-# define AC_atref_SHIFT 16
-# define AC_alphasel_MASK 0xfcffffff /* bits 24-25 */
-# define AC_alphasel_fromtex 0x0 /* val 0, shift 24 */
-# define AC_alphasel_diffused 0x1000000 /* val 1, shift 24 */
-# define AC_alphasel_modulated 0x2000000 /* val 2, shift 24 */
-# define AC_alphasel_trans 0x3000000 /* val 3, shift 24 */
-
-#define MGAREG_ALPHASTART 0x2c70
-#define MGAREG_ALPHAXINC 0x2c74
-#define MGAREG_ALPHAYINC 0x2c78
-#define MGAREG_AR0 0x1c60
-
-# define AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */
-# define AR0_ar0_SHIFT 0
-
-#define MGAREG_AR1 0x1c64
-
-# define AR1_ar1_MASK 0xff000000 /* bits 0-23 */
-# define AR1_ar1_SHIFT 0
-
-#define MGAREG_AR2 0x1c68
-
-# define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */
-# define AR2_ar2_SHIFT 0
-
-#define MGAREG_AR3 0x1c6c
-
-# define AR3_ar3_MASK 0xff000000 /* bits 0-23 */
-# define AR3_ar3_SHIFT 0
-# define AR3_spage_MASK 0xf8ffffff /* bits 24-26 */
-# define AR3_spage_SHIFT 24
-
-#define MGAREG_AR4 0x1c70
-
-# define AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */
-# define AR4_ar4_SHIFT 0
-
-#define MGAREG_AR5 0x1c74
-
-# define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */
-# define AR5_ar5_SHIFT 0
-
-#define MGAREG_AR6 0x1c78
-
-# define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */
-# define AR6_ar6_SHIFT 0
-
-#define MGAREG_BCOL 0x1c20
-#define MGAREG_BESA1CORG 0x3d10
-#define MGAREG_BESA1ORG 0x3d00
-#define MGAREG_BESA2CORG 0x3d14
-#define MGAREG_BESA2ORG 0x3d04
-#define MGAREG_BESB1CORG 0x3d18
-#define MGAREG_BESB1ORG 0x3d08
-#define MGAREG_BESB2CORG 0x3d1c
-#define MGAREG_BESB2ORG 0x3d0c
-#define MGAREG_BESCTL 0x3d20
-
-# define BC_besen_MASK 0xfffffffe /* bit 0 */
-# define BC_besen_disable 0x0
-# define BC_besen_enable 0x1
-# define BC_besv1srcstp_MASK 0xffffffbf /* bit 6 */
-# define BC_besv1srcstp_even 0x0
-# define BC_besv1srcstp_odd 0x40
-# define BC_besv2srcstp_MASK 0xfffffeff /* bit 8 */
-# define BC_besv2srcstp_disable 0x0
-# define BC_besv2srcstp_enable 0x100
-# define BC_beshfen_MASK 0xfffffbff /* bit 10 */
-# define BC_beshfen_disable 0x0
-# define BC_beshfen_enable 0x400
-# define BC_besvfen_MASK 0xfffff7ff /* bit 11 */
-# define BC_besvfen_disable 0x0
-# define BC_besvfen_enable 0x800
-# define BC_beshfixc_MASK 0xffffefff /* bit 12 */
-# define BC_beshfixc_weight 0x0
-# define BC_beshfixc_coeff 0x1000
-# define BC_bescups_MASK 0xfffeffff /* bit 16 */
-# define BC_bescups_disable 0x0
-# define BC_bescups_enable 0x10000
-# define BC_bes420pl_MASK 0xfffdffff /* bit 17 */
-# define BC_bes420pl_422 0x0
-# define BC_bes420pl_420 0x20000
-# define BC_besdith_MASK 0xfffbffff /* bit 18 */
-# define BC_besdith_disable 0x0
-# define BC_besdith_enable 0x40000
-# define BC_beshmir_MASK 0xfff7ffff /* bit 19 */
-# define BC_beshmir_disable 0x0
-# define BC_beshmir_enable 0x80000
-# define BC_besbwen_MASK 0xffefffff /* bit 20 */
-# define BC_besbwen_color 0x0
-# define BC_besbwen_bw 0x100000
-# define BC_besblank_MASK 0xffdfffff /* bit 21 */
-# define BC_besblank_disable 0x0
-# define BC_besblank_enable 0x200000
-# define BC_besfselm_MASK 0xfeffffff /* bit 24 */
-# define BC_besfselm_soft 0x0
-# define BC_besfselm_hard 0x1000000
-# define BC_besfsel_MASK 0xf9ffffff /* bits 25-26 */
-# define BC_besfsel_a1 0x0 /* val 0, shift 25 */
-# define BC_besfsel_a2 0x2000000 /* val 1, shift 25 */
-# define BC_besfsel_b1 0x4000000 /* val 2, shift 25 */
-# define BC_besfsel_b2 0x6000000 /* val 3, shift 25 */
-
-#define MGAREG_BESGLOBCTL 0x3dc0
-
-# define BGC_beshzoom_MASK 0xfffffffe /* bit 0 */
-# define BGC_beshzoom_disable 0x0
-# define BGC_beshzoom_enable 0x1
-# define BGC_beshzoomf_MASK 0xfffffffd /* bit 1 */
-# define BGC_beshzoomf_disable 0x0
-# define BGC_beshzoomf_enable 0x2
-# define BGC_bescorder_MASK 0xfffffff7 /* bit 3 */
-# define BGC_bescorder_even 0x0
-# define BGC_bescorder_odd 0x8
-# define BGC_besreghup_MASK 0xffffffef /* bit 4 */
-# define BGC_besreghup_disable 0x0
-# define BGC_besreghup_enable 0x10
-# define BGC_besvcnt_MASK 0xf000ffff /* bits 16-27 */
-# define BGC_besvcnt_SHIFT 16
-
-#define MGAREG_BESHCOORD 0x3d28
-
-# define BHC_besright_MASK 0xfffff800 /* bits 0-10 */
-# define BHC_besright_SHIFT 0
-# define BHC_besleft_MASK 0xf800ffff /* bits 16-26 */
-# define BHC_besleft_SHIFT 16
-
-#define MGAREG_BESHISCAL 0x3d30
-
-# define BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */
-# define BHISF_beshiscal_SHIFT 2
-
-#define MGAREG_BESHSRCEND 0x3d3c
-
-# define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */
-# define BHSE_beshsrcend_SHIFT 2
-
-#define MGAREG_BESHSRCLST 0x3d50
-
-# define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */
-# define BHSL_beshsrclst_SHIFT 16
-
-#define MGAREG_BESHSRCST 0x3d38
-
-# define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */
-# define BHSS_beshsrcst_SHIFT 2
-
-#define MGAREG_BESPITCH 0x3d24
-
-# define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */
-# define BP_bespitch_SHIFT 0
-
-#define MGAREG_BESSTATUS 0x3dc4
-
-# define BS_besstat_MASK 0xfffffffc /* bits 0-1 */
-# define BS_besstat_a1 0x0 /* val 0, shift 0 */
-# define BS_besstat_a2 0x1 /* val 1, shift 0 */
-# define BS_besstat_b1 0x2 /* val 2, shift 0 */
-# define BS_besstat_b2 0x3 /* val 3, shift 0 */
-
-#define MGAREG_BESV1SRCLST 0x3d54
-
-# define BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */
-# define BSF_besv1srclast_SHIFT 0
-
-#define MGAREG_BESV2SRCLST 0x3d58
-
-# define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */
-# define BSF_besv2srclst_SHIFT 0
-
-#define MGAREG_BESV1WGHT 0x3d48
-
-# define BSF_besv1wght_MASK 0xffff0003 /* bits 2-15 */
-# define BSF_besv1wght_SHIFT 2
-# define BSF_besv1wghts_MASK 0xfffeffff /* bit 16 */
-# define BSF_besv1wghts_disable 0x0
-# define BSF_besv1wghts_enable 0x10000
-
-#define MGAREG_BESV2WGHT 0x3d4c
-
-# define BSF_besv2wght_MASK 0xffff0003 /* bits 2-15 */
-# define BSF_besv2wght_SHIFT 2
-# define BSF_besv2wghts_MASK 0xfffeffff /* bit 16 */
-# define BSF_besv2wghts_disable 0x0
-# define BSF_besv2wghts_enable 0x10000
-
-#define MGAREG_BESVCOORD 0x3d2c
-
-# define BVC_besbot_MASK 0xfffff800 /* bits 0-10 */
-# define BVC_besbot_SHIFT 0
-# define BVC_bestop_MASK 0xf800ffff /* bits 16-26 */
-# define BVC_bestop_SHIFT 16
-
-#define MGAREG_BESVISCAL 0x3d34
-
-# define BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */
-# define BVISF_besviscal_SHIFT 2
-
-#define MGAREG_CODECADDR 0x3e44
-#define MGAREG_CODECCTL 0x3e40
-#define MGAREG_CODECHARDPTR 0x3e4c
-#define MGAREG_CODECHOSTPTR 0x3e48
-#define MGAREG_CODECLCODE 0x3e50
-#define MGAREG_CXBNDRY 0x1c80
-
-# define CXB_cxleft_MASK 0xfffff000 /* bits 0-11 */
-# define CXB_cxleft_SHIFT 0
-# define CXB_cxright_MASK 0xf000ffff /* bits 16-27 */
-# define CXB_cxright_SHIFT 16
-
-#define MGAREG_CXLEFT 0x1ca0
-#define MGAREG_CXRIGHT 0x1ca4
-#define MGAREG_DMAMAP30 0x1e30
-#define MGAREG_DMAMAP74 0x1e34
-#define MGAREG_DMAMAPB8 0x1e38
-#define MGAREG_DMAMAPFC 0x1e3c
-#define MGAREG_DMAPAD 0x1c54
-#define MGAREG_DR0_Z32LSB 0x2c50
-#define MGAREG_DR0_Z32MSB 0x2c54
-#define MGAREG_DR2_Z32LSB 0x2c60
-#define MGAREG_DR2_Z32MSB 0x2c64
-#define MGAREG_DR3_Z32LSB 0x2c68
-#define MGAREG_DR3_Z32MSB 0x2c6c
-#define MGAREG_DR0 0x1cc0
-#define MGAREG_DR2 0x1cc8
-#define MGAREG_DR3 0x1ccc
-#define MGAREG_DR4 0x1cd0
-#define MGAREG_DR6 0x1cd8
-#define MGAREG_DR7 0x1cdc
-#define MGAREG_DR8 0x1ce0
-#define MGAREG_DR10 0x1ce8
-#define MGAREG_DR11 0x1cec
-#define MGAREG_DR12 0x1cf0
-#define MGAREG_DR14 0x1cf8
-#define MGAREG_DR15 0x1cfc
-#define MGAREG_DSTORG 0x2cb8
-
-# define DO_dstmap_MASK 0xfffffffe /* bit 0 */
-# define DO_dstmap_fb 0x0
-# define DO_dstmap_sys 0x1
-# define DO_dstacc_MASK 0xfffffffd /* bit 1 */
-# define DO_dstacc_pci 0x0
-# define DO_dstacc_agp 0x2
-# define DO_dstorg_MASK 0x7 /* bits 3-31 */
-# define DO_dstorg_SHIFT 3
-
-#define MGAREG_DWG_INDIR_WT 0x1e80
-#define MGAREG_DWGCTL 0x1c00
-
-# define DC_opcod_MASK 0xfffffff0 /* bits 0-3 */
-# define DC_opcod_line_open 0x0 /* val 0, shift 0 */
-# define DC_opcod_autoline_open 0x1 /* val 1, shift 0 */
-# define DC_opcod_line_close 0x2 /* val 2, shift 0 */
-# define DC_opcod_autoline_close 0x3 /* val 3, shift 0 */
-# define DC_opcod_trap 0x4 /* val 4, shift 0 */
-# define DC_opcod_texture_trap 0x6 /* val 6, shift 0 */
-# define DC_opcod_bitblt 0x8 /* val 8, shift 0 */
-# define DC_opcod_iload 0x9 /* val 9, shift 0 */
-# define DC_atype_MASK 0xffffff8f /* bits 4-6 */
-# define DC_atype_rpl 0x0 /* val 0, shift 4 */
-# define DC_atype_rstr 0x10 /* val 1, shift 4 */
-# define DC_atype_zi 0x30 /* val 3, shift 4 */
-# define DC_atype_blk 0x40 /* val 4, shift 4 */
-# define DC_atype_i 0x70 /* val 7, shift 4 */
-# define DC_linear_MASK 0xffffff7f /* bit 7 */
-# define DC_linear_xy 0x0
-# define DC_linear_linear 0x80
-# define DC_zmode_MASK 0xfffff8ff /* bits 8-10 */
-# define DC_zmode_nozcmp 0x0 /* val 0, shift 8 */
-# define DC_zmode_ze 0x200 /* val 2, shift 8 */
-# define DC_zmode_zne 0x300 /* val 3, shift 8 */
-# define DC_zmode_zlt 0x400 /* val 4, shift 8 */
-# define DC_zmode_zlte 0x500 /* val 5, shift 8 */
-# define DC_zmode_zgt 0x600 /* val 6, shift 8 */
-# define DC_zmode_zgte 0x700 /* val 7, shift 8 */
-# define DC_solid_MASK 0xfffff7ff /* bit 11 */
-# define DC_solid_disable 0x0
-# define DC_solid_enable 0x800
-# define DC_arzero_MASK 0xffffefff /* bit 12 */
-# define DC_arzero_disable 0x0
-# define DC_arzero_enable 0x1000
-# define DC_sgnzero_MASK 0xffffdfff /* bit 13 */
-# define DC_sgnzero_disable 0x0
-# define DC_sgnzero_enable 0x2000
-# define DC_shftzero_MASK 0xffffbfff /* bit 14 */
-# define DC_shftzero_disable 0x0
-# define DC_shftzero_enable 0x4000
-# define DC_bop_MASK 0xfff0ffff /* bits 16-19 */
-# define DC_bop_SHIFT 16
-# define DC_trans_MASK 0xff0fffff /* bits 20-23 */
-# define DC_trans_SHIFT 20
-# define DC_bltmod_MASK 0xe1ffffff /* bits 25-28 */
-# define DC_bltmod_bmonolef 0x0 /* val 0, shift 25 */
-# define DC_bltmod_bmonowf 0x8000000 /* val 4, shift 25 */
-# define DC_bltmod_bplan 0x2000000 /* val 1, shift 25 */
-# define DC_bltmod_bfcol 0x4000000 /* val 2, shift 25 */
-# define DC_bltmod_bu32bgr 0x6000000 /* val 3, shift 25 */
-# define DC_bltmod_bu32rgb 0xe000000 /* val 7, shift 25 */
-# define DC_bltmod_bu24bgr 0x16000000 /* val 11, shift 25 */
-# define DC_bltmod_bu24rgb 0x1e000000 /* val 15, shift 25 */
-# define DC_pattern_MASK 0xdfffffff /* bit 29 */
-# define DC_pattern_disable 0x0
-# define DC_pattern_enable 0x20000000
-# define DC_transc_MASK 0xbfffffff /* bit 30 */
-# define DC_transc_disable 0x0
-# define DC_transc_enable 0x40000000
-# define DC_clipdis_MASK 0x7fffffff /* bit 31 */
-# define DC_clipdis_disable 0x0
-# define DC_clipdis_enable 0x80000000
-
-#define MGAREG_DWGSYNC 0x2c4c
-
-# define DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */
-# define DS_dwgsyncaddr_SHIFT 2
-
-#define MGAREG_FCOL 0x1c24
-#define MGAREG_FIFOSTATUS 0x1e10
-
-# define FS_fifocount_MASK 0xffffff80 /* bits 0-6 */
-# define FS_fifocount_SHIFT 0
-# define FS_bfull_MASK 0xfffffeff /* bit 8 */
-# define FS_bfull_disable 0x0
-# define FS_bfull_enable 0x100
-# define FS_bempty_MASK 0xfffffdff /* bit 9 */
-# define FS_bempty_disable 0x0
-# define FS_bempty_enable 0x200
-
-#define MGAREG_FOGCOL 0x1cf4
-#define MGAREG_FOGSTART 0x1cc4
-#define MGAREG_FOGXINC 0x1cd4
-#define MGAREG_FOGYINC 0x1ce4
-#define MGAREG_FXBNDRY 0x1c84
-
-# define XA_fxleft_MASK 0xffff0000 /* bits 0-15 */
-# define XA_fxleft_SHIFT 0
-# define XA_fxright_MASK 0xffff /* bits 16-31 */
-# define XA_fxright_SHIFT 16
-
-#define MGAREG_FXLEFT 0x1ca8
-#define MGAREG_FXRIGHT 0x1cac
-#define MGAREG_ICLEAR 0x1e18
-
-# define IC_softrapiclr_MASK 0xfffffffe /* bit 0 */
-# define IC_softrapiclr_disable 0x0
-# define IC_softrapiclr_enable 0x1
-# define IC_pickiclr_MASK 0xfffffffb /* bit 2 */
-# define IC_pickiclr_disable 0x0
-# define IC_pickiclr_enable 0x4
-# define IC_vlineiclr_MASK 0xffffffdf /* bit 5 */
-# define IC_vlineiclr_disable 0x0
-# define IC_vlineiclr_enable 0x20
-# define IC_wiclr_MASK 0xffffff7f /* bit 7 */
-# define IC_wiclr_disable 0x0
-# define IC_wiclr_enable 0x80
-# define IC_wciclr_MASK 0xfffffeff /* bit 8 */
-# define IC_wciclr_disable 0x0
-# define IC_wciclr_enable 0x100
-
-#define MGAREG_IEN 0x1e1c
-
-# define IE_softrapien_MASK 0xfffffffe /* bit 0 */
-# define IE_softrapien_disable 0x0
-# define IE_softrapien_enable 0x1
-# define IE_pickien_MASK 0xfffffffb /* bit 2 */
-# define IE_pickien_disable 0x0
-# define IE_pickien_enable 0x4
-# define IE_vlineien_MASK 0xffffffdf /* bit 5 */
-# define IE_vlineien_disable 0x0
-# define IE_vlineien_enable 0x20
-# define IE_extien_MASK 0xffffffbf /* bit 6 */
-# define IE_extien_disable 0x0
-# define IE_extien_enable 0x40
-# define IE_wien_MASK 0xffffff7f /* bit 7 */
-# define IE_wien_disable 0x0
-# define IE_wien_enable 0x80
-# define IE_wcien_MASK 0xfffffeff /* bit 8 */
-# define IE_wcien_disable 0x0
-# define IE_wcien_enable 0x100
-
-#define MGAREG_LEN 0x1c5c
-#define MGAREG_MACCESS 0x1c04
-
-# define MA_pwidth_MASK 0xfffffffc /* bits 0-1 */
-# define MA_pwidth_8 0x0 /* val 0, shift 0 */
-# define MA_pwidth_16 0x1 /* val 1, shift 0 */
-# define MA_pwidth_32 0x2 /* val 2, shift 0 */
-# define MA_pwidth_24 0x3 /* val 3, shift 0 */
-# define MA_zwidth_MASK 0xffffffe7 /* bits 3-4 */
-# define MA_zwidth_16 0x0 /* val 0, shift 3 */
-# define MA_zwidth_32 0x8 /* val 1, shift 3 */
-# define MA_zwidth_15 0x10 /* val 2, shift 3 */
-# define MA_zwidth_24 0x18 /* val 3, shift 3 */
-# define MA_memreset_MASK 0xffff7fff /* bit 15 */
-# define MA_memreset_disable 0x0
-# define MA_memreset_enable 0x8000
-# define MA_fogen_MASK 0xfbffffff /* bit 26 */
-# define MA_fogen_disable 0x0
-# define MA_fogen_enable 0x4000000
-# define MA_tlutload_MASK 0xdfffffff /* bit 29 */
-# define MA_tlutload_disable 0x0
-# define MA_tlutload_enable 0x20000000
-# define MA_nodither_MASK 0xbfffffff /* bit 30 */
-# define MA_nodither_disable 0x0
-# define MA_nodither_enable 0x40000000
-# define MA_dit555_MASK 0x7fffffff /* bit 31 */
-# define MA_dit555_disable 0x0
-# define MA_dit555_enable 0x80000000
-
-#define MGAREG_MCTLWTST 0x1c08
-
-# define MCWS_casltncy_MASK 0xfffffff8 /* bits 0-2 */
-# define MCWS_casltncy_SHIFT 0
-# define MCWS_rrddelay_MASK 0xffffffcf /* bits 4-5 */
-# define MCWS_rcddelay_MASK 0xfffffe7f /* bits 7-8 */
-# define MCWS_rasmin_MASK 0xffffe3ff /* bits 10-12 */
-# define MCWS_rasmin_SHIFT 10
-# define MCWS_rpdelay_MASK 0xffff3fff /* bits 14-15 */
-# define MCWS_wrdelay_MASK 0xfff3ffff /* bits 18-19 */
-# define MCWS_rddelay_MASK 0xffdfffff /* bit 21 */
-# define MCWS_rddelay_disable 0x0
-# define MCWS_rddelay_enable 0x200000
-# define MCWS_smrdelay_MASK 0xfe7fffff /* bits 23-24 */
-# define MCWS_bwcdelay_MASK 0xf3ffffff /* bits 26-27 */
-# define MCWS_bpldelay_MASK 0x1fffffff /* bits 29-31 */
-# define MCWS_bpldelay_SHIFT 29
-
-#define MGAREG_MEMRDBK 0x1e44
-
-# define MRB_mclkbrd0_MASK 0xfffffff0 /* bits 0-3 */
-# define MRB_mclkbrd0_SHIFT 0
-# define MRB_mclkbrd1_MASK 0xfffffe1f /* bits 5-8 */
-# define MRB_mclkbrd1_SHIFT 5
-# define MRB_strmfctl_MASK 0xff3fffff /* bits 22-23 */
-# define MRB_mrsopcod_MASK 0xe1ffffff /* bits 25-28 */
-# define MRB_mrsopcod_SHIFT 25
-
-#define MGAREG_OPMODE 0x1e54
-
-# define OM_dmamod_MASK 0xfffffff3 /* bits 2-3 */
-# define OM_dmamod_general 0x0 /* val 0, shift 2 */
-# define OM_dmamod_blit 0x4 /* val 1, shift 2 */
-# define OM_dmamod_vector 0x8 /* val 2, shift 2 */
-# define OM_dmamod_vertex 0xc /* val 3, shift 2 */
-# define OM_dmadatasiz_MASK 0xfffffcff /* bits 8-9 */
-# define OM_dmadatasiz_8 0x0 /* val 0, shift 8 */
-# define OM_dmadatasiz_16 0x100 /* val 1, shift 8 */
-# define OM_dmadatasiz_32 0x200 /* val 2, shift 8 */
-# define OM_dirdatasiz_MASK 0xfffcffff /* bits 16-17 */
-# define OM_dirdatasiz_8 0x0 /* val 0, shift 16 */
-# define OM_dirdatasiz_16 0x10000 /* val 1, shift 16 */
-# define OM_dirdatasiz_32 0x20000 /* val 2, shift 16 */
-
-#define MGAREG_PAT0 0x1c10
-#define MGAREG_PAT1 0x1c14
-#define MGAREG_PITCH 0x1c8c
-
-# define P_iy_MASK 0xffffe000 /* bits 0-12 */
-# define P_iy_SHIFT 0
-# define P_ylin_MASK 0xffff7fff /* bit 15 */
-# define P_ylin_disable 0x0
-# define P_ylin_enable 0x8000
-
-#define MGAREG_PLNWT 0x1c1c
-#define MGAREG_PRIMADDRESS 0x1e58
-
-# define PDCA_primod_MASK 0xfffffffc /* bits 0-1 */
-# define PDCA_primod_general 0x0 /* val 0, shift 0 */
-# define PDCA_primod_blit 0x1 /* val 1, shift 0 */
-# define PDCA_primod_vector 0x2 /* val 2, shift 0 */
-# define PDCA_primod_vertex 0x3 /* val 3, shift 0 */
-# define PDCA_primaddress_MASK 0x3 /* bits 2-31 */
-# define PDCA_primaddress_SHIFT 2
-
-#define MGAREG_PRIMEND 0x1e5c
-
-# define PDEA_primnostart_MASK 0xfffffffe /* bit 0 */
-# define PDEA_primnostart_disable 0x0
-# define PDEA_primnostart_enable 0x1
-# define PDEA_pagpxfer_MASK 0xfffffffd /* bit 1 */
-# define PDEA_pagpxfer_disable 0x0
-# define PDEA_pagpxfer_enable 0x2
-# define PDEA_primend_MASK 0x3 /* bits 2-31 */
-# define PDEA_primend_SHIFT 2
-
-#define MGAREG_PRIMPTR 0x1e50
-
-# define PLS_primptren0_MASK 0xfffffffe /* bit 0 */
-# define PLS_primptren0_disable 0x0
-# define PLS_primptren0_enable 0x1
-# define PLS_primptren1_MASK 0xfffffffd /* bit 1 */
-# define PLS_primptren1_disable 0x0
-# define PLS_primptren1_enable 0x2
-# define PLS_primptr_MASK 0x7 /* bits 3-31 */
-# define PLS_primptr_SHIFT 3
-
-#define MGAREG_RST 0x1e40
-
-# define R_softreset_MASK 0xfffffffe /* bit 0 */
-# define R_softreset_disable 0x0
-# define R_softreset_enable 0x1
-# define R_softextrst_MASK 0xfffffffd /* bit 1 */
-# define R_softextrst_disable 0x0
-# define R_softextrst_enable 0x2
-
-#define MGAREG_SECADDRESS 0x2c40
-
-# define SDCA_secmod_MASK 0xfffffffc /* bits 0-1 */
-# define SDCA_secmod_general 0x0 /* val 0, shift 0 */
-# define SDCA_secmod_blit 0x1 /* val 1, shift 0 */
-# define SDCA_secmod_vector 0x2 /* val 2, shift 0 */
-# define SDCA_secmod_vertex 0x3 /* val 3, shift 0 */
-# define SDCA_secaddress_MASK 0x3 /* bits 2-31 */
-# define SDCA_secaddress_SHIFT 2
-
-#define MGAREG_SECEND 0x2c44
-
-# define SDEA_sagpxfer_MASK 0xfffffffd /* bit 1 */
-# define SDEA_sagpxfer_disable 0x0
-# define SDEA_sagpxfer_enable 0x2
-# define SDEA_secend_MASK 0x3 /* bits 2-31 */
-# define SDEA_secend_SHIFT 2
-
-#define MGAREG_SETUPADDRESS 0x2cd0
-
-# define SETADD_mode_MASK 0xfffffffc /* bits 0-1 */
-# define SETADD_mode_vertlist 0x0 /* val 0, shift 0 */
-# define SETADD_address_MASK 0x3 /* bits 2-31 */
-# define SETADD_address_SHIFT 2
-
-#define MGAREG_SETUPEND 0x2cd4
-
-# define SETEND_agpxfer_MASK 0xfffffffd /* bit 1 */
-# define SETEND_agpxfer_disable 0x0
-# define SETEND_agpxfer_enable 0x2
-# define SETEND_address_MASK 0x3 /* bits 2-31 */
-# define SETEND_address_SHIFT 2
-
-#define MGAREG_SGN 0x1c58
-
-# define S_sdydxl_MASK 0xfffffffe /* bit 0 */
-# define S_sdydxl_y 0x0
-# define S_sdydxl_x 0x1
-# define S_scanleft_MASK 0xfffffffe /* bit 0 */
-# define S_scanleft_disable 0x0
-# define S_scanleft_enable 0x1
-# define S_sdxl_MASK 0xfffffffd /* bit 1 */
-# define S_sdxl_pos 0x0
-# define S_sdxl_neg 0x2
-# define S_sdy_MASK 0xfffffffb /* bit 2 */
-# define S_sdy_pos 0x0
-# define S_sdy_neg 0x4
-# define S_sdxr_MASK 0xffffffdf /* bit 5 */
-# define S_sdxr_pos 0x0
-# define S_sdxr_neg 0x20
-# define S_brkleft_MASK 0xfffffeff /* bit 8 */
-# define S_brkleft_disable 0x0
-# define S_brkleft_enable 0x100
-# define S_errorinit_MASK 0x7fffffff /* bit 31 */
-# define S_errorinit_disable 0x0
-# define S_errorinit_enable 0x80000000
-
-#define MGAREG_SHIFT 0x1c50
-
-# define FSC_x_off_MASK 0xfffffff0 /* bits 0-3 */
-# define FSC_x_off_SHIFT 0
-# define FSC_funcnt_MASK 0xffffff80 /* bits 0-6 */
-# define FSC_funcnt_SHIFT 0
-# define FSC_y_off_MASK 0xffffff8f /* bits 4-6 */
-# define FSC_y_off_SHIFT 4
-# define FSC_funoff_MASK 0xffc0ffff /* bits 16-21 */
-# define FSC_funoff_SHIFT 16
-# define FSC_stylelen_MASK 0xffc0ffff /* bits 16-21 */
-# define FSC_stylelen_SHIFT 16
-
-#define MGAREG_SOFTRAP 0x2c48
-
-# define STH_softraphand_MASK 0x3 /* bits 2-31 */
-# define STH_softraphand_SHIFT 2
-
-#define MGAREG_SPECBSTART 0x2c98
-#define MGAREG_SPECBXINC 0x2c9c
-#define MGAREG_SPECBYINC 0x2ca0
-#define MGAREG_SPECGSTART 0x2c8c
-#define MGAREG_SPECGXINC 0x2c90
-#define MGAREG_SPECGYINC 0x2c94
-#define MGAREG_SPECRSTART 0x2c80
-#define MGAREG_SPECRXINC 0x2c84
-#define MGAREG_SPECRYINC 0x2c88
-#define MGAREG_SRC0 0x1c30
-#define MGAREG_SRC1 0x1c34
-#define MGAREG_SRC2 0x1c38
-#define MGAREG_SRC3 0x1c3c
-#define MGAREG_SRCORG 0x2cb4
-
-# define SO_srcmap_MASK 0xfffffffe /* bit 0 */
-# define SO_srcmap_fb 0x0
-# define SO_srcmap_sys 0x1
-# define SO_srcacc_MASK 0xfffffffd /* bit 1 */
-# define SO_srcacc_pci 0x0
-# define SO_srcacc_agp 0x2
-# define SO_srcorg_MASK 0x7 /* bits 3-31 */
-# define SO_srcorg_SHIFT 3
-
-#define MGAREG_STATUS 0x1e14
-
-# define STAT_softrapen_MASK 0xfffffffe /* bit 0 */
-# define STAT_softrapen_disable 0x0
-# define STAT_softrapen_enable 0x1
-# define STAT_pickpen_MASK 0xfffffffb /* bit 2 */
-# define STAT_pickpen_disable 0x0
-# define STAT_pickpen_enable 0x4
-# define STAT_vsyncsts_MASK 0xfffffff7 /* bit 3 */
-# define STAT_vsyncsts_disable 0x0
-# define STAT_vsyncsts_enable 0x8
-# define STAT_vsyncpen_MASK 0xffffffef /* bit 4 */
-# define STAT_vsyncpen_disable 0x0
-# define STAT_vsyncpen_enable 0x10
-# define STAT_vlinepen_MASK 0xffffffdf /* bit 5 */
-# define STAT_vlinepen_disable 0x0
-# define STAT_vlinepen_enable 0x20
-# define STAT_extpen_MASK 0xffffffbf /* bit 6 */
-# define STAT_extpen_disable 0x0
-# define STAT_extpen_enable 0x40
-# define STAT_wpen_MASK 0xffffff7f /* bit 7 */
-# define STAT_wpen_disable 0x0
-# define STAT_wpen_enable 0x80
-# define STAT_wcpen_MASK 0xfffffeff /* bit 8 */
-# define STAT_wcpen_disable 0x0
-# define STAT_wcpen_enable 0x100
-# define STAT_dwgengsts_MASK 0xfffeffff /* bit 16 */
-# define STAT_dwgengsts_disable 0x0
-# define STAT_dwgengsts_enable 0x10000
-# define STAT_endprdmasts_MASK 0xfffdffff /* bit 17 */
-# define STAT_endprdmasts_disable 0x0
-# define STAT_endprdmasts_enable 0x20000
-# define STAT_wbusy_MASK 0xfffbffff /* bit 18 */
-# define STAT_wbusy_disable 0x0
-# define STAT_wbusy_enable 0x40000
-# define STAT_swflag_MASK 0xfffffff /* bits 28-31 */
-# define STAT_swflag_SHIFT 28
-
-#define MGAREG_STENCIL 0x2cc8
-
-# define S_sref_MASK 0xffffff00 /* bits 0-7 */
-# define S_sref_SHIFT 0
-# define S_smsk_MASK 0xffff00ff /* bits 8-15 */
-# define S_smsk_SHIFT 8
-# define S_swtmsk_MASK 0xff00ffff /* bits 16-23 */
-# define S_swtmsk_SHIFT 16
-
-#define MGAREG_STENCILCTL 0x2ccc
-
-# define SC_smode_MASK 0xfffffff8 /* bits 0-2 */
-# define SC_smode_salways 0x0 /* val 0, shift 0 */
-# define SC_smode_snever 0x1 /* val 1, shift 0 */
-# define SC_smode_se 0x2 /* val 2, shift 0 */
-# define SC_smode_sne 0x3 /* val 3, shift 0 */
-# define SC_smode_slt 0x4 /* val 4, shift 0 */
-# define SC_smode_slte 0x5 /* val 5, shift 0 */
-# define SC_smode_sgt 0x6 /* val 6, shift 0 */
-# define SC_smode_sgte 0x7 /* val 7, shift 0 */
-# define SC_sfailop_MASK 0xffffffc7 /* bits 3-5 */
-# define SC_sfailop_keep 0x0 /* val 0, shift 3 */
-# define SC_sfailop_zero 0x8 /* val 1, shift 3 */
-# define SC_sfailop_replace 0x10 /* val 2, shift 3 */
-# define SC_sfailop_incrsat 0x18 /* val 3, shift 3 */
-# define SC_sfailop_decrsat 0x20 /* val 4, shift 3 */
-# define SC_sfailop_invert 0x28 /* val 5, shift 3 */
-# define SC_sfailop_incr 0x30 /* val 6, shift 3 */
-# define SC_sfailop_decr 0x38 /* val 7, shift 3 */
-# define SC_szfailop_MASK 0xfffffe3f /* bits 6-8 */
-# define SC_szfailop_keep 0x0 /* val 0, shift 6 */
-# define SC_szfailop_zero 0x40 /* val 1, shift 6 */
-# define SC_szfailop_replace 0x80 /* val 2, shift 6 */
-# define SC_szfailop_incrsat 0xc0 /* val 3, shift 6 */
-# define SC_szfailop_decrsat 0x100 /* val 4, shift 6 */
-# define SC_szfailop_invert 0x140 /* val 5, shift 6 */
-# define SC_szfailop_incr 0x180 /* val 6, shift 6 */
-# define SC_szfailop_decr 0x1c0 /* val 7, shift 6 */
-# define SC_szpassop_MASK 0xfffff1ff /* bits 9-11 */
-# define SC_szpassop_keep 0x0 /* val 0, shift 9 */
-# define SC_szpassop_zero 0x200 /* val 1, shift 9 */
-# define SC_szpassop_replace 0x400 /* val 2, shift 9 */
-# define SC_szpassop_incrsat 0x600 /* val 3, shift 9 */
-# define SC_szpassop_decrsat 0x800 /* val 4, shift 9 */
-# define SC_szpassop_invert 0xa00 /* val 5, shift 9 */
-# define SC_szpassop_incr 0xc00 /* val 6, shift 9 */
-# define SC_szpassop_decr 0xe00 /* val 7, shift 9 */
-
-#define MGAREG_TDUALSTAGE0 0x2cf8
-
-# define TD0_color_arg2_MASK 0xfffffffc /* bits 0-1 */
-# define TD0_color_arg2_diffuse 0x0 /* val 0, shift 0 */
-# define TD0_color_arg2_specular 0x1 /* val 1, shift 0 */
-# define TD0_color_arg2_fcol 0x2 /* val 2, shift 0 */
-# define TD0_color_arg2_prevstage 0x3 /* val 3, shift 0 */
-# define TD0_color_alpha_MASK 0xffffffe3 /* bits 2-4 */
-# define TD0_color_alpha_diffuse 0x0 /* val 0, shift 2 */
-# define TD0_color_alpha_fcol 0x4 /* val 1, shift 2 */
-# define TD0_color_alpha_currtex 0x8 /* val 2, shift 2 */
-# define TD0_color_alpha_prevtex 0xc /* val 3, shift 2 */
-# define TD0_color_alpha_prevstage 0x10 /* val 4, shift 2 */
-# define TD0_color_arg1_replicatealpha_MASK 0xffffffdf /* bit 5 */
-# define TD0_color_arg1_replicatealpha_disable 0x0
-# define TD0_color_arg1_replicatealpha_enable 0x20
-# define TD0_color_arg1_inv_MASK 0xffffffbf /* bit 6 */
-# define TD0_color_arg1_inv_disable 0x0
-# define TD0_color_arg1_inv_enable 0x40
-# define TD0_color_arg2_replicatealpha_MASK 0xffffff7f /* bit 7 */
-# define TD0_color_arg2_replicatealpha_disable 0x0
-# define TD0_color_arg2_replicatealpha_enable 0x80
-# define TD0_color_arg2_inv_MASK 0xfffffeff /* bit 8 */
-# define TD0_color_arg2_inv_disable 0x0
-# define TD0_color_arg2_inv_enable 0x100
-# define TD0_color_alpha1inv_MASK 0xfffffdff /* bit 9 */
-# define TD0_color_alpha1inv_disable 0x0
-# define TD0_color_alpha1inv_enable 0x200
-# define TD0_color_alpha2inv_MASK 0xfffffbff /* bit 10 */
-# define TD0_color_alpha2inv_disable 0x0
-# define TD0_color_alpha2inv_enable 0x400
-# define TD0_color_arg1mul_MASK 0xfffff7ff /* bit 11 */
-# define TD0_color_arg1mul_disable 0x0 /* val 0, shift 11 */
-# define TD0_color_arg1mul_alpha1 0x800 /* val 1, shift 11 */
-# define TD0_color_arg2mul_MASK 0xffffefff /* bit 12 */
-# define TD0_color_arg2mul_disable 0x0 /* val 0, shift 12 */
-# define TD0_color_arg2mul_alpha2 0x1000 /* val 1, shift 12 */
-# define TD0_color_arg1add_MASK 0xffffdfff /* bit 13 */
-# define TD0_color_arg1add_disable 0x0 /* val 0, shift 13 */
-# define TD0_color_arg1add_mulout 0x2000 /* val 1, shift 13 */
-# define TD0_color_arg2add_MASK 0xffffbfff /* bit 14 */
-# define TD0_color_arg2add_disable 0x0 /* val 0, shift 14 */
-# define TD0_color_arg2add_mulout 0x4000 /* val 1, shift 14 */
-# define TD0_color_modbright_MASK 0xfffe7fff /* bits 15-16 */
-# define TD0_color_modbright_disable 0x0 /* val 0, shift 15 */
-# define TD0_color_modbright_2x 0x8000 /* val 1, shift 15 */
-# define TD0_color_modbright_4x 0x10000 /* val 2, shift 15 */
-# define TD0_color_add_MASK 0xfffdffff /* bit 17 */
-# define TD0_color_add_sub 0x0 /* val 0, shift 17 */
-# define TD0_color_add_add 0x20000 /* val 1, shift 17 */
-# define TD0_color_add2x_MASK 0xfffbffff /* bit 18 */
-# define TD0_color_add2x_disable 0x0
-# define TD0_color_add2x_enable 0x40000
-# define TD0_color_addbias_MASK 0xfff7ffff /* bit 19 */
-# define TD0_color_addbias_disable 0x0
-# define TD0_color_addbias_enable 0x80000
-# define TD0_color_blend_MASK 0xffefffff /* bit 20 */
-# define TD0_color_blend_disable 0x0
-# define TD0_color_blend_enable 0x100000
-# define TD0_color_sel_MASK 0xff9fffff /* bits 21-22 */
-# define TD0_color_sel_arg1 0x0 /* val 0, shift 21 */
-# define TD0_color_sel_arg2 0x200000 /* val 1, shift 21 */
-# define TD0_color_sel_add 0x400000 /* val 2, shift 21 */
-# define TD0_color_sel_mul 0x600000 /* val 3, shift 21 */
-# define TD0_alpha_arg1_inv_MASK 0xff7fffff /* bit 23 */
-# define TD0_alpha_arg1_inv_disable 0x0
-# define TD0_alpha_arg1_inv_enable 0x800000
-# define TD0_alpha_arg2_MASK 0xfcffffff /* bits 24-25 */
-# define TD0_alpha_arg2_diffuse 0x0 /* val 0, shift 24 */
-# define TD0_alpha_arg2_fcol 0x1000000 /* val 1, shift 24 */
-# define TD0_alpha_arg2_prevtex 0x2000000 /* val 2, shift 24 */
-# define TD0_alpha_arg2_prevstage 0x3000000 /* val 3, shift 24 */
-# define TD0_alpha_arg2_inv_MASK 0xfbffffff /* bit 26 */
-# define TD0_alpha_arg2_inv_disable 0x0
-# define TD0_alpha_arg2_inv_enable 0x4000000
-# define TD0_alpha_add_MASK 0xf7ffffff /* bit 27 */
-# define TD0_alpha_add_disable 0x0
-# define TD0_alpha_add_enable 0x8000000
-# define TD0_alpha_addbias_MASK 0xefffffff /* bit 28 */
-# define TD0_alpha_addbias_disable 0x0
-# define TD0_alpha_addbias_enable 0x10000000
-# define TD0_alpha_add2x_MASK 0xdfffffff /* bit 29 */
-# define TD0_alpha_add2x_disable 0x0
-# define TD0_alpha_add2x_enable 0x20000000
-# define TD0_alpha_modbright_MASK 0xcfffffff /* bits 28-29 */
-# define TD0_alpha_modbright_disable 0x0 /* val 0, shift 28 */
-# define TD0_alpha_modbright_2x 0x10000000 /* val 1, shift 28 */
-# define TD0_alpha_modbright_4x 0x20000000 /* val 2, shift 28 */
-# define TD0_alpha_sel_MASK 0x3fffffff /* bits 30-31 */
-# define TD0_alpha_sel_arg1 0x0 /* val 0, shift 30 */
-# define TD0_alpha_sel_arg2 0x40000000 /* val 1, shift 30 */
-# define TD0_alpha_sel_add 0x80000000 /* val 2, shift 30 */
-# define TD0_alpha_sel_mul 0xc0000000 /* val 3, shift 30 */
-
-#define MGAREG_TDUALSTAGE1 0x2cfc
-
-# define TD1_color_arg2_MASK 0xfffffffc /* bits 0-1 */
-# define TD1_color_arg2_diffuse 0x0 /* val 0, shift 0 */
-# define TD1_color_arg2_specular 0x1 /* val 1, shift 0 */
-# define TD1_color_arg2_fcol 0x2 /* val 2, shift 0 */
-# define TD1_color_arg2_prevstage 0x3 /* val 3, shift 0 */
-# define TD1_color_alpha_MASK 0xffffffe3 /* bits 2-4 */
-# define TD1_color_alpha_diffuse 0x0 /* val 0, shift 2 */
-# define TD1_color_alpha_fcol 0x4 /* val 1, shift 2 */
-# define TD1_color_alpha_tex0 0x8 /* val 2, shift 2 */
-# define TD1_color_alpha_prevtex 0xc /* val 3, shift 2 */
-# define TD1_color_alpha_prevstage 0x10 /* val 4, shift 2 */
-# define TD1_color_arg1_replicatealpha_MASK 0xffffffdf /* bit 5 */
-# define TD1_color_arg1_replicatealpha_disable 0x0
-# define TD1_color_arg1_replicatealpha_enable 0x20
-# define TD1_color_arg1_inv_MASK 0xffffffbf /* bit 6 */
-# define TD1_color_arg1_inv_disable 0x0
-# define TD1_color_arg1_inv_enable 0x40
-# define TD1_color_arg2_replicatealpha_MASK 0xffffff7f /* bit 7 */
-# define TD1_color_arg2_replicatealpha_disable 0x0
-# define TD1_color_arg2_replicatealpha_enable 0x80
-# define TD1_color_arg2_inv_MASK 0xfffffeff /* bit 8 */
-# define TD1_color_arg2_inv_disable 0x0
-# define TD1_color_arg2_inv_enable 0x100
-# define TD1_color_alpha1inv_MASK 0xfffffdff /* bit 9 */
-# define TD1_color_alpha1inv_disable 0x0
-# define TD1_color_alpha1inv_enable 0x200
-# define TD1_color_alpha2inv_MASK 0xfffffbff /* bit 10 */
-# define TD1_color_alpha2inv_disable 0x0
-# define TD1_color_alpha2inv_enable 0x400
-# define TD1_color_arg1mul_MASK 0xfffff7ff /* bit 11 */
-# define TD1_color_arg1mul_disable 0x0 /* val 0, shift 11 */
-# define TD1_color_arg1mul_alpha1 0x800 /* val 1, shift 11 */
-# define TD1_color_arg2mul_MASK 0xffffefff /* bit 12 */
-# define TD1_color_arg2mul_disable 0x0 /* val 0, shift 12 */
-# define TD1_color_arg2mul_alpha2 0x1000 /* val 1, shift 12 */
-# define TD1_color_arg1add_MASK 0xffffdfff /* bit 13 */
-# define TD1_color_arg1add_disable 0x0 /* val 0, shift 13 */
-# define TD1_color_arg1add_mulout 0x2000 /* val 1, shift 13 */
-# define TD1_color_arg2add_MASK 0xffffbfff /* bit 14 */
-# define TD1_color_arg2add_disable 0x0 /* val 0, shift 14 */
-# define TD1_color_arg2add_mulout 0x4000 /* val 1, shift 14 */
-# define TD1_color_modbright_MASK 0xfffe7fff /* bits 15-16 */
-# define TD1_color_modbright_disable 0x0 /* val 0, shift 15 */
-# define TD1_color_modbright_2x 0x8000 /* val 1, shift 15 */
-# define TD1_color_modbright_4x 0x10000 /* val 2, shift 15 */
-# define TD1_color_add_MASK 0xfffdffff /* bit 17 */
-# define TD1_color_add_sub 0x0 /* val 0, shift 17 */
-# define TD1_color_add_add 0x20000 /* val 1, shift 17 */
-# define TD1_color_add2x_MASK 0xfffbffff /* bit 18 */
-# define TD1_color_add2x_disable 0x0
-# define TD1_color_add2x_enable 0x40000
-# define TD1_color_addbias_MASK 0xfff7ffff /* bit 19 */
-# define TD1_color_addbias_disable 0x0
-# define TD1_color_addbias_enable 0x80000
-# define TD1_color_blend_MASK 0xffefffff /* bit 20 */
-# define TD1_color_blend_disable 0x0
-# define TD1_color_blend_enable 0x100000
-# define TD1_color_sel_MASK 0xff9fffff /* bits 21-22 */
-# define TD1_color_sel_arg1 0x0 /* val 0, shift 21 */
-# define TD1_color_sel_arg2 0x200000 /* val 1, shift 21 */
-# define TD1_color_sel_add 0x400000 /* val 2, shift 21 */
-# define TD1_color_sel_mul 0x600000 /* val 3, shift 21 */
-# define TD1_alpha_arg1_inv_MASK 0xff7fffff /* bit 23 */
-# define TD1_alpha_arg1_inv_disable 0x0
-# define TD1_alpha_arg1_inv_enable 0x800000
-# define TD1_alpha_arg2_MASK 0xfcffffff /* bits 24-25 */
-# define TD1_alpha_arg2_diffuse 0x0 /* val 0, shift 24 */
-# define TD1_alpha_arg2_fcol 0x1000000 /* val 1, shift 24 */
-# define TD1_alpha_arg2_prevtex 0x2000000 /* val 2, shift 24 */
-# define TD1_alpha_arg2_prevstage 0x3000000 /* val 3, shift 24 */
-# define TD1_alpha_arg2_inv_MASK 0xfbffffff /* bit 26 */
-# define TD1_alpha_arg2_inv_disable 0x0
-# define TD1_alpha_arg2_inv_enable 0x4000000
-# define TD1_alpha_add_MASK 0xf7ffffff /* bit 27 */
-# define TD1_alpha_add_disable 0x0
-# define TD1_alpha_add_enable 0x8000000
-# define TD1_alpha_addbias_MASK 0xefffffff /* bit 28 */
-# define TD1_alpha_addbias_disable 0x0
-# define TD1_alpha_addbias_enable 0x10000000
-# define TD1_alpha_add2x_MASK 0xdfffffff /* bit 29 */
-# define TD1_alpha_add2x_disable 0x0
-# define TD1_alpha_add2x_enable 0x20000000
-# define TD1_alpha_modbright_MASK 0xcfffffff /* bits 28-29 */
-# define TD1_alpha_modbright_disable 0x0 /* val 0, shift 28 */
-# define TD1_alpha_modbright_2x 0x10000000 /* val 1, shift 28 */
-# define TD1_alpha_modbright_4x 0x20000000 /* val 2, shift 28 */
-# define TD1_alpha_sel_MASK 0x3fffffff /* bits 30-31 */
-# define TD1_alpha_sel_arg1 0x0 /* val 0, shift 30 */
-# define TD1_alpha_sel_arg2 0x40000000 /* val 1, shift 30 */
-# define TD1_alpha_sel_add 0x80000000 /* val 2, shift 30 */
-# define TD1_alpha_sel_mul 0xc0000000 /* val 3, shift 30 */
-
-#define MGAREG_TEST0 0x1e48
-
-# define TST_ramtsten_MASK 0xfffffffe /* bit 0 */
-# define TST_ramtsten_disable 0x0
-# define TST_ramtsten_enable 0x1
-# define TST_ramtstdone_MASK 0xfffffffd /* bit 1 */
-# define TST_ramtstdone_disable 0x0
-# define TST_ramtstdone_enable 0x2
-# define TST_wramtstpass_MASK 0xfffffffb /* bit 2 */
-# define TST_wramtstpass_disable 0x0
-# define TST_wramtstpass_enable 0x4
-# define TST_tcachetstpass_MASK 0xfffffff7 /* bit 3 */
-# define TST_tcachetstpass_disable 0x0
-# define TST_tcachetstpass_enable 0x8
-# define TST_tluttstpass_MASK 0xffffffef /* bit 4 */
-# define TST_tluttstpass_disable 0x0
-# define TST_tluttstpass_enable 0x10
-# define TST_luttstpass_MASK 0xffffffdf /* bit 5 */
-# define TST_luttstpass_disable 0x0
-# define TST_luttstpass_enable 0x20
-# define TST_besramtstpass_MASK 0xffffffbf /* bit 6 */
-# define TST_besramtstpass_disable 0x0
-# define TST_besramtstpass_enable 0x40
-# define TST_ringen_MASK 0xfffffeff /* bit 8 */
-# define TST_ringen_disable 0x0
-# define TST_ringen_enable 0x100
-# define TST_apllbyp_MASK 0xfffffdff /* bit 9 */
-# define TST_apllbyp_disable 0x0
-# define TST_apllbyp_enable 0x200
-# define TST_hiten_MASK 0xfffffbff /* bit 10 */
-# define TST_hiten_disable 0x0
-# define TST_hiten_enable 0x400
-# define TST_tmode_MASK 0xffffc7ff /* bits 11-13 */
-# define TST_tmode_SHIFT 11
-# define TST_tclksel_MASK 0xfffe3fff /* bits 14-16 */
-# define TST_tclksel_SHIFT 14
-# define TST_ringcnten_MASK 0xfffdffff /* bit 17 */
-# define TST_ringcnten_disable 0x0
-# define TST_ringcnten_enable 0x20000
-# define TST_ringcnt_MASK 0xc003ffff /* bits 18-29 */
-# define TST_ringcnt_SHIFT 18
-# define TST_ringcntclksl_MASK 0xbfffffff /* bit 30 */
-# define TST_ringcntclksl_disable 0x0
-# define TST_ringcntclksl_enable 0x40000000
-# define TST_biosboot_MASK 0x7fffffff /* bit 31 */
-# define TST_biosboot_disable 0x0
-# define TST_biosboot_enable 0x80000000
-
-#define MGAREG_TEXBORDERCOL 0x2c5c
-#define MGAREG_TEXCTL 0x2c30
-
-# define TMC_tformat_MASK 0xfffffff0 /* bits 0-3 */
-# define TMC_tformat_tw4 0x0 /* val 0, shift 0 */
-# define TMC_tformat_tw8 0x1 /* val 1, shift 0 */
-# define TMC_tformat_tw15 0x2 /* val 2, shift 0 */
-# define TMC_tformat_tw16 0x3 /* val 3, shift 0 */
-# define TMC_tformat_tw12 0x4 /* val 4, shift 0 */
-# define TMC_tformat_tw32 0x6 /* val 6, shift 0 */
-# define TMC_tformat_tw8a 0x7 /* val 7, shift 0 */
-# define TMC_tformat_tw8al 0x8 /* val 8, shift 0 */
-# define TMC_tformat_tw422 0xa /* val 10, shift 0 */
-# define TMC_tformat_tw422uyvy 0xb /* val 11, shift 0 */
-# define TMC_tpitchlin_MASK 0xfffffeff /* bit 8 */
-# define TMC_tpitchlin_disable 0x0
-# define TMC_tpitchlin_enable 0x100
-# define TMC_tpitchext_MASK 0xfff001ff /* bits 9-19 */
-# define TMC_tpitchext_SHIFT 9
-# define TMC_tpitch_MASK 0xfff8ffff /* bits 16-18 */
-# define TMC_tpitch_SHIFT 16
-# define TMC_owalpha_MASK 0xffbfffff /* bit 22 */
-# define TMC_owalpha_disable 0x0
-# define TMC_owalpha_enable 0x400000
-# define TMC_azeroextend_MASK 0xff7fffff /* bit 23 */
-# define TMC_azeroextend_disable 0x0
-# define TMC_azeroextend_enable 0x800000
-# define TMC_decalckey_MASK 0xfeffffff /* bit 24 */
-# define TMC_decalckey_disable 0x0
-# define TMC_decalckey_enable 0x1000000
-# define TMC_takey_MASK 0xfdffffff /* bit 25 */
-# define TMC_takey_0 0x0
-# define TMC_takey_1 0x2000000
-# define TMC_tamask_MASK 0xfbffffff /* bit 26 */
-# define TMC_tamask_0 0x0
-# define TMC_tamask_1 0x4000000
-# define TMC_clampv_MASK 0xf7ffffff /* bit 27 */
-# define TMC_clampv_disable 0x0
-# define TMC_clampv_enable 0x8000000
-# define TMC_clampu_MASK 0xefffffff /* bit 28 */
-# define TMC_clampu_disable 0x0
-# define TMC_clampu_enable 0x10000000
-# define TMC_tmodulate_MASK 0xdfffffff /* bit 29 */
-# define TMC_tmodulate_disable 0x0
-# define TMC_tmodulate_enable 0x20000000
-# define TMC_strans_MASK 0xbfffffff /* bit 30 */
-# define TMC_strans_disable 0x0
-# define TMC_strans_enable 0x40000000
-# define TMC_itrans_MASK 0x7fffffff /* bit 31 */
-# define TMC_itrans_disable 0x0
-# define TMC_itrans_enable 0x80000000
-
-#define MGAREG_TEXCTL2 0x2c3c
-
-# define TMC_decalblend_MASK 0xfffffffe /* bit 0 */
-# define TMC_decalblend_disable 0x0
-# define TMC_decalblend_enable 0x1
-# define TMC_idecal_MASK 0xfffffffd /* bit 1 */
-# define TMC_idecal_disable 0x0
-# define TMC_idecal_enable 0x2
-# define TMC_decaldis_MASK 0xfffffffb /* bit 2 */
-# define TMC_decaldis_disable 0x0
-# define TMC_decaldis_enable 0x4
-# define TMC_ckstransdis_MASK 0xffffffef /* bit 4 */
-# define TMC_ckstransdis_disable 0x0
-# define TMC_ckstransdis_enable 0x10
-# define TMC_borderen_MASK 0xffffffdf /* bit 5 */
-# define TMC_borderen_disable 0x0
-# define TMC_borderen_enable 0x20
-# define TMC_specen_MASK 0xffffffbf /* bit 6 */
-# define TMC_specen_disable 0x0
-# define TMC_specen_enable 0x40
-# define TMC_dualtex_MASK 0xffffff7f /* bit 7 */
-# define TMC_dualtex_disable 0x0
-# define TMC_dualtex_enable 0x80
-# define TMC_tablefog_MASK 0xfffffeff /* bit 8 */
-# define TMC_tablefog_disable 0x0
-# define TMC_tablefog_enable 0x100
-# define TMC_bumpmap_MASK 0xfffffdff /* bit 9 */
-# define TMC_bumpmap_disable 0x0
-# define TMC_bumpmap_enable 0x200
-# define TMC_map1_MASK 0x7fffffff /* bit 31 */
-# define TMC_map1_disable 0x0
-# define TMC_map1_enable 0x80000000
-
-#define MGAREG_TEXFILTER 0x2c58
-
-# define TF_minfilter_MASK 0xfffffff0 /* bits 0-3 */
-# define TF_minfilter_nrst 0x0 /* val 0, shift 0 */
-# define TF_minfilter_bilin 0x2 /* val 2, shift 0 */
-# define TF_minfilter_cnst 0x3 /* val 3, shift 0 */
-# define TF_minfilter_mm1s 0x8 /* val 8, shift 0 */
-# define TF_minfilter_mm2s 0x9 /* val 9, shift 0 */
-# define TF_minfilter_mm4s 0xa /* val 10, shift 0 */
-# define TF_minfilter_mm8s 0xc /* val 12, shift 0 */
-# define TF_magfilter_MASK 0xffffff0f /* bits 4-7 */
-# define TF_magfilter_nrst 0x0 /* val 0, shift 4 */
-# define TF_magfilter_bilin 0x20 /* val 2, shift 4 */
-# define TF_magfilter_cnst 0x30 /* val 3, shift 4 */
-# define TF_uvoffset_SHIFT 17
-# define TF_uvoffset_OGL (0U << TF_uvoffset_SHIFT)
-# define TF_uvoffset_D3D (1U << TF_uvoffset_SHIFT)
-# define TF_uvoffset_MASK (~(1U << TF_uvoffset_SHIFT))
-# define TF_reserved_MASK (~0x1ff00) /* bits 8-16 */
-# define TF_mapnbhigh_SHIFT 18
-# define TF_mapnbhigh_MASK (~(1U << TF_mapnbhigh_SHIFT))
-# define TF_avgstride_MASK 0xfff7ffff /* bit 19 */
-# define TF_avgstride_disable 0x0
-# define TF_avgstride_enable 0x80000
-# define TF_filteralpha_MASK 0xffefffff /* bit 20 */
-# define TF_filteralpha_disable 0x0
-# define TF_filteralpha_enable 0x100000
-# define TF_fthres_MASK 0xe01fffff /* bits 21-28 */
-# define TF_fthres_SHIFT 21
-# define TF_mapnb_MASK 0x1fffffff /* bits 29-31 */
-# define TF_mapnb_SHIFT 29
-
-#define MGAREG_TEXHEIGHT 0x2c2c
-
-# define TH_th_MASK 0xffffffc0 /* bits 0-5 */
-# define TH_th_SHIFT 0
-# define TH_rfh_MASK 0xffff81ff /* bits 9-14 */
-# define TH_rfh_SHIFT 9
-# define TH_thmask_MASK 0xe003ffff /* bits 18-28 */
-# define TH_thmask_SHIFT 18
-
-#define MGAREG_TEXORG 0x2c24
-
-# define TO_texorgmap_MASK 0xfffffffe /* bit 0 */
-# define TO_texorgmap_fb 0x0
-# define TO_texorgmap_sys 0x1
-# define TO_texorgacc_MASK 0xfffffffd /* bit 1 */
-# define TO_texorgacc_pci 0x0
-# define TO_texorgacc_agp 0x2
-# define TO_texorgoffsetsel 0x4
-# define TO_texorg_MASK 0x1f /* bits 5-31 */
-# define TO_texorg_SHIFT 5
-
-#define MGAREG_TEXORG1 0x2ca4
-#define MGAREG_TEXORG2 0x2ca8
-#define MGAREG_TEXORG3 0x2cac
-#define MGAREG_TEXORG4 0x2cb0
-#define MGAREG_TEXTRANS 0x2c34
-
-# define TT_tckey_MASK 0xffff0000 /* bits 0-15 */
-# define TT_tckey_SHIFT 0
-# define TT_tkmask_MASK 0xffff /* bits 16-31 */
-# define TT_tkmask_SHIFT 16
-
-#define MGAREG_TEXTRANSHIGH 0x2c38
-
-# define TT_tckeyh_MASK 0xffff0000 /* bits 0-15 */
-# define TT_tckeyh_SHIFT 0
-# define TT_tkmaskh_MASK 0xffff /* bits 16-31 */
-# define TT_tkmaskh_SHIFT 16
-
-#define MGAREG_TEXWIDTH 0x2c28
-
-# define TW_tw_MASK 0xffffffc0 /* bits 0-5 */
-# define TW_tw_SHIFT 0
-# define TW_rfw_MASK 0xffff81ff /* bits 9-14 */
-# define TW_rfw_SHIFT 9
-# define TW_twmask_MASK 0xe003ffff /* bits 18-28 */
-# define TW_twmask_SHIFT 18
-
-#define MGAREG_TMR0 0x2c00
-#define MGAREG_TMR1 0x2c04
-#define MGAREG_TMR2 0x2c08
-#define MGAREG_TMR3 0x2c0c
-#define MGAREG_TMR4 0x2c10
-#define MGAREG_TMR5 0x2c14
-#define MGAREG_TMR6 0x2c18
-#define MGAREG_TMR7 0x2c1c
-#define MGAREG_TMR8 0x2c20
-#define MGAREG_VBIADDR0 0x3e08
-#define MGAREG_VBIADDR1 0x3e0c
-#define MGAREG_VCOUNT 0x1e20
-#define MGAREG_WACCEPTSEQ 0x1dd4
-
-# define WAS_seqdst0_MASK 0xffffffc0 /* bits 0-5 */
-# define WAS_seqdst0_SHIFT 0
-# define WAS_seqdst1_MASK 0xfffff03f /* bits 6-11 */
-# define WAS_seqdst1_SHIFT 6
-# define WAS_seqdst2_MASK 0xfffc0fff /* bits 12-17 */
-# define WAS_seqdst2_SHIFT 12
-# define WAS_seqdst3_MASK 0xff03ffff /* bits 18-23 */
-# define WAS_seqdst3_SHIFT 18
-# define WAS_seqlen_MASK 0xfcffffff /* bits 24-25 */
-# define WAS_wfirsttag_MASK 0xfbffffff /* bit 26 */
-# define WAS_wfirsttag_disable 0x0
-# define WAS_wfirsttag_enable 0x4000000
-# define WAS_wsametag_MASK 0xf7ffffff /* bit 27 */
-# define WAS_wsametag_disable 0x0
-# define WAS_wsametag_enable 0x8000000
-# define WAS_seqoff_MASK 0xefffffff /* bit 28 */
-# define WAS_seqoff_disable 0x0
-# define WAS_seqoff_enable 0x10000000
-
-#define MGAREG_WCODEADDR 0x1e6c
-
-# define WMA_wcodeaddr_MASK 0xff /* bits 8-31 */
-# define WMA_wcodeaddr_SHIFT 8
-
-#define MGAREG_WFLAG 0x1dc4
-
-# define WF_walustsflag_MASK 0xffffff00 /* bits 0-7 */
-# define WF_walustsflag_SHIFT 0
-# define WF_walucfgflag_MASK 0xffff00ff /* bits 8-15 */
-# define WF_walucfgflag_SHIFT 8
-# define WF_wprgflag_MASK 0xffff /* bits 16-31 */
-# define WF_wprgflag_SHIFT 16
-
-#define MGAREG_WFLAG1 0x1de0
-
-# define WF1_walustsflag1_MASK 0xffffff00 /* bits 0-7 */
-# define WF1_walustsflag1_SHIFT 0
-# define WF1_walucfgflag1_MASK 0xffff00ff /* bits 8-15 */
-# define WF1_walucfgflag1_SHIFT 8
-# define WF1_wprgflag1_MASK 0xffff /* bits 16-31 */
-# define WF1_wprgflag1_SHIFT 16
-
-#define MGAREG_WFLAGNB 0x1e64
-#define MGAREG_WFLAGNB1 0x1e08
-#define MGAREG_WGETMSB 0x1dc8
-
-# define WGV_wgetmsbmin_MASK 0xffffffe0 /* bits 0-4 */
-# define WGV_wgetmsbmin_SHIFT 0
-# define WGV_wgetmsbmax_MASK 0xffffe0ff /* bits 8-12 */
-# define WGV_wgetmsbmax_SHIFT 8
-# define WGV_wbrklefttop_MASK 0xfffeffff /* bit 16 */
-# define WGV_wbrklefttop_disable 0x0
-# define WGV_wbrklefttop_enable 0x10000
-# define WGV_wfastcrop_MASK 0xfffdffff /* bit 17 */
-# define WGV_wfastcrop_disable 0x0
-# define WGV_wfastcrop_enable 0x20000
-# define WGV_wcentersnap_MASK 0xfffbffff /* bit 18 */
-# define WGV_wcentersnap_disable 0x0
-# define WGV_wcentersnap_enable 0x40000
-# define WGV_wbrkrighttop_MASK 0xfff7ffff /* bit 19 */
-# define WGV_wbrkrighttop_disable 0x0
-# define WGV_wbrkrighttop_enable 0x80000
-
-#define MGAREG_WIADDR 0x1dc0
-
-# define WIA_wmode_MASK 0xfffffffc /* bits 0-1 */
-# define WIA_wmode_suspend 0x0 /* val 0, shift 0 */
-# define WIA_wmode_resume 0x1 /* val 1, shift 0 */
-# define WIA_wmode_jump 0x2 /* val 2, shift 0 */
-# define WIA_wmode_start 0x3 /* val 3, shift 0 */
-# define WIA_wagp_MASK 0xfffffffb /* bit 2 */
-# define WIA_wagp_pci 0x0
-# define WIA_wagp_agp 0x4
-# define WIA_wiaddr_MASK 0x7 /* bits 3-31 */
-# define WIA_wiaddr_SHIFT 3
-
-#define MGAREG_WIADDR2 0x1dd8
-
-# define WIA2_wmode_MASK 0xfffffffc /* bits 0-1 */
-# define WIA2_wmode_suspend 0x0 /* val 0, shift 0 */
-# define WIA2_wmode_resume 0x1 /* val 1, shift 0 */
-# define WIA2_wmode_jump 0x2 /* val 2, shift 0 */
-# define WIA2_wmode_start 0x3 /* val 3, shift 0 */
-# define WIA2_wagp_MASK 0xfffffffb /* bit 2 */
-# define WIA2_wagp_pci 0x0
-# define WIA2_wagp_agp 0x4
-# define WIA2_wiaddr_MASK 0x7 /* bits 3-31 */
-# define WIA2_wiaddr_SHIFT 3
-
-#define MGAREG_WIADDRNB 0x1e60
-#define MGAREG_WIADDRNB1 0x1e04
-#define MGAREG_WIADDRNB2 0x1e00
-#define MGAREG_WIMEMADDR 0x1e68
-
-# define WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */
-# define WIMA_wimemaddr_SHIFT 0
-
-#define MGAREG_WIMEMDATA 0x2000
-#define MGAREG_WIMEMDATA1 0x2100
-#define MGAREG_WMISC 0x1e70
-
-# define WM_wucodecache_MASK 0xfffffffe /* bit 0 */
-# define WM_wucodecache_disable 0x0
-# define WM_wucodecache_enable 0x1
-# define WM_wmaster_MASK 0xfffffffd /* bit 1 */
-# define WM_wmaster_disable 0x0
-# define WM_wmaster_enable 0x2
-# define WM_wcacheflush_MASK 0xfffffff7 /* bit 3 */
-# define WM_wcacheflush_disable 0x0
-# define WM_wcacheflush_enable 0x8
-
-#define MGAREG_WR 0x2d00
-#define MGAREG_WVRTXSZ 0x1dcc
-
-# define WVS_wvrtxsz_MASK 0xffffffc0 /* bits 0-5 */
-# define WVS_wvrtxsz_SHIFT 0
-# define WVS_primsz_MASK 0xffffc0ff /* bits 8-13 */
-# define WVS_primsz_SHIFT 8
-
-#define MGAREG_XDST 0x1cb0
-#define MGAREG_XYEND 0x1c44
-
-# define XYEA_x_end_MASK 0xffff0000 /* bits 0-15 */
-# define XYEA_x_end_SHIFT 0
-# define XYEA_y_end_MASK 0xffff /* bits 16-31 */
-# define XYEA_y_end_SHIFT 16
-
-#define MGAREG_XYSTRT 0x1c40
-
-# define XYSA_x_start_MASK 0xffff0000 /* bits 0-15 */
-# define XYSA_x_start_SHIFT 0
-# define XYSA_y_start_MASK 0xffff /* bits 16-31 */
-# define XYSA_y_start_SHIFT 16
-
-#define MGAREG_YBOT 0x1c9c
-#define MGAREG_YDST 0x1c90
-
-# define YA_ydst_MASK 0xff800000 /* bits 0-22 */
-# define YA_ydst_SHIFT 0
-# define YA_sellin_MASK 0x1fffffff /* bits 29-31 */
-# define YA_sellin_SHIFT 29
-
-#define MGAREG_YDSTLEN 0x1c88
-
-# define YDL_length_MASK 0xffff0000 /* bits 0-15 */
-# define YDL_length_SHIFT 0
-# define YDL_yval_MASK 0xffff /* bits 16-31 */
-# define YDL_yval_SHIFT 16
-
-#define MGAREG_YDSTORG 0x1c94
-#define MGAREG_YTOP 0x1c98
-#define MGAREG_ZORG 0x1c0c
-
-# define ZO_zorgmap_MASK 0xfffffffe /* bit 0 */
-# define ZO_zorgmap_fb 0x0
-# define ZO_zorgmap_sys 0x1
-# define ZO_zorgacc_MASK 0xfffffffd /* bit 1 */
-# define ZO_zorgacc_pci 0x0
-# define ZO_zorgacc_agp 0x2
-# define ZO_zorg_MASK 0x3 /* bits 2-31 */
-# define ZO_zorg_SHIFT 2
-
-
-
-
-/**************** (END) AUTOMATICLY GENERATED REGISTER FILE ******************/
-
-/* Copied from mga_drv.h kernel file.
- */
-
-#define MGA_ILOAD_ALIGN 64
-#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1)
-
-#endif /* _MGAREGS_H_ */
-
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgarender.c b/xc/lib/GL/mesa/src/drv/mga/mgarender.c
deleted file mode 100644
index 516a99099..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgarender.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgarender.c,v 1.4 2002/10/30 12:51:36 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Simulate missing primitives with indexed vertices.
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "mgacontext.h"
-#include "mgatris.h"
-#include "mgastate.h"
-#include "mgaioctl.h"
-#include "mgavb.h"
-
-#define HAVE_POINTS 0
-#define HAVE_LINES 0
-#define HAVE_LINE_STRIPS 0
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 0
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0 /* for now */
-
-static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint hwprim;
-
- switch (prim) {
- case GL_TRIANGLES:
- hwprim = MGA_WA_TRIANGLES;
- break;
- case GL_TRIANGLE_STRIP:
- if (mmesa->vertex_size == 8)
- hwprim = MGA_WA_TRISTRIP_T0;
- else
- hwprim = MGA_WA_TRISTRIP_T0T1;
- break;
- case GL_TRIANGLE_FAN:
- if (mmesa->vertex_size == 8)
- hwprim = MGA_WA_TRIFAN_T0;
- else
- hwprim = MGA_WA_TRIFAN_T0T1;
- break;
- default:
- return;
- }
-
- mgaRasterPrimitive( ctx, GL_TRIANGLES, hwprim );
-}
-
-static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_CLIP;
-}
-
-#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx)
-#define INIT( prim ) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- FLUSH_BATCH(mmesa); \
- mgaDmaPrimitive( ctx, prim ); \
-} while (0)
-#define NEW_PRIMITIVE() FLUSH_BATCH( mmesa )
-#define NEW_BUFFER() FLUSH_BATCH( mmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- 0 /* fix me */
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- MGA_BUFFER_SIZE / (mmesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr ) \
- mga_emit_contiguous_verts(ctx, j, (j)+(nr))
-
-
-#define TAG(x) mga_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean mga_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
-
- /* Don't handle clipping or indexed vertices or vertex manipulations.
- */
- if (VB->ClipOrMask || mmesa->RenderIndex != 0 || VB->Elts) {
- return GL_TRUE;
- }
-
- tnl->Driver.Render.Start( ctx );
- mmesa->SetupNewInputs = ~0;
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- mga_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _mga_render_stage =
-{
- "mga render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- mga_check_render, /* check - initially set to alloc data */
- mga_run_render /* run */
-};
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
deleted file mode 100644
index c8a55d4cd..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.11 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "mtypes.h"
-#include "mgadd.h"
-#include "mgacontext.h"
-#include "mgaspan.h"
-#include "mgaioctl.h"
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-
-#define LOCAL_VARS \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
- __DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
- GLuint height = dPriv->h; \
- char *read_buf = (char *)(sPriv->pFB + \
- mmesa->readOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch); \
- char *buf = (char *)(sPriv->pFB + \
- mmesa->drawOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-
-
-#define LOCAL_DEPTH_VARS \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
- __DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- mgaScreen->depthOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
- _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-
-#define HW_LOCK() \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- FLUSH_BATCH(mmesa); \
- LOCK_HARDWARE_QUIESCENT(mmesa);
-
-
-#define HW_CLIPLOOP() \
- do { \
- int _nc = mmesa->numClipRects; \
- while (_nc--) { \
- int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \
- int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \
- int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \
- int maxy = mmesa->pClipRects[_nc].y2 - mmesa->drawY;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK() \
- UNLOCK_HARDWARE(mmesa);
-
-
-
-
-
-
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#define Y_FLIP(_y) (height - _y - 1)
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) mga##x##_565
-#include "spantmp.h"
-
-
-
-
-
-/* 32 bit, 8888 argb color spanline and pixel functions
- */
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-
-#define WRITE_RGBA(_x, _y, r, g, b, a) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((r << 16) | \
- (g << 8) | \
- (b << 0) | \
- (a << 24) )
-
-#define WRITE_PIXEL(_x, _y, p) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA(rgba, _x, _y) \
- do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) mga##x##_8888
-#include "spantmp.h"
-
-
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch);
-
-#define TAG(x) mga##x##_16
-#include "depthtmp.h"
-
-
-
-
-/* 32 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch);
-
-#define TAG(x) mga##x##_32
-#include "depthtmp.h"
-
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xff; \
- tmp |= (d) << 8; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) { \
- d = (*(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff) >> 8; \
-}
-
-#define TAG(x) mga##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff00; \
- tmp |= d & 0xff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff;
-
-#define TAG(x) mga##x##_24_8
-#include "stenciltmp.h"
-
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- unsigned int offset;
-
- assert( (bufferBit == FRONT_LEFT_BIT) || (bufferBit == BACK_LEFT_BIT) );
-
- offset = (bufferBit == FRONT_LEFT_BIT)
- ? mmesa->mgaScreen->frontOffset
- : mmesa->mgaScreen->backOffset;
-
- mmesa->drawOffset = offset;
- mmesa->readOffset = offset;
-
- assert( (buffer == mmesa->driDrawable->driverPrivate)
- || (buffer == mmesa->driReadable->driverPrivate) );
-
- mmesa->mesa_drawable = (buffer == mmesa->driDrawable->driverPrivate)
- ? mmesa->driDrawable : mmesa->driReadable;
-}
-
-void mgaDDInitSpanFuncs( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mgaDDSetBuffer;
-
- switch (mmesa->mgaScreen->cpp) {
- case 2:
- swdd->WriteRGBASpan = mgaWriteRGBASpan_565;
- swdd->WriteRGBSpan = mgaWriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = mgaWriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = mgaWriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = mgaWriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = mgaReadRGBASpan_565;
- swdd->ReadRGBAPixels = mgaReadRGBAPixels_565;
-
- swdd->ReadDepthSpan = mgaReadDepthSpan_16;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_16;
- swdd->ReadDepthPixels = mgaReadDepthPixels_16;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_16;
- break;
-
- case 4:
- swdd->WriteRGBASpan = mgaWriteRGBASpan_8888;
- swdd->WriteRGBSpan = mgaWriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = mgaWriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = mgaWriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = mgaWriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = mgaReadRGBASpan_8888;
- swdd->ReadRGBAPixels = mgaReadRGBAPixels_8888;
-
- if (!mmesa->hw_stencil) {
- swdd->ReadDepthSpan = mgaReadDepthSpan_32;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_32;
- swdd->ReadDepthPixels = mgaReadDepthPixels_32;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_32;
- } else {
- swdd->ReadDepthSpan = mgaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = mgaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = mgaReadStencilSpan_24_8;
- swdd->WriteStencilSpan = mgaWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = mgaReadStencilPixels_24_8;
- swdd->WriteStencilPixels = mgaWriteStencilPixels_24_8;
- }
- break;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.h b/xc/lib/GL/mesa/src/drv/mga/mgaspan.h
deleted file mode 100644
index 80583daca..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.h,v 1.3 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef _MGA_SPAN_H
-#define _MGA_SPAN_H
-
-extern void mgaDDInitSpanFuncs( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c
deleted file mode 100644
index 15bd1a936..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c
+++ /dev/null
@@ -1,1239 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.13 2002/10/30 12:51:36 alanh Exp $ */
-
-
-#include "mtypes.h"
-#include "colormac.h"
-#include "dd.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgavb.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-#include "mgaregs.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "xmlpool.h"
-
-static void updateSpecularLighting( GLcontext *ctx );
-
-static const GLuint mgarop_NoBLK[16] = {
- DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000,
- DC_atype_rstr | 0x00040000, DC_atype_rpl | 0x000c0000,
- DC_atype_rstr | 0x00020000, DC_atype_rstr | 0x000a0000,
- DC_atype_rstr | 0x00060000, DC_atype_rstr | 0x000e0000,
- DC_atype_rstr | 0x00010000, DC_atype_rstr | 0x00090000,
- DC_atype_rstr | 0x00050000, DC_atype_rstr | 0x000d0000,
- DC_atype_rpl | 0x00030000, DC_atype_rstr | 0x000b0000,
- DC_atype_rstr | 0x00070000, DC_atype_rpl | 0x000f0000
-};
-
-/* =============================================================
- * Alpha blending
- */
-
-static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLubyte refByte;
- GLuint a;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- switch ( func ) {
- case GL_NEVER:
- a = AC_atmode_alt;
- refByte = 0;
- break;
- case GL_LESS:
- a = AC_atmode_alt;
- break;
- case GL_GEQUAL:
- a = AC_atmode_agte;
- break;
- case GL_LEQUAL:
- a = AC_atmode_alte;
- break;
- case GL_GREATER:
- a = AC_atmode_agt;
- break;
- case GL_NOTEQUAL:
- a = AC_atmode_ane;
- break;
- case GL_EQUAL:
- a = AC_atmode_ae;
- break;
- case GL_ALWAYS:
- a = AC_atmode_noacmp;
- break;
- default:
- a = 0;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.alpha_func = a | MGA_FIELD( AC_atref, refByte );
-}
-
-static void updateBlendLogicOp(GLcontext *ctx)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
-
- mmesa->hw.blend_func_enable =
- (ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled) ? ~0 : 0;
-
- FALLBACK( ctx, MGA_FALLBACK_BLEND,
- ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled &&
- mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
-}
-
-static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode)
-{
- updateBlendLogicOp( ctx );
-}
-
-static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint src;
- GLuint dst;
-
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO:
- src = AC_src_zero; break;
- case GL_SRC_ALPHA:
- src = AC_src_src_alpha; break;
- case GL_ONE:
- default: /* never happens */
- src = AC_src_one; break;
- case GL_DST_COLOR:
- src = AC_src_dst_color; break;
- case GL_ONE_MINUS_DST_COLOR:
- src = AC_src_om_dst_color; break;
- case GL_ONE_MINUS_SRC_ALPHA:
- src = AC_src_om_src_alpha; break;
- case GL_DST_ALPHA:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_dst_alpha : AC_src_one;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_om_dst_alpha : AC_src_zero;
- break;
- case GL_SRC_ALPHA_SATURATE:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_src_alpha_sat : AC_src_zero;
- break;
- }
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_SRC_ALPHA:
- dst = AC_dst_src_alpha; break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dst = AC_dst_om_src_alpha; break;
- default: /* never happens */
- case GL_ZERO:
- dst = AC_dst_zero; break;
- case GL_ONE:
- dst = AC_dst_one; break;
- case GL_SRC_COLOR:
- dst = AC_dst_src_color; break;
- case GL_ONE_MINUS_SRC_COLOR:
- dst = AC_dst_om_src_color; break;
- case GL_DST_ALPHA:
- dst = (ctx->Visual.alphaBits > 0)
- ? AC_dst_dst_alpha : AC_dst_one;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dst = (ctx->Visual.alphaBits > 0)
- ? AC_dst_om_dst_alpha : AC_dst_zero;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.blend_func = (src | dst);
-
- FALLBACK( ctx, MGA_FALLBACK_BLEND,
- ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled &&
- mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
-}
-
-static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- mgaDDBlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void mgaDDDepthFunc(GLcontext *ctx, GLenum func)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- int zmode;
-
- switch (func) {
- case GL_NEVER:
- /* can't do this in h/w, we'll use a s/w fallback */
- FALLBACK (ctx, MGA_FALLBACK_DEPTH, ctx->Depth.Test);
-
- /* FALLTHROUGH */
- case GL_ALWAYS:
- zmode = DC_zmode_nozcmp; break;
- case GL_LESS:
- zmode = DC_zmode_zlt; break;
- case GL_LEQUAL:
- zmode = DC_zmode_zlte; break;
- case GL_EQUAL:
- zmode = DC_zmode_ze; break;
- case GL_GREATER:
- zmode = DC_zmode_zgt; break;
- case GL_GEQUAL:
- zmode = DC_zmode_zgte; break;
- case GL_NOTEQUAL:
- zmode = DC_zmode_zne; break;
- default:
- zmode = 0; break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.zmode &= DC_zmode_MASK;
- mmesa->hw.zmode |= zmode;
-}
-
-static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.zmode &= DC_atype_MASK;
- mmesa->hw.zmode |= (flag) ? DC_atype_zi : DC_atype_i;
-}
-
-
-static void mgaDDClearDepth(GLcontext *ctx, GLclampd d)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- /* Select the Z depth. The ~ is used because the _MASK values in the
- * MGA driver are used to mask OFF the selected bits. In this case,
- * we want to mask off everything except the MA_zwidth bits.
- */
- switch (mmesa->setup.maccess & ~MA_zwidth_MASK) {
- case MA_zwidth_16: mmesa->ClearDepth = d * 0x0000ffff; break;
- case MA_zwidth_24: mmesa->ClearDepth = d * 0xffffff00; break;
- case MA_zwidth_32: mmesa->ClearDepth = d * 0xffffffff; break;
- default: return;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = PACK_COLOR_888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- MGA_STATECHANGE(mmesa, MGA_UPLOAD_CONTEXT);
- mmesa->setup.fogcolor = color;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-void mgaUpdateClipping(const GLcontext *ctx)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (mmesa->driDrawable)
- {
- int x1 = mmesa->driDrawable->x + ctx->Scissor.X;
- int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h
- - (ctx->Scissor.Y + ctx->Scissor.Height);
- int x2 = x1 + ctx->Scissor.Width - 1;
- int y2 = y1 + ctx->Scissor.Height - 1;
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- mmesa->scissor_rect.x1 = x1;
- mmesa->scissor_rect.y1 = y1;
- mmesa->scissor_rect.x2 = x2;
- mmesa->scissor_rect.y2 = y2;
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
- }
-}
-
-
-static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- if ( ctx->Scissor.Enabled ) {
- FLUSH_BATCH( MGA_CONTEXT(ctx) ); /* don't pipeline cliprect changes */
- mgaUpdateClipping( ctx );
- }
-}
-
-
-/* =============================================================
- * Culling
- */
-
-
-#define _CULL_DISABLE 0
-#define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16))
-#define _CULL_POSITIVE (1<<11)
-
-static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (ctx->Polygon.CullFlag &&
- ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK)
- {
- mmesa->hw.cull = _CULL_NEGATIVE;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mmesa->hw.cull ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
-
- if (ctx->Polygon.FrontFace != GL_CCW)
- mmesa->hw.cull ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
-
- mmesa->hw.cull_dualtex = mmesa->hw.cull ^
- (_CULL_POSITIVE ^ _CULL_NEGATIVE); /* warp bug? */
- }
- else {
- mmesa->hw.cull = _CULL_DISABLE;
- mmesa->hw.cull_dualtex = _CULL_DISABLE;
- }
-}
-
-
-/* =============================================================
- * Masks
- */
-
-static void mgaDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
-
-
- GLuint mask = mgaPackColor(mgaScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (mgaScreen->cpp == 2)
- mask = mask | (mask << 16);
-
- if (mmesa->setup.plnwt != mask) {
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->setup.plnwt = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static int mgaStipples[16] = {
- 0xffff,
- 0xa5a5,
- 0x5a5a,
- 0xa0a0,
- 0x5050,
- 0x0a0a,
- 0x0505,
- 0x8020,
- 0x0401,
- 0x1040,
- 0x0208,
- 0x0802,
- 0x4010,
- 0x0104,
- 0x2080,
- 0x0000
-};
-
-/**
- * The MGA supports a subset of possible 4x4 stipples natively, GL
- * wants 32x32. Fortunately stipple is usually a repeating pattern.
- *
- * \param ctx GL rendering context to be affected
- * \param mask Pointer to the 32x32 stipple mask
- */
-
-static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- mmesa->raster_primitive == GL_TRIANGLES);
- GLuint stipple;
-
- FLUSH_BATCH(mmesa);
- mmesa->haveHwStipple = 0;
-
- if (active) {
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->setup.dwgctl &= ~(0xf<<20);
- }
-
- p[0] = mask[0] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[4] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[8] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[12] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++)
- if (*m++ != p[j]) {
- return;
- }
-
- stipple = ( ((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12) );
-
- for (i = 0 ; i < 16 ; i++)
- if (mgaStipples[i] == stipple) {
- mmesa->poly_stipple = i<<20;
- mmesa->haveHwStipple = 1;
- break;
- }
-
- if (active) {
- mmesa->setup.dwgctl &= ~(0xf<<20);
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
-}
-
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-static void updateSpecularLighting( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- unsigned int specen;
-
- specen = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TMC_specen_enable : 0;
-
- if ( specen != mmesa->hw.specen ) {
- mmesa->hw.specen = specen;
- mmesa->dirty |= MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1;
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- FLUSH_BATCH( MGA_CONTEXT(ctx) );
- updateSpecularLighting( ctx );
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-
-static void mgaDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint stencil;
- GLuint stencilctl;
-
- stencil = MGA_FIELD( S_sref, ref ) | MGA_FIELD( S_smsk, mask );
- switch (func)
- {
- case GL_NEVER:
- stencilctl = SC_smode_snever;
- break;
- case GL_LESS:
- stencilctl = SC_smode_slt;
- break;
- case GL_LEQUAL:
- stencilctl = SC_smode_slte;
- break;
- case GL_GREATER:
- stencilctl = SC_smode_sgt;
- break;
- case GL_GEQUAL:
- stencilctl = SC_smode_sgte;
- break;
- case GL_NOTEQUAL:
- stencilctl = SC_smode_sne;
- break;
- case GL_EQUAL:
- stencilctl = SC_smode_se;
- break;
- case GL_ALWAYS:
- default:
- stencilctl = SC_smode_salways;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencil &= (S_sref_MASK & S_smsk_MASK);
- mmesa->hw.stencil |= stencil;
- mmesa->hw.stencilctl &= SC_smode_MASK;
- mmesa->hw.stencilctl |= stencilctl;
-}
-
-static void mgaDDStencilMask(GLcontext *ctx, GLuint mask)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencil &= S_swtmsk_MASK;
- mmesa->hw.stencil |= MGA_FIELD( S_swtmsk, mask );
-}
-
-static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint stencilctl;
-
- stencilctl = 0;
- switch (ctx->Stencil.FailFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_sfailop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_sfailop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_sfailop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_sfailop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_sfailop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_sfailop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_sfailop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_sfailop_invert;
- break;
- default:
- break;
- }
-
- switch (ctx->Stencil.ZFailFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_szfailop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_szfailop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_szfailop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_szfailop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_szfailop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_szfailop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_szfailop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_szfailop_invert;
- break;
- default:
- break;
- }
-
- switch (ctx->Stencil.ZPassFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_szpassop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_szpassop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_szpassop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_szpassop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_szpassop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_szpassop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_szpassop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_szpassop_invert;
- break;
- default:
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencilctl &= (SC_sfailop_MASK & SC_szfailop_MASK
- & SC_szpassop_MASK);
- mmesa->hw.stencilctl |= stencilctl;
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void mgaCalcViewport( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = mmesa->hw_viewport;
-
- /* See also mga_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + mmesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * mmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * mmesa->depth_scale;
-
- mmesa->SetupNewInputs = ~0;
-}
-
-static void mgaViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- mgaCalcViewport( ctx );
-}
-
-static void mgaDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- mgaCalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void mgaDDClearColor(GLcontext *ctx,
- const GLfloat color[4] )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- mmesa->ClearColor = mgaPackColor( mmesa->mgaScreen->cpp,
- c[0], c[1], c[2], c[3]);
-}
-
-
-/* Fallback to swrast for select and feedback.
- */
-static void mgaRenderMode( GLcontext *ctx, GLenum mode )
-{
- FALLBACK( ctx, MGA_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.rop = mgarop_NoBLK[ opcode & 0x0f ];
-}
-
-
-static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-
- if (driDrawable->numClipRects == 0) {
- static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
- mmesa->numClipRects = 1;
- mmesa->pClipRects = &zeroareacliprect;
- } else {
- mmesa->numClipRects = driDrawable->numClipRects;
- mmesa->pClipRects = driDrawable->pClipRects;
- }
- mmesa->drawX = driDrawable->x;
- mmesa->drawY = driDrawable->y;
-
- mmesa->setup.dstorg = mmesa->drawOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-}
-
-
-static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-
- if (driDrawable->numBackClipRects == 0)
- {
- if (driDrawable->numClipRects == 0) {
- static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
- mmesa->numClipRects = 1;
- mmesa->pClipRects = &zeroareacliprect;
- } else {
- mmesa->numClipRects = driDrawable->numClipRects;
- mmesa->pClipRects = driDrawable->pClipRects;
- }
- mmesa->drawX = driDrawable->x;
- mmesa->drawY = driDrawable->y;
- } else {
- mmesa->numClipRects = driDrawable->numBackClipRects;
- mmesa->pClipRects = driDrawable->pBackClipRects;
- mmesa->drawX = driDrawable->backX;
- mmesa->drawY = driDrawable->backY;
- }
-
- mmesa->setup.dstorg = mmesa->drawOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-}
-
-
-void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
- MGASAREAPrivPtr sarea = mmesa->sarea;
-
-
- DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable);
- mmesa->dirty_cliprects = 0;
-
- if (mmesa->draw_buffer == MGA_FRONT)
- mgaXMesaSetFrontClipRects( mmesa );
- else
- mgaXMesaSetBackClipRects( mmesa );
-
-
- sarea->req_drawable = driDrawable->draw;
- sarea->req_draw_buffer = mmesa->draw_buffer;
-
- mgaUpdateClipping( mmesa->glCtx );
- mgaCalcViewport( mmesa->glCtx );
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-}
-
-
-static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->draw_buffer = MGA_FRONT;
- mgaXMesaSetFrontClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BACK_LEFT_BIT:
- mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
- mmesa->draw_buffer = MGA_BACK;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mgaXMesaSetBackClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-
-static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- switch(cap) {
- case GL_DITHER:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (!ctx->Color.DitherFlag)
- mmesa->setup.maccess |= MA_nodither_enable;
- else
- mmesa->setup.maccess &= ~MA_nodither_enable;
- break;
- case GL_LIGHTING:
- case GL_COLOR_SUM_EXT:
- FLUSH_BATCH( mmesa );
- updateSpecularLighting( ctx );
- break;
- case GL_ALPHA_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.alpha_func_enable = (state) ? ~0 : 0;
- break;
- case GL_DEPTH_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- FALLBACK (ctx, MGA_FALLBACK_DEPTH,
- ctx->Depth.Func == GL_NEVER && ctx->Depth.Test);
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( mmesa );
- mmesa->scissor = state;
- mgaUpdateClipping( ctx );
- break;
-
- case GL_FOG:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (ctx->Fog.Enabled)
- mmesa->setup.maccess |= MA_fogen_enable;
- else
- mmesa->setup.maccess &= ~MA_fogen_enable;
- break;
- case GL_CULL_FACE:
- mgaDDCullFaceFrontFace( ctx, 0 );
- break;
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
- case GL_POLYGON_STIPPLE:
- if (mmesa->haveHwStipple && mmesa->raster_primitive == GL_TRIANGLES) {
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->setup.dwgctl &= ~(0xf<<20);
- if (state)
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- updateBlendLogicOp( ctx );
- break;
-
- case GL_STENCIL_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (mmesa->hw_stencil) {
- mmesa->hw.stencil_enable = ( state ) ? ~0 : 0;
- }
- else {
- FALLBACK( ctx, MGA_FALLBACK_STENCIL, state );
- }
- default:
- break;
- }
-}
-
-
-/* =============================================================
- */
-
-static void mgaDDPrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%03x): %s%s%s%s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & MGA_WAIT_AGE) ? "wait-age " : "",
- (state & MGA_UPLOAD_TEX0IMAGE) ? "upload-tex0-img " : "",
- (state & MGA_UPLOAD_TEX1IMAGE) ? "upload-tex1-img " : "",
- (state & MGA_UPLOAD_CONTEXT) ? "upload-ctx " : "",
- (state & MGA_UPLOAD_TEX0) ? "upload-tex0 " : "",
- (state & MGA_UPLOAD_TEX1) ? "upload-tex1 " : "",
- (state & MGA_UPLOAD_PIPE) ? "upload-pipe " : ""
- );
-}
-
-/* Push the state into the sarea and/or texture memory.
- */
-void mgaEmitHwStateLocked( mgaContextPtr mmesa )
-{
- MGASAREAPrivPtr sarea = mmesa->sarea;
- GLcontext * ctx = mmesa->glCtx;
-
- if (MGA_DEBUG & DEBUG_VERBOSE_MSG)
- mgaDDPrintDirty( __FUNCTION__, mmesa->dirty );
-
- if (mmesa->dirty & MGA_UPLOAD_CONTEXT) {
- mmesa->setup.wflag = _CULL_DISABLE;
- if (mmesa->raster_primitive == GL_TRIANGLES) {
- if ((ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT)) {
- mmesa->setup.wflag = mmesa->hw.cull_dualtex;
- }
- else {
- mmesa->setup.wflag = mmesa->hw.cull;
- }
- }
-
- mmesa->setup.stencil = mmesa->hw.stencil
- & mmesa->hw.stencil_enable;
- mmesa->setup.stencilctl = mmesa->hw.stencilctl
- & mmesa->hw.stencil_enable;
-
- /* If depth testing is not enabled, then use the no Z-compare / no
- * Z-write mode. Otherwise, use whatever is set in hw.zmode.
- */
- mmesa->setup.dwgctl &= (DC_zmode_MASK & DC_atype_MASK);
- mmesa->setup.dwgctl |= (ctx->Depth.Test)
- ? mmesa->hw.zmode : (DC_zmode_nozcmp | DC_atype_i);
-
- mmesa->setup.dwgctl &= DC_bop_MASK;
- mmesa->setup.dwgctl |= (ctx->Color._LogicOpEnabled)
- ? mmesa->hw.rop : mgarop_NoBLK[ GL_COPY & 0x0f ];
-
- mmesa->setup.alphactrl &= AC_src_MASK & AC_dst_MASK & AC_atmode_MASK
- & AC_atref_MASK & AC_alphasel_MASK;
- mmesa->setup.alphactrl |=
- (mmesa->hw.alpha_func & mmesa->hw.alpha_func_enable) |
- (mmesa->hw.blend_func & mmesa->hw.blend_func_enable) |
- ((AC_src_one | AC_dst_zero) & ~mmesa->hw.blend_func_enable) |
- mmesa->hw.alpha_sel;
-
- memcpy( &sarea->ContextState, &mmesa->setup, sizeof(mmesa->setup));
- }
-
- if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) {
- memcpy(&sarea->TexState[0],
- &mmesa->CurrentTexObj[0]->setup,
- sizeof(sarea->TexState[0]));
- }
-
- if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) {
- memcpy(&sarea->TexState[1],
- &mmesa->CurrentTexObj[1]->setup,
- sizeof(sarea->TexState[1]));
- }
-
- if (mmesa->dirty & (MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1)) {
- sarea->TexState[0].texctl2 &= ~TMC_specen_enable;
- sarea->TexState[1].texctl2 &= ~TMC_specen_enable;
- sarea->TexState[0].texctl2 |= mmesa->hw.specen;
- sarea->TexState[1].texctl2 |= mmesa->hw.specen;
- }
-
- if (mmesa->dirty & MGA_UPLOAD_PIPE) {
-/* mmesa->sarea->wacceptseq = mmesa->hw_primitive; */
- mmesa->sarea->WarpPipe = mmesa->vertex_format;
- mmesa->sarea->vertsize = mmesa->vertex_size;
- }
-
- mmesa->sarea->dirty |= mmesa->dirty;
- mmesa->dirty &= MGA_UPLOAD_CLIPRECTS;
-}
-
-/* =============================================================
- */
-
-
-static void mgaDDValidateState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- FLUSH_BATCH( mmesa );
-
- if (mmesa->NewGLState & _NEW_TEXTURE) {
- mgaUpdateTextureState(ctx);
- }
-
- if (!mmesa->Fallback) {
- if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) {
- mgaChooseVertexState( ctx );
- }
-
- if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) {
- mgaChooseRenderState( ctx );
- }
- }
-
- mmesa->NewGLState = 0;
-}
-
-
-static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- MGA_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-static void mgaRunPipeline( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (mmesa->NewGLState) {
- mgaDDValidateState( ctx );
- }
-
- if (mmesa->dirty) {
- mgaEmitHwStateLocked( mmesa );
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-void mgaInitState( mgaContextPtr mmesa )
-{
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
- GLcontext *ctx = mmesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- /* use back buffer by default */
- mmesa->draw_buffer = MGA_BACK;
- mmesa->drawOffset = mmesa->mgaScreen->backOffset;
- mmesa->readOffset = mmesa->mgaScreen->backOffset;
- mmesa->setup.dstorg = mgaScreen->backOffset;
- } else {
- /* use front buffer by default */
- mmesa->draw_buffer = MGA_FRONT;
- mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
- mmesa->readOffset = mmesa->mgaScreen->frontOffset;
- mmesa->setup.dstorg = mgaScreen->frontOffset;
- }
-
- mmesa->setup.maccess = (MA_memreset_disable |
- MA_fogen_disable |
- MA_tlutload_disable |
- MA_nodither_disable |
- MA_dit555_disable);
- if (driQueryOptioni (&mmesa->optionCache, "color_reduction") !=
- DRI_CONF_COLOR_REDUCTION_DITHER)
- mmesa->setup.maccess |= MA_nodither_enable;
-
- switch (mmesa->mgaScreen->cpp) {
- case 2:
- mmesa->setup.maccess |= MA_pwidth_16;
- break;
- case 4:
- mmesa->setup.maccess |= MA_pwidth_32;
- break;
- default:
- fprintf( stderr, "Error: unknown cpp %d, exiting...\n",
- mmesa->mgaScreen->cpp );
- exit( 1 );
- }
-
- switch (mmesa->glCtx->Visual.depthBits) {
- case 16:
- mmesa->setup.maccess |= MA_zwidth_16;
- break;
- case 24:
- mmesa->setup.maccess |= MA_zwidth_24;
- break;
- case 32:
- mmesa->setup.maccess |= MA_zwidth_32;
- break;
- }
-
- mmesa->hw.blend_func = AC_src_one | AC_dst_zero;
- mmesa->hw.blend_func_enable = 0;
- mmesa->hw.alpha_func = AC_atmode_noacmp | MGA_FIELD( AC_atref, 0x00 );
- mmesa->hw.alpha_func_enable = 0;
- mmesa->hw.rop = mgarop_NoBLK[ GL_COPY & 0x0f ];
- mmesa->hw.zmode = DC_zmode_zlt | DC_atype_zi;
- mmesa->hw.stencil = MGA_FIELD( S_sref, 0x00) | MGA_FIELD( S_smsk, 0xff ) |
- MGA_FIELD( S_swtmsk, 0xff );
- mmesa->hw.stencilctl = SC_smode_salways | SC_sfailop_keep
- | SC_szfailop_keep | SC_szpassop_keep;
- mmesa->hw.stencil_enable = 0;
- mmesa->hw.cull = _CULL_DISABLE;
- mmesa->hw.cull_dualtex = _CULL_DISABLE;
- mmesa->hw.specen = 0;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
-
- mmesa->setup.dwgctl = (DC_opcod_trap |
- DC_linear_xy |
- DC_solid_disable |
- DC_arzero_disable |
- DC_sgnzero_disable |
- DC_shftzero_enable |
- MGA_FIELD( DC_bop, 0xC ) |
- MGA_FIELD( DC_trans, 0x0 ) |
- DC_bltmod_bmonolef |
- DC_pattern_disable |
- DC_transc_disable |
- DC_clipdis_disable);
-
- mmesa->setup.plnwt = ~0;
- mmesa->setup.alphactrl = (AC_amode_alpha_channel |
- AC_astipple_disable |
- AC_aten_disable);
-
- mmesa->setup.fogcolor = PACK_COLOR_888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- mmesa->setup.wflag = 0;
- mmesa->setup.tdualstage0 = 0;
- mmesa->setup.tdualstage1 = 0;
- mmesa->setup.fcol = 0;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
-
- mmesa->envcolor[0] = 0;
- mmesa->envcolor[1] = 0;
-}
-
-
-void mgaDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = mgaDDInvalidateState;
- ctx->Driver.Enable = mgaDDEnable;
- ctx->Driver.LightModelfv = mgaDDLightModelfv;
- ctx->Driver.AlphaFunc = mgaDDAlphaFunc;
- ctx->Driver.BlendEquation = mgaDDBlendEquation;
- ctx->Driver.BlendFunc = mgaDDBlendFunc;
- ctx->Driver.BlendFuncSeparate = mgaDDBlendFuncSeparate;
- ctx->Driver.DepthFunc = mgaDDDepthFunc;
- ctx->Driver.DepthMask = mgaDDDepthMask;
- ctx->Driver.Fogfv = mgaDDFogfv;
- ctx->Driver.Scissor = mgaDDScissor;
- ctx->Driver.CullFace = mgaDDCullFaceFrontFace;
- ctx->Driver.FrontFace = mgaDDCullFaceFrontFace;
- ctx->Driver.ColorMask = mgaDDColorMask;
-
- ctx->Driver.DrawBuffer = mgaDDDrawBuffer;
- ctx->Driver.ReadBuffer = mgaDDReadBuffer;
- ctx->Driver.ClearColor = mgaDDClearColor;
- ctx->Driver.ClearDepth = mgaDDClearDepth;
- ctx->Driver.LogicOpcode = mgaDDLogicOp;
-
- ctx->Driver.PolygonStipple = mgaDDPolygonStipple;
-
- ctx->Driver.StencilFunc = mgaDDStencilFunc;
- ctx->Driver.StencilMask = mgaDDStencilMask;
- ctx->Driver.StencilOp = mgaDDStencilOp;
-
- ctx->Driver.DepthRange = mgaDepthRange;
- ctx->Driver.Viewport = mgaViewport;
- ctx->Driver.RenderMode = mgaRenderMode;
-
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- TNL_CONTEXT(ctx)->Driver.RunPipeline = mgaRunPipeline;
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.h b/xc/lib/GL/mesa/src/drv/mga/mgastate.h
deleted file mode 100644
index afbe0aaf9..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgastate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.h,v 1.5 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef _MGA_STATE_H
-#define _MGA_STATE_H
-
-extern void mgaInitState( mgaContextPtr mmesa );
-extern void mgaDDInitStateFuncs(GLcontext *ctx);
-extern void mgaUpdateClipping(const GLcontext *ctx);
-extern void mgaUpdateCull( GLcontext *ctx );
-extern void mgaCalcViewport( GLcontext *ctx );
-extern void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
deleted file mode 100644
index 4561466c9..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.14 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "glheader.h"
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "macros.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "swrast/swrast.h"
-
-#include "xmlpool.h"
-
-/**
- * Set the texture wrap modes.
- * Currently \c GL_REPEAT, \c GL_CLAMP and \c GL_CLAMP_TO_EDGE are supported.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void
-mgaSetTexWrapping( mgaTextureObjectPtr t, GLenum swrap, GLenum twrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_edge = GL_FALSE;
-
- t->setup.texctl &= (TMC_clampu_MASK & TMC_clampv_MASK);
- t->setup.texctl2 &= (TMC_borderen_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- break;
- case GL_CLAMP:
- t->setup.texctl |= TMC_clampu_enable;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.texctl |= TMC_clampu_enable;
- is_clamp_to_edge = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- break;
- case GL_CLAMP:
- t->setup.texctl |= TMC_clampv_enable;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.texctl |= TMC_clampv_enable;
- is_clamp_to_edge = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp ) {
- t->setup.texctl2 |= TMC_borderen_enable;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_edge);
-}
-
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void
-mgaSetTexFilter( mgaTextureObjectPtr t, GLenum minf, GLenum magf )
-{
- GLuint val = 0;
-
- switch (minf) {
- case GL_NEAREST: val = TF_minfilter_nrst; break;
- case GL_LINEAR: val = TF_minfilter_bilin; break;
- case GL_NEAREST_MIPMAP_NEAREST: val = TF_minfilter_mm1s; break;
- case GL_LINEAR_MIPMAP_NEAREST: val = TF_minfilter_mm4s; break;
- case GL_NEAREST_MIPMAP_LINEAR: val = TF_minfilter_mm2s; break;
- case GL_LINEAR_MIPMAP_LINEAR: val = TF_minfilter_mm8s; break;
- default: val = TF_minfilter_nrst; break;
- }
-
- switch (magf) {
- case GL_NEAREST: val |= TF_magfilter_nrst; break;
- case GL_LINEAR: val |= TF_magfilter_bilin; break;
- default: val |= TF_magfilter_nrst; break;
- }
-
- /* See OpenGL 1.2 specification */
- if (magf == GL_LINEAR && (minf == GL_NEAREST_MIPMAP_NEAREST ||
- minf == GL_NEAREST_MIPMAP_LINEAR)) {
- val |= MGA_FIELD( TF_fthres, 0x20 ); /* c = 0.5 */
- } else {
- val |= MGA_FIELD( TF_fthres, 0x10 ); /* c = 0 */
- }
-
-
- /* Mask off the bits for the fields we are setting. Remember, the MGA mask
- * defines have 0s for the bits in the named fields. This is the opposite
- * of most of the other drivers.
- */
-
- t->setup.texfilter &= (TF_minfilter_MASK &
- TF_magfilter_MASK &
- TF_fthres_MASK);
- t->setup.texfilter |= val;
-}
-
-static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4])
-{
- t->setup.texbordercol = PACK_COLOR_8888(color[3], color[0],
- color[1], color[2] );
-}
-
-
-static const struct gl_texture_format *
-mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
-
- case GL_YCBCR_MESA:
- if (MGA_IS_G400(mmesa) &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE))
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
-
- default:
- _mesa_problem( ctx, "unexpected texture format in %s", __FUNCTION__ );
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static mgaTextureObjectPtr
-mgaAllocTexObj( struct gl_texture_object *tObj )
-{
- mgaTextureObjectPtr t;
-
-
- t = CALLOC( sizeof( *t ) );
- tObj->DriverData = t;
- if ( t != NULL ) {
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = tObj;
-
- t->setup.texctl = TMC_takey_1 | TMC_tamask_0;
- t->setup.texctl2 = TMC_ckstransdis_enable;
- t->setup.texfilter = TF_filteralpha_enable | TF_uvoffset_OGL;
-
- t->border_fallback = GL_FALSE;
- t->texenv_fallback = GL_FALSE;
-
- make_empty_list( & t->base );
-
- mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- mgaSetTexBorderColor( t, tObj->_BorderChan );
- }
-
- return( t );
-}
-
-
-static void mgaDDTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- switch( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
-
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- mmesa->envcolor[unit] = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
- break;
- }
- }
-}
-
-
-static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) mgaAllocTexObj( texObj );
- if ( t == NULL ) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glTexImage2D" );
- return;
- }
- }
-
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
- level -= t->firstLevel;
- if (level >= 0)
- t->dirty_images[0] |= (1UL << level);
-}
-
-static void mgaTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
-
- assert( t != NULL ); /* this _should_ be true */
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) mgaAllocTexObj( texObj );
- if ( t == NULL ) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glTexImage2D" );
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
- level -= t->firstLevel;
- if (level >= 0)
- t->dirty_images[0] |= (1UL << level);
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void
-mgaDDTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- mgaTextureObjectPtr t;
-
- t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* If we don't have a hardware texture, it will be automatically
- * created with current state before it is used, so we don't have
- * to do anything now
- */
-
- if ( (t == NULL) ||
- (target != GL_TEXTURE_2D &&
- target != GL_TEXTURE_RECTANGLE_NV) ) {
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- driSwapOutTextureObject( (driTextureObject *) t );
- /* FALLTHROUGH */
- case GL_TEXTURE_MAG_FILTER:
- FLUSH_BATCH(mmesa);
- mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- FLUSH_BATCH(mmesa);
- mgaSetTexWrapping(t,tObj->WrapS,tObj->WrapT);
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- FLUSH_BATCH(mmesa);
- mgaSetTexBorderColor(t, tObj->_BorderChan);
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-}
-
-
-static void
-mgaDDBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- if ( target == GL_TEXTURE_2D ||
- target == GL_TEXTURE_RECTANGLE_NV ) {
- if ( tObj->DriverData == NULL ) {
- mgaAllocTexObj( tObj );
- }
- }
-}
-
-
-static void
-mgaDDDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t ) {
- if ( mmesa ) {
- FLUSH_BATCH( mmesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-
-void
-mgaDDInitTextureFuncs( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
-
- ctx->Driver.ChooseTextureFormat = mgaChooseTextureFormat;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = mgaTexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = mgaTexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.BindTexture = mgaDDBindTexture;
- ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */
- ctx->Driver.DeleteTexture = mgaDDDeleteTexture;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
- ctx->Driver.ActiveTexture = NULL;
- ctx->Driver.UpdateTexturePalette = NULL;
-
- ctx->Driver.TexEnv = mgaDDTexEnv;
- ctx->Driver.TexParameter = mgaDDTexParameter;
-
- driInitTextureObjects( ctx, & mmesa->swapped,
- (DRI_TEXMGR_DO_TEXTURE_2D |
- DRI_TEXMGR_DO_TEXTURE_RECT) );
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.h b/xc/lib/GL/mesa/src/drv/mga/mgatex.h
deleted file mode 100644
index 94547e388..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgatex.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.h,v 1.7 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef MGATEX_INC
-#define MGATEX_INC
-
-#include "mgacontext.h"
-
-typedef struct mga_texture_object_s *mgaTextureObjectPtr;
-
-
-/* Called before a primitive is rendered to make sure the texture
- * state is properly setup. Texture residence is checked later
- * when we grab the lock.
- */
-void mgaUpdateTextureState( GLcontext *ctx );
-
-int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t );
-
-void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t );
-
-void mgaDDInitTextureFuncs( GLcontext *ctx );
-
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c
deleted file mode 100644
index 66c69bf3e..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.7 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "glheader.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgaioctl.h"
-#include "mga_xmesa.h"
-
-#include "imports.h"
-#include "simple_list.h"
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t )
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
-
- if ( mmesa != NULL )
- {
- if ( t->age > mmesa->dirtyAge )
- mmesa->dirtyAge = t->age;
-
- for ( i = 0 ; i < mmesa->glCtx->Const.MaxTextureUnits ; i++ )
- {
- if ( t == mmesa->CurrentTexObj[ i ] ) {
- mmesa->CurrentTexObj[ i ] = NULL;
- }
- }
- }
-}
-
-
-/**
- * Upload a texture image from system memory to either on-card or AGP
- * memory. Uploads to on-card memory are performed using an ILOAD operation.
- * This is used for both initial loading of the entire image, and texSubImage
- * updates.
- *
- * Performed with the hardware lock held.
- *
- * Even though this function is named "upload subimage," the entire image
- * is uploaded.
- *
- * \param mmesa Driver context.
- * \param t Texture to be uploaded.
- * \param hwlevel Mipmap level of the texture to be uploaded.
- *
- * \bug As mentioned above, this fuction actually copies the entier mipmap
- * level. There should be a version of this function that performs
- * sub-rectangle uploads. This will perform quite a bit better if only
- * a small portion of a larger texture has been updated. Care would
- * need to be take with such an implementation once glCopyTexImage has
- * been hardware accelerated.
- */
-static void mgaUploadSubImage( mgaContextPtr mmesa,
- mgaTextureObjectPtr t, GLint hwlevel )
-{
- struct gl_texture_image * texImage;
- unsigned offset;
- unsigned texelBytes;
- unsigned length;
- const int level = hwlevel + t->base.firstLevel;
-
-
- if ( (hwlevel < 0)
- || (hwlevel >= (MGA_IS_G200(mmesa)
- ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS)) ) {
- fprintf( stderr, "[%s:%d] level = %d\n", __FILE__, __LINE__, level );
- return;
- }
-
- texImage = t->base.tObj->Image[level];
- if ( texImage == NULL ) {
- fprintf( stderr, "[%s:%d] Image[%d] = NULL\n", __FILE__, __LINE__,
- level );
- return;
- }
-
-
- if (texImage->Data == NULL) {
- fprintf(stderr, "null texture image data tObj %p level %d\n",
- t->base.tObj, level);
- return;
- }
-
-
- /* find the proper destination offset for this level */
- if ( MGA_IS_G200(mmesa) ) {
- offset = (t->base.memBlock->ofs + t->offsets[hwlevel]);
- }
- else {
- unsigned i;
-
- offset = t->base.memBlock->ofs;
- for ( i = 0 ; i < hwlevel ; i++ ) {
- offset += (t->offsets[1] >> (i * 2));
- }
- }
-
-
- /* Copy the texture from system memory to a memory space that can be
- * directly used by the hardware for texturing.
- */
-
- texelBytes = texImage->TexFormat->TexelBytes;
- length = texImage->Width * texImage->Height * texelBytes;
- if ( t->base.heap->heapId == MGA_CARD_HEAP ) {
- unsigned tex_offset = 0;
- unsigned to_copy;
-
-
- /* We may not be able to upload the entire texture in one batch due to
- * register limits or dma buffer limits. Split the copy up into maximum
- * sized chunks.
- */
-
- offset += mmesa->mgaScreen->textureOffset[ t->base.heap->heapId ];
- while ( length != 0 ) {
- mgaGetILoadBufferLocked( mmesa );
-
- /* The kernel ILOAD ioctl requires that the lenght be an even multiple
- * of MGA_ILOAD_ALIGN.
- */
- length = ((length) + MGA_ILOAD_MASK) & ~MGA_ILOAD_MASK;
-
- to_copy = MIN2( length, MGA_BUFFER_SIZE );
- (void) memcpy( mmesa->iload_buffer->address,
- (GLubyte *) texImage->Data + tex_offset, to_copy );
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_TEXTURE )
- fprintf(stderr, "[%s:%d] address/size = 0x%08lx/%d\n",
- __FILE__, __LINE__,
- (long) (offset + tex_offset),
- to_copy );
-
- mgaFireILoadLocked( mmesa, offset + tex_offset, to_copy );
- tex_offset += to_copy;
- length -= to_copy;
- }
- } else {
- /* FIXME: the sync for direct copy reduces speed.. */
- /* This works, is slower for uploads to card space and needs
- * additional synchronization with the dma stream.
- */
-
- UPDATE_LOCK(mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT);
-
- memcpy( mmesa->mgaScreen->texVirtual[t->base.heap->heapId] + offset,
- texImage->Data, length );
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_TEXTURE )
- fprintf(stderr, "[%s:%d] address/size = 0x%08lx/%d\n",
- __FILE__, __LINE__,
- (long) (mmesa->mgaScreen->texVirtual[t->base.heap->heapId]
- + offset),
- length);
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param mmesa Context pointer
- * \param t Texture to be uploaded
- */
-
-int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t )
-{
- int i;
- int ofs;
-
-
- if ( (t == NULL) || (t->base.totalSize == 0) )
- return 0;
-
- LOCK_HARDWARE( mmesa );
-
- if (t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( mmesa->texture_heaps, mmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( mmesa );
- return -1;
- }
-
- ofs = mmesa->mgaScreen->textureOffset[ heap ]
- + t->base.memBlock->ofs;
-
- if ( MGA_IS_G200(mmesa) ) {
- t->setup.texorg = ofs;
- t->setup.texorg1 = ofs + t->offsets[1];
- t->setup.texorg2 = ofs + t->offsets[2];
- t->setup.texorg3 = ofs + t->offsets[3];
- t->setup.texorg4 = ofs + t->offsets[4];
- }
- else {
- t->setup.texorg = ofs | TO_texorgoffsetsel;
- t->setup.texorg1 = t->offsets[1];
- t->setup.texorg2 = 0;
- t->setup.texorg3 = 0;
- t->setup.texorg4 = 0;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (MGA_DEBUG&DEBUG_VERBOSE_TEXTURE)
- fprintf(stderr, "[%s:%d] dispatch age: %d age freed memory: %d\n",
- __FILE__, __LINE__,
- GET_DISPATCH_AGE(mmesa), mmesa->dirtyAge);
-
- if (mmesa->dirtyAge >= GET_DISPATCH_AGE(mmesa))
- mgaWaitAgeLocked( mmesa, mmesa->dirtyAge );
-
- if (t->base.dirty_images[0]) {
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_TEXTURE)
- fprintf(stderr, "[%s:%d] dirty_images[0] = 0x%04x\n",
- __FILE__, __LINE__, t->base.dirty_images[0] );
-
- for (i = 0 ; i < numLevels ; i++) {
- if ( (t->base.dirty_images[0] & (1U << i)) != 0 ) {
- mgaUploadSubImage( mmesa, t, i );
- }
- }
- t->base.dirty_images[0] = 0;
- }
-
-
- UNLOCK_HARDWARE( mmesa );
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c
deleted file mode 100644
index 651c93ccd..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.10 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mgastate.h"
-
-
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Functions to draw basic primitives *
- ***********************************************************************/
-
-
-#if defined (USE_X86_ASM)
-#define EMIT_VERT( j, vb, vertex_size, v ) \
-do { int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertex_size), \
- "D" ((long)vb), \
- "S" ((long)v)); \
-} while (0)
-#else
-#define EMIT_VERT( j, vb, vertex_size, v ) \
-do { \
- for ( j = 0 ; j < vertex_size ; j++ ) \
- vb[j] = (v)->ui[j]; \
- vb += vertex_size; \
-} while (0)
-#endif
-
-static void __inline__ mga_draw_triangle( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1,
- mgaVertexPtr v2 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 3 * 4 * vertex_size );
- int j;
-
- EMIT_VERT( j, vb, vertex_size, v0 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v2 );
-}
-
-
-static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1,
- mgaVertexPtr v2,
- mgaVertexPtr v3 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- int j;
-
- EMIT_VERT( j, vb, vertex_size, v0 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v3 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v2 );
- EMIT_VERT( j, vb, vertex_size, v3 );
-}
-
-
-static __inline__ void mga_draw_point( mgaContextPtr mmesa,
- mgaVertexPtr tmp )
-{
- GLfloat sz = mmesa->glCtx->Point._Size * .5;
- int vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- int j;
-
-#if 0
- v0->v.x += PNT_X_OFFSET - TRI_X_OFFSET;
- v0->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-
- /* Draw a point as two triangles.
- */
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
-
-#if 0
- v0->v.x -= PNT_X_OFFSET - TRI_X_OFFSET;
- v0->v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-}
-
-
-static __inline__ void mga_draw_line( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- GLfloat dx, dy, ix, iy;
- GLfloat width = mmesa->glCtx->Line._Width;
- GLint j;
-
-#if 0
- v0->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- v0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- v1->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- v1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-
- dx = v0->v.x - v1->v.x;
- dy = v0->v.y - v1->v.y;
-
- ix = width * .5; iy = 0;
- if (dx * dx > dy * dy) {
- iy = ix; ix = 0;
- }
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v0->v.x + ix;
- *(float *)&vb[1] = v0->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x - ix;
- *(float *)&vb[1] = v1->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
-#if 0
- v0->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- v0->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- v1->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- v1->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_tri( mmesa, a, b, c ); \
- else \
- mga_draw_triangle( mmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- mmesa->draw_tri( mmesa, a, b, d ); \
- mmesa->draw_tri( mmesa, b, c, d ); \
- } else { \
- mga_draw_quad( mmesa, a, b, c, d ); \
- } \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_line( mmesa, v0, v1 ); \
- else { \
- mga_draw_line( mmesa, v0, v1 ); \
- } \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_point( mmesa, v0 ); \
- else { \
- mga_draw_point( mmesa, v0 ); \
- } \
-} while (0)
-
-
-/***********************************************************************
- * Fallback to swrast for basic primitives *
- ***********************************************************************/
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-
-static void
-mga_fallback_tri( mgaContextPtr mmesa,
- mgaVertex *v0,
- mgaVertex *v1,
- mgaVertex *v2 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[3];
- mga_translate_vertex( ctx, v0, &v[0] );
- mga_translate_vertex( ctx, v1, &v[1] );
- mga_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-mga_fallback_line( mgaContextPtr mmesa,
- mgaVertex *v0,
- mgaVertex *v1 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[2];
- mga_translate_vertex( ctx, v0, &v[0] );
- mga_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-mga_fallback_point( mgaContextPtr mmesa,
- mgaVertex *v0 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[1];
- mga_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-
-#define MGA_UNFILLED_BIT 0x1
-#define MGA_OFFSET_BIT 0x2
-#define MGA_TWOSIDE_BIT 0x4
-#define MGA_FLAT_BIT 0x8 /* mga can't flatshade? */
-#define MGA_FALLBACK_BIT 0x10
-#define MGA_MAX_TRIFUNC 0x20
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[MGA_MAX_TRIFUNC];
-
-#define DO_FALLBACK (IND & MGA_FALLBACK_BIT)
-#define DO_OFFSET (IND & MGA_OFFSET_BIT)
-#define DO_UNFILLED (IND & MGA_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & MGA_TWOSIDE_BIT)
-#define DO_FLAT (IND & MGA_FLAT_BIT)
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_SPEC 1
-#define HAVE_HW_FLATSHADE 0
-#define VERTEX mgaVertex
-#define TAB rast_tab
-
-#define MGA_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define MGA_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-#define DEPTH_SCALE mmesa->depth_scale
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (mmesa->verts + (e<<mmesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) MGA_COLOR( v->ub4[4], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) MGA_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- (void) color; (void) spec;
-
-
-
-/***********************************************************************
- * Functions to draw basic unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (mmesa->raster_primitive != x) \
- mgaRasterPrimitive( ctx, x, MGA_WA_TRIANGLES )
-#define RENDER_PRIMITIVE mmesa->render_primitive
-#define IND MGA_FALLBACK_BIT
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Functions to draw GL primitives *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT| \
- MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Mga doesn't support provoking-vertex flat-shading?
- */
-#define IND (MGA_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT| \
- MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-
- init_flat();
- init_offset_flat();
- init_twoside_flat();
- init_twoside_offset_flat();
- init_unfilled_flat();
- init_offset_unfilled_flat();
- init_twoside_unfilled_flat();
- init_twoside_offset_unfilled_flat();
- init_fallback_flat();
- init_offset_fallback_flat();
- init_twoside_fallback_flat();
- init_twoside_offset_fallback_flat();
- init_unfilled_fallback_flat();
- init_offset_unfilled_fallback_flat();
- init_twoside_unfilled_fallback_flat();
- init_twoside_offset_unfilled_fallback_flat();
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-
-#define VERT(x) (mgaVertex *)(vertptr + ((x)<<vertshift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- mga_draw_point( mmesa, VERT(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) \
- mga_draw_line( mmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- mga_draw_triangle( mmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- mga_draw_quad( mmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) mgaRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)mmesa->verts; \
- const GLuint vertshift = mmesa->vertex_stride_shift; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) mga_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) mga_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = mmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void mgaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, (n-2) * 3 * 4 * vertex_size );
- GLubyte *vertptr = (GLubyte *)mmesa->verts;
- const GLuint vertshift = mmesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i-1]) );
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i]) );
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_SMOOTH | DD_LINE_STIPPLE)
-#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_UNFILLED)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \
- DD_TRI_UNFILLED)
-
-void mgaChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS|DD_TRI_STIPPLE)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= MGA_UNFILLED_BIT;
- if (flags & DD_FLATSHADE) index |= MGA_FLAT_BIT;
- }
-
- mmesa->draw_point = mga_draw_point;
- mmesa->draw_line = mga_draw_line;
- mmesa->draw_tri = mga_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- mmesa->draw_point = mga_fallback_point;
-
- if (flags & LINE_FALLBACK)
- mmesa->draw_line = mga_fallback_line;
-
- if (flags & TRI_FALLBACK)
- mmesa->draw_tri = mga_fallback_tri;
-
- index |= MGA_FALLBACK_BIT;
- }
-
- if ((flags & DD_TRI_STIPPLE) && !mmesa->haveHwStipple) {
- mmesa->draw_tri = mga_fallback_tri;
- index |= MGA_FALLBACK_BIT;
- }
- }
-
- if (mmesa->RenderIndex != index) {
- mmesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = mga_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = mga_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = mgaFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = mgaRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = mgaRenderClippedPoly;
- }
- }
-}
-
-/**********************************************************************/
-/* Runtime render state and callbacks */
-/**********************************************************************/
-
-
-static GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-
-
-/* Always called between RenderStart and RenderFinish --> We already
- * hold the lock.
- */
-void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- FLUSH_BATCH( mmesa );
-
- /* Update culling */
- if (mmesa->raster_primitive != prim)
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
-
- mmesa->raster_primitive = prim;
-/* mmesa->hw_primitive = hwprim; */
- mmesa->hw_primitive = MGA_WA_TRIANGLES; /* disable mgarender.c for now */
-
- if (ctx->Polygon.StippleFlag && mmesa->haveHwStipple)
- {
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->setup.dwgctl &= ~(0xf<<20);
- if (mmesa->raster_primitive == GL_TRIANGLES)
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
-}
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in mgarender.c.
- */
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- mmesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (mmesa->raster_primitive != rprim) {
- mgaRasterPrimitive( ctx, rprim, MGA_WA_TRIANGLES );
- }
-}
-
-static void mgaRenderFinish( GLcontext *ctx )
-{
- if (MGA_CONTEXT(ctx)->RenderIndex & MGA_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Manage total rasterization fallbacks */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "read buffer",
- "glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ZERO)",
- "glRenderMode(selection or feedback)",
- "No hardware stencil",
- "glDepthFunc( GL_NEVER )",
- "Mixing GL_CLAMP_TO_EDGE and GL_CLAMP"
-};
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint oldfallback = mmesa->Fallback;
-
- if (mode) {
- mmesa->Fallback |= bit;
- if (oldfallback == 0) {
- FLUSH_BATCH(mmesa);
- _swsetup_Wakeup( ctx );
- mmesa->RenderIndex = ~0;
- if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "MGA begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- mmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = mgaCheckTexSizes;
- tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
- tnl->Driver.Render.Finish = mgaRenderFinish;
- tnl->Driver.Render.BuildVertices = mgaBuildVertices;
- mmesa->NewGLState |= (_MGA_NEW_RENDERSTATE |
- _MGA_NEW_RASTERSETUP);
- if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "MGA end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void mgaDDInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- static int firsttime = 1;
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- mmesa->RenderIndex = ~0;
-
- tnl->Driver.Render.Start = mgaCheckTexSizes;
- tnl->Driver.Render.Finish = mgaRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = mgaBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h
deleted file mode 100644
index f3ece3a05..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgatris.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.10 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGATRIS_INC
-#define MGATRIS_INC
-
-#include "mtypes.h"
-
-extern void mgaDDInitTriFuncs( GLcontext *ctx );
-extern void mgaChooseRenderState( GLcontext *ctx );
-extern void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim );
-
-extern void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( ctx, bit, mode ) mgaFallback( ctx, bit, mode )
-
-#define _MGA_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c
deleted file mode 100644
index e14774d63..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.15 2003/03/26 20:43:49 tsi Exp $ */
-
-#include "mgacontext.h"
-#include "mgavb.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-#include "mga_xmesa.h"
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/swrast.h"
-
-
-#define MGA_TEX1_BIT 0x1
-#define MGA_TEX0_BIT 0x2
-#define MGA_RGBA_BIT 0x4
-#define MGA_SPEC_BIT 0x8
-#define MGA_FOG_BIT 0x10
-#define MGA_XYZW_BIT 0x20
-#define MGA_PTEX_BIT 0x40
-#define MGA_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[MGA_MAX_SETUP];
-
-
-#define TINY_VERTEX_FORMAT 0
-#define NOTEX_VERTEX_FORMAT 0
-#define TEX0_VERTEX_FORMAT (MGA_A|MGA_S|MGA_F)
-#define TEX1_VERTEX_FORMAT (MGA_A|MGA_S|MGA_F|MGA_T2)
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & MGA_XYZW_BIT)
-#define DO_RGBA (IND & MGA_RGBA_BIT)
-#define DO_SPEC (IND & MGA_SPEC_BIT)
-#define DO_FOG (IND & MGA_FOG_BIT)
-#define DO_TEX0 (IND & MGA_TEX0_BIT)
-#define DO_TEX1 (IND & MGA_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & MGA_PTEX_BIT)
-
-
-#define VERTEX mgaVertex
-#define VERTEX_COLOR mga_color_t
-#define LOCALVARS mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() mmesa->hw_viewport
-#define GET_TEXSOURCE(n) mmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() mmesa->vertex_format
-#define GET_VERTEX_STORE() mmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() mmesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &mmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &mmesa->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 0
-#define HAVE_NOTEX_VERTICES 0
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS \
- const GLfloat dx = - mmesa->drawX - SUBPIXEL_X; \
- const GLfloat dy = (mmesa->driDrawable->h + \
- mmesa->drawY + SUBPIXEL_Y); \
- const GLfloat sz = 1.0 / mmesa->depth_scale
-
-#define UNVIEWPORT_X(x) x + dx;
-#define UNVIEWPORT_Y(y) - y + dy;
-#define UNVIEWPORT_Z(z) z * sz;
-
-#define PTEX_FALLBACK() FALLBACK(ctx, MGA_FALLBACK_TEXTURE, 1)
-
-
-#define IMPORT_FLOAT_COLORS mga_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS mga_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[mmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[mmesa->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) mga_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-
-void mgaPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s: %d %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & MGA_XYZW_BIT) ? " xyzw," : "",
- (flags & MGA_RGBA_BIT) ? " rgba," : "",
- (flags & MGA_SPEC_BIT) ? " spec," : "",
- (flags & MGA_FOG_BIT) ? " fog," : "",
- (flags & MGA_TEX0_BIT) ? " tex-0," : "",
- (flags & MGA_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-void mgaCheckTexSizes( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /*fprintf(stderr, "%s\n", __FUNCTION__);*/
-
- if (!setup_tab[mmesa->SetupIndex].check_tex_sizes(ctx)) {
- mmesa->SetupIndex |= MGA_PTEX_BIT;
- mmesa->SetupNewInputs = ~0;
-
- if (!mmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[mmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[mmesa->SetupIndex].copy_pv;
- }
- if (mmesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- }
- }
-}
-
-
-void mgaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)mmesa->verts + (start<<mmesa->vertex_stride_shift));
- GLuint stride = 1<<mmesa->vertex_stride_shift;
-
- newinputs |= mmesa->SetupNewInputs;
- mmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= MGA_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= MGA_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= MGA_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= MGA_TEX0_BIT|MGA_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= MGA_FOG_BIT;
-
- if (mmesa->SetupIndex & MGA_PTEX_BIT)
- ind = ~0;
-
- ind &= mmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-
-void mgaChooseVertexState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = MGA_XYZW_BIT|MGA_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= MGA_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= MGA_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2) {
- /* unit 1 enabled */
- if (ctx->Texture._EnabledUnits & 0x1) {
- /* unit 0 enabled */
- ind |= MGA_TEX1_BIT|MGA_TEX0_BIT;
- }
- else {
- ind |= MGA_TEX0_BIT;
- }
- }
- else if (ctx->Texture._EnabledUnits & 0x1) {
- /* unit 0 enabled */
- ind |= MGA_TEX0_BIT;
- }
-
- mmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = mga_interp_extras;
- tnl->Driver.Render.CopyPV = mga_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != mmesa->vertex_format) {
- FLUSH_BATCH(mmesa);
- mmesa->dirty |= MGA_UPLOAD_PIPE;
- mmesa->vertex_format = setup_tab[ind].vertex_format;
- mmesa->vertex_size = setup_tab[ind].vertex_size;
- mmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-
-void mga_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint vertex_size = mmesa->vertex_size * 4;
- GLuint *dest = mgaAllocDmaLow( mmesa, (count-start) * vertex_size);
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-}
-
-
-
-void mgaInitVB( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- mmesa->verts = (char *)ALIGN_MALLOC(size * sizeof(mgaVertex), 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-
- mmesa->dirty |= MGA_UPLOAD_PIPE;
- mmesa->vertex_format = setup_tab[0].vertex_format;
- mmesa->vertex_size = setup_tab[0].vertex_size;
- mmesa->vertex_stride_shift = setup_tab[0].vertex_stride_shift;
-}
-
-
-void mgaFreeVB( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- if (mmesa->verts) {
- ALIGN_FREE(mmesa->verts);
- mmesa->verts = 0;
- }
-
- if (mmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(mmesa->UbyteSecondaryColor.Ptr);
- mmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (mmesa->UbyteColor.Ptr) {
- ALIGN_FREE(mmesa->UbyteColor.Ptr);
- mmesa->UbyteColor.Ptr = 0;
- }
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.h b/xc/lib/GL/mesa/src/drv/mga/mgavb.h
deleted file mode 100644
index 88cc3108d..000000000
--- a/xc/lib/GL/mesa/src/drv/mga/mgavb.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.h,v 1.8 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef MGAVB_INC
-#define MGAVB_INC
-
-#include "mtypes.h"
-#include "mgacontext.h"
-#include "swrast/swrast.h"
-
-#define _MGA_NEW_RASTERSETUP (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void mgaChooseVertexState( GLcontext *ctx );
-extern void mgaCheckTexSizes( GLcontext *ctx );
-extern void mgaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-extern void mgaPrintSetupFlags(char *msg, GLuint flags );
-
-extern void mgaInitVB( GLcontext *ctx );
-extern void mgaFreeVB( GLcontext *ctx );
-
-extern void mga_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void mga_translate_vertex(GLcontext *ctx,
- const mgaVertex *src,
- SWvertex *dst);
-
-extern void mga_print_vertex( GLcontext *ctx, const mgaVertex *v );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
deleted file mode 100644
index 1c7e868ad..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.8 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_dd.h"
-#include "r128_state.h"
-#include "r128_span.h"
-#include "r128_tex.h"
-#include "r128_tris.h"
-#include "r128_vb.h"
-
-#include "vblank.h"
-#include "utils.h"
-#include "texmem.h"
-
-/* R128 configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_SECTION_END
-#if ENABLE_PERF_BOXES
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_PERFORMANCE_BOXES(false)
- DRI_CONF_SECTION_END
-#endif
-DRI_CONF_END;
-#if ENABLE_PERF_BOXES
-const GLuint __driNConfigOptions = 3;
-#else
-const GLuint __driNConfigOptions = 2;
-#endif
-
-#ifndef R128_DEBUG
-int R128_DEBUG = 0;
-#endif
-
-static const char * const card_extensions[] =
-{
- "GL_ARB_multitexture",
- "GL_ARB_texture_env_add",
- "GL_ARB_texture_mirrored_repeat",
- "GL_EXT_texture_edge_clamp",
- "GL_EXT_texture_env_add",
- "GL_IBM_texture_mirrored_repeat",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_edge_clamp",
- NULL
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "ioctl", DEBUG_VERBOSE_IOCTL },
- { "verb", DEBUG_VERBOSE_MSG },
- { "dri", DEBUG_VERBOSE_DRI },
- { "2d", DEBUG_VERBOSE_2D },
- { "sync", DEBUG_ALWAYS_SYNC },
- { "api", DEBUG_VERBOSE_API },
- { NULL, 0 }
-};
-
-/* Create the device specific context.
- */
-GLboolean r128CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- r128ContextPtr rmesa;
- r128ScreenPtr r128scrn;
- int i;
-
- /* Allocate the r128 context */
- rmesa = (r128ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((r128ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
- ctx = rmesa->glCtx;
-
- rmesa->driContext = driContextPriv;
- rmesa->driScreen = sPriv;
- rmesa->driDrawable = NULL;
- rmesa->hHWContext = driContextPriv->hHWContext;
- rmesa->driHwLock = &sPriv->pSAREA->lock;
- rmesa->driFd = sPriv->fd;
-
- r128scrn = rmesa->r128Screen = (r128ScreenPtr)(sPriv->private);
-
- /* Parse configuration files */
- driParseConfigFiles (&rmesa->optionCache, &r128scrn->optionCache,
- r128scrn->driScreen->myNum, "r128");
-
- rmesa->sarea = (R128SAREAPrivPtr)((char *)sPriv->pSAREA +
- r128scrn->sarea_priv_offset);
-
- rmesa->CurrentTexObj[0] = NULL;
- rmesa->CurrentTexObj[1] = NULL;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = r128scrn->numTexHeaps;
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- r128scrn->texSize[i],
- 12,
- R128_NR_TEX_REGIONS,
- rmesa->sarea->texList[i],
- & rmesa->sarea->texAge[i],
- & rmesa->swapped,
- sizeof( r128TexObj ),
- (destroy_texture_object_t *) r128DestroyTexObj );
-
- driSetTextureSwapCounterLocation( rmesa->texture_heaps[i],
- & rmesa->c_textureSwaps );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( r128scrn->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
-
- rmesa->RenderIndex = -1; /* Impossible value */
- rmesa->vert_buf = NULL;
- rmesa->num_verts = 0;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx->Const.MaxTextureUnits = 2;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 10, /* max 2D texture size is 1024x1024 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 11,
- GL_FALSE );
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* No wide lines.
- */
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
-#if ENABLE_PERF_BOXES
- rmesa->boxes = driQueryOptionb(&rmesa->optionCache, "performance_boxes");
-#endif
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
-/* _tnl_destroy_pipeline( ctx ); */
-/* _tnl_install_pipeline( ctx, r128_pipeline ); */
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (sPriv->drmMinor >= 4)
- _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
-
- r128InitVB( ctx );
- r128InitTriFuncs( ctx );
- r128DDInitDriverFuncs( ctx );
- r128DDInitIoctlFuncs( ctx );
- r128DDInitStateFuncs( ctx );
- r128DDInitSpanFuncs( ctx );
- r128DDInitTextureFuncs( ctx );
- r128DDInitState( rmesa );
-
- rmesa->vblank_flags = (rmesa->r128Screen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- driContextPriv->driverPrivate = (void *)rmesa;
-
-#if DO_DEBUG
- R128_DEBUG = driParseDebugString( getenv( "R128_DEBUG" ),
- debug_control );
-#endif
-
- return GL_TRUE;
-}
-
-/* Destroy the device specific context.
- */
-void r128DestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- r128ContextPtr rmesa = (r128ContextPtr) driContextPriv->driverPrivate;
-
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
-
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- r128FreeVB( rmesa->glCtx );
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(rmesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & rmesa->swapped ) );
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-
-#if 0
- /* Use this to force shared object profiling. */
- glx_fini_prof();
-#endif
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- GET_CURRENT_CONTEXT(ctx);
- r128ContextPtr oldR128Ctx = ctx ? R128_CONTEXT(ctx) : NULL;
- r128ContextPtr newR128Ctx = (r128ContextPtr) driContextPriv->driverPrivate;
-
- if ( newR128Ctx != oldR128Ctx ) {
- newR128Ctx->new_state |= R128_NEW_CONTEXT;
- newR128Ctx->dirty = R128_UPLOAD_ALL;
- }
-
- driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags );
- newR128Ctx->driDrawable = driDrawPriv;
-
- _mesa_make_current2( newR128Ctx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
-
- newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP;
-
- if ( !newR128Ctx->glCtx->Viewport.Width ) {
- _mesa_set_viewport(newR128Ctx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- } else {
- _mesa_make_current( 0, 0 );
- }
-
- return GL_TRUE;
-}
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-r128UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
deleted file mode 100644
index 3a908d7a1..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.12 2002/12/16 16:18:52 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_CONTEXT_H__
-#define __R128_CONTEXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "dri_util.h"
-
-#include "xf86drm.h"
-#include "r128_common.h"
-
-#include "mtypes.h"
-
-#include "r128_reg.h"
-
-#include "texmem.h"
-
-struct r128_context;
-typedef struct r128_context r128ContextRec;
-typedef struct r128_context *r128ContextPtr;
-
-#include "r128_lock.h"
-#include "r128_texobj.h"
-#include "r128_screen.h"
-
-/* Flags for what context state needs to be updated:
- */
-#define R128_NEW_ALPHA 0x0001
-#define R128_NEW_DEPTH 0x0002
-#define R128_NEW_FOG 0x0004
-#define R128_NEW_CLIP 0x0008
-#define R128_NEW_CULL 0x0010
-#define R128_NEW_MASKS 0x0020
-#define R128_NEW_RENDER_NOT 0x0040
-#define R128_NEW_WINDOW 0x0080
-#define R128_NEW_CONTEXT 0x0100
-#define R128_NEW_ALL 0x01ff
-
-/* Flags for software fallback cases:
- */
-#define R128_FALLBACK_TEXTURE 0x0001
-#define R128_FALLBACK_DRAW_BUFFER 0x0002
-#define R128_FALLBACK_READ_BUFFER 0x0004
-#define R128_FALLBACK_STENCIL 0x0008
-#define R128_FALLBACK_RENDER_MODE 0x0010
-#define R128_FALLBACK_MULTIDRAW 0x0020
-#define R128_FALLBACK_LOGICOP 0x0040
-#define R128_FALLBACK_SEP_SPECULAR 0x0080
-#define R128_FALLBACK_BLEND_EQ 0x0100
-#define R128_FALLBACK_BLEND_FUNC 0x0200
-
-
-/* Use the templated vertex format:
- */
-#define TAG(x) r128##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* Reasons why the GL_BLEND fallback mightn't work:
- */
-#define R128_BLEND_ENV_COLOR 0x1
-#define R128_BLEND_MULTITEX 0x2
-
-/* Subpixel offsets for window coordinates (triangles):
- */
-#define SUBPIXEL_X (0.0F)
-#define SUBPIXEL_Y (0.125F)
-
-
-typedef void (*r128_tri_func)( r128ContextPtr,
- r128Vertex *,
- r128Vertex *,
- r128Vertex * );
-
-typedef void (*r128_line_func)( r128ContextPtr,
- r128Vertex *,
- r128Vertex * );
-
-typedef void (*r128_point_func)( r128ContextPtr,
- r128Vertex * );
-
-
-struct r128_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- GLuint new_state;
- GLuint dirty; /* Hardware state to be updated */
- r128_context_regs_t setup;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- GLuint NewGLState;
- GLuint Fallback;
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLuint num_verts;
- GLubyte *verts;
-
- CARD32 ClearColor; /* Color used to clear color buffer */
- CARD32 ClearDepth; /* Value used to clear depth buffer */
- CARD32 ClearStencil; /* Value used to clear stencil */
-
- /* Map GL texture units onto hardware
- */
- GLint multitex;
- GLint tmu_source[2];
- GLuint tex_combine[2];
- GLuint blend_flags;
- GLuint env_color;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ R128_NR_TEX_HEAPS ];
- driTextureObject swapped;
-
- r128TexObjPtr CurrentTexObj[2];
-
- int texture_depth;
-
- /* Fallback rasterization functions
- */
- r128_point_func draw_point;
- r128_line_func draw_line;
- r128_tri_func draw_tri;
-
- /* Vertex buffers
- */
- drmBufPtr vert_buf;
-
- GLuint hw_primitive;
- GLenum render_primitive;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
-
- GLuint scissor;
- XF86DRIClipRectRec ScissorRect; /* Current software scissor */
-
- /* Mirrors of some DRI state
- */
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
-
- unsigned int lastStamp; /* mirror driDrawable->lastStamp */
-
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- r128ScreenPtr r128Screen; /* Screen private DRI data */
- R128SAREAPrivPtr sarea; /* Private SAREA data */
-
- /* Performance counters
- */
- GLuint boxes; /* Draw performance boxes */
- GLuint hardwareWentIdle;
- GLuint c_clears;
- GLuint c_drawWaits;
- GLuint c_textureSwaps;
- GLuint c_textureBytes;
- GLuint c_vertexBuffers;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define R128_CONTEXT(ctx) ((r128ContextPtr)(ctx->DriverCtx))
-
-#define R128_IS_PLAIN( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128)
-#define R128_IS_PRO( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_PRO)
-#define R128_IS_MOBILITY( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
-
-
-extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void r128DestroyContext( __DRIcontextPrivate * );
-
-extern GLboolean r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean r128UnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 0
-#define ENABLE_PERF_BOXES 0
-
-#if DO_DEBUG
-extern int R128_DEBUG;
-#else
-#define R128_DEBUG 0
-#endif
-
-#define DEBUG_ALWAYS_SYNC 0x01
-#define DEBUG_VERBOSE_API 0x02
-#define DEBUG_VERBOSE_MSG 0x04
-#define DEBUG_VERBOSE_LRU 0x08
-#define DEBUG_VERBOSE_DRI 0x10
-#define DEBUG_VERBOSE_IOCTL 0x20
-#define DEBUG_VERBOSE_2D 0x40
-
-#endif
-#endif /* __R128_CONTEXT_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
deleted file mode 100644
index b64c26b4b..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.15 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_state.h"
-#include "r128_vb.h"
-#include "r128_dd.h"
-
-#include "context.h"
-
-#include "utils.h"
-
-#define DRIVER_DATE "20030328"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void r128DDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->driDrawable->w;
- *height = rmesa->driDrawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- const char * card_name = "Rage 128";
- GLuint agp_mode = rmesa->r128Screen->IsPCI ? 0 :
- rmesa->r128Screen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"VA Linux Systems, Inc.";
-
- case GL_RENDERER:
- /* Select the spefic chipset.
- */
- if ( R128_IS_PRO( rmesa ) ) {
- card_name = "Rage 128 Pro";
- }
- else if ( R128_IS_MOBILITY( rmesa ) ) {
- card_name = "Rage 128 Mobility";
- }
-
- offset = driGetRendererString( buffer, card_name, DRIVER_DATE,
- agp_mode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Send all commands to the hardware. If vertex buffers or indirect
- * buffers are in use, then we need to make sure they are sent to the
- * hardware. All commands that are normally sent to the ring are
- * already considered `flushed'.
- */
-static void r128DDFlush( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
-#if ENABLE_PERF_BOXES
- if ( rmesa->boxes ) {
- LOCK_HARDWARE( rmesa );
- r128PerformanceBoxesLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- }
-
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-static void r128DDFinish( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- rmesa->c_drawWaits++;
-#endif
-
- r128DDFlush( ctx );
- r128WaitForIdle( rmesa );
-}
-
-
-/* Initialize the driver's misc functions.
- */
-void r128DDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = r128DDGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = r128DDGetString;
- ctx->Driver.Finish = r128DDFinish;
- ctx->Driver.Flush = r128DDFlush;
- ctx->Driver.Error = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.h b/xc/lib/GL/mesa/src/drv/r128/r128_dd.h
deleted file mode 100644
index b8fc7ad9b..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.h,v 1.3 2001/01/08 01:07:20 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_DD_H__
-#define __R128_DD_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r128DDInitDriverFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
deleted file mode 100644
index 192418c72..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.10 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-
-#include "vblank.h"
-
-#define R128_TIMEOUT 2048
-#define R128_IDLE_RETRY 32
-
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-/* Get a new VB from the pool of vertex buffers in AGP space.
- */
-drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa )
-{
- int fd = rmesa->r128Screen->driScreen->fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- drmBufPtr buf = NULL;
- int to = 0;
- int ret;
-
- dma.context = rmesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = R128_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- while ( !buf && ( to++ < R128_TIMEOUT ) ) {
- ret = drmDMA( fd, &dma );
-
- if ( ret == 0 ) {
- buf = &rmesa->r128Screen->buffers->list[index];
- buf->used = 0;
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- rmesa->c_vertexBuffers++;
-#endif
- return buf;
- }
- }
-
- if ( !buf ) {
- drmCommandNone( fd, DRM_R128_CCE_RESET);
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Could not get new VB... exiting\n" );
- exit( -1 );
- }
-
- return buf;
-}
-
-void r128FlushVerticesLocked( r128ContextPtr rmesa )
-{
- XF86DRIClipRectPtr pbox = rmesa->pClipRects;
- int nbox = rmesa->numClipRects;
- drmBufPtr buffer = rmesa->vert_buf;
- int count = rmesa->num_verts;
- int prim = rmesa->hw_primitive;
- int fd = rmesa->driScreen->fd;
- drmR128Vertex vertex;
- int i;
-
- rmesa->num_verts = 0;
- rmesa->vert_buf = NULL;
-
- if ( !buffer )
- return;
-
- if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS )
- r128EmitHwStateLocked( rmesa );
-
- if ( !nbox )
- count = 0;
-
- if ( nbox >= R128_NR_SAREA_CLIPRECTS )
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
-
- if ( !count || !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- vertex.prim = prim;
- vertex.idx = buffer->idx;
- vertex.count = count;
- vertex.discard = 1;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(drmR128Vertex) );
- }
- else
- {
- for ( i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- int discard = 0;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- }
-
- /* Finished with the buffer?
- */
- if ( nr == nbox ) {
- discard = 1;
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- vertex.prim = prim;
- vertex.idx = buffer->idx;
- vertex.count = count;
- vertex.discard = discard;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(drmR128Vertex) );
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-
-
-
-
-/* ================================================================
- * Texture uploads
- */
-
-void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height )
-{
- drmR128Blit blit;
- GLint ret;
-
- blit.idx = buffer->idx;
- blit.offset = offset;
- blit.pitch = pitch;
- blit.format = format;
- blit.x = x;
- blit.y = y;
- blit.width = width;
- blit.height = height;
-
- ret = drmCommandWrite( rmesa->driFd, DRM_R128_BLIT,
- &blit, sizeof(drmR128Blit) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_BLIT: return = %d\n", ret );
- exit( 1 );
- }
-}
-
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static void delay( void ) {
-/* Prevent an optimizing compiler from removing a spin loop */
-}
-
-#define R128_MAX_OUTSTANDING 2
-
-/* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- * GH: We probably don't want a timeout here, as we can wait as
- * long as we want for a frame to complete. If it never does, then
- * the card has locked.
- */
-static int r128WaitForFrameCompletion( r128ContextPtr rmesa )
-{
- unsigned char *R128MMIO = rmesa->r128Screen->mmio.map;
- CARD32 frame;
- int i;
- int wait = 0;
-
- while ( 1 ) {
- frame = INREG( R128_LAST_FRAME_REG );
- if ( rmesa->sarea->last_frame - frame <= R128_MAX_OUTSTANDING ) {
- break;
- }
-
- /* Spin in place a bit so we aren't hammering the register */
- wait++;
- for ( i = 0 ; i < 1024 ; i++ ) {
- delay();
- }
- }
-
- return wait;
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void r128CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- r128ContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "\n********************************\n" );
- fprintf( stderr, "\n%s( %p )\n\n",
- __FUNCTION__, rmesa->glCtx );
- fflush( stderr );
- }
-
- FLUSH_BATCH( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- if ( !r128WaitForFrameCompletion( rmesa ) ) {
- rmesa->hardwareWentIdle = 1;
- } else {
- rmesa->hardwareWentIdle = 0;
- }
-
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , nbox );
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = *(XF86DRIClipRectRec *)&box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->driFd, DRM_R128_SWAP );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_SWAP: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- if ( R128_DEBUG & DEBUG_ALWAYS_SYNC ) {
- i = 0;
- do {
- ret = drmCommandNone(rmesa->driFd, DRM_R128_CCE_IDLE);
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
- }
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_CLIPRECTS);
-
-#if ENABLE_PERF_BOXES
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-void r128PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- r128ContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "\n%s( %p ): page=%d\n\n",
- __FUNCTION__, rmesa->glCtx, rmesa->sarea->pfCurrentPage );
- }
-
- FLUSH_BATCH( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- if ( !r128WaitForFrameCompletion( rmesa ) ) {
- rmesa->hardwareWentIdle = 1;
- } else {
- rmesa->hardwareWentIdle = 0;
- }
-
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target );
- LOCK_HARDWARE( rmesa );
-
- /* The kernel will have been initialized to perform page flipping
- * on a swapbuffers ioctl.
- */
- ret = drmCommandNone( rmesa->driFd, DRM_R128_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_R128_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- }
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-
- /* FIXME: Do we need this anymore? */
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_CLIPRECTS);
-
-#if ENABLE_PERF_BOXES
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-
-static void r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable;
- drmR128Clear clear;
- GLuint flags = 0;
- GLint i;
- GLint ret;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( rmesa );
-
- /* The only state change we care about here is the RGBA colormask
- * We'll just update that state, if needed. If we do more then
- * there's some strange side-effects that the conformance tests find.
- */
- if ( rmesa->new_state & R128_NEW_MASKS) {
- const GLuint save_state = rmesa->new_state;
- rmesa->new_state = R128_NEW_MASKS;
- r128DDUpdateHWState( ctx );
- rmesa->new_state = save_state & ~R128_NEW_MASKS;
- }
-
- if ( mask & DD_FRONT_LEFT_BIT ) {
- flags |= DRM_R128_FRONT_BUFFER;
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if ( mask & DD_BACK_LEFT_BIT ) {
- flags |= DRM_R128_BACK_BUFFER;
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) {
- flags |= DRM_R128_DEPTH_BUFFER;
- mask &= ~DD_DEPTH_BIT;
- }
-#if 0
- /* FIXME: Add stencil support */
- if ( mask & DD_STENCIL_BIT ) {
- flags |= DRM_R128_DEPTH_BUFFER;
- mask &= ~DD_STENCIL_BIT;
- }
-#endif
-
- if ( flags ) {
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Do we actually need this?
- */
- if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS ) {
- r128EmitHwStateLocked( rmesa );
- }
-
- for ( i = 0 ; i < rmesa->numClipRects ; ) {
- GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , rmesa->numClipRects );
- XF86DRIClipRectPtr box = rmesa->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = *(XF86DRIClipRectPtr)&box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) {
- fprintf( stderr,
- "DRM_R128_CLEAR: flag 0x%x color %x depth %x nbox %d\n",
- flags,
- (GLuint)rmesa->ClearColor,
- (GLuint)rmesa->ClearDepth,
- rmesa->sarea->nbox );
- }
-
- clear.flags = flags;
- clear.clear_color = rmesa->ClearColor;
- clear.clear_depth = rmesa->ClearDepth;
- clear.color_mask = rmesa->setup.plane_3d_mask_c;
- clear.depth_mask = ~0;
-
- ret = drmCommandWrite( rmesa->driFd, DRM_R128_CLEAR,
- &clear, sizeof(drmR128Clear) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-/* ================================================================
- * Depth spans, pixels
- */
-
-void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y,
- const GLdepth depth[],
- const GLubyte mask[] )
-{
- XF86DRIClipRectPtr pbox = rmesa->pClipRects;
- drmR128Depth d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = DRM_R128_WRITE_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
-
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = DRM_R128_WRITE_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[],
- const GLubyte mask[] )
-{
- XF86DRIClipRectPtr pbox = rmesa->pClipRects;
- drmR128Depth d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = DRM_R128_WRITE_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = DRM_R128_WRITE_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y )
-{
- XF86DRIClipRectPtr pbox = rmesa->pClipRects;
- drmR128Depth d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = DRM_R128_READ_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = DRM_R128_READ_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[] )
-{
- XF86DRIClipRectPtr pbox = rmesa->pClipRects;
- drmR128Depth d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = DRM_R128_READ_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = DRM_R128_READ_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-
-void r128WaitForIdleLocked( r128ContextPtr rmesa )
-{
- int fd = rmesa->r128Screen->driScreen->fd;
- int to = 0;
- int ret, i;
-
- do {
- i = 0;
- do {
- ret = drmCommandNone( fd, DRM_R128_CCE_IDLE);
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
- } while ( ( ret == -EBUSY ) && ( to++ < R128_TIMEOUT ) );
-
- if ( ret < 0 ) {
- drmCommandNone( fd, DRM_R128_CCE_RESET);
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Rage 128 timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-void r128DDInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = r128DDClear;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h
deleted file mode 100644
index b0f6b363a..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h,v 1.6 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_IOCTL_H__
-#define __R128_IOCTL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r128_dri.h"
-#include "r128_reg.h"
-#include "r128_lock.h"
-
-#include "xf86drm.h"
-#include "r128_common.h"
-
-#define R128_BUFFER_MAX_DWORDS (R128_BUFFER_SIZE / sizeof(CARD32))
-
-
-extern drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa );
-extern void r128FlushVerticesLocked( r128ContextPtr rmesa );
-
-static __inline void *r128AllocDmaLow( r128ContextPtr rmesa, int bytes )
-{
- CARD32 *head;
-
- if ( !rmesa->vert_buf ) {
- LOCK_HARDWARE( rmesa );
- rmesa->vert_buf = r128GetBufferLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- } else if ( rmesa->vert_buf->used + bytes > rmesa->vert_buf->total ) {
- LOCK_HARDWARE( rmesa );
- r128FlushVerticesLocked( rmesa );
- rmesa->vert_buf = r128GetBufferLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- }
-
- head = (CARD32 *)((char *)rmesa->vert_buf->address + rmesa->vert_buf->used);
- rmesa->vert_buf->used += bytes;
- return head;
-}
-
-extern void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height );
-
-extern void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y,
- const GLdepth depth[],
- const GLubyte mask[] );
-extern void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[],
- const GLubyte mask[] );
-extern void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y );
-extern void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[] );
-
-extern void r128CopyBuffer( const __DRIdrawablePrivate *dPriv );
-extern void r128PageFlip( const __DRIdrawablePrivate *dPriv );
-void r128WaitForVBlank( r128ContextPtr rmesa );
-
-extern void r128WaitForIdleLocked( r128ContextPtr rmesa );
-
-
-extern void r128DDInitIoctlFuncs( GLcontext *ctx );
-
-
-/* ================================================================
- * Helper macros:
- */
-
-#define FLUSH_BATCH( rmesa ) \
-do { \
- if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) \
- fprintf( stderr, "FLUSH_BATCH in %s\n", __FUNCTION__ ); \
- if ( rmesa->vert_buf ) { \
- r128FlushVertices( rmesa ); \
- } \
-} while (0)
-
-/* 64-bit align the next element address, and then make room for the
- * next indexed prim packet header.
- */
-#define ALIGN_NEXT_ELT( rmesa ) \
-do { \
- rmesa->next_elt = (GLushort *) \
- (((GLuint)rmesa->next_elt + 7) & ~0x7); \
- rmesa->next_elt = (GLushort *) \
- ((GLubyte *)rmesa->next_elt + R128_INDEX_PRIM_OFFSET); \
-} while (0)
-
-#define r128FlushVertices( rmesa ) \
-do { \
- LOCK_HARDWARE( rmesa ); \
- r128FlushVerticesLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
-} while (0)
-
-#define r128FlushElts( rmesa ) \
-do { \
- LOCK_HARDWARE( rmesa ); \
- r128FlushEltsLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
-} while (0)
-
-#define r128WaitForIdle( rmesa ) \
- do { \
- LOCK_HARDWARE( rmesa ); \
- r128WaitForIdleLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
- } while (0)
-
-#endif
-#endif /* __R128_IOCTL_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c
deleted file mode 100644
index 12eb0128b..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.5 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_lock.h"
-#include "r128_tex.h"
-#include "r128_state.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-r128UpdatePageFlipping( r128ContextPtr rmesa )
-{
- int use_back;
-
- rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API )
- fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
- rmesa->doPageFlip,
- rmesa->sarea->pfCurrentPage );
-
- if ( use_back ) {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
- }
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-}
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void r128GetLock( r128ContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable;
- __DRIscreenPrivate *sPriv = rmesa->driScreen;
- R128SAREAPrivPtr sarea = rmesa->sarea;
- int i;
-
- drmGetLock( rmesa->driFd, rmesa->hHWContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( rmesa->lastStamp != dPriv->lastStamp ) {
- r128UpdatePageFlipping( rmesa );
- rmesa->lastStamp = dPriv->lastStamp;
- rmesa->new_state |= R128_NEW_CLIP;
- rmesa->SetupNewInputs = ~0;
- }
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_CLIPRECTS;
-
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
-
- if ( sarea->ctxOwner != rmesa->hHWContext ) {
- sarea->ctxOwner = rmesa->hHWContext;
- rmesa->dirty = R128_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[i] );
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h b/xc/lib/GL/mesa/src/drv/r128/r128_lock.h
deleted file mode 100644
index e734ba29d..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.4 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_LOCK_H__
-#define __R128_LOCK_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r128GetLock( r128ContextPtr rmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->driHwLock, rmesa->hHWContext, \
- (DRM_LOCK_HELD | rmesa->hHWContext), __ret ); \
- if ( __ret ) \
- r128GetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->driFd, \
- rmesa->driHwLock, \
- rmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
-#endif /* __R128_LOCK_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c
deleted file mode 100644
index a57472b98..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.9 2003/03/26 20:43:49 tsi Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_dri.h"
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_vb.h"
-
-#include "context.h"
-#include "imports.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#include "glxextensions.h"
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_RAGE128LE 0x4C45
-#define PCI_CHIP_RAGE128LF 0x4C46
-#define PCI_CHIP_RAGE128PF 0x5046
-#define PCI_CHIP_RAGE128PR 0x5052
-#define PCI_CHIP_RAGE128RE 0x5245
-#define PCI_CHIP_RAGE128RF 0x5246
-#define PCI_CHIP_RAGE128RK 0x524B
-#define PCI_CHIP_RAGE128RL 0x524C
-#endif
-
-
-/* Create the device specific screen private data struct.
- */
-static r128ScreenPtr
-r128CreateScreen( __DRIscreenPrivate *sPriv )
-{
- r128ScreenPtr r128Screen;
- R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv;
-
- if ( ! driCheckDriDdxDrmVersions( sPriv, "Rage128", 4, 0, 4, 0, 2, 2 ) )
- return NULL;
-
- /* Allocate the private area */
- r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) );
- if ( !r128Screen ) return NULL;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&r128Screen->optionCache);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- r128Screen->IsPCI = r128DRIPriv->IsPCI;
- r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset;
-
- if (sPriv->drmMinor >= 3) {
- drmR128GetParam gp;
- int ret;
-
- gp.param = R128_PARAM_IRQ_NR;
- gp.value = &r128Screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_R128_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmR128GetParam (R128_PARAM_IRQ_NR): %d\n", ret);
- FREE( r128Screen );
- return NULL;
- }
- }
-
- r128Screen->mmio.handle = r128DRIPriv->registerHandle;
- r128Screen->mmio.size = r128DRIPriv->registerSize;
- if ( drmMap( sPriv->fd,
- r128Screen->mmio.handle,
- r128Screen->mmio.size,
- (drmAddressPtr)&r128Screen->mmio.map ) ) {
- FREE( r128Screen );
- return NULL;
- }
-
- r128Screen->buffers = drmMapBufs( sPriv->fd );
- if ( !r128Screen->buffers ) {
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
- FREE( r128Screen );
- return NULL;
- }
-
- if ( !r128Screen->IsPCI ) {
- r128Screen->agpTextures.handle = r128DRIPriv->agpTexHandle;
- r128Screen->agpTextures.size = r128DRIPriv->agpTexMapSize;
- if ( drmMap( sPriv->fd,
- r128Screen->agpTextures.handle,
- r128Screen->agpTextures.size,
- (drmAddressPtr)&r128Screen->agpTextures.map ) ) {
- drmUnmapBufs( r128Screen->buffers );
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
- FREE( r128Screen );
- return NULL;
- }
- }
-
- switch ( r128DRIPriv->deviceID ) {
- case PCI_CHIP_RAGE128RE:
- case PCI_CHIP_RAGE128RF:
- case PCI_CHIP_RAGE128RK:
- case PCI_CHIP_RAGE128RL:
- r128Screen->chipset = R128_CARD_TYPE_R128;
- break;
- case PCI_CHIP_RAGE128PF:
- r128Screen->chipset = R128_CARD_TYPE_R128_PRO;
- break;
- case PCI_CHIP_RAGE128LE:
- case PCI_CHIP_RAGE128LF:
- r128Screen->chipset = R128_CARD_TYPE_R128_MOBILITY;
- break;
- default:
- r128Screen->chipset = R128_CARD_TYPE_R128;
- break;
- }
-
- r128Screen->cpp = r128DRIPriv->bpp / 8;
- r128Screen->AGPMode = r128DRIPriv->AGPMode;
-
- r128Screen->frontOffset = r128DRIPriv->frontOffset;
- r128Screen->frontPitch = r128DRIPriv->frontPitch;
- r128Screen->backOffset = r128DRIPriv->backOffset;
- r128Screen->backPitch = r128DRIPriv->backPitch;
- r128Screen->depthOffset = r128DRIPriv->depthOffset;
- r128Screen->depthPitch = r128DRIPriv->depthPitch;
- r128Screen->spanOffset = r128DRIPriv->spanOffset;
-
- r128Screen->texOffset[R128_CARD_HEAP] = r128DRIPriv->textureOffset;
- r128Screen->texSize[R128_CARD_HEAP] = r128DRIPriv->textureSize;
- r128Screen->logTexGranularity[R128_CARD_HEAP] = r128DRIPriv->log2TexGran;
-
- if ( r128Screen->IsPCI ) {
- r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1;
- r128Screen->texOffset[R128_AGP_HEAP] = 0;
- r128Screen->texSize[R128_AGP_HEAP] = 0;
- r128Screen->logTexGranularity[R128_AGP_HEAP] = 0;
- } else {
- r128Screen->numTexHeaps = R128_NR_TEX_HEAPS;
- r128Screen->texOffset[R128_AGP_HEAP] =
- r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET;
- r128Screen->texSize[R128_AGP_HEAP] = r128DRIPriv->agpTexMapSize;
- r128Screen->logTexGranularity[R128_AGP_HEAP] =
- r128DRIPriv->log2AGPTexGran;
- }
-
- r128Screen->driScreen = sPriv;
-
- if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
- void * const psc = sPriv->psc->screenConfigs;
-
- if ( glx_enable_extension != NULL ) {
- if ( r128Screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
- }
-
- return r128Screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-r128DestroyScreen( __DRIscreenPrivate *sPriv )
-{
- r128ScreenPtr r128Screen = (r128ScreenPtr)sPriv->private;
-
- if ( !r128Screen )
- return;
-
- if ( !r128Screen->IsPCI ) {
- drmUnmap( (drmAddress)r128Screen->agpTextures.map,
- r128Screen->agpTextures.size );
- }
- drmUnmapBufs( r128Screen->buffers );
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&r128Screen->optionCache);
-
- FREE( r128Screen );
- sPriv->private = NULL;
-}
-
-
-/* Initialize the fullscreen mode.
- */
-static GLboolean
-r128OpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-/* Copy the back color buffer to the front color buffer */
-static void
-r128SwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- r128ContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( rmesa->doPageFlip ) {
- r128PageFlip( dPriv );
- }
- else {
- r128CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-r128InitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) r128CreateScreen( sPriv );
-
- if ( !sPriv->private ) {
- r128DestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we register new extension functions with the dispatcher.
- *
- * \todo This interface has been deprecated, so we should probably remove
- * this function before the next XFree86 release.
- */
-void __driRegisterExtensions( void )
-{
- PFNGLXENABLEEXTENSIONPROC glx_enable_extension;
-
- if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) {
- glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC)
- glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" );
-
- if ( glx_enable_extension != NULL ) {
- glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE );
- glx_enable_extension( "GLX_SGI_video_sync", GL_FALSE );
- glx_enable_extension( "GLX_MESA_swap_control", GL_FALSE );
- }
- }
-}
-
-
-static struct __DriverAPIRec r128API = {
- .InitDriver = r128InitDriver,
- .DestroyScreen = r128DestroyScreen,
- .CreateContext = r128CreateContext,
- .DestroyContext = r128DestroyContext,
- .CreateBuffer = r128CreateBuffer,
- .DestroyBuffer = r128DestroyBuffer,
- .SwapBuffers = r128SwapBuffers,
- .MakeCurrent = r128MakeCurrent,
- .UnbindContext = r128UnbindContext,
- .OpenFullScreen = r128OpenCloseFullScreen,
- .CloseFullScreen = r128OpenCloseFullScreen,
- .GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &r128API);
- return (void *) psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h b/xc/lib/GL/mesa/src/drv/r128/r128_screen.h
deleted file mode 100644
index affe9e69e..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.7 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_SCREEN_H__
-#define __R128_SCREEN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r128_sarea.h"
-#include "xmlconfig.h"
-
-typedef struct {
- drmHandle handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- unsigned char *map; /* Mapping of the DRM region */
-} r128RegionRec, *r128RegionPtr;
-
-typedef struct {
-
- GLint chipset;
- GLint cpp;
- GLint IsPCI; /* Current card is a PCI card */
- GLint AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- GLuint frontOffset;
- GLuint frontPitch;
- GLuint backOffset;
- GLuint backPitch;
-
- GLuint depthOffset;
- GLuint depthPitch;
- GLuint spanOffset;
-
- /* Shared texture data */
- GLint numTexHeaps;
- GLint texOffset[R128_NR_TEX_HEAPS];
- GLint texSize[R128_NR_TEX_HEAPS];
- GLint logTexGranularity[R128_NR_TEX_HEAPS];
-
- r128RegionRec mmio;
- r128RegionRec agpTextures;
-
- drmBufMapPtr buffers;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-
-} r128ScreenRec, *r128ScreenPtr;
-
-
-#endif
-#endif /* __R128_SCREEN_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c
deleted file mode 100644
index c6f319594..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.8 2002/10/30 12:51:39 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_state.h"
-#include "r128_span.h"
-#include "r128_tex.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define HAVE_HW_DEPTH_SPANS 1
-#define HAVE_HW_DEPTH_PIXELS 1
-
-#define LOCAL_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = rmesa->r128Screen; \
- __DRIscreenPrivate *sPriv = rmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- GLuint pitch = r128scrn->frontPitch * r128scrn->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->drawOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->readOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = rmesa->r128Screen; \
- __DRIscreenPrivate *sPriv = rmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- GLuint height = dPriv->h; \
- (void) r128scrn; (void) sPriv; (void) height
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-
-#define HW_LOCK() \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- FLUSH_BATCH( rmesa ); \
- LOCK_HARDWARE( rmesa ); \
- r128WaitForIdleLocked( rmesa );
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK() \
- UNLOCK_HARDWARE( rmesa )
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = R128PACKCOLOR565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 8) & 0xf8; \
- rgba[1] = (p >> 3) & 0xfc; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 0xff; \
- if ( rgba[0] & 0x08 ) rgba[0] |= 0x07; \
- if ( rgba[1] & 0x04 ) rgba[1] |= 0x03; \
- if ( rgba[2] & 0x08 ) rgba[2] |= 0x07; \
- } while (0)
-
-#define TAG(x) r128##x##_RGB565
-#include "spantmp.h"
-
-#define READ_DEPTH(d, _x, _y) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch)
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = R128PACKCOLOR8888( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff;/*(p >> 24) & 0xff;*/ \
-} while (0)
-
-#define TAG(x) r128##x##_ARGB8888
-#include "spantmp.h"
-
-
-/* 24 bit, RGB888 color spanline and pixel functions */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = R128PACKCOLOR888( color[0], color[1], color[2] )
-
-#define WRITE_RGBA(_x, _y, r, g, b, a) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = ((r << 16) | \
- (g << 8) | \
- (b << 0))
-
-#define WRITE_PIXEL(_x, _y, p) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = p
-
-#define READ_RGBA(rgba, _x, _y) \
- do { \
- GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
- } while (0)
-
-/* ================================================================
- * Depth buffer
- */
-
-/* 16-bit depth buffer functions
- */
-#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y, \
- depth, mask );
-
-#define WRITE_DEPTH_PIXELS() \
-do { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- for ( i = 0 ; i < n ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- } \
- for ( i = 0 ; i < n ; i++ ) { \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
-} while (0)
-
-#define READ_DEPTH_SPAN() \
-do { \
- GLushort *buf = (GLushort *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i; \
- \
- r128ReadDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < n ; i++ ) { \
- depth[i] = buf[i]; \
- } \
-} while (0)
-
-#define READ_DEPTH_PIXELS() \
-do { \
- GLushort *buf = (GLushort *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i, remaining = n; \
- \
- while ( remaining > 0 ) { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- GLint count; \
- \
- if ( remaining <= 128 ) { \
- count = remaining; \
- } else { \
- count = 128; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- \
- r128ReadDepthPixelsLocked( rmesa, count, ox, oy ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < count ; i++ ) { \
- depth[i] = buf[i]; \
- } \
- depth += count; \
- x += count; \
- y += count; \
- remaining -= count; \
- } \
-} while (0)
-
-#define TAG(x) r128##x##_16
-#include "depthtmp.h"
-
-
-/* 24-bit depth, 8-bit stencil buffer functions
- */
-#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y, \
- depth, mask );
-
-#define WRITE_DEPTH_PIXELS() \
-do { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- for ( i = 0 ; i < n ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- } \
- for ( i = 0 ; i < n ; i++ ) { \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
-} while (0)
-
-#define READ_DEPTH_SPAN() \
-do { \
- GLuint *buf = (GLuint *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i; \
- \
- r128ReadDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < n ; i++ ) { \
- depth[i] = buf[i] & 0x00ffffff; \
- } \
-} while (0)
-
-#define READ_DEPTH_PIXELS() \
-do { \
- GLuint *buf = (GLuint *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i, remaining = n; \
- \
- while ( remaining > 0 ) { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- GLint count; \
- \
- if ( remaining <= 128 ) { \
- count = remaining; \
- } else { \
- count = 128; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- \
- r128ReadDepthPixelsLocked( rmesa, count, ox, oy ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < count ; i++ ) { \
- depth[i] = buf[i] & 0x00ffffff; \
- } \
- depth += count; \
- x += count; \
- y += count; \
- remaining -= count; \
- } \
-} while (0)
-
-#define TAG(x) r128##x##_24_8
-#include "depthtmp.h"
-
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* FIXME: Add support for hardware stencil buffers.
- */
-
-
-/* 32 bit depthbuffer functions */
-#define WRITE_DEPTH(_x, _y, d) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = d
-
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void r128DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
- break;
- case BACK_LEFT_BIT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- }
- break;
- default:
- break;
- }
-}
-
-
-void r128DDInitSpanFuncs( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = r128DDSetBuffer;
-
- switch ( rmesa->r128Screen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = r128WriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = r128WriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = r128WriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = r128ReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = r128ReadRGBAPixels_RGB565;
- break;
-
- case 4:
- swdd->WriteRGBASpan = r128WriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = r128WriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = r128WriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = r128ReadRGBASpan_ARGB8888;
- swdd->ReadRGBAPixels = r128ReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-
- switch ( rmesa->glCtx->Visual.depthBits ) {
- case 16:
- swdd->ReadDepthSpan = r128ReadDepthSpan_16;
- swdd->WriteDepthSpan = r128WriteDepthSpan_16;
- swdd->ReadDepthPixels = r128ReadDepthPixels_16;
- swdd->WriteDepthPixels = r128WriteDepthPixels_16;
- break;
-
- case 24:
- swdd->ReadDepthSpan = r128ReadDepthSpan_24_8;
- swdd->WriteDepthSpan = r128WriteDepthSpan_24_8;
- swdd->ReadDepthPixels = r128ReadDepthPixels_24_8;
- swdd->WriteDepthPixels = r128WriteDepthPixels_24_8;
- break;
-
- default:
- break;
- }
-
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.h b/xc/lib/GL/mesa/src/drv/r128/r128_span.h
deleted file mode 100644
index 44356c5b2..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_span.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.h,v 1.3 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_SPAN_H__
-#define __R128_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r128DDInitSpanFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.c b/xc/lib/GL/mesa/src/drv/r128/r128_state.c
deleted file mode 100644
index 110a16a83..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_state.c
+++ /dev/null
@@ -1,1239 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.11 2002/10/30 12:51:39 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_vb.h"
-#include "r128_tex.h"
-
-#include "context.h"
-#include "enums.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void r128UpdateAlphaMode( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint a = rmesa->setup.misc_3d_state_cntl_reg;
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Color.AlphaEnabled ) {
- GLubyte ref;
-
- CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
-
- a &= ~(R128_ALPHA_TEST_MASK | R128_REF_ALPHA_MASK);
-
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- a |= R128_ALPHA_TEST_NEVER;
- break;
- case GL_LESS:
- a |= R128_ALPHA_TEST_LESS;
- break;
- case GL_LEQUAL:
- a |= R128_ALPHA_TEST_LESSEQUAL;
- break;
- case GL_EQUAL:
- a |= R128_ALPHA_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- a |= R128_ALPHA_TEST_GREATEREQUAL;
- break;
- case GL_GREATER:
- a |= R128_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- a |= R128_ALPHA_TEST_NEQUAL;
- break;
- case GL_ALWAYS:
- a |= R128_ALPHA_TEST_ALWAYS;
- break;
- }
-
- a |= ref & R128_REF_ALPHA_MASK;
- t |= R128_ALPHA_TEST_ENABLE;
- } else {
- t &= ~R128_ALPHA_TEST_ENABLE;
- }
-
- FALLBACK( rmesa, R128_FALLBACK_BLEND_FUNC, GL_FALSE );
-
- if ( ctx->Color.BlendEnabled ) {
- a &= ~(R128_ALPHA_BLEND_SRC_MASK | R128_ALPHA_BLEND_DST_MASK);
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- a |= R128_ALPHA_BLEND_SRC_ZERO;
- break;
- case GL_ONE:
- a |= R128_ALPHA_BLEND_SRC_ONE;
- break;
- case GL_DST_COLOR:
- a |= R128_ALPHA_BLEND_SRC_DESTCOLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- a |= R128_ALPHA_BLEND_SRC_INVDESTCOLOR;
- break;
- case GL_SRC_ALPHA:
- a |= R128_ALPHA_BLEND_SRC_SRCALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- a |= R128_ALPHA_BLEND_SRC_INVSRCALPHA;
- break;
- case GL_DST_ALPHA:
- a |= R128_ALPHA_BLEND_SRC_DESTALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- a |= R128_ALPHA_BLEND_SRC_INVDESTALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- a |= R128_ALPHA_BLEND_SRC_SRCALPHASAT;
- break;
- default:
- FALLBACK( rmesa, R128_FALLBACK_BLEND_FUNC, GL_TRUE );
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- a |= R128_ALPHA_BLEND_DST_ZERO;
- break;
- case GL_ONE:
- a |= R128_ALPHA_BLEND_DST_ONE;
- break;
- case GL_SRC_COLOR:
- a |= R128_ALPHA_BLEND_DST_SRCCOLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- a |= R128_ALPHA_BLEND_DST_INVSRCCOLOR;
- break;
- case GL_SRC_ALPHA:
- a |= R128_ALPHA_BLEND_DST_SRCALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- a |= R128_ALPHA_BLEND_DST_INVSRCALPHA;
- break;
- case GL_DST_ALPHA:
- a |= R128_ALPHA_BLEND_DST_DESTALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- a |= R128_ALPHA_BLEND_DST_INVDESTALPHA;
- break;
- default:
- FALLBACK( rmesa, R128_FALLBACK_BLEND_FUNC, GL_TRUE );
- }
-
- t |= R128_ALPHA_ENABLE;
- } else {
- t &= ~R128_ALPHA_ENABLE;
- }
-
- if ( rmesa->setup.misc_3d_state_cntl_reg != a ) {
- rmesa->setup.misc_3d_state_cntl_reg = a;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
-}
-
-static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-static void r128DDBlendEquation( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK( R128_CONTEXT(ctx), R128_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-
- /* Can only do blend addition, not min, max, subtract, etc. */
- FALLBACK( R128_CONTEXT(ctx), R128_FALLBACK_BLEND_EQ,
- mode != GL_FUNC_ADD_EXT);
-
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-static void r128DDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-static void r128DDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void r128UpdateZMode( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint z = rmesa->setup.z_sten_cntl_c;
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Depth.Test ) {
- z &= ~R128_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- z |= R128_Z_TEST_NEVER;
- break;
- case GL_ALWAYS:
- z |= R128_Z_TEST_ALWAYS;
- break;
- case GL_LESS:
- z |= R128_Z_TEST_LESS;
- break;
- case GL_LEQUAL:
- z |= R128_Z_TEST_LESSEQUAL;
- break;
- case GL_EQUAL:
- z |= R128_Z_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- z |= R128_Z_TEST_GREATEREQUAL;
- break;
- case GL_GREATER:
- z |= R128_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- z |= R128_Z_TEST_NEQUAL;
- break;
- }
-
- t |= R128_Z_ENABLE;
- } else {
- t &= ~R128_Z_ENABLE;
- }
-
- if ( ctx->Depth.Mask ) {
- t |= R128_Z_WRITE_ENABLE;
- } else {
- t &= ~R128_Z_WRITE_ENABLE;
- }
-
- if ( rmesa->setup.z_sten_cntl_c != z ) {
- rmesa->setup.z_sten_cntl_c = z;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDDepthFunc( GLcontext *ctx, GLenum func )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
-}
-
-static void r128DDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
-}
-
-static void r128DDClearDepth( GLcontext *ctx, GLclampd d )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- switch ( rmesa->setup.z_sten_cntl_c & R128_Z_PIX_WIDTH_MASK ) {
- case R128_Z_PIX_WIDTH_16:
- rmesa->ClearDepth = d * 0x0000ffff;
- break;
- case R128_Z_PIX_WIDTH_24:
- rmesa->ClearDepth = d * 0x00ffffff;
- break;
- case R128_Z_PIX_WIDTH_32:
- rmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-static void r128UpdateFogAttrib( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint t = rmesa->setup.tex_cntl_c;
- GLubyte c[4];
- GLuint col;
-
- if ( ctx->Fog.Enabled ) {
- t |= R128_FOG_ENABLE;
- } else {
- t &= ~R128_FOG_ENABLE;
- }
-
- c[0] = FLOAT_TO_UBYTE( ctx->Fog.Color[0] );
- c[1] = FLOAT_TO_UBYTE( ctx->Fog.Color[1] );
- c[2] = FLOAT_TO_UBYTE( ctx->Fog.Color[2] );
-
- col = r128PackColor( 4, c[0], c[1], c[2], 0 );
-
- if ( rmesa->setup.fog_color_c != col ) {
- rmesa->setup.fog_color_c = col;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_FOG;
-}
-
-
-/* =============================================================
- * Clipping
- */
-
-static void r128UpdateClipping( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( rmesa->driDrawable ) {
- __DRIdrawablePrivate *drawable = rmesa->driDrawable;
- int x1 = 0;
- int y1 = 0;
- int x2 = drawable->w - 1;
- int y2 = drawable->h - 1;
-
- if ( ctx->Scissor.Enabled ) {
- if ( ctx->Scissor.X > x1 ) {
- x1 = ctx->Scissor.X;
- }
- if ( drawable->h - ctx->Scissor.Y - ctx->Scissor.Height > y1 ) {
- y1 = drawable->h - ctx->Scissor.Y - ctx->Scissor.Height;
- }
- if ( ctx->Scissor.X + ctx->Scissor.Width - 1 < x2 ) {
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- }
- if ( drawable->h - ctx->Scissor.Y - 1 < y2 ) {
- y2 = drawable->h - ctx->Scissor.Y - 1;
- }
- }
-
- x1 += drawable->x;
- y1 += drawable->y;
- x2 += drawable->x;
- y2 += drawable->y;
-
- rmesa->setup.sc_top_left_c = ((y1 << 16) | x1);
- rmesa->setup.sc_bottom_right_c = ((y2 << 16) | x2);
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CLIP;
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void r128UpdateCull( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint f = rmesa->setup.pm4_vc_fpu_setup;
-
- f &= ~R128_FRONT_DIR_MASK;
-
- switch ( ctx->Polygon.FrontFace ) {
- case GL_CW:
- f |= R128_FRONT_DIR_CW;
- break;
- case GL_CCW:
- f |= R128_FRONT_DIR_CCW;
- break;
- }
-
- f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID;
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- f &= ~R128_FRONTFACE_SOLID;
- break;
- case GL_BACK:
- f &= ~R128_BACKFACE_SOLID;
- break;
- case GL_FRONT_AND_BACK:
- f &= ~(R128_BACKFACE_SOLID |
- R128_FRONTFACE_SOLID);
- break;
- }
- }
-
- if ( 1 || rmesa->setup.pm4_vc_fpu_setup != f ) {
- rmesa->setup.pm4_vc_fpu_setup = f;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_SETUP;
- }
-}
-
-static void r128DDCullFace( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
-}
-
-static void r128DDFrontFace( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
-}
-
-
-/* =============================================================
- * Masks
- */
-
-static void r128UpdateMasks( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- GLuint mask = r128PackColor( rmesa->r128Screen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if ( rmesa->setup.plane_3d_mask_c != mask ) {
- rmesa->setup.plane_3d_mask_c = mask;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
-}
-
-static void r128DDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_MASKS;
-}
-
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-static void updateSpecularLighting( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Light.Enabled) {
- /* XXX separate specular color just doesn't seem to work as it should.
- * For now, we fall back to s/w rendering whenever separate specular
- * is enabled.
- */
-#if 0
- if (ctx->Light.ShadeModel == GL_FLAT) {
- /* R128 can't do flat-shaded separate specular */
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_TRUE );
- /*printf("%s fallback sep spec\n", __FUNCTION__);*/
- }
- else {
- t |= R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_FALSE );
- /*printf("%s enable sep spec\n", __FUNCTION__);*/
- }
-#else
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_TRUE );
- /*printf("%s fallback sep spec\n", __FUNCTION__);*/
-#endif
- }
- else {
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_FALSE );
- /*printf("%s disable sep spec\n", __FUNCTION__);*/
- }
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_SETUP;
- rmesa->new_state |= R128_NEW_CONTEXT;
- }
-}
-
-
-static void r128DDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
- FLUSH_BATCH( rmesa );
- updateSpecularLighting(ctx);
- }
-}
-
-static void r128DDShadeModel( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint s = rmesa->setup.pm4_vc_fpu_setup;
-
- s &= ~R128_FPU_COLOR_MASK;
-
- switch ( mode ) {
- case GL_FLAT:
- s |= R128_FPU_COLOR_FLAT;
- break;
- case GL_SMOOTH:
- s |= R128_FPU_COLOR_GOURAUD;
- break;
- default:
- return;
- }
-
- updateSpecularLighting(ctx);
-
- if ( rmesa->setup.pm4_vc_fpu_setup != s ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.pm4_vc_fpu_setup = s;
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_SETUP;
- }
-}
-
-
-/* =============================================================
- * Window position
- */
-
-void r128UpdateWindow( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- int x = rmesa->driDrawable->x;
- int y = rmesa->driDrawable->y;
-
- rmesa->setup.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) |
- (x << R128_WINDOW_X_SHIFT));
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_WINDOW;
-}
-
-/* =============================================================
- * Viewport
- */
-
-
-static void r128CalcViewport( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = rmesa->hw_viewport;
-
- /* See also r128_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + rmesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * rmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * rmesa->depth_scale;
-}
-
-static void r128Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- r128CalcViewport( ctx );
-}
-
-static void r128DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- r128CalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void r128DDClearColor( GLcontext *ctx,
- const GLfloat color[4] )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLubyte c[4];
-
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- rmesa->ClearColor = r128PackColor( rmesa->r128Screen->cpp,
- c[0], c[1], c[2], c[3] );
-}
-
-static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( ctx->Color.ColorLogicOpEnabled ) {
- FLUSH_BATCH( rmesa );
-
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP, opcode != GL_COPY );
- }
-}
-
-static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BACK_LEFT_BIT:
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_TRUE );
- break;
- }
-
- /* We want to update the s/w rast state too so that r128DDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-}
-
-static void r128DDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * Polygon stipple
- */
-
-static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint stipple[32], i;
- drmR128Stipple stippleRec;
-
- for (i = 0; i < 32; i++) {
- stipple[31 - i] = ((mask[i*4+0] << 24) |
- (mask[i*4+1] << 16) |
- (mask[i*4+2] << 8) |
- (mask[i*4+3]));
- }
-
- FLUSH_BATCH( rmesa );
- LOCK_HARDWARE( rmesa );
-
- stippleRec.mask = stipple;
- drmCommandWrite( rmesa->driFd, DRM_R128_STIPPLE,
- &stippleRec, sizeof(drmR128Stipple) );
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-}
-
-
-/* =============================================================
- * Render mode
- */
-
-static void r128DDRenderMode( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- FALLBACK( rmesa, R128_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s = %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
- }
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
- break;
-
- case GL_BLEND:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-
- /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- do {
- GLuint t = rmesa->setup.tex_cntl_c;
- FLUSH_BATCH( rmesa );
-
- if ( ctx->Color.DitherFlag ) {
- t |= R128_DITHER_ENABLE;
- } else {
- t &= ~R128_DITHER_ENABLE;
- }
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- } while (0);
- break;
-
- case GL_FOG:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_FOG;
- break;
-
- case GL_COLOR_LOGIC_OP:
- FLUSH_BATCH( rmesa );
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP,
- state && ctx->Color.LogicOp != GL_COPY );
- break;
-
- case GL_LIGHTING:
- updateSpecularLighting(ctx);
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->scissor = state;
- rmesa->new_state |= R128_NEW_CLIP;
- break;
-
- case GL_STENCIL_TEST:
- FLUSH_BATCH( rmesa );
- FALLBACK( rmesa, R128_FALLBACK_STENCIL, state );
- break;
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- FLUSH_BATCH( rmesa );
- break;
-
- case GL_POLYGON_STIPPLE:
- if ( rmesa->render_primitive == GL_TRIANGLES ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE;
- if ( state ) {
- rmesa->setup.dp_gui_master_cntl_c |=
- R128_GMC_BRUSH_32x32_MONO_FG_LA;
- } else {
- rmesa->setup.dp_gui_master_cntl_c |=
- R128_GMC_BRUSH_SOLID_COLOR;
- }
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- break;
-
- default:
- return;
- }
-}
-
-
-/* =============================================================
- * State initialization, management
- */
-
-static void r128DDPrintDirty( const char *msg, GLuint state )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n",
- msg,
- state,
- (state & R128_UPLOAD_CORE) ? "core, " : "",
- (state & R128_UPLOAD_CONTEXT) ? "context, " : "",
- (state & R128_UPLOAD_SETUP) ? "setup, " : "",
- (state & R128_UPLOAD_TEX0) ? "tex0, " : "",
- (state & R128_UPLOAD_TEX1) ? "tex1, " : "",
- (state & R128_UPLOAD_MASKS) ? "masks, " : "",
- (state & R128_UPLOAD_WINDOW) ? "window, " : "",
- (state & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "",
- (state & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" );
-}
-
-/*
- * Load the current context's state into the hardware.
- *
- * NOTE: Be VERY careful about ensuring the context state is marked for
- * upload, the only place it shouldn't be uploaded is when the setup
- * state has changed in ReducedPrimitiveChange as this comes right after
- * a state update.
- *
- * Blits of any type should always upload the context and masks after
- * they are done.
- */
-void r128EmitHwStateLocked( r128ContextPtr rmesa )
-{
- R128SAREAPrivPtr sarea = rmesa->sarea;
- r128_context_regs_t *regs = &(rmesa->setup);
- const r128TexObjPtr t0 = rmesa->CurrentTexObj[0];
- const r128TexObjPtr t1 = rmesa->CurrentTexObj[1];
-
- if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) {
- r128DDPrintDirty( "r128EmitHwStateLocked", rmesa->dirty );
- }
-
- if ( rmesa->dirty & (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_SETUP |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_WINDOW |
- R128_UPLOAD_CORE) ) {
- memcpy( &sarea->ContextState, regs, sizeof(sarea->ContextState) );
- }
-
- if ( (rmesa->dirty & R128_UPLOAD_TEX0) && t0 ) {
- r128_texture_regs_t *tex = &sarea->TexState[0];
-
- tex->tex_cntl = t0->setup.tex_cntl;
- tex->tex_combine_cntl = rmesa->tex_combine[0];
- tex->tex_size_pitch = t0->setup.tex_size_pitch;
- memcpy( &tex->tex_offset[0], &t0->setup.tex_offset[0],
- sizeof(tex->tex_offset ) );
- tex->tex_border_color = t0->setup.tex_border_color;
- }
-
- if ( (rmesa->dirty & R128_UPLOAD_TEX1) && t1 ) {
- r128_texture_regs_t *tex = &sarea->TexState[1];
-
- tex->tex_cntl = t1->setup.tex_cntl;
- tex->tex_combine_cntl = rmesa->tex_combine[1];
- tex->tex_size_pitch = t1->setup.tex_size_pitch;
- memcpy( &tex->tex_offset[0], &t1->setup.tex_offset[0],
- sizeof(tex->tex_offset ) );
- tex->tex_border_color = t1->setup.tex_border_color;
- }
-
- sarea->vertsize = rmesa->vertex_size;
- sarea->vc_format = rmesa->vertex_format;
-
- /* Turn off the texture cache flushing */
- rmesa->setup.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH;
-
- sarea->dirty |= rmesa->dirty;
- rmesa->dirty &= R128_UPLOAD_CLIPRECTS;
-}
-
-static void r128DDPrintState( const char *msg, GLuint flags )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & R128_NEW_CONTEXT) ? "context, " : "",
- (flags & R128_NEW_ALPHA) ? "alpha, " : "",
- (flags & R128_NEW_DEPTH) ? "depth, " : "",
- (flags & R128_NEW_FOG) ? "fog, " : "",
- (flags & R128_NEW_CLIP) ? "clip, " : "",
- (flags & R128_NEW_CULL) ? "cull, " : "",
- (flags & R128_NEW_MASKS) ? "masks, " : "",
- (flags & R128_NEW_WINDOW) ? "window, " : "" );
-}
-
-void r128DDUpdateHWState( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- int new_state = rmesa->new_state;
-
- if ( new_state || rmesa->NewGLState & _NEW_TEXTURE )
- {
- FLUSH_BATCH( rmesa );
-
- rmesa->new_state = 0;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_MSG )
- r128DDPrintState( "r128UpdateHwState", new_state );
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & R128_NEW_ALPHA )
- r128UpdateAlphaMode( ctx );
-
- if ( new_state & R128_NEW_DEPTH )
- r128UpdateZMode( ctx );
-
- if ( new_state & R128_NEW_FOG )
- r128UpdateFogAttrib( ctx );
-
- if ( new_state & R128_NEW_CLIP )
- r128UpdateClipping( ctx );
-
- if ( new_state & R128_NEW_CULL )
- r128UpdateCull( ctx );
-
- if ( new_state & R128_NEW_MASKS )
- r128UpdateMasks( ctx );
-
- if ( new_state & R128_NEW_WINDOW )
- r128UpdateWindow( ctx );
-
- if ( rmesa->NewGLState & _NEW_TEXTURE ) {
- r128UpdateTextureState( ctx );
- }
- }
-}
-
-
-static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- R128_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-
-/* Initialize the context's hardware state.
- */
-void r128DDInitState( r128ContextPtr rmesa )
-{
- int dst_bpp, depth_bpp;
-
- switch ( rmesa->r128Screen->cpp ) {
- case 2:
- dst_bpp = R128_GMC_DST_16BPP;
- break;
- case 4:
- dst_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->ClearColor = 0x00000000;
-
- switch ( rmesa->glCtx->Visual.depthBits ) {
- case 16:
- rmesa->ClearDepth = 0x0000ffff;
- depth_bpp = R128_Z_PIX_WIDTH_16;
- rmesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 24:
- rmesa->ClearDepth = 0x00ffffff;
- depth_bpp = R128_Z_PIX_WIDTH_24;
- rmesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- rmesa->glCtx->Visual.depthBits );
- exit( -1 );
- }
-
- rmesa->Fallback = 0;
-
- if ( rmesa->glCtx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
-
- /* Harware state:
- */
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
-
- rmesa->setup.dp_gui_master_cntl_c = (R128_GMC_DST_PITCH_OFFSET_CNTL |
- R128_GMC_DST_CLIPPING |
- R128_GMC_BRUSH_SOLID_COLOR |
- dst_bpp |
- R128_GMC_SRC_DATATYPE_COLOR |
- R128_GMC_BYTE_MSB_TO_LSB |
- R128_GMC_CONVERSION_TEMP_6500 |
- R128_ROP3_S |
- R128_DP_SRC_SOURCE_MEMORY |
- R128_GMC_3D_FCN_EN |
- R128_GMC_CLR_CMP_CNTL_DIS |
- R128_GMC_AUX_CLIP_DIS |
- R128_GMC_WR_MSK_DIS);
-
- rmesa->setup.sc_top_left_c = 0x00000000;
- rmesa->setup.sc_bottom_right_c = 0x1fff1fff;
-
- rmesa->setup.z_offset_c = rmesa->r128Screen->depthOffset;
- rmesa->setup.z_pitch_c = ((rmesa->r128Screen->depthPitch >> 3) |
- R128_Z_TILE);
-
- rmesa->setup.z_sten_cntl_c = (depth_bpp |
- R128_Z_TEST_LESS |
- R128_STENCIL_TEST_ALWAYS |
- R128_STENCIL_S_FAIL_KEEP |
- R128_STENCIL_ZPASS_KEEP |
- R128_STENCIL_ZFAIL_KEEP);
-
- rmesa->setup.tex_cntl_c = (R128_Z_WRITE_ENABLE |
- R128_SHADE_ENABLE |
- R128_DITHER_ENABLE |
- R128_ALPHA_IN_TEX_COMPLETE_A |
- R128_LIGHT_DIS |
- R128_ALPHA_LIGHT_DIS |
- R128_TEX_CACHE_FLUSH |
- (0x3f << R128_LOD_BIAS_SHIFT));
-
- rmesa->setup.misc_3d_state_cntl_reg = (R128_MISC_SCALE_3D_TEXMAP_SHADE |
- R128_MISC_SCALE_PIX_REPLICATE |
- R128_ALPHA_COMB_ADD_CLAMP |
- R128_FOG_VERTEX |
- R128_ALPHA_BLEND_SRC_ONE |
- R128_ALPHA_BLEND_DST_ZERO |
- R128_ALPHA_TEST_ALWAYS);
-
- rmesa->setup.texture_clr_cmp_clr_c = 0x00000000;
- rmesa->setup.texture_clr_cmp_msk_c = 0xffffffff;
-
- rmesa->setup.fog_color_c = 0x00000000;
-
- rmesa->setup.pm4_vc_fpu_setup = (R128_FRONT_DIR_CCW |
- R128_BACKFACE_SOLID |
- R128_FRONTFACE_SOLID |
- R128_FPU_COLOR_GOURAUD |
- R128_FPU_SUB_PIX_4BITS |
- R128_FPU_MODE_3D |
- R128_TRAP_BITS_DISABLE |
- R128_XFACTOR_2 |
- R128_YFACTOR_2 |
- R128_FLAT_SHADE_VERTEX_OGL |
- R128_FPU_ROUND_TRUNCATE |
- R128_WM_SEL_8DW);
-
- rmesa->setup.setup_cntl = (R128_COLOR_GOURAUD |
- R128_PRIM_TYPE_TRI |
- R128_TEXTURE_ST_MULT_W |
- R128_STARTING_VERTEX_1 |
- R128_ENDING_VERTEX_3 |
- R128_SU_POLY_LINE_NOT_LAST |
- R128_SUB_PIX_4BITS);
-
- rmesa->setup.tex_size_pitch_c = 0x00000000;
- rmesa->setup.constant_color_c = 0x00ffffff;
-
- rmesa->setup.dp_write_mask = 0xffffffff;
- rmesa->setup.sten_ref_mask_c = 0xffff0000;
- rmesa->setup.plane_3d_mask_c = 0xffffffff;
-
- rmesa->setup.window_xy_offset = 0x00000000;
-
- rmesa->setup.scale_3d_cntl = (R128_SCALE_DITHER_TABLE |
- R128_TEX_CACHE_SIZE_FULL |
- R128_DITHER_INIT_RESET |
- R128_SCALE_3D_TEXMAP_SHADE |
- R128_SCALE_PIX_REPLICATE |
- R128_ALPHA_COMB_ADD_CLAMP |
- R128_FOG_VERTEX |
- R128_ALPHA_BLEND_SRC_ONE |
- R128_ALPHA_BLEND_DST_ZERO |
- R128_ALPHA_TEST_ALWAYS |
- R128_COMPOSITE_SHADOW_CMP_EQUAL |
- R128_TEX_MAP_ALPHA_IN_TEXTURE |
- R128_TEX_CACHE_LINE_SIZE_4QW);
-
- rmesa->new_state = R128_NEW_ALL;
-}
-
-/* Initialize the driver's state functions.
- */
-void r128DDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = r128DDInvalidateState;
-
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = r128DDClearColor;
- ctx->Driver.DrawBuffer = r128DDDrawBuffer;
- ctx->Driver.ReadBuffer = r128DDReadBuffer;
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = r128DDColorMask;
- ctx->Driver.AlphaFunc = r128DDAlphaFunc;
- ctx->Driver.BlendEquation = r128DDBlendEquation;
- ctx->Driver.BlendFunc = r128DDBlendFunc;
- ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate;
- ctx->Driver.ClearDepth = r128DDClearDepth;
- ctx->Driver.CullFace = r128DDCullFace;
- ctx->Driver.FrontFace = r128DDFrontFace;
- ctx->Driver.DepthFunc = r128DDDepthFunc;
- ctx->Driver.DepthMask = r128DDDepthMask;
- ctx->Driver.Enable = r128DDEnable;
- ctx->Driver.Fogfv = r128DDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LightModelfv = r128DDLightModelfv;
- ctx->Driver.LogicOpcode = r128DDLogicOpCode;
- ctx->Driver.PolygonMode = NULL;
- ctx->Driver.PolygonStipple = r128DDPolygonStipple;
- ctx->Driver.RenderMode = r128DDRenderMode;
- ctx->Driver.Scissor = r128DDScissor;
- ctx->Driver.ShadeModel = r128DDShadeModel;
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
-
- ctx->Driver.DepthRange = r128DepthRange;
- ctx->Driver.Viewport = r128Viewport;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.h b/xc/lib/GL/mesa/src/drv/r128/r128_state.h
deleted file mode 100644
index c51ac2394..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_state.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.h,v 1.3 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_STATE_H__
-#define __R128_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r128_context.h"
-
-extern void r128DDInitState( r128ContextPtr rmesa );
-extern void r128DDInitStateFuncs( GLcontext *ctx );
-
-extern void r128DDUpdateState( GLcontext *ctx );
-extern void r128DDUpdateHWState( GLcontext *ctx );
-
-extern void r128UpdateWindow( GLcontext *ctx );
-
-extern void r128EmitHwStateLocked( r128ContextPtr rmesa );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
deleted file mode 100644
index 5914938e3..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.14 2002/11/05 17:46:08 tsi Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_vb.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-#include "r128_texobj.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "imports.h"
-#include "colormac.h"
-
-#include "xmlpool.h"
-
-#define TEX_0 1
-#define TEX_1 2
-
-
-static void r128SetTexWrap( r128TexObjPtr t, GLenum swrap, GLenum twrap )
-{
- t->setup.tex_cntl &= ~(R128_TEX_CLAMP_S_MASK | R128_TEX_CLAMP_T_MASK);
-
- switch ( swrap ) {
- case GL_CLAMP:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_BORDER_COLOR;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_CLAMP;
- break;
- case GL_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_WRAP;
- break;
- case GL_CLAMP_TO_BORDER:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_BORDER_COLOR;
- break;
- case GL_MIRRORED_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_MIRROR;
- break;
- }
-
- switch ( twrap ) {
- case GL_CLAMP:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_BORDER_COLOR;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_CLAMP;
- break;
- case GL_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_WRAP;
- break;
- case GL_CLAMP_TO_BORDER:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_BORDER_COLOR;
- break;
- case GL_MIRRORED_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_MIRROR;
- break;
- }
-}
-
-static void r128SetTexFilter( r128TexObjPtr t, GLenum minf, GLenum magf )
-{
- t->setup.tex_cntl &= ~(R128_MIN_BLEND_MASK | R128_MAG_BLEND_MASK);
-
- switch ( minf ) {
- case GL_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_NEAREST;
- break;
- case GL_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_MIPLINEAR;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPLINEAR;
- break;
- }
-
- switch ( magf ) {
- case GL_NEAREST:
- t->setup.tex_cntl |= R128_MAG_BLEND_NEAREST;
- break;
- case GL_LINEAR:
- t->setup.tex_cntl |= R128_MAG_BLEND_LINEAR;
- break;
- }
-}
-
-static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] )
-{
- t->setup.tex_border_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj )
-{
- r128TexObjPtr t;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, texObj );
- }
-
- t = (r128TexObjPtr) CALLOC_STRUCT( r128_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
-
- /* FIXME Something here to set initial values for other parts of
- * FIXME t->setup?
- */
-
- make_empty_list( (driTextureObject *) t );
-
- r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
- r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r128SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
-r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
- (void) type;
-
- switch ( internalFormat ) {
- /* non-sized formats with alpha */
- case GL_INTENSITY:
- case GL_COMPRESSED_INTENSITY:
- case GL_ALPHA:
- case GL_COMPRESSED_ALPHA:
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if (do32bpt)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_argb4444;
-
- /* 16-bit formats with alpha */
- case GL_INTENSITY4:
- case GL_ALPHA4:
- case GL_LUMINANCE4_ALPHA4:
- case GL_RGBA2:
- case GL_RGBA4:
- return &_mesa_texformat_argb4444;
-
- /* 32-bit formats with alpha */
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- if (!force16bpt)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_argb4444;
-
- /* non-sized formats without alpha */
- case 1:
- case GL_LUMINANCE:
- case GL_COMPRESSED_LUMINANCE:
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if (do32bpt)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_rgb565;
-
- /* 16-bit formats without alpha */
- case GL_LUMINANCE4:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return &_mesa_texformat_rgb565;
-
- /* 32-bit formats without alpha */
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- if (!force16bpt)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_rgb565;
-
- /* color-indexed formats */
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
- }
-}
-
-
-static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call r128ChooseTextureFormat */
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( (driTextureObject *) t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- /* Note, this will call r128ChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128DDTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- struct gl_texture_unit *texUnit;
- GLubyte c[4];
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_ENV_MODE:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
- break;
-
- case GL_TEXTURE_ENV_COLOR:
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- CLAMPED_FLOAT_TO_UBYTE( c[0], texUnit->EnvColor[0] );
- CLAMPED_FLOAT_TO_UBYTE( c[1], texUnit->EnvColor[1] );
- CLAMPED_FLOAT_TO_UBYTE( c[2], texUnit->EnvColor[2] );
- CLAMPED_FLOAT_TO_UBYTE( c[3], texUnit->EnvColor[3] );
- rmesa->env_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->setup.constant_color_c != rmesa->env_color ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.constant_color_c = rmesa->env_color;
-
- /* More complex multitexture/multipass fallbacks for GL_BLEND
- * can be done later, but this allows a single pass GL_BLEND
- * in some cases (ie. Performer town demo). This is only
- * applicable to the regular Rage 128, as the Pro and M3 can
- * handle true single-pass GL_BLEND texturing.
- */
- rmesa->blend_flags &= ~R128_BLEND_ENV_COLOR;
- if ( R128_IS_PLAIN( rmesa ) &&
- rmesa->env_color != 0x00000000 &&
- rmesa->env_color != 0xff000000 &&
- rmesa->env_color != 0x00ffffff &&
- rmesa->env_color != 0xffffffff ) {
- rmesa->blend_flags |= R128_BLEND_ENV_COLOR;
- }
- }
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
- do {
- CARD32 t = rmesa->setup.tex_cntl_c;
- GLint bias;
- CARD32 b;
-
- /* GTH: This isn't exactly correct, but gives good results up to a
- * certain point. It is better than completely ignoring the LOD
- * bias. Unfortunately there isn't much range in the bias, the
- * spec mentions strides that vary between 0.5 and 2.0 but these
- * numbers don't seem to relate the the GL LOD bias value at all.
- */
- if ( param[0] >= 1.0 ) {
- bias = -128;
- } else if ( param[0] >= 0.5 ) {
- bias = -64;
- } else if ( param[0] >= 0.25 ) {
- bias = 0;
- } else if ( param[0] >= 0.0 ) {
- bias = 63;
- } else {
- bias = 127;
- }
-
- b = (CARD32)bias & 0xff;
- t &= ~R128_LOD_BIAS_MASK;
- t |= (b << R128_LOD_BIAS_SHIFT);
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- } while (0);
- break;
-
- default:
- return;
- }
-}
-
-
-static void r128DDTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- if ( ( target != GL_TEXTURE_2D ) && ( target != GL_TEXTURE_1D ) )
- return;
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexWrap( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative for R128. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-}
-
-static void r128DDBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, tObj,
- ctx->Texture.CurrentUnit );
- }
-
- if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
- if ( tObj->DriverData == NULL ) {
- r128AllocTexObj( tObj );
- }
- }
-}
-
-static void r128DDDeleteTexture( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t ) {
- if ( t->bound && rmesa ) {
- FLUSH_BATCH( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-void r128DDInitTextureFuncs( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
-
- ctx->Driver.TexEnv = r128DDTexEnv;
- ctx->Driver.ChooseTextureFormat = r128ChooseTextureFormat;
- ctx->Driver.TexImage1D = r128TexImage1D;
- ctx->Driver.TexSubImage1D = r128TexSubImage1D;
- ctx->Driver.TexImage2D = r128TexImage2D;
- ctx->Driver.TexSubImage2D = r128TexSubImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
- ctx->Driver.TexParameter = r128DDTexParameter;
- ctx->Driver.BindTexture = r128DDBindTexture;
- ctx->Driver.DeleteTexture = r128DDDeleteTexture;
- ctx->Driver.UpdateTexturePalette = NULL;
- ctx->Driver.ActiveTexture = NULL;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
-
- driInitTextureObjects( ctx, & rmesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_1D
- | DRI_TEXMGR_DO_TEXTURE_2D );
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h
deleted file mode 100644
index 2e3d954fb..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.7 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_TEX_H__
-#define __R128_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r128UpdateTextureState( GLcontext *ctx );
-
-extern void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t );
-
-extern void r128DestroyTexObj( r128ContextPtr rmesa, r128TexObjPtr t );
-
-extern void r128DDInitTextureFuncs( GLcontext *ctx );
-
-
-/* ================================================================
- * Color conversion macros:
- */
-
-#define R128PACKCOLOR332( r, g, b ) \
- (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
-
-#define R128PACKCOLOR1555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define R128PACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define R128PACKCOLOR888( r, g, b ) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define R128PACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define R128PACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static __inline__ CARD32 r128PackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return R128PACKCOLOR565( r, g, b );
- case 4:
- return R128PACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-#endif
-#endif /* __R128_TEX_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c b/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c
deleted file mode 100644
index 7bffaf462..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texmem.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_vb.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "imports.h"
-
-#define TEX_0 1
-#define TEX_1 2
-
-
-/* Destroy hardware state associated with texture `t'.
- */
-void r128DestroyTexObj( r128ContextPtr rmesa, r128TexObjPtr t )
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
-
- if ( rmesa != NULL )
- {
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ )
- {
- if ( t == rmesa->CurrentTexObj[ i ] ) {
- assert( t->base.bound & (1 << i) );
- rmesa->CurrentTexObj[ i ] = NULL;
- }
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t,
- GLint level,
- GLint x, GLint y, GLint width, GLint height )
-{
- struct gl_texture_image *image;
- int texelsPerDword = 0;
- int imageWidth, imageHeight;
- int remaining, rows;
- int format, dwords;
- CARD32 pitch, offset;
- int i;
-
- /* Ensure we have a valid texture to upload */
- if ( ( level < 0 ) || ( level > R128_MAX_TEXTURE_LEVELS ) )
- return;
-
- image = t->base.tObj->Image[level];
- if ( !image )
- return;
-
- switch ( image->TexFormat->TexelBytes ) {
- case 1: texelsPerDword = 4; break;
- case 2: texelsPerDword = 2; break;
- case 4: texelsPerDword = 1; break;
- }
-
-#if 1
- /* FIXME: The subimage index calcs are wrong... */
- x = 0;
- y = 0;
- width = image->Width;
- height = image->Height;
-#endif
-
- imageWidth = image->Width;
- imageHeight = image->Height;
-
- format = t->textureFormat >> 16;
-
- /* The texel upload routines have a minimum width, so force the size
- * if needed.
- */
- if ( imageWidth < texelsPerDword ) {
- int factor;
-
- factor = texelsPerDword / imageWidth;
- imageWidth = texelsPerDword;
- imageHeight /= factor;
- if ( imageHeight == 0 ) {
- /* In this case, the texel converter will actually walk a
- * texel or two off the end of the image, but normal malloc
- * alignment should prevent it from ever causing a fault.
- */
- imageHeight = 1;
- }
- }
-
- /* We can't upload to a pitch less than 8 texels so we will need to
- * linearly upload all modified rows for textures smaller than this.
- * This makes the x/y/width/height different for the blitter and the
- * texture walker.
- */
- if ( imageWidth >= 8 ) {
- /* The texture walker and the blitter look identical */
- pitch = imageWidth >> 3;
- } else {
- int factor;
- int y2;
- int start, end;
-
- start = (y * imageWidth) & ~7;
- end = (y + height) * imageWidth;
-
- if ( end - start < 8 ) {
- /* Handle the case where the total number of texels
- * uploaded is < 8.
- */
- x = 0;
- y = start / 8;
- width = end - start;
- height = 1;
- } else {
- /* Upload some number of full 8 texel blit rows */
- factor = 8 / imageWidth;
-
- y2 = y + height - 1;
- y /= factor;
- y2 /= factor;
-
- x = 0;
- width = 8;
- height = y2 - y + 1;
- }
-
- /* Fixed pitch of 8 */
- pitch = 1;
- }
-
- dwords = width * height / texelsPerDword;
- offset = t->bufAddr + t->image[level - t->base.firstLevel].offset;
-
-#if ENABLE_PERF_BOXES
- /* Bump the performace counter */
- rmesa->c_textureBytes += (dwords << 2);
-#endif
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "r128UploadSubImage: %d,%d of %d,%d at %d,%d\n",
- width, height, image->Width, image->Height, x, y );
- fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d "
- "level: %d format: %x\n",
- (GLuint)offset, (GLuint)pitch, dwords, level, format );
- }
-
- /* Subdivide the texture if required */
- if ( dwords <= R128_BUFFER_MAX_DWORDS / 2 ) {
- rows = height;
- } else {
- rows = (R128_BUFFER_MAX_DWORDS * texelsPerDword) / (2 * width);
- }
-
- for ( i = 0, remaining = height ;
- remaining > 0 ;
- remaining -= rows, y += rows, i++ )
- {
- CARD32 *dst;
- drmBufPtr buffer;
-
- assert(image->Data);
-
- height = MIN2(remaining, rows);
-
- /* Grab the indirect buffer for the texture blit */
- LOCK_HARDWARE( rmesa );
- buffer = r128GetBufferLocked( rmesa );
-
- dst = (CARD32 *)((char *)buffer->address + R128_HOSTDATA_BLIT_OFFSET);
-
- /* Copy the next chunck of the texture image into the blit buffer */
- {
- const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
- memcpy(dst, src, bytes);
- }
-
- r128FireBlitLocked( rmesa, buffer,
- offset, pitch, format,
- x, y, width, height );
- UNLOCK_HARDWARE( rmesa );
- }
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
-}
-
-
-/* Upload the texture images associated with texture `t'. This might
- * require removing our own and/or other client's texture objects to
- * make room for these images.
- */
-void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t )
-{
- const GLint numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- GLint i;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %p )\n",
- __FUNCTION__, rmesa->glCtx, t );
- }
-
- assert(t);
-
- LOCK_HARDWARE( rmesa );
-
- if ( !t->base.memBlock ) {
- int heap;
-
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->r128Screen->texOffset[heap]
- + t->base.memBlock->ofs;
-
- /* Set texture offsets for each mipmap level */
- if ( t->setup.tex_cntl & R128_MIP_MAP_DISABLE ) {
- for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) {
- t->setup.tex_offset[i] = t->bufAddr;
- }
- } else {
- for ( i = 0; i < numLevels; i++ ) {
- const int j = numLevels - i - 1;
- t->setup.tex_offset[j] = t->bufAddr + t->image[i].offset;
- }
- }
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
- /* Upload any images that are new */
- if ( t->base.dirty_images[0] ) {
- for ( i = 0 ; i < numLevels; i++ ) {
- const GLint j = t->base.firstLevel + i; /* the texObj's level */
- if ( t->base.dirty_images[0] & (1 << j) ) {
- uploadSubImage( rmesa, t, j, 0, 0,
- t->image[i].width, t->image[i].height );
- }
- }
-
- rmesa->setup.tex_cntl_c |= R128_TEX_CACHE_FLUSH;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- t->base.dirty_images[0] = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h b/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h
deleted file mode 100644
index e2ff1ac24..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texobj.h,v 1.5 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef _R128_TEXOBJ_H_
-#define _R128_TEXOBJ_H_
-
-#include "r128_sarea.h"
-#include "mm.h"
-
-/* Individual texture image information.
- */
-typedef struct {
- GLuint offset; /* Relative to local texture space */
- GLuint width;
- GLuint height;
-} r128TexImage;
-
-typedef struct r128_tex_obj r128TexObj, *r128TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r128_tex_obj {
- driTextureObject base;
-
- CARD32 bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint age;
- r128TexImage image[R128_MAX_TEXTURE_LEVELS]; /* Image data for all
- mipmap levels */
-
- CARD32 textureFormat; /* Actual hardware format */
-
- r128_texture_regs_t setup; /* Setup regs for texture */
-};
-
-#endif /* _R128_TEXOBJ_H_ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c b/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c
deleted file mode 100644
index 3c43eb452..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texstate.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_vb.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-
-
-static void r128SetTexImages( r128ContextPtr rmesa,
- const struct gl_texture_object *tObj )
-{
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
- struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- int log2Pitch, log2Height, log2Size, log2MinSize;
- int totalSize;
- int i;
- GLint firstLevel, lastLevel;
-
- assert(t);
- assert(baseImage);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj );
-
- switch (baseImage->TexFormat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
- t->textureFormat = R128_DATATYPE_ARGB8888;
- break;
- case MESA_FORMAT_ARGB4444:
- t->textureFormat = R128_DATATYPE_ARGB4444;
- break;
- case MESA_FORMAT_RGB565:
- t->textureFormat = R128_DATATYPE_RGB565;
- break;
- case MESA_FORMAT_RGB332:
- t->textureFormat = R128_DATATYPE_RGB8;
- break;
- case MESA_FORMAT_CI8:
- t->textureFormat = R128_DATATYPE_CI8;
- break;
- case MESA_FORMAT_YCBCR:
- t->textureFormat = R128_DATATYPE_YVYU422;
- break;
- case MESA_FORMAT_YCBCR_REV:
- t->textureFormat = R128_DATATYPE_VYUY422;
- break;
- default:
- _mesa_problem(rmesa->glCtx, "Bad texture format in %s", __FUNCTION__);
- };
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- firstLevel = t->base.firstLevel;
- lastLevel = t->base.lastLevel;
-
- log2Pitch = tObj->Image[firstLevel]->WidthLog2;
- log2Height = tObj->Image[firstLevel]->HeightLog2;
- log2Size = MAX2(log2Pitch, log2Height);
- log2MinSize = log2Size;
-
- t->base.dirty_images[0] = 0;
- totalSize = 0;
- for ( i = firstLevel; i <= lastLevel; i++ ) {
- const struct gl_texture_image *texImage;
-
- texImage = tObj->Image[i];
- if ( !texImage || !texImage->Data ) {
- lastLevel = i - 1;
- break;
- }
-
- log2MinSize = texImage->MaxLog2;
-
- t->image[i - firstLevel].offset = totalSize;
- t->image[i - firstLevel].width = tObj->Image[i]->Width;
- t->image[i - firstLevel].height = tObj->Image[i]->Height;
-
- t->base.dirty_images[0] |= (1 << i);
-
- totalSize += (tObj->Image[i]->Height *
- tObj->Image[i]->Width *
- tObj->Image[i]->TexFormat->TexelBytes);
-
- /* Offsets must be 32-byte aligned for host data blits and tiling */
- totalSize = (totalSize + 31) & ~31;
- }
-
- t->base.totalSize = totalSize;
- t->base.firstLevel = firstLevel;
- t->base.lastLevel = lastLevel;
-
- /* Set the texture format */
- t->setup.tex_cntl &= ~(0xf << 16);
- t->setup.tex_cntl |= t->textureFormat;
-
- t->setup.tex_combine_cntl = 0x00000000; /* XXX is this right? */
-
- t->setup.tex_size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) |
- (log2Size << R128_TEX_SIZE_SHIFT) |
- (log2Height << R128_TEX_HEIGHT_SHIFT) |
- (log2MinSize << R128_TEX_MIN_SIZE_SHIFT));
-
- for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) {
- t->setup.tex_offset[i] = 0x00000000;
- }
-
- if (firstLevel == lastLevel)
- t->setup.tex_cntl |= R128_MIP_MAP_DISABLE;
- else
- t->setup.tex_cntl &= ~R128_MIP_MAP_DISABLE;
-
- /* FYI: r128UploadTexImages( rmesa, t ); used to be called here */
-}
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define COLOR_COMB_DISABLE (R128_COMB_DIS | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_COPY_INPUT (R128_COMB_COPY_INP | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_MODULATE (R128_COMB_MODULATE | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_MODULATE_NTEX (R128_COMB_MODULATE | \
- R128_COLOR_FACTOR_NTEX)
-#define COLOR_COMB_ADD (R128_COMB_ADD | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_BLEND_TEX (R128_COMB_BLEND_TEXTURE | \
- R128_COLOR_FACTOR_TEX)
-/* Rage 128 Pro/M3 only! */
-#define COLOR_COMB_BLEND_COLOR (R128_COMB_MODULATE2X | \
- R128_COMB_FCN_MSB | \
- R128_COLOR_FACTOR_CONST_COLOR)
-
-#define ALPHA_COMB_DISABLE (R128_COMB_ALPHA_DIS | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_COPY_INPUT (R128_COMB_ALPHA_COPY_INP | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_MODULATE (R128_COMB_ALPHA_MODULATE | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_MODULATE_NTEX (R128_COMB_ALPHA_MODULATE | \
- R128_ALPHA_FACTOR_NTEX_ALPHA)
-#define ALPHA_COMB_ADD (R128_COMB_ALPHA_ADD | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-
-#define INPUT_INTERP (R128_INPUT_FACTOR_INT_COLOR | \
- R128_INP_FACTOR_A_INT_ALPHA)
-#define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \
- R128_INP_FACTOR_A_PREV_ALPHA)
-
-static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLint source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[tObj->BaseLevel]->Format;
- GLuint combine;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %d )\n",
- __FUNCTION__, ctx, unit );
- }
-
- if ( unit == 0 ) {
- combine = INPUT_INTERP;
- } else {
- combine = INPUT_PREVIOUS;
- }
-
- /* Set the texture environment state */
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_DISABLE); /* A = At */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_DISABLE); /* A = At */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_MODULATE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- combine |= (COLOR_COMB_MODULATE | /* C = CfCt */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_MODULATE | /* C = CfCt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- combine |= (COLOR_COMB_BLEND_TEX | /* C = Cf(1-At)+CtAt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_RGB:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined behaviour - just copy the incoming fragment */
- combine |= (COLOR_COMB_COPY_INPUT | /* C = undefined */
- ALPHA_COMB_COPY_INPUT); /* A = undefined */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_BLEND:
- /* Rage 128 Pro and M3 can handle GL_BLEND texturing.
- */
- if ( !R128_IS_PLAIN( rmesa ) ) {
- /* XXX this hasn't been fully tested, I don't have a Pro card. -BP */
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-Ct)+CcCt */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-Ct)+CcCt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
-
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-
- case GL_INTENSITY:
- /* GH: We could be smarter about this... */
- switch ( rmesa->env_color & 0xff000000 ) {
- case 0x00000000:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-It)+CcIt */
- ALPHA_COMB_MODULATE_NTEX); /* A = Af(1-It) */
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
-
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
- }
-
- /* Rage 128 has to fake some cases of GL_BLEND, otherwise fallback
- * to software rendering.
- */
- if ( rmesa->blend_flags ) {
- return GL_FALSE;
- }
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- } else {
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- } else {
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_COPY_INPUT); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_ALPHA:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- } else {
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
- case GL_INTENSITY:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= COLOR_COMB_MODULATE_NTEX; /* C = Cf(1-It) */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= COLOR_COMB_MODULATE_NTEX; /* C = Cf(1-It) */
- } else {
- combine |= COLOR_COMB_ADD; /* C = Cf+It */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- switch ( rmesa->env_color & 0xff000000 ) {
- case 0x00000000:
- combine |= ALPHA_COMB_MODULATE_NTEX; /* A = Af(1-It) */
- break;
-#if 0
- /* This isn't right - BP */
- case 0xff000000:
- if ( unit == 0 ) {
- combine |= ALPHA_COMB_MODULATE_NTEX; /* A = Af(1-It) */
- } else {
- combine |= ALPHA_COMB_ADD; /* A = Af+It */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_ADD:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_INTENSITY:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_ADD); /* A = Af+At */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( rmesa->tex_combine[unit] != combine ) {
- rmesa->tex_combine[unit] = combine;
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
- }
- return GL_TRUE;
-}
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
- if ( rmesa->CurrentTexObj[unit] ) {
- rmesa->CurrentTexObj[unit]->base.bound &= ~(1 << unit);
- rmesa->CurrentTexObj[unit] = NULL;
- }
-
- rmesa->setup.tex_cntl_c &= ~(R128_TEXMAP_ENABLE << unit);
- rmesa->setup.tex_size_pitch_c &= ~(R128_TEX_SIZE_PITCH_MASK <<
- (R128_SEC_TEX_SIZE_PITCH_SHIFT * unit));
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
- /* If either texture unit is disabled, then multitexturing is not
- * happening.
- */
-
- rmesa->blend_flags &= ~R128_BLEND_MULTITEX;
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if ( t->base.dirty_images[0] ) {
- /* FIXME: For Radeon, RADEON_FIREVERTICES is called here. Should
- * FIXME: something similar be done for R128?
- */
- /* FLUSH_BATCH( rmesa ); */
-
- r128SetTexImages( rmesa, tObj );
- r128UploadTexImages( rmesa, t );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
-
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->CurrentTexObj[unit] != t ) {
- if ( rmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->CurrentTexObj[unit]->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1UL << unit);
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
- /* FIXME: We need to update the texture unit if any texture parameters have
- * changed, but this texture was already bound. This could be changed to
- * work like the Radeon driver where the texture object has it's own
- * dirty state flags
- */
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
-
- /* register setup */
- rmesa->setup.tex_size_pitch_c &= ~(R128_TEX_SIZE_PITCH_MASK <<
- (R128_SEC_TEX_SIZE_PITCH_SHIFT * unit));
-
- if ( unit == 0 ) {
- rmesa->setup.tex_cntl_c |= R128_TEXMAP_ENABLE;
- rmesa->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 0;
- rmesa->setup.scale_3d_cntl &= ~R128_TEX_CACHE_SPLIT;
- t->setup.tex_cntl &= ~R128_SEC_SELECT_SEC_ST;
- }
- else {
- rmesa->setup.tex_cntl_c |= R128_SEC_TEXMAP_ENABLE;
- rmesa->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 16;
- rmesa->setup.scale_3d_cntl |= R128_TEX_CACHE_SPLIT;
- t->setup.tex_cntl |= R128_SEC_SELECT_SEC_ST;
-
- /* If the second TMU is enabled, then multitexturing is happening.
- */
- if ( R128_IS_PLAIN( rmesa ) )
- rmesa->blend_flags |= R128_BLEND_MULTITEX;
- }
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
-
- /* FIXME: The Radeon has some cached state so that it can avoid calling
- * FIXME: UpdateTextureEnv in some cases. Is that possible here?
- */
- return r128UpdateTextureEnv( ctx, unit );
-}
-
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
-
-
- if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-
-void r128UpdateTextureState( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLboolean ok;
-
-
- /* This works around a quirk with the R128 hardware. If only OpenGL
- * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used. The
- * hardware TEXTURE1 can ONLY be used when hardware TEXTURE0 is also used.
- */
-
- rmesa->tmu_source[0] = 0;
- rmesa->tmu_source[1] = 1;
-
- if ((ctx->Texture._EnabledUnits & 0x03) == 0x02) {
- /* only texture 1 enabled */
- rmesa->tmu_source[0] = 1;
- rmesa->tmu_source[1] = 0;
- }
-
- ok = (updateTextureUnit( ctx, 0 ) &&
- updateTextureUnit( ctx, 1 ));
-
- FALLBACK( rmesa, R128_FALLBACK_TEXTURE, !ok );
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c
deleted file mode 100644
index 4e2860288..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c
+++ /dev/null
@@ -1,721 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.8 2002/10/30 12:51:43 alanh Exp $ */ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "r128_tris.h"
-#include "r128_state.h"
-#include "r128_tex.h"
-#include "r128_vb.h"
-#include "r128_ioctl.h"
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- R128_CCE_VC_CNTL_PRIM_TYPE_POINT,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
-};
-
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) \
- vb[j] = CPU_TO_LE32(((GLuint *)v)[j]); \
- vb += vertsize; \
-} while (0)
-#endif
-
-static __inline void r128_draw_quad( r128ContextPtr rmesa,
- r128VertexPtr v0,
- r128VertexPtr v1,
- r128VertexPtr v2,
- r128VertexPtr v3 )
-{
- GLuint vertsize = rmesa->vertex_size;
- GLuint *vb = (GLuint *)r128AllocDmaLow( rmesa, 6 * vertsize * 4 );
- GLuint j;
-
- rmesa->num_verts += 6;
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-
-static __inline void r128_draw_triangle( r128ContextPtr rmesa,
- r128VertexPtr v0,
- r128VertexPtr v1,
- r128VertexPtr v2 )
-{
- GLuint vertsize = rmesa->vertex_size;
- GLuint *vb = (GLuint *)r128AllocDmaLow( rmesa, 3 * vertsize * 4 );
- GLuint j;
-
- rmesa->num_verts += 3;
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-static __inline void r128_draw_line( r128ContextPtr rmesa,
- r128VertexPtr v0,
- r128VertexPtr v1 )
-{
- GLuint vertsize = rmesa->vertex_size;
- GLuint *vb = (GLuint *)r128AllocDmaLow( rmesa, 2 * vertsize * 4 );
- GLuint j;
-
- rmesa->num_verts += 2;
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-static __inline void r128_draw_point( r128ContextPtr rmesa,
- r128VertexPtr v0 )
-{
- int vertsize = rmesa->vertex_size;
- GLuint *vb = (GLuint *)r128AllocDmaLow( rmesa, vertsize * 4 );
- int j;
-
- rmesa->num_verts += 1;
- COPY_DWORDS( j, vb, vertsize, v0 );
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_tri( rmesa, a, b, c ); \
- else \
- r128_draw_triangle( rmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- rmesa->draw_tri( rmesa, a, b, d ); \
- rmesa->draw_tri( rmesa, b, c, d ); \
- } else \
- r128_draw_quad( rmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_line( rmesa, v0, v1 ); \
- else \
- r128_draw_line( rmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_point( rmesa, v0 ); \
- else \
- r128_draw_point( rmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define R128_OFFSET_BIT 0x01
-#define R128_TWOSIDE_BIT 0x02
-#define R128_UNFILLED_BIT 0x04
-#define R128_FALLBACK_BIT 0x08
-#define R128_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[R128_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & R128_FALLBACK_BIT)
-#define DO_OFFSET (IND & R128_OFFSET_BIT)
-#define DO_UNFILLED (IND & R128_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & R128_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX r128Vertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (rmesa->verts + (e<<rmesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) do { \
- r128_color_t *vc = (r128_color_t *)&(v)->ui[coloroffset]; \
- vc->blue = (c)[2]; \
- vc->green = (c)[1]; \
- vc->red = (c)[0]; \
- vc->alpha = (c)[3]; \
- } while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v0, c ) if (havespec) { \
- (v0)->v.specular.red = (c)[0];\
- (v0)->v.specular.green = (c)[1];\
- (v0)->v.specular.blue = (c)[2]; }
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) { \
- (v0)->v.specular.red = v1->v.specular.red; \
- (v0)->v.specular.green = v1->v.specular.green; \
- (v0)->v.specular.blue = v1->v.specular.blue; }
-
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (rmesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (rmesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (rmesa->hw_primitive != hw_prim[x]) \
- r128RasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->render_primitive
-#define IND R128_FALLBACK_BIT
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_UNFILLED_BIT| \
- R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-r128_fallback_tri( r128ContextPtr rmesa,
- r128Vertex *v0,
- r128Vertex *v1,
- r128Vertex *v2 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[3];
- r128_translate_vertex( ctx, v0, &v[0] );
- r128_translate_vertex( ctx, v1, &v[1] );
- r128_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-r128_fallback_line( r128ContextPtr rmesa,
- r128Vertex *v0,
- r128Vertex *v1 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[2];
- r128_translate_vertex( ctx, v0, &v[0] );
- r128_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-r128_fallback_point( r128ContextPtr rmesa,
- r128Vertex *v0 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[1];
- r128_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (r128Vertex *)(r128verts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- r128_draw_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- r128_draw_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- r128_draw_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- r128_draw_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- r128RenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- const GLuint shift = rmesa->vertex_stride_shift; \
- const char *r128verts = (char *)rmesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) r128_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) r128_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void r128RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-}
-
-static void r128RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void r128FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- r128ContextPtr rmesa = R128_CONTEXT( ctx );
- GLuint vertsize = rmesa->vertex_size;
- GLuint *vb = r128AllocDmaLow( rmesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *r128verts = (GLubyte *)rmesa->verts;
- const GLuint shift = rmesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i,j;
-
- rmesa->num_verts += (n-2) * 3;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) VERT(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) VERT(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) start );
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _R128_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void r128ChooseRenderState(GLcontext *ctx)
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- rmesa->draw_point = r128_draw_point;
- rmesa->draw_line = r128_draw_line;
- rmesa->draw_tri = r128_draw_triangle;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R128_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= R128_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= R128_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) {
- if (flags & POINT_FALLBACK) rmesa->draw_point = r128_fallback_point;
- if (flags & LINE_FALLBACK) rmesa->draw_line = r128_fallback_line;
- if (flags & TRI_FALLBACK) rmesa->draw_tri = r128_fallback_tri;
- index |= R128_FALLBACK_BIT;
- }
- }
-
- if (index != rmesa->RenderIndex) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = r128_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = r128_render_tab_elts;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.ClippedPolygon = r128FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = r128RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = r128RenderClippedPoly;
- }
-
- rmesa->RenderIndex = index;
- }
-}
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void r128RunPipeline( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if (rmesa->new_state || rmesa->NewGLState & _NEW_TEXTURE)
- r128DDUpdateHWState( ctx );
-
- if (!rmesa->Fallback && rmesa->NewGLState) {
- if (rmesa->NewGLState & _R128_NEW_VERTEX_STATE)
- r128ChooseVertexState( ctx );
-
- if (rmesa->NewGLState & _R128_NEW_RENDER_STATE)
- r128ChooseRenderState( ctx );
-
- rmesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- *
- * As the r128 uses triangles to render lines and points, it is
- * necessary to turn off hardware culling when rendering these
- * primitives.
- */
-
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- rmesa->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE;
-
- if ( ctx->Polygon.StippleFlag && hwprim == GL_TRIANGLES ) {
- rmesa->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_32x32_MONO_FG_LA;
- }
- else {
- rmesa->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_SOLID_COLOR;
- }
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
- if (rmesa->hw_primitive != hwprim) {
- FLUSH_BATCH( rmesa );
- rmesa->hw_primitive = hwprim;
- }
-}
-
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint hw = hw_prim[prim];
- rmesa->render_primitive = prim;
- if (prim >= GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
- r128RasterPrimitive( ctx, hw );
-}
-
-
-static void r128RenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- r128CheckTexSizes( ctx );
-}
-
-static void r128RenderFinish( GLcontext *ctx )
-{
- if (R128_CONTEXT(ctx)->RenderIndex & R128_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- FLUSH_BATCH( rmesa );
- _swsetup_Wakeup( ctx );
- rmesa->RenderIndex = ~0;
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = r128RenderStart;
- tnl->Driver.Render.PrimitiveNotify = r128RenderPrimitive;
- tnl->Driver.Render.Finish = r128RenderFinish;
- tnl->Driver.Render.BuildVertices = r128BuildVertices;
- rmesa->NewGLState |= (_R128_NEW_RENDER_STATE|
- _R128_NEW_VERTEX_STATE);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void r128InitTriFuncs( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = r128RunPipeline;
- tnl->Driver.Render.Start = r128RenderStart;
- tnl->Driver.Render.Finish = r128RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = r128RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = r128BuildVertices;
- rmesa->NewGLState |= (_R128_NEW_RENDER_STATE|
- _R128_NEW_VERTEX_STATE);
-
-/* r128Fallback( ctx, 0x100000, 1 ); */
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h
deleted file mode 100644
index 755d3320b..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.8 2002/10/30 12:51:43 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __R128_TRIS_H__
-#define __R128_TRIS_H__
-
-#include "mtypes.h"
-
-extern void r128InitTriFuncs( GLcontext *ctx );
-
-
-extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode )
-
-
-#endif /* __R128_TRIS_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
deleted file mode 100644
index 0387e5dc9..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.16 2003/03/26 20:43:49 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "r128_context.h"
-#include "r128_vb.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_state.h"
-
-
-#define R128_TEX1_BIT 0x1
-#define R128_TEX0_BIT 0x2
-#define R128_RGBA_BIT 0x4
-#define R128_SPEC_BIT 0x8
-#define R128_FOG_BIT 0x10
-#define R128_XYZW_BIT 0x20
-#define R128_PTEX_BIT 0x40
-#define R128_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[R128_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT (R128_CCE_VC_FRMT_DIFFUSE_ARGB)
-
-#define NOTEX_VERTEX_FORMAT (R128_CCE_VC_FRMT_RHW | \
- R128_CCE_VC_FRMT_DIFFUSE_ARGB |\
- R128_CCE_VC_FRMT_SPEC_FRGB)
-
-#define TEX0_VERTEX_FORMAT (R128_CCE_VC_FRMT_RHW | \
- R128_CCE_VC_FRMT_DIFFUSE_ARGB |\
- R128_CCE_VC_FRMT_SPEC_FRGB | \
- R128_CCE_VC_FRMT_S_T)
-
-#define TEX1_VERTEX_FORMAT (R128_CCE_VC_FRMT_RHW | \
- R128_CCE_VC_FRMT_DIFFUSE_ARGB |\
- R128_CCE_VC_FRMT_SPEC_FRGB | \
- R128_CCE_VC_FRMT_S_T | \
- R128_CCE_VC_FRMT_S2_T2)
-
-
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & R128_XYZW_BIT)
-#define DO_RGBA (IND & R128_RGBA_BIT)
-#define DO_SPEC (IND & R128_SPEC_BIT)
-#define DO_FOG (IND & R128_FOG_BIT)
-#define DO_TEX0 (IND & R128_TEX0_BIT)
-#define DO_TEX1 (IND & R128_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & R128_PTEX_BIT)
-
-#define VERTEX r128Vertex
-#define VERTEX_COLOR r128_color_t
-#define LOCALVARS r128ContextPtr rmesa = R128_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() rmesa->hw_viewport
-#define GET_TEXSOURCE(n) rmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() rmesa->vertex_format
-#define GET_VERTEX_STORE() rmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() rmesa->vertex_stride_shift
-#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &rmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &rmesa->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0 /* r128 rhw2 not supported by template */
-
-#define UNVIEWPORT_VARS GLfloat h = R128_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z / rmesa->depth_scale
-
-#define PTEX_FALLBACK() FALLBACK(R128_CONTEXT(ctx), R128_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS r128_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r128_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[rmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[rmesa->SetupIndex].copy_pv
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) r128_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_TEX0_BIT|R128_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|\
- R128_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|\
- R128_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|\
- R128_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|\
- R128_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|\
- R128_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|\
- R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_XYZW_BIT|R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|\
- R128_TEX0_BIT|R128_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_FOG_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_SPEC_BIT|R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT|R128_TEX0_BIT|R128_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R128_RGBA_BIT|R128_FOG_BIT|R128_SPEC_BIT|R128_TEX0_BIT|\
- R128_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-void r128PrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & R128_XYZW_BIT) ? " xyzw," : "",
- (flags & R128_RGBA_BIT) ? " rgba," : "",
- (flags & R128_SPEC_BIT) ? " spec," : "",
- (flags & R128_FOG_BIT) ? " fog," : "",
- (flags & R128_TEX0_BIT) ? " tex-0," : "",
- (flags & R128_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-
-void r128CheckTexSizes( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT( ctx );
-
- if (!setup_tab[rmesa->SetupIndex].check_tex_sizes(ctx)) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /* Invalidate stored verts
- */
- rmesa->SetupNewInputs = ~0;
- rmesa->SetupIndex |= R128_PTEX_BIT;
-
- if (!rmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[rmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[rmesa->SetupIndex].copy_pv;
- }
- if (rmesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- }
- }
-}
-
-void r128BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- r128ContextPtr rmesa = R128_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->verts + (start<<rmesa->vertex_stride_shift));
- GLuint stride = 1<<rmesa->vertex_stride_shift;
-
- newinputs |= rmesa->SetupNewInputs;
- rmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[rmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= R128_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= R128_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= R128_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= R128_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= R128_FOG_BIT;
-
- if (rmesa->SetupIndex & R128_PTEX_BIT)
- ind = ~0;
-
- ind &= rmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void r128ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r128ContextPtr rmesa = R128_CONTEXT( ctx );
- GLuint ind = R128_XYZW_BIT|R128_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= R128_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= R128_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits) {
- ind |= R128_TEX0_BIT;
- if (ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[1]._ReallyEnabled)
- ind |= R128_TEX1_BIT;
- }
-
- rmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = r128_interp_extras;
- tnl->Driver.Render.CopyPV = r128_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != rmesa->vertex_format) {
- FLUSH_BATCH(rmesa);
- rmesa->vertex_format = setup_tab[ind].vertex_format;
- rmesa->vertex_size = setup_tab[ind].vertex_size;
- rmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-
-void r128_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint vertex_size = rmesa->vertex_size * 4;
- GLuint *dest = r128AllocDmaLow( rmesa, (count-start) * vertex_size);
- setup_tab[rmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-}
-
-
-#if 0
-void r128_emit_indexed_verts( GLcontext *ctx, GLuint start, GLuint count )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint vertex_size = rmesa->vertex_size * 4;
- GLuint bufsz = (count-start) * vertex_size;
- CARD32 *dest;
-
- rmesa->vertex_low = (rmesa->vertex_low + 63) & ~63; /* alignment */
- rmesa->vertex_last_prim = rmesa->vertex_low;
-
- dest = r128AllocDmaLow( rmesa, bufsz, __FUNCTION__);
- setup_tab[rmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-
- rmesa->retained_buffer = rmesa->vertex_buffer;
- rmesa->vb_offset = (rmesa->vertex_buffer->idx * R128_BUFFER_SIZE +
- rmesa->vertex_low - bufsz);
-
- rmesa->vertex_low = (rmesa->vertex_low + 0x7) & ~0x7; /* alignment */
- rmesa->vertex_last_prim = rmesa->vertex_low;
-}
-#endif
-
-
-void r128InitVB( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- rmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void r128FreeVB( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- if (rmesa->verts) {
- ALIGN_FREE(rmesa->verts);
- rmesa->verts = 0;
- }
-
-
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h
deleted file mode 100644
index 31afa74f1..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.8 2002/10/30 12:51:46 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef R128VB_INC
-#define R128VB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "r128_context.h"
-
-#define _R128_NEW_VERTEX_STATE (_DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_UNFILLED | \
- _NEW_TEXTURE | \
- _NEW_FOG)
-
-extern void r128CheckTexSizes( GLcontext *ctx );
-extern void r128ChooseVertexState( GLcontext *ctx );
-
-extern void r128BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void r128PrintSetupFlags(char *msg, GLuint flags );
-
-extern void r128InitVB( GLcontext *ctx );
-extern void r128FreeVB( GLcontext *ctx );
-
-extern void r128_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void r128_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void r128_translate_vertex( GLcontext *ctx,
- const r128Vertex *src,
- SWvertex *dst );
-
-extern void r128_print_vertex( GLcontext *ctx, const r128Vertex *v );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c b/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c
deleted file mode 100644
index 3a4fa30bc..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c,v 1.1 2002/10/30 12:51:51 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "simple_list.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tcl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-
-static void print_state_atom( struct r200_state_atom *state )
-{
- int i;
-
- fprintf(stderr, "emit %s/%d\n", state->name, state->cmd_size);
-
- if (0 & R200_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < state->cmd_size ; i++)
- fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]);
-
-}
-
-static void r200_emit_state_list( r200ContextPtr rmesa,
- struct r200_state_atom *list )
-{
- struct r200_state_atom *state, *tmp;
- char *dest;
-
- foreach_s( state, tmp, list ) {
- if (state->check( rmesa->glCtx, state->idx )) {
- dest = r200AllocCmdBuf( rmesa, state->cmd_size * 4, __FUNCTION__);
- memcpy( dest, state->cmd, state->cmd_size * 4);
- move_to_head( &(rmesa->hw.clean), state );
- if (R200_DEBUG & DEBUG_STATE)
- print_state_atom( state );
- }
- else if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "skip state %s\n", state->name);
- }
-}
-
-
-void r200EmitState( r200ContextPtr rmesa )
-{
- struct r200_state_atom *state, *tmp;
-
- if (R200_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Somewhat overkill:
- */
- if ( rmesa->lost_context) {
- if (R200_DEBUG & (DEBUG_STATE|DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s - lost context\n", __FUNCTION__);
-
- foreach_s( state, tmp, &(rmesa->hw.clean) )
- move_to_tail(&(rmesa->hw.dirty), state );
-
- rmesa->lost_context = 0;
- }
- else {
- move_to_tail( &rmesa->hw.dirty, &rmesa->hw.mtl[0] );
- /* odd bug? -- isosurf, cycle between reflect & lit */
- }
-
- r200_emit_state_list( rmesa, &rmesa->hw.dirty );
-}
-
-
-
-/* Fire a section of the retained (indexed_verts) buffer as a regular
- * primtive.
- */
-extern void r200EmitVbufPrim( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint vertex_nr )
-{
- drmRadeonCmdHeader *cmd;
-
- assert(!(primitive & R200_VF_PRIM_WALK_IND));
-
- r200EmitState( rmesa );
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS))
- fprintf(stderr, "%s cmd_used/4: %d prim %x nr %d\n", __FUNCTION__,
- rmesa->store.cmd_used/4, primitive, vertex_nr);
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, 3 * sizeof(*cmd),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = R200_CP_CMD_3D_DRAW_VBUF_2;
- cmd[2].i = (primitive |
- R200_VF_PRIM_WALK_LIST |
- R200_VF_COLOR_ORDER_RGBA |
- (vertex_nr << R200_VF_VERTEX_NUMBER_SHIFT));
-}
-
-
-void r200FlushElts( r200ContextPtr rmesa )
-{
- int *cmd = (int *)(rmesa->store.cmd_buf + rmesa->store.elts_start);
- int dwords;
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 12)) / 2;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert( rmesa->dma.flush == r200FlushElts );
- rmesa->dma.flush = 0;
-
- /* Cope with odd number of elts:
- */
- rmesa->store.cmd_used = (rmesa->store.cmd_used + 2) & ~2;
- dwords = (rmesa->store.cmd_used - rmesa->store.elts_start) / 4;
-
- cmd[1] |= (dwords - 3) << 16;
- cmd[2] |= nr << R200_VF_VERTEX_NUMBER_SHIFT;
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
- r200Finish( rmesa->glCtx );
- }
-}
-
-
-GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint min_nr )
-{
- drmRadeonCmdHeader *cmd;
- GLushort *retval;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d prim %x\n", __FUNCTION__, min_nr, primitive);
-
- assert((primitive & R200_VF_PRIM_WALK_IND));
-
- r200EmitState( rmesa );
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa,
- 12 + min_nr*2,
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = R200_CP_CMD_3D_DRAW_INDX_2;
- cmd[2].i = (primitive |
- R200_VF_PRIM_WALK_IND |
- R200_VF_COLOR_ORDER_RGBA);
-
-
- retval = (GLushort *)(cmd+3);
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x prim %x \n",
- __FUNCTION__,
- cmd[1].i, primitive);
-
- assert(!rmesa->dma.flush);
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = r200FlushElts;
-
- rmesa->store.elts_start = ((char *)cmd) - rmesa->store.cmd_buf;
-
- return retval;
-}
-
-
-
-void r200EmitVertexAOS( r200ContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset )
-{
- drmRadeonCmdHeader *cmd;
-
- if (R200_DEBUG & (DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s: vertex_size 0x%x offset 0x%x \n",
- __FUNCTION__, vertex_size, offset);
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, 5 * sizeof(int),
- __FUNCTION__ );
-
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_3D_LOAD_VBPNTR | (2 << 16);
- cmd[2].i = 1;
- cmd[3].i = vertex_size | (vertex_size << 8);
- cmd[4].i = offset;
-}
-
-
-void r200EmitAOS( r200ContextPtr rmesa,
- struct r200_dma_region **component,
- GLuint nr,
- GLuint offset )
-{
- drmRadeonCmdHeader *cmd;
- int sz = 3 + ((nr/2)*3) + ((nr&1)*2);
- int i;
- int *tmp;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s nr arrays: %d\n", __FUNCTION__, nr);
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, sz * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_3D_LOAD_VBPNTR | ((sz-3) << 16);
- cmd[2].i = nr;
- tmp = &cmd[0].i;
- cmd += 3;
-
- for (i = 0 ; i < nr ; i++) {
- if (i & 1) {
- cmd[0].i |= ((component[i]->aos_stride << 24) |
- (component[i]->aos_size << 16));
- cmd[2].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- cmd += 3;
- }
- else {
- cmd[0].i = ((component[i]->aos_stride << 8) |
- (component[i]->aos_size << 0));
- cmd[1].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- }
- }
-
- if (R200_DEBUG & DEBUG_VERTS) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- for (i = 0 ; i < sz ; i++)
- fprintf(stderr, " %d: %x\n", i, tmp[i]);
- }
-}
-
-void r200EmitBlit( r200ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h )
-{
- drmRadeonCmdHeader *cmd;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s src %x/%x %d,%d dst: %x/%x %d,%d sz: %dx%d\n",
- __FUNCTION__,
- src_pitch, src_offset, srcx, srcy,
- dst_pitch, dst_offset, dstx, dsty,
- w, h);
-
- assert( (src_pitch & 63) == 0 );
- assert( (dst_pitch & 63) == 0 );
- assert( (src_offset & 1023) == 0 );
- assert( (dst_offset & 1023) == 0 );
- assert( w < (1<<16) );
- assert( h < (1<<16) );
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, 8 * sizeof(int),
- __FUNCTION__ );
-
-
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_BITBLT_MULTI | (5 << 16);
- cmd[2].i = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
- RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- (color_fmt << 8) |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_MEMORY |
- RADEON_GMC_CLR_CMP_CNTL_DIS |
- RADEON_GMC_WR_MSK_DIS );
-
- cmd[3].i = ((src_pitch/64)<<22) | (src_offset >> 10);
- cmd[4].i = ((dst_pitch/64)<<22) | (dst_offset >> 10);
- cmd[5].i = (srcx << 16) | srcy;
- cmd[6].i = (dstx << 16) | dsty; /* dst */
- cmd[7].i = (w << 16) | h;
-}
-
-
-void r200EmitWait( r200ContextPtr rmesa, GLuint flags )
-{
- if (rmesa->dri.drmMinor >= 6) {
- drmRadeonCmdHeader *cmd;
-
- assert( !(flags & ~(RADEON_WAIT_2D|RADEON_WAIT_3D)) );
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, 1 * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].wait.cmd_type = RADEON_CMD_WAIT;
- cmd[0].wait.flags = flags;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.c b/xc/lib/GL/mesa/src/drv/r200/r200_context.c
deleted file mode 100644
index ac969e299..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_context.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "state.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_span.h"
-#include "r200_pixel.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_tcl.h"
-#include "r200_vtxfmt.h"
-#include "r200_maos.h"
-
-#define DRIVER_DATE "20030328"
-
-#include "vblank.h"
-#include "utils.h"
-#ifndef R200_DEBUG
-int R200_DEBUG = (0);
-#endif
-
-
-/* R200 configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 8;
-
-
-/* Return the width and height of the given buffer.
- */
-static void r200GetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->dri.drawable->w;
- *height = rmesa->dri.drawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = rmesa->r200Screen->IsPCI ? 0 :
- rmesa->r200Screen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "R200", DRIVER_DATE,
- agp_mode );
-
- sprintf( & buffer[ offset ], " %sTCL",
- !(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-" );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-/* Extension strings exported by the R200 driver.
- */
-static const char * const card_extensions[] =
-{
- "GL_ARB_multisample",
- "GL_ARB_multitexture",
- "GL_ARB_texture_border_clamp",
- "GL_ARB_texture_compression",
- "GL_ARB_texture_env_add",
- "GL_ARB_texture_env_combine",
- "GL_ARB_texture_env_dot3",
- "GL_ARB_texture_mirrored_repeat",
- "GL_EXT_blend_logic_op",
- "GL_EXT_blend_minmax",
- "GL_EXT_blend_subtract",
- "GL_EXT_secondary_color",
- "GL_EXT_stencil_wrap",
- "GL_EXT_texture_edge_clamp",
- "GL_EXT_texture_env_add",
- "GL_EXT_texture_env_combine",
- "GL_EXT_texture_env_dot3",
- "GL_EXT_texture_filter_anisotropic",
- "GL_EXT_texture_lod_bias",
- "GL_ATI_texture_env_combine3",
- "GL_ATI_texture_mirror_once",
- "GL_IBM_texture_mirrored_repeat",
- "GL_MESA_pack_invert",
- "GL_MESA_ycbcr_texture",
- "GL_NV_blend_square",
- "GL_NV_texture_rectangle",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_border_clamp",
- "GL_SGIS_texture_edge_clamp",
- NULL
-};
-
-extern const struct gl_pipeline_stage _r200_render_stage;
-extern const struct gl_pipeline_stage _r200_tcl_stage;
-
-static const struct gl_pipeline_stage *r200_pipeline[] = {
-
- /* Try and go straight to t&l
- */
- &_r200_tcl_stage,
-
- /* Catch any t&l fallbacks
- */
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
-
- /* Try again to go to tcl?
- * - no good for asymmetric-twoside (do with multipass)
- * - no good for asymmetric-unfilled (do with multipass)
- * - good for material
- * - good for texgen
- * - need to manipulate a bit of state
- *
- * - worth it/not worth it?
- */
-
- /* Else do them here.
- */
-/* &_r200_render_stage, */ /* FIXME: bugs with ut2003 */
- &_tnl_render_stage, /* FALLBACK: */
- 0,
-};
-
-
-
-/* Initialize the driver's misc functions.
- */
-static void r200InitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = r200GetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = r200GetString;
-
- ctx->Driver.Error = NULL;
- ctx->Driver.DrawPixels = NULL;
- ctx->Driver.Bitmap = NULL;
-}
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "code", DEBUG_CODEGEN },
- { "vfmt", DEBUG_VFMT },
- { "vtxf", DEBUG_VFMT },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "pix", DEBUG_PIXEL },
- { "mem", DEBUG_MEMORY },
- { NULL, 0 }
-};
-
-
-static int
-get_ust_nop( int64_t * ust )
-{
- *ust = 1;
- return 0;
-}
-
-
-/* Create the device specific context.
- */
-GLboolean r200CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- r200ScreenPtr screen = (r200ScreenPtr)(sPriv->private);
- r200ContextPtr rmesa;
- GLcontext *ctx, *shareCtx;
- int i;
- int tcl_mode, fthrottle_mode;
-
- assert(glVisual);
- assert(driContextPriv);
- assert(screen);
-
- /* Allocate the R200 context */
- rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((r200ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
-
- /* Init r200 context data */
- rmesa->dri.context = driContextPriv;
- rmesa->dri.screen = sPriv;
- rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
- rmesa->dri.hwContext = driContextPriv->hHWContext;
- rmesa->dri.hwLock = &sPriv->pSAREA->lock;
- rmesa->dri.fd = sPriv->fd;
- rmesa->dri.drmMinor = sPriv->drmMinor;
-
- /* Parse configuration files */
- driParseConfigFiles (&rmesa->optionCache, &screen->optionCache,
- screen->driScreen->myNum, "r200");
-
- rmesa->r200Screen = screen;
- rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA +
- screen->sarea_priv_offset);
-
-
- rmesa->dma.buf0_address = rmesa->r200Screen->buffers->list[0].address;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = 1 /* screen->numTexHeaps */ ;
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- screen->texSize[i],
- 12,
- RADEON_NR_TEX_REGIONS,
- rmesa->sarea->texList[i],
- & rmesa->sarea->texAge[i],
- & rmesa->swapped,
- sizeof( r200TexObj ),
- (destroy_texture_object_t *) r200DestroyTexObj );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( screen->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->lost_context = 1;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx = rmesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
-#if ENABLE_HW_3D_TEXTURE
- 8, /* max 3D texture size is 256^3 */
-#else
- 0, /* 3D textures unsupported */
-#endif
- 11, /* max cube texture size is 2048x2048 */
- 11, /* max texture rectangle size is 2048x2048 */
- 12,
- GL_FALSE );
-
- ctx->Const.MaxTextureMaxAnisotropy = 16.0;
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 0.0625;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _ae_create_context( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, r200_pipeline );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials( ctx, GL_TRUE );
-
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
-
- _math_matrix_ctr( &rmesa->TexGenMatrix[0] );
- _math_matrix_ctr( &rmesa->TexGenMatrix[1] );
- _math_matrix_ctr( &rmesa->tmpmat );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[0] );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[1] );
- _math_matrix_set_identity( &rmesa->tmpmat );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (rmesa->r200Screen->drmSupportsCubeMaps)
- _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
-
- r200InitDriverFuncs( ctx );
- r200InitIoctlFuncs( ctx );
- r200InitStateFuncs( ctx );
- r200InitSpanFuncs( ctx );
- r200InitPixelFuncs( ctx );
- r200InitTextureFuncs( ctx );
- r200InitState( rmesa );
- r200InitSwtcl( ctx );
-
- fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
- rmesa->iw.irq_seq = -1;
- rmesa->irqsEmitted = 0;
- rmesa->do_irqs = (rmesa->dri.drmMinor >= 6 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
- rmesa->r200Screen->irq);
-
- rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- if (!rmesa->do_irqs)
- fprintf(stderr,
- "IRQ's not enabled, falling back to %s: %d %d %d\n",
- rmesa->do_usleeps ? "usleeps" : "busy waits",
- rmesa->dri.drmMinor,
- fthrottle_mode,
- rmesa->r200Screen->irq);
-
- rmesa->vblank_flags = (rmesa->r200Screen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- rmesa->prefer_gart_client_texturing =
- (getenv("R200_GART_CLIENT_TEXTURES") != 0);
-
- rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
- if ( rmesa->get_ust == NULL ) {
- rmesa->get_ust = get_ust_nop;
- }
-
- (*rmesa->get_ust)( & rmesa->swap_ust );
-
-
-#if DO_DEBUG
- R200_DEBUG = driParseDebugString( getenv( "R200_DEBUG" ),
- debug_control );
- R200_DEBUG |= driParseDebugString( getenv( "RADEON_DEBUG" ),
- debug_control );
-#endif
-
- tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1);
- }
- else if (tcl_mode == DRI_CONF_TCL_SW) {
- fprintf(stderr, "disabling TCL support\n");
- TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
- }
- else {
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT) {
- r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
- }
- _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
- }
- return GL_TRUE;
-}
-
-
-/* Destroy the device specific context.
- */
-/* Destroy the Mesa and driver specific context data.
- */
-void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
- r200ContextPtr current = ctx ? R200_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (rmesa == current) {
- R200_FIREVERTICES( rmesa );
- _mesa_make_current2(NULL, NULL, NULL);
- }
-
- /* Free r200 context resources */
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- r200DestroySwtcl( rmesa->glCtx );
- r200ReleaseArrays( rmesa->glCtx, ~0 );
-
- if (rmesa->dma.current.buf) {
- r200ReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
- }
-
- if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) {
- int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- r200VtxfmtDestroy( rmesa->glCtx );
- }
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context( rmesa->glCtx );
-
- if (rmesa->state.scissor.pClipRects) {
- FREE(rmesa->state.scissor.pClipRects);
- rmesa->state.scissor.pClipRects = 0;
- }
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & rmesa->swapped ) );
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-}
-
-
-
-
-void
-r200SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- r200ContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( rmesa->doPageFlip ) {
- r200PageFlip( dPriv );
- }
- else {
- r200CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- r200ContextPtr newCtx =
- (r200ContextPtr) driContextPriv->driverPrivate;
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx);
-
- if ( newCtx->dri.drawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
- newCtx->dri.drawable = driDrawPriv;
- r200UpdateWindow( newCtx->glCtx );
- r200UpdateViewportOffset( newCtx->glCtx );
- }
-
- _mesa_make_current2( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if ( !newCtx->glCtx->Viewport.Width ) {
- _mesa_set_viewport( newCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h );
- }
-
- if (newCtx->vb.enabled)
- r200VtxfmtMakeCurrent( newCtx->glCtx );
-
- _mesa_update_state( newCtx->glCtx );
- r200ValidateState( newCtx->glCtx );
-
- } else {
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current( 0, 0 );
- }
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-r200UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, rmesa->glCtx);
-
- r200VtxfmtUnbindContext( rmesa->glCtx );
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.h b/xc/lib/GL/mesa/src/drv/r200/r200_context.h
deleted file mode 100644
index 0b2ce111f..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_context.h
+++ /dev/null
@@ -1,931 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_CONTEXT_H__
-#define __R200_CONTEXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <inttypes.h>
-#include "dri_util.h"
-#include "radeon_common.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "r200_reg.h"
-
-#define ENABLE_HW_3D_TEXTURE 0 /* XXX this is temporary! */
-
-struct r200_context;
-typedef struct r200_context r200ContextRec;
-typedef struct r200_context *r200ContextPtr;
-
-#include "r200_lock.h"
-#include "r200_screen.h"
-#include "mm.h"
-
-/* Flags for software fallback cases */
-/* See correponding strings in r200_swtcl.c */
-#define R200_FALLBACK_TEXTURE 0x1
-#define R200_FALLBACK_DRAW_BUFFER 0x2
-#define R200_FALLBACK_STENCIL 0x4
-#define R200_FALLBACK_RENDER_MODE 0x8
-#define R200_FALLBACK_BLEND_EQ 0x10
-#define R200_FALLBACK_BLEND_FUNC 0x20
-#define R200_FALLBACK_DISABLE 0x40
-#define R200_FALLBACK_BORDER_MODE 0x80
-
-/* The blit width for texture uploads
- */
-#define BLIT_WIDTH_BYTES 1024
-
-/* Use the templated vertex format:
- */
-#define COLOR_IS_RGBA
-#define TAG(x) r200##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*r200_tri_func)( r200ContextPtr,
- r200Vertex *,
- r200Vertex *,
- r200Vertex * );
-
-typedef void (*r200_line_func)( r200ContextPtr,
- r200Vertex *,
- r200Vertex * );
-
-typedef void (*r200_point_func)( r200ContextPtr,
- r200Vertex * );
-
-
-struct r200_colorbuffer_state {
- GLuint clear;
- GLint drawOffset, drawPitch;
- int roundEnable;
-};
-
-
-struct r200_depthbuffer_state {
- GLfloat scale;
-};
-
-struct r200_pixel_state {
- GLint readOffset, readPitch;
-};
-
-struct r200_scissor_state {
- XF86DRIClipRectRec rect;
- GLboolean enabled;
-
- GLuint numClipRects; /* Cliprects active */
- GLuint numAllocedClipRects; /* Cliprects available */
- XF86DRIClipRectPtr pClipRects;
-};
-
-struct r200_stencilbuffer_state {
- GLboolean hwBuffer;
- GLuint clear; /* rb3d_stencilrefmask value */
-};
-
-struct r200_stipple_state {
- GLuint mask[32];
-};
-
-
-
-#define TEX_0 0x1
-#define TEX_1 0x2
-#define TEX_ALL 0x3
-
-typedef struct r200_tex_obj r200TexObj, *r200TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r200_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drmRadeonTexImage image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
- GLuint pp_txfilter; /* hardware register values */
- GLuint pp_txformat;
- GLuint pp_txformat_x;
- GLuint pp_txoffset; /* Image location in texmem.
- All cube faces follow. */
- GLuint pp_txsize; /* npot only */
- GLuint pp_txpitch; /* npot only */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
-
- GLboolean border_fallback;
-};
-
-
-struct r200_texture_env_state {
- r200TexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-#define R200_MAX_TEXTURE_UNITS 3
-
-struct r200_texture_state {
- struct r200_texture_env_state unit[R200_MAX_TEXTURE_UNITS];
-};
-
-
-struct r200_state_atom {
- struct r200_state_atom *next, *prev;
- const char *name; /* for debug */
- int cmd_size; /* size in bytes */
- GLuint idx;
- int *cmd; /* one or more cmd's */
- int *lastcmd; /* one or more cmd's */
- GLboolean (*check)( GLcontext *, int ); /* is this state active? */
-};
-
-
-
-/* Trying to keep these relatively short as the variables are becoming
- * extravagently long. Drop the driver name prefix off the front of
- * everything - I think we know which driver we're in by now, and keep the
- * prefix to 3 letters unless absolutely impossible.
- */
-
-#define CTX_CMD_0 0
-#define CTX_PP_MISC 1
-#define CTX_PP_FOG_COLOR 2
-#define CTX_RE_SOLID_COLOR 3
-#define CTX_RB3D_BLENDCNTL 4
-#define CTX_RB3D_DEPTHOFFSET 5
-#define CTX_RB3D_DEPTHPITCH 6
-#define CTX_RB3D_ZSTENCILCNTL 7
-#define CTX_CMD_1 8
-#define CTX_PP_CNTL 9
-#define CTX_RB3D_CNTL 10
-#define CTX_RB3D_COLOROFFSET 11
-#define CTX_CMD_2 12 /* why */
-#define CTX_RB3D_COLORPITCH 13 /* why */
-#define CTX_STATE_SIZE 14
-
-#define SET_CMD_0 0
-#define SET_SE_CNTL 1
-#define SET_RE_CNTL 2 /* replace se_coord_fmt */
-#define SET_STATE_SIZE 3
-
-#define VTE_CMD_0 0
-#define VTE_SE_VTE_CNTL 1
-#define VTE_STATE_SIZE 2
-
-#define LIN_CMD_0 0
-#define LIN_RE_LINE_PATTERN 1
-#define LIN_RE_LINE_STATE 2
-#define LIN_CMD_1 3
-#define LIN_SE_LINE_WIDTH 4
-#define LIN_STATE_SIZE 5
-
-#define MSK_CMD_0 0
-#define MSK_RB3D_STENCILREFMASK 1
-#define MSK_RB3D_ROPCNTL 2
-#define MSK_RB3D_PLANEMASK 3
-#define MSK_STATE_SIZE 4
-
-#define VPT_CMD_0 0
-#define VPT_SE_VPORT_XSCALE 1
-#define VPT_SE_VPORT_XOFFSET 2
-#define VPT_SE_VPORT_YSCALE 3
-#define VPT_SE_VPORT_YOFFSET 4
-#define VPT_SE_VPORT_ZSCALE 5
-#define VPT_SE_VPORT_ZOFFSET 6
-#define VPT_STATE_SIZE 7
-
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
-
-#define MSC_CMD_0 0
-#define MSC_RE_MISC 1
-#define MSC_STATE_SIZE 2
-
-#define TAM_CMD_0 0
-#define TAM_DEBUG3 1
-#define TAM_STATE_SIZE 2
-
-#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1 /*2c00*/
-#define TEX_PP_TXFORMAT 2 /*2c04*/
-#define TEX_PP_TXFORMAT_X 3 /*2c08*/
-#define TEX_PP_TXSIZE 4 /*2c0c*/
-#define TEX_PP_TXPITCH 5 /*2c10*/
-#define TEX_PP_BORDER_COLOR 6 /*2c14*/
-#define TEX_CMD_1 7
-#define TEX_PP_TXOFFSET 8 /*2d00 */
-#define TEX_STATE_SIZE 9
-
-#define CUBE_CMD_0 0 /* 1 register follows */
-#define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */
-#define CUBE_CMD_1 2 /* 5 registers follow */
-#define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */
-#define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */
-#define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */
-#define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */
-#define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */
-#define CUBE_STATE_SIZE 8
-
-#define PIX_CMD_0 0
-#define PIX_PP_TXCBLEND 1
-#define PIX_PP_TXCBLEND2 2
-#define PIX_PP_TXABLEND 3
-#define PIX_PP_TXABLEND2 4
-#define PIX_STATE_SIZE 5
-
-#define TF_CMD_0 0
-#define TF_TFACTOR_0 1
-#define TF_TFACTOR_1 2
-#define TF_TFACTOR_2 3
-#define TF_TFACTOR_3 4
-#define TF_TFACTOR_4 5
-#define TF_TFACTOR_5 6
-#define TF_STATE_SIZE 7
-
-#define TCL_CMD_0 0
-#define TCL_LIGHT_MODEL_CTL_0 1
-#define TCL_LIGHT_MODEL_CTL_1 2
-#define TCL_PER_LIGHT_CTL_0 3
-#define TCL_PER_LIGHT_CTL_1 4
-#define TCL_PER_LIGHT_CTL_2 5
-#define TCL_PER_LIGHT_CTL_3 6
-#define TCL_CMD_1 7
-#define TCL_UCP_VERT_BLEND_CTL 8
-#define TCL_STATE_SIZE 9
-
-#define MSL_CMD_0 0
-#define MSL_MATRIX_SELECT_0 1
-#define MSL_MATRIX_SELECT_1 2
-#define MSL_MATRIX_SELECT_2 3
-#define MSL_MATRIX_SELECT_3 4
-#define MSL_MATRIX_SELECT_4 5
-#define MSL_STATE_SIZE 6
-
-#define TCG_CMD_0 0
-#define TCG_TEX_PROC_CTL_2 1
-#define TCG_TEX_PROC_CTL_3 2
-#define TCG_TEX_PROC_CTL_0 3
-#define TCG_TEX_PROC_CTL_1 4
-#define TCG_TEX_CYL_WRAP_CTL 5
-#define TCG_STATE_SIZE 6
-
-#define MTL_CMD_0 0
-#define MTL_EMMISSIVE_RED 1
-#define MTL_EMMISSIVE_GREEN 2
-#define MTL_EMMISSIVE_BLUE 3
-#define MTL_EMMISSIVE_ALPHA 4
-#define MTL_AMBIENT_RED 5
-#define MTL_AMBIENT_GREEN 6
-#define MTL_AMBIENT_BLUE 7
-#define MTL_AMBIENT_ALPHA 8
-#define MTL_DIFFUSE_RED 9
-#define MTL_DIFFUSE_GREEN 10
-#define MTL_DIFFUSE_BLUE 11
-#define MTL_DIFFUSE_ALPHA 12
-#define MTL_SPECULAR_RED 13
-#define MTL_SPECULAR_GREEN 14
-#define MTL_SPECULAR_BLUE 15
-#define MTL_SPECULAR_ALPHA 16
-#define MTL_CMD_1 17
-#define MTL_SHININESS 18
-#define MTL_STATE_SIZE 19
-
-#define VAP_CMD_0 0
-#define VAP_SE_VAP_CNTL 1
-#define VAP_STATE_SIZE 2
-
-/* Replaces a lot of packet info from radeon
- */
-#define VTX_CMD_0 0
-#define VTX_VTXFMT_0 1
-#define VTX_VTXFMT_1 2
-#define VTX_TCL_OUTPUT_VTXFMT_0 3
-#define VTX_TCL_OUTPUT_VTXFMT_1 4
-#define VTX_CMD_1 5
-#define VTX_TCL_OUTPUT_COMPSEL 6
-#define VTX_CMD_2 7
-#define VTX_STATE_CNTL 8
-#define VTX_STATE_SIZE 9
-
-
-#define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\
- R200_VTX_COLOR_MASK)
-
-#define MAT_CMD_0 0
-#define MAT_ELT_0 1
-#define MAT_STATE_SIZE 17
-
-#define GRD_CMD_0 0
-#define GRD_VERT_GUARD_CLIP_ADJ 1
-#define GRD_VERT_GUARD_DISCARD_ADJ 2
-#define GRD_HORZ_GUARD_CLIP_ADJ 3
-#define GRD_HORZ_GUARD_DISCARD_ADJ 4
-#define GRD_STATE_SIZE 5
-
-/* position changes frequently when lighting in modelpos - separate
- * out to new state item?
- */
-#define LIT_CMD_0 0
-#define LIT_AMBIENT_RED 1
-#define LIT_AMBIENT_GREEN 2
-#define LIT_AMBIENT_BLUE 3
-#define LIT_AMBIENT_ALPHA 4
-#define LIT_DIFFUSE_RED 5
-#define LIT_DIFFUSE_GREEN 6
-#define LIT_DIFFUSE_BLUE 7
-#define LIT_DIFFUSE_ALPHA 8
-#define LIT_SPECULAR_RED 9
-#define LIT_SPECULAR_GREEN 10
-#define LIT_SPECULAR_BLUE 11
-#define LIT_SPECULAR_ALPHA 12
-#define LIT_POSITION_X 13
-#define LIT_POSITION_Y 14
-#define LIT_POSITION_Z 15
-#define LIT_POSITION_W 16
-#define LIT_DIRECTION_X 17
-#define LIT_DIRECTION_Y 18
-#define LIT_DIRECTION_Z 19
-#define LIT_DIRECTION_W 20
-#define LIT_ATTEN_CONST 21
-#define LIT_ATTEN_LINEAR 22
-#define LIT_ATTEN_QUADRATIC 23
-#define LIT_ATTEN_XXX 24
-#define LIT_CMD_1 25
-#define LIT_SPOT_DCD 26
-#define LIT_SPOT_DCM 27
-#define LIT_SPOT_EXPONENT 28
-#define LIT_SPOT_CUTOFF 29
-#define LIT_SPECULAR_THRESH 30
-#define LIT_RANGE_CUTOFF 31 /* ? */
-#define LIT_RANGE_ATTEN 32 /* ? */
-#define LIT_STATE_SIZE 33
-
-/* Fog
- */
-#define FOG_CMD_0 0
-#define FOG_R 1
-#define FOG_C 2
-#define FOG_D 3
-#define FOG_PAD 4
-#define FOG_STATE_SIZE 5
-
-/* UCP
- */
-#define UCP_CMD_0 0
-#define UCP_X 1
-#define UCP_Y 2
-#define UCP_Z 3
-#define UCP_W 4
-#define UCP_STATE_SIZE 5
-
-/* GLT - Global ambient
- */
-#define GLT_CMD_0 0
-#define GLT_RED 1
-#define GLT_GREEN 2
-#define GLT_BLUE 3
-#define GLT_ALPHA 4
-#define GLT_STATE_SIZE 5
-
-/* EYE
- */
-#define EYE_CMD_0 0
-#define EYE_X 1
-#define EYE_Y 2
-#define EYE_Z 3
-#define EYE_RESCALE_FACTOR 4
-#define EYE_STATE_SIZE 5
-
-/* CST - constant state
- */
-#define CST_CMD_0 0
-#define CST_PP_CNTL_X 1
-#define CST_CMD_1 2
-#define CST_RB3D_DEPTHXY_OFFSET 3
-#define CST_CMD_2 4
-#define CST_RE_AUX_SCISSOR_CNTL 5
-#define CST_CMD_3 6
-#define CST_RE_SCISSOR_TL_0 7
-#define CST_RE_SCISSOR_BR_0 8
-#define CST_CMD_4 9
-#define CST_SE_VAP_CNTL_STATUS 10
-#define CST_CMD_5 11
-#define CST_RE_POINTSIZE 12
-#define CST_CMD_6 13
-#define CST_SE_TCL_INPUT_VTX_0 14
-#define CST_SE_TCL_INPUT_VTX_1 15
-#define CST_SE_TCL_INPUT_VTX_2 16
-#define CST_SE_TCL_INPUT_VTX_3 17
-#define CST_STATE_SIZE 18
-
-
-
-
-struct r200_hw_state {
- /* All state should be on one of these lists:
- */
- struct r200_state_atom dirty; /* dirty list head placeholder */
- struct r200_state_atom clean; /* clean list head placeholder */
-
- /* Hardware state, stored as cmdbuf commands:
- * -- Need to doublebuffer for
- * - reviving state after loss of context
- * - eliding noop statechange loops? (except line stipple count)
- */
- struct r200_state_atom ctx;
- struct r200_state_atom set;
- struct r200_state_atom vte;
- struct r200_state_atom lin;
- struct r200_state_atom msk;
- struct r200_state_atom vpt;
- struct r200_state_atom vap;
- struct r200_state_atom vtx;
- struct r200_state_atom tcl;
- struct r200_state_atom msl;
- struct r200_state_atom tcg;
- struct r200_state_atom msc;
- struct r200_state_atom cst;
- struct r200_state_atom tam;
- struct r200_state_atom tf;
- struct r200_state_atom tex[2];
- struct r200_state_atom cube[2];
- struct r200_state_atom zbs;
- struct r200_state_atom mtl[2];
- struct r200_state_atom mat[5];
- struct r200_state_atom lit[8]; /* includes vec, scl commands */
- struct r200_state_atom ucp[6];
- struct r200_state_atom pix[6]; /* pixshader stages */
- struct r200_state_atom eye; /* eye pos */
- struct r200_state_atom grd; /* guard band clipping */
- struct r200_state_atom fog;
- struct r200_state_atom glt;
-};
-
-struct r200_state {
- /* Derived state for internal purposes:
- */
- struct r200_colorbuffer_state color;
- struct r200_depthbuffer_state depth;
- struct r200_pixel_state pixel;
- struct r200_scissor_state scissor;
- struct r200_stencilbuffer_state stencil;
- struct r200_stipple_state stipple;
- struct r200_texture_state texture;
-};
-
-/* Need refcounting on dma buffers:
- */
-struct r200_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct r200_dma_region {
- struct r200_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
- int aos_start;
- int aos_stride;
- int aos_size;
-};
-
-
-struct r200_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct r200_dma_region current;
-
- void (*flush)( r200ContextPtr );
-
- char *buf0_address; /* start of buf[0], for index calcs */
- GLuint nr_released_bufs; /* flush after so many buffers released */
-};
-
-struct r200_dri_mirror {
- __DRIcontextPrivate *context; /* DRI context */
- __DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
-
- drmContext hwContext;
- drmLock *hwLock;
- int fd;
- int drmMinor;
-};
-
-
-#define R200_CMD_BUF_SZ (8*1024)
-
-struct r200_store {
- GLuint statenr;
- GLuint primnr;
- char cmd_buf[R200_CMD_BUF_SZ];
- int cmd_used;
- int elts_start;
-};
-
-
-/* r200_tcl.c
- */
-struct r200_tcl_info {
- GLuint vertex_format;
- GLint last_offset;
- GLuint hw_primitive;
-
- struct r200_dma_region *aos_components[8];
- GLuint nr_aos_components;
-
- GLuint *Elts;
-
- struct r200_dma_region indexed_verts;
- struct r200_dma_region obj;
- struct r200_dma_region rgba;
- struct r200_dma_region spec;
- struct r200_dma_region fog;
- struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS];
- struct r200_dma_region norm;
-};
-
-
-/* r200_swtcl.c
- */
-struct r200_swtcl_info {
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLubyte *verts;
-
- /* Fallback rasterization functions
- */
- r200_point_func draw_point;
- r200_line_func draw_line;
- r200_tri_func draw_tri;
-
- GLuint hw_primitive;
- GLenum render_primitive;
- GLuint numverts;
-
- struct r200_dma_region indexed_verts;
-};
-
-
-struct r200_ioctl {
- GLuint vertex_offset;
- GLuint vertex_size;
-};
-
-
-
-#define R200_MAX_PRIMS 64
-
-
-/* Want to keep a cache of these around. Each is parameterized by
- * only a single value which has only a small range. Only expect a
- * few, so just rescan the list each time?
- */
-struct dynfn {
- struct dynfn *next, *prev;
- int key[2];
- char *code;
-};
-
-struct dfn_lists {
- struct dynfn Vertex2f;
- struct dynfn Vertex2fv;
- struct dynfn Vertex3f;
- struct dynfn Vertex3fv;
- struct dynfn Color4ub;
- struct dynfn Color4ubv;
- struct dynfn Color3ub;
- struct dynfn Color3ubv;
- struct dynfn Color4f;
- struct dynfn Color4fv;
- struct dynfn Color3f;
- struct dynfn Color3fv;
- struct dynfn SecondaryColor3ubEXT;
- struct dynfn SecondaryColor3ubvEXT;
- struct dynfn SecondaryColor3fEXT;
- struct dynfn SecondaryColor3fvEXT;
- struct dynfn Normal3f;
- struct dynfn Normal3fv;
- struct dynfn TexCoord2f;
- struct dynfn TexCoord2fv;
- struct dynfn TexCoord1f;
- struct dynfn TexCoord1fv;
- struct dynfn MultiTexCoord2fARB;
- struct dynfn MultiTexCoord2fvARB;
- struct dynfn MultiTexCoord1fARB;
- struct dynfn MultiTexCoord1fvARB;
-};
-
-struct dfn_generators {
- struct dynfn *(*Vertex2f)( GLcontext *, const int * );
- struct dynfn *(*Vertex2fv)( GLcontext *, const int * );
- struct dynfn *(*Vertex3f)( GLcontext *, const int * );
- struct dynfn *(*Vertex3fv)( GLcontext *, const int * );
- struct dynfn *(*Color4ub)( GLcontext *, const int * );
- struct dynfn *(*Color4ubv)( GLcontext *, const int * );
- struct dynfn *(*Color3ub)( GLcontext *, const int * );
- struct dynfn *(*Color3ubv)( GLcontext *, const int * );
- struct dynfn *(*Color4f)( GLcontext *, const int * );
- struct dynfn *(*Color4fv)( GLcontext *, const int * );
- struct dynfn *(*Color3f)( GLcontext *, const int * );
- struct dynfn *(*Color3fv)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, const int * );
- struct dynfn *(*Normal3f)( GLcontext *, const int * );
- struct dynfn *(*Normal3fv)( GLcontext *, const int * );
- struct dynfn *(*TexCoord2f)( GLcontext *, const int * );
- struct dynfn *(*TexCoord2fv)( GLcontext *, const int * );
- struct dynfn *(*TexCoord1f)( GLcontext *, const int * );
- struct dynfn *(*TexCoord1fv)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, const int * );
-};
-
-
-
-struct r200_prim {
- GLuint start;
- GLuint end;
- GLuint prim;
-};
-
-struct r200_vbinfo {
- GLint counter, initial_counter;
- GLint *dmaptr;
- void (*notify)( void );
- GLint vertex_size;
-
- /* A maximum total of 15 elements per vertex: 3 floats for position, 3
- * floats for normal, 4 floats for color, 4 bytes for secondary color,
- * 2 floats for each texture unit (4 floats total).
- *
- * As soon as the 3rd TMU is supported or cube maps (or 3D textures) are
- * supported, this value will grow.
- *
- * The position data is never actually stored here, so 3 elements could be
- * trimmed out of the buffer.
- */
- union { float f; int i; r200_color_t color; } vertex[15];
-
- GLfloat *normalptr;
- GLfloat *floatcolorptr;
- r200_color_t *colorptr;
- GLfloat *floatspecptr;
- r200_color_t *specptr;
- GLfloat *texcoordptr[2];
-
-
- GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */
- GLuint primflags;
- GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */
- GLboolean installed;
- GLboolean fell_back;
- GLboolean recheck;
- GLint nrverts;
- GLuint vtxfmt_0, vtxfmt_1;
-
- GLuint installed_vertex_format;
- GLuint installed_color_3f_sz;
-
- struct r200_prim primlist[R200_MAX_PRIMS];
- int nrprims;
-
- struct dfn_lists dfn_cache;
- struct dfn_generators codegen;
- GLvertexformat vtxfmt;
-};
-
-
-
-
-struct r200_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- struct r200_hw_state hw;
- struct r200_state state;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ R200_NR_TEX_HEAPS ];
- driTextureObject swapped;
- int texture_depth;
-
-
- /* Rasterization and vertex state:
- */
- GLuint TclFallback;
- GLuint Fallback;
- GLuint NewGLState;
-
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Vertex buffers
- */
- struct r200_ioctl ioctl;
- struct r200_dma dma;
- struct r200_store store;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Busy waiting
- */
- GLuint do_usleeps;
- GLuint do_irqs;
- GLuint irqsEmitted;
- drmRadeonIrqWait iw;
-
- /* Clientdata textures;
- */
- GLuint prefer_gart_client_texturing;
-
- /* Drawable, cliprect and scissor information
- */
- GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
- unsigned int lastStamp;
- GLboolean lost_context;
- r200ScreenPtr r200Screen; /* Screen private DRI data */
- RADEONSAREAPrivPtr sarea; /* Private SAREA data */
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexMatCompSel;
- GLuint TexGenEnabled;
- GLuint TexGenInputs;
- GLuint TexGenCompSel;
- GLmatrix tmpmat;
-
- /* VBI / buffer swap
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- uint64_t swap_ust;
- uint64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
- PFNGLXGETUSTPROC get_ust;
-
- /* r200_tcl.c
- */
- struct r200_tcl_info tcl;
-
- /* r200_swtcl.c
- */
- struct r200_swtcl_info swtcl;
-
- /* r200_vtxfmt.c
- */
- struct r200_vbinfo vb;
-
- /* Mirrors of some DRI state
- */
- struct r200_dri_mirror dri;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx))
-
-
-static __inline GLuint r200PackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return PACK_COLOR_565( r, g, b );
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define R200_OLD_PACKETS 0
-
-
-extern void r200DestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv );
-extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-extern GLboolean r200UnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int R200_DEBUG;
-#else
-#define R200_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x001
-#define DEBUG_STATE 0x002
-#define DEBUG_IOCTL 0x004
-#define DEBUG_PRIMS 0x008
-#define DEBUG_VERTS 0x010
-#define DEBUG_FALLBACKS 0x020
-#define DEBUG_VFMT 0x040
-#define DEBUG_CODEGEN 0x080
-#define DEBUG_VERBOSE 0x100
-#define DEBUG_DRI 0x200
-#define DEBUG_DMA 0x400
-#define DEBUG_SANITY 0x800
-#define DEBUG_SYNC 0x1000
-#define DEBUG_PIXEL 0x2000
-#define DEBUG_MEMORY 0x4000
-
-#endif
-#endif /* __R200_CONTEXT_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c b/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c
deleted file mode 100644
index 284cd47b9..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c
+++ /dev/null
@@ -1,923 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tcl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-
-#include "vblank.h"
-
-
-#define R200_TIMEOUT 512
-#define R200_IDLE_RETRY 16
-
-
-static void r200WaitForIdle( r200ContextPtr rmesa );
-
-
-int r200FlushCmdBufLocked( r200ContextPtr rmesa, const char * caller )
-{
- int ret, i;
- drmRadeonCmdBuffer cmd;
-
- if (R200_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (0 & R200_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < rmesa->store.cmd_used ; i += 4 )
- fprintf(stderr, "%d: %x\n", i/4,
- *(int *)(&rmesa->store.cmd_buf[i]));
- }
-
- if (R200_DEBUG & DEBUG_DMA)
- fprintf(stderr, "%s: Releasing %d buffers\n", __FUNCTION__,
- rmesa->dma.nr_released_bufs);
-
-
- if (R200_DEBUG & DEBUG_SANITY) {
- if (rmesa->state.scissor.enabled)
- ret = r200SanityCmdBuffer( rmesa,
- rmesa->state.scissor.numClipRects,
- rmesa->state.scissor.pClipRects);
- else
- ret = r200SanityCmdBuffer( rmesa,
- rmesa->numClipRects,
- rmesa->pClipRects);
- if (ret) {
- fprintf(stderr, "drmSanityCommandWrite: %d\n", ret);
- goto out;
- }
- }
-
-
- if (R200_DEBUG & DEBUG_MEMORY) {
- if (! driValidateTextureHeaps( rmesa->texture_heaps, rmesa->nr_heaps,
- & rmesa->swapped ) ) {
- fprintf( stderr, "%s: texture memory is inconsistent - expect "
- "mangled textures\n", __FUNCTION__ );
- }
- }
-
-
- cmd.bufsz = rmesa->store.cmd_used;
- cmd.buf = rmesa->store.cmd_buf;
-
- if (rmesa->state.scissor.enabled) {
- cmd.nbox = rmesa->state.scissor.numClipRects;
- cmd.boxes = (drmClipRect *)rmesa->state.scissor.pClipRects;
- } else {
- cmd.nbox = rmesa->numClipRects;
- cmd.boxes = (drmClipRect *)rmesa->pClipRects;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd,
- DRM_RADEON_CMDBUF,
- &cmd, sizeof(cmd) );
-
- if (ret)
- fprintf(stderr, "drmCommandWrite: %d\n", ret);
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "\nSyncing in %s\n\n", __FUNCTION__);
- r200WaitForIdleLocked( rmesa );
- }
-
-
- out:
- rmesa->store.primnr = 0;
- rmesa->store.statenr = 0;
- rmesa->store.cmd_used = 0;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->lost_context = 1;
- return ret;
-}
-
-
-/* Note: does not emit any commands to avoid recursion on
- * r200AllocCmdBuf.
- */
-void r200FlushCmdBuf( r200ContextPtr rmesa, const char *caller )
-{
- int ret;
-
- LOCK_HARDWARE( rmesa );
-
- ret = r200FlushCmdBufLocked( rmesa, caller );
-
- UNLOCK_HARDWARE( rmesa );
-
- if (ret) {
- fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
- exit(ret);
- }
-}
-
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-
-void r200RefillCurrentDmaRegion( r200ContextPtr rmesa )
-{
- struct r200_dma_buffer *dmabuf;
- int fd = rmesa->dri.fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- int ret;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush) {
- rmesa->dma.flush( rmesa );
- }
-
- if (rmesa->dma.current.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
-
- if (rmesa->dma.nr_released_bufs > 4)
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
-
- dma.context = rmesa->dri.hwContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = RADEON_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- LOCK_HARDWARE(rmesa); /* no need to validate */
-
- while (1) {
- ret = drmDMA( fd, &dma );
- if (ret == 0)
- break;
-
- if (rmesa->dma.nr_released_bufs) {
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
-
- if (rmesa->do_usleeps) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
- UNLOCK_HARDWARE(rmesa);
-
- if (R200_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Allocated buffer %d\n", index);
-
- dmabuf = CALLOC_STRUCT( r200_dma_buffer );
- dmabuf->buf = &rmesa->r200Screen->buffers->list[index];
- dmabuf->refcount = 1;
-
- rmesa->dma.current.buf = dmabuf;
- rmesa->dma.current.address = dmabuf->buf->address;
- rmesa->dma.current.end = dmabuf->buf->total;
- rmesa->dma.current.start = 0;
- rmesa->dma.current.ptr = 0;
-}
-
-void r200ReleaseDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- const char *caller )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (!region->buf)
- return;
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (--region->buf->refcount == 0) {
- drmRadeonCmdHeader *cmd;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
- region->buf->buf->idx);
-
- cmd = (drmRadeonCmdHeader *)r200AllocCmdBuf( rmesa, sizeof(*cmd),
- __FUNCTION__ );
- cmd->dma.cmd_type = RADEON_CMD_DMA_DISCARD;
- cmd->dma.buf_idx = region->buf->buf->idx;
- FREE(region->buf);
- rmesa->dma.nr_released_bufs++;
- }
-
- region->buf = 0;
- region->start = 0;
-}
-
-/* Allocates a region from rmesa->dma.current. If there isn't enough
- * space in current, grab a new buffer (and discard what was left of current)
- */
-void r200AllocDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int bytes,
- int alignment )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (region->buf)
- r200ReleaseDmaRegion( rmesa, region, __FUNCTION__ );
-
- alignment--;
- rmesa->dma.current.start = rmesa->dma.current.ptr =
- (rmesa->dma.current.ptr + alignment) & ~alignment;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- r200RefillCurrentDmaRegion( rmesa );
-
- region->start = rmesa->dma.current.start;
- region->ptr = rmesa->dma.current.start;
- region->end = rmesa->dma.current.start + bytes;
- region->address = rmesa->dma.current.address;
- region->buf = rmesa->dma.current.buf;
- region->buf->refcount++;
-
- rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */
- rmesa->dma.current.start =
- rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7;
-
- assert( rmesa->dma.current.ptr <= rmesa->dma.current.end );
-}
-
-void r200AllocDmaRegionVerts( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts,
- int vertsize,
- int alignment )
-{
- r200AllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
-}
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static CARD32 r200GetLastFrame(r200ContextPtr rmesa)
-{
- drmRadeonGetParam gp;
- int ret;
- CARD32 frame;
-
- gp.param = RADEON_PARAM_LAST_FRAME;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp) );
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- return frame;
-}
-
-static void r200EmitIrqLocked( r200ContextPtr rmesa )
-{
- drmRadeonIrqEmit ie;
- int ret;
-
- ie.irq_seq = &rmesa->iw.irq_seq;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void r200WaitIrq( r200ContextPtr rmesa )
-{
- int ret;
-
- do {
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
- &rmesa->iw, sizeof(rmesa->iw) );
- } while (ret && (errno == EINTR || errno == EAGAIN));
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void r200WaitForFrameCompletion( r200ContextPtr rmesa )
-{
- RADEONSAREAPrivPtr sarea = rmesa->sarea;
-
- if (rmesa->do_irqs) {
- if (r200GetLastFrame(rmesa) < sarea->last_frame) {
- if (!rmesa->irqsEmitted) {
- while (r200GetLastFrame (rmesa) < sarea->last_frame)
- ;
- }
- else {
- UNLOCK_HARDWARE( rmesa );
- r200WaitIrq( rmesa );
- LOCK_HARDWARE( rmesa );
- }
- rmesa->irqsEmitted = 10;
- }
-
- if (rmesa->irqsEmitted) {
- r200EmitIrqLocked( rmesa );
- rmesa->irqsEmitted--;
- }
- }
- else {
- while (r200GetLastFrame (rmesa) < sarea->last_frame) {
- UNLOCK_HARDWARE( rmesa );
- if (rmesa->do_usleeps)
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-}
-
-
-
-/* Copy the back color buffer to the front color buffer.
- */
-void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- r200ContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
- int64_t ust;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, rmesa->glCtx );
- }
-
- R200_FIREVERTICES( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- r200WaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
-
- if ( ret ) {
- fprintf( stderr, "DRM_R200_SWAP_BUFFERS: return = %d\n", ret );
- UNLOCK_HARDWARE( rmesa );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->lost_context = 1;
-
- rmesa->swap_count++;
- (*rmesa->get_ust)( & ust );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- rmesa->swap_missed_ust = ust - rmesa->swap_ust;
- }
-
- rmesa->swap_ust = ust;
-
- sched_yield();
-}
-
-void r200PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- r200ContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__,
- rmesa->sarea->pfCurrentPage);
- }
-
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- if (!dPriv->numClipRects) {
- UNLOCK_HARDWARE( rmesa );
- usleep( 10000 ); /* throttle invisible client 10ms */
- return;
- }
-
- /* Need to do this for the perf box placement:
- */
- {
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- b[0] = box[0];
- rmesa->sarea->nbox = 1;
- }
-
- /* Throttle the frame rate -- only allow a few pending swap buffers
- * request at a time.
- */
- r200WaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- (void) (*rmesa->get_ust)( & rmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( rmesa );
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- rmesa->swap_count++;
- (void) (*rmesa->get_ust)( & rmesa->swap_ust );
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLuint flags = 0;
- GLuint color_mask = 0;
- GLint ret, i;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
- }
-
- {
- LOCK_HARDWARE( rmesa );
- UNLOCK_HARDWARE( rmesa );
- if ( dPriv->numClipRects == 0 )
- return;
- }
-
- r200EmitState( rmesa );
-
- /* Need to cope with lostcontext here as kernel relies on
- * some residual state:
- */
- R200_FIREVERTICES( rmesa );
-
- if ( mask & DD_FRONT_LEFT_BIT ) {
- flags |= RADEON_FRONT;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if ( mask & DD_BACK_LEFT_BIT ) {
- flags |= RADEON_BACK;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if ( mask & DD_DEPTH_BIT ) {
- if ( ctx->Depth.Mask ) flags |= RADEON_DEPTH; /* FIXME: ??? */
- mask &= ~DD_DEPTH_BIT;
- }
-
- if ( (mask & DD_STENCIL_BIT) && rmesa->state.stencil.hwBuffer ) {
- flags |= RADEON_STENCIL;
- mask &= ~DD_STENCIL_BIT;
- }
-
- if ( mask ) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
- }
-
- if ( !flags )
- return;
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the number of clear ioctls we do.
- */
- while ( 1 ) {
- drmRadeonGetParam gp;
- int ret;
- int clear;
-
- gp.param = RADEON_PARAM_LAST_CLEAR;
- gp.value = (int *)&clear;
- ret = drmCommandWriteRead( rmesa->dri.fd,
- DRM_RADEON_GETPARAM, &gp, sizeof(gp) );
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- /* Clear throttling needs more thought.
- */
- if ( rmesa->sarea->last_clear - clear <= 25 ) {
- break;
- }
-
- if (rmesa->do_usleeps) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
-
- for ( i = 0 ; i < dPriv->numClipRects ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, dPriv->numClipRects );
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- drmRadeonClearType clear;
- drmRadeonClearRect depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = rmesa->state.color.clear;
- clear.clear_depth = 0; /* not used */
- clear.color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- clear.depth_mask = rmesa->state.stencil.clear;
- clear.depth_boxes = depth_boxes;
-
- n--;
- b = rmesa->sarea->boxes;
- for ( ; n >= 0 ; n-- ) {
- depth_boxes[n].f[RADEON_CLEAR_X1] = (float)b[n].x1;
- depth_boxes[n].f[RADEON_CLEAR_Y1] = (float)b[n].y1;
- depth_boxes[n].f[RADEON_CLEAR_X2] = (float)b[n].x2;
- depth_boxes[n].f[RADEON_CLEAR_Y2] = (float)b[n].y2;
- depth_boxes[n].f[RADEON_CLEAR_DEPTH] = ctx->Depth.Clear;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_CLEAR,
- &clear, sizeof(drmRadeonClearType));
-
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_RADEON_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->lost_context = 1;
-}
-
-
-void r200WaitForIdleLocked( r200ContextPtr rmesa )
-{
- int ret;
- int i = 0;
-
- do {
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_CP_IDLE);
- if (ret)
- DO_USLEEP( 1 );
- } while (ret && ++i < 100);
-
- if ( ret < 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: R200 timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-
-static void r200WaitForIdle( r200ContextPtr rmesa )
-{
- LOCK_HARDWARE(rmesa);
- r200WaitForIdleLocked( rmesa );
- UNLOCK_HARDWARE(rmesa);
-}
-
-
-void r200Flush( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (!is_empty_list(&rmesa->hw.dirty))
- r200EmitState( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-void r200Finish( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200Flush( ctx );
-
- if (rmesa->do_irqs) {
- LOCK_HARDWARE( rmesa );
- r200EmitIrqLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- r200WaitIrq( rmesa );
- }
- else
- r200WaitForIdle( rmesa );
-}
-
-
-/* This version of AllocateMemoryMESA allocates only GART memory, and
- * only does so after the point at which the driver has been
- * initialized.
- *
- * Theoretically a valid context isn't required. However, in this
- * implementation, it is, as I'm using the hardware lock to protect
- * the kernel data structures, and the current context to get the
- * device fd.
- */
-void *r200AllocateMemoryMESA(Display *dpy, int scrn, GLsizei size,
- GLfloat readfreq, GLfloat writefreq,
- GLfloat priority)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- int region_offset;
- drmRadeonMemAlloc alloc;
- int ret;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq,
- writefreq, priority);
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map)
- return NULL;
-
- if (getenv("R200_NO_ALLOC"))
- return NULL;
-
- if (rmesa->dri.drmMinor < 6)
- return NULL;
-
- alloc.region = RADEON_MEM_REGION_GART;
- alloc.alignment = 0;
- alloc.size = size;
- alloc.region_offset = &region_offset;
-
- ret = drmCommandWriteRead( rmesa->r200Screen->driScreen->fd,
- DRM_RADEON_ALLOC,
- &alloc, sizeof(alloc));
-
- if (ret) {
- fprintf(stderr, "%s: DRM_RADEON_ALLOC ret %d\n", __FUNCTION__, ret);
- return NULL;
- }
-
- {
- char *region_start = (char *)rmesa->r200Screen->gartTextures.map;
- return (void *)(region_start + region_offset);
- }
-}
-
-
-/* Called via glXFreeMemoryMESA() */
-void r200FreeMemoryMESA(Display *dpy, int scrn, GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- int region_offset;
- drmRadeonMemFree memfree;
- int ret;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return;
- }
-
- if (rmesa->dri.drmMinor < 6)
- return;
-
- region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
-
- if (region_offset < 0 ||
- region_offset > rmesa->r200Screen->gartTextures.size) {
- fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
- rmesa->r200Screen->gartTextures.size);
- return;
- }
-
- memfree.region = RADEON_MEM_REGION_GART;
- memfree.region_offset = region_offset;
-
- ret = drmCommandWrite( rmesa->r200Screen->driScreen->fd,
- DRM_RADEON_FREE,
- &memfree, sizeof(memfree));
-
- if (ret)
- fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret);
-}
-
-/* Called via glXGetMemoryOffsetMESA() */
-GLuint r200GetMemoryOffsetMESA(Display *dpy, int scrn, const GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- GLuint card_offset;
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) ) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return ~0;
- }
-
- if (!r200IsGartMemory( rmesa, pointer, 0 ))
- return ~0;
-
- if (rmesa->dri.drmMinor < 6)
- return ~0;
-
- card_offset = r200GartOffsetFromVirtual( rmesa, pointer );
-
- return card_offset - rmesa->r200Screen->gart_base;
-}
-
-
-GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
- GLint size )
-{
- int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
- int valid = (size >= 0 &&
- offset >= 0 &&
- offset + size < rmesa->r200Screen->gartTextures.size);
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "r200IsGartMemory( %p ) : %d\n", pointer, valid );
-
- return valid;
-}
-
-
-GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer )
-{
- int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
-
- if (offset < 0 || offset > rmesa->r200Screen->gartTextures.size)
- return ~0;
- else
- return rmesa->r200Screen->gart_texture_offset + offset;
-}
-
-
-
-void r200InitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = r200Clear;
- ctx->Driver.Finish = r200Finish;
- ctx->Driver.Flush = r200Flush;
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h b/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h
deleted file mode 100644
index f06b6b415..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_IOCTL_H__
-#define __R200_IOCTL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "simple_list.h"
-#include "radeon_dri.h"
-#include "r200_lock.h"
-
-#include "xf86drm.h"
-#include "radeon_common.h"
-
-extern void r200EmitState( r200ContextPtr rmesa );
-extern void r200EmitVertexAOS( r200ContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset );
-
-extern void r200EmitVbufPrim( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint vertex_nr );
-
-extern void r200FlushElts( r200ContextPtr rmesa );
-
-extern GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint min_nr );
-
-extern void r200EmitAOS( r200ContextPtr rmesa,
- struct r200_dma_region **regions,
- GLuint n,
- GLuint offset );
-
-extern void r200EmitBlit( r200ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h );
-
-extern void r200EmitWait( r200ContextPtr rmesa, GLuint flags );
-
-extern void r200FlushCmdBuf( r200ContextPtr rmesa, const char * );
-extern int r200FlushCmdBufLocked( r200ContextPtr rmesa, const char * caller );
-
-extern void r200RefillCurrentDmaRegion( r200ContextPtr rmesa );
-
-extern void r200AllocDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int bytes,
- int alignment );
-
-extern void r200AllocDmaRegionVerts( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts,
- int vertsize,
- int alignment );
-
-extern void r200ReleaseDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- const char *caller );
-
-extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable );
-extern void r200PageFlip( const __DRIdrawablePrivate *drawable );
-extern void r200Flush( GLcontext *ctx );
-extern void r200Finish( GLcontext *ctx );
-extern void r200WaitForIdleLocked( r200ContextPtr rmesa );
-extern void r200WaitForVBlank( r200ContextPtr rmesa );
-extern void r200InitIoctlFuncs( GLcontext *ctx );
-
-extern void *r200AllocateMemoryMESA( Display *dpy, int scrn,
- GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority );
-extern void r200FreeMemoryMESA( Display *dpy, int scrn, GLvoid *pointer );
-extern GLuint r200GetMemoryOffsetMESA( Display *dpy, int scrn, const GLvoid *pointer );
-extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
- GLint size );
-
-extern GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa,
- const GLvoid *pointer );
-
-/* ================================================================
- * Helper macros:
- */
-
-/* Close off the last primitive, if it exists.
- */
-#define R200_NEWPRIM( rmesa ) \
-do { \
- if ( rmesa->dma.flush ) \
- rmesa->dma.flush( rmesa ); \
-} while (0)
-
-/* Can accomodate several state changes and primitive changes without
- * actually firing the buffer.
- */
-#define R200_STATECHANGE( rmesa, ATOM ) \
-do { \
- R200_NEWPRIM( rmesa ); \
- move_to_head( &(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \
-} while (0)
-
-#define R200_DB_STATE( ATOM ) \
- memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \
- rmesa->hw.ATOM.cmd_size * 4)
-
-static __inline int R200_DB_STATECHANGE(
- r200ContextPtr rmesa,
- struct r200_state_atom *atom )
-{
- if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size*4)) {
- int *tmp;
- R200_NEWPRIM( rmesa );
- move_to_head( &(rmesa->hw.dirty), atom );
- tmp = atom->cmd;
- atom->cmd = atom->lastcmd;
- atom->lastcmd = tmp;
- return 1;
- }
- else
- return 0;
-}
-
-
-/* Fire the buffered vertices no matter what.
- */
-#define R200_FIREVERTICES( rmesa ) \
-do { \
- if ( rmesa->store.cmd_used || rmesa->dma.flush ) { \
- r200Flush( rmesa->glCtx ); \
- } \
-} while (0)
-
-/* Alloc space in the command buffer
- */
-static __inline char *r200AllocCmdBuf( r200ContextPtr rmesa,
- int bytes, const char *where )
-{
- char * head;
-
- if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ)
- r200FlushCmdBuf( rmesa, where );
-
- head = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- rmesa->store.cmd_used += bytes;
- assert( rmesa->store.cmd_used <= R200_CMD_BUF_SZ );
- return head;
-}
-
-
-
-
-#endif
-#endif /* __R200_IOCTL_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_lock.c b/xc/lib/GL/mesa/src/drv/r200/r200_lock.c
deleted file mode 100644
index 3c3356eec..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_lock.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "r200_context.h"
-#include "r200_lock.h"
-#include "r200_tex.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-r200UpdatePageFlipping( r200ContextPtr rmesa )
-{
- int use_back;
- rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if (use_back) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void r200GetLock( r200ContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- __DRIscreenPrivate *sPriv = rmesa->dri.screen;
- RADEONSAREAPrivPtr sarea = rmesa->sarea;
- int i;
-
- drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( rmesa->lastStamp != dPriv->lastStamp ) {
- r200UpdatePageFlipping( rmesa );
- if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
- r200SetCliprects( rmesa, GL_BACK_LEFT );
- else
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
- r200UpdateViewportOffset( rmesa->glCtx );
- rmesa->lastStamp = dPriv->lastStamp;
- }
-
- if ( sarea->ctxOwner != rmesa->dri.hwContext ) {
- sarea->ctxOwner = rmesa->dri.hwContext;
- }
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[ i ] );
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_lock.h b/xc/lib/GL/mesa/src/drv/r200/r200_lock.h
deleted file mode 100644
index 7a4dfcf15..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_lock.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_LOCK_H__
-#define __R200_LOCK_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r200GetLock( r200ContextPtr rmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->dri.hwLock, rmesa->dri.hwContext, \
- (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret ); \
- if ( __ret ) \
- r200GetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->dri.fd, \
- rmesa->dri.hwLock, \
- rmesa->dri.hwContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
-#endif /* __R200_LOCK_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos.c b/xc/lib/GL/mesa/src/drv/r200/r200_maos.c
deleted file mode 100644
index fd2bd5102..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos.c
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-/* If using new packets, can choose either verts or arrays.
- * Otherwise, must use verts.
- */
-#include "r200_context.h"
-#define R200_MAOS_VERTS 0
-#if (R200_MAOS_VERTS) || (R200_OLD_PACKETS)
-#include "r200_maos_verts.c"
-#else
-#include "r200_maos_arrays.c"
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos.h b/xc/lib/GL/mesa/src/drv/r200/r200_maos.h
deleted file mode 100644
index a430497db..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_MAOS_H__
-#define __R200_MAOS_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-extern void r200EmitArrays( GLcontext *ctx, GLuint inputs );
-extern void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c b/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c
deleted file mode 100644
index 7842c0c59..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_imm_debug.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
-/* Usage:
- * - from r200_tcl_render
- * - call r200EmitArrays to ensure uptodate arrays in dma
- * - emit primitives (new type?) which reference the data
- * -- need to use elts for lineloop, quads, quadstrip/flat
- * -- other primitives are all well-formed (need tristrip-1,fake-poly)
- *
- */
-static void emit_ubyte_rgba3( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- r200_color_t *out = (r200_color_t *)(rvb->start + rvb->address);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p\n",
- __FUNCTION__, count, stride, out);
-
- for (i = 0; i < count; i++) {
- out->red = *data;
- out->green = *(data+1);
- out->blue = *(data+2);
- out->alpha = 0xFF;
- out++;
- data += stride;
- }
-}
-
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-
-static void emit_ubyte_rgba4( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4) {
- for (i = 0; i < count; i++)
- ((int *)out)[i] = LE32_TO_CPU(((int *)data)[i]);
- } else {
- for (i = 0; i < count; i++) {
- *(int *)out++ = LE32_TO_CPU(*(int *)data);
- data += stride;
- }
- }
-}
-
-
-static void emit_ubyte_rgba( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- r200AllocDmaRegion( rmesa, rvb, 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = 1;
- }
- else {
- r200AllocDmaRegion( rmesa, rvb, 4 * count, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 1;
- rvb->aos_size = 1;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 3:
- emit_ubyte_rgba3( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_ubyte_rgba4( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-
-
-static void emit_vec4( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS( out, data, count );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out++;
- data += stride;
- }
-}
-
-
-static void emit_vec8( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 8)
- COPY_DWORDS( out, data, count*2 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out += 2;
- data += stride;
- }
-}
-
-static void emit_vec12( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, out, data);
-
- if (stride == 12)
- COPY_DWORDS( out, data, count*3 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out += 3;
- data += stride;
- }
-}
-
-static void emit_vec16( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 16)
- COPY_DWORDS( out, data, count*4 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out[3] = *(int *)(data+12);
- out += 4;
- data += stride;
- }
-}
-
-
-static void emit_vector( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d size %d stride %d\n",
- __FUNCTION__, count, size, stride);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- r200AllocDmaRegion( rmesa, rvb, size * 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = size;
- }
- else {
- r200AllocDmaRegion( rmesa, rvb, size * count * 4, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = size;
- rvb->aos_size = size;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_vec4( ctx, rvb, data, stride, count );
- break;
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec12( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_vec16( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-
-}
-
-
-
-/* Emit any changed arrays to new GART memory, re-emit a packet to
- * update the arrays.
- */
-void r200EmitArrays( GLcontext *ctx, GLuint inputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- struct r200_dma_region **component = rmesa->tcl.aos_components;
- GLuint nr = 0;
- GLuint vfmt0 = 0, vfmt1 = 0;
- GLuint count = VB->Count;
-
- if (R200_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, inputs );
-
- if (1) {
- if (!rmesa->tcl.obj.buf)
- emit_vector( ctx,
- &rmesa->tcl.obj,
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
- count);
-
- switch( VB->ObjPtr->size ) {
- case 4: vfmt0 |= R200_VTX_W0;
- case 3: vfmt0 |= R200_VTX_Z0;
- case 2:
- default:
- break;
- }
- component[nr++] = &rmesa->tcl.obj;
- }
-
-
- if (inputs & VERT_BIT_NORMAL) {
- if (!rmesa->tcl.norm.buf)
- emit_vector( ctx,
- &(rmesa->tcl.norm),
- (char *)VB->NormalPtr->data,
- 3,
- VB->NormalPtr->stride,
- count);
-
- vfmt0 |= R200_VTX_N0;
- component[nr++] = &rmesa->tcl.norm;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
- if (!rmesa->tcl.rgba.buf)
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.rgba,
- (char *)VB->ColorPtr[0]->Ptr,
- VB->ColorPtr[0]->Size,
- VB->ColorPtr[0]->StrideB,
- count);
-
- vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
- }
- else {
- int emitsize;
-
- if (VB->ColorPtr[0]->Size == 4 &&
- (VB->ColorPtr[0]->StrideB != 0 ||
- ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) {
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- emitsize = 4;
- }
- else {
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->Ptr,
- emitsize,
- VB->ColorPtr[0]->StrideB,
- count);
- }
-
- component[nr++] = &rmesa->tcl.rgba;
- }
-
-
- if (inputs & VERT_BIT_COLOR1) {
- if (!rmesa->tcl.spec.buf) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- r200_import_float_spec_colors( ctx );
-
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->Ptr,
- 3,
- VB->SecondaryColorPtr[0]->StrideB,
- count);
- }
-
- /* How does this work?
- */
- vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT;
- component[nr++] = &rmesa->tcl.spec;
- }
-
-/* vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] & */
-/* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1)); */
-
- if (inputs & VERT_BIT_TEX0) {
- if (!rmesa->tcl.tex[0].buf)
- emit_vector( ctx,
- &(rmesa->tcl.tex[0]),
- (char *)VB->TexCoordPtr[0]->data,
- VB->TexCoordPtr[0]->size,
- VB->TexCoordPtr[0]->stride,
- count );
-
- vfmt1 |= VB->TexCoordPtr[0]->size << R200_VTX_TEX0_COMP_CNT_SHIFT;
- component[nr++] = &rmesa->tcl.tex[0];
- }
-
- if (inputs & VERT_BIT_TEX1) {
- if (!rmesa->tcl.tex[1].buf)
- emit_vector( ctx,
- &(rmesa->tcl.tex[1]),
- (char *)VB->TexCoordPtr[1]->data,
- VB->TexCoordPtr[1]->size,
- VB->TexCoordPtr[1]->stride,
- count );
-
- vfmt1 |= VB->TexCoordPtr[1]->size << R200_VTX_TEX1_COMP_CNT_SHIFT;
- component[nr++] = &rmesa->tcl.tex[1];
- }
-
- if (vfmt0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
- vfmt1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = vfmt0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = vfmt1;
- }
-
- rmesa->tcl.nr_aos_components = nr;
- rmesa->tcl.vertex_format = vfmt0;
-}
-
-
-void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-
- if (newinputs & VERT_BIT_POS)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_NORMAL)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR0)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR1)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX0)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX1)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h b/xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h
deleted file mode 100644
index ce258d798..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-#undef TCL_DEBUG
-#ifndef TCL_DEBUG
-#define TCL_DEBUG 0
-#endif
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint (*tc0)[4], (*tc1)[4];
- GLfloat *fog;
- GLuint (*tc2)[4], (*norm)[3];
- GLubyte (*col)[4], (*spec)[4];
- GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
- GLuint tc2_stride, norm_stride;
- GLuint (*coord)[4];
- GLuint coord_stride;
- GLubyte dummy[4];
- int i;
-
- union emit_union *v = (union emit_union *)dest;
-
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* The vertex code expects Obj to be clean to element 3. To fix
- * this, add more vertex code (for obj-2, obj-3) or preferably move
- * to maos.
- */
- if (VB->ObjPtr->size < 3) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 );
- }
-
- if (DO_W && VB->ObjPtr->size < 4) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 );
- }
-
- coord = (GLuint (*)[4])VB->ObjPtr->data;
- coord_stride = VB->ObjPtr->stride;
-
- if (DO_TEX2) {
- const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
- if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX2, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 );
- }
- }
-
- if (DO_TEX1) {
- if (VB->TexCoordPtr[1]) {
- const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
- if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX1, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 );
- }
- } else {
- tc1 = (GLuint (*)[4])&ctx->Current.Texcoord[1]; /* could be anything, really */
- tc1_stride = 0;
- }
- }
-
- if (DO_TEX0) {
- if (VB->TexCoordPtr[0]) {
- const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
- if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
- if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX0, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 );
- }
- } else {
- tc0 = (GLuint (*)[4])&ctx->Current.Texcoord[0]; /* could be anything, really */
- tc0_stride = 0;
- }
-
- }
-
- if (DO_NORM) {
- if (VB->NormalPtr) {
- norm_stride = VB->NormalPtr->stride;
- norm = (GLuint (*)[3])VB->NormalPtr->data;
- } else {
- norm_stride = 0;
- norm = (GLuint (*)[3])&ctx->Current.Normal;
- }
- }
-
- if (DO_RGBA) {
- if (VB->ColorPtr[0]) {
- /* This is incorrect when colormaterial is enabled:
- */
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) {
- if (0) fprintf(stderr, "IMPORTING FLOAT COLORS\n");
- IMPORT_FLOAT_COLORS( ctx );
- }
- col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
- } else {
- col = &dummy; /* any old memory is fine */
- col_stride = 0;
- }
-
- }
-
- if (DO_SPEC) {
- if (VB->SecondaryColorPtr[0]) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- IMPORT_FLOAT_SPEC_COLORS( ctx );
- spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
- spec_stride = VB->SecondaryColorPtr[0]->StrideB;
- } else {
- spec = &dummy;
- spec_stride = 0;
- }
-
- }
-
- if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- } else {
- fog = (GLfloat *)&dummy; *fog = 0;
- fog_stride = 0;
- }
-
- }
-
-
- if (VB->importable_data) {
- if (start) {
- coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride);
- if (DO_TEX0)
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (DO_TEX1)
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (DO_TEX2)
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
- if (DO_NORM)
- norm = (GLuint (*)[3])((GLubyte *)norm + start * norm_stride);
- if (DO_RGBA)
- STRIDE_4UB(col, start * col_stride);
- if (DO_SPEC)
- STRIDE_4UB(spec, start * spec_stride);
- if (DO_FOG)
- STRIDE_F(fog, start * fog_stride);
- }
-
- for (i=start; i < end; i++) {
- v[0].ui = coord[0][0];
- v[1].ui = coord[0][1];
- v[2].ui = coord[0][2];
- if (TCL_DEBUG) fprintf(stderr, "%d: %.2f %.2f %.2f ", i, v[0].f, v[1].f, v[2].f);
- if (DO_W) {
- v[3].ui = coord[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[3].f);
- v += 4;
- }
- else
- v += 3;
- coord = (GLuint (*)[4])((GLubyte *)coord + coord_stride);
-
- if (DO_NORM) {
- v[0].ui = norm[0][0];
- v[1].ui = norm[0][1];
- v[2].ui = norm[0][2];
- if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f);
- v += 3;
- norm = (GLuint (*)[3])((GLubyte *)norm + norm_stride);
- }
- if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]);
- STRIDE_4UB(col, col_stride);
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- v[0].ub[0] = spec[0][0];
- v[0].ub[1] = spec[0][1];
- v[0].ub[2] = spec[0][2];
- STRIDE_4UB(spec, spec_stride);
- }
- if (DO_FOG) {
- v[0].ub[3] = fog[0] * 255.0;
- STRIDE_F(fog, fog_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[0][0];
- v[1].ui = tc0[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- v[2].ui = tc0[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (DO_TEX1) {
- v[0].ui = tc1[0][0];
- v[1].ui = tc1[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- v[2].ui = tc1[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- if (DO_TEX2) {
- v[0].ui = tc2[0][0];
- v[1].ui = tc2[0][1];
- if (DO_PTEX) {
- v[2].ui = tc2[0][3];
- v += 3;
- }
- else
- v += 2;
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + tc2_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "\n");
- }
- } else {
- for (i=start; i < end; i++) {
- v[0].ui = coord[i][0];
- v[1].ui = coord[i][1];
- v[2].ui = coord[i][2];
- if (DO_W) {
- v[3].ui = coord[i][3];
- v += 4;
- }
- else
- v += 3;
-
- if (DO_NORM) {
- v[0].ui = norm[i][0];
- v[1].ui = norm[i][1];
- v[2].ui = norm[i][2];
- v += 3;
- }
- if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[i]);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- v[0].ub[0] = spec[i][0];
- v[0].ub[1] = spec[i][1];
- v[0].ub[2] = spec[i][2];
- }
- if (DO_FOG) {
- v[0].ub[3] = fog[i] * 255.0;
- }
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[i][0];
- v[1].ui = tc0[i][1];
- if (DO_PTEX) {
- v[2].ui = tc0[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX1) {
- v[0].ui = tc1[i][0];
- v[1].ui = tc1[i][1];
- if (DO_PTEX) {
- v[2].ui = tc1[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX2) {
- v[0].ui = tc2[i][0];
- v[1].ui = tc2[i][1];
- if (DO_PTEX) {
- v[2].ui = tc2[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- }
- }
-}
-
-
-
-static void TAG(init)( void )
-{
- int sz = 3;
- if (DO_W) sz++;
- if (DO_NORM) sz += 3;
- if (DO_RGBA) sz++;
- if (DO_SPEC || DO_FOG) sz++;
- if (DO_TEX0) sz += 2;
- if (DO_TEX0 && DO_PTEX) sz++;
- if (DO_TEX1) sz += 2;
- if (DO_TEX1 && DO_PTEX) sz++;
- if (DO_TEX2) sz += 2;
- if (DO_TEX2 && DO_PTEX) sz++;
-
- setup_tab[IDX].emit = TAG(emit);
- setup_tab[IDX].vertex_format = IND;
- setup_tab[IDX].vertex_size = sz;
-}
-
-
-#undef IND
-#undef TAG
-#undef IDX
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c b/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c
deleted file mode 100644
index 872bbd47f..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mmath.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_imm_debug.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
-
-#define R200_TCL_MAX_SETUP 13
-
-union emit_union { float f; GLuint ui; GLubyte ub[4]; };
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
- GLuint vertex_size;
- GLuint vertex_format;
-} setup_tab[R200_TCL_MAX_SETUP];
-
-#define DO_W (IND & R200_CP_VC_FRMT_W0)
-#define DO_RGBA (IND & R200_CP_VC_FRMT_PKCOLOR)
-#define DO_SPEC (IND & R200_CP_VC_FRMT_PKSPEC)
-#define DO_FOG (IND & R200_CP_VC_FRMT_PKSPEC)
-#define DO_TEX0 (IND & R200_CP_VC_FRMT_ST0)
-#define DO_TEX1 (IND & R200_CP_VC_FRMT_ST1)
-#define DO_PTEX (IND & R200_CP_VC_FRMT_Q0)
-#define DO_NORM (IND & R200_CP_VC_FRMT_N0)
-
-#define DO_TEX2 0
-#define DO_TEX3 0
-
-#define GET_TEXSOURCE(n) n
-#define GET_UBYTE_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define IMPORT_FLOAT_COLORS r200_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r200_import_float_spec_colors
-
-/***********************************************************************
- * Generate vertex emit functions *
- ***********************************************************************/
-
-
-/* Defined in order of increasing vertex size:
- */
-#define IDX 0
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR)
-#define TAG(x) x##_rgba
-#include "r200_maos_vbtmp.h"
-
-#define IDX 1
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 2
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_ST0)
-#define TAG(x) x##_rgba_st
-#include "r200_maos_vbtmp.h"
-
-#define IDX 3
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 4
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 5
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_st_st
-#include "r200_maos_vbtmp.h"
-
-#define IDX 6
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_st_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 7
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_PKSPEC| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_spec_st_st
-#include "r200_maos_vbtmp.h"
-
-#define IDX 8
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_ST1| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_st_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 9
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_PKSPEC| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_ST1| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgpa_spec_st_st_n
-#include "r200_maos_vbtmp.h"
-
-#define IDX 10
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq
-#include "r200_maos_vbtmp.h"
-
-#define IDX 11
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_ST1| \
- R200_CP_VC_FRMT_Q1| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq_stq
-#include "r200_maos_vbtmp.h"
-
-#define IDX 12
-#define IND (R200_CP_VC_FRMT_XY| \
- R200_CP_VC_FRMT_Z| \
- R200_CP_VC_FRMT_W0| \
- R200_CP_VC_FRMT_PKCOLOR| \
- R200_CP_VC_FRMT_PKSPEC| \
- R200_CP_VC_FRMT_ST0| \
- R200_CP_VC_FRMT_Q0| \
- R200_CP_VC_FRMT_ST1| \
- R200_CP_VC_FRMT_Q1| \
- R200_CP_VC_FRMT_N0)
-#define TAG(x) x##_w_rgpa_spec_stq_stq_n
-#include "r200_maos_vbtmp.h"
-
-
-
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-
-static void init_tcl_verts( void )
-{
- init_rgba();
- init_n();
- init_rgba_n();
- init_rgba_st();
- init_st_n();
- init_rgba_st_st();
- init_rgba_st_n();
- init_rgba_spec_st_st();
- init_st_st_n();
- init_rgpa_spec_st_st_n();
- init_rgba_stq();
- init_rgba_stq_stq();
- init_w_rgpa_spec_stq_stq_n();
-}
-
-
-void r200EmitArrays( GLcontext *ctx, GLuint inputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint req = 0;
- GLuint vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
- ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1));
- int i;
- static int firsttime = 1;
-
- if (firsttime) {
- init_tcl_verts();
- firsttime = 0;
- }
-
- if (1) {
- req |= R200_CP_VC_FRMT_Z;
- if (VB->ObjPtr->size == 4) {
- req |= R200_CP_VC_FRMT_W0;
- }
- }
-
- if (inputs & VERT_BIT_NORMAL) {
- req |= R200_CP_VC_FRMT_N0;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- req |= R200_CP_VC_FRMT_PKCOLOR;
- }
-
- if (inputs & VERT_BIT_COLOR1) {
- req |= R200_CP_VC_FRMT_PKSPEC;
- }
-
- if (inputs & VERT_BIT_TEX0) {
- req |= R200_CP_VC_FRMT_ST0;
-
- if (VB->TexCoordPtr[0]->size == 4) {
- req |= R200_CP_VC_FRMT_Q0;
- vtx |= R200_TCL_VTX_Q0;
- }
- }
-
- if (inputs & VERT_BIT_TEX1) {
- req |= R200_CP_VC_FRMT_ST1;
-
- if (VB->TexCoordPtr[1]->size == 4) {
- req |= R200_CP_VC_FRMT_Q1;
- vtx |= R200_TCL_VTX_Q1;
- }
- }
-
- if (vtx != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT]) {
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] = vtx;
- }
-
- for (i = 0 ; i < R200_TCL_MAX_SETUP ; i++)
- if ((setup_tab[i].vertex_format & req) == req)
- break;
-
- if (rmesa->tcl.vertex_format == setup_tab[i].vertex_format &&
- rmesa->tcl.indexed_verts.buf)
- return;
-
- if (rmesa->tcl.indexed_verts.buf)
- r200ReleaseArrays( ctx, ~0 );
-
- r200AllocDmaRegionVerts( rmesa,
- &rmesa->tcl.indexed_verts,
- VB->Count,
- setup_tab[i].vertex_size * 4,
- 4);
-
- setup_tab[i].emit( ctx, 0, VB->Count,
- rmesa->tcl.indexed_verts.address +
- rmesa->tcl.indexed_verts.start );
-
- rmesa->tcl.vertex_format = setup_tab[i].vertex_format;
- rmesa->tcl.indexed_verts.aos_start = GET_START( &rmesa->tcl.indexed_verts );
- rmesa->tcl.indexed_verts.aos_size = setup_tab[i].vertex_size;
- rmesa->tcl.indexed_verts.aos_stride = setup_tab[i].vertex_size;
-
- rmesa->tcl.aos_components[0] = &rmesa->tcl.indexed_verts;
- rmesa->tcl.nr_aos_components = 1;
-}
-
-
-
-void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-
- if (newinputs)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.indexed_verts, __FUNCTION__ );
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c b/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c
deleted file mode 100644
index 806484404..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "texutil.h"
-#include "swrast/swrast.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_pixel.h"
-#include "r200_swtcl.h"
-
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint cpp = rmesa->r200Screen->cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( (pitch & 63) ||
- ctx->_ImageTransferState ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed 1\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV &&
- cpp == 4 &&
- format == GL_BGRA ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: passed 2\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- return GL_FALSE;
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- int result;
- result = (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
- ) &&
- ctx->Current.RasterPosValid);
-
- return result;
-}
-
-
-
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *size )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * rmesa->r200Screen->frontPitch +
- (*x + *width - 1) * rmesa->r200Screen->cpp);
-
- return GL_TRUE;
-}
-
-static GLboolean
-r200TryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint size;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- GLint blit_format;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Only accelerate reading to GART buffers.
- */
- if ( !r200IsGartMemory(rmesa, pixels,
- pitch * height * rmesa->r200Screen->cpp ) ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Need GL_PACK_INVERT_MESA to cope with upsidedown results from
- * blitter:
- */
- if (!pack->Invert) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, pack, pixels, size, pitch))
- return GL_FALSE;
-
- switch ( rmesa->r200Screen->cpp ) {
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return GL_FALSE;
- }
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects and drawOffset are
- * correct.
- *
- * This is an unusual situation however, as the code which flushes
- * a full command buffer expects to be called unlocked. As a
- * workaround, immediately flush the buffer on aquiring the lock.
- */
- LOCK_HARDWARE( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( rmesa );
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s totally clipped -- nothing to do\n",
- __FUNCTION__);
- return GL_TRUE;
- }
-
- {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- int nbox = dPriv->numClipRects;
- int src_offset = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp;
- int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int dst_pitch = pitch * rmesa->r200Screen->cpp;
- XF86DRIClipRectRec *box = dPriv->pClipRects;
- int i;
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
- src_pitch, dst_pitch);
-
- for (i = 0 ; i < nbox ; i++)
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- dst_pitch, dst_offset,
- bx, by,
- bx - x, by - y,
- bw, bh );
- }
-
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
- UNLOCK_HARDWARE( rmesa );
-
- r200Finish( ctx ); /* required by GL */
-
- return GL_TRUE;
-}
-
-static void
-r200ReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint planemask)
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int i;
- int blit_format;
- int size;
- int src_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int src_pitch = pitch * rmesa->r200Screen->cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch ( rmesa->r200Screen->cpp ) {
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
-
- LOCK_HARDWARE( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- y -= height; /* cope with pixel zoom */
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( rmesa );
- return;
- }
-
- y = dPriv->h - y - height; /* convert from gl to hardware coords */
- x += dPriv->x;
- y += dPriv->y;
-
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- for (i = 0 ; i < nbox ; i++ )
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- rmesa->state.color.drawPitch * rmesa->r200Screen->cpp,
- rmesa->state.color.drawOffset + rmesa->r200Screen->fbLocation,
- bx - x, by - y,
- bx, by,
- bw, bh );
- }
-
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- r200WaitForIdleLocked( rmesa ); /* required by GL */
- UNLOCK_HARDWARE( rmesa );
-}
-
-
-
-
-static GLboolean
-r200TryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint planemask;
- GLuint cpp = rmesa->r200Screen->cpp;
- GLint size = width * pitch * cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case GL_RGB:
- case GL_RGBA:
- case GL_BGRA:
- planemask = r200PackColor(cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (cpp == 2)
- planemask |= planemask << 16;
-
- if (planemask != ~0)
- return GL_FALSE; /* fix me -- should be possible */
-
- /* Can't do conversions on GART reads/draws.
- */
- if ( !r200IsGartMemory( rmesa, pixels, size ) ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: not GART memory\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( r200IsGartMemory(rmesa, pixels, size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels, planemask );
- return GL_TRUE;
- }
- else if (0)
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them.
- */
- }
- else
- return GL_FALSE;
-}
-
-static void
-r200DrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-static void
-r200Bitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->Fallback)
- _swrast_Bitmap( ctx, px, py, width, height, unpack, bitmap );
- else
- r200PointsBitmap( ctx, px, py, width, height, unpack, bitmap );
-}
-
-
-
-void r200InitPixelFuncs( GLcontext *ctx )
-{
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- if (!getenv("R200_NO_BLITS") && R200_CONTEXT(ctx)->dri.drmMinor >= 6) {
- ctx->Driver.ReadPixels = r200ReadPixels;
- ctx->Driver.DrawPixels = r200DrawPixels;
- if (getenv("R200_HW_BITMAP"))
- ctx->Driver.Bitmap = r200Bitmap;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.h b/xc/lib/GL/mesa/src/drv/r200/r200_pixel.h
deleted file mode 100644
index 9282d2b14..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_PIXEL_H__
-#define __R200_PIXEL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r200InitPixelFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_reg.h b/xc/lib/GL/mesa/src/drv/r200/r200_reg.h
deleted file mode 100644
index 8e9126342..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_reg.h
+++ /dev/null
@@ -1,1438 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _R200_REG_H_
-#define _R200_REG_H_
-
-#define R200_PP_MISC 0x1c14
-#define R200_REF_ALPHA_MASK 0x000000ff
-#define R200_ALPHA_TEST_FAIL (0 << 8)
-#define R200_ALPHA_TEST_LESS (1 << 8)
-#define R200_ALPHA_TEST_LEQUAL (2 << 8)
-#define R200_ALPHA_TEST_EQUAL (3 << 8)
-#define R200_ALPHA_TEST_GEQUAL (4 << 8)
-#define R200_ALPHA_TEST_GREATER (5 << 8)
-#define R200_ALPHA_TEST_NEQUAL (6 << 8)
-#define R200_ALPHA_TEST_PASS (7 << 8)
-#define R200_ALPHA_TEST_OP_MASK (7 << 8)
-#define R200_CHROMA_FUNC_FAIL (0 << 16)
-#define R200_CHROMA_FUNC_PASS (1 << 16)
-#define R200_CHROMA_FUNC_NEQUAL (2 << 16)
-#define R200_CHROMA_FUNC_EQUAL (3 << 16)
-#define R200_CHROMA_KEY_NEAREST (0 << 18)
-#define R200_CHROMA_KEY_ZERO (1 << 18)
-#define R200_RIGHT_HAND_CUBE_D3D (0 << 24)
-#define R200_RIGHT_HAND_CUBE_OGL (1 << 24)
-#define R200_PP_FOG_COLOR 0x1c18
-#define R200_FOG_COLOR_MASK 0x00ffffff
-#define R200_FOG_VERTEX (0 << 24)
-#define R200_FOG_TABLE (1 << 24)
-#define R200_FOG_USE_DEPTH (0 << 25)
-#define R200_FOG_USE_W (1 << 25)
-#define R200_FOG_USE_DIFFUSE_ALPHA (2 << 25)
-#define R200_FOG_USE_SPEC_ALPHA (3 << 25)
-#define R200_FOG_USE_VTX_FOG (4 << 25)
-#define R200_RE_SOLID_COLOR 0x1c1c
-#define R200_RB3D_BLENDCNTL 0x1c20
-#define R200_COMB_FCN_MASK (7 << 12)
-#define R200_COMB_FCN_ADD_CLAMP (0 << 12)
-#define R200_COMB_FCN_ADD_NOCLAMP (1 << 12)
-#define R200_COMB_FCN_SUB_CLAMP (2 << 12)
-#define R200_COMB_FCN_SUB_NOCLAMP (3 << 12)
-#define R200_COMB_FCN_MIN (4 << 12)
-#define R200_COMB_FCN_MAX (5 << 12)
-#define R200_COMB_FCN_RSUB_CLAMP (6 << 12)
-#define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12)
-#define R200_SRC_BLEND_GL_ZERO (32 << 16)
-#define R200_SRC_BLEND_GL_ONE (33 << 16)
-#define R200_SRC_BLEND_GL_SRC_COLOR (34 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
-#define R200_SRC_BLEND_GL_DST_COLOR (36 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
-#define R200_SRC_BLEND_GL_SRC_ALPHA (38 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
-#define R200_SRC_BLEND_GL_DST_ALPHA (40 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
-#define R200_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
-#define R200_SRC_BLEND_GL_CONST_COLOR (43 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_CONST_COLOR (44 << 16)
-#define R200_SRC_BLEND_GL_CONST_ALPHA (45 << 16)
-#define R200_SRC_BLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 16)
-#define R200_SRC_BLEND_MASK (63 << 16)
-#define R200_DST_BLEND_GL_ZERO (32 << 24)
-#define R200_DST_BLEND_GL_ONE (33 << 24)
-#define R200_DST_BLEND_GL_SRC_COLOR (34 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
-#define R200_DST_BLEND_GL_DST_COLOR (36 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
-#define R200_DST_BLEND_GL_SRC_ALPHA (38 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
-#define R200_DST_BLEND_GL_DST_ALPHA (40 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
-#define R200_DST_BLEND_GL_CONST_COLOR (43 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_CONST_COLOR (44 << 24)
-#define R200_DST_BLEND_GL_CONST_ALPHA (45 << 24)
-#define R200_DST_BLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 24)
-#define R200_DST_BLEND_MASK (63 << 24)
-#define R200_RB3D_DEPTHOFFSET 0x1c24
-#define R200_RB3D_DEPTHPITCH 0x1c28
-#define R200_DEPTHPITCH_MASK 0x00001ff8
-#define R200_DEPTH_ENDIAN_NO_SWAP (0 << 18)
-#define R200_DEPTH_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_RB3D_ZSTENCILCNTL 0x1c2c
-#define R200_DEPTH_FORMAT_MASK (0xf << 0)
-#define R200_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
-#define R200_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0)
-#define R200_DEPTH_FORMAT_32BIT_INT_Z (4 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0)
-#define R200_Z_TEST_NEVER (0 << 4)
-#define R200_Z_TEST_LESS (1 << 4)
-#define R200_Z_TEST_LEQUAL (2 << 4)
-#define R200_Z_TEST_EQUAL (3 << 4)
-#define R200_Z_TEST_GEQUAL (4 << 4)
-#define R200_Z_TEST_GREATER (5 << 4)
-#define R200_Z_TEST_NEQUAL (6 << 4)
-#define R200_Z_TEST_ALWAYS (7 << 4)
-#define R200_Z_TEST_MASK (7 << 4)
-#define R200_STENCIL_TEST_NEVER (0 << 12)
-#define R200_STENCIL_TEST_LESS (1 << 12)
-#define R200_STENCIL_TEST_LEQUAL (2 << 12)
-#define R200_STENCIL_TEST_EQUAL (3 << 12)
-#define R200_STENCIL_TEST_GEQUAL (4 << 12)
-#define R200_STENCIL_TEST_GREATER (5 << 12)
-#define R200_STENCIL_TEST_NEQUAL (6 << 12)
-#define R200_STENCIL_TEST_ALWAYS (7 << 12)
-#define R200_STENCIL_TEST_MASK (0x7 << 12)
-#define R200_STENCIL_FAIL_KEEP (0 << 16)
-#define R200_STENCIL_FAIL_ZERO (1 << 16)
-#define R200_STENCIL_FAIL_REPLACE (2 << 16)
-#define R200_STENCIL_FAIL_INC (3 << 16)
-#define R200_STENCIL_FAIL_DEC (4 << 16)
-#define R200_STENCIL_FAIL_INVERT (5 << 16)
-#define R200_STENCIL_FAIL_INC_WRAP (6 << 16)
-#define R200_STENCIL_FAIL_DEC_WRAP (7 << 16)
-#define R200_STENCIL_FAIL_MASK (0x7 << 16)
-#define R200_STENCIL_ZPASS_KEEP (0 << 20)
-#define R200_STENCIL_ZPASS_ZERO (1 << 20)
-#define R200_STENCIL_ZPASS_REPLACE (2 << 20)
-#define R200_STENCIL_ZPASS_INC (3 << 20)
-#define R200_STENCIL_ZPASS_DEC (4 << 20)
-#define R200_STENCIL_ZPASS_INVERT (5 << 20)
-#define R200_STENCIL_ZPASS_INC_WRAP (6 << 20)
-#define R200_STENCIL_ZPASS_DEC_WRAP (7 << 20)
-#define R200_STENCIL_ZPASS_MASK (0x7 << 20)
-#define R200_STENCIL_ZFAIL_KEEP (0 << 24)
-#define R200_STENCIL_ZFAIL_ZERO (1 << 24)
-#define R200_STENCIL_ZFAIL_REPLACE (2 << 24)
-#define R200_STENCIL_ZFAIL_INC (3 << 24)
-#define R200_STENCIL_ZFAIL_DEC (4 << 24)
-#define R200_STENCIL_ZFAIL_INVERT (5 << 24)
-#define R200_STENCIL_ZFAIL_INC_WRAP (6 << 24)
-#define R200_STENCIL_ZFAIL_DEC_WRAP (7 << 24)
-#define R200_STENCIL_ZFAIL_MASK (0x7 << 24)
-#define R200_Z_WRITE_ENABLE (1 << 30)
-/*gap*/
-#define R200_PP_CNTL 0x1c38
-#define R200_TEX_0_ENABLE 0x00000010
-#define R200_TEX_1_ENABLE 0x00000020
-#define R200_TEX_2_ENABLE 0x00000040
-#define R200_TEX_3_ENABLE 0x00000080
-#define R200_TEX_4_ENABLE 0x00000100
-#define R200_TEX_5_ENABLE 0x00000200
-#define R200_TEX_ENABLE_MASK 0x000003f0
-#define R200_FILTER_ROUND_MODE_MASK 0x00000400
-#define R200_TEX_BLEND_7_ENABLE 0x00000800
-#define R200_TEX_BLEND_0_ENABLE 0x00001000
-#define R200_TEX_BLEND_1_ENABLE 0x00002000
-#define R200_TEX_BLEND_2_ENABLE 0x00004000
-#define R200_TEX_BLEND_3_ENABLE 0x00008000
-#define R200_TEX_BLEND_4_ENABLE 0x00010000
-#define R200_TEX_BLEND_5_ENABLE 0x00020000
-#define R200_TEX_BLEND_6_ENABLE 0x00040000
-#define R200_MULTI_PASS_ENABLE 0x00080000
-#define R200_SPECULAR_ENABLE 0x00200000
-#define R200_FOG_ENABLE 0x00400000
-#define R200_ALPHA_TEST_ENABLE 0x00800000
-#define R200_ANTI_ALIAS_NONE 0x00000000
-#define R200_ANTI_ALIAS_LINE 0x01000000
-#define R200_ANTI_ALIAS_POLY 0x02000000
-#define R200_ANTI_ALIAS_MASK 0x03000000
-#define R200_RB3D_CNTL 0x1c3c
-#define R200_ALPHA_BLEND_ENABLE (1 << 0)
-#define R200_PLANE_MASK_ENABLE (1 << 1)
-#define R200_DITHER_ENABLE (1 << 2)
-#define R200_ROUND_ENABLE (1 << 3)
-#define R200_SCALE_DITHER_ENABLE (1 << 4)
-#define R200_DITHER_INIT (1 << 5)
-#define R200_ROP_ENABLE (1 << 6)
-#define R200_STENCIL_ENABLE (1 << 7)
-#define R200_Z_ENABLE (1 << 8)
-#define R200_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
-#define R200_COLOR_FORMAT_ARGB1555 (3 << 10)
-#define R200_COLOR_FORMAT_RGB565 (4 << 10)
-#define R200_COLOR_FORMAT_ARGB8888 (6 << 10)
-#define R200_COLOR_FORMAT_RGB332 (7 << 10)
-#define R200_COLOR_FORMAT_Y8 (8 << 10)
-#define R200_COLOR_FORMAT_RGB8 (9 << 10)
-#define R200_COLOR_FORMAT_YUV422_VYUY (11 << 10)
-#define R200_COLOR_FORMAT_YUV422_YVYU (12 << 10)
-#define R200_COLOR_FORMAT_aYUV444 (14 << 10)
-#define R200_COLOR_FORMAT_ARGB4444 (15 << 10)
-#define R200_CLRCMP_FLIP_ENABLE (1 << 14)
-#define R200_SEPARATE_ALPHA_ENABLE (1 << 16)
-#define R200_RB3D_COLOROFFSET 0x1c40
-#define R200_COLOROFFSET_MASK 0xfffffff0
-#define R200_RE_WIDTH_HEIGHT 0x1c44
-#define R200_RE_WIDTH_SHIFT 0
-#define R200_RE_HEIGHT_SHIFT 16
-#define R200_RB3D_COLORPITCH 0x1c48
-#define R200_COLORPITCH_MASK 0x000001ff8
-#define R200_COLOR_ENDIAN_NO_SWAP (0 << 18)
-#define R200_COLOR_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_SE_CNTL 0x1c4c
-#define R200_FFACE_CULL_CW (0 << 0)
-#define R200_FFACE_CULL_CCW (1 << 0)
-#define R200_FFACE_CULL_DIR_MASK (1 << 0)
-#define R200_BFACE_CULL (0 << 1)
-#define R200_BFACE_SOLID (3 << 1)
-#define R200_FFACE_CULL (0 << 3)
-#define R200_FFACE_SOLID (3 << 3)
-#define R200_FFACE_CULL_MASK (3 << 3)
-#define R200_FLAT_SHADE_VTX_0 (0 << 6)
-#define R200_FLAT_SHADE_VTX_1 (1 << 6)
-#define R200_FLAT_SHADE_VTX_2 (2 << 6)
-#define R200_FLAT_SHADE_VTX_LAST (3 << 6)
-#define R200_DIFFUSE_SHADE_SOLID (0 << 8)
-#define R200_DIFFUSE_SHADE_FLAT (1 << 8)
-#define R200_DIFFUSE_SHADE_GOURAUD (2 << 8)
-#define R200_DIFFUSE_SHADE_MASK (3 << 8)
-#define R200_ALPHA_SHADE_SOLID (0 << 10)
-#define R200_ALPHA_SHADE_FLAT (1 << 10)
-#define R200_ALPHA_SHADE_GOURAUD (2 << 10)
-#define R200_ALPHA_SHADE_MASK (3 << 10)
-#define R200_SPECULAR_SHADE_SOLID (0 << 12)
-#define R200_SPECULAR_SHADE_FLAT (1 << 12)
-#define R200_SPECULAR_SHADE_GOURAUD (2 << 12)
-#define R200_SPECULAR_SHADE_MASK (3 << 12)
-#define R200_FOG_SHADE_SOLID (0 << 14)
-#define R200_FOG_SHADE_FLAT (1 << 14)
-#define R200_FOG_SHADE_GOURAUD (2 << 14)
-#define R200_FOG_SHADE_MASK (3 << 14)
-#define R200_ZBIAS_ENABLE_POINT (1 << 16)
-#define R200_ZBIAS_ENABLE_LINE (1 << 17)
-#define R200_ZBIAS_ENABLE_TRI (1 << 18)
-#define R200_WIDELINE_ENABLE (1 << 20)
-#define R200_VTX_PIX_CENTER_D3D (0 << 27)
-#define R200_VTX_PIX_CENTER_OGL (1 << 27)
-#define R200_ROUND_MODE_TRUNC (0 << 28)
-#define R200_ROUND_MODE_ROUND (1 << 28)
-#define R200_ROUND_MODE_ROUND_EVEN (2 << 28)
-#define R200_ROUND_MODE_ROUND_ODD (3 << 28)
-#define R200_ROUND_PREC_16TH_PIX (0 << 30)
-#define R200_ROUND_PREC_8TH_PIX (1 << 30)
-#define R200_ROUND_PREC_4TH_PIX (2 << 30)
-#define R200_ROUND_PREC_HALF_PIX (3 << 30)
-#define R200_RE_CNTL 0x1c50
-#define R200_STIPPLE_ENABLE 0x1
-#define R200_SCISSOR_ENABLE 0x2
-#define R200_PATTERN_ENABLE 0x4
-#define R200_PERSPECTIVE_ENABLE 0x8
-#define R200_POINT_SMOOTH 0x20
-#define R200_VTX_STQ0_D3D 0x00010000
-#define R200_VTX_STQ1_D3D 0x00040000
-#define R200_VTX_STQ2_D3D 0x00100000
-#define R200_VTX_STQ3_D3D 0x00400000
-#define R200_VTX_STQ4_D3D 0x01000000
-#define R200_VTX_STQ5_D3D 0x04000000
-/* gap */
-#define R200_RE_STIPPLE_ADDR 0x1cc8
-#define R200_RE_STIPPLE_DATA 0x1ccc
-#define R200_RE_LINE_PATTERN 0x1cd0
-#define R200_LINE_PATTERN_MASK 0x0000ffff
-#define R200_LINE_REPEAT_COUNT_SHIFT 16
-#define R200_LINE_PATTERN_START_SHIFT 24
-#define R200_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
-#define R200_LINE_PATTERN_BIG_BIT_ORDER (1 << 28)
-#define R200_LINE_PATTERN_AUTO_RESET (1 << 29)
-#define R200_RE_LINE_STATE 0x1cd4
-#define R200_LINE_CURRENT_PTR_SHIFT 0
-#define R200_LINE_CURRENT_COUNT_SHIFT 8
-#define R200_RE_SCISSOR_TL_0 0x1cd8
-#define R200_RE_SCISSOR_BR_0 0x1cdc
-#define R200_RE_SCISSOR_TL_1 0x1ce0
-#define R200_RE_SCISSOR_BR_1 0x1ce4
-#define R200_RE_SCISSOR_TL_2 0x1ce8
-#define R200_RE_SCISSOR_BR_2 0x1cec
-/* gap */
-#define R200_RB3D_DEPTHXY_OFFSET 0x1d60
-#define R200_DEPTHX_SHIFT 0
-#define R200_DEPTHY_SHIFT 16
-/* gap */
-#define R200_RB3D_STENCILREFMASK 0x1d7c
-#define R200_STENCIL_REF_SHIFT 0
-#define R200_STENCIL_REF_MASK (0xff << 0)
-#define R200_STENCIL_MASK_SHIFT 16
-#define R200_STENCIL_VALUE_MASK (0xff << 16)
-#define R200_STENCIL_WRITEMASK_SHIFT 24
-#define R200_STENCIL_WRITE_MASK (0xff << 24)
-#define R200_RB3D_ROPCNTL 0x1d80
-#define R200_ROP_MASK (15 << 8)
-#define R200_ROP_CLEAR (0 << 8)
-#define R200_ROP_NOR (1 << 8)
-#define R200_ROP_AND_INVERTED (2 << 8)
-#define R200_ROP_COPY_INVERTED (3 << 8)
-#define R200_ROP_AND_REVERSE (4 << 8)
-#define R200_ROP_INVERT (5 << 8)
-#define R200_ROP_XOR (6 << 8)
-#define R200_ROP_NAND (7 << 8)
-#define R200_ROP_AND (8 << 8)
-#define R200_ROP_EQUIV (9 << 8)
-#define R200_ROP_NOOP (10 << 8)
-#define R200_ROP_OR_INVERTED (11 << 8)
-#define R200_ROP_COPY (12 << 8)
-#define R200_ROP_OR_REVERSE (13 << 8)
-#define R200_ROP_OR (14 << 8)
-#define R200_ROP_SET (15 << 8)
-#define R200_RB3D_PLANEMASK 0x1d84
-/* gap */
-#define R200_SE_VPORT_XSCALE 0x1d98
-#define R200_SE_VPORT_XOFFSET 0x1d9c
-#define R200_SE_VPORT_YSCALE 0x1da0
-#define R200_SE_VPORT_YOFFSET 0x1da4
-#define R200_SE_VPORT_ZSCALE 0x1da8
-#define R200_SE_VPORT_ZOFFSET 0x1dac
-#define R200_SE_ZBIAS_FACTOR 0x1db0
-#define R200_SE_ZBIAS_CONSTANT 0x1db4
-#define R200_SE_LINE_WIDTH 0x1db8
-#define R200_LINE_WIDTH_SHIFT 0x00000000
-#define R200_MINPOINTSIZE_SHIFT 0x00000010
-/* gap */
-#define R200_SE_VAP_CNTL 0x2080
-#define R200_VAP_TCL_ENABLE 0x00000001
-#define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010
-#define R200_VAP_FORCE_W_TO_ONE 0x00010000
-#define R200_VAP_D3D_TEX_DEFAULT 0x00020000
-#define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18
-#define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000
-#define R200_SE_VF_CNTL 0x2084
-#define R200_VF_PRIM_NONE 0x00000000
-#define R200_VF_PRIM_POINTS 0x00000001
-#define R200_VF_PRIM_LINES 0x00000002
-#define R200_VF_PRIM_LINE_STRIP 0x00000003
-#define R200_VF_PRIM_TRIANGLES 0x00000004
-#define R200_VF_PRIM_TRIANGLE_FAN 0x00000005
-#define R200_VF_PRIM_TRIANGLE_STRIP 0x00000006
-#define R200_VF_PRIM_RECT_LIST 0x00000008
-#define R200_VF_PRIM_3VRT_POINTS 0x00000009
-#define R200_VF_PRIM_3VRT_LINES 0x0000000a
-#define R200_VF_PRIM_POINT_SPRITES 0x0000000b
-#define R200_VF_PRIM_LINE_LOOP 0x0000000c
-#define R200_VF_PRIM_QUADS 0x0000000d
-#define R200_VF_PRIM_QUAD_STRIP 0x0000000e
-#define R200_VF_PRIM_POLYGON 0x0000000f
-#define R200_VF_PRIM_MASK 0x0000000f
-#define R200_VF_PRIM_WALK_IND 0x00000010
-#define R200_VF_PRIM_WALK_LIST 0x00000020
-#define R200_VF_PRIM_WALK_RING 0x00000030
-#define R200_VF_PRIM_WALK_MASK 0x00000030
-#define R200_VF_COLOR_ORDER_RGBA 0x00000040
-#define R200_VF_TCL_OUTPUT_VTX_ENABLE 0x00000200
-#define R200_VF_INDEX_SZ_4 0x00000800
-#define R200_VF_VERTEX_NUMBER_MASK 0xffff0000
-#define R200_VF_VERTEX_NUMBER_SHIFT 16
-#define R200_SE_VTX_FMT_0 0x2088
-#define R200_VTX_XY 0 /* always have xy */
-#define R200_VTX_Z0 (1<<0)
-#define R200_VTX_W0 (1<<1)
-#define R200_VTX_WEIGHT_COUNT_SHIFT (2)
-#define R200_VTX_PV_MATRIX_SEL (1<<5)
-#define R200_VTX_N0 (1<<6)
-#define R200_VTX_POINT_SIZE (1<<7)
-#define R200_VTX_DISCRETE_FOG (1<<8)
-#define R200_VTX_SHININESS_0 (1<<9)
-#define R200_VTX_SHININESS_1 (1<<10)
-#define R200_VTX_COLOR_NOT_PRESENT 0
-#define R200_VTX_PK_RGBA 1
-#define R200_VTX_FP_RGB 2
-#define R200_VTX_FP_RGBA 3
-#define R200_VTX_COLOR_MASK 3
-#define R200_VTX_COLOR_0_SHIFT 11
-#define R200_VTX_COLOR_1_SHIFT 13
-#define R200_VTX_COLOR_2_SHIFT 15
-#define R200_VTX_COLOR_3_SHIFT 17
-#define R200_VTX_COLOR_4_SHIFT 19
-#define R200_VTX_COLOR_5_SHIFT 21
-#define R200_VTX_COLOR_6_SHIFT 23
-#define R200_VTX_COLOR_7_SHIFT 25
-#define R200_VTX_XY1 (1<<28)
-#define R200_VTX_Z1 (1<<29)
-#define R200_VTX_W1 (1<<30)
-#define R200_VTX_N1 (1<<31)
-#define R200_SE_VTX_FMT_1 0x208c
-#define R200_VTX_TEX0_COMP_CNT_SHIFT 0
-#define R200_VTX_TEX1_COMP_CNT_SHIFT 3
-#define R200_VTX_TEX2_COMP_CNT_SHIFT 6
-#define R200_VTX_TEX3_COMP_CNT_SHIFT 9
-#define R200_VTX_TEX4_COMP_CNT_SHIFT 12
-#define R200_VTX_TEX5_COMP_CNT_SHIFT 15
-#define R200_SE_TCL_OUTPUT_VTX_FMT_0 0x2090
-#define R200_SE_TCL_OUTPUT_VTX_FMT_1 0x2094
-/* gap */
-#define R200_SE_VTE_CNTL 0x20b0
-#define R200_VPORT_X_SCALE_ENA 0x00000001
-#define R200_VPORT_X_OFFSET_ENA 0x00000002
-#define R200_VPORT_Y_SCALE_ENA 0x00000004
-#define R200_VPORT_Y_OFFSET_ENA 0x00000008
-#define R200_VPORT_Z_SCALE_ENA 0x00000010
-#define R200_VPORT_Z_OFFSET_ENA 0x00000020
-#define R200_VTX_XY_FMT 0x00000100
-#define R200_VTX_Z_FMT 0x00000200
-#define R200_VTX_W0_FMT 0x00000400
-#define R200_VTX_W0_NORMALIZE 0x00000800
-#define R200_VTX_ST_DENORMALIZED 0x00001000
-/* gap */
-#define R200_SE_VTX_NUM_ARRAYS 0x20c0
-#define R200_SE_VTX_AOS_ATTR01 0x20c4
-#define R200_SE_VTX_AOS_ADDR0 0x20c8
-#define R200_SE_VTX_AOS_ADDR1 0x20cc
-#define R200_SE_VTX_AOS_ATTR23 0x20d0
-#define R200_SE_VTX_AOS_ADDR2 0x20d4
-#define R200_SE_VTX_AOS_ADDR3 0x20d8
-#define R200_SE_VTX_AOS_ATTR45 0x20dc
-#define R200_SE_VTX_AOS_ADDR4 0x20e0
-#define R200_SE_VTX_AOS_ADDR5 0x20e4
-#define R200_SE_VTX_AOS_ATTR67 0x20e8
-#define R200_SE_VTX_AOS_ADDR6 0x20ec
-#define R200_SE_VTX_AOS_ADDR7 0x20f0
-#define R200_SE_VTX_AOS_ATTR89 0x20f4
-#define R200_SE_VTX_AOS_ADDR8 0x20f8
-#define R200_SE_VTX_AOS_ADDR9 0x20fc
-#define R200_SE_VTX_AOS_ATTR1011 0x2100
-#define R200_SE_VTX_AOS_ADDR10 0x2104
-#define R200_SE_VTX_AOS_ADDR11 0x2108
-#define R200_SE_VF_MAX_VTX_INDX 0x210c
-#define R200_SE_VF_MIN_VTX_INDX 0x2110
-/* gap */
-#define R200_SE_VAP_CNTL_STATUS 0x2140
-#define R200_VC_NO_SWAP (0 << 0)
-#define R200_VC_16BIT_SWAP (1 << 0)
-#define R200_VC_32BIT_SWAP (2 << 0)
-/* gap */
-#define R200_SE_VTX_STATE_CNTL 0x2180
-#define R200_VSC_COLOR_0_ASSEMBLY_CNTL_SHIFT 0x00000000
-#define R200_VSC_COLOR_1_ASSEMBLY_CNTL_SHIFT 0x00000002
-#define R200_VSC_COLOR_2_ASSEMBLY_CNTL_SHIFT 0x00000004
-#define R200_VSC_COLOR_3_ASSEMBLY_CNTL_SHIFT 0x00000006
-#define R200_VSC_COLOR_4_ASSEMBLY_CNTL_SHIFT 0x00000008
-#define R200_VSC_COLOR_5_ASSEMBLY_CNTL_SHIFT 0x0000000a
-#define R200_VSC_COLOR_6_ASSEMBLY_CNTL_SHIFT 0x0000000c
-#define R200_VSC_COLOR_7_ASSEMBLY_CNTL_SHIFT 0x0000000e
-#define R200_VSC_UPDATE_USER_COLOR_0_ENABLE 0x00010000
-#define R200_VSC_UPDATE_USER_COLOR_1_ENABLE 0x00020000
-/* gap */
-#define R200_SE_TCL_VECTOR_INDX_REG 0x2200
-#define R200_SE_TCL_VECTOR_DATA_REG 0x2204
-#define R200_SE_TCL_SCALAR_INDX_REG 0x2208
-#define R200_SE_TCL_SCALAR_DATA_REG 0x220c
-/* gap */
-#define R200_SE_TCL_MATRIX_SEL_0 0x2230
-#define R200_MODELVIEW_0_SHIFT (0)
-#define R200_MODELVIEW_1_SHIFT (8)
-#define R200_MODELVIEW_2_SHIFT (16)
-#define R200_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_1 0x2234
-#define R200_IT_MODELVIEW_0_SHIFT (0)
-#define R200_IT_MODELVIEW_1_SHIFT (8)
-#define R200_IT_MODELVIEW_2_SHIFT (16)
-#define R200_IT_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_2 0x2238
-#define R200_MODELPROJECT_0_SHIFT (0)
-#define R200_MODELPROJECT_1_SHIFT (8)
-#define R200_MODELPROJECT_2_SHIFT (16)
-#define R200_MODELPROJECT_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_3 0x223c
-#define R200_TEXMAT_0_SHIFT 0
-#define R200_TEXMAT_1_SHIFT 8
-#define R200_TEXMAT_2_SHIFT 16
-#define R200_TEXMAT_3_SHIFT 24
-#define R200_SE_TCL_MATRIX_SEL_4 0x2240
-#define R200_TEXMAT_4_SHIFT 0
-#define R200_TEXMAT_5_SHIFT 8
-/* gap */
-#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250
-#define R200_OUTPUT_XYZW (1<<0)
-#define R200_OUTPUT_COLOR_0 (1<<8)
-#define R200_OUTPUT_COLOR_1 (1<<9)
-#define R200_OUTPUT_TEX_0 (1<<16)
-#define R200_OUTPUT_TEX_1 (1<<17)
-#define R200_OUTPUT_TEX_2 (1<<18)
-#define R200_OUTPUT_TEX_3 (1<<19)
-#define R200_OUTPUT_TEX_4 (1<<20)
-#define R200_OUTPUT_TEX_5 (1<<21)
-#define R200_OUTPUT_TEX_MASK (0x3f<<16)
-#define R200_OUTPUT_PT_SIZE (1<<25)
-#define R200_FORCE_INORDER_PROC (1<<31)
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0 0x2254
-#define R200_VERTEX_POSITION_ADDR__SHIFT 0x00000000
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1 0x2258
-#define R200_VTX_COLOR_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_COLOR_1_ADDR__SHIFT 0x00000008
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2 0x225c
-#define R200_VTX_TEX_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_1_ADDR__SHIFT 0x00000008
-#define R200_VTX_TEX_2_ADDR__SHIFT 0x00000010
-#define R200_VTX_TEX_3_ADDR__SHIFT 0x00000018
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3 0x2260
-#define R200_VTX_TEX_4_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_5_ADDR__SHIFT 0x00000008
-
-/* gap */
-#define R200_SE_TCL_LIGHT_MODEL_CTL_0 0x2268
-#define R200_LIGHTING_ENABLE (1<<0)
-#define R200_LIGHT_IN_MODELSPACE (1<<1)
-#define R200_LOCAL_VIEWER (1<<2)
-#define R200_NORMALIZE_NORMALS (1<<3)
-#define R200_RESCALE_NORMALS (1<<4)
-#define R200_SPECULAR_LIGHTS (1<<5)
-#define R200_DIFFUSE_SPECULAR_COMBINE (1<<6)
-#define R200_LIGHT_ALPHA (1<<7)
-#define R200_LOCAL_LIGHT_VEC_GL (1<<8)
-#define R200_LIGHT_NO_NORMAL_AMBIENT_ONLY (1<<9)
-#define R200_LIGHT_TWOSIDE (1<<10)
-#define R200_FRONT_SHININESS_SOURCE_SHIFT (0xb)
-#define R200_BACK_SHININESS_SOURCE_SHIFT (0xd)
-#define R200_LM0_SOURCE_MATERIAL_0 (0)
-#define R200_LM0_SOURCE_MATERIAL_1 (1)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_0 (2)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_1 (3)
-#define R200_SE_TCL_LIGHT_MODEL_CTL_1 0x226c
-#define R200_LM1_SOURCE_LIGHT_PREMULT (0)
-#define R200_LM1_SOURCE_MATERIAL_0 (1)
-#define R200_LM1_SOURCE_VERTEX_COLOR_0 (2)
-#define R200_LM1_SOURCE_VERTEX_COLOR_1 (3)
-#define R200_LM1_SOURCE_VERTEX_COLOR_2 (4)
-#define R200_LM1_SOURCE_VERTEX_COLOR_3 (5)
-#define R200_LM1_SOURCE_VERTEX_COLOR_4 (6)
-#define R200_LM1_SOURCE_VERTEX_COLOR_5 (7)
-#define R200_LM1_SOURCE_VERTEX_COLOR_6 (8)
-#define R200_LM1_SOURCE_VERTEX_COLOR_7 (9)
-#define R200_LM1_SOURCE_MATERIAL_1 (0xf)
-#define R200_FRONT_EMISSIVE_SOURCE_SHIFT (0)
-#define R200_FRONT_AMBIENT_SOURCE_SHIFT (4)
-#define R200_FRONT_DIFFUSE_SOURCE_SHIFT (8)
-#define R200_FRONT_SPECULAR_SOURCE_SHIFT (12)
-#define R200_BACK_EMISSIVE_SOURCE_SHIFT (16)
-#define R200_BACK_AMBIENT_SOURCE_SHIFT (20)
-#define R200_BACK_DIFFUSE_SOURCE_SHIFT (24)
-#define R200_BACK_SPECULAR_SOURCE_SHIFT (28)
-#define R200_SE_TCL_PER_LIGHT_CTL_0 0x2270
-#define R200_LIGHT_0_ENABLE (1<<0)
-#define R200_LIGHT_0_ENABLE_AMBIENT (1<<1)
-#define R200_LIGHT_0_ENABLE_SPECULAR (1<<2)
-#define R200_LIGHT_0_IS_LOCAL (1<<3)
-#define R200_LIGHT_0_IS_SPOT (1<<4)
-#define R200_LIGHT_0_DUAL_CONE (1<<5)
-#define R200_LIGHT_0_ENABLE_RANGE_ATTEN (1<<6)
-#define R200_LIGHT_0_CONSTANT_RANGE_ATTEN (1<<7)
-#define R200_LIGHT_1_ENABLE (1<<16)
-#define R200_LIGHT_1_ENABLE_AMBIENT (1<<17)
-#define R200_LIGHT_1_ENABLE_SPECULAR (1<<18)
-#define R200_LIGHT_1_IS_LOCAL (1<<19)
-#define R200_LIGHT_1_IS_SPOT (1<<20)
-#define R200_LIGHT_1_DUAL_CONE (1<<21)
-#define R200_LIGHT_1_ENABLE_RANGE_ATTEN (1<<22)
-#define R200_LIGHT_1_CONSTANT_RANGE_ATTEN (1<<23)
-#define R200_LIGHT_0_SHIFT (0)
-#define R200_LIGHT_1_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_1 0x2274
-#define R200_LIGHT_2_SHIFT (0)
-#define R200_LIGHT_3_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_2 0x2278
-#define R200_LIGHT_4_SHIFT (0)
-#define R200_LIGHT_5_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_3 0x227c
-#define R200_LIGHT_6_SHIFT (0)
-#define R200_LIGHT_7_SHIFT (16)
-/* gap */
-#define R200_SE_TCL_TEX_PROC_CTL_2 0x22a8
-#define R200_TEXGEN_0_COMP_MASK_SHIFT (0)
-#define R200_TEXGEN_1_COMP_MASK_SHIFT (4)
-#define R200_TEXGEN_2_COMP_MASK_SHIFT (8)
-#define R200_TEXGEN_3_COMP_MASK_SHIFT (12)
-#define R200_TEXGEN_4_COMP_MASK_SHIFT (16)
-#define R200_TEXGEN_5_COMP_MASK_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_3 0x22ac
-#define R200_TEXGEN_0_INPUT_TEX_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_TEX_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_TEX_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_TEX_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_TEX_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_TEX_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_0 0x22b0
-#define R200_TEXGEN_TEXMAT_0_ENABLE (1<<0)
-#define R200_TEXGEN_TEXMAT_1_ENABLE (1<<1)
-#define R200_TEXGEN_TEXMAT_2_ENABLE (1<<2)
-#define R200_TEXGEN_TEXMAT_3_ENABLE (1<<3)
-#define R200_TEXGEN_TEXMAT_4_ENABLE (1<<4)
-#define R200_TEXGEN_TEXMAT_5_ENABLE (1<<5)
-#define R200_TEXMAT_0_ENABLE (1<<8)
-#define R200_TEXMAT_1_ENABLE (1<<9)
-#define R200_TEXMAT_2_ENABLE (1<<10)
-#define R200_TEXMAT_3_ENABLE (1<<11)
-#define R200_TEXMAT_4_ENABLE (1<<12)
-#define R200_TEXMAT_5_ENABLE (1<<13)
-#define R200_TEXGEN_FORCE_W_TO_ONE (1<<16)
-#define R200_SE_TCL_TEX_PROC_CTL_1 0x22b4
-#define R200_TEXGEN_INPUT_MASK (0xf)
-#define R200_TEXGEN_INPUT_TEXCOORD_0 (0)
-#define R200_TEXGEN_INPUT_TEXCOORD_1 (1)
-#define R200_TEXGEN_INPUT_TEXCOORD_2 (2)
-#define R200_TEXGEN_INPUT_TEXCOORD_3 (3)
-#define R200_TEXGEN_INPUT_TEXCOORD_4 (4)
-#define R200_TEXGEN_INPUT_TEXCOORD_5 (5)
-#define R200_TEXGEN_INPUT_OBJ (8)
-#define R200_TEXGEN_INPUT_EYE (9)
-#define R200_TEXGEN_INPUT_EYE_NORMAL (0xa)
-#define R200_TEXGEN_INPUT_EYE_REFLECT (0xb)
-#define R200_TEXGEN_INPUT_SPHERE (0xd)
-#define R200_TEXGEN_0_INPUT_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_SHIFT (20)
-#define R200_SE_TC_TEX_CYL_WRAP_CTL 0x22b8
-/* gap */
-#define R200_SE_TCL_UCP_VERT_BLEND_CTL 0x22c0
-#define R200_UCP_IN_CLIP_SPACE (1<<0)
-#define R200_UCP_IN_MODEL_SPACE (1<<1)
-#define R200_UCP_ENABLE_0 (1<<2)
-#define R200_UCP_ENABLE_1 (1<<3)
-#define R200_UCP_ENABLE_2 (1<<4)
-#define R200_UCP_ENABLE_3 (1<<5)
-#define R200_UCP_ENABLE_4 (1<<6)
-#define R200_UCP_ENABLE_5 (1<<7)
-#define R200_TCL_FOG_MASK (3<<8)
-#define R200_TCL_FOG_DISABLE (0<<8)
-#define R200_TCL_FOG_EXP (1<<8)
-#define R200_TCL_FOG_EXP2 (2<<8)
-#define R200_TCL_FOG_LINEAR (3<<8)
-#define R200_RNG_BASED_FOG (1<<10)
-#define R200_CLIP_DISABLE (1<<11)
-#define R200_CULL_FRONT_IS_CW (0<<28)
-#define R200_CULL_FRONT_IS_CCW (1<<28)
-#define R200_CULL_FRONT (1<<29)
-#define R200_CULL_BACK (1<<30)
-#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
-/* gap */
-#define R200_SE_VTX_ST_POS_0_X_4 0x2300
-#define R200_SE_VTX_ST_POS_0_Y_4 0x2304
-#define R200_SE_VTX_ST_POS_0_Z_4 0x2308
-#define R200_SE_VTX_ST_POS_0_W_4 0x230c
-#define R200_SE_VTX_ST_NORM_0_X 0x2310
-#define R200_SE_VTX_ST_NORM_0_Y 0x2314
-#define R200_SE_VTX_ST_NORM_0_Z 0x2318
-#define R200_SE_VTX_ST_PVMS 0x231c
-#define R200_SE_VTX_ST_CLR_0_R 0x2320
-#define R200_SE_VTX_ST_CLR_0_G 0x2324
-#define R200_SE_VTX_ST_CLR_0_B 0x2328
-#define R200_SE_VTX_ST_CLR_0_A 0x232c
-#define R200_SE_VTX_ST_CLR_1_R 0x2330
-#define R200_SE_VTX_ST_CLR_1_G 0x2334
-#define R200_SE_VTX_ST_CLR_1_B 0x2338
-#define R200_SE_VTX_ST_CLR_1_A 0x233c
-#define R200_SE_VTX_ST_CLR_2_R 0x2340
-#define R200_SE_VTX_ST_CLR_2_G 0x2344
-#define R200_SE_VTX_ST_CLR_2_B 0x2348
-#define R200_SE_VTX_ST_CLR_2_A 0x234c
-#define R200_SE_VTX_ST_CLR_3_R 0x2350
-#define R200_SE_VTX_ST_CLR_3_G 0x2354
-#define R200_SE_VTX_ST_CLR_3_B 0x2358
-#define R200_SE_VTX_ST_CLR_3_A 0x235c
-#define R200_SE_VTX_ST_CLR_4_R 0x2360
-#define R200_SE_VTX_ST_CLR_4_G 0x2364
-#define R200_SE_VTX_ST_CLR_4_B 0x2368
-#define R200_SE_VTX_ST_CLR_4_A 0x236c
-#define R200_SE_VTX_ST_CLR_5_R 0x2370
-#define R200_SE_VTX_ST_CLR_5_G 0x2374
-#define R200_SE_VTX_ST_CLR_5_B 0x2378
-#define R200_SE_VTX_ST_CLR_5_A 0x237c
-#define R200_SE_VTX_ST_CLR_6_R 0x2380
-#define R200_SE_VTX_ST_CLR_6_G 0x2384
-#define R200_SE_VTX_ST_CLR_6_B 0x2388
-#define R200_SE_VTX_ST_CLR_6_A 0x238c
-#define R200_SE_VTX_ST_CLR_7_R 0x2390
-#define R200_SE_VTX_ST_CLR_7_G 0x2394
-#define R200_SE_VTX_ST_CLR_7_B 0x2398
-#define R200_SE_VTX_ST_CLR_7_A 0x239c
-#define R200_SE_VTX_ST_TEX_0_S 0x23a0
-#define R200_SE_VTX_ST_TEX_0_T 0x23a4
-#define R200_SE_VTX_ST_TEX_0_R 0x23a8
-#define R200_SE_VTX_ST_TEX_0_Q 0x23ac
-#define R200_SE_VTX_ST_TEX_1_S 0x23b0
-#define R200_SE_VTX_ST_TEX_1_T 0x23b4
-#define R200_SE_VTX_ST_TEX_1_R 0x23b8
-#define R200_SE_VTX_ST_TEX_1_Q 0x23bc
-#define R200_SE_VTX_ST_TEX_2_S 0x23c0
-#define R200_SE_VTX_ST_TEX_2_T 0x23c4
-#define R200_SE_VTX_ST_TEX_2_R 0x23c8
-#define R200_SE_VTX_ST_TEX_2_Q 0x23cc
-#define R200_SE_VTX_ST_TEX_3_S 0x23d0
-#define R200_SE_VTX_ST_TEX_3_T 0x23d4
-#define R200_SE_VTX_ST_TEX_3_R 0x23d8
-#define R200_SE_VTX_ST_TEX_3_Q 0x23dc
-#define R200_SE_VTX_ST_TEX_4_S 0x23e0
-#define R200_SE_VTX_ST_TEX_4_T 0x23e4
-#define R200_SE_VTX_ST_TEX_4_R 0x23e8
-#define R200_SE_VTX_ST_TEX_4_Q 0x23ec
-#define R200_SE_VTX_ST_TEX_5_S 0x23f0
-#define R200_SE_VTX_ST_TEX_5_T 0x23f4
-#define R200_SE_VTX_ST_TEX_5_R 0x23f8
-#define R200_SE_VTX_ST_TEX_5_Q 0x23fc
-#define R200_SE_VTX_ST_PNT_SPRT_SZ 0x2400
-#define R200_SE_VTX_ST_DISC_FOG 0x2404
-#define R200_SE_VTX_ST_SHININESS_0 0x2408
-#define R200_SE_VTX_ST_SHININESS_1 0x240c
-#define R200_SE_VTX_ST_BLND_WT_0 0x2410
-#define R200_SE_VTX_ST_BLND_WT_1 0x2414
-#define R200_SE_VTX_ST_BLND_WT_2 0x2418
-#define R200_SE_VTX_ST_BLND_WT_3 0x241c
-#define R200_SE_VTX_ST_POS_1_X 0x2420
-#define R200_SE_VTX_ST_POS_1_Y 0x2424
-#define R200_SE_VTX_ST_POS_1_Z 0x2428
-#define R200_SE_VTX_ST_POS_1_W 0x242c
-#define R200_SE_VTX_ST_NORM_1_X 0x2430
-#define R200_SE_VTX_ST_NORM_1_Y 0x2434
-#define R200_SE_VTX_ST_NORM_1_Z 0x2438
-#define R200_SE_VTX_ST_USR_CLR_0_R 0x2440
-#define R200_SE_VTX_ST_USR_CLR_0_G 0x2444
-#define R200_SE_VTX_ST_USR_CLR_0_B 0x2448
-#define R200_SE_VTX_ST_USR_CLR_0_A 0x244c
-#define R200_SE_VTX_ST_USR_CLR_1_R 0x2450
-#define R200_SE_VTX_ST_USR_CLR_1_G 0x2454
-#define R200_SE_VTX_ST_USR_CLR_1_B 0x2458
-#define R200_SE_VTX_ST_USR_CLR_1_A 0x245c
-#define R200_SE_VTX_ST_CLR_0_PKD 0x2460
-#define R200_SE_VTX_ST_CLR_1_PKD 0x2464
-#define R200_SE_VTX_ST_CLR_2_PKD 0x2468
-#define R200_SE_VTX_ST_CLR_3_PKD 0x246c
-#define R200_SE_VTX_ST_CLR_4_PKD 0x2470
-#define R200_SE_VTX_ST_CLR_5_PKD 0x2474
-#define R200_SE_VTX_ST_CLR_6_PKD 0x2478
-#define R200_SE_VTX_ST_CLR_7_PKD 0x247c
-#define R200_SE_VTX_ST_POS_0_X_2 0x2480
-#define R200_SE_VTX_ST_POS_0_Y_2 0x2484
-#define R200_SE_VTX_ST_PAR_CLR_LD 0x2488
-#define R200_SE_VTX_ST_USR_CLR_PKD 0x248c
-#define R200_SE_VTX_ST_POS_0_X_3 0x2490
-#define R200_SE_VTX_ST_POS_0_Y_3 0x2494
-#define R200_SE_VTX_ST_POS_0_Z_3 0x2498
-#define R200_SE_VTX_ST_END_OF_PKT 0x249c
-/* gap */
-#define R200_RE_POINTSIZE 0x2648
-#define R200_POINTSIZE_SHIFT 0
-#define R200_MAXPOINTSIZE_SHIFT 16
-/* gap */
-#define R200_RE_TOP_LEFT 0x26c0
-#define R200_RE_LEFT_SHIFT 0
-#define R200_RE_TOP_SHIFT 16
-#define R200_RE_MISC 0x26c4
-#define R200_STIPPLE_COORD_MASK 0x1f
-#define R200_STIPPLE_X_OFFSET_SHIFT 0
-#define R200_STIPPLE_X_OFFSET_MASK (0x1f << 0)
-#define R200_STIPPLE_Y_OFFSET_SHIFT 8
-#define R200_STIPPLE_Y_OFFSET_MASK (0x1f << 8)
-#define R200_STIPPLE_LITTLE_BIT_ORDER (0 << 16)
-#define R200_STIPPLE_BIG_BIT_ORDER (1 << 16)
-/* gap */
-#define R200_RE_AUX_SCISSOR_CNTL 0x26f0
-#define R200_EXCLUSIVE_SCISSOR_0 0x01000000
-#define R200_EXCLUSIVE_SCISSOR_1 0x02000000
-#define R200_EXCLUSIVE_SCISSOR_2 0x04000000
-#define R200_SCISSOR_ENABLE_0 0x10000000
-#define R200_SCISSOR_ENABLE_1 0x20000000
-#define R200_SCISSOR_ENABLE_2 0x40000000
-/* gap */
-#define R200_PP_TXFILTER_0 0x2c00
-#define R200_MAG_FILTER_NEAREST (0 << 0)
-#define R200_MAG_FILTER_LINEAR (1 << 0)
-#define R200_MAG_FILTER_MASK (1 << 0)
-#define R200_MIN_FILTER_NEAREST (0 << 1)
-#define R200_MIN_FILTER_LINEAR (1 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST (8 << 1)
-#define R200_MIN_FILTER_ANISO_LINEAR (9 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
-#define R200_MIN_FILTER_MASK (15 << 1)
-#define R200_MAX_ANISO_1_TO_1 (0 << 5)
-#define R200_MAX_ANISO_2_TO_1 (1 << 5)
-#define R200_MAX_ANISO_4_TO_1 (2 << 5)
-#define R200_MAX_ANISO_8_TO_1 (3 << 5)
-#define R200_MAX_ANISO_16_TO_1 (4 << 5)
-#define R200_MAX_ANISO_MASK (7 << 5)
-#define R200_MAX_MIP_LEVEL_MASK (0x0f << 16)
-#define R200_MAX_MIP_LEVEL_SHIFT 16
-#define R200_YUV_TO_RGB (1 << 20)
-#define R200_YUV_TEMPERATURE_COOL (0 << 21)
-#define R200_YUV_TEMPERATURE_HOT (1 << 21)
-#define R200_YUV_TEMPERATURE_MASK (1 << 21)
-#define R200_WRAPEN_S (1 << 22)
-#define R200_CLAMP_S_WRAP (0 << 23)
-#define R200_CLAMP_S_MIRROR (1 << 23)
-#define R200_CLAMP_S_CLAMP_LAST (2 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
-#define R200_CLAMP_S_CLAMP_BORDER (4 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
-#define R200_CLAMP_S_CLAMP_GL (6 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
-#define R200_CLAMP_S_MASK (7 << 23)
-#define R200_WRAPEN_T (1 << 26)
-#define R200_CLAMP_T_WRAP (0 << 27)
-#define R200_CLAMP_T_MIRROR (1 << 27)
-#define R200_CLAMP_T_CLAMP_LAST (2 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
-#define R200_CLAMP_T_CLAMP_BORDER (4 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
-#define R200_CLAMP_T_CLAMP_GL (6 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
-#define R200_CLAMP_T_MASK (7 << 27)
-#define R200_KILL_LT_ZERO (1 << 30)
-#define R200_BORDER_MODE_OGL (0 << 31)
-#define R200_BORDER_MODE_D3D (1 << 31)
-#define R200_PP_TXFORMAT_0 0x2c04
-#define R200_TXFORMAT_I8 (0 << 0)
-#define R200_TXFORMAT_AI88 (1 << 0)
-#define R200_TXFORMAT_RGB332 (2 << 0)
-#define R200_TXFORMAT_ARGB1555 (3 << 0)
-#define R200_TXFORMAT_RGB565 (4 << 0)
-#define R200_TXFORMAT_ARGB4444 (5 << 0)
-#define R200_TXFORMAT_ARGB8888 (6 << 0)
-#define R200_TXFORMAT_RGBA8888 (7 << 0)
-#define R200_TXFORMAT_Y8 (8 << 0)
-#define R200_TXFORMAT_AVYU4444 (9 << 0)
-#define R200_TXFORMAT_VYUY422 (10 << 0)
-#define R200_TXFORMAT_YVYU422 (11 << 0)
-#define R200_TXFORMAT_DXT1 (12 << 0)
-#define R200_TXFORMAT_DXT23 (14 << 0)
-#define R200_TXFORMAT_DXT45 (15 << 0)
-#define R200_TXFORMAT_FORMAT_MASK (31 << 0)
-#define R200_TXFORMAT_FORMAT_SHIFT 0
-#define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
-#define R200_TXFORMAT_NON_POWER2 (1 << 7)
-#define R200_TXFORMAT_WIDTH_MASK (15 << 8)
-#define R200_TXFORMAT_WIDTH_SHIFT 8
-#define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
-#define R200_TXFORMAT_HEIGHT_SHIFT 12
-#define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
-#define R200_TXFORMAT_F5_WIDTH_SHIFT 16
-#define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
-#define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
-#define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
-#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
-#define R200_TXFORMAT_ST_ROUTE_SHIFT 24
-#define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
-#define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
-#define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
-#define R200_PP_TXFORMAT_X_0 0x2c08
-#define R200_DEPTH_LOG2_MASK (0xf << 0)
-#define R200_DEPTH_LOG2_SHIFT 0
-#define R200_VOLUME_FILTER_SHIFT 4
-#define R200_VOLUME_FILTER_MASK (1 << 4)
-#define R200_VOLUME_FILTER_NEAREST (0 << 4)
-#define R200_VOLUME_FILTER_LINEAR (1 << 4)
-#define R200_WRAPEN_Q (1 << 8)
-#define R200_CLAMP_Q_WRAP (0 << 9)
-#define R200_CLAMP_Q_MIRROR (1 << 9)
-#define R200_CLAMP_Q_CLAMP_LAST (2 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9)
-#define R200_CLAMP_Q_CLAMP_BORDER (4 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9)
-#define R200_CLAMP_Q_CLAMP_GL (6 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9)
-#define R200_CLAMP_Q_MASK (7 << 9)
-#define R200_MIN_MIP_LEVEL_MASK (0xff << 12)
-#define R200_MIN_MIP_LEVEL_SHIFT 12
-#define R200_TEXCOORD_NONPROJ (0 << 16)
-#define R200_TEXCOORD_CUBIC_ENV (1 << 16)
-#define R200_TEXCOORD_VOLUME (2 << 16)
-#define R200_TEXCOORD_PROJ (3 << 16)
-#define R200_TEXCOORD_DEPTH (4 << 16)
-#define R200_TEXCOORD_1D_PROJ (5 << 16)
-#define R200_TEXCOORD_1D (6 << 16)
-#define R200_TEXCOORD_ZERO (7 << 16)
-#define R200_TEXCOORD_MASK (7 << 16)
-#define R200_LOD_BIAS_MASK (0xfff80000)
-#define R200_LOD_BIAS_SHIFT 19
-#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */
-#define R200_PP_TXPITCH_0 0x2c10 /* NPOT only */
-#define R200_PP_BORDER_COLOR_0 0x2c14
-#define R200_PP_CUBIC_FACES_0 0x2c18
-#define R200_FACE_WIDTH_1_SHIFT 0
-#define R200_FACE_HEIGHT_1_SHIFT 4
-#define R200_FACE_WIDTH_1_MASK (0xf << 0)
-#define R200_FACE_HEIGHT_1_MASK (0xf << 4)
-#define R200_FACE_WIDTH_2_SHIFT 8
-#define R200_FACE_HEIGHT_2_SHIFT 12
-#define R200_FACE_WIDTH_2_MASK (0xf << 8)
-#define R200_FACE_HEIGHT_2_MASK (0xf << 12)
-#define R200_FACE_WIDTH_3_SHIFT 16
-#define R200_FACE_HEIGHT_3_SHIFT 20
-#define R200_FACE_WIDTH_3_MASK (0xf << 16)
-#define R200_FACE_HEIGHT_3_MASK (0xf << 20)
-#define R200_FACE_WIDTH_4_SHIFT 24
-#define R200_FACE_HEIGHT_4_SHIFT 28
-#define R200_FACE_WIDTH_4_MASK (0xf << 24)
-#define R200_FACE_HEIGHT_4_MASK (0xf << 28)
-#define R200_PP_TXFILTER_1 0x2c20
-#define R200_PP_TXFORMAT_1 0x2c24
-#define R200_PP_TXFORMAT_X_1 0x2c28
-#define R200_PP_TXSIZE_1 0x2c2c
-#define R200_PP_TXPITCH_1 0x2c30
-#define R200_PP_BORDER_COLOR_1 0x2c34
-#define R200_PP_CUBIC_FACES_1 0x2c38
-#define R200_PP_TXFILTER_2 0x2c40
-#define R200_PP_TXFORMAT_2 0x2c44
-#define R200_PP_TXSIZE_2 0x2c4c
-#define R200_PP_TXFORMAT_X_2 0x2c48
-#define R200_PP_TXPITCH_2 0x2c50
-#define R200_PP_BORDER_COLOR_2 0x2c54
-#define R200_PP_CUBIC_FACES_2 0x2c58
-#define R200_PP_TXFILTER_3 0x2c60
-#define R200_PP_TXFORMAT_3 0x2c64
-#define R200_PP_TXSIZE_3 0x2c6c
-#define R200_PP_TXFORMAT_X_3 0x2c68
-#define R200_PP_TXPITCH_3 0x2c70
-#define R200_PP_BORDER_COLOR_3 0x2c74
-#define R200_PP_CUBIC_FACES_3 0x2c78
-#define R200_PP_TXFILTER_4 0x2c80
-#define R200_PP_TXFORMAT_4 0x2c84
-#define R200_PP_TXSIZE_4 0x2c8c
-#define R200_PP_TXFORMAT_X_4 0x2c88
-#define R200_PP_TXPITCH_4 0x2c90
-#define R200_PP_BORDER_COLOR_4 0x2c94
-#define R200_PP_CUBIC_FACES_4 0x2c98
-#define R200_PP_TXFILTER_5 0x2ca0
-#define R200_PP_TXFORMAT_5 0x2ca4
-#define R200_PP_TXSIZE_5 0x2cac
-#define R200_PP_TXFORMAT_X_5 0x2ca8
-#define R200_PP_TXPITCH_5 0x2cb0
-#define R200_PP_BORDER_COLOR_5 0x2cb4
-#define R200_PP_CUBIC_FACES_5 0x2cb8
-/* gap */
-#define R200_PP_CNTL_X 0x2cc4
-/* gap */
-#define R200_PP_TXOFFSET_0 0x2d00
-#define R200_TXO_ENDIAN_NO_SWAP (0 << 0)
-#define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
-#define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
-#define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
-#define R200_TXO_OFFSET_MASK 0xffffffe0
-#define R200_TXO_OFFSET_SHIFT 5
-#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
-#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08
-#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c
-#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10
-#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14
-#define R200_PP_TXOFFSET_1 0x2d18
-#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c
-#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20
-#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24
-#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28
-#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c
-#define R200_PP_TXOFFSET_2 0x2d30
-#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34
-#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38
-#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c
-#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40
-#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44
-#define R200_PP_TXOFFSET_3 0x2d48
-#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c
-#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50
-#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54
-#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58
-#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c
-#define R200_PP_TXOFFSET_4 0x2d60
-#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64
-#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68
-#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c
-#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70
-#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74
-#define R200_PP_TXOFFSET_5 0x2d78
-#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c
-#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80
-#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84
-#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88
-#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c
-/* gap */
-#define R200_PP_TAM_DEBUG3 0x2d9c
-/* gap */
-#define R200_PP_TFACTOR_0 0x2ee0
-#define R200_PP_TFACTOR_1 0x2ee4
-#define R200_PP_TFACTOR_2 0x2ee8
-#define R200_PP_TFACTOR_3 0x2eec
-#define R200_PP_TFACTOR_4 0x2ef0
-#define R200_PP_TFACTOR_5 0x2ef4
-/* gap */
-#define R200_PP_TXCBLEND_0 0x2f00
-#define R200_TXC_ARG_A_ZERO (0)
-#define R200_TXC_ARG_A_CURRENT_COLOR (2)
-#define R200_TXC_ARG_A_CURRENT_ALPHA (3)
-#define R200_TXC_ARG_A_DIFFUSE_COLOR (4)
-#define R200_TXC_ARG_A_DIFFUSE_ALPHA (5)
-#define R200_TXC_ARG_A_SPECULAR_COLOR (6)
-#define R200_TXC_ARG_A_SPECULAR_ALPHA (7)
-#define R200_TXC_ARG_A_TFACTOR_COLOR (8)
-#define R200_TXC_ARG_A_TFACTOR_ALPHA (9)
-#define R200_TXC_ARG_A_R0_COLOR (10)
-#define R200_TXC_ARG_A_R0_ALPHA (11)
-#define R200_TXC_ARG_A_R1_COLOR (12)
-#define R200_TXC_ARG_A_R1_ALPHA (13)
-#define R200_TXC_ARG_A_R2_COLOR (14)
-#define R200_TXC_ARG_A_R2_ALPHA (15)
-#define R200_TXC_ARG_A_R3_COLOR (16)
-#define R200_TXC_ARG_A_R3_ALPHA (17)
-#define R200_TXC_ARG_A_R4_COLOR (18)
-#define R200_TXC_ARG_A_R4_ALPHA (19)
-#define R200_TXC_ARG_A_R5_COLOR (20)
-#define R200_TXC_ARG_A_R5_ALPHA (21)
-#define R200_TXC_ARG_A_TFACTOR1_COLOR (26)
-#define R200_TXC_ARG_A_TFACTOR1_ALPHA (27)
-#define R200_TXC_ARG_A_MASK (31 << 0)
-#define R200_TXC_ARG_A_SHIFT 0
-#define R200_TXC_ARG_B_ZERO (0<<5)
-#define R200_TXC_ARG_B_CURRENT_COLOR (2<<5)
-#define R200_TXC_ARG_B_CURRENT_ALPHA (3<<5)
-#define R200_TXC_ARG_B_DIFFUSE_COLOR (4<<5)
-#define R200_TXC_ARG_B_DIFFUSE_ALPHA (5<<5)
-#define R200_TXC_ARG_B_SPECULAR_COLOR (6<<5)
-#define R200_TXC_ARG_B_SPECULAR_ALPHA (7<<5)
-#define R200_TXC_ARG_B_TFACTOR_COLOR (8<<5)
-#define R200_TXC_ARG_B_TFACTOR_ALPHA (9<<5)
-#define R200_TXC_ARG_B_R0_COLOR (10<<5)
-#define R200_TXC_ARG_B_R0_ALPHA (11<<5)
-#define R200_TXC_ARG_B_R1_COLOR (12<<5)
-#define R200_TXC_ARG_B_R1_ALPHA (13<<5)
-#define R200_TXC_ARG_B_R2_COLOR (14<<5)
-#define R200_TXC_ARG_B_R2_ALPHA (15<<5)
-#define R200_TXC_ARG_B_R3_COLOR (16<<5)
-#define R200_TXC_ARG_B_R3_ALPHA (17<<5)
-#define R200_TXC_ARG_B_R4_COLOR (18<<5)
-#define R200_TXC_ARG_B_R4_ALPHA (19<<5)
-#define R200_TXC_ARG_B_R5_COLOR (20<<5)
-#define R200_TXC_ARG_B_R5_ALPHA (21<<5)
-#define R200_TXC_ARG_B_TFACTOR1_COLOR (26<<5)
-#define R200_TXC_ARG_B_TFACTOR1_ALPHA (27<<5)
-#define R200_TXC_ARG_B_MASK (31 << 5)
-#define R200_TXC_ARG_B_SHIFT 5
-#define R200_TXC_ARG_C_ZERO (0<<10)
-#define R200_TXC_ARG_C_CURRENT_COLOR (2<<10)
-#define R200_TXC_ARG_C_CURRENT_ALPHA (3<<10)
-#define R200_TXC_ARG_C_DIFFUSE_COLOR (4<<10)
-#define R200_TXC_ARG_C_DIFFUSE_ALPHA (5<<10)
-#define R200_TXC_ARG_C_SPECULAR_COLOR (6<<10)
-#define R200_TXC_ARG_C_SPECULAR_ALPHA (7<<10)
-#define R200_TXC_ARG_C_TFACTOR_COLOR (8<<10)
-#define R200_TXC_ARG_C_TFACTOR_ALPHA (9<<10)
-#define R200_TXC_ARG_C_R0_COLOR (10<<10)
-#define R200_TXC_ARG_C_R0_ALPHA (11<<10)
-#define R200_TXC_ARG_C_R1_COLOR (12<<10)
-#define R200_TXC_ARG_C_R1_ALPHA (13<<10)
-#define R200_TXC_ARG_C_R2_COLOR (14<<10)
-#define R200_TXC_ARG_C_R2_ALPHA (15<<10)
-#define R200_TXC_ARG_C_R3_COLOR (16<<10)
-#define R200_TXC_ARG_C_R3_ALPHA (17<<10)
-#define R200_TXC_ARG_C_R4_COLOR (18<<10)
-#define R200_TXC_ARG_C_R4_ALPHA (19<<10)
-#define R200_TXC_ARG_C_R5_COLOR (20<<10)
-#define R200_TXC_ARG_C_R5_ALPHA (21<<10)
-#define R200_TXC_ARG_C_TFACTOR1_COLOR (26<<10)
-#define R200_TXC_ARG_C_TFACTOR1_ALPHA (27<<10)
-#define R200_TXC_ARG_C_MASK (31 << 10)
-#define R200_TXC_ARG_C_SHIFT 10
-#define R200_TXC_COMP_ARG_A (1 << 16)
-#define R200_TXC_COMP_ARG_A_SHIFT (16)
-#define R200_TXC_BIAS_ARG_A (1 << 17)
-#define R200_TXC_SCALE_ARG_A (1 << 18)
-#define R200_TXC_NEG_ARG_A (1 << 19)
-#define R200_TXC_COMP_ARG_B (1 << 20)
-#define R200_TXC_COMP_ARG_B_SHIFT (20)
-#define R200_TXC_BIAS_ARG_B (1 << 21)
-#define R200_TXC_SCALE_ARG_B (1 << 22)
-#define R200_TXC_NEG_ARG_B (1 << 23)
-#define R200_TXC_COMP_ARG_C (1 << 24)
-#define R200_TXC_COMP_ARG_C_SHIFT (24)
-#define R200_TXC_BIAS_ARG_C (1 << 25)
-#define R200_TXC_SCALE_ARG_C (1 << 26)
-#define R200_TXC_NEG_ARG_C (1 << 27)
-#define R200_TXC_OP_MADD (0 << 28)
-#define R200_TXC_OP_CND0 (2 << 28)
-#define R200_TXC_OP_LERP (3 << 28)
-#define R200_TXC_OP_DOT3 (4 << 28)
-#define R200_TXC_OP_DOT4 (5 << 28)
-#define R200_TXC_OP_CONDITIONAL (6 << 28)
-#define R200_TXC_OP_DOT2_ADD (7 << 28)
-#define R200_TXC_OP_MASK (7 << 28)
-#define R200_PP_TXCBLEND2_0 0x2f04
-#define R200_TXC_TFACTOR_SEL_SHIFT 0
-#define R200_TXC_TFACTOR_SEL_MASK 0x7
-#define R200_TXC_TFACTOR1_SEL_SHIFT 4
-#define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXC_SCALE_SHIFT 8
-#define R200_TXC_SCALE_MASK (7 << 8)
-#define R200_TXC_SCALE_1X (0 << 8)
-#define R200_TXC_SCALE_2X (1 << 8)
-#define R200_TXC_SCALE_4X (2 << 8)
-#define R200_TXC_SCALE_8X (3 << 8)
-#define R200_TXC_SCALE_INV2 (5 << 8)
-#define R200_TXC_SCALE_INV4 (6 << 8)
-#define R200_TXC_SCALE_INV8 (7 << 8)
-#define R200_TXC_CLAMP_SHIFT 12
-#define R200_TXC_CLAMP_MASK (3 << 12)
-#define R200_TXC_CLAMP_WRAP (0 << 12)
-#define R200_TXC_CLAMP_0_1 (1 << 12)
-#define R200_TXC_CLAMP_8_8 (2 << 12)
-#define R200_TXC_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXC_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXC_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXC_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXC_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXC_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXC_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXC_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXC_OUTPUT_MASK_MASK (7 << 20)
-#define R200_TXC_OUTPUT_MASK_RGB (0 << 20)
-#define R200_TXC_OUTPUT_MASK_RG (1 << 20)
-#define R200_TXC_OUTPUT_MASK_RB (2 << 20)
-#define R200_TXC_OUTPUT_MASK_R (3 << 20)
-#define R200_TXC_OUTPUT_MASK_GB (4 << 20)
-#define R200_TXC_OUTPUT_MASK_G (5 << 20)
-#define R200_TXC_OUTPUT_MASK_B (6 << 20)
-#define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
-#define R200_TXC_REPL_NORMAL 0
-#define R200_TXC_REPL_RED 1
-#define R200_TXC_REPL_GREEN 2
-#define R200_TXC_REPL_BLUE 3
-#define R200_TXC_REPL_ARG_A_SHIFT 26
-#define R200_TXC_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXC_REPL_ARG_B_SHIFT 28
-#define R200_TXC_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXC_REPL_ARG_C_SHIFT 30
-#define R200_TXC_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXABLEND_0 0x2f08
-#define R200_TXA_ARG_A_ZERO (0)
-#define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */
-#define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */
-#define R200_TXA_ARG_A_DIFFUSE_ALPHA (4)
-#define R200_TXA_ARG_A_DIFFUSE_BLUE (5)
-#define R200_TXA_ARG_A_SPECULAR_ALPHA (6)
-#define R200_TXA_ARG_A_SPECULAR_BLUE (7)
-#define R200_TXA_ARG_A_TFACTOR_ALPHA (8)
-#define R200_TXA_ARG_A_TFACTOR_BLUE (9)
-#define R200_TXA_ARG_A_R0_ALPHA (10)
-#define R200_TXA_ARG_A_R0_BLUE (11)
-#define R200_TXA_ARG_A_R1_ALPHA (12)
-#define R200_TXA_ARG_A_R1_BLUE (13)
-#define R200_TXA_ARG_A_R2_ALPHA (14)
-#define R200_TXA_ARG_A_R2_BLUE (15)
-#define R200_TXA_ARG_A_R3_ALPHA (16)
-#define R200_TXA_ARG_A_R3_BLUE (17)
-#define R200_TXA_ARG_A_R4_ALPHA (18)
-#define R200_TXA_ARG_A_R4_BLUE (19)
-#define R200_TXA_ARG_A_R5_ALPHA (20)
-#define R200_TXA_ARG_A_R5_BLUE (21)
-#define R200_TXA_ARG_A_TFACTOR1_ALPHA (26)
-#define R200_TXA_ARG_A_TFACTOR1_BLUE (27)
-#define R200_TXA_ARG_A_MASK (31 << 0)
-#define R200_TXA_ARG_A_SHIFT 0
-#define R200_TXA_ARG_B_ZERO (0<<5)
-#define R200_TXA_ARG_B_CURRENT_ALPHA (2<<5) /* guess */
-#define R200_TXA_ARG_B_CURRENT_BLUE (3<<5) /* guess */
-#define R200_TXA_ARG_B_DIFFUSE_ALPHA (4<<5)
-#define R200_TXA_ARG_B_DIFFUSE_BLUE (5<<5)
-#define R200_TXA_ARG_B_SPECULAR_ALPHA (6<<5)
-#define R200_TXA_ARG_B_SPECULAR_BLUE (7<<5)
-#define R200_TXA_ARG_B_TFACTOR_ALPHA (8<<5)
-#define R200_TXA_ARG_B_TFACTOR_BLUE (9<<5)
-#define R200_TXA_ARG_B_R0_ALPHA (10<<5)
-#define R200_TXA_ARG_B_R0_BLUE (11<<5)
-#define R200_TXA_ARG_B_R1_ALPHA (12<<5)
-#define R200_TXA_ARG_B_R1_BLUE (13<<5)
-#define R200_TXA_ARG_B_R2_ALPHA (14<<5)
-#define R200_TXA_ARG_B_R2_BLUE (15<<5)
-#define R200_TXA_ARG_B_R3_ALPHA (16<<5)
-#define R200_TXA_ARG_B_R3_BLUE (17<<5)
-#define R200_TXA_ARG_B_R4_ALPHA (18<<5)
-#define R200_TXA_ARG_B_R4_BLUE (19<<5)
-#define R200_TXA_ARG_B_R5_ALPHA (20<<5)
-#define R200_TXA_ARG_B_R5_BLUE (21<<5)
-#define R200_TXA_ARG_B_TFACTOR1_ALPHA (26<<5)
-#define R200_TXA_ARG_B_TFACTOR1_BLUE (27<<5)
-#define R200_TXA_ARG_B_MASK (31 << 5)
-#define R200_TXA_ARG_B_SHIFT 5
-#define R200_TXA_ARG_C_ZERO (0<<10)
-#define R200_TXA_ARG_C_CURRENT_ALPHA (2<<10) /* guess */
-#define R200_TXA_ARG_C_CURRENT_BLUE (3<<10) /* guess */
-#define R200_TXA_ARG_C_DIFFUSE_ALPHA (4<<10)
-#define R200_TXA_ARG_C_DIFFUSE_BLUE (5<<10)
-#define R200_TXA_ARG_C_SPECULAR_ALPHA (6<<10)
-#define R200_TXA_ARG_C_SPECULAR_BLUE (7<<10)
-#define R200_TXA_ARG_C_TFACTOR_ALPHA (8<<10)
-#define R200_TXA_ARG_C_TFACTOR_BLUE (9<<10)
-#define R200_TXA_ARG_C_R0_ALPHA (10<<10)
-#define R200_TXA_ARG_C_R0_BLUE (11<<10)
-#define R200_TXA_ARG_C_R1_ALPHA (12<<10)
-#define R200_TXA_ARG_C_R1_BLUE (13<<10)
-#define R200_TXA_ARG_C_R2_ALPHA (14<<10)
-#define R200_TXA_ARG_C_R2_BLUE (15<<10)
-#define R200_TXA_ARG_C_R3_ALPHA (16<<10)
-#define R200_TXA_ARG_C_R3_BLUE (17<<10)
-#define R200_TXA_ARG_C_R4_ALPHA (18<<10)
-#define R200_TXA_ARG_C_R4_BLUE (19<<10)
-#define R200_TXA_ARG_C_R5_ALPHA (20<<10)
-#define R200_TXA_ARG_C_R5_BLUE (21<<10)
-#define R200_TXA_ARG_C_TFACTOR1_ALPHA (26<<10)
-#define R200_TXA_ARG_C_TFACTOR1_BLUE (27<<10)
-#define R200_TXA_ARG_C_MASK (31 << 10)
-#define R200_TXA_ARG_C_SHIFT 10
-#define R200_TXA_COMP_ARG_A (1 << 16)
-#define R200_TXA_COMP_ARG_A_SHIFT (16)
-#define R200_TXA_BIAS_ARG_A (1 << 17)
-#define R200_TXA_SCALE_ARG_A (1 << 18)
-#define R200_TXA_NEG_ARG_A (1 << 19)
-#define R200_TXA_COMP_ARG_B (1 << 20)
-#define R200_TXA_COMP_ARG_B_SHIFT (20)
-#define R200_TXA_BIAS_ARG_B (1 << 21)
-#define R200_TXA_SCALE_ARG_B (1 << 22)
-#define R200_TXA_NEG_ARG_B (1 << 23)
-#define R200_TXA_COMP_ARG_C (1 << 24)
-#define R200_TXA_COMP_ARG_C_SHIFT (24)
-#define R200_TXA_BIAS_ARG_C (1 << 25)
-#define R200_TXA_SCALE_ARG_C (1 << 26)
-#define R200_TXA_NEG_ARG_C (1 << 27)
-#define R200_TXA_OP_MADD (0 << 28)
-#define R200_TXA_OP_CND0 (2 << 28)
-#define R200_TXA_OP_LERP (3 << 28)
-#define R200_TXA_OP_CONDITIONAL (6 << 28)
-#define R200_TXA_OP_MASK (7 << 28)
-#define R200_PP_TXABLEND2_0 0x2f0c
-#define R200_TXA_TFACTOR_SEL_SHIFT 0
-#define R200_TXA_TFACTOR_SEL_MASK 0x7
-#define R200_TXA_TFACTOR1_SEL_SHIFT 4
-#define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXA_SCALE_SHIFT 8
-#define R200_TXA_SCALE_MASK (7 << 8)
-#define R200_TXA_SCALE_1X (0 << 8)
-#define R200_TXA_SCALE_2X (1 << 8)
-#define R200_TXA_SCALE_4X (2 << 8)
-#define R200_TXA_SCALE_8X (3 << 8)
-#define R200_TXA_SCALE_INV2 (5 << 8)
-#define R200_TXA_SCALE_INV4 (6 << 8)
-#define R200_TXA_SCALE_INV8 (7 << 8)
-#define R200_TXA_CLAMP_SHIFT 12
-#define R200_TXA_CLAMP_MASK (3 << 12)
-#define R200_TXA_CLAMP_WRAP (0 << 12)
-#define R200_TXA_CLAMP_0_1 (1 << 12)
-#define R200_TXA_CLAMP_8_8 (2 << 12)
-#define R200_TXA_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXA_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXA_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXA_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXA_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXA_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXA_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXA_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXA_DOT_ALPHA (1 << 20)
-#define R200_TXA_REPL_NORMAL 0
-#define R200_TXA_REPL_RED 1
-#define R200_TXA_REPL_GREEN 2
-#define R200_TXA_REPL_ARG_A_SHIFT 26
-#define R200_TXA_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXA_REPL_ARG_B_SHIFT 28
-#define R200_TXA_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXA_REPL_ARG_C_SHIFT 30
-#define R200_TXA_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXCBLEND_1 0x2f10
-#define R200_PP_TXCBLEND2_1 0x2f14
-#define R200_PP_TXABLEND_1 0x2f18
-#define R200_PP_TXABLEND2_1 0x2f1c
-#define R200_PP_TXCBLEND_2 0x2f20
-#define R200_PP_TXCBLEND2_2 0x2f24
-#define R200_PP_TXABLEND_2 0x2f28
-#define R200_PP_TXABLEND2_2 0x2f2c
-#define R200_PP_TXCBLEND_3 0x2f30
-#define R200_PP_TXCBLEND2_3 0x2f34
-#define R200_PP_TXABLEND_3 0x2f38
-#define R200_PP_TXABLEND2_3 0x2f3c
-#define R200_PP_TXCBLEND_4 0x2f40
-#define R200_PP_TXCBLEND2_4 0x2f44
-#define R200_PP_TXABLEND_4 0x2f48
-#define R200_PP_TXABLEND2_4 0x2f4c
-#define R200_PP_TXCBLEND_5 0x2f50
-#define R200_PP_TXCBLEND2_5 0x2f54
-#define R200_PP_TXABLEND_5 0x2f58
-#define R200_PP_TXABLEND2_5 0x2f5c
-#define R200_PP_TXCBLEND_6 0x2f60
-#define R200_PP_TXCBLEND2_6 0x2f64
-#define R200_PP_TXABLEND_6 0x2f68
-#define R200_PP_TXABLEND2_6 0x2f6c
-#define R200_PP_TXCBLEND_7 0x2f70
-#define R200_PP_TXCBLEND2_7 0x2f74
-#define R200_PP_TXABLEND_7 0x2f78
-#define R200_PP_TXABLEND2_7 0x2f7c
-/* gap */
-#define R200_RB3D_ABLENDCNTL 0x321C /* see BLENDCTL */
-#define R200_RB3D_CBLENDCNTL 0x3220 /* see BLENDCTL */
-
-
-/*
- * Offsets in TCL vector state. NOTE: Hardwiring matrix positions.
- * Multiple contexts could collaberate to eliminate state bouncing.
- */
-#define R200_VS_LIGHT_AMBIENT_ADDR 0x00000028
-#define R200_VS_LIGHT_DIFFUSE_ADDR 0x00000030
-#define R200_VS_LIGHT_SPECULAR_ADDR 0x00000038
-#define R200_VS_LIGHT_DIRPOS_ADDR 0x00000040
-#define R200_VS_LIGHT_HWVSPOT_ADDR 0x00000048
-#define R200_VS_LIGHT_ATTENUATION_ADDR 0x00000050
-#define R200_VS_SPOT_DUAL_CONE 0x00000058
-#define R200_VS_GLOBAL_AMBIENT_ADDR 0x0000005C
-#define R200_VS_FOG_PARAM_ADDR 0x0000005D
-#define R200_VS_EYE_VECTOR_ADDR 0x0000005E
-#define R200_VS_UCP_ADDR 0x00000060
-#define R200_VS_PNT_SPRITE_VPORT_SCALE 0x00000068
-#define R200_VS_MATRIX_0_MV 0x00000080
-#define R200_VS_MATRIX_1_INV_MV 0x00000084
-#define R200_VS_MATRIX_2_MVP 0x00000088
-#define R200_VS_MATRIX_3_TEX0 0x0000008C
-#define R200_VS_MATRIX_4_TEX1 0x00000090
-#define R200_VS_MATRIX_5_TEX2 0x00000094
-#define R200_VS_MATRIX_6_TEX3 0x00000098
-#define R200_VS_MATRIX_7_TEX4 0x0000009C
-#define R200_VS_MATRIX_8_TEX5 0x000000A0
-#define R200_VS_MAT_0_EMISS 0x000000B0
-#define R200_VS_MAT_0_AMB 0x000000B1
-#define R200_VS_MAT_0_DIF 0x000000B2
-#define R200_VS_MAT_0_SPEC 0x000000B3
-#define R200_VS_MAT_1_EMISS 0x000000B4
-#define R200_VS_MAT_1_AMB 0x000000B5
-#define R200_VS_MAT_1_DIF 0x000000B6
-#define R200_VS_MAT_1_SPEC 0x000000B7
-#define R200_VS_EYE2CLIP_MTX 0x000000B8
-#define R200_VS_PNT_SPRITE_ATT_CONST 0x000000BC
-#define R200_VS_PNT_SPRITE_EYE_IN_MODEL 0x000000BD
-#define R200_VS_PNT_SPRITE_CLAMP 0x000000BE
-#define R200_VS_MAX 0x000001C0
-
-
-/*
- * Offsets in TCL scalar state
- */
-#define R200_SS_LIGHT_DCD_ADDR 0x00000000
-#define R200_SS_LIGHT_DCM_ADDR 0x00000008
-#define R200_SS_LIGHT_SPOT_EXPONENT_ADDR 0x00000010
-#define R200_SS_LIGHT_SPOT_CUTOFF_ADDR 0x00000018
-#define R200_SS_LIGHT_SPECULAR_THRESH_ADDR 0x00000020
-#define R200_SS_LIGHT_RANGE_CUTOFF_SQRD 0x00000028
-#define R200_SS_LIGHT_RANGE_ATT_CONST 0x00000030
-#define R200_SS_VERT_GUARD_CLIP_ADJ_ADDR 0x00000080
-#define R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR 0x00000081
-#define R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR 0x00000082
-#define R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 0x00000083
-#define R200_SS_MAT_0_SHININESS 0x00000100
-#define R200_SS_MAT_1_SHININESS 0x00000101
-
-
-/*
- * Matrix indices
- */
-#define R200_MTX_MV 0
-#define R200_MTX_IMV 1
-#define R200_MTX_MVP 2
-#define R200_MTX_TEX0 3
-#define R200_MTX_TEX1 4
-#define R200_MTX_TEX2 5
-#define R200_MTX_TEX3 6
-#define R200_MTX_TEX4 7
-#define R200_MTX_TEX5 8
-
-/* Color formats for 2d packets
- */
-#define R200_CP_COLOR_FORMAT_CI8 2
-#define R200_CP_COLOR_FORMAT_ARGB1555 3
-#define R200_CP_COLOR_FORMAT_RGB565 4
-#define R200_CP_COLOR_FORMAT_ARGB8888 6
-#define R200_CP_COLOR_FORMAT_RGB332 7
-#define R200_CP_COLOR_FORMAT_RGB8 9
-#define R200_CP_COLOR_FORMAT_ARGB4444 15
-
-
-/*
- * CP type-3 packets
- */
-#define R200_CP_CMD_NOP 0xC0001000
-#define R200_CP_CMD_NEXT_CHAR 0xC0001900
-#define R200_CP_CMD_PLY_NEXTSCAN 0xC0001D00
-#define R200_CP_CMD_SET_SCISSORS 0xC0001E00
-#define R200_CP_CMD_LOAD_MICROCODE 0xC0002400
-#define R200_CP_CMD_WAIT_FOR_IDLE 0xC0002600
-#define R200_CP_CMD_3D_DRAW_VBUF 0xC0002800
-#define R200_CP_CMD_3D_DRAW_IMMD 0xC0002900
-#define R200_CP_CMD_3D_DRAW_INDX 0xC0002A00
-#define R200_CP_CMD_LOAD_PALETTE 0xC0002C00
-#define R200_CP_CMD_3D_LOAD_VBPNTR 0xC0002F00
-#define R200_CP_CMD_INDX_BUFFER 0xC0003300
-#define R200_CP_CMD_3D_DRAW_VBUF_2 0xC0003400
-#define R200_CP_CMD_3D_DRAW_IMMD_2 0xC0003500
-#define R200_CP_CMD_3D_DRAW_INDX_2 0xC0003600
-#define R200_CP_CMD_PAINT 0xC0009100
-#define R200_CP_CMD_BITBLT 0xC0009200
-#define R200_CP_CMD_SMALLTEXT 0xC0009300
-#define R200_CP_CMD_HOSTDATA_BLT 0xC0009400
-#define R200_CP_CMD_POLYLINE 0xC0009500
-#define R200_CP_CMD_POLYSCANLINES 0xC0009800
-#define R200_CP_CMD_PAINT_MULTI 0xC0009A00
-#define R200_CP_CMD_BITBLT_MULTI 0xC0009B00
-#define R200_CP_CMD_TRANS_BITBLT 0xC0009C00
-
-#endif
-
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c b/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c
deleted file mode 100644
index bc7838953..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c
+++ /dev/null
@@ -1,1324 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_sanity.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc, Cedar Park, TX.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "imports.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-#include "r200_reg.h"
-
-/* Set this '1' to get more verbiage.
- */
-#define MORE_VERBOSE 1
-
-#if MORE_VERBOSE
-#define VERBOSE (R200_DEBUG & DEBUG_VERBOSE)
-#define NORMAL (1)
-#else
-#define VERBOSE 0
-#define NORMAL (R200_DEBUG & DEBUG_VERBOSE)
-#endif
-
-
-/* New (1.3) state mechanism. 3 commands (packet, scalar, vector) in
- * 1.3 cmdbuffers allow all previous state to be updated as well as
- * the tcl scalar and vector areas.
- */
-static struct {
- int start;
- int len;
- const char *name;
-} packet[RADEON_MAX_STATE_PACKETS] = {
- { RADEON_PP_MISC,7,"RADEON_PP_MISC" },
- { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" },
- { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" },
- { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" },
- { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" },
- { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" },
- { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" },
- { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" },
- { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" },
- { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_MISC,1,"RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" },
- { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" },
- { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" },
- { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" },
- { R200_PP_TXCBLEND_0, 4, "R200_EMIT_PP_TXCBLEND_0" },
- { R200_PP_TXCBLEND_1, 4, "R200_PP_TXCBLEND_1" },
- { R200_PP_TXCBLEND_2, 4, "R200_PP_TXCBLEND_2" },
- { R200_PP_TXCBLEND_3, 4, "R200_PP_TXCBLEND_3" },
- { R200_PP_TXCBLEND_4, 4, "R200_PP_TXCBLEND_4" },
- { R200_PP_TXCBLEND_5, 4, "R200_PP_TXCBLEND_5" },
- { R200_PP_TXCBLEND_6, 4, "R200_PP_TXCBLEND_6" },
- { R200_PP_TXCBLEND_7, 4, "R200_PP_TXCBLEND_7" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_0, 6, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { R200_PP_TFACTOR_0, 6, "R200_PP_TFACTOR_0" },
- { R200_SE_VTX_FMT_0, 4, "R200_SE_VTX_FMT_0" },
- { R200_SE_VAP_CNTL, 1, "R200_SE_VAP_CNTL" },
- { R200_SE_TCL_MATRIX_SEL_0, 5, "R200_SE_TCL_MATRIX_SEL_0" },
- { R200_SE_TCL_TEX_PROC_CTL_2, 5, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { R200_SE_TCL_UCP_VERT_BLEND_CTL, 1, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { R200_PP_TXFILTER_0, 6, "R200_PP_TXFILTER_0" },
- { R200_PP_TXFILTER_1, 6, "R200_PP_TXFILTER_1" },
- { R200_PP_TXFILTER_2, 6, "R200_PP_TXFILTER_2" },
- { R200_PP_TXFILTER_3, 6, "R200_PP_TXFILTER_3" },
- { R200_PP_TXFILTER_4, 6, "R200_PP_TXFILTER_4" },
- { R200_PP_TXFILTER_5, 6, "R200_PP_TXFILTER_5" },
- { R200_PP_TXOFFSET_0, 1, "R200_PP_TXOFFSET_0" },
- { R200_PP_TXOFFSET_1, 1, "R200_PP_TXOFFSET_1" },
- { R200_PP_TXOFFSET_2, 1, "R200_PP_TXOFFSET_2" },
- { R200_PP_TXOFFSET_3, 1, "R200_PP_TXOFFSET_3" },
- { R200_PP_TXOFFSET_4, 1, "R200_PP_TXOFFSET_4" },
- { R200_PP_TXOFFSET_5, 1, "R200_PP_TXOFFSET_5" },
- { R200_SE_VTE_CNTL, 1, "R200_SE_VTE_CNTL" },
- { R200_SE_TCL_OUTPUT_VTX_COMP_SEL, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { R200_PP_TAM_DEBUG3, 1, "R200_PP_TAM_DEBUG3" },
- { R200_PP_CNTL_X, 1, "R200_PP_CNTL_X" },
- { R200_RB3D_DEPTHXY_OFFSET, 1, "R200_RB3D_DEPTHXY_OFFSET" },
- { R200_RE_AUX_SCISSOR_CNTL, 1, "R200_RE_AUX_SCISSOR_CNTL" },
- { R200_RE_SCISSOR_TL_0, 2, "R200_RE_SCISSOR_TL_0" },
- { R200_RE_SCISSOR_TL_1, 2, "R200_RE_SCISSOR_TL_1" },
- { R200_RE_SCISSOR_TL_2, 2, "R200_RE_SCISSOR_TL_2" },
- { R200_SE_VAP_CNTL_STATUS, 1, "R200_SE_VAP_CNTL_STATUS" },
- { R200_SE_VTX_STATE_CNTL, 1, "R200_SE_VTX_STATE_CNTL" },
- { R200_RE_POINTSIZE, 1, "R200_RE_POINTSIZE" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, 4, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { R200_PP_CUBIC_FACES_0, 1, "R200_PP_CUBIC_FACES_0" }, /* 61 */
- { R200_PP_CUBIC_OFFSET_F1_0, 5, "R200_PP_CUBIC_OFFSET_F1_0" }, /* 62 */
- { R200_PP_CUBIC_FACES_1, 1, "R200_PP_CUBIC_FACES_1" },
- { R200_PP_CUBIC_OFFSET_F1_1, 5, "R200_PP_CUBIC_OFFSET_F1_1" },
- { R200_PP_CUBIC_FACES_2, 1, "R200_PP_CUBIC_FACES_2" },
- { R200_PP_CUBIC_OFFSET_F1_2, 5, "R200_PP_CUBIC_OFFSET_F1_2" },
- { R200_PP_CUBIC_FACES_3, 1, "R200_PP_CUBIC_FACES_3" },
- { R200_PP_CUBIC_OFFSET_F1_3, 5, "R200_PP_CUBIC_OFFSET_F1_3" },
- { R200_PP_CUBIC_FACES_4, 1, "R200_PP_CUBIC_FACES_4" },
- { R200_PP_CUBIC_OFFSET_F1_4, 5, "R200_PP_CUBIC_OFFSET_F1_4" },
- { R200_PP_CUBIC_FACES_5, 1, "R200_PP_CUBIC_FACES_5" },
- { R200_PP_CUBIC_OFFSET_F1_5, 5, "R200_PP_CUBIC_OFFSET_F1_5" },
-};
-
-struct reg_names {
- int idx;
- const char *name;
-};
-
-static struct reg_names reg_names[] = {
- { R200_PP_MISC, "R200_PP_MISC" },
- { R200_PP_FOG_COLOR, "R200_PP_FOG_COLOR" },
- { R200_RE_SOLID_COLOR, "R200_RE_SOLID_COLOR" },
- { R200_RB3D_BLENDCNTL, "R200_RB3D_BLENDCNTL" },
- { R200_RB3D_DEPTHOFFSET, "R200_RB3D_DEPTHOFFSET" },
- { R200_RB3D_DEPTHPITCH, "R200_RB3D_DEPTHPITCH" },
- { R200_RB3D_ZSTENCILCNTL, "R200_RB3D_ZSTENCILCNTL" },
- { R200_PP_CNTL, "R200_PP_CNTL" },
- { R200_RB3D_CNTL, "R200_RB3D_CNTL" },
- { R200_RB3D_COLOROFFSET, "R200_RB3D_COLOROFFSET" },
- { R200_RE_WIDTH_HEIGHT, "R200_RE_WIDTH_HEIGHT" },
- { R200_RB3D_COLORPITCH, "R200_RB3D_COLORPITCH" },
- { R200_SE_CNTL, "R200_SE_CNTL" },
- { R200_RE_CNTL, "R200_RE_CNTL" },
- { R200_RE_MISC, "R200_RE_MISC" },
- { R200_RE_STIPPLE_ADDR, "R200_RE_STIPPLE_ADDR" },
- { R200_RE_STIPPLE_DATA, "R200_RE_STIPPLE_DATA" },
- { R200_RE_LINE_PATTERN, "R200_RE_LINE_PATTERN" },
- { R200_RE_LINE_STATE, "R200_RE_LINE_STATE" },
- { R200_RE_SCISSOR_TL_0, "R200_RE_SCISSOR_TL_0" },
- { R200_RE_SCISSOR_BR_0, "R200_RE_SCISSOR_BR_0" },
- { R200_RE_SCISSOR_TL_1, "R200_RE_SCISSOR_TL_1" },
- { R200_RE_SCISSOR_BR_1, "R200_RE_SCISSOR_BR_1" },
- { R200_RE_SCISSOR_TL_2, "R200_RE_SCISSOR_TL_2" },
- { R200_RE_SCISSOR_BR_2, "R200_RE_SCISSOR_BR_2" },
- { R200_RB3D_DEPTHXY_OFFSET, "R200_RB3D_DEPTHXY_OFFSET" },
- { R200_RB3D_STENCILREFMASK, "R200_RB3D_STENCILREFMASK" },
- { R200_RB3D_ROPCNTL, "R200_RB3D_ROPCNTL" },
- { R200_RB3D_PLANEMASK, "R200_RB3D_PLANEMASK" },
- { R200_SE_VPORT_XSCALE, "R200_SE_VPORT_XSCALE" },
- { R200_SE_VPORT_XOFFSET, "R200_SE_VPORT_XOFFSET" },
- { R200_SE_VPORT_YSCALE, "R200_SE_VPORT_YSCALE" },
- { R200_SE_VPORT_YOFFSET, "R200_SE_VPORT_YOFFSET" },
- { R200_SE_VPORT_ZSCALE, "R200_SE_VPORT_ZSCALE" },
- { R200_SE_VPORT_ZOFFSET, "R200_SE_VPORT_ZOFFSET" },
- { R200_SE_ZBIAS_FACTOR, "R200_SE_ZBIAS_FACTOR" },
- { R200_SE_ZBIAS_CONSTANT, "R200_SE_ZBIAS_CONSTANT" },
- { R200_SE_LINE_WIDTH, "R200_SE_LINE_WIDTH" },
- { R200_SE_VAP_CNTL, "R200_SE_VAP_CNTL" },
- { R200_SE_VF_CNTL, "R200_SE_VF_CNTL" },
- { R200_SE_VTX_FMT_0, "R200_SE_VTX_FMT_0" },
- { R200_SE_VTX_FMT_1, "R200_SE_VTX_FMT_1" },
- { R200_SE_TCL_OUTPUT_VTX_FMT_0, "R200_SE_TCL_OUTPUT_VTX_FMT_0" },
- { R200_SE_TCL_OUTPUT_VTX_FMT_1, "R200_SE_TCL_OUTPUT_VTX_FMT_1" },
- { R200_SE_VTE_CNTL, "R200_SE_VTE_CNTL" },
- { R200_SE_VTX_NUM_ARRAYS, "R200_SE_VTX_NUM_ARRAYS" },
- { R200_SE_VTX_AOS_ATTR01, "R200_SE_VTX_AOS_ATTR01" },
- { R200_SE_VTX_AOS_ADDR0, "R200_SE_VTX_AOS_ADDR0" },
- { R200_SE_VTX_AOS_ADDR1, "R200_SE_VTX_AOS_ADDR1" },
- { R200_SE_VTX_AOS_ATTR23, "R200_SE_VTX_AOS_ATTR23" },
- { R200_SE_VTX_AOS_ADDR2, "R200_SE_VTX_AOS_ADDR2" },
- { R200_SE_VTX_AOS_ADDR3, "R200_SE_VTX_AOS_ADDR3" },
- { R200_SE_VTX_AOS_ATTR45, "R200_SE_VTX_AOS_ATTR45" },
- { R200_SE_VTX_AOS_ADDR4, "R200_SE_VTX_AOS_ADDR4" },
- { R200_SE_VTX_AOS_ADDR5, "R200_SE_VTX_AOS_ADDR5" },
- { R200_SE_VTX_AOS_ATTR67, "R200_SE_VTX_AOS_ATTR67" },
- { R200_SE_VTX_AOS_ADDR6, "R200_SE_VTX_AOS_ADDR6" },
- { R200_SE_VTX_AOS_ADDR7, "R200_SE_VTX_AOS_ADDR7" },
- { R200_SE_VTX_AOS_ATTR89, "R200_SE_VTX_AOS_ATTR89" },
- { R200_SE_VTX_AOS_ADDR8, "R200_SE_VTX_AOS_ADDR8" },
- { R200_SE_VTX_AOS_ADDR9, "R200_SE_VTX_AOS_ADDR9" },
- { R200_SE_VTX_AOS_ATTR1011, "R200_SE_VTX_AOS_ATTR1011" },
- { R200_SE_VTX_AOS_ADDR10, "R200_SE_VTX_AOS_ADDR10" },
- { R200_SE_VTX_AOS_ADDR11, "R200_SE_VTX_AOS_ADDR11" },
- { R200_SE_VF_MAX_VTX_INDX, "R200_SE_VF_MAX_VTX_INDX" },
- { R200_SE_VF_MIN_VTX_INDX, "R200_SE_VF_MIN_VTX_INDX" },
- { R200_SE_VTX_STATE_CNTL, "R200_SE_VTX_STATE_CNTL" },
- { R200_SE_TCL_VECTOR_INDX_REG, "R200_SE_TCL_VECTOR_INDX_REG" },
- { R200_SE_TCL_VECTOR_DATA_REG, "R200_SE_TCL_VECTOR_DATA_REG" },
- { R200_SE_TCL_SCALAR_INDX_REG, "R200_SE_TCL_SCALAR_INDX_REG" },
- { R200_SE_TCL_SCALAR_DATA_REG, "R200_SE_TCL_SCALAR_DATA_REG" },
- { R200_SE_TCL_MATRIX_SEL_0, "R200_SE_TCL_MATRIX_SEL_0" },
- { R200_SE_TCL_MATRIX_SEL_1, "R200_SE_TCL_MATRIX_SEL_1" },
- { R200_SE_TCL_MATRIX_SEL_2, "R200_SE_TCL_MATRIX_SEL_2" },
- { R200_SE_TCL_MATRIX_SEL_3, "R200_SE_TCL_MATRIX_SEL_3" },
- { R200_SE_TCL_MATRIX_SEL_4, "R200_SE_TCL_MATRIX_SEL_4" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_0, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_1, "R200_SE_TCL_LIGHT_MODEL_CTL_1" },
- { R200_SE_TCL_PER_LIGHT_CTL_0, "R200_SE_TCL_PER_LIGHT_CTL_0" },
- { R200_SE_TCL_PER_LIGHT_CTL_1, "R200_SE_TCL_PER_LIGHT_CTL_1" },
- { R200_SE_TCL_PER_LIGHT_CTL_2, "R200_SE_TCL_PER_LIGHT_CTL_2" },
- { R200_SE_TCL_PER_LIGHT_CTL_3, "R200_SE_TCL_PER_LIGHT_CTL_3" },
- { R200_SE_TCL_TEX_PROC_CTL_2, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { R200_SE_TCL_TEX_PROC_CTL_3, "R200_SE_TCL_TEX_PROC_CTL_3" },
- { R200_SE_TCL_TEX_PROC_CTL_0, "R200_SE_TCL_TEX_PROC_CTL_0" },
- { R200_SE_TCL_TEX_PROC_CTL_1, "R200_SE_TCL_TEX_PROC_CTL_1" },
- { R200_SE_TC_TEX_CYL_WRAP_CTL, "R200_SE_TC_TEX_CYL_WRAP_CTL" },
- { R200_SE_TCL_UCP_VERT_BLEND_CTL, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { R200_SE_TCL_POINT_SPRITE_CNTL, "R200_SE_TCL_POINT_SPRITE_CNTL" },
- { R200_SE_VTX_ST_POS_0_X_4, "R200_SE_VTX_ST_POS_0_X_4" },
- { R200_SE_VTX_ST_POS_0_Y_4, "R200_SE_VTX_ST_POS_0_Y_4" },
- { R200_SE_VTX_ST_POS_0_Z_4, "R200_SE_VTX_ST_POS_0_Z_4" },
- { R200_SE_VTX_ST_POS_0_W_4, "R200_SE_VTX_ST_POS_0_W_4" },
- { R200_SE_VTX_ST_NORM_0_X, "R200_SE_VTX_ST_NORM_0_X" },
- { R200_SE_VTX_ST_NORM_0_Y, "R200_SE_VTX_ST_NORM_0_Y" },
- { R200_SE_VTX_ST_NORM_0_Z, "R200_SE_VTX_ST_NORM_0_Z" },
- { R200_SE_VTX_ST_PVMS, "R200_SE_VTX_ST_PVMS" },
- { R200_SE_VTX_ST_CLR_0_R, "R200_SE_VTX_ST_CLR_0_R" },
- { R200_SE_VTX_ST_CLR_0_G, "R200_SE_VTX_ST_CLR_0_G" },
- { R200_SE_VTX_ST_CLR_0_B, "R200_SE_VTX_ST_CLR_0_B" },
- { R200_SE_VTX_ST_CLR_0_A, "R200_SE_VTX_ST_CLR_0_A" },
- { R200_SE_VTX_ST_CLR_1_R, "R200_SE_VTX_ST_CLR_1_R" },
- { R200_SE_VTX_ST_CLR_1_G, "R200_SE_VTX_ST_CLR_1_G" },
- { R200_SE_VTX_ST_CLR_1_B, "R200_SE_VTX_ST_CLR_1_B" },
- { R200_SE_VTX_ST_CLR_1_A, "R200_SE_VTX_ST_CLR_1_A" },
- { R200_SE_VTX_ST_CLR_2_R, "R200_SE_VTX_ST_CLR_2_R" },
- { R200_SE_VTX_ST_CLR_2_G, "R200_SE_VTX_ST_CLR_2_G" },
- { R200_SE_VTX_ST_CLR_2_B, "R200_SE_VTX_ST_CLR_2_B" },
- { R200_SE_VTX_ST_CLR_2_A, "R200_SE_VTX_ST_CLR_2_A" },
- { R200_SE_VTX_ST_CLR_3_R, "R200_SE_VTX_ST_CLR_3_R" },
- { R200_SE_VTX_ST_CLR_3_G, "R200_SE_VTX_ST_CLR_3_G" },
- { R200_SE_VTX_ST_CLR_3_B, "R200_SE_VTX_ST_CLR_3_B" },
- { R200_SE_VTX_ST_CLR_3_A, "R200_SE_VTX_ST_CLR_3_A" },
- { R200_SE_VTX_ST_CLR_4_R, "R200_SE_VTX_ST_CLR_4_R" },
- { R200_SE_VTX_ST_CLR_4_G, "R200_SE_VTX_ST_CLR_4_G" },
- { R200_SE_VTX_ST_CLR_4_B, "R200_SE_VTX_ST_CLR_4_B" },
- { R200_SE_VTX_ST_CLR_4_A, "R200_SE_VTX_ST_CLR_4_A" },
- { R200_SE_VTX_ST_CLR_5_R, "R200_SE_VTX_ST_CLR_5_R" },
- { R200_SE_VTX_ST_CLR_5_G, "R200_SE_VTX_ST_CLR_5_G" },
- { R200_SE_VTX_ST_CLR_5_B, "R200_SE_VTX_ST_CLR_5_B" },
- { R200_SE_VTX_ST_CLR_5_A, "R200_SE_VTX_ST_CLR_5_A" },
- { R200_SE_VTX_ST_CLR_6_R, "R200_SE_VTX_ST_CLR_6_R" },
- { R200_SE_VTX_ST_CLR_6_G, "R200_SE_VTX_ST_CLR_6_G" },
- { R200_SE_VTX_ST_CLR_6_B, "R200_SE_VTX_ST_CLR_6_B" },
- { R200_SE_VTX_ST_CLR_6_A, "R200_SE_VTX_ST_CLR_6_A" },
- { R200_SE_VTX_ST_CLR_7_R, "R200_SE_VTX_ST_CLR_7_R" },
- { R200_SE_VTX_ST_CLR_7_G, "R200_SE_VTX_ST_CLR_7_G" },
- { R200_SE_VTX_ST_CLR_7_B, "R200_SE_VTX_ST_CLR_7_B" },
- { R200_SE_VTX_ST_CLR_7_A, "R200_SE_VTX_ST_CLR_7_A" },
- { R200_SE_VTX_ST_TEX_0_S, "R200_SE_VTX_ST_TEX_0_S" },
- { R200_SE_VTX_ST_TEX_0_T, "R200_SE_VTX_ST_TEX_0_T" },
- { R200_SE_VTX_ST_TEX_0_R, "R200_SE_VTX_ST_TEX_0_R" },
- { R200_SE_VTX_ST_TEX_0_Q, "R200_SE_VTX_ST_TEX_0_Q" },
- { R200_SE_VTX_ST_TEX_1_S, "R200_SE_VTX_ST_TEX_1_S" },
- { R200_SE_VTX_ST_TEX_1_T, "R200_SE_VTX_ST_TEX_1_T" },
- { R200_SE_VTX_ST_TEX_1_R, "R200_SE_VTX_ST_TEX_1_R" },
- { R200_SE_VTX_ST_TEX_1_Q, "R200_SE_VTX_ST_TEX_1_Q" },
- { R200_SE_VTX_ST_TEX_2_S, "R200_SE_VTX_ST_TEX_2_S" },
- { R200_SE_VTX_ST_TEX_2_T, "R200_SE_VTX_ST_TEX_2_T" },
- { R200_SE_VTX_ST_TEX_2_R, "R200_SE_VTX_ST_TEX_2_R" },
- { R200_SE_VTX_ST_TEX_2_Q, "R200_SE_VTX_ST_TEX_2_Q" },
- { R200_SE_VTX_ST_TEX_3_S, "R200_SE_VTX_ST_TEX_3_S" },
- { R200_SE_VTX_ST_TEX_3_T, "R200_SE_VTX_ST_TEX_3_T" },
- { R200_SE_VTX_ST_TEX_3_R, "R200_SE_VTX_ST_TEX_3_R" },
- { R200_SE_VTX_ST_TEX_3_Q, "R200_SE_VTX_ST_TEX_3_Q" },
- { R200_SE_VTX_ST_TEX_4_S, "R200_SE_VTX_ST_TEX_4_S" },
- { R200_SE_VTX_ST_TEX_4_T, "R200_SE_VTX_ST_TEX_4_T" },
- { R200_SE_VTX_ST_TEX_4_R, "R200_SE_VTX_ST_TEX_4_R" },
- { R200_SE_VTX_ST_TEX_4_Q, "R200_SE_VTX_ST_TEX_4_Q" },
- { R200_SE_VTX_ST_TEX_5_S, "R200_SE_VTX_ST_TEX_5_S" },
- { R200_SE_VTX_ST_TEX_5_T, "R200_SE_VTX_ST_TEX_5_T" },
- { R200_SE_VTX_ST_TEX_5_R, "R200_SE_VTX_ST_TEX_5_R" },
- { R200_SE_VTX_ST_TEX_5_Q, "R200_SE_VTX_ST_TEX_5_Q" },
- { R200_SE_VTX_ST_PNT_SPRT_SZ, "R200_SE_VTX_ST_PNT_SPRT_SZ" },
- { R200_SE_VTX_ST_DISC_FOG, "R200_SE_VTX_ST_DISC_FOG" },
- { R200_SE_VTX_ST_SHININESS_0, "R200_SE_VTX_ST_SHININESS_0" },
- { R200_SE_VTX_ST_SHININESS_1, "R200_SE_VTX_ST_SHININESS_1" },
- { R200_SE_VTX_ST_BLND_WT_0, "R200_SE_VTX_ST_BLND_WT_0" },
- { R200_SE_VTX_ST_BLND_WT_1, "R200_SE_VTX_ST_BLND_WT_1" },
- { R200_SE_VTX_ST_BLND_WT_2, "R200_SE_VTX_ST_BLND_WT_2" },
- { R200_SE_VTX_ST_BLND_WT_3, "R200_SE_VTX_ST_BLND_WT_3" },
- { R200_SE_VTX_ST_POS_1_X, "R200_SE_VTX_ST_POS_1_X" },
- { R200_SE_VTX_ST_POS_1_Y, "R200_SE_VTX_ST_POS_1_Y" },
- { R200_SE_VTX_ST_POS_1_Z, "R200_SE_VTX_ST_POS_1_Z" },
- { R200_SE_VTX_ST_POS_1_W, "R200_SE_VTX_ST_POS_1_W" },
- { R200_SE_VTX_ST_NORM_1_X, "R200_SE_VTX_ST_NORM_1_X" },
- { R200_SE_VTX_ST_NORM_1_Y, "R200_SE_VTX_ST_NORM_1_Y" },
- { R200_SE_VTX_ST_NORM_1_Z, "R200_SE_VTX_ST_NORM_1_Z" },
- { R200_SE_VTX_ST_USR_CLR_0_R, "R200_SE_VTX_ST_USR_CLR_0_R" },
- { R200_SE_VTX_ST_USR_CLR_0_G, "R200_SE_VTX_ST_USR_CLR_0_G" },
- { R200_SE_VTX_ST_USR_CLR_0_B, "R200_SE_VTX_ST_USR_CLR_0_B" },
- { R200_SE_VTX_ST_USR_CLR_0_A, "R200_SE_VTX_ST_USR_CLR_0_A" },
- { R200_SE_VTX_ST_USR_CLR_1_R, "R200_SE_VTX_ST_USR_CLR_1_R" },
- { R200_SE_VTX_ST_USR_CLR_1_G, "R200_SE_VTX_ST_USR_CLR_1_G" },
- { R200_SE_VTX_ST_USR_CLR_1_B, "R200_SE_VTX_ST_USR_CLR_1_B" },
- { R200_SE_VTX_ST_USR_CLR_1_A, "R200_SE_VTX_ST_USR_CLR_1_A" },
- { R200_SE_VTX_ST_CLR_0_PKD, "R200_SE_VTX_ST_CLR_0_PKD" },
- { R200_SE_VTX_ST_CLR_1_PKD, "R200_SE_VTX_ST_CLR_1_PKD" },
- { R200_SE_VTX_ST_CLR_2_PKD, "R200_SE_VTX_ST_CLR_2_PKD" },
- { R200_SE_VTX_ST_CLR_3_PKD, "R200_SE_VTX_ST_CLR_3_PKD" },
- { R200_SE_VTX_ST_CLR_4_PKD, "R200_SE_VTX_ST_CLR_4_PKD" },
- { R200_SE_VTX_ST_CLR_5_PKD, "R200_SE_VTX_ST_CLR_5_PKD" },
- { R200_SE_VTX_ST_CLR_6_PKD, "R200_SE_VTX_ST_CLR_6_PKD" },
- { R200_SE_VTX_ST_CLR_7_PKD, "R200_SE_VTX_ST_CLR_7_PKD" },
- { R200_SE_VTX_ST_POS_0_X_2, "R200_SE_VTX_ST_POS_0_X_2" },
- { R200_SE_VTX_ST_POS_0_Y_2, "R200_SE_VTX_ST_POS_0_Y_2" },
- { R200_SE_VTX_ST_PAR_CLR_LD, "R200_SE_VTX_ST_PAR_CLR_LD" },
- { R200_SE_VTX_ST_USR_CLR_PKD, "R200_SE_VTX_ST_USR_CLR_PKD" },
- { R200_SE_VTX_ST_POS_0_X_3, "R200_SE_VTX_ST_POS_0_X_3" },
- { R200_SE_VTX_ST_POS_0_Y_3, "R200_SE_VTX_ST_POS_0_Y_3" },
- { R200_SE_VTX_ST_POS_0_Z_3, "R200_SE_VTX_ST_POS_0_Z_3" },
- { R200_SE_VTX_ST_END_OF_PKT, "R200_SE_VTX_ST_END_OF_PKT" },
- { R200_RE_POINTSIZE, "R200_RE_POINTSIZE" },
- { R200_RE_TOP_LEFT, "R200_RE_TOP_LEFT" },
- { R200_RE_AUX_SCISSOR_CNTL, "R200_RE_AUX_SCISSOR_CNTL" },
- { R200_PP_TXFILTER_0, "R200_PP_TXFILTER_0" },
- { R200_PP_TXFORMAT_0, "R200_PP_TXFORMAT_0" },
- { R200_PP_TXSIZE_0, "R200_PP_TXSIZE_0" },
- { R200_PP_TXFORMAT_X_0, "R200_PP_TXFORMAT_X_0" },
- { R200_PP_TXPITCH_0, "R200_PP_TXPITCH_0" },
- { R200_PP_BORDER_COLOR_0, "R200_PP_BORDER_COLOR_0" },
- { R200_PP_CUBIC_FACES_0, "R200_PP_CUBIC_FACES_0" },
- { R200_PP_TXFILTER_1, "R200_PP_TXFILTER_1" },
- { R200_PP_TXFORMAT_1, "R200_PP_TXFORMAT_1" },
- { R200_PP_TXSIZE_1, "R200_PP_TXSIZE_1" },
- { R200_PP_TXFORMAT_X_1, "R200_PP_TXFORMAT_X_1" },
- { R200_PP_TXPITCH_1, "R200_PP_TXPITCH_1" },
- { R200_PP_BORDER_COLOR_1, "R200_PP_BORDER_COLOR_1" },
- { R200_PP_CUBIC_FACES_1, "R200_PP_CUBIC_FACES_1" },
- { R200_PP_TXFILTER_2, "R200_PP_TXFILTER_2" },
- { R200_PP_TXFORMAT_2, "R200_PP_TXFORMAT_2" },
- { R200_PP_TXSIZE_2, "R200_PP_TXSIZE_2" },
- { R200_PP_TXFORMAT_X_2, "R200_PP_TXFORMAT_X_2" },
- { R200_PP_TXPITCH_2, "R200_PP_TXPITCH_2" },
- { R200_PP_BORDER_COLOR_2, "R200_PP_BORDER_COLOR_2" },
- { R200_PP_CUBIC_FACES_2, "R200_PP_CUBIC_FACES_2" },
- { R200_PP_TXFILTER_3, "R200_PP_TXFILTER_3" },
- { R200_PP_TXFORMAT_3, "R200_PP_TXFORMAT_3" },
- { R200_PP_TXSIZE_3, "R200_PP_TXSIZE_3" },
- { R200_PP_TXFORMAT_X_3, "R200_PP_TXFORMAT_X_3" },
- { R200_PP_TXPITCH_3, "R200_PP_TXPITCH_3" },
- { R200_PP_BORDER_COLOR_3, "R200_PP_BORDER_COLOR_3" },
- { R200_PP_CUBIC_FACES_3, "R200_PP_CUBIC_FACES_3" },
- { R200_PP_TXFILTER_4, "R200_PP_TXFILTER_4" },
- { R200_PP_TXFORMAT_4, "R200_PP_TXFORMAT_4" },
- { R200_PP_TXSIZE_4, "R200_PP_TXSIZE_4" },
- { R200_PP_TXFORMAT_X_4, "R200_PP_TXFORMAT_X_4" },
- { R200_PP_TXPITCH_4, "R200_PP_TXPITCH_4" },
- { R200_PP_BORDER_COLOR_4, "R200_PP_BORDER_COLOR_4" },
- { R200_PP_CUBIC_FACES_4, "R200_PP_CUBIC_FACES_4" },
- { R200_PP_TXFILTER_5, "R200_PP_TXFILTER_5" },
- { R200_PP_TXFORMAT_5, "R200_PP_TXFORMAT_5" },
- { R200_PP_TXSIZE_5, "R200_PP_TXSIZE_5" },
- { R200_PP_TXFORMAT_X_5, "R200_PP_TXFORMAT_X_5" },
- { R200_PP_TXPITCH_5, "R200_PP_TXPITCH_5" },
- { R200_PP_BORDER_COLOR_5, "R200_PP_BORDER_COLOR_5" },
- { R200_PP_CUBIC_FACES_5, "R200_PP_CUBIC_FACES_5" },
- { R200_PP_TXOFFSET_0, "R200_PP_TXOFFSET_0" },
- { R200_PP_CUBIC_OFFSET_F1_0, "R200_PP_CUBIC_OFFSET_F1_0" },
- { R200_PP_CUBIC_OFFSET_F2_0, "R200_PP_CUBIC_OFFSET_F2_0" },
- { R200_PP_CUBIC_OFFSET_F3_0, "R200_PP_CUBIC_OFFSET_F3_0" },
- { R200_PP_CUBIC_OFFSET_F4_0, "R200_PP_CUBIC_OFFSET_F4_0" },
- { R200_PP_CUBIC_OFFSET_F5_0, "R200_PP_CUBIC_OFFSET_F5_0" },
- { R200_PP_TXOFFSET_1, "R200_PP_TXOFFSET_1" },
- { R200_PP_CUBIC_OFFSET_F1_1, "R200_PP_CUBIC_OFFSET_F1_1" },
- { R200_PP_CUBIC_OFFSET_F2_1, "R200_PP_CUBIC_OFFSET_F2_1" },
- { R200_PP_CUBIC_OFFSET_F3_1, "R200_PP_CUBIC_OFFSET_F3_1" },
- { R200_PP_CUBIC_OFFSET_F4_1, "R200_PP_CUBIC_OFFSET_F4_1" },
- { R200_PP_CUBIC_OFFSET_F5_1, "R200_PP_CUBIC_OFFSET_F5_1" },
- { R200_PP_TXOFFSET_2, "R200_PP_TXOFFSET_2" },
- { R200_PP_CUBIC_OFFSET_F1_2, "R200_PP_CUBIC_OFFSET_F1_2" },
- { R200_PP_CUBIC_OFFSET_F2_2, "R200_PP_CUBIC_OFFSET_F2_2" },
- { R200_PP_CUBIC_OFFSET_F3_2, "R200_PP_CUBIC_OFFSET_F3_2" },
- { R200_PP_CUBIC_OFFSET_F4_2, "R200_PP_CUBIC_OFFSET_F4_2" },
- { R200_PP_CUBIC_OFFSET_F5_2, "R200_PP_CUBIC_OFFSET_F5_2" },
- { R200_PP_TXOFFSET_3, "R200_PP_TXOFFSET_3" },
- { R200_PP_CUBIC_OFFSET_F1_3, "R200_PP_CUBIC_OFFSET_F1_3" },
- { R200_PP_CUBIC_OFFSET_F2_3, "R200_PP_CUBIC_OFFSET_F2_3" },
- { R200_PP_CUBIC_OFFSET_F3_3, "R200_PP_CUBIC_OFFSET_F3_3" },
- { R200_PP_CUBIC_OFFSET_F4_3, "R200_PP_CUBIC_OFFSET_F4_3" },
- { R200_PP_CUBIC_OFFSET_F5_3, "R200_PP_CUBIC_OFFSET_F5_3" },
- { R200_PP_TXOFFSET_4, "R200_PP_TXOFFSET_4" },
- { R200_PP_CUBIC_OFFSET_F1_4, "R200_PP_CUBIC_OFFSET_F1_4" },
- { R200_PP_CUBIC_OFFSET_F2_4, "R200_PP_CUBIC_OFFSET_F2_4" },
- { R200_PP_CUBIC_OFFSET_F3_4, "R200_PP_CUBIC_OFFSET_F3_4" },
- { R200_PP_CUBIC_OFFSET_F4_4, "R200_PP_CUBIC_OFFSET_F4_4" },
- { R200_PP_CUBIC_OFFSET_F5_4, "R200_PP_CUBIC_OFFSET_F5_4" },
- { R200_PP_TXOFFSET_5, "R200_PP_TXOFFSET_5" },
- { R200_PP_CUBIC_OFFSET_F1_5, "R200_PP_CUBIC_OFFSET_F1_5" },
- { R200_PP_CUBIC_OFFSET_F2_5, "R200_PP_CUBIC_OFFSET_F2_5" },
- { R200_PP_CUBIC_OFFSET_F3_5, "R200_PP_CUBIC_OFFSET_F3_5" },
- { R200_PP_CUBIC_OFFSET_F4_5, "R200_PP_CUBIC_OFFSET_F4_5" },
- { R200_PP_CUBIC_OFFSET_F5_5, "R200_PP_CUBIC_OFFSET_F5_5" },
- { R200_PP_TAM_DEBUG3, "R200_PP_TAM_DEBUG3" },
- { R200_PP_TFACTOR_0, "R200_PP_TFACTOR_0" },
- { R200_PP_TFACTOR_1, "R200_PP_TFACTOR_1" },
- { R200_PP_TFACTOR_2, "R200_PP_TFACTOR_2" },
- { R200_PP_TFACTOR_3, "R200_PP_TFACTOR_3" },
- { R200_PP_TFACTOR_4, "R200_PP_TFACTOR_4" },
- { R200_PP_TFACTOR_5, "R200_PP_TFACTOR_5" },
- { R200_PP_TXCBLEND_0, "R200_PP_TXCBLEND_0" },
- { R200_PP_TXCBLEND2_0, "R200_PP_TXCBLEND2_0" },
- { R200_PP_TXABLEND_0, "R200_PP_TXABLEND_0" },
- { R200_PP_TXABLEND2_0, "R200_PP_TXABLEND2_0" },
- { R200_PP_TXCBLEND_1, "R200_PP_TXCBLEND_1" },
- { R200_PP_TXCBLEND2_1, "R200_PP_TXCBLEND2_1" },
- { R200_PP_TXABLEND_1, "R200_PP_TXABLEND_1" },
- { R200_PP_TXABLEND2_1, "R200_PP_TXABLEND2_1" },
- { R200_PP_TXCBLEND_2, "R200_PP_TXCBLEND_2" },
- { R200_PP_TXCBLEND2_2, "R200_PP_TXCBLEND2_2" },
- { R200_PP_TXABLEND_2, "R200_PP_TXABLEND_2" },
- { R200_PP_TXABLEND2_2, "R200_PP_TXABLEND2_2" },
- { R200_PP_TXCBLEND_3, "R200_PP_TXCBLEND_3" },
- { R200_PP_TXCBLEND2_3, "R200_PP_TXCBLEND2_3" },
- { R200_PP_TXABLEND_3, "R200_PP_TXABLEND_3" },
- { R200_PP_TXABLEND2_3, "R200_PP_TXABLEND2_3" },
- { R200_PP_TXCBLEND_4, "R200_PP_TXCBLEND_4" },
- { R200_PP_TXCBLEND2_4, "R200_PP_TXCBLEND2_4" },
- { R200_PP_TXABLEND_4, "R200_PP_TXABLEND_4" },
- { R200_PP_TXABLEND2_4, "R200_PP_TXABLEND2_4" },
- { R200_PP_TXCBLEND_5, "R200_PP_TXCBLEND_5" },
- { R200_PP_TXCBLEND2_5, "R200_PP_TXCBLEND2_5" },
- { R200_PP_TXABLEND_5, "R200_PP_TXABLEND_5" },
- { R200_PP_TXABLEND2_5, "R200_PP_TXABLEND2_5" },
- { R200_PP_TXCBLEND_6, "R200_PP_TXCBLEND_6" },
- { R200_PP_TXCBLEND2_6, "R200_PP_TXCBLEND2_6" },
- { R200_PP_TXABLEND_6, "R200_PP_TXABLEND_6" },
- { R200_PP_TXABLEND2_6, "R200_PP_TXABLEND2_6" },
- { R200_PP_TXCBLEND_7, "R200_PP_TXCBLEND_7" },
- { R200_PP_TXCBLEND2_7, "R200_PP_TXCBLEND2_7" },
- { R200_PP_TXABLEND_7, "R200_PP_TXABLEND_7" },
- { R200_PP_TXABLEND2_7, "R200_PP_TXABLEND2_7" },
- { R200_RB3D_ABLENDCNTL, "R200_RB3D_ABLENDCNTL" },
- { R200_RB3D_CBLENDCNTL, "R200_RB3D_CBLENDCNTL" },
- { R200_SE_TCL_OUTPUT_VTX_COMP_SEL, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { R200_PP_CNTL_X, "R200_PP_CNTL_X" },
- { R200_SE_VAP_CNTL_STATUS, "R200_SE_VAP_CNTL_STATUS" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3" },
-};
-
-static struct reg_names scalar_names[] = {
- { R200_SS_LIGHT_DCD_ADDR, "R200_SS_LIGHT_DCD_ADDR" },
- { R200_SS_LIGHT_DCM_ADDR, "R200_SS_LIGHT_DCM_ADDR" },
- { R200_SS_LIGHT_SPOT_EXPONENT_ADDR, "R200_SS_LIGHT_SPOT_EXPONENT_ADDR" },
- { R200_SS_LIGHT_SPOT_CUTOFF_ADDR, "R200_SS_LIGHT_SPOT_CUTOFF_ADDR" },
- { R200_SS_LIGHT_SPECULAR_THRESH_ADDR, "R200_SS_LIGHT_SPECULAR_THRESH_ADDR" },
- { R200_SS_LIGHT_RANGE_CUTOFF_SQRD, "R200_SS_LIGHT_RANGE_CUTOFF_SQRD" },
- { R200_SS_LIGHT_RANGE_ATT_CONST, "R200_SS_LIGHT_RANGE_ATT_CONST" },
- { R200_SS_VERT_GUARD_CLIP_ADJ_ADDR, "R200_SS_VERT_GUARD_CLIP_ADJ_ADDR" },
- { R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR, "R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR" },
- { R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR, "R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR" },
- { R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR, "R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR" },
- { R200_SS_MAT_0_SHININESS, "R200_SS_MAT_0_SHININESS" },
- { R200_SS_MAT_1_SHININESS, "R200_SS_MAT_1_SHININESS" },
- { 1000, "" },
-};
-
-/* Puff these out to make them look like normal (dword) registers.
- */
-static struct reg_names vector_names[] = {
- { 0, "start" },
- { R200_VS_LIGHT_AMBIENT_ADDR, "R200_VS_LIGHT_AMBIENT_ADDR" },
- { R200_VS_LIGHT_DIFFUSE_ADDR, "R200_VS_LIGHT_DIFFUSE_ADDR" },
- { R200_VS_LIGHT_SPECULAR_ADDR, "R200_VS_LIGHT_SPECULAR_ADDR" },
- { R200_VS_LIGHT_DIRPOS_ADDR, "R200_VS_LIGHT_DIRPOS_ADDR" },
- { R200_VS_LIGHT_HWVSPOT_ADDR, "R200_VS_LIGHT_HWVSPOT_ADDR" },
- { R200_VS_LIGHT_ATTENUATION_ADDR, "R200_VS_LIGHT_ATTENUATION_ADDR" },
- { R200_VS_SPOT_DUAL_CONE, "R200_VS_SPOT_DUAL_CONE" },
- { R200_VS_GLOBAL_AMBIENT_ADDR, "R200_VS_GLOBAL_AMBIENT_ADDR" },
- { R200_VS_FOG_PARAM_ADDR, "R200_VS_FOG_PARAM_ADDR" },
- { R200_VS_EYE_VECTOR_ADDR, "R200_VS_EYE_VECTOR_ADDR" },
- { R200_VS_UCP_ADDR, "R200_VS_UCP_ADDR" },
- { R200_VS_PNT_SPRITE_VPORT_SCALE, "R200_VS_PNT_SPRITE_VPORT_SCALE" },
- { R200_VS_MATRIX_0_MV, "R200_VS_MATRIX_0_MV" },
- { R200_VS_MATRIX_1_INV_MV, "R200_VS_MATRIX_1_INV_MV" },
- { R200_VS_MATRIX_2_MVP, "R200_VS_MATRIX_2_MVP" },
- { R200_VS_MATRIX_3_TEX0, "R200_VS_MATRIX_3_TEX0" },
- { R200_VS_MATRIX_4_TEX1, "R200_VS_MATRIX_4_TEX1" },
- { R200_VS_MATRIX_5_TEX2, "R200_VS_MATRIX_5_TEX2" },
- { R200_VS_MATRIX_6_TEX3, "R200_VS_MATRIX_6_TEX3" },
- { R200_VS_MATRIX_7_TEX4, "R200_VS_MATRIX_7_TEX4" },
- { R200_VS_MATRIX_8_TEX5, "R200_VS_MATRIX_8_TEX5" },
- { R200_VS_MAT_0_EMISS, "R200_VS_MAT_0_EMISS" },
- { R200_VS_MAT_0_AMB, "R200_VS_MAT_0_AMB" },
- { R200_VS_MAT_0_DIF, "R200_VS_MAT_0_DIF" },
- { R200_VS_MAT_0_SPEC, "R200_VS_MAT_0_SPEC" },
- { R200_VS_MAT_1_EMISS, "R200_VS_MAT_1_EMISS" },
- { R200_VS_MAT_1_AMB, "R200_VS_MAT_1_AMB" },
- { R200_VS_MAT_1_DIF, "R200_VS_MAT_1_DIF" },
- { R200_VS_MAT_1_SPEC, "R200_VS_MAT_1_SPEC" },
- { R200_VS_EYE2CLIP_MTX, "R200_VS_EYE2CLIP_MTX" },
- { R200_VS_PNT_SPRITE_ATT_CONST, "R200_VS_PNT_SPRITE_ATT_CONST" },
- { R200_VS_PNT_SPRITE_EYE_IN_MODEL, "R200_VS_PNT_SPRITE_EYE_IN_MODEL" },
- { R200_VS_PNT_SPRITE_CLAMP, "R200_VS_PNT_SPRITE_CLAMP" },
- { R200_VS_MAX, "R200_VS_MAX" },
- { 1000, "" },
-};
-
-union fi { float f; int i; };
-
-#define ISVEC 1
-#define ISFLOAT 2
-#define TOUCHED 4
-
-struct reg {
- int idx;
- struct reg_names *closest;
- int flags;
- union fi current;
- union fi *values;
- int nvalues;
- int nalloc;
- float vmin, vmax;
-};
-
-
-static struct reg regs[Elements(reg_names)+1];
-static struct reg scalars[512+1];
-static struct reg vectors[512*4+1];
-
-static int total, total_changed, bufs;
-
-static void init_regs( void )
-{
- struct reg_names *tmp;
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++) {
- regs[i].idx = reg_names[i].idx;
- regs[i].closest = &reg_names[i];
- regs[i].flags = 0;
- }
-
- for (i = 0, tmp = scalar_names ; i < Elements(scalars) ; i++) {
- if (tmp[1].idx == i) tmp++;
- scalars[i].idx = i;
- scalars[i].closest = tmp;
- scalars[i].flags = ISFLOAT;
- }
-
- for (i = 0, tmp = vector_names ; i < Elements(vectors) ; i++) {
- if (tmp[1].idx*4 == i) tmp++;
- vectors[i].idx = i;
- vectors[i].closest = tmp;
- vectors[i].flags = ISFLOAT|ISVEC;
- }
-
- regs[Elements(regs)-1].idx = -1;
- scalars[Elements(scalars)-1].idx = -1;
- vectors[Elements(vectors)-1].idx = -1;
-}
-
-static int find_or_add_value( struct reg *reg, int val )
-{
- int j;
-
- for ( j = 0 ; j < reg->nvalues ; j++)
- if ( val == reg->values[j].i )
- return 1;
-
- if (j == reg->nalloc) {
- reg->nalloc += 5;
- reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
- }
-
- reg->values[reg->nvalues++].i = val;
- return 0;
-}
-
-static struct reg *lookup_reg( struct reg *tab, int reg )
-{
- int i;
-
- for (i = 0 ; tab[i].idx != -1 ; i++) {
- if (tab[i].idx == reg)
- return &tab[i];
- }
-
- fprintf(stderr, "*** unknown reg 0x%x\n", reg);
- return 0;
-}
-
-
-static const char *get_reg_name( struct reg *reg )
-{
- static char tmp[80];
-
- if (reg->idx == reg->closest->idx)
- return reg->closest->name;
-
-
- if (reg->flags & ISVEC) {
- if (reg->idx/4 != reg->closest->idx)
- sprintf(tmp, "%s+%d[%d]",
- reg->closest->name,
- (reg->idx/4) - reg->closest->idx,
- reg->idx%4);
- else
- sprintf(tmp, "%s[%d]", reg->closest->name, reg->idx%4);
- }
- else {
- if (reg->idx != reg->closest->idx)
- sprintf(tmp, "%s+%d", reg->closest->name, reg->idx - reg->closest->idx);
- else
- sprintf(tmp, "%s", reg->closest->name);
- }
-
- return tmp;
-}
-
-static int print_int_reg_assignment( struct reg *reg, int data )
-{
- int changed = (reg->current.i != data);
- int ever_seen = find_or_add_value( reg, data );
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, " %s <-- 0x%x", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (!ever_seen)
- fprintf(stderr, " *** BRAND NEW VALUE");
- else if (changed)
- fprintf(stderr, " *** CHANGED");
- }
-
- reg->current.i = data;
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-
-static int print_float_reg_assignment( struct reg *reg, float data )
-{
- int changed = (reg->current.f != data);
- int newmin = (data < reg->vmin);
- int newmax = (data > reg->vmax);
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, " %s <-- %.3f", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (newmin) {
- fprintf(stderr, " *** NEW MIN (prev %.3f)", reg->vmin);
- reg->vmin = data;
- }
- else if (newmax) {
- fprintf(stderr, " *** NEW MAX (prev %.3f)", reg->vmax);
- reg->vmax = data;
- }
- else if (changed) {
- fprintf(stderr, " *** CHANGED");
- }
- }
-
- reg->current.f = data;
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-static int print_reg_assignment( struct reg *reg, int data )
-{
- reg->flags |= TOUCHED;
- if (reg->flags & ISFLOAT)
- return print_float_reg_assignment( reg, *(float *)&data );
- else
- return print_int_reg_assignment( reg, data );
-}
-
-static void print_reg( struct reg *reg )
-{
- if (reg->flags & TOUCHED) {
- if (reg->flags & ISFLOAT) {
- fprintf(stderr, " %s == %f\n", get_reg_name(reg), reg->current.f);
- } else {
- fprintf(stderr, " %s == 0x%x\n", get_reg_name(reg), reg->current.i);
- }
- }
-}
-
-
-static void dump_state( void )
-{
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++)
- print_reg( &regs[i] );
-
- for (i = 0 ; i < Elements(scalars) ; i++)
- print_reg( &scalars[i] );
-
- for (i = 0 ; i < Elements(vectors) ; i++)
- print_reg( &vectors[i] );
-}
-
-
-
-static int radeon_emit_packets(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int id = (int)header.packet.packet_id;
- int sz = packet[id].len;
- int *data = (int *)cmdbuf->buf;
- int i;
-
- if (sz * sizeof(int) > cmdbuf->bufsz) {
- fprintf(stderr, "Packet overflows cmdbuf\n");
- return -EINVAL;
- }
-
- if (!packet[id].name) {
- fprintf(stderr, "*** Unknown packet 0 nr %d\n", id );
- return -EINVAL;
- }
-
-
- if (VERBOSE)
- fprintf(stderr, "Packet 0 reg %s nr %d\n", packet[id].name, sz );
-
- for ( i = 0 ; i < sz ; i++) {
- struct reg *reg = lookup_reg( regs, packet[id].start + i*4 );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars2(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset + 0x100;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars2, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
- if (start + stride * sz > 257) {
- fprintf(stderr, "emit scalars OVERFLOW %d/%d/%d\n", start, stride, sz);
- return -1;
- }
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-/* Check: inf/nan/extreme-size?
- * Check: table start, end, nr, etc.
- */
-static int radeon_emit_vectors(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.vectors.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.vectors.offset;
- int stride = header.vectors.stride;
- int i,j;
-
- if (VERBOSE)
- fprintf(stderr, "emit vectors, start %d stride %d nr %d (end %d) (0x%x)\n",
- start, stride, sz, start + stride * sz, header.i);
-
-/* if (start + stride * (sz/4) > 128) { */
-/* fprintf(stderr, "emit vectors OVERFLOW %d/%d/%d\n", start, stride, sz); */
-/* return -1; */
-/* } */
-
- for (i = 0 ; i < sz ; start += stride) {
- int changed = 0;
- for (j = 0 ; j < 4 ; i++,j++) {
- struct reg *reg = lookup_reg( vectors, start*4+j );
- if (print_reg_assignment( reg, data[i] ))
- changed = 1;
- }
- if (changed)
- total_changed += 4;
- total += 4;
- }
-
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-#if 0
-static int print_vertex_format( int vfmt )
-{
- if (NORMAL) {
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- "vertex format",
- vfmt,
- "xy,",
- (vfmt & R200_VTX_Z0) ? "z," : "",
- (vfmt & R200_VTX_W0) ? "w0," : "",
- (vfmt & R200_VTX_FPCOLOR) ? "fpcolor," : "",
- (vfmt & R200_VTX_FPALPHA) ? "fpalpha," : "",
- (vfmt & R200_VTX_PKCOLOR) ? "pkcolor," : "",
- (vfmt & R200_VTX_FPSPEC) ? "fpspec," : "",
- (vfmt & R200_VTX_FPFOG) ? "fpfog," : "",
- (vfmt & R200_VTX_PKSPEC) ? "pkspec," : "",
- (vfmt & R200_VTX_ST0) ? "st0," : "",
- (vfmt & R200_VTX_ST1) ? "st1," : "",
- (vfmt & R200_VTX_Q1) ? "q1," : "",
- (vfmt & R200_VTX_ST2) ? "st2," : "",
- (vfmt & R200_VTX_Q2) ? "q2," : "",
- (vfmt & R200_VTX_ST3) ? "st3," : "",
- (vfmt & R200_VTX_Q3) ? "q3," : "",
- (vfmt & R200_VTX_Q0) ? "q0," : "",
- (vfmt & R200_VTX_N0) ? "n0," : "",
- (vfmt & R200_VTX_XY1) ? "xy1," : "",
- (vfmt & R200_VTX_Z1) ? "z1," : "",
- (vfmt & R200_VTX_W1) ? "w1," : "",
- (vfmt & R200_VTX_N1) ? "n1," : "");
-
-
- if (!find_or_add_value( &others[V_VTXFMT], vfmt ))
- fprintf(stderr, " *** NEW VALUE");
-
- fprintf(stderr, "\n");
- }
-
- return 0;
-}
-#endif
-
-static char *primname[0x10] = {
- "NONE",
- "POINTS",
- "LINES",
- "LINE_STRIP",
- "TRIANGLES",
- "TRIANGLE_FAN",
- "TRIANGLE_STRIP",
- "RECT_LIST",
- 0,
- "3VRT_POINTS",
- "3VRT_LINES",
- "POINT_SPRITES",
- "LINE_LOOP",
- "QUADS",
- "QUAD_STRIP",
- "POLYGON",
-};
-
-static int print_prim_and_flags( int prim )
-{
- int numverts;
-
- if (NORMAL)
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s\n",
- "prim flags",
- prim,
- ((prim & 0x30) == R200_VF_PRIM_WALK_IND) ? "IND," : "",
- ((prim & 0x30) == R200_VF_PRIM_WALK_LIST) ? "LIST," : "",
- ((prim & 0x30) == R200_VF_PRIM_WALK_RING) ? "RING," : "",
- (prim & R200_VF_COLOR_ORDER_RGBA) ? "RGBA," : "BGRA, ",
- (prim & R200_VF_INDEX_SZ_4) ? "INDX-32," : "",
- (prim & R200_VF_TCL_OUTPUT_VTX_ENABLE) ? "TCL_OUT_VTX," : "");
-
- numverts = prim>>16;
-
- if (NORMAL)
- fprintf(stderr, " prim: %s numverts %d\n", primname[prim&0xf], numverts);
-
- switch (prim & 0xf) {
- case R200_VF_PRIM_NONE:
- case R200_VF_PRIM_POINTS:
- if (numverts < 1) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_LINES:
- case R200_VF_PRIM_POINT_SPRITES:
- if ((numverts & 1) || numverts == 0) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_LINE_STRIP:
- case R200_VF_PRIM_LINE_LOOP:
- if (numverts < 2) {
- fprintf(stderr, "Bad nr verts for line_strip %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_TRIANGLES:
- case R200_VF_PRIM_3VRT_POINTS:
- case R200_VF_PRIM_3VRT_LINES:
- case R200_VF_PRIM_RECT_LIST:
- if (numverts % 3 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for tri %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_TRIANGLE_FAN:
- case R200_VF_PRIM_TRIANGLE_STRIP:
- case R200_VF_PRIM_POLYGON:
- if (numverts < 3) {
- fprintf(stderr, "Bad nr verts for strip/fan %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_QUADS:
- if (numverts % 4 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for quad %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_QUAD_STRIP:
- if (numverts % 2 || numverts < 4) {
- fprintf(stderr, "Bad nr verts for quadstrip %d\n", numverts);
- return -1;
- }
- break;
- default:
- fprintf(stderr, "Bad primitive\n");
- return -1;
- }
- return 0;
-}
-
-/* build in knowledge about each packet type
- */
-static int radeon_emit_packet3( drmRadeonCmdBuffer *cmdbuf )
-{
- int cmdsz;
- int *cmd = (int *)cmdbuf->buf;
- int *tmp;
- int i, stride, size, start;
-
- cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
- if ((cmd[0] & RADEON_CP_PACKET_MASK) != RADEON_CP_PACKET3 ||
- cmdsz * 4 > cmdbuf->bufsz ||
- cmdsz > RADEON_CP_PACKET_MAX_DWORDS) {
- fprintf(stderr, "Bad packet\n");
- return -EINVAL;
- }
-
- switch( cmd[0] & ~RADEON_CP_PACKET_COUNT_MASK ) {
- case R200_CP_CMD_NOP:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NOP, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_NEXT_CHAR:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NEXT_CHAR, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_PLY_NEXTSCAN:
- if (NORMAL)
- fprintf(stderr, "PACKET3_PLY_NEXTSCAN, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_SET_SCISSORS:
- if (NORMAL)
- fprintf(stderr, "PACKET3_SET_SCISSORS, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_LOAD_MICROCODE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_MICROCODE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_WAIT_FOR_IDLE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_WAIT_FOR_IDLE, %d dwords\n", cmdsz);
- break;
-
- case R200_CP_CMD_3D_DRAW_VBUF:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_VBUF, %d dwords\n", cmdsz);
-/* print_vertex_format(cmd[1]); */
- if (print_prim_and_flags(cmd[2]))
- return -EINVAL;
- break;
-
- case R200_CP_CMD_3D_DRAW_IMMD:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_IMMD, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_3D_DRAW_INDX: {
- int neltdwords;
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_INDX, %d dwords\n", cmdsz);
-/* print_vertex_format(cmd[1]); */
- if (print_prim_and_flags(cmd[2]))
- return -EINVAL;
- neltdwords = cmd[2]>>16;
- neltdwords += neltdwords & 1;
- neltdwords /= 2;
- if (neltdwords + 3 != cmdsz)
- fprintf(stderr, "Mismatch in DRAW_INDX, %d vs cmdsz %d\n",
- neltdwords, cmdsz);
- break;
- }
- case R200_CP_CMD_LOAD_PALETTE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_PALETTE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_3D_LOAD_VBPNTR:
- if (NORMAL) {
- fprintf(stderr, "PACKET3_3D_LOAD_VBPNTR, %d dwords\n", cmdsz);
- fprintf(stderr, " nr arrays: %d\n", cmd[1]);
- }
-
- if (((cmd[1]/2)*3) + ((cmd[1]%2)*2) != cmdsz - 2) {
- fprintf(stderr, " ****** MISMATCH %d/%d *******\n",
- ((cmd[1]/2)*3) + ((cmd[1]%2)*2) + 2, cmdsz);
- return -EINVAL;
- }
-
- if (NORMAL) {
- tmp = cmd+2;
- for (i = 0 ; i < cmd[1] ; i++) {
- if (i & 1) {
- stride = (tmp[0]>>24) & 0xff;
- size = (tmp[0]>>16) & 0xff;
- start = tmp[2];
- tmp += 3;
- }
- else {
- stride = (tmp[0]>>8) & 0xff;
- size = (tmp[0]) & 0xff;
- start = tmp[1];
- }
- fprintf(stderr, " array %d: start 0x%x vsize %d vstride %d\n",
- i, start, size, stride );
- }
- }
- break;
- case R200_CP_CMD_PAINT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_SMALLTEXT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_SMALLTEXT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_HOSTDATA_BLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_HOSTDATA_BLT, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_POLYLINE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYLINE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_POLYSCANLINES:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYSCANLINES, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_PAINT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_BITBLT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_TRANS_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_TRANS_BITBLT, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_3D_DRAW_VBUF_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_VBUF_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- case R200_CP_CMD_3D_DRAW_IMMD_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_IMMD_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- case R200_CP_CMD_3D_DRAW_INDX_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_INDX_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- default:
- fprintf(stderr, "UNKNOWN PACKET, %d dwords\n", cmdsz);
- break;
- }
-
- cmdbuf->buf += cmdsz * 4;
- cmdbuf->bufsz -= cmdsz * 4;
- return 0;
-}
-
-
-/* Check cliprects for bounds, then pass on to above:
- */
-static int radeon_emit_packet3_cliprect( drmRadeonCmdBuffer *cmdbuf )
-{
- XF86DRIClipRectRec *boxes = (XF86DRIClipRectRec *)cmdbuf->boxes;
- int i = 0;
-
- if (VERBOSE && total_changed) {
- dump_state();
- total_changed = 0;
- }
-
- if (NORMAL) {
- do {
- if ( i < cmdbuf->nbox ) {
- fprintf(stderr, "Emit box %d/%d %d,%d %d,%d\n",
- i, cmdbuf->nbox,
- boxes[i].x1, boxes[i].y1, boxes[i].x2, boxes[i].y2);
- }
- } while ( ++i < cmdbuf->nbox );
- }
-
- if (cmdbuf->nbox == 1)
- cmdbuf->nbox = 0;
-
- return radeon_emit_packet3( cmdbuf );
-}
-
-
-int r200SanityCmdBuffer( r200ContextPtr rmesa,
- int nbox,
- XF86DRIClipRectRec *boxes )
-{
- int idx;
- drmRadeonCmdBuffer cmdbuf;
- drmRadeonCmdHeader header;
- static int inited = 0;
-
- if (!inited) {
- init_regs();
- inited = 1;
- }
-
-
- cmdbuf.buf = rmesa->store.cmd_buf;
- cmdbuf.bufsz = rmesa->store.cmd_used;
- cmdbuf.boxes = (drmClipRect *)boxes;
- cmdbuf.nbox = nbox;
-
- while ( cmdbuf.bufsz >= sizeof(header) ) {
-
- header.i = *(int *)cmdbuf.buf;
- cmdbuf.buf += sizeof(header);
- cmdbuf.bufsz -= sizeof(header);
-
- switch (header.header.cmd_type) {
- case RADEON_CMD_PACKET:
- if (radeon_emit_packets( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packets failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS:
- if (radeon_emit_scalars( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS2:
- if (radeon_emit_scalars2( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_VECTORS:
- if (radeon_emit_vectors( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_vectors failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_DMA_DISCARD:
- idx = header.dma.buf_idx;
- if (NORMAL)
- fprintf(stderr, "RADEON_CMD_DMA_DISCARD buf %d\n", idx);
- bufs++;
- break;
-
- case RADEON_CMD_PACKET3:
- if (radeon_emit_packet3( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3 failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3_clip failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_WAIT:
- break;
-
- default:
- fprintf(stderr,"bad cmd_type %d at %p\n",
- header.header.cmd_type,
- cmdbuf.buf - sizeof(header));
- return -EINVAL;
- }
- }
-
- if (0)
- {
- static int n = 0;
- n++;
- if (n == 10) {
- fprintf(stderr, "Bufs %d Total emitted %d real changes %d (%.2f%%)\n",
- bufs,
- total, total_changed,
- ((float)total_changed/(float)total*100.0));
- fprintf(stderr, "Total emitted per buf: %.2f\n",
- (float)total/(float)bufs);
- fprintf(stderr, "Real changes per buf: %.2f\n",
- (float)total_changed/(float)bufs);
-
- bufs = n = total = total_changed = 0;
- }
- }
-
- fprintf(stderr, "leaving %s\n\n\n", __FUNCTION__);
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.h b/xc/lib/GL/mesa/src/drv/r200/r200_sanity.h
deleted file mode 100644
index 10260f211..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef R200_SANITY_H
-#define R200_SANITY_H
-
-extern int r200SanityCmdBuffer( r200ContextPtr rmesa,
- int nbox,
- XF86DRIClipRectRec *boxes );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_screen.c b/xc/lib/GL/mesa/src/drv/r200/r200_screen.c
deleted file mode 100644
index ea102c89b..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_screen.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.c,v 1.4 2003/05/08 09:25:35 herrb Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <dlfcn.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-
-#include "r200_screen.h"
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#include "glxextensions.h"
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_R200_QD 0x5144
-#define PCI_CHIP_R200_QE 0x5145
-#define PCI_CHIP_R200_QF 0x5146
-#define PCI_CHIP_R200_QG 0x5147
-#define PCI_CHIP_R200_QY 0x5159
-#define PCI_CHIP_R200_QZ 0x515A
-#define PCI_CHIP_R200_LW 0x4C57
-#define PCI_CHIP_R200_LY 0x4C59
-#define PCI_CHIP_R200_LZ 0x4C5A
-#define PCI_CHIP_RV200_QW 0x5157 /* Radeon 7500 - not an R200 at all */
-#endif
-
-static r200ScreenPtr __r200Screen;
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-/* Create the device specific screen private data struct.
- */
-static r200ScreenPtr
-r200CreateScreen( __DRIscreenPrivate *sPriv )
-{
- r200ScreenPtr screen;
- RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv;
- unsigned char *RADEONMMIO;
-
- if ( ! driCheckDriDdxDrmVersions( sPriv, "R200", 4, 0, 4, 0, 1, 5 ) )
- return NULL;
-
- /* Allocate the private area */
- screen = (r200ScreenPtr) CALLOC( sizeof(*screen) );
- if ( !screen ) {
- __driUtilMessage("%s: Could not allocate memory for screen structure",
- __FUNCTION__);
- return NULL;
- }
-
- switch ( dri_priv->deviceID ) {
- case PCI_CHIP_R200_QD:
- case PCI_CHIP_R200_QE:
- case PCI_CHIP_R200_QF:
- case PCI_CHIP_R200_QG:
- case PCI_CHIP_R200_QY:
- case PCI_CHIP_R200_QZ:
- case PCI_CHIP_RV200_QW:
- case PCI_CHIP_R200_LW:
- case PCI_CHIP_R200_LY:
- case PCI_CHIP_R200_LZ:
- __driUtilMessage("r200CreateScreen(): Device isn't an r200!\n");
- FREE( screen );
- return NULL;
- default:
- screen->chipset = R200_CHIPSET_R200;
- break;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&screen->optionCache);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- screen->IsPCI = dri_priv->IsPCI;
-
- {
- int ret;
- drmRadeonGetParam gp;
-
- gp.param = RADEON_PARAM_GART_BUFFER_OFFSET;
- gp.value = &screen->gart_buffer_offset;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret);
- return NULL;
- }
-
- if (sPriv->drmMinor >= 6) {
- gp.param = RADEON_PARAM_GART_BASE;
- gp.value = &screen->gart_base;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n", ret);
- return NULL;
- }
-
-
- gp.param = RADEON_PARAM_IRQ_NR;
- gp.value = &screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_IRQ_NR): %d\n", ret);
- return NULL;
- }
-
- /* Check if kernel module is new enough to support cube maps */
- screen->drmSupportsCubeMaps = (sPriv->drmMinor >= 7);
- }
- }
-
- screen->mmio.handle = dri_priv->registerHandle;
- screen->mmio.size = dri_priv->registerSize;
- if ( drmMap( sPriv->fd,
- screen->mmio.handle,
- screen->mmio.size,
- &screen->mmio.map ) ) {
- FREE( screen );
- __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ );
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- screen->status.handle = dri_priv->statusHandle;
- screen->status.size = dri_priv->statusSize;
- if ( drmMap( sPriv->fd,
- screen->status.handle,
- screen->status.size,
- &screen->status.map ) ) {
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ );
- return NULL;
- }
- screen->scratch = (__volatile__ CARD32 *)
- ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET);
-
- screen->buffers = drmMapBufs( sPriv->fd );
- if ( !screen->buffers ) {
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ );
- return NULL;
- }
-
- if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) {
- screen->gartTextures.handle = dri_priv->gartTexHandle;
- screen->gartTextures.size = dri_priv->gartTexMapSize;
- if ( drmMap( sPriv->fd,
- screen->gartTextures.handle,
- screen->gartTextures.size,
- (drmAddressPtr)&screen->gartTextures.map ) ) {
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMAP failed for GART texture area\n", __FUNCTION__);
- return NULL;
- }
-
- screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI
- ? INREG( RADEON_AIC_LO_ADDR )
- : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) );
- }
-
- screen->cpp = dri_priv->bpp / 8;
- screen->AGPMode = dri_priv->AGPMode;
-
- screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16;
-
- if ( sPriv->drmMinor >= 10 ) {
- drmRadeonSetParam sp;
-
- sp.param = RADEON_SETPARAM_FB_LOCATION;
- sp.value = screen->fbLocation;
-
- drmCommandWrite( sPriv->fd, DRM_RADEON_SETPARAM,
- &sp, sizeof( sp ) );
- }
-
- screen->frontOffset = dri_priv->frontOffset;
- screen->frontPitch = dri_priv->frontPitch;
- screen->backOffset = dri_priv->backOffset;
- screen->backPitch = dri_priv->backPitch;
- screen->depthOffset = dri_priv->depthOffset;
- screen->depthPitch = dri_priv->depthPitch;
-
- screen->texOffset[RADEON_CARD_HEAP] = dri_priv->textureOffset
- + screen->fbLocation;
- screen->texSize[RADEON_CARD_HEAP] = dri_priv->textureSize;
- screen->logTexGranularity[RADEON_CARD_HEAP] =
- dri_priv->log2TexGran;
-
- if ( !screen->gartTextures.map ) {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
- screen->texOffset[RADEON_GART_HEAP] = 0;
- screen->texSize[RADEON_GART_HEAP] = 0;
- screen->logTexGranularity[RADEON_GART_HEAP] = 0;
- } else {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS;
- screen->texOffset[RADEON_GART_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_HEAP] =
- dri_priv->log2GARTTexGran;
- }
-
- screen->driScreen = sPriv;
- screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
-
- if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
- void * const psc = sPriv->psc->screenConfigs;
-
- if ( glx_enable_extension != NULL ) {
- if ( screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
-
- if ( driCompareGLXAPIVersion( 20030818 ) >= 0 ) {
- sPriv->psc->allocateMemory = r200AllocateMemoryMESA;
- sPriv->psc->freeMemory = r200FreeMemoryMESA;
- sPriv->psc->memoryOffset = r200GetMemoryOffsetMESA;
-
- (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
- }
- }
- }
-
- return screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-r200DestroyScreen( __DRIscreenPrivate *sPriv )
-{
- r200ScreenPtr screen = (r200ScreenPtr)sPriv->private;
-
- if (!screen)
- return;
-
- if ( screen->gartTextures.map ) {
- drmUnmap( screen->gartTextures.map, screen->gartTextures.size );
- }
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&screen->optionCache);
-
- FREE( screen );
- sPriv->private = NULL;
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-r200InitDriver( __DRIscreenPrivate *sPriv )
-{
- __r200Screen = r200CreateScreen( sPriv );
-
- sPriv->private = (void *) __r200Screen;
-
- return sPriv->private ? GL_TRUE : GL_FALSE;
-}
-
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-r200CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- const GLboolean swDepth = GL_FALSE;
- const GLboolean swAlpha = GL_FALSE;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24;
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- swDepth,
- swStencil,
- swAccum,
- swAlpha );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-r200DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-
-
-/* Fullscreen mode isn't used for much -- could be a way to shrink
- * front/back buffers & get more texture memory if the client has
- * changed the video resolution.
- *
- * Pageflipping is now done automatically whenever there is a single
- * 3d client.
- */
-static GLboolean
-r200OpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec r200API = {
- .InitDriver = r200InitDriver,
- .DestroyScreen = r200DestroyScreen,
- .CreateContext = r200CreateContext,
- .DestroyContext = r200DestroyContext,
- .CreateBuffer = r200CreateBuffer,
- .DestroyBuffer = r200DestroyBuffer,
- .SwapBuffers = r200SwapBuffers,
- .MakeCurrent = r200MakeCurrent,
- .UnbindContext = r200UnbindContext,
- .OpenFullScreen = r200OpenCloseFullScreen,
- .CloseFullScreen = r200OpenCloseFullScreen,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- *
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &r200API);
- return (void *) psp;
-}
-
-
-/**
- * This function is called by libGL.so to allow the driver to dynamically
- * extend libGL. We can add new GLX functions and/or new GL functions.
- * Note that _mesa_create_context() will probably add most of the newer
- * OpenGL extension functions into the dispatcher.
- *
- * \todo This interface has been deprecated, so we should probably remove
- * this function before the next XFree86 release.
- */
-void
-__driRegisterExtensions( void )
-{
- PFNGLXENABLEEXTENSIONPROC glx_enable_extension;
-
-
- if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) {
- glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC)
- glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" );
-
- if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE );
- (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE );
- (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE );
- (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE );
- }
- }
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- r200ContextPtr rmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = rmesa->swap_count;
- sInfo->swap_ust = rmesa->swap_ust;
- sInfo->swap_missed_count = rmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, rmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_screen.h b/xc/lib/GL/mesa/src/drv/r200/r200_screen.h
deleted file mode 100644
index 6b12227ec..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_screen.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SCREEN_H__
-#define __R200_SCREEN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "dri_util.h"
-#include "xf86drm.h"
-#include "radeon_common.h"
-#include "radeon_sarea.h"
-#include "xmlconfig.h"
-
-typedef struct {
- drmHandle handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} r200RegionRec, *r200RegionPtr;
-
-#define R200_CHIPSET_R200 1
-#define R200_CHIPSET_MOBILITY 2
-
-
-#define R200_NR_TEX_HEAPS 2
-
-typedef struct {
-
- int chipset;
- int cpp;
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- unsigned int fbLocation;
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- /* Shared texture data */
- int numTexHeaps;
- int texOffset[R200_NR_TEX_HEAPS];
- int texSize[R200_NR_TEX_HEAPS];
- int logTexGranularity[R200_NR_TEX_HEAPS];
-
- r200RegionRec mmio;
- r200RegionRec status;
- r200RegionRec gartTextures;
-
- drmBufMapPtr buffers;
-
- __volatile__ CARD32 *scratch;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
- unsigned int gart_buffer_offset; /* offset in card memory space */
- unsigned int gart_texture_offset; /* offset in card memory space */
- unsigned int gart_base;
-
- GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} r200ScreenRec, *r200ScreenPtr;
-
-#endif
-#endif /* __R200_SCREEN_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_span.c b/xc/lib/GL/mesa/src/drv/r200/r200_span.c
deleted file mode 100644
index 7e48a9d5a..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_span.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_span.h"
-#include "r200_tex.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- r200ScreenPtr r200Screen = rmesa->r200Screen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint pitch = r200Screen->frontPitch * r200Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->state.color.drawOffset + \
- (dPriv->x * r200Screen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->state.pixel.readOffset + \
- (dPriv->x * r200Screen->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- r200ScreenPtr r200Screen = rmesa->r200Screen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint height = dPriv->h; \
- GLuint xo = dPriv->x; \
- GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + r200Screen->depthOffset); \
- (void) buf
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-
-#define HW_LOCK()
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) r200##x##_RGB565
-#include "spantmp.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) ); \
-} while (0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p; \
-} while (0)
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- volatile GLuint *ptr = (volatile GLuint *)(read_buf + _x*4 + _y*pitch); \
- GLuint p = *ptr; \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) r200##x##_ARGB8888
-#include "spantmp.h"
-
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* The Radeon family has depth tiling on all the time, so we have to convert
- * the x,y coordinates into the memory bus address (mba) in the same
- * manner as the engine. In each case, the linear block address (ba)
- * is calculated, and then wired with x and y to produce the final
- * memory address.
- */
-
-#define BIT(x,b) ((x & (1<<b))>>b)
-static GLuint r200_mba_z32( r200ContextPtr rmesa,
- GLint x, GLint y )
-{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- GLuint b = ((y & 0x3FF) >> 4) * ((pitch & 0xFFF) >> 5) + ((x & 0x3FF) >> 5);
- GLuint a =
- (BIT(x,0) << 2) |
- (BIT(y,0) << 3) |
- (BIT(x,1) << 4) |
- (BIT(y,1) << 5) |
- (BIT(x,3) << 6) |
- (BIT(x,4) << 7) |
- (BIT(x,2) << 8) |
- (BIT(y,2) << 9) |
- (BIT(y,3) << 10) |
- (((pitch & 0x20) ? (b & 0x01) : ((b & 0x01) ^ (BIT(y,4)))) << 11) |
- ((b >> 1) << 12);
- return a;
-}
-
-static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
-{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- GLuint b = ((y & 0x3FF) >> 4) * ((pitch & 0xFFF) >> 6) + ((x & 0x3FF) >> 6);
- GLuint a =
- (BIT(x,0) << 1) |
- (BIT(y,0) << 2) |
- (BIT(x,1) << 3) |
- (BIT(y,1) << 4) |
- (BIT(x,2) << 5) |
- (BIT(x,4) << 6) |
- (BIT(x,5) << 7) |
- (BIT(x,3) << 8) |
- (BIT(y,2) << 9) |
- (BIT(y,3) << 10) |
- (((pitch & 0x40) ? (b & 0x01) : ((b & 0x01) ^ (BIT(y,4)))) << 11) |
- ((b >> 1) << 12);
- return a;
-}
-
-
-/* 16-bit depth buffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo )) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo ));
-
-#define TAG(x) r200##x##_16
-#include "depthtmp.h"
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + r200_mba_z32( rmesa, _x + xo, \
- _y + yo )) & 0x00ffffff;
-
-#define TAG(x) r200##x##_24_8
-#include "depthtmp.h"
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0x00ffffff; \
- tmp |= (((d) & 0xff) << 24); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- d = tmp >> 24; \
-} while (0)
-
-#define TAG(x) r200##x##_24_8
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void r200SetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
- break;
- case BACK_LEFT_BIT:
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- }
- break;
- default:
- _mesa_problem(ctx, "Bad bufferBit in %s", __FUNCTION__);
- break;
- }
-}
-
-/* Move locking out to get reasonable span performance (10x better
- * than doing this in HW_LOCK above). WaitForIdle() is the main
- * culprit.
- */
-
-static void r200SpanRenderStart( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
- r200WaitForIdleLocked( rmesa );
-
- /* Read & rewrite the first pixel in the frame buffer. This should
- * be a noop, right? In fact without this conform fails as reading
- * from the framebuffer sometimes produces old results -- the
- * on-card read cache gets mixed up and doesn't notice that the
- * framebuffer has been updated.
- *
- * In the worst case this is buggy too as p might get the wrong
- * value first time, so really need a hidden pixel somewhere for this.
- */
- {
- int p;
- volatile int *read_buf = (volatile int *)(rmesa->dri.screen->pFB +
- rmesa->state.pixel.readOffset);
- p = *read_buf;
- *read_buf = p;
- }
-}
-
-static void r200SpanRenderFinish( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( rmesa );
-}
-
-void r200InitSpanFuncs( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = r200SetBuffer;
-
- switch ( rmesa->r200Screen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = r200WriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = r200WriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = r200WriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = r200WriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = r200WriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = r200ReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = r200ReadRGBAPixels_RGB565;
- break;
-
- case 4:
- swdd->WriteRGBASpan = r200WriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = r200WriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = r200WriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = r200WriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = r200WriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = r200ReadRGBASpan_ARGB8888;
- swdd->ReadRGBAPixels = r200ReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-
- switch ( rmesa->glCtx->Visual.depthBits ) {
- case 16:
- swdd->ReadDepthSpan = r200ReadDepthSpan_16;
- swdd->WriteDepthSpan = r200WriteDepthSpan_16;
- swdd->ReadDepthPixels = r200ReadDepthPixels_16;
- swdd->WriteDepthPixels = r200WriteDepthPixels_16;
- break;
-
- case 24:
- swdd->ReadDepthSpan = r200ReadDepthSpan_24_8;
- swdd->WriteDepthSpan = r200WriteDepthSpan_24_8;
- swdd->ReadDepthPixels = r200ReadDepthPixels_24_8;
- swdd->WriteDepthPixels = r200WriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = r200ReadStencilSpan_24_8;
- swdd->WriteStencilSpan = r200WriteStencilSpan_24_8;
- swdd->ReadStencilPixels = r200ReadStencilPixels_24_8;
- swdd->WriteStencilPixels = r200WriteStencilPixels_24_8;
- break;
-
- default:
- break;
- }
-
- swdd->SpanRenderStart = r200SpanRenderStart;
- swdd->SpanRenderFinish = r200SpanRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_span.h b/xc/lib/GL/mesa/src/drv/r200/r200_span.h
deleted file mode 100644
index 72911e945..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_span.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SPAN_H__
-#define __R200_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r200InitSpanFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_state.c b/xc/lib/GL/mesa/src/drv/r200/r200_state.c
deleted file mode 100644
index 5e10b52c0..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_state.c
+++ /dev/null
@@ -1,2202 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.c,v 1.4 2003/02/23 23:59:01 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-#include "enums.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- R200_STATECHANGE( rmesa, ctx );
-
- pp_misc &= ~(R200_ALPHA_TEST_OP_MASK | R200_REF_ALPHA_MASK);
- pp_misc |= (refByte & R200_REF_ALPHA_MASK);
-
- switch ( func ) {
- case GL_NEVER:
- pp_misc |= R200_ALPHA_TEST_FAIL;
- break;
- case GL_LESS:
- pp_misc |= R200_ALPHA_TEST_LESS;
- break;
- case GL_EQUAL:
- pp_misc |= R200_ALPHA_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- pp_misc |= R200_ALPHA_TEST_LEQUAL;
- break;
- case GL_GREATER:
- pp_misc |= R200_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- pp_misc |= R200_ALPHA_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- pp_misc |= R200_ALPHA_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- pp_misc |= R200_ALPHA_TEST_PASS;
- break;
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
-}
-
-static void r200BlendEquation( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~R200_COMB_FCN_MASK;
-
- switch ( mode ) {
- case GL_FUNC_ADD:
- case GL_LOGIC_OP:
- b |= R200_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- b |= R200_COMB_FCN_SUB_CLAMP;
- break;
-
- case GL_FUNC_REVERSE_SUBTRACT:
- b |= R200_COMB_FCN_RSUB_CLAMP;
- break;
-
- case GL_MIN:
- b |= R200_COMB_FCN_MIN;
- break;
-
- case GL_MAX:
- b |= R200_COMB_FCN_MAX;
- break;
-
- default:
- break;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
- if ( ctx->Color.ColorLogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE;
- }
-}
-
-static void r200BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] &
- ~(R200_SRC_BLEND_MASK | R200_DST_BLEND_MASK);
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- b |= R200_SRC_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= R200_SRC_BLEND_GL_ONE;
- break;
- case GL_DST_COLOR:
- b |= R200_SRC_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_COLOR:
- b |= R200_SRC_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= R200_SRC_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- b |= R200_SRC_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- b |= R200_SRC_BLEND_GL_SRC_ALPHA_SATURATE;
- break;
- case GL_CONSTANT_COLOR:
- b |= R200_SRC_BLEND_GL_CONST_COLOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_CONST_COLOR;
- break;
- case GL_CONSTANT_ALPHA:
- b |= R200_SRC_BLEND_GL_CONST_ALPHA;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- b |= R200_SRC_BLEND_GL_ONE_MINUS_CONST_ALPHA;
- break;
- default:
- break;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- b |= R200_DST_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= R200_DST_BLEND_GL_ONE;
- break;
- case GL_SRC_COLOR:
- b |= R200_DST_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= R200_DST_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= R200_DST_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= R200_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_COLOR:
- b |= R200_DST_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= R200_DST_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_DST_ALPHA:
- b |= R200_DST_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= R200_DST_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_CONSTANT_COLOR:
- b |= R200_DST_BLEND_GL_CONST_COLOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- b |= R200_DST_BLEND_GL_ONE_MINUS_CONST_COLOR;
- break;
- case GL_CONSTANT_ALPHA:
- b |= R200_DST_BLEND_GL_CONST_ALPHA;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- b |= R200_DST_BLEND_GL_ONE_MINUS_CONST_ALPHA;
- break;
- default:
- break;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
-}
-
-static void r200BlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- r200BlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void r200DepthFunc( GLcontext *ctx, GLenum func )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_ALWAYS;
- break;
- }
-}
-
-
-static void r200DepthMask( GLcontext *ctx, GLboolean flag )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- R200_STATECHANGE( rmesa, ctx );
-
- if ( ctx->Depth.Mask ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_WRITE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_WRITE_ENABLE;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
- GLuint i;
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- R200_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = -ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = -ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- R200_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- i = r200PackColor( 4, col[0], col[1], col[2], 0 );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_COLOR_MASK;
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= i;
- break;
- case GL_FOG_COORDINATE_SOURCE_EXT:
- /* What to do?
- */
- break;
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- R200_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-static GLboolean intersect_rect( XF86DRIClipRectPtr out,
- XF86DRIClipRectPtr a,
- XF86DRIClipRectPtr b )
-{
- *out = *a;
- if ( b->x1 > out->x1 ) out->x1 = b->x1;
- if ( b->y1 > out->y1 ) out->y1 = b->y1;
- if ( b->x2 < out->x2 ) out->x2 = b->x2;
- if ( b->y2 < out->y2 ) out->y2 = b->y2;
- if ( out->x1 >= out->x2 ) return GL_FALSE;
- if ( out->y1 >= out->y2 ) return GL_FALSE;
- return GL_TRUE;
-}
-
-
-void r200RecalcScissorRects( r200ContextPtr rmesa )
-{
- XF86DRIClipRectPtr out;
- int i;
-
- /* Grow cliprect store?
- */
- if (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- while (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- rmesa->state.scissor.numAllocedClipRects += 1; /* zero case */
- rmesa->state.scissor.numAllocedClipRects *= 2;
- }
-
- if (rmesa->state.scissor.pClipRects)
- FREE(rmesa->state.scissor.pClipRects);
-
- rmesa->state.scissor.pClipRects =
- MALLOC( rmesa->state.scissor.numAllocedClipRects *
- sizeof(XF86DRIClipRectRec) );
-
- if ( rmesa->state.scissor.pClipRects == NULL ) {
- rmesa->state.scissor.numAllocedClipRects = 0;
- return;
- }
- }
-
- out = rmesa->state.scissor.pClipRects;
- rmesa->state.scissor.numClipRects = 0;
-
- for ( i = 0 ; i < rmesa->numClipRects ; i++ ) {
- if ( intersect_rect( out,
- &rmesa->pClipRects[i],
- &rmesa->state.scissor.rect ) ) {
- rmesa->state.scissor.numClipRects++;
- out++;
- }
- }
-}
-
-
-static void r200UpdateScissor( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if ( rmesa->dri.drawable ) {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- int x = ctx->Scissor.X;
- int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height;
- int w = ctx->Scissor.X + ctx->Scissor.Width - 1;
- int h = dPriv->h - ctx->Scissor.Y - 1;
-
- rmesa->state.scissor.rect.x1 = x + dPriv->x;
- rmesa->state.scissor.rect.y1 = y + dPriv->y;
- rmesa->state.scissor.rect.x2 = w + dPriv->x + 1;
- rmesa->state.scissor.rect.y2 = h + dPriv->y + 1;
-
- r200RecalcScissorRects( rmesa );
- }
-}
-
-
-static void r200Scissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if ( ctx->Scissor.Enabled ) {
- R200_FIREVERTICES( rmesa ); /* don't pipeline cliprect changes */
- r200UpdateScissor( ctx );
- }
-
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void r200CullFace( GLcontext *ctx, GLenum unused )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
- GLuint t = rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL];
-
- s |= R200_FFACE_SOLID | R200_BFACE_SOLID;
- t &= ~(R200_CULL_FRONT | R200_CULL_BACK);
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- s &= ~R200_FFACE_SOLID;
- t |= R200_CULL_FRONT;
- break;
- case GL_BACK:
- s &= ~R200_BFACE_SOLID;
- t |= R200_CULL_BACK;
- break;
- case GL_FRONT_AND_BACK:
- s &= ~(R200_FFACE_SOLID | R200_BFACE_SOLID);
- t |= (R200_CULL_FRONT | R200_CULL_BACK);
- break;
- }
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- R200_STATECHANGE(rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-
- if ( rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] != t ) {
- R200_STATECHANGE(rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] = t;
- }
-}
-
-static void r200FrontFace( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_FFACE_CULL_DIR_MASK;
-
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW;
-
- switch ( mode ) {
- case GL_CW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CW;
- break;
- case GL_CCW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CCW;
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_CULL_FRONT_IS_CCW;
- break;
- }
-}
-
-/* =============================================================
- * Point state
- */
-static void r200PointSize( GLcontext *ctx, GLfloat size )
-{
- if (0) fprintf(stderr, "%s: %f\n", __FUNCTION__, size );
-}
-
-/* =============================================================
- * Line state
- */
-static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, lin );
- R200_STATECHANGE( rmesa, set );
-
- /* Line width is stored in U6.4 format.
- */
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff;
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0);
-
- if ( widthf > 1.0 ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_WIDELINE_ENABLE;
- }
-}
-
-static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, lin );
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] =
- ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern));
-}
-
-
-/* =============================================================
- * Masks
- */
-static void r200ColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint mask = r200PackColor( rmesa->r200Screen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- GLuint flag = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~R200_PLANE_MASK_ENABLE;
-
- if (!(r && g && b && a))
- flag |= R200_PLANE_MASK_ENABLE;
-
- if ( rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] != flag ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = flag;
- }
-
- if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) {
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static void r200PolygonOffset( GLcontext *ctx,
- GLfloat factor, GLfloat units )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat constant = units * rmesa->state.depth.scale;
-
-/* factor *= 2; */
-/* constant *= 2; */
-
-/* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */
-
- R200_STATECHANGE( rmesa, zbs );
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
-}
-
-static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint i;
- drmRadeonStipple stipple;
-
- /* Must flip pattern upside down.
- */
- for ( i = 0 ; i < 32 ; i++ ) {
- rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i];
- }
-
- /* TODO: push this into cmd mechanism
- */
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Use window x,y offsets into stipple RAM.
- */
- stipple.mask = rmesa->state.stipple.mask;
- drmCommandWrite( rmesa->dri.fd, DRM_RADEON_STIPPLE,
- &stipple, sizeof(drmRadeonStipple) );
- UNLOCK_HARDWARE( rmesa );
-}
-
-static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
-
- /* Can't generally do unfilled via tcl, but some good special
- * cases work.
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag);
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-static void r200UpdateSpecular( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- CARD32 p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- R200_STATECHANGE( rmesa, tcl );
- R200_STATECHANGE( rmesa, vtx );
-
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_0_SHIFT);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_1_SHIFT);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_1;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LIGHTING_ENABLE;
-
- p &= ~R200_SPECULAR_ENABLE;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_DIFFUSE_SPECULAR_COMBINE;
-
-
- if (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE;
- p |= R200_SPECULAR_ENABLE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &=
- ~R200_DIFFUSE_SPECULAR_COMBINE;
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- p |= R200_SPECULAR_ENABLE;
- } else {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT));
- }
-
- if (ctx->Fog.Enabled) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1;
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-static void update_global_ambient( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- float *fcmd = (float *)R200_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] &
- ((3 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (3 << R200_FRONT_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material[0].Emission);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material[0].Ambient);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- R200_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- * - material,
- * - colormaterial enabled
- * - colormaterial bitmask
- */
-static void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- float *fcmd = (float *)R200_DB_STATE( lit[p] );
- GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- struct gl_material *mat = &ctx->Light.Material[0];
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- if (!ctx->Light.ColorMaterialEnabled)
- bitmask = 0;
-
- if ((bitmask & FRONT_AMBIENT_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_AMBIENT_RED], mat->Ambient );
-
- if ((bitmask & FRONT_DIFFUSE_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_DIFFUSE_RED], mat->Diffuse );
-
- if ((bitmask & FRONT_SPECULAR_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_SPECULAR_RED], mat->Specular );
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-/* Also fallback for asym colormaterial mode in twoside lighting...
- */
-static void check_twoside_fallback( GLcontext *ctx )
-{
- GLboolean fallback = GL_FALSE;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- if (memcmp( &ctx->Light.Material[0],
- &ctx->Light.Material[1],
- sizeof(struct gl_material)) != 0)
- fallback = GL_TRUE;
- else if (ctx->Light.ColorMaterialEnabled &&
- (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) !=
- ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1))
- fallback = GL_TRUE;
- }
-
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_LIGHT_TWOSIDE, fallback );
-}
-
-static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- if (ctx->Light.ColorMaterialEnabled) {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1];
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- /* Default to PREMULT:
- */
- light_model_ctl1 &= ~((0xf << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (0xf << R200_FRONT_AMBIENT_SOURCE_SHIFT) |
- (0xf << R200_FRONT_DIFFUSE_SOURCE_SHIFT) |
- (0xf << R200_FRONT_SPECULAR_SOURCE_SHIFT));
-
- if (mask & FRONT_EMISSION_BIT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_EMISSIVE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_AMBIENT_BIT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_AMBIENT_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_DIFFUSE_BIT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_DIFFUSE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_SPECULAR_BIT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl1 != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]) {
- GLuint p;
-
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] = light_model_ctl1;
-
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
- update_global_ambient( ctx );
- }
- }
-
- check_twoside_fallback( ctx );
-}
-
-void r200UpdateMaterial( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( mtl[0] );
- GLuint p;
- GLuint mask = ~0;
-
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (mask & FRONT_EMISSION_BIT) {
- fcmd[MTL_EMMISSIVE_RED] = ctx->Light.Material[0].Emission[0];
- fcmd[MTL_EMMISSIVE_GREEN] = ctx->Light.Material[0].Emission[1];
- fcmd[MTL_EMMISSIVE_BLUE] = ctx->Light.Material[0].Emission[2];
- fcmd[MTL_EMMISSIVE_ALPHA] = ctx->Light.Material[0].Emission[3];
- }
- if (mask & FRONT_AMBIENT_BIT) {
- fcmd[MTL_AMBIENT_RED] = ctx->Light.Material[0].Ambient[0];
- fcmd[MTL_AMBIENT_GREEN] = ctx->Light.Material[0].Ambient[1];
- fcmd[MTL_AMBIENT_BLUE] = ctx->Light.Material[0].Ambient[2];
- fcmd[MTL_AMBIENT_ALPHA] = ctx->Light.Material[0].Ambient[3];
- }
- if (mask & FRONT_DIFFUSE_BIT) {
- fcmd[MTL_DIFFUSE_RED] = ctx->Light.Material[0].Diffuse[0];
- fcmd[MTL_DIFFUSE_GREEN] = ctx->Light.Material[0].Diffuse[1];
- fcmd[MTL_DIFFUSE_BLUE] = ctx->Light.Material[0].Diffuse[2];
- fcmd[MTL_DIFFUSE_ALPHA] = ctx->Light.Material[0].Diffuse[3];
- }
- if (mask & FRONT_SPECULAR_BIT) {
- fcmd[MTL_SPECULAR_RED] = ctx->Light.Material[0].Specular[0];
- fcmd[MTL_SPECULAR_GREEN] = ctx->Light.Material[0].Specular[1];
- fcmd[MTL_SPECULAR_BLUE] = ctx->Light.Material[0].Specular[2];
- fcmd[MTL_SPECULAR_ALPHA] = ctx->Light.Material[0].Specular[3];
- }
- if (mask & FRONT_SHININESS_BIT) {
- fcmd[MTL_SHININESS] = ctx->Light.Material[0].Shininess;
- }
-
- if (R200_DB_STATECHANGE( rmesa, &rmesa->hw.mtl[0] )) {
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
-
- check_twoside_fallback( ctx );
- update_global_ambient( ctx );
- }
- else if (R200_DEBUG & (DEBUG_PRIMS|DEBUG_STATE))
- fprintf(stderr, "%s: Elided noop material call\n", __FUNCTION__);
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-static void update_light( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~R200_LIGHT_IN_MODELSPACE;
- else
- tmp |= R200_LIGHT_IN_MODELSPACE;
-
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0])
- {
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-static void r200Lightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- /* FIXME: Set RANGE_ATTEN only when needed */
- if (p&1)
- flag = R200_LIGHT_1_IS_LOCAL;
- else
- flag = R200_LIGHT_0_IS_LOCAL;
-
- R200_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? R200_LIGHT_1_IS_SPOT : R200_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- R200_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
-
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
- /* Set RANGE_ATTEN only when needed */
- switch (pname) {
- case GL_POSITION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- {
- GLuint flag;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- if (p&1)
- flag = R200_LIGHT_1_ENABLE_RANGE_ATTEN;
- else
- flag = R200_LIGHT_0_ENABLE_RANGE_ATTEN;
-
- R200_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F &&
- (l->LinearAttenuation != 0.0F || l->QuadraticAttenuation != 0.0F))
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
- default:
- break;
- }
-}
-
-
-
-
-static void r200LightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- R200_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- R200_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LIGHT_TWOSIDE;
-
- check_twoside_fallback( ctx );
-
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- r200UpdateSpecular(ctx);
- break;
-
- default:
- break;
- }
-}
-
-static void r200ShadeModel( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
-
- s &= ~(R200_DIFFUSE_SHADE_MASK |
- R200_ALPHA_SHADE_MASK |
- R200_SPECULAR_SHADE_MASK |
- R200_FOG_SHADE_MASK);
-
- switch ( mode ) {
- case GL_FLAT:
- s |= (R200_DIFFUSE_SHADE_FLAT |
- R200_ALPHA_SHADE_FLAT |
- R200_SPECULAR_SHADE_FLAT |
- R200_FOG_SHADE_FLAT);
- break;
- case GL_SMOOTH:
- s |= (R200_DIFFUSE_SHADE_GOURAUD |
- R200_ALPHA_SHADE_GOURAUD |
- R200_SPECULAR_SHADE_GOURAUD |
- R200_FOG_SHADE_GOURAUD);
- break;
- default:
- return;
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-}
-
-
-/* =============================================================
- * User clip planes
- */
-
-static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
-{
- GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- R200_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
-}
-
-static void r200UpdateClipPlanes( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- R200_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
- }
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-static void r200StencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << R200_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask[0] << R200_STENCIL_MASK_SHIFT));
-
- R200_STATECHANGE( rmesa, ctx );
- R200_STATECHANGE( rmesa, msk );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_STENCIL_TEST_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(R200_STENCIL_REF_MASK|
- R200_STENCIL_VALUE_MASK);
-
- switch ( ctx->Stencil.Function[0] ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_ALWAYS;
- break;
- }
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask;
-}
-
-static void r200StencilMask( GLcontext *ctx, GLuint mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~R200_STENCIL_WRITE_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT);
-}
-
-static void r200StencilOp( GLcontext *ctx, GLenum fail,
- GLenum zfail, GLenum zpass )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(R200_STENCIL_FAIL_MASK |
- R200_STENCIL_ZFAIL_MASK |
- R200_STENCIL_ZPASS_MASK);
-
- switch ( ctx->Stencil.FailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZFailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZPassFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INVERT;
- break;
- }
-}
-
-static void r200ClearStencil( GLcontext *ctx, GLint s )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- rmesa->state.stencil.clear =
- ((GLuint) ctx->Stencil.Clear |
- (0xff << R200_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT));
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-void r200UpdateWindow( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat sy = - v[MAT_SY];
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
- GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
-
- R200_FIREVERTICES( rmesa );
- R200_STATECHANGE( rmesa, vpt );
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
-}
-
-
-
-static void r200Viewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* Don't pipeline viewport changes, conflict with window offset
- * setting below. Could apply deltas to rescue pipelined viewport
- * values, or keep the originals hanging around.
- */
- R200_FIREVERTICES( R200_CONTEXT(ctx) );
- r200UpdateWindow( ctx );
-}
-
-static void r200DepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- r200UpdateWindow( ctx );
-}
-
-void r200UpdateViewportOffset( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat ty = (- v[MAT_TY]) + yoffset;
-
- if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
- {
- /* Note: this should also modify whatever data the context reset
- * code uses...
- */
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
-
- /* update polygon stipple x/y screen offset */
- {
- GLuint stx, sty;
- GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC];
-
- m &= ~(R200_STIPPLE_X_OFFSET_MASK |
- R200_STIPPLE_Y_OFFSET_MASK);
-
- /* add magic offsets, then invert */
- stx = 31 - ((rmesa->dri.drawable->x - 1) & R200_STIPPLE_COORD_MASK);
- sty = 31 - ((rmesa->dri.drawable->y + rmesa->dri.drawable->h - 1)
- & R200_STIPPLE_COORD_MASK);
-
- m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) |
- (sty << R200_STIPPLE_Y_OFFSET_SHIFT));
-
- if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) {
- R200_STATECHANGE( rmesa, msc );
- rmesa->hw.msc.cmd[MSC_RE_MISC] = m;
- }
- }
- }
-
- r200UpdateScissor( ctx );
-}
-
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLubyte color[4];
- CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]);
- CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]);
- CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]);
- CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]);
- rmesa->state.color.clear = r200PackColor( rmesa->r200Screen->cpp,
- color[0], color[1],
- color[2], color[3] );
-}
-
-
-static void r200RenderMode( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-static GLuint r200_rop_tab[] = {
- R200_ROP_CLEAR,
- R200_ROP_AND,
- R200_ROP_AND_REVERSE,
- R200_ROP_COPY,
- R200_ROP_AND_INVERTED,
- R200_ROP_NOOP,
- R200_ROP_XOR,
- R200_ROP_OR,
- R200_ROP_NOR,
- R200_ROP_EQUIV,
- R200_ROP_INVERT,
- R200_ROP_OR_REVERSE,
- R200_ROP_COPY_INVERTED,
- R200_ROP_OR_INVERTED,
- R200_ROP_NAND,
- R200_ROP_SET,
-};
-
-static void r200LogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint rop = (GLuint)opcode - GL_CLEAR;
-
- ASSERT( rop < 16 );
-
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = r200_rop_tab[rop];
-}
-
-
-void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
- }
- else {
- rmesa->numClipRects = dPriv->numBackClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pBackClipRects;
- }
- break;
- default:
- fprintf(stderr, "bad mode in r200SetCliprects\n");
- return;
- }
-
- if (rmesa->state.scissor.enabled)
- r200RecalcScissorRects( rmesa );
-}
-
-
-static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
- break;
- case BACK_LEFT_BIT:
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_BACK_LEFT );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->r200Screen->fbLocation)
- & R200_COLOROFFSET_MASK);
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-static void r200ReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-/* =============================================================
- * State enable/disable
- */
-
-static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint p, flag;
-
- if ( R200_DEBUG & DEBUG_STATE )
- fprintf( stderr, "%s( %s = %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
-
- switch ( cap ) {
- /* Fast track this one...
- */
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
-
- case GL_ALPHA_TEST:
- R200_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ALPHA_TEST_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ALPHA_TEST_ENABLE;
- }
- break;
-
- case GL_BLEND:
- R200_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ALPHA_BLEND_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ALPHA_BLEND_ENABLE;
- }
- if ( ctx->Color.ColorLogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE;
- }
- break;
-
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- p = cap-GL_CLIP_PLANE0;
- R200_STATECHANGE( rmesa, tcl );
- if (state) {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (R200_UCP_ENABLE_0<<p);
- r200ClipPlane( ctx, cap, NULL );
- }
- else {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(R200_UCP_ENABLE_0<<p);
- }
- break;
-
- case GL_COLOR_MATERIAL:
- r200ColorMaterial( ctx, 0, 0 );
- if (!state)
- r200UpdateMaterial( ctx );
- break;
-
- case GL_CULL_FACE:
- r200CullFace( ctx, 0 );
- break;
-
- case GL_DEPTH_TEST:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_Z_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_Z_ENABLE;
- }
- break;
-
- case GL_DITHER:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~rmesa->state.color.roundEnable;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
- }
- break;
-
- case GL_FOG:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_FOG_ENABLE;
- r200Fogfv( ctx, GL_FOG_MODE, 0 );
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_FOG_ENABLE;
- R200_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK;
- }
- r200UpdateSpecular( ctx ); /* for PK_SPEC */
- _mesa_allow_light_in_model( ctx, !state );
- break;
-
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- R200_STATECHANGE(rmesa, tcl);
- p = cap - GL_LIGHT0;
- if (p&1)
- flag = (R200_LIGHT_1_ENABLE |
- R200_LIGHT_1_ENABLE_AMBIENT |
- R200_LIGHT_1_ENABLE_SPECULAR);
- else
- flag = (R200_LIGHT_0_ENABLE |
- R200_LIGHT_0_ENABLE_AMBIENT |
- R200_LIGHT_0_ENABLE_SPECULAR);
-
- if (state)
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] |= flag;
- else
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag;
-
- /*
- */
- update_light_colors( ctx, p );
- break;
-
- case GL_LIGHTING:
- r200UpdateSpecular(ctx);
- check_twoside_fallback( ctx );
- break;
-
- case GL_LINE_SMOOTH:
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_LINE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_LINE;
- }
- break;
-
- case GL_LINE_STIPPLE:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PATTERN_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PATTERN_ENABLE;
- }
- break;
-
- case GL_COLOR_LOGIC_OP:
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE;
- }
- break;
-
- case GL_NORMALIZE:
- R200_STATECHANGE( rmesa, tcl );
- if ( state ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_NORMALIZE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_NORMALIZE_NORMALS;
- }
- break;
-
- /* Pointsize registers on r200 don't seem to do anything. Maybe
- * have to pass pointsizes as vertex parameters? In any case,
- * setting pointmin == pointsizemax == 1.0, and doing nothing
- * for aa is enough to satisfy conform.
- */
- case GL_POINT_SMOOTH:
- break;
-
- /* These don't really do anything, as we don't use the 3vtx
- * primitives yet.
- */
-#if 0
- case GL_POLYGON_OFFSET_POINT:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_POINT;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_POINT;
- }
- break;
-
- case GL_POLYGON_OFFSET_LINE:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_LINE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_LINE;
- }
- break;
-#endif
-
- case GL_POLYGON_OFFSET_FILL:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_TRI;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_TRI;
- }
- break;
-
- case GL_POLYGON_SMOOTH:
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_POLY;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_POLY;
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- R200_STATECHANGE(rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_STIPPLE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_STIPPLE_ENABLE;
- }
- break;
-
- case GL_RESCALE_NORMAL_EXT: {
- GLboolean tmp = ctx->_NeedEyeCoords ? state : !state;
- R200_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS;
- }
- break;
- }
-
- case GL_SCISSOR_TEST:
- R200_FIREVERTICES( rmesa );
- rmesa->state.scissor.enabled = state;
- r200UpdateScissor( ctx );
- break;
-
- case GL_STENCIL_TEST:
- if ( rmesa->state.stencil.hwBuffer ) {
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_STENCIL_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_STENCIL_ENABLE;
- }
- } else {
- FALLBACK( rmesa, R200_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_TEXTURE_GEN_Q:
- case GL_TEXTURE_GEN_R:
- case GL_TEXTURE_GEN_S:
- case GL_TEXTURE_GEN_T:
- /* Picked up in r200UpdateTextureState.
- */
- rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE;
- break;
-
- case GL_COLOR_SUM_EXT:
- r200UpdateSpecular ( ctx );
- break;
-
- default:
- return;
- }
-}
-
-
-void r200LightingSpaceChange( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean tmp;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- R200_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS;
- }
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]);
-}
-
-/* =============================================================
- * Deferred state management - matrices, textures, other?
- */
-
-
-
-
-static void upload_matrix( r200ContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0;
- int i;
-
-
- for (i = 0 ; i < 4 ; i++) {
- *dest++ = src[i];
- *dest++ = src[i+4];
- *dest++ = src[i+8];
- *dest++ = src[i+12];
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx )
-{
- float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0;
- memcpy(dest, src, 16*sizeof(float));
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-
-static void update_texturematrix( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0];
- GLuint compsel = rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL];
- int unit;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s before COMPSEL: %x\n", __FUNCTION__,
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]);
-
- rmesa->TexMatEnabled = 0;
- rmesa->TexMatCompSel = 0;
-
- for (unit = 0 ; unit < 2; unit++) {
- if (!ctx->Texture.Unit[unit]._ReallyEnabled)
- continue;
-
- if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
- rmesa->TexMatEnabled |= (R200_TEXGEN_TEXMAT_0_ENABLE|
- R200_TEXMAT_0_ENABLE) << unit;
-
- rmesa->TexMatCompSel |= R200_OUTPUT_TEX_0 << unit;
-
- if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) {
- /* Need to preconcatenate any active texgen
- * obj/eyeplane matrices:
- */
- _math_matrix_mul_matrix( &rmesa->tmpmat,
- &rmesa->TexGenMatrix[unit],
- ctx->TextureMatrixStack[unit].Top );
- upload_matrix( rmesa, rmesa->tmpmat.m, R200_MTX_TEX0+unit );
- }
- else {
- upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
- R200_MTX_TEX0+unit );
- }
- }
- else if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) {
- upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m,
- R200_MTX_TEX0+unit );
- }
- }
-
- tpc = (rmesa->TexMatEnabled | rmesa->TexGenEnabled);
- if (tpc != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] ||
- rmesa->TexGenInputs != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1]) {
- R200_STATECHANGE(rmesa, tcg);
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] = tpc;
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] = rmesa->TexGenInputs;
- }
-
- compsel &= ~R200_OUTPUT_TEX_MASK;
- compsel |= rmesa->TexMatCompSel | rmesa->TexGenCompSel;
- if (compsel != rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]) {
- R200_STATECHANGE(rmesa, vtx);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = compsel;
- }
-}
-
-
-
-void r200ValidateState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint new_state = rmesa->NewGLState;
-
- if (new_state & _NEW_TEXTURE) {
- r200UpdateTextureState( ctx );
- new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
- }
-
- /* Need an event driven matrix update?
- */
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, R200_MTX_MVP );
-
- /* Need these for lighting (shouldn't upload otherwise)
- */
- if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, R200_MTX_MV );
- upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, R200_MTX_IMV );
- }
-
- /* Does this need to be triggered on eg. modelview for
- * texgen-derived objplane/eyeplane matrices?
- */
- if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) {
- update_texturematrix( ctx );
- }
-
- if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) {
- update_light( ctx );
- }
-
- /* emit all active clip planes if projection matrix changes.
- */
- if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform.ClipPlanesEnabled)
- r200UpdateClipPlanes( ctx );
- }
-
-
- rmesa->NewGLState = 0;
-}
-
-
-static void r200InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _ae_invalidate_state( ctx, new_state );
- R200_CONTEXT(ctx)->NewGLState |= new_state;
- r200VtxfmtInvalidate( ctx );
-}
-
-static void r200WrapRunPipeline( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (tnl->vb.Material) {
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE );
- }
-
- /* Run the pipeline.
- */
- _tnl_run_pipeline( ctx );
-
- if (tnl->vb.Material) {
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE );
- r200UpdateMaterial( ctx ); /* not needed any more? */
- }
-}
-
-
-/* Initialize the driver's state functions.
- */
-void r200InitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = r200InvalidateState;
- ctx->Driver.LightingSpaceChange = r200LightingSpaceChange;
-
- ctx->Driver.DrawBuffer = r200DrawBuffer;
- ctx->Driver.ReadBuffer = r200ReadBuffer;
-
- ctx->Driver.AlphaFunc = r200AlphaFunc;
- ctx->Driver.BlendEquation = r200BlendEquation;
- ctx->Driver.BlendFunc = r200BlendFunc;
- ctx->Driver.BlendFuncSeparate = r200BlendFuncSeparate;
- ctx->Driver.ClearColor = r200ClearColor;
- ctx->Driver.ClearDepth = NULL;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearStencil = r200ClearStencil;
- ctx->Driver.ClipPlane = r200ClipPlane;
- ctx->Driver.ColorMask = r200ColorMask;
- ctx->Driver.CullFace = r200CullFace;
- ctx->Driver.DepthFunc = r200DepthFunc;
- ctx->Driver.DepthMask = r200DepthMask;
- ctx->Driver.DepthRange = r200DepthRange;
- ctx->Driver.Enable = r200Enable;
- ctx->Driver.Fogfv = r200Fogfv;
- ctx->Driver.FrontFace = r200FrontFace;
- ctx->Driver.Hint = NULL;
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.LightModelfv = r200LightModelfv;
- ctx->Driver.Lightfv = r200Lightfv;
- ctx->Driver.LineStipple = r200LineStipple;
- ctx->Driver.LineWidth = r200LineWidth;
- ctx->Driver.LogicOpcode = r200LogicOpCode;
- ctx->Driver.PolygonMode = r200PolygonMode;
- ctx->Driver.PolygonOffset = r200PolygonOffset;
- ctx->Driver.PolygonStipple = r200PolygonStipple;
- ctx->Driver.PointSize = r200PointSize;
- ctx->Driver.RenderMode = r200RenderMode;
- ctx->Driver.Scissor = r200Scissor;
- ctx->Driver.ShadeModel = r200ShadeModel;
- ctx->Driver.StencilFunc = r200StencilFunc;
- ctx->Driver.StencilMask = r200StencilMask;
- ctx->Driver.StencilOp = r200StencilOp;
- ctx->Driver.Viewport = r200Viewport;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial;
- TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_state.h b/xc/lib/GL/mesa/src/drv/r200/r200_state.h
deleted file mode 100644
index 118712d84..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_state.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.h,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_STATE_H__
-#define __R200_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-extern void r200InitState( r200ContextPtr rmesa );
-extern void r200InitStateFuncs( GLcontext *ctx );
-
-extern void r200UpdateMaterial( GLcontext *ctx );
-
-extern void r200SetCliprects( r200ContextPtr rmesa, GLenum mode );
-extern void r200RecalcScissorRects( r200ContextPtr rmesa );
-extern void r200UpdateViewportOffset( GLcontext *ctx );
-extern void r200UpdateWindow( GLcontext *ctx );
-
-extern void r200ValidateState( GLcontext *ctx );
-
-extern void r200PrintDirty( r200ContextPtr rmesa,
- const char *msg );
-
-
-extern void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) do { \
- if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
- __FUNCTION__, bit, mode ); \
- r200Fallback( rmesa->glCtx, bit, mode ); \
-} while (0)
-
-extern void r200LightingSpaceChange( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c b/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c
deleted file mode 100644
index f7dfcff8b..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state_init.c,v 1.4 2003/02/22 06:21:11 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "enums.h"
-#include "colormac.h"
-#include "api_arrayelt.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "xmlpool.h"
-
-/* =============================================================
- * State initialization
- */
-
-void r200PrintDirty( r200ContextPtr rmesa, const char *msg )
-{
- struct r200_state_atom *l;
-
- fprintf(stderr, msg);
- fprintf(stderr, ": ");
-
- foreach(l, &(rmesa->hw.dirty)) {
- fprintf(stderr, "%s, ", l->name);
- }
-
- fprintf(stderr, "\n");
-}
-
-static int cmdpkt( int id )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.packet.cmd_type = RADEON_CMD_PACKET;
- h.packet.packet_id = id;
- return h.i;
-}
-
-static int cmdvec( int offset, int stride, int count )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.vectors.cmd_type = RADEON_CMD_VECTORS;
- h.vectors.offset = offset;
- h.vectors.stride = stride;
- h.vectors.count = count;
- return h.i;
-}
-
-static int cmdscl( int offset, int stride, int count )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS;
- h.scalars.offset = offset;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-static int cmdscl2( int offset, int stride, int count )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS2;
- h.scalars.offset = offset - 0x100;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-#define CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx, int idx ) \
-{ \
- (void) idx; \
- return FLAG; \
-}
-
-#define TCL_CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx, int idx ) \
-{ \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- (void) idx; \
- return !rmesa->TclFallback && (FLAG); \
-}
-
-
-
-CHECK( always, GL_TRUE )
-CHECK( never, GL_FALSE )
-CHECK( tex_any, ctx->Texture._EnabledUnits )
-CHECK( tex, ctx->Texture.Unit[idx]._ReallyEnabled )
-CHECK( fog, ctx->Fog.Enabled )
-TCL_CHECK( tcl, GL_TRUE )
-TCL_CHECK( tcl_tex, ctx->Texture.Unit[idx]._ReallyEnabled )
-TCL_CHECK( tcl_lighting, ctx->Light.Enabled )
-TCL_CHECK( tcl_light, ctx->Light.Enabled && ctx->Light.Light[idx].Enabled )
-TCL_CHECK( tcl_ucp, (ctx->Transform.ClipPlanesEnabled & (1 << idx)) )
-
-
-/* Initialize the context's hardware state.
- */
-void r200InitState( r200ContextPtr rmesa )
-{
- GLcontext *ctx = rmesa->glCtx;
- GLuint color_fmt, depth_fmt, i;
-
- switch ( rmesa->r200Screen->cpp ) {
- case 2:
- color_fmt = R200_COLOR_FORMAT_RGB565;
- break;
- case 4:
- color_fmt = R200_COLOR_FORMAT_ARGB8888;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->state.color.clear = 0x00000000;
-
- switch ( ctx->Visual.depthBits ) {
- case 16:
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffff;
- depth_fmt = R200_DEPTH_FORMAT_16BIT_INT_Z;
- rmesa->state.stencil.clear = 0x00000000;
- break;
- case 24:
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffffff;
- depth_fmt = R200_DEPTH_FORMAT_24BIT_INT_Z;
- rmesa->state.stencil.clear = 0xff000000;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits );
- exit( -1 );
- }
-
- /* Only have hw stencil when depth buffer is 24 bits deep */
- rmesa->state.stencil.hwBuffer = ( ctx->Visual.stencilBits > 0 &&
- ctx->Visual.depthBits == 24 );
-
- rmesa->Fallback = 0;
-
- if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
-
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
-
- /* Initialize lists:
- */
- make_empty_list(&(rmesa->hw.dirty)); rmesa->hw.dirty.name = "DIRTY";
- make_empty_list(&(rmesa->hw.clean)); rmesa->hw.clean.name = "CLEAN";
-
-
-#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
- do { \
- rmesa->hw.ATOM.cmd_size = SZ; \
- rmesa->hw.ATOM.cmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.lastcmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.name = NM; \
- rmesa->hw.ATOM.idx = IDX; \
- rmesa->hw.ATOM.check = check_##CHK; \
- insert_at_head(&(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \
- } while (0)
-
-
- /* Allocate state buffers:
- */
- ALLOC_STATE( ctx, always, CTX_STATE_SIZE, "CTX/context", 0 );
- ALLOC_STATE( set, always, SET_STATE_SIZE, "SET/setup", 0 );
- ALLOC_STATE( lin, always, LIN_STATE_SIZE, "LIN/line", 0 );
- ALLOC_STATE( msk, always, MSK_STATE_SIZE, "MSK/mask", 0 );
- ALLOC_STATE( vpt, always, VPT_STATE_SIZE, "VPT/viewport", 0 );
- ALLOC_STATE( vtx, always, VTX_STATE_SIZE, "VTX/vertex", 0 );
- ALLOC_STATE( vap, always, VAP_STATE_SIZE, "VAP/vap", 0 );
- ALLOC_STATE( vte, always, VTE_STATE_SIZE, "VTE/vte", 0 );
- ALLOC_STATE( msc, always, MSC_STATE_SIZE, "MSC/misc", 0 );
- ALLOC_STATE( cst, always, CST_STATE_SIZE, "CST/constant", 0 );
- ALLOC_STATE( zbs, always, ZBS_STATE_SIZE, "ZBS/zbias", 0 );
- ALLOC_STATE( tam, tex_any, TAM_STATE_SIZE, "TAM/tam", 0 );
- ALLOC_STATE( tf, tex_any, TF_STATE_SIZE, "TF/tfactor", 0 );
- ALLOC_STATE( tex[0], tex_any, TEX_STATE_SIZE, "TEX/tex-0", 0 );
- ALLOC_STATE( tex[1], tex_any, TEX_STATE_SIZE, "TEX/tex-1", 1 );
-
- if (rmesa->r200Screen->drmSupportsCubeMaps) {
- ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 );
- ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 );
- }
- else {
- ALLOC_STATE( cube[0], never, CUBE_STATE_SIZE, "CUBE/tex-0", 0 );
- ALLOC_STATE( cube[1], never, CUBE_STATE_SIZE, "CUBE/tex-1", 1 );
- }
-
- ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 );
- ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 );
- ALLOC_STATE( tcg, tcl, TCG_STATE_SIZE, "TCG/texcoordgen", 0 );
- ALLOC_STATE( mtl[0], tcl_lighting, MTL_STATE_SIZE, "MTL0/material0", 0 );
- ALLOC_STATE( grd, tcl, GRD_STATE_SIZE, "GRD/guard-band", 0 );
- ALLOC_STATE( fog, fog, FOG_STATE_SIZE, "FOG/fog", 0 );
- ALLOC_STATE( glt, tcl_lighting, GLT_STATE_SIZE, "GLT/light-global", 0 );
- ALLOC_STATE( eye, tcl_lighting, EYE_STATE_SIZE, "EYE/eye-vector", 0 );
- ALLOC_STATE( mat[R200_MTX_MV], tcl, MAT_STATE_SIZE, "MAT/modelview", 0 );
- ALLOC_STATE( mat[R200_MTX_IMV], tcl, MAT_STATE_SIZE, "MAT/it-modelview", 0 );
- ALLOC_STATE( mat[R200_MTX_MVP], tcl, MAT_STATE_SIZE, "MAT/modelproject", 0 );
- ALLOC_STATE( mat[R200_MTX_TEX0], tcl_tex, MAT_STATE_SIZE, "MAT/texmat0", 0 );
- ALLOC_STATE( mat[R200_MTX_TEX1], tcl_tex, MAT_STATE_SIZE, "MAT/texmat1", 1 );
- ALLOC_STATE( ucp[0], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-0", 0 );
- ALLOC_STATE( ucp[1], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-1", 1 );
- ALLOC_STATE( ucp[2], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-2", 2 );
- ALLOC_STATE( ucp[3], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-3", 3 );
- ALLOC_STATE( ucp[4], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-4", 4 );
- ALLOC_STATE( ucp[5], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-5", 5 );
- ALLOC_STATE( lit[0], tcl_light, LIT_STATE_SIZE, "LIT/light-0", 0 );
- ALLOC_STATE( lit[1], tcl_light, LIT_STATE_SIZE, "LIT/light-1", 1 );
- ALLOC_STATE( lit[2], tcl_light, LIT_STATE_SIZE, "LIT/light-2", 2 );
- ALLOC_STATE( lit[3], tcl_light, LIT_STATE_SIZE, "LIT/light-3", 3 );
- ALLOC_STATE( lit[4], tcl_light, LIT_STATE_SIZE, "LIT/light-4", 4 );
- ALLOC_STATE( lit[5], tcl_light, LIT_STATE_SIZE, "LIT/light-5", 5 );
- ALLOC_STATE( lit[6], tcl_light, LIT_STATE_SIZE, "LIT/light-6", 6 );
- ALLOC_STATE( lit[7], tcl_light, LIT_STATE_SIZE, "LIT/light-7", 7 );
- ALLOC_STATE( pix[0], always, PIX_STATE_SIZE, "PIX/pixstage-0", 0 );
- ALLOC_STATE( pix[1], tex, PIX_STATE_SIZE, "PIX/pixstage-1", 1 );
-
-
- /* Fill in the packet headers:
- */
- rmesa->hw.ctx.cmd[CTX_CMD_0] = cmdpkt(RADEON_EMIT_PP_MISC);
- rmesa->hw.ctx.cmd[CTX_CMD_1] = cmdpkt(RADEON_EMIT_PP_CNTL);
- rmesa->hw.ctx.cmd[CTX_CMD_2] = cmdpkt(RADEON_EMIT_RB3D_COLORPITCH);
- rmesa->hw.lin.cmd[LIN_CMD_0] = cmdpkt(RADEON_EMIT_RE_LINE_PATTERN);
- rmesa->hw.lin.cmd[LIN_CMD_1] = cmdpkt(RADEON_EMIT_SE_LINE_WIDTH);
- rmesa->hw.msk.cmd[MSK_CMD_0] = cmdpkt(RADEON_EMIT_RB3D_STENCILREFMASK);
- rmesa->hw.vpt.cmd[VPT_CMD_0] = cmdpkt(RADEON_EMIT_SE_VPORT_XSCALE);
- rmesa->hw.set.cmd[SET_CMD_0] = cmdpkt(RADEON_EMIT_SE_CNTL);
- rmesa->hw.msc.cmd[MSC_CMD_0] = cmdpkt(RADEON_EMIT_RE_MISC);
- rmesa->hw.cst.cmd[CST_CMD_0] = cmdpkt(R200_EMIT_PP_CNTL_X);
- rmesa->hw.cst.cmd[CST_CMD_1] = cmdpkt(R200_EMIT_RB3D_DEPTHXY_OFFSET);
- rmesa->hw.cst.cmd[CST_CMD_2] = cmdpkt(R200_EMIT_RE_AUX_SCISSOR_CNTL);
- rmesa->hw.cst.cmd[CST_CMD_3] = cmdpkt(R200_EMIT_RE_SCISSOR_TL_0);
- rmesa->hw.cst.cmd[CST_CMD_4] = cmdpkt(R200_EMIT_SE_VAP_CNTL_STATUS);
- rmesa->hw.cst.cmd[CST_CMD_5] = cmdpkt(R200_EMIT_RE_POINTSIZE);
- rmesa->hw.cst.cmd[CST_CMD_6] = cmdpkt(R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0);
- rmesa->hw.tam.cmd[TAM_CMD_0] = cmdpkt(R200_EMIT_PP_TAM_DEBUG3);
- rmesa->hw.tf.cmd[TF_CMD_0] = cmdpkt(R200_EMIT_TFACTOR_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_0);
- rmesa->hw.tex[1].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_1);
- rmesa->hw.tex[1].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_1);
- rmesa->hw.cube[0].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_0);
- rmesa->hw.cube[0].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_0);
- rmesa->hw.cube[1].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_1);
- rmesa->hw.cube[1].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_1);
- rmesa->hw.pix[0].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_0);
- rmesa->hw.pix[1].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_1);
- rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
- rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(R200_EMIT_TCL_LIGHT_MODEL_CTL_0);
- rmesa->hw.tcl.cmd[TCL_CMD_1] = cmdpkt(R200_EMIT_TCL_UCP_VERT_BLEND_CTL);
- rmesa->hw.tcg.cmd[TCG_CMD_0] = cmdpkt(R200_EMIT_TEX_PROC_CTL_2);
- rmesa->hw.msl.cmd[MSL_CMD_0] = cmdpkt(R200_EMIT_MATRIX_SELECT_0);
- rmesa->hw.vap.cmd[VAP_CMD_0] = cmdpkt(R200_EMIT_VAP_CTL);
- rmesa->hw.vtx.cmd[VTX_CMD_0] = cmdpkt(R200_EMIT_VTX_FMT_0);
- rmesa->hw.vtx.cmd[VTX_CMD_1] = cmdpkt(R200_EMIT_OUTPUT_VTX_COMP_SEL);
- rmesa->hw.vtx.cmd[VTX_CMD_2] = cmdpkt(R200_EMIT_SE_VTX_STATE_CNTL);
- rmesa->hw.vte.cmd[VTE_CMD_0] = cmdpkt(R200_EMIT_VTE_CNTL);
- rmesa->hw.mtl[0].cmd[MTL_CMD_0] =
- cmdvec( R200_VS_MAT_0_EMISS, 1, 16 );
- rmesa->hw.mtl[0].cmd[MTL_CMD_1] =
- cmdscl2( R200_SS_MAT_0_SHININESS, 1, 1 );
- rmesa->hw.grd.cmd[GRD_CMD_0] =
- cmdscl( R200_SS_VERT_GUARD_CLIP_ADJ_ADDR, 1, 4 );
- rmesa->hw.fog.cmd[FOG_CMD_0] =
- cmdvec( R200_VS_FOG_PARAM_ADDR, 1, 4 );
- rmesa->hw.glt.cmd[GLT_CMD_0] =
- cmdvec( R200_VS_GLOBAL_AMBIENT_ADDR, 1, 4 );
- rmesa->hw.eye.cmd[EYE_CMD_0] =
- cmdvec( R200_VS_EYE_VECTOR_ADDR, 1, 4 );
-
- rmesa->hw.mat[R200_MTX_MV].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_0_MV, 1, 16);
- rmesa->hw.mat[R200_MTX_IMV].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_1_INV_MV, 1, 16);
- rmesa->hw.mat[R200_MTX_MVP].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_2_MVP, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX0].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_3_TEX0, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX1].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_4_TEX1, 1, 16);
-
- for (i = 0 ; i < 8; i++) {
- rmesa->hw.lit[i].cmd[LIT_CMD_0] =
- cmdvec( R200_VS_LIGHT_AMBIENT_ADDR + i, 8, 24 );
- rmesa->hw.lit[i].cmd[LIT_CMD_1] =
- cmdscl( R200_SS_LIGHT_DCD_ADDR + i, 8, 7 );
- }
-
- for (i = 0 ; i < 6; i++) {
- rmesa->hw.ucp[i].cmd[UCP_CMD_0] =
- cmdvec( R200_VS_UCP_ADDR + i, 1, 4 );
- }
-
- /* Initial Harware state:
- */
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = (R200_ALPHA_TEST_PASS
- /* | R200_RIGHT_HAND_CUBE_OGL*/);
-
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = (R200_FOG_VERTEX |
- R200_FOG_USE_SPEC_ALPHA);
-
- rmesa->hw.ctx.cmd[CTX_RE_SOLID_COLOR] = 0x00000000;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = (R200_COMB_FCN_ADD_CLAMP |
- R200_SRC_BLEND_GL_ONE |
- R200_DST_BLEND_GL_ZERO );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHOFFSET] =
- rmesa->r200Screen->depthOffset + rmesa->r200Screen->fbLocation;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] =
- ((rmesa->r200Screen->depthPitch &
- R200_DEPTHPITCH_MASK) |
- R200_DEPTH_ENDIAN_NO_SWAP);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] = (depth_fmt |
- R200_Z_TEST_LESS |
- R200_STENCIL_TEST_ALWAYS |
- R200_STENCIL_FAIL_KEEP |
- R200_STENCIL_ZPASS_KEEP |
- R200_STENCIL_ZFAIL_KEEP |
- R200_Z_WRITE_ENABLE);
-
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = (R200_ANTI_ALIAS_NONE
- | R200_TEX_BLEND_0_ENABLE);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = color_fmt;
- switch ( driQueryOptioni( &rmesa->optionCache, "dither_mode" ) ) {
- case DRI_CONF_DITHER_XERRORDIFFRESET:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_INIT;
- break;
- case DRI_CONF_DITHER_ORDERED:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_SCALE_DITHER_ENABLE;
- break;
- }
- if ( driQueryOptioni( &rmesa->optionCache, "round_mode" ) ==
- DRI_CONF_ROUND_ROUND )
- rmesa->state.color.roundEnable = R200_ROUND_ENABLE;
- else
- rmesa->state.color.roundEnable = 0;
- if ( driQueryOptioni (&rmesa->optionCache, "color_reduction" ) ==
- DRI_CONF_COLOR_REDUCTION_DITHER )
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE;
- else
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->r200Screen->fbLocation)
- & R200_COLOROFFSET_MASK);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch &
- R200_COLORPITCH_MASK) |
- R200_COLOR_ENDIAN_NO_SWAP);
-
- rmesa->hw.set.cmd[SET_SE_CNTL] = (R200_FFACE_CULL_CCW |
- R200_BFACE_SOLID |
- R200_FFACE_SOLID |
- R200_FLAT_SHADE_VTX_LAST |
- R200_DIFFUSE_SHADE_GOURAUD |
- R200_ALPHA_SHADE_GOURAUD |
- R200_SPECULAR_SHADE_GOURAUD |
- R200_FOG_SHADE_GOURAUD |
- R200_VTX_PIX_CENTER_OGL |
- R200_ROUND_MODE_TRUNC |
- R200_ROUND_PREC_8TH_PIX);
-
- rmesa->hw.set.cmd[SET_RE_CNTL] = (R200_PERSPECTIVE_ENABLE |
- R200_SCISSOR_ENABLE);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((1 << 16) | 0xffff);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_STATE] =
- ((0 << R200_LINE_CURRENT_PTR_SHIFT) |
- (1 << R200_LINE_CURRENT_COUNT_SHIFT));
-
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (1 << 4);
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] =
- ((0x00 << R200_STENCIL_REF_SHIFT) |
- (0xff << R200_STENCIL_MASK_SHIFT) |
- (0xff << R200_STENCIL_WRITEMASK_SHIFT));
-
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = R200_ROP_COPY;
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = 0xffffffff;
-
- rmesa->hw.tam.cmd[TAM_DEBUG3] = 0;
-
- rmesa->hw.msc.cmd[MSC_RE_MISC] =
- ((0 << R200_STIPPLE_X_OFFSET_SHIFT) |
- (0 << R200_STIPPLE_Y_OFFSET_SHIFT) |
- R200_STIPPLE_BIG_BIT_ORDER);
-
-
- rmesa->hw.cst.cmd[CST_PP_CNTL_X] = 0;
- rmesa->hw.cst.cmd[CST_RB3D_DEPTHXY_OFFSET] = 0;
- rmesa->hw.cst.cmd[CST_RE_AUX_SCISSOR_CNTL] = 0x0;
- rmesa->hw.cst.cmd[CST_RE_SCISSOR_TL_0] = 0;
- rmesa->hw.cst.cmd[CST_RE_SCISSOR_BR_0] = 0;
- rmesa->hw.cst.cmd[CST_SE_VAP_CNTL_STATUS] =
-#ifdef MESA_BIG_ENDIAN
- R200_VC_32BIT_SWAP;
-#else
- R200_VC_NO_SWAP;
-#endif
- rmesa->hw.cst.cmd[CST_RE_POINTSIZE] = 0x100010;
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_0] =
- (0x0 << R200_VERTEX_POSITION_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_1] =
- (0x02 << R200_VTX_COLOR_0_ADDR__SHIFT) |
- (0x03 << R200_VTX_COLOR_1_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_2] =
- (0x06 << R200_VTX_TEX_0_ADDR__SHIFT) |
- (0x07 << R200_VTX_TEX_1_ADDR__SHIFT) |
- (0x08 << R200_VTX_TEX_2_ADDR__SHIFT) |
- (0x09 << R200_VTX_TEX_3_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_3] =
- (0x0A << R200_VTX_TEX_4_ADDR__SHIFT) |
- (0x0B << R200_VTX_TEX_5_ADDR__SHIFT);
-
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = 0x00000000;
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] = R200_BORDER_MODE_OGL;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT] =
- ((i << R200_TXFORMAT_ST_ROUTE_SHIFT) | /* <-- note i */
- (2 << R200_TXFORMAT_WIDTH_SHIFT) |
- (2 << R200_TXFORMAT_HEIGHT_SHIFT));
- rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] =
- rmesa->r200Screen->texOffset[RADEON_CARD_HEAP];
- rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT_X] =
- (/* R200_TEXCOORD_PROJ | */
- 0x100000); /* Small default bias */
-
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_FACES] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F1] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F2] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F3] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F4] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F5] = 0;
- }
-
- rmesa->hw.pix[0].cmd[PIX_PP_TXCBLEND] =
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR |
- R200_TXC_OP_MADD);
-
- rmesa->hw.pix[0].cmd[PIX_PP_TXCBLEND2] =
- ((0 << R200_TXC_TFACTOR_SEL_SHIFT) |
- R200_TXC_SCALE_1X |
- R200_TXC_CLAMP_0_1 |
- R200_TXC_OUTPUT_REG_R0);
-
- rmesa->hw.pix[0].cmd[PIX_PP_TXABLEND] =
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD);
-
- rmesa->hw.pix[0].cmd[PIX_PP_TXABLEND2] =
- ((0 << R200_TXA_TFACTOR_SEL_SHIFT) |
- R200_TXA_SCALE_1X |
- R200_TXA_CLAMP_0_1 |
- R200_TXA_OUTPUT_REG_R0);
-
- rmesa->hw.pix[1].cmd[PIX_PP_TXCBLEND] =
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR |
- R200_TXC_OP_MADD);
-
- rmesa->hw.pix[1].cmd[PIX_PP_TXCBLEND2] =
- ((0 << R200_TXC_TFACTOR_SEL_SHIFT) |
- R200_TXC_SCALE_1X |
- R200_TXC_CLAMP_0_1 |
- R200_TXC_OUTPUT_REG_R0);
-
- rmesa->hw.pix[1].cmd[PIX_PP_TXABLEND] =
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD);
-
- rmesa->hw.pix[1].cmd[PIX_PP_TXABLEND2] =
- ((0 << R200_TXA_TFACTOR_SEL_SHIFT) |
- R200_TXA_SCALE_1X |
- R200_TXA_CLAMP_0_1 |
- R200_TXA_OUTPUT_REG_R0);
-
- rmesa->hw.tf.cmd[TF_TFACTOR_0] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_1] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_2] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_3] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_4] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_5] = 0;
-
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] =
- (R200_VAP_TCL_ENABLE |
- (0x9 << R200_VAP_VF_MAX_VTX_NUM__SHIFT));
-
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] =
- (R200_VPORT_X_SCALE_ENA |
- R200_VPORT_Y_SCALE_ENA |
- R200_VPORT_Z_SCALE_ENA |
- R200_VPORT_X_OFFSET_ENA |
- R200_VPORT_Y_OFFSET_ENA |
- R200_VPORT_Z_OFFSET_ENA |
-/* FIXME: Turn on for tex rect only */
- R200_VTX_ST_DENORMALIZED |
- R200_VTX_W0_FMT);
-
-
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = 0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = 0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] =
- ((R200_VTX_Z0 | R200_VTX_W0 |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] = 0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = (R200_OUTPUT_XYZW);
- rmesa->hw.vtx.cmd[VTX_STATE_CNTL] = R200_VSC_UPDATE_USER_COLOR_0_ENABLE;
-
-
- /* Matrix selection */
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_0] =
- (R200_MTX_MV << R200_MODELVIEW_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_1] =
- (R200_MTX_IMV << R200_IT_MODELVIEW_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_2] =
- (R200_MTX_MVP << R200_MODELPROJECT_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_3] =
- ((R200_MTX_TEX0 << R200_TEXMAT_0_SHIFT) |
- (R200_MTX_TEX1 << R200_TEXMAT_1_SHIFT) |
- (R200_MTX_TEX2 << R200_TEXMAT_2_SHIFT) |
- (R200_MTX_TEX3 << R200_TEXMAT_3_SHIFT));
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_4] =
- ((R200_MTX_TEX4 << R200_TEXMAT_4_SHIFT) |
- (R200_MTX_TEX5 << R200_TEXMAT_5_SHIFT));
-
-
- /* General TCL state */
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] =
- (R200_SPECULAR_LIGHTS |
- R200_DIFFUSE_SPECULAR_COMBINE |
- R200_LOCAL_LIGHT_VEC_GL);
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] =
- ((R200_LM1_SOURCE_LIGHT_PREMULT << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_FRONT_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_FRONT_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_FRONT_SPECULAR_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_BACK_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_BACK_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_BACK_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_LIGHT_PREMULT << R200_BACK_SPECULAR_SOURCE_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_0] = 0; /* filled in via callbacks */
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_1] = 0;
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_2] = 0;
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_3] = 0;
-
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] =
- (R200_UCP_IN_CLIP_SPACE |
- R200_CULL_FRONT_IS_CCW);
-
- /* Texgen/Texmat state */
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2] = 0x0; /* masks??? */
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_3] =
- ((0 << R200_TEXGEN_0_INPUT_TEX_SHIFT) |
- (1 << R200_TEXGEN_1_INPUT_TEX_SHIFT) |
- (2 << R200_TEXGEN_2_INPUT_TEX_SHIFT) |
- (3 << R200_TEXGEN_3_INPUT_TEX_SHIFT) |
- (4 << R200_TEXGEN_4_INPUT_TEX_SHIFT) |
- (5 << R200_TEXGEN_5_INPUT_TEX_SHIFT));
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] = 0;
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] =
- ((0 << R200_TEXGEN_0_INPUT_SHIFT) |
- (1 << R200_TEXGEN_1_INPUT_SHIFT) |
- (2 << R200_TEXGEN_2_INPUT_SHIFT) |
- (3 << R200_TEXGEN_3_INPUT_SHIFT) |
- (4 << R200_TEXGEN_4_INPUT_SHIFT) |
- (5 << R200_TEXGEN_5_INPUT_SHIFT));
- rmesa->hw.tcg.cmd[TCG_TEX_CYL_WRAP_CTL] = 0;
-
- rmesa->TexGenInputs = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1];
-
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
-
- for (i = 0 ; i < 6; i++) {
- ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL );
- }
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, 0 );
-
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_DISCARD_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_DISCARD_ADJ] = IEEE_ONE;
-
- rmesa->hw.eye.cmd[EYE_X] = 0;
- rmesa->hw.eye.cmd[EYE_Y] = 0;
- rmesa->hw.eye.cmd[EYE_Z] = IEEE_ONE;
- rmesa->hw.eye.cmd[EYE_RESCALE_FACTOR] = IEEE_ONE;
-
- r200LightingSpaceChange( ctx );
-
- rmesa->lost_context = 1;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c b/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c
deleted file mode 100644
index 5090cfe48..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c
+++ /dev/null
@@ -1,1290 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v 1.5 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "enums.h"
-#include "image.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast/s_context.h"
-#include "swrast/s_fog.h"
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_imm_exec.h"
-#include "tnl/t_pipeline.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_swtcl.h"
-#include "r200_tcl.h"
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-
-#define R200_XYZW_BIT 0x01
-#define R200_RGBA_BIT 0x02
-#define R200_SPEC_BIT 0x04
-#define R200_TEX0_BIT 0x08
-#define R200_TEX1_BIT 0x10
-#define R200_PTEX_BIT 0x20
-#define R200_MAX_SETUP 0x40
-
-static void flush_last_swtcl_prim( r200ContextPtr rmesa );
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[R200_MAX_SETUP];
-
-
-static int se_vtx_fmt_0[] = {
- 0,
-
- (R200_VTX_XY |
- R200_VTX_Z0 |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT)),
-
- (R200_VTX_XY |
- R200_VTX_Z0 |
- R200_VTX_W0 |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT)),
-
- (R200_VTX_XY |
- R200_VTX_Z0 |
- R200_VTX_W0 |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT)),
-
- (R200_VTX_XY |
- R200_VTX_Z0 |
- R200_VTX_W0 |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT)),
-
- (R200_VTX_XY |
- R200_VTX_Z0 |
- R200_VTX_W0 |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT))
-};
-
-static int se_vtx_fmt_1[] = {
- 0,
- 0,
- 0,
- ((2 << R200_VTX_TEX0_COMP_CNT_SHIFT)),
- ((2 << R200_VTX_TEX0_COMP_CNT_SHIFT) |
- (2 << R200_VTX_TEX1_COMP_CNT_SHIFT)),
- ((3 << R200_VTX_TEX0_COMP_CNT_SHIFT) |
- (3 << R200_VTX_TEX1_COMP_CNT_SHIFT)),
-};
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 4
-#define PROJ_TEX1_VERTEX_FORMAT 5
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & R200_XYZW_BIT)
-#define DO_RGBA (IND & R200_RGBA_BIT)
-#define DO_SPEC (IND & R200_SPEC_BIT)
-#define DO_FOG (IND & R200_SPEC_BIT)
-#define DO_TEX0 (IND & R200_TEX0_BIT)
-#define DO_TEX1 (IND & R200_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & R200_PTEX_BIT)
-
-#define VERTEX r200Vertex
-#define VERTEX_COLOR r200_color_t
-#define GET_VIEWPORT_MAT() 0
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() R200_CONTEXT(ctx)->swtcl.vertex_format
-#define GET_VERTEX_STORE() R200_CONTEXT(ctx)->swtcl.verts
-#define GET_VERTEX_STRIDE_SHIFT() R200_CONTEXT(ctx)->swtcl.vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 1
-#define HAVE_HW_DIVIDE (IND & ~(R200_XYZW_BIT|R200_RGBA_BIT))
-#define HAVE_TINY_VERTICES 1
-#define HAVE_RGBA_COLOR 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define CHECK_HW_DIVIDE (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE| \
- DD_TRI_UNFILLED)))
-
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS r200_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r200_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[R200_CONTEXT(ctx)->swtcl.SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[R200_CONTEXT(ctx)->swtcl.SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) r200_##x
-#define IND ~0
-#include "tnl_dd/t_dd_vb.c"
-#undef IND
-
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_TEX0_BIT|R200_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_TEX0_BIT|R200_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_TEX0_BIT|R200_TEX1_BIT|\
- R200_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_SPEC_BIT|\
- R200_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_SPEC_BIT|\
- R200_TEX0_BIT|R200_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_SPEC_BIT|\
- R200_TEX0_BIT|R200_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (R200_XYZW_BIT|R200_RGBA_BIT|R200_SPEC_BIT|\
- R200_TEX0_BIT|R200_TEX1_BIT|R200_PTEX_BIT)
-#define TAG(x) x##_wgfspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgt0();
- init_wgpt0();
- init_wgt0t1();
- init_wgpt0t1();
- init_wgfs();
- init_wgfst0();
- init_wgfspt0();
- init_wgfst0t1();
- init_wgfspt0t1();
-}
-
-
-
-void r200PrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & R200_XYZW_BIT) ? " xyzw," : "",
- (flags & R200_RGBA_BIT) ? " rgba," : "",
- (flags & R200_SPEC_BIT) ? " spec/fog," : "",
- (flags & R200_TEX0_BIT) ? " tex-0," : "",
- (flags & R200_TEX1_BIT) ? " tex-1," : "",
- (flags & R200_PTEX_BIT) ? " proj-tex," : "");
-}
-
-
-
-static void r200SetVertexFormat( GLcontext *ctx, GLuint ind )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- rmesa->swtcl.SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = r200_interp_extras;
- tnl->Driver.Render.CopyPV = r200_copy_pv_extras;
- }
- else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != rmesa->swtcl.vertex_format) {
- int i;
- R200_NEWPRIM(rmesa);
- i = rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
- rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
-
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = se_vtx_fmt_0[i];
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = se_vtx_fmt_1[i];
- }
-
- {
- GLuint vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL];
- GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL];
- GLuint needproj;
-
- /* HW perspective divide is a win, but tiny vertex formats are a
- * bigger one.
- */
- if (setup_tab[ind].vertex_format == TINY_VERTEX_FORMAT ||
- (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- needproj = GL_TRUE;
- vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
- vte &= ~R200_VTX_W0_FMT;
- vap |= R200_VAP_FORCE_W_TO_ONE;
- }
- else {
- needproj = GL_FALSE;
- vte &= ~(R200_VTX_XY_FMT | R200_VTX_Z_FMT);
- vte |= R200_VTX_W0_FMT;
- vap &= ~R200_VAP_FORCE_W_TO_ONE;
- }
-
- _tnl_need_projected_coords( ctx, needproj );
- if (vte != rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]) {
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] = vte;
- }
- if (vap != rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]) {
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] = vap;
- }
- }
-}
-
-static void r200RenderStart( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (!setup_tab[rmesa->swtcl.SetupIndex].check_tex_sizes(ctx)) {
- r200SetVertexFormat( ctx, rmesa->swtcl.SetupIndex | R200_PTEX_BIT);
- }
-
- if (rmesa->dma.flush != 0 &&
- rmesa->dma.flush != flush_last_swtcl_prim)
- rmesa->dma.flush( rmesa );
-}
-
-
-void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->swtcl.verts +
- (start << rmesa->swtcl.vertex_stride_shift));
- GLuint stride = 1 << rmesa->swtcl.vertex_stride_shift;
-
- newinputs |= rmesa->swtcl.SetupNewInputs;
- rmesa->swtcl.SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, v, stride );
-}
-
-
-void r200ChooseVertexState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLuint ind = (R200_XYZW_BIT | R200_RGBA_BIT);
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (ctx->Fog.Enabled || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
- ind |= R200_SPEC_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2) /* unit 1 enabled */
- ind |= R200_TEX0_BIT|R200_TEX1_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1) /* unit 1 enabled */
- ind |= R200_TEX0_BIT;
-
- r200SetVertexFormat( ctx, ind );
-}
-
-
-/* Flush vertices in the current dma region.
- */
-static void flush_last_swtcl_prim( r200ContextPtr rmesa )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->dma.flush = 0;
-
- if (rmesa->dma.current.buf) {
- struct r200_dma_region *current = &rmesa->dma.current;
- GLuint current_offset = (rmesa->r200Screen->gart_buffer_offset +
- current->buf->buf->idx * RADEON_BUFFER_SIZE +
- current->start);
-
- assert (!(rmesa->swtcl.hw_primitive & R200_VF_PRIM_WALK_IND));
-
- assert (current->start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- current->ptr);
-
- if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
- r200EmitVertexAOS( rmesa,
- rmesa->swtcl.vertex_size,
- current_offset);
-
- r200EmitVbufPrim( rmesa,
- rmesa->swtcl.hw_primitive,
- rmesa->swtcl.numverts);
- }
-
- rmesa->swtcl.numverts = 0;
- current->start = current->ptr;
- }
-}
-
-
-/* Alloc space in the current dma region.
- */
-static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa,
- int nverts, int vsize )
-{
- GLuint bytes = vsize * nverts;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- r200RefillCurrentDmaRegion( rmesa );
-
- if (!rmesa->dma.flush) {
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = flush_last_swtcl_prim;
- }
-
- ASSERT( vsize == rmesa->swtcl.vertex_size * 4 );
- ASSERT( rmesa->dma.flush == flush_last_swtcl_prim );
- ASSERT( rmesa->dma.current.start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- rmesa->dma.current.ptr );
-
-
- {
- GLubyte *head = (GLubyte *) (rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->dma.current.ptr += bytes;
- rmesa->swtcl.numverts += nverts;
- return head;
- }
-
-}
-
-
-
-
-void r200_emit_contiguous_verts( GLcontext *ctx, GLuint start, GLuint count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint vertex_size = rmesa->swtcl.vertex_size * 4;
- CARD32 *dest = r200AllocDmaLowVerts( rmesa, count-start, vertex_size );
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest,
- vertex_size );
-}
-
-
-
-void r200_emit_indexed_verts( GLcontext *ctx, GLuint start, GLuint count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- r200AllocDmaRegionVerts( rmesa,
- &rmesa->swtcl.indexed_verts,
- count - start,
- rmesa->swtcl.vertex_size * 4,
- 64);
-
- setup_tab[rmesa->swtcl.SetupIndex].emit(
- ctx, start, count,
- rmesa->swtcl.indexed_verts.address + rmesa->swtcl.indexed_verts.start,
- rmesa->swtcl.vertex_size * 4 );
-}
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 1
-#define HAVE_QUAD_STRIPS 1
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 1
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- 0,
- R200_VF_PRIM_LINE_STRIP,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLE_STRIP,
- R200_VF_PRIM_TRIANGLE_FAN,
- R200_VF_PRIM_QUADS,
- R200_VF_PRIM_QUAD_STRIP,
- R200_VF_PRIM_POLYGON
-};
-
-static __inline void r200DmaPrimitive( r200ContextPtr rmesa, GLenum prim )
-{
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim];
- assert(rmesa->dma.current.ptr == rmesa->dma.current.start);
-}
-
-static __inline void r200EltPrimitive( r200ContextPtr rmesa, GLenum prim )
-{
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim] | R200_VF_PRIM_WALK_IND;
-}
-
-
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
-}
-
-static void ELT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
-}
-
-
-#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx)
-#define ELTS_VARS GLushort *dest
-#define INIT( prim ) r200DmaPrimitive( rmesa, prim )
-#define ELT_INIT(prim) r200EltPrimitive( rmesa, prim )
-#define NEW_PRIMITIVE() R200_NEWPRIM( rmesa )
-#define NEW_BUFFER() r200RefillCurrentDmaRegion( rmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)rmesa->dma.current.end - (int)rmesa->dma.current.ptr) / (rmesa->swtcl.vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- ((RADEON_BUFFER_SIZE) / (rmesa->swtcl.vertex_size*4))
-
-#define GET_CURRENT_VB_MAX_ELTS() \
- ((R200_CMD_BUF_SZ - (rmesa->store.cmd_used + 16)) / 2)
-#define GET_SUBSEQUENT_VB_MAX_ELTS() \
- ((R200_CMD_BUF_SZ - 1024) / 2)
-
-
-
-/* How do you extend an existing primitive?
- */
-#define ALLOC_ELTS(nr) \
-do { \
- if (rmesa->dma.flush == r200FlushElts && \
- rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) { \
- \
- dest = (GLushort *)(rmesa->store.cmd_buf + \
- rmesa->store.cmd_used); \
- rmesa->store.cmd_used += nr*2; \
- } \
- else { \
- if (rmesa->dma.flush) { \
- rmesa->dma.flush( rmesa ); \
- } \
- \
- r200EmitVertexAOS( rmesa, \
- rmesa->swtcl.vertex_size, \
- (rmesa->r200Screen->gart_buffer_offset + \
- rmesa->swtcl.indexed_verts.buf->buf->idx * \
- RADEON_BUFFER_SIZE + \
- rmesa->swtcl.indexed_verts.start)); \
- \
- dest = r200AllocEltsOpenEnded( rmesa, \
- rmesa->swtcl.hw_primitive, \
- nr ); \
- } \
-} while (0)
-
-#define ALLOC_ELTS_NEW_PRIMITIVE(nr) ALLOC_ELTS( nr )
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0)
-#else
-#define EMIT_ELT(offset, x) (dest)[offset] = (GLushort) (x)
-#endif
-#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
-#define INCR_ELTS( nr ) dest += nr
-#define RELEASE_ELT_VERTS() \
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ )
-#define EMIT_VERTS( ctx, j, nr ) \
- r200_emit_contiguous_verts(ctx, j, (j)+(nr))
-#define EMIT_INDEXED_VERTS( ctx, start, count ) \
- r200_emit_indexed_verts( ctx, start, count )
-
-
-#define TAG(x) r200_dma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean r200_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
- render_func *tab = TAG(render_tab_verts);
-
- if (rmesa->swtcl.indexed_verts.buf && (!VB->Elts || stage->changed_inputs))
- RELEASE_ELT_VERTS();
-
-
-
- if ((R200_DEBUG & DEBUG_VERTS) || /* No debug */
- VB->ClipOrMask || /* No clipping */
- rmesa->swtcl.RenderIndex != 0 || /* No per-vertex manipulations */
- ctx->Line.StippleFlag) /* No stipple -- fix me? */
- return GL_TRUE;
-
- if (VB->Elts) {
- tab = TAG(render_tab_elts);
- if (!rmesa->swtcl.indexed_verts.buf)
- if (!TAG(emit_elt_verts)(ctx, 0, VB->Count))
- return GL_TRUE; /* too many vertices */
- }
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "r200_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
-
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-static void r200_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _r200_render_stage =
-{
- "r200 render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- r200_check_render, /* check - initially set to alloc data */
- r200_run_render /* run */
-};
-
-
-
-/**************************************************************************/
-
-
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES
-};
-
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim );
-static void r200ResetLineStipple( GLcontext *ctx );
-
-#undef HAVE_QUADS
-#define HAVE_QUADS 0
-
-#undef HAVE_QUAD_STRIPS
-#define HAVE_QUAD_STRIPS 0
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#undef LOCAL_VARS
-#define CTX_ARG r200ContextPtr rmesa
-#define CTX_ARG2 rmesa
-#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
-#define ALLOC_VERTS( n, size ) r200AllocDmaLowVerts( rmesa, n, size * 4 )
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
- const char *r200verts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (r200Vertex *)(r200verts + (x << shift))
-#define VERTEX r200Vertex
-#define DO_DEBUG_VERTS (1 && (R200_DEBUG & DEBUG_VERTS))
-#define PRINT_VERTEX(v) r200_print_vertex(rmesa->glCtx, v)
-#undef TAG
-#define TAG(x) r200_##x
-#include "tnl_dd/t_dd_triemit.h"
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define QUAD( a, b, c, d ) r200_quad( rmesa, a, b, c, d )
-#define TRI( a, b, c ) r200_triangle( rmesa, a, b, c )
-#define LINE( a, b ) r200_line( rmesa, a, b )
-#define POINT( a ) r200_point( rmesa, a )
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define R200_TWOSIDE_BIT 0x01
-#define R200_UNFILLED_BIT 0x02
-#define R200_MAX_TRIFUNC 0x04
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[R200_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK 0
-#define DO_UNFILLED (IND & R200_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & R200_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_OFFSET 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_INDEX 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (rmesa->swtcl.verts + (e<<rmesa->swtcl.vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) v->ui[coloroffset] = LE32_TO_CPU(*(GLuint *)c)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = CPU_TO_LE32(v[idx]->ui[coloroffset])
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = LE32_TO_CPU(color[idx])
-
-#define VERT_SET_SPEC( v0, c ) if (havespec) { \
- v0->v.specular.red = (c)[0]; \
- v0->v.specular.green = (c)[1]; \
- v0->v.specular.blue = (c)[2]; }
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; }
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = CPU_TO_LE32(v[idx]->ui[5])
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = LE32_TO_CPU(spec[idx])
-
-#undef LOCAL_VARS
-#undef TAG
-#undef INIT
-
-#define LOCAL_VARS(n) \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (rmesa->swtcl.vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (rmesa->swtcl.vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) r200RasterPrimitive( ctx, reduced_hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
-#undef TAG
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R200_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R200_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R200_TWOSIDE_BIT|R200_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_twoside();
- init_unfilled();
- init_twoside_unfilled();
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (r200Vertex *)(r200verts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- r200_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- r200_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- r200_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- r200_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- r200RenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
- const char *r200verts = (char *)rmesa->swtcl.verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) r200ResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) r200_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) r200_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-void r200ChooseRenderState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint index = 0;
- GLuint flags = ctx->_TriangleCaps;
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= R200_UNFILLED_BIT;
-
- if (index != rmesa->swtcl.RenderIndex) {
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = r200_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = r200_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = r200_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
-
- rmesa->swtcl.RenderIndex = index;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->swtcl.hw_primitive != hwprim) {
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hwprim;
- }
-}
-
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- rmesa->swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
- r200RasterPrimitive( ctx, reduced_hw_prim[prim] );
-}
-
-static void r200RenderFinish( GLcontext *ctx )
-{
-}
-
-static void r200ResetLineStipple( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- R200_STATECHANGE( rmesa, lin );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glBlendEquation",
- "glBlendFunc(mode != ADD)",
- "R200_NO_RAST",
- "Mixing GL_CLAMP_TO_BORDER and GL_CLAMP (or GL_MIRROR_CLAMP_ATI)"
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- R200_FIREVERTICES( rmesa );
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_RASTER, GL_TRUE );
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- rmesa->swtcl.RenderIndex = ~0;
- if (R200_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "R200 begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = r200RenderStart;
- tnl->Driver.Render.PrimitiveNotify = r200RenderPrimitive;
- tnl->Driver.Render.Finish = r200RenderFinish;
- tnl->Driver.Render.BuildVertices = r200BuildVertices;
- tnl->Driver.Render.ResetLineStipple = r200ResetLineStipple;
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_RASTER, GL_FALSE );
- if (rmesa->TclFallback) {
- /* These are already done if rmesa->TclFallback goes to
- * zero above. But not if it doesn't (R200_NO_TCL for
- * example?)
- */
- r200ChooseVertexState( ctx );
- r200ChooseRenderState( ctx );
- }
- if (R200_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "R200 end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-
-
-/* Cope with depth operations by drawing individual pixels as points???
- */
-void
-r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const GLfloat *rc = ctx->Current.RasterColor;
- GLint row, col;
- r200Vertex vert;
- GLuint orig_vte;
- GLuint h;
-
-
- /* Turn off tcl.
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_BITMAP, 1 );
-
- /* Choose tiny vertex format
- */
- r200SetVertexFormat( ctx, R200_XYZW_BIT | R200_RGBA_BIT );
-
- /* Ready for point primitives:
- */
- r200RenderPrimitive( ctx, GL_POINTS );
-
- /* Turn off the hw viewport transformation:
- */
- R200_STATECHANGE( rmesa, vte );
- orig_vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL];
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VPORT_X_SCALE_ENA |
- R200_VPORT_Y_SCALE_ENA |
- R200_VPORT_Z_SCALE_ENA |
- R200_VPORT_X_OFFSET_ENA |
- R200_VPORT_Y_OFFSET_ENA |
- R200_VPORT_Z_OFFSET_ENA);
-
- /* Turn off other stuff: Stipple?, texture?, blending?, etc.
- */
-
-
- /* Populate the vertex
- *
- * Incorporate FOG into RGBA
- */
- if (ctx->Fog.Enabled) {
- const GLfloat *fc = ctx->Fog.Color;
- GLfloat color[4];
- GLfloat f;
-
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- f = _mesa_z_to_fogfactor(ctx, ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
- else
- f = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
-
- color[0] = f * rc[0] + (1.F - f) * fc[0];
- color[1] = f * rc[1] + (1.F - f) * fc[1];
- color[2] = f * rc[2] + (1.F - f) * fc[2];
- color[3] = rc[3];
-
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.red, color[0]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.green, color[1]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.blue, color[2]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.alpha, color[3]);
- }
- else {
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.red, rc[0]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.green, rc[1]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.blue, rc[2]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.alpha, rc[3]);
- }
-
-
- vert.tv.z = ctx->Current.RasterPos[2];
-
-
- /* Update window height
- */
- LOCK_HARDWARE( rmesa );
- UNLOCK_HARDWARE( rmesa );
- h = rmesa->dri.drawable->h + rmesa->dri.drawable->y;
- px += rmesa->dri.drawable->x;
-
- /* Clipping handled by existing mechansims in r200_ioctl.c?
- */
- for (row=0; row<height; row++) {
- const GLubyte *src = (const GLubyte *)
- _mesa_image_address( unpack, bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
-
- if (unpack->LsbFirst) {
- /* Lsb first */
- GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
- for (col=0; col<width; col++) {
- if (*src & mask) {
- vert.tv.x = px+col;
- vert.tv.y = h - (py+row) - 1;
- r200_point( rmesa, &vert );
- }
- src += (mask >> 7);
- mask = ((mask << 1) & 0xff) | (mask >> 7);
- }
-
- /* get ready for next row */
- if (mask != 1)
- src++;
- }
- else {
- /* Msb first */
- GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
- for (col=0; col<width; col++) {
- if (*src & mask) {
- vert.tv.x = px+col;
- vert.tv.y = h - (py+row) - 1;
- r200_point( rmesa, &vert );
- }
- src += mask & 1;
- mask = ((mask << 7) & 0xff) | (mask >> 1);
- }
- /* get ready for next row */
- if (mask != 128)
- src++;
- }
- }
-
- /* Fire outstanding vertices, restore state
- */
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] = orig_vte;
-
- /* Unfallback
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_BITMAP, 0 );
-
- /* Need to restore vertexformat?
- */
- if (rmesa->TclFallback)
- r200ChooseVertexState( ctx );
-}
-
-
-void r200FlushVertices( GLcontext *ctx, GLuint flags )
-{
- _tnl_flush_vertices( ctx, flags );
-
- if (flags & FLUSH_STORED_VERTICES)
- R200_NEWPRIM( R200_CONTEXT( ctx ) );
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void r200InitSwtcl( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_setup_tab();
- firsttime = 0;
- }
-
- tnl->Driver.Render.Start = r200RenderStart;
- tnl->Driver.Render.Finish = r200RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = r200RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = r200ResetLineStipple;
- tnl->Driver.Render.BuildVertices = r200BuildVertices;
-
- rmesa->swtcl.verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 );
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->swtcl.render_primitive = GL_TRIANGLES;
- rmesa->swtcl.hw_primitive = 0;
-}
-
-
-void r200DestroySwtcl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->swtcl.indexed_verts.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ );
-
- if (rmesa->swtcl.verts) {
- ALIGN_FREE(rmesa->swtcl.verts);
- rmesa->swtcl.verts = 0;
- }
-
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h b/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h
deleted file mode 100644
index f183b931c..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SWTCL_H__
-#define __R200_SWTCL_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "r200_context.h"
-
-extern void r200InitSwtcl( GLcontext *ctx );
-extern void r200DestroySwtcl( GLcontext *ctx );
-
-extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
-extern void r200ChooseRenderState( GLcontext *ctx );
-extern void r200ChooseVertexState( GLcontext *ctx );
-
-extern void r200CheckTexSizes( GLcontext *ctx );
-
-extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void r200PrintSetupFlags(char *msg, GLuint flags );
-
-
-extern void r200_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void r200_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void r200_translate_vertex( GLcontext *ctx,
- const r200Vertex *src,
- SWvertex *dst );
-
-extern void r200_print_vertex( GLcontext *ctx, const r200Vertex *v );
-
-extern void r200_import_float_colors( GLcontext *ctx );
-extern void r200_import_float_spec_colors( GLcontext *ctx );
-
-extern void r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c b/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c
deleted file mode 100644
index 873163c72..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.c,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
-
-
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_LOOP 0
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 0 /* hw quad verts in wrong order??? */
-#define HAVE_QUAD_STRIPS 1
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 1
-
-
-#define HW_POINTS R200_VF_PRIM_POINTS
-#define HW_LINES R200_VF_PRIM_LINES
-#define HW_LINE_LOOP 0
-#define HW_LINE_STRIP R200_VF_PRIM_LINE_STRIP
-#define HW_TRIANGLES R200_VF_PRIM_TRIANGLES
-#define HW_TRIANGLE_STRIP_0 R200_VF_PRIM_TRIANGLE_STRIP
-#define HW_TRIANGLE_STRIP_1 0
-#define HW_TRIANGLE_FAN R200_VF_PRIM_TRIANGLE_FAN
-#define HW_QUADS R200_VF_PRIM_QUADS
-#define HW_QUAD_STRIP R200_VF_PRIM_QUAD_STRIP
-#define HW_POLYGON R200_VF_PRIM_POLYGON
-
-
-static GLboolean discrete_prim[0x10] = {
- 0, /* 0 none */
- 1, /* 1 points */
- 1, /* 2 lines */
- 0, /* 3 line_strip */
- 1, /* 4 tri_list */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 0, /* 7 tri_w_flags */
- 1, /* 8 rect list (unused) */
- 1, /* 9 3vert point */
- 1, /* a 3vert line */
- 0, /* b point sprite */
- 0, /* c line loop */
- 1, /* d quads */
- 0, /* e quad strip */
- 0, /* f polygon */
-};
-
-
-#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx)
-#define ELT_TYPE GLushort
-
-#define ELT_INIT(prim, hw_prim) \
- r200TclPrimitive( ctx, prim, hw_prim | R200_VF_PRIM_WALK_IND )
-
-#define GET_MESA_ELTS() rmesa->tcl.Elts
-
-
-/* Don't really know how many elts will fit in what's left of cmdbuf,
- * as there is state to emit, etc:
- */
-
-/* Testing on isosurf shows a maximum around here. Don't know if it's
- * the card or driver or kernel module that is causing the behaviour.
- */
-#define GET_MAX_HW_ELTS() 300
-
-#define RESET_STIPPLE() do { \
- R200_STATECHANGE( rmesa, lin ); \
- r200EmitState( rmesa ); \
-} while (0)
-
-#define AUTO_STIPPLE( mode ) do { \
- R200_STATECHANGE( rmesa, lin ); \
- if (mode) \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] |= \
- R200_LINE_PATTERN_AUTO_RESET; \
- else \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] &= \
- ~R200_LINE_PATTERN_AUTO_RESET; \
- r200EmitState( rmesa ); \
-} while (0)
-
-
-#define ALLOC_ELTS(nr) r200AllocElts( rmesa, nr )
-
-static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr )
-{
- if (rmesa->dma.flush == r200FlushElts &&
- rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) {
-
- GLushort *dest = (GLushort *)(rmesa->store.cmd_buf +
- rmesa->store.cmd_used);
-
- rmesa->store.cmd_used += nr*2;
-
- return dest;
- }
- else {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- r200EmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components, 0 );
-
- return r200AllocEltsOpenEnded( rmesa, rmesa->tcl.hw_primitive, nr );
- }
-}
-
-
-#define CLOSE_ELTS() \
-do { \
- if (0) R200_NEWPRIM( rmesa ); \
-} \
-while (0)
-
-
-/* TODO: Try to extend existing primitive if both are identical,
- * discrete and there are no intervening state changes. (Somewhat
- * duplicates changes to DrawArrays code)
- */
-static void EMIT_PRIM( GLcontext *ctx,
- GLenum prim,
- GLuint hwprim,
- GLuint start,
- GLuint count)
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- r200TclPrimitive( ctx, prim, hwprim );
-
- r200EmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components,
- start );
-
- /* Why couldn't this packet have taken an offset param?
- */
- r200EmitVbufPrim( rmesa,
- rmesa->tcl.hw_primitive,
- count - start );
-}
-
-
-
-/* Try & join small primitives
- */
-#if 0
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) 0
-#else
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) \
- ((NR) < 20 || \
- ((NR) < 40 && \
- rmesa->tcl.hw_primitive == (PRIM| \
- R200_VF_TCL_OUTPUT_VTX_ENABLE| \
- R200_VF_PRIM_WALK_IND)))
-#endif
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(dest, offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0)
-#else
-#define EMIT_ELT(dest, offset, x) (dest)[offset] = (GLushort) (x)
-#endif
-
-#define EMIT_TWO_ELTS(dest, offset, x, y) *(GLuint *)((dest)+offset) = ((y)<<16)|(x);
-
-
-
-#define TAG(x) tcl_##x
-#include "tnl_dd/t_dd_dmatmp2.h"
-
-/**********************************************************************/
-/* External entrypoints */
-/**********************************************************************/
-
-void r200EmitPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void r200EmitEltPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void r200TclPrimitive( GLcontext *ctx,
- GLenum prim,
- int hw_prim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
-
- if (newprim != rmesa->tcl.hw_primitive ||
- !discrete_prim[hw_prim&0xf]) {
- R200_NEWPRIM( rmesa );
- rmesa->tcl.hw_primitive = newprim;
- }
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-/* TCL render.
- */
-static GLboolean r200_run_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i,flags = 0,length;
-
- /* TODO: separate this from the swtnl pipeline
- */
- if (rmesa->TclFallback)
- return GL_TRUE; /* fallback to software t&l */
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (VB->Count == 0)
- return GL_FALSE;
-
- r200ReleaseArrays( ctx, ~0 /* stage->changed_inputs */ );
- r200EmitArrays( ctx, stage->inputs );
-
- rmesa->tcl.Elts = VB->Elts;
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: prim %s %d..%d\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
-
- if (!length)
- continue;
-
- if (rmesa->tcl.Elts)
- r200EmitEltPrimitive( ctx, i, i+length, flags );
- else
- r200EmitPrimitive( ctx, i, i+length, flags );
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-static void r200_check_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint inputs = VERT_BIT_POS;
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (ctx->RenderMode == GL_RENDER) {
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- inputs |= VERT_BIT_NORMAL;
-
- if (1 || ctx->Light.ColorMaterialEnabled) {
- inputs |= VERT_BIT_COLOR0;
- }
- }
- else {
- inputs |= VERT_BIT_COLOR0;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_BIT_COLOR1;
- }
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- inputs |= VERT_BIT_NORMAL;
- }
- } else {
- inputs |= VERT_BIT_TEX0;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- inputs |= VERT_BIT_NORMAL;
- }
- } else {
- inputs |= VERT_BIT_TEX1;
- }
- }
-
- stage->inputs = inputs;
- stage->active = 1;
- }
- else
- stage->active = 0;
-}
-
-static void r200_init_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- stage->check = r200_check_tcl_render;
- stage->check( ctx, stage );
-}
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-/* Initial state for tcl stage.
- */
-const struct gl_pipeline_stage _r200_tcl_stage =
-{
- "r200 render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_LIGHT|
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- r200_init_tcl_render, /* check - initially set to alloc data */
- r200_run_tcl_render /* run */
-};
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-
-/*-----------------------------------------------------------------------
- * Manage TCL fallbacks
- */
-
-
-static void transition_to_swtnl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.vertex_format = 0;
-
- r200ChooseVertexState( ctx );
- r200ChooseRenderState( ctx );
-
- _mesa_validate_all_lighting_tables( ctx );
-
- tnl->Driver.NotifyMaterialChange =
- _mesa_validate_all_lighting_tables;
-
- r200ReleaseArrays( ctx, ~0 );
-
- /* Still using the D3D based hardware-rasterizer from the radeon;
- * need to put the card into D3D mode to make it work:
- */
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_TCL_ENABLE;
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_D3D_TEX_DEFAULT;
-
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~R200_VTX_W0_FMT;
-
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_RE_CNTL] |= (R200_VTX_STQ0_D3D |
- R200_VTX_STQ1_D3D);
-}
-
-
-static void transition_to_hwtnl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- r200UpdateMaterial( ctx );
-
- tnl->Driver.NotifyMaterialChange = r200UpdateMaterial;
-
- if ( rmesa->dma.flush )
- rmesa->dma.flush( rmesa );
-
- rmesa->dma.flush = 0;
- rmesa->swtcl.vertex_format = 0;
-
- if (rmesa->swtcl.indexed_verts.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE;
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~(R200_VAP_FORCE_W_TO_ONE |
- R200_VAP_D3D_TEX_DEFAULT);
-
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT);
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] |= R200_VTX_W0_FMT;
-
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_RE_CNTL] &= ~(R200_VTX_STQ0_D3D |
- R200_VTX_STQ1_D3D);
-
-
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 end tcl fallback\n");
-}
-
-
-static char *fallbackStrings[] = {
- "Rasterization fallback",
- "Unfilled triangles",
- "Twosided lighting, differing materials",
- "Materials in VB (maybe between begin/end)",
- "Texgen unit 0",
- "Texgen unit 1",
- "Texgen unit 2",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint oldfallback = rmesa->TclFallback;
-
- if (mode) {
- rmesa->TclFallback |= bit;
- if (oldfallback == 0) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 begin tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_swtnl( ctx );
- }
- }
- else {
- rmesa->TclFallback &= ~bit;
- if (oldfallback == bit) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 end tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_hwtnl( ctx );
- }
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.h b/xc/lib/GL/mesa/src/drv/r200/r200_tcl.h
deleted file mode 100644
index 0fdf9c22c..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TCL_H__
-#define __R200_TCL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-extern void r200TclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void r200EmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-extern void r200EmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-
-extern void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-
-#define R200_TCL_FALLBACK_RASTER 0x1 /* rasterization */
-#define R200_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
-#define R200_TCL_FALLBACK_LIGHT_TWOSIDE 0x4 /* twoside tris */
-#define R200_TCL_FALLBACK_MATERIAL 0x8 /* material in vb */
-#define R200_TCL_FALLBACK_TEXGEN_0 0x10 /* texgen, unit 0 */
-#define R200_TCL_FALLBACK_TEXGEN_1 0x20 /* texgen, unit 1 */
-#define R200_TCL_FALLBACK_TEXGEN_2 0x40 /* texgen, unit 2 */
-#define R200_TCL_FALLBACK_TCL_DISABLE 0x80 /* user disable */
-#define R200_TCL_FALLBACK_BITMAP 0x100 /* draw bitmap with points */
-
-#define R200_MAX_TCL_VERTSIZE (4*4) /* using maos now... */
-
-#define TCL_FALLBACK( ctx, bit, mode ) r200TclFallback( ctx, bit, mode )
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c b/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
deleted file mode 100644
index 824419434..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "image.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "texutil.h"
-#include "texmem.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-
-#include "xmlpool.h"
-
-
-
-/**
- * Set the texture wrap modes.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap, GLenum rwrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_border = GL_FALSE;
-
- t->pp_txfilter &= ~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK | R200_BORDER_MODE_D3D);
-
- switch ( swrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= R200_CLAMP_S_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR;
- break;
- case GL_MIRROR_CLAMP_ATI:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_ATI:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_LAST;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch ( twrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= R200_CLAMP_T_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL | R200_BORDER_MODE_D3D;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR;
- break;
- case GL_MIRROR_CLAMP_ATI:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_ATI:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_LAST;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- t->pp_txformat_x &= ~R200_CLAMP_Q_MASK;
-
- switch ( rwrap ) {
- case GL_REPEAT:
- t->pp_txformat_x |= R200_CLAMP_Q_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR;
- break;
- case GL_MIRROR_CLAMP_ATI:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_ATI:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_LAST;
- break;
- default:
- _mesa_problem(NULL, "bad R wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp_to_border ) {
- t->pp_txfilter |= R200_BORDER_MODE_D3D;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_border);
-}
-
-static void r200SetTexMaxAnisotropy( r200TexObjPtr t, GLfloat max )
-{
- t->pp_txfilter &= ~R200_MAX_ANISO_MASK;
-
- if ( max == 1.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_1_TO_1;
- } else if ( max <= 2.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_2_TO_1;
- } else if ( max <= 4.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_4_TO_1;
- } else if ( max <= 8.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_8_TO_1;
- } else {
- t->pp_txfilter |= R200_MAX_ANISO_16_TO_1;
- }
-}
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void r200SetTexFilter( r200TexObjPtr t, GLenum minf, GLenum magf )
-{
- GLuint anisotropy = (t->pp_txfilter & R200_MAX_ANISO_MASK);
-
- t->pp_txfilter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
- t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK;
-
- if ( anisotropy == R200_MAX_ANISO_1_TO_1 ) {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
- } else {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
- break;
- }
- }
-
- /* Note we don't have 3D mipmaps so only use the mag filter setting
- * to set the 3D texture filter mode.
- */
- switch ( magf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MAG_FILTER_NEAREST;
- t->pp_txformat_x |= R200_VOLUME_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MAG_FILTER_LINEAR;
- t->pp_txformat_x |= R200_VOLUME_FILTER_LINEAR;
- break;
- }
-}
-
-static void r200SetTexBorderColor( r200TexObjPtr t, GLubyte c[4] )
-{
- t->pp_border_color = r200PackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static r200TexObjPtr r200AllocTexObj( struct gl_texture_object *texObj )
-{
- r200TexObjPtr t;
-
- t = CALLOC_STRUCT( r200_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, texObj, t );
- }
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->border_fallback = GL_FALSE;
-
- make_empty_list( & t->base );
-
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
- r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r200SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static const struct gl_texture_format *
-r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- default:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
- default:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_al88;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- /* At the moment, glean & conform both fail using the i8 internal
- * format.
- */
- return &_mesa_texformat_al88;
-/* return &_mesa_texformat_i8; */
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-static GLboolean
-r200ValidateClientStorage( GLcontext *ctx, GLenum target,
- GLint internalFormat,
- GLint srcWidth, GLint srcHeight,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int texelBytes;
-
- if (0)
- fprintf(stderr, "intformat %s format %s type %s\n",
- _mesa_lookup_enum_by_nr( internalFormat ),
- _mesa_lookup_enum_by_nr( format ),
- _mesa_lookup_enum_by_nr( type ));
-
- if (!ctx->Unpack.ClientStorage)
- return 0;
-
- if (ctx->_ImageTransferState ||
- texImage->IsCompressed ||
- texObj->GenerateMipmap)
- return 0;
-
-
- /* This list is incomplete, may be different on ppc???
- */
- switch ( internalFormat ) {
- case GL_RGBA:
- if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- texImage->TexFormat = &_mesa_texformat_argb8888;
- texelBytes = 4;
- }
- else
- return 0;
- break;
-
- case GL_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- texImage->TexFormat = &_mesa_texformat_rgb565;
- texelBytes = 2;
- }
- else
- return 0;
- break;
-
- case GL_YCBCR_MESA:
- if ( format == GL_YCBCR_MESA &&
- type == GL_UNSIGNED_SHORT_8_8_REV_APPLE ) {
- texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
- texelBytes = 2;
- }
- else if ( format == GL_YCBCR_MESA &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)) {
- texImage->TexFormat = &_mesa_texformat_ycbcr;
- texelBytes = 2;
- }
- else
- return 0;
- break;
-
-
- default:
- return 0;
- }
-
- /* Could deal with these packing issues, but currently don't:
- */
- if (packing->SkipPixels ||
- packing->SkipRows ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- return 0;
- }
-
- {
- GLint srcRowStride = _mesa_image_row_stride(packing, srcWidth,
- format, type);
-
-
- if (0)
- fprintf(stderr, "%s: srcRowStride %d/%x\n",
- __FUNCTION__, srcRowStride, srcRowStride);
-
- /* Could check this later in upload, pitch restrictions could be
- * relaxed, but would need to store the image pitch somewhere,
- * as packing details might change before image is uploaded:
- */
- if (!r200IsGartMemory( rmesa, pixels, srcHeight * srcRowStride ) ||
- (srcRowStride & 63))
- return 0;
-
-
- /* Have validated that _mesa_transfer_teximage would be a straight
- * memcpy at this point. NOTE: future calls to TexSubImage will
- * overwrite the client data. This is explicitly mentioned in the
- * extension spec.
- */
- texImage->Data = (void *)pixels;
- texImage->IsClientData = GL_TRUE;
- texImage->RowStride = srcRowStride / texelBytes;
- return 1;
- }
-}
-
-
-static void r200TexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage1d(ctx, target, level, internalFormat,
- width, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r200TexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
- if (r200ValidateClientStorage( ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r200ChooseTextureFormat.
- */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-
-static void r200TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-#if ENABLE_HW_3D_TEXTURE
-static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
-#if 0
- if (r200ValidateClientStorage( ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else
-#endif
- {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r200ChooseTextureFormat.
- */
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
- width, height, depth, border,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
- }
-}
-#endif
-
-
-#if ENABLE_HW_3D_TEXTURE
-static void
-r200TexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = r200AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
- return;
- }
- texObj->DriverData = t;
- }
-
- _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, packing, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-#endif
-
-
-
-static void r200TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( R200_DEBUG & DEBUG_STATE ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- /* This is incorrect: Need to maintain this data for each of
- * GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
- * between them according to _ReallyEnabled.
- */
- switch ( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
- GLuint envColor;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- envColor = r200PackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] != envColor ) {
- R200_STATECHANGE( rmesa, tf );
- rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] = envColor;
- }
- break;
- }
-
- case GL_TEXTURE_LOD_BIAS_EXT: {
- GLfloat bias;
- GLuint b;
- const int fixed_one = 0x8000000;
-
- /* The R200's LOD bias is a signed 2's complement value with a
- * range of -16.0 <= bias < 16.0.
- *
- * NOTE: Add a small bias to the bias for conform mipsel.c test.
- */
- bias = *param + .01;
- bias = CLAMP( bias, -16.0, 16.0 );
- b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
-
- if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
- R200_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] &= ~R200_LOD_BIAS_MASK;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] |= b;
- }
- break;
- }
-
- default:
- return;
- }
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void r200TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params )
-{
- r200TexObjPtr t = (r200TexObjPtr) texObj->DriverData;
-
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( pname ) );
- }
-
- if ( ( target != GL_TEXTURE_2D ) &&
- ( target != GL_TEXTURE_1D ) )
- return;
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- r200SetTexBorderColor( t, texObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- /* Mark this texobj as dirty (one bit per tex unit)
- */
- t->dirty_state = TEX_ALL;
-}
-
-
-
-static void r200BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, texObj,
- ctx->Texture.CurrentUnit );
- }
-
- if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
- if ( texObj->DriverData == NULL ) {
- r200AllocTexObj( texObj );
- }
- }
-}
-
-static void r200DeleteTexture( GLcontext *ctx,
- struct gl_texture_object *texObj )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, texObj,
- _mesa_lookup_enum_by_nr( texObj->Target ) );
- }
-
- if ( t != NULL ) {
- if ( rmesa ) {
- R200_FIREVERTICES( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void r200TexGen( GLcontext *ctx,
- GLenum coord,
- GLenum pname,
- const GLfloat *params )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- rmesa->recheck_texgen[unit] = GL_TRUE;
-}
-
-
-void r200InitTextureFuncs( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
-
- ctx->Driver.ChooseTextureFormat = r200ChooseTextureFormat;
- ctx->Driver.TexImage1D = r200TexImage1D;
- ctx->Driver.TexImage2D = r200TexImage2D;
-#if ENABLE_HW_3D_TEXTURE
- ctx->Driver.TexImage3D = r200TexImage3D;
-#else
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
-#endif
- ctx->Driver.TexSubImage1D = r200TexSubImage1D;
- ctx->Driver.TexSubImage2D = r200TexSubImage2D;
-#if ENABLE_HW_3D_TEXTURE
- ctx->Driver.TexSubImage3D = r200TexSubImage3D;
-#else
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-#endif
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.BindTexture = r200BindTexture;
- ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */
- ctx->Driver.DeleteTexture = r200DeleteTexture;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
- ctx->Driver.ActiveTexture = NULL;
- ctx->Driver.UpdateTexturePalette = NULL;
-
- ctx->Driver.TexEnv = r200TexEnv;
- ctx->Driver.TexParameter = r200TexParameter;
- ctx->Driver.TexGen = r200TexGen;
-
- driInitTextureObjects( ctx, & rmesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_1D
- | DRI_TEXMGR_DO_TEXTURE_2D );
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tex.h b/xc/lib/GL/mesa/src/drv/r200/r200_tex.h
deleted file mode 100644
index a4301206e..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tex.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TEX_H__
-#define __R200_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r200UpdateTextureState( GLcontext *ctx );
-
-extern int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face );
-
-extern void r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t );
-
-extern void r200InitTextureFuncs( GLcontext *ctx );
-
-#endif
-#endif /* __R200_TEX_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c b/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c
deleted file mode 100644
index 43286aeb0..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */
-/**************************************************************************
-
-Copyright (C) Tungsten Graphics 2002. All Rights Reserved.
-The Weather Channel, Inc. funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86
-license. This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation on the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR THEIR
-SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "radeon_reg.h" /* gets definition for usleep */
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-
-#include <unistd.h> /* for usleep() */
-
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
-{
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->base.tObj );
- }
-
- if ( rmesa != NULL ) {
- unsigned i;
-
-
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == rmesa->state.texture.unit[i].texobj ) {
- rmesa->state.texture.unit[i].texobj = NULL;
- remove_from_list( &rmesa->hw.tex[i] );
- make_empty_list( &rmesa->hw.tex[i] );
- remove_from_list( &rmesa->hw.cube[i] );
- make_empty_list( &rmesa->hw.cube[i] );
- }
- }
- }
-}
-
-
-/* ------------------------------------------------------------
- * Texture image conversions
- */
-
-
-static void r200UploadGARTClientSubImage( r200ContextPtr rmesa,
- r200TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint hwlevel,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- GLuint srcPitch, dstPitch;
- int blit_format;
- int srcOffset;
-
- /*
- * XXX it appears that we always upload the full image, not a subimage.
- * I.e. x==0, y==0, width=texWidth, height=texWidth. If this is ever
- * changed, the src pitch will have to change.
- */
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- default:
- return;
- }
-
- t->image[0][hwlevel].data = texImage->Data;
- srcOffset = r200GartOffsetFromVirtual( rmesa, texImage->Data );
-
- assert( srcOffset != ~0 );
-
- /* Don't currently need to cope with small pitches?
- */
- width = texImage->Width;
- height = texImage->Height;
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- r200EmitBlit( rmesa, blit_format,
- srcPitch,
- srcOffset,
- dstPitch,
- t->bufAddr,
- x,
- y,
- t->image[0][hwlevel].x + x,
- t->image[0][hwlevel].y + y,
- width,
- height );
-
- r200EmitWait( rmesa, RADEON_WAIT_2D );
-}
-
-static void r200UploadRectSubImage( r200ContextPtr rmesa,
- r200TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, dstPitch, done;
-
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
- t->image[0][0].data = texImage->Data;
-
- /* Currently don't need to cope with small pitches.
- */
- width = texImage->Width;
- height = texImage->Height;
- dstPitch = t->pp_txpitch + 32;
-
- if (rmesa->prefer_gart_client_texturing && texImage->IsClientData) {
- /* In this case, could also use GART texturing. This is
- * currently disabled, but has been tested & works.
- */
- t->pp_txoffset = r200GartOffsetFromVirtual( rmesa, texImage->Data );
- t->pp_txpitch = texImage->RowStride * texFormat->TexelBytes - 32;
-
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Using GART texturing for rectangular client texture\n");
-
- /* Release FB memory allocated for this image:
- */
- /* FIXME This may not be correct as driSwapOutTextureObject sets
- * FIXME dirty_images. It may be fine, though.
- */
- if ( t->base.memBlock ) {
- driSwapOutTextureObject( (driTextureObject *) t );
- }
- }
- else if (texImage->IsClientData) {
- /* Data already in GART memory, with usable pitch.
- */
- GLuint srcPitch;
- srcPitch = texImage->RowStride * texFormat->TexelBytes;
- r200EmitBlit( rmesa,
- blit_format,
- srcPitch,
- r200GartOffsetFromVirtual( rmesa, texImage->Data ),
- dstPitch, t->bufAddr,
- 0, 0,
- 0, 0,
- width, height );
- }
- else {
- /* Data not in GART memory, or bad pitch.
- */
- for (done = 0; done < height ; ) {
- struct r200_dma_region region;
- int lines = MIN2( height - done, RADEON_BUFFER_SIZE / dstPitch );
- int src_pitch;
- char *tex;
-
- src_pitch = texImage->RowStride * texFormat->TexelBytes;
-
- tex = (char *)texImage->Data + done * src_pitch;
-
- memset(&region, 0, sizeof(region));
- r200AllocDmaRegion( rmesa, &region, lines * dstPitch, 64 );
-
- /* Copy texdata to dma:
- */
- if (0)
- fprintf(stderr, "%s: src_pitch %d dst_pitch %d\n",
- __FUNCTION__, src_pitch, dstPitch);
-
- if (src_pitch == dstPitch) {
- memcpy( region.address, tex, lines * src_pitch );
- }
- else {
- char *buf = region.address;
- int i;
- for (i = 0 ; i < lines ; i++) {
- memcpy( buf, tex, src_pitch );
- buf += dstPitch;
- tex += src_pitch;
- }
- }
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- /* Blit to framebuffer
- */
- r200EmitBlit( rmesa,
- blit_format,
- dstPitch, GET_START( &region ),
- dstPitch, t->bufAddr,
- 0, 0,
- 0, done,
- width, lines );
-
- r200EmitWait( rmesa, RADEON_WAIT_2D );
-
- r200ReleaseDmaRegion( rmesa, &region, __FUNCTION__ );
- done += lines;
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t,
- GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height,
- GLuint face )
-{
- struct gl_texture_image *texImage = NULL;
- GLuint offset;
- GLint imageWidth, imageHeight;
- GLint ret;
- drmRadeonTexture tex;
- drmRadeonTexImage tmp;
- const int level = hwlevel + t->base.firstLevel;
-
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, t, t->base.tObj, level, width, height, face );
- }
-
- ASSERT(face < 6);
-
- /* Ensure we have a valid texture to upload */
- if ( ( hwlevel < 0 ) || ( hwlevel >= RADEON_MAX_TEXTURE_LEVELS ) ) {
- _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
- return;
- }
-
- switch (face) {
- case 0:
- texImage = t->base.tObj->Image[level];
- break;
- case 1:
- texImage = t->base.tObj->NegX[level];
- break;
- case 2:
- texImage = t->base.tObj->PosY[level];
- break;
- case 3:
- texImage = t->base.tObj->NegY[level];
- break;
- case 4:
- texImage = t->base.tObj->PosZ[level];
- break;
- case 5:
- texImage = t->base.tObj->NegZ[level];
- break;
- }
-
- if ( !texImage ) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: texImage %d is NULL!\n", __FUNCTION__, level );
- return;
- }
- if ( !texImage->Data ) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is NULL!\n", __FUNCTION__ );
- return;
- }
-
-
- if (t->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- assert(level == 0);
- assert(hwlevel == 0);
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is rectangular\n", __FUNCTION__);
- r200UploadRectSubImage( rmesa, t, texImage, x, y, width, height );
- return;
- }
- else if (texImage->IsClientData) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is in GART client storage\n",
- __FUNCTION__);
- r200UploadGARTClientSubImage( rmesa, t, texImage, hwlevel,
- x, y, width, height );
- return;
- }
- else if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is in normal memory\n",
- __FUNCTION__);
-
-
- imageWidth = texImage->Width;
- imageHeight = texImage->Height;
-
- offset = t->bufAddr;
-
- if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- GLint imageX = 0;
- GLint imageY = 0;
- GLint blitX = t->image[face][hwlevel].x;
- GLint blitY = t->image[face][hwlevel].y;
- GLint blitWidth = t->image[face][hwlevel].width;
- GLint blitHeight = t->image[face][hwlevel].height;
- fprintf( stderr, " upload image: %d,%d at %d,%d\n",
- imageWidth, imageHeight, imageX, imageY );
- fprintf( stderr, " upload blit: %d,%d at %d,%d\n",
- blitWidth, blitHeight, blitX, blitY );
- fprintf( stderr, " blit ofs: 0x%07x level: %d/%d\n",
- (GLuint)offset, hwlevel, level );
- }
-
- t->image[face][hwlevel].data = texImage->Data;
-
- /* Init the DRM_RADEON_TEXTURE command / drmRadeonTexture struct.
- * NOTE: we're always use a 1KB-wide blit and I8 texture format.
- * We used to use 1, 2 and 4-byte texels and used to use the texture
- * width to dictate the blit width - but that won't work for compressed
- * textures. (Brian)
- */
- tex.offset = offset;
- tex.pitch = BLIT_WIDTH_BYTES / 64;
- tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */
- if (texImage->TexFormat->TexelBytes) {
- tex.width = imageWidth * texImage->TexFormat->TexelBytes; /* in bytes */
- tex.height = imageHeight;
- }
- else {
- tex.width = imageWidth; /* compressed */
- tex.height = imageHeight;
- if (tex.height < 4)
- tex.height = 4;
- }
- tex.image = &tmp;
-
- /* copy (x,y,width,height,data) */
- memcpy( &tmp, &t->image[face][hwlevel], sizeof(drmRadeonTexImage) );
-
- LOCK_HARDWARE( rmesa );
- do {
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,
- &tex, sizeof(drmRadeonTexture) );
- if (ret) {
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "DRM_RADEON_TEXTURE: again!\n");
- usleep(1);
- }
- } while ( ret && errno == EAGAIN );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret );
- fprintf( stderr, " offset=0x%08x\n",
- offset );
- fprintf( stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight );
- fprintf( stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width, t->image[face][hwlevel].height,
- t->image[face][hwlevel].data );
- exit( 1 );
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param rmesa Context pointer
- * \param t Texture to be uploaded
- * \param face Cube map face to be uploaded. Zero for non-cube maps.
- */
-
-int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face )
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- rmesa->glCtx, t->base.tObj, t->base.totalSize,
- t->base.firstLevel, t->base.lastLevel );
- }
-
- if ( !t || t->base.totalSize == 0 )
- return 0;
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- r200Finish( rmesa->glCtx );
- }
-
- LOCK_HARDWARE( rmesa );
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return -1;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->r200Screen->texOffset[heap]
- + t->base.memBlock->ofs;
- t->pp_txoffset = t->bufAddr;
-
-
- /* Mark this texobj as dirty on all units:
- */
- t->dirty_state = TEX_ALL;
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
- for ( i = 0 ; i < numLevels ; i++ ) {
- if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) {
- uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width,
- t->image[face][i].height, face );
- }
- }
- t->base.dirty_images[face] = 0;
- }
-
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- r200Finish( rmesa->glCtx );
- }
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c b/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c
deleted file mode 100644
index 3d82aac32..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c
+++ /dev/null
@@ -1,1780 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-#include "enums.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-
-
-#define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88
-#define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422
-#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
- && (tx_table[f].format != 0xffffffff) )
-
-static const struct {
- GLuint format, filter;
-}
-tx_table[] =
-{
- _ALPHA(RGBA8888),
- _ALPHA(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA(AL88),
- _INVALID(A8),
- _INVALID(L8),
- _COLOR(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
-};
-
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
-
-/**
- * This function computes the number of bytes of storage needed for
- * the given texture object (all mipmap levels, all cube faces).
- * The \c image[face][level].x/y/width/height parameters for upload/blitting
- * are computed here. \c pp_txfilter, \c pp_txformat, etc. will be set here
- * too.
- *
- * \param rmesa Context pointer
- * \param tObj GL texture object whose images are to be posted to
- * hardware state.
- */
-static void r200SetTexImages( r200ContextPtr rmesa,
- struct gl_texture_object *tObj )
-{
- r200TexObjPtr t = (r200TexObjPtr)tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint curOffset;
- GLint i;
- GLint numLevels;
- GLint log2Width, log2Height, log2Depth;
-
- /* Set the hardware texture format
- */
-
- t->pp_txformat &= ~(R200_TXFORMAT_FORMAT_MASK |
- R200_TXFORMAT_ALPHA_IN_MAP);
- t->pp_txfilter &= ~R200_YUV_TO_RGB;
-
- if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) {
- t->pp_txformat |= tx_table[ baseImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= tx_table[ baseImage->TexFormat->MesaFormat ].filter;
- }
- else {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- log2Width = tObj->Image[t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[t->base.firstLevel]->HeightLog2;
- log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2;
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
-
- /* Calculate mipmap offsets and dimensions for blitting (uploading)
- * The idea is that we lay out the mipmap levels within a block of
- * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
- */
- curOffset = 0;
-
- for (i = 0; i < numLevels; i++) {
- const struct gl_texture_image *texImage;
- GLuint size;
-
- texImage = tObj->Image[i + t->base.firstLevel];
- if ( !texImage )
- break;
-
- /* find image size in bytes */
- if (texImage->IsCompressed) {
- size = texImage->CompressedSize;
- }
- else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
- & ~63) * texImage->Height;
- }
- else {
- int w = texImage->Width * texImage->TexFormat->TexelBytes;
- if (w < 32)
- w = 32;
- size = w * texImage->Height * texImage->Depth;
- }
- assert(size > 0);
-
-
- /* Align to 32-byte offset. It is faster to do this unconditionally
- * (no branch penalty).
- */
-
- curOffset = (curOffset + 0x1f) & ~0x1f;
-
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
- t->image[0][i].height = size / t->image[0][i].width;
-
-#if 0
- /* for debugging only and only applicable to non-rectangle targets */
- assert(size % t->image[0][i].width == 0);
- assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES && t->image[0][i].height == 1));
-#endif
-
- if (0)
- fprintf(stderr,
- "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
- i, texImage->Width, texImage->Height,
- t->image[0][i].x, t->image[0][i].y,
- t->image[0][i].width, t->image[0][i].height, size, curOffset);
-
- curOffset += size;
-
- }
-
- /* Align the total size of texture memory block.
- */
- t->base.totalSize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
-
- /* Setup remaining cube face blits, if needed */
- if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- /* Round totalSize up to multiple of BLIT_WIDTH_BYTES */
- const GLuint faceSize = (t->base.totalSize + BLIT_WIDTH_BYTES - 1)
- & ~(BLIT_WIDTH_BYTES-1);
- const GLuint lines = faceSize / BLIT_WIDTH_BYTES;
- GLuint face;
- /* reuse face 0 x/y/width/height - just adjust y */
- for (face = 1; face < 6; face++) {
- for (i = 0; i < numLevels; i++) {
- t->image[face][i].x = t->image[0][i].x;
- t->image[face][i].y = t->image[0][i].y + face * lines;
- t->image[face][i].width = t->image[0][i].width;
- t->image[face][i].height = t->image[0][i].height;
- }
- }
- t->base.totalSize = 6 * faceSize; /* total texmem needed */
- }
-
-
- /* Hardware state:
- */
- t->pp_txfilter &= ~R200_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
-
- t->pp_txformat &= ~(R200_TXFORMAT_WIDTH_MASK |
- R200_TXFORMAT_HEIGHT_MASK |
- R200_TXFORMAT_CUBIC_MAP_ENABLE |
- R200_TXFORMAT_F5_WIDTH_MASK |
- R200_TXFORMAT_F5_HEIGHT_MASK);
- t->pp_txformat |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
-
- t->pp_txformat_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
- if (tObj->Target == GL_TEXTURE_3D) {
- t->pp_txformat_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
- t->pp_txformat_x |= R200_TEXCOORD_VOLUME;
- }
- else if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- ASSERT(log2Width == log2height);
- t->pp_txformat |= ((log2Width << R200_TXFORMAT_F5_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_F5_HEIGHT_SHIFT) |
- (R200_TXFORMAT_CUBIC_MAP_ENABLE));
- t->pp_txformat_x |= R200_TEXCOORD_CUBIC_ENV;
- t->pp_cubic_faces = ((log2Width << R200_FACE_WIDTH_1_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_1_SHIFT) |
- (log2Width << R200_FACE_WIDTH_2_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_2_SHIFT) |
- (log2Width << R200_FACE_WIDTH_3_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_3_SHIFT) |
- (log2Width << R200_FACE_WIDTH_4_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_4_SHIFT));
- }
-
- t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) |
- ((tObj->Image[t->base.firstLevel]->Height - 1) << 16));
-
- /* Only need to round to nearest 32 for textures, but the blitter
- * requires 64-byte aligned pitches, and we may/may not need the
- * blitter. NPOT only!
- */
- if (baseImage->IsCompressed)
- t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63);
- else
- t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63);
- t->pp_txpitch -= 32;
-
- t->dirty_state = TEX_ALL;
-
- /* FYI: r200UploadTexImages( rmesa, t ) used to be called here */
-}
-
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define R200_DISABLE 0
-#define R200_REPLACE 1
-#define R200_MODULATE 2
-#define R200_DECAL 3
-#define R200_BLEND 4
-#define R200_ADD 5
-#define R200_MAX_COMBFUNC 6
-
-static GLuint r200_color_combine[][R200_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00802800
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x00800142
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR | /* current starts in DIFFUSE */
- R200_TXC_ARG_B_R0_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c2d42
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_R0_COLOR |
- R200_TXC_ARG_C_R0_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c2902
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00812802
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00803000
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x00800182
- */
- (R200_TXC_ARG_A_R0_COLOR | /* current in R0 thereafter */
- R200_TXC_ARG_B_R1_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c3582
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R1_COLOR |
- R200_TXC_ARG_C_R1_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c3102
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00813002
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00803800
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x008001c2
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R2_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c3dc2
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R2_COLOR |
- R200_TXC_ARG_C_R2_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c3902
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00813802
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- }
-};
-
-static GLuint r200_alpha_combine[][R200_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD),
-
-
- /* GL_REPLACE = 0x00800500
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_R0_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_REPLACE = 0x00800600
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_R1_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_REPLACE = 0x00800700
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800071
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_R2_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800071
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800021
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- }
-};
-
-
-/* GL_ARB_texture_env_combine support
- */
-
-/* The color tables have combine functions for GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r200_register_color[][R200_MAX_TEXTURE_UNITS] =
-{
- {
- R200_TXC_ARG_A_R0_COLOR,
- R200_TXC_ARG_A_R1_COLOR,
- R200_TXC_ARG_A_R2_COLOR
- },
- {
- R200_TXC_ARG_A_R0_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_COLOR | R200_TXC_COMP_ARG_A
- },
- {
- R200_TXC_ARG_A_R0_ALPHA,
- R200_TXC_ARG_A_R1_ALPHA,
- R200_TXC_ARG_A_R2_ALPHA
- },
- {
- R200_TXC_ARG_A_R0_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_ALPHA | R200_TXC_COMP_ARG_A
- },
-};
-
-static GLuint r200_tfactor_color[] =
-{
- R200_TXC_ARG_A_TFACTOR_COLOR,
- R200_TXC_ARG_A_TFACTOR_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_TFACTOR_ALPHA,
- R200_TXC_ARG_A_TFACTOR_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-static GLuint r200_primary_color[] =
-{
- R200_TXC_ARG_A_DIFFUSE_COLOR,
- R200_TXC_ARG_A_DIFFUSE_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_DIFFUSE_ALPHA,
- R200_TXC_ARG_A_DIFFUSE_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-3
- * GL_ONE table - indices 1-4
- */
-static GLuint r200_zero_color[] =
-{
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO
-};
-
-/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r200_register_alpha[][R200_MAX_TEXTURE_UNITS] =
-{
- {
- R200_TXA_ARG_A_R0_ALPHA,
- R200_TXA_ARG_A_R1_ALPHA,
- R200_TXA_ARG_A_R2_ALPHA
- },
- {
- R200_TXA_ARG_A_R0_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R1_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R2_ALPHA | R200_TXA_COMP_ARG_A
- },
-};
-
-static GLuint r200_tfactor_alpha[] =
-{
- R200_TXA_ARG_A_TFACTOR_ALPHA,
- R200_TXA_ARG_A_TFACTOR_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-static GLuint r200_primary_alpha[] =
-{
- R200_TXA_ARG_A_DIFFUSE_ALPHA,
- R200_TXA_ARG_A_DIFFUSE_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-1
- * GL_ONE table - indices 1-2
- */
-static GLuint r200_zero_alpha[] =
-{
- R200_TXA_ARG_A_ZERO,
- R200_TXA_ARG_A_ZERO | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_ZERO,
-};
-
-
-/* Extract the arg from slot A, shift it into the correct argument slot
- * and set the corresponding complement bit.
- */
-#define R200_COLOR_ARG( n, arg ) \
-do { \
- color_combine |= \
- ((color_arg[n] & R200_TXC_ARG_A_MASK) \
- << R200_TXC_ARG_##arg##_SHIFT); \
- color_combine |= \
- ((color_arg[n] >> R200_TXC_COMP_ARG_A_SHIFT) \
- << R200_TXC_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-#define R200_ALPHA_ARG( n, arg ) \
-do { \
- alpha_combine |= \
- ((alpha_arg[n] & R200_TXA_ARG_A_MASK) \
- << R200_TXA_ARG_##arg##_SHIFT); \
- alpha_combine |= \
- ((alpha_arg[n] >> R200_TXA_COMP_ARG_A_SHIFT) \
- << R200_TXA_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint color_combine, alpha_combine;
- GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2];
- GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2];
-
- /* texUnit->_Current can be NULL if and only if the texture unit is
- * not actually enabled.
- */
- assert( (texUnit->_ReallyEnabled == 0)
- || (texUnit->_Current != NULL) );
-
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, ctx, unit );
- }
-
- /* Set the texture environment state. Isn't this nice and clean?
- * The chip will automagically set the texture alpha to 0xff when
- * the texture format does not include an alpha component. This
- * reduces the amount of special-casing we have to do, alpha-only
- * textures being a notable exception.
- */
- if ( !texUnit->_ReallyEnabled ) {
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- }
- else {
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[tObj->BaseLevel]->Format;
- GLuint color_arg[3], alpha_arg[3];
- GLuint i, numColorArgs = 0, numAlphaArgs = 0;
- GLuint RGBshift = texUnit->CombineScaleShiftRGB;
- GLuint Ashift = texUnit->CombineScaleShiftA;
-
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_REPLACE];
- alpha_combine = r200_alpha_combine[unit][R200_REPLACE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_REPLACE];
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_REPLACE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_MODULATE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_MODULATE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_MODULATE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_DECAL];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_BLEND:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_BLEND];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_BLEND];
- alpha_combine = r200_alpha_combine[unit][R200_BLEND];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_ADD:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_ADD];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_ADD];
- alpha_combine = r200_alpha_combine[unit][R200_ADD];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_COMBINE:
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
-
- /* Step 0:
- * Calculate how many arguments we need to process.
- */
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- numColorArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- numColorArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numColorArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- numAlphaArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numAlphaArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numAlphaArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR;
- assert(op >= 0);
- assert(op <= 3);
- switch ( texUnit->CombineSourceRGB[i] ) {
- case GL_TEXTURE:
- color_arg[i] = r200_register_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = r200_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = r200_primary_color[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- color_arg[i] = r200_primary_color[op];
- else
- color_arg[i] = r200_register_color[op][0];
- break;
- case GL_ZERO:
- color_arg[i] = r200_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = r200_zero_color[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA;
- assert(op >= 0);
- assert(op <= 1);
- switch ( texUnit->CombineSourceA[i] ) {
- case GL_TEXTURE:
- alpha_arg[i] = r200_register_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = r200_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = r200_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- alpha_arg[i] = r200_primary_alpha[op];
- else
- alpha_arg[i] = r200_register_alpha[op][0];
- break;
- case GL_ZERO:
- alpha_arg[i] = r200_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = r200_zero_alpha[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- /* Step 2:
- * Build up the color and alpha combine functions.
- */
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- color_combine = (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, C );
- break;
- case GL_MODULATE:
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
- case GL_ADD:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- color_combine = (R200_TXC_OP_LERP);
- R200_COLOR_ARG( 0, B );
- R200_COLOR_ARG( 1, A );
- R200_COLOR_ARG( 2, C );
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- Ashift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* DOT3 works differently on R200 than on R100. On R100, just
- * setting the DOT3 mode did everything for you. On R200, the
- * driver has to enable the biasing (the -0.5 in the combine
- * equation), and it has add the 4x scale factor. The hardware
- * only supports up to 8x in the post filter, so 2x part of it
- * happens on the inputs going into the combiner.
- */
-
- RGBshift++;
- Ashift = RGBshift;
-
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_DOT3 |
- R200_TXC_BIAS_ARG_A |
- R200_TXC_BIAS_ARG_B |
- R200_TXC_SCALE_ARG_A |
- R200_TXC_SCALE_ARG_B);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- alpha_combine = (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, C );
- break;
- case GL_MODULATE:
- alpha_combine = (R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, B );
- break;
- case GL_ADD:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- alpha_combine = (R200_TXA_OP_LERP);
- R200_ALPHA_ARG( 0, B );
- R200_ALPHA_ARG( 1, A );
- R200_ALPHA_ARG( 2, C );
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGB_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGB) ) {
- alpha_scale |= R200_TXA_DOT_ALPHA;
- }
-
- /* Step 3:
- * Apply the scale factor.
- */
- color_scale &= ~R200_TXC_SCALE_MASK;
- alpha_scale &= ~R200_TXA_SCALE_MASK;
- color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT);
- alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT);
-
- /* All done!
- */
- break;
-
- default:
- return GL_FALSE;
- }
- }
-
- if ( rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] != alpha_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] != color_scale ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] != alpha_scale) {
- R200_STATECHANGE( rmesa, pix[unit] );
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] = color_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] = alpha_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] = color_scale;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale;
- }
-
- return GL_TRUE;
-}
-
-#define TEXOBJ_TXFILTER_MASK (R200_MAX_MIP_LEVEL_MASK | \
- R200_MIN_FILTER_MASK | \
- R200_MAG_FILTER_MASK | \
- R200_MAX_ANISO_MASK | \
- R200_YUV_TO_RGB | \
- R200_YUV_TEMPERATURE_MASK | \
- R200_CLAMP_S_MASK | \
- R200_CLAMP_T_MASK | \
- R200_BORDER_MODE_D3D )
-
-#define TEXOBJ_TXFORMAT_MASK (R200_TXFORMAT_WIDTH_MASK | \
- R200_TXFORMAT_HEIGHT_MASK | \
- R200_TXFORMAT_FORMAT_MASK | \
- R200_TXFORMAT_F5_WIDTH_MASK | \
- R200_TXFORMAT_F5_HEIGHT_MASK | \
- R200_TXFORMAT_ALPHA_IN_MAP | \
- R200_TXFORMAT_CUBIC_MAP_ENABLE | \
- R200_TXFORMAT_NON_POWER2)
-
-#define TEXOBJ_TXFORMAT_X_MASK (R200_DEPTH_LOG2_MASK | \
- R200_TEXCOORD_MASK | \
- R200_VOLUME_FILTER_MASK)
-
-
-static void import_tex_obj_state( r200ContextPtr rmesa,
- int unit,
- r200TexObjPtr texobj )
-{
- GLuint *cmd = R200_DB_STATE( tex[unit] );
-
- cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXFORMAT_X] |= texobj->pp_txformat_x & TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXSIZE] = texobj->pp_txsize; /* NPOT only! */
- cmd[TEX_PP_TXPITCH] = texobj->pp_txpitch; /* NPOT only! */
- cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
- cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
-
- if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) {
- GLuint *cube_cmd = R200_DB_STATE( cube[unit] );
- GLuint bytesPerFace = texobj->base.totalSize / 6;
- ASSERT(texobj->totalSize % 6 == 0);
- cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] = texobj->pp_txoffset + 1 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] = texobj->pp_txoffset + 2 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = texobj->pp_txoffset + 3 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = texobj->pp_txoffset + 4 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = texobj->pp_txoffset + 5 * bytesPerFace;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.cube[unit] );
- }
-
- texobj->dirty_state &= ~(1<<unit);
-}
-
-
-
-
-static void set_texgen_matrix( r200ContextPtr rmesa,
- GLuint unit,
- const GLfloat *s_plane,
- const GLfloat *t_plane,
- const GLfloat *r_plane )
-{
- static const GLfloat scale_identity[4] = { 1,1,1,1 };
-
- if (!TEST_EQ_4V( s_plane, scale_identity) ||
- !TEST_EQ_4V( t_plane, scale_identity) ||
- !TEST_EQ_4V( r_plane, scale_identity)) {
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
- rmesa->TexGenMatrix[unit].m[0] = s_plane[0];
- rmesa->TexGenMatrix[unit].m[4] = s_plane[1];
- rmesa->TexGenMatrix[unit].m[8] = s_plane[2];
- rmesa->TexGenMatrix[unit].m[12] = s_plane[3];
-
- rmesa->TexGenMatrix[unit].m[1] = t_plane[0];
- rmesa->TexGenMatrix[unit].m[5] = t_plane[1];
- rmesa->TexGenMatrix[unit].m[9] = t_plane[2];
- rmesa->TexGenMatrix[unit].m[13] = t_plane[3];
-
- /* NOTE: r_plane goes in the 4th row, not 3rd! */
- rmesa->TexGenMatrix[unit].m[3] = r_plane[0];
- rmesa->TexGenMatrix[unit].m[7] = r_plane[1];
- rmesa->TexGenMatrix[unit].m[11] = r_plane[2];
- rmesa->TexGenMatrix[unit].m[15] = r_plane[3];
-
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-}
-
-/* Need this special matrix to get correct reflection map coords */
-static void
-set_texgen_reflection_matrix( r200ContextPtr rmesa, GLuint unit )
-{
- static const GLfloat m[16] = {
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, -1, 0 };
- _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
- _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
-}
-
-/* Need this special matrix to get correct normal map coords */
-static void
-set_texgen_normal_map_matrix( r200ContextPtr rmesa, GLuint unit )
-{
- static const GLfloat m[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 0, 1,
- 0, 0, 1, 0 };
- _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
- _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
-}
-
-
-/* Ignoring the Q texcoord for now.
- *
- * Returns GL_FALSE if fallback required.
- */
-static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenInputs &= ~(R200_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
-
- if (0)
- fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
-
- if ((texUnit->TexGenEnabled & (S_BIT|T_BIT|R_BIT)) == 0) {
- /* Disabled, no fallback:
- */
- rmesa->TexGenInputs |=
- (R200_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- return GL_TRUE;
- }
- else if (texUnit->TexGenEnabled & Q_BIT) {
- /* Very easy to do this, in fact would remove a fallback case
- * elsewhere, but I haven't done it yet... Fallback:
- */
- /*fprintf(stderr, "fallback Q_BIT\n");*/
- return GL_FALSE;
- }
- else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) &&
- texUnit->GenModeS == texUnit->GenModeT) {
- /* OK */
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
- /* continue */
- }
- else if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT) &&
- texUnit->GenModeS == texUnit->GenModeT &&
- texUnit->GenModeT == texUnit->GenModeR) {
- /* OK */
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
- /* continue */
- }
- else {
- /* Mixed modes, fallback:
- */
- /* fprintf(stderr, "fallback mixed texgen\n"); */
- return GL_FALSE;
- }
-
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
-
- switch (texUnit->GenModeS) {
- case GL_OBJECT_LINEAR:
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_OBJ << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->ObjectPlaneS,
- texUnit->ObjectPlaneT,
- texUnit->ObjectPlaneR);
- break;
-
- case GL_EYE_LINEAR:
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->EyePlaneS,
- texUnit->EyePlaneT,
- texUnit->EyePlaneR);
- break;
-
- case GL_REFLECTION_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE_REFLECT<<inputshift;
- set_texgen_reflection_matrix(rmesa, unit);
- break;
-
- case GL_NORMAL_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE_NORMAL<<inputshift;
- set_texgen_normal_map_matrix(rmesa, unit);
- break;
-
- case GL_SPHERE_MAP:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_SPHERE<<inputshift;
- break;
-
- default:
- /* Unsupported mode, fallback:
- */
- /* fprintf(stderr, "fallback unsupported texgen\n"); */
- return GL_FALSE;
- }
-
- rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit;
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- return GL_TRUE;
-}
-
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE<<unit)) {
- /* Texture unit disabled */
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &= ~(1UL << unit);
- rmesa->state.texture.unit[unit].texobj = NULL;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~((R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) << unit);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_BLEND_0_ENABLE;
-
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= ~(7 << (unit * 3));
-
- if (rmesa->TclFallback & (R200_TCL_FALLBACK_TEXGEN_0<<unit)) {
- TCL_FALLBACK( ctx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
- }
-
- /* Actually want to keep all units less than max active texture
- * enabled, right? Fix this for >2 texunits.
- */
- /* FIXME: What should happen here if r200UpdateTextureEnv fails? */
- if (unit == 0)
- r200UpdateTextureEnv( ctx, unit );
-
-
- {
- GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
- rmesa->TexGenInputs &= ~(R200_TEXGEN_INPUT_MASK<<inputshift);
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->recheck_texgen[unit] = GL_TRUE;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
- }
- }
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-#if ENABLE_HW_3D_TEXTURE
-static GLboolean enable_tex_3d( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- /* Need to load the 3d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_3D);
-
- /* R100 & R200 do not support mipmaps for 3D textures.
- */
- if ( (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR) ) {
- return GL_FALSE;
- }
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-#endif
-
-static GLboolean enable_tex_cube( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
- GLuint face;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- for (face = 0; face < 6; face++)
- t->base.dirty_images[face] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_CUBE_MAP);
-
- if ( t->base.dirty_images[0] || t->base.dirty_images[1] ||
- t->base.dirty_images[2] || t->base.dirty_images[3] ||
- t->base.dirty_images[4] || t->base.dirty_images[5] ) {
- /* flush */
- R200_FIREVERTICES( rmesa );
- /* layout memory space, once for all faces */
- r200SetTexImages( rmesa, tObj );
- }
-
- /* upload (per face) */
- for (face = 0; face < 6; face++) {
- if (t->base.dirty_images[face]) {
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, face );
- }
- }
-
- if ( !t->base.memBlock ) {
- /* texmem alloc failed, use s/w fallback */
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- if (!(t->pp_txformat & R200_TXFORMAT_NON_POWER2)) {
- t->pp_txformat |= R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock && !rmesa->prefer_gart_client_texturing )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
- GLenum format;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[tObj->BaseLevel]->Border > 0 )
- return GL_FALSE;
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->state.texture.unit[unit].texobj != t ) {
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->state.texture.unit[unit].texobj = t;
- t->base.bound |= (1UL << unit);
- t->dirty_state |= 1<<unit;
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
-
- /* Newly enabled?
- */
- if ( 1|| !(rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE<<unit))) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) << unit;
-
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] |= 4 << (unit * 3);
-
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
- if (t->dirty_state & (1<<unit)) {
- import_tex_obj_state( rmesa, unit, t );
- }
-
- if (rmesa->recheck_texgen[unit]) {
- GLboolean fallback = !r200_validate_texgen( ctx, unit );
- TCL_FALLBACK( ctx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), fallback);
- rmesa->recheck_texgen[unit] = 0;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- format = tObj->Image[tObj->BaseLevel]->Format;
- if ( rmesa->state.texture.unit[unit].format != format ||
- rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) {
- rmesa->state.texture.unit[unit].format = format;
- rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode;
- if ( ! r200UpdateTextureEnv( ctx, unit ) ) {
- return GL_FALSE;
- }
- }
-
- FALLBACK( rmesa, R200_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback;
-}
-
-
-
-static GLboolean r200UpdateTextureUnit( GLcontext *ctx, int unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT) ) {
- return (enable_tex_rect( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
-#if ENABLE_HW_3D_TEXTURE
- else if ( texUnit->_ReallyEnabled & (TEXTURE_3D_BIT) ) {
- return (enable_tex_3d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
-#endif
- else if ( texUnit->_ReallyEnabled & (TEXTURE_CUBE_BIT) ) {
- return (enable_tex_cube( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-
-void r200UpdateTextureState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean ok;
- GLuint dbg;
-
- ok = (r200UpdateTextureUnit( ctx, 0 ) &&
- r200UpdateTextureUnit( ctx, 1 ));
-
- FALLBACK( rmesa, R200_FALLBACK_TEXTURE, !ok );
-
- if (rmesa->TclFallback)
- r200ChooseVertexState( ctx );
-
- /*
- * T0 hang workaround -------------
- */
-#if 1
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) == R200_TEX_0_ENABLE &&
- (rmesa->hw.tex[0].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) > R200_MIN_FILTER_LINEAR) {
-
- R200_STATECHANGE(rmesa, ctx);
- R200_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_1_ENABLE;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= 0x08000000;
- }
- else {
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) &&
- (rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] & 0x08000000)) {
- R200_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~0x08000000;
- }
- }
-#endif
-
-#if 1
- /*
- * Texture cache LRU hang workaround -------------
- */
- dbg = 0x0;
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_0_ENABLE) &&
- ((((rmesa->hw.tex[0].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)))
- {
- dbg |= 0x02;
- }
-
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) &&
- ((((rmesa->hw.tex[1].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)))
- {
- dbg |= 0x04;
- }
-
- if (dbg != rmesa->hw.tam.cmd[TAM_DEBUG3]) {
- R200_STATECHANGE( rmesa, tam );
- rmesa->hw.tam.cmd[TAM_DEBUG3] = dbg;
- if (0) printf("TEXCACHE LRU HANG WORKAROUND %x\n", dbg);
- }
-#endif
-}
-
-/*
- also tests for higher texunits:
-
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_2_ENABLE) &&
- ((((rmesa->hw.tex[2].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_4_ENABLE) &&
- ((((rmesa->hw.tex[4].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) == 0)))
-
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_3_ENABLE) &&
- ((((rmesa->hw.tex[3].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_5_ENABLE) &&
- ((((rmesa->hw.tex[5].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) == 0)))
-
-*/
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
deleted file mode 100644
index a617d3f02..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
+++ /dev/null
@@ -1,1124 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c,v 1.4 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "api_noop.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "glapi.h"
-#include "colormac.h"
-#include "light.h"
-#include "state.h"
-#include "vtxfmt.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_array_api.h"
-
-static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
-
-static void count_func( const char *name, struct dynfn *l )
-{
- int i = 0;
- struct dynfn *f;
- foreach (f, l) i++;
- if (i) fprintf(stderr, "%s: %d\n", name, i );
-}
-
-static void count_funcs( r200ContextPtr rmesa )
-{
- count_func( "Vertex2f", &rmesa->vb.dfn_cache.Vertex2f );
- count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv );
- count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f );
- count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv );
- count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
- count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
- count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
- count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
- count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f );
- count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv );
- count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f );
- count_func( "Color3fv", &rmesa->vb.dfn_cache.Color3fv );
- count_func( "SecondaryColor3f", &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- count_func( "SecondaryColor3fv", &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- count_func( "SecondaryColor3ub", &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- count_func( "SecondaryColor3ubv", &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- count_func( "Normal3f", &rmesa->vb.dfn_cache.Normal3f );
- count_func( "Normal3fv", &rmesa->vb.dfn_cache.Normal3fv );
- count_func( "TexCoord2f", &rmesa->vb.dfn_cache.TexCoord2f );
- count_func( "TexCoord2fv", &rmesa->vb.dfn_cache.TexCoord2fv );
- count_func( "TexCoord1f", &rmesa->vb.dfn_cache.TexCoord1f );
- count_func( "TexCoord1fv", &rmesa->vb.dfn_cache.TexCoord1fv );
- count_func( "MultiTexCoord2fARB", &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- count_func( "MultiTexCoord2fvARB", &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- count_func( "MultiTexCoord1fARB", &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- count_func( "MultiTexCoord1fvARB", &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
-
-void r200_copy_to_current( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT);
-
- if (rmesa->vb.vtxfmt_0 & R200_VTX_N0) {
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = rmesa->vb.normalptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = rmesa->vb.normalptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = rmesa->vb.normalptr[2];
- }
-
- switch( VTX_COLOR(rmesa->vb.vtxfmt_0, 0) ) {
- case R200_VTX_PK_RGBA:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->blue );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->alpha );
- break;
-
- case R200_VTX_FP_RGB:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- break;
-
- case R200_VTX_FP_RGBA:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = rmesa->vb.floatcolorptr[3];
- break;
-
- default:
- break;
- }
-
- if (VTX_COLOR(rmesa->vb.vtxfmt_0, 1) == R200_VTX_PK_RGBA) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( rmesa->vb.specptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( rmesa->vb.specptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( rmesa->vb.specptr->blue );
- }
-
- if (rmesa->vb.vtxfmt_1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][0] = rmesa->vb.texcoordptr[0][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][1] = rmesa->vb.texcoordptr[0][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] = 1.0F;
- }
-
- if (rmesa->vb.vtxfmt_1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT)) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][0] = rmesa->vb.texcoordptr[1][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][1] = rmesa->vb.texcoordptr[1][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] = 1.0F;
- }
-
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
-}
-
-static GLboolean discreet_gl_prim[GL_POLYGON+1] = {
- 1, /* 0 points */
- 1, /* 1 lines */
- 0, /* 2 line_strip */
- 0, /* 3 line_loop */
- 1, /* 4 tris */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 1, /* 7 quads */
- 0, /* 8 quadstrip */
- 0, /* 9 poly */
-};
-
-static void flush_prims( r200ContextPtr rmesa )
-{
- int i,j;
- struct r200_dma_region tmp = rmesa->dma.current;
-
- tmp.buf->refcount++;
- tmp.aos_size = rmesa->vb.vertex_size;
- tmp.aos_stride = rmesa->vb.vertex_size;
- tmp.aos_start = GET_START(&tmp);
-
- rmesa->dma.current.ptr = rmesa->dma.current.start +=
- (rmesa->vb.initial_counter - rmesa->vb.counter) *
- rmesa->vb.vertex_size * 4;
-
- rmesa->tcl.vertex_format = rmesa->vb.vtxfmt_0;
- rmesa->tcl.aos_components[0] = &tmp;
- rmesa->tcl.nr_aos_components = 1;
- rmesa->dma.flush = 0;
-
- /* Optimize the primitive list:
- */
- if (rmesa->vb.nrprims > 1) {
- for (j = 0, i = 1 ; i < rmesa->vb.nrprims; i++) {
- int pj = rmesa->vb.primlist[j].prim & 0xf;
- int pi = rmesa->vb.primlist[i].prim & 0xf;
-
- if (pj == pi && discreet_gl_prim[pj] &&
- rmesa->vb.primlist[i].start == rmesa->vb.primlist[j].end) {
- rmesa->vb.primlist[j].end = rmesa->vb.primlist[i].end;
- }
- else {
- j++;
- if (j != i) rmesa->vb.primlist[j] = rmesa->vb.primlist[i];
- }
- }
- rmesa->vb.nrprims = j+1;
- }
-
- if (rmesa->vb.vtxfmt_0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
- rmesa->vb.vtxfmt_1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = rmesa->vb.vtxfmt_0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = rmesa->vb.vtxfmt_1;
- }
-
-
- for (i = 0 ; i < rmesa->vb.nrprims; i++) {
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "vtxfmt prim %d: %s %d..%d\n", i,
- _mesa_lookup_enum_by_nr( rmesa->vb.primlist[i].prim &
- PRIM_MODE_MASK ),
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end);
-
- if (rmesa->vb.primlist[i].start < rmesa->vb.primlist[i].end)
- r200EmitPrimitive( rmesa->glCtx,
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end,
- rmesa->vb.primlist[i].prim );
- }
-
- rmesa->vb.nrprims = 0;
- r200ReleaseDmaRegion( rmesa, &tmp, __FUNCTION__ );
-}
-
-
-static void start_prim( r200ContextPtr rmesa, GLuint mode )
-{
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- rmesa->vb.primlist[rmesa->vb.nrprims].start =
- rmesa->vb.initial_counter - rmesa->vb.counter;
- rmesa->vb.primlist[rmesa->vb.nrprims].prim = mode;
-}
-
-static void note_last_prim( r200ContextPtr rmesa, GLuint flags )
-{
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- rmesa->vb.primlist[rmesa->vb.nrprims].prim |= flags;
- rmesa->vb.primlist[rmesa->vb.nrprims].end =
- rmesa->vb.initial_counter - rmesa->vb.counter;
-
- if (++(rmesa->vb.nrprims) == R200_MAX_PRIMS)
- flush_prims( rmesa );
- }
-}
-
-
-static void copy_vertex( r200ContextPtr rmesa, GLuint n, GLfloat *dst )
-{
- GLuint i;
- GLfloat *src = (GLfloat *)(rmesa->dma.current.address +
- rmesa->dma.current.ptr +
- (rmesa->vb.primlist[rmesa->vb.nrprims].start + n) *
- rmesa->vb.vertex_size * 4);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "copy_vertex %d\n", rmesa->vb.primlist[rmesa->vb.nrprims].start + n);
-
- for (i = 0 ; i < rmesa->vb.vertex_size; i++) {
- dst[i] = src[i];
- }
-}
-
-/* NOTE: This actually reads the copied vertices back from uncached
- * memory. Could also use the counter/notify mechanism to populate
- * tmp on the fly as vertices are generated.
- */
-static GLuint copy_dma_verts( r200ContextPtr rmesa, GLfloat (*tmp)[15] )
-{
- GLuint ovf, i;
- GLuint nr = (rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start;
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d verts\n", __FUNCTION__, nr);
-
- switch( rmesa->vb.prim[0] )
- {
- case GL_POINTS:
- return 0;
- case GL_LINES:
- ovf = nr&1;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_TRIANGLES:
- ovf = nr%3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUADS:
- ovf = nr&3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_LINE_STRIP:
- if (nr == 0)
- return 0;
- copy_vertex( rmesa, nr-1, tmp[0] );
- return 1;
- case GL_LINE_LOOP:
- case GL_TRIANGLE_FAN:
- case GL_POLYGON:
- if (nr == 0)
- return 0;
- else if (nr == 1) {
- copy_vertex( rmesa, 0, tmp[0] );
- return 1;
- } else {
- copy_vertex( rmesa, 0, tmp[0] );
- copy_vertex( rmesa, nr-1, tmp[1] );
- return 2;
- }
- case GL_TRIANGLE_STRIP:
- ovf = MIN2( nr, 2 );
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUAD_STRIP:
- switch (nr) {
- case 0: ovf = 0; break;
- case 1: ovf = 1; break;
- default: ovf = 2 + (nr&1); break;
- }
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- default:
- assert(0);
- return 0;
- }
-}
-
-static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (ctx->Driver.NeedFlush)
- r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (ctx->NewState)
- _mesa_update_state( ctx ); /* clear state so fell_back sticks */
-
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- assert( rmesa->dma.flush == 0 );
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
-}
-
-
-static void VFMT_FALLBACK( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, prim;
- GLuint ind0 = rmesa->vb.vtxfmt_0;
- GLuint ind1 = rmesa->vb.vtxfmt_1;
- GLuint nrverts;
- GLfloat alpha = 1.0;
-
- if (R200_DEBUG & (DEBUG_FALLBACKS|DEBUG_VFMT))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
- return;
- }
-
- /* Copy vertices out of dma:
- */
- nrverts = copy_dma_verts( rmesa, tmp );
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- flush_prims( rmesa );
-
- /* Update ctx->Driver.CurrentExecPrimitive and swap in swtnl.
- */
- prim = rmesa->vb.prim[0];
- ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- assert(rmesa->dma.flush == 0);
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
- glBegin( prim );
-
- if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
-
- /* Replay saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- GLuint offset = 3;
- if (ind0 & R200_VTX_N0) {
- glNormal3fv( &tmp[i][offset] );
- offset += 3;
- }
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
- glColor4ubv( (GLubyte *)&tmp[i][offset] );
- offset++;
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
- glColor4fv( &tmp[i][offset] );
- offset+=4;
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- glColor3fv( &tmp[i][offset] );
- offset+=3;
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) {
- _glapi_Dispatch->SecondaryColor3ubvEXT( (GLubyte *)&tmp[i][offset] );
- offset++;
- }
-
- if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) {
- glTexCoord2fv( &tmp[i][offset] );
- offset += 2;
- }
-
- if (ind1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT)) {
- glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, &tmp[i][offset] );
- offset += 2;
- }
-
- glVertex3fv( &tmp[i][0] );
- }
-
- /* Replay current vertex
- */
- if (ind0 & R200_VTX_N0)
- glNormal3fv( rmesa->vb.normalptr );
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA)
- glColor4ub( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha );
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA)
- glColor4fv( rmesa->vb.floatcolorptr );
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0)
- glColor4f( rmesa->vb.floatcolorptr[0],
- rmesa->vb.floatcolorptr[1],
- rmesa->vb.floatcolorptr[2],
- alpha );
- else
- glColor3fv( rmesa->vb.floatcolorptr );
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA)
- _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue );
-
- if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT))
- glTexCoord2fv( rmesa->vb.texcoordptr[0] );
-
- if (ind1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT))
- glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, rmesa->vb.texcoordptr[1] );
-}
-
-
-
-static void wrap_buffer( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, nrverts;
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_PRIMS))
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- /* Don't deal with parity.
- */
- if ((((rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start) & 1)) {
- rmesa->vb.counter++;
- rmesa->vb.initial_counter++;
- return;
- }
-
- /* Copy vertices out of dma:
- */
- if (rmesa->vb.prim[0] == GL_POLYGON+1)
- nrverts = 0;
- else {
- nrverts = copy_dma_verts( rmesa, tmp );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%d vertices to copy\n", nrverts);
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- }
-
- /* Fire any buffered primitives
- */
- flush_prims( rmesa );
-
- /* Get new buffer
- */
- r200RefillCurrentDmaRegion( rmesa );
-
- /* Reset counter, dmaptr
- */
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.ptr + rmesa->dma.current.address);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
-
- rmesa->dma.flush = flush_prims;
-
- /* Restart wrapped primitive:
- */
- if (rmesa->vb.prim[0] != GL_POLYGON+1)
- start_prim( rmesa, rmesa->vb.prim[0] );
-
-
- /* Reemit saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- if (R200_DEBUG & DEBUG_VERTS) {
- int j;
- fprintf(stderr, "re-emit vertex %d to %p\n", i, rmesa->vb.dmaptr);
- if (R200_DEBUG & DEBUG_VERBOSE)
- for (j = 0 ; j < rmesa->vb.vertex_size; j++)
- fprintf(stderr, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]);
- }
-
- memcpy( rmesa->vb.dmaptr, tmp[i], rmesa->vb.vertex_size * 4 );
- rmesa->vb.dmaptr += rmesa->vb.vertex_size;
- rmesa->vb.counter--;
- }
-}
-
-
-
-static GLboolean check_vtx_fmt( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint ind0 = R200_VTX_Z0;
- GLuint ind1 = 0;
-
- if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag)
- return GL_FALSE;
-
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
- ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT );
-
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- ind0 |= R200_VTX_N0;
-
- /* TODO: make this data driven: If we receive only ubytes, send
- * color as ubytes. Also check if converting (with free
- * checking for overflow) is cheaper than sending floats
- * directly.
- */
- if (ctx->Light.ColorMaterialEnabled)
- ind0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- else
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
- }
- else {
- /* TODO: make this data driven?
- */
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT;
- }
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- ind0 |= R200_VTX_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] != 1.0) {
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq0\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind1 |= 2 << R200_VTX_TEX0_COMP_CNT_SHIFT;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- ind0 |= R200_VTX_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] != 1.0) {
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq1\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind1 |= 2 << R200_VTX_TEX1_COMP_CNT_SHIFT;
- }
- }
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_STATE))
- fprintf(stderr, "%s: format: 0x%x, 0x%x\n", __FUNCTION__, ind0, ind1 );
-
- R200_NEWPRIM(rmesa);
- rmesa->vb.vtxfmt_0 = ind0;
- rmesa->vb.vtxfmt_1 = ind1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
-
- rmesa->vb.vertex_size = 3;
- rmesa->vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- rmesa->vb.colorptr = NULL;
- rmesa->vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- rmesa->vb.specptr = NULL;
- rmesa->vb.floatspecptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- rmesa->vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- rmesa->vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
-
- /* Run through and initialize the vertex components in the order
- * the hardware understands:
- */
- if (ind0 & R200_VTX_N0) {
- rmesa->vb.normalptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
- rmesa->vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
- rmesa->vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
- }
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
- rmesa->vb.colorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->alpha, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] );
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 4;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
- rmesa->vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) {
- rmesa->vb.specptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] );
- }
-
-
- if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) {
- rmesa->vb.texcoordptr[0] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[0][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][0];
- rmesa->vb.texcoordptr[0][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][1];
- }
-
- if (ind1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT)) {
- rmesa->vb.texcoordptr[1] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[1][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][0];
- rmesa->vb.texcoordptr[1][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][1];
- }
-
- if (rmesa->vb.installed_vertex_format != rmesa->vb.vtxfmt_0) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on vertex_format change\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- rmesa->vb.installed_vertex_format = rmesa->vb.vtxfmt_0;
- }
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- success\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-
-void r200VtxfmtInvalidate( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- rmesa->vb.recheck = GL_TRUE;
- rmesa->vb.fell_back = GL_FALSE;
-}
-
-
-static void r200NewList( GLcontext *ctx, GLuint list, GLenum mode )
-{
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
-}
-
-
-static void r200VtxfmtValidate( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- rmesa->vb.recheck = GL_FALSE;
-
- if (check_vtx_fmt( ctx )) {
- if (!rmesa->vb.installed) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall (new install)\n");
-
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
- ctx->Driver.NewList = r200NewList;
- rmesa->vb.installed = GL_TRUE;
- }
- else if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: already installed", __FUNCTION__);
- }
- else {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- if (rmesa->vb.installed) {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
- rmesa->vb.installed = GL_FALSE;
- }
- }
-}
-
-
-
-/* Materials:
- */
-static void r200_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- VFMT_FALLBACK( __FUNCTION__ );
- glMaterialfv( face, pname, params );
- return;
- }
- _mesa_noop_Materialfv( face, pname, params );
- r200UpdateMaterial( ctx );
-}
-
-
-/* Begin/End
- */
-static void r200_Begin( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- if (mode > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (rmesa->vb.recheck)
- r200VtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- glBegin( mode );
- return;
- }
-
-
- if (rmesa->dma.flush && rmesa->vb.counter < 12) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__);
- flush_prims( rmesa );
- }
-
- /* Need to arrange to save vertices here? Or always copy from dma (yuk)?
- */
- if (!rmesa->dma.flush) {
- if (rmesa->dma.current.ptr + 12*rmesa->vb.vertex_size*4 >
- rmesa->dma.current.end) {
- R200_NEWPRIM( rmesa );
- r200RefillCurrentDmaRegion( rmesa );
- }
-
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
- rmesa->dma.flush = flush_prims;
- ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- }
-
-
- rmesa->vb.prim[0] = mode;
- start_prim( rmesa, mode | PRIM_BEGIN );
-}
-
-
-
-static void r200_End( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- note_last_prim( rmesa, PRIM_END );
- rmesa->vb.prim[0] = GL_POLYGON+1;
-}
-
-
-/* Fallback on difficult entrypoints:
- */
-#define PRE_LOOPBACK( FUNC ) \
-do { \
- if (R200_DEBUG & DEBUG_VFMT) \
- fprintf(stderr, "%s\n", __FUNCTION__); \
- VFMT_FALLBACK( __FUNCTION__ ); \
-} while (0)
-#define TAG(x) r200_fallback_##x
-#include "vtxfmt_tmp.h"
-
-
-
-static GLboolean r200NotifyBegin( GLcontext *ctx, GLenum p )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(!rmesa->vb.installed);
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (rmesa->vb.recheck)
- r200VtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- r200_Begin( p );
- return GL_TRUE;
-}
-
-static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(rmesa->vb.installed);
-
- if (flags & FLUSH_UPDATE_CURRENT) {
- r200_copy_to_current( ctx );
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on update_current\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
- }
-
- if (flags & FLUSH_STORED_VERTICES) {
- assert (rmesa->dma.flush == 0 ||
- rmesa->dma.flush == flush_prims);
- if (rmesa->dma.flush == flush_prims)
- flush_prims( rmesa );
- ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
- }
-}
-
-
-
-/* At this point, don't expect very many versions of each function to
- * be generated, so not concerned about freeing them?
- */
-
-
-void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLvertexformat *vfmt = &(rmesa->vb.vtxfmt);
-
- MEMSET( vfmt, 0, sizeof(GLvertexformat) );
-
- /* Hook in chooser functions for codegen, etc:
- */
- r200VtxfmtInitChoosers( vfmt );
-
- /* Handled fully in supported states, but no codegen:
- */
- vfmt->Materialfv = r200_Materialfv;
- vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
- vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */
- vfmt->Begin = r200_Begin;
- vfmt->End = r200_End;
-
- /* Fallback for performance reasons: (Fix with cva/elt path here and
- * dmatmp2.h style primitive-merging)
- *
- * These should call NotifyBegin(), as should _tnl_EvalMesh, to allow
- * a driver-hook.
- */
- vfmt->DrawArrays = r200_fallback_DrawArrays;
- vfmt->DrawElements = r200_fallback_DrawElements;
- vfmt->DrawRangeElements = r200_fallback_DrawRangeElements;
-
-
- /* Not active in supported states; just keep ctx->Current uptodate:
- */
- vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
- vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
-
-
- /* Active but unsupported -- fallback if we receive these:
- */
- vfmt->CallList = r200_fallback_CallList;
- vfmt->EvalCoord1f = r200_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = r200_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = r200_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = r200_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = r200_fallback_EvalMesh1;
- vfmt->EvalMesh2 = r200_fallback_EvalMesh2;
- vfmt->EvalPoint1 = r200_fallback_EvalPoint1;
- vfmt->EvalPoint2 = r200_fallback_EvalPoint2;
- vfmt->TexCoord3f = r200_fallback_TexCoord3f;
- vfmt->TexCoord3fv = r200_fallback_TexCoord3fv;
- vfmt->TexCoord4f = r200_fallback_TexCoord4f;
- vfmt->TexCoord4fv = r200_fallback_TexCoord4fv;
- vfmt->MultiTexCoord3fARB = r200_fallback_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = r200_fallback_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = r200_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = r200_fallback_MultiTexCoord4fvARB;
- vfmt->Vertex4f = r200_fallback_Vertex4f;
- vfmt->Vertex4fv = r200_fallback_Vertex4fv;
-
- (void)r200_fallback_vtxfmt;
-
- TNL_CONTEXT(ctx)->Driver.NotifyBegin = r200NotifyBegin;
-
- rmesa->vb.enabled = 1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
- rmesa->vb.primflags = 0;
-
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2fv );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4f );
- make_empty_list( &rmesa->vb.dfn_cache.Color4fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3f );
- make_empty_list( &rmesa->vb.dfn_cache.Color3fv );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3f );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1fv );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-
- r200InitCodegen( &rmesa->vb.codegen, useCodegen );
-}
-
-static void free_funcs( struct dynfn *l )
-{
- struct dynfn *f, *tmp;
- foreach_s (f, tmp, l) {
- remove_from_list( f );
- ALIGN_FREE( f->code );
- FREE( f );
- }
-}
-
-void r200VtxfmtUnbindContext( GLcontext *ctx )
-{
-}
-
-
-void r200VtxfmtMakeCurrent( GLcontext *ctx )
-{
-}
-
-
-void r200VtxfmtDestroy( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- count_funcs( rmesa );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2fv );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3fv );
- free_funcs( &rmesa->vb.dfn_cache.Color4ub );
- free_funcs( &rmesa->vb.dfn_cache.Color4ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color3ub );
- free_funcs( &rmesa->vb.dfn_cache.Color3ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color4f );
- free_funcs( &rmesa->vb.dfn_cache.Color4fv );
- free_funcs( &rmesa->vb.dfn_cache.Color3f );
- free_funcs( &rmesa->vb.dfn_cache.Color3fv );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- free_funcs( &rmesa->vb.dfn_cache.Normal3f );
- free_funcs( &rmesa->vb.dfn_cache.Normal3fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1fv );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
deleted file mode 100644
index 39f0a10e4..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_VTXFMT_H__
-#define __R200_VTXFMT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-
-
-extern void r200VtxfmtUpdate( GLcontext *ctx );
-extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
-extern void r200VtxfmtInvalidate( GLcontext *ctx );
-extern void r200VtxfmtDestroy( GLcontext *ctx );
-extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt );
-
-extern void r200VtxfmtMakeCurrent( GLcontext *ctx );
-extern void r200VtxfmtUnbindContext( GLcontext *ctx );
-
-extern void r200_copy_to_current( GLcontext *ctx );
-
-#define DFN( FUNC, CACHE) \
-do { \
- char *start = (char *)&FUNC; \
- char *end = (char *)&FUNC##_end; \
- insert_at_head( &CACHE, dfn ); \
- dfn->key[0] = key[0]; \
- dfn->key[1] = key[1]; \
- dfn->code = ALIGN_MALLOC( end - start, 16 ); \
- memcpy (dfn->code, start, end - start); \
-} \
-while ( 0 )
-
-#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- int *icode = (int *)(CODE+OFFSET); \
- assert (*icode == CHECKVAL); \
- *icode = (int)NEWVAL; \
-} while (0)
-
-
-/* Useful for figuring out the offsets:
- */
-#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
- /*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
- /* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
- *(int *)(CODE+OFFSET) = (int)(NEWVAL); \
- OFFSET += 4; \
-} while (0)
-
-/*
- */
-void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
-void r200InitX86Codegen( struct dfn_generators *gen );
-void r200InitSSECodegen( struct dfn_generators *gen );
-
-
-
-/* Defined in r200_vtxfmt_x86.c
- */
-struct dynfn *r200_makeX86Vertex2f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex2fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4ub( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4ubv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3ub( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3ubv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3ubEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3ubvEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3fEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3fvEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86Normal3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Normal3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord2f( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord2fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord1f( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord1fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord1fARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord1fvARB( GLcontext *, const int * );
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c
deleted file mode 100644
index efef751a6..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c
+++ /dev/null
@@ -1,900 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "simple_list.h"
-#include "api_noop.h"
-#include "vtxfmt.h"
-
-#include "r200_vtxfmt.h"
-
-/* Fallback versions of all the entrypoints for situations where
- * codegen isn't available. This is still a lot faster than the
- * vb/pipeline implementation in Mesa.
- */
-static void r200_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = *(int *)&z;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = *(int *)&v[2];
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex2f( GLfloat x, GLfloat y )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-
-/* Color for ubyte (packed) color formats:
- */
-static void r200_Color3ub_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void r200_Color3ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void r200_Color4ub_ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = a;
-}
-
-static void r200_Color4ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- *(GLuint *)rmesa->vb.colorptr = LE32_TO_CPU(*(GLuint *)v);
-}
-
-
-static void r200_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void r200_Color3fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void r200_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
-}
-
-static void r200_Color4fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
-}
-
-
-/* Color for float color+alpha formats:
- */
-static void r200_Color3ub_4f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void r200_Color3ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void r200_Color4ub_4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = UBYTE_TO_FLOAT(a);
-}
-
-static void r200_Color4ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = UBYTE_TO_FLOAT(v[3]);
-}
-
-
-static void r200_Color3f_4f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void r200_Color3fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-static void r200_Color4f_4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = a;
-}
-
-static void r200_Color4fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = v[3];
-}
-
-
-/* Color for float color formats:
- */
-static void r200_Color3ub_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
-}
-
-static void r200_Color3ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
-}
-
-static void r200_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
-}
-
-static void r200_Color4ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
-}
-
-
-static void r200_Color3f_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
-}
-
-static void r200_Color3fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-static void r200_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
-}
-
-static void r200_Color4fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
-}
-
-
-/* Secondary Color:
- */
-static void r200_SecondaryColor3ubEXT_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void r200_SecondaryColor3ubvEXT_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void r200_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void r200_SecondaryColor3fvEXT_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void r200_SecondaryColor3ubEXT_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void r200_SecondaryColor3ubvEXT_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void r200_SecondaryColor3fEXT_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void r200_SecondaryColor3fvEXT_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-
-
-/* Normal
- */
-static void r200_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = n0;
- dest[1] = n1;
- dest[2] = n2;
-}
-
-static void r200_Normal3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-
-/* TexCoord
- */
-static void r200_TexCoord1f( GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void r200_TexCoord1fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void r200_TexCoord2f( GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void r200_TexCoord2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-
-/* MultiTexcoord
- *
- * Technically speaking, these functions should subtract GL_TEXTURE0 from
- * \c target before masking and using it. The value of GL_TEXTURE0 is 0x84C0,
- * which has the low-order 5 bits 0. For all possible valid values of
- * \c target. Subtracting GL_TEXTURE0 has the net effect of masking \c target
- * with 0x1F. Masking with 0x1F and then masking with 0x01 is redundant, so
- * the subtraction has been omitted.
- */
-
-static void r200_MultiTexCoord1fARB( GLenum target, GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void r200_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void r200_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void r200_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-static struct dynfn *lookup( struct dynfn *l, const int *key )
-{
- struct dynfn *f;
-
- foreach( f, l ) {
- if (f->key[0] == key[0] && f->key[1] == key[1])
- return f;
- }
-
- return 0;
-}
-
-/* Can't use the loopback template for this:
- */
-
-#define CHOOSE(FN, FNTYPE, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \
- \
- if (dfn) \
- ctx->Exec->FN = (FNTYPE)(dfn->code); \
- else { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- ctx->Exec->FN = r200_##FN; \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-/* For the _3f case, only allow one color function to be hooked in at
- * a time. Eventually, use a similar mechanism to allow selecting the
- * color component of the vertex format based on client behaviour.
- *
- * Note: Perform these actions even if there is a codegen or cached
- * codegen version of the chosen function.
- */
-#define CHOOSE_COLOR(FN, FNTYPE, NR, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_PK_RGBA) { \
- ctx->Exec->FN = r200_##FN##_ub; \
- } \
- else if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_FP_RGB) { \
- \
- if (rmesa->vb.installed_color_3f_sz != NR) { \
- rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
- r200_copy_to_current( ctx ); \
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
- ctx->Exec->FN ARGS2; \
- return; \
- } \
- } \
- \
- ctx->Exec->FN = r200_##FN##_3f; \
- } \
- else { \
- ctx->Exec->FN = r200_##FN##_4f; \
- } \
- \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (!dfn) dfn = rmesa->vb.codegen.FN( ctx, key ); \
- \
- if (dfn) { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \
- ctx->Exec->FN = (FNTYPE)dfn->code; \
- } \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-/* Right now there are both _ub and _3f versions of the secondary color
- * functions. Currently, we only set-up the hardware to use the _ub versions.
- * The _3f versions are needed for the cases where secondary color isn't used
- * in the vertex format, but it still needs to be stored in the context
- * state vector.
- */
-#define CHOOSE_SECONDARY_COLOR(FN, FNTYPE, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \
- \
- if (dfn) \
- ctx->Exec->FN = (FNTYPE)(dfn->code); \
- else { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- ctx->Exec->FN = (VTX_COLOR(rmesa->vb.vtxfmt_0,1) == R200_VTX_PK_RGBA) \
- ? r200_##FN##_ub : r200_##FN##_3f; \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-
-
-/* VTXFMT_0
- */
-#define MASK_XYZW (R200_VTX_W0|R200_VTX_Z0)
-#define MASK_NORM (MASK_XYZW|R200_VTX_N0)
-#define MASK_COLOR (MASK_NORM |(R200_VTX_COLOR_MASK<<R200_VTX_COLOR_0_SHIFT))
-#define MASK_SPEC (MASK_COLOR|(R200_VTX_COLOR_MASK<<R200_VTX_COLOR_1_SHIFT))
-
-/* VTXFMT_1
- */
-#define MASK_ST0 (0x7 << R200_VTX_TEX0_COMP_CNT_SHIFT)
-
-
-
-typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat );
-typedef void (*p3f)( GLfloat, GLfloat, GLfloat );
-typedef void (*p2f)( GLfloat, GLfloat );
-typedef void (*p1f)( GLfloat );
-typedef void (*pe2f)( GLenum, GLfloat, GLfloat );
-typedef void (*pe1f)( GLenum, GLfloat );
-typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
-typedef void (*p3ub)( GLubyte, GLubyte, GLubyte );
-typedef void (*pfv)( const GLfloat * );
-typedef void (*pefv)( GLenum, const GLfloat * );
-typedef void (*pubv)( const GLubyte * );
-
-
-CHOOSE(Normal3f, p3f, MASK_NORM, 0,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Normal3fv, pfv, MASK_NORM, 0,
- (const GLfloat *v), (v))
-
-CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, 0,
- (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
-CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, 0,
- (const GLubyte *v), (v))
-CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, 0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, 0,
- (const GLubyte *v), (v))
-
-CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, 0,
- (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
-CHOOSE_COLOR(Color4fv, pfv, 4, MASK_COLOR, 0,
- (const GLfloat *v), (v))
-CHOOSE_COLOR(Color3f, p3f, 3, MASK_COLOR, 0,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, 0,
- (const GLfloat *v), (v))
-
-
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, 0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, 0,
- (const GLubyte *v), (v))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, 0,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, 0,
- (const GLfloat *v), (v))
-
-CHOOSE(TexCoord2f, p2f, ~0, MASK_ST0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(TexCoord2fv, pfv, ~0, MASK_ST0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord1f, p1f, ~0, MASK_ST0,
- (GLfloat a), (a))
-CHOOSE(TexCoord1fv, pfv, ~0, MASK_ST0,
- (const GLfloat *v), (v))
-
-CHOOSE(MultiTexCoord2fARB, pe2f, ~0, ~0,
- (GLenum u,GLfloat a,GLfloat b), (u,a,b))
-CHOOSE(MultiTexCoord2fvARB, pefv, ~0, ~0,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord1fARB, pe1f, ~0, ~0,
- (GLenum u,GLfloat a), (u,a))
-CHOOSE(MultiTexCoord1fvARB, pefv, ~0, ~0,
- (GLenum u,const GLfloat *v), (u,v))
-
-CHOOSE(Vertex3f, p3f, ~0, ~0,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Vertex3fv, pfv, ~0, ~0,
- (const GLfloat *v), (v))
-CHOOSE(Vertex2f, p2f, ~0, ~0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(Vertex2fv, pfv, ~0, ~0,
- (const GLfloat *v), (v))
-
-
-
-
-
-void r200VtxfmtInitChoosers( GLvertexformat *vfmt )
-{
- vfmt->Color3f = choose_Color3f;
- vfmt->Color3fv = choose_Color3fv;
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
- vfmt->Color4f = choose_Color4f;
- vfmt->Color4fv = choose_Color4fv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
- vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
- vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = choose_MultiTexCoord2fvARB;
- vfmt->Normal3f = choose_Normal3f;
- vfmt->Normal3fv = choose_Normal3fv;
- vfmt->TexCoord1f = choose_TexCoord1f;
- vfmt->TexCoord1fv = choose_TexCoord1fv;
- vfmt->TexCoord2f = choose_TexCoord2f;
- vfmt->TexCoord2fv = choose_TexCoord2fv;
- vfmt->Vertex2f = choose_Vertex2f;
- vfmt->Vertex2fv = choose_Vertex2fv;
- vfmt->Vertex3f = choose_Vertex3f;
- vfmt->Vertex3fv = choose_Vertex3fv;
-}
-
-
-static struct dynfn *codegen_noop( GLcontext *ctx, const int *key )
-{
- (void) ctx; (void) key;
- return 0;
-}
-
-void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen )
-{
- gen->Vertex3f = codegen_noop;
- gen->Vertex3fv = codegen_noop;
- gen->Color4ub = codegen_noop;
- gen->Color4ubv = codegen_noop;
- gen->Normal3f = codegen_noop;
- gen->Normal3fv = codegen_noop;
- gen->TexCoord2f = codegen_noop;
- gen->TexCoord2fv = codegen_noop;
- gen->MultiTexCoord2fARB = codegen_noop;
- gen->MultiTexCoord2fvARB = codegen_noop;
- gen->Vertex2f = codegen_noop;
- gen->Vertex2fv = codegen_noop;
- gen->Color3ub = codegen_noop;
- gen->Color3ubv = codegen_noop;
- gen->Color4f = codegen_noop;
- gen->Color4fv = codegen_noop;
- gen->Color3f = codegen_noop;
- gen->Color3fv = codegen_noop;
- gen->SecondaryColor3fEXT = codegen_noop;
- gen->SecondaryColor3fvEXT = codegen_noop;
- gen->SecondaryColor3ubEXT = codegen_noop;
- gen->SecondaryColor3ubvEXT = codegen_noop;
- gen->TexCoord1f = codegen_noop;
- gen->TexCoord1fv = codegen_noop;
- gen->MultiTexCoord1fARB = codegen_noop;
- gen->MultiTexCoord1fvARB = codegen_noop;
-
- if (useCodegen) {
-#if defined(USE_X86_ASM)
- r200InitX86Codegen( gen );
-#endif
-
-#if defined(USE_SSE_ASM)
- r200InitSSECodegen( gen );
-#endif
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c
deleted file mode 100644
index 2245bbcef..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "r200_vtxfmt.h"
-
-#if defined(USE_SSE_ASM)
-#include "X86/common_x86_asm.h"
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN( _sse_Attribute2fv );
-EXTERN( _sse_Attribute2f );
-EXTERN( _sse_Attribute3fv );
-EXTERN( _sse_Attribute3f );
-EXTERN( _sse_MultiTexCoord2fv );
-EXTERN( _sse_MultiTexCoord2f );
-EXTERN( _sse_MultiTexCoord2fv_2 );
-EXTERN( _sse_MultiTexCoord2f_2 );
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state.
- */
-
-static struct dynfn *r200_makeSSEAttribute2fv( struct dynfn * cache, const int * key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 10, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute2f( struct dynfn * cache, const int * key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute2f, (*cache) );
- FIXUP(dfn->code, 8, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute3fv( struct dynfn * cache, const int * key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 13, 0x0, (int)dest);
- FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute3f( struct dynfn * cache, const int * key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute3f, (*cache) );
- FIXUP(dfn->code, 12, 0x0, (int)dest);
- FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSENormal3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *r200_makeSSENormal3f( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *r200_makeSSEColor3fv( GLcontext *ctx, const int * key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return 0;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *r200_makeSSEColor3f( GLcontext *ctx, const int * key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return 0;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *r200_makeSSETexCoord2fv( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *r200_makeSSETexCoord2f( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *r200_makeSSEMultiTexCoord2fv( GLcontext *ctx, const int * key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEMultiTexCoord2f( GLcontext *ctx, const int * key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-void r200InitSSECodegen( struct dfn_generators *gen )
-{
- if ( cpu_has_xmm ) {
- gen->Normal3fv = (void *) r200_makeSSENormal3fv;
- gen->Normal3f = (void *) r200_makeSSENormal3f;
- gen->Color3fv = (void *) r200_makeSSEColor3fv;
- gen->Color3f = (void *) r200_makeSSEColor3f;
- gen->TexCoord2fv = (void *) r200_makeSSETexCoord2fv;
- gen->TexCoord2f = (void *) r200_makeSSETexCoord2f;
- gen->MultiTexCoord2fvARB = (void *) r200_makeSSEMultiTexCoord2fv;
- gen->MultiTexCoord2fARB = (void *) r200_makeSSEMultiTexCoord2f;
- }
-}
-
-#else
-
-void r200InitSSECodegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c
deleted file mode 100644
index c4d8af85e..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "r200_vtxfmt.h"
-
-#if defined(USE_X86_ASM)
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN ( _x86_Attribute2fv );
-EXTERN ( _x86_Attribute2f );
-EXTERN ( _x86_Attribute3fv );
-EXTERN ( _x86_Attribute3f );
-EXTERN ( _x86_Vertex3fv_6 );
-EXTERN ( _x86_Vertex3fv_8 );
-EXTERN ( _x86_Vertex3fv );
-EXTERN ( _x86_Vertex3f_4 );
-EXTERN ( _x86_Vertex3f_6 );
-EXTERN ( _x86_Vertex3f );
-EXTERN ( _x86_Color4ubv_ub );
-EXTERN ( _x86_Color4ubv_4f );
-EXTERN ( _x86_Color4ub_ub );
-EXTERN ( _x86_MultiTexCoord2fv );
-EXTERN ( _x86_MultiTexCoord2fv_2 );
-EXTERN ( _x86_MultiTexCoord2f );
-EXTERN ( _x86_MultiTexCoord2f_2 );
-
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state. Generic x86 versions.
- */
-
-struct dynfn *r200_makeX86Vertex3f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
- key[0], key[1], rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 4: {
-
- DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- case 6: {
-
- DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- default: {
-
- DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-
-
-struct dynfn *r200_makeX86Vertex3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
- key[0], key[1], rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 6: {
-
- DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
- case 8: {
-
- DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
- FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
- FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
-
- default: {
-
- DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute2fv( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 11, 0x0, (int)dest);
- FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute2f( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute2f, (*cache) );
- FIXUP(dfn->code, 1, 0x0, (int)dest);
-
- return dfn;
-}
-
-
-static struct dynfn *
-r200_makeX86Attribute3fv( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute3f( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute3f, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-struct dynfn *r200_makeX86Normal3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *r200_makeX86Normal3f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *r200_makeX86Color4ubv( GLcontext *ctx, const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
- DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
- return dfn;
- }
- else {
-
- DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
- FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
- FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
- FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
- FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
- return dfn;
- }
-}
-
-struct dynfn *r200_makeX86Color4ub( GLcontext *ctx, const int *key )
-{
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
- FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
- FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
- FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
- return dfn;
- }
- else
- return 0;
-}
-
-
-struct dynfn *r200_makeX86Color3fv( GLcontext *ctx, const int *key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return 0;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-struct dynfn *r200_makeX86Color3f( GLcontext *ctx, const int *key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return 0;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-
-
-struct dynfn *r200_makeX86TexCoord2fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *r200_makeX86TexCoord2f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *ctx, const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- } else {
- DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *ctx,
- const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- }
- else {
- /* Note: this might get generated multiple times, even though the
- * actual emitted code is the same.
- */
- DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-
-void r200InitX86Codegen( struct dfn_generators *gen )
-{
- gen->Vertex3f = r200_makeX86Vertex3f;
- gen->Vertex3fv = r200_makeX86Vertex3fv;
- gen->Color4ub = r200_makeX86Color4ub; /* PKCOLOR only */
- gen->Color4ubv = r200_makeX86Color4ubv; /* PKCOLOR only */
- gen->Normal3f = r200_makeX86Normal3f;
- gen->Normal3fv = r200_makeX86Normal3fv;
- gen->TexCoord2f = r200_makeX86TexCoord2f;
- gen->TexCoord2fv = r200_makeX86TexCoord2fv;
- gen->MultiTexCoord2fARB = r200_makeX86MultiTexCoord2fARB;
- gen->MultiTexCoord2fvARB = r200_makeX86MultiTexCoord2fvARB;
- gen->Color3f = r200_makeX86Color3f;
- gen->Color3fv = r200_makeX86Color3fv;
-
- /* Not done:
- */
-/* gen->Vertex2f = r200_makeX86Vertex2f; */
-/* gen->Vertex2fv = r200_makeX86Vertex2fv; */
-/* gen->Color3ub = r200_makeX86Color3ub; */
-/* gen->Color3ubv = r200_makeX86Color3ubv; */
-/* gen->Color4f = r200_makeX86Color4f; */
-/* gen->Color4fv = r200_makeX86Color4fv; */
-/* gen->TexCoord1f = r200_makeX86TexCoord1f; */
-/* gen->TexCoord1fv = r200_makeX86TexCoord1fv; */
-/* gen->MultiTexCoord1fARB = r200_makeX86MultiTexCoord1fARB; */
-/* gen->MultiTexCoord1fvARB = r200_makeX86MultiTexCoord1fvARB; */
-}
-
-
-#else
-
-void r200InitX86Codegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S b/xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S
deleted file mode 100644
index 56a4144e8..000000000
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.2 2002/11/07 18:31:59 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#define GLOBL( x ) \
-.globl x; \
-x:
-
-.data
-.align 4
-
-/*
- vertex 3f vertex size 4
-*/
-
-GLOBL ( _x86_Vertex3f_4 )
- movl (0), %ecx
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl %eax, (%ecx)
- movl %edx, 4(%ecx)
- movl 12(%esp), %eax
- movl (0), %edx
- movl %eax, 8(%ecx)
- movl %edx, 12(%ecx)
- movl (0), %eax
- addl $16, %ecx
- dec %eax
- movl %ecx, (0)
- movl %eax, (0)
- je .1
- ret
-.1: jmp *0
-
-GLOBL ( _x86_Vertex3f_4_end )
-
-/*
- vertex 3f vertex size 6
-*/
-GLOBL ( _x86_Vertex3f_6 )
- push %edi
- movl (0), %edi
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- movl (0), %eax
- movl (0), %edx
- movl (0), %ecx
- movl %eax, 12(%edi)
- movl %edx, 16(%edi)
- movl %ecx, 20(%edi)
- addl $24, %edi
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- pop %edi
- movl %eax, (0)
- je .2
- ret
-.2: jmp *0
-GLOBL ( _x86_Vertex3f_6_end )
-/*
- vertex 3f generic size
-*/
-GLOBL ( _x86_Vertex3f )
- push %edi
- push %esi
- movl $0, %esi
- movl (0), %edi
- movl 12(%esp), %eax
- movl 16(%esp), %edx
- movl 20(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- addl $12, %edi
- movl $0, %ecx
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- movl %eax, (0)
- pop %esi
- pop %edi
- je .3
- ret
-.3: jmp *0
-
-GLOBL ( _x86_Vertex3f_end )
-
-/*
- Vertex 3fv vertex size 6
-*/
-GLOBL ( _x86_Vertex3fv_6 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx, (%eax)
- movl 4(%ecx), %edx
- movl 8(%ecx), %ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (36), %edx
- movl %edx, 20(%eax)
- addl $24, %eax
- movl %eax, 0
- movl 4, %eax
- dec %eax
- movl %eax, 4
- je .4
- ret
-.4: jmp *8
-
-GLOBL ( _x86_Vertex3fv_6_end )
-
-/*
- Vertex 3fv vertex size 8
-*/
-GLOBL ( _x86_Vertex3fv_8 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx ,(%eax)
- movl 4(%ecx) ,%edx
- movl 8(%ecx) ,%ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 20(%eax)
- movl %ecx, 24(%eax)
- movl (36), %edx
- movl %edx, 28(%eax)
- addl $32, %eax
- movl %eax, (0)
- movl 4, %eax
- dec %eax
- movl %eax, (4)
- je .5
- ret
-.5: jmp *8
-
-GLOBL ( _x86_Vertex3fv_8_end )
-
-/*
- Vertex 3fv generic vertex size
-*/
-GLOBL ( _x86_Vertex3fv )
- movl 4(%esp), %edx
- push %edi
- push %esi
- movl (0x1010101), %edi
- movl (%edx), %eax
- movl 4(%edx), %ecx
- movl 8(%edx), %esi
- movl %eax, (%edi)
- movl %ecx, 4(%edi)
- movl %esi, 8(%edi)
- addl $12, %edi
- movl $6, %ecx
- movl $0x58, %esi
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl %edi, (0x1010101)
- movl (0x2020202), %eax
- pop %esi
- pop %edi
- dec %eax
- movl %eax, (0x2020202)
- je .6
- ret
-.6: jmp *0
-GLOBL ( _x86_Vertex3fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL ( _x86_Attribute2f )
- movl $0x0, %edx
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movl %eax, (%edx)
- movl %ecx, 4(%edx)
- ret
-GLOBL ( _x86_Attribute2f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _x86_Attribute2fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %eax /* load v[1] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %eax, 4 /* store v[1] to current vertex */
- ret
-GLOBL ( _x86_Attribute2fv_end )
-
-
-/**
- * Generic handler for 3 float format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL ( _x86_Attribute3f )
- movl 4(%esp), %ecx
- movl 8(%esp), %edx
- movl 12(%esp), %eax
- movl %ecx, 0
- movl %edx, 4
- movl %eax, 8
- ret
-GLOBL ( _x86_Attribute3f_end )
-
-/**
- * Generic handler for 3 float vector format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL( _x86_Attribute3fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %edx /* load v[1] */
- movl 8(%eax), %eax /* load v[2] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %edx, 4 /* store v[1] to current vertex */
- movl %eax, 8 /* store v[2] to current vertex */
- ret
-GLOBL ( _x86_Attribute3fv_end )
-
-
-/*
- Color 4ubv_ub
-*/
-GLOBL ( _x86_Color4ubv_ub )
- movl 4(%esp), %eax
- movl $0x12345678, %edx
- movl (%eax), %eax
- movl %eax, (%edx)
- ret
-GLOBL ( _x86_Color4ubv_ub_end )
-
-/*
- Color 4ubv 4f
-*/
-GLOBL ( _x86_Color4ubv_4f )
- push %ebx
- movl $0, %edx
- xor %eax, %eax
- xor %ecx, %ecx
- movl 8(%esp), %ebx
- movl (%ebx), %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4),%eax
- movl (%edx,%ecx,4),%ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- xor %eax, %eax
- xor %ecx, %ecx
- shr $16, %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4), %eax
- movl (%edx,%ecx,4), %ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- pop %ebx
- ret
-GLOBL ( _x86_Color4ubv_4f_end )
-
-/*
-
- Color4ub_ub
-*/
-GLOBL( _x86_Color4ub_ub )
- push %ebx
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl 20(%esp), %ebx
- mov %al, (0)
- mov %dl, (0)
- mov %cl, (0)
- mov %bl, (0)
- pop %ebx
- ret
-GLOBL( _x86_Color4ub_ub_end )
-
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movl (%ecx), %edx
- shl $3, %eax
- movl 4(%ecx), %ecx
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-
-GLOBL( _x86_MultiTexCoord2fv_2 )
- movl 4(%esp,1), %eax
- movl 8(%esp,1), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movl (%ecx), %eax
- movl %eax, (%edx)
- movl 4(%ecx), %eax
- movl %eax, 4(%edx)
- ret
-GLOBL( _x86_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2f )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp), %ecx
- and $1, %eax
- shl $3, %eax
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _x86_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp,1), %ecx
- and $1,%eax
- movl 0(,%eax,4), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_2_end )
-
-/**
- * This can be used as a template for either Color3fv (when the color
- * target is also a 3f) or Normal3fv.
- */
-
-GLOBL( _sse_Attribute3fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movl 8(%eax), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3fv_end )
-
-/**
- * This can be used as a template for either Color3f (when the color
- * target is also a 3f) or Normal3f.
- */
-
-GLOBL( _sse_Attribute3f )
- movlps 4(%esp), %xmm0
- movl 12(%esp), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2f )
- movlps 4(%esp), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2f_end )
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movlps (%ecx), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-GLOBL( _sse_MultiTexCoord2fv_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movlps (%ecx), %xmm0
- movlps %xmm0, (%edx)
- ret
-GLOBL( _sse_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2f )
- movl 4(%esp), %eax
- and $1, %eax
- movlps 8(%esp), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _sse_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movlps 8(%esp), %xmm0
- and $1,%eax
- movl 0(,%eax,4), %eax
- movlps %xmm0, (%eax)
- ret
-GLOBL( _sse_MultiTexCoord2f_2_end )
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c
deleted file mode 100644
index 694025c62..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.9 2003/09/24 02:43:12 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_span.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_tcl.h"
-#include "radeon_vtxfmt.h"
-#include "radeon_maos.h"
-
-#define DRIVER_DATE "20030328"
-
-#include "vblank.h"
-#include "utils.h"
-#ifndef RADEON_DEBUG
-int RADEON_DEBUG = (0);
-#endif
-
-
-/* Radeon configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 8;
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->dri.drawable->w;
- *height = rmesa->dri.drawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = rmesa->radeonScreen->IsPCI ? 0 :
- rmesa->radeonScreen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "Radeon", DRIVER_DATE,
- agp_mode );
-
- sprintf( & buffer[ offset ], "%sTCL",
- !(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-" );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-/* Extension strings exported by the R100 driver.
- */
-static const char * const card_extensions[] =
-{
- "GL_ARB_multisample",
- "GL_ARB_multitexture",
- "GL_ARB_texture_border_clamp",
- "GL_ARB_texture_compression",
- "GL_ARB_texture_env_add",
- "GL_ARB_texture_env_combine",
- "GL_ARB_texture_env_dot3",
- "GL_ARB_texture_mirrored_repeat",
- "GL_EXT_blend_logic_op",
- "GL_EXT_blend_subtract",
- "GL_EXT_secondary_color",
- "GL_EXT_texture_edge_clamp",
- "GL_EXT_texture_env_add",
- "GL_EXT_texture_env_combine",
- "GL_EXT_texture_env_dot3",
- "GL_EXT_texture_filter_anisotropic",
- "GL_EXT_texture_lod_bias",
- "GL_ATI_texture_env_combine3",
- "GL_ATI_texture_mirror_once",
- "GL_IBM_texture_mirrored_repeat",
- "GL_MESA_ycbcr_texture",
- "GL_NV_blend_square",
- "GL_SGIS_generate_mipmap",
- "GL_SGIS_texture_border_clamp",
- "GL_SGIS_texture_edge_clamp",
- NULL
-};
-
-extern const struct gl_pipeline_stage _radeon_texrect_stage;
-extern const struct gl_pipeline_stage _radeon_render_stage;
-extern const struct gl_pipeline_stage _radeon_tcl_stage;
-
-static const struct gl_pipeline_stage *radeon_pipeline[] = {
-
- /* Try and go straight to t&l
- */
- &_radeon_tcl_stage,
-
- /* Catch any t&l fallbacks
- */
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
-
- /* Scale texture rectangle to 0..1.
- */
- &_radeon_texrect_stage,
-
- &_radeon_render_stage,
- &_tnl_render_stage, /* FALLBACK: */
- 0,
-};
-
-
-
-/* Initialize the driver's misc functions.
- */
-static void radeonInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = radeonGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = radeonGetString;
-
- ctx->Driver.Error = NULL;
- ctx->Driver.DrawPixels = NULL;
- ctx->Driver.Bitmap = NULL;
-}
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "code", DEBUG_CODEGEN },
- { "vfmt", DEBUG_VFMT },
- { "vtxf", DEBUG_VFMT },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { NULL, 0 }
-};
-
-
-static int
-get_ust_nop( int64_t * ust )
-{
- *ust = 1;
- return 0;
-}
-
-
-/* Create the device specific context.
- */
-GLboolean
-radeonCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
- radeonContextPtr rmesa;
- GLcontext *ctx, *shareCtx;
- int i;
- int tcl_mode, fthrottle_mode;
-
- assert(glVisual);
- assert(driContextPriv);
- assert(screen);
-
- /* Allocate the Radeon context */
- rmesa = (radeonContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((radeonContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
-
- /* Init radeon context data */
- rmesa->dri.context = driContextPriv;
- rmesa->dri.screen = sPriv;
- rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
- rmesa->dri.hwContext = driContextPriv->hHWContext;
- rmesa->dri.hwLock = &sPriv->pSAREA->lock;
- rmesa->dri.fd = sPriv->fd;
- rmesa->dri.drmMinor = sPriv->drmMinor;
-
- /* Parse configuration files */
- driParseConfigFiles (&rmesa->optionCache, &screen->optionCache,
- screen->driScreen->myNum, "radeon");
-
- rmesa->radeonScreen = screen;
- rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA +
- screen->sarea_priv_offset);
-
-
- rmesa->dma.buf0_address = rmesa->radeonScreen->buffers->list[0].address;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = screen->numTexHeaps;
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- screen->texSize[i],
- 12,
- RADEON_NR_TEX_REGIONS,
- rmesa->sarea->texList[i],
- & rmesa->sarea->texAge[i],
- & rmesa->swapped,
- sizeof( radeonTexObj ),
- (destroy_texture_object_t *) radeonDestroyTexObj );
-
- driSetTextureSwapCounterLocation( rmesa->texture_heaps[i],
- & rmesa->c_textureSwaps );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( screen->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->lost_context = 1;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx = rmesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 11, /* max rect texture size is 2048x2048. */
- 12,
- GL_FALSE );
-
- ctx->Const.MaxTextureMaxAnisotropy = 16.0;
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 0.0625;
-
- /* Set maxlocksize (and hence vb size) small enough to avoid
- * fallbacks in radeon_tcl.c. ie. guarentee that all vertices can
- * fit in a single dma buffer for indexed rendering of quad strips,
- * etc.
- */
- ctx->Const.MaxArrayLockSize =
- MIN2( ctx->Const.MaxArrayLockSize,
- RADEON_BUFFER_SIZE / RADEON_MAX_TCL_VERTSIZE );
-
- rmesa->boxes = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _ae_create_context( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, radeon_pipeline );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials( ctx, GL_TRUE );
-
-
-/* _mesa_allow_light_in_model( ctx, GL_FALSE ); */
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials( ctx, GL_TRUE );
-
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
-
- _math_matrix_ctr( &rmesa->TexGenMatrix[0] );
- _math_matrix_ctr( &rmesa->TexGenMatrix[1] );
- _math_matrix_ctr( &rmesa->tmpmat );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[0] );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[1] );
- _math_matrix_set_identity( &rmesa->tmpmat );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
-
- if (rmesa->dri.drmMinor >= 9)
- _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
-
- radeonInitDriverFuncs( ctx );
- radeonInitIoctlFuncs( ctx );
- radeonInitStateFuncs( ctx );
- radeonInitSpanFuncs( ctx );
- radeonInitTextureFuncs( ctx );
- radeonInitState( rmesa );
- radeonInitSwtcl( ctx );
-
- fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
- rmesa->iw.irq_seq = -1;
- rmesa->irqsEmitted = 0;
- rmesa->do_irqs = (rmesa->radeonScreen->irq != 0 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS);
-
- rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
- if ( rmesa->get_ust == NULL ) {
- rmesa->get_ust = get_ust_nop;
- }
-
- (*rmesa->get_ust)( & rmesa->swap_ust );
-
-
-#if DO_DEBUG
- RADEON_DEBUG = driParseDebugString( getenv( "RADEON_DEBUG" ),
- debug_control );
-#endif
-
- tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(rmesa, RADEON_FALLBACK_DISABLE, 1);
- } else if (tcl_mode == DRI_CONF_TCL_SW ||
- !(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- rmesa->radeonScreen->chipset &= ~RADEON_CHIPSET_TCL;
- fprintf(stderr, "disabling TCL support\n");
- TCL_FALLBACK(rmesa->glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
- }
-
- if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- radeonVtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
-
- _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
- }
- return GL_TRUE;
-}
-
-
-/* Destroy the device specific context.
- */
-/* Destroy the Mesa and driver specific context data.
- */
-void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = (radeonContextPtr) driContextPriv->driverPrivate;
- radeonContextPtr current = ctx ? RADEON_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (rmesa == current) {
- RADEON_FIREVERTICES( rmesa );
- _mesa_make_current2(NULL, NULL, NULL);
- }
-
- /* Free radeon context resources */
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- radeonDestroySwtcl( rmesa->glCtx );
- radeonReleaseArrays( rmesa->glCtx, ~0 );
- if (rmesa->dma.current.buf) {
- radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
- }
-
- if (!(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)) {
- int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- radeonVtxfmtDestroy( rmesa->glCtx );
- }
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context( rmesa->glCtx );
-
- if (rmesa->state.scissor.pClipRects) {
- FREE(rmesa->state.scissor.pClipRects);
- rmesa->state.scissor.pClipRects = 0;
- }
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- assert( is_empty_list( & rmesa->swapped ) );
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-}
-
-
-
-
-void
-radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- radeonContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
-
- if ( rmesa->doPageFlip ) {
- radeonPageFlip( dPriv );
- }
- else {
- radeonCopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- radeonContextPtr newCtx =
- (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx);
-
- if ( newCtx->dri.drawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
- newCtx->dri.drawable = driDrawPriv;
- radeonUpdateWindow( newCtx->glCtx );
- radeonUpdateViewportOffset( newCtx->glCtx );
- }
-
- _mesa_make_current2( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if ( !newCtx->glCtx->Viewport.Width ) {
- _mesa_set_viewport( newCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h );
- }
-
- if (newCtx->vb.enabled)
- radeonVtxfmtMakeCurrent( newCtx->glCtx );
-
- } else {
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current( 0, 0 );
- }
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-radeonUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- radeonContextPtr rmesa = (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, rmesa->glCtx);
-
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h
deleted file mode 100644
index 13dcae5e4..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h
+++ /dev/null
@@ -1,845 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.6 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_CONTEXT_H__
-#define __RADEON_CONTEXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <inttypes.h>
-#include "dri_util.h"
-#include "radeon_common.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-struct radeon_context;
-typedef struct radeon_context radeonContextRec;
-typedef struct radeon_context *radeonContextPtr;
-
-#include "radeon_lock.h"
-#include "radeon_screen.h"
-#include "mm.h"
-
-/* Flags for software fallback cases */
-/* See correponding strings in radeon_swtcl.c */
-#define RADEON_FALLBACK_TEXTURE 0x0001
-#define RADEON_FALLBACK_DRAW_BUFFER 0x0002
-#define RADEON_FALLBACK_STENCIL 0x0004
-#define RADEON_FALLBACK_RENDER_MODE 0x0008
-#define RADEON_FALLBACK_BLEND_EQ 0x0010
-#define RADEON_FALLBACK_BLEND_FUNC 0x0020
-#define RADEON_FALLBACK_DISABLE 0x0040
-#define RADEON_FALLBACK_BORDER_MODE 0x0080
-
-/* The blit width for texture uploads
- */
-#define BLIT_WIDTH_BYTES 1024
-
-/* Use the templated vertex format:
- */
-#define COLOR_IS_RGBA
-#define TAG(x) radeon##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*radeon_tri_func)( radeonContextPtr,
- radeonVertex *,
- radeonVertex *,
- radeonVertex * );
-
-typedef void (*radeon_line_func)( radeonContextPtr,
- radeonVertex *,
- radeonVertex * );
-
-typedef void (*radeon_point_func)( radeonContextPtr,
- radeonVertex * );
-
-
-struct radeon_colorbuffer_state {
- GLuint clear;
- GLint drawOffset, drawPitch;
- int roundEnable;
-};
-
-
-struct radeon_depthbuffer_state {
- GLuint clear;
- GLfloat scale;
-};
-
-struct radeon_pixel_state {
- GLint readOffset, readPitch;
-};
-
-struct radeon_scissor_state {
- XF86DRIClipRectRec rect;
- GLboolean enabled;
-
- GLuint numClipRects; /* Cliprects active */
- GLuint numAllocedClipRects; /* Cliprects available */
- XF86DRIClipRectPtr pClipRects;
-};
-
-struct radeon_stencilbuffer_state {
- GLboolean hwBuffer;
- GLuint clear; /* rb3d_stencilrefmask value */
-};
-
-struct radeon_stipple_state {
- GLuint mask[32];
-};
-
-
-
-#define TEX_0 0x1
-#define TEX_1 0x2
-#define TEX_ALL 0x3
-
-typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct radeon_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drmRadeonTexImage image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
- GLuint pp_txfilter; /* hardware register values */
- GLuint pp_txformat;
- GLuint pp_txoffset; /* Image location in texmem.
- All cube faces follow. */
- GLuint pp_txsize; /* npot only */
- GLuint pp_txpitch; /* npot only */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
-
- GLboolean border_fallback;
-};
-
-
-struct radeon_texture_env_state {
- radeonTexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-struct radeon_texture_state {
- struct radeon_texture_env_state unit[RADEON_MAX_TEXTURE_UNITS];
-};
-
-
-struct radeon_state_atom {
- struct radeon_state_atom *next, *prev;
- const char *name; /* for debug */
- int cmd_size; /* size in bytes */
- GLuint is_tcl;
- int *cmd; /* one or more cmd's */
- int *lastcmd; /* one or more cmd's */
- GLboolean (*check)( GLcontext * ); /* is this state active? */
-};
-
-
-
-/* Trying to keep these relatively short as the variables are becoming
- * extravagently long. Drop the driver name prefix off the front of
- * everything - I think we know which driver we're in by now, and keep the
- * prefix to 3 letters unless absolutely impossible.
- */
-
-#define CTX_CMD_0 0
-#define CTX_PP_MISC 1
-#define CTX_PP_FOG_COLOR 2
-#define CTX_RE_SOLID_COLOR 3
-#define CTX_RB3D_BLENDCNTL 4
-#define CTX_RB3D_DEPTHOFFSET 5
-#define CTX_RB3D_DEPTHPITCH 6
-#define CTX_RB3D_ZSTENCILCNTL 7
-#define CTX_CMD_1 8
-#define CTX_PP_CNTL 9
-#define CTX_RB3D_CNTL 10
-#define CTX_RB3D_COLOROFFSET 11
-#define CTX_CMD_2 12
-#define CTX_RB3D_COLORPITCH 13
-#define CTX_STATE_SIZE 14
-
-#define SET_CMD_0 0
-#define SET_SE_CNTL 1
-#define SET_SE_COORDFMT 2
-#define SET_CMD_1 3
-#define SET_SE_CNTL_STATUS 4
-#define SET_STATE_SIZE 5
-
-#define LIN_CMD_0 0
-#define LIN_RE_LINE_PATTERN 1
-#define LIN_RE_LINE_STATE 2
-#define LIN_CMD_1 3
-#define LIN_SE_LINE_WIDTH 4
-#define LIN_STATE_SIZE 5
-
-#define MSK_CMD_0 0
-#define MSK_RB3D_STENCILREFMASK 1
-#define MSK_RB3D_ROPCNTL 2
-#define MSK_RB3D_PLANEMASK 3
-#define MSK_STATE_SIZE 4
-
-#define VPT_CMD_0 0
-#define VPT_SE_VPORT_XSCALE 1
-#define VPT_SE_VPORT_XOFFSET 2
-#define VPT_SE_VPORT_YSCALE 3
-#define VPT_SE_VPORT_YOFFSET 4
-#define VPT_SE_VPORT_ZSCALE 5
-#define VPT_SE_VPORT_ZOFFSET 6
-#define VPT_STATE_SIZE 7
-
-#define MSC_CMD_0 0
-#define MSC_RE_MISC 1
-#define MSC_STATE_SIZE 2
-
-#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1
-#define TEX_PP_TXFORMAT 2
-#define TEX_PP_TXOFFSET 3
-#define TEX_PP_TXCBLEND 4
-#define TEX_PP_TXABLEND 5
-#define TEX_PP_TFACTOR 6
-#define TEX_CMD_1 7
-#define TEX_PP_BORDER_COLOR 8
-#define TEX_STATE_SIZE 9
-
-#define TXR_CMD_0 0 /* rectangle textures */
-#define TXR_PP_TEX_SIZE 1 /* 0x1d04, 0x1d0c for NPOT! */
-#define TXR_PP_TEX_PITCH 2 /* 0x1d08, 0x1d10 for NPOT! */
-#define TXR_STATE_SIZE 3
-
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
-
-#define TCL_CMD_0 0
-#define TCL_OUTPUT_VTXFMT 1
-#define TCL_OUTPUT_VTXSEL 2
-#define TCL_MATRIX_SELECT_0 3
-#define TCL_MATRIX_SELECT_1 4
-#define TCL_UCP_VERT_BLEND_CTL 5
-#define TCL_TEXTURE_PROC_CTL 6
-#define TCL_LIGHT_MODEL_CTL 7
-#define TCL_PER_LIGHT_CTL_0 8
-#define TCL_PER_LIGHT_CTL_1 9
-#define TCL_PER_LIGHT_CTL_2 10
-#define TCL_PER_LIGHT_CTL_3 11
-#define TCL_STATE_SIZE 12
-
-#define MTL_CMD_0 0
-#define MTL_EMMISSIVE_RED 1
-#define MTL_EMMISSIVE_GREEN 2
-#define MTL_EMMISSIVE_BLUE 3
-#define MTL_EMMISSIVE_ALPHA 4
-#define MTL_AMBIENT_RED 5
-#define MTL_AMBIENT_GREEN 6
-#define MTL_AMBIENT_BLUE 7
-#define MTL_AMBIENT_ALPHA 8
-#define MTL_DIFFUSE_RED 9
-#define MTL_DIFFUSE_GREEN 10
-#define MTL_DIFFUSE_BLUE 11
-#define MTL_DIFFUSE_ALPHA 12
-#define MTL_SPECULAR_RED 13
-#define MTL_SPECULAR_GREEN 14
-#define MTL_SPECULAR_BLUE 15
-#define MTL_SPECULAR_ALPHA 16
-#define MTL_SHININESS 17
-#define MTL_STATE_SIZE 18
-
-#define VTX_CMD_0 0
-#define VTX_SE_COORD_FMT 1
-#define VTX_STATE_SIZE 2
-
-#define MAT_CMD_0 0
-#define MAT_ELT_0 1
-#define MAT_STATE_SIZE 17
-
-#define GRD_CMD_0 0
-#define GRD_VERT_GUARD_CLIP_ADJ 1
-#define GRD_VERT_GUARD_DISCARD_ADJ 2
-#define GRD_HORZ_GUARD_CLIP_ADJ 3
-#define GRD_HORZ_GUARD_DISCARD_ADJ 4
-#define GRD_STATE_SIZE 5
-
-/* position changes frequently when lighting in modelpos - separate
- * out to new state item?
- */
-#define LIT_CMD_0 0
-#define LIT_AMBIENT_RED 1
-#define LIT_AMBIENT_GREEN 2
-#define LIT_AMBIENT_BLUE 3
-#define LIT_AMBIENT_ALPHA 4
-#define LIT_DIFFUSE_RED 5
-#define LIT_DIFFUSE_GREEN 6
-#define LIT_DIFFUSE_BLUE 7
-#define LIT_DIFFUSE_ALPHA 8
-#define LIT_SPECULAR_RED 9
-#define LIT_SPECULAR_GREEN 10
-#define LIT_SPECULAR_BLUE 11
-#define LIT_SPECULAR_ALPHA 12
-#define LIT_POSITION_X 13
-#define LIT_POSITION_Y 14
-#define LIT_POSITION_Z 15
-#define LIT_POSITION_W 16
-#define LIT_DIRECTION_X 17
-#define LIT_DIRECTION_Y 18
-#define LIT_DIRECTION_Z 19
-#define LIT_DIRECTION_W 20
-#define LIT_ATTEN_CONST 21
-#define LIT_ATTEN_LINEAR 22
-#define LIT_ATTEN_QUADRATIC 23
-#define LIT_ATTEN_XXX 24
-#define LIT_CMD_1 25
-#define LIT_SPOT_DCD 26
-#define LIT_SPOT_EXPONENT 27
-#define LIT_SPOT_CUTOFF 28
-#define LIT_SPECULAR_THRESH 29
-#define LIT_RANGE_CUTOFF 30 /* ? */
-#define LIT_RANGE_ATTEN 31 /* ? */
-#define LIT_STATE_SIZE 32
-
-/* Fog
- */
-#define FOG_CMD_0 0
-#define FOG_R 1
-#define FOG_C 2
-#define FOG_D 3
-#define FOG_PAD 4
-#define FOG_STATE_SIZE 5
-
-/* UCP
- */
-#define UCP_CMD_0 0
-#define UCP_X 1
-#define UCP_Y 2
-#define UCP_Z 3
-#define UCP_W 4
-#define UCP_STATE_SIZE 5
-
-/* GLT - Global ambient
- */
-#define GLT_CMD_0 0
-#define GLT_RED 1
-#define GLT_GREEN 2
-#define GLT_BLUE 3
-#define GLT_ALPHA 4
-#define GLT_STATE_SIZE 5
-
-/* EYE
- */
-#define EYE_CMD_0 0
-#define EYE_X 1
-#define EYE_Y 2
-#define EYE_Z 3
-#define EYE_RESCALE_FACTOR 4
-#define EYE_STATE_SIZE 5
-
-#define SHN_CMD_0 0
-#define SHN_SHININESS 1
-#define SHN_STATE_SIZE 2
-
-
-
-
-
-struct radeon_hw_state {
- /* All state should be on one of these lists:
- */
- struct radeon_state_atom dirty; /* dirty list head placeholder */
- struct radeon_state_atom clean; /* clean list head placeholder */
-
- /* Hardware state, stored as cmdbuf commands:
- * -- Need to doublebuffer for
- * - reviving state after loss of context
- * - eliding noop statechange loops? (except line stipple count)
- */
- struct radeon_state_atom ctx;
- struct radeon_state_atom set;
- struct radeon_state_atom lin;
- struct radeon_state_atom msk;
- struct radeon_state_atom vpt;
- struct radeon_state_atom tcl;
- struct radeon_state_atom msc;
- struct radeon_state_atom tex[2];
- struct radeon_state_atom zbs;
- struct radeon_state_atom mtl;
- struct radeon_state_atom mat[5];
- struct radeon_state_atom lit[8]; /* includes vec, scl commands */
- struct radeon_state_atom ucp[6];
- struct radeon_state_atom eye; /* eye pos */
- struct radeon_state_atom grd; /* guard band clipping */
- struct radeon_state_atom fog;
- struct radeon_state_atom glt;
- struct radeon_state_atom txr[2]; /* for NPOT */
-};
-
-struct radeon_state {
- /* Derived state for internal purposes:
- */
- struct radeon_colorbuffer_state color;
- struct radeon_depthbuffer_state depth;
- struct radeon_pixel_state pixel;
- struct radeon_scissor_state scissor;
- struct radeon_stencilbuffer_state stencil;
- struct radeon_stipple_state stipple;
- struct radeon_texture_state texture;
-};
-
-
-/* Need refcounting on dma buffers:
- */
-struct radeon_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->radeonScreen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct radeon_dma_region {
- struct radeon_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
- int aos_start;
- int aos_stride;
- int aos_size;
-};
-
-
-struct radeon_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct radeon_dma_region current;
-
- void (*flush)( radeonContextPtr );
-
- char *buf0_address; /* start of buf[0], for index calcs */
- GLuint nr_released_bufs; /* flush after so many buffers released */
-};
-
-struct radeon_dri_mirror {
- __DRIcontextPrivate *context; /* DRI context */
- __DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
-
- drmContext hwContext;
- drmLock *hwLock;
- int fd;
- int drmMinor;
-};
-
-
-#define RADEON_CMD_BUF_SZ (8*1024)
-
-struct radeon_store {
- GLuint statenr;
- GLuint primnr;
- char cmd_buf[RADEON_CMD_BUF_SZ];
- int cmd_used;
- int elts_start;
-};
-
-
-/* radeon_tcl.c
- */
-struct radeon_tcl_info {
- GLuint vertex_format;
- GLint last_offset;
- GLuint hw_primitive;
-
- struct radeon_dma_region *aos_components[8];
- GLuint nr_aos_components;
-
- GLuint *Elts;
-
- struct radeon_dma_region indexed_verts;
- struct radeon_dma_region obj;
- struct radeon_dma_region rgba;
- struct radeon_dma_region spec;
- struct radeon_dma_region fog;
- struct radeon_dma_region tex[RADEON_MAX_TEXTURE_UNITS];
- struct radeon_dma_region norm;
-};
-
-
-/* radeon_swtcl.c
- */
-struct radeon_swtcl_info {
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLubyte *verts;
-
- /* Fallback rasterization functions
- */
- radeon_point_func draw_point;
- radeon_line_func draw_line;
- radeon_tri_func draw_tri;
-
- GLuint hw_primitive;
- GLenum render_primitive;
- GLuint numverts;
-
- struct radeon_dma_region indexed_verts;
-};
-
-
-struct radeon_ioctl {
- GLuint vertex_offset;
- GLuint vertex_size;
-};
-
-
-
-#define RADEON_MAX_PRIMS 64
-
-
-/* Want to keep a cache of these around. Each is parameterized by
- * only a single value which has only a small range. Only expect a
- * few, so just rescan the list each time?
- */
-struct dynfn {
- struct dynfn *next, *prev;
- int key;
- char *code;
-};
-
-struct dfn_lists {
- struct dynfn Vertex2f;
- struct dynfn Vertex2fv;
- struct dynfn Vertex3f;
- struct dynfn Vertex3fv;
- struct dynfn Color4ub;
- struct dynfn Color4ubv;
- struct dynfn Color3ub;
- struct dynfn Color3ubv;
- struct dynfn Color4f;
- struct dynfn Color4fv;
- struct dynfn Color3f;
- struct dynfn Color3fv;
- struct dynfn SecondaryColor3ubEXT;
- struct dynfn SecondaryColor3ubvEXT;
- struct dynfn SecondaryColor3fEXT;
- struct dynfn SecondaryColor3fvEXT;
- struct dynfn Normal3f;
- struct dynfn Normal3fv;
- struct dynfn TexCoord2f;
- struct dynfn TexCoord2fv;
- struct dynfn TexCoord1f;
- struct dynfn TexCoord1fv;
- struct dynfn MultiTexCoord2fARB;
- struct dynfn MultiTexCoord2fvARB;
- struct dynfn MultiTexCoord1fARB;
- struct dynfn MultiTexCoord1fvARB;
-};
-
-struct dfn_generators {
- struct dynfn *(*Vertex2f)( GLcontext *, int );
- struct dynfn *(*Vertex2fv)( GLcontext *, int );
- struct dynfn *(*Vertex3f)( GLcontext *, int );
- struct dynfn *(*Vertex3fv)( GLcontext *, int );
- struct dynfn *(*Color4ub)( GLcontext *, int );
- struct dynfn *(*Color4ubv)( GLcontext *, int );
- struct dynfn *(*Color3ub)( GLcontext *, int );
- struct dynfn *(*Color3ubv)( GLcontext *, int );
- struct dynfn *(*Color4f)( GLcontext *, int );
- struct dynfn *(*Color4fv)( GLcontext *, int );
- struct dynfn *(*Color3f)( GLcontext *, int );
- struct dynfn *(*Color3fv)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, int );
- struct dynfn *(*Normal3f)( GLcontext *, int );
- struct dynfn *(*Normal3fv)( GLcontext *, int );
- struct dynfn *(*TexCoord2f)( GLcontext *, int );
- struct dynfn *(*TexCoord2fv)( GLcontext *, int );
- struct dynfn *(*TexCoord1f)( GLcontext *, int );
- struct dynfn *(*TexCoord1fv)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, int );
-};
-
-
-
-struct radeon_prim {
- GLuint start;
- GLuint end;
- GLuint prim;
-};
-
-struct radeon_vbinfo {
- GLint counter, initial_counter;
- GLint *dmaptr;
- void (*notify)( void );
- GLint vertex_size;
-
- /* A maximum total of 15 elements per vertex: 3 floats for position, 3
- * floats for normal, 4 floats for color, 4 bytes for secondary color,
- * 2 floats for each texture unit (4 floats total).
- *
- * As soon as the 3rd TMU is supported or cube maps (or 3D textures) are
- * supported, this value will grow.
- *
- * The position data is never actually stored here, so 3 elements could be
- * trimmed out of the buffer.
- */
- union { float f; int i; radeon_color_t color; } vertex[15];
-
- GLfloat *normalptr;
- GLfloat *floatcolorptr;
- radeon_color_t *colorptr;
- GLfloat *floatspecptr;
- radeon_color_t *specptr;
- GLfloat *texcoordptr[2];
-
- GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */
- GLuint primflags;
- GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */
- GLboolean installed;
- GLboolean fell_back;
- GLboolean recheck;
- GLint nrverts;
- GLuint vertex_format;
-
- GLuint installed_vertex_format;
- GLuint installed_color_3f_sz;
-
- struct radeon_prim primlist[RADEON_MAX_PRIMS];
- int nrprims;
-
- struct dfn_lists dfn_cache;
- struct dfn_generators codegen;
- GLvertexformat vtxfmt;
-};
-
-
-
-
-struct radeon_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- struct radeon_hw_state hw;
- struct radeon_state state;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ RADEON_NR_TEX_HEAPS ];
- driTextureObject swapped;
- int texture_depth;
-
-
- /* Rasterization and vertex state:
- */
- GLuint TclFallback;
- GLuint Fallback;
- GLuint NewGLState;
-
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Vertex buffers
- */
- struct radeon_ioctl ioctl;
- struct radeon_dma dma;
- struct radeon_store store;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Busy waiting
- */
- GLuint do_usleeps;
- GLuint do_irqs;
- GLuint irqsEmitted;
- drmRadeonIrqWait iw;
-
- /* Drawable, cliprect and scissor information
- */
- GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
- unsigned int lastStamp;
- GLboolean lost_context;
- radeonScreenPtr radeonScreen; /* Screen private DRI data */
- RADEONSAREAPrivPtr sarea; /* Private SAREA data */
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[RADEON_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[RADEON_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[RADEON_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexGenEnabled;
- GLmatrix tmpmat;
- GLuint last_ReallyEnabled;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- uint64_t swap_ust;
- uint64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
- PFNGLXGETUSTPROC get_ust;
-
- /* radeon_tcl.c
- */
- struct radeon_tcl_info tcl;
-
- /* radeon_swtcl.c
- */
- struct radeon_swtcl_info swtcl;
-
- /* radeon_vtxfmt.c
- */
- struct radeon_vbinfo vb;
-
- /* Mirrors of some DRI state
- */
- struct radeon_dri_mirror dri;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-
-
- /* Performance counters
- */
- GLuint boxes; /* Draw performance boxes */
- GLuint hardwareWentIdle;
- GLuint c_clears;
- GLuint c_drawWaits;
- GLuint c_textureSwaps;
- GLuint c_textureBytes;
- GLuint c_vertexBuffers;
-};
-
-#define RADEON_CONTEXT(ctx) ((radeonContextPtr)(ctx->DriverCtx))
-
-
-static __inline GLuint radeonPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return PACK_COLOR_565( r, g, b );
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define RADEON_OLD_PACKETS 1
-
-
-extern void radeonDestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean radeonCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-extern void radeonSwapBuffers( __DRIdrawablePrivate *dPriv );
-extern GLboolean radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-extern GLboolean radeonUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int RADEON_DEBUG;
-#else
-#define RADEON_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x001
-#define DEBUG_STATE 0x002
-#define DEBUG_IOCTL 0x004
-#define DEBUG_PRIMS 0x008
-#define DEBUG_VERTS 0x010
-#define DEBUG_FALLBACKS 0x020
-#define DEBUG_VFMT 0x040
-#define DEBUG_CODEGEN 0x080
-#define DEBUG_VERBOSE 0x100
-#define DEBUG_DRI 0x200
-#define DEBUG_DMA 0x400
-#define DEBUG_SANITY 0x800
-
-#endif
-#endif /* __RADEON_CONTEXT_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
deleted file mode 100644
index 483733305..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
+++ /dev/null
@@ -1,1179 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.11 2003/01/29 22:04:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "swrast/swrast.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tcl.h"
-#include "radeon_sanity.h"
-
-#include "radeon_macros.h" /* for INREG() */
-
-#include "vblank.h"
-
-#define RADEON_TIMEOUT 512
-#define RADEON_IDLE_RETRY 16
-
-
-static void radeonWaitForIdle( radeonContextPtr rmesa );
-
-/* =============================================================
- * Kernel command buffer handling
- */
-
-static void print_state_atom( struct radeon_state_atom *state )
-{
- int i;
-
- fprintf(stderr, "emit %s/%d\n", state->name, state->cmd_size);
-
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < state->cmd_size ; i++)
- fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]);
-
-}
-
-static void radeon_emit_state_list( radeonContextPtr rmesa,
- struct radeon_state_atom *list )
-{
- struct radeon_state_atom *state, *tmp;
- char *dest;
-
- /* From Felix Kuhling: similar to some other lockups, glaxium will
- * lock with what we believe to be a normal command stream, but
- * sprinkling some magic waits arounds allows it to run
- * uninterrupted. This has a slight effect on q3 framerates, but
- * it might now be possible to remove the zbs hack, below.
- *
- * Felix reports that this can be narrowed down to just
- * tcl,tex0,tex1 state, but that's pretty much every statechange,
- * so let's just put the wait in always (unless Felix wants to
- * narrow it down further...)
- */
- if (1) {
- drmRadeonCmdHeader *cmd;
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, sizeof(*cmd),
- __FUNCTION__ );
- cmd->wait.cmd_type = RADEON_CMD_WAIT;
- cmd->wait.flags = RADEON_WAIT_3D;
- }
-
- foreach_s( state, tmp, list ) {
- if (state->check( rmesa->glCtx )) {
- dest = radeonAllocCmdBuf( rmesa, state->cmd_size * 4, __FUNCTION__);
- memcpy( dest, state->cmd, state->cmd_size * 4);
- move_to_head( &(rmesa->hw.clean), state );
- if (RADEON_DEBUG & DEBUG_STATE)
- print_state_atom( state );
- }
- else if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "skip state %s\n", state->name);
- }
-}
-
-
-void radeonEmitState( radeonContextPtr rmesa )
-{
- struct radeon_state_atom *state, *tmp;
-
- if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Somewhat overkill:
- */
- if (rmesa->lost_context) {
- if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s - lost context\n", __FUNCTION__);
-
- foreach_s( state, tmp, &(rmesa->hw.clean) )
- move_to_tail(&(rmesa->hw.dirty), state );
-
- rmesa->lost_context = 0;
- }
- else if (1) {
- /* This is a darstardly kludge to work around a lockup that I
- * haven't otherwise figured out.
- */
- move_to_tail(&(rmesa->hw.dirty), &(rmesa->hw.zbs) );
- }
-
- if (!(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- foreach_s( state, tmp, &(rmesa->hw.dirty) ) {
- if (state->is_tcl) {
- move_to_head( &(rmesa->hw.clean), state );
- }
- }
- }
-
- radeon_emit_state_list( rmesa, &rmesa->hw.dirty );
-}
-
-
-
-/* Fire a section of the retained (indexed_verts) buffer as a regular
- * primtive.
- */
-extern void radeonEmitVbufPrim( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint vertex_nr )
-{
- drmRadeonCmdHeader *cmd;
-
-
- assert(!(primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- radeonEmitState( rmesa );
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s cmd_used/4: %d\n", __FUNCTION__,
- rmesa->store.cmd_used/4);
-
-#if RADEON_OLD_PACKETS
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, 6 * sizeof(*cmd),
- __FUNCTION__ );
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM | (3 << 16);
- cmd[2].i = rmesa->ioctl.vertex_offset;
- cmd[3].i = vertex_nr;
- cmd[4].i = vertex_format;
- cmd[5].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_LIST |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
- (vertex_nr << RADEON_CP_VC_CNTL_NUM_SHIFT));
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x offt 0x%x vfmt 0x%x vfcntl %x \n",
- __FUNCTION__,
- cmd[1].i, cmd[2].i, cmd[4].i, cmd[5].i);
-#else
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, 4 * sizeof(*cmd),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_DRAW_VBUF | (1 << 16);
- cmd[2].i = vertex_format;
- cmd[3].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_LIST |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_MAOS_ENABLE |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
- (vertex_nr << RADEON_CP_VC_CNTL_NUM_SHIFT));
-
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x vfmt 0x%x vfcntl %x \n",
- __FUNCTION__,
- cmd[1].i, cmd[2].i, cmd[3].i);
-#endif
-}
-
-
-void radeonFlushElts( radeonContextPtr rmesa )
-{
- int *cmd = (int *)(rmesa->store.cmd_buf + rmesa->store.elts_start);
- int dwords;
-#if RADEON_OLD_PACKETS
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 24)) / 2;
-#else
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 16)) / 2;
-#endif
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert( rmesa->dma.flush == radeonFlushElts );
- rmesa->dma.flush = 0;
-
- /* Cope with odd number of elts:
- */
- rmesa->store.cmd_used = (rmesa->store.cmd_used + 2) & ~2;
- dwords = (rmesa->store.cmd_used - rmesa->store.elts_start) / 4;
-
-#if RADEON_OLD_PACKETS
- cmd[1] |= (dwords - 3) << 16;
- cmd[5] |= nr << RADEON_CP_VC_CNTL_NUM_SHIFT;
-#else
- cmd[1] |= (dwords - 3) << 16;
- cmd[3] |= nr << RADEON_CP_VC_CNTL_NUM_SHIFT;
-#endif
-}
-
-
-GLushort *radeonAllocEltsOpenEnded( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint min_nr )
-{
- drmRadeonCmdHeader *cmd;
- GLushort *retval;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, min_nr);
-
- assert((primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- radeonEmitState( rmesa );
-
-#if RADEON_OLD_PACKETS
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa,
- 24 + min_nr*2,
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM;
- cmd[2].i = rmesa->ioctl.vertex_offset;
- cmd[3].i = 0xffff;
- cmd[4].i = vertex_format;
- cmd[5].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_IND |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE);
-
- retval = (GLushort *)(cmd+6);
-#else
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa,
- 16 + min_nr*2,
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_DRAW_INDX;
- cmd[2].i = vertex_format;
- cmd[3].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_IND |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_MAOS_ENABLE |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE);
-
- retval = (GLushort *)(cmd+4);
-#endif
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x vfmt 0x%x prim %x \n",
- __FUNCTION__,
- cmd[1].i, vertex_format, primitive);
-
- assert(!rmesa->dma.flush);
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = radeonFlushElts;
-
- rmesa->store.elts_start = ((char *)cmd) - rmesa->store.cmd_buf;
-
- return retval;
-}
-
-
-
-void radeonEmitVertexAOS( radeonContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset )
-{
-#if RADEON_OLD_PACKETS
- rmesa->ioctl.vertex_size = vertex_size;
- rmesa->ioctl.vertex_offset = offset;
-#else
- drmRadeonCmdHeader *cmd;
-
- if (RADEON_DEBUG & (DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s: vertex_size 0x%x offset 0x%x \n",
- __FUNCTION__, vertex_size, offset);
-
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, 5 * sizeof(int),
- __FUNCTION__ );
-
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_3D_LOAD_VBPNTR | (2 << 16);
- cmd[2].i = 1;
- cmd[3].i = vertex_size | (vertex_size << 8);
- cmd[4].i = offset;
-#endif
-}
-
-
-void radeonEmitAOS( radeonContextPtr rmesa,
- struct radeon_dma_region **component,
- GLuint nr,
- GLuint offset )
-{
-#if RADEON_OLD_PACKETS
- assert( nr == 1 );
- assert( component[0]->aos_size == component[0]->aos_stride );
- rmesa->ioctl.vertex_size = component[0]->aos_size;
- rmesa->ioctl.vertex_offset =
- (component[0]->aos_start + offset * component[0]->aos_stride * 4);
-#else
- drmRadeonCmdHeader *cmd;
- int sz = 3 + (nr/2 * 3) + (nr & 1) * 2;
- int i;
- int *tmp;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, sz * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_3D_LOAD_VBPNTR | ((sz-3) << 16);
- cmd[2].i = nr;
- tmp = &cmd[0].i;
- cmd += 3;
-
- for (i = 0 ; i < nr ; i++) {
- if (i & 1) {
- cmd[0].i |= ((component[i]->aos_stride << 24) |
- (component[i]->aos_size << 16));
- cmd[2].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- cmd += 3;
- }
- else {
- cmd[0].i = ((component[i]->aos_stride << 8) |
- (component[i]->aos_size << 0));
- cmd[1].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- }
- }
-
- if (RADEON_DEBUG & DEBUG_VERTS) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- for (i = 0 ; i < sz ; i++)
- fprintf(stderr, " %d: %x\n", i, tmp[i]);
- }
-#endif
-}
-
-/* using already shifted color_fmt! */
-void radeonEmitBlit( radeonContextPtr rmesa, /* FIXME: which drmMinor is required? */
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h )
-{
- drmRadeonCmdHeader *cmd;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s src %x/%x %d,%d dst: %x/%x %d,%d sz: %dx%d\n",
- __FUNCTION__,
- src_pitch, src_offset, srcx, srcy,
- dst_pitch, dst_offset, dstx, dsty,
- w, h);
-
- assert( (src_pitch & 63) == 0 );
- assert( (dst_pitch & 63) == 0 );
- assert( (src_offset & 1023) == 0 );
- assert( (dst_offset & 1023) == 0 );
- assert( w < (1<<16) );
- assert( h < (1<<16) );
-
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, 8 * sizeof(int),
- __FUNCTION__ );
-
-
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_CNTL_BITBLT_MULTI | (5 << 16);
- cmd[2].i = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
- RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- color_fmt |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_MEMORY |
- RADEON_GMC_CLR_CMP_CNTL_DIS |
- RADEON_GMC_WR_MSK_DIS );
-
- cmd[3].i = ((src_pitch/64)<<22) | (src_offset >> 10);
- cmd[4].i = ((dst_pitch/64)<<22) | (dst_offset >> 10);
- cmd[5].i = (srcx << 16) | srcy;
- cmd[6].i = (dstx << 16) | dsty; /* dst */
- cmd[7].i = (w << 16) | h;
-}
-
-
-void radeonEmitWait( radeonContextPtr rmesa, GLuint flags )
-{
- if (rmesa->dri.drmMinor >= 6) {
- drmRadeonCmdHeader *cmd;
-
- assert( !(flags & ~(RADEON_WAIT_2D|RADEON_WAIT_3D)) );
-
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, 1 * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].wait.cmd_type = RADEON_CMD_WAIT;
- cmd[0].wait.flags = flags;
- }
-}
-
-
-static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
- const char * caller )
-{
- int ret, i;
- drmRadeonCmdBuffer cmd;
-
- if (RADEON_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < rmesa->store.cmd_used ; i += 4 )
- fprintf(stderr, "%d: %x\n", i/4,
- *(int *)(&rmesa->store.cmd_buf[i]));
- }
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "%s: Releasing %d buffers\n", __FUNCTION__,
- rmesa->dma.nr_released_bufs);
-
-
- if (RADEON_DEBUG & DEBUG_SANITY) {
- if (rmesa->state.scissor.enabled)
- ret = radeonSanityCmdBuffer( rmesa,
- rmesa->state.scissor.numClipRects,
- rmesa->state.scissor.pClipRects);
- else
- ret = radeonSanityCmdBuffer( rmesa,
- rmesa->numClipRects,
- rmesa->pClipRects);
- if (ret) {
- fprintf(stderr, "drmSanityCommandWrite: %d\n", ret);
- goto out;
- }
- }
-
-
- cmd.bufsz = rmesa->store.cmd_used;
- cmd.buf = rmesa->store.cmd_buf;
-
- if (rmesa->state.scissor.enabled) {
- cmd.nbox = rmesa->state.scissor.numClipRects;
- cmd.boxes = (drmClipRect *)rmesa->state.scissor.pClipRects;
- } else {
- cmd.nbox = rmesa->numClipRects;
- cmd.boxes = (drmClipRect *)rmesa->pClipRects;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd,
- DRM_RADEON_CMDBUF,
- &cmd, sizeof(cmd) );
-
- if (ret)
- fprintf(stderr, "drmCommandWrite: %d\n", ret);
-
- out:
- rmesa->store.primnr = 0;
- rmesa->store.statenr = 0;
- rmesa->store.cmd_used = 0;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->lost_context = 1;
- return ret;
-}
-
-
-/* Note: does not emit any commands to avoid recursion on
- * radeonAllocCmdBuf.
- */
-void radeonFlushCmdBuf( radeonContextPtr rmesa, const char *caller )
-{
- int ret;
-
-
- LOCK_HARDWARE( rmesa );
-
- ret = radeonFlushCmdBufLocked( rmesa, caller );
-
- UNLOCK_HARDWARE( rmesa );
-
- if (ret) {
- fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
- exit(ret);
- }
-}
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-
-void radeonRefillCurrentDmaRegion( radeonContextPtr rmesa )
-{
- struct radeon_dma_buffer *dmabuf;
- int fd = rmesa->dri.fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- int ret;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush) {
- rmesa->dma.flush( rmesa );
- }
-
- if (rmesa->dma.current.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
-
- if (rmesa->dma.nr_released_bufs > 4)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-
- dma.context = rmesa->dri.hwContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = RADEON_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- LOCK_HARDWARE(rmesa); /* no need to validate */
-
- ret = drmDMA( fd, &dma );
-
- if (ret != 0) {
- /* Free some up this way?
- */
- if (rmesa->dma.nr_released_bufs) {
- radeonFlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Waiting for buffers\n");
-
- radeonWaitForIdleLocked( rmesa );
- ret = drmDMA( fd, &dma );
-
- if ( ret != 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Could not get dma buffer... exiting\n" );
- exit( -1 );
- }
- }
-
- UNLOCK_HARDWARE(rmesa);
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Allocated buffer %d\n", index);
-
- dmabuf = CALLOC_STRUCT( radeon_dma_buffer );
- dmabuf->buf = &rmesa->radeonScreen->buffers->list[index];
- dmabuf->refcount = 1;
-
- rmesa->dma.current.buf = dmabuf;
- rmesa->dma.current.address = dmabuf->buf->address;
- rmesa->dma.current.end = dmabuf->buf->total;
- rmesa->dma.current.start = 0;
- rmesa->dma.current.ptr = 0;
-
- rmesa->c_vertexBuffers++;
-}
-
-void radeonReleaseDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- const char *caller )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (!region->buf)
- return;
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (--region->buf->refcount == 0) {
- drmRadeonCmdHeader *cmd;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
- region->buf->buf->idx);
-
- cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, sizeof(*cmd),
- __FUNCTION__ );
- cmd->dma.cmd_type = RADEON_CMD_DMA_DISCARD;
- cmd->dma.buf_idx = region->buf->buf->idx;
- FREE(region->buf);
- rmesa->dma.nr_released_bufs++;
- }
-
- region->buf = 0;
- region->start = 0;
-}
-
-/* Allocates a region from rmesa->dma.current. If there isn't enough
- * space in current, grab a new buffer (and discard what was left of current)
- */
-void radeonAllocDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int bytes,
- int alignment )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (region->buf)
- radeonReleaseDmaRegion( rmesa, region, __FUNCTION__ );
-
- alignment--;
- rmesa->dma.current.start = rmesa->dma.current.ptr =
- (rmesa->dma.current.ptr + alignment) & ~alignment;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- radeonRefillCurrentDmaRegion( rmesa );
-
- region->start = rmesa->dma.current.start;
- region->ptr = rmesa->dma.current.start;
- region->end = rmesa->dma.current.start + bytes;
- region->address = rmesa->dma.current.address;
- region->buf = rmesa->dma.current.buf;
- region->buf->refcount++;
-
- rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */
- rmesa->dma.current.start =
- rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7;
-}
-
-void radeonAllocDmaRegionVerts( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int numverts,
- int vertsize,
- int alignment )
-{
- radeonAllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
-}
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static CARD32 radeonGetLastFrame (radeonContextPtr rmesa)
-{
- unsigned char *RADEONMMIO = rmesa->radeonScreen->mmio.map;
- int ret;
- CARD32 frame;
-
- if (rmesa->dri.screen->drmMinor >= 4) {
- drmRadeonGetParam gp;
-
- gp.param = RADEON_PARAM_LAST_FRAME;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp) );
- }
- else
- ret = -EINVAL;
-
-#ifndef __alpha__
- if ( ret == -EINVAL ) {
- frame = INREG( RADEON_LAST_FRAME_REG );
- ret = 0;
- }
-#endif
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- return frame;
-}
-
-static void radeonEmitIrqLocked( radeonContextPtr rmesa )
-{
- drmRadeonIrqEmit ie;
- int ret;
-
- ie.irq_seq = &rmesa->iw.irq_seq;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void radeonWaitIrq( radeonContextPtr rmesa )
-{
- int ret;
-
- do {
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
- &rmesa->iw, sizeof(rmesa->iw) );
- } while (ret && (errno == EINTR || errno == EAGAIN));
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void radeonWaitForFrameCompletion( radeonContextPtr rmesa )
-{
- RADEONSAREAPrivPtr sarea = rmesa->sarea;
-
- if (rmesa->do_irqs) {
- if (radeonGetLastFrame(rmesa) < sarea->last_frame) {
- if (!rmesa->irqsEmitted) {
- while (radeonGetLastFrame (rmesa) < sarea->last_frame)
- ;
- }
- else {
- UNLOCK_HARDWARE( rmesa );
- radeonWaitIrq( rmesa );
- LOCK_HARDWARE( rmesa );
- }
- rmesa->irqsEmitted = 10;
- }
-
- if (rmesa->irqsEmitted) {
- radeonEmitIrqLocked( rmesa );
- rmesa->irqsEmitted--;
- }
- }
- else {
- while (radeonGetLastFrame (rmesa) < sarea->last_frame) {
- UNLOCK_HARDWARE( rmesa );
- if (rmesa->do_usleeps)
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- radeonContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
- int64_t ust;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, rmesa->glCtx );
- }
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_SWAP_BUFFERS: return = %d\n", ret );
- UNLOCK_HARDWARE( rmesa );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->swap_count++;
- (*rmesa->get_ust)( & ust );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- rmesa->swap_missed_ust = ust - rmesa->swap_ust;
- }
-
- rmesa->swap_ust = ust;
-}
-
-void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
-{
- radeonContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__,
- rmesa->sarea->pfCurrentPage);
- }
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* Need to do this for the perf box placement:
- */
- if (dPriv->numClipRects)
- {
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- b[0] = box[0];
- rmesa->sarea->nbox = 1;
- }
-
- /* Throttle the frame rate -- only allow a few pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- (void) (*rmesa->get_ust)( & rmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( rmesa );
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- rmesa->swap_count++;
- (void) (*rmesa->get_ust)( & rmesa->swap_ust );
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->radeonScreen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-#define RADEON_MAX_CLEARS 256
-
-static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- RADEONSAREAPrivPtr sarea = rmesa->sarea;
- unsigned char *RADEONMMIO = rmesa->radeonScreen->mmio.map;
- CARD32 clear;
- GLuint flags = 0;
- GLuint color_mask = 0;
- GLint ret, i;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
- }
-
- radeonEmitState( rmesa );
-
- /* Need to cope with lostcontext here as kernel relies on
- * some residual state:
- */
- RADEON_FIREVERTICES( rmesa );
-
- if ( mask & DD_FRONT_LEFT_BIT ) {
- flags |= RADEON_FRONT;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_FRONT_LEFT_BIT;
- }
-
- if ( mask & DD_BACK_LEFT_BIT ) {
- flags |= RADEON_BACK;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if ( mask & DD_DEPTH_BIT ) {
- if ( ctx->Depth.Mask ) flags |= RADEON_DEPTH; /* FIXME: ??? */
- mask &= ~DD_DEPTH_BIT;
- }
-
- if ( (mask & DD_STENCIL_BIT) && rmesa->state.stencil.hwBuffer ) {
- flags |= RADEON_STENCIL;
- mask &= ~DD_STENCIL_BIT;
- }
-
- if ( mask ) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
- }
-
- if ( !flags )
- return;
-
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the number of clear ioctls we do.
- */
- while ( 1 ) {
- int ret;
-
- if (rmesa->dri.screen->drmMinor >= 4) {
- drmRadeonGetParam gp;
-
- gp.param = RADEON_PARAM_LAST_CLEAR;
- gp.value = (int *)&clear;
- ret = drmCommandWriteRead( rmesa->dri.fd,
- DRM_RADEON_GETPARAM, &gp, sizeof(gp) );
- } else
- ret = -EINVAL;
-
-#ifndef __alpha__
- if ( ret == -EINVAL ) {
- clear = INREG( RADEON_LAST_CLEAR_REG );
- ret = 0;
- }
-#endif
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s( %d )\n", __FUNCTION__, (int)clear );
- if ( ret ) fprintf( stderr, " ( RADEON_LAST_CLEAR register read directly )\n" );
- }
-
- if ( sarea->last_clear - clear <= RADEON_MAX_CLEARS ) {
- break;
- }
-
- if ( rmesa->do_usleeps ) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
- for ( i = 0 ; i < dPriv->numClipRects ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, dPriv->numClipRects );
- XF86DRIClipRectPtr box = dPriv->pClipRects;
- XF86DRIClipRectPtr b = rmesa->sarea->boxes;
- drmRadeonClearType clear;
- drmRadeonClearRect depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = rmesa->state.color.clear;
- clear.clear_depth = rmesa->state.depth.clear;
- clear.color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- clear.depth_mask = rmesa->state.stencil.clear;
- clear.depth_boxes = depth_boxes;
-
- n--;
- b = rmesa->sarea->boxes;
- for ( ; n >= 0 ; n-- ) {
- depth_boxes[n].f[RADEON_CLEAR_X1] = (float)b[n].x1;
- depth_boxes[n].f[RADEON_CLEAR_Y1] = (float)b[n].y1;
- depth_boxes[n].f[RADEON_CLEAR_X2] = (float)b[n].x2;
- depth_boxes[n].f[RADEON_CLEAR_Y2] = (float)b[n].y2;
- depth_boxes[n].f[RADEON_CLEAR_DEPTH] =
- (float)rmesa->state.depth.clear;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_CLEAR,
- &clear, sizeof(drmRadeonClearType));
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_RADEON_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
-}
-
-
-void radeonWaitForIdleLocked( radeonContextPtr rmesa )
-{
- int fd = rmesa->dri.fd;
- int to = 0;
- int ret, i = 0;
-
- rmesa->c_drawWaits++;
-
- do {
- do {
- ret = drmCommandNone( fd, DRM_RADEON_CP_IDLE);
- } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY );
- } while ( ( ret == -EBUSY ) && ( to++ < RADEON_TIMEOUT ) );
-
- if ( ret < 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Radeon timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-
-static void radeonWaitForIdle( radeonContextPtr rmesa )
-{
- LOCK_HARDWARE(rmesa);
- radeonWaitForIdleLocked( rmesa );
- UNLOCK_HARDWARE(rmesa);
-}
-
-
-void radeonFlush( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (!is_empty_list(&rmesa->hw.dirty))
- radeonEmitState( rmesa );
-
- if (rmesa->store.cmd_used)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-void radeonFinish( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeonFlush( ctx );
-
- if (rmesa->do_irqs) {
- LOCK_HARDWARE( rmesa );
- radeonEmitIrqLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- radeonWaitIrq( rmesa );
- }
- else
- radeonWaitForIdle( rmesa );
-}
-
-
-void radeonInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = radeonClear;
- ctx->Driver.Finish = radeonFinish;
- ctx->Driver.Flush = radeonFlush;
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h
deleted file mode 100644
index 3f6e1751c..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.6 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_IOCTL_H__
-#define __RADEON_IOCTL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "simple_list.h"
-#include "radeon_lock.h"
-
-
-extern void radeonEmitState( radeonContextPtr rmesa );
-extern void radeonEmitVertexAOS( radeonContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset );
-
-extern void radeonEmitVbufPrim( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint vertex_nr );
-
-extern void radeonFlushElts( radeonContextPtr rmesa );
-
-extern GLushort *radeonAllocEltsOpenEnded( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint min_nr );
-
-extern void radeonEmitAOS( radeonContextPtr rmesa,
- struct radeon_dma_region **regions,
- GLuint n,
- GLuint offset );
-
-extern void radeonEmitBlit( radeonContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h );
-
-extern void radeonEmitWait( radeonContextPtr rmesa, GLuint flags );
-
-extern void radeonFlushCmdBuf( radeonContextPtr rmesa, const char * );
-extern void radeonRefillCurrentDmaRegion( radeonContextPtr rmesa );
-
-extern void radeonAllocDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int bytes,
- int alignment );
-
-extern void radeonAllocDmaRegionVerts( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int numverts,
- int vertsize,
- int alignment );
-
-extern void radeonReleaseDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- const char *caller );
-
-extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable );
-extern void radeonPageFlip( const __DRIdrawablePrivate *drawable );
-extern void radeonFlush( GLcontext *ctx );
-extern void radeonFinish( GLcontext *ctx );
-extern void radeonWaitForIdleLocked( radeonContextPtr rmesa );
-extern void radeonWaitForVBlank( radeonContextPtr rmesa );
-extern void radeonInitIoctlFuncs( GLcontext *ctx );
-extern void radeonGetAllParams( radeonContextPtr rmesa );
-
-/* radeon_compat.c:
- */
-extern void radeonCompatEmitPrimitive( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint hw_primitive,
- GLuint nrverts );
-
-
-/* ================================================================
- * Helper macros:
- */
-
-/* Close off the last primitive, if it exists.
- */
-#define RADEON_NEWPRIM( rmesa ) \
-do { \
- if ( rmesa->dma.flush ) \
- rmesa->dma.flush( rmesa ); \
-} while (0)
-
-/* Can accomodate several state changes and primitive changes without
- * actually firing the buffer.
- */
-#define RADEON_STATECHANGE( rmesa, ATOM ) \
-do { \
- RADEON_NEWPRIM( rmesa ); \
- move_to_head( &(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \
-} while (0)
-
-#define RADEON_DB_STATE( ATOM ) \
- memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \
- rmesa->hw.ATOM.cmd_size * 4)
-
-static __inline int RADEON_DB_STATECHANGE(
- radeonContextPtr rmesa,
- struct radeon_state_atom *atom )
-{
- if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size*4)) {
- int *tmp;
- RADEON_NEWPRIM( rmesa );
- move_to_head( &(rmesa->hw.dirty), atom );
- tmp = atom->cmd;
- atom->cmd = atom->lastcmd;
- atom->lastcmd = tmp;
- return 1;
- }
- else
- return 0;
-}
-
-
-/* Fire the buffered vertices no matter what.
- */
-#define RADEON_FIREVERTICES( rmesa ) \
-do { \
- if ( rmesa->store.cmd_used || rmesa->dma.flush ) { \
- radeonFlush( rmesa->glCtx ); \
- } \
-} while (0)
-
-/* Alloc space in the command buffer
- */
-static __inline char *radeonAllocCmdBuf( radeonContextPtr rmesa,
- int bytes, const char *where )
-{
- if (rmesa->store.cmd_used + bytes > RADEON_CMD_BUF_SZ)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-
- assert(rmesa->dri.drmMinor >= 3);
-
- {
- char *head = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- rmesa->store.cmd_used += bytes;
- return head;
- }
-}
-
-
-
-
-#endif
-#endif /* __RADEON_IOCTL_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c
deleted file mode 100644
index fb285157a..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.5 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include "glheader.h"
-#include "radeon_context.h"
-#include "radeon_lock.h"
-#include "radeon_tex.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-radeonUpdatePageFlipping( radeonContextPtr rmesa )
-{
- int use_back;
-
-
- rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if ( RADEON_DEBUG & DEBUG_VERBOSE )
- fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
- rmesa->doPageFlip,
- rmesa->sarea->pfCurrentPage );
-
- if ( use_back ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->radeonScreen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- __DRIscreenPrivate *sPriv = rmesa->dri.screen;
- RADEONSAREAPrivPtr sarea = rmesa->sarea;
-
- drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( rmesa->lastStamp != dPriv->lastStamp ) {
- radeonUpdatePageFlipping( rmesa );
- if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
- radeonSetCliprects( rmesa, GL_BACK_LEFT );
- else
- radeonSetCliprects( rmesa, GL_FRONT_LEFT );
- radeonUpdateViewportOffset( rmesa->glCtx );
- rmesa->lastStamp = dPriv->lastStamp;
- }
-
- if ( sarea->ctxOwner != rmesa->dri.hwContext ) {
- int i;
- sarea->ctxOwner = rmesa->dri.hwContext;
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[ i ] );
- }
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h
deleted file mode 100644
index 783db7e92..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h,v 1.3 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_LOCK_H__
-#define __RADEON_LOCK_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void radeonGetLock( radeonContextPtr rmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->dri.hwLock, rmesa->dri.hwContext, \
- (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret ); \
- if ( __ret ) \
- radeonGetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->dri.fd, \
- rmesa->dri.hwLock, \
- rmesa->dri.hwContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
-#endif /* __RADEON_LOCK_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.c
deleted file mode 100644
index c62edd715..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.c
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-/* If using new packets, can choose either verts or arrays.
- * Otherwise, must use verts.
- */
-#include "radeon_context.h"
-#define RADEON_MAOS_VERTS 1
-#if (RADEON_MAOS_VERTS) || (RADEON_OLD_PACKETS)
-#include "radeon_maos_verts.c"
-#else
-#include "radeon_maos_arrays.c"
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h
deleted file mode 100644
index 8c8aa15c5..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Grahpics Inc., Austin, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_MAOS_H__
-#define __RADEON_MAOS_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "radeon_context.h"
-
-extern void radeonEmitArrays( GLcontext *ctx, GLuint inputs );
-extern void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c
deleted file mode 100644
index fc55b89b0..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "mmath.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_imm_debug.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-/* Usage:
- * - from radeon_tcl_render
- * - call radeonEmitArrays to ensure uptodate arrays in dma
- * - emit primitives (new type?) which reference the data
- * -- need to use elts for lineloop, quads, quadstrip/flat
- * -- other primitives are all well-formed (need tristrip-1,fake-poly)
- *
- */
-static void emit_ubyte_rgba3( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- radeon_color_t *out = (radeon_color_t *)(rvb->start + rvb->address);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p\n",
- __FUNCTION__, count, stride, out);
-
- for (i = 0; i < count; i++) {
- out->red = *data;
- out->green = *(data+1);
- out->blue = *(data+2);
- out->alpha = 0xFF;
- out++;
- data += stride;
- }
-}
-
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-
-static void emit_ubyte_rgba4( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS( out, data, count );
- else
- for (i = 0; i < count; i++) {
- *out++ = LE32_TO_CPU(*(int *)data);
- data += stride;
- }
-}
-
-
-static void emit_ubyte_rgba( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = 1;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, 4 * count, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 1;
- rvb->aos_size = 1;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 3:
- emit_ubyte_rgba3( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_ubyte_rgba4( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-
-
-
-
-static void emit_vec8( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 8)
- COPY_DWORDS( out, data, count*2 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out += 2;
- data += stride;
- }
-}
-
-static void emit_vec12( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, out, data);
-
- if (stride == 12)
- COPY_DWORDS( out, data, count*3 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out += 3;
- data += stride;
- }
-}
-
-static void emit_vec16( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 16)
- COPY_DWORDS( out, data, count*4 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out[3] = *(int *)(data+12);
- out += 4;
- data += stride;
- }
-}
-
-
-static void emit_vector( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d size %d stride %d\n",
- __FUNCTION__, count, size, stride);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, size * 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = size;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, size * count * 4, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = size;
- rvb->aos_size = size;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec12( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_vec16( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-
-}
-
-
-
-static void emit_s0_vec( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = 0;
- out += 2;
- data += stride;
- }
-}
-
-static void emit_stq_vec( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+12);
- out += 3;
- data += stride;
- }
-}
-
-
-
-
-static void emit_tex_vector( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int emitsize;
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- switch (size) {
- case 4: emitsize = 3; break;
- default: emitsize = 2; break;
- }
-
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, 4 * emitsize, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = emitsize;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, 4 * emitsize * count, 4 );
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = emitsize;
- rvb->aos_size = emitsize;
- }
-
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_s0_vec( ctx, rvb, data, stride, count );
- break;
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_stq_vec( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-
-
-
-
-/* Emit any changed arrays to new GART memory, re-emit a packet to
- * update the arrays.
- */
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- struct radeon_dma_region **component = rmesa->tcl.aos_components;
- GLuint nr = 0;
- GLuint vfmt = 0;
- GLuint count = VB->Count;
- GLuint vtx;
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, inputs );
-
- if (1) {
- if (!rmesa->tcl.obj.buf)
- emit_vector( ctx,
- &rmesa->tcl.obj,
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
- count);
-
- switch( VB->ObjPtr->size ) {
- case 4: vfmt |= RADEON_CP_VC_FRMT_W0;
- case 3: vfmt |= RADEON_CP_VC_FRMT_Z;
- case 2: vfmt |= RADEON_CP_VC_FRMT_XY;
- default:
- }
- component[nr++] = &rmesa->tcl.obj;
- }
-
-
- if (inputs & VERT_BIT_NORMAL) {
- if (!rmesa->tcl.norm.buf)
- emit_vector( ctx,
- &(rmesa->tcl.norm),
- (char *)VB->NormalPtr->data,
- 3,
- VB->NormalPtr->stride,
- count);
-
- vfmt |= RADEON_CP_VC_FRMT_N0;
- component[nr++] = &rmesa->tcl.norm;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
- if (!rmesa->tcl.rgba.buf)
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.rgba,
- (char *)VB->ColorPtr[0]->Ptr,
- VB->ColorPtr[0]->Size,
- VB->ColorPtr[0]->StrideB,
- count);
-
- vfmt |= RADEON_CP_VC_FRMT_PKCOLOR;
- }
- else {
- int emitsize;
-
- if (VB->ColorPtr[0]->Size == 4 &&
- (VB->ColorPtr[0]->StrideB != 0 ||
- ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
- emitsize = 4;
- }
- else {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->Ptr,
- emitsize,
- VB->ColorPtr[0]->StrideB,
- count);
- }
-
- component[nr++] = &rmesa->tcl.rgba;
- }
-
-
- if (inputs & VERT_BIT_COLOR1) {
- if (!rmesa->tcl.spec.buf) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- radeon_import_float_spec_colors( ctx );
-
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->Ptr,
- 3,
- VB->SecondaryColorPtr[0]->StrideB,
- count);
- }
-
- vfmt |= RADEON_CP_VC_FRMT_PKSPEC;
- component[nr++] = &rmesa->tcl.spec;
- }
-
- vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
- ~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
-
- if (inputs & VERT_BIT_TEX0) {
- if (!rmesa->tcl.tex[0].buf)
- emit_tex_vector( ctx,
- &(rmesa->tcl.tex[0]),
- (char *)VB->TexCoordPtr[0]->data,
- VB->TexCoordPtr[0]->size,
- VB->TexCoordPtr[0]->stride,
- count );
-
- switch( VB->TexCoordPtr[0]->size ) {
- case 4:
- vtx |= RADEON_TCL_VTX_Q0;
- vfmt |= RADEON_CP_VC_FRMT_Q0;
- default:
- vfmt |= RADEON_CP_VC_FRMT_ST0;
- }
- component[nr++] = &rmesa->tcl.tex[0];
- }
-
- if (inputs & VERT_BIT_TEX1) {
- if (!rmesa->tcl.tex[1].buf)
- emit_tex_vector( ctx,
- &(rmesa->tcl.tex[1]),
- (char *)VB->TexCoordPtr[1]->data,
- VB->TexCoordPtr[1]->size,
- VB->TexCoordPtr[1]->stride,
- count );
-
- switch( VB->TexCoordPtr[1]->size ) {
- case 4:
- vtx |= RADEON_TCL_VTX_Q1;
- vfmt |= RADEON_CP_VC_FRMT_Q1;
- default:
- vfmt |= RADEON_CP_VC_FRMT_ST1;
- }
- component[nr++] = &rmesa->tcl.tex[1];
- }
-
- if (vtx != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT]) {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] = vtx;
- }
-
- rmesa->tcl.nr_aos_components = nr;
- rmesa->tcl.vertex_format = vfmt;
-}
-
-
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-
- if (newinputs & VERT_BIT_POS)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_NORMAL)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR0)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR1)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX0)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX1)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h
deleted file mode 100644
index b379bad98..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-#undef TCL_DEBUG
-#ifndef TCL_DEBUG
-#define TCL_DEBUG 0
-#endif
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4];
- GLfloat (*fog)[4];
- GLuint (*norm)[4];
- GLubyte (*col)[4], (*spec)[4];
- GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
- GLuint tc2_stride, norm_stride;
- GLuint (*coord)[4];
- GLuint coord_stride; /* object coordinates */
- GLubyte dummy[4];
- int i;
-
- union emit_union *v = (union emit_union *)dest;
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* The vertex code expects Obj to be clean to element 3. To fix
- * this, add more vertex code (for obj-2, obj-3) or preferably move
- * to maos.
- */
- if (VB->ObjPtr->size < 3) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 );
- }
-
- if (DO_W && VB->ObjPtr->size < 4) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 );
- }
-
- coord = (GLuint (*)[4])VB->ObjPtr->data;
- coord_stride = VB->ObjPtr->stride;
-
- if (DO_TEX2) {
- const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
- if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX2, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 );
- }
- }
-
- if (DO_TEX1) {
- if (VB->TexCoordPtr[1]) {
- const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
- if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX1, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 );
- }
- } else {
- tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; /* could be anything, really */
- tc1_stride = 0;
- }
- }
-
- if (DO_TEX0) {
- if (VB->TexCoordPtr[0]) {
- const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
- if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
- if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX0, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 );
- }
- } else {
- tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* could be anything, really */
- tc0_stride = 0;
- }
-
- }
-
- if (DO_NORM) {
- if (VB->NormalPtr) {
- norm_stride = VB->NormalPtr->stride;
- norm = (GLuint (*)[4])VB->NormalPtr->data;
- } else {
- norm_stride = 0;
- norm = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- }
- }
-
- if (DO_RGBA) {
- if (VB->ColorPtr[0]) {
- /* This is incorrect when colormaterial is enabled:
- */
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) {
- if (0) fprintf(stderr, "IMPORTING FLOAT COLORS\n");
- IMPORT_FLOAT_COLORS( ctx );
- }
- col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
- } else {
- col = &dummy; /* any old memory is fine */
- col_stride = 0;
- }
- }
-
- if (DO_SPEC) {
- if (VB->SecondaryColorPtr[0]) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- IMPORT_FLOAT_SPEC_COLORS( ctx );
- spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
- spec_stride = VB->SecondaryColorPtr[0]->StrideB;
- } else {
- spec = &dummy;
- spec_stride = 0;
- }
- }
-
- if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- } else {
- fog = (GLfloat (*)[4])&dummy; fog[0][0] = 0.0F;
- fog_stride = 0;
- }
- }
-
-
- if (VB->importable_data) {
- if (start) {
- coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride);
- if (DO_TEX0)
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (DO_TEX1)
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (DO_TEX2)
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
- if (DO_NORM)
- norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride);
- if (DO_RGBA)
- STRIDE_4UB(col, start * col_stride);
- if (DO_SPEC)
- STRIDE_4UB(spec, start * spec_stride);
- if (DO_FOG)
- fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
- }
-
- for (i=start; i < end; i++) {
- v[0].ui = coord[0][0];
- v[1].ui = coord[0][1];
- v[2].ui = coord[0][2];
- if (TCL_DEBUG) fprintf(stderr, "%d: %.2f %.2f %.2f ", i, v[0].f, v[1].f, v[2].f);
- if (DO_W) {
- v[3].ui = coord[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[3].f);
- v += 4;
- }
- else
- v += 3;
- coord = (GLuint (*)[4])((GLubyte *)coord + coord_stride);
-
- if (DO_NORM) {
- v[0].ui = norm[0][0];
- v[1].ui = norm[0][1];
- v[2].ui = norm[0][2];
- if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f);
- v += 3;
- norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride);
- }
- if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]);
- STRIDE_4UB(col, col_stride);
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- v[0].specular.red = spec[0][0];
- v[0].specular.green = spec[0][1];
- v[0].specular.blue = spec[0][2];
- STRIDE_4UB(spec, spec_stride);
- }
- if (DO_FOG) {
- v[0].specular.alpha = fog[0][0] * 255.0;
- fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[0][0];
- v[1].ui = tc0[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- v[2].ui = tc0[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (DO_TEX1) {
- v[0].ui = tc1[0][0];
- v[1].ui = tc1[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- v[2].ui = tc1[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- if (DO_TEX2) {
- v[0].ui = tc2[0][0];
- v[1].ui = tc2[0][1];
- if (DO_PTEX) {
- v[2].ui = tc2[0][3];
- v += 3;
- }
- else
- v += 2;
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + tc2_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "\n");
- }
- } else {
- for (i=start; i < end; i++) {
- v[0].ui = coord[i][0];
- v[1].ui = coord[i][1];
- v[2].ui = coord[i][2];
- if (DO_W) {
- v[3].ui = coord[i][3];
- v += 4;
- }
- else
- v += 3;
-
- if (DO_NORM) {
- v[0].ui = norm[i][0];
- v[1].ui = norm[i][1];
- v[2].ui = norm[i][2];
- v += 3;
- }
- if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[i]);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- v[0].specular.red = spec[i][0];
- v[0].specular.green = spec[i][1];
- v[0].specular.blue = spec[i][2];
- }
- if (DO_FOG) {
- GLfloat *f = (GLfloat *) ((GLubyte *)fog + fog_stride);
- v[0].specular.alpha = *f * 255.0;
- }
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[i][0];
- v[1].ui = tc0[i][1];
- if (DO_PTEX) {
- v[2].ui = tc0[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX1) {
- v[0].ui = tc1[i][0];
- v[1].ui = tc1[i][1];
- if (DO_PTEX) {
- v[2].ui = tc1[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX2) {
- v[0].ui = tc2[i][0];
- v[1].ui = tc2[i][1];
- if (DO_PTEX) {
- v[2].ui = tc2[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- }
- }
-}
-
-
-
-static void TAG(init)( void )
-{
- int sz = 3;
- if (DO_W) sz++;
- if (DO_NORM) sz += 3;
- if (DO_RGBA) sz++;
- if (DO_SPEC || DO_FOG) sz++;
- if (DO_TEX0) sz += 2;
- if (DO_TEX0 && DO_PTEX) sz++;
- if (DO_TEX1) sz += 2;
- if (DO_TEX1 && DO_PTEX) sz++;
- if (DO_TEX2) sz += 2;
- if (DO_TEX2 && DO_PTEX) sz++;
-
- setup_tab[IDX].emit = TAG(emit);
- setup_tab[IDX].vertex_format = IND;
- setup_tab[IDX].vertex_size = sz;
-}
-
-
-#undef IND
-#undef TAG
-#undef IDX
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c
deleted file mode 100644
index b32fd624f..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Austin, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_imm_debug.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-
-#define RADEON_TCL_MAX_SETUP 13
-
-union emit_union { float f; GLuint ui; radeon_color_t specular; };
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
- GLuint vertex_size;
- GLuint vertex_format;
-} setup_tab[RADEON_TCL_MAX_SETUP];
-
-#define DO_W (IND & RADEON_CP_VC_FRMT_W0)
-#define DO_RGBA (IND & RADEON_CP_VC_FRMT_PKCOLOR)
-#define DO_SPEC (IND & RADEON_CP_VC_FRMT_PKSPEC)
-#define DO_FOG (IND & RADEON_CP_VC_FRMT_PKSPEC)
-#define DO_TEX0 (IND & RADEON_CP_VC_FRMT_ST0)
-#define DO_TEX1 (IND & RADEON_CP_VC_FRMT_ST1)
-#define DO_PTEX (IND & RADEON_CP_VC_FRMT_Q0)
-#define DO_NORM (IND & RADEON_CP_VC_FRMT_N0)
-
-#define DO_TEX2 0
-#define DO_TEX3 0
-
-#define GET_TEXSOURCE(n) n
-#define GET_UBYTE_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define IMPORT_FLOAT_COLORS radeon_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS radeon_import_float_spec_colors
-
-/***********************************************************************
- * Generate vertex emit functions *
- ***********************************************************************/
-
-
-/* Defined in order of increasing vertex size:
- */
-#define IDX 0
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR)
-#define TAG(x) x##_rgba
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 1
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 2
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0)
-#define TAG(x) x##_rgba_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 3
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 4
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 5
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_st_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 6
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 7
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_spec_st_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 8
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 9
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgpa_spec_st_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 10
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 11
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_Q1| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq_stq
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 12
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_W0| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_Q1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_w_rgpa_spec_stq_stq_n
-#include "radeon_maos_vbtmp.h"
-
-
-
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-
-static void init_tcl_verts( void )
-{
- init_rgba();
- init_n();
- init_rgba_n();
- init_rgba_st();
- init_st_n();
- init_rgba_st_st();
- init_rgba_st_n();
- init_rgba_spec_st_st();
- init_st_st_n();
- init_rgpa_spec_st_st_n();
- init_rgba_stq();
- init_rgba_stq_stq();
- init_w_rgpa_spec_stq_stq_n();
-}
-
-
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint req = 0;
- GLuint vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
- ~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
- int i;
- static int firsttime = 1;
-
- if (firsttime) {
- init_tcl_verts();
- firsttime = 0;
- }
-
- if (1) {
- req |= RADEON_CP_VC_FRMT_Z;
- if (VB->ObjPtr->size == 4) {
- req |= RADEON_CP_VC_FRMT_W0;
- }
- }
-
- if (inputs & VERT_BIT_NORMAL) {
- req |= RADEON_CP_VC_FRMT_N0;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- req |= RADEON_CP_VC_FRMT_PKCOLOR;
- }
-
- if (inputs & VERT_BIT_COLOR1) {
- req |= RADEON_CP_VC_FRMT_PKSPEC;
- }
-
- if (inputs & VERT_BIT_TEX0) {
- req |= RADEON_CP_VC_FRMT_ST0;
-
- if (VB->TexCoordPtr[0]->size == 4) {
- req |= RADEON_CP_VC_FRMT_Q0;
- vtx |= RADEON_TCL_VTX_Q0;
- }
- }
-
- if (inputs & VERT_BIT_TEX1) {
- req |= RADEON_CP_VC_FRMT_ST1;
-
- if (VB->TexCoordPtr[1]->size == 4) {
- req |= RADEON_CP_VC_FRMT_Q1;
- vtx |= RADEON_TCL_VTX_Q1;
- }
- }
-
- if (vtx != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT]) {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] = vtx;
- }
-
- for (i = 0 ; i < RADEON_TCL_MAX_SETUP ; i++)
- if ((setup_tab[i].vertex_format & req) == req)
- break;
-
- if (rmesa->tcl.vertex_format == setup_tab[i].vertex_format &&
- rmesa->tcl.indexed_verts.buf)
- return;
-
- if (rmesa->tcl.indexed_verts.buf)
- radeonReleaseArrays( ctx, ~0 );
-
- radeonAllocDmaRegionVerts( rmesa,
- &rmesa->tcl.indexed_verts,
- VB->Count,
- setup_tab[i].vertex_size * 4,
- 4);
-
- setup_tab[i].emit( ctx, 0, VB->Count,
- rmesa->tcl.indexed_verts.address +
- rmesa->tcl.indexed_verts.start );
-
- rmesa->tcl.vertex_format = setup_tab[i].vertex_format;
- rmesa->tcl.indexed_verts.aos_start = GET_START( &rmesa->tcl.indexed_verts );
- rmesa->tcl.indexed_verts.aos_size = setup_tab[i].vertex_size;
- rmesa->tcl.indexed_verts.aos_stride = setup_tab[i].vertex_size;
-
- rmesa->tcl.aos_components[0] = &rmesa->tcl.indexed_verts;
- rmesa->tcl.nr_aos_components = 1;
-}
-
-
-
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-
- if (newinputs)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.indexed_verts, __FUNCTION__ );
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c
deleted file mode 100644
index 75db99772..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c
+++ /dev/null
@@ -1,1042 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc, Cedar Park, TX.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_sanity.h"
-
-/* Set this '1' to get more verbiage.
- */
-#define MORE_VERBOSE 1
-
-#if MORE_VERBOSE
-#define VERBOSE (RADEON_DEBUG & DEBUG_VERBOSE)
-#define NORMAL (1)
-#else
-#define VERBOSE 0
-#define NORMAL (RADEON_DEBUG & DEBUG_VERBOSE)
-#endif
-
-
-/* New (1.3) state mechanism. 3 commands (packet, scalar, vector) in
- * 1.3 cmdbuffers allow all previous state to be updated as well as
- * the tcl scalar and vector areas.
- */
-static struct {
- int start;
- int len;
- const char *name;
-} packet[RADEON_MAX_STATE_PACKETS] = {
- { RADEON_PP_MISC,7,"RADEON_PP_MISC" },
- { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" },
- { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" },
- { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" },
- { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" },
- { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" },
- { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" },
- { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" },
- { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" },
- { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_MISC,1,"RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" },
- { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" },
- { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" },
- { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" },
- { 0, 4, "R200_PP_TXCBLEND_0" },
- { 0, 4, "R200_PP_TXCBLEND_1" },
- { 0, 4, "R200_PP_TXCBLEND_2" },
- { 0, 4, "R200_PP_TXCBLEND_3" },
- { 0, 4, "R200_PP_TXCBLEND_4" },
- { 0, 4, "R200_PP_TXCBLEND_5" },
- { 0, 4, "R200_PP_TXCBLEND_6" },
- { 0, 4, "R200_PP_TXCBLEND_7" },
- { 0, 6, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { 0, 6, "R200_PP_TFACTOR_0" },
- { 0, 4, "R200_SE_VTX_FMT_0" },
- { 0, 1, "R200_SE_VAP_CNTL" },
- { 0, 5, "R200_SE_TCL_MATRIX_SEL_0" },
- { 0, 5, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { 0, 1, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { 0, 6, "R200_PP_TXFILTER_0" },
- { 0, 6, "R200_PP_TXFILTER_1" },
- { 0, 6, "R200_PP_TXFILTER_2" },
- { 0, 6, "R200_PP_TXFILTER_3" },
- { 0, 6, "R200_PP_TXFILTER_4" },
- { 0, 6, "R200_PP_TXFILTER_5" },
- { 0, 1, "R200_PP_TXOFFSET_0" },
- { 0, 1, "R200_PP_TXOFFSET_1" },
- { 0, 1, "R200_PP_TXOFFSET_2" },
- { 0, 1, "R200_PP_TXOFFSET_3" },
- { 0, 1, "R200_PP_TXOFFSET_4" },
- { 0, 1, "R200_PP_TXOFFSET_5" },
- { 0, 1, "R200_SE_VTE_CNTL" },
- { 0, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { 0, 1, "R200_PP_TAM_DEBUG3" },
- { 0, 1, "R200_PP_CNTL_X" },
- { 0, 1, "R200_RB3D_DEPTHXY_OFFSET" },
- { 0, 1, "R200_RE_AUX_SCISSOR_CNTL" },
- { 0, 2, "R200_RE_SCISSOR_TL_0" },
- { 0, 2, "R200_RE_SCISSOR_TL_1" },
- { 0, 2, "R200_RE_SCISSOR_TL_2" },
- { 0, 1, "R200_SE_VAP_CNTL_STATUS" },
- { 0, 1, "R200_SE_VTX_STATE_CNTL" },
- { 0, 1, "R200_RE_POINTSIZE" },
- { 0, 4, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { 0, 1, "R200_PP_CUBIC_FACES_0" }, /* 61 */
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_0" }, /* 62 */
- { 0, 1, "R200_PP_CUBIC_FACES_1" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_1" },
- { 0, 1, "R200_PP_CUBIC_FACES_2" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_2" },
- { 0, 1, "R200_PP_CUBIC_FACES_3" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_3" },
- { 0, 1, "R200_PP_CUBIC_FACES_4" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_4" },
- { 0, 1, "R200_PP_CUBIC_FACES_5" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_5" },
- { RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" },
- { RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
- { RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_1" },
-};
-
-struct reg_names {
- int idx;
- const char *name;
-};
-
-static struct reg_names reg_names[] = {
- { RADEON_PP_MISC, "RADEON_PP_MISC" },
- { RADEON_PP_FOG_COLOR, "RADEON_PP_FOG_COLOR" },
- { RADEON_RE_SOLID_COLOR, "RADEON_RE_SOLID_COLOR" },
- { RADEON_RB3D_BLENDCNTL, "RADEON_RB3D_BLENDCNTL" },
- { RADEON_RB3D_DEPTHOFFSET, "RADEON_RB3D_DEPTHOFFSET" },
- { RADEON_RB3D_DEPTHPITCH, "RADEON_RB3D_DEPTHPITCH" },
- { RADEON_RB3D_ZSTENCILCNTL, "RADEON_RB3D_ZSTENCILCNTL" },
- { RADEON_PP_CNTL, "RADEON_PP_CNTL" },
- { RADEON_RB3D_CNTL, "RADEON_RB3D_CNTL" },
- { RADEON_RB3D_COLOROFFSET, "RADEON_RB3D_COLOROFFSET" },
- { RADEON_RB3D_COLORPITCH, "RADEON_RB3D_COLORPITCH" },
- { RADEON_SE_CNTL, "RADEON_SE_CNTL" },
- { RADEON_SE_COORD_FMT, "RADEON_SE_COORDFMT" },
- { RADEON_SE_CNTL_STATUS, "RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_LINE_PATTERN, "RADEON_RE_LINE_PATTERN" },
- { RADEON_RE_LINE_STATE, "RADEON_RE_LINE_STATE" },
- { RADEON_SE_LINE_WIDTH, "RADEON_SE_LINE_WIDTH" },
- { RADEON_RB3D_STENCILREFMASK, "RADEON_RB3D_STENCILREFMASK" },
- { RADEON_RB3D_ROPCNTL, "RADEON_RB3D_ROPCNTL" },
- { RADEON_RB3D_PLANEMASK, "RADEON_RB3D_PLANEMASK" },
- { RADEON_SE_VPORT_XSCALE, "RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_VPORT_XOFFSET, "RADEON_SE_VPORT_XOFFSET" },
- { RADEON_SE_VPORT_YSCALE, "RADEON_SE_VPORT_YSCALE" },
- { RADEON_SE_VPORT_YOFFSET, "RADEON_SE_VPORT_YOFFSET" },
- { RADEON_SE_VPORT_ZSCALE, "RADEON_SE_VPORT_ZSCALE" },
- { RADEON_SE_VPORT_ZOFFSET, "RADEON_SE_VPORT_ZOFFSET" },
- { RADEON_RE_MISC, "RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0, "RADEON_PP_TXFILTER_0" },
- { RADEON_PP_TXFILTER_1, "RADEON_PP_TXFILTER_1" },
- { RADEON_PP_TXFILTER_2, "RADEON_PP_TXFILTER_2" },
- { RADEON_PP_TXFORMAT_0, "RADEON_PP_TXFORMAT_0" },
- { RADEON_PP_TXFORMAT_1, "RADEON_PP_TXFORMAT_1" },
- { RADEON_PP_TXFORMAT_2, "RADEON_PP_TXFORMAT_3" },
- { RADEON_PP_TXOFFSET_0, "RADEON_PP_TXOFFSET_0" },
- { RADEON_PP_TXOFFSET_1, "RADEON_PP_TXOFFSET_1" },
- { RADEON_PP_TXOFFSET_2, "RADEON_PP_TXOFFSET_3" },
- { RADEON_PP_TXCBLEND_0, "RADEON_PP_TXCBLEND_0" },
- { RADEON_PP_TXCBLEND_1, "RADEON_PP_TXCBLEND_1" },
- { RADEON_PP_TXCBLEND_2, "RADEON_PP_TXCBLEND_3" },
- { RADEON_PP_TXABLEND_0, "RADEON_PP_TXABLEND_0" },
- { RADEON_PP_TXABLEND_1, "RADEON_PP_TXABLEND_1" },
- { RADEON_PP_TXABLEND_2, "RADEON_PP_TXABLEND_3" },
- { RADEON_PP_TFACTOR_0, "RADEON_PP_TFACTOR_0" },
- { RADEON_PP_TFACTOR_1, "RADEON_PP_TFACTOR_1" },
- { RADEON_PP_TFACTOR_2, "RADEON_PP_TFACTOR_3" },
- { RADEON_PP_BORDER_COLOR_0, "RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_BORDER_COLOR_1, "RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_BORDER_COLOR_2, "RADEON_PP_BORDER_COLOR_3" },
- { RADEON_SE_ZBIAS_FACTOR, "RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_ZBIAS_CONSTANT, "RADEON_SE_ZBIAS_CONSTANT" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT, "RADEON_SE_TCL_OUTPUT_VTXFMT" },
- { RADEON_SE_TCL_OUTPUT_VTX_SEL, "RADEON_SE_TCL_OUTPUT_VTXSEL" },
- { RADEON_SE_TCL_MATRIX_SELECT_0, "RADEON_SE_TCL_MATRIX_SELECT_0" },
- { RADEON_SE_TCL_MATRIX_SELECT_1, "RADEON_SE_TCL_MATRIX_SELECT_1" },
- { RADEON_SE_TCL_UCP_VERT_BLEND_CTL, "RADEON_SE_TCL_UCP_VERT_BLEND_CTL" },
- { RADEON_SE_TCL_TEXTURE_PROC_CTL, "RADEON_SE_TCL_TEXTURE_PROC_CTL" },
- { RADEON_SE_TCL_LIGHT_MODEL_CTL, "RADEON_SE_TCL_LIGHT_MODEL_CTL" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_0, "RADEON_SE_TCL_PER_LIGHT_CTL_0" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_1, "RADEON_SE_TCL_PER_LIGHT_CTL_1" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_2, "RADEON_SE_TCL_PER_LIGHT_CTL_2" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_3, "RADEON_SE_TCL_PER_LIGHT_CTL_3" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED, "RADEON_SE_TCL_EMMISSIVE_RED" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN, "RADEON_SE_TCL_EMMISSIVE_GREEN" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE, "RADEON_SE_TCL_EMMISSIVE_BLUE" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA, "RADEON_SE_TCL_EMMISSIVE_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_RED, "RADEON_SE_TCL_AMBIENT_RED" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN, "RADEON_SE_TCL_AMBIENT_GREEN" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE, "RADEON_SE_TCL_AMBIENT_BLUE" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA, "RADEON_SE_TCL_AMBIENT_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_RED, "RADEON_SE_TCL_DIFFUSE_RED" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN, "RADEON_SE_TCL_DIFFUSE_GREEN" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE, "RADEON_SE_TCL_DIFFUSE_BLUE" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA, "RADEON_SE_TCL_DIFFUSE_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_RED, "RADEON_SE_TCL_SPECULAR_RED" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN, "RADEON_SE_TCL_SPECULAR_GREEN" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE, "RADEON_SE_TCL_SPECULAR_BLUE" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA, "RADEON_SE_TCL_SPECULAR_ALPHA" },
- { RADEON_SE_TCL_SHININESS, "RADEON_SE_TCL_SHININESS" },
- { RADEON_SE_COORD_FMT, "RADEON_SE_COORD_FMT" },
- { RADEON_PP_TEX_SIZE_0, "RADEON_PP_TEX_SIZE_0" },
- { RADEON_PP_TEX_SIZE_1, "RADEON_PP_TEX_SIZE_1" },
- { RADEON_PP_TEX_SIZE_2, "RADEON_PP_TEX_SIZE_2" },
- { RADEON_PP_TEX_SIZE_0+4, "RADEON_PP_TEX_PITCH_0" },
- { RADEON_PP_TEX_SIZE_1+4, "RADEON_PP_TEX_PITCH_1" },
- { RADEON_PP_TEX_SIZE_2+4, "RADEON_PP_TEX_PITCH_2" },
-};
-
-static struct reg_names scalar_names[] = {
- { RADEON_SS_LIGHT_DCD_ADDR, "LIGHT_DCD" },
- { RADEON_SS_LIGHT_SPOT_EXPONENT_ADDR, "LIGHT_SPOT_EXPONENT" },
- { RADEON_SS_LIGHT_SPOT_CUTOFF_ADDR, "LIGHT_SPOT_CUTOFF" },
- { RADEON_SS_LIGHT_SPECULAR_THRESH_ADDR, "LIGHT_SPECULAR_THRESH" },
- { RADEON_SS_LIGHT_RANGE_CUTOFF_ADDR, "LIGHT_RANGE_CUTOFF" },
- { RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR, "VERT_GUARD_CLIP" },
- { RADEON_SS_VERT_GUARD_DISCARD_ADJ_ADDR, "VERT_GUARD_DISCARD" },
- { RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR, "HORZ_GUARD_CLIP" },
- { RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR, "HORZ_GUARD_DISCARD" },
- { RADEON_SS_SHININESS, "SHININESS" },
- { 1000, "" },
-};
-
-/* Puff these out to make them look like normal (dword) registers.
- */
-static struct reg_names vector_names[] = {
- { RADEON_VS_MATRIX_0_ADDR * 4, "MATRIX_0" },
- { RADEON_VS_MATRIX_1_ADDR * 4, "MATRIX_1" },
- { RADEON_VS_MATRIX_2_ADDR * 4, "MATRIX_2" },
- { RADEON_VS_MATRIX_3_ADDR * 4, "MATRIX_3" },
- { RADEON_VS_MATRIX_4_ADDR * 4, "MATRIX_4" },
- { RADEON_VS_MATRIX_5_ADDR * 4, "MATRIX_5" },
- { RADEON_VS_MATRIX_6_ADDR * 4, "MATRIX_6" },
- { RADEON_VS_MATRIX_7_ADDR * 4, "MATRIX_7" },
- { RADEON_VS_MATRIX_8_ADDR * 4, "MATRIX_8" },
- { RADEON_VS_MATRIX_9_ADDR * 4, "MATRIX_9" },
- { RADEON_VS_MATRIX_10_ADDR * 4, "MATRIX_10" },
- { RADEON_VS_MATRIX_11_ADDR * 4, "MATRIX_11" },
- { RADEON_VS_MATRIX_12_ADDR * 4, "MATRIX_12" },
- { RADEON_VS_MATRIX_13_ADDR * 4, "MATRIX_13" },
- { RADEON_VS_MATRIX_14_ADDR * 4, "MATRIX_14" },
- { RADEON_VS_MATRIX_15_ADDR * 4, "MATRIX_15" },
- { RADEON_VS_LIGHT_AMBIENT_ADDR * 4, "LIGHT_AMBIENT" },
- { RADEON_VS_LIGHT_DIFFUSE_ADDR * 4, "LIGHT_DIFFUSE" },
- { RADEON_VS_LIGHT_SPECULAR_ADDR * 4, "LIGHT_SPECULAR" },
- { RADEON_VS_LIGHT_DIRPOS_ADDR * 4, "LIGHT_DIRPOS" },
- { RADEON_VS_LIGHT_HWVSPOT_ADDR * 4, "LIGHT_HWVSPOT" },
- { RADEON_VS_LIGHT_ATTENUATION_ADDR * 4, "LIGHT_ATTENUATION" },
- { RADEON_VS_MATRIX_EYE2CLIP_ADDR * 4, "MATRIX_EYE2CLIP" },
- { RADEON_VS_UCP_ADDR * 4, "UCP" },
- { RADEON_VS_GLOBAL_AMBIENT_ADDR * 4, "GLOBAL_AMBIENT" },
- { RADEON_VS_FOG_PARAM_ADDR * 4, "FOG_PARAM" },
- { RADEON_VS_EYE_VECTOR_ADDR * 4, "EYE_VECTOR" },
- { 1000, "" },
-};
-
-union fi { float f; int i; };
-
-#define ISVEC 1
-#define ISFLOAT 2
-#define TOUCHED 4
-
-struct reg {
- int idx;
- struct reg_names *closest;
- int flags;
- union fi current;
- union fi *values;
- int nvalues;
- int nalloc;
- float vmin, vmax;
-};
-
-
-static struct reg regs[Elements(reg_names)+1];
-static struct reg scalars[512+1];
-static struct reg vectors[512*4+1];
-
-static int total, total_changed, bufs;
-
-static void init_regs( void )
-{
- struct reg_names *tmp;
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++) {
- regs[i].idx = reg_names[i].idx;
- regs[i].closest = &reg_names[i];
- regs[i].flags = 0;
- }
-
- for (i = 0, tmp = scalar_names ; i < Elements(scalars) ; i++) {
- if (tmp[1].idx == i) tmp++;
- scalars[i].idx = i;
- scalars[i].closest = tmp;
- scalars[i].flags = ISFLOAT;
- }
-
- for (i = 0, tmp = vector_names ; i < Elements(vectors) ; i++) {
- if (tmp[1].idx*4 == i) tmp++;
- vectors[i].idx = i;
- vectors[i].closest = tmp;
- vectors[i].flags = ISFLOAT|ISVEC;
- }
-
- regs[Elements(regs)-1].idx = -1;
- scalars[Elements(scalars)-1].idx = -1;
- vectors[Elements(vectors)-1].idx = -1;
-}
-
-static int find_or_add_value( struct reg *reg, int val )
-{
- int j;
-
- for ( j = 0 ; j < reg->nvalues ; j++)
- if ( val == reg->values[j].i )
- return 1;
-
- if (j == reg->nalloc) {
- reg->nalloc += 5;
- reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
- }
-
- reg->values[reg->nvalues++].i = val;
- return 0;
-}
-
-static struct reg *lookup_reg( struct reg *tab, int reg )
-{
- int i;
-
- for (i = 0 ; tab[i].idx != -1 ; i++) {
- if (tab[i].idx == reg)
- return &tab[i];
- }
-
- fprintf(stderr, "*** unknown reg 0x%x\n", reg);
- return 0;
-}
-
-
-static const char *get_reg_name( struct reg *reg )
-{
- static char tmp[80];
-
- if (reg->idx == reg->closest->idx)
- return reg->closest->name;
-
-
- if (reg->flags & ISVEC) {
- if (reg->idx/4 != reg->closest->idx)
- sprintf(tmp, "%s+%d[%d]",
- reg->closest->name,
- (reg->idx/4) - reg->closest->idx,
- reg->idx%4);
- else
- sprintf(tmp, "%s[%d]", reg->closest->name, reg->idx%4);
- }
- else {
- if (reg->idx != reg->closest->idx)
- sprintf(tmp, "%s+%d", reg->closest->name, reg->idx - reg->closest->idx);
- else
- sprintf(tmp, "%s", reg->closest->name);
- }
-
- return tmp;
-}
-
-static int print_int_reg_assignment( struct reg *reg, int data )
-{
- int changed = (reg->current.i != data);
- int ever_seen = find_or_add_value( reg, data );
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, " %s <-- 0x%x", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (!ever_seen)
- fprintf(stderr, " *** BRAND NEW VALUE");
- else if (changed)
- fprintf(stderr, " *** CHANGED");
- }
-
- reg->current.i = data;
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-
-static int print_float_reg_assignment( struct reg *reg, float data )
-{
- int changed = (reg->current.f != data);
- int newmin = (data < reg->vmin);
- int newmax = (data > reg->vmax);
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, " %s <-- %.3f", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (newmin) {
- fprintf(stderr, " *** NEW MIN (prev %.3f)", reg->vmin);
- reg->vmin = data;
- }
- else if (newmax) {
- fprintf(stderr, " *** NEW MAX (prev %.3f)", reg->vmax);
- reg->vmax = data;
- }
- else if (changed) {
- fprintf(stderr, " *** CHANGED");
- }
- }
-
- reg->current.f = data;
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-static int print_reg_assignment( struct reg *reg, int data )
-{
- reg->flags |= TOUCHED;
- if (reg->flags & ISFLOAT)
- return print_float_reg_assignment( reg, *(float *)&data );
- else
- return print_int_reg_assignment( reg, data );
-}
-
-static void print_reg( struct reg *reg )
-{
- if (reg->flags & TOUCHED) {
- if (reg->flags & ISFLOAT) {
- fprintf(stderr, " %s == %f\n", get_reg_name(reg), reg->current.f);
- } else {
- fprintf(stderr, " %s == 0x%x\n", get_reg_name(reg), reg->current.i);
- }
- }
-}
-
-
-static void dump_state( void )
-{
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++)
- print_reg( &regs[i] );
-
- for (i = 0 ; i < Elements(scalars) ; i++)
- print_reg( &scalars[i] );
-
- for (i = 0 ; i < Elements(vectors) ; i++)
- print_reg( &vectors[i] );
-}
-
-
-
-static int radeon_emit_packets(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int id = (int)header.packet.packet_id;
- int sz = packet[id].len;
- int *data = (int *)cmdbuf->buf;
- int i;
-
- if (sz * sizeof(int) > cmdbuf->bufsz) {
- fprintf(stderr, "Packet overflows cmdbuf\n");
- return -EINVAL;
- }
-
- if (!packet[id].name) {
- fprintf(stderr, "*** Unknown packet 0 nr %d\n", id );
- return -EINVAL;
- }
-
-
- if (VERBOSE)
- fprintf(stderr, "Packet 0 reg %s nr %d\n", packet[id].name, sz );
-
- for ( i = 0 ; i < sz ; i++) {
- struct reg *reg = lookup_reg( regs, packet[id].start + i*4 );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars2(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset + 0x100;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars2, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
- if (start + stride * sz > 257) {
- fprintf(stderr, "emit scalars OVERFLOW %d/%d/%d\n", start, stride, sz);
- return -1;
- }
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-/* Check: inf/nan/extreme-size?
- * Check: table start, end, nr, etc.
- */
-static int radeon_emit_vectors(
- drmRadeonCmdHeader header,
- drmRadeonCmdBuffer *cmdbuf )
-{
- int sz = header.vectors.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.vectors.offset;
- int stride = header.vectors.stride;
- int i,j;
-
- if (VERBOSE)
- fprintf(stderr, "emit vectors, start %d stride %d nr %d (end %d) (0x%x)\n",
- start, stride, sz, start + stride * sz, header.i);
-
-/* if (start + stride * (sz/4) > 128) { */
-/* fprintf(stderr, "emit vectors OVERFLOW %d/%d/%d\n", start, stride, sz); */
-/* return -1; */
-/* } */
-
- for (i = 0 ; i < sz ; start += stride) {
- int changed = 0;
- for (j = 0 ; j < 4 ; i++,j++) {
- struct reg *reg = lookup_reg( vectors, start*4+j );
- if (print_reg_assignment( reg, data[i] ))
- changed = 1;
- }
- if (changed)
- total_changed += 4;
- total += 4;
- }
-
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int print_vertex_format( int vfmt )
-{
- if (NORMAL) {
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- "vertex format",
- vfmt,
- "xy,",
- (vfmt & RADEON_CP_VC_FRMT_Z) ? "z," : "",
- (vfmt & RADEON_CP_VC_FRMT_W0) ? "w0," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPCOLOR) ? "fpcolor," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPALPHA) ? "fpalpha," : "",
- (vfmt & RADEON_CP_VC_FRMT_PKCOLOR) ? "pkcolor," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPSPEC) ? "fpspec," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPFOG) ? "fpfog," : "",
- (vfmt & RADEON_CP_VC_FRMT_PKSPEC) ? "pkspec," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST0) ? "st0," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST1) ? "st1," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q1) ? "q1," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST2) ? "st2," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q2) ? "q2," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST3) ? "st3," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q3) ? "q3," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q0) ? "q0," : "",
- (vfmt & RADEON_CP_VC_FRMT_N0) ? "n0," : "",
- (vfmt & RADEON_CP_VC_FRMT_XY1) ? "xy1," : "",
- (vfmt & RADEON_CP_VC_FRMT_Z1) ? "z1," : "",
- (vfmt & RADEON_CP_VC_FRMT_W1) ? "w1," : "",
- (vfmt & RADEON_CP_VC_FRMT_N1) ? "n1," : "");
-
-
-/* if (!find_or_add_value( &others[V_VTXFMT], vfmt )) */
-/* fprintf(stderr, " *** NEW VALUE"); */
-
- fprintf(stderr, "\n");
- }
-
- return 0;
-}
-
-static char *primname[0xf] = {
- "NONE",
- "POINTS",
- "LINES",
- "LINE_STRIP",
- "TRIANGLES",
- "TRIANGLE_FAN",
- "TRIANGLE_STRIP",
- "TRI_TYPE_2",
- "RECT_LIST",
- "3VRT_POINTS",
- "3VRT_LINES",
-};
-
-static int print_prim_and_flags( int prim )
-{
- int numverts;
-
- if (NORMAL)
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s\n",
- "prim flags",
- prim,
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_IND) ? "IND," : "",
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_LIST) ? "LIST," : "",
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_RING) ? "RING," : "",
- (prim & RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA) ? "RGBA," : "BGRA, ",
- (prim & RADEON_CP_VC_CNTL_MAOS_ENABLE) ? "MAOS," : "",
- (prim & RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE) ? "RADEON," : "",
- (prim & RADEON_CP_VC_CNTL_TCL_ENABLE) ? "TCL," : "");
-
- if ((prim & 0xf) > RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST) {
- fprintf(stderr, " *** Bad primitive: %x\n", prim & 0xf);
- return -1;
- }
-
- numverts = prim>>16;
-
- if (NORMAL)
- fprintf(stderr, " prim: %s numverts %d\n", primname[prim&0xf], numverts);
-
- switch (prim & 0xf) {
- case RADEON_CP_VC_CNTL_PRIM_TYPE_NONE:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_POINT:
- if (numverts < 1) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_LINE:
- if ((numverts & 1) || numverts == 0) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP:
- if (numverts < 2) {
- fprintf(stderr, "Bad nr verts for line_strip %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST:
- if (numverts % 3 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for tri %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP:
- if (numverts < 3) {
- fprintf(stderr, "Bad nr verts for strip/fan %d\n", numverts);
- return -1;
- }
- break;
- default:
- fprintf(stderr, "Bad primitive\n");
- return -1;
- }
- return 0;
-}
-
-/* build in knowledge about each packet type
- */
-static int radeon_emit_packet3( drmRadeonCmdBuffer *cmdbuf )
-{
- int cmdsz;
- int *cmd = (int *)cmdbuf->buf;
- int *tmp;
- int i, stride, size, start;
-
- cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
- if ((cmd[0] & RADEON_CP_PACKET_MASK) != RADEON_CP_PACKET3 ||
- cmdsz * 4 > cmdbuf->bufsz ||
- cmdsz > RADEON_CP_PACKET_MAX_DWORDS) {
- fprintf(stderr, "Bad packet\n");
- return -EINVAL;
- }
-
- switch( cmd[0] & ~RADEON_CP_PACKET_COUNT_MASK ) {
- case RADEON_CP_PACKET3_NOP:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NOP, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_NEXT_CHAR:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NEXT_CHAR, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_PLY_NEXTSCAN:
- if (NORMAL)
- fprintf(stderr, "PACKET3_PLY_NEXTSCAN, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_SET_SCISSORS:
- if (NORMAL)
- fprintf(stderr, "PACKET3_SET_SCISSORS, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_RNDR_GEN_INDX_PRIM, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_LOAD_MICROCODE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_MICROCODE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_WAIT_FOR_IDLE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_WAIT_FOR_IDLE, %d dwords\n", cmdsz);
- break;
-
- case RADEON_CP_PACKET3_3D_DRAW_VBUF:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_VBUF, %d dwords\n", cmdsz);
- print_vertex_format(cmd[1]);
- print_prim_and_flags(cmd[2]);
- break;
-
- case RADEON_CP_PACKET3_3D_DRAW_IMMD:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_IMMD, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_DRAW_INDX: {
- int neltdwords;
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_INDX, %d dwords\n", cmdsz);
- print_vertex_format(cmd[1]);
- print_prim_and_flags(cmd[2]);
- neltdwords = cmd[2]>>16;
- neltdwords += neltdwords & 1;
- neltdwords /= 2;
- if (neltdwords + 3 != cmdsz)
- fprintf(stderr, "Mismatch in DRAW_INDX, %d vs cmdsz %d\n",
- neltdwords, cmdsz);
- break;
- }
- case RADEON_CP_PACKET3_LOAD_PALETTE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_PALETTE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_LOAD_VBPNTR:
- if (NORMAL) {
- fprintf(stderr, "PACKET3_3D_LOAD_VBPNTR, %d dwords\n", cmdsz);
- fprintf(stderr, " nr arrays: %d\n", cmd[1]);
- }
-
- if (cmd[1]/2 + cmd[1]%2 != cmdsz - 3) {
- fprintf(stderr, " ****** MISMATCH %d/%d *******\n",
- cmd[1]/2 + cmd[1]%2 + 3, cmdsz);
- return -EINVAL;
- }
-
- if (NORMAL) {
- tmp = cmd+2;
- for (i = 0 ; i < cmd[1] ; i++) {
- if (i & 1) {
- stride = (tmp[0]>>24) & 0xff;
- size = (tmp[0]>>16) & 0xff;
- start = tmp[2];
- tmp += 3;
- }
- else {
- stride = (tmp[0]>>8) & 0xff;
- size = (tmp[0]) & 0xff;
- start = tmp[1];
- }
- fprintf(stderr, " array %d: start 0x%x vsize %d vstride %d\n",
- i, start, size, stride );
- }
- }
- break;
- case RADEON_CP_PACKET3_CNTL_PAINT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_SMALLTEXT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_SMALLTEXT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_HOSTDATA_BLT, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_POLYLINE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYLINE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_POLYSCANLINES:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYSCANLINES, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_PAINT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_BITBLT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_TRANS_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_TRANS_BITBLT, %d dwords\n",
- cmdsz);
- break;
- default:
- fprintf(stderr, "UNKNOWN PACKET, %d dwords\n", cmdsz);
- break;
- }
-
- cmdbuf->buf += cmdsz * 4;
- cmdbuf->bufsz -= cmdsz * 4;
- return 0;
-}
-
-
-/* Check cliprects for bounds, then pass on to above:
- */
-static int radeon_emit_packet3_cliprect( drmRadeonCmdBuffer *cmdbuf )
-{
- XF86DRIClipRectRec *boxes = (XF86DRIClipRectRec *)cmdbuf->boxes;
- int i = 0;
-
- if (VERBOSE && total_changed) {
- dump_state();
- total_changed = 0;
- }
- else fprintf(stderr, "total_changed zero\n");
-
- if (NORMAL) {
- do {
- if ( i < cmdbuf->nbox ) {
- fprintf(stderr, "Emit box %d/%d %d,%d %d,%d\n",
- i, cmdbuf->nbox,
- boxes[i].x1, boxes[i].y1, boxes[i].x2, boxes[i].y2);
- }
- } while ( ++i < cmdbuf->nbox );
- }
-
- if (cmdbuf->nbox == 1)
- cmdbuf->nbox = 0;
-
- return radeon_emit_packet3( cmdbuf );
-}
-
-
-int radeonSanityCmdBuffer( radeonContextPtr rmesa,
- int nbox,
- XF86DRIClipRectRec *boxes )
-{
- int idx;
- drmRadeonCmdBuffer cmdbuf;
- drmRadeonCmdHeader header;
- static int inited = 0;
-
- if (!inited) {
- init_regs();
- inited = 1;
- }
-
- cmdbuf.buf = rmesa->store.cmd_buf;
- cmdbuf.bufsz = rmesa->store.cmd_used;
- cmdbuf.boxes = (drmClipRect *)boxes;
- cmdbuf.nbox = nbox;
-
- while ( cmdbuf.bufsz >= sizeof(header) ) {
-
- header.i = *(int *)cmdbuf.buf;
- cmdbuf.buf += sizeof(header);
- cmdbuf.bufsz -= sizeof(header);
-
- switch (header.header.cmd_type) {
- case RADEON_CMD_PACKET:
- if (radeon_emit_packets( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packets failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS:
- if (radeon_emit_scalars( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS2:
- if (radeon_emit_scalars2( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_VECTORS:
- if (radeon_emit_vectors( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_vectors failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_DMA_DISCARD:
- idx = header.dma.buf_idx;
- if (NORMAL)
- fprintf(stderr, "RADEON_CMD_DMA_DISCARD buf %d\n", idx);
- bufs++;
- break;
-
- case RADEON_CMD_PACKET3:
- if (radeon_emit_packet3( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3 failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3_clip failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_WAIT:
- break;
-
- default:
- fprintf(stderr,"bad cmd_type %d at %p\n",
- header.header.cmd_type,
- cmdbuf.buf - sizeof(header));
- return -EINVAL;
- }
- }
-
- if (0)
- {
- static int n = 0;
- n++;
- if (n == 10) {
- fprintf(stderr, "Bufs %d Total emitted %d real changes %d (%.2f%%)\n",
- bufs,
- total, total_changed,
- ((float)total_changed/(float)total*100.0));
- fprintf(stderr, "Total emitted per buf: %.2f\n",
- (float)total/(float)bufs);
- fprintf(stderr, "Real changes per buf: %.2f\n",
- (float)total_changed/(float)bufs);
-
- bufs = n = total = total_changed = 0;
- }
- }
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.h
deleted file mode 100644
index 58e8335dd..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef RADEON_SANITY_H
-#define RADEON_SANITY_H
-
-extern int radeonSanityCmdBuffer( radeonContextPtr rmesa,
- int nbox,
- XF86DRIClipRectRec *boxes );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c
deleted file mode 100644
index e7d20c59b..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.7 2003/03/26 20:43:51 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "glheader.h"
-#include "imports.h"
-
-#include "radeon_context.h"
-#include "radeon_screen.h"
-#include "radeon_macros.h"
-
-#include "utils.h"
-#include "context.h"
-#include "vblank.h"
-
-#include "glxextensions.h"
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_RADEON_QD 0x5144
-#define PCI_CHIP_RADEON_QE 0x5145
-#define PCI_CHIP_RADEON_QF 0x5146
-#define PCI_CHIP_RADEON_QG 0x5147
-
-#define PCI_CHIP_RADEON_QY 0x5159
-#define PCI_CHIP_RADEON_QZ 0x515A
-
-#define PCI_CHIP_RADEON_LW 0x4C57 /* mobility 7 - has tcl */
-
-#define PCI_CHIP_RADEON_LY 0x4C59
-#define PCI_CHIP_RADEON_LZ 0x4C5A
-
-#define PCI_CHIP_RV200_QW 0x5157 /* Radeon 7500 - not an R200 at all */
-#endif
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-/* Create the device specific screen private data struct.
- */
-radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
-{
- radeonScreenPtr screen;
- RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv;
- unsigned char *RADEONMMIO;
-
- if ( ! driCheckDriDdxDrmVersions( sPriv, "Radeon", 4, 0, 4, 0, 1, 3 ) )
- return NULL;
-
- /* Allocate the private area */
- screen = (radeonScreenPtr) CALLOC( sizeof(*screen) );
- if ( !screen ) {
- __driUtilMessage("%s: Could not allocate memory for screen structure",
- __FUNCTION__);
- return NULL;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&screen->optionCache);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- screen->IsPCI = dri_priv->IsPCI;
-
- {
- int ret;
- drmRadeonGetParam gp;
-
- gp.param = RADEON_PARAM_GART_BUFFER_OFFSET;
- gp.value = &screen->gart_buffer_offset;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret);
- return NULL;
- }
-
- if (sPriv->drmMinor >= 6) {
- gp.param = RADEON_PARAM_IRQ_NR;
- gp.value = &screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_IRQ_NR): %d\n", ret);
- return NULL;
- }
- }
- }
-
- screen->mmio.handle = dri_priv->registerHandle;
- screen->mmio.size = dri_priv->registerSize;
- if ( drmMap( sPriv->fd,
- screen->mmio.handle,
- screen->mmio.size,
- &screen->mmio.map ) ) {
- FREE( screen );
- __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ );
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- screen->status.handle = dri_priv->statusHandle;
- screen->status.size = dri_priv->statusSize;
- if ( drmMap( sPriv->fd,
- screen->status.handle,
- screen->status.size,
- &screen->status.map ) ) {
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ );
- return NULL;
- }
- screen->scratch = (__volatile__ CARD32 *)
- ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET);
-
- screen->buffers = drmMapBufs( sPriv->fd );
- if ( !screen->buffers ) {
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ );
- return NULL;
- }
-
- if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) {
- screen->gartTextures.handle = dri_priv->gartTexHandle;
- screen->gartTextures.size = dri_priv->gartTexMapSize;
- if ( drmMap( sPriv->fd,
- screen->gartTextures.handle,
- screen->gartTextures.size,
- (drmAddressPtr)&screen->gartTextures.map ) ) {
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__);
- return NULL;
- }
-
- screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI
- ? INREG( RADEON_AIC_LO_ADDR )
- : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) );
- }
-
- screen->chipset = 0;
- switch ( dri_priv->deviceID ) {
- default:
- fprintf(stderr, "unknown chip id, assuming full radeon support\n");
- case PCI_CHIP_RADEON_QD:
- case PCI_CHIP_RADEON_QE:
- case PCI_CHIP_RADEON_QF:
- case PCI_CHIP_RADEON_QG:
- case PCI_CHIP_RV200_QW:
- case PCI_CHIP_RADEON_LW:
- screen->chipset |= RADEON_CHIPSET_TCL;
- case PCI_CHIP_RADEON_QY:
- case PCI_CHIP_RADEON_QZ:
- case PCI_CHIP_RADEON_LY:
- case PCI_CHIP_RADEON_LZ:
- break;
- }
-
- screen->cpp = dri_priv->bpp / 8;
- screen->AGPMode = dri_priv->AGPMode;
-
- screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16;
-
- if ( sPriv->drmMinor >= 10 ) {
- drmRadeonSetParam sp;
-
- sp.param = RADEON_SETPARAM_FB_LOCATION;
- sp.value = screen->fbLocation;
-
- drmCommandWrite( sPriv->fd, DRM_RADEON_SETPARAM,
- &sp, sizeof( sp ) );
- }
-
- screen->frontOffset = dri_priv->frontOffset;
- screen->frontPitch = dri_priv->frontPitch;
- screen->backOffset = dri_priv->backOffset;
- screen->backPitch = dri_priv->backPitch;
- screen->depthOffset = dri_priv->depthOffset;
- screen->depthPitch = dri_priv->depthPitch;
-
- screen->texOffset[RADEON_CARD_HEAP] = dri_priv->textureOffset
- + screen->fbLocation;
- screen->texSize[RADEON_CARD_HEAP] = dri_priv->textureSize;
- screen->logTexGranularity[RADEON_CARD_HEAP] =
- dri_priv->log2TexGran;
-
- if ( !screen->gartTextures.map
- || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
- screen->texOffset[RADEON_GART_HEAP] = 0;
- screen->texSize[RADEON_GART_HEAP] = 0;
- screen->logTexGranularity[RADEON_GART_HEAP] = 0;
- } else {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS;
- screen->texOffset[RADEON_GART_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_HEAP] =
- dri_priv->log2GARTTexGran;
- }
-
- if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
- void * const psc = sPriv->psc->screenConfigs;
-
- if ( glx_enable_extension != NULL ) {
- if ( screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
- }
-
- screen->driScreen = sPriv;
- screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
- return screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void radeonDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- radeonScreenPtr screen = (radeonScreenPtr)sPriv->private;
-
- if (!screen)
- return;
-
- if ( screen->gartTextures.map ) {
- drmUnmap( screen->gartTextures.map, screen->gartTextures.size );
- }
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&screen->optionCache);
-
- FREE( screen );
- sPriv->private = NULL;
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-radeonInitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) radeonCreateScreen( sPriv );
- if ( !sPriv->private ) {
- radeonDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- const GLboolean swDepth = GL_FALSE;
- const GLboolean swAlpha = GL_FALSE;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24;
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- swDepth,
- swStencil,
- swAccum,
- swAlpha );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-
-
-/* Fullscreen mode isn't used for much -- could be a way to shrink
- * front/back buffers & get more texture memory if the client has
- * changed the video resolution.
- *
- * Pageflipping is now done automatically whenever there is a single
- * 3d client.
- */
-static GLboolean
-radeonOpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec radeonAPI = {
- .InitDriver = radeonInitDriver,
- .DestroyScreen = radeonDestroyScreen,
- .CreateContext = radeonCreateContext,
- .DestroyContext = radeonDestroyContext,
- .CreateBuffer = radeonCreateBuffer,
- .DestroyBuffer = radeonDestroyBuffer,
- .SwapBuffers = radeonSwapBuffers,
- .MakeCurrent = radeonMakeCurrent,
- .UnbindContext = radeonUnbindContext,
- .OpenFullScreen = radeonOpenCloseFullScreen,
- .CloseFullScreen = radeonOpenCloseFullScreen,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &radeonAPI);
- return (void *) psp;
-}
-
-
-/**
- * This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we'd register new extension functions with the dispatcher.
- *
- * \todo This interface has been deprecated, so we should probably remove
- * this function before the next XFree86 release.
- */
-void
-__driRegisterExtensions( void )
-{
- PFNGLXENABLEEXTENSIONPROC glx_enable_extension;
-
-
- if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) {
- glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC)
- glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" );
-
- if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE );
- (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE );
- (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE );
- (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE );
- }
- }
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- radeonContextPtr rmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = rmesa->swap_count;
- sInfo->swap_ust = rmesa->swap_ust;
- sInfo->swap_missed_count = rmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, rmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h
deleted file mode 100644
index 4a0f6d47f..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.5 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_SCREEN_H__
-#define __RADEON_SCREEN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-/*
- * IMPORTS: these headers contain all the DRI, X and kernel-related
- * definitions that we need.
- */
-#include "dri_util.h"
-#include "radeon_common.h"
-#include "radeon_dri.h"
-#include "radeon_reg.h"
-#include "radeon_sarea.h"
-#include "xmlconfig.h"
-
-
-typedef struct {
- drmHandle handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} radeonRegionRec, *radeonRegionPtr;
-
-/* chipset features */
-#define RADEON_CHIPSET_TCL (1 << 0)
-
-typedef struct {
-
- int chipset;
- int cpp;
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- unsigned int fbLocation;
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- /* Shared texture data */
- int numTexHeaps;
- int texOffset[RADEON_NR_TEX_HEAPS];
- int texSize[RADEON_NR_TEX_HEAPS];
- int logTexGranularity[RADEON_NR_TEX_HEAPS];
-
- radeonRegionRec mmio;
- radeonRegionRec status;
- radeonRegionRec gartTextures;
-
- drmBufMapPtr buffers;
-
- __volatile__ CARD32 *scratch;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
- unsigned int gart_buffer_offset; /* offset in card memory space */
- unsigned int gart_texture_offset; /* offset in card memory space */
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} radeonScreenRec, *radeonScreenPtr;
-
-extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv );
-extern void radeonDestroyScreen( __DRIscreenPrivate *sPriv );
-
-#endif
-#endif /* __RADEON_SCREEN_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c
deleted file mode 100644
index 029d7cd8e..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.6 2002/10/30 12:51:56 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "swrast/swrast.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_span.h"
-#include "radeon_tex.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- radeonScreenPtr radeonScreen = rmesa->radeonScreen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint pitch = radeonScreen->frontPitch * radeonScreen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->state.color.drawOffset + \
- (dPriv->x * radeonScreen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->state.pixel.readOffset + \
- (dPriv->x * radeonScreen->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- radeonScreenPtr radeonScreen = rmesa->radeonScreen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint height = dPriv->h; \
- GLuint xo = dPriv->x; \
- GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + radeonScreen->depthOffset); \
- (void) buf
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-
-#define HW_LOCK()
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) radeon##x##_RGB565
-#include "spantmp.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) ); \
-} while (0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p; \
-} while (0)
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- volatile GLuint *ptr = (volatile GLuint *)(read_buf + _x*4 + _y*pitch); \
- GLuint p = *ptr; \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) radeon##x##_ARGB8888
-#include "spantmp.h"
-
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* The Radeon family has depth tiling on all the time, so we have to convert
- * the x,y coordinates into the memory bus address (mba) in the same
- * manner as the engine. In each case, the linear block address (ba)
- * is calculated, and then wired with x and y to produce the final
- * memory address.
- */
-
-static GLuint radeon_mba_z32( radeonContextPtr rmesa,
- GLint x, GLint y )
-{
- GLuint pitch = rmesa->radeonScreen->frontPitch;
- GLuint ba, address = 0; /* a[0..1] = 0 */
-
- ba = (y / 16) * (pitch / 16) + (x / 16);
-
- address |= (x & 0x7) << 2; /* a[2..4] = x[0..2] */
- address |= (y & 0x3) << 5; /* a[5..6] = y[0..1] */
- address |=
- (((x & 0x10) >> 2) ^ (y & 0x4)) << 5; /* a[7] = x[4] ^ y[2] */
- address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */
-
- address |= (y & 0x8) << 7; /* a[10] = y[3] */
- address |=
- (((x & 0x8) << 1) ^ (y & 0x10)) << 7; /* a[11] = x[3] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
-
- return address;
-}
-
-static __inline GLuint radeon_mba_z16( radeonContextPtr rmesa, GLint x, GLint y )
-{
- GLuint pitch = rmesa->radeonScreen->frontPitch;
- GLuint ba, address = 0; /* a[0] = 0 */
-
- ba = (y / 16) * (pitch / 32) + (x / 32);
-
- address |= (x & 0x7) << 1; /* a[1..3] = x[0..2] */
- address |= (y & 0x7) << 4; /* a[4..6] = y[0..2] */
- address |= (x & 0x8) << 4; /* a[7] = x[3] */
- address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */
- address |= (y & 0x8) << 7; /* a[10] = y[3] */
- address |= ((x & 0x10) ^ (y & 0x10)) << 7; /* a[11] = x[4] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
-
- return address;
-}
-
-
-/* 16-bit depth buffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo )) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo ));
-
-#define TAG(x) radeon##x##_16
-#include "depthtmp.h"
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + radeon_mba_z32( rmesa, _x + xo, \
- _y + yo )) & 0x00ffffff;
-
-#define TAG(x) radeon##x##_24_8
-#include "depthtmp.h"
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0x00ffffff; \
- tmp |= (((d) & 0xff) << 24); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- d = tmp >> 24; \
-} while (0)
-
-#define TAG(x) radeon##x##_24_8
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void radeonSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
- break;
- case BACK_LEFT_BIT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- }
- break;
- default:
- assert(0);
- break;
- }
-}
-
-/* Move locking out to get reasonable span performance (10x better
- * than doing this in HW_LOCK above). WaitForIdle() is the main
- * culprit.
- */
-
-static void radeonSpanRenderStart( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
- radeonWaitForIdleLocked( rmesa );
-}
-
-static void radeonSpanRenderFinish( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( rmesa );
-}
-
-void radeonInitSpanFuncs( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = radeonSetBuffer;
-
- switch ( rmesa->radeonScreen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = radeonWriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = radeonWriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = radeonWriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = radeonReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = radeonReadRGBAPixels_RGB565;
- break;
-
- case 4:
- swdd->WriteRGBASpan = radeonWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = radeonWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = radeonWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = radeonReadRGBASpan_ARGB8888;
- swdd->ReadRGBAPixels = radeonReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-
- switch ( rmesa->glCtx->Visual.depthBits ) {
- case 16:
- swdd->ReadDepthSpan = radeonReadDepthSpan_16;
- swdd->WriteDepthSpan = radeonWriteDepthSpan_16;
- swdd->ReadDepthPixels = radeonReadDepthPixels_16;
- swdd->WriteDepthPixels = radeonWriteDepthPixels_16;
- break;
-
- case 24:
- swdd->ReadDepthSpan = radeonReadDepthSpan_24_8;
- swdd->WriteDepthSpan = radeonWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = radeonReadDepthPixels_24_8;
- swdd->WriteDepthPixels = radeonWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = radeonReadStencilSpan_24_8;
- swdd->WriteStencilSpan = radeonWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = radeonReadStencilPixels_24_8;
- swdd->WriteStencilPixels = radeonWriteStencilPixels_24_8;
- break;
-
- default:
- break;
- }
-
- swdd->SpanRenderStart = radeonSpanRenderStart;
- swdd->SpanRenderFinish = radeonSpanRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.h
deleted file mode 100644
index 011e8eff5..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.h,v 1.2 2002/02/22 21:45:01 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_SPAN_H__
-#define __RADEON_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void radeonInitSpanFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c
deleted file mode 100644
index c291701d3..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c
+++ /dev/null
@@ -1,2187 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.8 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-#include "enums.h"
-#include "colormac.h"
-#include "state.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-/* =============================================================
- * Alpha blending
- */
-
-static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- RADEON_STATECHANGE( rmesa, ctx );
-
- pp_misc &= ~(RADEON_ALPHA_TEST_OP_MASK | RADEON_REF_ALPHA_MASK);
- pp_misc |= (refByte & RADEON_REF_ALPHA_MASK);
-
- switch ( func ) {
- case GL_NEVER:
- pp_misc |= RADEON_ALPHA_TEST_FAIL;
- break;
- case GL_LESS:
- pp_misc |= RADEON_ALPHA_TEST_LESS;
- break;
- case GL_EQUAL:
- pp_misc |= RADEON_ALPHA_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_LEQUAL;
- break;
- case GL_GREATER:
- pp_misc |= RADEON_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- pp_misc |= RADEON_ALPHA_TEST_PASS;
- break;
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
-}
-
-static void radeonBlendEquation( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~RADEON_COMB_FCN_MASK;
- GLboolean fallback = GL_FALSE;
-
- switch ( mode ) {
- case GL_FUNC_ADD:
- case GL_LOGIC_OP:
- b |= RADEON_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- b |= RADEON_COMB_FCN_SUB_CLAMP;
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_COMB_FCN_ADD_CLAMP;
- break;
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_EQ, fallback );
- if ( !fallback ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
- if ( ctx->Color.ColorLogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
- }
-}
-
-static void radeonBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] &
- ~(RADEON_SRC_BLEND_MASK | RADEON_DST_BLEND_MASK);
- GLboolean fallback = GL_FALSE;
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- b |= RADEON_SRC_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= RADEON_SRC_BLEND_GL_ONE;
- break;
- case GL_DST_COLOR:
- b |= RADEON_SRC_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_COLOR:
- b |= RADEON_SRC_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= RADEON_SRC_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- b |= RADEON_SRC_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- b |= RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE;
- break;
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_SRC_BLEND_GL_ONE;
- break;
- default:
- break;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- b |= RADEON_DST_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= RADEON_DST_BLEND_GL_ONE;
- break;
- case GL_SRC_COLOR:
- b |= RADEON_DST_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= RADEON_DST_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_COLOR:
- b |= RADEON_DST_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_DST_ALPHA:
- b |= RADEON_DST_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_DST_BLEND_GL_ZERO;
- break;
- default:
- break;
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, fallback );
- if ( !fallback ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
- }
-}
-
-static void radeonBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- radeonBlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void radeonDepthFunc( GLcontext *ctx, GLenum func )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_ALWAYS;
- break;
- }
-}
-
-
-static void radeonDepthMask( GLcontext *ctx, GLboolean flag )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- RADEON_STATECHANGE( rmesa, ctx );
-
- if ( ctx->Depth.Mask ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_WRITE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_Z_WRITE_ENABLE;
- }
-}
-
-static void radeonClearDepth( GLcontext *ctx, GLclampd d )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &
- RADEON_DEPTH_FORMAT_MASK);
-
- switch ( format ) {
- case RADEON_DEPTH_FORMAT_16BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x0000ffff;
- break;
- case RADEON_DEPTH_FORMAT_24BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x00ffffff;
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- RADEON_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] =
- radeonPackColor( 4, col[0], col[1], col[2], 0 );
- break;
- case GL_FOG_COORDINATE_SOURCE_EXT:
- /* What to do?
- */
- break;
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- RADEON_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-static GLboolean intersect_rect( XF86DRIClipRectPtr out,
- XF86DRIClipRectPtr a,
- XF86DRIClipRectPtr b )
-{
- *out = *a;
- if ( b->x1 > out->x1 ) out->x1 = b->x1;
- if ( b->y1 > out->y1 ) out->y1 = b->y1;
- if ( b->x2 < out->x2 ) out->x2 = b->x2;
- if ( b->y2 < out->y2 ) out->y2 = b->y2;
- if ( out->x1 >= out->x2 ) return GL_FALSE;
- if ( out->y1 >= out->y2 ) return GL_FALSE;
- return GL_TRUE;
-}
-
-
-void radeonRecalcScissorRects( radeonContextPtr rmesa )
-{
- XF86DRIClipRectPtr out;
- int i;
-
- /* Grow cliprect store?
- */
- if (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- while (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- rmesa->state.scissor.numAllocedClipRects += 1; /* zero case */
- rmesa->state.scissor.numAllocedClipRects *= 2;
- }
-
- if (rmesa->state.scissor.pClipRects)
- FREE(rmesa->state.scissor.pClipRects);
-
- rmesa->state.scissor.pClipRects =
- MALLOC( rmesa->state.scissor.numAllocedClipRects *
- sizeof(XF86DRIClipRectRec) );
-
- if ( rmesa->state.scissor.pClipRects == NULL ) {
- rmesa->state.scissor.numAllocedClipRects = 0;
- return;
- }
- }
-
- out = rmesa->state.scissor.pClipRects;
- rmesa->state.scissor.numClipRects = 0;
-
- for ( i = 0 ; i < rmesa->numClipRects ; i++ ) {
- if ( intersect_rect( out,
- &rmesa->pClipRects[i],
- &rmesa->state.scissor.rect ) ) {
- rmesa->state.scissor.numClipRects++;
- out++;
- }
- }
-}
-
-
-static void radeonUpdateScissor( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if ( rmesa->dri.drawable ) {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- int x = ctx->Scissor.X;
- int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height;
- int w = ctx->Scissor.X + ctx->Scissor.Width - 1;
- int h = dPriv->h - ctx->Scissor.Y - 1;
-
- rmesa->state.scissor.rect.x1 = x + dPriv->x;
- rmesa->state.scissor.rect.y1 = y + dPriv->y;
- rmesa->state.scissor.rect.x2 = w + dPriv->x + 1;
- rmesa->state.scissor.rect.y2 = h + dPriv->y + 1;
-
- radeonRecalcScissorRects( rmesa );
- }
-}
-
-
-static void radeonScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if ( ctx->Scissor.Enabled ) {
- RADEON_FIREVERTICES( rmesa ); /* don't pipeline cliprect changes */
- radeonUpdateScissor( ctx );
- }
-
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void radeonCullFace( GLcontext *ctx, GLenum unused )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
- GLuint t = rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL];
-
- s |= RADEON_FFACE_SOLID | RADEON_BFACE_SOLID;
- t &= ~(RADEON_CULL_FRONT | RADEON_CULL_BACK);
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- s &= ~RADEON_FFACE_SOLID;
- t |= RADEON_CULL_FRONT;
- break;
- case GL_BACK:
- s &= ~RADEON_BFACE_SOLID;
- t |= RADEON_CULL_BACK;
- break;
- case GL_FRONT_AND_BACK:
- s &= ~(RADEON_FFACE_SOLID | RADEON_BFACE_SOLID);
- t |= (RADEON_CULL_FRONT | RADEON_CULL_BACK);
- break;
- }
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- RADEON_STATECHANGE(rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-
- if ( rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] != t ) {
- RADEON_STATECHANGE(rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] = t;
- }
-}
-
-static void radeonFrontFace( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_FFACE_CULL_DIR_MASK;
-
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_CULL_FRONT_IS_CCW;
-
- switch ( mode ) {
- case GL_CW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_FFACE_CULL_CW;
- break;
- case GL_CCW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_FFACE_CULL_CCW;
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_CULL_FRONT_IS_CCW;
- break;
- }
-}
-
-
-/* =============================================================
- * Line state
- */
-static void radeonLineWidth( GLcontext *ctx, GLfloat widthf )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, lin );
- RADEON_STATECHANGE( rmesa, set );
-
- /* Line width is stored in U6.4 format.
- */
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (GLuint)(widthf * 16.0);
- if ( widthf > 1.0 ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_WIDELINE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_WIDELINE_ENABLE;
- }
-}
-
-static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, lin );
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] =
- ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern));
-}
-
-
-/* =============================================================
- * Masks
- */
-static void radeonColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint mask = radeonPackColor( rmesa->radeonScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) {
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static void radeonPolygonOffset( GLcontext *ctx,
- GLfloat factor, GLfloat units )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat constant = units * rmesa->state.depth.scale;
-
- RADEON_STATECHANGE( rmesa, zbs );
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
-}
-
-static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint i;
- drmRadeonStipple stipple;
-
- /* Must flip pattern upside down.
- */
- for ( i = 0 ; i < 32 ; i++ ) {
- rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i];
- }
-
- /* TODO: push this into cmd mechanism
- */
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Use window x,y offsets into stipple RAM.
- */
- stipple.mask = rmesa->state.stipple.mask;
- drmCommandWrite( rmesa->dri.fd, DRM_RADEON_STIPPLE,
- &stipple, sizeof(drmRadeonStipple) );
- UNLOCK_HARDWARE( rmesa );
-}
-
-static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
-
- /* Can't generally do unfilled via tcl, but some good special
- * cases work.
- */
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_UNFILLED, flag);
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-static void radeonUpdateSpecular( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- CARD32 p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- RADEON_STATECHANGE( rmesa, tcl );
-
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
-
- p &= ~RADEON_SPECULAR_ENABLE;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_DIFFUSE_SPECULAR_COMBINE;
-
-
- if (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- p |= RADEON_SPECULAR_ENABLE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &=
- ~RADEON_DIFFUSE_SPECULAR_COMBINE;
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- p |= RADEON_SPECULAR_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- }
-
- if (ctx->Fog.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
-
- /* Bizzare: have to leave lighting enabled to get fog.
- */
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
-
- if ( ctx->_TriangleCaps & DD_SEPARATE_SPECULAR ) {
- assert( (p & RADEON_SPECULAR_ENABLE) != 0 );
- } else {
- assert( (p & RADEON_SPECULAR_ENABLE) == 0 );
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-static void update_global_ambient( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &
- ((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material[0].Emission);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material[0].Ambient);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- RADEON_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- * - material,
- * - colormaterial enabled
- * - colormaterial bitmask
- */
-static void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( lit[p] );
- GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- struct gl_material *mat = &ctx->Light.Material[0];
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- if (!ctx->Light.ColorMaterialEnabled)
- bitmask = 0;
-
- if ((bitmask & FRONT_AMBIENT_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_AMBIENT_RED], mat->Ambient );
-
- if ((bitmask & FRONT_DIFFUSE_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_DIFFUSE_RED], mat->Diffuse );
-
- if ((bitmask & FRONT_SPECULAR_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_SPECULAR_RED], mat->Specular );
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-/* Also fallback for asym colormaterial mode in twoside lighting...
- */
-static void check_twoside_fallback( GLcontext *ctx )
-{
- GLboolean fallback = GL_FALSE;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- if (memcmp( &ctx->Light.Material[0],
- &ctx->Light.Material[1],
- sizeof(struct gl_material)) != 0)
- fallback = GL_TRUE;
- else if (ctx->Light.ColorMaterialEnabled &&
- (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) !=
- ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1))
- fallback = GL_TRUE;
- }
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback );
-}
-
-static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- if (ctx->Light.ColorMaterialEnabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint light_model_ctl = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- /* Default to PREMULT:
- */
- light_model_ctl &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT) |
- (3 << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (3 << RADEON_SPECULAR_SOURCE_SHIFT));
-
- if (mask & FRONT_EMISSION_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_EMISSIVE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_AMBIENT_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_AMBIENT_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_DIFFUSE_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_DIFFUSE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_SPECULAR_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) {
- GLuint p;
-
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl;
-
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
- update_global_ambient( ctx );
- }
- }
-
- check_twoside_fallback( ctx );
-}
-
-void radeonUpdateMaterial( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( mtl );
- GLuint p;
- GLuint mask = ~0;
-
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (mask & FRONT_EMISSION_BIT) {
- fcmd[MTL_EMMISSIVE_RED] = ctx->Light.Material[0].Emission[0];
- fcmd[MTL_EMMISSIVE_GREEN] = ctx->Light.Material[0].Emission[1];
- fcmd[MTL_EMMISSIVE_BLUE] = ctx->Light.Material[0].Emission[2];
- fcmd[MTL_EMMISSIVE_ALPHA] = ctx->Light.Material[0].Emission[3];
- }
- if (mask & FRONT_AMBIENT_BIT) {
- fcmd[MTL_AMBIENT_RED] = ctx->Light.Material[0].Ambient[0];
- fcmd[MTL_AMBIENT_GREEN] = ctx->Light.Material[0].Ambient[1];
- fcmd[MTL_AMBIENT_BLUE] = ctx->Light.Material[0].Ambient[2];
- fcmd[MTL_AMBIENT_ALPHA] = ctx->Light.Material[0].Ambient[3];
- }
- if (mask & FRONT_DIFFUSE_BIT) {
- fcmd[MTL_DIFFUSE_RED] = ctx->Light.Material[0].Diffuse[0];
- fcmd[MTL_DIFFUSE_GREEN] = ctx->Light.Material[0].Diffuse[1];
- fcmd[MTL_DIFFUSE_BLUE] = ctx->Light.Material[0].Diffuse[2];
- fcmd[MTL_DIFFUSE_ALPHA] = ctx->Light.Material[0].Diffuse[3];
- }
- if (mask & FRONT_SPECULAR_BIT) {
- fcmd[MTL_SPECULAR_RED] = ctx->Light.Material[0].Specular[0];
- fcmd[MTL_SPECULAR_GREEN] = ctx->Light.Material[0].Specular[1];
- fcmd[MTL_SPECULAR_BLUE] = ctx->Light.Material[0].Specular[2];
- fcmd[MTL_SPECULAR_ALPHA] = ctx->Light.Material[0].Specular[3];
- }
- if (mask & FRONT_SHININESS_BIT) {
- fcmd[MTL_SHININESS] = ctx->Light.Material[0].Shininess;
- }
-
- if (RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mtl )) {
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
-
- check_twoside_fallback( ctx );
- update_global_ambient( ctx );
- }
- else if (RADEON_DEBUG & (DEBUG_PRIMS|DEBUG_STATE))
- fprintf(stderr, "%s: Elided noop material call\n", __FUNCTION__);
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-static void update_light( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~RADEON_LIGHT_IN_MODELSPACE;
- else
- tmp |= RADEON_LIGHT_IN_MODELSPACE;
-
-
- /* Leave this test disabled: (unexplained q3 lockup) (even with
- new packets)
- */
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL])
- {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-static void radeonLightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- /* FIXME: Set RANGE_ATTEN only when needed */
- if (p&1)
- flag = RADEON_LIGHT_1_IS_LOCAL;
- else
- flag = RADEON_LIGHT_0_IS_LOCAL;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? RADEON_LIGHT_1_IS_SPOT : RADEON_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
-
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
- /* Set RANGE_ATTEN only when needed */
- switch (pname) {
- case GL_POSITION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- {
- GLuint flag;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- if (p&1)
- flag = RADEON_LIGHT_1_ENABLE_RANGE_ATTEN;
- else
- flag = RADEON_LIGHT_0_ENABLE_RANGE_ATTEN;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F &&
- (l->LinearAttenuation != 0.0F || l->QuadraticAttenuation != 0.0F))
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
- default:
- break;
- }
-}
-
-
-
-
-static void radeonLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_LIGHT_TWOSIDE;
-
- check_twoside_fallback( ctx );
-
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- radeonUpdateSpecular(ctx);
- break;
-
- default:
- break;
- }
-}
-
-static void radeonShadeModel( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
-
- s &= ~(RADEON_DIFFUSE_SHADE_MASK |
- RADEON_ALPHA_SHADE_MASK |
- RADEON_SPECULAR_SHADE_MASK |
- RADEON_FOG_SHADE_MASK);
-
- switch ( mode ) {
- case GL_FLAT:
- s |= (RADEON_DIFFUSE_SHADE_FLAT |
- RADEON_ALPHA_SHADE_FLAT |
- RADEON_SPECULAR_SHADE_FLAT |
- RADEON_FOG_SHADE_FLAT);
- break;
- case GL_SMOOTH:
- s |= (RADEON_DIFFUSE_SHADE_GOURAUD |
- RADEON_ALPHA_SHADE_GOURAUD |
- RADEON_SPECULAR_SHADE_GOURAUD |
- RADEON_FOG_SHADE_GOURAUD);
- break;
- default:
- return;
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-}
-
-
-/* =============================================================
- * User clip planes
- */
-
-static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
-{
- GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- RADEON_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
-}
-
-static void radeonUpdateClipPlanes( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- RADEON_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
- }
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-static void radeonStencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << RADEON_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask[0] << RADEON_STENCIL_MASK_SHIFT));
-
- RADEON_STATECHANGE( rmesa, ctx );
- RADEON_STATECHANGE( rmesa, msk );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_STENCIL_TEST_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(RADEON_STENCIL_REF_MASK|
- RADEON_STENCIL_VALUE_MASK);
-
- switch ( ctx->Stencil.Function[0] ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_ALWAYS;
- break;
- }
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask;
-}
-
-static void radeonStencilMask( GLcontext *ctx, GLuint mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~RADEON_STENCIL_WRITE_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT);
-}
-
-static void radeonStencilOp( GLcontext *ctx, GLenum fail,
- GLenum zfail, GLenum zpass )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(RADEON_STENCIL_FAIL_MASK |
- RADEON_STENCIL_ZFAIL_MASK |
- RADEON_STENCIL_ZPASS_MASK);
-
- switch ( ctx->Stencil.FailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_DEC;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZFailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_DEC;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZPassFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_DEC;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_INVERT;
- break;
- }
-}
-
-static void radeonClearStencil( GLcontext *ctx, GLint s )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- rmesa->state.stencil.clear =
- ((GLuint) ctx->Stencil.Clear |
- (0xff << RADEON_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT));
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-void radeonUpdateWindow( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat sy = - v[MAT_SY];
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
- GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
- RADEON_FIREVERTICES( rmesa );
- RADEON_STATECHANGE( rmesa, vpt );
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
-}
-
-
-
-static void radeonViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* Don't pipeline viewport changes, conflict with window offset
- * setting below. Could apply deltas to rescue pipelined viewport
- * values, or keep the originals hanging around.
- */
- RADEON_FIREVERTICES( RADEON_CONTEXT(ctx) );
- radeonUpdateWindow( ctx );
-}
-
-static void radeonDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- radeonUpdateWindow( ctx );
-}
-
-void radeonUpdateViewportOffset( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat ty = (- v[MAT_TY]) + yoffset;
-
- if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
- {
- /* Note: this should also modify whatever data the context reset
- * code uses...
- */
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
-
- /* update polygon stipple x/y screen offset */
- {
- GLuint stx, sty;
- GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC];
-
- m &= ~(RADEON_STIPPLE_X_OFFSET_MASK |
- RADEON_STIPPLE_Y_OFFSET_MASK);
-
- /* add magic offsets, then invert */
- stx = 31 - ((rmesa->dri.drawable->x - 1) & RADEON_STIPPLE_COORD_MASK);
- sty = 31 - ((rmesa->dri.drawable->y + rmesa->dri.drawable->h - 1)
- & RADEON_STIPPLE_COORD_MASK);
-
- m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) |
- (sty << RADEON_STIPPLE_Y_OFFSET_SHIFT));
-
- if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) {
- RADEON_STATECHANGE( rmesa, msc );
- rmesa->hw.msc.cmd[MSC_RE_MISC] = m;
- }
- }
- }
-
- radeonUpdateScissor( ctx );
-}
-
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- rmesa->state.color.clear = radeonPackColor( rmesa->radeonScreen->cpp,
- c[0], c[1], c[2], c[3] );
-}
-
-
-static void radeonRenderMode( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- FALLBACK( rmesa, RADEON_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-static GLuint radeon_rop_tab[] = {
- RADEON_ROP_CLEAR,
- RADEON_ROP_AND,
- RADEON_ROP_AND_REVERSE,
- RADEON_ROP_COPY,
- RADEON_ROP_AND_INVERTED,
- RADEON_ROP_NOOP,
- RADEON_ROP_XOR,
- RADEON_ROP_OR,
- RADEON_ROP_NOR,
- RADEON_ROP_EQUIV,
- RADEON_ROP_INVERT,
- RADEON_ROP_OR_REVERSE,
- RADEON_ROP_COPY_INVERTED,
- RADEON_ROP_OR_INVERTED,
- RADEON_ROP_NAND,
- RADEON_ROP_SET,
-};
-
-static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint rop = (GLuint)opcode - GL_CLEAR;
-
- ASSERT( rop < 16 );
-
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = radeon_rop_tab[rop];
-}
-
-
-void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
- }
- else {
- rmesa->numClipRects = dPriv->numBackClipRects;
- rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pBackClipRects;
- }
- break;
- default:
- fprintf(stderr, "bad mode in radeonSetCliprects\n");
- return;
- }
-
- if (rmesa->state.scissor.enabled)
- radeonRecalcScissorRects( rmesa );
-}
-
-
-static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- RADEON_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- radeonSetCliprects( rmesa, GL_FRONT_LEFT );
- break;
- case BACK_LEFT_BIT:
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- radeonSetCliprects( rmesa, GL_BACK_LEFT );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->radeonScreen->fbLocation)
- & RADEON_COLOROFFSET_MASK);
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-static void radeonReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p, flag;
-
- if ( RADEON_DEBUG & DEBUG_STATE )
- fprintf( stderr, "%s( %s = %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
-
- switch ( cap ) {
- /* Fast track this one...
- */
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
-
- case GL_ALPHA_TEST:
- RADEON_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ALPHA_TEST_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ALPHA_TEST_ENABLE;
- }
- break;
-
- case GL_BLEND:
- RADEON_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ALPHA_BLEND_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ALPHA_BLEND_ENABLE;
- }
- if ( ctx->Color.ColorLogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
-
- /* Catch a possible fallback:
- */
- if (state) {
- ctx->Driver.BlendEquation( ctx, ctx->Color.BlendEquation );
- ctx->Driver.BlendFunc( ctx, ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB );
- }
- else {
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE );
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_EQ, GL_FALSE );
- }
- break;
-
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- p = cap-GL_CLIP_PLANE0;
- RADEON_STATECHANGE( rmesa, tcl );
- if (state) {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (RADEON_UCP_ENABLE_0<<p);
- radeonClipPlane( ctx, cap, NULL );
- }
- else {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(RADEON_UCP_ENABLE_0<<p);
- }
- break;
-
- case GL_COLOR_MATERIAL:
- radeonColorMaterial( ctx, 0, 0 );
- if (!state)
- radeonUpdateMaterial( ctx );
- break;
-
- case GL_CULL_FACE:
- radeonCullFace( ctx, 0 );
- break;
-
- case GL_DEPTH_TEST:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_Z_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_Z_ENABLE;
- }
- break;
-
- case GL_DITHER:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~rmesa->state.color.roundEnable;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
- }
- break;
-
- case GL_FOG:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_FOG_ENABLE;
- radeonFogfv( ctx, GL_FOG_MODE, 0 );
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_FOG_ENABLE;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- }
- radeonUpdateSpecular( ctx ); /* for PK_SPEC */
- if (rmesa->TclFallback)
- radeonChooseVertexState( ctx );
- _mesa_allow_light_in_model( ctx, !state );
- break;
-
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- RADEON_STATECHANGE(rmesa, tcl);
- p = cap - GL_LIGHT0;
- if (p&1)
- flag = (RADEON_LIGHT_1_ENABLE |
- RADEON_LIGHT_1_ENABLE_AMBIENT |
- RADEON_LIGHT_1_ENABLE_SPECULAR);
- else
- flag = (RADEON_LIGHT_0_ENABLE |
- RADEON_LIGHT_0_ENABLE_AMBIENT |
- RADEON_LIGHT_0_ENABLE_SPECULAR);
-
- if (state)
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] |= flag;
- else
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag;
-
- /*
- */
- update_light_colors( ctx, p );
- break;
-
- case GL_LIGHTING:
- RADEON_STATECHANGE(rmesa, tcl);
- radeonUpdateSpecular(ctx);
- check_twoside_fallback( ctx );
- break;
-
- case GL_LINE_SMOOTH:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ANTI_ALIAS_LINE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ANTI_ALIAS_LINE;
- }
- break;
-
- case GL_LINE_STIPPLE:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_PATTERN_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_PATTERN_ENABLE;
- }
- break;
-
- case GL_COLOR_LOGIC_OP:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
- break;
-
- case GL_NORMALIZE:
- RADEON_STATECHANGE( rmesa, tcl );
- if ( state ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_NORMALIZE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_NORMALIZE_NORMALS;
- }
- break;
-
- case GL_POLYGON_OFFSET_POINT:
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_POINT;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_POINT;
- }
- break;
-
- case GL_POLYGON_OFFSET_LINE:
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_LINE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_LINE;
- }
- break;
-
- case GL_POLYGON_OFFSET_FILL:
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_TRI;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_TRI;
- }
- break;
-
- case GL_POLYGON_SMOOTH:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ANTI_ALIAS_POLY;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ANTI_ALIAS_POLY;
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_STIPPLE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_STIPPLE_ENABLE;
- }
- break;
-
- case GL_RESCALE_NORMAL_EXT: {
- GLboolean tmp = ctx->_NeedEyeCoords ? state : !state;
- RADEON_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
- break;
- }
-
- case GL_SCISSOR_TEST:
- RADEON_FIREVERTICES( rmesa );
- rmesa->state.scissor.enabled = state;
- radeonUpdateScissor( ctx );
- break;
-
- case GL_STENCIL_TEST:
- if ( rmesa->state.stencil.hwBuffer ) {
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_STENCIL_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_STENCIL_ENABLE;
- }
- } else {
- FALLBACK( rmesa, RADEON_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_TEXTURE_GEN_Q:
- case GL_TEXTURE_GEN_R:
- case GL_TEXTURE_GEN_S:
- case GL_TEXTURE_GEN_T:
- /* Picked up in radeonUpdateTextureState.
- */
- rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE;
- break;
-
- case GL_COLOR_SUM_EXT:
- radeonUpdateSpecular ( ctx );
- break;
-
- default:
- return;
- }
-}
-
-
-static void radeonLightingSpaceChange( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean tmp;
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]);
-}
-
-/* =============================================================
- * Deferred state management - matrices, textures, other?
- */
-
-
-
-
-static void upload_matrix( radeonContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)RADEON_DB_STATE( mat[idx] ))+MAT_ELT_0;
- int i;
-
-
- for (i = 0 ; i < 4 ; i++) {
- *dest++ = src[i];
- *dest++ = src[i+4];
- *dest++ = src[i+8];
- *dest++ = src[i+12];
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-static void upload_matrix_t( radeonContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)RADEON_DB_STATE( mat[idx] ))+MAT_ELT_0;
- memcpy(dest, src, 16*sizeof(float));
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-
-static void update_texturematrix( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLuint tpc = rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL];
- GLuint vs = rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL];
- int unit;
-
- rmesa->TexMatEnabled = 0;
-
- for (unit = 0 ; unit < 2; unit++) {
- if (!ctx->Texture.Unit[unit]._ReallyEnabled) {
- }
- else if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
-
- rmesa->TexMatEnabled |= (RADEON_TEXGEN_TEXMAT_0_ENABLE|
- RADEON_TEXMAT_0_ENABLE) << unit;
-
- if (rmesa->TexGenEnabled & (RADEON_TEXMAT_0_ENABLE << unit)) {
- /* Need to preconcatenate any active texgen
- * obj/eyeplane matrices:
- */
- _math_matrix_mul_matrix( &rmesa->tmpmat,
- &rmesa->TexGenMatrix[unit],
- ctx->TextureMatrixStack[unit].Top );
- upload_matrix( rmesa, rmesa->tmpmat.m, TEXMAT_0+unit );
- }
- else {
- rmesa->TexMatEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
- TEXMAT_0+unit );
- }
- }
- else if (rmesa->TexGenEnabled & (RADEON_TEXMAT_0_ENABLE << unit)) {
- upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m,
- TEXMAT_0+unit );
- }
- }
-
-
- tpc = (rmesa->TexMatEnabled | rmesa->TexGenEnabled);
-
- vs &= ~((0xf << RADEON_TCL_TEX_0_OUTPUT_SHIFT) |
- (0xf << RADEON_TCL_TEX_1_OUTPUT_SHIFT));
-
- if (tpc & RADEON_TEXGEN_TEXMAT_0_ENABLE)
- vs |= RADEON_TCL_TEX_COMPUTED_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT;
- else
- vs |= RADEON_TCL_TEX_INPUT_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT;
-
- if (tpc & RADEON_TEXGEN_TEXMAT_1_ENABLE)
- vs |= RADEON_TCL_TEX_COMPUTED_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT;
- else
- vs |= RADEON_TCL_TEX_INPUT_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT;
-
- if (tpc != rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] ||
- vs != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL]) {
-
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] = tpc;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] = vs;
- }
-}
-
-
-
-void radeonValidateState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint new_state = rmesa->NewGLState;
-
- if (new_state & _NEW_TEXTURE) {
- radeonUpdateTextureState( ctx );
- new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
- }
-
- /* Need an event driven matrix update?
- */
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, MODEL_PROJ );
-
- /* Need these for lighting (shouldn't upload otherwise)
- */
- if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, MODEL );
- upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, MODEL_IT );
- }
-
- /* Does this need to be triggered on eg. modelview for
- * texgen-derived objplane/eyeplane matrices?
- */
- if (new_state & _NEW_TEXTURE_MATRIX) {
- update_texturematrix( ctx );
- }
-
- if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) {
- update_light( ctx );
- }
-
- /* emit all active clip planes if projection matrix changes.
- */
- if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform.ClipPlanesEnabled)
- radeonUpdateClipPlanes( ctx );
- }
-
-
- rmesa->NewGLState = 0;
-}
-
-
-static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _ae_invalidate_state( ctx, new_state );
- RADEON_CONTEXT(ctx)->NewGLState |= new_state;
- radeonVtxfmtInvalidate( ctx );
-}
-
-static void radeonWrapRunPipeline( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- if (tnl->vb.Material) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_TRUE );
- }
-
- /* Run the pipeline.
- */
- _tnl_run_pipeline( ctx );
-
- if (tnl->vb.Material) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_FALSE );
- radeonUpdateMaterial( ctx ); /* not needed any more? */
- }
-}
-
-
-/* Initialize the driver's state functions.
- */
-void radeonInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = radeonInvalidateState;
- ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
-
- ctx->Driver.DrawBuffer = radeonDrawBuffer;
- ctx->Driver.ReadBuffer = radeonReadBuffer;
-
- ctx->Driver.AlphaFunc = radeonAlphaFunc;
- ctx->Driver.BlendEquation = radeonBlendEquation;
- ctx->Driver.BlendFunc = radeonBlendFunc;
- ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
- ctx->Driver.ClearColor = radeonClearColor;
- ctx->Driver.ClearDepth = radeonClearDepth;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearStencil = radeonClearStencil;
- ctx->Driver.ClipPlane = radeonClipPlane;
- ctx->Driver.ColorMask = radeonColorMask;
- ctx->Driver.CullFace = radeonCullFace;
- ctx->Driver.DepthFunc = radeonDepthFunc;
- ctx->Driver.DepthMask = radeonDepthMask;
- ctx->Driver.DepthRange = radeonDepthRange;
- ctx->Driver.Enable = radeonEnable;
- ctx->Driver.Fogfv = radeonFogfv;
- ctx->Driver.FrontFace = radeonFrontFace;
- ctx->Driver.Hint = NULL;
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.LightModelfv = radeonLightModelfv;
- ctx->Driver.Lightfv = radeonLightfv;
- ctx->Driver.LineStipple = radeonLineStipple;
- ctx->Driver.LineWidth = radeonLineWidth;
- ctx->Driver.LogicOpcode = radeonLogicOpCode;
- ctx->Driver.PolygonMode = radeonPolygonMode;
- ctx->Driver.PolygonOffset = radeonPolygonOffset;
- ctx->Driver.PolygonStipple = radeonPolygonStipple;
- ctx->Driver.RenderMode = radeonRenderMode;
- ctx->Driver.Scissor = radeonScissor;
- ctx->Driver.ShadeModel = radeonShadeModel;
- ctx->Driver.StencilFunc = radeonStencilFunc;
- ctx->Driver.StencilMask = radeonStencilMask;
- ctx->Driver.StencilOp = radeonStencilOp;
- ctx->Driver.Viewport = radeonViewport;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = radeonUpdateMaterial;
- TNL_CONTEXT(ctx)->Driver.RunPipeline = radeonWrapRunPipeline;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.h
deleted file mode 100644
index a181d427e..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.h,v 1.5 2002/11/05 17:46:09 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __RADEON_STATE_H__
-#define __RADEON_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "radeon_context.h"
-
-extern void radeonInitState( radeonContextPtr rmesa );
-extern void radeonInitStateFuncs( GLcontext *ctx );
-
-extern void radeonUpdateMaterial( GLcontext *ctx );
-
-extern void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode );
-extern void radeonRecalcScissorRects( radeonContextPtr rmesa );
-extern void radeonUpdateViewportOffset( GLcontext *ctx );
-extern void radeonUpdateWindow( GLcontext *ctx );
-
-extern void radeonValidateState( GLcontext *ctx );
-
-extern void radeonPrintDirty( radeonContextPtr rmesa,
- const char *msg );
-
-
-extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) do { \
- if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
- __FUNCTION__, bit, mode ); \
- radeonFallback( rmesa->glCtx, bit, mode ); \
-} while (0)
-
-
-#define MODEL_PROJ 0
-#define MODEL 1
-#define MODEL_IT 2
-#define TEXMAT_0 3
-#define TEXMAT_1 4
-#define TEXMAT_2 5
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c
deleted file mode 100644
index 2aa8dbe40..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c,v 1.3 2003/02/22 06:21:11 dawes Exp $ */
-/*
- * Copyright 2000, 2001 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-#include "xmlpool.h"
-
-/* =============================================================
- * State initialization
- */
-
-void radeonPrintDirty( radeonContextPtr rmesa, const char *msg )
-{
- struct radeon_state_atom *l;
-
- fprintf(stderr, msg);
- fprintf(stderr, ": ");
-
- foreach(l, &(rmesa->hw.dirty)) {
- fprintf(stderr, "%s, ", l->name);
- }
-
- fprintf(stderr, "\n");
-}
-
-static int cmdpkt( int id )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.packet.cmd_type = RADEON_CMD_PACKET;
- h.packet.packet_id = id;
- return h.i;
-}
-
-static int cmdvec( int offset, int stride, int count )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.vectors.cmd_type = RADEON_CMD_VECTORS;
- h.vectors.offset = offset;
- h.vectors.stride = stride;
- h.vectors.count = count;
- return h.i;
-}
-
-static int cmdscl( int offset, int stride, int count )
-{
- drmRadeonCmdHeader h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS;
- h.scalars.offset = offset;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-#define CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx ) \
-{ \
- return FLAG; \
-}
-
-#define TCL_CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx ) \
-{ \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- return !rmesa->TclFallback && (FLAG); \
-}
-
-
-CHECK( always, GL_TRUE )
-CHECK( tex0, ctx->Texture.Unit[0]._ReallyEnabled )
-CHECK( tex1, ctx->Texture.Unit[1]._ReallyEnabled )
-CHECK( fog, ctx->Fog.Enabled )
-TCL_CHECK( tcl, GL_TRUE )
-TCL_CHECK( tcl_tex0, ctx->Texture.Unit[0]._ReallyEnabled )
-TCL_CHECK( tcl_tex1, ctx->Texture.Unit[1]._ReallyEnabled )
-TCL_CHECK( tcl_lighting, ctx->Light.Enabled )
-TCL_CHECK( tcl_eyespace_or_lighting, ctx->_NeedEyeCoords || ctx->Light.Enabled )
-TCL_CHECK( tcl_lit0, ctx->Light.Enabled && ctx->Light.Light[0].Enabled )
-TCL_CHECK( tcl_lit1, ctx->Light.Enabled && ctx->Light.Light[1].Enabled )
-TCL_CHECK( tcl_lit2, ctx->Light.Enabled && ctx->Light.Light[2].Enabled )
-TCL_CHECK( tcl_lit3, ctx->Light.Enabled && ctx->Light.Light[3].Enabled )
-TCL_CHECK( tcl_lit4, ctx->Light.Enabled && ctx->Light.Light[4].Enabled )
-TCL_CHECK( tcl_lit5, ctx->Light.Enabled && ctx->Light.Light[5].Enabled )
-TCL_CHECK( tcl_lit6, ctx->Light.Enabled && ctx->Light.Light[6].Enabled )
-TCL_CHECK( tcl_lit7, ctx->Light.Enabled && ctx->Light.Light[7].Enabled )
-TCL_CHECK( tcl_ucp0, (ctx->Transform.ClipPlanesEnabled & 0x1) )
-TCL_CHECK( tcl_ucp1, (ctx->Transform.ClipPlanesEnabled & 0x2) )
-TCL_CHECK( tcl_ucp2, (ctx->Transform.ClipPlanesEnabled & 0x4) )
-TCL_CHECK( tcl_ucp3, (ctx->Transform.ClipPlanesEnabled & 0x8) )
-TCL_CHECK( tcl_ucp4, (ctx->Transform.ClipPlanesEnabled & 0x10) )
-TCL_CHECK( tcl_ucp5, (ctx->Transform.ClipPlanesEnabled & 0x20) )
-TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled )
-
-CHECK( txr0, (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_RECT_BIT))
-CHECK( txr1, (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_RECT_BIT))
-
-
-
-/* Initialize the context's hardware state.
- */
-void radeonInitState( radeonContextPtr rmesa )
-{
- GLcontext *ctx = rmesa->glCtx;
- GLuint color_fmt, depth_fmt, i;
-
- switch ( rmesa->radeonScreen->cpp ) {
- case 2:
- color_fmt = RADEON_COLOR_FORMAT_RGB565;
- break;
- case 4:
- color_fmt = RADEON_COLOR_FORMAT_ARGB8888;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->state.color.clear = 0x00000000;
-
- switch ( ctx->Visual.depthBits ) {
- case 16:
- rmesa->state.depth.clear = 0x0000ffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffff;
- depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z;
- rmesa->state.stencil.clear = 0x00000000;
- break;
- case 24:
- rmesa->state.depth.clear = 0x00ffffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffffff;
- depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z;
- rmesa->state.stencil.clear = 0xff000000;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits );
- exit( -1 );
- }
-
- /* Only have hw stencil when depth buffer is 24 bits deep */
- rmesa->state.stencil.hwBuffer = ( ctx->Visual.stencilBits > 0 &&
- ctx->Visual.depthBits == 24 );
-
- rmesa->Fallback = 0;
-
- if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
-
- /* Initialize lists:
- */
- make_empty_list(&(rmesa->hw.dirty));
- make_empty_list(&(rmesa->hw.clean));
-
-
-#define ALLOC_STATE( ATOM, CHK, SZ, NM, FLAG ) \
- do { \
- rmesa->hw.ATOM.cmd_size = SZ; \
- rmesa->hw.ATOM.cmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.lastcmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.name = NM; \
- rmesa->hw.ATOM.is_tcl = FLAG; \
- rmesa->hw.ATOM.check = check_##CHK; \
- insert_at_head(&(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \
- } while (0)
-
-
- /* Allocate state buffers:
- */
- ALLOC_STATE( ctx, always, CTX_STATE_SIZE, "CTX/context", 0 );
- ALLOC_STATE( lin, always, LIN_STATE_SIZE, "LIN/line", 0 );
- ALLOC_STATE( msk, always, MSK_STATE_SIZE, "MSK/mask", 0 );
- ALLOC_STATE( vpt, always, VPT_STATE_SIZE, "VPT/viewport", 0 );
- ALLOC_STATE( set, always, SET_STATE_SIZE, "SET/setup", 0 );
- ALLOC_STATE( msc, always, MSC_STATE_SIZE, "MSC/misc", 0 );
- ALLOC_STATE( zbs, always, ZBS_STATE_SIZE, "ZBS/zbias", 0 );
- ALLOC_STATE( tcl, always, TCL_STATE_SIZE, "TCL/tcl", 1 );
- ALLOC_STATE( mtl, tcl_lighting, MTL_STATE_SIZE, "MTL/material", 1 );
- ALLOC_STATE( grd, always, GRD_STATE_SIZE, "GRD/guard-band", 1 );
- ALLOC_STATE( fog, fog, FOG_STATE_SIZE, "FOG/fog", 1 );
- ALLOC_STATE( glt, tcl_lighting, GLT_STATE_SIZE, "GLT/light-global", 1 );
- ALLOC_STATE( eye, tcl_lighting, EYE_STATE_SIZE, "EYE/eye-vector", 1 );
- ALLOC_STATE( tex[0], tex0, TEX_STATE_SIZE, "TEX/tex-0", 0 );
- ALLOC_STATE( tex[1], tex1, TEX_STATE_SIZE, "TEX/tex-1", 0 );
- ALLOC_STATE( mat[0], tcl, MAT_STATE_SIZE, "MAT/modelproject", 1 );
- ALLOC_STATE( mat[1], tcl_eyespace_or_fog, MAT_STATE_SIZE, "MAT/modelview", 1 );
- ALLOC_STATE( mat[2], tcl_eyespace_or_lighting, MAT_STATE_SIZE, "MAT/it-modelview", 1 );
- ALLOC_STATE( mat[3], tcl_tex0, MAT_STATE_SIZE, "MAT/texmat0", 1 );
- ALLOC_STATE( mat[4], tcl_tex1, MAT_STATE_SIZE, "MAT/texmat1", 1 );
- ALLOC_STATE( ucp[0], tcl_ucp0, UCP_STATE_SIZE, "UCP/userclip-0", 1 );
- ALLOC_STATE( ucp[1], tcl_ucp1, UCP_STATE_SIZE, "UCP/userclip-1", 1 );
- ALLOC_STATE( ucp[2], tcl_ucp2, UCP_STATE_SIZE, "UCP/userclip-2", 1 );
- ALLOC_STATE( ucp[3], tcl_ucp3, UCP_STATE_SIZE, "UCP/userclip-3", 1 );
- ALLOC_STATE( ucp[4], tcl_ucp4, UCP_STATE_SIZE, "UCP/userclip-4", 1 );
- ALLOC_STATE( ucp[5], tcl_ucp5, UCP_STATE_SIZE, "UCP/userclip-5", 1 );
- ALLOC_STATE( lit[0], tcl_lit0, LIT_STATE_SIZE, "LIT/light-0", 1 );
- ALLOC_STATE( lit[1], tcl_lit1, LIT_STATE_SIZE, "LIT/light-1", 1 );
- ALLOC_STATE( lit[2], tcl_lit2, LIT_STATE_SIZE, "LIT/light-2", 1 );
- ALLOC_STATE( lit[3], tcl_lit3, LIT_STATE_SIZE, "LIT/light-3", 1 );
- ALLOC_STATE( lit[4], tcl_lit4, LIT_STATE_SIZE, "LIT/light-4", 1 );
- ALLOC_STATE( lit[5], tcl_lit5, LIT_STATE_SIZE, "LIT/light-5", 1 );
- ALLOC_STATE( lit[6], tcl_lit6, LIT_STATE_SIZE, "LIT/light-6", 1 );
- ALLOC_STATE( lit[7], tcl_lit7, LIT_STATE_SIZE, "LIT/light-7", 1 );
- ALLOC_STATE( txr[0], txr0, TXR_STATE_SIZE, "TXR/txr-0", 0 );
- ALLOC_STATE( txr[1], txr1, TXR_STATE_SIZE, "TXR/txr-1", 0 );
-
-
- /* Fill in the packet headers:
- */
- rmesa->hw.ctx.cmd[CTX_CMD_0] = cmdpkt(RADEON_EMIT_PP_MISC);
- rmesa->hw.ctx.cmd[CTX_CMD_1] = cmdpkt(RADEON_EMIT_PP_CNTL);
- rmesa->hw.ctx.cmd[CTX_CMD_2] = cmdpkt(RADEON_EMIT_RB3D_COLORPITCH);
- rmesa->hw.lin.cmd[LIN_CMD_0] = cmdpkt(RADEON_EMIT_RE_LINE_PATTERN);
- rmesa->hw.lin.cmd[LIN_CMD_1] = cmdpkt(RADEON_EMIT_SE_LINE_WIDTH);
- rmesa->hw.msk.cmd[MSK_CMD_0] = cmdpkt(RADEON_EMIT_RB3D_STENCILREFMASK);
- rmesa->hw.vpt.cmd[VPT_CMD_0] = cmdpkt(RADEON_EMIT_SE_VPORT_XSCALE);
- rmesa->hw.set.cmd[SET_CMD_0] = cmdpkt(RADEON_EMIT_SE_CNTL);
- rmesa->hw.set.cmd[SET_CMD_1] = cmdpkt(RADEON_EMIT_SE_CNTL_STATUS);
- rmesa->hw.msc.cmd[MSC_CMD_0] = cmdpkt(RADEON_EMIT_RE_MISC);
- rmesa->hw.tex[0].cmd[TEX_CMD_0] = cmdpkt(RADEON_EMIT_PP_TXFILTER_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_1] = cmdpkt(RADEON_EMIT_PP_BORDER_COLOR_0);
- rmesa->hw.tex[1].cmd[TEX_CMD_0] = cmdpkt(RADEON_EMIT_PP_TXFILTER_1);
- rmesa->hw.tex[1].cmd[TEX_CMD_1] = cmdpkt(RADEON_EMIT_PP_BORDER_COLOR_1);
- rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
- rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT);
- rmesa->hw.mtl.cmd[MTL_CMD_0] =
- cmdpkt(RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED);
- rmesa->hw.txr[0].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_0);
- rmesa->hw.txr[1].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_1);
- rmesa->hw.grd.cmd[GRD_CMD_0] =
- cmdscl( RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR, 1, 4 );
- rmesa->hw.fog.cmd[FOG_CMD_0] =
- cmdvec( RADEON_VS_FOG_PARAM_ADDR, 1, 4 );
- rmesa->hw.glt.cmd[GLT_CMD_0] =
- cmdvec( RADEON_VS_GLOBAL_AMBIENT_ADDR, 1, 4 );
- rmesa->hw.eye.cmd[EYE_CMD_0] =
- cmdvec( RADEON_VS_EYE_VECTOR_ADDR, 1, 4 );
-
- for (i = 0 ; i < 5; i++) {
- rmesa->hw.mat[i].cmd[MAT_CMD_0] =
- cmdvec( RADEON_VS_MATRIX_0_ADDR + i*4, 1, 16);
- }
-
- for (i = 0 ; i < 8; i++) {
- rmesa->hw.lit[i].cmd[LIT_CMD_0] =
- cmdvec( RADEON_VS_LIGHT_AMBIENT_ADDR + i, 8, 24 );
- rmesa->hw.lit[i].cmd[LIT_CMD_1] =
- cmdscl( RADEON_SS_LIGHT_DCD_ADDR + i, 8, 6 );
- }
-
- for (i = 0 ; i < 6; i++) {
- rmesa->hw.ucp[i].cmd[UCP_CMD_0] =
- cmdvec( RADEON_VS_UCP_ADDR + i, 1, 4 );
- }
-
- rmesa->last_ReallyEnabled = -1;
-
- /* Initial Harware state:
- */
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = (RADEON_ALPHA_TEST_PASS |
- RADEON_CHROMA_FUNC_FAIL |
- RADEON_CHROMA_KEY_NEAREST |
- RADEON_SHADOW_FUNC_EQUAL |
- RADEON_SHADOW_PASS_1 |
- RADEON_RIGHT_HAND_CUBE_OGL);
-
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = (RADEON_FOG_VERTEX |
- RADEON_FOG_USE_DEPTH);
-
- rmesa->hw.ctx.cmd[CTX_RE_SOLID_COLOR] = 0x00000000;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = (RADEON_COMB_FCN_ADD_CLAMP |
- RADEON_SRC_BLEND_GL_ONE |
- RADEON_DST_BLEND_GL_ZERO );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHOFFSET] =
- rmesa->radeonScreen->depthOffset + rmesa->radeonScreen->fbLocation;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] =
- ((rmesa->radeonScreen->depthPitch &
- RADEON_DEPTHPITCH_MASK) |
- RADEON_DEPTH_ENDIAN_NO_SWAP);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] = (depth_fmt |
- RADEON_Z_TEST_LESS |
- RADEON_STENCIL_TEST_ALWAYS |
- RADEON_STENCIL_FAIL_KEEP |
- RADEON_STENCIL_ZPASS_KEEP |
- RADEON_STENCIL_ZFAIL_KEEP |
- RADEON_Z_WRITE_ENABLE);
-
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = (RADEON_SCISSOR_ENABLE |
- RADEON_ANTI_ALIAS_NONE);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = (RADEON_PLANE_MASK_ENABLE |
- color_fmt |
- (1<<15));
-
- switch ( driQueryOptioni( &rmesa->optionCache, "dither_mode" ) ) {
- case DRI_CONF_DITHER_XERRORDIFFRESET:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_INIT;
- break;
- case DRI_CONF_DITHER_ORDERED:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_SCALE_DITHER_ENABLE;
- break;
- }
- if ( driQueryOptioni( &rmesa->optionCache, "round_mode" ) ==
- DRI_CONF_ROUND_ROUND )
- rmesa->state.color.roundEnable = RADEON_ROUND_ENABLE;
- else
- rmesa->state.color.roundEnable = 0;
- if ( driQueryOptioni (&rmesa->optionCache, "color_reduction" ) ==
- DRI_CONF_COLOR_REDUCTION_DITHER )
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_ENABLE;
- else
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->radeonScreen->fbLocation)
- & RADEON_COLOROFFSET_MASK);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch &
- RADEON_COLORPITCH_MASK) |
- RADEON_COLOR_ENDIAN_NO_SWAP);
-
- rmesa->hw.set.cmd[SET_SE_CNTL] = (RADEON_FFACE_CULL_CCW |
- RADEON_BFACE_SOLID |
- RADEON_FFACE_SOLID |
-/* RADEON_BADVTX_CULL_DISABLE | */
- RADEON_FLAT_SHADE_VTX_LAST |
- RADEON_DIFFUSE_SHADE_GOURAUD |
- RADEON_ALPHA_SHADE_GOURAUD |
- RADEON_SPECULAR_SHADE_GOURAUD |
- RADEON_FOG_SHADE_GOURAUD |
- RADEON_VPORT_XY_XFORM_ENABLE |
- RADEON_VPORT_Z_XFORM_ENABLE |
- RADEON_VTX_PIX_CENTER_OGL |
- RADEON_ROUND_MODE_TRUNC |
- RADEON_ROUND_PREC_8TH_PIX);
-
- rmesa->hw.set.cmd[SET_SE_CNTL_STATUS] =
-#ifdef MESA_BIG_ENDIAN
- RADEON_VC_32BIT_SWAP;
-#else
- RADEON_VC_NO_SWAP;
-#endif
-
- if (!(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- rmesa->hw.set.cmd[SET_SE_CNTL_STATUS] |= RADEON_TCL_BYPASS;
- }
-
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = (
- RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
-
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((1 << 16) | 0xffff);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_STATE] =
- ((0 << RADEON_LINE_CURRENT_PTR_SHIFT) |
- (1 << RADEON_LINE_CURRENT_COUNT_SHIFT));
-
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (1 << 4);
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] =
- ((0x00 << RADEON_STENCIL_REF_SHIFT) |
- (0xff << RADEON_STENCIL_MASK_SHIFT) |
- (0xff << RADEON_STENCIL_WRITEMASK_SHIFT));
-
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = RADEON_ROP_COPY;
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = 0xffffffff;
-
- rmesa->hw.msc.cmd[MSC_RE_MISC] =
- ((0 << RADEON_STIPPLE_X_OFFSET_SHIFT) |
- (0 << RADEON_STIPPLE_Y_OFFSET_SHIFT) |
- RADEON_STIPPLE_BIG_BIT_ORDER);
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = 0x00000000;
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] = RADEON_BORDER_MODE_OGL;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT] =
- (RADEON_TXFORMAT_ENDIAN_NO_SWAP |
- RADEON_TXFORMAT_PERSPECTIVE_ENABLE |
- (i << 24) | /* This is one of RADEON_TXFORMAT_ST_ROUTE_STQ[012] */
- (2 << RADEON_TXFORMAT_WIDTH_SHIFT) |
- (2 << RADEON_TXFORMAT_HEIGHT_SHIFT));
-
- /* Initialize the texture offset to the start of the card texture heap */
- rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] =
- rmesa->radeonScreen->texOffset[RADEON_CARD_HEAP];
-
- rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[i].cmd[TEX_PP_TXCBLEND] =
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_CURRENT_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX);
- rmesa->hw.tex[i].cmd[TEX_PP_TXABLEND] =
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX);
- rmesa->hw.tex[i].cmd[TEX_PP_TFACTOR] = 0;
- }
-
- /* Can only add ST1 at the time of doing some multitex but can keep
- * it after that. Errors if DIFFUSE is missing.
- */
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] =
- (RADEON_TCL_VTX_Z0 |
- RADEON_TCL_VTX_W0 |
- RADEON_TCL_VTX_PK_DIFFUSE
- ); /* need to keep this uptodate */
-
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] =
- ( RADEON_TCL_COMPUTE_XYZW |
- (RADEON_TCL_TEX_INPUT_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT) |
- (RADEON_TCL_TEX_INPUT_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT) |
- (RADEON_TCL_TEX_INPUT_TEX_2 << RADEON_TCL_TEX_2_OUTPUT_SHIFT));
-
-
- /* XXX */
- rmesa->hw.tcl.cmd[TCL_MATRIX_SELECT_0] =
- ((MODEL << RADEON_MODELVIEW_0_SHIFT) |
- (MODEL_IT << RADEON_IT_MODELVIEW_0_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_MATRIX_SELECT_1] =
- ((MODEL_PROJ << RADEON_MODELPROJECT_0_SHIFT) |
- (TEXMAT_0 << RADEON_TEXMAT_0_SHIFT) |
- (TEXMAT_1 << RADEON_TEXMAT_1_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] =
- (RADEON_UCP_IN_CLIP_SPACE |
- RADEON_CULL_FRONT_IS_CCW);
-
- rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] = 0;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] =
- (RADEON_SPECULAR_LIGHTS |
- RADEON_DIFFUSE_SPECULAR_COMBINE |
- RADEON_LOCAL_LIGHT_VEC_GL |
- (RADEON_LM_SOURCE_STATE_PREMULT << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_PREMULT << RADEON_AMBIENT_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_PREMULT << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_PREMULT << RADEON_SPECULAR_SOURCE_SHIFT));
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
-
- for (i = 0 ; i < 6; i++) {
- ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL );
- }
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, 0 );
-
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_DISCARD_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_DISCARD_ADJ] = IEEE_ONE;
-
- rmesa->hw.eye.cmd[EYE_X] = 0;
- rmesa->hw.eye.cmd[EYE_Y] = 0;
- rmesa->hw.eye.cmd[EYE_Z] = IEEE_ONE;
- rmesa->hw.eye.cmd[EYE_RESCALE_FACTOR] = IEEE_ONE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
deleted file mode 100644
index 89db67739..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
+++ /dev/null
@@ -1,1254 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "enums.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_imm_exec.h"
-#include "tnl/t_pipeline.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_swtcl.h"
-#include "radeon_tcl.h"
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-
-#define RADEON_XYZW_BIT 0x01
-#define RADEON_RGBA_BIT 0x02
-#define RADEON_SPEC_BIT 0x04
-#define RADEON_TEX0_BIT 0x08
-#define RADEON_TEX1_BIT 0x10
-#define RADEON_PTEX_BIT 0x20
-#define RADEON_MAX_SETUP 0x40
-
-static void flush_last_swtcl_prim( radeonContextPtr rmesa );
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[RADEON_MAX_SETUP];
-
-
-#define TINY_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
- RADEON_CP_VC_FRMT_Z | \
- RADEON_CP_VC_FRMT_PKCOLOR)
-
-#define NOTEX_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
- RADEON_CP_VC_FRMT_Z | \
- RADEON_CP_VC_FRMT_W0 | \
- RADEON_CP_VC_FRMT_PKCOLOR | \
- RADEON_CP_VC_FRMT_PKSPEC)
-
-#define TEX0_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
- RADEON_CP_VC_FRMT_Z | \
- RADEON_CP_VC_FRMT_W0 | \
- RADEON_CP_VC_FRMT_PKCOLOR | \
- RADEON_CP_VC_FRMT_PKSPEC | \
- RADEON_CP_VC_FRMT_ST0)
-
-#define TEX1_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
- RADEON_CP_VC_FRMT_Z | \
- RADEON_CP_VC_FRMT_W0 | \
- RADEON_CP_VC_FRMT_PKCOLOR | \
- RADEON_CP_VC_FRMT_PKSPEC | \
- RADEON_CP_VC_FRMT_ST0 | \
- RADEON_CP_VC_FRMT_ST1)
-
-#define PROJ_TEX1_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
- RADEON_CP_VC_FRMT_Z | \
- RADEON_CP_VC_FRMT_W0 | \
- RADEON_CP_VC_FRMT_PKCOLOR | \
- RADEON_CP_VC_FRMT_PKSPEC | \
- RADEON_CP_VC_FRMT_ST0 | \
- RADEON_CP_VC_FRMT_Q0 | \
- RADEON_CP_VC_FRMT_ST1 | \
- RADEON_CP_VC_FRMT_Q1)
-
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & RADEON_XYZW_BIT)
-#define DO_RGBA (IND & RADEON_RGBA_BIT)
-#define DO_SPEC (IND & RADEON_SPEC_BIT)
-#define DO_FOG (IND & RADEON_SPEC_BIT)
-#define DO_TEX0 (IND & RADEON_TEX0_BIT)
-#define DO_TEX1 (IND & RADEON_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & RADEON_PTEX_BIT)
-
-#define VERTEX radeonVertex
-#define VERTEX_COLOR radeon_color_t
-#define GET_VIEWPORT_MAT() 0
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() RADEON_CONTEXT(ctx)->swtcl.vertex_format
-#define GET_VERTEX_STORE() RADEON_CONTEXT(ctx)->swtcl.verts
-#define GET_VERTEX_STRIDE_SHIFT() RADEON_CONTEXT(ctx)->swtcl.vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 1
-/* Tiny vertices don't seem to work atm - haven't looked into why.
- */
-#define HAVE_HW_DIVIDE (IND & ~(RADEON_XYZW_BIT|RADEON_RGBA_BIT))
-#define HAVE_TINY_VERTICES 1
-#define HAVE_RGBA_COLOR 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define CHECK_HW_DIVIDE (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE| \
- DD_TRI_UNFILLED)))
-
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS radeon_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS radeon_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) radeon_##x
-#define IND ~0
-#include "tnl_dd/t_dd_vb.c"
-#undef IND
-
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_TEX1_BIT|\
- RADEON_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
- RADEON_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
- RADEON_TEX0_BIT|RADEON_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
- RADEON_TEX0_BIT|RADEON_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
- RADEON_TEX0_BIT|RADEON_TEX1_BIT|RADEON_PTEX_BIT)
-#define TAG(x) x##_wgfspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgt0();
- init_wgpt0();
- init_wgt0t1();
- init_wgpt0t1();
- init_wgfs();
- init_wgfst0();
- init_wgfspt0();
- init_wgfst0t1();
- init_wgfspt0t1();
-}
-
-
-
-void radeonPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & RADEON_XYZW_BIT) ? " xyzw," : "",
- (flags & RADEON_RGBA_BIT) ? " rgba," : "",
- (flags & RADEON_SPEC_BIT) ? " spec/fog," : "",
- (flags & RADEON_TEX0_BIT) ? " tex-0," : "",
- (flags & RADEON_TEX1_BIT) ? " tex-1," : "",
- (flags & RADEON_PTEX_BIT) ? " proj-tex," : "");
-}
-
-
-static void radeonRenderStart( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (!setup_tab[rmesa->swtcl.SetupIndex].check_tex_sizes(ctx)) {
- GLuint ind = rmesa->swtcl.SetupIndex |= (RADEON_PTEX_BIT|RADEON_RGBA_BIT);
-
- /* Projective textures are handled nicely; just have to change
- * up to the new vertex format.
- */
- if (setup_tab[ind].vertex_format != rmesa->swtcl.vertex_format) {
- RADEON_NEWPRIM(rmesa);
- rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
- rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-
- if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[rmesa->swtcl.SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[rmesa->swtcl.SetupIndex].copy_pv;
- }
- }
-
- if (rmesa->dma.flush != 0 &&
- rmesa->dma.flush != flush_last_swtcl_prim)
- rmesa->dma.flush( rmesa );
-}
-
-
-void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->swtcl.verts +
- (start << rmesa->swtcl.vertex_stride_shift));
- GLuint stride = 1 << rmesa->swtcl.vertex_stride_shift;
-
- newinputs |= rmesa->swtcl.SetupNewInputs;
- rmesa->swtcl.SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, v, stride );
-}
-
-void radeonChooseVertexState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = (RADEON_XYZW_BIT | RADEON_RGBA_BIT);
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (ctx->Fog.Enabled || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
- ind |= RADEON_SPEC_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= RADEON_TEX0_BIT|RADEON_TEX1_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= RADEON_TEX0_BIT;
-
- rmesa->swtcl.SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = radeon_interp_extras;
- tnl->Driver.Render.CopyPV = radeon_copy_pv_extras;
- }
- else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != rmesa->swtcl.vertex_format) {
- RADEON_NEWPRIM(rmesa);
- rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
- rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-
- {
- GLuint se_coord_fmt, needproj;
-
- /* HW perspective divide is a win, but tiny vertex formats are a
- * bigger one.
- */
- if (setup_tab[ind].vertex_format == TINY_VERTEX_FORMAT ||
- (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- needproj = GL_TRUE;
- se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
- RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
- }
- else {
- needproj = GL_FALSE;
- se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
- }
-
- if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
- }
- _tnl_need_projected_coords( ctx, needproj );
- }
-}
-
-
-/* Flush vertices in the current dma region.
- */
-static void flush_last_swtcl_prim( radeonContextPtr rmesa )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->dma.flush = 0;
-
- if (rmesa->dma.current.buf) {
- struct radeon_dma_region *current = &rmesa->dma.current;
- GLuint current_offset = (rmesa->radeonScreen->gart_buffer_offset +
- current->buf->buf->idx * RADEON_BUFFER_SIZE +
- current->start);
-
- assert (!(rmesa->swtcl.hw_primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- assert (current->start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- current->ptr);
-
- if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
- radeonEmitVertexAOS( rmesa,
- rmesa->swtcl.vertex_size,
- current_offset);
-
- radeonEmitVbufPrim( rmesa,
- rmesa->swtcl.vertex_format,
- rmesa->swtcl.hw_primitive,
- rmesa->swtcl.numverts);
- }
-
- rmesa->swtcl.numverts = 0;
- current->start = current->ptr;
- }
-}
-
-
-/* Alloc space in the current dma region.
- */
-static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa,
- int nverts, int vsize )
-{
- GLuint bytes = vsize * nverts;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- radeonRefillCurrentDmaRegion( rmesa );
-
- if (!rmesa->dma.flush) {
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = flush_last_swtcl_prim;
- }
-
- assert( vsize == rmesa->swtcl.vertex_size * 4 );
- assert( rmesa->dma.flush == flush_last_swtcl_prim );
- assert (rmesa->dma.current.start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- rmesa->dma.current.ptr);
-
-
- {
- GLubyte *head = (GLubyte *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->dma.current.ptr += bytes;
- rmesa->swtcl.numverts += nverts;
- return head;
- }
-
-}
-
-
-
-
-void radeon_emit_contiguous_verts( GLcontext *ctx, GLuint start, GLuint count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint vertex_size = rmesa->swtcl.vertex_size * 4;
- CARD32 *dest = radeonAllocDmaLowVerts( rmesa, count-start, vertex_size );
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest,
- vertex_size );
-}
-
-
-
-void radeon_emit_indexed_verts( GLcontext *ctx, GLuint start, GLuint count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- radeonAllocDmaRegionVerts( rmesa,
- &rmesa->swtcl.indexed_verts,
- count - start,
- rmesa->swtcl.vertex_size * 4,
- 64);
-
- setup_tab[rmesa->swtcl.SetupIndex].emit(
- ctx, start, count,
- rmesa->swtcl.indexed_verts.address + rmesa->swtcl.indexed_verts.start,
- rmesa->swtcl.vertex_size * 4 );
-}
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 0
-#define HAVE_ELTS 1
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- 0,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
- 0,
- 0,
- 0
-};
-
-static __inline void radeonDmaPrimitive( radeonContextPtr rmesa, GLenum prim )
-{
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim];
- assert(rmesa->dma.current.ptr == rmesa->dma.current.start);
-}
-
-static __inline void radeonEltPrimitive( radeonContextPtr rmesa, GLenum prim )
-{
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim] | RADEON_CP_VC_CNTL_PRIM_WALK_IND;
-}
-
-
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
-}
-
-static void ELT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
- tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
-}
-
-
-#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
-#define ELTS_VARS GLushort *dest
-#define INIT( prim ) radeonDmaPrimitive( rmesa, prim )
-#define ELT_INIT(prim) radeonEltPrimitive( rmesa, prim )
-#define NEW_PRIMITIVE() RADEON_NEWPRIM( rmesa )
-#define NEW_BUFFER() radeonRefillCurrentDmaRegion( rmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)rmesa->dma.current.end - (int)rmesa->dma.current.ptr) / (rmesa->swtcl.vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- ((RADEON_BUFFER_SIZE) / (rmesa->swtcl.vertex_size*4))
-
-#if RADEON_OLD_PACKETS
-# define GET_CURRENT_VB_MAX_ELTS() \
- ((RADEON_CMD_BUF_SZ - (rmesa->store.cmd_used + 24)) / 2)
-#else
-# define GET_CURRENT_VB_MAX_ELTS() \
- ((RADEON_CMD_BUF_SZ - (rmesa->store.cmd_used + 16)) / 2)
-#endif
-#define GET_SUBSEQUENT_VB_MAX_ELTS() \
- ((RADEON_CMD_BUF_SZ - 1024) / 2)
-
-
-
-/* How do you extend an existing primitive?
- */
-#define ALLOC_ELTS(nr) \
-do { \
- if (rmesa->dma.flush == radeonFlushElts && \
- rmesa->store.cmd_used + nr*2 < RADEON_CMD_BUF_SZ) { \
- \
- dest = (GLushort *)(rmesa->store.cmd_buf + \
- rmesa->store.cmd_used); \
- rmesa->store.cmd_used += nr*2; \
- } \
- else { \
- if (rmesa->dma.flush) { \
- rmesa->dma.flush( rmesa ); \
- } \
- \
- radeonEmitVertexAOS( rmesa, \
- rmesa->swtcl.vertex_size, \
- (rmesa->radeonScreen->gart_buffer_offset + \
- rmesa->swtcl.indexed_verts.buf->buf->idx * \
- RADEON_BUFFER_SIZE + \
- rmesa->swtcl.indexed_verts.start)); \
- \
- dest = radeonAllocEltsOpenEnded( rmesa, \
- rmesa->swtcl.vertex_format, \
- rmesa->swtcl.hw_primitive, \
- nr ); \
- } \
-} while (0)
-
-#define ALLOC_ELTS_NEW_PRIMITIVE(nr) ALLOC_ELTS( nr )
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0)
-#else
-#define EMIT_ELT(offset, x) (dest)[offset] = (GLushort) (x)
-#endif
-#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
-#define INCR_ELTS( nr ) dest += nr
-#define RELEASE_ELT_VERTS() \
- radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ )
-#define EMIT_VERTS( ctx, j, nr ) \
- radeon_emit_contiguous_verts(ctx, j, (j)+(nr))
-#define EMIT_INDEXED_VERTS( ctx, start, count ) \
- radeon_emit_indexed_verts( ctx, start, count )
-
-
-#define TAG(x) radeon_dma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean radeon_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
- render_func *tab = TAG(render_tab_verts);
-
- if (rmesa->swtcl.indexed_verts.buf && (!VB->Elts || stage->changed_inputs))
- RELEASE_ELT_VERTS();
-
- if (VB->ClipOrMask || /* No clipping */
- rmesa->swtcl.RenderIndex != 0 || /* No per-vertex manipulations */
- ctx->Line.StippleFlag) /* GH: THIS IS A HACK!!! */
- return GL_TRUE;
-
- tnl->Driver.Render.Start( ctx );
-
- if (VB->Elts) {
- tab = TAG(render_tab_elts);
- if (!rmesa->swtcl.indexed_verts.buf)
- if (!TAG(emit_elt_verts)(ctx, 0, VB->Count))
- return GL_TRUE; /* too many vertices */
- }
-
- for (i = 0 ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "radeon_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
-
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-static void radeon_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
- if (ctx->RenderMode == GL_RENDER) {
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
-
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
- }
-
- stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct gl_pipeline_stage _radeon_render_stage =
-{
- "radeon render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- radeon_check_render, /* check - initially set to alloc data */
- radeon_run_render /* run */
-};
-
-
-/**************************************************************************/
-
-/* Radeon texture rectangle expects coords in 0..1 range, not 0..dimension
- * as in the extension spec. Need to translate here.
- *
- * Note that swrast expects 0..dimension, so if a fallback is active,
- * don't do anything. (Maybe need to configure swrast to match hw)
- */
-struct texrect_stage_data {
- GLvector4f texcoord[MAX_TEXTURE_UNITS];
-};
-
-#define TEXRECT_STAGE_DATA(stage) ((struct texrect_stage_data *)stage->privatePtr)
-
-
-static GLboolean run_texrect_stage( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- if (rmesa->Fallback)
- return GL_TRUE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (!(ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_RECT_BIT))
- continue;
-
- if (stage->changed_inputs & VERT_BIT_TEX(i)) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[i].CurrentRect;
- struct gl_texture_image *texImage = texObj->Image[texObj->BaseLevel];
- const GLfloat iw = 1.0/texImage->Width;
- const GLfloat ih = 1.0/texImage->Height;
- GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data;
- GLint instride = VB->TexCoordPtr[i]->stride;
- GLfloat (*out)[4] = store->texcoord[i].data;
- GLint j;
-
- for (j = 0 ; j < VB->Count ; j++) {
- out[j][0] = in[0] * iw;
- out[j][1] = in[1] * ih;
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- }
-
- VB->TexCoordPtr[i] = &store->texcoord[i];
- }
-
- return GL_TRUE;
-}
-
-
-/* Called the first time stage->run() is invoked.
- */
-static GLboolean alloc_texrect_data( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct texrect_stage_data *store;
- GLuint i;
-
- stage->privatePtr = CALLOC(sizeof(*store));
- store = TEXRECT_STAGE_DATA(stage);
- if (!store)
- return GL_FALSE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
-
- /* Now run the stage.
- */
- stage->run = run_texrect_stage;
- return stage->run( ctx, stage );
-}
-
-
-static void check_texrect( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- GLuint flags = 0;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_RECT_BIT)
- flags |= VERT_BIT_TEX0;
-
- if (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_RECT_BIT)
- flags |= VERT_BIT_TEX1;
-
- stage->inputs = flags;
- stage->outputs = flags;
- stage->active = (flags != 0);
-}
-
-
-static void free_texrect_data( struct gl_pipeline_stage *stage )
-{
- struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
- GLuint i;
-
- if (store) {
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
- if (store->texcoord[i].data)
- _mesa_vector4f_free( &store->texcoord[i] );
- FREE( store );
- stage->privatePtr = 0;
- }
-}
-
-
-const struct gl_pipeline_stage _radeon_texrect_stage =
-{
- "radeon texrect stage", /* name */
- _NEW_TEXTURE, /* check_state */
- _NEW_TEXTURE, /* run_state */
- GL_TRUE, /* active? */
- 0, /* inputs */
- 0, /* outputs */
- 0, /* changed_inputs */
- NULL, /* private data */
- free_texrect_data, /* destructor */
- check_texrect, /* check */
- alloc_texrect_data, /* run -- initially set to init */
-};
-
-
-/**************************************************************************/
-
-
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
-};
-
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void radeonResetLineStipple( GLcontext *ctx );
-
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#undef LOCAL_VARS
-#define CTX_ARG radeonContextPtr rmesa
-#define CTX_ARG2 rmesa
-#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
-#define ALLOC_VERTS( n, size ) radeonAllocDmaLowVerts( rmesa, n, size * 4 )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
- const char *radeonverts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (radeonVertex *)(radeonverts + (x << shift))
-#define VERTEX radeonVertex
-#undef TAG
-#define TAG(x) radeon_##x
-#include "tnl_dd/t_dd_triemit.h"
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define QUAD( a, b, c, d ) radeon_quad( rmesa, a, b, c, d )
-#define TRI( a, b, c ) radeon_triangle( rmesa, a, b, c )
-#define LINE( a, b ) radeon_line( rmesa, a, b )
-#define POINT( a ) radeon_point( rmesa, a )
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define RADEON_TWOSIDE_BIT 0x01
-#define RADEON_UNFILLED_BIT 0x02
-#define RADEON_MAX_TRIFUNC 0x08
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[RADEON_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK 0
-#define DO_OFFSET 0
-#define DO_UNFILLED (IND & RADEON_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & RADEON_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_INDEX 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (rmesa->swtcl.verts + (e<<rmesa->swtcl.vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) v->ui[coloroffset] = LE32_TO_CPU(*(GLuint *)c)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = CPU_TO_LE32(v[idx]->ui[coloroffset])
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = LE32_TO_CPU(color[idx])
-
-#define VERT_SET_SPEC( v0, c ) if (havespec) { \
- v0->v.specular.red = (c)[0]; \
- v0->v.specular.green = (c)[1]; \
- v0->v.specular.blue = (c)[2]; }
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; }
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = CPU_TO_LE32(v[idx]->ui[5])
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = LE32_TO_CPU(spec[idx])
-
-#undef LOCAL_VARS
-#undef TAG
-#undef INIT
-
-#define LOCAL_VARS(n) \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (rmesa->swtcl.vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (rmesa->swtcl.vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) radeonRasterPrimitive( ctx, reduced_hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
-#undef TAG
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (RADEON_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (RADEON_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (RADEON_TWOSIDE_BIT|RADEON_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_twoside();
- init_unfilled();
- init_twoside_unfilled();
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (radeonVertex *)(radeonverts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- radeon_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- radeon_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- radeon_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- radeon_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#undef INIT
-#define INIT(x) do { \
- radeonRenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
- const char *radeonverts = (char *)rmesa->swtcl.verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) radeonResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) radeon_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) radeon_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-void radeonChooseRenderState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint index = 0;
- GLuint flags = ctx->_TriangleCaps;
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= RADEON_UNFILLED_BIT;
-
- if (index != rmesa->swtcl.RenderIndex) {
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = radeon_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = radeon_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = radeon_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
-
- rmesa->swtcl.RenderIndex = index;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->swtcl.hw_primitive != hwprim) {
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hwprim;
- }
-}
-
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- rmesa->swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
- radeonRasterPrimitive( ctx, reduced_hw_prim[prim] );
-}
-
-static void radeonRenderFinish( GLcontext *ctx )
-{
-}
-
-static void radeonResetLineStipple( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- RADEON_STATECHANGE( rmesa, lin );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glBlendEquation",
- "glBlendFunc",
- "RADEON_NO_RAST",
- "Mixing GL_CLAMP_TO_BORDER and GL_CLAMP (or GL_MIRROR_CLAMP_ATI)"
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- RADEON_FIREVERTICES( rmesa );
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_RASTER, GL_TRUE );
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- rmesa->swtcl.RenderIndex = ~0;
- if (RADEON_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "Radeon begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = radeonRenderStart;
- tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
- tnl->Driver.Render.Finish = radeonRenderFinish;
- tnl->Driver.Render.BuildVertices = radeonBuildVertices;
- tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_RASTER, GL_FALSE );
- if (rmesa->TclFallback) {
- /* These are already done if rmesa->TclFallback goes to
- * zero above. But not if it doesn't (RADEON_NO_TCL for
- * example?)
- */
- radeonChooseVertexState( ctx );
- radeonChooseRenderState( ctx );
- }
- if (RADEON_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "Radeon end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void radeonFlushVertices( GLcontext *ctx, GLuint flags )
-{
- _tnl_flush_vertices( ctx, flags );
-
- if (flags & FLUSH_STORED_VERTICES)
- RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) );
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void radeonInitSwtcl( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_setup_tab();
- firsttime = 0;
- }
-
- tnl->Driver.Render.Start = radeonRenderStart;
- tnl->Driver.Render.Finish = radeonRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
- tnl->Driver.Render.BuildVertices = radeonBuildVertices;
-
- rmesa->swtcl.verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 );
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->swtcl.render_primitive = GL_TRIANGLES;
- rmesa->swtcl.hw_primitive = 0;
-}
-
-
-void radeonDestroySwtcl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->swtcl.indexed_verts.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-
- if (rmesa->swtcl.verts) {
- ALIGN_FREE(rmesa->swtcl.verts);
- rmesa->swtcl.verts = 0;
- }
-
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h
deleted file mode 100644
index c45e711c0..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __RADEON_TRIS_H__
-#define __RADEON_TRIS_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "radeon_context.h"
-
-extern void radeonInitSwtcl( GLcontext *ctx );
-extern void radeonDestroySwtcl( GLcontext *ctx );
-
-extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
-extern void radeonChooseRenderState( GLcontext *ctx );
-extern void radeonChooseVertexState( GLcontext *ctx );
-
-extern void radeonCheckTexSizes( GLcontext *ctx );
-
-extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void radeonPrintSetupFlags(char *msg, GLuint flags );
-
-
-extern void radeon_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void radeon_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void radeon_translate_vertex( GLcontext *ctx,
- const radeonVertex *src,
- SWvertex *dst );
-
-extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v );
-
-extern void radeon_import_float_colors( GLcontext *ctx );
-extern void radeon_import_float_spec_colors( GLcontext *ctx );
-
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c
deleted file mode 100644
index 651194a80..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Austin, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "light.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_LOOP 0
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 1
-
-
-#define HW_POINTS RADEON_CP_VC_CNTL_PRIM_TYPE_POINT
-#define HW_LINES RADEON_CP_VC_CNTL_PRIM_TYPE_LINE
-#define HW_LINE_LOOP 0
-#define HW_LINE_STRIP RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP
-#define HW_TRIANGLES RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
-#define HW_TRIANGLE_STRIP_0 RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP
-#define HW_TRIANGLE_STRIP_1 0
-#define HW_TRIANGLE_FAN RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN
-#define HW_QUADS 0
-#define HW_QUAD_STRIP 0
-#define HW_POLYGON RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN
-
-
-static GLboolean discrete_prim[0x10] = {
- 0, /* 0 none */
- 1, /* 1 points */
- 1, /* 2 lines */
- 0, /* 3 line_strip */
- 1, /* 4 tri_list */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_type2 */
- 1, /* 7 rect list (unused) */
- 1, /* 8 3vert point */
- 1, /* 9 3vert line */
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-
-#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
-#define ELT_TYPE GLushort
-
-#define ELT_INIT(prim, hw_prim) \
- radeonTclPrimitive( ctx, prim, hw_prim | RADEON_CP_VC_CNTL_PRIM_WALK_IND )
-
-#define GET_MESA_ELTS() rmesa->tcl.Elts
-
-
-/* Don't really know how many elts will fit in what's left of cmdbuf,
- * as there is state to emit, etc:
- */
-
-/* Testing on isosurf shows a maximum around here. Don't know if it's
- * the card or driver or kernel module that is causing the behaviour.
- */
-#define GET_MAX_HW_ELTS() 300
-
-
-#define RESET_STIPPLE() do { \
- RADEON_STATECHANGE( rmesa, lin ); \
- radeonEmitState( rmesa ); \
-} while (0)
-
-#define AUTO_STIPPLE( mode ) do { \
- RADEON_STATECHANGE( rmesa, lin ); \
- if (mode) \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] |= \
- RADEON_LINE_PATTERN_AUTO_RESET; \
- else \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] &= \
- ~RADEON_LINE_PATTERN_AUTO_RESET; \
- radeonEmitState( rmesa ); \
-} while (0)
-
-
-
-#define ALLOC_ELTS(nr) radeonAllocElts( rmesa, nr )
-
-static GLushort *radeonAllocElts( radeonContextPtr rmesa, GLuint nr )
-{
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- radeonEmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components, 0 );
-
- return radeonAllocEltsOpenEnded( rmesa,
- rmesa->tcl.vertex_format,
- rmesa->tcl.hw_primitive, nr );
-}
-
-#define CLOSE_ELTS() RADEON_NEWPRIM( rmesa )
-
-
-
-/* TODO: Try to extend existing primitive if both are identical,
- * discrete and there are no intervening state changes. (Somewhat
- * duplicates changes to DrawArrays code)
- */
-static void EMIT_PRIM( GLcontext *ctx,
- GLenum prim,
- GLuint hwprim,
- GLuint start,
- GLuint count)
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- radeonTclPrimitive( ctx, prim, hwprim );
-
- radeonEmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components,
- start );
-
- /* Why couldn't this packet have taken an offset param?
- */
- radeonEmitVbufPrim( rmesa,
- rmesa->tcl.vertex_format,
- rmesa->tcl.hw_primitive,
- count - start );
-}
-
-
-
-/* Try & join small primitives
- */
-#if 0
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) 0
-#else
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) \
- ((NR) < 20 || \
- ((NR) < 40 && \
- rmesa->tcl.hw_primitive == (PRIM| \
- RADEON_CP_VC_CNTL_PRIM_WALK_IND| \
- RADEON_CP_VC_CNTL_TCL_ENABLE)))
-#endif
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(dest, offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0)
-#else
-#define EMIT_ELT(dest, offset, x) (dest)[offset] = (GLushort) (x)
-#endif
-
-#define EMIT_TWO_ELTS(dest, offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
-
-
-
-#define TAG(x) tcl_##x
-#include "tnl_dd/t_dd_dmatmp2.h"
-
-/**********************************************************************/
-/* External entrypoints */
-/**********************************************************************/
-
-void radeonEmitPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void radeonEmitEltPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void radeonTclPrimitive( GLcontext *ctx,
- GLenum prim,
- int hw_prim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint se_cntl;
- GLuint newprim = hw_prim | RADEON_CP_VC_CNTL_TCL_ENABLE;
-
- if (newprim != rmesa->tcl.hw_primitive ||
- !discrete_prim[hw_prim&0xf]) {
- RADEON_NEWPRIM( rmesa );
- rmesa->tcl.hw_primitive = newprim;
- }
-
- se_cntl = rmesa->hw.set.cmd[SET_SE_CNTL];
- se_cntl &= ~RADEON_FLAT_SHADE_VTX_LAST;
-
- if (prim == GL_POLYGON && (ctx->_TriangleCaps & DD_FLATSHADE))
- se_cntl |= RADEON_FLAT_SHADE_VTX_0;
- else
- se_cntl |= RADEON_FLAT_SHADE_VTX_LAST;
-
- if (se_cntl != rmesa->hw.set.cmd[SET_SE_CNTL]) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = se_cntl;
- }
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-/* TCL render.
- */
-static GLboolean radeon_run_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i,flags = 0,length;
-
- /* TODO: separate this from the swtnl pipeline
- */
- if (rmesa->TclFallback)
- return GL_TRUE; /* fallback to software t&l */
-
- if (VB->Count == 0)
- return GL_FALSE;
-
- radeonReleaseArrays( ctx, stage->changed_inputs );
- radeonEmitArrays( ctx, stage->inputs );
-
- rmesa->tcl.Elts = VB->Elts;
-
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
- {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: prim %s %d..%d\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
-
- if (!length)
- continue;
-
- if (rmesa->tcl.Elts)
- radeonEmitEltPrimitive( ctx, i, i+length, flags );
- else
- radeonEmitPrimitive( ctx, i, i+length, flags );
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-static void radeon_check_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint inputs = VERT_BIT_POS;
-
- if (ctx->RenderMode == GL_RENDER) {
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- inputs |= VERT_BIT_NORMAL;
-
- if (1 || ctx->Light.ColorMaterialEnabled) {
- inputs |= VERT_BIT_COLOR0;
- }
- }
- else {
- inputs |= VERT_BIT_COLOR0;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_BIT_COLOR1;
- }
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- inputs |= VERT_BIT_NORMAL;
- }
- } else {
- inputs |= VERT_BIT_TEX0;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- inputs |= VERT_BIT_NORMAL;
- }
- } else {
- inputs |= VERT_BIT_TEX1;
- }
- }
-
- stage->inputs = inputs;
- stage->active = 1;
- }
- else
- stage->active = 0;
-}
-
-static void radeon_init_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
-{
- stage->check = radeon_check_tcl_render;
- stage->check( ctx, stage );
-}
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-/* Initial state for tcl stage.
- */
-const struct gl_pipeline_stage _radeon_tcl_stage =
-{
- "radeon render",
- (_DD_NEW_SEPARATE_SPECULAR |
- _NEW_LIGHT|
- _NEW_TEXTURE|
- _NEW_FOG|
- _NEW_RENDERMODE), /* re-check (new inputs) */
- 0, /* re-run (always runs) */
- GL_TRUE, /* active */
- 0, 0, /* inputs (set in check_render), outputs */
- 0, 0, /* changed_inputs, private */
- dtr, /* destructor */
- radeon_init_tcl_render, /* check - initially set to alloc data */
- radeon_run_tcl_render /* run */
-};
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-
-/*-----------------------------------------------------------------------
- * Manage TCL fallbacks
- */
-
-
-static void transition_to_swtnl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint se_cntl;
-
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.vertex_format = 0;
-
- radeonChooseVertexState( ctx );
- radeonChooseRenderState( ctx );
-
- _mesa_validate_all_lighting_tables( ctx );
-
- tnl->Driver.NotifyMaterialChange =
- _mesa_validate_all_lighting_tables;
-
- radeonReleaseArrays( ctx, ~0 );
-
- se_cntl = rmesa->hw.set.cmd[SET_SE_CNTL];
- se_cntl |= RADEON_FLAT_SHADE_VTX_LAST;
-
- if (se_cntl != rmesa->hw.set.cmd[SET_SE_CNTL]) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = se_cntl;
- }
-}
-
-
-static void transition_to_hwtnl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
-
- if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
- _tnl_need_projected_coords( ctx, GL_FALSE );
- }
-
- radeonUpdateMaterial( ctx );
-
- tnl->Driver.NotifyMaterialChange = radeonUpdateMaterial;
-
- if ( rmesa->dma.flush )
- rmesa->dma.flush( rmesa );
-
- rmesa->dma.flush = 0;
- rmesa->swtcl.vertex_format = 0;
-
- if (rmesa->swtcl.indexed_verts.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon end tcl fallback\n");
-}
-
-static char *fallbackStrings[] = {
- "Rasterization fallback",
- "Unfilled triangles",
- "Twosided lighting, differing materials",
- "Materials in VB (maybe between begin/end)",
- "Texgen unit 0",
- "Texgen unit 1",
- "Texgen unit 2",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint oldfallback = rmesa->TclFallback;
-
- if (mode) {
- rmesa->TclFallback |= bit;
- if (oldfallback == 0) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon begin tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_swtnl( ctx );
- }
- }
- else {
- rmesa->TclFallback &= ~bit;
- if (oldfallback == bit) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon end tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_hwtnl( ctx );
- }
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h
deleted file mode 100644
index 881264a26..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h,v 1.2 2003/02/08 21:26:45 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Grahpics Inc., Austin, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __RADEON_TCL_H__
-#define __RADEON_TCL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "radeon_context.h"
-
-extern void radeonTclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void radeonEmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-extern void radeonEmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-
-extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-
-#define RADEON_TCL_FALLBACK_RASTER 0x1 /* rasterization */
-#define RADEON_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
-#define RADEON_TCL_FALLBACK_LIGHT_TWOSIDE 0x4 /* twoside tris */
-#define RADEON_TCL_FALLBACK_MATERIAL 0x8 /* material in vb */
-#define RADEON_TCL_FALLBACK_TEXGEN_0 0x10 /* texgen, unit 0 */
-#define RADEON_TCL_FALLBACK_TEXGEN_1 0x20 /* texgen, unit 1 */
-#define RADEON_TCL_FALLBACK_TEXGEN_2 0x40 /* texgen, unit 2 */
-#define RADEON_TCL_FALLBACK_TCL_DISABLE 0x80 /* user disable */
-#define RADEON_TCL_FALLBACK_TEXRECT_0 0x100 /* texture rectangle */
-#define RADEON_TCL_FALLBACK_TEXRECT_1 0x200 /* texture rectangle */
-#define RADEON_TCL_FALLBACK_TEXRECT_2 0x400 /* texture rectangle */
-
-#define RADEON_MAX_TCL_VERTSIZE (15*4)
-
-#define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
deleted file mode 100644
index 743c8865e..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
+++ /dev/null
@@ -1,748 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.9 2002/12/16 16:18:59 dawes Exp $ */
-/*
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "image.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_swtcl.h"
-#include "radeon_tex.h"
-
-#include "xmlpool.h"
-
-
-
-/**
- * Set the texture wrap modes.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void radeonSetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_border = GL_FALSE;
-
- t->pp_txfilter &= ~(RADEON_CLAMP_S_MASK | RADEON_CLAMP_T_MASK | RADEON_BORDER_MODE_D3D);
-
- switch ( swrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_S_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR;
- break;
- case GL_MIRROR_CLAMP_ATI:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_ATI:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_LAST;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch ( twrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_T_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR;
- break;
- case GL_MIRROR_CLAMP_ATI:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_ATI:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_LAST;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp_to_border ) {
- t->pp_txfilter |= RADEON_BORDER_MODE_D3D;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_border);
-}
-
-static void radeonSetTexMaxAnisotropy( radeonTexObjPtr t, GLfloat max )
-{
- t->pp_txfilter &= ~RADEON_MAX_ANISO_MASK;
-
- if ( max == 1.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_1_TO_1;
- } else if ( max <= 2.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_2_TO_1;
- } else if ( max <= 4.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_4_TO_1;
- } else if ( max <= 8.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_8_TO_1;
- } else {
- t->pp_txfilter |= RADEON_MAX_ANISO_16_TO_1;
- }
-}
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
-{
- GLuint anisotropy = (t->pp_txfilter & RADEON_MAX_ANISO_MASK);
-
- t->pp_txfilter &= ~(RADEON_MIN_FILTER_MASK | RADEON_MAG_FILTER_MASK);
-
- if ( anisotropy == RADEON_MAX_ANISO_1_TO_1 ) {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
- } else {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
- break;
- }
- }
-
- switch ( magf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MAG_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MAG_FILTER_LINEAR;
- break;
- }
-}
-
-static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] )
-{
- t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj )
-{
- radeonTexObjPtr t;
-
- t = CALLOC_STRUCT( radeon_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, texObj, t );
- }
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->border_fallback = GL_FALSE;
-
- t->pp_txfilter = RADEON_BORDER_MODE_OGL;
- t->pp_txformat = (RADEON_TXFORMAT_ENDIAN_NO_SWAP |
- RADEON_TXFORMAT_PERSPECTIVE_ENABLE);
-
- make_empty_list( & t->base );
-
- radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
- radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- radeonSetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static const struct gl_texture_format *
-radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- default:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
- default:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_al88;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-static void radeonTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage1d(ctx, target, level, internalFormat,
- width, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void radeonTexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void radeonTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-
-#define SCALED_FLOAT_TO_BYTE( x, scale ) \
- (((GLuint)((255.0F / scale) * (x))) / 2)
-
-static void radeonTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( RADEON_DEBUG & DEBUG_STATE ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
- GLuint envColor;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- envColor = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->hw.tex[unit].cmd[TEX_PP_TFACTOR] != envColor ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TFACTOR] = envColor;
- }
- break;
- }
-
- case GL_TEXTURE_LOD_BIAS_EXT: {
- GLfloat bias;
- GLuint b;
-
- /* The Radeon's LOD bias is a signed 2's complement value with a
- * range of -1.0 <= bias < 4.0. We break this into two linear
- * functions, one mapping [-1.0,0.0] to [-128,0] and one mapping
- * [0.0,4.0] to [0,127].
- */
- bias = CLAMP( *param, -1.0, 4.0 );
- if ( bias == 0 ) {
- b = 0;
- } else if ( bias > 0 ) {
- b = ((GLuint)SCALED_FLOAT_TO_BYTE( bias, 4.0 )) << RADEON_LOD_BIAS_SHIFT;
- } else {
- b = ((GLuint)SCALED_FLOAT_TO_BYTE( bias, 1.0 )) << RADEON_LOD_BIAS_SHIFT;
- }
- if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] & RADEON_LOD_BIAS_MASK) != b ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] &= ~RADEON_LOD_BIAS_MASK;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] |= (b & RADEON_LOD_BIAS_MASK);
- }
- break;
- }
-
- default:
- return;
- }
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void radeonTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params )
-{
- radeonTexObjPtr t = (radeonTexObjPtr) texObj->DriverData;
-
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( pname ) );
- }
-
- if ( ( target != GL_TEXTURE_2D ) &&
- ( target != GL_TEXTURE_1D ) )
- return;
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- radeonSetTexBorderColor( t, texObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- /* Mark this texobj as dirty (one bit per tex unit)
- */
- t->dirty_state = TEX_ALL;
-}
-
-
-
-static void radeonBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, texObj,
- ctx->Texture.CurrentUnit );
- }
-
- if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
- if ( texObj->DriverData == NULL ) {
- radeonAllocTexObj( texObj );
- }
- }
-}
-
-static void radeonDeleteTexture( GLcontext *ctx,
- struct gl_texture_object *texObj )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, texObj,
- _mesa_lookup_enum_by_nr( texObj->Target ) );
- }
-
- if ( t != NULL ) {
- if ( rmesa ) {
- RADEON_FIREVERTICES( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void radeonTexGen( GLcontext *ctx,
- GLenum coord,
- GLenum pname,
- const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- rmesa->recheck_texgen[unit] = GL_TRUE;
-}
-
-
-void radeonInitTextureFuncs( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
-
- ctx->Driver.ChooseTextureFormat = radeonChooseTextureFormat;
- ctx->Driver.TexImage1D = radeonTexImage1D;
- ctx->Driver.TexImage2D = radeonTexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = radeonTexSubImage1D;
- ctx->Driver.TexSubImage2D = radeonTexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.BindTexture = radeonBindTexture;
- ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */
- ctx->Driver.DeleteTexture = radeonDeleteTexture;
- ctx->Driver.IsTextureResident = driIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
- ctx->Driver.ActiveTexture = NULL;
- ctx->Driver.UpdateTexturePalette = NULL;
-
- ctx->Driver.TexEnv = radeonTexEnv;
- ctx->Driver.TexParameter = radeonTexParameter;
- ctx->Driver.TexGen = radeonTexGen;
-
- driInitTextureObjects( ctx, & rmesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_1D
- | DRI_TEXMGR_DO_TEXTURE_2D );
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h
deleted file mode 100644
index ce079baec..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h,v 1.3 2002/02/22 21:45:01 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __RADEON_TEX_H__
-#define __RADEON_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void radeonUpdateTextureState( GLcontext *ctx );
-
-extern int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t,
- GLuint face );
-
-extern void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t );
-
-extern void radeonInitTextureFuncs( GLcontext *ctx );
-
-#endif
-#endif /* __RADEON_TEX_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
deleted file mode 100644
index dabfa313e..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c,v 1.7 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation on the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR THEIR
-SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
-{
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->base.tObj );
- }
-
- if ( rmesa != NULL ) {
- unsigned i;
-
-
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == rmesa->state.texture.unit[i].texobj ) {
- rmesa->state.texture.unit[i].texobj = NULL;
- remove_from_list( &rmesa->hw.tex[i] );
- make_empty_list( &rmesa->hw.tex[i] );
- }
- }
- }
-}
-
-
-/* ------------------------------------------------------------
- * Texture image conversions
- */
-
-
-static void radeonUploadRectSubImage( radeonContextPtr rmesa,
- radeonTexObjPtr t,
- struct gl_texture_image *texImage,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, dstPitch, done;
-
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = RADEON_GMC_DST_8BPP_CI;
- break;
- case 2:
- blit_format = RADEON_GMC_DST_16BPP;
- break;
- case 4:
- blit_format = RADEON_GMC_DST_32BPP;
- break;
- default:
- fprintf( stderr, "radeonUploadRectSubImage: unknown blit_format (texelbytes=%d)\n",
- texFormat->TexelBytes);
- return;
- }
-
- t->image[0][0].data = texImage->Data;
-
- /* Currently don't need to cope with small pitches.
- */
- width = texImage->Width;
- height = texImage->Height;
- dstPitch = t->pp_txpitch + 32;
-
- { /* FIXME: prefer GART-texturing if possible */
- /* Data not in GART memory, or bad pitch.
- */
- for (done = 0; done < height ; ) {
- struct radeon_dma_region region;
- int lines = MIN2( height - done, RADEON_BUFFER_SIZE / dstPitch );
- int src_pitch;
- char *tex;
-
- src_pitch = texImage->RowStride * texFormat->TexelBytes;
-
- tex = (char *)texImage->Data + done * src_pitch;
-
- memset(&region, 0, sizeof(region));
- radeonAllocDmaRegion( rmesa, &region, lines * dstPitch, 1024 );
-
- /* Copy texdata to dma:
- */
- if (0)
- fprintf(stderr, "%s: src_pitch %d dst_pitch %d\n",
- __FUNCTION__, src_pitch, dstPitch);
-
- if (src_pitch == dstPitch) {
- memcpy( region.address, tex, lines * src_pitch );
- }
- else {
- char *buf = region.address;
- int i;
- for (i = 0 ; i < lines ; i++) {
- memcpy( buf, tex, src_pitch );
- buf += dstPitch;
- tex += src_pitch;
- }
- }
-
- radeonEmitWait( rmesa, RADEON_WAIT_3D );
-
-
-
- /* Blit to framebuffer
- */
- radeonEmitBlit( rmesa,
- blit_format,
- dstPitch, GET_START( &region ),
- dstPitch, t->bufAddr,
- 0, 0,
- 0, done,
- width, lines );
-
- radeonEmitWait( rmesa, RADEON_WAIT_2D );
-
- radeonReleaseDmaRegion( rmesa, &region, __FUNCTION__ );
- done += lines;
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t,
- GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height,
- GLuint face )
-{
- struct gl_texture_image *texImage = NULL;
- GLuint offset;
- GLint imageWidth, imageHeight;
- GLint ret;
- drmRadeonTexture tex;
- drmRadeonTexImage tmp;
- const int level = hwlevel + t->base.firstLevel;
-
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, t, t->base.tObj, level, width, height, face );
- }
-
- ASSERT(face < 6);
-
- /* Ensure we have a valid texture to upload */
- if ( ( hwlevel < 0 ) || ( hwlevel >= RADEON_MAX_TEXTURE_LEVELS ) ) {
- _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
- return;
- }
-
- switch (face) {
- case 0:
- texImage = t->base.tObj->Image[level];
- break;
- case 1:
- texImage = t->base.tObj->NegX[level];
- break;
- case 2:
- texImage = t->base.tObj->PosY[level];
- break;
- case 3:
- texImage = t->base.tObj->NegY[level];
- break;
- case 4:
- texImage = t->base.tObj->PosZ[level];
- break;
- case 5:
- texImage = t->base.tObj->NegZ[level];
- break;
- }
-
- if ( !texImage ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: texImage %d is NULL!\n", __FUNCTION__, level );
- return;
- }
- if ( !texImage->Data ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is NULL!\n", __FUNCTION__ );
- return;
- }
-
-
- if (t->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- assert(level == 0);
- assert(hwlevel == 0);
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is rectangular\n", __FUNCTION__);
- radeonUploadRectSubImage( rmesa, t, texImage, x, y, width, height );
- return;
- }
-
- imageWidth = texImage->Width;
- imageHeight = texImage->Height;
-
- offset = t->bufAddr;
-
- if ( RADEON_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- GLint imageX = 0;
- GLint imageY = 0;
- GLint blitX = t->image[face][hwlevel].x;
- GLint blitY = t->image[face][hwlevel].y;
- GLint blitWidth = t->image[face][hwlevel].width;
- GLint blitHeight = t->image[face][hwlevel].height;
- fprintf( stderr, " upload image: %d,%d at %d,%d\n",
- imageWidth, imageHeight, imageX, imageY );
- fprintf( stderr, " upload blit: %d,%d at %d,%d\n",
- blitWidth, blitHeight, blitX, blitY );
- fprintf( stderr, " blit ofs: 0x%07x level: %d/%d\n",
- (GLuint)offset, hwlevel, level );
- }
-
- t->image[face][hwlevel].data = texImage->Data;
-
- /* Init the DRM_RADEON_TEXTURE command / drmRadeonTexture struct.
- * NOTE: we're always use a 1KB-wide blit and I8 texture format.
- * We used to use 1, 2 and 4-byte texels and used to use the texture
- * width to dictate the blit width - but that won't work for compressed
- * textures. (Brian)
- */
- tex.offset = offset;
- tex.pitch = BLIT_WIDTH_BYTES / 64;
- tex.format = RADEON_TXFORMAT_I8; /* any 1-byte texel format */
- if (texImage->TexFormat->TexelBytes) {
- tex.width = imageWidth * texImage->TexFormat->TexelBytes; /* in bytes */
- tex.height = imageHeight;
- }
- else {
- tex.width = imageWidth; /* compressed */
- tex.height = imageHeight;
- if (tex.height < 4)
- tex.height = 4;
- }
- tex.image = &tmp;
-
- /* copy (x,y,width,height,data) */
- memcpy( &tmp, &t->image[face][hwlevel], sizeof(drmRadeonTexImage) );
-
- LOCK_HARDWARE( rmesa );
- do {
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,
- &tex, sizeof(drmRadeonTexture) );
- } while ( ret && errno == EAGAIN );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret );
- fprintf( stderr, " offset=0x%08x\n",
- offset );
- fprintf( stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight );
- fprintf( stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width, t->image[face][hwlevel].height,
- t->image[face][hwlevel].data );
- exit( 1 );
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param rmesa Context pointer
- * \param t Texture to be uploaded
- * \param face Cube map face to be uploaded. Zero for non-cube maps.
- */
-
-int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t, GLuint face )
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if ( RADEON_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- rmesa->glCtx, t->base.tObj, t->base.totalSize,
- t->base.firstLevel, t->base.lastLevel );
- }
-
- if ( !t || t->base.totalSize == 0 )
- return 0;
-
- LOCK_HARDWARE( rmesa );
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return -1;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->radeonScreen->texOffset[heap]
- + t->base.memBlock->ofs;
- t->pp_txoffset = t->bufAddr;
-
-
- /* Mark this texobj as dirty on all units:
- */
- t->dirty_state = TEX_ALL;
- }
-
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
- for ( i = 0 ; i < numLevels ; i++ ) {
- if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) {
- uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width,
- t->image[face][i].height, face );
- }
- }
- t->base.dirty_images[face] = 0;
- }
-
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
deleted file mode 100644
index 0bece3e8b..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
+++ /dev/null
@@ -1,1605 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c,v 1.6 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- VA Linux Systems Inc., Fremont, California.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-#include "enums.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_swtcl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-
-
-#define RADEON_TXFORMAT_AL88 RADEON_TXFORMAT_AI88
-#define RADEON_TXFORMAT_YCBCR RADEON_TXFORMAT_YVYU422
-#define RADEON_TXFORMAT_YCBCR_REV RADEON_TXFORMAT_VYUY422
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, RADEON_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
- && (tx_table[f].format != 0xffffffff) )
-
-static const struct {
- GLuint format, filter;
-}
-tx_table[] =
-{
- _ALPHA(RGBA8888),
- _ALPHA(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA(AL88),
- _INVALID(A8),
- _INVALID(L8),
- _COLOR(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
-};
-
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
-
-/**
- * This function computes the number of bytes of storage needed for
- * the given texture object (all mipmap levels, all cube faces).
- * The \c image[face][level].x/y/width/height parameters for upload/blitting
- * are computed here. \c pp_txfilter, \c pp_txformat, etc. will be set here
- * too.
- *
- * \param rmesa Context pointer
- * \param tObj GL texture object whose images are to be posted to
- * hardware state.
- */
-static void radeonSetTexImages( radeonContextPtr rmesa,
- struct gl_texture_object *tObj )
-{
- radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint curOffset;
- GLint i;
- GLint numLevels;
- GLint log2Width, log2Height, log2Depth;
-
- /* Set the hardware texture format
- */
-
- t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK |
- RADEON_TXFORMAT_ALPHA_IN_MAP);
- t->pp_txfilter &= ~RADEON_YUV_TO_RGB;
-
- if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) {
- t->pp_txformat |= tx_table[ baseImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= tx_table[ baseImage->TexFormat->MesaFormat ].filter;
- }
- else {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- log2Width = tObj->Image[t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[t->base.firstLevel]->HeightLog2;
- log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2;
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
-
- /* Calculate mipmap offsets and dimensions for blitting (uploading)
- * The idea is that we lay out the mipmap levels within a block of
- * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
- */
- curOffset = 0;
-
- for (i = 0; i < numLevels; i++) {
- const struct gl_texture_image *texImage;
- GLuint size;
-
- texImage = tObj->Image[i + t->base.firstLevel];
- if ( !texImage )
- break;
-
- /* find image size in bytes */
- if (texImage->IsCompressed) {
- size = texImage->CompressedSize;
- }
- else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
- & ~63) * texImage->Height;
- }
- else {
- int w = texImage->Width * texImage->TexFormat->TexelBytes;
- if (w < 32)
- w = 32;
- size = w * texImage->Height * texImage->Depth;
- }
- assert(size > 0);
-
-
- /* Align to 32-byte offset. It is faster to do this unconditionally
- * (no branch penalty).
- */
-
- curOffset = (curOffset + 0x1f) & ~0x1f;
-
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
- t->image[0][i].height = size / t->image[0][i].width;
-
-#if 0
- /* for debugging only and only applicable to non-rectangle targets */
- assert(size % t->image[0][i].width == 0);
- assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES && t->image[0][i].height == 1));
-#endif
-
- if (0)
- fprintf(stderr,
- "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
- i, texImage->Width, texImage->Height,
- t->image[0][i].x, t->image[0][i].y,
- t->image[0][i].width, t->image[0][i].height, size, curOffset);
-
- curOffset += size;
-
- }
-
- /* Align the total size of texture memory block.
- */
- t->base.totalSize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
-
- /* Hardware state:
- */
- t->pp_txfilter &= ~RADEON_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (numLevels - 1) << RADEON_MAX_MIP_LEVEL_SHIFT;
-
- t->pp_txformat &= ~(RADEON_TXFORMAT_WIDTH_MASK |
- RADEON_TXFORMAT_HEIGHT_MASK |
- RADEON_TXFORMAT_CUBIC_MAP_ENABLE);
- t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT));
-
- t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) |
- ((tObj->Image[t->base.firstLevel]->Height - 1) << 16));
-
- /* Only need to round to nearest 32 for textures, but the blitter
- * requires 64-byte aligned pitches, and we may/may not need the
- * blitter. NPOT only!
- */
- if (baseImage->IsCompressed)
- t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63);
- else
- t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63);
- t->pp_txpitch -= 32;
-
- t->dirty_state = TEX_ALL;
-
- /* FYI: radeonUploadTexImages( rmesa, t ); used to be called here */
-}
-
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define RADEON_DISABLE 0
-#define RADEON_REPLACE 1
-#define RADEON_MODULATE 2
-#define RADEON_DECAL 3
-#define RADEON_BLEND 4
-#define RADEON_ADD 5
-#define RADEON_MAX_COMBFUNC 6
-
-static GLuint radeon_color_combine[][RADEON_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_CURRENT_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00802800
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T0_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x00800142
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T0_COLOR |
- RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x008c2d42
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T0_COLOR |
- RADEON_COLOR_ARG_C_T0_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x008c2902
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_TFACTOR_COLOR |
- RADEON_COLOR_ARG_C_T0_COLOR |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00812802
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T0_COLOR |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_CURRENT_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00803000
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T1_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x00800182
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T1_COLOR |
- RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x008c3582
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T1_COLOR |
- RADEON_COLOR_ARG_C_T1_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x008c3102
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_TFACTOR_COLOR |
- RADEON_COLOR_ARG_C_T1_COLOR |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00813002
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T1_COLOR |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_CURRENT_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00803800
- */
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T2_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x008001c2
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T2_COLOR |
- RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x008c3dc2
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_T2_COLOR |
- RADEON_COLOR_ARG_C_T2_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x008c3902
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_TFACTOR_COLOR |
- RADEON_COLOR_ARG_C_T2_COLOR |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00813802
- */
- (RADEON_COLOR_ARG_A_CURRENT_COLOR |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_T2_COLOR |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- }
-};
-
-static GLuint radeon_alpha_combine[][RADEON_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00800500
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T0_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x00800051
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_T0_ALPHA |
- RADEON_ALPHA_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x00800100
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x00800051
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_TFACTOR_ALPHA |
- RADEON_ALPHA_ARG_C_T0_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00800051
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T0_ALPHA |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00800600
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T1_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x00800061
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_T1_ALPHA |
- RADEON_ALPHA_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x00800100
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x00800061
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_TFACTOR_ALPHA |
- RADEON_ALPHA_ARG_C_T1_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00800061
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T1_ALPHA |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_REPLACE = 0x00800700
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T2_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_MODULATE = 0x00800071
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_T2_ALPHA |
- RADEON_ALPHA_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_DECAL = 0x00800100
- */
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_BLEND = 0x00800071
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_TFACTOR_ALPHA |
- RADEON_ALPHA_ARG_C_T2_ALPHA |
- RADEON_BLEND_CTL_BLEND |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
-
- /* GL_ADD = 0x00800021
- */
- (RADEON_ALPHA_ARG_A_CURRENT_ALPHA |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_T2_ALPHA |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX),
- }
-};
-
-
-/* GL_ARB_texture_env_combine support
- */
-
-/* The color tables have combine functions for GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint radeon_texture_color[][RADEON_MAX_TEXTURE_UNITS] =
-{
- {
- RADEON_COLOR_ARG_A_T0_COLOR,
- RADEON_COLOR_ARG_A_T1_COLOR,
- RADEON_COLOR_ARG_A_T2_COLOR
- },
- {
- RADEON_COLOR_ARG_A_T0_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T1_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T2_COLOR | RADEON_COMP_ARG_A
- },
- {
- RADEON_COLOR_ARG_A_T0_ALPHA,
- RADEON_COLOR_ARG_A_T1_ALPHA,
- RADEON_COLOR_ARG_A_T2_ALPHA
- },
- {
- RADEON_COLOR_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A
- },
-};
-
-static GLuint radeon_tfactor_color[] =
-{
- RADEON_COLOR_ARG_A_TFACTOR_COLOR,
- RADEON_COLOR_ARG_A_TFACTOR_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_TFACTOR_ALPHA,
- RADEON_COLOR_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_primary_color[] =
-{
- RADEON_COLOR_ARG_A_DIFFUSE_COLOR,
- RADEON_COLOR_ARG_A_DIFFUSE_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_DIFFUSE_ALPHA,
- RADEON_COLOR_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_previous_color[] =
-{
- RADEON_COLOR_ARG_A_CURRENT_COLOR,
- RADEON_COLOR_ARG_A_CURRENT_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_CURRENT_ALPHA,
- RADEON_COLOR_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-3
- * GL_ONE table - indices 1-4
- */
-static GLuint radeon_zero_color[] =
-{
- RADEON_COLOR_ARG_A_ZERO,
- RADEON_COLOR_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_ZERO,
- RADEON_COLOR_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_ZERO
-};
-
-
-/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint radeon_texture_alpha[][RADEON_MAX_TEXTURE_UNITS] =
-{
- {
- RADEON_ALPHA_ARG_A_T0_ALPHA,
- RADEON_ALPHA_ARG_A_T1_ALPHA,
- RADEON_ALPHA_ARG_A_T2_ALPHA
- },
- {
- RADEON_ALPHA_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A
- },
-};
-
-static GLuint radeon_tfactor_alpha[] =
-{
- RADEON_ALPHA_ARG_A_TFACTOR_ALPHA,
- RADEON_ALPHA_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_primary_alpha[] =
-{
- RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA,
- RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_previous_alpha[] =
-{
- RADEON_ALPHA_ARG_A_CURRENT_ALPHA,
- RADEON_ALPHA_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-1
- * GL_ONE table - indices 1-2
- */
-static GLuint radeon_zero_alpha[] =
-{
- RADEON_ALPHA_ARG_A_ZERO,
- RADEON_ALPHA_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_ZERO
-};
-
-
-/* Extract the arg from slot A, shift it into the correct argument slot
- * and set the corresponding complement bit.
- */
-#define RADEON_COLOR_ARG( n, arg ) \
-do { \
- color_combine |= \
- ((color_arg[n] & RADEON_COLOR_ARG_MASK) \
- << RADEON_COLOR_ARG_##arg##_SHIFT); \
- color_combine |= \
- ((color_arg[n] >> RADEON_COMP_ARG_SHIFT) \
- << RADEON_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-#define RADEON_ALPHA_ARG( n, arg ) \
-do { \
- alpha_combine |= \
- ((alpha_arg[n] & RADEON_ALPHA_ARG_MASK) \
- << RADEON_ALPHA_ARG_##arg##_SHIFT); \
- alpha_combine |= \
- ((alpha_arg[n] >> RADEON_COMP_ARG_SHIFT) \
- << RADEON_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint color_combine, alpha_combine;
-
- /* texUnit->_Current can be NULL if and only if the texture unit is
- * not actually enabled.
- */
- assert( (texUnit->_ReallyEnabled == 0)
- || (texUnit->_Current != NULL) );
-
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, ctx, unit );
- }
-
- /* Set the texture environment state. Isn't this nice and clean?
- * The chip will automagically set the texture alpha to 0xff when
- * the texture format does not include an alpha component. This
- * reduces the amount of special-casing we have to do, alpha-only
- * textures being a notable exception.
- */
- if ( !texUnit->_ReallyEnabled ) {
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE];
- }
- else {
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[tObj->BaseLevel]->Format;
- GLuint color_arg[3], alpha_arg[3];
- GLuint i, numColorArgs = 0, numAlphaArgs = 0;
- GLuint RGBshift = texUnit->CombineScaleShiftRGB;
- GLuint Ashift = texUnit->CombineScaleShiftA;
-
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = radeon_color_combine[unit][RADEON_REPLACE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE];
- break;
- case GL_ALPHA:
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE];
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = radeon_color_combine[unit][RADEON_REPLACE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_MODULATE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = radeon_color_combine[unit][RADEON_MODULATE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_YCBCR_MESA:
- color_combine = radeon_color_combine[unit][RADEON_MODULATE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = radeon_color_combine[unit][RADEON_DECAL];
- alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE];
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_BLEND:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = radeon_color_combine[unit][RADEON_BLEND];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = radeon_color_combine[unit][RADEON_BLEND];
- alpha_combine = radeon_alpha_combine[unit][RADEON_BLEND];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_ADD:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = radeon_color_combine[unit][RADEON_ADD];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = radeon_color_combine[unit][RADEON_DISABLE];
- alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = radeon_color_combine[unit][RADEON_ADD];
- alpha_combine = radeon_alpha_combine[unit][RADEON_ADD];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_COMBINE:
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
-
- /* Step 0:
- * Calculate how many arguments we need to process.
- */
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- numColorArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- numColorArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numColorArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- numAlphaArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numAlphaArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numAlphaArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR;
- assert(op >= 0);
- assert(op <= 3);
- switch ( texUnit->CombineSourceRGB[i] ) {
- case GL_TEXTURE:
- color_arg[i] = radeon_texture_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = radeon_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = radeon_primary_color[op];
- break;
- case GL_PREVIOUS:
- color_arg[i] = radeon_previous_color[op];
- break;
- case GL_ZERO:
- color_arg[i] = radeon_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = radeon_zero_color[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA;
- assert(op >= 0);
- assert(op <= 1);
- switch ( texUnit->CombineSourceA[i] ) {
- case GL_TEXTURE:
- alpha_arg[i] = radeon_texture_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = radeon_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = radeon_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- alpha_arg[i] = radeon_previous_alpha[op];
- break;
- case GL_ZERO:
- alpha_arg[i] = radeon_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = radeon_zero_alpha[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- /* Step 2:
- * Build up the color and alpha combine functions.
- */
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- color_combine = (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, C );
- break;
- case GL_MODULATE:
- color_combine = (RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, B );
- break;
- case GL_ADD:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- color_combine = (RADEON_BLEND_CTL_BLEND |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, B );
- RADEON_COLOR_ARG( 1, A );
- RADEON_COLOR_ARG( 2, C );
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- Ashift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* The R100 / RV200 only support a 1X multiplier in hardware
- * w/the ARB version.
- */
- if ( RGBshift != (RADEON_SCALE_1X >> RADEON_SCALE_SHIFT) ) {
- return GL_FALSE;
- }
-
- RGBshift += 2;
- Ashift = RGBshift;
-
- color_combine = (RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_DOT3 |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, B );
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- alpha_combine = (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, C );
- break;
- case GL_MODULATE:
- alpha_combine = (RADEON_ALPHA_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, B );
- break;
- case GL_ADD:
- alpha_combine = (RADEON_ALPHA_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (RADEON_ALPHA_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- alpha_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- alpha_combine = (RADEON_BLEND_CTL_BLEND |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, B );
- RADEON_ALPHA_ARG( 1, A );
- RADEON_ALPHA_ARG( 2, C );
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGB_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGB) ) {
- alpha_combine |= RADEON_DOT_ALPHA_DONT_REPLICATE;
- }
-
- /* Step 3:
- * Apply the scale factor.
- */
- color_combine |= (RGBshift << RADEON_SCALE_SHIFT);
- alpha_combine |= (Ashift << RADEON_SCALE_SHIFT);
-
- /* All done!
- */
- break;
-
- default:
- return GL_FALSE;
- }
- }
-
- if ( rmesa->hw.tex[unit].cmd[TEX_PP_TXCBLEND] != color_combine ||
- rmesa->hw.tex[unit].cmd[TEX_PP_TXABLEND] != alpha_combine ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXCBLEND] = color_combine;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXABLEND] = alpha_combine;
- }
-
- return GL_TRUE;
-}
-
-#define TEXOBJ_TXFILTER_MASK (RADEON_MAX_MIP_LEVEL_MASK | \
- RADEON_MIN_FILTER_MASK | \
- RADEON_MAG_FILTER_MASK | \
- RADEON_MAX_ANISO_MASK | \
- RADEON_YUV_TO_RGB | \
- RADEON_YUV_TEMPERATURE_MASK | \
- RADEON_CLAMP_S_MASK | \
- RADEON_CLAMP_T_MASK | \
- RADEON_BORDER_MODE_D3D )
-
-#define TEXOBJ_TXFORMAT_MASK (RADEON_TXFORMAT_WIDTH_MASK | \
- RADEON_TXFORMAT_HEIGHT_MASK | \
- RADEON_TXFORMAT_FORMAT_MASK | \
- RADEON_TXFORMAT_F5_WIDTH_MASK | \
- RADEON_TXFORMAT_F5_HEIGHT_MASK | \
- RADEON_TXFORMAT_ALPHA_IN_MAP | \
- RADEON_TXFORMAT_CUBIC_MAP_ENABLE | \
- RADEON_TXFORMAT_NON_POWER2)
-
-
-static void import_tex_obj_state( radeonContextPtr rmesa,
- int unit,
- radeonTexObjPtr texobj )
-{
- GLuint *cmd = RADEON_DB_STATE( tex[unit] );
-
- cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
- cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
-
- if (texobj->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- GLuint *txr_cmd = RADEON_DB_STATE( txr[unit] );
- txr_cmd[TXR_PP_TEX_SIZE] = texobj->pp_txsize; /* NPOT only! */
- txr_cmd[TXR_PP_TEX_PITCH] = texobj->pp_txpitch; /* NPOT only! */
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.txr[unit] );
- }
-
- texobj->dirty_state &= ~(1<<unit);
-}
-
-
-
-
-static void set_texgen_matrix( radeonContextPtr rmesa,
- GLuint unit,
- const GLfloat *s_plane,
- const GLfloat *t_plane )
-{
- static const GLfloat scale_identity[4] = { 1,1,1,1 };
-
- if (!TEST_EQ_4V( s_plane, scale_identity) ||
- !TEST_EQ_4V( t_plane, scale_identity)) {
- rmesa->TexGenEnabled |= RADEON_TEXMAT_0_ENABLE<<unit;
- rmesa->TexGenMatrix[unit].m[0] = s_plane[0];
- rmesa->TexGenMatrix[unit].m[4] = s_plane[1];
- rmesa->TexGenMatrix[unit].m[8] = s_plane[2];
- rmesa->TexGenMatrix[unit].m[12] = s_plane[3];
-
- rmesa->TexGenMatrix[unit].m[1] = t_plane[0];
- rmesa->TexGenMatrix[unit].m[5] = t_plane[1];
- rmesa->TexGenMatrix[unit].m[9] = t_plane[2];
- rmesa->TexGenMatrix[unit].m[13] = t_plane[3];
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-}
-
-/* Ignoring the Q texcoord for now.
- *
- * Returns GL_FALSE if fallback required.
- */
-static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
-
- if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) == 0) {
- /* Disabled, no fallback:
- */
- rmesa->TexGenEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- return GL_TRUE;
- }
- else if (texUnit->TexGenEnabled & Q_BIT) {
- /* Very easy to do this, in fact would remove a fallback case
- * elsewhere, but I haven't done it yet... Fallback:
- */
- fprintf(stderr, "fallback Q_BIT\n");
- return GL_FALSE;
- }
- else if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) != (S_BIT|T_BIT) ||
- texUnit->GenModeS != texUnit->GenModeT) {
- /* Mixed modes, fallback:
- */
- /* fprintf(stderr, "fallback mixed texgen\n"); */
- return GL_FALSE;
- }
- else
- rmesa->TexGenEnabled |= RADEON_TEXGEN_TEXMAT_0_ENABLE << unit;
-
- switch (texUnit->GenModeS) {
- case GL_OBJECT_LINEAR:
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_OBJ << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->ObjectPlaneS,
- texUnit->ObjectPlaneT);
- break;
-
- case GL_EYE_LINEAR:
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->EyePlaneS,
- texUnit->EyePlaneT);
- break;
-
- case GL_REFLECTION_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE_REFLECT<<inputshift;
- break;
-
- case GL_NORMAL_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE_NORMAL<<inputshift;
- break;
-
- case GL_SPHERE_MAP:
- default:
- /* Unsupported mode, fallback:
- */
- /* fprintf(stderr, "fallback unsupported texgen\n"); */
- return GL_FALSE;
- }
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- return GL_TRUE;
-}
-
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (RADEON_TEX_0_ENABLE<<unit)) {
- /* Texture unit disabled */
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &= ~(1UL << unit);
- rmesa->state.texture.unit[unit].texobj = NULL;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &=
- ~((RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE) << unit);
-
- RADEON_STATECHANGE( rmesa, tcl );
- switch (unit) {
- case 0:
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~(RADEON_TCL_VTX_ST0 |
- RADEON_TCL_VTX_Q0);
- break;
- case 1:
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~(RADEON_TCL_VTX_ST1 |
- RADEON_TCL_VTX_Q1);
- break;
- default:
- break;
- }
-
-
- if (rmesa->TclFallback & (RADEON_TCL_FALLBACK_TEXGEN_0<<unit)) {
- TCL_FALLBACK( ctx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
-
-
- {
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
- rmesa->TexGenEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->recheck_texgen[unit] = GL_TRUE;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
- }
- }
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & RADEON_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~RADEON_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
-
- if ( t->base.dirty_images[0] ) {
- RADEON_FIREVERTICES( rmesa );
- radeonSetTexImages( rmesa, tObj );
- radeonUploadTexImages( rmesa, (radeonTexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
-
- if (!(t->pp_txformat & RADEON_TXFORMAT_NON_POWER2)) {
- t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
-
- if ( t->base.dirty_images[0] ) {
- RADEON_FIREVERTICES( rmesa );
- radeonSetTexImages( rmesa, tObj );
- radeonUploadTexImages( rmesa, (radeonTexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock /* && !rmesa->prefer_gart_client_texturing FIXME */ ) {
- fprintf(stderr, "%s: upload failed\n", __FUNCTION__);
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
- GLenum format;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) {
- fprintf(stderr, "%s: border\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->state.texture.unit[unit].texobj != t ) {
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->state.texture.unit[unit].texobj = t;
- t->base.bound |= (1UL << unit);
- t->dirty_state |= 1<<unit;
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
-
- /* Newly enabled?
- */
- if ( !(rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (RADEON_TEX_0_ENABLE<<unit))) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |=
- (RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE) << unit;
-
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (unit == 0)
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_ST0;
- else
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_ST1;
-
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
- if (t->dirty_state & (1<<unit)) {
- import_tex_obj_state( rmesa, unit, t );
- }
-
- if (rmesa->recheck_texgen[unit]) {
- GLboolean fallback = !radeon_validate_texgen( ctx, unit );
- TCL_FALLBACK( ctx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), fallback);
- rmesa->recheck_texgen[unit] = 0;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- format = tObj->Image[tObj->BaseLevel]->Format;
- if ( rmesa->state.texture.unit[unit].format != format ||
- rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) {
- rmesa->state.texture.unit[unit].format = format;
- rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode;
- if ( ! radeonUpdateTextureEnv( ctx, unit ) ) {
- return GL_FALSE;
- }
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback;
-}
-
-
-
-static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_TEXRECT_0 << unit, 0 );
-
- if ( texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT) ) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_TEXRECT_0 << unit, 1 );
-
- return (enable_tex_rect( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-void radeonUpdateTextureState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean ok;
-
- ok = (radeonUpdateTextureUnit( ctx, 0 ) &&
- radeonUpdateTextureUnit( ctx, 1 ));
-
- FALLBACK( rmesa, RADEON_FALLBACK_TEXTURE, !ok );
-
- if (rmesa->TclFallback)
- radeonChooseVertexState( ctx );
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
deleted file mode 100644
index 9af094289..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include "glheader.h"
-#include "imports.h"
-#include "api_noop.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "glapi.h"
-#include "colormac.h"
-#include "light.h"
-#include "state.h"
-#include "vtxfmt.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_array_api.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
-
-static void count_func( const char *name, struct dynfn *l )
-{
- int i = 0;
- struct dynfn *f;
- foreach (f, l) i++;
- if (i) fprintf(stderr, "%s: %d\n", name, i );
-}
-
-static void count_funcs( radeonContextPtr rmesa )
-{
- count_func( "Vertex2f", &rmesa->vb.dfn_cache.Vertex2f );
- count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv );
- count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f );
- count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv );
- count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
- count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
- count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
- count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
- count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f );
- count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv );
- count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f );
- count_func( "Color3fv", &rmesa->vb.dfn_cache.Color3fv );
- count_func( "SecondaryColor3f", &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- count_func( "SecondaryColor3fv", &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- count_func( "SecondaryColor3ub", &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- count_func( "SecondaryColor3ubv", &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- count_func( "Normal3f", &rmesa->vb.dfn_cache.Normal3f );
- count_func( "Normal3fv", &rmesa->vb.dfn_cache.Normal3fv );
- count_func( "TexCoord2f", &rmesa->vb.dfn_cache.TexCoord2f );
- count_func( "TexCoord2fv", &rmesa->vb.dfn_cache.TexCoord2fv );
- count_func( "TexCoord1f", &rmesa->vb.dfn_cache.TexCoord1f );
- count_func( "TexCoord1fv", &rmesa->vb.dfn_cache.TexCoord1fv );
- count_func( "MultiTexCoord2fARB", &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- count_func( "MultiTexCoord2fvARB", &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- count_func( "MultiTexCoord1fARB", &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- count_func( "MultiTexCoord1fvARB", &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
-
-void radeon_copy_to_current( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT);
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_N0) {
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = rmesa->vb.normalptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = rmesa->vb.normalptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = rmesa->vb.normalptr[2];
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKCOLOR) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->blue );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->alpha );
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPCOLOR) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPALPHA)
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = rmesa->vb.floatcolorptr[3];
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKSPEC) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( rmesa->vb.specptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( rmesa->vb.specptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( rmesa->vb.specptr->blue );
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST0) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][0] = rmesa->vb.texcoordptr[0][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][1] = rmesa->vb.texcoordptr[0][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] = 1.0F;
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST1) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][0] = rmesa->vb.texcoordptr[1][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][1] = rmesa->vb.texcoordptr[1][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] = 1.0F;
- }
-
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
-}
-
-static GLboolean discreet_gl_prim[GL_POLYGON+1] = {
- 1, /* 0 points */
- 1, /* 1 lines */
- 0, /* 2 line_strip */
- 0, /* 3 line_loop */
- 1, /* 4 tris */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 1, /* 7 quads */
- 0, /* 8 quadstrip */
- 0, /* 9 poly */
-};
-
-static void flush_prims( radeonContextPtr rmesa )
-{
- int i,j;
- struct radeon_dma_region tmp = rmesa->dma.current;
-
- tmp.buf->refcount++;
- tmp.aos_size = rmesa->vb.vertex_size;
- tmp.aos_stride = rmesa->vb.vertex_size;
- tmp.aos_start = GET_START(&tmp);
-
- rmesa->dma.current.ptr = rmesa->dma.current.start +=
- (rmesa->vb.initial_counter - rmesa->vb.counter) * rmesa->vb.vertex_size * 4;
-
- rmesa->tcl.vertex_format = rmesa->vb.vertex_format;
- rmesa->tcl.aos_components[0] = &tmp;
- rmesa->tcl.nr_aos_components = 1;
- rmesa->dma.flush = 0;
-
- /* Optimize the primitive list:
- */
- if (rmesa->vb.nrprims > 1) {
- for (j = 0, i = 1 ; i < rmesa->vb.nrprims; i++) {
- int pj = rmesa->vb.primlist[j].prim & 0xf;
- int pi = rmesa->vb.primlist[i].prim & 0xf;
-
- if (pj == pi && discreet_gl_prim[pj] &&
- rmesa->vb.primlist[i].start == rmesa->vb.primlist[j].end) {
- rmesa->vb.primlist[j].end = rmesa->vb.primlist[i].end;
- }
- else {
- j++;
- if (j != i) rmesa->vb.primlist[j] = rmesa->vb.primlist[i];
- }
- }
- rmesa->vb.nrprims = j+1;
- }
-
- for (i = 0 ; i < rmesa->vb.nrprims; i++) {
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "vtxfmt prim %d: %s %d..%d\n", i,
- _mesa_lookup_enum_by_nr( rmesa->vb.primlist[i].prim &
- PRIM_MODE_MASK ),
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end);
-
- radeonEmitPrimitive( rmesa->glCtx,
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end,
- rmesa->vb.primlist[i].prim );
- }
-
- rmesa->vb.nrprims = 0;
- radeonReleaseDmaRegion( rmesa, &tmp, __FUNCTION__ );
-}
-
-
-static void start_prim( radeonContextPtr rmesa, GLuint mode )
-{
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- rmesa->vb.primlist[rmesa->vb.nrprims].start = rmesa->vb.initial_counter - rmesa->vb.counter;
- rmesa->vb.primlist[rmesa->vb.nrprims].prim = mode;
-}
-
-static void note_last_prim( radeonContextPtr rmesa, GLuint flags )
-{
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- rmesa->vb.primlist[rmesa->vb.nrprims].prim |= flags;
- rmesa->vb.primlist[rmesa->vb.nrprims].end = rmesa->vb.initial_counter - rmesa->vb.counter;
-
- if (++(rmesa->vb.nrprims) == RADEON_MAX_PRIMS)
- flush_prims( rmesa );
- }
-}
-
-
-static void copy_vertex( radeonContextPtr rmesa, GLuint n, GLfloat *dst )
-{
- GLuint i;
- GLfloat *src = (GLfloat *)(rmesa->dma.current.address +
- rmesa->dma.current.ptr +
- (rmesa->vb.primlist[rmesa->vb.nrprims].start + n) *
- rmesa->vb.vertex_size * 4);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "copy_vertex %d\n", rmesa->vb.primlist[rmesa->vb.nrprims].start + n);
-
- for (i = 0 ; i < rmesa->vb.vertex_size; i++) {
- dst[i] = src[i];
- }
-}
-
-/* NOTE: This actually reads the copied vertices back from uncached
- * memory. Could also use the counter/notify mechanism to populate
- * tmp on the fly as vertices are generated.
- */
-static GLuint copy_dma_verts( radeonContextPtr rmesa, GLfloat (*tmp)[15] )
-{
- GLuint ovf, i;
- GLuint nr = (rmesa->vb.initial_counter - rmesa->vb.counter) - rmesa->vb.primlist[rmesa->vb.nrprims].start;
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d verts\n", __FUNCTION__, nr);
-
- switch( rmesa->vb.prim[0] )
- {
- case GL_POINTS:
- return 0;
- case GL_LINES:
- ovf = nr&1;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_TRIANGLES:
- ovf = nr%3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUADS:
- ovf = nr&3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_LINE_STRIP:
- if (nr == 0)
- return 0;
- copy_vertex( rmesa, nr-1, tmp[0] );
- return 1;
- case GL_LINE_LOOP:
- case GL_TRIANGLE_FAN:
- case GL_POLYGON:
- if (nr == 0)
- return 0;
- else if (nr == 1) {
- copy_vertex( rmesa, 0, tmp[0] );
- return 1;
- } else {
- copy_vertex( rmesa, 0, tmp[0] );
- copy_vertex( rmesa, nr-1, tmp[1] );
- return 2;
- }
- case GL_TRIANGLE_STRIP:
- ovf = MIN2(nr, 2);
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUAD_STRIP:
- switch (nr) {
- case 0: ovf = 0; break;
- case 1: ovf = 1; break;
- default: ovf = 2 + (nr&1); break;
- }
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- default:
- assert(0);
- return 0;
- }
-}
-
-static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (ctx->Driver.NeedFlush)
- radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (ctx->NewState)
- _mesa_update_state( ctx ); /* clear state so fell_back sticks */
-
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- assert( rmesa->dma.flush == 0 );
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
-}
-
-
-static void VFMT_FALLBACK( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, prim;
- GLuint ind = rmesa->vb.vertex_format;
- GLuint nrverts;
- GLfloat alpha = 1.0;
-
- if (RADEON_DEBUG & (DEBUG_FALLBACKS|DEBUG_VFMT))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
- return;
- }
-
- /* Copy vertices out of dma:
- */
- nrverts = copy_dma_verts( rmesa, tmp );
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- flush_prims( rmesa );
-
- /* Update ctx->Driver.CurrentExecPrimitive and swap in swtnl.
- */
- prim = rmesa->vb.prim[0];
- ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- assert(rmesa->dma.flush == 0);
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
- glBegin( prim );
-
- if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
-
- /* Replay saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- GLuint offset = 3;
- if (ind & RADEON_CP_VC_FRMT_N0) {
- glNormal3fv( &tmp[i][offset] );
- offset += 3;
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
- radeon_color_t *col = (radeon_color_t *)&tmp[i][offset];
- glColor4ub( col->red, col->green, col->blue, col->alpha );
- offset++;
- }
- else if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
- glColor4fv( &tmp[i][offset] );
- offset+=4;
- }
- else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- glColor3fv( &tmp[i][offset] );
- offset+=3;
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
- radeon_color_t *spec = (radeon_color_t *)&tmp[i][offset];
- _glapi_Dispatch->SecondaryColor3ubEXT( spec->red, spec->green, spec->blue );
- offset++;
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST0) {
- glTexCoord2fv( &tmp[i][offset] );
- offset += 2;
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST1) {
- glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, &tmp[i][offset] );
- offset += 2;
- }
- glVertex3fv( &tmp[i][0] );
- }
-
- /* Replay current vertex
- */
- if (ind & RADEON_CP_VC_FRMT_N0)
- glNormal3fv( rmesa->vb.normalptr );
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR)
- glColor4ub( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha );
- else if (ind & RADEON_CP_VC_FRMT_FPALPHA)
- glColor4fv( rmesa->vb.floatcolorptr );
- else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0)
- glColor4f( rmesa->vb.floatcolorptr[0],
- rmesa->vb.floatcolorptr[1],
- rmesa->vb.floatcolorptr[2],
- alpha );
- else
- glColor3fv( rmesa->vb.floatcolorptr );
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC)
- _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue );
-
- if (ind & RADEON_CP_VC_FRMT_ST0)
- glTexCoord2fv( rmesa->vb.texcoordptr[0] );
-
- if (ind & RADEON_CP_VC_FRMT_ST1)
- glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, rmesa->vb.texcoordptr[1] );
-}
-
-
-
-static void wrap_buffer( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, nrverts;
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_PRIMS))
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- /* Don't deal with parity.
- */
- if ((((rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start) & 1)) {
- rmesa->vb.counter++;
- rmesa->vb.initial_counter++;
- return;
- }
-
- /* Copy vertices out of dma:
- */
- if (rmesa->vb.prim[0] == GL_POLYGON+1)
- nrverts = 0;
- else {
- nrverts = copy_dma_verts( rmesa, tmp );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%d vertices to copy\n", nrverts);
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- }
-
- /* Fire any buffered primitives
- */
- flush_prims( rmesa );
-
- /* Get new buffer
- */
- radeonRefillCurrentDmaRegion( rmesa );
-
- /* Reset counter, dmaptr
- */
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.ptr + rmesa->dma.current.address);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
-
- rmesa->dma.flush = flush_prims;
-
- /* Restart wrapped primitive:
- */
- if (rmesa->vb.prim[0] != GL_POLYGON+1)
- start_prim( rmesa, rmesa->vb.prim[0] );
-
- /* Reemit saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- if (RADEON_DEBUG & DEBUG_VERTS) {
- int j;
- fprintf(stderr, "re-emit vertex %d to %p\n", i, rmesa->vb.dmaptr);
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (j = 0 ; j < rmesa->vb.vertex_size; j++)
- fprintf(stderr, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]);
- }
-
- memcpy( rmesa->vb.dmaptr, tmp[i], rmesa->vb.vertex_size * 4 );
- rmesa->vb.dmaptr += rmesa->vb.vertex_size;
- rmesa->vb.counter--;
- }
-}
-
-
-
-static GLboolean check_vtx_fmt( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint ind = RADEON_CP_VC_FRMT_Z;
-
- if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag)
- return GL_FALSE;
-
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
- ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT );
-
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- ind |= RADEON_CP_VC_FRMT_N0;
-
- /* TODO: make this data driven: If we receive only ubytes, send
- * color as ubytes. Also check if converting (with free
- * checking for overflow) is cheaper than sending floats
- * directly.
- */
- if (ctx->Light.ColorMaterialEnabled) {
- ind |= (RADEON_CP_VC_FRMT_FPCOLOR |
- RADEON_CP_VC_FRMT_FPALPHA);
- }
- else
- ind |= RADEON_CP_VC_FRMT_PKCOLOR; /* for alpha? */
- }
- else {
- /* TODO: make this data driven?
- */
- ind |= RADEON_CP_VC_FRMT_PKCOLOR;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- ind |= RADEON_CP_VC_FRMT_PKSPEC;
- }
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- ind |= RADEON_CP_VC_FRMT_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] != 1.0) {
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq0\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind |= RADEON_CP_VC_FRMT_ST0;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- ind |= RADEON_CP_VC_FRMT_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] != 1.0) {
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq1\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind |= RADEON_CP_VC_FRMT_ST1;
- }
- }
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_STATE))
- fprintf(stderr, "%s: format: 0x%x\n", __FUNCTION__, ind );
-
- RADEON_NEWPRIM(rmesa);
- rmesa->vb.vertex_format = ind;
- rmesa->vb.vertex_size = 3;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
-
- rmesa->vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- rmesa->vb.colorptr = NULL;
- rmesa->vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- rmesa->vb.specptr = NULL;
- rmesa->vb.floatspecptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- rmesa->vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- rmesa->vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
-
- /* Run through and initialize the vertex components in the order
- * the hardware understands:
- */
- if (ind & RADEON_CP_VC_FRMT_N0) {
- rmesa->vb.normalptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
- rmesa->vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
- rmesa->vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
- rmesa->vb.colorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->alpha, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] );
- }
-
- if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- assert(!(ind & RADEON_CP_VC_FRMT_PKCOLOR));
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
-
- if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
- rmesa->vb.vertex_size += 1;
- rmesa->vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
- }
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
- rmesa->vb.specptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] );
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST0) {
- rmesa->vb.texcoordptr[0] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[0][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][0];
- rmesa->vb.texcoordptr[0][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][1];
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST1) {
- rmesa->vb.texcoordptr[1] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[1][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][0];
- rmesa->vb.texcoordptr[1][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][1];
- }
-
- if (rmesa->vb.installed_vertex_format != rmesa->vb.vertex_format) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on vertex_format change\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- rmesa->vb.installed_vertex_format = rmesa->vb.vertex_format;
- }
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- success\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-void radeonVtxfmtInvalidate( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- rmesa->vb.recheck = GL_TRUE;
- rmesa->vb.fell_back = GL_FALSE;
-}
-
-
-static void radeonNewList( GLcontext *ctx, GLuint list, GLenum mode )
-{
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
-}
-
-
-static void radeonVtxfmtValidate( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- rmesa->vb.recheck = GL_FALSE;
-
- if (check_vtx_fmt( ctx )) {
- if (!rmesa->vb.installed) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall (new install)\n");
-
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
- ctx->Driver.NewList = radeonNewList;
- rmesa->vb.installed = GL_TRUE;
- }
- else if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: already installed", __FUNCTION__);
- }
- else {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- if (rmesa->vb.installed) {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
- rmesa->vb.installed = GL_FALSE;
- }
- }
-}
-
-
-
-/* Materials:
- */
-static void radeon_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- VFMT_FALLBACK( __FUNCTION__ );
- glMaterialfv( face, pname, params );
- return;
- }
- _mesa_noop_Materialfv( face, pname, params );
- radeonUpdateMaterial( ctx );
-}
-
-
-/* Begin/End
- */
-static void radeon_Begin( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- if (mode > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- if (rmesa->vb.recheck)
- radeonVtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- glBegin( mode );
- return;
- }
-
-
- if (rmesa->dma.flush && rmesa->vb.counter < 12) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__);
- flush_prims( rmesa );
- }
-
- /* Need to arrange to save vertices here? Or always copy from dma (yuk)?
- */
- if (!rmesa->dma.flush) {
- if (rmesa->dma.current.ptr + 12*rmesa->vb.vertex_size*4 >
- rmesa->dma.current.end) {
- RADEON_NEWPRIM( rmesa );
- radeonRefillCurrentDmaRegion( rmesa );
- }
-
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
- rmesa->dma.flush = flush_prims;
- ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- }
-
-
- rmesa->vb.prim[0] = mode;
- start_prim( rmesa, mode | PRIM_BEGIN );
-}
-
-
-
-static void radeon_End( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- note_last_prim( rmesa, PRIM_END );
- rmesa->vb.prim[0] = GL_POLYGON+1;
-}
-
-
-/* Fallback on difficult entrypoints:
- */
-#define PRE_LOOPBACK( FUNC ) \
-do { \
- if (RADEON_DEBUG & DEBUG_VFMT) \
- fprintf(stderr, "%s\n", __FUNCTION__); \
- VFMT_FALLBACK( __FUNCTION__ ); \
-} while (0)
-#define TAG(x) radeon_fallback_##x
-#include "vtxfmt_tmp.h"
-
-
-
-static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(!rmesa->vb.installed);
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (rmesa->vb.recheck)
- radeonVtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- radeon_Begin( p );
- return GL_TRUE;
-}
-
-static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(rmesa->vb.installed);
-
- if (flags & FLUSH_UPDATE_CURRENT) {
- radeon_copy_to_current( ctx );
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on update_current\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
- }
-
- if (flags & FLUSH_STORED_VERTICES) {
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- assert (rmesa->dma.flush == 0 ||
- rmesa->dma.flush == flush_prims);
- if (rmesa->dma.flush == flush_prims)
- flush_prims( RADEON_CONTEXT( ctx ) );
- ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
- }
-}
-
-
-
-/* At this point, don't expect very many versions of each function to
- * be generated, so not concerned about freeing them?
- */
-
-
-void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLvertexformat *vfmt = &(rmesa->vb.vtxfmt);
-
- MEMSET( vfmt, 0, sizeof(GLvertexformat) );
-
- /* Hook in chooser functions for codegen, etc:
- */
- radeonVtxfmtInitChoosers( vfmt );
-
- /* Handled fully in supported states, but no codegen:
- */
- vfmt->Materialfv = radeon_Materialfv;
- vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
- vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */
- vfmt->Begin = radeon_Begin;
- vfmt->End = radeon_End;
-
- /* Fallback for performance reasons: (Fix with cva/elt path here and
- * dmatmp2.h style primitive-merging)
- *
- * These should call NotifyBegin(), as should _tnl_EvalMesh, to allow
- * a driver-hook.
- */
- vfmt->DrawArrays = radeon_fallback_DrawArrays;
- vfmt->DrawElements = radeon_fallback_DrawElements;
- vfmt->DrawRangeElements = radeon_fallback_DrawRangeElements;
-
-
- /* Not active in supported states; just keep ctx->Current uptodate:
- */
- vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
- vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
-
-
- /* Active but unsupported -- fallback if we receive these:
- */
- vfmt->CallList = radeon_fallback_CallList;
- vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = radeon_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = radeon_fallback_EvalMesh1;
- vfmt->EvalMesh2 = radeon_fallback_EvalMesh2;
- vfmt->EvalPoint1 = radeon_fallback_EvalPoint1;
- vfmt->EvalPoint2 = radeon_fallback_EvalPoint2;
- vfmt->TexCoord3f = radeon_fallback_TexCoord3f;
- vfmt->TexCoord3fv = radeon_fallback_TexCoord3fv;
- vfmt->TexCoord4f = radeon_fallback_TexCoord4f;
- vfmt->TexCoord4fv = radeon_fallback_TexCoord4fv;
- vfmt->MultiTexCoord3fARB = radeon_fallback_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = radeon_fallback_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = radeon_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = radeon_fallback_MultiTexCoord4fvARB;
- vfmt->Vertex4f = radeon_fallback_Vertex4f;
- vfmt->Vertex4fv = radeon_fallback_Vertex4fv;
-
- (void)radeon_fallback_vtxfmt;
-
- TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin;
-
- rmesa->vb.enabled = 1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
- rmesa->vb.primflags = 0;
-
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2fv );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4f );
- make_empty_list( &rmesa->vb.dfn_cache.Color4fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3f );
- make_empty_list( &rmesa->vb.dfn_cache.Color3fv );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3f );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1fv );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-
- radeonInitCodegen( &rmesa->vb.codegen, useCodegen );
-}
-
-static void free_funcs( struct dynfn *l )
-{
- struct dynfn *f, *tmp;
- foreach_s (f, tmp, l) {
- remove_from_list( f );
- ALIGN_FREE( f->code );
- FREE( f );
- }
-}
-
-
-
-void radeonVtxfmtMakeCurrent( GLcontext *ctx )
-{
-}
-
-
-void radeonVtxfmtDestroy( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- count_funcs( rmesa );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2fv );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3fv );
- free_funcs( &rmesa->vb.dfn_cache.Color4ub );
- free_funcs( &rmesa->vb.dfn_cache.Color4ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color3ub );
- free_funcs( &rmesa->vb.dfn_cache.Color3ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color4f );
- free_funcs( &rmesa->vb.dfn_cache.Color4fv );
- free_funcs( &rmesa->vb.dfn_cache.Color3f );
- free_funcs( &rmesa->vb.dfn_cache.Color3fv );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- free_funcs( &rmesa->vb.dfn_cache.Normal3f );
- free_funcs( &rmesa->vb.dfn_cache.Normal3fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1fv );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h
deleted file mode 100644
index 780339082..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h,v 1.3 2002/12/21 17:02:16 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_VTXFMT_H__
-#define __RADEON_VTXFMT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "radeon_context.h"
-
-
-extern void radeonVtxfmtUpdate( GLcontext *ctx );
-extern void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
-extern void radeonVtxfmtInvalidate( GLcontext *ctx );
-extern void radeonVtxfmtDestroy( GLcontext *ctx );
-extern void radeonVtxfmtInitChoosers( GLvertexformat *vfmt );
-
-extern void radeonVtxfmtMakeCurrent( GLcontext *ctx );
-extern void radeonVtxfmtUnbindContext( GLcontext *ctx );
-
-extern void radeon_copy_to_current( GLcontext *ctx );
-
-#define DFN( FUNC, CACHE) \
-do { \
- char *start = (char *)&FUNC; \
- char *end = (char *)&FUNC##_end; \
- insert_at_head( &CACHE, dfn ); \
- dfn->key = key; \
- dfn->code = ALIGN_MALLOC( end - start, 16 ); \
- memcpy (dfn->code, start, end - start); \
-} \
-while ( 0 )
-
-#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- int *icode = (int *)(CODE+OFFSET); \
- assert (*icode == CHECKVAL); \
- *icode = (int)NEWVAL; \
-} while (0)
-
-
-/* Useful for figuring out the offsets:
- */
-#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
- fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__, \
- __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL)); \
- *(int *)(CODE+OFFSET) = (int)(NEWVAL); \
- OFFSET += 4; \
-} while (0)
-
-/*
- */
-void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
-void radeonInitX86Codegen( struct dfn_generators *gen );
-void radeonInitSSECodegen( struct dfn_generators *gen );
-
-
-
-/* Defined in radeon_vtxfmt_x86.c
- */
-struct dynfn *radeon_makeX86Vertex2f( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex2fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4ub( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4ubv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3ub( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3ubv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4f( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3ubEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3ubvEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3fEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3fvEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86Normal3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Normal3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord2f( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord1f( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord1fv( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord1fARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord1fvARB( GLcontext *, int );
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
deleted file mode 100644
index 04cffb777..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
+++ /dev/null
@@ -1,905 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c,v 1.2 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "simple_list.h"
-#include "api_noop.h"
-#include "vtxfmt.h"
-
-#include "radeon_vtxfmt.h"
-
-/* Fallback versions of all the entrypoints for situations where
- * codegen isn't available. This is still a lot faster than the
- * vb/pipeline implementation in Mesa.
- */
-static void radeon_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = *(int *)&z;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = *(int *)&v[2];
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex2f( GLfloat x, GLfloat y )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = *(int *)&rmesa->vb.vertex[i];
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-
-/* Color for ubyte (packed) color formats:
- */
-static void radeon_Color3ub_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void radeon_Color3ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void radeon_Color4ub_ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = a;
-}
-
-static void radeon_Color4ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- *(GLuint *)rmesa->vb.colorptr = LE32_TO_CPU(*(GLuint *)v);
-}
-
-
-static void radeon_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void radeon_Color3fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void radeon_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
-}
-
-static void radeon_Color4fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
-}
-
-
-/* Color for float color+alpha formats:
- */
-static void radeon_Color3ub_4f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void radeon_Color3ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void radeon_Color4ub_4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = UBYTE_TO_FLOAT(a);
-}
-
-static void radeon_Color4ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = UBYTE_TO_FLOAT(v[3]);
-}
-
-
-static void radeon_Color3f_4f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void radeon_Color3fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-static void radeon_Color4f_4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = a;
-}
-
-static void radeon_Color4fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = v[3];
-}
-
-
-/* Color for float color formats:
- */
-static void radeon_Color3ub_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
-}
-
-static void radeon_Color3ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
-}
-
-static void radeon_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
-}
-
-static void radeon_Color4ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
-}
-
-
-static void radeon_Color3f_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
-}
-
-static void radeon_Color3fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-static void radeon_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
-}
-
-static void radeon_Color4fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
-}
-
-
-/* Secondary Color:
- */
-static void radeon_SecondaryColor3ubEXT_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void radeon_SecondaryColor3ubvEXT_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void radeon_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void radeon_SecondaryColor3fvEXT_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void radeon_SecondaryColor3ubEXT_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void radeon_SecondaryColor3ubvEXT_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void radeon_SecondaryColor3fEXT_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void radeon_SecondaryColor3fvEXT_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-
-/* Normal
- */
-static void radeon_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = n0;
- dest[1] = n1;
- dest[2] = n2;
-}
-
-static void radeon_Normal3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-
-/* TexCoord
- */
-static void radeon_TexCoord1f( GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void radeon_TexCoord1fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void radeon_TexCoord2f( GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void radeon_TexCoord2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-
-/* MultiTexcoord
- *
- * Technically speaking, these functions should subtract GL_TEXTURE0 from
- * \c target before masking and using it. The value of GL_TEXTURE0 is 0x84C0,
- * which has the low-order 5 bits 0. For all possible valid values of
- * \c target. Subtracting GL_TEXTURE0 has the net effect of masking \c target
- * with 0x1F. Masking with 0x1F and then masking with 0x01 is redundant, so
- * the subtraction has been omitted.
- */
-
-static void radeon_MultiTexCoord1fARB( GLenum target, GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void radeon_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void radeon_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void radeon_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-static struct dynfn *lookup( struct dynfn *l, int key )
-{
- struct dynfn *f;
-
- foreach( f, l ) {
- if (f->key == key)
- return f;
- }
-
- return 0;
-}
-
-/* Can't use the loopback template for this:
- */
-
-#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \
- \
- if (dfn) \
- ctx->Exec->FN = (FNTYPE)(dfn->code); \
- else { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- ctx->Exec->FN = radeon_##FN; \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-/* For the _3f case, only allow one color function to be hooked in at
- * a time. Eventually, use a similar mechanism to allow selecting the
- * color component of the vertex format based on client behaviour.
- *
- * Note: Perform these actions even if there is a codegen or cached
- * codegen version of the chosen function.
- */
-#define CHOOSE_COLOR(FN, FNTYPE, NR, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn; \
- \
- if (rmesa->vb.vertex_format & ACTIVE_PKCOLOR) { \
- ctx->Exec->FN = radeon_##FN##_ub; \
- } \
- else if ((rmesa->vb.vertex_format & \
- (ACTIVE_FPCOLOR|ACTIVE_FPALPHA)) == ACTIVE_FPCOLOR) { \
- \
- if (rmesa->vb.installed_color_3f_sz != NR) { \
- rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
- radeon_copy_to_current( ctx ); \
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
- ctx->Exec->FN ARGS2; \
- return; \
- } \
- } \
- \
- ctx->Exec->FN = radeon_##FN##_3f; \
- } \
- else { \
- ctx->Exec->FN = radeon_##FN##_4f; \
- } \
- \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (!dfn) dfn = rmesa->vb.codegen.FN( ctx, key ); \
- \
- if (dfn) { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \
- ctx->Exec->FN = (FNTYPE)dfn->code; \
- } \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-/* Right now there are both _ub and _3f versions of the secondary color
- * functions. Currently, we only set-up the hardware to use the _ub versions.
- * The _3f versions are needed for the cases where secondary color isn't used
- * in the vertex format, but it still needs to be stored in the context
- * state vector.
- */
-#define CHOOSE_SECONDARY_COLOR(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \
- \
- if (dfn) \
- ctx->Exec->FN = (FNTYPE)(dfn->code); \
- else { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- ctx->Exec->FN = ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \
- ? radeon_##FN##_ub : radeon_##FN##_3f; \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- ctx->Exec->FN ARGS2; \
-}
-
-
-
-
-
-/* Shorthands
- */
-#define ACTIVE_XYZW (RADEON_CP_VC_FRMT_W0|RADEON_CP_VC_FRMT_Z)
-#define ACTIVE_NORM RADEON_CP_VC_FRMT_N0
-
-#define ACTIVE_PKCOLOR RADEON_CP_VC_FRMT_PKCOLOR
-#define ACTIVE_FPCOLOR RADEON_CP_VC_FRMT_FPCOLOR
-#define ACTIVE_FPALPHA RADEON_CP_VC_FRMT_FPALPHA
-#define ACTIVE_COLOR (ACTIVE_FPCOLOR|ACTIVE_PKCOLOR)
-
-#define ACTIVE_PKSPEC RADEON_CP_VC_FRMT_PKSPEC
-#define ACTIVE_FPSPEC RADEON_CP_VC_FRMT_FPSPEC
-#define ACTIVE_SPEC (ACTIVE_FPSPEC|ACTIVE_PKSPEC)
-
-#define ACTIVE_ST0 RADEON_CP_VC_FRMT_ST0
-#define ACTIVE_ST1 RADEON_CP_VC_FRMT_ST1
-#define ACTIVE_ST_ALL (RADEON_CP_VC_FRMT_ST1|RADEON_CP_VC_FRMT_ST0)
-
-/* Each codegen function should be able to be fully specified by a
- * subsetted version of rmesa->vb.vertex_format.
- */
-#define MASK_NORM (ACTIVE_XYZW)
-#define MASK_COLOR (MASK_NORM|ACTIVE_NORM)
-#define MASK_SPEC (MASK_COLOR|ACTIVE_COLOR)
-#define MASK_ST0 (MASK_SPEC|ACTIVE_SPEC)
-#define MASK_ST1 (MASK_ST0|ACTIVE_ST0)
-#define MASK_ST_ALL (MASK_ST1|ACTIVE_ST1)
-#define MASK_VERTEX (MASK_ST_ALL|ACTIVE_FPALPHA)
-
-
-typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat );
-typedef void (*p3f)( GLfloat, GLfloat, GLfloat );
-typedef void (*p2f)( GLfloat, GLfloat );
-typedef void (*p1f)( GLfloat );
-typedef void (*pe2f)( GLenum, GLfloat, GLfloat );
-typedef void (*pe1f)( GLenum, GLfloat );
-typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
-typedef void (*p3ub)( GLubyte, GLubyte, GLubyte );
-typedef void (*pfv)( const GLfloat * );
-typedef void (*pefv)( GLenum, const GLfloat * );
-typedef void (*pubv)( const GLubyte * );
-
-
-CHOOSE(Normal3f, p3f, MASK_NORM, ACTIVE_NORM,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Normal3fv, pfv, MASK_NORM, ACTIVE_NORM,
- (const GLfloat *v), (v))
-
-CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, ACTIVE_COLOR,
- (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
-CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, ACTIVE_COLOR,
- (const GLubyte *v), (v))
-CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, ACTIVE_COLOR,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, ACTIVE_COLOR,
- (const GLubyte *v), (v))
-
-CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, ACTIVE_COLOR,
- (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
-CHOOSE_COLOR(Color4fv, pfv, 4, MASK_COLOR, ACTIVE_COLOR,
- (const GLfloat *v), (v))
-CHOOSE_COLOR(Color3f, p3f, 3, MASK_COLOR, ACTIVE_COLOR,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, ACTIVE_COLOR,
- (const GLfloat *v), (v))
-
-
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, ACTIVE_SPEC,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, ACTIVE_SPEC,
- (const GLubyte *v), (v))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, ACTIVE_SPEC,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, ACTIVE_SPEC,
- (const GLfloat *v), (v))
-
-CHOOSE(TexCoord2f, p2f, MASK_ST0, ACTIVE_ST0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(TexCoord2fv, pfv, MASK_ST0, ACTIVE_ST0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord1f, p1f, MASK_ST0, ACTIVE_ST0,
- (GLfloat a), (a))
-CHOOSE(TexCoord1fv, pfv, MASK_ST0, ACTIVE_ST0,
- (const GLfloat *v), (v))
-
-CHOOSE(MultiTexCoord2fARB, pe2f, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,GLfloat a,GLfloat b), (u,a,b))
-CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,GLfloat a), (u,a))
-CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-
-CHOOSE(Vertex3f, p3f, MASK_VERTEX, MASK_VERTEX,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Vertex3fv, pfv, MASK_VERTEX, MASK_VERTEX,
- (const GLfloat *v), (v))
-CHOOSE(Vertex2f, p2f, MASK_VERTEX, MASK_VERTEX,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(Vertex2fv, pfv, MASK_VERTEX, MASK_VERTEX,
- (const GLfloat *v), (v))
-
-
-
-
-
-void radeonVtxfmtInitChoosers( GLvertexformat *vfmt )
-{
- vfmt->Color3f = choose_Color3f;
- vfmt->Color3fv = choose_Color3fv;
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
- vfmt->Color4f = choose_Color4f;
- vfmt->Color4fv = choose_Color4fv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
- vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
- vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = choose_MultiTexCoord2fvARB;
- vfmt->Normal3f = choose_Normal3f;
- vfmt->Normal3fv = choose_Normal3fv;
- vfmt->TexCoord1f = choose_TexCoord1f;
- vfmt->TexCoord1fv = choose_TexCoord1fv;
- vfmt->TexCoord2f = choose_TexCoord2f;
- vfmt->TexCoord2fv = choose_TexCoord2fv;
- vfmt->Vertex2f = choose_Vertex2f;
- vfmt->Vertex2fv = choose_Vertex2fv;
- vfmt->Vertex3f = choose_Vertex3f;
- vfmt->Vertex3fv = choose_Vertex3fv;
-}
-
-
-static struct dynfn *codegen_noop( GLcontext *ctx, int key )
-{
- (void) ctx; (void) key;
- return 0;
-}
-
-void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen )
-{
- gen->Vertex3f = codegen_noop;
- gen->Vertex3fv = codegen_noop;
- gen->Color4ub = codegen_noop;
- gen->Color4ubv = codegen_noop;
- gen->Normal3f = codegen_noop;
- gen->Normal3fv = codegen_noop;
- gen->TexCoord2f = codegen_noop;
- gen->TexCoord2fv = codegen_noop;
- gen->MultiTexCoord2fARB = codegen_noop;
- gen->MultiTexCoord2fvARB = codegen_noop;
- gen->Vertex2f = codegen_noop;
- gen->Vertex2fv = codegen_noop;
- gen->Color3ub = codegen_noop;
- gen->Color3ubv = codegen_noop;
- gen->Color4f = codegen_noop;
- gen->Color4fv = codegen_noop;
- gen->Color3f = codegen_noop;
- gen->Color3fv = codegen_noop;
- gen->SecondaryColor3fEXT = codegen_noop;
- gen->SecondaryColor3fvEXT = codegen_noop;
- gen->SecondaryColor3ubEXT = codegen_noop;
- gen->SecondaryColor3ubvEXT = codegen_noop;
- gen->TexCoord1f = codegen_noop;
- gen->TexCoord1fv = codegen_noop;
- gen->MultiTexCoord1fARB = codegen_noop;
- gen->MultiTexCoord1fvARB = codegen_noop;
-
- if (useCodegen) {
-#if defined(USE_X86_ASM)
- radeonInitX86Codegen( gen );
-#endif
-
-#if defined(USE_SSE_ASM)
- radeonInitSSECodegen( gen );
-#endif
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c
deleted file mode 100644
index 71e74381a..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "radeon_vtxfmt.h"
-
-#if defined(USE_SSE_ASM)
-#include "X86/common_x86_asm.h"
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN( _sse_Attribute2fv );
-EXTERN( _sse_Attribute2f );
-EXTERN( _sse_Attribute3fv );
-EXTERN( _sse_Attribute3f );
-EXTERN( _sse_MultiTexCoord2fv );
-EXTERN( _sse_MultiTexCoord2f );
-EXTERN( _sse_MultiTexCoord2fv_2 );
-EXTERN( _sse_MultiTexCoord2f_2 );
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state.
- */
-
-static struct dynfn *radeon_makeSSEAttribute2fv( struct dynfn * cache, int key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 10, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute2f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute2f, (*cache) );
- FIXUP(dfn->code, 8, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute3fv( struct dynfn * cache, int key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 13, 0x0, (int)dest);
- FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute3f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute3f, (*cache) );
- FIXUP(dfn->code, 12, 0x0, (int)dest);
- FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn * radeon_makeSSENormal3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *radeon_makeSSENormal3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *radeon_makeSSEColor3fv( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return 0;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *radeon_makeSSEColor3f( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return 0;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *radeon_makeSSETexCoord2fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *radeon_makeSSETexCoord2f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *radeon_makeSSEMultiTexCoord2fv( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEMultiTexCoord2f( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-void radeonInitSSECodegen( struct dfn_generators *gen )
-{
- if ( cpu_has_xmm ) {
- gen->Normal3fv = (void *) radeon_makeSSENormal3fv;
- gen->Normal3f = (void *) radeon_makeSSENormal3f;
- gen->Color3fv = (void *) radeon_makeSSEColor3fv;
- gen->Color3f = (void *) radeon_makeSSEColor3f;
- gen->TexCoord2fv = (void *) radeon_makeSSETexCoord2fv;
- gen->TexCoord2f = (void *) radeon_makeSSETexCoord2f;
- gen->MultiTexCoord2fvARB = (void *) radeon_makeSSEMultiTexCoord2fv;
- gen->MultiTexCoord2fARB = (void *) radeon_makeSSEMultiTexCoord2f;
- }
-}
-
-#else
-
-void radeonInitSSECodegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c
deleted file mode 100644
index 59b0db0a5..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c,v 1.2 2002/12/21 17:02:16 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "radeon_vtxfmt.h"
-
-#if defined(USE_X86_ASM)
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN ( _x86_Attribute2fv );
-EXTERN ( _x86_Attribute2f );
-EXTERN ( _x86_Attribute3fv );
-EXTERN ( _x86_Attribute3f );
-EXTERN ( _x86_Vertex3fv_6 );
-EXTERN ( _x86_Vertex3fv_8 );
-EXTERN ( _x86_Vertex3fv );
-EXTERN ( _x86_Vertex3f_4 );
-EXTERN ( _x86_Vertex3f_6 );
-EXTERN ( _x86_Vertex3f );
-EXTERN ( _x86_Color4ubv_ub );
-EXTERN ( _x86_Color4ubv_4f );
-EXTERN ( _x86_Color4ub_ub );
-EXTERN ( _x86_MultiTexCoord2fv );
-EXTERN ( _x86_MultiTexCoord2fv_2 );
-EXTERN ( _x86_MultiTexCoord2f );
-EXTERN ( _x86_MultiTexCoord2f_2 );
-
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state. Generic x86 versions.
- */
-
-struct dynfn *radeon_makeX86Vertex3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 4: {
-
- DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- case 6: {
-
- DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- default: {
-
- DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-
-
-struct dynfn *radeon_makeX86Vertex3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 6: {
-
- DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
- case 8: {
-
- DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
- FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
- FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
-
- default: {
-
- DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute2fv( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 11, 0x0, (int)dest);
- FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute2f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute2f, (*cache) );
- FIXUP(dfn->code, 1, 0x0, (int)dest);
-
- return dfn;
-}
-
-
-static struct dynfn *
-radeon_makeX86Attribute3fv( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute3f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute3f, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-struct dynfn *radeon_makeX86Normal3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *radeon_makeX86Normal3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *radeon_makeX86Color4ubv( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
- DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
- return dfn;
- }
- else {
-
- DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
- FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
- FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
- FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
- FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
- return dfn;
- }
-}
-
-struct dynfn *radeon_makeX86Color4ub( GLcontext *ctx, int key )
-{
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
- FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
- FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
- FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
- return dfn;
- }
- else
- return 0;
-}
-
-
-struct dynfn *radeon_makeX86Color3fv( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return 0;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-struct dynfn *radeon_makeX86Color3f( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return 0;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-
-
-struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *radeon_makeX86TexCoord2f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- } else {
- DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *ctx,
- int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- }
- else {
- /* Note: this might get generated multiple times, even though the
- * actual emitted code is the same.
- */
- DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-
-void radeonInitX86Codegen( struct dfn_generators *gen )
-{
- gen->Vertex3f = radeon_makeX86Vertex3f;
- gen->Vertex3fv = radeon_makeX86Vertex3fv;
- gen->Color4ub = radeon_makeX86Color4ub; /* PKCOLOR only */
- gen->Color4ubv = radeon_makeX86Color4ubv; /* PKCOLOR only */
- gen->Normal3f = radeon_makeX86Normal3f;
- gen->Normal3fv = radeon_makeX86Normal3fv;
- gen->TexCoord2f = radeon_makeX86TexCoord2f;
- gen->TexCoord2fv = radeon_makeX86TexCoord2fv;
- gen->MultiTexCoord2fARB = radeon_makeX86MultiTexCoord2fARB;
- gen->MultiTexCoord2fvARB = radeon_makeX86MultiTexCoord2fvARB;
- gen->Color3f = radeon_makeX86Color3f;
- gen->Color3fv = radeon_makeX86Color3fv;
-
- /* Not done:
- */
-/* gen->Vertex2f = radeon_makeX86Vertex2f; */
-/* gen->Vertex2fv = radeon_makeX86Vertex2fv; */
-/* gen->Color3ub = radeon_makeX86Color3ub; */
-/* gen->Color3ubv = radeon_makeX86Color3ubv; */
-/* gen->Color4f = radeon_makeX86Color4f; */
-/* gen->Color4fv = radeon_makeX86Color4fv; */
-/* gen->TexCoord1f = radeon_makeX86TexCoord1f; */
-/* gen->TexCoord1fv = radeon_makeX86TexCoord1fv; */
-/* gen->MultiTexCoord1fARB = radeon_makeX86MultiTexCoord1fARB; */
-/* gen->MultiTexCoord1fvARB = radeon_makeX86MultiTexCoord1fvARB; */
-}
-
-
-#else
-
-void radeonInitX86Codegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S
deleted file mode 100644
index 68edb533b..000000000
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S,v 1.2 2002/11/07 18:32:00 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#define GLOBL( x ) \
-.globl x; \
-x:
-
-.data
-.align 4
-
-/*
- vertex 3f vertex size 4
-*/
-
-GLOBL ( _x86_Vertex3f_4 )
- movl (0), %ecx
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl %eax, (%ecx)
- movl %edx, 4(%ecx)
- movl 12(%esp), %eax
- movl (0), %edx
- movl %eax, 8(%ecx)
- movl %edx, 12(%ecx)
- movl (0), %eax
- addl $16, %ecx
- dec %eax
- movl %ecx, (0)
- movl %eax, (0)
- je .1
- ret
-.1: jmp *0
-
-GLOBL ( _x86_Vertex3f_4_end )
-
-/*
- vertex 3f vertex size 6
-*/
-GLOBL ( _x86_Vertex3f_6 )
- push %edi
- movl (0), %edi
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- movl (0), %eax
- movl (0), %edx
- movl (0), %ecx
- movl %eax, 12(%edi)
- movl %edx, 16(%edi)
- movl %ecx, 20(%edi)
- addl $24, %edi
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- pop %edi
- movl %eax, (0)
- je .2
- ret
-.2: jmp *0
-GLOBL ( _x86_Vertex3f_6_end )
-/*
- vertex 3f generic size
-*/
-GLOBL ( _x86_Vertex3f )
- push %edi
- push %esi
- movl $0, %esi
- movl (0), %edi
- movl 12(%esp), %eax
- movl 16(%esp), %edx
- movl 20(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- addl $12, %edi
- movl $0, %ecx
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- movl %eax, (0)
- pop %esi
- pop %edi
- je .3
- ret
-.3: jmp *0
-
-GLOBL ( _x86_Vertex3f_end )
-
-/*
- Vertex 3fv vertex size 6
-*/
-GLOBL ( _x86_Vertex3fv_6 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx, (%eax)
- movl 4(%ecx), %edx
- movl 8(%ecx), %ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (36), %edx
- movl %edx, 20(%eax)
- addl $24, %eax
- movl %eax, 0
- movl 4, %eax
- dec %eax
- movl %eax, 4
- je .4
- ret
-.4: jmp *8
-
-GLOBL ( _x86_Vertex3fv_6_end )
-
-/*
- Vertex 3fv vertex size 8
-*/
-GLOBL ( _x86_Vertex3fv_8 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx ,(%eax)
- movl 4(%ecx) ,%edx
- movl 8(%ecx) ,%ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 20(%eax)
- movl %ecx, 24(%eax)
- movl (36), %edx
- movl %edx, 28(%eax)
- addl $32, %eax
- movl %eax, (0)
- movl 4, %eax
- dec %eax
- movl %eax, (4)
- je .5
- ret
-.5: jmp *8
-
-GLOBL ( _x86_Vertex3fv_8_end )
-
-/*
- Vertex 3fv generic vertex size
-*/
-GLOBL ( _x86_Vertex3fv )
- movl 4(%esp), %edx
- push %edi
- push %esi
- movl (0x1010101), %edi
- movl (%edx), %eax
- movl 4(%edx), %ecx
- movl 8(%edx), %esi
- movl %eax, (%edi)
- movl %ecx, 4(%edi)
- movl %esi, 8(%edi)
- addl $12, %edi
- movl $6, %ecx
- movl $0x58, %esi
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl %edi, (0x1010101)
- movl (0x2020202), %eax
- pop %esi
- pop %edi
- dec %eax
- movl %eax, (0x2020202)
- je .6
- ret
-.6: jmp *0
-GLOBL ( _x86_Vertex3fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL ( _x86_Attribute2f )
- movl $0x0, %edx
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movl %eax, (%edx)
- movl %ecx, 4(%edx)
- ret
-GLOBL ( _x86_Attribute2f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _x86_Attribute2fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %eax /* load v[1] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %eax, 4 /* store v[1] to current vertex */
- ret
-GLOBL ( _x86_Attribute2fv_end )
-
-
-/**
- * Generic handler for 3 float format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL ( _x86_Attribute3f )
- movl 4(%esp), %ecx
- movl 8(%esp), %edx
- movl 12(%esp), %eax
- movl %ecx, 0
- movl %edx, 4
- movl %eax, 8
- ret
-GLOBL ( _x86_Attribute3f_end )
-
-/**
- * Generic handler for 3 float vector format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL( _x86_Attribute3fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %edx /* load v[1] */
- movl 8(%eax), %eax /* load v[2] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %edx, 4 /* store v[1] to current vertex */
- movl %eax, 8 /* store v[2] to current vertex */
- ret
-GLOBL ( _x86_Attribute3fv_end )
-
-
-/*
- Color 4ubv_ub
-*/
-GLOBL ( _x86_Color4ubv_ub )
- movl 4(%esp), %eax
- movl $0x12345678, %edx
- movl (%eax), %eax
- movl %eax, (%edx)
- ret
-GLOBL ( _x86_Color4ubv_ub_end )
-
-/*
- Color 4ubv 4f
-*/
-GLOBL ( _x86_Color4ubv_4f )
- push %ebx
- movl $0, %edx
- xor %eax, %eax
- xor %ecx, %ecx
- movl 8(%esp), %ebx
- movl (%ebx), %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4),%eax
- movl (%edx,%ecx,4),%ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- xor %eax, %eax
- xor %ecx, %ecx
- shr $16, %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4), %eax
- movl (%edx,%ecx,4), %ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- pop %ebx
- ret
-GLOBL ( _x86_Color4ubv_4f_end )
-
-/*
-
- Color4ub_ub
-*/
-GLOBL( _x86_Color4ub_ub )
- push %ebx
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl 20(%esp), %ebx
- mov %al, (0)
- mov %dl, (0)
- mov %cl, (0)
- mov %bl, (0)
- pop %ebx
- ret
-GLOBL( _x86_Color4ub_ub_end )
-
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movl (%ecx), %edx
- shl $3, %eax
- movl 4(%ecx), %ecx
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-
-GLOBL( _x86_MultiTexCoord2fv_2 )
- movl 4(%esp,1), %eax
- movl 8(%esp,1), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movl (%ecx), %eax
- movl %eax, (%edx)
- movl 4(%ecx), %eax
- movl %eax, 4(%edx)
- ret
-GLOBL( _x86_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2f )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp), %ecx
- and $1, %eax
- shl $3, %eax
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _x86_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp,1), %ecx
- and $1,%eax
- movl 0(,%eax,4), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_2_end )
-
-/**
- * This can be used as a template for either Color3fv (when the color
- * target is also a 3f) or Normal3fv.
- */
-
-GLOBL( _sse_Attribute3fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movl 8(%eax), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3fv_end )
-
-/**
- * This can be used as a template for either Color3f (when the color
- * target is also a 3f) or Normal3f.
- */
-
-GLOBL( _sse_Attribute3f )
- movlps 4(%esp), %xmm0
- movl 12(%esp), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2f )
- movlps 4(%esp), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2f_end )
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movlps (%ecx), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-GLOBL( _sse_MultiTexCoord2fv_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movlps (%ecx), %xmm0
- movlps %xmm0, (%edx)
- ret
-GLOBL( _sse_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2f )
- movl 4(%esp), %eax
- and $1, %eax
- movlps 8(%esp), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _sse_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movlps 8(%esp), %xmm0
- and $1,%eax
- movl 0(,%eax,4), %eax
- movlps %xmm0, (%eax)
- ret
-GLOBL( _sse_MultiTexCoord2f_2_end )
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c b/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c
deleted file mode 100644
index 1789fbb5f..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_alloc.c,v 1.7 2001/01/08 01:07:29 martin Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_alloc.h"
-
-#include "sis_common.h"
-
-#include <unistd.h>
-
-#define Z_BUFFER_HW_ALIGNMENT 16
-#define Z_BUFFER_HW_PLUS (16 + 4)
-
-/* 3D engine uses 2, and bitblt uses 4 */
-#define DRAW_BUFFER_HW_ALIGNMENT 16
-#define DRAW_BUFFER_HW_PLUS (16 + 4)
-
-#define ALIGNMENT(value, align) (((value) + (align) - 1) / (align) * (align))
-
-static int _total_video_memory_used = 0;
-static int _total_video_memory_count = 0;
-
-void *
-sisAllocFB( sisContextPtr smesa, GLuint size, void **handle )
-{
- drm_sis_mem_t fb;
-
- _total_video_memory_used += size;
-
- fb.context = smesa->hHWContext;
- fb.size = size;
- if (drmCommandWriteRead( smesa->driFd, DRM_SIS_FB_ALLOC, &fb,
- sizeof(drm_sis_mem_t) ) || fb.offset == 0)
- {
- return NULL;
- }
- *handle = (void *)fb.free;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisAllocFB: size=%d, offset=%lu, pid=%d, count=%d\n",
- size, fb.offset, (GLint)getpid(),
- ++_total_video_memory_count);
- }
-
- return (void *)(smesa->FbBase + fb.offset);
-}
-
-void
-sisFreeFB( sisContextPtr smesa, void *handle )
-{
- drm_sis_mem_t fb;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisFreeFB: free=%p, pid=%d, count=%d\n",
- handle, (GLint)getpid(), --_total_video_memory_count);
- }
-
- fb.context = smesa->hHWContext;
- fb.free = handle;
- drmCommandWrite( smesa->driFd, DRM_SIS_FB_FREE, &fb, sizeof(drm_sis_mem_t) );
-}
-
-void *
-sisAllocAGP( sisContextPtr smesa, GLuint size, void **handle )
-{
- drm_sis_mem_t agp;
-
- if (smesa->AGPSize == 0)
- return NULL;
-
- agp.context = smesa->hHWContext;
- agp.size = size;
- if (drmCommandWriteRead( smesa->driFd, DRM_SIS_AGP_ALLOC, &agp,
- sizeof(drm_sis_mem_t) ) || agp.offset == 0)
- {
- return NULL;
- }
- *handle = (void *)agp.free;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisAllocAGP: size=%u, offset=%lu, pid=%d, count=%d\n",
- size, agp.offset, (GLint)getpid(),
- ++_total_video_memory_count);
- }
-
- return (void *)(smesa->AGPBase + agp.offset);
-}
-
-void
-sisFreeAGP( sisContextPtr smesa, void *handle )
-{
- drm_sis_mem_t agp;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisFreeAGP: free=%p, pid=%d, count=%d\n",
- handle, (GLint)getpid(), --_total_video_memory_count);
- }
-
- agp.context = smesa->hHWContext;
- agp.free = handle;
- drmCommandWrite( smesa->driFd, DRM_SIS_AGP_FREE, &agp,
- sizeof(drm_sis_mem_t) );
-}
-
-void
-sisAllocZStencilBuffer( sisContextPtr smesa )
-{
- GLuint z_depth;
- GLuint totalBytes;
- int width2;
-
- GLubyte *addr;
-
- z_depth = ( smesa->glCtx->Visual.depthBits +
- smesa->glCtx->Visual.stencilBits ) / 8;
-
- width2 = ALIGNMENT( smesa->width * z_depth, 4 );
-
- totalBytes = smesa->height * width2 + Z_BUFFER_HW_PLUS;
-
- addr = sisAllocFB( smesa, totalBytes, &smesa->zbFree );
- if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
-
- if (SIS_VERBOSE & VERBOSE_SIS_BUFFER) {
- fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr);
- }
-
- addr = (GLubyte *)ALIGNMENT( (unsigned long)addr, Z_BUFFER_HW_ALIGNMENT );
-
- smesa->depthbuffer = (void *) addr;
- smesa->depthPitch = width2;
- smesa->depthOffset = (unsigned long)addr - (unsigned long)smesa->FbBase;
-
- /* set pZClearPacket */
- memset( &smesa->zClearPacket, 0, sizeof(ENGPACKET) );
-
- smesa->zClearPacket.dwSrcPitch = (z_depth == 2) ? 0x80000000 : 0xf0000000;
- smesa->zClearPacket.dwDestBaseAddr = (GLint)(addr -
- (unsigned long)smesa->FbBase);
- smesa->zClearPacket.wDestPitch = width2;
- smesa->zClearPacket.stdwDestPos.wY = 0;
- smesa->zClearPacket.stdwDestPos.wX = 0;
-
- smesa->zClearPacket.wDestHeight = smesa->virtualY;
- smesa->zClearPacket.stdwDim.wWidth = (GLshort)width2 / z_depth;
- smesa->zClearPacket.stdwDim.wHeight = (GLshort)smesa->height;
- smesa->zClearPacket.stdwCmd.cRop = 0xf0;
-
- if (smesa->blockWrite)
- smesa->zClearPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- smesa->zClearPacket.stdwCmd.cCmd0 = 0;
- smesa->zClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-}
-
-void
-sisFreeZStencilBuffer( sisContextPtr smesa )
-{
- sisFreeFB( smesa, smesa->zbFree );
- smesa->zbFree = NULL;
- smesa->depthbuffer = NULL;
-}
-
-void
-sisAllocBackbuffer( sisContextPtr smesa )
-{
- GLuint depth = smesa->bytesPerPixel;
- GLuint size, width2;
-
- char *addr;
-
- width2 = (depth == 2) ? ALIGNMENT (smesa->width, 2) : smesa->width;
- size = width2 * smesa->height * depth + DRAW_BUFFER_HW_PLUS;
-
- /* Fixme: unique context alloc/free back-buffer? */
- addr = sisAllocFB( smesa, size, &smesa->bbFree );
- if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
-
- addr = (char *)ALIGNMENT( (unsigned long)addr, DRAW_BUFFER_HW_ALIGNMENT );
-
- smesa->backbuffer = addr;
- smesa->backOffset = (GLint)(addr - (unsigned long)smesa->FbBase);
- smesa->backPitch = width2 * depth;
-
- memset ( &smesa->cbClearPacket, 0, sizeof(ENGPACKET) );
-
- smesa->cbClearPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xf0000000;
- smesa->cbClearPacket.dwDestBaseAddr = smesa->backOffset;
- smesa->cbClearPacket.wDestPitch = smesa->backPitch;
- smesa->cbClearPacket.stdwDestPos.wY = 0;
- smesa->cbClearPacket.stdwDestPos.wX = 0;
-
- smesa->cbClearPacket.wDestHeight = smesa->virtualY;
- smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width2;
- smesa->cbClearPacket.stdwDim.wHeight = (GLshort) smesa->height;
- smesa->cbClearPacket.stdwCmd.cRop = 0xf0;
-
- if (smesa->blockWrite)
- smesa->cbClearPacket.stdwCmd.cCmd0 = (GLbyte)(CMD0_PAT_FG_COLOR);
- else
- smesa->cbClearPacket.stdwCmd.cCmd0 = 0;
- smesa->cbClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-}
-
-void
-sisFreeBackbuffer( sisContextPtr smesa )
-{
- sisFreeFB( smesa, smesa->bbFree );
- smesa->backbuffer = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.h b/xc/lib/GL/mesa/src/drv/sis/sis_alloc.h
deleted file mode 100644
index e76fc53fe..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_alloc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-enum {
- VIDEO_TYPE,
- AGP_TYPE
-};
-
-void sisAllocZStencilBuffer( sisContextPtr smesa );
-void sisFreeZStencilBuffer( sisContextPtr smesa );
-void sisAllocBackbuffer( sisContextPtr smesa );
-void sisFreeBackbuffer ( sisContextPtr smesa );
-void *sisAllocFB( sisContextPtr smesa, GLuint size, void **handle );
-void sisFreeFB( sisContextPtr smesa, void *handle );
-void *sisAllocAGP( sisContextPtr smesa, GLuint size, void **handle );
-void sisFreeAGP( sisContextPtr smesa, void *handle );
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_clear.c b/xc/lib/GL/mesa/src/drv/sis/sis_clear.c
deleted file mode 100644
index 3b33d8cb9..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_clear.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_clear.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_lock.h"
-
-#include "swrast/swrast.h"
-#include "mmath.h"
-
-static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width,
- GLint height );
-static void sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x,
- GLint y, GLint width, GLint height );
-static void sis_clear_z_stencil_buffer( GLcontext * ctx,
- GLbitfield mask, GLint x,
- GLint y, GLint width,
- GLint height );
-
-static void
-set_color_pattern( sisContextPtr smesa, GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha )
-{
- /* XXX only RGB565 and ARGB8888 */
- switch (smesa->colorFormat)
- {
- case DST_FORMAT_ARGB_8888:
- smesa->clearColorPattern = (alpha << 24) +
- (red << 16) + (green << 8) + (blue);
- break;
- case DST_FORMAT_RGB_565:
- smesa->clearColorPattern = ((red >> 3) << 11) +
- ((green >> 2) << 5) + (blue >> 3);
- smesa->clearColorPattern |= smesa->clearColorPattern << 16;
- break;
- default:
- assert(0);
- }
-}
-
-void
-sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil )
-{
- GLuint zPattern;
-
- switch (smesa->zFormat)
- {
- case SiS_ZFORMAT_Z16:
- zPattern = FLOAT_TO_USHORT(z);
- zPattern |= zPattern << 16;
- break;
- case SiS_ZFORMAT_S8Z24:
- zPattern = FLOAT_TO_UINT(z) >> 8;
- zPattern |= stencil << 24;
- break;
- case SiS_ZFORMAT_Z32:
- zPattern = FLOAT_TO_UINT(z);
- break;
- default:
- assert(0);
- }
- smesa->clearZStencilPattern = zPattern;
-}
-
-void
-sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- GLint x1, y1, width1, height1;
-
- if (all) {
- GLframebuffer *buffer = ctx->DrawBuffer;
-
- x1 = 0;
- y1 = 0;
- width1 = buffer->Width;
- height1 = buffer->Height;
- } else {
- x1 = x;
- y1 = Y_FLIP(y+height-1);
- width1 = width;
- height1 = height;
- }
- /* XXX: Scissoring */
-
- LOCK_HARDWARE();
-
- /* Mask out any non-existent buffers */
- if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask)
- mask &= ~DD_DEPTH_BIT;
- if (ctx->Visual.stencilBits == 0)
- mask &= ~DD_STENCIL_BIT;
-
- /* The 3d clear code is use for masked clears because I don't know how to do
- * masked clears with the 2d functions. 3d isn't used in general because
- * it's slower, even in the case of clearing multiple buffers
- */
- if ((smesa->current.hwDstMask != 0xffffffff &&
- (mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0) ||
- (ctx->Stencil.WriteMask[0] < 0xff && (mask & DD_STENCIL_BIT) != 0) )
- {
- mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 );
- }
-
- if ( mask & DD_FRONT_LEFT_BIT || mask & DD_BACK_LEFT_BIT) {
- sis_clear_color_buffer( ctx, mask, x1, y1, width1, height1 );
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
- }
-
- if (mask & (DD_DEPTH_BIT | DD_STENCIL_BIT)) {
- if (smesa->depthbuffer != NULL)
- sis_clear_z_stencil_buffer( ctx, mask, x1, y1, width1, height1 );
- mask &= ~(DD_DEPTH_BIT | DD_STENCIL_BIT);
- }
-
- UNLOCK_HARDWARE();
-
- if (mask != 0)
- _swrast_Clear( ctx, mask, all, x1, y1, width, height );
-}
-
-
-void
-sisDDClearColor( GLcontext * ctx, const GLfloat color[4] )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLubyte c[4];
-
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- set_color_pattern( smesa, c[0], c[1], c[2], c[3] );
-}
-
-void
-sisDDClearDepth( GLcontext * ctx, GLclampd d )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- sisUpdateZStencilPattern( smesa, d, ctx->Stencil.Clear );
-}
-
-void
-sisDDClearStencil( GLcontext * ctx, GLint s )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- sisUpdateZStencilPattern( smesa, ctx->Depth.Clear, s );
-}
-
-static GLbitfield
-sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *current = &smesa->current;
-
- float left, top, right, bottom, zClearVal;
- GLboolean bClrColor, bClrDepth, bClrStencil;
- GLint dwPrimitiveSet;
- GLint dwEnable1 = 0, dwEnable2 = MASK_ColorMaskWriteEnable;
- GLint dwDepthMask = 0, dwSten1 = 0, dwSten2 = 0;
- GLint dirtyflags = GFLAG_ENABLESETTING | GFLAG_ENABLESETTING2 |
- GFLAG_CLIPPING | GFLAG_DESTSETTING;
- int count;
- XF86DRIClipRectPtr pExtents;
-
- bClrColor = (mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0;
- bClrDepth = (mask & DD_DEPTH_BIT) != 0;
- bClrStencil = (mask & DD_STENCIL_BIT) != 0;
-
- if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
- sis_update_render_state( smesa );
-
- if (bClrStencil) {
- dwSten1 = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS |
- (ctx->Stencil.Clear << 8) | 0xff;
- dwSten2 = SiS_SFAIL_REPLACE | SiS_SPASS_ZFAIL_REPLACE |
- SiS_SPASS_ZPASS_REPLACE;
- dwEnable1 = MASK_ZWriteEnable | MASK_StencilTestEnable;
- dwEnable2 |= MASK_ZMaskWriteEnable;
- dwDepthMask |= ctx->Stencil.WriteMask[0] << 24;
- } else if (bClrDepth) {
- dwEnable1 = MASK_ZWriteEnable;
- dwEnable2 |= MASK_ZMaskWriteEnable;
- }
-
- if (bClrDepth) {
- zClearVal = ctx->Depth.Clear;
- if (ctx->Visual.depthBits != 32)
- dwDepthMask |= 0x00ffffff;
- else
- dwDepthMask = 0xffffffff;
- } else
- zClearVal = 0.0;
-
- mWait3DCmdQueue(9);
- MMIO(REG_3D_TEnable, dwEnable1);
- MMIO(REG_3D_TEnable2, dwEnable2);
- if (bClrDepth || bClrStencil) {
- MMIO(REG_3D_ZSet, (current->hwZ & ~MASK_ZTestMode) | SiS_Z_COMP_ALWAYS);
- dirtyflags |= GFLAG_ZSETTING;
- }
- if (bClrColor) {
- MMIO(REG_3D_DstSet, (current->hwDstSet & ~MASK_ROP2) | LOP_COPY);
- } else {
- MMIO(REG_3D_DstAlphaWriteMask, 0L);
- }
- if (bClrStencil) {
- MMIO(REG_3D_StencilSet, dwSten1);
- MMIO(REG_3D_StencilSet2, dwSten2);
- dirtyflags |= GFLAG_STENCILSETTING;
- }
-
- if (mask & DD_FRONT_LEFT_BIT) {
- pExtents = smesa->driDrawable->pClipRects;
- count = smesa->driDrawable->numClipRects;
- } else {
- pExtents = NULL;
- count = 1;
- }
-
- while(count--) {
- left = x;
- right = x + width;
- top = y;
- bottom = y + height;
-
- if (pExtents != NULL) {
- GLuint x1, y1, x2, y2;
-
- x1 = pExtents->x1 - smesa->driDrawable->x;
- y1 = pExtents->y1 - smesa->driDrawable->y;
- x2 = pExtents->x2 - smesa->driDrawable->x - 1;
- y2 = pExtents->y2 - smesa->driDrawable->y - 1;
-
- left = (left > x1) ? left : x1;
- right = (right > x2) ? x2 : right;
- top = (top > y1) ? top : y1;
- bottom = (bottom > y2) ? y2 : bottom;
- pExtents++;
- if (left > right || top > bottom)
- continue;
- }
-
- mWait3DCmdQueue(20);
-
- MMIO(REG_3D_ClipTopBottom, ((GLint)top << 13) | (GLint)bottom);
- MMIO(REG_3D_ClipLeftRight, ((GLint)left << 13) | (GLint)right);
-
- /* the first triangle */
- dwPrimitiveSet = OP_3D_TRIANGLE_DRAW | OP_3D_FIRE_TSARGBc |
- SHADE_FLAT_VertexC;
- MMIO(REG_3D_PrimitiveSet, dwPrimitiveSet);
-
- MMIO(REG_3D_TSZa, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXa, *(GLint *) &right);
- MMIO(REG_3D_TSYa, *(GLint *) &top);
- MMIO(REG_3D_TSARGBa, smesa->clearColorPattern);
-
- MMIO(REG_3D_TSZb, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXb, *(GLint *) &left);
- MMIO(REG_3D_TSYb, *(GLint *) &top);
- MMIO(REG_3D_TSARGBb, smesa->clearColorPattern);
-
- MMIO(REG_3D_TSZc, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXc, *(GLint *) &left);
- MMIO(REG_3D_TSYc, *(GLint *) &bottom);
- MMIO(REG_3D_TSARGBc, smesa->clearColorPattern);
-
- /* second triangle */
- dwPrimitiveSet = OP_3D_TRIANGLE_DRAW | OP_3D_FIRE_TSARGBb |
- SHADE_FLAT_VertexB;
- MMIO(REG_3D_PrimitiveSet, dwPrimitiveSet);
-
- MMIO(REG_3D_TSZb, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXb, *(GLint *) &right);
- MMIO(REG_3D_TSYb, *(GLint *) &bottom);
- MMIO(REG_3D_TSARGBb, smesa->clearColorPattern);
- }
-
- mEndPrimitive();
-
- /* If DD_FRONT_LEFT_BIT is set, we've only cleared the front buffer so far */
- if ((mask & DD_FRONT_LEFT_BIT) != 0 && (mask & DD_BACK_LEFT_BIT) != 0)
- sis_3D_Clear( ctx, DD_BACK_LEFT_BIT, x, y, width, height );
-
- smesa->GlobalFlag |= dirtyflags;
-
- return mask & ~(DD_DEPTH_BIT | DD_STENCIL_BIT | DD_BACK_LEFT_BIT |
- DD_FRONT_LEFT_BIT);
-}
-
-static void
-sis_bitblt_clear_cmd( sisContextPtr smesa, ENGPACKET * pkt )
-{
- GLint *lpdwDest, *lpdwSrc;
- int i;
-
- lpdwSrc = (GLint *) pkt + 1;
- lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR) + 1;
-
- mWait3DCmdQueue (10);
-
- *lpdwDest++ = *lpdwSrc++;
- lpdwSrc++;
- lpdwDest++;
- for (i = 3; i < 8; i++) {
- *lpdwDest++ = *lpdwSrc++;
- }
-
- MMIO(REG_CMD0, *(GLint *) & pkt->stdwCmd);
- MMIO(REG_CommandQueue, -1);
-}
-
-static void
-sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
- GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- int count;
- GLuint depth = smesa->bytesPerPixel;
- XF86DRIClipRectPtr pExtents = NULL;
- GLint xx, yy;
- GLint x0, y0, width0, height0;
-
- ENGPACKET stEngPacket;
-
- /* Clear back buffer */
- if (mask & DD_BACK_LEFT_BIT) {
- smesa->cbClearPacket.stdwDestPos.wY = y;
- smesa->cbClearPacket.stdwDestPos.wX = x;
- smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width;
- smesa->cbClearPacket.stdwDim.wHeight = (GLshort) height;
- smesa->cbClearPacket.dwFgRopColor = smesa->clearColorPattern;
-
- sis_bitblt_clear_cmd( smesa, &smesa->cbClearPacket );
- }
-
- if ((mask & DD_FRONT_LEFT_BIT) == 0)
- return;
-
- /* Clear front buffer */
- x0 = x;
- y0 = y;
- width0 = width;
- height0 = height;
-
- pExtents = smesa->driDrawable->pClipRects;
- count = smesa->driDrawable->numClipRects;
-
- memset( &stEngPacket, 0, sizeof (ENGPACKET) );
-
- stEngPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xc0000000;
- stEngPacket.dwDestBaseAddr = smesa->frontOffset;
- stEngPacket.wDestPitch = smesa->frontPitch;
- /* TODO: set maximum value? */
- stEngPacket.wDestHeight = smesa->virtualY;
- stEngPacket.stdwCmd.cRop = 0xf0;
- stEngPacket.dwFgRopColor = smesa->clearColorPattern;
-
- /* for SGRAM Block Write Enable */
- if (smesa->blockWrite)
- stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- stEngPacket.stdwCmd.cCmd0 = 0;
- stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-
- while (count--) {
- GLint x2 = pExtents->x1 - smesa->driDrawable->x;
- GLint y2 = pExtents->y1 - smesa->driDrawable->y;
- GLint xx2 = pExtents->x2 - smesa->driDrawable->x;
- GLint yy2 = pExtents->y2 - smesa->driDrawable->y;
-
- x = (x0 > x2) ? x0 : x2;
- y = (y0 > y2) ? y0 : y2;
- xx = ((x0 + width0) > (xx2)) ? xx2 : x0 + width0;
- yy = ((y0 + height0) > (yy2)) ? yy2 : y0 + height0;
- width = xx - x;
- height = yy - y;
- pExtents++;
-
- if (width <= 0 || height <= 0)
- continue;
-
- stEngPacket.stdwDestPos.wY = y;
- stEngPacket.stdwDestPos.wX = x;
- stEngPacket.stdwDim.wWidth = (GLshort)width;
- stEngPacket.stdwDim.wHeight = (GLshort)height;
-
- sis_bitblt_clear_cmd( smesa, &stEngPacket );
- }
-}
-
-static void
-sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- /* TODO: consider alignment of width, height? */
- smesa->zClearPacket.stdwDestPos.wY = y;
- smesa->zClearPacket.stdwDestPos.wX = x;
- smesa->zClearPacket.stdwDim.wWidth = (GLshort) width;
- smesa->zClearPacket.stdwDim.wHeight = (GLshort) height;
- smesa->zClearPacket.dwFgRopColor = smesa->clearZStencilPattern;
-
- sis_bitblt_clear_cmd( smesa, &smesa->zClearPacket );
-}
-
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_common2.h b/xc/lib/GL/mesa/src/drv/sis/sis_common2.h
deleted file mode 100644
index 40ae451be..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_common2.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- */
-
-#ifndef _sis_common_h_
-#define _sis_common_h_
-
-#if 0
-#define free(x)
-#define calloc(x,y) sis_debug_malloc((x)*(y))
-extern void *sis_debug_malloc(int x);
-#endif
-
-#if defined(SIS_DUMP)
-#include "sis_debug.h"
-#endif
-
-#ifdef GLX_DIRECT_RENDERING
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-typedef struct _Box
-{
- short x1, y1, x2, y2;
-}
-BoxRec;
-#define NullBox ((BoxPtr)0)
-typedef struct _Box *BoxPtr;
-#endif /* GLX_DIRECT_RENDERING */
-
-/* BitBlt Commands */
-#define CMD0_DD_ENABLE 0x06
-#define CMD0_SRC_VIDEO 0x00
-#define CMD0_SRC_CPU 0x10
-#define CMD0_PAT_FG_COLOR 0x00
-#define CMD1_DIR_X_DEC 0x00
-#define CMD1_DIR_X_INC 0x01
-#define CMD1_DIR_Y_DEC 0x00
-#define CMD1_DIR_Y_INC 0x02
-#define REG_SRC_ADDR 0x8200
-#define REG_CMD0 0x823c
-
-typedef struct
-{
- GLshort wSrcPitch;
- GLshort wDestPitch;
-}
-_PITCH;
-typedef struct
-{
- GLshort wWidth;
- GLshort wHeight;
-}
-_DIM;
-typedef struct
-{
- GLshort wY;
- GLshort wX;
-}
-_POS;
-
-typedef struct
-{
- GLubyte cCmd0;
- GLubyte cRop;
- GLubyte cCmd1;
- GLubyte cReserved;
-}
-_CMD;
-
-typedef struct
-{
- GLshort wStatus0;
- GLbyte cStatus0_GLbyte3;
- GLbyte cStatus0_GLbyte4;
-}
-_CMDQUESTATUS;
-
-typedef struct
-{
- GLint dwSrcBaseAddr;
- GLint dwSrcPitch;
- _POS stdwSrcPos;
- _POS stdwDestPos;
- GLint dwDestBaseAddr;
- GLshort wDestPitch;
- GLshort wDestHeight;
- _DIM stdwDim;
- GLint dwFgRopColor;
- GLint dwBgRopColor;
- GLint dwSrcHiCKey;
- GLint dwSrcLoCKey;
- GLint dwMaskA;
- GLint dwMaskB;
- GLint dwClipA;
- GLint dwClipB;
- _CMD stdwCmd;
- _CMDQUESTATUS stdwCmdQueStatus;
-}
-ENGPACKET, *LPENGPACKET;
-
-/* Hardware Info */
-#include "sis_reg.h"
-
-/* HW capability */
-#define SIS_MAX_TEXTURE_SIZE 2048
-#define SIS_MAX_TEXTURES 2
-
-#define SIS_MAX_FRAME_LENGTH 3
-
-GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_context.c b/xc/lib/GL/mesa/src/drv/sis/sis_context.c
deleted file mode 100644
index 0830e5676..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_context.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_dri.h"
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_dd.h"
-#include "sis_span.h"
-#include "sis_stencil.h"
-#include "sis_tex.h"
-#include "sis_tris.h"
-#include "sis_vb.h"
-
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "utils.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-int GlobalCurrentHwcx = -1;
-int GlobalHwcxCountBase = 1;
-int GlobalCmdQueueLen = 0;
-
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_OPT_BEGIN(agp_disable,bool,false)
- DRI_CONF_DESC(en,"Disable AGP vertex dispatch")
- DRI_CONF_OPT_END
- DRI_CONF_OPT_BEGIN(fallback_force,bool,false)
- DRI_CONF_DESC(en,"Force software fallback")
- DRI_CONF_OPT_END
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 2;
-
-static const char * const card_extensions[] =
-{
- "GL_ARB_multitexture",
- "GL_EXT_texture_lod_bias",
- NULL
-};
-
-void
-WaitEngIdle (sisContextPtr smesa)
-{
- GLuint cEngineState;
-
- do {
- cEngineState = MMIO_READ(REG_CommandQueue);
- } while ((cEngineState & SiS_EngIdle) != SiS_EngIdle);
-}
-
-void
-Wait2DEngIdle (sisContextPtr smesa)
-{
- GLuint cEngineState;
-
- do {
- cEngineState = MMIO_READ(REG_CommandQueue);
- } while ((cEngineState & SiS_EngIdle2d) != SiS_EngIdle2d);
-}
-
-/* To be called from mWait3DCmdQueue. Separate function for profiling
- * purposes, and speed doesn't matter because we're spinning anyway.
- * This function should use usleeps to release cpu probably, but I have yet
- * to see it get called.
- */
-void
-WaitingFor3dIdle(sisContextPtr smesa, int wLen)
-{
- while (*(smesa->CurrentQueueLenPtr) < wLen) {
- *(smesa->CurrentQueueLenPtr) =
- (MMIO_READ(REG_CommandQueue) & MASK_QueueLen) - 20;
- }
-}
-
-GLboolean
-sisCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- sisContextPtr smesa;
- sisScreenPtr sisScreen;
- int i;
-
- smesa = (sisContextPtr)CALLOC( sizeof(*smesa) );
- if ( smesa == NULL )
- return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((sisContextPtr)sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- smesa->glCtx = _mesa_create_context( glVisual, shareCtx, (void *) smesa,
- GL_TRUE);
- if (smesa->glCtx == NULL) {
- FREE(smesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = smesa;
- ctx = smesa->glCtx;
-
- sisScreen = smesa->sisScreen = (sisScreenPtr)(sPriv->private);
-
- smesa->driContext = driContextPriv;
- smesa->driScreen = sPriv;
- smesa->driDrawable = NULL;
- smesa->hHWContext = driContextPriv->hHWContext;
- smesa->driHwLock = &sPriv->pSAREA->lock;
- smesa->driFd = sPriv->fd;
-
- smesa->virtualX = sisScreen->screenX;
- smesa->virtualY = sisScreen->screenY;
- smesa->bytesPerPixel = sisScreen->cpp;
- smesa->IOBase = sisScreen->mmio.map;
- smesa->Chipset = sisScreen->deviceID;
- smesa->irqEnabled = sisScreen->irqEnabled;
-
- smesa->FbBase = sPriv->pFB;
- smesa->displayWidth = sPriv->fbWidth;
- smesa->frontPitch = sPriv->fbStride;
-
- smesa->sarea = (SISSAREAPriv *)((char *)sPriv->pSAREA +
- sisScreen->sarea_priv_offset);
-
-#if defined(SIS_DUMP)
- IOBase4Debug = GET_IOBase (smesa);
-#endif
-
- /* support ARGB8888 and RGB565 */
- switch (smesa->bytesPerPixel)
- {
- case 4:
- smesa->redMask = 0x00ff0000;
- smesa->greenMask = 0x0000ff00;
- smesa->blueMask = 0x000000ff;
- smesa->alphaMask = 0xff000000;
- smesa->colorFormat = DST_FORMAT_ARGB_8888;
- break;
- case 2:
- smesa->redMask = 0xf800;
- smesa->greenMask = 0x07e0;
- smesa->blueMask = 0x001f;
- smesa->alphaMask = 0;
- smesa->colorFormat = DST_FORMAT_RGB_565;
- break;
- default:
- assert (0);
- }
-
- /* Parse configuration files */
- driParseConfigFiles (&smesa->optionCache, &sisScreen->optionCache,
- sisScreen->driScreen->myNum, "sis");
-
- /* TODO: index mode */
-
- smesa->CurrentQueueLenPtr = &(smesa->sarea->QueueLength);
- smesa->FrameCountPtr = &(smesa->sarea->FrameCount);
-
- /* set AGP */
- smesa->AGPSize = sisScreen->agp.size;
- smesa->AGPBase = sisScreen->agp.map;
- smesa->AGPAddr = sisScreen->agp.handle;
-
- /* set AGP command buffer */
- if (smesa->AGPSize != 0 && sisScreen->AGPCmdBufSize != 0 &&
- !driQueryOptionb(&smesa->optionCache, "agp_disable"))
- {
- smesa->AGPCmdBufBase = smesa->AGPBase + sisScreen->AGPCmdBufOffset;
- smesa->AGPCmdBufAddr = smesa->AGPAddr + sisScreen->AGPCmdBufOffset;
- smesa->AGPCmdBufSize = sisScreen->AGPCmdBufSize;
-
- smesa->pAGPCmdBufNext = (GLint *)&(smesa->sarea->AGPCmdBufNext);
- smesa->AGPCmdModeEnabled = GL_TRUE;
- } else {
- smesa->AGPCmdModeEnabled = GL_FALSE;
- }
-
- smesa->GlobalFlag = 0L;
-
- smesa->Fallback = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- _swrast_allow_pixel_fog( ctx, GL_TRUE );
- _swrast_allow_vertex_fog( ctx, GL_FALSE );
-
- sisDDInitStateFuncs( ctx );
- sisDDInitState( smesa ); /* Initializes smesa->zFormat, important */
- sisInitVB( ctx );
- sisInitTriFuncs( ctx );
- sisDDInitDriverFuncs( ctx );
- sisDDInitSpanFuncs( ctx );
- sisDDInitStencilFuncs( ctx );
- sisDDInitTextureFuncs( ctx );
-
- driInitExtensions( ctx, card_extensions, GL_FALSE );
-
- /* TODO */
- /* smesa->blockWrite = SGRAMbw = IsBlockWrite (); */
- smesa->blockWrite = GL_FALSE;
-
- for (i = 0; i < SIS_MAX_TEXTURES; i++) {
- smesa->TexStates[i] = 0;
- smesa->PrevTexFormat[i] = 0;
- }
-
- return GL_TRUE;
-}
-
-void
-sisDestroyContext ( __DRIcontextPrivate *driContextPriv )
-{
- sisContextPtr smesa = (sisContextPtr)driContextPriv->driverPrivate;
-
- assert( smesa != NULL );
-
- if ( smesa != NULL ) {
- _swsetup_DestroyContext( smesa->glCtx );
- _tnl_DestroyContext( smesa->glCtx );
- _ac_DestroyContext( smesa->glCtx );
- _swrast_DestroyContext( smesa->glCtx );
-
- /* free the Mesa context */
- /* XXX: Is the next line needed? The DriverCtx (smesa) reference is
- * needed for sisDDDeleteTexture, since it needs to call the FB/AGP free
- * function.
- */
- /* smesa->glCtx->DriverCtx = NULL; */
- _mesa_destroy_context(smesa->glCtx);
- }
-
- FREE( smesa );
-}
-
-GLboolean
-sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- GET_CURRENT_CONTEXT(ctx);
- sisContextPtr oldSisCtx = ctx ? SIS_CONTEXT(ctx) : NULL;
- sisContextPtr newSisCtx = (sisContextPtr) driContextPriv->driverPrivate;
-
- if ( newSisCtx != oldSisCtx) {
- newSisCtx->GlobalFlag = GFLAG_ALL;
- }
-
- newSisCtx->driDrawable = driDrawPriv;
-
- _mesa_make_current2( newSisCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- sisUpdateBufferSize( newSisCtx );
- sisUpdateClipping( newSisCtx->glCtx );
-
- if ( newSisCtx->glCtx->Viewport.Width == 0 ) {
- _mesa_set_viewport(newSisCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- } else {
- _mesa_make_current( 0, 0 );
- }
-
- return GL_TRUE;
-}
-
-GLboolean
-sisUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-void
-sis_update_render_state( sisContextPtr smesa )
-{
- __GLSiSHardware *prev = &smesa->prev;
-
- mWait3DCmdQueue (45);
-
- if (smesa->GlobalFlag & GFLAG_ENABLESETTING) {
- if (!smesa->clearTexCache) {
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- } else {
- MMIO(REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear);
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- smesa->clearTexCache = GL_FALSE;
- }
- }
-
- if (smesa->GlobalFlag & GFLAG_ENABLESETTING2)
- MMIO(REG_3D_TEnable2, prev->hwCapEnable2);
-
- /* Z Setting */
- if (smesa->GlobalFlag & GFLAG_ZSETTING)
- {
- MMIO(REG_3D_ZSet, prev->hwZ);
- MMIO(REG_3D_ZStWriteMask, prev->hwZMask);
- MMIO(REG_3D_ZAddress, prev->hwOffsetZ);
- }
-
- /* Alpha Setting */
- if (smesa->GlobalFlag & GFLAG_ALPHASETTING)
- MMIO(REG_3D_AlphaSet, prev->hwAlpha);
-
- if (smesa->GlobalFlag & GFLAG_DESTSETTING) {
- MMIO(REG_3D_DstSet, prev->hwDstSet);
- MMIO(REG_3D_DstAlphaWriteMask, prev->hwDstMask);
- MMIO(REG_3D_DstAddress, prev->hwOffsetDest);
- }
-
- /* Line Setting */
-#if 0
- if (smesa->GlobalFlag & GFLAG_LINESETTING)
- MMIO(REG_3D_LinePattern, prev->hwLinePattern);
-#endif
-
- /* Fog Setting */
- if (smesa->GlobalFlag & GFLAG_FOGSETTING)
- {
- MMIO(REG_3D_FogSet, prev->hwFog);
- MMIO(REG_3D_FogInverseDistance, prev->hwFogInverse);
- MMIO(REG_3D_FogFarDistance, prev->hwFogFar);
- MMIO(REG_3D_FogFactorDensity, prev->hwFogDensity);
- }
-
- /* Stencil Setting */
- if (smesa->GlobalFlag & GFLAG_STENCILSETTING) {
- MMIO(REG_3D_StencilSet, prev->hwStSetting);
- MMIO(REG_3D_StencilSet2, prev->hwStSetting2);
- }
-
- /* Miscellaneous Setting */
- if (smesa->GlobalFlag & GFLAG_DSTBLEND)
- MMIO(REG_3D_DstBlendMode, prev->hwDstSrcBlend);
- if (smesa->GlobalFlag & GFLAG_CLIPPING) {
- MMIO(REG_3D_ClipTopBottom, prev->clipTopBottom);
- MMIO(REG_3D_ClipLeftRight, prev->clipLeftRight);
- }
-
- smesa->GlobalFlag &= ~GFLAG_RENDER_STATES;
-}
-
-void
-sis_update_texture_state (sisContextPtr smesa)
-{
- __GLSiSHardware *prev = &smesa->prev;
-
- mWait3DCmdQueue (55);
- if (smesa->clearTexCache || (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS)) {
- MMIO(REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear);
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- smesa->clearTexCache = GL_FALSE;
- }
-
- /* Texture Setting */
- if (smesa->GlobalFlag & CFLAG_TEXTURERESET)
- MMIO(REG_3D_TextureSet, prev->texture[0].hwTextureSet);
-
- if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP)
- MMIO(REG_3D_TextureMip, prev->texture[0].hwTextureMip);
-
- /*
- MMIO(REG_3D_TextureTransparencyColorHigh, prev->texture[0].hwTextureClrHigh);
- MMIO(REG_3D_TextureTransparencyColorLow, prev->texture[0].hwTextureClrLow);
- */
-
- if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR)
- MMIO(REG_3D_TextureBorderColor, prev->texture[0].hwTextureBorderColor);
-
- if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS) {
- switch ((prev->texture[0].hwTextureSet & MASK_TextureLevel) >> 8)
- {
- case 11:
- MMIO(REG_3D_TextureAddress11, prev->texture[0].texOffset11);
- case 10:
- MMIO(REG_3D_TextureAddress10, prev->texture[0].texOffset10);
- MMIO(REG_3D_TexturePitch10, prev->texture[0].texPitch10);
- case 9:
- MMIO(REG_3D_TextureAddress9, prev->texture[0].texOffset9);
- case 8:
- MMIO(REG_3D_TextureAddress8, prev->texture[0].texOffset8);
- MMIO(REG_3D_TexturePitch8, prev->texture[0].texPitch89);
- case 7:
- MMIO(REG_3D_TextureAddress7, prev->texture[0].texOffset7);
- case 6:
- MMIO(REG_3D_TextureAddress6, prev->texture[0].texOffset6);
- MMIO(REG_3D_TexturePitch6, prev->texture[0].texPitch67);
- case 5:
- MMIO(REG_3D_TextureAddress5, prev->texture[0].texOffset5);
- case 4:
- MMIO(REG_3D_TextureAddress4, prev->texture[0].texOffset4);
- MMIO(REG_3D_TexturePitch4, prev->texture[0].texPitch45);
- case 3:
- MMIO(REG_3D_TextureAddress3, prev->texture[0].texOffset3);
- case 2:
- MMIO(REG_3D_TextureAddress2, prev->texture[0].texOffset2);
- MMIO(REG_3D_TexturePitch2, prev->texture[0].texPitch23);
- case 1:
- MMIO(REG_3D_TextureAddress1, prev->texture[0].texOffset1);
- case 0:
- MMIO(REG_3D_TextureAddress0, prev->texture[0].texOffset0);
- MMIO(REG_3D_TexturePitch0, prev->texture[0].texPitch01);
- }
- }
- if (smesa->GlobalFlag & CFLAG_TEXTURERESET_1)
- MMIO(REG_3D_Texture1Set, prev->texture[1].hwTextureSet);
- if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP_1)
- MMIO(REG_3D_Texture1Mip, prev->texture[1].hwTextureMip);
-
- if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR_1) {
- MMIO(REG_3D_Texture1BorderColor,
- prev->texture[1].hwTextureBorderColor);
- }
- if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS_1) {
- switch ((prev->texture[1].hwTextureSet & MASK_TextureLevel) >> 8)
- {
- case 11:
- MMIO(REG_3D_Texture1Address11, prev->texture[1].texOffset11);
- case 10:
- MMIO(REG_3D_Texture1Address10, prev->texture[1].texOffset10);
- MMIO(REG_3D_Texture1Pitch10, prev->texture[1].texPitch10);
- case 9:
- MMIO(REG_3D_Texture1Address9, prev->texture[1].texOffset9);
- case 8:
- MMIO(REG_3D_Texture1Address8, prev->texture[1].texOffset8);
- MMIO(REG_3D_Texture1Pitch8, prev->texture[1].texPitch89);
- case 7:
- MMIO(REG_3D_Texture1Address7, prev->texture[1].texOffset7);
- case 6:
- MMIO(REG_3D_Texture1Address6, prev->texture[1].texOffset6);
- MMIO(REG_3D_Texture1Pitch6, prev->texture[1].texPitch67);
- case 5:
- MMIO(REG_3D_Texture1Address5, prev->texture[1].texOffset5);
- case 4:
- MMIO(REG_3D_Texture1Address4, prev->texture[1].texOffset4);
- MMIO(REG_3D_Texture1Pitch4, prev->texture[1].texPitch45);
- case 3:
- MMIO(REG_3D_Texture1Address3, prev->texture[1].texOffset3);
- case 2:
- MMIO(REG_3D_Texture1Address2, prev->texture[1].texOffset2);
- MMIO(REG_3D_Texture1Pitch2, prev->texture[1].texPitch23);
- case 1:
- MMIO(REG_3D_Texture1Address1, prev->texture[1].texOffset1);
- case 0:
- MMIO(REG_3D_Texture1Address0, prev->texture[1].texOffset0);
- MMIO(REG_3D_Texture1Pitch0, prev->texture[1].texPitch01);
- }
- }
-
- /* texture environment */
- if (smesa->GlobalFlag & GFLAG_TEXTUREENV) {
- MMIO(REG_3D_TextureBlendFactor, prev->hwTexEnvColor);
- MMIO(REG_3D_TextureColorBlendSet0, prev->hwTexBlendColor0);
- MMIO(REG_3D_TextureAlphaBlendSet0, prev->hwTexBlendAlpha0);
- }
- if (smesa->GlobalFlag & GFLAG_TEXTUREENV_1) {
- MMIO(REG_3D_TextureBlendFactor, prev->hwTexEnvColor);
- MMIO(REG_3D_TextureColorBlendSet1, prev->hwTexBlendColor1);
- MMIO(REG_3D_TextureAlphaBlendSet1, prev->hwTexBlendAlpha1);
- }
-
- smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES;
-}
-
-void
-sis_fatal_error (void)
-{
- /* free video memory, or the framebuffer device will do it automatically */
-
- fprintf(stderr, "Fatal errors in sis_dri.so\n");
- exit (-1);
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_context.h b/xc/lib/GL/mesa/src/drv/sis/sis_context.h
deleted file mode 100644
index fb4191a6e..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_context.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef _sis_ctx_h_
-#define _sis_ctx_h_
-
-#include "context.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-#include "sis_screen.h"
-#include "sis_common2.h"
-#include "sis_dri.h"
-
-/* for GLboolean */
-#include <GL/gl.h>
-
-#define PCI_CHIP_SIS300 0x0300
-#define PCI_CHIP_SIS630 0x6300
-#define PCI_CHIP_SIS540 0x5300
-
-#define NEW_TEXTURING 0x1
-#define NEW_TEXTURE_ENV 0x2
-
-/* Flags for software fallback cases:
- */
-#define SIS_FALLBACK_TEXTURE 0x0001
-#define SIS_FALLBACK_TEXTURE0 0x0002
-#define SIS_FALLBACK_TEXTURE1 0x0004
-#define SIS_FALLBACK_TEXENV0 0x0008
-#define SIS_FALLBACK_TEXENV1 0x0010
-#define SIS_FALLBACK_DRAW_BUFFER 0x0020
-#define SIS_FALLBACK_STENCIL 0x0040
-#define SIS_FALLBACK_FORCE 0x8000
-
-/* Flags for hardware state that needs to be updated */
-#define GFLAG_ENABLESETTING 0x00000001
-#define GFLAG_ENABLESETTING2 0x00000002
-#define GFLAG_ZSETTING 0x00000004
-#define GFLAG_ALPHASETTING 0x00000008
-#define GFLAG_DESTSETTING 0x00000010
-#define GFLAG_LINESETTING 0x00000020
-#define GFLAG_STENCILSETTING 0x00000040
-#define GFLAG_FOGSETTING 0x00000080
-#define GFLAG_DSTBLEND 0x00000100
-#define GFLAG_CLIPPING 0x00000200
-#define CFLAG_TEXTURERESET 0x00000400
-#define GFLAG_TEXTUREMIPMAP 0x00000800
-#define GFLAG_TEXBORDERCOLOR 0x00001000
-#define GFLAG_TEXTUREADDRESS 0x00002000
-#define GFLAG_TEXTUREENV 0x00004000
-#define CFLAG_TEXTURERESET_1 0x00008000
-#define GFLAG_TEXTUREMIPMAP_1 0x00010000
-#define GFLAG_TEXBORDERCOLOR_1 0x00020000
-#define GFLAG_TEXTUREADDRESS_1 0x00040000
-#define GFLAG_TEXTUREENV_1 0x00080000
-#define GFLAG_ALL 0x000fffff
-
-#define GFLAG_TEXTURE_STATES (CFLAG_TEXTURERESET | GFLAG_TEXTUREMIPMAP | \
- GFLAG_TEXBORDERCOLOR | GFLAG_TEXTUREADDRESS | \
- CFLAG_TEXTURERESET_1 | GFLAG_TEXTUREMIPMAP_1 | \
- GFLAG_TEXBORDERCOLOR_1 | \
- GFLAG_TEXTUREADDRESS_1 | \
- GFLAG_TEXTUREENV | GFLAG_TEXTUREENV_1)
-
-
-#define GFLAG_RENDER_STATES (GFLAG_ENABLESETTING | GFLAG_ENABLESETTING2 | \
- GFLAG_ZSETTING | GFLAG_ALPHASETTING | \
- GFLAG_DESTSETTING | GFLAG_FOGSETTING | \
- GFLAG_STENCILSETTING | GFLAG_DSTBLEND | \
- GFLAG_CLIPPING)
-
-/* Use the templated vertex format:
- */
-#define TAG(x) sis##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* Subpixel offsets for window coordinates (triangles):
- */
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F)
-
-#define SIS_MAX_TEXTURE_LEVELS 11
-
-typedef struct {
- GLbyte *Data; /* Pointer to texture in offscreen */
- GLuint memType; /* VIDEO_TYPE or AGP_TYPE */
- void *handle; /* Handle for sisFree*() */
- GLuint pitch;
- GLuint size;
-} sisTexImage;
-
-typedef struct sis_tex_obj {
- sisTexImage image[SIS_MAX_TEXTURE_LEVELS]; /* Image data for each mipmap
- * level */
- GLenum format; /* One of GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
- * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA */
- GLint hwformat; /* One of the TEXEL_ defines */
- GLint numImages; /* Number of images loaded into .image */
-} sisTexObj, *sisTexObjPtr;
-
-/*
- ** Device dependent context state
- */
-typedef struct __GLSiSTextureRec
-{
- GLint hwTextureSet;
- GLint hwTextureMip;
- GLint hwTextureClrHigh;
- GLint hwTextureClrLow;
- GLint hwTextureBorderColor;
-
- GLint texOffset0;
- GLint texOffset1;
- GLint texOffset2;
- GLint texOffset3;
- GLint texOffset4;
- GLint texOffset5;
- GLint texOffset6;
- GLint texOffset7;
- GLint texOffset8;
- GLint texOffset9;
- GLint texOffset10;
- GLint texOffset11;
-
- GLint texPitch01;
- GLint texPitch23;
- GLint texPitch45;
- GLint texPitch67;
- GLint texPitch89;
- GLint texPitch10;
-} __GLSiSTexture;
-
-typedef struct __GLSiSHardwareRec
-{
- GLint hwCapEnable, hwCapEnable2; /* Enable Setting */
-
- GLint hwOffsetZ, hwZ; /* Z Setting */
-
- GLint hwZBias, hwZMask; /* Z Setting */
-
- GLint hwAlpha; /* Alpha Setting */
-
- GLint hwDstSet, hwDstMask; /* Destination Setting */
-
- GLint hwOffsetDest; /* Destination Setting */
-
- GLint hwLinePattern; /* Line Setting */
-
- GLint hwFog; /* Fog Setting */
-
- GLint hwFogFar, hwFogInverse; /* Fog Distance setting */
-
- GLint hwFogDensity; /* Fog factor & density */
-
- GLint hwStSetting, hwStSetting2; /* Stencil Setting */
-
- GLint hwStOffset; /* Stencil Setting */
-
- GLint hwDstSrcBlend; /* Blending mode Setting */
-
- GLint clipTopBottom; /* Clip for Top & Bottom */
-
- GLint clipLeftRight; /* Clip for Left & Right */
-
- struct __GLSiSTextureRec texture[2];
-
- GLint hwTexEnvColor; /* Texture Blending Setting */
-
- GLint hwTexBlendColor0;
- GLint hwTexBlendColor1;
- GLint hwTexBlendAlpha0;
- GLint hwTexBlendAlpha1;
-
-}
-__GLSiSHardware;
-
-typedef struct sis_context sisContextRec;
-typedef struct sis_context *sisContextPtr;
-
-typedef void (*sis_quad_func)( sisContextPtr,
- sisVertex *,
- sisVertex *,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_tri_func)( sisContextPtr,
- sisVertex *,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_line_func)( sisContextPtr,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_point_func)( sisContextPtr,
- sisVertex * );
-
-/* Device dependent context state */
-
-struct sis_context
-{
- /* This must be first in this structure */
- GLcontext *glCtx;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- GLuint NewGLState;
- GLuint Fallback;
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLuint num_verts;
- GLubyte *verts;
-
- unsigned int virtualX, virtualY;
- unsigned int bytesPerPixel;
- unsigned char *IOBase;
- unsigned char *FbBase;
- unsigned int displayWidth;
- unsigned int frontOffset;
- unsigned int frontPitch;
-
- /* HW RGBA layout */
- unsigned int redMask, greenMask, blueMask, alphaMask;
- unsigned int colorFormat;
-
- /* Z format */
- unsigned int zFormat;
-
- /* Clear patterns, 4 bytes */
- unsigned int clearColorPattern;
- unsigned int clearZStencilPattern;
-
- /* Fallback rasterization functions
- */
- sis_point_func draw_point;
- sis_line_func draw_line;
- sis_tri_func draw_tri;
- sis_quad_func draw_quad;
-
- GLuint hw_primitive;
- GLenum raster_primitive;
- GLenum render_primitive;
-
- /* DRM fd */
- int driFd;
-
- /* AGP Memory */
- unsigned int AGPSize;
- unsigned char *AGPBase;
- unsigned int AGPAddr;
-
- /* AGP Command Buffer */
- /* TODO: use Global variables */
-
- unsigned char *AGPCmdBufBase;
- GLint AGPCmdBufAddr;
- unsigned int AGPCmdBufSize;
- GLint *pAGPCmdBufNext;
- GLboolean AGPCmdModeEnabled;
-
- /* register 0x89F4 */
- GLint AGPParseSet;
-
- /* register 0x89F8 */
- GLint dwPrimitiveSet;
-
- __GLSiSHardware prev, current;
-
- int Chipset;
-
- GLint drawableID;
-
- /* SGRAM block write */
- GLboolean blockWrite;
-
- GLint GlobalFlag;
-
- /* Stereo */
- GLboolean isFullScreen;
- GLboolean useStereo;
- GLboolean stereoEnabled;
- int stereo_drawIndex;
- int stereo_drawSide;
- GLboolean irqEnabled;
-
- GLboolean clearTexCache;
-
- GLuint TexStates[SIS_MAX_TEXTURES];
- GLuint PrevTexFormat[SIS_MAX_TEXTURES];
-
- int *CurrentQueueLenPtr;
- unsigned int *FrameCountPtr;
-
- /* Front/back/depth buffer info */
- GLuint width, height; /* size of buffers */
- GLint bottom; /* used for FLIP macro */
- GLvoid *backbuffer;
- unsigned int backOffset;
- unsigned int backPitch;
- GLvoid *depthbuffer;
- unsigned int depthOffset;
- unsigned int depthPitch;
- void *zbFree, *bbFree; /* Cookies for freeing buffers */
- ENGPACKET zClearPacket, cbClearPacket;
-
- /* Drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
-
- /* Mirrors of some DRI state
- */
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
-
- unsigned int lastStamp; /* mirror driDrawable->lastStamp */
-
- drmContext hHWContext;
- drmLock *driHwLock;
-
- sisScreenPtr sisScreen; /* Screen private DRI data */
- SISSAREAPrivPtr sarea; /* Private SAREA data */
-
- /* Configuration cache */
- driOptionCache optionCache;
-};
-
-#define SIS_CONTEXT(ctx) ((sisContextPtr)(ctx->DriverCtx))
-
-/* Macros */
-#define GET_IOBase(x) ((x)->IOBase)
-
-#define Y_FLIP(Y) (smesa->bottom - (Y))
-
-#define SISPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define SISPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define SIS_VERBOSE 0
-
-
-#define MMIO(reg, value) \
-{\
- *(GLint *)(GET_IOBase(smesa) + (reg)) = value; \
-}
-
-#define MMIO_READ(reg) *(volatile GLint *)(smesa->IOBase + (reg))
-#define MMIO_READf(reg) *(volatile GLfloat *)(smesa->IOBase + (reg))
-
-#define mEndPrimitive() \
-{ \
- *(GET_IOBase(smesa) + REG_3D_EndPrimitiveList) = 0xFF; \
- *(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \
-}
-
-/* Lock required */
-#define mWait3DCmdQueue(wLen) \
-/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
-if (*(smesa->CurrentQueueLenPtr) < (wLen)) { \
- *(smesa->CurrentQueueLenPtr) = \
- (*(GLint *)(GET_IOBase(smesa) + REG_CommandQueue) & MASK_QueueLen) - 20; \
- /* Spin and wait if the queue is actually too full */ \
- if (*(smesa->CurrentQueueLenPtr) < (wLen)) \
- WaitingFor3dIdle(smesa, wLen); \
- *(smesa->CurrentQueueLenPtr) -= wLen; \
-}
-
-enum _sis_verbose {
- VERBOSE_SIS_BUFFER = 0x1,
- VERBOSE_SIS_MEMORY = 0x2
-};
-
-extern GLboolean sisCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-extern void sisDestroyContext( __DRIcontextPrivate * );
-
-extern GLboolean sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean sisUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-void WaitEngIdle (sisContextPtr smesa);
-void Wait2DEngIdle (sisContextPtr smesa);
-void WaitingFor3dIdle(sisContextPtr smesa, int wLen);
-
-/* update to hw */
-extern void sis_update_texture_state( sisContextPtr smesa );
-extern void sis_update_render_state( sisContextPtr smesa );
-
-void sis_fatal_error (void);
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_dd.c b/xc/lib/GL/mesa/src/drv/sis/sis_dd.c
deleted file mode 100644
index aecc20e53..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_dd.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-#include "sis_context.h"
-#include "sis_dd.h"
-#include "sis_lock.h"
-#include "sis_alloc.h"
-#include "sis_state.h"
-
-#include "swrast/swrast.h"
-
-#include "utils.h"
-
-#define DRIVER_DATE "20030810"
-
-/* Return the width and height of the given buffer.
- */
-static void
-sisDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- LOCK_HARDWARE();
- *width = smesa->driDrawable->w;
- *height = smesa->driDrawable->h;
- UNLOCK_HARDWARE();
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *
-sisDDGetString( GLcontext *ctx, GLenum name )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = (smesa->AGPSize > 0);
-
- switch ( name )
- {
- case GL_VENDOR:
- return (GLubyte *)"Eric Anholt";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "SiS", DRIVER_DATE, agp_mode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Send all commands to the hardware. No-op, due to mmio.
- */
-static void
-sisDDFlush( GLcontext *ctx )
-{
- /* Do nothing */
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-static void
-sisDDFinish( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- sisDDFlush( ctx );
- WaitEngIdle( smesa );
-}
-
-void
-sisUpdateBufferSize( sisContextPtr smesa )
-{
- __GLSiSHardware *current = &smesa->current;
- __GLSiSHardware *prev = &smesa->prev;
- GLuint z_depth;
-
- /* XXX Should get the base offset of the frontbuffer from the X Server */
- smesa->frontOffset = smesa->driDrawable->x * smesa->bytesPerPixel +
- smesa->driDrawable->y * smesa->frontPitch;
-
- if ( smesa->width == smesa->driDrawable->w &&
- smesa->height == smesa->driDrawable->h )
- {
- return;
- }
-
- smesa->width = smesa->driDrawable->w;
- smesa->height = smesa->driDrawable->h;
- smesa->bottom = smesa->height - 1;
-
- if ( smesa->backbuffer )
- sisFreeBackbuffer( smesa );
- if ( smesa->depthbuffer )
- sisFreeZStencilBuffer( smesa );
-
- if ( smesa->glCtx->Visual.depthBits > 0 )
- sisAllocZStencilBuffer( smesa );
- if ( smesa->glCtx->Visual.doubleBufferMode )
- sisAllocBackbuffer( smesa );
-
- switch (smesa->zFormat)
- {
- case SiS_ZFORMAT_Z16:
- z_depth = 2;
- break;
- case SiS_ZFORMAT_Z32:
- case SiS_ZFORMAT_S8Z24:
- z_depth = 4;
- break;
- default:
- assert( 0 );
- }
-
- current->hwZ &= ~MASK_ZBufferPitch;
- current->hwZ |= smesa->width * z_depth >> 2;
- current->hwOffsetZ = smesa->depthOffset >> 2;
-
- if ((current->hwOffsetZ != prev->hwOffsetZ) || (current->hwZ != prev->hwZ)) {
- prev->hwOffsetZ = current->hwOffsetZ;
- prev->hwZ = current->hwZ;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
-
- sisUpdateClipping( smesa->glCtx );
-}
-
-/* Initialize the driver's misc functions.
- */
-void
-sisDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = sisDDGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = sisDDGetString;
- ctx->Driver.Finish = sisDDFinish;
- ctx->Driver.Flush = sisDDFlush;
- ctx->Driver.Error = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_dd.h b/xc/lib/GL/mesa/src/drv/sis/sis_dd.h
deleted file mode 100644
index 9ff5f5b00..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_dd.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_DD_H__
-#define __SIS_DD_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void sisUpdateBufferSize( sisContextPtr smesa );
-
-extern void sisDDInitDriverFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_debug.c b/xc/lib/GL/mesa/src/drv/sis/sis_debug.c
deleted file mode 100644
index 99cb09c25..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_debug.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-/*
- * dump HW states, set environment variable SIS_DEBUG
- * to enable these functions
- */
-
-#include <fcntl.h>
-#include <assert.h>
-
-#include "sis_context.h"
-
-/* for SiS 300/630/540 */
-#define MMIOLength (0x8FFF-0x8800+1)
-#define MMIO3DOffset (0x8800)
-#define FILE_NAME "300.dump"
-
-char *IOBase4Debug = 0;
-
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-
-GLint _empty[0x10000];
-
-void
-dump_agp (void *addr, int dword_count)
-{
- if (!getenv ("SIS_DEBUG"))
- return;
-
- {
- int i;
- FILE *file = fopen ("300agp.dump", "w");
-
- if (file)
- {
- for (i = 0; i < dword_count; i++)
- {
- fprintf (file, "%f\n", *(float *) addr);
- ((unsigned char *) addr) += 4;
- }
- fclose (file);
- }
- }
-}
-
-void
-d2f_once (GLcontext * ctx)
-{
- XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- static int serialNumber = -1;
-
- if (serialNumber == smesa->serialNumber)
- return;
- else
- serialNumber = smesa->serialNumber;
-
- d2f();
-}
-
-void
-d2f (void)
-{
- if (!getenv ("SIS_DEBUG"))
- return;
-
- /* dump 0x8800 - 0x8AFF */
- {
- int fh;
- int rval;
- void *addr = IOBase4Debug + MMIO3DOffset;
-
- assert (IOBase4Debug);
-
- if ((fh = open (FILE_NAME, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = write (fh, addr, MMIOLength);
- assert (rval != -1);
- close (fh);
- }
- }
-}
-
-/* dump to HW */
-void
-d2h (char *file_name)
-{
- int fh;
- int rval;
- void *addr[MMIOLength];
-
- if (!getenv ("SIS_DEBUG"))
- return;
-
- if ((fh = open (file_name, O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = read (fh, addr, MMIOLength);
- assert (rval != -1);
- close (fh);
- }
- memcpy (IOBase4Debug + MMIO3DOffset, addr, MMIOLength);
-
-}
-
-/* dump video memory to file */
-void
-dvidmem (unsigned char *addr, int size)
-{
- int fh;
- int rval;
- static char *file_name = "vidmem.dump";
-
- if (!getenv ("SIS_DEBUG"))
- return;
-
- if ((fh = open (file_name, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = write (fh, addr, size);
- assert (rval != -1);
- close (fh);
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_debug.h b/xc/lib/GL/mesa/src/drv/sis/sis_debug.h
deleted file mode 100644
index 5e2b30912..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_debug.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.h,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-#ifndef _sis_debug_h_
-#define _sis_debug_h_
-
-void dump_agp (void *addr, int dword_count);
-void d2f (void);
-void d2f_once (GLcontext * ctx);
-void d2h (char *file_name);
-void dvidmem (unsigned char *addr, int size);
-extern char *IOBase4Debug;
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_fog.c b/xc/lib/GL/mesa/src/drv/sis/sis_fog.c
deleted file mode 100644
index 74b888b1a..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_fog.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_fog.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "swrast/swrast.h"
-
-#include "mmath.h"
-
-static GLint convertFtToFogFt( GLfloat dwInValue );
-
-void
-sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- float fArg;
- GLint fogColor;
-
- switch (pname)
- {
- case GL_FOG_MODE:
- current->hwFog &= ~MASK_FogMode;
- switch (ctx->Fog.Mode)
- {
- case GL_LINEAR:
- current->hwFog |= FOGMODE_LINEAR;
- break;
- case GL_EXP:
- current->hwFog |= FOGMODE_EXP;
- break;
- case GL_EXP2:
- current->hwFog |= FOGMODE_EXP2;
- break;
- }
- if (current->hwFog != prev->hwFog) {
- prev->hwFog = current->hwFog;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_DENSITY:
- current->hwFogDensity = convertFtToFogFt( ctx->Fog.Density );
- if (current->hwFogDensity != prev->hwFogDensity) {
- prev->hwFogDensity = current->hwFogDensity;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- fArg = 1.0 / (ctx->Fog.End - ctx->Fog.Start);
- current->hwFogInverse = doFPtoFixedNoRound( fArg, 10 );
- if (pname == GL_FOG_END)
- {
- if (smesa->Chipset == PCI_CHIP_SIS300)
- current->hwFogFar = doFPtoFixedNoRound( ctx->Fog.End, 10 );
- else
- current->hwFogFar = doFPtoFixedNoRound( ctx->Fog.End, 6 );
- }
- if (current->hwFogFar != prev->hwFogFar ||
- current->hwFogInverse != prev->hwFogInverse)
- {
- prev->hwFogFar = current->hwFogFar;
- prev->hwFogInverse = current->hwFogInverse;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_INDEX:
- /* TODO */
- break;
- case GL_FOG_COLOR:
- fogColor = FLOAT_TO_UBYTE( ctx->Fog.Color[0] ) << 16;
- fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[1] ) << 8;
- fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[2] );
- current->hwFog &= 0xff000000;
- current->hwFog |= fogColor;
- if (current->hwFog != prev->hwFog) {
- prev->hwFog = current->hwFog;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- }
-}
-
-GLint
-doFPtoFixedNoRound( GLfloat dwInValue, int nFraction )
-{
- GLint dwMantissa;
- int nTemp;
- union { int i; float f; } u;
- GLint val;
-
- u.f = dwInValue;
- val = u.i;
-
- if (val == 0)
- return 0;
- nTemp = (int) (val & 0x7F800000) >> 23;
- nTemp = nTemp - 127 + nFraction - 23;
- dwMantissa = (val & 0x007FFFFF) | 0x00800000;
-
- if (nTemp < -25)
- return 0;
- if (nTemp > 0)
- dwMantissa <<= nTemp;
- else {
- nTemp = -nTemp;
- dwMantissa >>= nTemp;
- }
- if (val & 0x80000000)
- dwMantissa = ~dwMantissa + 1;
- return dwMantissa;
-}
-
-/* s[8].23->s[7].10 */
-static GLint
-convertFtToFogFt( GLfloat dwInValue )
-{
- GLint dwMantissa, dwExp;
- GLint dwRet;
- union { int i; float f; } u;
- GLint val;
-
- u.f = dwInValue;
- val = u.i;
-
- if (val == 0)
- return 0;
-
- /* ----- Standard float Format: s[8].23 -----
- * ----- = (-1)^S * 2^(E - 127) * (1 + M / 2^23) -----
- * ----- = (-1)^S * 2^((E-63) - 64) * (1 + (M/2^13) / 2^10) -----
- * ----- Density float Format: s[7].10 -----
- * ----- New Exponential = E - 63 -----
- * ----- New Mantissa = M / 2^13 -----
- * ----- -----
- */
-
- dwExp = (val & 0x7F800000) >> 23;
- dwExp -= 63;
-
- if (dwExp < 0)
- return 0;
-
- if (dwExp <= 0x7F)
- dwMantissa = (val & 0x007FFFFF) >> (23 - 10);
- else {
- /* ----- To Return +Max(or -Max) ----- */
- dwExp = 0x7F;
- dwMantissa = 0x3FF;
- }
-
- dwRet = (val & 0x80000000) >> (31 - 17); /* Shift Sign Bit */
-
- dwRet |= (dwExp << 10) | dwMantissa;
-
- return dwRet;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_lock.c b/xc/lib/GL/mesa/src/drv/sis/sis_lock.c
deleted file mode 100644
index 5e6a0d468..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_lock.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "context.h"
-#include "sis_context.h"
-#include "sis_lock.h"
-#include "sis_dd.h"
-#include "sis_state.h"
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void
-sisGetLock( sisContextPtr smesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = smesa->driDrawable;
- __DRIscreenPrivate *sPriv = smesa->driScreen;
- SISSAREAPrivPtr sarea = smesa->sarea;
-
- drmGetLock( smesa->driFd, smesa->hHWContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( smesa->lastStamp != dPriv->lastStamp ) {
- sisUpdateBufferSize( smesa );
- sisUpdateClipping( smesa->glCtx );
- sisDDDrawBuffer( smesa->glCtx, smesa->glCtx->Color.DrawBuffer );
- smesa->lastStamp = dPriv->lastStamp;
- }
-
- if ( sarea->CtxOwner != smesa->hHWContext ) {
- sarea->CtxOwner = smesa->hHWContext;
- smesa->GlobalFlag = GFLAG_ALL;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_lock.h b/xc/lib/GL/mesa/src/drv/sis/sis_lock.h
deleted file mode 100644
index fef993196..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_lock.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_LOCK_H
-#define __SIS_LOCK_H
-
-extern void sisGetLock( sisContextPtr smesa, GLuint flags );
-
-#ifdef DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-#define DEBUG_LOCK() \
- do { \
- prevLockFile=(__FILE__); \
- prevLockLine=(__LINE__); \
- } while (0)
-#define DEBUG_RESET() \
- do { \
- prevLockFile=NULL; \
- prevLockLine=0; \
- } while (0)
-#define DEBUG_CHECK_LOCK() \
- do { \
- if(prevLockFile){ \
- fprintf(stderr, "LOCK SET : %s:%d\n", __FILE__, __LINE__); \
- } \
- } while (0)
-#else
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-#endif
-
-/* Lock the hardware using the global current context */
-#define LOCK_HARDWARE() \
- do { \
- char __ret=0; \
- mEndPrimitive(); \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( smesa->driHwLock, smesa->hHWContext, \
- (DRM_LOCK_HELD | smesa->hHWContext), __ret ); \
- if ( __ret != 0 ) \
- sisGetLock( smesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware using the global current context */
-#define UNLOCK_HARDWARE() \
- do { \
- mEndPrimitive(); \
- DRM_UNLOCK(smesa->driFd, smesa->driHwLock, \
- smesa->hHWContext); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_reg.h b/xc/lib/GL/mesa/src/drv/sis/sis_reg.h
deleted file mode 100644
index 378692fc1..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_reg.h
+++ /dev/null
@@ -1,858 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_reg.h,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef _sis_reg_h_
-#define _sis_reg_h_
-
-/*
- * Define All the Register Address of 6327
- */
-
-#define REG_CommandQueue 0x8240
-
-#define REG_3D_TSFSa 0x8800
-#define REG_3D_TSZa 0x8804
-#define REG_3D_TSXa 0x8808
-#define REG_3D_TSYa 0x880C
-#define REG_3D_TSARGBa 0x8810
-#define REG_3D_TSWGa 0x8814
-#define REG_3D_TSUAa 0x8818
-#define REG_3D_TSVAa 0x881C
-#define REG_3D_TSUBa 0x8820
-#define REG_3D_TSVBa 0x8824
-#define REG_3D_TSUCa 0x8828
-#define REG_3D_TSVCa 0x882C
-
-#define REG_3D_TSFSb 0x8830
-#define REG_3D_TSZb 0x8834
-#define REG_3D_TSXb 0x8838
-#define REG_3D_TSYb 0x883C
-#define REG_3D_TSARGBb 0x8840
-#define REG_3D_TSWGb 0x8844
-#define REG_3D_TSUAb 0x8848
-#define REG_3D_TSVAb 0x884C
-#define REG_3D_TSUBb 0x8850
-#define REG_3D_TSVBb 0x8854
-#define REG_3D_TSUCb 0x8858
-#define REG_3D_TSVCb 0x885C
-
-#define REG_3D_TSFSc 0x8860
-#define REG_3D_TSZc 0x8864
-#define REG_3D_TSXc 0x8868
-#define REG_3D_TSYc 0x886C
-#define REG_3D_TSARGBc 0x8870
-#define REG_3D_TSWGc 0x8874
-#define REG_3D_TSUAc 0x8878
-#define REG_3D_TSVAc 0x887C
-#define REG_3D_TSUBc 0x8880
-#define REG_3D_TSVBc 0x8884
-#define REG_3D_TSUCc 0x8888
-#define REG_3D_TSVCc 0x888C
-
-/*
- * REG_3D_AGPCmdSetting (89e4h-89f7)
- */
-#define REG_3D_AGPCmBase 0x89E4
-#define REG_3D_AGPRmDwNum 0x89E8
-#define REG_3D_AGPTtDwNum 0x89EC
-#define REG_3D_AGPCmFire 0x89F0
-
-#define REG_3D_ParsingSet 0x89F4
-#define REG_3D_PrimitiveSet 0x89F8
-#define REG_3D_ShadeMode 0x89F8
-#define REG_3D_EngineFire 0x89FC
-#define REG_3D_EngineStatus 0x89FC
-#define REG_3D_TEnable 0x8A00
-#define REG_3D_TEnable2 0x8A04
-
-#define REG_3D_ZSet 0x8A08
-#define REG_3D_ZBias 0x8A0C
-#define REG_3D_ZStWriteMask 0x8A10
-
-#define REG_3D_ZAddress 0x8A14
-#define REG_3D_AlphaSet 0x8A18
-#define REG_3D_AlphaAddress 0x8A1C
-#define REG_3D_DstSet 0x8A20
-#define REG_3D_DstAlphaWriteMask 0x8A24
-
-#define REG_3D_DstAddress 0x8A28
-
-#define REG_3D_LinePattern 0x8A2C
-
-#define REG_3D_FogSet 0x8A30
-
-#define REG_3D_FogFarDistance 0x8A34
-#define REG_3D_FogInverseDistance 0x8A38
-#define REG_3D_FogFactorDensity 0x8A3C
-
-#define REG_3D_StencilSet 0x8A44
-#define REG_3D_StencilSet2 0x8A48
-#define REG_3D_StencilAddress 0x8A4C
-
-#define REG_3D_DstBlendMode 0x8A50
-#define REG_3D_SrcBlendMode 0x8A50
-#define REG_3D_ClipTopBottom 0x8A54
-#define REG_3D_ClipLeftRight 0x8A58
-
-#define REG_3D_Brightness 0x8A5C
-
-#define REG_3D_BumpMapSet 0x8A68
-#define REG_3D_BumpMapAddress 0x8A6C
-#define REG_3D_BumpMapPitch 0x8A70
-#define REG_3D_BumpMapMatrix0 0x8A74
-#define REG_3D_BumpMapMatrix1 0x8A78
-
-/*
- * Define the Texture Register Address of 6326
- */
-#define REG_3D_TextureSet 0x8A7C
-#define REG_3D_TextureWidthHeight 0x8A7C
-#define REG_3D_TextureMip 0x8A80
-
-#define REG_3D_TextureTransparencyColorHigh 0x8A84
-#define REG_3D_TextureTransparencyColorLow 0x8A88
-#define REG_3D_TextureBorderColor 0x8A8C
-#define REG_3D_TextureAddress0 0x8A90
-#define REG_3D_TextureAddress1 0x8A94
-#define REG_3D_TextureAddress2 0x8A98
-#define REG_3D_TextureAddress3 0x8A9C
-#define REG_3D_TextureAddress4 0x8AA0
-#define REG_3D_TextureAddress5 0x8AA4
-#define REG_3D_TextureAddress6 0x8AA8
-#define REG_3D_TextureAddress7 0x8AAC
-#define REG_3D_TextureAddress8 0x8AB0
-#define REG_3D_TextureAddress9 0x8AB4
-#define REG_3D_TextureAddress10 0x8AB8
-#define REG_3D_TextureAddress11 0x8ABC
-#define REG_3D_TexturePitch0 0x8AC0
-#define REG_3D_TexturePitch1 0x8AC0
-#define REG_3D_TexturePitch2 0x8AC4
-#define REG_3D_TexturePitch3 0x8AC4
-#define REG_3D_TexturePitch4 0x8AC8
-#define REG_3D_TexturePitch5 0x8AC8
-#define REG_3D_TexturePitch6 0x8ACC
-#define REG_3D_TexturePitch7 0x8ACC
-#define REG_3D_TexturePitch8 0x8AD0
-#define REG_3D_TexturePitch9 0x8AD0
-#define REG_3D_TexturePitch10 0x8AD4
-
-#define REG_3D_Texture1Set 0x8ADC
-#define REG_3D_Texture1WidthHeight 0x8ADC
-#define REG_3D_Texture1Mip 0x8AE0
-
-#define REG_3D_Texture1TransparencyColorHigh 0x8AE4
-#define REG_3D_Texture1TransparencyColorLow 0x8AE8
-#define REG_3D_Texture1BorderColor 0x8AEC
-#define REG_3D_Texture1Address0 0x8AF0
-#define REG_3D_Texture1Address1 0x8AF4
-#define REG_3D_Texture1Address2 0x8AF8
-#define REG_3D_Texture1Address3 0x8AFC
-#define REG_3D_Texture1Address4 0x8B00
-#define REG_3D_Texture1Address5 0x8B04
-#define REG_3D_Texture1Address6 0x8B08
-#define REG_3D_Texture1Address7 0x8B0C
-#define REG_3D_Texture1Address8 0x8B10
-#define REG_3D_Texture1Address9 0x8B14
-#define REG_3D_Texture1Address10 0x8B18
-#define REG_3D_Texture1Address11 0x8B1C
-#define REG_3D_Texture1Pitch0 0x8B20
-#define REG_3D_Texture1Pitch1 0x8B20
-#define REG_3D_Texture1Pitch2 0x8B24
-#define REG_3D_Texture1Pitch3 0x8B24
-#define REG_3D_Texture1Pitch4 0x8B28
-#define REG_3D_Texture1Pitch5 0x8B28
-#define REG_3D_Texture1Pitch6 0x8B2C
-#define REG_3D_Texture1Pitch7 0x8B2C
-#define REG_3D_Texture1Pitch8 0x8B30
-#define REG_3D_Texture1Pitch9 0x8B30
-#define REG_3D_Texture1Pitch10 0x8B34
-
-#define REG_3D_TextureBlendFactor 0x8B3C
-#define REG_3D_TextureColorBlendSet0 0x8B40
-#define REG_3D_TextureColorBlendSet1 0x8B44
-#define REG_3D_TextureAlphaBlendSet0 0x8B48
-#define REG_3D_TextureAlphaBlendSet1 0x8B4C
-/*
- * Define the End of Primitive List of 6326
- */
-#define REG_3D_EndPrimitiveList 0X8B50
-
-
-/*
- * Define the Stipple Register Address of 6326
- */
-#define REG_3D_Stipple0 0X8B60
-
-#define REG_3D_TexturePalette 0x8C00
-
-/*
- * REG_CommandQueue -- (8240h-8243h)
- */
-#define MASK_QueueLen 0x0000ffff
-#define SiS_EngIdle2d 0x80000000
-#define SiS_EngIdle 0xe0000000
-#define MASK_EngState 0xf0000000
-
-/*
- * REG_3D_ParsingSet -- Define Parsing Mask (89F4h-89F7h)
- */
-#define MASK_VertexDWSize 0xF0000000
-#define MASK_VertexDataFormat 0x0FFF0000
-#define MASK_PsVertex_HAS_RHW 0x08000000
-#define MASK_PsVertex_HAS_NORMALXYZ 0x04000000
-#define MASK_PsVertex_HAS_DIFFUSE 0x02000000
-#define MASK_PsVertex_HAS_SPECULAR 0x01000000
-#define MASK_PsUVSet 0x00FF0000
-#define MASK_PsVertex_HAS_1SetUV 0x00800000
-#define MASK_PsVertex_HAS_2SetUV 0x00C00000
-#define MASK_PsVertex_HAS_3SetUV 0x00E00000
-#define MASK_PsVertex_HAS_UVSet1 0x00800000
-#define MASK_PsVertex_HAS_UVSet2 0x00400000
-#define MASK_PsVertex_HAS_UVSet3 0x00200000
-#define MASK_PsCullDirection_CCW 0x00008000
-#define MASK_PsShadingMode 0x00007000
-/* XXX Shading modes just a guess, but seem to work*/
-#define MASK_PsShadingFlatA 0x00001000
-#define MASK_PsShadingFlatB 0x00002000
-#define MASK_PsShadingFlatC 0x00003000
-#define MASK_PsShadingSmooth 0x00004000
-#define MASK_PsTextureFrom 0x000003F0
-#define MASK_PsTexture0FromA 0x00000000
-#define MASK_PsTexture1FromA 0x00000000
-#define MASK_PsTexture1FromB 0x00000040
-#define MASK_PsBumpTextureFromA 0x00000000
-#define MASK_PsBumpTextureFromB 0x00000010
-#define MASK_PsBumpTextureFromC 0x00000020
-#define MASK_PsDataType 0x0000000F
-#define MASK_PsPointList 0x00000000
-#define MASK_PsLineList 0x00000004
-#define MASK_PsLineStrip 0x00000005
-#define MASK_PsTriangleList 0x00000008
-#define MASK_PsTriangleStrip 0x00000009
-#define MASK_PsTriangleFan 0x0000000A
-
-/*
- * REG_3D_PrimitiveSet -- Define Fire Primitive Mask (89F8h-89FBh)
- */
-#define MASK_DrawPrimitiveCommand 0x00000007
-#define MASK_SetFirePosition 0x00001F00
-#define MASK_BumpTextureFrom 0x00030000
-#define MASK_Texture1From 0x000C0000
-#define MASK_Texture0From 0x00300000
-#define MASK_ShadingMode 0x07000000
-#define MASK_CullDirection 0x08000000
-
-#define OP_3D_POINT_DRAW 0x00000000
-#define OP_3D_LINE_DRAW 0x00000001
-#define OP_3D_TRIANGLE_DRAW 0x00000002
-
-#define OP_3D_DIRECTION_RIGHT 0x00000000
-#define OP_3D_DIRECTION_LEFT 0x00000100
-#define OP_3D_DIRECTION_HORIZONTAL 0x00000000
-#define OP_3D_DIRECTION_VERTICAL 0x00000100
-
-#define OP_3D_FIRE_TFIRE 0x00000000
-#define OP_3D_FIRE_TSARGBa 0x00000100
-#define OP_3D_FIRE_TSWa 0x00000200
-#define OP_3D_FIRE_TSVAa 0x00000300
-#define OP_3D_FIRE_TSVBa 0x00000400
-#define OP_3D_FIRE_TSVCa 0x00000500
-
-#define OP_3D_FIRE_TSARGBb 0x00000900
-#define OP_3D_FIRE_TSWb 0x00000a00
-#define OP_3D_FIRE_TSVAb 0x00000b00
-#define OP_3D_FIRE_TSVBb 0x00000c00
-#define OP_3D_FIRE_TSVCb 0x00000d00
-
-#define OP_3D_FIRE_TSARGBc 0x00001100
-#define OP_3D_FIRE_TSWc 0x00001200
-#define OP_3D_FIRE_TSVAc 0x00001300
-#define OP_3D_FIRE_TSVBc 0x00001400
-#define OP_3D_FIRE_TSVCc 0x00001500
-
-#define OP_3D_Texture0FromA 0x00000000
-#define OP_3D_Texture0FromB 0x00100000
-#define OP_3D_Texture0FromC 0x00200000
-#define OP_3D_Texture1FromA 0x00000000
-#define OP_3D_Texture1FromB 0x00040000
-#define OP_3D_Texture1FromC 0x00080000
-#define OP_3D_TextureBumpFromA 0x00000000
-#define OP_3D_TextureBumpFromB 0x00010000
-#define OP_3D_TextureBumpFromC 0x00020000
-
-#define OP_3D_CullDirection_CCW 0x08000000
-
-#define SHADE_FLAT_VertexA 0x01000000
-#define SHADE_FLAT_VertexB 0x02000000
-#define SHADE_FLAT_VertexC 0x03000000
-#define SHADE_GOURAUD 0x04000000
-
-/*
- * Define Command Queue Length Mask (89FCh-89FF)
- */
-#define MASK_CmdQueueLen 0x0FFF0000
-
-/*
- * REG_3D_TEnable -- Define Capility Enable Mask (8A00h-8A03h)
- */
-#define MASK_DitherEnable 0x00000001
-#define MASK_BlendEnable 0x00000002
-#define MASK_FogTestEnable 0x00000004
-#define MASK_FogEnable 0x00000008
-#define MASK_SpecularEnable 0x00000010
-#define MASK_FogPerspectiveEnable 0x00000020
-#define MASK_TextureCacheClear 0x00000040
-#define MASK_TextureCacheEnable 0x00000080
-#define MASK_BumpMapEnable 0x00000100
-#define MASK_TexturePerspectiveEnable 0x00000200
-#define MASK_TextureEnable 0x00000400
-#define MASK_CullEnable 0x00000800
-#define MASK_TextureNumUsed 0x0000F000
-#define MASK_AlphaBufferEnable 0x00010000
-#define MASK_AlphaTestEnable 0x00020000
-#define MASK_AlphaWriteEnable 0x00040000
-#define MASK_ZTestEnable 0x00080000
-#define MASK_ZWriteEnable 0x00100000
-#define MASK_StencilBufferEnable 0x00200000
-#define MASK_StencilTestEnable 0x00400000
-#define MASK_StencilWriteEnable 0x00800000
-#define MASK_Texture0TransparencyEnable 0x01000000
-#define MASK_Texture1TransparencyEnable 0x02000000
-#define MASK_TextureAWrapUCorrection 0x04000000
-#define MASK_TextureAWrapVCorrection 0x08000000
-#define MASK_TextureBWrapUCorrection 0x10000000
-#define MASK_TextureBWrapVCorrection 0x20000000
-#define MASK_TextureCWrapUCorrection 0x40000000
-#define MASK_TextureCWrapVCorrection 0x80000000
-
-/*
- * REG_3D_TEnable2 -- Define Capility Enable Mask2 (8A04h-8A07h)
- */
-#define MASK_Texture0BlockTextureEnable 0x00000001
-#define MASK_Texture1BlockTextureEnable 0x00000002
-#define MASK_Texture0AnisotropicEnable 0x00000010
-#define MASK_Texture1AnisotropicEnable 0x00000020
-#define MASK_TextureMipmapBiasEnable 0x00000040
-#define MASK_LinePatternEnable 0x00000100
-#define MASK_StippleAlphaEnable 0x00000200
-#define MASK_StippleEnable 0x00000400
-#define MASK_AntiAliasEnable 0x00000800
-#define MASK_ZMaskWriteEnable 0x00001000
-#define MASK_StencilMaskWriteEnable 0x00002000
-#define MASK_AlphaMaskWriteEnable 0x00004000
-#define MASK_ColorMaskWriteEnable 0x00008000
-#define MASK_ZCacheClear 0x00010000
-#define MASK_ZCacheEnable 0x00020000
-#define MASK_StencilCacheClear 0x00040000
-#define MASK_StencilCacheEnable 0x00080000
-#define MASK_AlphaCacheClear 0x00100000
-#define MASK_AlphaCacheEnable 0x00200000
-#define MASK_ColorCacheClear 0x00400000
-#define MASK_ColorCacheEnable 0x00800000
-
-/*
- * REG_3D_ZSet -- Define Z Buffer Setting Mask (8A08h-8A0Bh)
- */
-#define MASK_ZBufferPitch 0x00000FFF
-#define MASK_ZTestMode 0x00070000
-#define MASK_ZBufferInSystem 0x00080000
-#define MASK_ZBufferFormat 0x01F00000
-
-#define SiS_Z_COMP_NEVER 0x00000000
-#define SiS_Z_COMP_S_LT_B 0x00010000
-#define SiS_Z_COMP_S_EQ_B 0x00020000
-#define SiS_Z_COMP_S_LE_B 0x00030000
-#define SiS_Z_COMP_S_GT_B 0x00040000
-#define SiS_Z_COMP_S_NE_B 0x00050000
-#define SiS_Z_COMP_S_GE_B 0x00060000
-#define SiS_Z_COMP_ALWAYS 0x00070000
-
-#define SiS_ZFORMAT_Z16 0x00000000
-#define SiS_ZFORMAT_Z16_INT 0x00100000
-#define SiS_ZFORMAT_S1Z15 0x00400000
-#define SiS_ZFORMAT_S1Z15_INT 0x00500000
-#define SiS_ZFORMAT_Z32 0x00800000
-#define SiS_ZFORMAT_S1Z31 0x00C00000
-#define SiS_ZFORMAT_S2Z30 0x00D00000
-#define SiS_ZFORMAT_S4Z28 0x00E00000
-#define SiS_ZFORMAT_S8Z24 0x00F00000
-#define SiS_ZFORMAT_FZ30 0x01800000
-#define SiS_ZFORMAT_FS1Z30 0x01C00000
-#define SiS_ZFORMAT_FS2Z30 0x01D00000
-
-/*
- * REG_3D_ZBias -- Define Z Buffer Setting Mask (8A0Ch-8A0Fh)
- */
-#define MASK_ZBias 0xFFFFFFFF
-
-/*
- * REG_3D_ZStWriteMask -- Define Z and Stencil Buffer Mask (8A10h-8A13h)
- */
-#define MASK_ZWriteMask 0x00FFFFFF
-
-/*
- * REG_3D_ZAddress -- Define Z Buffer Base Address(8A14h-8A17h)
- */
-#define MASK_ZAddress 0xFFFFFFFF
-
-/*
- * REG_3D_AlphaSet -- Define Alpha Buffer Setting Mask (8A18h-8A1Bh)
- */
-#define MASK_AlphaBufferPitch 0x000003FF
-#define MASK_AlphaRefValue 0x00FF0000
-#define MASK_AlphaTestMode 0x07000000
-#define MASK_AlphaBufferInSystem 0x08000000
-#define MASK_AlphaBufferFormat 0x30000000
-
-#define SiS_ALPHA_NEVER 0x00000000
-#define SiS_ALPHA_LESS 0x01000000
-#define SiS_ALPHA_EQUAL 0x02000000
-#define SiS_ALPHA_LEQUAL 0x03000000
-#define SiS_ALPHA_GREATER 0x04000000
-#define SiS_ALPHA_NOTEQUAL 0x05000000
-#define SiS_ALPHA_GEQUAL 0x06000000
-#define SiS_ALPHA_ALWAYS 0x07000000
-
-/*
- * REG_3D_AlphaAddress -- Define Alpha Buffer Base Address(8A1Ch-8A1Fh)
- */
-#define MASK_AlphaAddress 0xFFFFFFFF
-
-/*
- * REG_3D_DstSet -- Define Destination Buffer Setting Mask (8A20h-8A23h)
- */
-#define MASK_DstBufferPitch 0x00000FFF
-#define MASK_DstBufferFormat 0x000F0000
-#define MASK_DstBufferBitDepth 0x00300000
-#define MASK_DstBufferRgbOrder 0x00400000
-#define MASK_DstBufferInSystem 0x00800000
-#define MASK_Dst7BitFormat 0x007F0000
-#define MASK_ROP2 0x0F000000
-
-#define DST_FORMAT_RGB_555 0x00100000
-#define DST_FORMAT_RGB_565 0x00110000
-#define DST_FORMAT_ARGB_1555 0x00120000
-#define DST_FORMAT_ARGB_4444 0x00130000
-#define DST_FORMAT_ARGB_1888 0x00300000
-#define DST_FORMAT_ARGB_2888 0x00310000
-#define DST_FORMAT_ARGB_4888 0x00320000
-#define DST_FORMAT_ARGB_8888 0x00330000
-#define DST_FORMAT_ARGB_0888 0x00340000
-
-#define DST_FORMAT_BGR_555 0x00500000
-#define DST_FORMAT_BGR_565 0x00510000
-#define DST_FORMAT_ABGR_1555 0x00520000
-#define DST_FORMAT_ABGR_4444 0x00530000
-#define DST_FORMAT_ABGR_1888 0x00700000
-#define DST_FORMAT_ABGR_2888 0x00710000
-#define DST_FORMAT_ABGR_4888 0x00720000
-#define DST_FORMAT_ABGR_8888 0x00730000
-#define DST_FORMAT_ABGR_0888 0x00740000
-
-#define LOP_CLEAR 0x00000000
-#define LOP_NOR 0x01000000
-#define LOP_AND_INVERTED 0x02000000
-#define LOP_COPY_INVERTED 0x03000000
-#define LOP_AND_REVERSE 0x04000000
-#define LOP_INVERT 0x05000000
-#define LOP_XOR 0x06000000
-#define LOP_NAND 0x07000000
-#define LOP_AND 0x08000000
-#define LOP_EQUIV 0x09000000
-#define LOP_NOOP 0x0a000000
-#define LOP_OR_INVERTED 0x0b000000
-#define LOP_COPY 0x0c000000
-#define LOP_OR_REVERSE 0x0d000000
-#define LOP_OR 0x0e000000
-#define LOP_SET 0x0f000000
-
-/*
- * REG_3D_DstAlphaWriteMask -- Define Destination/Alpha Buffer Write Mask (8A24h-8A27h)
- */
-#define MASK_ColorWriteMask 0x00FFFFFF
-#define MASK_AlphaWriteMask 0xFF000000
-
-/*
- * REG_3D_DstAddress -- Define Destination Buffer Base Address(8A1Ch-8A1Fh)
- */
-#define MASK_DstAddress 0xFFFFFFFF
-
-/*
- * REG_3D_LinePattern -- Define Line Pattern (8A2Ch-8A2Fh)
- */
-#define MASK_LinePatternRepeatFactor 0x00007FFF
-#define MASK_LinePatternLastPixelFlag 0x00008000
-#define MASK_LinePattern 0xFFFF0000
-
-/*
- * REG_3D_FogSet -- Define Fog Mask (8A30h-8A33h)
- */
-#define MASK_FogColor 0x00FFFFFF
-#define MASK_FogMode 0x07000000
-#define MASK_FogZLookup 0x08000000
-
-#define FOGMODE_CHEAP 0x04000000
-#define FOGMODE_LINEAR 0x05000000
-#define FOGMODE_EXP 0x06000000
-#define FOGMODE_EXP2 0x07000000
-
-/*
- * REG_3D_FogStartEnd -- Define Fog Start End Setting (0x8A34 - 0x8A37)
- */
-#define MASK_FogFarDistance 0x0007FFFF
-
-/*
- * REG_3D_FogStartEnd -- Define Fog End Setting (0x8A38 - 0x8A3B)
- */
-#define MASK_FogInvFarDistance 0x0007FFFF
-
-/*
- * REG_3D_FogFactorDensity (0x8A3C - 0x8A3F)
- */
-#define MASK_FogDensity 0x0003FFFF
-#define MASK_FogFactor 0xFF000000
-
-/*
- * REG_3D_StencilSet -- Define stencil test (8A44h-8A47h)
- */
-#define MASK_StencilValueMask 0x000000ff
-#define MASK_StencilRefMask 0x0000ff00
-#define MASK_StencilTestMode 0x07000000
-#define MASK_StencilBufferInSystem 0x08000000
-#define MASK_StencilFormat 0x30000000
-
-#define SiS_STENCIL_NEVER 0x00000000
-#define SiS_STENCIL_LESS 0x01000000
-#define SiS_STENCIL_EQUAL 0x02000000
-#define SiS_STENCIL_LEQUAL 0x03000000
-#define SiS_STENCIL_GREATER 0x04000000
-#define SiS_STENCIL_NOTEQUAL 0x05000000
-#define SiS_STENCIL_GEQUAL 0x06000000
-#define SiS_STENCIL_ALWAYS 0x07000000
-
-#define STENCIL_FORMAT_1 0x00000000
-#define STENCIL_FORMAT_2 0x10000000
-#define STENCIL_FORMAT_4 0x20000000
-#define STENCIL_FORMAT_8 0x30000000
-
-/*
- * REG_3D_StencilSet2 -- Define stencil test (8A4h-8A47h)
- */
-#define MASK_StencilBufferPitch 0x00000FFF
-#define MASK_StencilZPassOp 0x00007000
-#define MASK_StencilZFailOp 0x00070000
-#define MASK_StencilFailOp 0x00700000
-#define MASK_StencilWriteMask 0xFF000000
-
-#define SiS_SFAIL_KEEP 0x00000000
-#define SiS_SFAIL_ZERO 0x00100000
-#define SiS_SFAIL_REPLACE 0x00200000
-#define SiS_SFAIL_INVERT 0x00500000
-#define SiS_SFAIL_INCR 0x00600000
-#define SiS_SFAIL_DECR 0x00700000
-
-#define SiS_SPASS_ZFAIL_KEEP 0x00000000
-#define SiS_SPASS_ZFAIL_ZERO 0x00010000
-#define SiS_SPASS_ZFAIL_REPLACE 0x00020000
-#define SiS_SPASS_ZFAIL_INVERT 0x00050000
-#define SiS_SPASS_ZFAIL_INCR 0x00060000
-#define SiS_SPASS_ZFAIL_DECR 0x00070000
-
-#define SiS_SPASS_ZPASS_KEEP 0x00000000
-#define SiS_SPASS_ZPASS_ZERO 0x00001000
-#define SiS_SPASS_ZPASS_REPLACE 0x00002000
-#define SiS_SPASS_ZPASS_INVERT 0x00005000
-#define SiS_SPASS_ZPASS_INCR 0x00006000
-#define SiS_SPASS_ZPASS_DECR 0x00007000
-
-/*
- * REG_3D_DstBlendMode (0x8A50 - 0x8A53)
- */
-#define MASK_SrcBlendMode 0x0000000F
-#define MASK_DstBlendMode 0x000000F0
-
-#define SiS_D_ZERO 0x00000000
-#define SiS_D_ONE 0x00000010
-#define SiS_D_SRC_COLOR 0x00000020
-#define SiS_D_ONE_MINUS_SRC_COLOR 0x00000030
-#define SiS_D_SRC_ALPHA 0x00000040
-#define SiS_D_ONE_MINUS_SRC_ALPHA 0x00000050
-#define SiS_D_DST_ALPHA 0x00000060
-#define SiS_D_ONE_MINUS_DST_ALPHA 0x00000070
-#define SiS_D_DST_COLOR 0x00000080
-#define SiS_D_ONE_MINUS_DST_COLOR 0x00000090
-#define SiS_D_SRC_ALPHA_SAT 0x000000a0
-
-#define SiS_S_ZERO 0x00000000
-#define SiS_S_ONE 0x00000001
-#define SiS_S_SRC_COLOR 0x00000002
-#define SiS_S_ONE_MINUS_SRC_COLOR 0x00000003
-#define SiS_S_SRC_ALPHA 0x00000004
-#define SiS_S_ONE_MINUS_SRC_ALPHA 0x00000005
-#define SiS_S_DST_ALPHA 0x00000006
-#define SiS_S_ONE_MINUS_DST_ALPHA 0x00000007
-#define SiS_S_DST_COLOR 0x00000008
-#define SiS_S_ONE_MINUS_DST_COLOR 0x00000009
-#define SiS_S_SRC_ALPHA_SATURATE 0x0000000a
-#define SiS_S_BOTH_SRC_ALPHA 0x0000000b
-#define SiS_S_BOTH_ONE_MINUS_SRC_ALPHA 0x0000000c
-
-/*
- * REG_3D_DstBlendMode (0x8A54 - 0x8A57)
- */
-#define MASK_BottomClip 0x00001FFF
-#define MASK_TopClip 0x03FFE000
-
-/*
- * REG_3D_DstBlendMode (0x8A58 - 0x8A5B)
- */
-#define MASK_RightClip 0x00001FFF
-#define MASK_LeftClip 0x03FFE000
-
-/*
- * REG_3D_TextureSet (0x8A7C - 0x8A7F)
- * REG_3D_Texture1Set (0x8ADC - 0x8ADF)
- */
-#define MASK_TextureHeight 0x0000000F
-#define MASK_TextureWidth 0x000000F0
-#define MASK_TextureLevel 0x00000F00
-#define MASK_TextureSignYUVFormat 0x00001000
-#define MASK_TextureMappingMode 0x00FF0000
-#define MASK_TextureWrapU 0x00010000
-#define MASK_TextureWrapV 0x00020000
-#define MASK_TextureMirrorU 0x00040000
-#define MASK_TextureMirrorV 0x00080000
-#define MASK_TextureClampU 0x00100000
-#define MASK_TextureClampV 0x00200000
-#define MASK_TextureBorderU 0x00400000
-#define MASK_TextureBorderV 0x00800000
-#define MASK_TextureFormat 0xFF000000
-#define MASK_TextureBitDepth 0x70000000
-#define MASK_TextureRgbOrder 0x80000000
-
-#define TEXEL_INDEX1 0x00000000
-#define TEXEL_INDEX2 0x01000000
-#define TEXEL_INDEX4 0x02000000
-#define TEXEL_INDEX8 0x03000000
-
-#define TEXEL_INDEX1WithAlpha 0x04000000
-#define TEXEL_INDEX2WithAlpha 0x05000000
-#define TEXEL_INDEX4WithAlpha 0x06000000
-#define TEXEL_INDEX8WithAlpha 0x07000000
-
-#define TEXEL_I1 0x10000000
-#define TEXEL_I2 0x11000000
-#define TEXEL_I4 0x12000000
-#define TEXEL_I8 0x13000000
-
-#define TEXEL_DXT1 0x19000000
-#define TEXEL_DXT2 0x1A000000
-#define TEXEL_DXT3 0x1B000000
-
-#define TEXEL_YUV422 0x20000000
-#define TEXEL_YVU422 0x21000000
-#define TEXEL_UVY422 0x22000000
-#define TEXEL_VUY422 0x23000000
-#define TEXEL_YUV411 0x24000000
-
-#define TEXEL_L1 0x30000000
-#define TEXEL_L2 0x31000000
-#define TEXEL_L4 0x32000000
-#define TEXEL_L8 0x33000000
-
-#define TEXEL_AL11 0x34000000
-#define TEXEL_AL44 0x35000000
-#define TEXEL_AL26 0x37000000
-#define TEXEL_AL88 0x38000000
-
-#define TEXEL_A1 0x40000000
-#define TEXEL_A2 0x41000000
-#define TEXEL_A4 0x42000000
-#define TEXEL_A8 0x43000000
-
-#define TEXEL_RGB_332_8 0x50000000
-#define TEXEL_RGB_233_8 0x51000000
-#define TEXEL_RGB_232_8 0x52000000
-#define TEXEL_ARGB_1232_8 0x53000000
-#define TEXEL_ARGB_2222_8 0x54000000
-
-#define TEXEL_RGB_555_16 0x60000000
-#define TEXEL_RGB_565_16 0x61000000
-#define TEXEL_ARGB_1555_16 0x62000000
-#define TEXEL_ARGB_4444_16 0x63000000
-
-#define TEXEL_ARGB_1888_32 0x70000000
-#define TEXEL_ARGB_2888_32 0x71000000
-#define TEXEL_ARGB_4888_32 0x72000000
-#define TEXEL_ARGB_8888_32 0x73000000
-#define TEXEL_ARGB_0888_32 0x74000000
-
-#define TEXEL_BGR_332_8 0xD0000000
-#define TEXEL_BGR_233_8 0xD1000000
-#define TEXEL_BGR_232_8 0xD2000000
-#define TEXEL_ABGR_1232_8 0xD3000000
-#define TEXEL_ABGR_2222_8 0xD4000000
-
-#define TEXEL_BGR_555_16 0xE0000000
-#define TEXEL_BGR_565_16 0xE1000000
-#define TEXEL_ABGR_1555_16 0xE2000000
-#define TEXEL_ABGR_4444_16 0xE3000000
-
-#define TEXEL_ABGR_1888_32 0xF0000000
-#define TEXEL_ABGR_2888_32 0xF1000000
-#define TEXEL_ABGR_4888_32 0xF2000000
-#define TEXEL_ABGR_8888_32 0xF3000000
-#define TEXEL_ABGR_0888_32 0xF4000000
-
-#define TEXEL_VU88 0x00000000
-#define TEXEL_LVU655 0x00800000
-#define TEXEL_LVU888 0x01000000
-#define TEXEL_UV88 0x02000000
-#define TEXEL_LUV655 0x02800000
-#define TEXEL_LUV888 0x03000000
-
-/*
- * REG_3D_TextureMip (0x8A80 - 0x8A83)
- * REG_3D_Texture1Mip (0x8AE0 - 0x8AE3)
- */
-#define MASK_TextureAnisotropyRatio 0x0000000F
-#define MASK_TextureMipmapLodBias 0x00003FF0
-#define MASK_TextureFilterMin 0x0001C000
-#define MASK_TextureFilterMag 0x00020000
-#define MASK_TextureFilter 0x0003C000
-#define MASK_TextureLevelInSystem 0x3FFC0000
-#define MASK_TextureLevel0InSystem 0x00040000
-#define MASK_TextureBlockLength 0xF0000000
-
-#define TEXTURE_FILTER_NEAREST 0x00000000
-#define TEXTURE_FILTER_LINEAR 0x00004000
-#define TEXTURE_FILTER_NEAREST_MIP_NEAREST 0x00008000
-#define TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x00010000
-#define TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x0000c000
-#define TEXTURE_FILTER_LINEAR_MIP_LINEAR 0x00014000
-
-/*
- * REG_3D_TextureTransparencyColorHigh (0x8A84 - 0x8A87)
- * REG_3D_Texture1TransparencyColorHigh (0x8AE4 - 0x8AE7)
- */
-#define MASK_TextureTransparencyColorHighB 0x000000FF
-#define MASK_TextureTransparencyColorHighG 0x0000FF00
-#define MASK_TextureTransparencyColorHighR 0x00FF0000
-#define MASK_TextureAlphaTransparencyMode 0x08000000
-
-/*
- * REG_3D_TextureTransparencyColorLow (0x8A88 - 0x8A8B)
- * REG_3D_Texture1TransparencyColorLow (0x8AE8 - 0x8AEB)
- */
-#define MASK_TextureTransparencyColorLowB 0x000000FF
-#define MASK_TextureTransparencyColorLowG 0x0000FF00
-#define MASK_TextureTransparencyColorLowR 0x00FF0000
-#define MASK_TextureBlockHeight 0x07000000
-#define MASK_TextureBlockWidth 0x70000000
-
-/*
- * REG_3D_TextureTransparencyColorLow (0x8A8C - 0x8A8F)
- * REG_3D_Texture1TransparencyColorLow (0x8AEC - 0x8AEF)
- */
-#define MASK_TextureBorderColorB 0x000000FF
-#define MASK_TextureBorderColorG 0x0000FF00
-#define MASK_TextureBorderColorR 0x00FF0000
-#define MASK_TextureBorderColorA 0xFF000000
-
-/*
- * REG_3D_TexturePitch0-10 (0x8AC0 - 0x8AD7)
- * REG_3D_Texture1Pitch0-10 (0x8B20 - 0x8B37)
- */
-#define MASK_TexturePitchOdd 0x000003FF
-#define MASK_TexturePitchEven 0x03FF0000
-#define SHIFT_TexturePitchEven 16
-
-/*
- * REG_3D_TextureColorBlendSet0 (0x8B40 - 0x8B43)
- * REG_3D_TextureColorBlendSet1 (0x8B44 - 0x8B46)
- * REG_3D_TextureAlphaBlendSet0 (0x8B40 - 0x8B43)
- * REG_3D_TextureAlphaBlendSet1 (0x8B44 - 0x8B46)
- */
-#define STAGE0_C_CF 0xa1485000
-#define STAGE0_C_CS 0xc1485000
-#define STAGE0_C_CFCS 0xa1705000
-#define STAGE0_C_CFOMAS_CSAS 0xc534c001
-#define STAGE0_C_CFOMCS_CCCS 0x4530c001
-
-#define STAGE0_A_AF 0x63230000
-#define STAGE0_A_AS 0xc3230000
-#define STAGE0_A_AFAS 0x63c30000
-#define STAGE0_A_AFOMAS_ACAS 0x46c60001
-
-#define STAGE1_C_CF 0xa1485000
-#define STAGE1_C_CS 0xe1485000
-#define STAGE1_C_CFCS 0xa1785000
-#define STAGE1_C_CFOMAS_CSAS 0xe5394001
-#define STAGE1_C_CFOMCS_CCCS 0x45394001
-
-#define STAGE1_A_AF 0xa3230000
-#define STAGE1_A_AS 0xe3230000
-#define STAGE1_A_AFAS 0xa3e30000
-#define STAGE1_A_AFOMAS_ACAS 0x4aea0001
-
-/* What registers are these associated with? */
-#define MASK_BMMemoryInSystem 0x00000080
-#define MASK_BMHeight 0x00000F00
-#define MASK_BMWidth 0x0000F000
-#define MASK_BMFilter 0x00010000
-#define MASK_BMMappingMode 0x007E0000
-#define MASK_BMFormat 0x07800000
-#define MASK_BMTxBumpmap 0x08000000
-
-#define MASK_BMAddress 0xFFFFFFFC
-
-#define MASK_BMOffset 0xFF800000
-#define MASK_BMScale 0x007FE000
-#define MASK_BMPitch 0x00001FFF
-
-#define MASK_BMMatrix00 0x000007FF
-#define MASK_BMMatrix01 0x07FF0000
-#define MASK_BMMatrix10 0x000007FF
-#define MASK_BMMatrix11 0x07FF0000
-
-#define MASK_TextureRealInSystem 0x00000001
-#define MASK_TextureDowngrade 0x00000002
-
-#define ALPHA_BUFFER_FORMAT_1 0x00000000
-#define ALPHA_BUFFER_FORMAT_2 0x10000000
-#define ALPHA_BUFFER_FORMAT_4 0x20000000
-#define ALPHA_BUFFER_FORMAT_8 0x30000000
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_screen.c b/xc/lib/GL/mesa/src/drv/sis/sis_screen.c
deleted file mode 100644
index a43f2be8c..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_screen.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "dri_util.h"
-
-#include "context.h"
-#include "utils.h"
-#include "imports.h"
-
-#include "sis_context.h"
-#include "sis_dri.h"
-#include "sis_lock.h"
-
-/* Create the device specific screen private data struct.
- */
-static sisScreenPtr
-sisCreateScreen( __DRIscreenPrivate *sPriv )
-{
- sisScreenPtr sisScreen;
- SISDRIPtr sisDRIPriv = (SISDRIPtr)sPriv->pDevPriv;
-
- if ( !driCheckDriDdxDrmVersions( sPriv, "SiS", 4, 0, 0, 1, 1, 0 ) )
- return NULL;
-
- /* Allocate the private area */
- sisScreen = (sisScreenPtr)CALLOC( sizeof(*sisScreen) );
- if ( sisScreen == NULL )
- return NULL;
-
- sisScreen->screenX = sisDRIPriv->width;
- sisScreen->screenY = sisDRIPriv->height;
- sisScreen->cpp = sisDRIPriv->bytesPerPixel;
- sisScreen->irqEnabled = sisDRIPriv->bytesPerPixel;
- sisScreen->deviceID = sisDRIPriv->deviceID;
- sisScreen->AGPCmdBufOffset = sisDRIPriv->AGPCmdBufOffset;
- sisScreen->AGPCmdBufSize = sisDRIPriv->AGPCmdBufSize;
- sisScreen->sarea_priv_offset = sizeof(XF86DRISAREARec);
-
- sisScreen->mmio.handle = sisDRIPriv->regs.handle;
- sisScreen->mmio.size = sisDRIPriv->regs.size;
- if ( drmMap( sPriv->fd, sisScreen->mmio.handle, sisScreen->mmio.size,
- &sisScreen->mmio.map ) )
- {
- FREE( sisScreen );
- return NULL;
- }
-
- if (sisDRIPriv->agp.size) {
- sisScreen->agp.handle = sisDRIPriv->agp.handle;
- sisScreen->agp.size = sisDRIPriv->agp.size;
- if ( drmMap( sPriv->fd, sisScreen->agp.handle, sisScreen->agp.size,
- &sisScreen->agp.map ) )
- {
- sisScreen->agp.size = 0;
- }
- }
-
- sisScreen->driScreen = sPriv;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo(&sisScreen->optionCache);
-
- return sisScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-sisDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- sisScreenPtr sisScreen = (sisScreenPtr)sPriv->private;
-
- if ( sisScreen == NULL )
- return;
-
- if (sisScreen->agp.size != 0)
- drmUnmap( sisScreen->agp.map, sisScreen->agp.size );
- drmUnmap( sisScreen->mmio.map, sisScreen->mmio.size );
-
- FREE( sisScreen );
- sPriv->private = NULL;
-}
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap)
- return GL_FALSE; /* not implemented */
-
- driDrawPriv->driverPrivate = (void *)_mesa_create_framebuffer(
- mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 ); /* XXX */
- return (driDrawPriv->driverPrivate != NULL);
-}
-
-
-static void
-sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-__inline__ static void
-sis_bitblt_copy_cmd (sisContextPtr smesa, ENGPACKET * pkt)
-{
- GLint *lpdwDest, *lpdwSrc;
- int i;
-
- lpdwSrc = (GLint *) pkt;
- lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR);
-
- mWait3DCmdQueue (10);
-
- for (i = 0; i < 7; i++)
- *lpdwDest++ = *lpdwSrc++;
-
- MMIO(REG_CMD0, *(GLint *)&pkt->stdwCmd);
- MMIO(REG_CommandQueue, -1);
-}
-
-static void sisCopyBuffer( __DRIdrawablePrivate *dPriv )
-{
- sisContextPtr smesa = (sisContextPtr)dPriv->driContextPriv->driverPrivate;
- int i;
- ENGPACKET stEngPacket;
-
- while ((*smesa->FrameCountPtr) - MMIO_READ(0x8a2c) > SIS_MAX_FRAME_LENGTH)
- usleep(1);
-
- LOCK_HARDWARE();
-
- stEngPacket.dwSrcBaseAddr = smesa->backOffset;
- stEngPacket.dwSrcPitch = smesa->backPitch |
- ((smesa->bytesPerPixel == 2) ? 0x80000000 : 0xc0000000);
- stEngPacket.dwDestBaseAddr = 0;
- stEngPacket.wDestPitch = smesa->frontPitch;
- /* TODO: set maximum value? */
- stEngPacket.wDestHeight = smesa->virtualY;
-
- stEngPacket.stdwCmd.cRop = 0xcc;
-
- if (smesa->blockWrite)
- stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- stEngPacket.stdwCmd.cCmd0 = 0;
- stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-
- for (i = 0; i < dPriv->numClipRects; i++) {
- XF86DRIClipRectPtr box = &dPriv->pClipRects[i];
- stEngPacket.stdwSrcPos.wY = box->y1 - dPriv->y;
- stEngPacket.stdwSrcPos.wX = box->x1 - dPriv->x;
- stEngPacket.stdwDestPos.wY = box->y1;
- stEngPacket.stdwDestPos.wX = box->x1;
-
- stEngPacket.stdwDim.wWidth = (GLshort) box->x2 - box->x1;
- stEngPacket.stdwDim.wHeight = (GLshort) box->y2 - box->y1;
- sis_bitblt_copy_cmd( smesa, &stEngPacket );
- }
-
- *(GLint *)(smesa->IOBase+0x8a2c) = *smesa->FrameCountPtr;
- (*smesa->FrameCountPtr)++;
-
- UNLOCK_HARDWARE ();
-}
-
-
-/* Copy the back color buffer to the front color buffer */
-static void
-sisSwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = smesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- sisCopyBuffer( dPriv );
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-sisInitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) sisCreateScreen( sPriv );
-
- if ( !sPriv->private ) {
- sisDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-/* Fullscreen mode change stub
- */
-static GLboolean
-sisOpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec sisAPI = {
- .InitDriver = sisInitDriver,
- .DestroyScreen = sisDestroyScreen,
- .CreateContext = sisCreateContext,
- .DestroyContext = sisDestroyContext,
- .CreateBuffer = sisCreateBuffer,
- .DestroyBuffer = sisDestroyBuffer,
- .SwapBuffers = sisSwapBuffers,
- .MakeCurrent = sisMakeCurrent,
- .UnbindContext = sisUnbindContext,
- .OpenFullScreen = sisOpenCloseFullScreen,
- .CloseFullScreen = sisOpenCloseFullScreen,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-
-};
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen( dpy, scrn, psc, numConfigs, config, &sisAPI );
- return (void *)psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_screen.h b/xc/lib/GL/mesa/src/drv/sis/sis_screen.h
deleted file mode 100644
index 452278264..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_screen.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_SCREEN_H
-#define __SIS_SCREEN_H
-
-typedef struct {
- drmHandle handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} sisRegionRec2, *sisRegionPtr2;
-
-typedef struct {
- sisRegionRec2 mmio;
- sisRegionRec2 agp;
-
- unsigned int AGPCmdBufOffset;
- unsigned int AGPCmdBufSize;
-
- int deviceID;
- int irqEnabled;
-
- int cpp;
- unsigned int screenX, screenY;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-
-} sisScreenRec, *sisScreenPtr;
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_span.c b/xc/lib/GL/mesa/src/drv/sis/sis_span.c
deleted file mode 100644
index 05e177789..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_span.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_span.c,v 1.5 2001/03/21 16:14:26 dawes Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_span.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- char *buf = (char *)(smesa->FbBase + smesa->drawOffset); \
- char *read_buf = (char *)(smesa->FbBase + smesa->readOffset); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- char *buf = smesa->depthbuffer; \
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
- _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define HW_LOCK() do {} while(0);
-
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = smesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK() do {} while(0);
-
-/* RGB565 */
-#define INIT_MONO_PIXEL(p, color) \
- p = SISPACKCOLOR565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*smesa->drawPitch) = \
- (((r & 0xf8) << 8) | \
- ((g & 0xfc) << 3) | \
- (b >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*smesa->drawPitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*smesa->readPitch); \
- rgba[0] = (p & 0xf800) >> 8; \
- rgba[1] = (p & 0x07e0) >> 3; \
- rgba[2] = (p & 0x001f) << 3; \
- rgba[3] = 0xff; \
-} while(0)
-
-#define TAG(x) sis##x##_565
-#include "spantmp.h"
-
-
-/* ARGB8888 */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = SISPACKCOLOR8888( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*smesa->drawPitch) = \
- (((a) << 24) | \
- ((r) << 16) | \
- ((g) << 8) | \
- ((b)))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*smesa->drawPitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*smesa->readPitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
-} while(0)
-
-#define TAG(x) sis##x##_8888
-#include "spantmp.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*smesa->depthPitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*smesa->depthPitch);
-
-#define TAG(x) sis##x##_16
-#include "depthtmp.h"
-
-
-/* 32 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch);
-
-#define TAG(x) sis##x##_32
-#include "depthtmp.h"
-
-
-/* 8/24 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch); \
- tmp &= 0xff000000; \
- tmp |= (d & 0x00ffffff); \
- *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) { \
- d = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) & 0x00ffffff; \
-}
-
-#define TAG(x) sis##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch); \
- tmp &= 0x00ffffff; \
- tmp |= (d << 24); \
- *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = (*(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) & 0xff000000) >> 24;
-
-#define TAG(x) sis##x##_24_8
-#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void sisDDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
- smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
- break;
- case BACK_LEFT_BIT:
- smesa->drawOffset = smesa->readOffset = smesa->backOffset;
- smesa->drawPitch = smesa->readPitch = smesa->backPitch;
- break;
- default:
- break;
- }
-}
-
-static void sisSpanRenderStart( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- WaitEngIdle( smesa );
-}
-
-static void sisSpanRenderFinish( GLcontext *ctx )
-{
- _swrast_flush( ctx );
-}
-
-void
-sisDDInitSpanFuncs( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = sisDDSetBuffer;
-
- switch (smesa->zFormat)
- {
- case SiS_ZFORMAT_Z16:
- swdd->ReadDepthSpan = sisReadDepthSpan_16;
- swdd->ReadDepthPixels = sisReadDepthPixels_16;
- swdd->WriteDepthSpan = sisWriteDepthSpan_16;
- swdd->WriteDepthPixels = sisWriteDepthPixels_16;
-
- swdd->ReadStencilSpan = NULL;
- swdd->ReadStencilPixels = NULL;
- swdd->WriteStencilSpan = NULL;
- swdd->WriteStencilPixels = NULL;
- break;
- case SiS_ZFORMAT_Z32:
- swdd->ReadDepthSpan = sisReadDepthSpan_32;
- swdd->ReadDepthPixels = sisReadDepthPixels_32;
- swdd->WriteDepthSpan = sisWriteDepthSpan_32;
- swdd->WriteDepthPixels = sisWriteDepthPixels_32;
-
- swdd->ReadStencilSpan = NULL;
- swdd->ReadStencilPixels = NULL;
- swdd->WriteStencilSpan = NULL;
- swdd->WriteStencilPixels = NULL;
- break;
- case SiS_ZFORMAT_S8Z24:
- swdd->ReadDepthSpan = sisReadDepthSpan_24_8;
- swdd->ReadDepthPixels = sisReadDepthPixels_24_8;
- swdd->WriteDepthSpan = sisWriteDepthSpan_24_8;
- swdd->WriteDepthPixels = sisWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = sisReadStencilSpan_24_8;
- swdd->ReadStencilPixels = sisReadStencilPixels_24_8;
- swdd->WriteStencilSpan = sisWriteStencilSpan_24_8;
- swdd->WriteStencilPixels = sisWriteStencilPixels_24_8;
- break;
- }
-
- switch ( smesa->bytesPerPixel )
- {
- case 2:
- swdd->WriteRGBASpan = sisWriteRGBASpan_565;
- swdd->WriteRGBSpan = sisWriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = sisWriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = sisWriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = sisWriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = sisReadRGBASpan_565;
- swdd->ReadRGBAPixels = sisReadRGBAPixels_565;
- break;
- case 4:
- swdd->WriteRGBASpan = sisWriteRGBASpan_8888;
- swdd->WriteRGBSpan = sisWriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = sisWriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = sisWriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = sisWriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = sisReadRGBASpan_8888;
- swdd->ReadRGBAPixels = sisReadRGBAPixels_8888;
- break;
- default:
- assert(0);
- break;
- }
-
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-
- swdd->SpanRenderStart = sisSpanRenderStart;
- swdd->SpanRenderFinish = sisSpanRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_span.h b/xc/lib/GL/mesa/src/drv/sis/sis_span.h
deleted file mode 100644
index f0d64df19..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_span.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_SPAN_H__
-#define __SIS_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void sisDDInitSpanFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_state.c b/xc/lib/GL/mesa/src/drv/sis/sis_state.c
deleted file mode 100644
index 8ff067f56..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_state.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_tris.h"
-#include "sis_lock.h"
-#include "sis_tex.h"
-
-#include "context.h"
-#include "enums.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-/* =============================================================
- * Alpha blending
- */
-
-static void
-sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLubyte refbyte;
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- CLAMPED_FLOAT_TO_UBYTE(refbyte, ref);
- current->hwAlpha = refbyte << 16;
-
- /* Alpha Test function */
- switch (func)
- {
- case GL_NEVER:
- current->hwAlpha |= SiS_ALPHA_NEVER;
- break;
- case GL_LESS:
- current->hwAlpha |= SiS_ALPHA_LESS;
- break;
- case GL_EQUAL:
- current->hwAlpha |= SiS_ALPHA_EQUAL;
- break;
- case GL_LEQUAL:
- current->hwAlpha |= SiS_ALPHA_LEQUAL;
- break;
- case GL_GREATER:
- current->hwAlpha |= SiS_ALPHA_GREATER;
- break;
- case GL_NOTEQUAL:
- current->hwAlpha |= SiS_ALPHA_NOTEQUAL;
- break;
- case GL_GEQUAL:
- current->hwAlpha |= SiS_ALPHA_GEQUAL;
- break;
- case GL_ALWAYS:
- current->hwAlpha |= SiS_ALPHA_ALWAYS;
- break;
- }
-
- prev->hwAlpha = current->hwAlpha;
- smesa->GlobalFlag |= GFLAG_ALPHASETTING;
-}
-
-static void
-sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /* TODO: in ICD, if no blend, it will reset these value */
- /* blending enable */
- current->hwDstSrcBlend = 0x10000; /* Default destination alpha */
-
- switch (dfactor)
- {
- case GL_ZERO:
- current->hwDstSrcBlend |= SiS_D_ZERO;
- break;
- case GL_ONE:
- current->hwDstSrcBlend |= SiS_D_ONE;
- break;
- case GL_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_D_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_D_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_D_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_ALPHA;
- break;
- }
-
- switch (sfactor)
- {
- case GL_ZERO:
- current->hwDstSrcBlend |= SiS_S_ZERO;
- break;
- case GL_ONE:
- current->hwDstSrcBlend |= SiS_S_ONE;
- break;
- case GL_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_S_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_S_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_ALPHA;
- break;
- case GL_DST_COLOR:
- current->hwDstSrcBlend |= SiS_S_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_ALPHA_SATURATE:
- current->hwDstSrcBlend |= SiS_S_SRC_ALPHA_SATURATE;
- break;
- }
-
- if (current->hwDstSrcBlend != prev->hwDstSrcBlend) {
- prev->hwDstSrcBlend = current->hwDstSrcBlend;
- smesa->GlobalFlag |= GFLAG_DSTBLEND;
- }
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void
-sisDDDepthFunc( GLcontext * ctx, GLenum func )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwZ &= ~MASK_ZTestMode;
- switch (func)
- {
- case GL_LESS:
- current->hwZ |= SiS_Z_COMP_S_LT_B;
- break;
- case GL_GEQUAL:
- current->hwZ |= SiS_Z_COMP_S_GE_B;
- break;
- case GL_LEQUAL:
- current->hwZ |= SiS_Z_COMP_S_LE_B;
- break;
- case GL_GREATER:
- current->hwZ |= SiS_Z_COMP_S_GT_B;
- break;
- case GL_NOTEQUAL:
- current->hwZ |= SiS_Z_COMP_S_NE_B;
- break;
- case GL_EQUAL:
- current->hwZ |= SiS_Z_COMP_S_EQ_B;
- break;
- case GL_ALWAYS:
- current->hwZ |= SiS_Z_COMP_ALWAYS;
- break;
- case GL_NEVER:
- current->hwZ |= SiS_Z_COMP_NEVER;
- break;
- }
-
- if (current->hwZ != prev->hwZ) {
- prev->hwZ = current->hwZ;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
-}
-
-void
-sisDDDepthMask( GLcontext * ctx, GLboolean flag )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (!ctx->Depth.Test)
- flag = GL_FALSE;
-
- if (ctx->Visual.stencilBits) {
- if (flag || (ctx->Stencil.WriteMask[0] != 0)) {
- current->hwCapEnable |= MASK_ZWriteEnable;
- if (flag && (ctx->Stencil.WriteMask[0] == 0xff)) {
- current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
- } else {
- current->hwCapEnable2 |= MASK_ZMaskWriteEnable;
- current->hwZMask = (ctx->Stencil.WriteMask[0] << 24) |
- ((flag) ? 0x00ffffff : 0);
-
- if (current->hwZMask ^ prev->hwZMask) {
- prev->hwZMask = current->hwZMask;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
- }
- } else {
- current->hwCapEnable &= ~MASK_ZWriteEnable;
- }
- } else {
- if (flag) {
- current->hwCapEnable |= MASK_ZWriteEnable;
- current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
- } else {
- current->hwCapEnable &= ~MASK_ZWriteEnable;
- }
- }
-}
-
-/* =============================================================
- * Clipping
- */
-
-void
-sisUpdateClipping( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- GLint x1, y1, x2, y2;
-
- x1 = 0;
- y1 = 0;
- x2 = smesa->width - 1;
- y2 = smesa->height - 1;
-
- if (ctx->Scissor.Enabled) {
- if (ctx->Scissor.X > x1)
- x1 = ctx->Scissor.X;
- if (ctx->Scissor.Y > y1)
- y1 = ctx->Scissor.Y;
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2)
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < y2)
- y2 = ctx->Scissor.Y + ctx->Scissor.Height - 1;
- }
-
- y1 = Y_FLIP(y1);
- y2 = Y_FLIP(y2);
-
- current->clipTopBottom = (y2 << 13) | y1;
- current->clipLeftRight = (x1 << 13) | x2;
-
- if ((current->clipTopBottom ^ prev->clipTopBottom) ||
- (current->clipLeftRight ^ prev->clipLeftRight))
- {
- prev->clipTopBottom = current->clipTopBottom;
- prev->clipLeftRight = current->clipLeftRight;
- smesa->GlobalFlag |= GFLAG_CLIPPING;
- }
-}
-
-static void
-sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- if (ctx->Scissor.Enabled)
- sisUpdateClipping( ctx );
-}
-
-/* =============================================================
- * Culling
- */
-
-static void
-sisUpdateCull( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLint cullflag, frontface;
-
- cullflag = ctx->Polygon.CullFaceMode;
- frontface = ctx->Polygon.FrontFace;
-
- smesa->AGPParseSet &= ~(MASK_PsCullDirection_CCW);
- smesa->dwPrimitiveSet &= ~(MASK_CullDirection);
-
- if((cullflag == GL_FRONT && frontface == GL_CCW) ||
- (cullflag == GL_BACK && frontface == GL_CW))
- {
- smesa->AGPParseSet |= MASK_PsCullDirection_CCW;
- smesa->dwPrimitiveSet |= OP_3D_CullDirection_CCW;
- }
-}
-
-
-static void
-sisDDCullFace( GLcontext *ctx, GLenum mode )
-{
- sisUpdateCull( ctx );
-}
-
-static void
-sisDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- sisUpdateCull( ctx );
-}
-
-/* =============================================================
- * Masks
- */
-
-static void sisDDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (r && g && b && ((ctx->Visual.alphaBits == 0) || a)) {
- current->hwCapEnable2 &= ~(MASK_AlphaMaskWriteEnable |
- MASK_ColorMaskWriteEnable);
- } else {
- current->hwCapEnable2 |= (MASK_AlphaMaskWriteEnable |
- MASK_ColorMaskWriteEnable);
-
- current->hwDstMask = (r) ? smesa->redMask : 0 |
- (g) ? smesa->greenMask : 0 |
- (b) ? smesa->blueMask : 0 |
- (a) ? smesa->alphaMask : 0;
- }
-
- if (current->hwDstMask != prev->hwDstMask) {
- prev->hwDstMask = current->hwDstMask;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-/* =============================================================
- * Rendering attributes
- */
-
-static void sisDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- /* Signal to sisRasterPrimitive to recalculate dwPrimitiveSet */
- smesa->hw_primitive = -1;
-}
-
-/* =============================================================
- * Window position
- */
-
-/* =============================================================
- * Viewport
- */
-
-static void sisCalcViewport( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = smesa->hw_viewport;
-
- /* See also sis_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + smesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * smesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale;
-}
-
-static void sisDDViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- sisCalcViewport( ctx );
-}
-
-static void sisDDDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- sisCalcViewport( ctx );
-}
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void
-sisDDLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (!ctx->Color.ColorLogicOpEnabled)
- return;
-
- current->hwDstSet &= ~MASK_ROP2;
- switch (opcode)
- {
- case GL_CLEAR:
- current->hwDstSet |= LOP_CLEAR;
- break;
- case GL_SET:
- current->hwDstSet |= LOP_SET;
- break;
- case GL_COPY:
- current->hwDstSet |= LOP_COPY;
- break;
- case GL_COPY_INVERTED:
- current->hwDstSet |= LOP_COPY_INVERTED;
- break;
- case GL_NOOP:
- current->hwDstSet |= LOP_NOOP;
- break;
- case GL_INVERT:
- current->hwDstSet |= LOP_INVERT;
- break;
- case GL_AND:
- current->hwDstSet |= LOP_AND;
- break;
- case GL_NAND:
- current->hwDstSet |= LOP_NAND;
- break;
- case GL_OR:
- current->hwDstSet |= LOP_OR;
- break;
- case GL_NOR:
- current->hwDstSet |= LOP_NOR;
- break;
- case GL_XOR:
- current->hwDstSet |= LOP_XOR;
- break;
- case GL_EQUIV:
- current->hwDstSet |= LOP_EQUIV;
- break;
- case GL_AND_REVERSE:
- current->hwDstSet |= LOP_AND_REVERSE;
- break;
- case GL_AND_INVERTED:
- current->hwDstSet |= LOP_AND_INVERTED;
- break;
- case GL_OR_REVERSE:
- current->hwDstSet |= LOP_OR_REVERSE;
- break;
- case GL_OR_INVERTED:
- current->hwDstSet |= LOP_OR_INVERTED;
- break;
- }
-
- if (current->hwDstSet ^ prev->hwDstSet) {
- prev->hwDstSet = current->hwDstSet;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- case BACK_LEFT_BIT:
- FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that sisDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- current->hwOffsetDest = (smesa->drawOffset) >> 1;
- current->hwDstSet &= ~MASK_DstBufferPitch;
- current->hwDstSet |= smesa->drawPitch >> 2;
-
- if (current->hwDstSet != prev->hwDstSet) {
- prev->hwDstSet = current->hwDstSet;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-
- if (current->hwOffsetDest != prev->hwOffsetDest) {
- prev->hwOffsetDest = current->hwOffsetDest;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-/* =============================================================
- * Polygon stipple
- */
-
-/* =============================================================
- * Render mode
- */
-
-/* =============================================================
- * State enable/disable
- */
-
-static void
-sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *current = &smesa->current;
-
- switch (cap)
- {
- case GL_ALPHA_TEST:
- if (state)
- current->hwCapEnable |= MASK_AlphaTestEnable;
- else
- current->hwCapEnable &= ~MASK_AlphaTestEnable;
- break;
- case GL_BLEND:
- /* TODO: */
- if (state)
- /* if (state & !ctx->Color.ColorLogicOpEnabled) */
- current->hwCapEnable |= MASK_BlendEnable;
- else
- current->hwCapEnable &= ~MASK_BlendEnable;
- break;
- case GL_CULL_FACE:
- if (state)
- current->hwCapEnable |= MASK_CullEnable;
- else
- current->hwCapEnable &= ~MASK_CullEnable;
- break;
- case GL_DEPTH_TEST:
- if (state && smesa->depthbuffer)
- current->hwCapEnable |= MASK_ZTestEnable;
- else
- current->hwCapEnable &= ~MASK_ZTestEnable;
- sisDDDepthMask( ctx, ctx->Depth.Mask );
- break;
- case GL_DITHER:
- if (state)
- current->hwCapEnable |= MASK_DitherEnable;
- else
- current->hwCapEnable &= ~MASK_DitherEnable;
- break;
- case GL_FOG:
- if (state)
- current->hwCapEnable |= MASK_FogEnable;
- else
- current->hwCapEnable &= ~MASK_FogEnable;
- break;
- case GL_COLOR_LOGIC_OP:
- if (state)
- sisDDLogicOpCode( ctx, ctx->Color.LogicOp );
- else
- sisDDLogicOpCode( ctx, GL_COPY );
- break;
- case GL_SCISSOR_TEST:
- sisUpdateClipping( ctx );
- break;
- case GL_STENCIL_TEST:
- if (state) {
- if (smesa->zFormat != SiS_ZFORMAT_S8Z24)
- FALLBACK(smesa, SIS_FALLBACK_STENCIL, 1);
- else
- current->hwCapEnable |= (MASK_StencilTestEnable |
- MASK_StencilWriteEnable);
- } else {
- FALLBACK(smesa, SIS_FALLBACK_STENCIL, 0);
- current->hwCapEnable &= ~(MASK_StencilTestEnable |
- MASK_StencilWriteEnable);
- }
- break;
- }
-}
-
-/* =============================================================
- * Pixel functions
- */
-
-static void
-sisDDDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- LOCK_HARDWARE();
- _swrast_DrawPixels( ctx, x, y, width, height, format, type, unpack, pixels );
- UNLOCK_HARDWARE();
-}
-
-static void
-sisDDReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- LOCK_HARDWARE();
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
- UNLOCK_HARDWARE();
-}
-
-static void
-sisDDBitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- LOCK_HARDWARE();
- _swrast_Bitmap( ctx, px, py, width, height, unpack, bitmap );
- UNLOCK_HARDWARE();
-}
-
-/* =============================================================
- * State initialization, management
- */
-
-/* Called before beginning of rendering. */
-void
-sisUpdateHWState( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (smesa->NewGLState & _NEW_TEXTURE)
- sisUpdateTextureState( ctx );
-
- /* enable setting 1 */
- if (current->hwCapEnable ^ prev->hwCapEnable) {
- prev->hwCapEnable = current->hwCapEnable;
- smesa->GlobalFlag |= GFLAG_ENABLESETTING;
- }
-
- /* enable setting 2 */
- if (current->hwCapEnable2 ^ prev->hwCapEnable2) {
- prev->hwCapEnable2 = current->hwCapEnable2;
- smesa->GlobalFlag |= GFLAG_ENABLESETTING2;
- }
-
- if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
- sis_update_render_state( smesa );
-
- if (smesa->GlobalFlag & GFLAG_TEXTURE_STATES)
- sis_update_texture_state( smesa );
-}
-
-static void
-sisDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- smesa->NewGLState |= new_state;
-}
-
-/* Initialize the context's hardware state.
- */
-void sisDDInitState( sisContextPtr smesa )
-{
- __GLSiSHardware *current = &smesa->current;
- __GLSiSHardware *prev = &(smesa->prev);
- GLcontext *ctx = smesa->glCtx;
-
- /* add Texture Perspective Enable */
- prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable |
- MASK_TexturePerspectiveEnable | MASK_DitherEnable;
- /*| MASK_SpecularEnable*/
-
- /*
- prev->hwCapEnable2 = 0x00aa0080;
- */
- /* if multi-texture enabled, disable Z pre-test */
- prev->hwCapEnable2 = MASK_TextureMipmapBiasEnable;
-
- /* Z test mode is LESS */
- prev->hwZ = SiS_Z_COMP_S_LT_B;
-
- /* Depth mask */
- prev->hwZMask = 0xffffffff;
-
- /* Alpha test mode is ALWAYS, alpha ref value is 0 */
- prev->hwAlpha = SiS_ALPHA_ALWAYS;
-
- /* ROP2 is COPYPEN */
- prev->hwDstSet = LOP_COPY;
-
- /* color mask */
- prev->hwDstMask = 0xffffffff;
-
- /* LinePattern is 0, Repeat Factor is 0 */
- prev->hwLinePattern = 0x00008000;
-
- /* Src blend is BLEND_ONE, Dst blend is D3DBLEND_ZERO */
- prev->hwDstSrcBlend = SiS_S_ONE | SiS_D_ZERO;
-
- /* Stenciling disabled, function ALWAYS, ref value zero, mask all ones */
- prev->hwStSetting = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS | 0xff;
- /* Op is KEEP for all three operations */
- prev->hwStSetting2 = SiS_SFAIL_KEEP | SiS_SPASS_ZFAIL_KEEP |
- SiS_SPASS_ZPASS_KEEP;
-
- /* Texture mapping mode is Tile */
-#if 0
- prev->texture[0].hwTextureSet = 0x00030000;
-#endif
- /* Magnified & minified texture filter is NEAREST */
-#if 0
- prev->texture[0].hwTextureMip = 0;
-#endif
-
- /* Texture Blending setting -- use fragment color/alpha*/
- prev->hwTexBlendColor0 = STAGE0_C_CF;
- prev->hwTexBlendColor1 = STAGE1_C_CF;
- prev->hwTexBlendAlpha0 = STAGE0_A_AF;
- prev->hwTexBlendAlpha1 = STAGE1_A_AF;
-
- switch (smesa->bytesPerPixel)
- {
- case 2:
- prev->hwDstSet |= DST_FORMAT_RGB_565;
- break;
- case 4:
- prev->hwDstSet |= DST_FORMAT_ARGB_8888;
- break;
- }
-
- switch (ctx->Visual.depthBits)
- {
- case 0:
- prev->hwCapEnable &= ~MASK_ZWriteEnable;
- case 16:
- smesa->zFormat = SiS_ZFORMAT_Z16;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 32:
- smesa->zFormat = SiS_ZFORMAT_Z32;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffffffff;
- break;
- case 24:
- assert (ctx->Visual.stencilBits);
- smesa->zFormat = SiS_ZFORMAT_S8Z24;
- prev->hwCapEnable |= MASK_StencilBufferEnable;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- }
-
- prev->hwZ |= smesa->zFormat;
-
- /* TODO: need to clear cache? */
- smesa->clearTexCache = GL_TRUE;
-
- smesa->clearColorPattern = 0;
-
- smesa->AGPParseSet = MASK_PsTexture1FromB;
- smesa->dwPrimitiveSet = OP_3D_Texture1FromB | OP_3D_TextureBumpFromC;
-
- sisUpdateZStencilPattern( smesa, 1.0, 0 );
- sisUpdateCull( ctx );
-
- memcpy( current, prev, sizeof (__GLSiSHardware) );
-
- /* Set initial fog settings. Start and end are the same case. */
- sisDDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- sisDDFogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- sisDDFogfv( ctx, GL_FOG_MODE, NULL );
-}
-
-/* Initialize the driver's state functions.
- */
-void sisDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = sisDDInvalidateState;
-
- ctx->Driver.Clear = sisDDClear;
- ctx->Driver.ClearColor = sisDDClearColor;
- ctx->Driver.ClearDepth = sisDDClearDepth;
- ctx->Driver.ClearStencil = sisDDClearStencil;
-
- ctx->Driver.AlphaFunc = sisDDAlphaFunc;
- ctx->Driver.Bitmap = sisDDBitmap;
- ctx->Driver.BlendFunc = sisDDBlendFunc;
- ctx->Driver.ColorMask = sisDDColorMask;
- ctx->Driver.CullFace = sisDDCullFace;
- ctx->Driver.DepthMask = sisDDDepthMask;
- ctx->Driver.DepthFunc = sisDDDepthFunc;
- ctx->Driver.DepthRange = sisDDDepthRange;
- ctx->Driver.DrawBuffer = sisDDDrawBuffer;
- ctx->Driver.DrawPixels = sisDDDrawPixels;
- ctx->Driver.Enable = sisDDEnable;
- ctx->Driver.FrontFace = sisDDFrontFace;
- ctx->Driver.Fogfv = sisDDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LogicOpcode = sisDDLogicOpCode;
- ctx->Driver.PolygonMode = NULL;
- ctx->Driver.PolygonStipple = NULL;
- ctx->Driver.ReadBuffer = NULL;
- ctx->Driver.ReadPixels = sisDDReadPixels;
- ctx->Driver.RenderMode = NULL;
- ctx->Driver.Scissor = sisDDScissor;
- ctx->Driver.ShadeModel = sisDDShadeModel;
- ctx->Driver.Viewport = sisDDViewport;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_state.h b/xc/lib/GL/mesa/src/drv/sis/sis_state.h
deleted file mode 100644
index b7251157f..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_state.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_STATE_H__
-#define __SIS_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "sis_context.h"
-
-extern void sisDDInitState( sisContextPtr smesa );
-extern void sisDDInitStateFuncs( GLcontext *ctx );
-
-extern void sisDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height );
-extern void sisDDClearColor( GLcontext * ctx, const GLfloat color[4] );
-extern void sisDDClearDepth( GLcontext * ctx, GLclampd d );
-extern void sisDDClearStencil( GLcontext * ctx, GLint s );
-extern void sisDDFogfv( GLcontext * ctx, GLenum pname, const GLfloat * params );
-extern void sisDDDepthMask( GLcontext * ctx, GLboolean flag );
-
-extern void sisUpdateClipping( GLcontext * gc );
-extern void sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z,
- int stencil );
-extern void sisDDDrawBuffer( GLcontext *ctx, GLenum mode );
-extern void sisUpdateHWState( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c b/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c
deleted file mode 100644
index a31d49ca2..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_stencil.c,v 1.3 2000/09/26 15:56:49 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_stencil.h"
-
-static void
-sisDDStencilFunc( GLcontext * ctx, GLenum func, GLint ref, GLuint mask )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /* set reference */
- current->hwStSetting = STENCIL_FORMAT_8 | (ctx->Stencil.Ref[0] << 8) |
- ctx->Stencil.ValueMask[0];
-
- switch (func)
- {
- case GL_NEVER:
- current->hwStSetting |= SiS_STENCIL_NEVER;
- break;
- case GL_LESS:
- current->hwStSetting |= SiS_STENCIL_LESS;
- break;
- case GL_EQUAL:
- current->hwStSetting |= SiS_STENCIL_EQUAL;
- break;
- case GL_LEQUAL:
- current->hwStSetting |= SiS_STENCIL_LEQUAL;
- break;
- case GL_GREATER:
- current->hwStSetting |= SiS_STENCIL_GREATER;
- break;
- case GL_NOTEQUAL:
- current->hwStSetting |= SiS_STENCIL_NOTEQUAL;
- break;
- case GL_GEQUAL:
- current->hwStSetting |= SiS_STENCIL_GEQUAL;
- break;
- case GL_ALWAYS:
- current->hwStSetting |= SiS_STENCIL_ALWAYS;
- break;
- }
-
- if (current->hwStSetting != prev->hwStSetting)
- {
- prev->hwStSetting = current->hwStSetting;
-
- smesa->GlobalFlag |= GFLAG_STENCILSETTING;
- }
-}
-
-static void
-sisDDStencilMask( GLcontext * ctx, GLuint mask )
-{
- if (!ctx->Visual.stencilBits)
- return;
-
- /* set Z buffer Write Enable */
- sisDDDepthMask (ctx, ctx->Depth.Mask);
-}
-
-static void
-sisDDStencilOp( GLcontext * ctx, GLenum fail, GLenum zfail, GLenum zpass )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwStSetting2 &= ~(MASK_StencilZPassOp | MASK_StencilZFailOp |
- MASK_StencilFailOp);
-
- switch (fail)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SFAIL_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SFAIL_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SFAIL_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SFAIL_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SFAIL_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SFAIL_DECR;
- break;
- }
-
- switch (zfail)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_DECR;
- break;
- }
-
- switch (zpass)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_DECR;
- break;
- }
-
- if (current->hwStSetting2 != prev->hwStSetting2)
- {
- prev->hwStSetting2 = current->hwStSetting2;
- smesa->GlobalFlag |= GFLAG_STENCILSETTING;
- }
-}
-
-void
-sisDDInitStencilFuncs( GLcontext *ctx )
-{
- ctx->Driver.StencilFunc = sisDDStencilFunc;
- ctx->Driver.StencilMask = sisDDStencilMask;
- ctx->Driver.StencilOp = sisDDStencilOp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_stencil.h b/xc/lib/GL/mesa/src/drv/sis/sis_stencil.h
deleted file mode 100644
index db6098ff0..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_stencil.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_STENCIL_H__
-#define __SIS_STENCIL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void sisDDInitStencilFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_tex.c b/xc/lib/GL/mesa/src/drv/sis/sis_tex.c
deleted file mode 100644
index 6e53da249..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_tex.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_alloc.h"
-#include "sis_tex.h"
-
-#include "swrast/swrast.h"
-#include "imports.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#define ALIGN(value, align) (char *)((long)(value + align - 1) & ~(align - 1))
-
-#define TEXTURE_HW_ALIGNMENT 4
-#define TEXTURE_HW_PLUS (4 + 4)
-
-static sisTexObjPtr
-sisAllocTexObj( struct gl_texture_object *texObj )
-{
- sisTexObjPtr t;
-
- t = (sisTexObjPtr) CALLOC_STRUCT( sis_tex_obj );
- texObj->DriverData = t;
- return t;
-}
-
-static void
-sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
- const struct gl_texture_image *image )
-{
- char *addr;
- int size, texel_size;
-
- if (t->format == 0) {
- t->format = image->Format;
- switch (t->format)
- {
- case GL_RGBA:
- t->hwformat = TEXEL_ARGB_8888_32;
- break;
- case GL_INTENSITY:
- t->hwformat = TEXEL_I8;
- break;
- case GL_ALPHA:
- t->hwformat = TEXEL_A8;
- break;
- case GL_LUMINANCE:
- t->hwformat = TEXEL_L8;
- break;
- case GL_LUMINANCE_ALPHA:
- t->hwformat = TEXEL_AL88;
- break;
- case GL_RGB:
- t->hwformat = TEXEL_ARGB_0888_32;
- break;
- default:
- assert(0);
- }
- }
- assert(t->format == image->Format);
-
- texel_size = image->TexFormat->TexelBytes;
- size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS;
-
- addr = sisAllocFB( smesa, size, &t->image[level].handle );
- if (addr == NULL) {
- addr = sisAllocAGP( smesa, size, &t->image[level].handle );
- if (addr == NULL) {
- fprintf (stderr, "SIS driver : out of video/agp memory\n");
- sis_fatal_error();
- }
- t->image[level].memType = AGP_TYPE;
- }
- else
- t->image[level].memType = VIDEO_TYPE;
-
- t->image[level].Data = ALIGN(addr, TEXTURE_HW_ALIGNMENT);
- t->image[level].pitch = image->Width * texel_size;
- t->image[level].size = image->Width * image->Height * texel_size;
- t->numImages++;
-}
-
-static void
-sisFreeTexImage( sisContextPtr smesa, sisTexObjPtr t, int level )
-{
- if (t->image[level].Data == NULL)
- return;
-
- switch (t->image[level].memType)
- {
- case VIDEO_TYPE:
- sisFreeFB( smesa, t->image[level].handle );
- break;
- case AGP_TYPE:
- sisFreeAGP( smesa, t->image[level].handle );
- break;
- }
- t->image[level].Data = NULL;
- t->image[level].handle = NULL;
- /* If there are no textures loaded any more, reset the hw format so the
- * object can be reused for new formats
- */
- t->numImages--;
- if (t->numImages == 0) {
- t->format = 0;
- t->hwformat = 0;
- }
-}
-
-static void
-sisDDTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
-}
-
-static void
-sisDDTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj, GLenum pname,
- const GLfloat *params )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void
-sisDDBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
- if ( texObj->DriverData == NULL ) {
- sisAllocTexObj( texObj );
- }
- }
-
- t = texObj->DriverData;
-
- if (t == NULL)
- return;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format) {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void
-sisDDDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- int i;
-
- smesa->clearTexCache = GL_TRUE;
-
- t = texObj->DriverData;
- if (t == NULL) {
- /*
- * this shows the texture is default object and never be a
- * argument of sisDDTexImage*
- */
- return;
- }
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- sisFreeTexImage( smesa, t, i );
- }
-
- FREE(t);
- texObj->DriverData = NULL;
-}
-
-static GLboolean sisDDIsTextureResident( GLcontext * ctx,
- struct gl_texture_object *texObj )
-{
- return (texObj->DriverData != NULL);
-}
-
-static const struct gl_texture_format *
-sisDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- /* XXX 16-bit internal texture formats? */
- switch ( internalFormat ) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_i8;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_argb8888 /*_mesa_texformat_rgb888*/; /* XXX */
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- default:
- _mesa_problem(ctx, "unexpected format in tdfxDDChooseTextureFormat: %d",
- internalFormat);
- return NULL;
- }
-}
-
-static void sisDDTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- /* Note, this will call sisDDChooseTextureFormat */
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- memcpy(t->image[level].Data, texImage->Data, t->image[level].size);
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-
-static void sisDDTexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- GLuint copySize;
- GLint texelBytes;
- char *src, *dst;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- texelBytes = texImage->TexFormat->TexelBytes;
-
- copySize = width * texelBytes;
- src = (char *)texImage->Data + xoffset * texelBytes;
- dst = t->image[level].Data + xoffset * texelBytes;
-
- memcpy( dst, src, copySize );
-
- smesa->clearTexCache = GL_TRUE;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void sisDDTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- /* Note, this will call sisDDChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- memcpy(t->image[level].Data, texImage->Data, t->image[level].size);
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void sisDDTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- GLuint copySize;
- GLint texelBytes;
- char *src, *dst;
- int j;
- GLuint soffset;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- texelBytes = texImage->TexFormat->TexelBytes;
-
- copySize = width * texelBytes;
- src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) *
- texelBytes;
- dst = t->image[level].Data + (xoffset + yoffset * texImage->Width) *
- texelBytes;
- soffset = texImage->Width * texelBytes;
-
- for (j = yoffset; j < yoffset + height; j++) {
- memcpy( dst, src, copySize );
- src += soffset;
- dst += soffset;
- }
-
- smesa->clearTexCache = GL_TRUE;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-
-}
-
-void sisDDInitTextureFuncs( GLcontext *ctx )
-{
- ctx->Driver.TexEnv = sisDDTexEnv;
- ctx->Driver.ChooseTextureFormat = sisDDChooseTextureFormat;
- ctx->Driver.TexImage1D = sisDDTexImage1D;
- ctx->Driver.TexSubImage1D = sisDDTexSubImage1D;
- ctx->Driver.TexImage2D = sisDDTexImage2D;
- ctx->Driver.TexSubImage2D = sisDDTexSubImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
- ctx->Driver.TexParameter = sisDDTexParameter;
- ctx->Driver.BindTexture = sisDDBindTexture;
- ctx->Driver.DeleteTexture = sisDDDeleteTexture;
- ctx->Driver.IsTextureResident = sisDDIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_tex.h b/xc/lib/GL/mesa/src/drv/sis/sis_tex.h
deleted file mode 100644
index b2f2ba0cb..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_tex.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_TEX_H__
-#define __SIS_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void sisDDInitTextureFuncs( GLcontext *ctx );
-extern void sisUpdateTextureState( GLcontext *ctx );
-
-#endif /* GLX_DIRECT_RENDERING */
-#endif /* __SIS_TEX_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_texstate.c b/xc/lib/GL/mesa/src/drv/sis/sis_texstate.c
deleted file mode 100644
index 001eb18a1..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_texstate.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_tex.h"
-#include "sis_tris.h"
-#include "sis_alloc.h"
-
-static GLint TransferTexturePitch (GLint dwPitch);
-
-/* Handle texenv stuff, called from validate_texture (renderstart) */
-static void
-sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj,
- int unit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit];
-
- sisTexObjPtr t = texObj->DriverData;
-
- switch (texture_unit->EnvMode)
- {
- case GL_REPLACE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AS;
- break;
- }
- break;
-
- case GL_MODULATE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CFCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- }
- break;
-
- case GL_DECAL:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFOMAS_CSAS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- }
- break;
-
- case GL_BLEND:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 1);
-#if 0 /* XXX Blending broken */
- current->hwTexEnvColor =
- ((GLint) (texture_unit->EnvColor[3])) << 24 |
- ((GLint) (texture_unit->EnvColor[0])) << 16 |
- ((GLint) (texture_unit->EnvColor[1])) << 8 |
- ((GLint) (texture_unit->EnvColor[2]));
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFOMAS_ACAS;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- }
- break;
-#endif
- }
-
- if ((current->hwTexBlendColor0 != prev->hwTexBlendColor0) ||
- (current->hwTexBlendAlpha0 != prev->hwTexBlendAlpha0) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexEnvColor = current->hwTexEnvColor;
- prev->hwTexBlendColor0 = current->hwTexBlendColor0;
- prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV;
- }
-}
-
-/* Handle texenv stuff, called from validate_texture (renderstart) */
-static void
-sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj,
- int unit)
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit];
-
- sisTexObjPtr t = texObj->DriverData;
-
- switch (texture_unit->EnvMode)
- {
- case GL_REPLACE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AS;
- break;
- }
- break;
-
- case GL_MODULATE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CFCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- }
- break;
-
- case GL_DECAL:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFOMAS_CSAS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- }
- break;
-
- case GL_BLEND:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 1);
-#if 0 /* XXX Blending broken */
- current->hwTexEnvColor =
- ((GLint) (texture_unit->EnvColor[3])) << 24 |
- ((GLint) (texture_unit->EnvColor[0])) << 16 |
- ((GLint) (texture_unit->EnvColor[1])) << 8 |
- ((GLint) (texture_unit->EnvColor[2]));
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFOMAS_ACAS;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- }
- break;
-#endif
- }
-
- if ((current->hwTexBlendColor1 != prev->hwTexBlendColor1) ||
- (current->hwTexBlendAlpha1 != prev->hwTexBlendAlpha1) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor1 = current->hwTexBlendColor1;
- prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV_1;
- }
-}
-
-/* Returns 0 if a software fallback is necessary */
-static GLboolean
-sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
- int hw_unit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- int ok = 1;
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- sisTexObjPtr t = texObj->DriverData;
-
- GLint firstLevel, lastLevel;
- GLint i;
-
- current->texture[hw_unit].hwTextureMip = 0UL;
- current->texture[hw_unit].hwTextureSet = t->hwformat;
-
- if ((texObj->MinFilter == GL_NEAREST) || (texObj->MinFilter == GL_LINEAR)) {
- firstLevel = lastLevel = texObj->BaseLevel;
- } else {
- /* Compute which mipmap levels we really want to send to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL.
- * Yes, this looks overly complicated, but it's all needed.
- */
-
- firstLevel = texObj->BaseLevel + (GLint)(texObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, texObj->BaseLevel);
- lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, texObj->BaseLevel);
- lastLevel = MIN2(lastLevel, texObj->BaseLevel +
- texObj->Image[texObj->BaseLevel]->MaxLog2);
- lastLevel = MIN2(lastLevel, texObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- current->texture[hw_unit].hwTextureSet |= (lastLevel << 8);
-
- switch (texObj->MagFilter)
- {
- case GL_NEAREST:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- current->texture[hw_unit].hwTextureMip |= (TEXTURE_FILTER_LINEAR << 3);
- break;
- }
-
- {
- GLint b;
-
- /* The mipmap lod biasing is based on experiment. It seems there's a
- * limit of around +4/-4 to the bias value; we're being conservative.
- */
- b = (GLint) (ctx->Texture.Unit[hw_unit].LodBias * 32.0);
- if (b > 127)
- b = 127;
- else if (b < -128)
- b = -128;
-
- current->texture[hw_unit].hwTextureMip |= ((b << 4) &
- MASK_TextureMipmapLodBias);
- }
-
- switch (texObj->MinFilter)
- {
- case GL_NEAREST:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
-
- switch (texObj->WrapS)
- {
- case GL_REPEAT:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapU;
- break;
- case GL_CLAMP:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureClampU;
- break;
- case GL_CLAMP_TO_EDGE:
- /*
- * ?? not support yet
- */
- ok = 0;
- break;
- }
-
- switch (texObj->WrapT)
- {
- case GL_REPEAT:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapV;
- break;
- case GL_CLAMP:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureClampV;
- break;
- case GL_CLAMP_TO_EDGE:
- /*
- * ?? not support yet
- */
- ok = 0;
- break;
- }
-
-/*
- if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampU) {
- current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampU;
- current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderU;
- }
-
- if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampV) {
- current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampV;
- current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderV;
- }
-*/
- current->texture[hw_unit].hwTextureBorderColor =
- ((GLuint) texObj->BorderColor[3] << 24) +
- ((GLuint) texObj->BorderColor[0] << 16) +
- ((GLuint) texObj->BorderColor[1] << 8) +
- ((GLuint) texObj->BorderColor[2]);
-
- if (current->texture[hw_unit].hwTextureBorderColor !=
- prev->texture[hw_unit].hwTextureBorderColor)
- {
- prev->texture[hw_unit].hwTextureBorderColor =
- current->texture[hw_unit].hwTextureBorderColor;
- if (hw_unit == 1)
- smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR_1;
- else
- smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR;
- }
-
- current->texture[hw_unit].hwTextureSet |=
- texObj->Image[firstLevel]->WidthLog2 << 4;
- current->texture[hw_unit].hwTextureSet |=
- texObj->Image[firstLevel]->HeightLog2;
-
- if (hw_unit == 0)
- smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS;
- else
- smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS_1;
-
- for (i = firstLevel; i <= lastLevel; i++)
- {
- GLuint texOffset = 0;
- GLuint texPitch = TransferTexturePitch( t->image[i].pitch );
-
- switch (t->image[i].memType)
- {
- case VIDEO_TYPE:
- texOffset = ((unsigned long)t->image[i].Data - (unsigned long)smesa->FbBase);
- break;
- case AGP_TYPE:
- texOffset = ((unsigned long)t->image[i].Data - (unsigned long)smesa->AGPBase) +
- (unsigned long) smesa->AGPAddr;
- current->texture[hw_unit].hwTextureMip |=
- (MASK_TextureLevel0InSystem << i);
- break;
- }
-
- switch (i)
- {
- case 0:
- prev->texture[hw_unit].texOffset0 = texOffset;
- prev->texture[hw_unit].texPitch01 = texPitch << 16;
- break;
- case 1:
- prev->texture[hw_unit].texOffset1 = texOffset;
- prev->texture[hw_unit].texPitch01 |= texPitch;
- break;
- case 2:
- prev->texture[hw_unit].texOffset2 = texOffset;
- prev->texture[hw_unit].texPitch23 = texPitch << 16;
- break;
- case 3:
- prev->texture[hw_unit].texOffset3 = texOffset;
- prev->texture[hw_unit].texPitch23 |= texPitch;
- break;
- case 4:
- prev->texture[hw_unit].texOffset4 = texOffset;
- prev->texture[hw_unit].texPitch45 = texPitch << 16;
- break;
- case 5:
- prev->texture[hw_unit].texOffset5 = texOffset;
- prev->texture[hw_unit].texPitch45 |= texPitch;
- break;
- case 6:
- prev->texture[hw_unit].texOffset6 = texOffset;
- prev->texture[hw_unit].texPitch67 = texPitch << 16;
- break;
- case 7:
- prev->texture[hw_unit].texOffset7 = texOffset;
- prev->texture[hw_unit].texPitch67 |= texPitch;
- break;
- case 8:
- prev->texture[hw_unit].texOffset8 = texOffset;
- prev->texture[hw_unit].texPitch89 = texPitch << 16;
- break;
- case 9:
- prev->texture[hw_unit].texOffset9 = texOffset;
- prev->texture[hw_unit].texPitch89 |= texPitch;
- break;
- case 10:
- prev->texture[hw_unit].texOffset10 = texOffset;
- prev->texture[hw_unit].texPitch10 = texPitch << 16;
- break;
- case 11:
- prev->texture[hw_unit].texOffset11 = texOffset;
- prev->texture[hw_unit].texPitch10 |= texPitch;
- break;
- }
- }
-
- if (current->texture[hw_unit].hwTextureSet !=
- prev->texture[hw_unit].hwTextureSet)
- {
- prev->texture[hw_unit].hwTextureSet =
- current->texture[hw_unit].hwTextureSet;
- if (hw_unit == 1)
- smesa->GlobalFlag |= CFLAG_TEXTURERESET_1;
- else
- smesa->GlobalFlag |= CFLAG_TEXTURERESET;
- }
- if (current->texture[hw_unit].hwTextureMip !=
- prev->texture[hw_unit].hwTextureMip)
- {
- prev->texture[hw_unit].hwTextureMip =
- current->texture[hw_unit].hwTextureMip;
- if (hw_unit == 1)
- smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP_1;
- else
- smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP;
- }
-
- return ok;
-}
-
-/* Disable a texture unit, called from validate_texture */
-static void
-sis_reset_texture_env (GLcontext *ctx, int hw_unit)
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (hw_unit == 1)
- {
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
-
- if ((current->hwTexBlendColor1 != prev->hwTexBlendColor1) ||
- (current->hwTexBlendAlpha1 != prev->hwTexBlendAlpha1) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor1 = current->hwTexBlendColor1;
- prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV_1;
- }
- } else {
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
-
- if ((current->hwTexBlendColor0 != prev->hwTexBlendColor0) ||
- (current->hwTexBlendAlpha0 != prev->hwTexBlendAlpha0) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor0 = current->hwTexBlendColor0;
- prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV;
- }
- }
-}
-
-static void updateTextureUnit( GLcontext *ctx, int unit )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj = texUnit->_Current;
- GLint fallbackbit;
-
- if (unit == 0)
- fallbackbit = SIS_FALLBACK_TEXTURE0;
- else
- fallbackbit = SIS_FALLBACK_TEXTURE1;
-
- if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
- if (smesa->TexStates[unit] & NEW_TEXTURING) {
- GLboolean ok;
-
- ok = sis_set_texobj_parm (ctx, texObj, unit);
- FALLBACK( smesa, fallbackbit, !ok );
- }
- if (smesa->TexStates[unit] & NEW_TEXTURE_ENV) {
- if (unit == 0)
- sis_set_texture_env0( ctx, texObj, unit );
- else
- sis_set_texture_env1( ctx, texObj, unit );
- }
- smesa->TexStates[unit] = 0;
- } else if ( texUnit->_ReallyEnabled ) {
- /* fallback */
- FALLBACK( smesa, fallbackbit, 1 );
- } else {
- sis_reset_texture_env( ctx, unit );
- FALLBACK( smesa, fallbackbit, 0 );
- }
-}
-
-
-void sisUpdateTextureState( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- int i;
- __GLSiSHardware *current = &smesa->current;
-
-#if 1
- /* TODO : if unmark these, error in multitexture */ /* XXX */
- for (i = 0; i < SIS_MAX_TEXTURES; i++)
- smesa->TexStates[i] |= (NEW_TEXTURING | NEW_TEXTURE_ENV);
-#endif
-
- updateTextureUnit( ctx, 0 );
- updateTextureUnit( ctx, 1 );
-
- /* XXX Issues with the 2nd unit but not the first being enabled? */
- if ( ctx->Texture.Unit[0]._ReallyEnabled &
- (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ||
- ctx->Texture.Unit[1]._ReallyEnabled &
- (TEXTURE_1D_BIT | TEXTURE_2D_BIT) )
- {
- current->hwCapEnable |= MASK_TextureEnable;
- current->hwCapEnable &= ~MASK_TextureNumUsed;
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- current->hwCapEnable |= 0x00002000;
- else
- current->hwCapEnable |= 0x00001000;
- } else {
- current->hwCapEnable &= ~MASK_TextureEnable;
- }
-}
-
-static GLint
-BitScanForward( GLshort w )
-{
- GLint i;
-
- for (i = 0; i < 16; i++) {
- if (w & (1 << i))
- break;
- }
- return i;
-}
-
-static GLint
-TransferTexturePitch( GLint dwPitch )
-{
- GLint dwRet, i;
-
- i = BitScanForward( (GLshort)dwPitch );
- dwRet = dwPitch >> i;
- dwRet |= i << 9;
- return dwRet;
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_tris.c b/xc/lib/GL/mesa/src/drv/sis/sis_tris.c
deleted file mode 100644
index 4877e3465..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_tris.c
+++ /dev/null
@@ -1,954 +0,0 @@
-/* $XFree86*/ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "sis_tris.h"
-#include "sis_state.h"
-#include "sis_vb.h"
-#include "sis_lock.h"
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- OP_3D_POINT_DRAW, /* GL_POINTS */
- OP_3D_LINE_DRAW, /* GL_LINES */
- OP_3D_LINE_DRAW, /* GL_LINE_LOOP */
- OP_3D_LINE_DRAW, /* GL_LINE_STRIP */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLES */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLE_STRIP */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLE_FAN */
- OP_3D_TRIANGLE_DRAW, /* GL_QUADS */
- OP_3D_TRIANGLE_DRAW, /* GL_QUAD_STRIP */
- OP_3D_TRIANGLE_DRAW /* GL_POLYGON */
-};
-
-static const GLuint hw_prim_mmio_fire[OP_3D_TRIANGLE_DRAW+1] = {
- OP_3D_FIRE_TSARGBa,
- OP_3D_FIRE_TSARGBb,
- OP_3D_FIRE_TSARGBc
-};
-
-static const GLuint hw_prim_mmio_shade[OP_3D_TRIANGLE_DRAW+1] = {
- SHADE_FLAT_VertexA,
- SHADE_FLAT_VertexB,
- SHADE_FLAT_VertexC
-};
-
-static const GLuint hw_prim_agp_type[OP_3D_TRIANGLE_DRAW+1] = {
- MASK_PsPointList,
- MASK_PsLineList,
- MASK_PsTriangleList
-};
-
-static const GLuint hw_prim_agp_shade[OP_3D_TRIANGLE_DRAW+1] = {
- MASK_PsShadingFlatA,
- MASK_PsShadingFlatB,
- MASK_PsShadingFlatC
-};
-
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void sisMakeRoomAGP( sisContextPtr smesa, GLint num );
-static void sisUpdateAGP( sisContextPtr smesa );
-static void sisFireVertsAGP( sisContextPtr smesa );
-
-static float *AGP_StartPtr;
-static float *AGP_WritePtr; /* Current write position */
-static float *AGP_ReadPtr; /* Last known engine readposition */
-static long AGP_SpaceLeft; /* Last known engine readposition */
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-/* Future optimizations:
- *
- * The previous code only emitted W when fog or textures were enabled.
- */
-
-#define SIS_MMIO_WRITE_VERTEX(_v, i, lastvert) \
-do { \
- MMIOBase[(REG_3D_TSXa+(i)*0x30)/4] = _v->v.x; \
- MMIOBase[(REG_3D_TSYa+(i)*0x30)/4] = _v->v.y; \
- MMIOBase[(REG_3D_TSZa+(i)*0x30)/4] = _v->v.z; \
- MMIOBase[(REG_3D_TSWGa+(i)*0x30)/4] = _v->v.w; \
- /*((GLint *) MMIOBase)[(REG_3D_TSFSa+(i)*0x30)/4] = _v->ui[5];*/ \
- if (SIS_STATES & SIS_VERT_TEX0) { \
- MMIOBase[(REG_3D_TSUAa+(i)*0x30)/4] = _v->v.u0; \
- MMIOBase[(REG_3D_TSVAa+(i)*0x30)/4] = _v->v.v0; \
- } \
- if (SIS_STATES & SIS_VERT_TEX1) { \
- MMIOBase[(REG_3D_TSUBa+(i)*0x30)/4] = _v->v.u1; \
- MMIOBase[(REG_3D_TSVBa+(i)*0x30)/4] = _v->v.v1; \
- } \
- /*MMIOBase[(REG_3D_TSUCa+(i)*0x30)/4] = _v->v.u2; \
- MMIOBase[(REG_3D_TSVCa+(i)*0x30)/4] = _v->v.v2;*/ \
- /* the ARGB write of the last vertex of the primitive fires the 3d engine*/ \
- if (lastvert || (SIS_STATES & SIS_VERT_SMOOTH)) \
- ((GLint *) MMIOBase)[(REG_3D_TSARGBa+(i)*0x30)/4] = _v->ui[4]; \
-} while (0);
-
-#define SIS_AGP_WRITE_VERTEX(_v) \
-do { \
- AGP_WritePtr[0] = _v->v.x; \
- AGP_WritePtr[1] = _v->v.y; \
- AGP_WritePtr[2] = _v->v.z; \
- AGP_WritePtr[3] = _v->v.w; \
- ((GLint *)AGP_WritePtr)[4] = _v->ui[4]; \
- AGP_WritePtr += 5; \
- if (SIS_STATES & SIS_VERT_TEX0) { \
- AGP_WritePtr[0] = _v->v.u0; \
- AGP_WritePtr[1] = _v->v.v0; \
- AGP_WritePtr += 2; \
- } \
- if (SIS_STATES & SIS_VERT_TEX1) { \
- AGP_WritePtr[0] = _v->v.u1; \
- AGP_WritePtr[1] = _v->v.v1; \
- AGP_WritePtr += 2; \
- } \
-} while(0)
-
-#define MMIO_VERT_REG_COUNT 10
-
-#define SIS_VERT_SMOOTH 0x01
-#define SIS_VERT_TEX0 0x02
-#define SIS_VERT_TEX1 0x04
-
-static sis_quad_func sis_quad_func_agp[8];
-static sis_tri_func sis_tri_func_agp[8];
-static sis_line_func sis_line_func_agp[8];
-static sis_point_func sis_point_func_agp[8];
-static sis_quad_func sis_quad_func_mmio[8];
-static sis_tri_func sis_tri_func_mmio[8];
-static sis_line_func sis_line_func_mmio[8];
-static sis_point_func sis_point_func_mmio[8];
-
-/* XXX: These definitions look questionable */
-#define USE_XYZ MASK_PsVertex_HAS_RHW
-#define USE_W MASK_PsVertex_HAS_NORMALXYZ
-#define USE_RGB MASK_PsVertex_HAS_SPECULAR
-#define USE_UV1 MASK_PsVertex_HAS_UVSet2
-#define USE_UV2 MASK_PsVertex_HAS_UVSet3
-
-static GLint AGPParsingValues[8] = {
- (5 << 28) | USE_XYZ | USE_W | USE_RGB,
- (5 << 28) | USE_XYZ | USE_W | USE_RGB,
- (7 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV1,
- (7 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV1,
- (7 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV2,
- (7 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV2,
- (9 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV1 | USE_UV2,
- (9 << 28) | USE_XYZ | USE_W | USE_RGB | USE_UV1 | USE_UV2,
-};
-
-#define SIS_STATES (0)
-#define TAG(x) x##_none
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_SMOOTH)
-#define TAG(x) x##_s
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_TEX0)
-#define TAG(x) x##_t0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_SMOOTH | SIS_VERT_TEX0)
-#define TAG(x) x##_st0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_TEX1)
-#define TAG(x) x##_t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_SMOOTH | SIS_VERT_TEX1)
-#define TAG(x) x##_st1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_TEX0 | SIS_VERT_TEX1)
-#define TAG(x) x##_t0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (SIS_VERT_SMOOTH | SIS_VERT_TEX0 | SIS_VERT_TEX1)
-#define TAG(x) x##_st0t1
-#include "sis_tritmp.h"
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define POINT( v0 ) smesa->draw_point( smesa, v0 )
-#define LINE( v0, v1 ) smesa->draw_line( smesa, v0, v1 )
-#define TRI( a, b, c ) smesa->draw_tri( smesa, a, b, c )
-#define QUAD( a, b, c, d ) smesa->draw_quad( smesa, a, b, c, d )
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define SIS_OFFSET_BIT 0x01
-#define SIS_TWOSIDE_BIT 0x02
-#define SIS_UNFILLED_BIT 0x04
-#define SIS_FALLBACK_BIT 0x08
-#define SIS_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[SIS_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & SIS_FALLBACK_BIT)
-#define DO_OFFSET (IND & SIS_OFFSET_BIT)
-#define DO_UNFILLED (IND & SIS_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & SIS_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX sisVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (smesa->verts + (e << smesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) \
- do { \
- sis_color_t *vc = (sis_color_t *)&(v)->ui[coloroffset]; \
- vc->blue = (c)[2]; \
- vc->green = (c)[1]; \
- vc->red = (c)[0]; \
- vc->alpha = (c)[3]; \
- } while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v0, c ) \
- if (havespec) { \
- (v0)->v.specular.red = (c)[0]; \
- (v0)->v.specular.green = (c)[1]; \
- (v0)->v.specular.blue = (c)[2]; \
- }
-#define VERT_COPY_SPEC( v0, v1 ) \
- if (havespec) { \
- (v0)->v.specular.red = v1->v.specular.red; \
- (v0)->v.specular.green = v1->v.specular.green; \
- (v0)->v.specular.blue = v1->v.specular.blue; \
- }
-
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (smesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (smesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (smesa->hw_primitive != hw_prim[x]) \
- sisRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE smesa->render_primitive
-#define IND SIS_FALLBACK_BIT
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT | SIS_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_OFFSET_BIT | SIS_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_OFFSET_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_UNFILLED_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT | SIS_UNFILLED_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_UNFILLED_BIT | SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT | SIS_OFFSET_BIT | SIS_UNFILLED_BIT | \
- SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-sis_fallback_quad( sisContextPtr smesa,
- sisVertex *v0,
- sisVertex *v1,
- sisVertex *v2,
- sisVertex *v3 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[4];
- sis_translate_vertex( ctx, v0, &v[0] );
- sis_translate_vertex( ctx, v1, &v[1] );
- sis_translate_vertex( ctx, v2, &v[2] );
- sis_translate_vertex( ctx, v3, &v[3] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[3] );
- _swrast_Triangle( ctx, &v[1], &v[2], &v[3] );
-}
-
-static void
-sis_fallback_tri( sisContextPtr smesa,
- sisVertex *v0,
- sisVertex *v1,
- sisVertex *v2 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[3];
- sis_translate_vertex( ctx, v0, &v[0] );
- sis_translate_vertex( ctx, v1, &v[1] );
- sis_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-sis_fallback_line( sisContextPtr smesa,
- sisVertex *v0,
- sisVertex *v1 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[2];
- sis_translate_vertex( ctx, v0, &v[0] );
- sis_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-sis_fallback_point( sisContextPtr smesa,
- sisVertex *v0 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[1];
- sis_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (sisVertex *)(sisverts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- smesa->draw_point( smesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) smesa->draw_line( smesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) smesa->draw_tri( smesa, VERT(v0), VERT(v1), \
- VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) smesa->draw_quad( smesa, VERT(v0), \
- VERT(v1), VERT(v2), VERT(v3))
-#define INIT(x) sisRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- const GLuint shift = smesa->vertex_stride_shift; \
- const char *sisverts = (char *)smesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) sis_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) sis_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void sisRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-}
-
-static void sisRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-#if 0
-static void sisFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLuint vertsize = smesa->vertex_size;
- GLuint *vb = r128AllocDmaLow( rmesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *sisverts = (GLubyte *)smesa->verts;
- const GLuint shift = smesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i,j;
-
- smesa->num_verts += (n-2) * 3;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, (sisVertexPtr) VERT(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, (sisVertexPtr) VERT(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, (sisVertexPtr) start );
- }
-}
-#endif
-
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _SIS_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void sisChooseRenderState(GLcontext *ctx)
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
- GLuint vertindex = 0;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- vertindex |= SIS_VERT_TEX0;
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- vertindex |= SIS_VERT_TEX1;
- if (ctx->Light.ShadeModel == GL_SMOOTH)
- vertindex |= SIS_VERT_SMOOTH;
-
- if (smesa->AGPCmdModeEnabled) {
- smesa->draw_quad = sis_quad_func_agp[vertindex];
- smesa->draw_tri = sis_tri_func_agp[vertindex];
- smesa->draw_line = sis_line_func_agp[vertindex];
- smesa->draw_point = sis_point_func_agp[vertindex];
- } else {
- smesa->draw_quad = sis_quad_func_mmio[vertindex];
- smesa->draw_tri = sis_tri_func_mmio[vertindex];
- smesa->draw_line = sis_line_func_mmio[vertindex];
- smesa->draw_point = sis_point_func_mmio[vertindex];
- }
- smesa->AGPParseSet &= ~(MASK_VertexDWSize | MASK_VertexDataFormat);
- smesa->AGPParseSet |= AGPParsingValues[vertindex];
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= SIS_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= SIS_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= SIS_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS) {
- if (flags & POINT_FALLBACK)
- smesa->draw_point = sis_fallback_point;
- if (flags & LINE_FALLBACK)
- smesa->draw_line = sis_fallback_line;
- if (flags & TRI_FALLBACK) {
- smesa->draw_quad = sis_fallback_quad;
- smesa->draw_tri = sis_fallback_tri;
- }
- index |= SIS_FALLBACK_BIT;
- }
- }
-
- if (index != smesa->RenderIndex) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = sis_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = sis_render_tab_elts;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- /*XXX: sisFastRenderClippedPoly*/
- tnl->Driver.Render.ClippedPolygon = sisRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = sisRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = sisRenderClippedPoly;
- }
-
- smesa->RenderIndex = index;
- }
-}
-
-/**********************************************************************/
-/* Multipass rendering for front buffering */
-/**********************************************************************/
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
-
- if (pass >= smesa->driDrawable->numClipRects) {
- return GL_FALSE;
- } else {
- GLint x1, y1, x2, y2;
-
- x1 = smesa->driDrawable->pClipRects[pass].x1 - smesa->driDrawable->x;
- y1 = smesa->driDrawable->pClipRects[pass].y1 - smesa->driDrawable->y;
- x2 = smesa->driDrawable->pClipRects[pass].x2 - smesa->driDrawable->x;
- y2 = smesa->driDrawable->pClipRects[pass].y2 - smesa->driDrawable->y;
-
- if (ctx->Scissor.Enabled) {
- GLint scisy1 = Y_FLIP(ctx->Scissor.Y + ctx->Scissor.Height - 1);
- GLint scisy2 = Y_FLIP(ctx->Scissor.Y);
-
- if (ctx->Scissor.X > x1)
- x1 = ctx->Scissor.X;
- if (scisy1 > y1)
- y1 = scisy1;
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2)
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- if (scisy2 < y2)
- y2 = scisy2;
- }
-
- MMIO(REG_3D_ClipTopBottom, y1 << 13 | y2);
- MMIO(REG_3D_ClipLeftRight, x1 << 13 | x2);
- /* Mark that we clobbered these registers */
- smesa->GlobalFlag |= GFLAG_CLIPPING;
- return GL_TRUE;
- }
-}
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void sisRunPipeline( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
-
- LOCK_HARDWARE();
- sisUpdateHWState( ctx );
-
- if (smesa->AGPCmdModeEnabled) {
- AGP_WritePtr = (GLfloat *)smesa->AGPCmdBufBase + *smesa->pAGPCmdBufNext;
- AGP_StartPtr = AGP_WritePtr;
- AGP_ReadPtr = (GLfloat *)((long)MMIO_READ(REG_3D_AGPCmBase) -
- (long)smesa->AGPCmdBufAddr + (long)smesa->AGPCmdBufBase);
- sisUpdateAGP( smesa );
- }
-
- if (!smesa->Fallback && smesa->NewGLState) {
- if (smesa->NewGLState & _SIS_NEW_VERTEX_STATE)
- sisChooseVertexState( ctx );
-
- if (smesa->NewGLState & (_SIS_NEW_RENDER_STATE | _NEW_TEXTURE))
- sisChooseRenderState( ctx );
-
- smesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-
- if (smesa->AGPCmdModeEnabled)
- sisFireVertsAGP( smesa );
- else
- mEndPrimitive();
- UNLOCK_HARDWARE();
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- */
-
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- if (smesa->hw_primitive != hwprim) {
- if (smesa->AGPCmdModeEnabled) {
- sisFireVertsAGP( smesa );
- smesa->AGPParseSet &= ~(MASK_PsDataType | MASK_PsShadingMode);
- smesa->AGPParseSet |= hw_prim_agp_type[hwprim];
- if (ctx->Light.ShadeModel == GL_FLAT)
- smesa->AGPParseSet |= hw_prim_agp_shade[hwprim];
- else
- smesa->AGPParseSet |= MASK_PsShadingSmooth;
- } else {
- mEndPrimitive();
- smesa->dwPrimitiveSet &= ~(MASK_DrawPrimitiveCommand |
- MASK_SetFirePosition | MASK_ShadingMode);
- smesa->dwPrimitiveSet |= hwprim | hw_prim_mmio_fire[hwprim];
- if (ctx->Light.ShadeModel == GL_FLAT)
- smesa->dwPrimitiveSet |= hw_prim_mmio_shade[hwprim];
- else
- smesa->dwPrimitiveSet |= SHADE_GOURAUD;
- }
- }
- smesa->hw_primitive = hwprim;
-}
-
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->render_primitive = prim;
- if (prim >= GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
- sisRasterPrimitive( ctx, hw_prim[prim] );
-}
-
-
-static void sisRenderStart( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- sisCheckTexSizes( ctx );
-
- if (ctx->Color._DrawDestMask == FRONT_LEFT_BIT &&
- smesa->driDrawable->numClipRects != 0)
- {
- multipass_cliprect(ctx, 0);
- if (smesa->driDrawable->numClipRects > 1)
- tnl->Driver.Render.Multipass = multipass_cliprect;
- else
- tnl->Driver.Render.Multipass = NULL;
- } else {
- tnl->Driver.Render.Multipass = NULL;
- }
-}
-
-static void sisRenderFinish( GLcontext *ctx )
-{
-}
-
-/* Update SpaceLeft after an engine or current write pointer update */
-static void sisUpdateAGP( sisContextPtr smesa )
-{
- /* ReadPtr == WritePtr is the empty case */
- if (AGP_ReadPtr <= AGP_WritePtr)
- AGP_SpaceLeft = (long)smesa->AGPCmdBufBase + (long)smesa->AGPCmdBufSize -
- (long)AGP_WritePtr;
- else
- AGP_SpaceLeft = AGP_ReadPtr - AGP_WritePtr - 4;
-}
-
-/* Fires a set of vertices that have been written from AGP_StartPtr to
- * AGP_WritePtr, using the smesa->AGPParseSet format.
- */
-void
-sisFireVertsAGP( sisContextPtr smesa )
-{
- if (AGP_WritePtr == AGP_StartPtr)
- return;
-
- mWait3DCmdQueue(5);
- mEndPrimitive();
- MMIO(REG_3D_AGPCmBase, (long)AGP_StartPtr - (long)smesa->AGPCmdBufBase +
- (long)smesa->AGPCmdBufAddr);
- MMIO(REG_3D_AGPTtDwNum, (((long)AGP_WritePtr - (long)AGP_StartPtr) >> 2) |
- 0x50000000);
- MMIO(REG_3D_ParsingSet, smesa->AGPParseSet);
-
- MMIO(REG_3D_AGPCmFire, (GLint)(-1));
- mEndPrimitive();
-
- *(smesa->pAGPCmdBufNext) = (((long)AGP_WritePtr -
- (long)smesa->AGPCmdBufBase) + 0xf) & ~0xf;
- AGP_StartPtr = AGP_WritePtr;
- sisUpdateAGP( smesa );
-}
-
-/* Make sure there are more than num dwords left in the AGP queue. */
-static void
-sisMakeRoomAGP( sisContextPtr smesa, GLint num )
-{
- int size = num * 4;
-
- if (size <= AGP_SpaceLeft) {
- AGP_SpaceLeft -= size;
- return;
- }
- /* Wrapping */
- if (AGP_WritePtr + num > (GLfloat *)(smesa->AGPCmdBufBase +
- smesa->AGPCmdBufSize))
- {
- sisFireVertsAGP( smesa );
- AGP_WritePtr = (GLfloat *)smesa->AGPCmdBufBase;
- AGP_StartPtr = AGP_WritePtr;
- sisUpdateAGP( smesa );
- WaitEngIdle( smesa ); /* XXX Why is this necessary? */
- }
-
- if (size > AGP_SpaceLeft) {
- /* Update the cached engine read pointer */
- AGP_ReadPtr = (GLfloat *)((long)MMIO_READ(REG_3D_AGPCmBase) -
- (long)smesa->AGPCmdBufAddr + (long)smesa->AGPCmdBufBase);
- sisUpdateAGP( smesa );
- while (size > AGP_SpaceLeft) {
- /* Spin until space is available. */
- usleep(1);
- AGP_ReadPtr = (GLfloat *)((long)MMIO_READ(REG_3D_AGPCmBase) -
- (long)smesa->AGPCmdBufAddr + (long)smesa->AGPCmdBufBase);
- sisUpdateAGP( smesa );
- }
- }
- AGP_SpaceLeft -= size;
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLuint oldfallback = smesa->Fallback;
-
- if (mode) {
- smesa->Fallback |= bit;
- if (oldfallback == 0) {
- _swsetup_Wakeup( ctx );
- smesa->RenderIndex = ~0;
- }
- }
- else {
- smesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = sisRenderStart;
- tnl->Driver.Render.PrimitiveNotify = sisRenderPrimitive;
- tnl->Driver.Render.Finish = sisRenderFinish;
- tnl->Driver.Render.BuildVertices = sisBuildVertices;
- smesa->NewGLState |= (_SIS_NEW_RENDER_STATE|
- _SIS_NEW_VERTEX_STATE);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void sisInitTriFuncs( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
-
- sis_vert_init_none();
- sis_vert_init_s();
- sis_vert_init_t0();
- sis_vert_init_st0();
- sis_vert_init_t1();
- sis_vert_init_st1();
- sis_vert_init_t0t1();
- sis_vert_init_st0t1();
- }
-
- tnl->Driver.RunPipeline = sisRunPipeline;
- tnl->Driver.Render.Start = sisRenderStart;
- tnl->Driver.Render.Finish = sisRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = sisRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = sisBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-
- if (driQueryOptionb(&smesa->optionCache, "fallback_force"))
- sisFallback(ctx, SIS_FALLBACK_FORCE, 1);
- else
- sisFallback(ctx, SIS_FALLBACK_FORCE, 0);
-
- smesa->RenderIndex = ~0;
- smesa->NewGLState |= (_SIS_NEW_RENDER_STATE|
- _SIS_NEW_VERTEX_STATE);
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_tris.h b/xc/lib/GL/mesa/src/drv/sis/sis_tris.h
deleted file mode 100644
index d0ca7c12c..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_tris.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.8 2002/10/30 12:51:43 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_TRIS_H__
-#define __SIS_TRIS_H__
-
-#include "mtypes.h"
-
-extern void sisInitTriFuncs( GLcontext *ctx );
-
-
-extern void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( smesa, bit, mode ) sisFallback( smesa->glCtx, bit, mode )
-
-
-#endif /* __SIS_TRIS_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_tritmp.h b/xc/lib/GL/mesa/src/drv/sis/sis_tritmp.h
deleted file mode 100644
index 775965854..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_tritmp.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $XFree86*/ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#define AGP_VERT_REG_COUNT (5 + \
- ((SIS_STATES & SIS_VERT_TEX0) != 0) * 2 + \
- ((SIS_STATES & SIS_VERT_TEX1) != 0) * 2)
-
-static void TAG(sis_draw_quad_mmio)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1,
- sisVertexPtr v2,
- sisVertexPtr v3 )
-{
- float *MMIOBase = (float *)GET_IOBase (smesa);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 6 + 1);
- ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet;
- SIS_MMIO_WRITE_VERTEX(v0, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v1, 1, 0);
- SIS_MMIO_WRITE_VERTEX(v3, 2, 1);
- SIS_MMIO_WRITE_VERTEX(v1, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v2, 1, 0);
- SIS_MMIO_WRITE_VERTEX(v3, 2, 1);
-}
-
-static void TAG(sis_draw_tri_mmio)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1,
- sisVertexPtr v2 )
-{
- float *MMIOBase = (float *)GET_IOBase (smesa);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 3 + 1);
- ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet;
- SIS_MMIO_WRITE_VERTEX(v0, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v1, 1, 0);
- SIS_MMIO_WRITE_VERTEX(v2, 2, 1);
-}
-
-static void TAG(sis_draw_line_mmio)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1 )
-{
- float *MMIOBase = (float *)GET_IOBase (smesa);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 2 + 1);
- ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet;
- SIS_MMIO_WRITE_VERTEX(v0, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v1, 1, 1);
-}
-
-static void TAG(sis_draw_point_mmio)( sisContextPtr smesa,
- sisVertexPtr v0 )
-{
- float *MMIOBase = (float *)GET_IOBase (smesa);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 1 + 1);
- ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet;
- SIS_MMIO_WRITE_VERTEX(v0, 1, 1);
-}
-
-static void TAG(sis_draw_quad_agp)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1,
- sisVertexPtr v2,
- sisVertexPtr v3 )
-{
- sisMakeRoomAGP(smesa, AGP_VERT_REG_COUNT * 6);
-
- SIS_AGP_WRITE_VERTEX(v0);
- SIS_AGP_WRITE_VERTEX(v1);
- SIS_AGP_WRITE_VERTEX(v3);
- SIS_AGP_WRITE_VERTEX(v1);
- SIS_AGP_WRITE_VERTEX(v2);
- SIS_AGP_WRITE_VERTEX(v3);
-}
-
-static void TAG(sis_draw_tri_agp)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1,
- sisVertexPtr v2 )
-{
- sisMakeRoomAGP(smesa, AGP_VERT_REG_COUNT * 3);
-
- SIS_AGP_WRITE_VERTEX(v0);
- SIS_AGP_WRITE_VERTEX(v1);
- SIS_AGP_WRITE_VERTEX(v2);
-}
-
-static void TAG(sis_draw_line_agp)( sisContextPtr smesa,
- sisVertexPtr v0,
- sisVertexPtr v1 )
-{
- sisMakeRoomAGP(smesa, AGP_VERT_REG_COUNT * 2);
-
- SIS_AGP_WRITE_VERTEX(v0);
- SIS_AGP_WRITE_VERTEX(v1);
-}
-
-static void TAG(sis_draw_point_agp)( sisContextPtr smesa,
- sisVertexPtr v0 )
-{
- sisMakeRoomAGP(smesa, AGP_VERT_REG_COUNT * 1);
-
- SIS_AGP_WRITE_VERTEX(v0);
-}
-
-static __inline void TAG(sis_vert_init)( void )
-{
- sis_quad_func_agp[SIS_STATES] = TAG(sis_draw_quad_agp);
- sis_tri_func_agp[SIS_STATES] = TAG(sis_draw_tri_agp);
- sis_line_func_agp[SIS_STATES] = TAG(sis_draw_line_agp);
- sis_point_func_agp[SIS_STATES] = TAG(sis_draw_point_agp);
- sis_quad_func_mmio[SIS_STATES] = TAG(sis_draw_quad_mmio);
- sis_tri_func_mmio[SIS_STATES] = TAG(sis_draw_tri_mmio);
- sis_line_func_mmio[SIS_STATES] = TAG(sis_draw_line_mmio);
- sis_point_func_mmio[SIS_STATES] = TAG(sis_draw_point_mmio);
-}
-
-#undef AGP_VERT_REG_COUNT
-#undef TAG
-#undef SIS_STATES
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_vb.c b/xc/lib/GL/mesa/src/drv/sis/sis_vb.c
deleted file mode 100644
index 0c5656a76..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_vb.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "sis_context.h"
-#include "sis_vb.h"
-#include "sis_tris.h"
-#include "sis_state.h"
-
-
-#define SIS_TEX1_BIT 0x1
-#define SIS_TEX0_BIT 0x2
-#define SIS_RGBA_BIT 0x4
-#define SIS_SPEC_BIT 0x8
-#define SIS_FOG_BIT 0x10
-#define SIS_XYZW_BIT 0x20
-#define SIS_PTEX_BIT 0x40
-#define SIS_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[SIS_MAX_SETUP];
-
-#define TEX0_VERTEX_FORMAT 1
-#define TEX1_VERTEX_FORMAT 2
-
-#define TINY_VERTEX_FORMAT 0
-#define NOTEX_VERTEX_FORMAT 0
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & SIS_XYZW_BIT)
-#define DO_RGBA (IND & SIS_RGBA_BIT)
-#define DO_SPEC (IND & SIS_SPEC_BIT)
-#define DO_FOG (IND & SIS_FOG_BIT)
-#define DO_TEX0 (IND & SIS_TEX0_BIT)
-#define DO_TEX1 (IND & SIS_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & SIS_PTEX_BIT)
-
-#define VERTEX sisVertex
-#define VERTEX_COLOR sis_color_t
-#define LOCALVARS sisContextPtr smesa = SIS_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() smesa->hw_viewport
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() smesa->vertex_format
-#define GET_VERTEX_STORE() smesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() smesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &smesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &smesa->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 0
-#define HAVE_NOTEX_VERTICES 0
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS GLfloat h = SIS_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z / smesa->depth_scale
-
-#define PTEX_FALLBACK() FALLBACK(smesa, SIS_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS sis_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS sis_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[smesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[smesa->SetupIndex].copy_pv
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) sis_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_TEX0_BIT|SIS_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT|\
- SIS_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT|\
- SIS_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_TEX0_BIT|\
- SIS_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_TEX0_BIT|\
- SIS_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT|\
- SIS_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT|\
- SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_XYZW_BIT|SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT|\
- SIS_TEX0_BIT|SIS_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_FOG_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_FOG_BIT|SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT|SIS_TEX0_BIT|SIS_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (SIS_RGBA_BIT|SIS_FOG_BIT|SIS_SPEC_BIT|SIS_TEX0_BIT|\
- SIS_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-void sisPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & SIS_XYZW_BIT) ? " xyzw," : "",
- (flags & SIS_RGBA_BIT) ? " rgba," : "",
- (flags & SIS_SPEC_BIT) ? " spec," : "",
- (flags & SIS_FOG_BIT) ? " fog," : "",
- (flags & SIS_TEX0_BIT) ? " tex-0," : "",
- (flags & SIS_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-
-void sisCheckTexSizes( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
-
- if (!setup_tab[smesa->SetupIndex].check_tex_sizes(ctx)) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /* Invalidate stored verts
- */
- smesa->SetupNewInputs = ~0;
- smesa->SetupIndex |= SIS_PTEX_BIT;
-
- if (!smesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[smesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[smesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void sisBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)smesa->verts + (start<<smesa->vertex_stride_shift));
- GLuint stride = 1 << smesa->vertex_stride_shift;
-
- newinputs |= smesa->SetupNewInputs;
- smesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[smesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= SIS_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= SIS_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= SIS_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= SIS_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= SIS_FOG_BIT;
-
- if (smesa->SetupIndex & SIS_PTEX_BIT)
- ind = ~0;
-
- ind &= smesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void sisChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLuint ind = SIS_XYZW_BIT | SIS_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= SIS_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= SIS_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits) {
- ind |= SIS_TEX0_BIT;
- if (ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[1]._ReallyEnabled)
- ind |= SIS_TEX1_BIT;
- }
-
- smesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = sis_interp_extras;
- tnl->Driver.Render.CopyPV = sis_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != smesa->vertex_format) {
- smesa->vertex_format = setup_tab[ind].vertex_format;
- smesa->vertex_size = setup_tab[ind].vertex_size;
- smesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-void sisInitVB( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
-
- smesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
-}
-
-void sisFreeVB( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- if (smesa->verts) {
- ALIGN_FREE(smesa->verts);
- smesa->verts = NULL;
- }
-
-
- if (smesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(smesa->UbyteSecondaryColor.Ptr);
- smesa->UbyteSecondaryColor.Ptr = NULL;
- }
-
- if (smesa->UbyteColor.Ptr) {
- ALIGN_FREE(smesa->UbyteColor.Ptr);
- smesa->UbyteColor.Ptr = NULL;
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_vb.h b/xc/lib/GL/mesa/src/drv/sis/sis_vb.h
deleted file mode 100644
index 689652988..000000000
--- a/xc/lib/GL/mesa/src/drv/sis/sis_vb.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.8 2002/10/30 12:51:46 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-on the rights to use, copy, modify, merge, publish, distribute, sub
-license, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_VB_H__
-#define __SIS_VB_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "sis_context.h"
-
-#define _SIS_NEW_VERTEX_STATE (_DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_UNFILLED | \
- _NEW_TEXTURE | \
- _NEW_FOG)
-
-extern void sisCheckTexSizes( GLcontext *ctx );
-extern void sisChooseVertexState( GLcontext *ctx );
-
-extern void sisBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void sisPrintSetupFlags( char *msg, GLuint flags );
-
-extern void sisInitVB( GLcontext *ctx );
-extern void sisFreeVB( GLcontext *ctx );
-
-extern void sis_translate_vertex( GLcontext *ctx,
- const sisVertex *src,
- SWvertex *dst );
-
-extern void sis_print_vertex( GLcontext *ctx, const sisVertex *v );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/BUGS b/xc/lib/GL/mesa/src/drv/tdfx/BUGS
deleted file mode 100644
index b15f6a91e..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/BUGS
+++ /dev/null
@@ -1,64 +0,0 @@
-REMOVE THIS FILE BEFORE MERGING WITH TRUNK
-------------------------------------------
-
-OUTSTANDING BUGS
-
-demos/reflect - reading back Z on Voodoo3, image offset to right
- Fixed in latest Glide.
-
-Q3 - some polygons drawn as vertical strips, similar to bug that was
- seen in demos/fire. Voodoo3 only. May be related to glDepthMask
- or glColorMask.
-
-book/fog - not fogging
- Fog in orthograph mode still not implemented. Checking with
- 3dfx engineers for ideas.
-
-Q3 demo crashes after changing display settings
- but the full Q3 game version seems OK.
-
-
-
-MORE OUTSTANDING BUGS
-
-private context was NULL! causing immediate failure of any glx prog. cant
-reproduce after restarting the X server. putting it down as halluc.
-
-texture object image was NULL, causing segmentation failure. happens with
-prboom. ive put a check in tdfx_texstate.c but this isn't a fix.
-
-prboom, wall textures near first chainsaw aren't bound properly. sideways
-movements causes the wall textures to move with you. prboom busted?
-
-16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it
-looks like multitexturing gone wrong. i'll disable a tmu and test.
-
-sof, polygons appear at wrong x,y,z positions, intermittent, have not yet
-found reliable way of reproducing. culling? sometimes polys disappear.
-
-descent3 is all black in 16bpp mode - FIXED (palette problems)
-
-smeared pixels in quake3 - FIXED (texture memory overlapped FB)
-
-
-
-PERFORMANCE COMPARISON (Brian / Alan)
-
- V3/16 is Voodoo3 in 16bpp on a P3/500
- V5/16 is Voodoo5 in 16bpp on a P3/600
- V5/32 is Voodoo5 in 32bpp on a P3/600
- V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600
- V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600
-
- tdfx-2-1-branch tdfx-3-0-0-branch
-demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32
-------------------------------------------------------------------------
-gloss 257 183 174 320 308 177 313 167
-fire 42 39 52 41
-fire (no help) 98 80 50 106 113 73 124 80
-tunnel 61 50 70 58
-tunnel (no help) 167 142 57 138 152 113 171 122
-gears 663 554 540 881 1232 776 1484 830
-teapot 20 21 37 36
-teapot (no help) 22 14 14 24 30 30 43 42
-
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S b/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S
deleted file mode 100644
index 0f4cc4508..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#include "../../X86/assyntax.h"
-
-#define SETUP_RGBA 0x1
-#define SETUP_TMU0 0x2
-#define SETUP_TMU1 0x4
-
-
-/* Pack either rgba or texture into the remaining half of a 32 byte vertex.
- */
-#define CLIP_R 24
-#define CLIP_G 16
-#define CLIP_B 20
-#define CLIP_A 28 /* defined inf fxdrv.h */
-
-#define CLIP_S0 16
-#define CLIP_T0 20
-#define CLIP_S1 24
-#define CLIP_T1 28
-
-#define SIZE 4
-#define TYPE (0)
-#define TAG(x) x
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_RGBA)
-#define TAG(x) x##_RGBA
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 6
-#define TYPE (SETUP_TMU0)
-#define TAG(x) x##_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 16
-#define CLIP_T1 20
-
-#define SIZE 6
-#define TYPE (SETUP_TMU1)
-#define TAG(x) x##_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-/* These three need to use a full 64 byte clip-space vertex.
- */
-#undef CLIP_S0
-#undef CLIP_T0
-#undef CLIP_S1
-#undef CLIP_T1
-
-#define CLIP_S0 32
-#define CLIP_T0 36
-#define CLIP_S1 40
-#define CLIP_T1 44
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_RGBA_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 12
-#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 32
-#define CLIP_T1 36
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h
deleted file mode 100644
index 9ec4935d7..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER)
-#define TAGLLBL(a) TAG(.L##a)
-#else
-#define TAGLLBL(a) TAG(a)
-#endif
-
-#if !GLIDE3
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_Z_OFFSET 8
-#define GR_VERTEX_R_OFFSET 12
-#define GR_VERTEX_G_OFFSET 16
-#define GR_VERTEX_B_OFFSET 20
-#define GR_VERTEX_OOZ_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_OOW_OFFSET 32
-
-#else /* GLIDE3 */
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_OOZ_OFFSET 8
-#define GR_VERTEX_OOW_OFFSET 12
-#define GR_VERTEX_R_OFFSET 16
-#define GR_VERTEX_G_OFFSET 20
-#define GR_VERTEX_B_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_Z_OFFSET 32
-
-#endif /* GLIDE3 */
-
-#define GR_VERTEX_SOW_TMU0_OFFSET 36
-#define GR_VERTEX_TOW_TMU0_OFFSET 40
-#define GR_VERTEX_OOW_TMU0_OFFSET 44
-#define GR_VERTEX_SOW_TMU1_OFFSET 48
-#define GR_VERTEX_TOW_TMU1_OFFSET 52
-#define GR_VERTEX_OOW_TMU1_OFFSET 56
-
-
-
-
-/*#define MAT_SX 0 /* accessed by REGIND !! */
-#define MAT_SY 20
-#define MAT_SZ 40
-#define MAT_TX 48
-#define MAT_TY 52
-#define MAT_TZ 56
-
-
-
-
-/* Do viewport map, device scale and perspective projection.
- *
- * void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride )
- *
- *
- * Rearrange fxVertices to look like grVertices.
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_vertices) )
-GLNAME( TAG(fx_3dnow_project_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */
- MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */
-
- CMP_L ( ECX, EDX )
- JE ( TAGLLBL(FXPV_end) )
-
- FEMMS
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */
- MOV_L ( REGOFF(20, ESP), EAX ) /* stride */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-ALIGNTEXT32
-TAGLLBL(FXPV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
-
- MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
- ADD_L ( EAX, ECX ) /* f += stride */
-
- CMP_L ( ECX, EDX ) /* stall??? */
- JA ( TAGLLBL(FXPV_loop_start) )
-
-TAGLLBL(FXPV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-
-
-
-
-/* void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride,
- * const GLubyte *mask )
- *
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_clipped_vertices) )
-GLNAME( TAG(fx_3dnow_project_clipped_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first FXDRIVER(VB)->verts*/
- MOV_L ( REGOFF(12, ESP), EDX ) /* last FXDRIVER(VB)->last_vert */
-
- FEMMS
-
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(24, ESP), EBP ) /* mat ctx->Viewport.WindowMap.M */
- MOV_L ( REGOFF(28, ESP), EAX ) /* stride */
- MOV_L ( REGOFF(32, ESP), ESI ) /* VB->ClipMask */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-
-ALIGNTEXT32
-TAGLLBL(FXPCV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
- CMP_B ( CONST(0), REGIND(ESI) )
- JNE ( TAGLLBL(FXPCV_skip) )
-
- MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
-
-TAGLLBL(FXPCV_skip):
- ADD_L ( EAX, ECX ) /* f += stride */
-
- INC_L ( ESI ) /* next ClipMask */
- CMP_L ( ECX, EDX )
- JA ( TAGLLBL(FXPCV_loop_start) )
-
- POP_L ( ESI )
- POP_L ( EDI )
-
-TAGLLBL(FXPCV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-#undef TYPE
-#undef TAG
-#undef SIZE
-
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h
deleted file mode 100644
index 0af560174..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h,v 1.1 2001/03/21 16:14:26 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __DRI_GLIDE_H__
-#define __DRI_GLIDE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <glide.h>
-#include "dri_mesaint.h"
-
-/*
- * This is the private interface between Glide and the DRI.
- */
-extern void grDRIOpen( char *pFB, char *pRegs, int deviceID,
- int width, int height,
- int mem, int cpp, int stride,
- int fifoOffset, int fifoSize,
- int fbOffset, int backOffset, int depthOffset,
- int textureOffset, int textureSize,
- volatile int *fifoPtr, volatile int *fifoRead );
-extern void grDRIPosition( int x, int y, int w, int h,
- int numClip, XF86DRIClipRectPtr pClip );
-extern void grDRILostContext( void );
-extern void grDRIImportFifo( int fifoPtr, int fifoRead );
-extern void grDRIInvalidateAll( void );
-extern void grDRIResetSAREA( void );
-extern void grDRIBufferSwap( FxU32 swapInterval );
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
deleted file mode 100644
index f3a719146..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c,v 1.12 2003/05/08 09:25:35 herrb Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include <dlfcn.h>
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_tris.h"
-#include "tdfx_render.h"
-#include "tdfx_span.h"
-#include "tdfx_texman.h"
-#include "extensions.h"
-
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-
-/*
- * Enable/Disable the extensions for this context.
- */
-static void tdfxDDInitExtensions( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- _mesa_enable_extension( ctx, "GL_HP_occlusion_test" );
- _mesa_enable_extension( ctx, "GL_EXT_paletted_texture" );
- _mesa_enable_extension( ctx, "GL_EXT_texture_lod_bias" );
-
- if ( fxMesa->haveTwoTMUs ) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_env_add" );
- _mesa_enable_extension( ctx, "GL_ARB_multitexture" );
- }
-
- if ( TDFX_IS_NAPALM( fxMesa ) ) {
-#if 0
- _mesa_enable_extension( ctx, "GL_ARB_texture_compression" );
- _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
-#endif
- _mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );
- }
-
-#if 0
- _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map");
- _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
-#endif
-
- if (fxMesa->haveHwStencil) {
- _mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" );
- }
-}
-
-
-
-static const struct gl_pipeline_stage *tdfx_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage, /* REMOVE: fog coord stage */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
- &_tnl_render_stage,
- 0,
-};
-
-
-GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- tdfxContextPtr fxMesa;
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
- TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA +
- sizeof(XF86DRISAREARec));
-
- /* Allocate tdfx context */
- fxMesa = (tdfxContextPtr) CALLOC( sizeof(tdfxContextRec) );
- if (!fxMesa)
- return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((tdfxContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) fxMesa, GL_TRUE);
- if (!fxMesa->glCtx) {
- FREE(fxMesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = fxMesa;
-
- /* Mirror some important DRI state
- */
- fxMesa->hHWContext = driContextPriv->hHWContext;
- fxMesa->driHwLock = &sPriv->pSAREA->lock;
- fxMesa->driFd = sPriv->fd;
-
- fxMesa->driScreen = sPriv;
- fxMesa->driContext = driContextPriv;
- fxMesa->fxScreen = fxScreen;
- fxMesa->sarea = saPriv;
-
- fxMesa->haveHwStencil = ( TDFX_IS_NAPALM( fxMesa ) &&
- mesaVis->stencilBits &&
- mesaVis->depthBits == 24 );
-
- fxMesa->screen_width = fxScreen->width;
- fxMesa->screen_height = fxScreen->height;
-
- fxMesa->new_gl_state = ~0;
- fxMesa->new_state = ~0;
- fxMesa->dirty = ~0;
-
- /* NOTE: This must be here before any Glide calls! */
- if (!tdfxInitGlide( fxMesa )) {
- FREE(fxMesa);
- return GL_FALSE;
- }
-
- fxMesa->Glide.grDRIOpen( (char*) sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID,
- fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp,
- fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize,
- fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset,
- fxScreen->textureOffset, fxScreen->textureSize, &saPriv->fifoPtr,
- &saPriv->fifoRead );
-
- if ( getenv( "FX_GLIDE_SWAPINTERVAL" ) ) {
- fxMesa->Glide.SwapInterval = atoi( getenv( "FX_GLIDE_SWAPINTERVAL" ) );
- } else {
- fxMesa->Glide.SwapInterval = 0;
- }
- if ( getenv( "FX_MAX_PENDING_SWAPS" ) ) {
- fxMesa->Glide.MaxPendingSwaps = atoi( getenv( "FX_MAX_PENDING_SWAPS" ) );
- } else {
- fxMesa->Glide.MaxPendingSwaps = 2;
- }
-
- fxMesa->Glide.Initialized = GL_FALSE;
- fxMesa->Glide.Board = 0;
-
-
- if (getenv("FX_EMULATE_SINGLE_TMU")) {
- fxMesa->haveTwoTMUs = GL_FALSE;
- }
- else {
- if ( TDFX_IS_BANSHEE( fxMesa ) ) {
- fxMesa->haveTwoTMUs = GL_FALSE;
- } else {
- fxMesa->haveTwoTMUs = GL_TRUE;
- }
- }
-
- fxMesa->stats.swapBuffer = 0;
- fxMesa->stats.reqTexUpload = 0;
- fxMesa->stats.texUpload = 0;
- fxMesa->stats.memTexUpload = 0;
-
- fxMesa->tmuSrc = TDFX_TMU_NONE;
-
- ctx = fxMesa->glCtx;
- if ( TDFX_IS_NAPALM( fxMesa ) ) {
- ctx->Const.MaxTextureLevels = 12;
- } else {
- ctx->Const.MaxTextureLevels = 9;
- }
- ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2;
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* Disable wide lines as we can't antialias them correctly in
- * hardware.
- */
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, tdfx_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_TRUE );
- _swrast_allow_vertex_fog( ctx, GL_FALSE );
-
- tdfxDDInitExtensions( ctx );
- tdfxDDInitDriverFuncs( ctx );
- tdfxDDInitStateFuncs( ctx );
- tdfxDDInitRenderFuncs( ctx );
- tdfxDDInitSpanFuncs( ctx );
- tdfxDDInitTriFuncs( ctx );
- tdfxInitVB( ctx );
- tdfxInitState( fxMesa );
-
- return GL_TRUE;
-}
-
-
-static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa )
-{
- FxI32 result;
- int i;
-
- LOCK_HARDWARE( fxMesa );
-
- fxMesa->Glide.grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result );
- for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) {
- fxMesa->layout[i] = MALLOC( result );
- if ( !fxMesa->layout[i] ) {
- UNLOCK_HARDWARE( fxMesa );
- return GL_FALSE;
- }
- }
-
- /* Tiny vertex format - 16 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_TINY] );
-
- /* Non textured vertex format - 24 bytes (Need w for table fog)
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_NOTEX] );
-
- /* Single textured vertex format - 32 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- /*grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );*/
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] );
-
- /* Multitextured vertex format - 40 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
- /*fxMesa->Glide.grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );*/
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] );
-
- /* Projected texture vertex format - 48 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE );
- /*fxMesa->Glide.grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );*/
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] );
-
- UNLOCK_HARDWARE( fxMesa );
-
- return GL_TRUE;
-}
-
-
-/*
- * Initialize the state in an tdfxContextPtr struct.
- */
-static GLboolean
-tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa )
-{
- /* KW: Would be nice to make one of these a member of the other.
- */
- FxI32 result[2];
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa );
- }
-
-#if DEBUG_LOCKING
- fprintf(stderr, "Debug locking enabled\n");
-#endif
-
- if ( fxMesa->Glide.Initialized )
- return GL_TRUE;
-
- fxMesa->width = driDrawPriv->w;
- fxMesa->height = driDrawPriv->h;
-
- /* We have to use a light lock here, because we can't do any glide
- * operations yet. No use of FX_* functions in this function.
- */
- DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
-
- fxMesa->Glide.grGlideInit();
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
-
- fxMesa->Glide.Context = fxMesa->Glide.grSstWinOpen( (FxU32) -1,
- GR_RESOLUTION_NONE,
- GR_REFRESH_NONE,
- fxMesa->Glide.ColorFormat,
- fxMesa->Glide.Origin,
- 2, 1 );
-
- fxMesa->Glide.grDRIResetSAREA();
-
- DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
-
- if ( !fxMesa->Glide.Context )
- return GL_FALSE;
-
-
- /* Perform the Glide-dependant part of the context initialization.
- */
- FX_grColorMaskv( fxMesa->glCtx, true4 );
-
- tdfxTMInit( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
-
- if ( fxMesa->glCtx->Visual.depthBits > 0 ) {
- fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
- } else {
- fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_DISABLE);
- }
-
- fxMesa->Glide.grLfbWriteColorFormat( GR_COLORFORMAT_ABGR );
-
- fxMesa->Glide.grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result );
- fxMesa->Glide.TextureAlign = result[0];
-
- fxMesa->Glide.State = NULL;
- fxMesa->Glide.grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result );
- fxMesa->Glide.State = MALLOC( result[0] );
-
- fxMesa->Fog.Table = NULL;
- fxMesa->Glide.grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result );
- fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) );
-
- UNLOCK_HARDWARE( fxMesa );
-
- if ( !fxMesa->Glide.State || !fxMesa->Fog.Table ) {
- if ( fxMesa->Glide.State )
- FREE( fxMesa->Glide.State );
- if ( fxMesa->Fog.Table )
- FREE( fxMesa->Fog.Table );
- return GL_FALSE;
- }
-
- if ( !tdfxInitVertexFormats( fxMesa ) ) {
- return GL_FALSE;
- }
-
- LOCK_HARDWARE( fxMesa );
-
- fxMesa->Glide.grGlideGetState( fxMesa->Glide.State );
-
- if ( getenv( "FX_GLIDE_INFO" ) ) {
- printf( "GR_RENDERER = %s\n", (char *) fxMesa->Glide.grGetString( GR_RENDERER ) );
- printf( "GR_VERSION = %s\n", (char *) fxMesa->Glide.grGetString( GR_VERSION ) );
- printf( "GR_VENDOR = %s\n", (char *) fxMesa->Glide.grGetString( GR_VENDOR ) );
- printf( "GR_HARDWARE = %s\n", (char *) fxMesa->Glide.grGetString( GR_HARDWARE ) );
- printf( "GR_EXTENSION = %s\n", (char *) fxMesa->Glide.grGetString( GR_EXTENSION ) );
- }
-
- UNLOCK_HARDWARE( fxMesa );
-
- {
- const char *debug = getenv("LIBGL_DEBUG");
- if (debug && strstr(debug, "fallbacks")) {
- fxMesa->debugFallbacks = GL_TRUE;
- }
- }
-
-
- fxMesa->numClipRects = 0;
- fxMesa->pClipRects = NULL;
- fxMesa->scissoredClipRects = GL_FALSE;
-
- fxMesa->Glide.Initialized = GL_TRUE;
-
- return GL_TRUE;
-}
-
-
-void
-tdfxDestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa );
- }
-
- if ( fxMesa ) {
- if (fxMesa->glCtx->Shared->RefCount == 1 && fxMesa->driDrawable) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- struct gl_texture_object *tObj;
- tObj = fxMesa->glCtx->Shared->TexObjectList;
- while (tObj) {
- tdfxTMFreeTexture(fxMesa, tObj);
- tObj = tObj->Next;
- }
- }
-
- tdfxTMClose(fxMesa); /* free texture memory */
-
- _swsetup_DestroyContext( fxMesa->glCtx );
- _tnl_DestroyContext( fxMesa->glCtx );
- _ac_DestroyContext( fxMesa->glCtx );
- _swrast_DestroyContext( fxMesa->glCtx );
-
- tdfxFreeVB( fxMesa->glCtx );
-
- /* Free Mesa context */
- fxMesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(fxMesa->glCtx);
-
- /* free the tdfx context */
- XFree( fxMesa );
- }
-}
-
-
-GLboolean
-tdfxUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv );
- }
-
- if ( driContextPriv && (tdfxContextPtr) driContextPriv == fxMesa ) {
- LOCK_HARDWARE(fxMesa);
- fxMesa->Glide.grGlideGetState(fxMesa->Glide.State);
- UNLOCK_HARDWARE(fxMesa);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv );
- }
-
- if ( driContextPriv ) {
- tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate;
- GLcontext *newCtx = newFx->glCtx;
- GET_CURRENT_CONTEXT(curCtx);
-
- if ( newFx->driDrawable != driDrawPriv ) {
- newFx->driDrawable = driDrawPriv;
- newFx->dirty = ~0;
- }
- else if (curCtx == newCtx) {
- /* same drawable, same context -> no-op */
- /* Need to call _mesa_make_current2() in order to make sure API
- * dispatch is set correctly.
- */
- _mesa_make_current2( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
- return GL_TRUE;
- }
-
- if ( !newFx->Glide.Initialized ) {
- if ( !tdfxInitContext( driDrawPriv, newFx ) )
- return GL_FALSE;
-
- LOCK_HARDWARE( newFx );
-
- /* FIXME: Force loading of window information */
- newFx->width = 0;
- tdfxUpdateClipping(newCtx);
- tdfxUploadClipping(newFx);
-
- UNLOCK_HARDWARE( newFx );
- } else {
- LOCK_HARDWARE( newFx );
-
- newFx->Glide.grSstSelect( newFx->Glide.Board );
- newFx->Glide.grGlideSetState( newFx->Glide.State );
-
- tdfxUpdateClipping(newCtx);
- tdfxUploadClipping(newFx);
-
- UNLOCK_HARDWARE( newFx );
- }
-
- _mesa_make_current2( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if ( !newCtx->Viewport.Width ) {
- _mesa_set_viewport( newCtx, 0, 0, driDrawPriv->w, driDrawPriv->h );
- }
- } else {
- _mesa_make_current( 0, 0 );
- }
-
- return GL_TRUE;
-}
-
-
-/*
- * Enable this to trace calls to various Glide functions.
- */
-/*#define DEBUG_TRAP*/
-#ifdef DEBUG_TRAP
-static void (*real_grDrawTriangle)( const void *a, const void *b, const void *c );
-static void (*real_grDrawPoint)( const void *a );
-static void (*real_grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);
-static void (*real_grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride);
-static void (*real_grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
-
-static void (*real_grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);
-static void (*real_grGlideGetVertexLayout)( void *layout );
-static void (*real_grGlideSetVertexLayout)( const void *layout );
-
-static void (*real_grTexDownloadMipMapLevel)( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data );
-
-
-static void debug_grDrawTriangle( const void *a, const void *b, const void *c )
-{
- printf("%s\n", __FUNCTION__);
- (*real_grDrawTriangle)(a, b, c);
-}
-
-static void debug_grDrawPoint( const void *a )
-{
- const float *f = (const float *) a;
- printf("%s %g %g\n", __FUNCTION__, f[0], f[1]);
- (*real_grDrawPoint)(a);
-}
-
-static void debug_grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers)
-{
- printf("%s count=%d\n", __FUNCTION__, (int) Count);
- (*real_grDrawVertexArray)(mode, Count, pointers);
-}
-
-static void debug_grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride)
-{
- printf("%s mode=0x%x count=%d\n", __FUNCTION__, (int) mode, (int) Count);
- (*real_grDrawVertexArrayContiguous)(mode, Count, pointers, stride);
-}
-
-static void debug_grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy )
-{
- printf("%s %d,%d .. %d,%d\n", __FUNCTION__,
- (int) minx, (int) miny, (int) maxx, (int) maxy);
- (*real_grClipWindow)(minx, miny, maxx, maxy);
-}
-
-static void debug_grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode)
-{
- (*real_grVertexLayout)(param, offset, mode);
-}
-
-static void debug_grGlideGetVertexLayout( void *layout )
-{
- (*real_grGlideGetVertexLayout)(layout);
-}
-
-static void debug_grGlideSetVertexLayout( const void *layout )
-{
- (*real_grGlideSetVertexLayout)(layout);
-}
-
-static void debug_grTexDownloadMipMapLevel( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data )
-{
- (*real_grTexDownloadMipMapLevel)(tmu, startAddress, thisLod, largeLod,
- aspectRatio, format, evenOdd, data);
-}
-
-#endif
-
-
-/*
- * Examine the context's deviceID to determine what kind of 3dfx hardware
- * is installed. dlopen() the appropriate Glide library and initialize
- * this context's Glide function pointers.
- * Return: true/false = success/failure
- */
-GLboolean tdfxInitGlide(tdfxContextPtr tmesa)
-{
- static const char *defaultGlide = "libglide3.so";
- const char *libName;
- void *libHandle;
-
- /*
- * XXX this code which selects a Glide library filename given the
- * deviceID may need to be cleaned up a bit.
- * Non-Linux systems may have different filenames, for example.
- */
- switch (tmesa->fxScreen->deviceID) {
- case PCI_CHIP_BANSHEE:
- case PCI_CHIP_VOODOO3:
- libName = "libglide3-v3.so";
- break;
- case PCI_CHIP_VOODOO5: /* same as PCI_CHIP_VOODOO4 */
- libName = "libglide3-v5.so";
- break;
- default:
- {
- __driUtilMessage("unrecognized 3dfx deviceID: 0x%x",
- tmesa->fxScreen->deviceID);
- }
- return GL_FALSE;
- }
-
- libHandle = dlopen(libName, RTLD_NOW);
- if (!libHandle) {
- /* The device-specific Glide library filename didn't work, try the
- * old, generic libglide3.so library.
- */
- libHandle = dlopen(defaultGlide, RTLD_NOW);
- if (!libHandle) {
- __driUtilMessage(
- "can't find Glide library, dlopen(%s) and dlopen(%s) both failed.",
- libName, defaultGlide);
- __driUtilMessage("dlerror() message: %s", dlerror());
- return GL_FALSE;
- }
- libName = defaultGlide;
- }
-
- {
- const char *env = getenv("LIBGL_DEBUG");
- if (env && strstr(env, "verbose")) {
- fprintf(stderr, "libGL: using Glide library %s\n", libName);
- }
- }
-
-#define GET_FUNCTION(PTR, NAME) \
- tmesa->Glide.PTR = dlsym(libHandle, NAME); \
- if (!tmesa->Glide.PTR) { \
- __driUtilMessage("couldn't find Glide function %s in %s.", \
- NAME, libName); \
- }
-
- GET_FUNCTION(grDrawPoint, "grDrawPoint");
- GET_FUNCTION(grDrawLine, "grDrawLine");
- GET_FUNCTION(grDrawTriangle, "grDrawTriangle");
- GET_FUNCTION(grVertexLayout, "grVertexLayout");
- GET_FUNCTION(grDrawVertexArray, "grDrawVertexArray");
- GET_FUNCTION(grDrawVertexArrayContiguous, "grDrawVertexArrayContiguous");
- GET_FUNCTION(grBufferClear, "grBufferClear");
- /*GET_FUNCTION(grBufferSwap, "grBufferSwap");*/
- GET_FUNCTION(grRenderBuffer, "grRenderBuffer");
- GET_FUNCTION(grErrorSetCallback, "grErrorSetCallback");
- GET_FUNCTION(grFinish, "grFinish");
- GET_FUNCTION(grFlush, "grFlush");
- GET_FUNCTION(grSstWinOpen, "grSstWinOpen");
- GET_FUNCTION(grSstWinClose, "grSstWinClose");
-#if 0
- /* Not in V3 lib, and not used anyway. */
- GET_FUNCTION(grSetNumPendingBuffers, "grSetNumPendingBuffers");
-#endif
- GET_FUNCTION(grSelectContext, "grSelectContext");
- GET_FUNCTION(grSstOrigin, "grSstOrigin");
- GET_FUNCTION(grSstSelect, "grSstSelect");
- GET_FUNCTION(grAlphaBlendFunction, "grAlphaBlendFunction");
- GET_FUNCTION(grAlphaCombine, "grAlphaCombine");
- GET_FUNCTION(grAlphaControlsITRGBLighting, "grAlphaControlsITRGBLighting");
- GET_FUNCTION(grAlphaTestFunction, "grAlphaTestFunction");
- GET_FUNCTION(grAlphaTestReferenceValue, "grAlphaTestReferenceValue");
- GET_FUNCTION(grChromakeyMode, "grChromakeyMode");
- GET_FUNCTION(grChromakeyValue, "grChromakeyValue");
- GET_FUNCTION(grClipWindow, "grClipWindow");
- GET_FUNCTION(grColorCombine, "grColorCombine");
- GET_FUNCTION(grColorMask, "grColorMask");
- GET_FUNCTION(grCullMode, "grCullMode");
- GET_FUNCTION(grConstantColorValue, "grConstantColorValue");
- GET_FUNCTION(grDepthBiasLevel, "grDepthBiasLevel");
- GET_FUNCTION(grDepthBufferFunction, "grDepthBufferFunction");
- GET_FUNCTION(grDepthBufferMode, "grDepthBufferMode");
- GET_FUNCTION(grDepthMask, "grDepthMask");
- GET_FUNCTION(grDisableAllEffects, "grDisableAllEffects");
- GET_FUNCTION(grDitherMode, "grDitherMode");
- GET_FUNCTION(grFogColorValue, "grFogColorValue");
- GET_FUNCTION(grFogMode, "grFogMode");
- GET_FUNCTION(grFogTable, "grFogTable");
- GET_FUNCTION(grLoadGammaTable, "grLoadGammaTable");
- GET_FUNCTION(grSplash, "grSplash");
- GET_FUNCTION(grGet, "grGet");
- GET_FUNCTION(grGetString, "grGetString");
- GET_FUNCTION(grQueryResolutions, "grQueryResolutions");
- GET_FUNCTION(grReset, "grReset");
- GET_FUNCTION(grGetProcAddress, "grGetProcAddress");
- GET_FUNCTION(grEnable, "grEnable");
- GET_FUNCTION(grDisable, "grDisable");
- GET_FUNCTION(grCoordinateSpace, "grCoordinateSpace");
- GET_FUNCTION(grDepthRange, "grDepthRange");
- GET_FUNCTION(grStippleMode, "grStippleMode");
- GET_FUNCTION(grStipplePattern, "grStipplePattern");
- GET_FUNCTION(grViewport, "grViewport");
- GET_FUNCTION(grTexCalcMemRequired, "grTexCalcMemRequired");
- GET_FUNCTION(grTexTextureMemRequired, "grTexTextureMemRequired");
- GET_FUNCTION(grTexMinAddress, "grTexMinAddress");
- GET_FUNCTION(grTexMaxAddress, "grTexMaxAddress");
- GET_FUNCTION(grTexNCCTable, "grTexNCCTable");
- GET_FUNCTION(grTexSource, "grTexSource");
- GET_FUNCTION(grTexClampMode, "grTexClampMode");
- GET_FUNCTION(grTexCombine, "grTexCombine");
- GET_FUNCTION(grTexDetailControl, "grTexDetailControl");
- GET_FUNCTION(grTexFilterMode, "grTexFilterMode");
- GET_FUNCTION(grTexLodBiasValue, "grTexLodBiasValue");
- GET_FUNCTION(grTexDownloadMipMap, "grTexDownloadMipMap");
- GET_FUNCTION(grTexDownloadMipMapLevel, "grTexDownloadMipMapLevel");
- GET_FUNCTION(grTexDownloadMipMapLevelPartial, "grTexDownloadMipMapLevelPartial");
- GET_FUNCTION(grTexDownloadTable, "grTexDownloadTable");
- GET_FUNCTION(grTexDownloadTablePartial, "grTexDownloadTablePartial");
- GET_FUNCTION(grTexMipMapMode, "grTexMipMapMode");
- GET_FUNCTION(grTexMultibase, "grTexMultibase");
- GET_FUNCTION(grTexMultibaseAddress, "grTexMultibaseAddress");
- GET_FUNCTION(grLfbLock, "grLfbLock");
- GET_FUNCTION(grLfbUnlock, "grLfbUnlock");
- GET_FUNCTION(grLfbConstantAlpha, "grLfbConstantAlpha");
- GET_FUNCTION(grLfbConstantDepth, "grLfbConstantDepth");
- GET_FUNCTION(grLfbWriteColorSwizzle, "grLfbWriteColorSwizzle");
- GET_FUNCTION(grLfbWriteColorFormat, "grLfbWriteColorFormat");
- GET_FUNCTION(grLfbWriteRegion, "grLfbWriteRegion");
- GET_FUNCTION(grLfbReadRegion, "grLfbReadRegion");
- GET_FUNCTION(grGlideInit, "grGlideInit");
- GET_FUNCTION(grGlideShutdown, "grGlideShutdown");
- GET_FUNCTION(grGlideGetState, "grGlideGetState");
- GET_FUNCTION(grGlideSetState, "grGlideSetState");
- GET_FUNCTION(grGlideGetVertexLayout, "grGlideGetVertexLayout");
- GET_FUNCTION(grGlideSetVertexLayout, "grGlideSetVertexLayout");
-
- /* Glide utility functions */
- GET_FUNCTION(guFogGenerateExp, "guFogGenerateExp");
- GET_FUNCTION(guFogGenerateExp2, "guFogGenerateExp2");
- GET_FUNCTION(guFogGenerateLinear, "guFogGenerateLinear");
-
- /* DRI functions */
- GET_FUNCTION(grDRIOpen, "grDRIOpen");
- GET_FUNCTION(grDRIPosition, "grDRIPosition");
- /*GET_FUNCTION(grDRILostContext, "grDRILostContext");*/
- GET_FUNCTION(grDRIImportFifo, "grDRIImportFifo");
- GET_FUNCTION(grDRIInvalidateAll, "grDRIInvalidateAll");
- GET_FUNCTION(grDRIResetSAREA, "grDRIResetSAREA");
- GET_FUNCTION(grDRIBufferSwap, "grDRIBufferSwap");
-
- /*
- * Extension functions:
- * Just use dlysm() because we want a NULL pointer if the function is
- * not found.
- */
- /* PIXEXT extension */
- tmesa->Glide.grStencilFunc = dlsym(libHandle, "grStencilFunc");
- tmesa->Glide.grStencilMask = dlsym(libHandle, "grStencilMask");
- tmesa->Glide.grStencilOp = dlsym(libHandle, "grStencilOp");
- tmesa->Glide.grBufferClearExt = dlsym(libHandle, "grBufferClearExt");
- tmesa->Glide.grColorMaskExt = dlsym(libHandle, "grColorMaskExt");
- /* COMBINE extension */
- tmesa->Glide.grColorCombineExt = dlsym(libHandle, "grColorCombineExt");
- tmesa->Glide.grTexColorCombineExt = dlsym(libHandle, "grTexColorCombineExt");
- tmesa->Glide.grAlphaCombineExt = dlsym(libHandle, "grAlphaCombineExt");
- tmesa->Glide.grTexAlphaCombineExt = dlsym(libHandle, "grTexAlphaCombineExt");
- tmesa->Glide.grAlphaBlendFunctionExt = dlsym(libHandle, "grAlphaBlendFunctionExt");
- tmesa->Glide.grConstantColorValueExt = dlsym(libHandle, "grConstantColorValueExt");
- /* Texus 2 */
- tmesa->Glide.txImgQuantize = dlsym(libHandle, "txImgQuantize");
- tmesa->Glide.txImgDequantizeFXT1 = dlsym(libHandle, "_txImgDequantizeFXT1");
- tmesa->Glide.txErrorSetCallback = dlsym(libHandle, "txErrorSetCallback");
-
-#ifdef DEBUG_TRAP
- /* wrap the drawing functions so we can trap them */
- real_grDrawTriangle = tmesa->Glide.grDrawTriangle;
- tmesa->Glide.grDrawTriangle = debug_grDrawTriangle;
-
- real_grDrawPoint = tmesa->Glide.grDrawPoint;
- tmesa->Glide.grDrawPoint = debug_grDrawPoint;
-
- real_grDrawVertexArray = tmesa->Glide.grDrawVertexArray;
- tmesa->Glide.grDrawVertexArray = debug_grDrawVertexArray;
-
- real_grDrawVertexArrayContiguous = tmesa->Glide.grDrawVertexArrayContiguous;
- tmesa->Glide.grDrawVertexArrayContiguous = debug_grDrawVertexArrayContiguous;
-
- real_grClipWindow = tmesa->Glide.grClipWindow;
- tmesa->Glide.grClipWindow = debug_grClipWindow;
-
- real_grVertexLayout = tmesa->Glide.grVertexLayout;
- tmesa->Glide.grVertexLayout = debug_grVertexLayout;
-
- real_grGlideGetVertexLayout = tmesa->Glide.grGlideGetVertexLayout;
- tmesa->Glide.grGlideGetVertexLayout = debug_grGlideGetVertexLayout;
-
- real_grGlideSetVertexLayout = tmesa->Glide.grGlideSetVertexLayout;
- tmesa->Glide.grGlideSetVertexLayout = debug_grGlideSetVertexLayout;
-
- real_grTexDownloadMipMapLevel = tmesa->Glide.grTexDownloadMipMapLevel;
- tmesa->Glide.grTexDownloadMipMapLevel = debug_grTexDownloadMipMapLevel;
-
-#endif
- return GL_TRUE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
deleted file mode 100644
index 9b0c91276..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
+++ /dev/null
@@ -1,1027 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h,v 1.5 2002/02/24 21:51:10 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_CONTEXT_H__
-#define __TDFX_CONTEXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <sys/time.h>
-#include "dri_util.h"
-#ifdef XFree86Server
-#include "GL/xf86glx.h"
-#else
-#include "glheader.h"
-#endif
-#if defined(__linux__)
-#include <signal.h>
-#endif
-
-#include "tdfx_glide.h"
-
-#include "clip.h"
-#include "context.h"
-#include "macros.h"
-#include "matrix.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tdfx_screen.h"
-
-
-
-
-#define TDFX_TMU0 GR_TMU0
-#define TDFX_TMU1 GR_TMU1
-#define TDFX_TMU_SPLIT 98
-#define TDFX_TMU_BOTH 99
-#define TDFX_TMU_NONE 100
-
-
-
-/* Flags for fxMesa->new_state
- */
-#define TDFX_NEW_COLOR 0x0001
-#define TDFX_NEW_ALPHA 0x0002
-#define TDFX_NEW_DEPTH 0x0004
-#define TDFX_NEW_FOG 0x0008
-#define TDFX_NEW_STENCIL 0x0010
-#define TDFX_NEW_CLIP 0x0020
-#define TDFX_NEW_VIEWPORT 0x0040
-#define TDFX_NEW_CULL 0x0080
-#define TDFX_NEW_GLIDE 0x0100
-#define TDFX_NEW_TEXTURE 0x0200
-#define TDFX_NEW_CONTEXT 0x0400
-#define TDFX_NEW_LINE 0x0800
-#define TDFX_NEW_RENDER 0x1000
-#define TDFX_NEW_STIPPLE 0x2000
-#define TDFX_NEW_TEXTURE_BIND 0x4000 /* experimental */
-
-
-/* Flags for fxMesa->dirty
- */
-#define TDFX_UPLOAD_COLOR_COMBINE 0x00000001
-#define TDFX_UPLOAD_ALPHA_COMBINE 0x00000002
-#define TDFX_UPLOAD_RENDER_BUFFER 0x00000004
-#define TDFX_UPLOAD_ALPHA_TEST 0x00000008
-#define TDFX_UPLOAD_ALPHA_REF 0x00000010
-#define TDFX_UPLOAD_BLEND_FUNC 0x00000020
-#define TDFX_UPLOAD_DEPTH_MODE 0x00000040
-#define TDFX_UPLOAD_DEPTH_BIAS 0x00000080
-#define TDFX_UPLOAD_DEPTH_FUNC 0x00000100
-#define TDFX_UPLOAD_DEPTH_MASK 0x00000200
-#define TDFX_UPLOAD_FOG_MODE 0x00000400
-#define TDFX_UPLOAD_FOG_COLOR 0x00000800
-#define TDFX_UPLOAD_FOG_TABLE 0x00001000
-
-#define TDFX_UPLOAD_CLIP 0x00002000
-#define TDFX_UPLOAD_CULL 0x00004000
-#define TDFX_UPLOAD_VERTEX_LAYOUT 0x00008000
-#define TDFX_UPLOAD_COLOR_MASK 0x00010000
-#define TDFX_UPLOAD_DITHER 0x00040000
-#define TDFX_UPLOAD_STENCIL 0x00080000
-
-#define TDFX_UPLOAD_TEXTURE_SOURCE 0x00100000
-#define TDFX_UPLOAD_TEXTURE_PARAMS 0x00200000
-#define TDFX_UPLOAD_TEXTURE_PALETTE 0x00400000
-#define TDFX_UPLOAD_TEXTURE_ENV 0x00800000
-#define TDFX_UPLOAD_TEXTURE_IMAGES 0x01000000
-
-#define TDFX_UPLOAD_LINE 0x02000000
-
-#define TDFX_UPLOAD_STIPPLE 0x04000000
-
-/* Flags for software fallback cases */
-/* See correponding strings in tdfx_tris.c */
-#define TDFX_FALLBACK_TEXTURE_1D_3D 0x0001
-#define TDFX_FALLBACK_DRAW_BUFFER 0x0002
-#define TDFX_FALLBACK_SPECULAR 0x0004
-#define TDFX_FALLBACK_STENCIL 0x0008
-#define TDFX_FALLBACK_RENDER_MODE 0x0010
-#define TDFX_FALLBACK_LOGICOP 0x0020
-#define TDFX_FALLBACK_TEXTURE_ENV 0x0040
-#define TDFX_FALLBACK_TEXTURE_BORDER 0x0080
-#define TDFX_FALLBACK_COLORMASK 0x0100
-#define TDFX_FALLBACK_BLEND 0x0200
-#define TDFX_FALLBACK_LINE_STIPPLE 0x0400
-
-/* Different Glide vertex layouts
- */
-#define TDFX_LAYOUT_TINY 0
-#define TDFX_LAYOUT_NOTEX 1
-#define TDFX_LAYOUT_SINGLE 2
-#define TDFX_LAYOUT_MULTI 3
-#define TDFX_LAYOUT_PROJECT 4
-#define TDFX_NUM_LAYOUTS 5
-
-#define TDFX_XY_OFFSET 0
-#define TDFX_Z_OFFSET 8
-#define TDFX_Q_OFFSET 12
-#define TDFX_ARGB_OFFSET 16
-#define TDFX_PAD_OFFSET 20
-#define TDFX_FOG_OFFSET 20 /* experimental */
-#define TDFX_ST0_OFFSET 24
-#define TDFX_ST1_OFFSET 32
-#define TDFX_Q0_OFFSET 40
-#define TDFX_Q1_OFFSET 44
-
-
-/* Flags for buffer clears
- */
-#define TDFX_FRONT 0x1
-#define TDFX_BACK 0x2
-#define TDFX_DEPTH 0x4
-#define TDFX_STENCIL 0x8
-
-/*
- * Subpixel offsets to adjust Mesa's (true) window coordinates to
- * Glide coordinates. We need these to ensure precise rasterization.
- * Otherwise, we'll fail a bunch of conformance tests.
- */
-#define TRI_X_OFFSET ( 0.0F)
-#define TRI_Y_OFFSET ( 0.0F)
-#define LINE_X_OFFSET ( 0.0F)
-#define LINE_Y_OFFSET ( 0.125F)
-#define PNT_X_OFFSET ( 0.375F)
-#define PNT_Y_OFFSET ( 0.375F)
-
-
-#define TDFX_DEPTH_BIAS_SCALE 128
-
-/* Including xf86PciInfo.h causes a bunch of errors
- */
-#ifndef PCI_CHIP_BANSHEE
-#define PCI_CHIP_BANSHEE 0x0003
-#define PCI_CHIP_VOODOO3 0x0005
-#define PCI_CHIP_VOODOO4 0x0009
-#define PCI_CHIP_VOODOO5 0x0009
-#endif
-
-#define TDFX_IS_BANSHEE( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_BANSHEE )
-#define TDFX_IS_VOODOO3( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO3 )
-#define TDFX_IS_VOODOO4( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4 )
-#define TDFX_IS_VOODOO5( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5 )
-#define TDFX_IS_NAPALM( fxMesa ) \
- ( (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4) || \
- (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5) )
-
-
-#define PACK_BGRA32(R, G, B, A) \
- ( (((GLuint) (R)) << 16) | \
- (((GLuint) (G)) << 8) | \
- (((GLuint) (B)) ) | \
- (((GLuint) (A)) << 24) )
-
-#define PACK_RGBA32(R, G, B, A) \
- ( (((GLuint) (R)) ) | \
- (((GLuint) (G)) << 8) | \
- (((GLuint) (B)) << 16) | \
- (((GLuint) (A)) << 24) )
-
-/*
- * The first two macros are to pack 8 bit color
- * channel values into a 565 format.
- */
-#define PACK_RGB16(R, G, B) \
- ((((GLuint) (R) & 0xF8) << 8) | \
- (((GLuint) (G) & 0xFC) << 3) | \
- (((GLuint) (B) & 0xFF) >> 3))
-#define PACK_BGR16(R, G, B) \
- ((((GLuint) (B) & 0xF8) << 8) | \
- (((GLuint) (G) & 0xFC) << 3) | \
- (((GLuint) (R) & 0xFF) >> 3))
-/*
- * The second two macros pack 8 bit color channel values
- * into 1555 values.
- */
-#define PACK_RGBA16(R, G, B, A) \
- (((((GLuint) (A) & 0xFF) > 0) << 15)| \
- (((GLuint) (R) & 0xF8) << 7) | \
- (((GLuint) (G) & 0xF8) << 2) | \
- (((GLuint) (B) & 0xF8) >> 3))
-#define PACK_BGRA16(R, G, B, A) \
- (((((GLuint) (A) & 0xFF) > 0) << 15)| \
- (((GLuint) (B) & 0xF8) << 7) | \
- (((GLuint) (G) & 0xF8) << 2) | \
- (((GLuint) (R) & 0xF8) >> 3))
-
-/* Used in calls to grColorMaskv()...
- */
-extern const GLboolean false4[4];
-extern const GLboolean true4[4];
-
-
-typedef struct tdfx_context tdfxContextRec;
-typedef struct tdfx_context *tdfxContextPtr;
-
-
-typedef struct {
- volatile int fifoPtr;
- volatile int fifoRead;
- volatile int fifoOwner;
- volatile int ctxOwner;
- volatile int texOwner;
-}
-TDFXSAREAPriv;
-
-
-typedef struct {
- GLuint swapBuffer;
- GLuint reqTexUpload;
- GLuint texUpload;
- GLuint memTexUpload;
- GLuint texSwaps;
-} tdfxStats;
-
-
-
-/*
- * Memory range from startAddr to endAddr-1
- */
-typedef struct mem_range {
- struct mem_range *next;
- FxU32 startAddr, endAddr;
-}
-tdfxMemRange;
-
-
-typedef struct {
- GLsizei width, height; /* image size */
- GLint wScale, hScale; /* scale factors */
- GrTextureFormat_t glideFormat; /* Glide image format */
-}
-tdfxMipMapLevel;
-
-
-#define TDFX_NUM_TMU 2
-
-
-typedef struct tdfxTexInfo_t
-{
- GLboolean isInTM;
- GLboolean reloadImages; /* if true, resend images to Glide */
- GLuint lastTimeUsed;
- FxU32 whichTMU;
-
- GrTexInfo info;
- GrAspectRatio_t aspectRatio;
- tdfxMemRange *tm[TDFX_NUM_TMU];
-
- GLint minLevel, maxLevel;
- GrTextureFilterMode_t minFilt;
- GrTextureFilterMode_t magFilt;
- GrTextureClampMode_t sClamp;
- GrTextureClampMode_t tClamp;
- FxBool LODblend;
- GrMipMapMode_t mmMode;
-
- GLfloat sScale, tScale; /* texcoord scale factor */
-
- GuTexPalette palette;
-}
-tdfxTexInfo;
-
-
-#define TDFX_TEXTURE_DATA(mesaObj) ((tdfxTexInfo *)((mesaObj)->DriverData))
-
-#define TDFX_TEXIMAGE_DATA(mesaImg) ((tdfxMipMapLevel *)((mesaImg)->DriverData))
-
-
-
-/*
- * This is state which may be shared by several tdfx contexts.
- * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData).
- */
-struct tdfxSharedState {
- GLboolean umaTexMemory;
- GLuint totalTexMem[TDFX_NUM_TMU]; /* constant */
- GLuint freeTexMem[TDFX_NUM_TMU]; /* changes as we go */
- tdfxMemRange *tmPool;
- tdfxMemRange *tmFree[TDFX_NUM_TMU];
-};
-
-
-
-/* ================================================================
- * The vertex structures.
- */
-typedef struct {
- GLubyte blue;
- GLubyte green;
- GLubyte red;
- GLubyte alpha;
-} tdfx_color_t;
-
-typedef struct {
- GLfloat x, y, z; /* Coordinates in screen space */
- GLfloat rhw; /* Reciprocal homogeneous w */
- tdfx_color_t color; /* Diffuse color */
- GLuint pad;
- GLfloat tu0, tv0; /* Texture 0 coordinates */
- GLfloat tu1, tv1; /* Texture 1 coordinates */
-} tdfx_vertex;
-
-typedef struct {
- GLfloat x, y, z; /* Coordinates in screen space */
- GLfloat rhw; /* Reciprocal homogeneous w */
- tdfx_color_t color; /* Diffuse color */
- GLuint pad;
- GLfloat tu0, tv0; /* Texture 0 coordinates */
- GLfloat tu1, tv1; /* Texture 1 coordinates */
- GLfloat tq0, tq1; /* Texture 0/1 q coords */
-} tdfx_ptex_vertex;
-
-typedef struct {
- GLfloat x, y, z; /* Coordinates in screen space */
- tdfx_color_t color; /* Diffuse color */
-} tdfx_tiny_vertex;
-
-/* The size of this union is not of relevence:
- */
-union tdfx_vertex_t {
- tdfx_vertex v;
- tdfx_tiny_vertex tv;
- tdfx_ptex_vertex pv;
- GLfloat f[16];
- GLuint ui[16];
- GLubyte ub4[16][4];
-};
-
-typedef union tdfx_vertex_t tdfxVertex, *tdfxVertexPtr;
-
-
-/* ================================================================
- *
- * We want to keep a mirror of the Glide function call parameters so we
- * can avoid updating our state too often.
- *
- * Each of these broad groups will typically have a new state flag
- * associated with it, and will be updated together. The individual
- * Glide function calls each have a dirty flag and will only be called
- * when absolutely necessary.
- */
-
-/* for grTexSource() */
-struct tdfx_texsource {
- FxU32 StartAddress;
- FxU32 EvenOdd;
- GrTexInfo *Info;
-};
-
-/* Texture object params */
-struct tdfx_texparams {
- GrTextureClampMode_t sClamp;
- GrTextureClampMode_t tClamp;
- GrTextureFilterMode_t minFilt;
- GrTextureFilterMode_t magFilt;
- GrMipMapMode_t mmMode;
- FxBool LODblend;
- GLfloat LodBias;
-};
-
-/* for grTexDownloadTable() texture palettes */
-struct tdfx_texpalette {
- GrTexTable_t Type;
- void *Data;
-};
-
-/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */
-struct tdfx_combine {
- GrCombineFunction_t Function; /* Combine function */
- GrCombineFactor_t Factor; /* Combine scale factor */
- GrCombineLocal_t Local; /* Local combine source */
- GrCombineOther_t Other; /* Other combine source */
- FxBool Invert; /* Combine result inversion flag */
-};
-
-/* for Voodoo3's grTexCombine() */
-struct tdfx_texcombine {
- GrCombineFunction_t FunctionRGB;
- GrCombineFactor_t FactorRGB;
- GrCombineFunction_t FunctionAlpha;
- GrCombineFactor_t FactorAlpha;
- FxBool InvertRGB;
- FxBool InvertAlpha;
-};
-
-
-/* for Voodoo5's grColorCombineExt() */
-struct tdfx_combine_color_ext {
- GrCCUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrCCUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrCCUColor_t SourceC;
- FxBool InvertC;
- GrCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grAlphaCombineExt() */
-struct tdfx_combine_alpha_ext {
- GrACUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrACUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrACUColor_t SourceC;
- FxBool InvertC;
- GrACUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grTexColorCombineExt() */
-struct tdfx_color_texenv {
- GrTCCUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrTCCUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrTCCUColor_t SourceC;
- FxBool InvertC;
- GrTCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grTexAlphaCombineExt() */
-struct tdfx_alpha_texenv {
- GrTACUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrTACUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrTACUColor_t SourceC;
- FxBool InvertC;
- GrTCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* Voodoo5's texture combine environment */
-struct tdfx_texcombine_ext {
- struct tdfx_alpha_texenv Alpha;
- struct tdfx_color_texenv Color;
- GrColor_t EnvColor;
-};
-
-/* Used to track changes between Glide's state and Mesa's */
-struct tdfx_texstate {
- GLuint Enabled[2]; /* values ala ctx->Texture.Unit[i]._ReallyEnabled */
- GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
- GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
-};
-
-struct tdfx_color {
- GrColor_t ClearColor; /* Buffer clear color value */
- GrAlpha_t ClearAlpha; /* Buffer clear alpha value */
- FxBool ColorMask[4]; /* Per-channel write enable flags */
-
- GrColor_t MonoColor; /* Constant color value */
-
- /* Alpha testing */
- GrCmpFnc_t AlphaFunc; /* Alpha test function */
- GrAlpha_t AlphaRef; /* Alpha ref value in range [0,255] */
-
- /* Blending */
- GrAlphaBlendFnc_t BlendSrcRGB; /* Blend source RGB factor */
- GrAlphaBlendFnc_t BlendDstRGB; /* Blend destination RGB factor */
- GrAlphaBlendFnc_t BlendSrcA; /* Blend source alpha factor */
- GrAlphaBlendFnc_t BlendDstA; /* Blend destination alpha factor */
-
- GrDitherMode_t Dither; /* Dither enable */
-};
-
-struct tdfx_depth {
- GrDepthBufferMode_t Mode; /* Fixed-point Z or floating-point W */
- FxI32 Bias; /* Polygon offset factor */
- GrCmpFnc_t Func; /* Depth test function */
- FxU32 Clear; /* Buffer clear value */
- FxBool Mask; /* Write enable flag */
-};
-
-struct tdfx_stipple {
- GrStippleMode_t Mode; /* Stipple enable/disable */
- FxU32 Pattern; /* 8x4 Stipple Pattern */
-};
-
-struct tdfx_fog {
- GrFogMode_t Mode; /* Glide fog mode */
- GrColor_t Color; /* Fog color value */
- GLenum TableMode; /* GL fog mode currently in table */
- GrFog_t *Table; /* Fog value table */
- FxFloat Density; /* Density >= 0 */
- FxFloat Near; /* Start distance in eye coords */
- FxFloat Far; /* End distance in eye coords */
-};
-
-struct tdfx_stencil {
- GrCmpFnc_t Function; /* Stencil function */
- GrStencil_t RefValue; /* Stencil reference value */
- GrStencil_t ValueMask; /* Value mask */
- GrStencil_t WriteMask; /* Write mask */
- GrStencil_t FailFunc; /* Stencil fail function */
- GrStencil_t ZFailFunc; /* Stencil pass, depth fail function */
- GrStencil_t ZPassFunc; /* Stencil pass, depth pass function */
- GrStencil_t Clear; /* Buffer clear value */
-};
-
-struct tdfx_scissor {
- FxU32 minX, minY; /* Lower left corner */
- FxU32 maxX, maxY; /* Upper right corner */
-};
-
-struct tdfx_viewport {
- GrCoordinateSpaceMode_t Mode; /* Coordinate space */
- FxI32 X, Y; /* Position */
- FxI32 Width, Height; /* Size */
- FxFloat Near, Far; /* Depth buffer range */
-};
-
-struct tdfx_glide {
- void *State; /* Mirror of internal Glide state */
- GrContext_t Context; /* Glide context identifier */
- FxI32 Board; /* Current graphics subsystem */
- GrColorFormat_t ColorFormat; /* Framebuffer format */
- GrOriginLocation_t Origin; /* Location of screen space origin */
-
- FxBool Initialized; /* Glide initialization done? */
-
- FxI32 SwapInterval; /* SwapBuffers interval */
- FxI32 MaxPendingSwaps; /* Maximum outstanding SwapBuffers */
- FxI32 TextureAlign;
-
- /* Extensions */
- FxBool HaveCombineExt; /* COMBINE */
- FxBool HaveCommandTransportExt; /* COMMAND_TRANSPORT */
- FxBool HaveFogCoordExt; /* FOGCOORD */
- FxBool HavePixelExt; /* PIXEXT */
- FxBool HaveTextureBufferExt; /* TEXTUREBUFFER */
- FxBool HaveTexFmtExt; /* TEXFMT */
- FxBool HaveTexUMAExt; /* TEXUMA */
- FxBool HaveTexus2; /* Texus 2 - FXT1 */
-
- /* Glide library function pointers */
- void (*grDrawPoint)( const void *pt );
- void (*grDrawLine)( const void *v1, const void *v2 );
- void (*grDrawTriangle)( const void *a, const void *b, const void *c );
- void (*grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);
- void (*grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);
- void (*grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride);
- void (*grBufferClear)( GrColor_t color, GrAlpha_t alpha, FxU32 depth );
- void (*grBufferSwap)( FxU32 swap_interval );
- void (*grRenderBuffer)( GrBuffer_t buffer );
- void (*grErrorSetCallback)( GrErrorCallbackFnc_t fnc );
- void (*grFinish)(void);
- void (*grFlush)(void);
- GrContext_t (*grSstWinOpen)(FxU32 hWnd,
- GrScreenResolution_t screen_resolution,
- GrScreenRefresh_t refresh_rate,
- GrColorFormat_t color_format,
- GrOriginLocation_t origin_location,
- int nColBuffers,
- int nAuxBuffers);
- void (*grSstWinClose)( GrContext_t context );
-/* Not used */
-#if 0
- void (*grSetNumPendingBuffers)(FxI32 NumPendingBuffers);
-#endif
- void (*grSelectContext)( GrContext_t context );
- void (*grSstOrigin)(GrOriginLocation_t origin);
- void (*grSstSelect)( int which_sst );
- void (*grAlphaBlendFunction)(GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df);
- void (*grAlphaCombine)(GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local, GrCombineOther_t other,
- FxBool invert);
- void (*grAlphaControlsITRGBLighting)( FxBool enable );
- void (*grAlphaTestFunction)( GrCmpFnc_t function );
- void (*grAlphaTestReferenceValue)( GrAlpha_t value );
- void (*grChromakeyMode)( GrChromakeyMode_t mode );
- void (*grChromakeyValue)( GrColor_t value );
- void (*grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
- void (*grColorCombine)( GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local,
- GrCombineOther_t other,
- FxBool invert );
- void (*grColorMask)( FxBool rgb, FxBool a );
- void (*grCullMode)( GrCullMode_t mode );
- void (*grConstantColorValue)( GrColor_t value );
- void (*grDepthBiasLevel)( FxI32 level );
- void (*grDepthBufferFunction)( GrCmpFnc_t function );
- void (*grDepthBufferMode)( GrDepthBufferMode_t mode );
- void (*grDepthMask)( FxBool mask );
- void (*grDisableAllEffects)( void );
- void (*grDitherMode)( GrDitherMode_t mode );
- void (*grFogColorValue)( GrColor_t fogcolor );
- void (*grFogMode)( GrFogMode_t mode );
- void (*grFogTable)( const GrFog_t ft[] );
- void (*grLoadGammaTable)( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
- void (*grSplash)(float x, float y, float width, float height, FxU32 frame);
- FxU32 (*grGet)( FxU32 pname, FxU32 plength, FxI32 *params );
- const char * (*grGetString)( FxU32 pname );
- FxI32 (*grQueryResolutions)( const GrResolution *resTemplate,
- GrResolution *output );
- FxBool (*grReset)( FxU32 what );
- GrProc (*grGetProcAddress)( char *procName );
- void (*grEnable)( GrEnableMode_t mode );
- void (*grDisable)( GrEnableMode_t mode );
- void (*grCoordinateSpace)( GrCoordinateSpaceMode_t mode );
- void (*grDepthRange)( FxFloat n, FxFloat f );
- void (*grStippleMode)( GrStippleMode_t mode );
- void (*grStipplePattern)( GrStipplePattern_t mode );
- void (*grViewport)( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
- FxU32 (*grTexCalcMemRequired)(GrLOD_t lodmin, GrLOD_t lodmax,
- GrAspectRatio_t aspect, GrTextureFormat_t fmt);
- FxU32 (*grTexTextureMemRequired)( FxU32 evenOdd, GrTexInfo *info );
- FxU32 (*grTexMinAddress)( GrChipID_t tmu );
- FxU32 (*grTexMaxAddress)( GrChipID_t tmu );
- void (*grTexNCCTable)( GrNCCTable_t table );
- void (*grTexSource)( GrChipID_t tmu, FxU32 startAddress,
- FxU32 evenOdd, GrTexInfo *info );
- void (*grTexClampMode)( GrChipID_t tmu,
- GrTextureClampMode_t s_clampmode,
- GrTextureClampMode_t t_clampmode );
- void (*grTexCombine)( GrChipID_t tmu,
- GrCombineFunction_t rgb_function,
- GrCombineFactor_t rgb_factor,
- GrCombineFunction_t alpha_function,
- GrCombineFactor_t alpha_factor,
- FxBool rgb_invert,
- FxBool alpha_invert);
- void (*grTexDetailControl)( GrChipID_t tmu, int lod_bias,
- FxU8 detail_scale, float detail_max );
- void (*grTexFilterMode)( GrChipID_t tmu,
- GrTextureFilterMode_t minfilter_mode,
- GrTextureFilterMode_t magfilter_mode );
- void (*grTexLodBiasValue)(GrChipID_t tmu, float bias );
- void (*grTexDownloadMipMap)( GrChipID_t tmu, FxU32 startAddress,
- FxU32 evenOdd, GrTexInfo *info );
- void (*grTexDownloadMipMapLevel)( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data );
- FxBool (*grTexDownloadMipMapLevelPartial)( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data,
- int start,
- int end );
- void (*grTexDownloadTable)( GrTexTable_t type, void *data );
- void (*grTexDownloadTablePartial)( GrTexTable_t type,
- void *data, int start, int end );
- void (*grTexMipMapMode)( GrChipID_t tmu, GrMipMapMode_t mode,
- FxBool lodBlend );
- void (*grTexMultibase)( GrChipID_t tmu, FxBool enable );
- void (*grTexMultibaseAddress)( GrChipID_t tmu,
- GrTexBaseRange_t range,
- FxU32 startAddress,
- FxU32 evenOdd,
- GrTexInfo *info );
- FxBool (*grLfbLock)( GrLock_t type, GrBuffer_t buffer,
- GrLfbWriteMode_t writeMode,
- GrOriginLocation_t origin, FxBool pixelPipeline,
- GrLfbInfo_t *info );
- FxBool (*grLfbUnlock)( GrLock_t type, GrBuffer_t buffer );
- void (*grLfbConstantAlpha)( GrAlpha_t alpha );
- void (*grLfbConstantDepth)( FxU32 depth );
- void (*grLfbWriteColorSwizzle)(FxBool swizzleBytes, FxBool swapWords);
- void (*grLfbWriteColorFormat)(GrColorFormat_t colorFormat);
- FxBool (*grLfbWriteRegion)( GrBuffer_t dst_buffer,
- FxU32 dst_x, FxU32 dst_y,
- GrLfbSrcFmt_t src_format,
- FxU32 src_width, FxU32 src_height,
- FxBool pixelPipeline,
- FxI32 src_stride, void *src_data );
- FxBool (*grLfbReadRegion)( GrBuffer_t src_buffer,
- FxU32 src_x, FxU32 src_y,
- FxU32 src_width, FxU32 src_height,
- FxU32 dst_stride, void *dst_data );
- void (*grGlideInit)( void );
- void (*grGlideShutdown)( void );
- void (*grGlideGetState)( void *state );
- void (*grGlideSetState)( const void *state );
- void (*grGlideGetVertexLayout)( void *layout );
- void (*grGlideSetVertexLayout)( const void *layout );
- /* Glide utility functions */
- void (*guFogGenerateExp)( GrFog_t *fogtable, float density );
- void (*guFogGenerateExp2)( GrFog_t *fogtable, float density );
- void (*guFogGenerateLinear)(GrFog_t *fogtable, float nearZ, float farZ );
- /* DRI functions */
- void (*grDRIOpen)( char *pFB, char *pRegs, int deviceID,
- int width, int height,
- int mem, int cpp, int stride,
- int fifoOffset, int fifoSize,
- int fbOffset, int backOffset, int depthOffset,
- int textureOffset, int textureSize,
- volatile int *fifoPtr, volatile int *fifoRead );
- void (*grDRIPosition)( int x, int y, int w, int h,
- int numClip, XF86DRIClipRectPtr pClip );
- void (*grDRILostContext)( void );
- void (*grDRIImportFifo)( int fifoPtr, int fifoRead );
- void (*grDRIInvalidateAll)( void );
- void (*grDRIResetSAREA)( void );
- void (*grDRIBufferSwap)( FxU32 swapInterval );
- /* Glide extensions */
- /* PIXEXT extension */
- void (*grStencilFunc)( GrCmpFnc_t func, GrStencil_t ref, GrStencil_t mask );
- void (*grStencilMask)( GrStencil_t mask );
- void (*grStencilOp)( GrStencilOp_t fail, GrStencilOp_t zfail,
- GrStencilOp_t zpass );
- void (*grBufferClearExt)( GrColor_t color, GrAlpha_t alpha,
- FxU32 depth, GrStencil_t stencil );
- void (*grColorMaskExt)( FxBool r, FxBool g, FxBool b, FxBool a );
- /* COMBINE extension */
- void (*grColorCombineExt)( GrCCUColor_t a, GrCombineMode_t a_mode,
- GrCCUColor_t b, GrCombineMode_t b_mode,
- GrCCUColor_t c, FxBool c_invert,
- GrCCUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
- void (*grTexColorCombineExt)( FxU32 tmu,
- GrTCCUColor_t a, GrCombineMode_t a_mode,
- GrTCCUColor_t b, GrCombineMode_t b_mode,
- GrTCCUColor_t c, FxBool c_invert,
- GrTCCUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
- void (*grAlphaCombineExt)( GrACUColor_t a, GrCombineMode_t a_mode,
- GrACUColor_t b, GrCombineMode_t b_mode,
- GrACUColor_t c, FxBool c_invert,
- GrACUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
- void (*grTexAlphaCombineExt)( FxU32 tmu,
- GrTACUColor_t a, GrCombineMode_t a_mode,
- GrTACUColor_t b, GrCombineMode_t b_mode,
- GrTACUColor_t c, FxBool c_invert,
- GrTACUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
- void (*grAlphaBlendFunctionExt)( GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendOp_t rgb_op,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df,
- GrAlphaBlendOp_t alpha_op );
- void (*grConstantColorValueExt)( FxU32 tmu, GrColor_t value );
- /* Texus 2 */
- void (*txImgQuantize)( void *xxx_unknown_arguments );
- void (*txImgDequantizeFXT1)( void *txMip, void *pxMip );
- void (*txErrorSetCallback)( void *fnc );
-};
-
-typedef void (*tdfx_tri_func)( tdfxContextPtr, tdfxVertex *, tdfxVertex *,
- tdfxVertex * );
-typedef void (*tdfx_line_func)( tdfxContextPtr, tdfxVertex *, tdfxVertex * );
-typedef void (*tdfx_point_func)( tdfxContextPtr, tdfxVertex * );
-
-struct tdfx_context {
- /* Set once and never changed:
- */
- GLcontext *glCtx; /* The core Mesa context */
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- /* Mirror of hardware state, Glide parameters
- */
- struct tdfx_texsource TexSource[TDFX_NUM_TMU];
- struct tdfx_texparams TexParams[TDFX_NUM_TMU];
- struct tdfx_texpalette TexPalette;
-
- /* Voodoo3 texture/color combine state */
- struct tdfx_combine ColorCombine;
- struct tdfx_combine AlphaCombine;
- struct tdfx_texcombine TexCombine[TDFX_NUM_TMU];
-
- /* Voodoo5 texture/color combine state */
- struct tdfx_combine_color_ext ColorCombineExt;
- struct tdfx_combine_alpha_ext AlphaCombineExt;
- struct tdfx_texcombine_ext TexCombineExt[TDFX_NUM_TMU];
-
- /* Tracks tex state difference between Glide and Mesa */
- struct tdfx_texstate TexState;
-
- GrBuffer_t DrawBuffer; /* Current draw buffer */
- GrBuffer_t ReadBuffer; /* Current read buffer */
-
- struct tdfx_color Color;
- struct tdfx_depth Depth;
- struct tdfx_fog Fog;
- struct tdfx_stencil Stencil;
- struct tdfx_scissor Scissor;
- struct tdfx_viewport Viewport;
- struct tdfx_stipple Stipple;
-
- GrCullMode_t CullMode;
-
- struct tdfx_glide Glide;
-
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
-
- /* Fallback rasterization functions
- */
- tdfx_point_func draw_point;
- tdfx_line_func draw_line;
- tdfx_tri_func draw_triangle;
-
-
- /* Variable-size Glide vertex formats
- */
- GLuint vertexFormat; /* the current format */
- GLuint vertex_stride_shift;
- void *layout[TDFX_NUM_LAYOUTS];
- GLubyte *verts; /* tdfxVertices, arbitarily packed */
-
- GLfloat hw_viewport[16];
-
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLuint Fallback;
- GLenum render_primitive; /* what GL thinks */
- GLenum raster_primitive; /* what the hardware thinks */
-
- GLfloat sScale0, tScale0;
- GLfloat sScale1, tScale1;
-
- GLuint texBindNumber;
- GLint tmuSrc;
-
- int screen_width;
- int screen_height;
-
- GLboolean haveTwoTMUs; /* True if we have 2 tmu's */
- GLboolean haveHwStencil;
- GLboolean haveHwStipple;
-
- GLint maxPendingSwapBuffers;
-
- char rendererString[100];
-
- /* stuff added for DRI */
- __DRIscreenPrivate *driScreen;
- __DRIcontextPrivate *driContext;
- __DRIdrawablePrivate *driDrawable;
- drmContext hHWContext;
- drmLock *driHwLock;
- int driFd;
- tdfxScreenPrivate *fxScreen;
- TDFXSAREAPriv *sarea;
-
-
- /*
- * Changes during execution:
- */
- int width, height; /* size of window */
- int x_offset; /* distance from window left to screen left */
- int y_offset; /* distance from window top to screen top */
- int y_delta; /* distance from window bottom to screen bottom */
-
- int numClipRects;
- XF86DRIClipRectPtr pClipRects;
- GLboolean scissoredClipRects; /* if true, pClipRects is private storage */
-
- GuTexPalette glbPalette; /* global texture palette */
-
- tdfxStats stats;
-
- GLboolean debugFallbacks;
-};
-
-#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx))
-
-
-extern GLboolean
-tdfxCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-tdfxDestroyContext( __DRIcontextPrivate *driContextPriv );
-
-extern GLboolean
-tdfxUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-extern GLboolean
-tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean
-tdfxInitGlide( tdfxContextPtr tmesa );
-
-extern void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]);
-
-extern void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]);
-
-
-/* Color packing utilities
- */
-#define TDFXPACKCOLOR332( r, g, b ) \
- (((b) & 0xe0) | (((g) & 0xe0) >> 3) | (((r) & 0xc0) >> 6))
-
-#define TDFXPACKCOLOR1555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define TDFXPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define TDFXPACKCOLOR888( r, g, b ) \
- (((b) << 16) | ((g) << 8) | (r))
-
-#define TDFXPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define TDFXPACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4))
-
-static __inline__ GrColor_t tdfxPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return TDFXPACKCOLOR565( r, g, b );
- case 4:
- return TDFXPACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-#define DO_DEBUG 0
-#if DO_DEBUG
-extern int TDFX_DEBUG;
-#else
-#define TDFX_DEBUG 0
-#endif
-
-#define DEBUG_ALWAYS_SYNC 0x01
-#define DEBUG_VERBOSE_API 0x02
-#define DEBUG_VERBOSE_MSG 0x04
-#define DEBUG_VERBOSE_LRU 0x08
-#define DEBUG_VERBOSE_DRI 0x10
-#define DEBUG_VERBOSE_IOCTL 0x20
-#define DEBUG_VERBOSE_2D 0x40
-
-#endif /* GLX_DIRECT_RENDERING */
-
-#endif /* __TDFX_CONTEXT_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
deleted file mode 100644
index 31604e3e1..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c,v 1.10 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_pixels.h"
-
-#include "context.h"
-#include "enums.h"
-#include "swrast/swrast.h"
-#if defined(USE_X86_ASM)
-#include "X86/common_x86_asm.h"
-#endif
-
-
-#define TDFX_DATE "20021125"
-
-
-/* These are used in calls to FX_grColorMaskv() */
-const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE };
-const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
-
-
-
-/* KW: Put the word Mesa in the render string because quakeworld
- * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE).
- * Why?
- */
-static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
-
- switch ( name ) {
- case GL_RENDERER:
- {
- /* The renderer string must be per-context state to handle
- * multihead correctly.
- */
- char *buffer = fxMesa->rendererString;
- char hardware[100];
-
- LOCK_HARDWARE(fxMesa);
- strcpy( hardware, fxMesa->Glide.grGetString(GR_HARDWARE) );
- UNLOCK_HARDWARE(fxMesa);
-
- strcpy( buffer, "Mesa DRI " );
- strcat( buffer, TDFX_DATE );
- strcat( buffer, " " );
-
- if ( strcmp( hardware, "Voodoo3 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo3" );
- }
- else if ( strcmp( hardware, "Voodoo Banshee (tm)" ) == 0 ) {
- strcat( buffer, "VoodooBanshee" );
- }
- else if ( strcmp( hardware, "Voodoo4 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo4" );
- }
- else if ( strcmp( hardware, "Voodoo5 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo5" );
- }
- else {
- /* unexpected result: replace spaces with hyphens */
- int i;
- for ( i = 0 ; hardware[i] && i < 60 ; i++ ) {
- if ( hardware[i] == ' ' || hardware[i] == '\t' )
- hardware[i] = '-';
- }
- strcat( buffer, hardware );
- }
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
- }
-#endif
-#ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- strncat( buffer, "/MMX", 4 );
- }
-#endif
-#ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- strncat( buffer, "/3DNow!", 7 );
- }
-#endif
-#ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- strncat( buffer, "/SSE", 4 );
- }
-#endif
- return (const GLubyte *) buffer;
- }
- case GL_VENDOR:
- return (const GLubyte *)"VA Linux Systems, Inc.";
- default:
- return NULL;
- }
-}
-
-
-/* Return uptodate buffer size information.
- */
-static void tdfxDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- LOCK_HARDWARE( fxMesa );
- *width = fxMesa->width;
- *height = fxMesa->height;
- UNLOCK_HARDWARE( fxMesa );
-}
-
-
-
-/*
- * Return the current value of the occlusion test flag and
- * reset the flag (hardware counters) to false.
- */
-static GLboolean get_occlusion_result( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLboolean result;
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFinish(); /* required to flush the FIFO - FB 21-01-2002 */
-
- if (ctx->Depth.OcclusionTest) {
- if (ctx->OcclusionResult) {
- result = GL_TRUE; /* result of software rendering */
- }
- else {
- FxI32 zfail, in;
- fxMesa->Glide.grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &zfail);
- fxMesa->Glide.grGet(GR_STATS_PIXELS_IN, 4, &in);
- /* Geometry is occluded if there is no input (in == 0) */
- /* or if all pixels failed the depth test (zfail == in) */
- /* The < 1 is there because I have empirically seen cases where */
- /* zfail > in.... go figure. FB - 21-01-2002. */
- result = ((in - zfail) < 1 || in == 0) ? GL_FALSE : GL_TRUE;
- }
- }
- else {
- result = ctx->OcclusionResultSaved;
- }
-
- /* reset results now */
- fxMesa->Glide.grReset(GR_STATS_PIXELS);
- ctx->OcclusionResult = GL_FALSE;
- ctx->OcclusionResultSaved = GL_FALSE;
-
- UNLOCK_HARDWARE( fxMesa );
-
- return result;
-}
-
-
-/*
- * We're only implementing this function to handle the
- * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it
- * has a side-effect: resetting the occlustion result flag.
- */
-static GLboolean tdfxDDGetBooleanv( GLcontext *ctx, GLenum pname,
- GLboolean *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetDoublev( GLcontext *ctx, GLenum pname,
- GLdouble *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLdouble) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetFloatv( GLcontext *ctx, GLenum pname,
- GLfloat *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLfloat) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetIntegerv( GLcontext *ctx, GLenum pname,
- GLint *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLint) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-
-#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \
- ((vis.redBits == r) && \
- (vis.greenBits == g) && \
- (vis.blueBits == b) && \
- (vis.alphaBits == a))
-
-void tdfxDDInitDriverFuncs( GLcontext *ctx )
-{
- if ( MESA_VERBOSE & VERBOSE_DRIVER ) {
- fprintf( stderr, "tdfx: %s()\n", __FUNCTION__ );
- }
-
- ctx->Driver.GetString = tdfxDDGetString;
- ctx->Driver.GetBufferSize = tdfxDDGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.Error = NULL;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Accelerated paths
- */
- if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) )
- {
- ctx->Driver.DrawPixels = tdfx_drawpixels_R8G8B8A8;
- ctx->Driver.ReadPixels = tdfx_readpixels_R8G8B8A8;
- }
- else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) )
- {
- ctx->Driver.ReadPixels = tdfx_readpixels_R5G6B5;
- }
-
- ctx->Driver.GetBooleanv = tdfxDDGetBooleanv;
- ctx->Driver.GetDoublev = tdfxDDGetDoublev;
- ctx->Driver.GetFloatv = tdfxDDGetFloatv;
- ctx->Driver.GetIntegerv = tdfxDDGetIntegerv;
- ctx->Driver.GetPointerv = NULL;
-}
-
-
-/*
- * These are here for lack of a better place.
- */
-
-void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- LOCK_HARDWARE(fxMesa);
- if (ctx->Visual.redBits == 8) {
- /* 32bpp mode */
- ASSERT( fxMesa->Glide.grColorMaskExt );
- fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
- rgba[BCOMP], rgba[ACOMP]);
- }
- else {
- /* 16 bpp mode */
- /* we never have an alpha buffer */
- fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP],
- GL_FALSE);
- }
- UNLOCK_HARDWARE(fxMesa);
-}
-
-void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (ctx->Visual.redBits == 8) {
- /* 32bpp mode */
- ASSERT( fxMesa->Glide.grColorMaskExt );
- fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
- rgba[BCOMP], rgba[ACOMP]);
- }
- else {
- /* 16 bpp mode */
- /* we never have an alpha buffer */
- fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP],
- GL_FALSE);
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h
deleted file mode 100644
index dbb585e3b..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h,v 1.1 2001/03/21 16:14:27 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_DD_H__
-#define __TDFX_DD_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "context.h"
-
-extern void tdfxDDInitDriverFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h
deleted file mode 100644
index f077aa678..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * This file defines macros and types necessary for accessing glide3.
- */
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h,v 1.1 2002/02/22 21:45:03 dawes Exp $ */
-
-#ifndef NEWGLIDE_H
-#define NEWGLIDE_H
-
-#define FX_CALL
-
-typedef unsigned char FxU8;
-typedef signed char FxI8;
-typedef unsigned short FxU16;
-typedef signed short FxI16;
-#if defined(__alpha__) || defined (__LP64__)
-typedef signed int FxI32;
-typedef unsigned int FxU32;
-#else
-typedef signed long FxI32;
-typedef unsigned long FxU32;
-#endif
-typedef unsigned long AnyPtr;
-typedef int FxBool;
-typedef float FxFloat;
-typedef double FxDouble;
-
-typedef unsigned long FxColor_t;
-typedef struct
-{
- float r, g, b, a;
-}
-FxColor4;
-
-typedef FxU32 GrColor_t;
-typedef FxU8 GrAlpha_t;
-typedef FxU32 GrMipMapId_t;
-typedef FxU32 GrStipplePattern_t;
-typedef FxU8 GrFog_t;
-typedef FxU32 GrContext_t;
-typedef int (FX_CALL * GrProc) (void);
-
-#define FXTRUE 1
-#define FXFALSE 0
-
-#define FXBIT(i) (1L << (i))
-
-#define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1)
-
-#define GR_MIPMAPLEVELMASK_EVEN FXBIT(0)
-#define GR_MIPMAPLEVELMASK_ODD FXBIT(1)
-#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
-
-typedef FxI32 GrChipID_t;
-#define GR_TMU0 0x0
-#define GR_TMU1 0x1
-#define GR_TMU2 0x2
-
-#define GR_FBI 0x0
-
-typedef FxI32 GrCombineFunction_t;
-#define GR_COMBINE_FUNCTION_ZERO 0x0
-#define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO
-#define GR_COMBINE_FUNCTION_LOCAL 0x1
-#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
-#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
-#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
-#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
-#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
-#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
-#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
-
-typedef FxI32 GrCombineFactor_t;
-#define GR_COMBINE_FACTOR_ZERO 0x0
-#define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO
-#define GR_COMBINE_FACTOR_LOCAL 0x1
-#define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2
-#define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3
-#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
-#define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5
-#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
-#define GR_COMBINE_FACTOR_LOD_FRACTION 0x5
-#define GR_COMBINE_FACTOR_ONE 0x8
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
-#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
-#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
-#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
-
-typedef FxI32 GrCombineLocal_t;
-#define GR_COMBINE_LOCAL_ITERATED 0x0
-#define GR_COMBINE_LOCAL_CONSTANT 0x1
-#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
-#define GR_COMBINE_LOCAL_DEPTH 0x2
-
-typedef FxI32 GrCombineOther_t;
-#define GR_COMBINE_OTHER_ITERATED 0x0
-#define GR_COMBINE_OTHER_TEXTURE 0x1
-#define GR_COMBINE_OTHER_CONSTANT 0x2
-#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
-
-typedef FxI32 GrAlphaSource_t;
-#define GR_ALPHASOURCE_CC_ALPHA 0x0
-#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
-#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
-#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
-
-typedef FxI32 GrColorCombineFnc_t;
-#define GR_COLORCOMBINE_ZERO 0x0
-#define GR_COLORCOMBINE_CCRGB 0x1
-#define GR_COLORCOMBINE_ITRGB 0x2
-#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
-#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
-#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
-#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
-#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
-#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
-#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
-#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
-#define GR_COLORCOMBINE_ONE 0x10
-
-typedef FxI32 GrAlphaBlendFnc_t;
-#define GR_BLEND_ZERO 0x0
-#define GR_BLEND_SRC_ALPHA 0x1
-#define GR_BLEND_SRC_COLOR 0x2
-#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
-#define GR_BLEND_DST_ALPHA 0x3
-#define GR_BLEND_ONE 0x4
-#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
-#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
-#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR
-#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
-#define GR_BLEND_RESERVED_8 0x8
-#define GR_BLEND_RESERVED_9 0x9
-#define GR_BLEND_RESERVED_A 0xa
-#define GR_BLEND_RESERVED_B 0xb
-#define GR_BLEND_RESERVED_C 0xc
-#define GR_BLEND_RESERVED_D 0xd
-#define GR_BLEND_RESERVED_E 0xe
-#define GR_BLEND_ALPHA_SATURATE 0xf
-#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
-#define GR_BLEND_SAME_COLOR_EXT 0x08
-#define GR_BLEND_ONE_MINUS_SAME_COLOR_EXT 0x09
-
-typedef FxI32 GrAspectRatio_t;
-#define GR_ASPECT_LOG2_8x1 3
-#define GR_ASPECT_LOG2_4x1 2
-#define GR_ASPECT_LOG2_2x1 1
-#define GR_ASPECT_LOG2_1x1 0
-#define GR_ASPECT_LOG2_1x2 -1
-#define GR_ASPECT_LOG2_1x4 -2
-#define GR_ASPECT_LOG2_1x8 -3
-
-typedef FxI32 GrBuffer_t;
-#define GR_BUFFER_FRONTBUFFER 0x0
-#define GR_BUFFER_BACKBUFFER 0x1
-#define GR_BUFFER_AUXBUFFER 0x2
-#define GR_BUFFER_DEPTHBUFFER 0x3
-#define GR_BUFFER_ALPHABUFFER 0x4
-#define GR_BUFFER_TRIPLEBUFFER 0x5
-
-typedef FxI32 GrChromakeyMode_t;
-#define GR_CHROMAKEY_DISABLE 0x0
-#define GR_CHROMAKEY_ENABLE 0x1
-
-typedef FxI32 GrChromaRangeMode_t;
-#define GR_CHROMARANGE_RGB_ALL_EXT 0x0
-
-#define GR_CHROMARANGE_DISABLE_EXT 0x00
-#define GR_CHROMARANGE_ENABLE_EXT 0x01
-
-typedef FxI32 GrTexChromakeyMode_t;
-#define GR_TEXCHROMA_DISABLE_EXT 0x0
-#define GR_TEXCHROMA_ENABLE_EXT 0x1
-
-#define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0
-
-typedef FxI32 GrCmpFnc_t;
-#define GR_CMP_NEVER 0x0
-#define GR_CMP_LESS 0x1
-#define GR_CMP_EQUAL 0x2
-#define GR_CMP_LEQUAL 0x3
-#define GR_CMP_GREATER 0x4
-#define GR_CMP_NOTEQUAL 0x5
-#define GR_CMP_GEQUAL 0x6
-#define GR_CMP_ALWAYS 0x7
-
-typedef FxI32 GrColorFormat_t;
-#define GR_COLORFORMAT_ARGB 0x0
-#define GR_COLORFORMAT_ABGR 0x1
-
-#define GR_COLORFORMAT_RGBA 0x2
-#define GR_COLORFORMAT_BGRA 0x3
-
-typedef FxI32 GrCullMode_t;
-#define GR_CULL_DISABLE 0x0
-#define GR_CULL_NEGATIVE 0x1
-#define GR_CULL_POSITIVE 0x2
-
-typedef FxI32 GrDepthBufferMode_t;
-#define GR_DEPTHBUFFER_DISABLE 0x0
-#define GR_DEPTHBUFFER_ZBUFFER 0x1
-#define GR_DEPTHBUFFER_WBUFFER 0x2
-#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3
-#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4
-
-typedef FxI32 GrDitherMode_t;
-#define GR_DITHER_DISABLE 0x0
-#define GR_DITHER_2x2 0x1
-#define GR_DITHER_4x4 0x2
-
-typedef FxI32 GrStippleMode_t;
-#define GR_STIPPLE_DISABLE 0x0
-#define GR_STIPPLE_PATTERN 0x1
-#define GR_STIPPLE_ROTATE 0x2
-
-typedef FxI32 GrFogMode_t;
-#define GR_FOG_DISABLE 0x0
-#define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1
-#define GR_FOG_WITH_TABLE_ON_Q 0x2
-#define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q
-#define GR_FOG_WITH_ITERATED_Z 0x3
-#define GR_FOG_WITH_ITERATED_ALPHA_EXT 0x4
-#define GR_FOG_MULT2 0x100
-#define GR_FOG_ADD2 0x200
-
-typedef FxU32 GrLock_t;
-#define GR_LFB_READ_ONLY 0x00
-#define GR_LFB_WRITE_ONLY 0x01
-#define GR_LFB_IDLE 0x00
-#define GR_LFB_NOIDLE 0x10
-
-typedef FxI32 GrLfbBypassMode_t;
-#define GR_LFBBYPASS_DISABLE 0x0
-#define GR_LFBBYPASS_ENABLE 0x1
-
-typedef FxI32 GrLfbWriteMode_t;
-#define GR_LFBWRITEMODE_565 0x0
-#define GR_LFBWRITEMODE_555 0x1
-#define GR_LFBWRITEMODE_1555 0x2
-#define GR_LFBWRITEMODE_RESERVED1 0x3
-#define GR_LFBWRITEMODE_888 0x4
-#define GR_LFBWRITEMODE_8888 0x5
-#define GR_LFBWRITEMODE_RESERVED2 0x6
-#define GR_LFBWRITEMODE_RESERVED3 0x7
-#define GR_LFBWRITEMODE_RESERVED4 0x8
-#define GR_LFBWRITEMODE_RESERVED5 0x9
-#define GR_LFBWRITEMODE_RESERVED6 0xa
-#define GR_LFBWRITEMODE_RESERVED7 0xb
-#define GR_LFBWRITEMODE_565_DEPTH 0xc
-#define GR_LFBWRITEMODE_555_DEPTH 0xd
-#define GR_LFBWRITEMODE_1555_DEPTH 0xe
-#define GR_LFBWRITEMODE_ZA16 0xf
-#define GR_LFBWRITEMODE_ANY 0xFF
-
-typedef FxI32 GrOriginLocation_t;
-#define GR_ORIGIN_UPPER_LEFT 0x0
-#define GR_ORIGIN_LOWER_LEFT 0x1
-#define GR_ORIGIN_ANY 0xFF
-
-typedef struct
-{
- int size;
- void *lfbPtr;
- FxU32 strideInBytes;
- GrLfbWriteMode_t writeMode;
- GrOriginLocation_t origin;
-}
-GrLfbInfo_t;
-
-typedef FxI32 GrLOD_t;
-#define GR_LOD_LOG2_2048 0xb
-#define GR_LOD_LOG2_1024 0xa
-#define GR_LOD_LOG2_512 0x9
-#define GR_LOD_LOG2_256 0x8
-#define GR_LOD_LOG2_128 0x7
-#define GR_LOD_LOG2_64 0x6
-#define GR_LOD_LOG2_32 0x5
-#define GR_LOD_LOG2_16 0x4
-#define GR_LOD_LOG2_8 0x3
-#define GR_LOD_LOG2_4 0x2
-#define GR_LOD_LOG2_2 0x1
-#define GR_LOD_LOG2_1 0x0
-
-typedef FxI32 GrMipMapMode_t;
-#define GR_MIPMAP_DISABLE 0x0
-#define GR_MIPMAP_NEAREST 0x1
-#define GR_MIPMAP_NEAREST_DITHER 0x2
-
-typedef FxI32 GrSmoothingMode_t;
-#define GR_SMOOTHING_DISABLE 0x0
-#define GR_SMOOTHING_ENABLE 0x1
-
-typedef FxI32 GrTextureClampMode_t;
-#define GR_TEXTURECLAMP_WRAP 0x0
-#define GR_TEXTURECLAMP_CLAMP 0x1
-#define GR_TEXTURECLAMP_MIRROR_EXT 0x2
-
-typedef FxI32 GrTextureCombineFnc_t;
-#define GR_TEXTURECOMBINE_ZERO 0x0
-#define GR_TEXTURECOMBINE_DECAL 0x1
-#define GR_TEXTURECOMBINE_OTHER 0x2
-#define GR_TEXTURECOMBINE_ADD 0x3
-#define GR_TEXTURECOMBINE_MULTIPLY 0x4
-#define GR_TEXTURECOMBINE_SUBTRACT 0x5
-#define GR_TEXTURECOMBINE_DETAIL 0x6
-#define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7
-#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8
-#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9
-#define GR_TEXTURECOMBINE_ONE 0xa
-
-typedef FxI32 GrTextureFilterMode_t;
-#define GR_TEXTUREFILTER_POINT_SAMPLED 0x0
-#define GR_TEXTUREFILTER_BILINEAR 0x1
-
-typedef FxI32 GrTextureFormat_t;
-#define GR_TEXFMT_8BIT 0x0
-#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
-#define GR_TEXFMT_YIQ_422 0x1
-#define GR_TEXFMT_ALPHA_8 0x2
-#define GR_TEXFMT_INTENSITY_8 0x3
-#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
-#define GR_TEXFMT_P_8 0x5
-#define GR_TEXFMT_RSVD0 0x6
-#define GR_TEXFMT_RSVD1 0x7
-#define GR_TEXFMT_16BIT 0x8
-#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
-#define GR_TEXFMT_AYIQ_8422 0x9
-#define GR_TEXFMT_RGB_565 0xa
-#define GR_TEXFMT_ARGB_1555 0xb
-#define GR_TEXFMT_ARGB_4444 0xc
-#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
-#define GR_TEXFMT_AP_88 0xe
-#define GR_TEXFMT_RSVD2 0xf
-#define GR_TEXFMT_ARGB_CMP_FXT1 0x11
-#define GR_TEXFMT_ARGB_8888 0x12
-#define GR_TEXFMT_YUYV_422 0x13
-#define GR_TEXFMT_UYVY_422 0x14
-#define GR_TEXFMT_AYUV_444 0x15
-#define GR_TEXFMT_ARGB_CMP_DXT1 0x16
-#define GR_TEXFMT_ARGB_CMP_DXT2 0x17
-#define GR_TEXFMT_ARGB_CMP_DXT3 0x18
-#define GR_TEXFMT_ARGB_CMP_DXT4 0x19
-#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
-
-typedef FxU32 GrTexTable_t;
-#define GR_TEXTABLE_NCC0 0x0
-#define GR_TEXTABLE_NCC1 0x1
-#define GR_TEXTABLE_PALETTE 0x2
-#define GR_TEXTABLE_PALETTE_6666_EXT 0x3
-
-typedef FxU32 GrNCCTable_t;
-#define GR_NCCTABLE_NCC0 0x0
-#define GR_NCCTABLE_NCC1 0x1
-
-typedef FxU32 GrTexBaseRange_t;
-#define GR_TEXBASE_256 0x3
-#define GR_TEXBASE_128 0x2
-#define GR_TEXBASE_64 0x1
-#define GR_TEXBASE_32_TO_1 0x0
-#define GR_TEXBASE_2048 0x7
-#define GR_TEXBASE_1024 0x6
-#define GR_TEXBASE_512 0x5
-#define GR_TEXBASE_256_TO_1 0x4
-
-typedef FxU32 GrEnableMode_t;
-#define GR_MODE_DISABLE 0x0
-#define GR_MODE_ENABLE 0x1
-
-#define GR_AA_ORDERED 0x01
-#define GR_ALLOW_MIPMAP_DITHER 0x02
-#define GR_PASSTHRU 0x03
-#define GR_SHAMELESS_PLUG 0x04
-#define GR_VIDEO_SMOOTHING 0x05
-
-typedef FxU32 GrCoordinateSpaceMode_t;
-#define GR_WINDOW_COORDS 0x00
-#define GR_CLIP_COORDS 0x01
-
-/* Parameters for strips */
-#define GR_PARAM_XY 0x01
-#define GR_PARAM_Z 0x02
-#define GR_PARAM_W 0x03
-#define GR_PARAM_Q 0x04
-#define GR_PARAM_FOG_EXT 0x05
-
-#define GR_PARAM_A 0x10
-
-#define GR_PARAM_RGB 0x20
-
-#define GR_PARAM_PARGB 0x30
-
-#define GR_PARAM_ST0 0x40
-#define GR_PARAM_ST1 GR_PARAM_ST0+1
-#define GR_PARAM_ST2 GR_PARAM_ST0+2
-
-#define GR_PARAM_Q0 0x50
-#define GR_PARAM_Q1 GR_PARAM_Q0+1
-#define GR_PARAM_Q2 GR_PARAM_Q0+2
-
-#define GR_PARAM_DISABLE 0x00
-#define GR_PARAM_ENABLE 0x01
-
-/* grDrawVertexArray/grDrawVertexArrayContiguous */
-#define GR_POINTS 0
-#define GR_LINE_STRIP 1
-#define GR_LINES 2
-#define GR_POLYGON 3
-#define GR_TRIANGLE_STRIP 4
-#define GR_TRIANGLE_FAN 5
-#define GR_TRIANGLES 6
-#define GR_TRIANGLE_STRIP_CONTINUE 7
-#define GR_TRIANGLE_FAN_CONTINUE 8
-
-/* grGet/grReset */
-#define GR_BITS_DEPTH 0x01
-#define GR_BITS_RGBA 0x02
-#define GR_FIFO_FULLNESS 0x03
-#define GR_FOG_TABLE_ENTRIES 0x04
-#define GR_GAMMA_TABLE_ENTRIES 0x05
-#define GR_GLIDE_STATE_SIZE 0x06
-#define GR_GLIDE_VERTEXLAYOUT_SIZE 0x07
-#define GR_IS_BUSY 0x08
-#define GR_LFB_PIXEL_PIPE 0x09
-#define GR_MAX_TEXTURE_SIZE 0x0a
-#define GR_MAX_TEXTURE_ASPECT_RATIO 0x0b
-#define GR_MEMORY_FB 0x0c
-#define GR_MEMORY_TMU 0x0d
-#define GR_MEMORY_UMA 0x0e
-#define GR_NUM_BOARDS 0x0f
-#define GR_NON_POWER_OF_TWO_TEXTURES 0x10
-#define GR_NUM_FB 0x11
-#define GR_NUM_SWAP_HISTORY_BUFFER 0x12
-#define GR_NUM_TMU 0x13
-#define GR_PENDING_BUFFERSWAPS 0x14
-#define GR_REVISION_FB 0x15
-#define GR_REVISION_TMU 0x16
-#define GR_STATS_LINES 0x17
-#define GR_STATS_PIXELS_AFUNC_FAIL 0x18
-#define GR_STATS_PIXELS_CHROMA_FAIL 0x19
-#define GR_STATS_PIXELS_DEPTHFUNC_FAIL 0x1a
-#define GR_STATS_PIXELS_IN 0x1b
-#define GR_STATS_PIXELS_OUT 0x1c
-#define GR_STATS_PIXELS 0x1d
-#define GR_STATS_POINTS 0x1e
-#define GR_STATS_TRIANGLES_IN 0x1f
-#define GR_STATS_TRIANGLES_OUT 0x20
-#define GR_STATS_TRIANGLES 0x21
-#define GR_SWAP_HISTORY 0x22
-#define GR_SUPPORTS_PASSTHRU 0x23
-#define GR_TEXTURE_ALIGN 0x24
-#define GR_VIDEO_POSITION 0x25
-#define GR_VIEWPORT 0x26
-#define GR_WDEPTH_MIN_MAX 0x27
-#define GR_ZDEPTH_MIN_MAX 0x28
-#define GR_VERTEX_PARAMETER 0x29
-#define GR_BITS_GAMMA 0x2a
-#define GR_GET_RESERVED_1 0x1000
-
-/* grGetString types */
-#define GR_EXTENSION 0xa0
-#define GR_HARDWARE 0xa1
-#define GR_RENDERER 0xa2
-#define GR_VENDOR 0xa3
-#define GR_VERSION 0xa4
-
-typedef FxI32 GrScreenRefresh_t;
-#define GR_REFRESH_NONE 0xff
-
-typedef FxI32 GrScreenResolution_t;
-#define GR_RESOLUTION_NONE 0xff
-
-typedef struct
-{
- GrLOD_t smallLodLog2;
- GrLOD_t largeLodLog2;
- GrAspectRatio_t aspectRatioLog2;
- GrTextureFormat_t format;
- void *data;
-}
-GrTexInfo;
-
-typedef struct GrSstPerfStats_s
-{
- FxU32 pixelsIn;
- FxU32 chromaFail;
- FxU32 zFuncFail;
- FxU32 aFuncFail;
- FxU32 pixelsOut;
-}
-GrSstPerfStats_t;
-
-typedef struct
-{
- GrScreenResolution_t resolution;
- GrScreenRefresh_t refresh;
- int numColorBuffers;
- int numAuxBuffers;
-}
-GrResolution;
-
-typedef GrResolution GlideResolution;
-#define GR_QUERY_ANY ((FxU32)(~0))
-
-typedef FxU32 GrLfbSrcFmt_t;
-#define GR_LFB_SRC_FMT_565 0x00
-#define GR_LFB_SRC_FMT_555 0x01
-#define GR_LFB_SRC_FMT_1555 0x02
-#define GR_LFB_SRC_FMT_888 0x04
-#define GR_LFB_SRC_FMT_8888 0x05
-#define GR_LFB_SRC_FMT_565_DEPTH 0x0c
-#define GR_LFB_SRC_FMT_555_DEPTH 0x0d
-#define GR_LFB_SRC_FMT_1555_DEPTH 0x0e
-#define GR_LFB_SRC_FMT_ZA16 0x0f
-#define GR_LFB_SRC_FMT_RLE16 0x80
-
-typedef FxU32 GrPixelFormat_t;
-#define GR_PIXFMT_I_8 0x0001
-#define GR_PIXFMT_AI_88 0x0002
-#define GR_PIXFMT_RGB_565 0x0003
-#define GR_PIXFMT_ARGB_1555 0x0004
-#define GR_PIXFMT_ARGB_8888 0x0005
-#define GR_PIXFMT_AA_2_RGB_565 0x0006
-#define GR_PIXFMT_AA_2_ARGB_1555 0x0007
-#define GR_PIXFMT_AA_2_ARGB_8888 0x0008
-#define GR_PIXFMT_AA_4_RGB_565 0x0009
-#define GR_PIXFMT_AA_4_ARGB_1555 0x000a
-#define GR_PIXFMT_AA_4_ARGB_8888 0x000b
-
-#define GR_LFBWRITEMODE_Z32 0x0008
-
-typedef FxU32 GrAAMode_t;
-#define GR_AA_NONE 0x0000
-#define GR_AA_4SAMPLES 0x0001
-
-typedef FxU8 GrStencil_t;
-
-typedef FxU32 GrStencilOp_t;
-#define GR_STENCILOP_KEEP 0x00
-#define GR_STENCILOP_ZERO 0x01
-#define GR_STENCILOP_REPLACE 0x02
-#define GR_STENCILOP_INCR_CLAMP 0x03
-#define GR_STENCILOP_DECR_CLAMP 0x04
-#define GR_STENCILOP_INVERT 0x05
-#define GR_STENCILOP_INCR_WRAP 0x06
-#define GR_STENCILOP_DECR_WRAP 0x07
-
-#define GR_TEXTURE_UMA_EXT 0x06
-#define GR_STENCIL_MODE_EXT 0x07
-#define GR_OPENGL_MODE_EXT 0x08
-
-typedef FxU32 GrCCUColor_t;
-typedef FxU32 GrACUColor_t;
-typedef FxU32 GrTCCUColor_t;
-typedef FxU32 GrTACUColor_t;
-#define GR_CMBX_ZERO 0x00
-#define GR_CMBX_TEXTURE_ALPHA 0x01
-#define GR_CMBX_ALOCAL 0x02
-#define GR_CMBX_AOTHER 0x03
-#define GR_CMBX_B 0x04
-#define GR_CMBX_CONSTANT_ALPHA 0x05
-#define GR_CMBX_CONSTANT_COLOR 0x06
-#define GR_CMBX_DETAIL_FACTOR 0x07
-#define GR_CMBX_ITALPHA 0x08
-#define GR_CMBX_ITRGB 0x09
-#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a
-#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b
-#define GR_CMBX_LOD_FRAC 0x0c
-#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d
-#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e
-#define GR_CMBX_TEXTURE_RGB 0x0f
-#define GR_CMBX_TMU_CALPHA 0x10
-#define GR_CMBX_TMU_CCOLOR 0x11
-
-typedef FxU32 GrCombineMode_t;
-#define GR_FUNC_MODE_ZERO 0x00
-#define GR_FUNC_MODE_X 0x01
-#define GR_FUNC_MODE_ONE_MINUS_X 0x02
-#define GR_FUNC_MODE_NEGATIVE_X 0x03
-#define GR_FUNC_MODE_X_MINUS_HALF 0x04
-
-typedef FxU32 GrAlphaBlendOp_t;
-#define GR_BLEND_OP_ADD 0x00
-#define GR_BLEND_OP_SUB 0x01
-#define GR_BLEND_OP_REVSUB 0x02
-
-typedef struct
-{
- FxU32 data[256];
-}
-GuTexPalette;
-
-typedef void (*GrErrorCallbackFnc_t) (const char *string, FxBool fatal);
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
deleted file mode 100644
index 6bbfb8d3a..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c,v 1.5 2002/12/16 16:19:00 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_state.h"
-#include "tdfx_render.h"
-#include "tdfx_texman.h"
-#include "tdfx_tris.h"
-
-
-void tdfxGetLock( tdfxContextPtr fxMesa )
-{
- __DRIcontextPrivate *cPriv = fxMesa->driContext;
- __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv;
- __DRIscreenPrivate *sPriv = dPriv->driScreenPriv;
- TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) +
- fxMesa->fxScreen->sarea_priv_offset);
- unsigned int stamp = dPriv->lastStamp;
-
- drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 );
-
- /* This macro will update dPriv's cliprects if needed */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( saPriv->fifoOwner != fxMesa->hHWContext ) {
- fxMesa->Glide.grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
- }
-
- if ( saPriv->ctxOwner != fxMesa->hHWContext ) {
- /* This sequence looks a little odd. Glide mirrors the state, and
- * when you get the state you are forcing the mirror to be up to
- * date, and then getting a copy from the mirror. You can then force
- * that state onto the hardware when you set the state.
- */
- void *state;
- FxI32 stateSize;
- fxMesa->Glide.grGet(GR_GLIDE_STATE_SIZE, 4, &stateSize);
- state = malloc(stateSize);
- fxMesa->Glide.grGlideGetState( state );
- fxMesa->Glide.grGlideSetState( state );
- free( state );
- }
-
-#if 0
- if ( saPriv->texOwner != fxMesa->hHWContext ) {
- tdfxTMRestoreTextures_NoLock( fxMesa );
- }
-#endif
-
- if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) {
- tdfxUpdateClipping(fxMesa->glCtx);
- tdfxUploadClipping(fxMesa);
- }
-
- DEBUG_LOCK();
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h
deleted file mode 100644
index 90d493762..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h,v 1.3 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_LOCK_H__
-#define __TDFX_LOCK_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-/* You can turn this on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif /* DEBUG_LOCKING */
-
-
-extern void tdfxGetLock( tdfxContextPtr fxMesa );
-
-
-/* !!! We may want to separate locks from locks with validation.
- This could be used to improve performance for those things
- commands that do not do any drawing !!! */
-
-#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \
- do { \
- DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
- if (__ret) drmGetLock(fd,context,0); \
- } while(0)
-
-#define LOCK_HARDWARE( fxMesa ) \
- do { \
- char __ret = 0; \
- \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( fxMesa->driHwLock, fxMesa->hHWContext, \
- DRM_LOCK_HELD | fxMesa->hHWContext, __ret ); \
- if ( __ret ) { \
- tdfxGetLock( fxMesa ); \
- } \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware using the global current context */
-#define UNLOCK_HARDWARE( fxMesa ) \
- do { \
- DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-/*
- * This pair of macros makes a loop over the drawing operations
- * so it is not self contained and doesn't have the nice single
- * statement semantics of most macros.
- */
-#define BEGIN_CLIP_LOOP(fxMesa) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- BEGIN_CLIP_LOOP_LOCKED( fxMesa )
-
-#define BEGIN_CLIP_LOOP_LOCKED(fxMesa) \
- do { \
- int _nc = fxMesa->numClipRects; \
- while (_nc--) { \
- if (fxMesa->numClipRects > 1) { \
- int _height = fxMesa->screen_height; \
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[_nc].x1, \
- _height - fxMesa->pClipRects[_nc].y2, \
- fxMesa->pClipRects[_nc].x2, \
- _height - fxMesa->pClipRects[_nc].y1); \
- }
-
-
-#define END_CLIP_LOOP_LOCKED( fxMesa ) \
- } \
- } while (0)
-
-#define END_CLIP_LOOP( fxMesa ) \
- END_CLIP_LOOP_LOCKED( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-
-#endif /* GLX_DIRECT_RENDERING */
-
-#endif /* __TDFX_LOCK_H__ */
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
deleted file mode 100644
index 803c8c5c1..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
+++ /dev/null
@@ -1,689 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c,v 1.4 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Nathan Hand <nhand@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_pixels.h"
-#include "tdfx_render.h"
-
-#include "swrast/swrast.h"
-
-#include "image.h"
-
-
-#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
- UNLOCK_HARDWARE(fxMesa); \
- } while(0)
-
-
-#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
- UNLOCK_HARDWARE(fxMesa); \
- } while (0);
-
-
-#if 0
-static FxBool
-FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer,
- GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
- FxBool pixelPipeline, GrLfbInfo_t * info)
-{
- FxBool result;
-
- LOCK_HARDWARE(fxMesa);
- result = fxMesa->Glide.grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
- UNLOCK_HARDWARE(fxMesa);
- return result;
-}
-#endif
-
-
-#define FX_grLfbUnlock(fxMesa, t, b) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbUnlock(t, b); \
- UNLOCK_HARDWARE(fxMesa); \
- } while (0)
-
-
-
-#if 0
-/* test if window coord (px,py) is visible */
-static GLboolean
-inClipRects(tdfxContextPtr fxMesa, int px, int py)
-{
- int i;
- for (i = 0; i < fxMesa->numClipRects; i++) {
- if ((px >= fxMesa->pClipRects[i].x1) &&
- (px < fxMesa->pClipRects[i].x2) &&
- (py >= fxMesa->pClipRects[i].y1) &&
- (py < fxMesa->pClipRects[i].y2)) return GL_TRUE;
- }
- return GL_FALSE;
-}
-#endif
-
-/* test if rectangle of pixels (px,py) (px+width,py+height) is visible */
-static GLboolean
-inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height)
-{
- int i;
- int x1, y1, x2, y2;
- int xmin, xmax, ymin, ymax, pixelsleft;
-
- y1 = y - height + 1; y2 = y;
- x1 = x; x2 = x + width - 1;
- pixelsleft = width * height;
-
- for (i = 0; i < fxMesa->numClipRects; i++)
- {
- /* algorithm requires x1 < x2 and y1 < y2 */
- if ((fxMesa->pClipRects[i].x1 < fxMesa->pClipRects[i].x2)) {
- xmin = fxMesa->pClipRects[i].x1;
- xmax = fxMesa->pClipRects[i].x2-1;
- } else {
- xmin = fxMesa->pClipRects[i].x2;
- xmax = fxMesa->pClipRects[i].x1-1;
- }
- if ((fxMesa->pClipRects[i].y1 < fxMesa->pClipRects[i].y2)) {
- ymin = fxMesa->pClipRects[i].y1;
- ymax = fxMesa->pClipRects[i].y2-1;
- } else {
- ymin = fxMesa->pClipRects[i].y2;
- ymax = fxMesa->pClipRects[i].y1-1;
- }
-
- /* reject trivial cases */
- if (xmax < x1) continue;
- if (ymax < y1) continue;
- if (xmin > x2) continue;
- if (ymin > y2) continue;
-
- /* find the intersection */
- if (xmin < x1) xmin = x1;
- if (ymin < y1) ymin = y1;
- if (xmax > x2) xmax = x2;
- if (ymax > y2) ymax = y2;
-
- pixelsleft -= (xmax-xmin+1) * (ymax-ymin+1);
- }
-
- return pixelsleft == 0;
-}
-
-#if 0
-GLboolean
-tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte * bitmap)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- TdfxU16 color;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- /* check if there's any raster operations enabled which we can't handle */
- if (ctx->RasterMask & (ALPHATEST_BIT |
- BLEND_BIT |
- DEPTH_BIT |
- FOG_BIT |
- LOGIC_OP_BIT |
- SCISSOR_BIT |
- STENCIL_BIT |
- MASKING_BIT |
- ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE;
-
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (px < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - px);
- width -= (ctx->Scissor.X - px);
- px = ctx->Scissor.X;
- }
- /* clip right */
- if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (py < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - py);
- height -= (ctx->Scissor.Y - py);
- py = ctx->Scissor.Y;
- }
- /* clip top */
- if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return GL_TRUE; /* totally scissored away */
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f);
- /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */
- if (fxMesa->bgrOrder) {
- color = (TdfxU16)
- (((TdfxU16) 0xf8 & b) << (11 - 3)) |
- (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) |
- (((TdfxU16) 0xf8 & r) >> 3);
- }
- else
- color = (TdfxU16)
- (((TdfxU16) 0xf8 & r) << (11 - 3)) |
- (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) |
- (((TdfxU16) 0xf8 & b) >> 3);
- }
-
- info.size = sizeof(info);
- if (!TDFX_grLfbLock(fxMesa,
- GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_565,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifndef TDFX_SILENT
- fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n");
-#endif
- return GL_TRUE;
- }
-
- {
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- /* The dest stride depends on the hardware and whether we're drawing
- * to the front or back buffer. This compile-time test seems to do
- * the job for now.
- */
- const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
- ? (fxMesa->screen_width) : (info.strideInBytes / 2);
- GLint row;
- /* compute dest address of bottom-left pixel in bitmap */
- GLushort *dst = (GLushort *) info.lfbPtr
- + (winY - py) * dstStride + (winX + px);
-
- for (row = 0; row < height; row++) {
- const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX,
- GL_BITMAP, 0, row, 0);
- if (finalUnpack->LsbFirst) {
- /* least significan bit first */
- GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 128U) {
- src++;
- mask = 1U;
- }
- else {
- mask = mask << 1;
- }
- }
- if (mask != 1)
- src++;
- }
- else {
- /* most significan bit first */
- GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst -= dstStride;
- }
- }
-
- TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- return GL_TRUE;
-}
-#endif
-
-#if 0
-GLboolean
-tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte * bitmap)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GLuint color;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- /* check if there's any raster operations enabled which we can't handle */
- if (ctx->RasterMask & (ALPHATEST_BIT |
- BLEND_BIT |
- DEPTH_BIT |
- FOG_BIT |
- LOGIC_OP_BIT |
- SCISSOR_BIT |
- STENCIL_BIT |
- MASKING_BIT |
- ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE;
-
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (px < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - px);
- width -= (ctx->Scissor.X - px);
- px = ctx->Scissor.X;
- }
- /* clip right */
- if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (py < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - py);
- height -= (ctx->Scissor.Y - py);
- py = ctx->Scissor.Y;
- }
- /* clip top */
- if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return GL_TRUE; /* totally scissored away */
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f);
- GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f);
- color = PACK_BGRA32(r, g, b, a);
- }
-
- info.size = sizeof(info);
- if (!TDFX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY,
- fxMesa->currentFB, GR_LFBWRITEMODE_8888,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifndef TDFX_SILENT
- fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n");
-#endif
- return GL_TRUE;
- }
-
- {
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- GLint dstStride;
- GLuint *dst;
- GLint row;
-
- if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) {
- dstStride = fxMesa->screen_width;
- dst =
- (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX +
- px);
- }
- else {
- dstStride = info.strideInBytes / 4;
- dst =
- (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX +
- px);
- }
-
- /* compute dest address of bottom-left pixel in bitmap */
- for (row = 0; row < height; row++) {
- const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX,
- GL_BITMAP, 0, row, 0);
- if (finalUnpack->LsbFirst) {
- /* least significan bit first */
- GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 128U) {
- src++;
- mask = 1U;
- }
- else {
- mask = mask << 1;
- }
- }
- if (mask != 1)
- src++;
- }
- else {
- /* most significan bit first */
- GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst -= dstStride;
- }
- }
-
- TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- return GL_TRUE;
-}
-#endif
-
-void
-tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid * dstImage)
-{
- if (format != GL_RGB ||
- type != GL_UNSIGNED_SHORT_5_6_5 ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)))
- {
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, packing,
- dstImage );
- return;
- }
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- LOCK_HARDWARE( fxMesa );
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer ==
- GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2);
- const GLushort *src = (const GLushort *) info.lfbPtr
- + scrY * srcStride + scrX;
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
- dstImage, width, height, format, type, 0, 0, 0);
- const GLint dstStride = _mesa_image_row_stride(packing,
- width, format, type);
-
- /* directly memcpy 5R6G5B pixels into client's buffer */
- const GLint widthInBytes = width * 2;
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- src -= srcStride;
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
- }
- UNLOCK_HARDWARE( fxMesa );
- return;
- }
-}
-
-void
-tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid * dstImage)
-{
- if ((!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) &&
- !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)))
- {
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, packing,
- dstImage );
- return;
- }
-
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- LOCK_HARDWARE(fxMesa);
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
- {
- const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
- ? (fxMesa->screen_width) : (info.strideInBytes / 4);
- const GLuint *src = (const GLuint *) info.lfbPtr
- + scrY * srcStride + scrX;
- const GLint dstStride =
- _mesa_image_row_stride(packing, width, format, type);
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
- dstImage, width, height, format, type, 0, 0, 0);
- const GLint widthInBytes = width * 4;
-
- {
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- src -= srcStride;
- }
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-}
-
-void
-tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ((!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) &&
- !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) ||
- ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest ||
- fxMesa->Fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GLboolean result = GL_FALSE;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- /* lock early to make sure cliprects are right */
- LOCK_HARDWARE(fxMesa);
-
- /* make sure hardware has latest blend funcs */
- if (ctx->Color.BlendEnabled) {
- fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC;
- tdfxEmitHwStateLocked( fxMesa );
- }
-
- /* look for clipmasks, giveup if region obscured */
- if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) {
- if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) {
- UNLOCK_HARDWARE(fxMesa);
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
- }
-
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->DrawBuffer,
- GR_LFBWRITEMODE_8888,
- GR_ORIGIN_UPPER_LEFT, FXTRUE, &info))
- {
- const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
- ? (fxMesa->screen_width * 4) : (info.strideInBytes);
- GLubyte *dst = (GLubyte *) info.lfbPtr
- + scrY * dstStride + scrX * 4;
- const GLint srcStride =
- _mesa_image_row_stride(unpack, width, format, type);
- const GLubyte *src = (GLubyte *) _mesa_image_address(unpack,
- pixels, width, height, format, type, 0, 0, 0);
- const GLint widthInBytes = width * 4;
-
- if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) ||
- (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) {
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst -= dstStride;
- src += srcStride;
- }
- result = GL_TRUE;
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h
deleted file mode 100644
index 93b7b8874..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h,v 1.2 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Nathan Hand <nhand@valinux.com>
- *
- */
-
-#ifndef __TDFX_PIXELS_H__
-#define __TDFX_PIXELS_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "context.h"
-
-extern void
-tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-extern void
-tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-extern void
-tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage );
-
-extern void
-tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage );
-
-extern void
-tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
deleted file mode 100644
index 1cb3eeddb..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c,v 1.4 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_render.h"
-#include "tdfx_state.h"
-#include "tdfx_texman.h"
-#include "swrast/swrast.h"
-
-/* Clear the color and/or depth buffers.
- */
-static void tdfxDDClear( GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLbitfield softwareMask = mask & (DD_ACCUM_BIT);
- const GLuint stencil_size =
- fxMesa->haveHwStencil ? fxMesa->glCtx->Visual.stencilBits : 0;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %d, %d, %d, %d )\n",
- __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
- }
-
- /* Need this check to respond to glScissor and clipping updates */
- if ((fxMesa->new_state & (TDFX_NEW_CLIP | TDFX_NEW_DEPTH)) ||
- (fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK)) {
- tdfxDDUpdateHwState(ctx);
- }
-
- /* we can't clear accum buffers */
- mask &= ~(DD_ACCUM_BIT);
-
- if (mask & DD_STENCIL_BIT) {
- if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 0xff) {
- /* Napalm seems to have trouble with stencil write masks != 0xff */
- /* do stencil clear in software */
- mask &= ~(DD_STENCIL_BIT);
- softwareMask |= DD_STENCIL_BIT;
- }
- }
-
- if (fxMesa->glCtx->Visual.redBits != 8) {
- /* can only do color masking if running in 24/32bpp on Napalm */
- if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
- ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
- softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
- }
- }
-
- if (fxMesa->haveHwStencil) {
- /*
- * If we want to clear stencil, it must be enabled
- * in the HW, even if the stencil test is not enabled
- * in the OGL state.
- */
- LOCK_HARDWARE(fxMesa);
- if (mask & DD_STENCIL_BIT) {
- fxMesa->Glide.grStencilMask(/*ctx->Stencil.WriteMask*/ 0xff);
- /* set stencil ref value = desired clear value */
- fxMesa->Glide.grStencilFunc(GR_CMP_ALWAYS,
- ctx->Stencil.Clear, 0xff);
- fxMesa->Glide.grStencilOp(GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
- fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
- }
- else {
- fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-
- /*
- * This may be ugly, but it's needed in order to work around a number
- * of Glide bugs.
- */
- BEGIN_CLIP_LOOP(fxMesa);
- {
- /*
- * This could probably be done fancier but doing each possible case
- * explicitly is less error prone.
- */
- switch (mask & ~DD_STENCIL_BIT) {
- case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
- /* back buffer & depth */
- FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0) {
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- }
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- break;
- case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
- /* XXX it appears that the depth buffer isn't cleared when
- * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
- * This is a work-around/
- */
- /* clear depth */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv_NoLock(ctx, false4);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- /* clear front */
- FX_grColorMaskv_NoLock(ctx, true4);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- break;
- case DD_BACK_LEFT_BIT:
- /* back buffer only */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case DD_FRONT_LEFT_BIT:
- /* front buffer only */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
- /* front and back */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
- /* clear front */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- /* clear back and depth */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- break;
- case DD_DEPTH_BIT:
- /* just the depth buffer */
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv_NoLock(ctx, false4);
- fxMesa->Glide.grDepthMask(FXTRUE);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (!ctx->Depth.Test || !ctx->Depth.Mask)
- fxMesa->Glide.grDepthMask(FXFALSE);
- break;
- default:
- /* clear no color buffers or depth buffer but might clear stencil */
- if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) {
- /* XXX need this RenderBuffer call to work around Glide bug */
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- fxMesa->Glide.grDepthMask(FXFALSE);
- FX_grColorMaskv_NoLock(ctx, false4);
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- }
- }
- }
- END_CLIP_LOOP(fxMesa);
-
- if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) {
- /* We changed the stencil state above. Signal that we need to
- * upload it again.
- */
- fxMesa->dirty |= TDFX_UPLOAD_STENCIL;
- }
-
- if (softwareMask)
- _swrast_Clear( ctx, softwareMask, all, x, y, width, height );
-}
-
-
-
-static void tdfxDDFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFinish();
- UNLOCK_HARDWARE( fxMesa );
-}
-
-static void tdfxDDFlush( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFlush();
- UNLOCK_HARDWARE( fxMesa );
-}
-
-
-#if 0
-static const char *texSource(int k)
-{
- switch (k) {
- case GR_CMBX_ZERO:
- return "GR_CMBX_ZERO";
- case GR_CMBX_TEXTURE_ALPHA:
- return "GR_CMBX_TEXTURE_ALPHA";
- case GR_CMBX_ALOCAL:
- return "GR_CMBX_ALOCAL";
- case GR_CMBX_AOTHER:
- return "GR_CMBX_AOTHER";
- case GR_CMBX_B:
- return "GR_CMBX_B";
- case GR_CMBX_CONSTANT_ALPHA:
- return "GR_CMBX_CONSTANT_ALPHA";
- case GR_CMBX_CONSTANT_COLOR:
- return "GR_CMBX_CONSTANT_COLOR";
- case GR_CMBX_DETAIL_FACTOR:
- return "GR_CMBX_DETAIL_FACTOR";
- case GR_CMBX_ITALPHA:
- return "GR_CMBX_ITALPHA";
- case GR_CMBX_ITRGB:
- return "GR_CMBX_ITRGB";
- case GR_CMBX_LOCAL_TEXTURE_ALPHA:
- return "GR_CMBX_LOCAL_TEXTURE_ALPHA";
- case GR_CMBX_LOCAL_TEXTURE_RGB:
- return "GR_CMBX_LOCAL_TEXTURE_RGB";
- case GR_CMBX_LOD_FRAC:
- return "GR_CMBX_LOD_FRAC";
- case GR_CMBX_OTHER_TEXTURE_ALPHA:
- return "GR_CMBX_OTHER_TEXTURE_ALPHA";
- case GR_CMBX_OTHER_TEXTURE_RGB:
- return "GR_CMBX_OTHER_TEXTURE_RGB";
- case GR_CMBX_TEXTURE_RGB:
- return "GR_CMBX_TEXTURE_RGB";
- case GR_CMBX_TMU_CALPHA:
- return "GR_CMBX_TMU_CALPHA";
- case GR_CMBX_TMU_CCOLOR:
- return "GR_CMBX_TMU_CCOLOR";
- default:
- return "";
- }
-}
-#endif
-
-#if 0
-static const char *texMode(int k)
-{
- switch (k) {
- case GR_FUNC_MODE_ZERO:
- return "GR_FUNC_MODE_ZERO";
- case GR_FUNC_MODE_X:
- return "GR_FUNC_MODE_X";
- case GR_FUNC_MODE_ONE_MINUS_X:
- return "GR_FUNC_MODE_ONE_MINUS_X";
- case GR_FUNC_MODE_NEGATIVE_X:
- return "GR_FUNC_MODE_NEGATIVE_X";
- case GR_FUNC_MODE_X_MINUS_HALF:
- return "GR_FUNC_MODE_X_MINUS_HALF";
- default:
- return "";
- }
-}
-#endif
-
-#if 0
-static const char *texInvert(int k)
-{
- return k ? "FXTRUE" : "FXFALSE";
-}
-#endif
-
-static void uploadTextureEnv( tdfxContextPtr fxMesa )
-{
- if (TDFX_IS_NAPALM(fxMesa)) {
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
-#if 0
- printf("upload env %d\n", unit);
- printf(" cSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceA));
- printf(" cModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeA));
- printf(" cSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceB));
- printf(" cModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeB));
- printf(" cSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceC));
- printf(" cInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertC));
- printf(" cSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceD));
- printf(" cInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertD));
- printf(" cShift = %d\t", fxMesa->TexCombineExt[unit].Color.Shift);
- printf(" cInvert = %d\n", fxMesa->TexCombineExt[unit].Color.Invert);
- printf(" aSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceA));
- printf(" aModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeA));
- printf(" aSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceB));
- printf(" aModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeB));
- printf(" aSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceC));
- printf(" aInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertC));
- printf(" aSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceD));
- printf(" aInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertD));
- printf(" aShift = %d\t", fxMesa->TexCombineExt[unit].Alpha.Shift);
- printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert);
- printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor);
-#endif
- fxMesa->Glide.grTexColorCombineExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].Color.SourceA,
- fxMesa->TexCombineExt[unit].Color.ModeA,
- fxMesa->TexCombineExt[unit].Color.SourceB,
- fxMesa->TexCombineExt[unit].Color.ModeB,
- fxMesa->TexCombineExt[unit].Color.SourceC,
- fxMesa->TexCombineExt[unit].Color.InvertC,
- fxMesa->TexCombineExt[unit].Color.SourceD,
- fxMesa->TexCombineExt[unit].Color.InvertD,
- fxMesa->TexCombineExt[unit].Color.Shift,
- fxMesa->TexCombineExt[unit].Color.Invert);
- fxMesa->Glide.grTexAlphaCombineExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].Alpha.SourceA,
- fxMesa->TexCombineExt[unit].Alpha.ModeA,
- fxMesa->TexCombineExt[unit].Alpha.SourceB,
- fxMesa->TexCombineExt[unit].Alpha.ModeB,
- fxMesa->TexCombineExt[unit].Alpha.SourceC,
- fxMesa->TexCombineExt[unit].Alpha.InvertC,
- fxMesa->TexCombineExt[unit].Alpha.SourceD,
- fxMesa->TexCombineExt[unit].Alpha.InvertD,
- fxMesa->TexCombineExt[unit].Alpha.Shift,
- fxMesa->TexCombineExt[unit].Alpha.Invert);
- fxMesa->Glide.grConstantColorValueExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].EnvColor);
- }
- }
- else {
- /* Voodoo3 */
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit];
- fxMesa->Glide.grTexCombine(TDFX_TMU0 + unit,
- comb->FunctionRGB,
- comb->FactorRGB,
- comb->FunctionAlpha,
- comb->FactorAlpha,
- comb->InvertRGB,
- comb->InvertAlpha);
- }
- }
-}
-
-
-static void uploadTextureParams( tdfxContextPtr fxMesa )
-{
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- const struct tdfx_texparams *p = &fxMesa->TexParams[unit];
- /*
- printf("upload params %d\n", unit);
- printf(" clamp %x %x\n", env->sClamp, env->tClamp);
- printf(" filter %x %x\n", env->minFilt, env->magFilt);
- printf(" mipmap %x %x\n", env->mmMode, env->LODblend);
- printf(" lod bias %f\n", env->LodBias);
- */
- fxMesa->Glide.grTexClampMode(GR_TMU0 + unit, p->sClamp, p->tClamp);
- fxMesa->Glide.grTexFilterMode(GR_TMU0 + unit, p->minFilt, p->magFilt);
- fxMesa->Glide.grTexMipMapMode(GR_TMU0 + unit, p->mmMode, p->LODblend);
- fxMesa->Glide.grTexLodBiasValue(GR_TMU0 + unit, p->LodBias);
- }
-}
-
-
-static void uploadTextureSource( tdfxContextPtr fxMesa )
-{
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- const struct tdfx_texsource *src = &fxMesa->TexSource[unit];
- /*
- printf("upload source %d @ %d %p\n", unit, src->StartAddress, src->Info);
- */
- if (src->Info) {
- /*
- printf(" smallLodLog2=%d largeLodLog2=%d ar=%d format=%d data=%p\n",
- src->Info->smallLodLog2, src->Info->largeLodLog2,
- src->Info->aspectRatioLog2, src->Info->format,
- src->Info->data);
- */
- fxMesa->Glide.grTexSource(GR_TMU0 + unit,
- src->StartAddress,
- src->EvenOdd,
- src->Info);
- }
- }
-}
-
-
-static void uploadTextureImages( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled == TEXTURE_2D_BIT) {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit].Current2D;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- if (ti && ti->reloadImages && ti->whichTMU != TDFX_TMU_NONE) {
- /*
- printf("download texture image on unit %d\n", unit);
- */
- tdfxTMDownloadTexture(fxMesa, tObj);
- ti->reloadImages = GL_FALSE;
- }
- }
- }
-}
-
-
-
-/*
- * If scissoring is enabled, compute intersection of scissor region
- * with all X clip rects, resulting in new cliprect list.
- * If number of cliprects is zero or one, call grClipWindow to setup
- * the clip region. Otherwise we'll call grClipWindow inside the
- * BEGIN_CLIP_LOOP macro.
- */
-void tdfxUploadClipping( tdfxContextPtr fxMesa )
-{
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable;
-
- assert(dPriv);
-
- if (fxMesa->numClipRects == 0) {
- /* all drawing clipped away */
- fxMesa->Glide.grClipWindow(0, 0, 0, 0);
- }
- else if (fxMesa->numClipRects == 1) {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[0].x1,
- fxMesa->screen_height - fxMesa->pClipRects[0].y2,
- fxMesa->pClipRects[0].x2,
- fxMesa->screen_height - fxMesa->pClipRects[0].y1);
- }
- /* else, we'll do a cliprect loop around all drawing */
-
- fxMesa->Glide.grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
-}
-
-
-void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
-{
- if ( !fxMesa->dirty )
- return;
-
- if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) {
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->Glide.grColorCombineExt(fxMesa->ColorCombineExt.SourceA,
- fxMesa->ColorCombineExt.ModeA,
- fxMesa->ColorCombineExt.SourceB,
- fxMesa->ColorCombineExt.ModeB,
- fxMesa->ColorCombineExt.SourceC,
- fxMesa->ColorCombineExt.InvertC,
- fxMesa->ColorCombineExt.SourceD,
- fxMesa->ColorCombineExt.InvertD,
- fxMesa->ColorCombineExt.Shift,
- fxMesa->ColorCombineExt.Invert);
- }
- else {
- /* Voodoo 3 */
- fxMesa->Glide.grColorCombine( fxMesa->ColorCombine.Function,
- fxMesa->ColorCombine.Factor,
- fxMesa->ColorCombine.Local,
- fxMesa->ColorCombine.Other,
- fxMesa->ColorCombine.Invert );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) {
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->Glide.grAlphaCombineExt(fxMesa->AlphaCombineExt.SourceA,
- fxMesa->AlphaCombineExt.ModeA,
- fxMesa->AlphaCombineExt.SourceB,
- fxMesa->AlphaCombineExt.ModeB,
- fxMesa->AlphaCombineExt.SourceC,
- fxMesa->AlphaCombineExt.InvertC,
- fxMesa->AlphaCombineExt.SourceD,
- fxMesa->AlphaCombineExt.InvertD,
- fxMesa->AlphaCombineExt.Shift,
- fxMesa->AlphaCombineExt.Invert);
- }
- else {
- /* Voodoo 3 */
- fxMesa->Glide.grAlphaCombine( fxMesa->AlphaCombine.Function,
- fxMesa->AlphaCombine.Factor,
- fxMesa->AlphaCombine.Local,
- fxMesa->AlphaCombine.Other,
- fxMesa->AlphaCombine.Invert );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) {
- fxMesa->Glide.grRenderBuffer( fxMesa->DrawBuffer );
- fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) {
- fxMesa->Glide.grStipplePattern( fxMesa->Stipple.Pattern );
- fxMesa->Glide.grStippleMode( fxMesa->Stipple.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) {
- fxMesa->Glide.grAlphaTestFunction( fxMesa->Color.AlphaFunc );
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) {
- fxMesa->Glide.grAlphaTestReferenceValue( fxMesa->Color.AlphaRef );
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) {
- if (fxMesa->Glide.grAlphaBlendFunctionExt) {
- fxMesa->Glide.grAlphaBlendFunctionExt( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- GR_BLEND_OP_ADD,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA,
- GR_BLEND_OP_ADD );
- }
- else {
- fxMesa->Glide.grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) {
- fxMesa->Glide.grDepthBufferMode( fxMesa->Depth.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) {
- fxMesa->Glide.grDepthBiasLevel( fxMesa->Depth.Bias );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) {
- fxMesa->Glide.grDepthBufferFunction( fxMesa->Depth.Func );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) {
- fxMesa->Glide.grDepthMask( fxMesa->Depth.Mask );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) {
- fxMesa->Glide.grDitherMode( fxMesa->Color.Dither );
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) {
- fxMesa->Glide.grFogMode( fxMesa->Fog.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) {
- fxMesa->Glide.grFogColorValue( fxMesa->Fog.Color );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) {
- fxMesa->Glide.grFogTable( fxMesa->Fog.Table );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- fxMesa->Glide.grCullMode( fxMesa->CullMode );
- fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_CLIP ) {
- tdfxUploadClipping( fxMesa );
- fxMesa->dirty &= ~TDFX_UPLOAD_CLIP;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) {
- if ( fxMesa->Glide.grColorMaskExt
- && fxMesa->glCtx->Visual.redBits == 8) {
- fxMesa->Glide.grColorMaskExt( fxMesa->Color.ColorMask[RCOMP],
- fxMesa->Color.ColorMask[GCOMP],
- fxMesa->Color.ColorMask[BCOMP],
- fxMesa->Color.ColorMask[ACOMP] );
- } else {
- fxMesa->Glide.grColorMask( fxMesa->Color.ColorMask[RCOMP] ||
- fxMesa->Color.ColorMask[GCOMP] ||
- fxMesa->Color.ColorMask[BCOMP],
- fxMesa->Color.ColorMask[ACOMP] );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK;
- }
-
-/* if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) { */
-/* grConstantColorValue( fxMesa->Color.MonoColor ); */
-/* fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR; */
-/* } */
-
- if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) {
- if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0)
- fxMesa->Glide.grEnable(GR_AA_ORDERED);
- else
- fxMesa->Glide.grDisable(GR_AA_ORDERED);
- fxMesa->dirty &= ~TDFX_UPLOAD_LINE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) {
- if (fxMesa->glCtx->Stencil.Enabled) {
- fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
- fxMesa->Glide.grStencilOp(fxMesa->Stencil.FailFunc,
- fxMesa->Stencil.ZFailFunc,
- fxMesa->Stencil.ZPassFunc);
- fxMesa->Glide.grStencilFunc(fxMesa->Stencil.Function,
- fxMesa->Stencil.RefValue,
- fxMesa->Stencil.ValueMask);
- fxMesa->Glide.grStencilMask(fxMesa->Stencil.WriteMask);
- }
- else {
- fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) {
- fxMesa->Glide.grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
- fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_ENV ) {
- uploadTextureEnv(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_ENV;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PARAMS ) {
- uploadTextureParams(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) {
- if (fxMesa->TexPalette.Data) {
- fxMesa->Glide.grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data);
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_SOURCE ) {
- uploadTextureSource(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_SOURCE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_IMAGES ) {
- uploadTextureImages(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_IMAGES;
- }
-
- fxMesa->dirty = 0;
-}
-
-
-
-void tdfxDDInitRenderFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = tdfxDDClear;
- ctx->Driver.Finish = tdfxDDFinish;
- ctx->Driver.Flush = tdfxDDFlush;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h
deleted file mode 100644
index 146120bc0..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_RENDER_H__
-#define __TDFX_RENDER_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "tdfx_context.h"
-
-extern void tdfxDDInitRenderFuncs( GLcontext *ctx );
-
-extern void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa );
-
-extern void tdfxUploadClipping( tdfxContextPtr fxMesa );
-
-#define FLUSH_BATCH( fxMesa )
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
deleted file mode 100644
index 480dc8064..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c,v 1.3 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "tdfx_dri.h"
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_tris.h"
-
-
-#ifdef DEBUG_LOCKING
-char *prevLockFile = 0;
-int prevLockLine = 0;
-#endif
-
-#ifndef TDFX_DEBUG
-int TDFX_DEBUG = (0
-/* | DEBUG_ALWAYS_SYNC */
-/* | DEBUG_VERBOSE_API */
-/* | DEBUG_VERBOSE_MSG */
-/* | DEBUG_VERBOSE_LRU */
-/* | DEBUG_VERBOSE_DRI */
-/* | DEBUG_VERBOSE_IOCTL */
-/* | DEBUG_VERBOSE_2D */
- );
-#endif
-
-
-
-static GLboolean
-tdfxCreateScreen( __DRIscreenPrivate *sPriv )
-{
- tdfxScreenPrivate *fxScreen;
- TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
-
- /* Allocate the private area */
- fxScreen = (tdfxScreenPrivate *) Xmalloc( sizeof(tdfxScreenPrivate) );
- if ( !fxScreen )
- return GL_FALSE;
-
- fxScreen->driScrnPriv = sPriv;
- sPriv->private = (void *) fxScreen;
-
- fxScreen->regs.handle = fxDRIPriv->regs;
- fxScreen->regs.size = fxDRIPriv->regsSize;
- fxScreen->deviceID = fxDRIPriv->deviceID;
- fxScreen->width = fxDRIPriv->width;
- fxScreen->height = fxDRIPriv->height;
- fxScreen->mem = fxDRIPriv->mem;
- fxScreen->cpp = fxDRIPriv->cpp;
- fxScreen->stride = fxDRIPriv->stride;
- fxScreen->fifoOffset = fxDRIPriv->fifoOffset;
- fxScreen->fifoSize = fxDRIPriv->fifoSize;
- fxScreen->fbOffset = fxDRIPriv->fbOffset;
- fxScreen->backOffset = fxDRIPriv->backOffset;
- fxScreen->depthOffset = fxDRIPriv->depthOffset;
- fxScreen->textureOffset = fxDRIPriv->textureOffset;
- fxScreen->textureSize = fxDRIPriv->textureSize;
- fxScreen->sarea_priv_offset = fxDRIPriv->sarea_priv_offset;
-
- if ( drmMap( sPriv->fd, fxScreen->regs.handle,
- fxScreen->regs.size, &fxScreen->regs.map ) ) {
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static void
-tdfxDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
-
- if ( fxScreen ) {
- drmUnmap( fxScreen->regs.map, fxScreen->regs.size );
-
- Xfree( fxScreen );
- sPriv->private = NULL;
- }
-}
-
-
-static GLboolean
-tdfxInitDriver( __DRIscreenPrivate *sPriv )
-{
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv );
- }
-
- /* Check the DRI externsion version */
- if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
- __driUtilMessage( "tdfx DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
- return GL_FALSE;
- }
-
- /* Check that the DDX driver version is compatible */
- if ( sPriv->ddxMajor != 1 ||
- sPriv->ddxMinor < 0 ) {
- __driUtilMessage(
- "3dfx DRI driver expected DDX driver version 1.0.x "
- "but got version %d.%d.%d",
- sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch );
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if ( sPriv->drmMajor != 1 ||
- sPriv->drmMinor < 0 ) {
- __driUtilMessage(
- "3dfx DRI driver expected DRM driver version 1.0.x "
- "but got version %d.%d.%d",
- sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch );
- return GL_FALSE;
- }
-
- if ( !tdfxCreateScreen( sPriv ) ) {
- tdfxDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* software alpha channel? */ );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-static void
-tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
-
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = 0;
- GLframebuffer *mesaBuffer;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, driDrawPriv );
- }
-
- mesaBuffer = (GLframebuffer *) driDrawPriv->driverPrivate;
- if ( !mesaBuffer->Visual.doubleBufferMode )
- return; /* can't swap a single-buffered window */
-
- /* If the current context's drawable matches the given drawable
- * we have to do a glFinish (per the GLX spec).
- */
- if ( ctx ) {
- __DRIdrawablePrivate *curDrawPriv;
- fxMesa = TDFX_CONTEXT(ctx);
- curDrawPriv = fxMesa->driContext->driDrawablePriv;
-
- if ( curDrawPriv == driDrawPriv ) {
- /* swapping window bound to current context, flush first */
- _mesa_notifySwapBuffers( ctx );
- LOCK_HARDWARE( fxMesa );
- }
- else {
- /* find the fxMesa context previously bound to the window */
- fxMesa = (tdfxContextPtr) driDrawPriv->driContextPriv->driverPrivate;
- if (!fxMesa)
- return;
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
- printf("SwapBuf SetState 1\n");
- fxMesa->Glide.grGlideSetState(fxMesa->Glide.State );
- }
- }
-
-#ifdef STATS
- {
- int stalls;
- static int prevStalls = 0;
-
- stalls = fxMesa->Glide.grFifoGetStalls();
-
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- if ( stalls != prevStalls ) {
- fprintf( stderr, " %d stalls occurred\n",
- stalls - prevStalls );
- prevStalls = stalls;
- }
- if ( fxMesa && fxMesa->texSwaps ) {
- fprintf( stderr, " %d texture swaps occurred\n",
- fxMesa->texSwaps );
- fxMesa->texSwaps = 0;
- }
- }
-#endif
-
- if (fxMesa->scissoredClipRects) {
- /* restore clip rects without scissor box */
- fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- driDrawPriv->numClipRects,
- driDrawPriv->pClipRects );
- }
-
- fxMesa->Glide.grDRIBufferSwap( fxMesa->Glide.SwapInterval );
-
- if (fxMesa->scissoredClipRects) {
- /* restore clip rects WITH scissor box */
- fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
- }
-
-
-#if 0
- {
- FxI32 result;
- do {
- FxI32 result;
- fxMesa->Glide.grGet(GR_PENDING_BUFFERSWAPS, 4, &result);
- } while ( result > fxMesa->maxPendingSwapBuffers );
- }
-#endif
-
- fxMesa->stats.swapBuffer++;
-
- if (ctx) {
- if (ctx->DriverCtx != fxMesa) {
- fxMesa = TDFX_CONTEXT(ctx);
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
- printf("SwapBuf SetState 2\n");
- fxMesa->Glide.grGlideSetState(fxMesa->Glide.State );
- }
- UNLOCK_HARDWARE( fxMesa );
- }
-}
-
-
-static GLboolean
-tdfxOpenCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-
-static const struct __DriverAPIRec tdfxAPI = {
- .InitDriver = tdfxInitDriver,
- .DestroyScreen = tdfxDestroyScreen,
- .CreateContext = tdfxCreateContext,
- .DestroyContext = tdfxDestroyContext,
- .CreateBuffer = tdfxCreateBuffer,
- .DestroyBuffer = tdfxDestroyBuffer,
- .SwapBuffers = tdfxSwapBuffers,
- .MakeCurrent = tdfxMakeCurrent,
- .UnbindContext = tdfxUnbindContext,
- .OpenFullScreen = tdfxOpenCloseFullScreen,
- .CloseFullScreen = tdfxOpenCloseFullScreen,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &tdfxAPI);
- return (void *) psp;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h
deleted file mode 100644
index 2a79c88b0..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h,v 1.2 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_SCREEN_H__
-#define __TDFX_SCREEN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-typedef struct {
- drmHandle handle;
- drmSize size;
- drmAddress map;
-} tdfxRegion, *tdfxRegionPtr;
-
-typedef struct {
- tdfxRegion regs;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int stride;
-
- int fifoOffset;
- int fifoSize;
-
- int fbOffset;
- int backOffset;
- int depthOffset;
- int textureOffset;
- int textureSize;
-
- __DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
-} tdfxScreenPrivate;
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
deleted file mode 100644
index d94ef699e..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
+++ /dev/null
@@ -1,1399 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c,v 1.7 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_span.h"
-#include "tdfx_render.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-
-#define LOCAL_VARS \
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \
- tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \
- GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) \
- ? (fxMesa->screen_width * BYTESPERPIXEL) : \
- (info.strideInBytes); \
- GLuint height = fxMesa->height; \
- char *buf = (char *)((char *)info.lfbPtr + \
- dPriv->x * fxPriv->cpp + \
- dPriv->y * pitch); \
- GLuint p; \
- (void) buf; (void) p;
-
-
-#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \
- _y >= miny && _y < maxy )
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-
-#define HW_WRITE_LOCK() \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- FLUSH_BATCH( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- LOCK_HARDWARE( fxMesa ); \
- info.size = sizeof(GrLfbInfo_t); \
- if ( fxMesa->Glide.grLfbLock( GR_LFB_WRITE_ONLY, \
- fxMesa->DrawBuffer, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
- {
-
-#define HW_WRITE_UNLOCK() \
- fxMesa->Glide.grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer );\
- }
-
-
-#define HW_READ_LOCK() \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- FLUSH_BATCH( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- LOCK_HARDWARE( fxMesa ); \
- info.size = sizeof(GrLfbInfo_t); \
- if ( fxMesa->Glide.grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, \
- LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
- {
-
-#define HW_READ_UNLOCK() \
- fxMesa->Glide.grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer );\
- }
-
-
-#define HW_WRITE_CLIPLOOP() \
- do { \
- int _nc = fxMesa->numClipRects; \
- while (_nc--) { \
- int minx = fxMesa->pClipRects[_nc].x1 - fxMesa->x_offset; \
- int miny = fxMesa->pClipRects[_nc].y1 - fxMesa->y_offset; \
- int maxx = fxMesa->pClipRects[_nc].x2 - fxMesa->x_offset; \
- int maxy = fxMesa->pClipRects[_nc].y2 - fxMesa->y_offset;
-
-#define HW_READ_CLIPLOOP() \
- do { \
- const __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \
- XF86DRIClipRectPtr rect = dPriv->pClipRects; \
- int _nc = dPriv->numClipRects; \
- while (_nc--) { \
- const int minx = rect->x1 - fxMesa->x_offset; \
- const int miny = rect->y1 - fxMesa->y_offset; \
- const int maxx = rect->x2 - fxMesa->x_offset; \
- const int maxy = rect->y2 - fxMesa->y_offset; \
- rect++;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-
-
-#define LFB_MODE GR_LFBWRITEMODE_565
-
-
-/* 16 bit, RGB565 color spanline and pixel functions */ \
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR565( color[0], color[1], color[2] )
-
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_RGB565
-#define BYTESPERPIXEL 2
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-/* 16 bit, BGR565 color spanline and pixel functions */ \
-#if 0
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)b & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)r & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
- rgba[0] = (p << 3) & 0xf8; \
- rgba[1] = (p >> 3) & 0xfc; \
- rgba[2] = (p >> 8) & 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_BGR565
-#define BYTESPERPIXEL 2
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-#endif
-
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_888
-
-
-/* 24 bit, RGB888 color spanline and pixel functions */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR888( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(buf + _x*3 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
-} while (0)
-
-#define TAG(x) tdfx##x##_RGB888
-#define BYTESPERPIXEL 4
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_8888
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR8888( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) tdfx##x##_ARGB8888
-#define BYTESPERPIXEL 4
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-
-/* ================================================================
- * Old span functions below...
- */
-
-
-/*
- * Examine the cliprects to generate an array of flags to indicate
- * which pixels in a span are visible. Note: (x,y) is a screen
- * coordinate.
- */
-static void
-generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n,
- GLubyte vismask[])
-{
- GLboolean initialized = GL_FALSE;
- GLint i, j;
-
- /* Ensure we clear the visual mask */
- MEMSET(vismask, 0, n);
-
- /* turn on flags for all visible pixels */
- for (i = 0; i < fxMesa->numClipRects; i++) {
- const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i];
-
- if (y >= rect->y1 && y < rect->y2) {
- if (x >= rect->x1 && x + n <= rect->x2) {
- /* common case, whole span inside cliprect */
- MEMSET(vismask, 1, n);
- return;
- }
- if (x < rect->x2 && x + n >= rect->x1) {
- /* some of the span is inside the rect */
- GLint start, end;
- if (!initialized) {
- MEMSET(vismask, 0, n);
- initialized = GL_TRUE;
- }
- if (x < rect->x1)
- start = rect->x1 - x;
- else
- start = 0;
- if (x + n > rect->x2)
- end = rect->x2 - x;
- else
- end = n;
- assert(start >= 0);
- assert(end <= n);
- for (j = start; j < end; j++)
- vismask[j] = 1;
- }
- }
- }
-}
-
-/*
- * Examine cliprects and determine if the given screen pixel is visible.
- */
-static GLboolean
-visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
-{
- int i;
- for (i = 0; i < fxMesa->numClipRects; i++) {
- const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i];
- if (scrX >= rect->x1 &&
- scrX < rect->x2 &&
- scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-
-/*
- * Depth buffer read/write functions.
- */
-/*
- * To read the frame buffer, we need to lock and unlock it. The
- * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK}
- * do this for us.
- *
- * Note that the lock must be matched with an unlock. These
- * macros include a spare curly brace, so they must
- * be syntactically matched.
- *
- * Note, also, that you can't lock a buffer twice with different
- * modes. That is to say, you can't lock a buffer in both read
- * and write modes. The strideInBytes and LFB pointer will be
- * the same with read and write locks, so you can use either.
- * o The HW has different state for reads and writes, so
- * locking it twice may give screwy results.
- * o The DRM won't let you lock twice. It hangs. This is probably
- * because of the LOCK_HARDWARE IN THE *_FB_SPAN_LOCK macros,
- * and could be eliminated with nonlocking lock routines. But
- * what's the point after all.
- */
-#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
- (info).size=sizeof(info); \
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY, \
- target_buffer, \
- GR_LFBWRITEMODE_ANY, \
- GR_ORIGIN_UPPER_LEFT, \
- FXFALSE, \
- &(info))) {
-
-#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \
- } else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \
- (target_buffer == GR_BUFFER_BACKBUFFER) \
- ? "back buffer" \
- : ((target_buffer == GR_BUFFER_AUXBUFFER) \
- ? "depth buffer" \
- : "unknown buffer"), \
- target_buffer); \
- }
-
-#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
- info.size=sizeof(info); \
- if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY, \
- target_buffer, \
- write_mode, \
- GR_ORIGIN_UPPER_LEFT, \
- FXFALSE, \
- &info)) {
-
-#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \
- } else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \
- (target_buffer == GR_BUFFER_BACKBUFFER) \
- ? "back buffer" \
- : ((target_buffer == GR_BUFFER_AUXBUFFER) \
- ? "depth buffer" \
- : "unknown buffer"), \
- target_buffer); \
- }
-
-/*
- * Because the Linear Frame Buffer is not necessarily aligned
- * with the depth buffer, we have to do some fiddling
- * around to get the right addresses.
- *
- * Perhaps a picture is in order. The Linear Frame Buffer
- * looks like this:
- *
- * |<----------------------info.strideInBytes------------->|
- * |<-----physicalStrideInBytes------->|
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * | | |
- * | Legal Memory | Forbidden Zone |
- * | | |
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- *
- * You can only reliably read and write legal locations. Reads
- * and writes from the Forbidden Zone will return undefined values,
- * and may cause segmentation faults.
- *
- * Now, the depth buffer may not end up in a location such each
- * scan line is an LFB line. For example, the depth buffer may
- * look like this:
- *
- * wrapped ordinary.
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * |0000000000000000000000 | | back
- * |1111111111111111111111 | | buffer
- * |2222222222222222222222 | |
- * |4096b align. padxx00000000000000000| Forbidden Zone | depth
- * |0000 11111111111111111| | buffer
- * |1111 22222222222222222| |
- * |2222 | |
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * where each number is the scan line number. We know it will
- * be aligned on 128 byte boundaries, at least. Aligning this
- * on a scanline boundary causes the back and depth buffers to
- * thrash in the SST1 cache. (Note that the back buffer is always
- * allocated at the beginning of LFB memory, and so it is always
- * properly aligned with the LFB stride.)
- *
- * We call the beginning of the line (which is the rightmost
- * part of the depth line in the picture above) the *ordinary* part
- * of the scanline, and the end of the line (which is the
- * leftmost part, one line below) the *wrapped* part of the scanline.
- * a.) We need to know what x value to subtract from the screen
- * x coordinate to index into the wrapped part.
- * b.) We also need to figure out if we need to read from the ordinary
- * part scan line, or from the wrapped part of the scan line.
- *
- * [ad a]
- * The first wrapped x coordinate is that coordinate such that
- * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*}
- * > physicalStrideInBytes
- * where depthBufferOffset is the LFB distance in bytes
- * from the back buffer to the depth buffer. The expression
- * depthBufferOffset&(info.strideInBytes)
- * is then the offset (in bytes) from the beginining of (any)
- * depth buffer line to first element in the line.
- * Simplifying inequation {*} above we see that x is the smallest
- * value such that
- * x*elementSize > physicalStrideInBytes {**}
- * - depthBufferOffset&(info.strideInBytes)
- * Now, we know that both the summands on the right are multiples of
- * 128, and elementSize <= 4, so if equality holds in {**}, x would
- * be a multiple of 32. Thus we can set x to
- * xwrapped = (physicalStrideInBytes
- * - depthBufferOffset&(info.strideInBytes))/elementSize
- * + 1
- *
- * [ad b]
- * Question b is now simple. We read from the wrapped scan line if
- * x is greater than xwrapped.
- */
-#define TILE_WIDTH_IN_BYTES 128
-#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz))
-#define TILE_HEIGHT_IN_LINES 32
-typedef struct
-{
- void *lfbPtr;
- void *lfbWrapPtr;
- FxU32 LFBStrideInElts;
- GLint firstWrappedX;
-}
-LFBParameters;
-
-/*
- * We need information about the back buffer. Note that
- * this function *cannot be called* while the aux buffer
- * is locked, or the caller will hang.
- *
- * Only Glide knows the LFB address of the back and depth
- * offsets. The upper levels of Mesa know the depth offset,
- * but that is not in LFB space, it is tiled memory space,
- * and is not useable for us.
- */
-static void
-GetBackBufferInfo(tdfxContextPtr fxMesa, GrLfbInfo_t * backBufferInfo)
-{
- READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER);
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER);
-}
-
-static void
-GetFbParams(tdfxContextPtr fxMesa,
- GrLfbInfo_t * info,
- GrLfbInfo_t * backBufferInfo,
- LFBParameters * ReadParamsp, FxU32 elementSize)
-{
- FxU32 physicalStrideInBytes, bufferOffset;
- FxU32 strideInBytes = info->strideInBytes;
- char *lfbPtr = (char *) (info->lfbPtr); /* For arithmetic, use char * */
-
- /*
- * These two come directly from the info structure.
- */
- ReadParamsp->lfbPtr = (void *) lfbPtr;
- ReadParamsp->LFBStrideInElts = strideInBytes / elementSize;
- /*
- * Now, calculate the value of firstWrappedX.
- *
- * The physical stride is the screen width in bytes rounded up to
- * the next highest multiple of 128 bytes. Note that this fails
- * when TILE_WIDTH_IN_BYTES is not a power of two.
- *
- * The buffer Offset is the distance between the beginning of
- * the LFB space, which is the beginning of the back buffer,
- * and the buffer we are gathering information about.
- * We want to make this routine usable for operations on the
- * back buffer, though we don't actually use it on the back
- * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX
- * is in the forbidden zone, and is therefore never reached.
- *
- * Note that if
- * physicalStrideInBytes
- * < bufferOffset&(info->strideInBytes-1)
- * the buffer begins in the forbidden zone. We assert for this.
- */
- bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr);
- physicalStrideInBytes
- = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1)
- & ~(TILE_WIDTH_IN_BYTES - 1);
- assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1)));
- ReadParamsp->firstWrappedX
- = (physicalStrideInBytes
- - (bufferOffset & (strideInBytes - 1))) / elementSize;
- /*
- * This is the address of the next physical line.
- */
- ReadParamsp->lfbWrapPtr
- = (void *) ((char *) backBufferInfo->lfbPtr
- + (bufferOffset & ~(strideInBytes - 1))
- + (TILE_HEIGHT_IN_LINES) * strideInBytes);
-}
-
-/*
- * These macros fetch data from the frame buffer. The type is
- * the type of data we want to fetch. It should match the type
- * whose size was used with GetFbParams to fill in the structure
- * in *ReadParamsp. We have a macro to read the ordinary
- * part, a second macro to read the wrapped part, and one which
- * will do either. When we are reading a span, we will know
- * when the ordinary part ends, so there's no need to test for
- * it. However, when reading and writing pixels, we don't
- * necessarily know. I suppose it's a matter of taste whether
- * it's better in the macro or in the call.
- *
- * Recall that x and y are screen coordinates.
- */
-#define GET_FB_DATA(ReadParamsp, type, x, y) \
- (((x) < (ReadParamsp)->firstWrappedX) \
- ? (((type *)((ReadParamsp)->lfbPtr)) \
- [(y) * ((ReadParamsp)->LFBStrideInElts) \
- + (x)]) \
- : (((type *)((ReadParamsp)->lfbWrapPtr)) \
- [((y)) * ((ReadParamsp)->LFBStrideInElts) \
- + ((x) - (ReadParamsp)->firstWrappedX)]))
-#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \
- (((type *)((ReadParamsp)->lfbPtr)) \
- [(y) * ((ReadParamsp)->LFBStrideInElts) \
- + (x)])
-#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \
- (((type *)((ReadParamsp)->lfbWrapPtr)) \
- [((y)) * ((ReadParamsp)->LFBStrideInElts) \
- + ((x) - (ReadParamsp)->firstWrappedX)])
-#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \
- (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \
- (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \
- (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-
-static void
-tdfxDDWriteDepthSpan(GLcontext * ctx,
- GLuint n, GLint x, GLint y, const GLdepth depth[],
- const GLubyte mask[])
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->y_offset + fxMesa->height - 1;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GrLfbInfo_t info;
- GLubyte visMask[MAX_WIDTH];
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthSpan(...)\n");
- }
-
- assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32));
- /*
- * Convert x and y to screen coordinates.
- */
- x += fxMesa->x_offset;
- y = bottom - y;
- if (mask) {
- GLint i;
- GLushort d16;
- GrLfbInfo_t backBufferInfo;
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER,
- GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- int wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (mask[i] && visMask[i]) {
- d16 = depth[i];
- PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16);
- }
- }
- for (; i < n; i++) {
- if (mask[i] && visMask[i]) {
- d16 = depth[i];
- PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER,
- GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- int wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- GLuint d32;
- if (mask[i] && visMask[i]) {
- if (stencil_size > 0) {
- d32 =
- GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- for (; i < n; i++) {
- GLuint d32;
- if (mask[i] && visMask[i]) {
- if (stencil_size > 0) {
- d32 =
- GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
- else {
- GLint i;
- GLuint d32;
- GLushort d16;
- GrLfbInfo_t backBufferInfo;
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- GLuint wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i]) {
- d16 = depth[i];
- PUT_ORDINARY_FB_DATA(&ReadParams,
- GLushort,
- x + i, y,
- d16);
- }
- }
- for (; i < n; i++) {
- if (visMask[i]) {
- d16 = depth[i];
- PUT_WRAPPED_FB_DATA(&ReadParams,
- GLushort,
- x + i, y,
- d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- GLuint wrappedPartStart;
-
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i]) {
- if (stencil_size > 0) {
- d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- for (; i < n; i++) {
- if (visMask[i]) {
- if (stencil_size > 0) {
- d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
-}
-
-static void
-tdfxDDReadDepthSpan(GLcontext * ctx,
- GLuint n, GLint x, GLint y, GLdepth depth[])
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GrLfbInfo_t info;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDReadDepthSpan(...)\n");
- }
-
- /*
- * Convert to screen coordinates.
- */
- x += fxMesa->x_offset;
- y = bottom - y;
- switch (depth_size) {
- case 16:
- {
- LFBParameters ReadParams;
- GrLfbInfo_t backBufferInfo;
- int wrappedPartStart;
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- /*
- * Read the line.
- */
- for (i = 0; i < wrappedPartStart; i++) {
- depth[i] =
- GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y);
- }
- for (; i < n; i++) {
- depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort,
- x + i, y);
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- case 24:
- case 32:
- {
- LFBParameters ReadParams;
- GrLfbInfo_t backBufferInfo;
- int wrappedPartStart;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- /*
- * Read the line.
- */
- for (i = 0; i < wrappedPartStart; i++) {
- const GLuint mask =
- (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF;
- depth[i] =
- GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y);
- depth[i] &= mask;
- }
- for (; i < n; i++) {
- const GLuint mask =
- (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF;
- depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y);
- depth[i] &= mask;
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
-}
-
-
-static void
-tdfxDDWriteDepthPixels(GLcontext * ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLdepth depth[], const GLubyte mask[])
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLushort d16;
- GLuint d32;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GrLfbInfo_t info;
- int xpos;
- int ypos;
- GrLfbInfo_t backBufferInfo;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthPixels(...)\n");
- }
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- for (i = 0; i < n; i++) {
- if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) {
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d16 = depth[i];
- PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- for (i = 0; i < n; i++) {
- if (mask[i]) {
- if (visible_pixel(fxMesa, x[i], y[i])) {
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- if (stencil_size > 0) {
- d32 =
- GET_FB_DATA(&ReadParams, GLuint, xpos, ypos);
- d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32);
- }
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
-}
-
-
-static void
-tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[], GLdepth depth[])
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLushort d16;
- int xpos;
- int ypos;
- GrLfbInfo_t info;
- GLuint stencil_size;
- GrLfbInfo_t backBufferInfo;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDReadDepthPixels(...)\n");
- }
-
- assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32));
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- for (i = 0; i < n; i++) {
- /*
- * Convert to screen coordinates.
- */
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos);
- depth[i] = d16;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- stencil_size = fxMesa->glCtx->Visual.stencilBits;
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- for (i = 0; i < n; i++) {
- GLuint d32;
-
- /*
- * Convert to screen coordinates.
- */
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos);
- if (stencil_size > 0) {
- d32 &= 0x00FFFFFF;
- }
- depth[i] = d32;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- default:
- assert(0);
- }
-}
-
-/*
- * Stencil buffer read/write functions.
- */
-#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF)
-#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff)
-#define BUILD_ZS(z, s) (((s) << 24) | (z))
-
-static void
-write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y,
- const GLstencil stencil[], const GLubyte mask[])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
- LFBParameters ReadParams;
- GLubyte visMask[MAX_WIDTH];
- GLuint i;
- int wrappedPartStart;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- generate_vismask(fxMesa, scrX, scrY, n, visMask);
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i] && (!mask || mask[i])) {
- GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- scrX + i, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z);
- }
- }
- for (; i < n; i++) {
- if (visMask[i] && (!mask || mask[i])) {
- GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- scrX + i, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y,
- GLstencil stencil[])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- GLuint i;
- LFBParameters ReadParams;
- int wrappedPartStart;
-
- /*
- * Convert to screen coordinates.
- */
- x += winX;
- y = winY - y;
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- x + i, y) >> 24) & 0xFF;
- }
- for (; i < n; i++) {
- stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- x + i, y) >> 24) & 0xFF;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-write_stencil_pixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLstencil stencil[], const GLubyte mask[])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- LFBParameters ReadParams;
- GLuint i;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- for (i = 0; i < n; i++) {
- const GLint scrX = winX + x[i];
- const GLint scrY = winY - y[i];
- if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) {
- GLuint z =
- GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[],
- const GLint y[], GLstencil stencil[])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- GLuint i;
- LFBParameters ReadParams;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- for (i = 0; i < n; i++) {
- const GLint scrX = winX + x[i];
- const GLint scrY = winY - y[i];
- stencil[i] =
- (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \
- ((vis.redBits == r) && \
- (vis.greenBits == g) && \
- (vis.blueBits == b) && \
- (vis.alphaBits == a))
-
-
-
-
-/**********************************************************************/
-/* Locking for swrast */
-/**********************************************************************/
-
-
-static void tdfxSpanRenderStart( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- LOCK_HARDWARE(fxMesa);
-}
-
-static void tdfxSpanRenderFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE(fxMesa);
-}
-
-/* Set the buffer used for reading */
-static void tdfxDDSetBuffer( GLcontext *ctx,
- GLframebuffer *buffer, GLuint bufferBit )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- (void) buffer;
-
- switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- break;
- case BACK_LEFT_BIT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- break;
- default:
- break;
- }
-}
-
-/**********************************************************************/
-/* Initialize swrast device driver */
-/**********************************************************************/
-
-void tdfxDDInitSpanFuncs( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
-
- swdd->SetBuffer = tdfxDDSetBuffer;
-
- if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) )
- {
- /* 16bpp mode */
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = tdfxReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB565;
- }
- else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 0) )
- {
- /* 24bpp mode */
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB888;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB888;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB888;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB888;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB888;
- swdd->ReadRGBASpan = tdfxReadRGBASpan_RGB888;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB888;
- }
- else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) )
- {
- /* 32bpp mode */
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = tdfxReadRGBASpan_ARGB8888;
- }
- else
- {
- abort();
- }
-
- if ( fxMesa->haveHwStencil ) {
- swdd->WriteStencilSpan = write_stencil_span;
- swdd->ReadStencilSpan = read_stencil_span;
- swdd->WriteStencilPixels = write_stencil_pixels;
- swdd->ReadStencilPixels = read_stencil_pixels;
- }
-
- swdd->WriteDepthSpan = tdfxDDWriteDepthSpan;
- swdd->WriteDepthPixels = tdfxDDWriteDepthPixels;
- swdd->ReadDepthSpan = tdfxDDReadDepthSpan;
- swdd->ReadDepthPixels = tdfxDDReadDepthPixels;
-
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-
- swdd->SpanRenderStart = tdfxSpanRenderStart;
- swdd->SpanRenderFinish = tdfxSpanRenderFinish;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h
deleted file mode 100644
index 8373d1af4..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_SPAN_H__
-#define __TDFX_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "context.h"
-
-extern void tdfxDDInitSpanFuncs( GLcontext *ctx );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
deleted file mode 100644
index bab3854a7..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
+++ /dev/null
@@ -1,1466 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c,v 1.7 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com> (port to 3.5)
- *
- */
-
-#include "mtypes.h"
-#include "colormac.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tdfx_context.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-#include "tdfx_texstate.h"
-#include "tdfx_tris.h"
-#include "tdfx_render.h"
-
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void tdfxUpdateAlphaMode( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCmpFnc_t func;
- GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA;
- GrAlpha_t ref = (GLint) (ctx->Color.AlphaRef * 255.0);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( ctx->Color.AlphaEnabled ) {
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- func = GR_CMP_NEVER;
- break;
- case GL_LESS:
- func = GR_CMP_LESS;
- break;
- case GL_LEQUAL:
- func = GR_CMP_LEQUAL;
- break;
- case GL_EQUAL:
- func = GR_CMP_EQUAL;
- break;
- case GL_GEQUAL:
- func = GR_CMP_GEQUAL;
- break;
- case GL_GREATER:
- func = GR_CMP_GREATER;
- break;
- case GL_NOTEQUAL:
- func = GR_CMP_NOTEQUAL;
- break;
- case GL_ALWAYS:
- default:
- func = GR_CMP_ALWAYS;
- break;
- }
- } else {
- func = GR_CMP_ALWAYS;
- }
-
- if ( ctx->Color.BlendEnabled
- && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) {
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- srcRGB = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- srcRGB = GR_BLEND_ONE;
- break;
- case GL_DST_COLOR:
- srcRGB = GR_BLEND_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- srcRGB = GR_BLEND_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_ALPHA:
- srcRGB = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- srcRGB = GR_BLEND_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- srcRGB = GR_BLEND_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- srcRGB = GR_BLEND_ALPHA_SATURATE;
- break;
- default:
- srcRGB = GR_BLEND_ONE;
- }
-
- switch ( ctx->Color.BlendSrcA ) {
- case GL_ZERO:
- srcA = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- srcA = GR_BLEND_ONE;
- break;
- case GL_DST_COLOR:
- srcA = GR_BLEND_DST_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_DST_COLOR:
- srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */
- break;
- case GL_SRC_ALPHA:
- srcA = GR_BLEND_SRC_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */
- break;
- case GL_DST_ALPHA:
- srcA = GR_BLEND_DST_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */
- break;
- case GL_SRC_ALPHA_SATURATE:
- srcA = GR_BLEND_ONE;
- break;
- default:
- srcA = GR_BLEND_ONE;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- dstRGB = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- dstRGB = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- dstRGB = GR_BLEND_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dstRGB = GR_BLEND_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- dstRGB = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- dstRGB = GR_BLEND_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dstRGB = GR_BLEND_ONE_MINUS_DST_ALPHA;
- break;
- default:
- dstRGB = GR_BLEND_ZERO;
- }
-
- switch ( ctx->Color.BlendDstA ) {
- case GL_ZERO:
- dstA = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- dstA = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */
- break;
- case GL_SRC_ALPHA:
- dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */
- break;
- case GL_DST_ALPHA:
- dstA = GR_BLEND_DST_ALPHA; /* Napalm only */
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dstA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */
- break;
- default:
- dstA = GR_BLEND_ZERO;
- }
- } else {
- /* blend disabled */
- srcRGB = GR_BLEND_ONE;
- dstRGB = GR_BLEND_ZERO;
- srcA = GR_BLEND_ONE;
- dstA = GR_BLEND_ZERO;
- }
-
- if ( fxMesa->Color.AlphaFunc != func ) {
- fxMesa->Color.AlphaFunc = func;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_TEST;
- }
- if ( fxMesa->Color.AlphaRef != ref ) {
- fxMesa->Color.AlphaRef = ref;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_REF;
- }
-
- if ( fxMesa->Color.BlendSrcRGB != srcRGB ||
- fxMesa->Color.BlendDstRGB != dstRGB ||
- fxMesa->Color.BlendSrcA != srcA ||
- fxMesa->Color.BlendDstA != dstA )
- {
- fxMesa->Color.BlendSrcRGB = srcRGB;
- fxMesa->Color.BlendDstRGB = dstRGB;
- fxMesa->Color.BlendSrcA = srcA;
- fxMesa->Color.BlendDstA = dstA;
- fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC;
- }
-}
-
-static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
-static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
-static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-
- /*
- * XXX - Voodoo5 seems to suffer from precision problems in some
- * blend modes. To pass all the conformance tests we'd have to
- * fall back to software for many modes. Revisit someday.
- */
-}
-
-static void tdfxDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
-/* =============================================================
- * Stipple
- */
-
-void tdfxUpdateStipple( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GrStippleMode_t mode = GR_STIPPLE_DISABLE;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
-
- if (ctx->Polygon.StippleFlag) {
- mode = GR_STIPPLE_PATTERN;
- }
-
- if ( fxMesa->Stipple.Mode != mode ) {
- fxMesa->Stipple.Mode = mode;
- fxMesa->dirty |= TDFX_UPLOAD_STIPPLE;
- }
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void tdfxUpdateZMode( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GrCmpFnc_t func;
- FxI32 bias;
- FxBool mask;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s()\n", __FUNCTION__ );
-
-
- bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE);
-
- if ( ctx->Depth.Test ) {
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- func = GR_CMP_NEVER;
- break;
- case GL_LESS:
- func = GR_CMP_LESS;
- break;
- case GL_LEQUAL:
- func = GR_CMP_LEQUAL;
- break;
- case GL_EQUAL:
- func = GR_CMP_EQUAL;
- break;
- case GL_GEQUAL:
- func = GR_CMP_GEQUAL;
- break;
- case GL_GREATER:
- func = GR_CMP_GREATER;
- break;
- case GL_NOTEQUAL:
- func = GR_CMP_NOTEQUAL;
- break;
- case GL_ALWAYS:
- default:
- func = GR_CMP_ALWAYS;
- break;
- }
-
- if ( ctx->Depth.Mask ) {
- mask = FXTRUE;
- }
- else {
- mask = FXFALSE;
- }
- }
- else {
- /* depth testing disabled */
- func = GR_CMP_ALWAYS; /* fragments always pass */
- mask = FXFALSE; /* zbuffer is not touched */
- }
-
- fxMesa->Depth.Clear = (FxU32) (((1 << fxMesa->glCtx->Visual.depthBits) - 1)
- * ctx->Depth.Clear);
-
- if ( fxMesa->Depth.Bias != bias ) {
- fxMesa->Depth.Bias = bias;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS;
- }
- if ( fxMesa->Depth.Func != func ) {
- fxMesa->Depth.Func = func;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_FUNC | TDFX_UPLOAD_DEPTH_MASK;
- }
- if ( fxMesa->Depth.Mask != mask ) {
- fxMesa->Depth.Mask = mask;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_MASK;
- }
-}
-
-static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-
-
-/* =============================================================
- * Stencil
- */
-
-
-/* Evaluate all stencil state and make the Glide calls.
- */
-static GrStencil_t convertGLStencilOp( GLenum op )
-{
- switch ( op ) {
- case GL_KEEP:
- return GR_STENCILOP_KEEP;
- case GL_ZERO:
- return GR_STENCILOP_ZERO;
- case GL_REPLACE:
- return GR_STENCILOP_REPLACE;
- case GL_INCR:
- return GR_STENCILOP_INCR_CLAMP;
- case GL_DECR:
- return GR_STENCILOP_DECR_CLAMP;
- case GL_INVERT:
- return GR_STENCILOP_INVERT;
- case GL_INCR_WRAP_EXT:
- return GR_STENCILOP_INCR_WRAP;
- case GL_DECR_WRAP_EXT:
- return GR_STENCILOP_DECR_WRAP;
- default:
- _mesa_problem( NULL, "bad stencil op in convertGLStencilOp" );
- }
- return GR_STENCILOP_KEEP; /* never get, silence compiler warning */
-}
-
-
-static void tdfxUpdateStencil( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if (fxMesa->haveHwStencil) {
- if (ctx->Stencil.Enabled) {
- fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER;
- fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0];
- fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0];
- fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0];
- fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[0]);
- fxMesa->Stencil.ZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[0]);
- fxMesa->Stencil.ZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[0]);
- fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff;
- }
- fxMesa->dirty |= TDFX_UPLOAD_STENCIL;
- }
-}
-
-
-static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail,
- GLenum zfail, GLenum zpass )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-
-/* =============================================================
- * Fog - orthographic fog still not working
- */
-
-static void tdfxUpdateFogAttrib( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrFogMode_t mode;
- GrColor_t color;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( ctx->Fog.Enabled ) {
- mode = GR_FOG_WITH_TABLE_ON_Q;
- } else {
- mode = GR_FOG_DISABLE;
- }
-
- color = TDFXPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- if ( fxMesa->Fog.Mode != mode ) {
- fxMesa->Fog.Mode = mode;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_MODE;
- }
- if ( fxMesa->Fog.Color != color ) {
- fxMesa->Fog.Color = color;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_COLOR;
- }
- if ( fxMesa->Fog.TableMode != ctx->Fog.Mode ||
- fxMesa->Fog.Density != ctx->Fog.Density ||
- fxMesa->Fog.Near != ctx->Fog.Start ||
- fxMesa->Fog.Far != ctx->Fog.End )
- {
- switch( ctx->Fog.Mode ) {
- case GL_EXP:
- fxMesa->Glide.guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density );
- break;
- case GL_EXP2:
- fxMesa->Glide.guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density);
- break;
- case GL_LINEAR:
- fxMesa->Glide.guFogGenerateLinear( fxMesa->Fog.Table,
- ctx->Fog.Start, ctx->Fog.End );
- break;
- }
-
- fxMesa->Fog.TableMode = ctx->Fog.Mode;
- fxMesa->Fog.Density = ctx->Fog.Density;
- fxMesa->Fog.Near = ctx->Fog.Start;
- fxMesa->Fog.Far = ctx->Fog.End;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_TABLE;
- }
-}
-
-static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_FOG;
-}
-
-
-/* =============================================================
- * Clipping
- */
-
-static int intersect_rect( XF86DRIClipRectPtr out,
- const XF86DRIClipRectPtr a,
- const XF86DRIClipRectPtr b)
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (b->y2 < out->y2) out->y2 = b->y2;
- if (out->x1 >= out->x2) return 0;
- if (out->y1 >= out->y2) return 0;
- return 1;
-}
-
-
-/*
- * Examine XF86 cliprect list and scissor state to recompute our
- * cliprect list.
- */
-void tdfxUpdateClipping( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- assert(ctx);
- assert(fxMesa);
- assert(dPriv);
-
- if ( dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset ||
- dPriv->w != fxMesa->width || dPriv->h != fxMesa->height ) {
- fxMesa->x_offset = dPriv->x;
- fxMesa->y_offset = dPriv->y;
- fxMesa->width = dPriv->w;
- fxMesa->height = dPriv->h;
- fxMesa->y_delta =
- fxMesa->screen_height - fxMesa->y_offset - fxMesa->height;
- tdfxUpdateViewport( ctx );
- }
-
- if (fxMesa->scissoredClipRects && fxMesa->pClipRects) {
- free(fxMesa->pClipRects);
- }
-
- if (ctx->Scissor.Enabled) {
- /* intersect OpenGL scissor box with all cliprects to make a new
- * list of cliprects.
- */
- XF86DRIClipRectRec scissor;
- int x1 = ctx->Scissor.X + fxMesa->x_offset;
- int y1 = fxMesa->screen_height - fxMesa->y_delta
- - ctx->Scissor.Y - ctx->Scissor.Height;
- int x2 = x1 + ctx->Scissor.Width;
- int y2 = y1 + ctx->Scissor.Height;
- scissor.x1 = MAX2(x1, 0);
- scissor.y1 = MAX2(y1, 0);
- scissor.x2 = MAX2(x2, 0);
- scissor.y2 = MAX2(y2, 0);
-
- assert(scissor.x2 >= scissor.x1);
- assert(scissor.y2 >= scissor.y1);
-
- fxMesa->pClipRects = malloc(dPriv->numClipRects
- * sizeof(XF86DRIClipRectRec));
- if (fxMesa->pClipRects) {
- int i;
- fxMesa->numClipRects = 0;
- for (i = 0; i < dPriv->numClipRects; i++) {
- if (intersect_rect(&fxMesa->pClipRects[fxMesa->numClipRects],
- &scissor, &dPriv->pClipRects[i])) {
- fxMesa->numClipRects++;
- }
- }
- fxMesa->scissoredClipRects = GL_TRUE;
- }
- else {
- /* out of memory, forgo scissor */
- fxMesa->numClipRects = dPriv->numClipRects;
- fxMesa->pClipRects = dPriv->pClipRects;
- fxMesa->scissoredClipRects = GL_FALSE;
- }
- }
- else {
- fxMesa->numClipRects = dPriv->numClipRects;
- fxMesa->pClipRects = dPriv->pClipRects;
- fxMesa->scissoredClipRects = GL_FALSE;
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_CLIP;
-}
-
-
-
-/* =============================================================
- * Culling
- */
-
-void tdfxUpdateCull( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCullMode_t mode = GR_CULL_DISABLE;
-
- /* KW: don't need to check raster_primitive here as we don't
- * attempt to draw lines or points with triangles.
- */
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- if ( ctx->Polygon.FrontFace == GL_CCW ) {
- mode = GR_CULL_POSITIVE;
- } else {
- mode = GR_CULL_NEGATIVE;
- }
- break;
-
- case GL_BACK:
- if ( ctx->Polygon.FrontFace == GL_CCW ) {
- mode = GR_CULL_NEGATIVE;
- } else {
- mode = GR_CULL_POSITIVE;
- }
- break;
-
- case GL_FRONT_AND_BACK:
- /* Handled as a fallback on triangles in tdfx_tris.c */
- return;
-
- default:
- ASSERT(0);
- break;
- }
- }
-
- if ( fxMesa->CullMode != mode ) {
- fxMesa->CullMode = mode;
- fxMesa->dirty |= TDFX_UPLOAD_CULL;
- }
-}
-
-static void tdfxDDCullFace( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
-}
-
-static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
-}
-
-
-/* =============================================================
- * Line drawing.
- */
-
-static void tdfxUpdateLine( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
- fxMesa->dirty |= TDFX_UPLOAD_LINE;
-}
-
-
-static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_LINE;
-}
-
-
-/* =============================================================
- * Color Attributes
- */
-
-static void tdfxDDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- if ( fxMesa->Color.ColorMask[RCOMP] != r ||
- fxMesa->Color.ColorMask[GCOMP] != g ||
- fxMesa->Color.ColorMask[BCOMP] != b ||
- fxMesa->Color.ColorMask[ACOMP] != a ) {
- fxMesa->Color.ColorMask[RCOMP] = r;
- fxMesa->Color.ColorMask[GCOMP] = g;
- fxMesa->Color.ColorMask[BCOMP] = b;
- fxMesa->Color.ColorMask[ACOMP] = a;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_MASK;
-
- if (ctx->Visual.redBits < 8) {
- /* Can't do RGB colormasking in 16bpp mode. */
- /* We can completely ignore the alpha mask. */
- FALLBACK( fxMesa, TDFX_FALLBACK_COLORMASK, (r != g || g != b) );
- }
- }
-}
-
-
-static void tdfxDDClearColor( GLcontext *ctx,
- const GLfloat color[4] )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLubyte c[4];
- FLUSH_BATCH( fxMesa );
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- fxMesa->Color.ClearColor = TDFXPACKCOLOR888( c[0], c[1], c[2] );
- fxMesa->Color.ClearAlpha = c[3];
-}
-
-
-/* =============================================================
- * Light Model
- */
-
-static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
- FALLBACK( fxMesa, TDFX_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ));
- }
-}
-
-static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- /* FIXME: Can we implement native flat shading? */
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/* =============================================================
- * Scissor
- */
-
-static void
-tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CLIP;
-}
-
-/* =============================================================
- * Render
- */
-
-static void tdfxUpdateRenderAttrib( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->dirty |= TDFX_UPLOAD_RENDER_BUFFER;
-}
-
-/* =============================================================
- * Viewport
- */
-
-void tdfxUpdateViewport( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = fxMesa->hw_viewport;
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET;
- m[MAT_SY] = v[MAT_SY];
- m[MAT_TY] = v[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET;
- m[MAT_SZ] = v[MAT_SZ];
- m[MAT_TZ] = v[MAT_TZ];
-
- fxMesa->SetupNewInputs |= VERT_BIT_CLIP;
-}
-
-
-static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_VIEWPORT;
-}
-
-
-static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_VIEWPORT;
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
- break;
-
- case GL_BLEND:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
- FALLBACK( fxMesa, TDFX_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- FLUSH_BATCH( fxMesa );
- if ( state ) {
- fxMesa->Color.Dither = GR_DITHER_2x2;
- } else {
- fxMesa->Color.Dither = GR_DITHER_DISABLE;
- }
- fxMesa->dirty |= TDFX_UPLOAD_DITHER;
- break;
-
- case GL_FOG:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_FOG;
- break;
-
- case GL_COLOR_LOGIC_OP:
- FALLBACK( fxMesa, TDFX_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_LIGHTING:
- FALLBACK( fxMesa, TDFX_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ));
- break;
-
- case GL_LINE_SMOOTH:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_LINE;
- break;
-
- case GL_LINE_STIPPLE:
- FALLBACK(fxMesa, TDFX_FALLBACK_LINE_STIPPLE, state);
- break;
-
- case GL_POLYGON_STIPPLE:
- FLUSH_BATCH(fxMesa);
- fxMesa->new_state |= TDFX_NEW_STIPPLE;
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CLIP;
- break;
-
- case GL_STENCIL_TEST:
- FLUSH_BATCH( fxMesa );
- FALLBACK( fxMesa, TDFX_FALLBACK_STENCIL, state && !fxMesa->haveHwStencil);
- break;
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_3D:
- FLUSH_BATCH( fxMesa );
- FALLBACK( fxMesa, TDFX_FALLBACK_TEXTURE_1D_3D, state); /* wrong */
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_2D:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- default:
- return;
- }
-}
-
-
-
-/* Set the buffer used for drawing */
-/* XXX support for separate read/draw buffers hasn't been tested */
-static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- fxMesa->new_state |= TDFX_NEW_RENDER;
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BACK_LEFT_BIT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- fxMesa->new_state |= TDFX_NEW_RENDER;
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case 0:
- FX_grColorMaskv( ctx, false4 );
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
- break;
- }
-
- /* We want to update the s/w rast state too so that tdfxDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* XXX ??? */
-}
-
-
-/* =============================================================
- * Polygon stipple
- */
-
-static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte q[4];
- int i,j,k;
- GLboolean allBitsSet;
-
-/* int active = (ctx->Polygon.StippleFlag && */
-/* fxMesa->reduced_prim == GL_TRIANGLES); */
-
- FLUSH_BATCH(fxMesa);
- fxMesa->Stipple.Pattern = 0xffffffff;
- fxMesa->dirty |= TDFX_UPLOAD_STIPPLE;
- fxMesa->new_state |= TDFX_NEW_STIPPLE;
-
- /* Check if the stipple pattern is fully opaque. If so, use software
- * rendering. This basically a trick to make sure the OpenGL conformance
- * test passes.
- */
- allBitsSet = GL_TRUE;
- for (i = 0; i < 32; i++) {
- if (((GLuint *) mask)[i] != 0xffffffff) {
- allBitsSet = GL_FALSE;
- break;
- }
- }
- if (allBitsSet) {
- fxMesa->haveHwStipple = GL_FALSE;
- return;
- }
-
- q[0] = mask[0];
- q[1] = mask[4];
- q[2] = mask[8];
- q[3] = mask[12];
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++,m++) {
- if (*m != q[j]) {
- fxMesa->haveHwStipple = GL_FALSE;
- return;
- }
- }
-
- fxMesa->haveHwStipple = GL_TRUE;
- fxMesa->Stipple.Pattern = ( (q[0] << 0) |
- (q[1] << 8) |
- (q[2] << 16) |
- (q[3] << 24) );
-}
-
-
-
-static void tdfxDDRenderMode( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FALLBACK( fxMesa, TDFX_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-
-static void tdfxDDPrintState( const char *msg, GLuint flags )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & TDFX_NEW_COLOR) ? "color, " : "",
- (flags & TDFX_NEW_ALPHA) ? "alpha, " : "",
- (flags & TDFX_NEW_DEPTH) ? "depth, " : "",
- (flags & TDFX_NEW_RENDER) ? "render, " : "",
- (flags & TDFX_NEW_FOG) ? "fog, " : "",
- (flags & TDFX_NEW_STENCIL) ? "stencil, " : "",
- (flags & TDFX_NEW_STIPPLE) ? "stipple, " : "",
- (flags & TDFX_NEW_CLIP) ? "clip, " : "",
- (flags & TDFX_NEW_VIEWPORT) ? "viewport, " : "",
- (flags & TDFX_NEW_CULL) ? "cull, " : "",
- (flags & TDFX_NEW_GLIDE) ? "glide, " : "",
- (flags & TDFX_NEW_TEXTURE) ? "texture, " : "",
- (flags & TDFX_NEW_CONTEXT) ? "context, " : "");
-}
-
-
-
-void tdfxDDUpdateHwState( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- int new_state = fxMesa->new_state;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( new_state )
- {
- FLUSH_BATCH( fxMesa );
-
- fxMesa->new_state = 0;
-
- if ( 0 )
- tdfxDDPrintState( "tdfxUpdateHwState", new_state );
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & TDFX_NEW_ALPHA ) {
- tdfxUpdateAlphaMode( ctx );
- }
-
- if ( new_state & TDFX_NEW_DEPTH )
- tdfxUpdateZMode( ctx );
-
- if ( new_state & TDFX_NEW_FOG )
- tdfxUpdateFogAttrib( ctx );
-
- if ( new_state & TDFX_NEW_CLIP )
- tdfxUpdateClipping( ctx );
-
- if ( new_state & TDFX_NEW_STIPPLE )
- tdfxUpdateStipple( ctx );
-
- if ( new_state & TDFX_NEW_CULL )
- tdfxUpdateCull( ctx );
-
- if ( new_state & TDFX_NEW_LINE )
- tdfxUpdateLine( ctx );
-
- if ( new_state & TDFX_NEW_VIEWPORT )
- tdfxUpdateViewport( ctx );
-
- if ( new_state & TDFX_NEW_RENDER )
- tdfxUpdateRenderAttrib( ctx );
-
- if ( new_state & TDFX_NEW_STENCIL )
- tdfxUpdateStencil( ctx );
-
- if ( new_state & TDFX_NEW_TEXTURE ) {
- tdfxUpdateTextureState( ctx );
- }
- else if ( new_state & TDFX_NEW_TEXTURE_BIND ) {
- tdfxUpdateTextureBinding( ctx );
- }
- }
-
- if ( 0 ) {
- FxI32 bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE);
-
- if ( fxMesa->Depth.Bias != bias ) {
- fxMesa->Depth.Bias = bias;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS;
- }
- }
-
- if ( fxMesa->dirty ) {
- LOCK_HARDWARE( fxMesa );
- tdfxEmitHwStateLocked( fxMesa );
- UNLOCK_HARDWARE( fxMesa );
- }
-}
-
-
-static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- TDFX_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-
-/* Initialize the context's Glide state mirror. These values will be
- * used as Glide function call parameters when the time comes.
- */
-void tdfxInitState( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- GLint i;
-
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
-
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
-
- fxMesa->sScale0 = fxMesa->tScale0 = 1.0;
- fxMesa->sScale1 = fxMesa->tScale1 = 1.0;
-
- fxMesa->TexPalette.Type = 0;
- fxMesa->TexPalette.Data = NULL;
-
- for ( i = 0 ; i < TDFX_NUM_TMU ; i++ ) {
- fxMesa->TexSource[i].StartAddress = 0;
- fxMesa->TexSource[i].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[i].Info = NULL;
-
- fxMesa->TexCombine[i].FunctionRGB = 0;
- fxMesa->TexCombine[i].FactorRGB = 0;
- fxMesa->TexCombine[i].FunctionAlpha = 0;
- fxMesa->TexCombine[i].FactorAlpha = 0;
- fxMesa->TexCombine[i].InvertRGB = FXFALSE;
- fxMesa->TexCombine[i].InvertAlpha = FXFALSE;
-
- fxMesa->TexCombineExt[i].Alpha.SourceA = 0;
- /* XXX more state to init here */
- fxMesa->TexCombineExt[i].Color.SourceA = 0;
- fxMesa->TexCombineExt[i].EnvColor = 0x0;
-
- fxMesa->TexParams[i].sClamp = GR_TEXTURECLAMP_WRAP;
- fxMesa->TexParams[i].tClamp = GR_TEXTURECLAMP_WRAP;
- fxMesa->TexParams[i].minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- fxMesa->TexParams[i].magFilt = GR_TEXTUREFILTER_BILINEAR;
- fxMesa->TexParams[i].mmMode = GR_MIPMAP_DISABLE;
- fxMesa->TexParams[i].LODblend = FXFALSE;
- fxMesa->TexParams[i].LodBias = 0.0;
-
- fxMesa->TexState.EnvMode[i] = ~0;
- fxMesa->TexState.TexFormat[i] = ~0;
- fxMesa->TexState.Enabled[i] = 0;
- }
-
- if ( ctx->Visual.doubleBufferMode) {
- fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER;
- fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- } else {
- fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER;
- fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- }
-
- fxMesa->Color.ClearColor = 0x00000000;
- fxMesa->Color.ClearAlpha = 0x00;
- fxMesa->Color.ColorMask[RCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[BCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[GCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[ACOMP] = FXTRUE;
- fxMesa->Color.MonoColor = 0xffffffff;
-
- fxMesa->Color.AlphaFunc = GR_CMP_ALWAYS;
- fxMesa->Color.AlphaRef = 0x00;
- fxMesa->Color.BlendSrcRGB = GR_BLEND_ONE;
- fxMesa->Color.BlendDstRGB = GR_BLEND_ZERO;
- fxMesa->Color.BlendSrcA = GR_BLEND_ONE;
- fxMesa->Color.BlendSrcA = GR_BLEND_ZERO;
-
- fxMesa->Color.Dither = GR_DITHER_2x2;
-
- if ( fxMesa->glCtx->Visual.depthBits > 0 ) {
- fxMesa->Depth.Mode = GR_DEPTHBUFFER_ZBUFFER;
- } else {
- fxMesa->Depth.Mode = GR_DEPTHBUFFER_DISABLE;
- }
- fxMesa->Depth.Bias = 0;
- fxMesa->Depth.Func = GR_CMP_LESS;
- fxMesa->Depth.Clear = 0; /* computed later */
- fxMesa->Depth.Mask = FXTRUE;
-
-
- fxMesa->Fog.Mode = GR_FOG_DISABLE;
- fxMesa->Fog.Color = 0x00000000;
- fxMesa->Fog.Table = NULL;
- fxMesa->Fog.Density = 1.0;
- fxMesa->Fog.Near = 1.0;
- fxMesa->Fog.Far = 1.0;
-
- fxMesa->Stencil.Function = GR_CMP_ALWAYS;
- fxMesa->Stencil.RefValue = 0;
- fxMesa->Stencil.ValueMask = 0xff;
- fxMesa->Stencil.WriteMask = 0xff;
- fxMesa->Stencil.FailFunc = 0;
- fxMesa->Stencil.ZFailFunc = 0;
- fxMesa->Stencil.ZPassFunc = 0;
- fxMesa->Stencil.Clear = 0;
-
- fxMesa->Stipple.Mode = GR_STIPPLE_DISABLE;
- fxMesa->Stipple.Pattern = 0xffffffff;
-
- fxMesa->Scissor.minX = 0;
- fxMesa->Scissor.minY = 0;
- fxMesa->Scissor.maxX = 0;
- fxMesa->Scissor.maxY = 0;
-
- fxMesa->Viewport.Mode = GR_WINDOW_COORDS;
- fxMesa->Viewport.X = 0;
- fxMesa->Viewport.Y = 0;
- fxMesa->Viewport.Width = 0;
- fxMesa->Viewport.Height = 0;
- fxMesa->Viewport.Near = 0.0;
- fxMesa->Viewport.Far = 0.0;
-
- fxMesa->CullMode = GR_CULL_DISABLE;
-
- fxMesa->Glide.ColorFormat = GR_COLORFORMAT_ABGR;
- fxMesa->Glide.Origin = GR_ORIGIN_LOWER_LEFT;
- fxMesa->Glide.Initialized = FXFALSE;
-}
-
-
-
-void tdfxDDInitStateFuncs( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- ctx->Driver.UpdateState = tdfxDDInvalidateState;
-
-
- /* State notification callbacks:
- */
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = tdfxDDClearColor;
- ctx->Driver.DrawBuffer = tdfxDDDrawBuffer;
- ctx->Driver.ReadBuffer = tdfxDDReadBuffer;
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = tdfxDDColorMask;
-
- ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
- ctx->Driver.BlendEquation = tdfxDDBlendEquation;
- ctx->Driver.BlendFunc = tdfxDDBlendFunc;
- ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate;
- ctx->Driver.ClearDepth = tdfxDDClearDepth;
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.CullFace = tdfxDDCullFace;
- ctx->Driver.FrontFace = tdfxDDFrontFace;
- ctx->Driver.DepthFunc = tdfxDDDepthFunc;
- ctx->Driver.DepthMask = tdfxDDDepthMask;
- ctx->Driver.DepthRange = tdfxDDDepthRange;
- ctx->Driver.Enable = tdfxDDEnable;
- ctx->Driver.Fogfv = tdfxDDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LightModelfv = tdfxDDLightModelfv;
- ctx->Driver.LineStipple = NULL;
- ctx->Driver.LineWidth = tdfxDDLineWidth;
- ctx->Driver.PolygonStipple = tdfxDDPolygonStipple;
- ctx->Driver.RenderMode = tdfxDDRenderMode;
- ctx->Driver.Scissor = tdfxDDScissor;
- ctx->Driver.ShadeModel = tdfxDDShadeModel;
-
- ctx->Driver.BindTexture = tdfxDDBindTexture;
- ctx->Driver.DeleteTexture = tdfxDDDeleteTexture;
- ctx->Driver.TexEnv = tdfxDDTexEnv;
- ctx->Driver.TexParameter = tdfxDDTexParameter;
- ctx->Driver.ChooseTextureFormat = tdfxDDChooseTextureFormat;
- ctx->Driver.TexImage2D = tdfxDDTexImage2D;
- ctx->Driver.TexSubImage2D = tdfxDDTexSubImage2D;
- /*
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- */
-
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
-/* ctx->Driver.GetTexImage = tdfxDDGetTexImage; */
- ctx->Driver.UpdateTexturePalette = tdfxDDTexturePalette;
-
- if ( fxMesa->haveHwStencil ) {
- ctx->Driver.StencilFunc = tdfxDDStencilFunc;
- ctx->Driver.StencilMask = tdfxDDStencilMask;
- ctx->Driver.StencilOp = tdfxDDStencilOp;
- } else {
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
- }
-
- ctx->Driver.Viewport = tdfxDDViewport;
-
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h
deleted file mode 100644
index 5e59a1601..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_STATE_H__
-#define __TDFX_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "context.h"
-#include "tdfx_context.h"
-
-extern void tdfxDDInitStateFuncs( GLcontext *ctx );
-
-extern void tdfxDDUpdateHwState( GLcontext *ctx );
-
-extern void tdfxInitState( tdfxContextPtr fxMesa );
-
-extern void tdfxUpdateClipping( GLcontext *ctx );
-
-
-extern void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) tdfxFallback( rmesa->glCtx, bit, mode )
-
-extern void tdfxUpdateCull( GLcontext *ctx );
-extern void tdfxUpdateStipple( GLcontext *ctx );
-extern void tdfxUpdateViewport( GLcontext *ctx );
-
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c
deleted file mode 100644
index bffee9606..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c
+++ /dev/null
@@ -1,1473 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c,v 1.7 2002/11/05 17:46:10 tsi Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "image.h"
-#include "texutil.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "tdfx_context.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-
-
-
-static int
-logbase2(int n)
-{
- GLint i = 1;
- GLint log2 = 0;
-
- if (n < 0) {
- return -1;
- }
-
- while (n > i) {
- i *= 2;
- log2++;
- }
- if (i != n) {
- return -1;
- }
- else {
- return log2;
- }
-}
-
-
-/*
- * Compute various texture image parameters.
- * Input: w, h - source texture width and height
- * Output: lodlevel - Glide lod level token for the larger texture dimension
- * aspectratio - Glide aspect ratio token
- * sscale - S scale factor used during triangle setup
- * tscale - T scale factor used during triangle setup
- * wscale - OpenGL -> Glide image width scale factor
- * hscale - OpenGL -> Glide image height scale factor
- *
- * Sample results:
- * w h lodlevel aspectRatio
- * 128 128 GR_LOD_LOG2_128 (=7) GR_ASPECT_LOG2_1x1 (=0)
- * 64 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x1 (=0)
- * 64 32 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_2x1 (=1)
- * 32 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x2 (=-1)
- * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0)
- */
-static void
-tdfxTexGetInfo(const GLcontext *ctx, int w, int h,
- GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio,
- float *sscale, float *tscale,
- int *wscale, int *hscale)
-{
- int logw, logh, ar, lod, ws, hs;
- float s, t;
-
- ASSERT(w >= 1);
- ASSERT(h >= 1);
-
- logw = logbase2(w);
- logh = logbase2(h);
- ar = logw - logh; /* aspect ratio = difference in log dimensions */
-
- /* Hardware only allows a maximum aspect ratio of 8x1, so handle
- |ar| > 3 by scaling the image and using an 8x1 aspect ratio */
- if (ar >= 0) {
- ASSERT(width >= height);
- lod = logw;
- s = 256.0;
- ws = 1;
- if (ar <= GR_ASPECT_LOG2_8x1) {
- t = 256 >> ar;
- hs = 1;
- }
- else {
- /* have to stretch image height */
- t = 32.0;
- hs = 1 << (ar - 3);
- }
- }
- else {
- ASSERT(width < height);
- lod = logh;
- t = 256.0;
- hs = 1;
- if (ar >= GR_ASPECT_LOG2_1x8) {
- s = 256 >> -ar;
- ws = 1;
- }
- else {
- /* have to stretch image width */
- s = 32.0;
- ws = 1 << (-ar - 3);
- }
- }
-
- if (ar < GR_ASPECT_LOG2_1x8)
- ar = GR_ASPECT_LOG2_1x8;
- else if (ar > GR_ASPECT_LOG2_8x1)
- ar = GR_ASPECT_LOG2_8x1;
-
- if (lodlevel)
- *lodlevel = (GrLOD_t) lod;
- if (aspectratio)
- *aspectratio = (GrAspectRatio_t) ar;
- if (sscale)
- *sscale = s;
- if (tscale)
- *tscale = t;
- if (wscale)
- *wscale = ws;
- if (hscale)
- *hscale = hs;
-}
-
-
-/*
- * We need to call this when a texture object's minification filter
- * or texture image sizes change.
- */
-static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- GLint minl, maxl;
-
- if (!ti)
- return;
-
- minl = maxl = tObj->BaseLevel;
-
- if (tObj->Image[minl]) {
- maxl = MIN2(tObj->MaxLevel, tObj->Image[minl]->MaxLog2);
-
- /* compute largeLodLog2, aspect ratio and texcoord scale factors */
- tdfxTexGetInfo(ctx, tObj->Image[minl]->Width, tObj->Image[minl]->Height,
- &ti->info.largeLodLog2,
- &ti->info.aspectRatioLog2,
- &(ti->sScale), &(ti->tScale), NULL, NULL);
- }
-
- if (tObj->Image[maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) {
- /* mipmapping: need to compute smallLodLog2 */
- tdfxTexGetInfo(ctx, tObj->Image[maxl]->Width,
- tObj->Image[maxl]->Height,
- &ti->info.smallLodLog2, NULL,
- NULL, NULL, NULL, NULL);
- }
- else {
- /* not mipmapping: smallLodLog2 = largeLodLog2 */
- ti->info.smallLodLog2 = ti->info.largeLodLog2;
- maxl = minl;
- }
-
- ti->minLevel = minl;
- ti->maxLevel = maxl;
- ti->info.data = NULL;
-}
-
-
-static tdfxTexInfo *
-fxAllocTexObjData(tdfxContextPtr fxMesa)
-{
- tdfxTexInfo *ti;
-
- if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) {
- _mesa_problem(NULL, "tdfx driver: out of memory");
- return NULL;
- }
-
- ti->isInTM = GL_FALSE;
-
- ti->whichTMU = TDFX_TMU_NONE;
-
- ti->tm[TDFX_TMU0] = NULL;
- ti->tm[TDFX_TMU1] = NULL;
-
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->magFilt = GR_TEXTUREFILTER_BILINEAR;
-
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
-
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXFALSE;
-
- return ti;
-}
-
-
-/*
- * Called via glBindTexture.
- */
-
-void
-tdfxDDBindTexture(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexBind(%d,%p)\n", tObj->Name,
- tObj->DriverData);
- }
-
- if (target != GL_TEXTURE_2D)
- return;
-
- if (!tObj->DriverData) {
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- }
-
- ti = TDFX_TEXTURE_DATA(tObj);
- ti->lastTimeUsed = fxMesa->texBindNumber++;
-
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/*
- * Called via glTexEnv.
- */
-void
-tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
- const GLfloat * param)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- if (param)
- fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname,
- (GLint) (*param));
- else
- fprintf(stderr, "fxmesa: texenv(%x)\n", pname);
- }
-
- /* XXX this is a bit of a hack to force the Glide texture
- * state to be updated.
- */
- fxMesa->TexState.EnvMode[ctx->Texture.CurrentUnit] = 0;
-
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/*
- * Called via glTexParameter.
- */
-void
-tdfxDDTexParameter(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat * params)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLenum param = (GLenum) (GLint) params[0];
- tdfxTexInfo *ti;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexParam(%d,%p,%x,%x)\n", tObj->Name,
- tObj->DriverData, pname, param);
- }
-
- if (target != GL_TEXTURE_2D)
- return;
-
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
-
- ti = TDFX_TEXTURE_DATA(tObj);
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- switch (param) {
- case GL_NEAREST:
- ti->mmMode = GR_MIPMAP_DISABLE;
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->LODblend = FXFALSE;
- break;
- case GL_LINEAR:
- ti->mmMode = GR_MIPMAP_DISABLE;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- if (TDFX_IS_NAPALM(fxMesa)) {
- if (fxMesa->haveTwoTMUs) {
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXTRUE;
- }
- else {
- ti->mmMode = GR_MIPMAP_NEAREST_DITHER;
- ti->LODblend = FXFALSE;
- }
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- break;
- }
- /* XXX Voodoo3/Banshee mipmap blending seems to produce
- * incorrectly filtered colors for the smallest mipmap levels.
- * To work-around we fall-through here and use a different filter.
- */
- case GL_NEAREST_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->LODblend = FXFALSE;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- if (TDFX_IS_NAPALM(fxMesa)) {
- if (fxMesa->haveTwoTMUs) {
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXTRUE;
- }
- else {
- ti->mmMode = GR_MIPMAP_NEAREST_DITHER;
- ti->LODblend = FXFALSE;
- }
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- break;
- }
- /* XXX Voodoo3/Banshee mipmap blending seems to produce
- * incorrectly filtered colors for the smallest mipmap levels.
- * To work-around we fall-through here and use a different filter.
- */
- case GL_LINEAR_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
- default:
- break;
- }
- RevalidateTexture(ctx, tObj);
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_MAG_FILTER:
- switch (param) {
- case GL_NEAREST:
- ti->magFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- break;
- case GL_LINEAR:
- ti->magFilt = GR_TEXTUREFILTER_BILINEAR;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_WRAP_S:
- switch (param) {
- case GL_CLAMP:
- ti->sClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_WRAP_T:
- switch (param) {
- case GL_CLAMP:
- ti->tClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- /* TO DO */
- break;
- case GL_TEXTURE_MIN_LOD:
- /* TO DO */
- break;
- case GL_TEXTURE_MAX_LOD:
- /* TO DO */
- break;
- case GL_TEXTURE_BASE_LEVEL:
- RevalidateTexture(ctx, tObj);
- break;
- case GL_TEXTURE_MAX_LEVEL:
- RevalidateTexture(ctx, tObj);
- break;
-
- default:
- break;
- }
-}
-
-
-/*
- * Called via glDeleteTextures to delete a texture object.
- * Here, we delete the Glide data associated with the texture.
- */
-void
-tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- if (ctx && ctx->DriverCtx) {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTMFreeTexture(fxMesa, tObj);
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- }
-}
-
-
-/*
- * Return true if texture is resident, false otherwise.
- */
-GLboolean
-tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- return (GLboolean) (ti && ti->isInTM);
-}
-
-
-
-/*
- * Convert a gl_color_table texture palette to Glide's format.
- */
-static void
-convertPalette(FxU32 data[256], const struct gl_color_table *table)
-{
- const GLubyte *tableUB = (const GLubyte *) table->Table;
- GLint width = table->Size;
- FxU32 r, g, b, a;
- GLint i;
-
- ASSERT(table->TableType == GL_UNSIGNED_BYTE);
-
- switch (table->Format) {
- case GL_INTENSITY:
- for (i = 0; i < width; i++) {
- r = tableUB[i];
- g = tableUB[i];
- b = tableUB[i];
- a = tableUB[i];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- case GL_LUMINANCE:
- for (i = 0; i < width; i++) {
- r = tableUB[i];
- g = tableUB[i];
- b = tableUB[i];
- a = 255;
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- case GL_ALPHA:
- for (i = 0; i < width; i++) {
- r = g = b = 255;
- a = tableUB[i];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- case GL_LUMINANCE_ALPHA:
- for (i = 0; i < width; i++) {
- r = g = b = tableUB[i * 2 + 0];
- a = tableUB[i * 2 + 1];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- case GL_RGB:
- for (i = 0; i < width; i++) {
- r = tableUB[i * 3 + 0];
- g = tableUB[i * 3 + 1];
- b = tableUB[i * 3 + 2];
- a = 255;
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- case GL_RGBA:
- for (i = 0; i < width; i++) {
- r = tableUB[i * 4 + 0];
- g = tableUB[i * 4 + 1];
- b = tableUB[i * 4 + 2];
- a = tableUB[i * 4 + 3];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- break;
- }
-}
-
-
-
-void
-tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (tObj) {
- /* per-texture palette */
- tdfxTexInfo *ti;
-
- /* This might be a proxy texture. */
- if (!tObj->Palette.Table)
- return;
-
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = TDFX_TEXTURE_DATA(tObj);
- convertPalette(ti->palette.data, &tObj->Palette);
- /*tdfxTexInvalidate(ctx, tObj);*/
- }
- else {
- /* global texture palette */
- convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX too heavy-handed */
-}
-
-
-/**********************************************************************/
-/**** NEW TEXTURE IMAGE FUNCTIONS ****/
-/**********************************************************************/
-
-#if 000
-static FxBool TexusFatalError = FXFALSE;
-static FxBool TexusError = FXFALSE;
-
-#define TX_DITHER_NONE 0x00000000
-
-static void
-fxTexusError(const char *string, FxBool fatal)
-{
- _mesa_problem(NULL, string);
- /*
- * Just propagate the fatal value up.
- */
- TexusError = FXTRUE;
- TexusFatalError = fatal;
-}
-#endif
-
-
-const struct gl_texture_format *
-tdfxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum srcFormat, GLenum srcType )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa);
-
- switch (internalFormat) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_i8;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return &_mesa_texformat_rgb565;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
- break;
- case GL_RGBA2:
- case GL_RGBA4:
- return &_mesa_texformat_argb4444;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return allow32bpt ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
- default:
- _mesa_problem(ctx, "unexpected format in tdfxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-
-/*
- * Return the Glide format for the given mesa texture format.
- */
-static GrTextureFormat_t
-fxGlideFormat(GLint mesaFormat)
-{
- switch (mesaFormat) {
- case MESA_FORMAT_I8:
- return GR_TEXFMT_ALPHA_8;
- case MESA_FORMAT_A8:
- return GR_TEXFMT_ALPHA_8;
- case MESA_FORMAT_L8:
- return GR_TEXFMT_INTENSITY_8;
- case MESA_FORMAT_CI8:
- return GR_TEXFMT_P_8;
- case MESA_FORMAT_AL88:
- return GR_TEXFMT_ALPHA_INTENSITY_88;
- case MESA_FORMAT_RGB565:
- return GR_TEXFMT_RGB_565;
- case MESA_FORMAT_ARGB4444:
- return GR_TEXFMT_ARGB_4444;
- case MESA_FORMAT_ARGB1555:
- return GR_TEXFMT_ARGB_1555;
- case MESA_FORMAT_ARGB8888:
- return GR_TEXFMT_ARGB_8888;
- default:
- _mesa_problem(NULL, "Unexpected format in fxGlideFormat");
- return 0;
- }
-}
-
-
-/* Texel-fetch functions for software texturing and glGetTexImage().
- * We should have been able to use some "standard" fetch functions (which
- * may get defined in texutil.c) but we have to account for scaled texture
- * images on tdfx hardware (the 8:1 aspect ratio limit).
- * Hence, we need special functions here.
- */
-
-static void
-fetch_intensity8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = *texel;
- rgba[GCOMP] = *texel;
- rgba[BCOMP] = *texel;
- rgba[ACOMP] = *texel;
-}
-
-
-static void
-fetch_luminance8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = *texel;
- rgba[GCOMP] = *texel;
- rgba[BCOMP] = *texel;
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
- i = i * mml->width / texImage->Width;
- j = j * mml->height / texImage->Height;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = 255;
- rgba[GCOMP] = 255;
- rgba[BCOMP] = 255;
- rgba[ACOMP] = *texel;
-}
-
-
-static void
-fetch_index8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- (void) mml;
- /* XXX todo */
-}
-
-
-static void
-fetch_luminance8_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + (j * mml->width + i) * 2;
- rgba[RCOMP] = texel[0];
- rgba[GCOMP] = texel[0];
- rgba[BCOMP] = texel[0];
- rgba[ACOMP] = texel[1];
-}
-
-
-static void
-fetch_r5g6b5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 5) & 0x3f) * 255 / 63;
- rgba[BCOMP] = (((*texel) >> 0) & 0x1f) * 255 / 31;
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_r4g4b4a4(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 12) & 0xf) * 255 / 15;
- rgba[GCOMP] = (((*texel) >> 8) & 0xf) * 255 / 15;
- rgba[BCOMP] = (((*texel) >> 4) & 0xf) * 255 / 15;
- rgba[ACOMP] = (((*texel) >> 0) & 0xf) * 255 / 15;
-}
-
-
-static void
-fetch_r5g5b5a1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 6) & 0x1f) * 255 / 31;
- rgba[BCOMP] = (((*texel) >> 1) & 0x1f) * 255 / 31;
- rgba[ACOMP] = (((*texel) >> 0) & 0x01) * 255;
-}
-
-
-static void
-fetch_a8r8g8b8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
-{
- GLchan *rgba = (GLchan *) texelOut;
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLuint *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLuint *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 16) & 0xff);
- rgba[GCOMP] = (((*texel) >> 8) & 0xff);
- rgba[BCOMP] = (((*texel) ) & 0xff);
- rgba[ACOMP] = (((*texel) >> 24) & 0xff);
-}
-
-
-static FetchTexelFunc
-fxFetchFunction(GLint mesaFormat)
-{
- switch (mesaFormat) {
- case MESA_FORMAT_I8:
- return fetch_intensity8;
- case MESA_FORMAT_A8:
- return fetch_alpha8;
- case MESA_FORMAT_L8:
- return fetch_luminance8;
- case MESA_FORMAT_CI8:
- return fetch_index8;
- case MESA_FORMAT_AL88:
- return fetch_luminance8_alpha8;
- case MESA_FORMAT_RGB565:
- return fetch_r5g6b5;
- case MESA_FORMAT_ARGB4444:
- return fetch_r4g4b4a4;
- case MESA_FORMAT_ARGB1555:
- return fetch_r5g5b5a1;
- case MESA_FORMAT_ARGB8888:
- return fetch_a8r8g8b8;
- default:
- _mesa_problem(NULL, "Unexpected format in fxFetchFunction");
- printf("%d\n", mesaFormat);
- return NULL;
- }
-}
-
-
-void
-tdfxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint texelBytes;
-
- /*
- printf("TexImage id=%d int 0x%x format 0x%x type 0x%x %dx%d\n",
- texObj->Name, texImage->IntFormat, format, type,
- texImage->Width, texImage->Height);
- */
-
- ti = TDFX_TEXTURE_DATA(texObj);
- if (!ti) {
- texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (!texObj->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- ti = TDFX_TEXTURE_DATA(texObj);
- }
-
- mml = TDFX_TEXIMAGE_DATA(texImage);
- if (!mml) {
- texImage->DriverData = CALLOC(sizeof(tdfxMipMapLevel));
- if (!texImage->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- mml = TDFX_TEXIMAGE_DATA(texImage);
- }
-
- /* Determine width and height scale factors for texture.
- * Remember, Glide is limited to 8:1 aspect ratios.
- */
- tdfxTexGetInfo(ctx,
- texImage->Width, texImage->Height,
- NULL, /* lod level */
- NULL, /* aspect ratio */
- NULL, NULL, /* sscale, tscale */
- &mml->wScale, &mml->hScale);
-
- /* rescaled size: */
- mml->width = width * mml->wScale;
- mml->height = height * mml->hScale;
-
-
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
- assert(texImage->TexFormat);
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
- ti->info.format = mml->glideFormat;
- texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat);
- texelBytes = texImage->TexFormat->TexelBytes;
-
- if (mml->width != width || mml->height != height) {
- /* rescale the image to overcome 1:8 aspect limitation */
- GLvoid *tempImage;
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- /* unpack image, apply transfer ops and store in tempImage */
- _mesa_transfer_teximage(ctx, 2, texImage->Format,
- texImage->TexFormat,
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, /* dstImageStride */
- format, type, pixels, packing);
- assert(!texImage->Data);
- texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- FREE(tempImage);
- return;
- }
- _mesa_rescale_teximage2d(texelBytes,
- mml->width * texelBytes, /* dst stride */
- width, height,
- mml->width, mml->height,
- tempImage /*src*/, texImage->Data /*dst*/ );
- FREE(tempImage);
- }
- else {
- /* no rescaling needed */
- assert(!texImage->Data);
- texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- /* unpack image, apply transfer ops and store in texImage->Data */
- _mesa_transfer_teximage(ctx, 2, texImage->Format,
- texImage->TexFormat, texImage->Data,
- width, height, 1, 0, 0, 0,
- texImage->Width * texelBytes,
- 0, /* dstImageStride */
- format, type, pixels, packing);
- }
-
- RevalidateTexture(ctx, texObj);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-void
-tdfxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint texelBytes;
-
- if (!texObj->DriverData) {
- _mesa_problem(ctx, "problem in fxDDTexSubImage2D");
- return;
- }
-
- ti = TDFX_TEXTURE_DATA(texObj);
- assert(ti);
- mml = TDFX_TEXIMAGE_DATA(texImage);
- assert(mml);
-
- assert(texImage->Data); /* must have an existing texture image! */
- assert(texImage->Format);
-
- texelBytes = texImage->TexFormat->TexelBytes;
-
- if (mml->wScale != 1 || mml->hScale != 1) {
- /* need to rescale subimage to match mipmap level's rescale factors */
- const GLint newWidth = width * mml->wScale;
- const GLint newHeight = height * mml->hScale;
- GLvoid *scaledImage, *tempImage;
- GLubyte *destAddr;
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
-
- _mesa_transfer_teximage(ctx, 2, texImage->Format,/* Tex int format */
- texImage->TexFormat, /* dest format */
- (GLubyte *) tempImage, /* dest */
- width, height, 1, /* subimage size */
- 0, 0, 0, /* subimage pos */
- width * texelBytes, /* dest row stride */
- 0, /* dst image stride */
- format, type, pixels, packing);
-
- /* now rescale */
- scaledImage = MALLOC(newWidth * newHeight * texelBytes);
- if (!scaledImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- FREE(tempImage);
- return;
- }
-
- /* compute address of dest subimage within the overal tex image */
- destAddr = (GLubyte *) texImage->Data
- + (yoffset * mml->hScale * mml->width
- + xoffset * mml->wScale) * texelBytes;
-
- _mesa_rescale_teximage2d(texelBytes,
- mml->width * texelBytes, /* dst stride */
- width, height,
- newWidth, newHeight,
- tempImage, destAddr);
-
- FREE(tempImage);
- FREE(scaledImage);
- }
- else {
- /* no rescaling needed */
- _mesa_transfer_teximage(ctx, 2, texImage->Format, /* Tex int format */
- texImage->TexFormat, /* dest format */
- (GLubyte *) texImage->Data,/* dest */
- width, height, 1, /* subimage size */
- xoffset, yoffset, 0, /* subimage pos */
- mml->width * texelBytes, /* dest row stride */
- 0, /* dst image stride */
- format, type, pixels, packing);
- }
-
- ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */
- fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX this might be a bit much */
-}
-
-
-
-/**********************************************************************/
-/**** COMPRESSED TEXTURE IMAGE FUNCTIONS ****/
-/**********************************************************************/
-
-#if 0000
-GLboolean
-tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target,
- GLint level, GLsizei imageSize,
- const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
- GLboolean *retainInternalCopy)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa);
- GrTextureFormat_t gldformat;
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint dstWidth, dstHeight, wScale, hScale, texelSize;
- MesaIntTexFormat intFormat;
- GLboolean isCompressedFormat;
- GLsizei texSize;
-
- if (target != GL_TEXTURE_2D || texImage->Border > 0)
- return GL_FALSE;
-
- if (!texObj->DriverData)
- texObj->DriverData = fxAllocTexObjData(fxMesa);
-
- ti = TDFX_TEXTURE_DATA(texObj);
- mml = &ti->mipmapLevel[level];
-
- isCompressedFormat = tdfxDDIsCompressedGlideFormatMacro(texImage->IntFormat);
- if (!isCompressedFormat) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(format)");
- return GL_FALSE;
- }
- /* Determine the apporpriate GL internal texel format, Mesa internal
- * texel format, and texelSize (bytes) given the user's internal
- * texture format hint.
- */
- tdfxTexGetFormat(texImage->IntFormat, allow32bpt,
- &gldformat, &intFormat, &texelSize);
-
- /* Determine width and height scale factors for texture.
- * Remember, Glide is limited to 8:1 aspect ratios.
- */
- tdfxTexGetInfo(ctx,
- texImage->Width, texImage->Height,
- NULL, /* lod level */
- NULL, /* aspect ratio */
- NULL, NULL, /* sscale, tscale */
- &wScale, &hScale);
- dstWidth = texImage->Width * wScale;
- dstHeight = texImage->Height * hScale;
- /* housekeeping */
- _mesa_set_teximage_component_sizes(intFormat, texImage);
-
- texSize = tdfxDDCompressedImageSize(ctx,
- texImage->IntFormat,
- 2,
- texImage->Width,
- texImage->Height,
- 1);
- if (texSize != imageSize) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage2D(texSize)");
- return GL_FALSE;
- }
-
- /* allocate new storage for texture image, if needed */
- if (!mml->data || mml->glideFormat != gldformat ||
- mml->width != dstWidth || mml->height != dstHeight ||
- texSize != mml->dataSize) {
- if (mml->data) {
- FREE(mml->data);
- }
- mml->data = MALLOC(texSize);
- if (!mml->data) {
- return GL_FALSE;
- }
- mml->texelSize = texelSize;
- mml->glideFormat = gldformat;
- mml->width = dstWidth;
- mml->height = dstHeight;
- tdfxTMMoveOutTM(fxMesa, texObj);
- /*tdfxTexInvalidate(ctx, texObj);*/
- }
-
- /* save the texture data */
- MEMCPY(mml->data, data, imageSize);
-
- RevalidateTexture(ctx, texObj);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-
- *retainInternalCopy = GL_FALSE;
- return GL_TRUE;
-}
-
-GLboolean
-tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target,
- GLint level, GLint xoffset,
- GLint yoffset, GLsizei width,
- GLint height, GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
-
- /*
- * We punt if we are not replacing the entire image. This
- * is allowed by the spec.
- */
- if ((xoffset != 0) && (yoffset != 0)
- && (width != texImage->Width)
- && (height != texImage->Height)) {
- return GL_FALSE;
- }
-
- ti = TDFX_TEXTURE_DATA(texObj);
- mml = &ti->mipmapLevel[level];
- if (imageSize != mml->dataSize) {
- return GL_FALSE;
- }
- MEMCPY(data, mml->data, imageSize);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-
- return GL_TRUE;
-}
-#endif
-
-
-
-#if 0
-static void
-PrintTexture(int w, int h, int c, const GLubyte * data)
-{
- int i, j;
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- if (c == 2)
- printf("%02x %02x ", data[0], data[1]);
- else if (c == 3)
- printf("%02x %02x %02x ", data[0], data[1], data[2]);
- data += c;
- }
- printf("\n");
- }
-}
-#endif
-
-
-GLboolean
-tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
-
- switch (target) {
- case GL_PROXY_TEXTURE_1D:
- return GL_TRUE; /* software rendering */
- case GL_PROXY_TEXTURE_2D:
- {
- struct gl_texture_object *tObj;
- tdfxTexInfo *ti;
- int memNeeded;
-
- tObj = ctx->Texture.Proxy2D;
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = TDFX_TEXTURE_DATA(tObj);
-
- /* assign the parameters to test against */
- tObj->Image[level]->Width = width;
- tObj->Image[level]->Height = height;
- tObj->Image[level]->Border = border;
-#if 0
- tObj->Image[level]->IntFormat = internalFormat;
-#endif
- if (level == 0) {
- /* don't use mipmap levels > 0 */
- tObj->MinFilter = tObj->MagFilter = GL_NEAREST;
- }
- else {
- /* test with all mipmap levels */
- tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR;
- tObj->MagFilter = GL_NEAREST;
- }
- RevalidateTexture(ctx, tObj);
-
- /*
- printf("small lodlog2 0x%x\n", ti->info.smallLodLog2);
- printf("large lodlog2 0x%x\n", ti->info.largeLodLog2);
- printf("aspect ratio 0x%x\n", ti->info.aspectRatioLog2);
- printf("glide format 0x%x\n", ti->info.format);
- printf("data %p\n", ti->info.data);
- printf("lodblend %d\n", (int) ti->LODblend);
- */
-
- /* determine where texture will reside */
- if (ti->LODblend && !shared->umaTexMemory) {
- /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- }
- else {
- /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- }
- /*
- printf("Proxy test %d > %d\n", memNeeded, shared->totalTexMem[0]);
- */
- if (memNeeded > shared->totalTexMem[0])
- return GL_FALSE;
- else
- return GL_TRUE;
- }
- case GL_PROXY_TEXTURE_3D:
- return GL_TRUE; /* software rendering */
- default:
- return GL_TRUE; /* never happens, silence compiler */
- }
-}
-
-
-#if 000
-/*
- * This is called from _mesa_GetCompressedTexImage. We just
- * copy out the compressed data.
- */
-void
-tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
- GLint lod, void *image,
- const struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
-
- if (target != GL_TEXTURE_2D)
- return;
-
- if (!texObj->DriverData)
- return;
-
- ti = TDFX_TEXTURE_DATA(texObj);
- mml = &ti->mipmapLevel[lod];
- if (mml->data) {
- MEMCPY(image, mml->data, mml->dataSize);
- }
-}
-#endif
-
-/*
- * Calculate a specific texture format given a generic
- * texture format.
- */
-GLint
-tdfxDDSpecificCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat,
- GLint numDimensions)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (numDimensions != 2) {
- return internalFormat;
- }
- /*
- * If we don't have pointers to the functions, then
- * we drop back to uncompressed format. The logic
- * in Mesa proper handles this for us.
- *
- * This is just to ease the transition to a Glide with
- * the texus2 library.
- */
- if (!fxMesa->Glide.txImgQuantize || !fxMesa->Glide.txImgDequantizeFXT1) {
- return internalFormat;
- }
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_ARB:
- return GL_COMPRESSED_RGB_FXT1_3DFX;
- case GL_COMPRESSED_RGBA_ARB:
- return GL_COMPRESSED_RGBA_FXT1_3DFX;
- }
- return internalFormat;
-}
-
-/*
- * Calculate a specific texture format given a generic
- * texture format.
- */
-GLint
-tdfxDDBaseCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat)
-{
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return GL_RGB;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return GL_RGBA;
- }
- return -1;
-}
-
-/*
- * Tell us if an image is compressed. The real work is done
- * in a macro, but we need to have a function to create a
- * function pointer.
- */
-GLboolean
-tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat)
-{
- return tdfxDDIsCompressedFormatMacro(internalFormat);
-}
-
-
-/*
- * Calculate the image size of a compressed texture.
- *
- * The current compressed format, the FXT1 family, all
- * map 8x32 texel blocks into 128 bits.
- *
- * We return 0 if we can't calculate the size.
- *
- * Glide would report this out to us, but we don't have
- * exactly the right parameters.
- */
-GLsizei
-tdfxDDCompressedImageSize(GLcontext *ctx,
- GLenum intFormat,
- GLuint numDimensions,
- GLuint width,
- GLuint height,
- GLuint depth)
-{
- if (numDimensions != 2) {
- return 0;
- }
- switch (intFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- /*
- * Round height and width to multiples of 4 and 8,
- * divide the resulting product by 32 to get the number
- * of blocks, and multiply by 32 = 128/8 to get the.
- * number of bytes required. That is to say, just
- * return the product. Remember that we are returning
- * bytes, not texels, so we have shrunk the texture
- * by a factor of the texel size.
- */
- width = (width + 0x7) &~ 0x7;
- height = (height + 0x3) &~ 0x3;
- return width * height;
- }
- return 0;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h
deleted file mode 100644
index 5fc7c740b..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef _TDFX_TEX_H_
-#define _TDFX_TEX_H_
-
-
-#include "texutil.h"
-
-
-#define tdfxDDIsCompressedFormatMacro(internalFormat) \
- (((internalFormat) == GL_COMPRESSED_RGB_FXT1_3DFX) || \
- ((internalFormat) == GL_COMPRESSED_RGBA_FXT1_3DFX))
-#define tdfxDDIsCompressedGlideFormatMacro(internalFormat) \
- ((internalFormat) == GR_TEXFMT_ARGB_CMP_FXT1)
-
-
-
-extern void
-tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj);
-
-extern void
-tdfxDDBindTexture(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj);
-
-extern void
-tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj);
-
-extern GLboolean
-tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj);
-
-extern void
-tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj);
-
-#if 000 /* DEAD? */
-extern void
-fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state);
-#endif
-
-extern void
-tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
- const GLfloat * param);
-
-extern void
-tdfxDDTexParameter(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat * params);
-
-extern const struct gl_texture_format *
-tdfxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum srcFormat, GLenum srcType );
-
-extern void
-tdfxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width, GLint height,
- GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib * packing,
- struct gl_texture_object * texObj,
- struct gl_texture_image * texImage);
-
-extern void
-tdfxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
-
-#if 000
-extern GLboolean
-tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target,
- GLint level, GLsizei imageSize,
- const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
- GLboolean *retainInternalCopy);
-
-extern GLboolean
-tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target,
- GLint level, GLint xoffset,
- GLint yoffset, GLsizei width,
- GLint height, GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
-#endif
-
-extern GLboolean
-tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border);
-
-extern GLvoid *
-tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level,
- const struct gl_texture_object *texObj,
- GLenum * formatOut, GLenum * typeOut,
- GLboolean * freeImageOut);
-
-extern void
-tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
- GLint lod, void *image,
- const struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
-
-extern GLint
-tdfxDDSpecificCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat,
- GLint numDimensions);
-
-extern GLint
-tdfxDDBaseCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat);
-
-extern GLboolean
-tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat);
-
-extern GLsizei
-tdfxDDCompressedImageSize(GLcontext *ctx,
- GLenum intFormat,
- GLuint numDimensions,
- GLuint width,
- GLuint height,
- GLuint depth);
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
deleted file mode 100644
index b34779c21..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v 1.5 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-
-
-#define BAD_ADDRESS ((FxU32) -1)
-
-
-#if 0 /* DEBUG use */
-/*
- * Verify the consistancy of the texture memory manager.
- * This involves:
- * Traversing all texture objects and computing total memory used.
- * Traverse the free block list and computing total memory free.
- * Compare the total free and total used amounts to the total memory size.
- * Make various assertions about the results.
- */
-static void
-VerifyFreeList(tdfxContextPtr fxMesa, FxU32 tmu)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *block;
- int prevStart = -1, prevEnd = -1;
- int totalFree = 0;
- int numObj = 0, numRes = 0;
- int totalUsed = 0;
-
- for (block = shared->tmFree[tmu]; block; block = block->next) {
- assert( block->endAddr > 0 );
- assert( block->startAddr <= shared->totalTexMem[tmu] );
- assert( block->endAddr <= shared->totalTexMem[tmu] );
- assert( (int) block->startAddr > prevStart );
- assert( (int) block->startAddr >= prevEnd );
- prevStart = (int) block->startAddr;
- prevEnd = (int) block->endAddr;
- totalFree += (block->endAddr - block->startAddr);
- }
- assert(totalFree == shared->freeTexMem[tmu]);
-
- {
- struct gl_texture_object *obj;
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(obj);
- numObj++;
- if (ti) {
- if (ti->isInTM) {
- numRes++;
- assert(ti->tm[0]);
- if (ti->tm[tmu])
- totalUsed += (ti->tm[tmu]->endAddr - ti->tm[tmu]->startAddr);
- }
- else {
- assert(!ti->tm[0]);
- }
- }
- }
- }
-
- printf("totalFree: %d totalUsed: %d totalMem: %d #objs=%d #res=%d\n",
- shared->freeTexMem[tmu], totalUsed, shared->totalTexMem[tmu],
- numObj, numRes);
-
- assert(totalUsed + totalFree == shared->totalTexMem[tmu]);
-}
-
-
-static void
-dump_texmem(tdfxContextPtr fxMesa)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
- tdfxMemRange *r;
- FxU32 prev;
-
- printf("DUMP Objects:\n");
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
- tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
-
- if (info && info->isInTM) {
- printf("Obj %8p: %4d info = %p\n", obj, obj->Name, info);
-
- printf(" isInTM=%d whichTMU=%d lastTimeUsed=%d\n",
- info->isInTM, info->whichTMU, info->lastTimeUsed);
- printf(" tm[0] = %p", info->tm[0]);
- assert(info->tm[0]);
- if (info->tm[0]) {
- printf(" tm startAddr = %d endAddr = %d",
- info->tm[0]->startAddr,
- info->tm[0]->endAddr);
- }
- printf("\n");
- printf(" tm[1] = %p", info->tm[1]);
- if (info->tm[1]) {
- printf(" tm startAddr = %d endAddr = %d",
- info->tm[1]->startAddr,
- info->tm[1]->endAddr);
- }
- printf("\n");
- }
- }
-
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
-
- printf("Free memory unit 0: %d bytes\n", shared->freeTexMem[0]);
- prev = 0;
- for (r = shared->tmFree[0]; r; r = r->next) {
- printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev);
- prev = r->endAddr;
- }
-
- printf("Free memory unit 1: %d bytes\n", shared->freeTexMem[1]);
- prev = 0;
- for (r = shared->tmFree[1]; r; r = r->next) {
- printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev);
- prev = r->endAddr;
- }
-
-}
-#endif
-
-
-
-#ifdef TEXSANITY
-static void
-fubar(void)
-{
-}
-
-/*
- * Sanity Check
- */
-static void
-sanity(tdfxContextPtr fxMesa)
-{
- tdfxMemRange *tmp, *prev, *pos;
-
- prev = 0;
- tmp = fxMesa->tmFree[0];
- while (tmp) {
- if (!tmp->startAddr && !tmp->endAddr) {
- fprintf(stderr, "Textures fubar\n");
- fubar();
- }
- if (tmp->startAddr >= tmp->endAddr) {
- fprintf(stderr, "Node fubar\n");
- fubar();
- }
- if (prev && (prev->startAddr >= tmp->startAddr ||
- prev->endAddr > tmp->startAddr)) {
- fprintf(stderr, "Sorting fubar\n");
- fubar();
- }
- prev = tmp;
- tmp = tmp->next;
- }
- prev = 0;
- tmp = fxMesa->tmFree[1];
- while (tmp) {
- if (!tmp->startAddr && !tmp->endAddr) {
- fprintf(stderr, "Textures fubar\n");
- fubar();
- }
- if (tmp->startAddr >= tmp->endAddr) {
- fprintf(stderr, "Node fubar\n");
- fubar();
- }
- if (prev && (prev->startAddr >= tmp->startAddr ||
- prev->endAddr > tmp->startAddr)) {
- fprintf(stderr, "Sorting fubar\n");
- fubar();
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-#endif
-
-
-
-
-
-/*
- * Allocate and initialize a new MemRange struct.
- * Try to allocate it from the pool of free MemRange nodes rather than malloc.
- */
-static tdfxMemRange *
-NewRangeNode(tdfxContextPtr fxMesa, FxU32 start, FxU32 end)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *result;
-
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- if (shared && shared->tmPool) {
- result = shared->tmPool;
- shared->tmPool = shared->tmPool->next;
- }
- else {
- result = MALLOC(sizeof(tdfxMemRange));
-
- }
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
-
- if (!result) {
- /*fprintf(stderr, "fxDriver: out of memory!\n");*/
- return NULL;
- }
-
- result->startAddr = start;
- result->endAddr = end;
- result->next = NULL;
-
- return result;
-}
-
-
-/*
- * Initialize texture memory.
- * We take care of one or both TMU's here.
- */
-void
-tdfxTMInit(tdfxContextPtr fxMesa)
-{
- if (!fxMesa->glCtx->Shared->DriverData) {
- const char *extensions;
- struct tdfxSharedState *shared = CALLOC_STRUCT(tdfxSharedState);
- if (!shared)
- return;
-
- LOCK_HARDWARE(fxMesa);
- extensions = fxMesa->Glide.grGetString(GR_EXTENSION);
- UNLOCK_HARDWARE(fxMesa);
- if (strstr(extensions, "TEXUMA")) {
- FxU32 start, end;
- shared->umaTexMemory = GL_TRUE;
- LOCK_HARDWARE(fxMesa);
- fxMesa->Glide.grEnable(GR_TEXTURE_UMA_EXT);
- start = fxMesa->Glide.grTexMinAddress(0);
- end = fxMesa->Glide.grTexMaxAddress(0);
- UNLOCK_HARDWARE(fxMesa);
- shared->totalTexMem[0] = end - start;
- shared->totalTexMem[1] = 0;
- shared->freeTexMem[0] = end - start;
- shared->freeTexMem[1] = 0;
- shared->tmFree[0] = NewRangeNode(fxMesa, start, end);
- shared->tmFree[1] = NULL;
- /*printf("UMA tex memory: %d\n", (int) (end - start));*/
- }
- else {
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- shared->umaTexMemory = GL_FALSE;
- LOCK_HARDWARE(fxMesa);
- for (tmu = 0; tmu < numTMUs; tmu++) {
- FxU32 start = fxMesa->Glide.grTexMinAddress(tmu);
- FxU32 end = fxMesa->Glide.grTexMaxAddress(tmu);
- shared->totalTexMem[tmu] = end - start;
- shared->freeTexMem[tmu] = end - start;
- shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end);
- /*printf("Split tex memory: %d\n", (int) (end - start));*/
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-
- shared->tmPool = NULL;
- fxMesa->glCtx->Shared->DriverData = shared;
- /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/
- }
-}
-
-
-/*
- * Clean-up texture memory before destroying context.
- */
-void
-tdfxTMClose(tdfxContextPtr fxMesa)
-{
- if (fxMesa->glCtx->Shared->RefCount == 1 && fxMesa->driDrawable) {
- /* refcount will soon go to zero, free our 3dfx stuff */
- struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
-
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- tdfxMemRange *tmp, *next;
-
- /* Deallocate the pool of free tdfxMemRange nodes */
- tmp = shared->tmPool;
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
-
- /* Delete the texture memory block tdfxMemRange nodes */
- for (tmu = 0; tmu < numTMUs; tmu++) {
- tmp = shared->tmFree[tmu];
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
- }
-
- FREE(shared);
- fxMesa->glCtx->Shared->DriverData = NULL;
- }
-}
-
-
-
-/*
- * Delete a tdfxMemRange struct.
- * We keep a linked list of free/available tdfxMemRange structs to
- * avoid extra malloc/free calls.
- */
-#if 0
-static void
-DeleteRangeNode_NoLock(struct TdfxSharedState *shared, tdfxMemRange *range)
-{
- /* insert at head of list */
- range->next = shared->tmPool;
- shared->tmPool = range;
-}
-#endif
-
-#define DELETE_RANGE_NODE(shared, range) \
- (range)->next = (shared)->tmPool; \
- (shared)->tmPool = (range)
-
-
-
-/*
- * When we've run out of texture memory we have to throw out an
- * existing texture to make room for the new one. This function
- * determins the texture to throw out.
- */
-static struct gl_texture_object *
-FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
-{
- const GLuint bindnumber = fxMesa->texBindNumber;
- struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
- GLfloat lowestPriority;
- GLuint oldestAge;
-
- oldestObj = NULL;
- oldestAge = 0;
-
- lowestPriority = 1.0F;
- lowestPriorityObj = NULL;
-
- for (obj = fxMesa->glCtx->Shared->TexObjectList; obj; obj = obj->Next) {
- tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
-
- if (info && info->isInTM &&
- ((info->whichTMU == tmu) || (info->whichTMU == TDFX_TMU_BOTH) ||
- (info->whichTMU == TDFX_TMU_SPLIT))) {
- GLuint age, lasttime;
-
- assert(info->tm[0]);
- lasttime = info->lastTimeUsed;
-
- if (lasttime > bindnumber)
- age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */
- else
- age = bindnumber - lasttime;
-
- if (age >= oldestAge) {
- oldestAge = age;
- oldestObj = obj;
- }
-
- /* examine priority */
- if (obj->Priority < lowestPriority) {
- lowestPriority = obj->Priority;
- lowestPriorityObj = obj;
- }
- }
- }
-
- if (lowestPriority < 1.0) {
- ASSERT(lowestPriorityObj);
- /*
- printf("discard %d pri=%f\n", lowestPriorityObj->Name, lowestPriority);
- */
- return lowestPriorityObj;
- }
- else {
- /*
- printf("discard %d age=%d\n", oldestObj->Name, oldestAge);
- */
- return oldestObj;
- }
-}
-
-
-#if 0
-static void
-FlushTexMemory(tdfxContextPtr fxMesa)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- struct gl_texture_object *obj;
-
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
- if (obj->RefCount < 2) {
- /* don't flush currently bound textures */
- tdfxTMMoveOutTM_NoLock(fxMesa, obj);
- }
- }
-}
-#endif
-
-
-/*
- * Find the address (offset?) at which we can store a new texture.
- * <tmu> is the texture unit.
- * <size> is the texture size in bytes.
- */
-static FxU32
-FindStartAddr(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 size)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *prev, *block;
- FxU32 result;
-#if 0
- int discardedCount = 0;
-#define MAX_DISCARDS 10
-#endif
-
- if (shared->umaTexMemory) {
- assert(tmu == TDFX_TMU0);
- }
-
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- while (1) {
- prev = NULL;
- block = shared->tmFree[tmu];
- while (block) {
- if (block->endAddr - block->startAddr >= size) {
- /* The texture will fit here */
- result = block->startAddr;
- block->startAddr += size;
- if (block->startAddr == block->endAddr) {
- /* Remove this node since it's empty */
- if (prev) {
- prev->next = block->next;
- }
- else {
- shared->tmFree[tmu] = block->next;
- }
- DELETE_RANGE_NODE(shared, block);
- }
- shared->freeTexMem[tmu] -= size;
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return result;
- }
- prev = block;
- block = block->next;
- }
- /* We failed to find a block large enough to accomodate <size> bytes.
- * Find the oldest texObject and free it.
- */
-#if 0
- discardedCount++;
- if (discardedCount > MAX_DISCARDS + 1) {
- _mesa_problem(NULL, "%s: extreme texmem fragmentation", __FUNCTION__);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
- }
- else if (discardedCount > MAX_DISCARDS) {
- /* texture memory is probably really fragmented, flush it */
- FlushTexMemory(fxMesa);
- }
- else
-#endif
- {
- struct gl_texture_object *obj = FindOldestObject(fxMesa, tmu);
- if (obj) {
- tdfxTMMoveOutTM_NoLock(fxMesa, obj);
- fxMesa->stats.texSwaps++;
- }
- else {
- _mesa_problem(NULL, "%s: extreme texmem fragmentation", __FUNCTION__);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
- }
- }
- }
-
- /* never get here, but play it safe */
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
-}
-
-
-/*
- * Remove the given tdfxMemRange node from hardware texture memory.
- */
-static void
-RemoveRange_NoLock(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *block, *prev;
-
- if (shared->umaTexMemory) {
- assert(tmu == TDFX_TMU0);
- }
-
- if (!range)
- return;
-
- if (range->startAddr == range->endAddr) {
- DELETE_RANGE_NODE(shared, range);
- return;
- }
- shared->freeTexMem[tmu] += range->endAddr - range->startAddr;
-
- /* find position in linked list to insert this tdfxMemRange node */
- prev = NULL;
- block = shared->tmFree[tmu];
- while (block) {
- assert(range->startAddr != block->startAddr);
- if (range->startAddr > block->startAddr) {
- prev = block;
- block = block->next;
- }
- else {
- break;
- }
- }
-
- /* Insert the free block, combine with adjacent blocks when possible */
- range->next = block;
- if (block) {
- if (range->endAddr == block->startAddr) {
- /* Combine */
- block->startAddr = range->startAddr;
- DELETE_RANGE_NODE(shared, range);
- range = block;
- }
- }
- if (prev) {
- if (prev->endAddr == range->startAddr) {
- /* Combine */
- prev->endAddr = range->endAddr;
- prev->next = range->next;
- DELETE_RANGE_NODE(shared, range);
- }
- else {
- prev->next = range;
- }
- }
- else {
- shared->tmFree[tmu] = range;
- }
-}
-
-
-#if 0 /* NOT USED */
-static void
-RemoveRange(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- RemoveRange_NoLock(fxMesa, tmu, range);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
-}
-#endif
-
-
-/*
- * Allocate space for a texture image.
- * <tmu> is the texture unit
- * <texmemsize> is the number of bytes to allocate
- */
-static tdfxMemRange *
-AllocTexMem(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 texmemsize)
-{
- FxU32 startAddr;
- startAddr = FindStartAddr(fxMesa, tmu, texmemsize);
- if (startAddr == BAD_ADDRESS) {
- _mesa_problem(fxMesa->glCtx, "%s returned NULL! tmu=%d texmemsize=%d",
- __FUNCTION__, (int) tmu, (int) texmemsize);
- return NULL;
- }
- else {
- tdfxMemRange *range;
- range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize);
- return range;
- }
-}
-
-
-/*
- * Download (copy) the given texture data (all mipmap levels) into the
- * Voodoo's texture memory.
- * The texture memory must have already been allocated.
- */
-void
-tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti;
- GLint l;
- FxU32 targetTMU;
-
- assert(tObj);
- ti = TDFX_TEXTURE_DATA(tObj);
- assert(ti);
- targetTMU = ti->whichTMU;
-
- switch (targetTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- if (ti->tm[targetTMU]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(targetTMU,
- ti->tm[targetTMU]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[l]->Data);
- }
- }
- break;
- case TDFX_TMU_SPLIT:
- if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[TDFX_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD,
- tObj->Image[l]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[TDFX_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN,
- tObj->Image[l]->Data);
- }
- }
- break;
- case TDFX_TMU_BOTH:
- if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[TDFX_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[l]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[TDFX_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[l]->Data);
- }
- }
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)targetTMU);
- return;
- }
-}
-
-
-void
-tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj,
- GLint level)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- GrLOD_t glideLod;
- FxU32 tmu;
-
- tmu = ti->whichTMU;
- glideLod = ti->info.largeLodLog2 - level + tObj->BaseLevel;
- ASSERT(ti->isInTM);
-
- LOCK_HARDWARE(fxMesa);
-
- switch (tmu) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- fxMesa->Glide.grTexDownloadMipMapLevel(tmu,
- ti->tm[tmu]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[level]->Data);
- break;
- case TDFX_TMU_SPLIT:
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD,
- tObj->Image[level]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN,
- tObj->Image[level]->Data);
- break;
- case TDFX_TMU_BOTH:
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[level]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[level]->Data);
- break;
-
- default:
- _mesa_problem(ctx, "%s: bad tmu (%d)", __FUNCTION__, (int)tmu);
- break;
- }
- UNLOCK_HARDWARE(fxMesa);
-}
-
-
-/*
- * Allocate space for the given texture in texture memory then
- * download (copy) it into that space.
- */
-void
-tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj,
- FxU32 targetTMU )
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- FxU32 texmemsize;
-
- fxMesa->stats.reqTexUpload++;
-
- if (ti->isInTM) {
- if (ti->whichTMU == targetTMU)
- return;
- if (targetTMU == TDFX_TMU_SPLIT || ti->whichTMU == TDFX_TMU_SPLIT) {
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == TDFX_TMU_BOTH)
- return;
- targetTMU = TDFX_TMU_BOTH;
- }
- }
-
- ti->whichTMU = targetTMU;
-
- switch (targetTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize);
- break;
- case TDFX_TMU_SPLIT:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_ODD,
- &(ti->info));
- ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize);
- if (ti->tm[TDFX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_EVEN,
- &(ti->info));
- ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize);
- break;
- case TDFX_TMU_BOTH:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize);
- if (ti->tm[TDFX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize);
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)targetTMU);
- return;
- }
-
- ti->reloadImages = GL_TRUE;
- ti->isInTM = GL_TRUE;
-
- fxMesa->stats.texUpload++;
-}
-
-
-/*
- * Move the given texture out of hardware texture memory.
- * This deallocates the texture's memory space.
- */
-void
-tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj )
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: %s(%p (%d))\n", __FUNCTION__, tObj, tObj->Name);
- }
-
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-
- if (!ti || !ti->isInTM)
- return;
-
- switch (ti->whichTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]);
- break;
- case TDFX_TMU_SPLIT:
- case TDFX_TMU_BOTH:
- assert(!shared->umaTexMemory);
- RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]);
- RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]);
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)ti->whichTMU);
- return;
- }
-
- ti->isInTM = GL_FALSE;
- ti->tm[0] = NULL;
- ti->tm[1] = NULL;
- ti->whichTMU = TDFX_TMU_NONE;
-
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
-
-
-/*
- * Called via glDeleteTexture to delete a texture object.
- */
-void
-tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- if (ti) {
- tdfxTMMoveOutTM(fxMesa, tObj);
- FREE(ti);
- tObj->DriverData = NULL;
- }
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
-
-
-
-/*
- * After a context switch this function will be called to restore
- * texture memory for the new context.
- */
-void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- struct gl_texture_object *tObj;
- int i;
-
- for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) {
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj );
- if ( ti && ti->isInTM ) {
- for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
- if ( ctx->Texture.Unit[i]._Current == tObj ) {
- tdfxTMDownloadTexture( fxMesa, tObj );
- break;
- }
- }
- if ( i == MAX_TEXTURE_UNITS ) {
- tdfxTMMoveOutTM_NoLock( fxMesa, tObj );
- }
- }
- }
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h
deleted file mode 100644
index 739d4e142..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_TEXMAN_H__
-#define __TDFX_TEXMAN_H__
-
-
-#include "tdfx_lock.h"
-
-
-extern void tdfxTMInit( tdfxContextPtr fxMesa );
-
-extern void tdfxTMClose( tdfxContextPtr fxMesa );
-
-extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj);
-
-extern void tdfxTMReloadMipMapLevel( GLcontext *ctx,
- struct gl_texture_object *tObj,
- GLint level );
-
-extern void tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj,
- FxU32 targetTMU );
-
-extern void tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj );
-
-extern void tdfxTMFreeTexture( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj );
-
-extern void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa );
-
-
-#define tdfxTMMoveInTM( fxMesa, tObj, targetTMU ) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- tdfxTMMoveInTM_NoLock( fxMesa, tObj, targetTMU ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-#define tdfxTMMoveOutTM( fxMesa, tObj ) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c
deleted file mode 100644
index e20938bf2..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c
+++ /dev/null
@@ -1,2107 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_state.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-#include "tdfx_texstate.h"
-
-
-/* =============================================================
- * Texture
- */
-
-/*
- * These macros are used below when handling COMBINE_EXT.
- */
-#define TEXENV_OPERAND_INVERTED(operand) \
- (((operand) == GL_ONE_MINUS_SRC_ALPHA) \
- || ((operand) == GL_ONE_MINUS_SRC_COLOR))
-#define TEXENV_OPERAND_ALPHA(operand) \
- (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA))
-#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CALPHA; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITALPHA; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedAlpha; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- }
-
-#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \
- if (!TEXENV_OPERAND_ALPHA(operand)) { \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_RGB; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CCOLOR; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITRGB; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedColor; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- } \
- } else { \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CALPHA; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITALPHA; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedAlpha; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- } \
- }
-
-#define TEXENV_SETUP_MODE_RGB(param, operand) \
- switch (operand) { \
- case GL_SRC_COLOR: \
- case GL_SRC_ALPHA: \
- param = GR_FUNC_MODE_X; \
- break; \
- case GL_ONE_MINUS_SRC_ALPHA: \
- case GL_ONE_MINUS_SRC_COLOR: \
- param = GR_FUNC_MODE_ONE_MINUS_X; \
- break; \
- default: \
- param = GR_FUNC_MODE_ZERO; \
- break; \
- }
-
-#define TEXENV_SETUP_MODE_A(param, operand) \
- switch (operand) { \
- case GL_SRC_ALPHA: \
- param = GR_FUNC_MODE_X; \
- break; \
- case GL_ONE_MINUS_SRC_ALPHA: \
- param = GR_FUNC_MODE_ONE_MINUS_X; \
- break; \
- default: \
- param = GR_FUNC_MODE_ZERO; \
- break; \
- }
-
-
-
-/*
- * Setup a texture environment on Voodoo5.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If we fail, we'll have to use software rendering.
- */
-static GLboolean
-SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
- const struct gl_texture_unit *texUnit, GLenum baseFormat,
- struct tdfx_texcombine_ext *env)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrTCCUColor_t incomingRGB, incomingAlpha;
- const GLenum envMode = texUnit->EnvMode;
-
- if (useIteratedRGBA) {
- incomingRGB = GR_CMBX_ITRGB;
- incomingAlpha = GR_CMBX_ITALPHA;
- }
- else {
- incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB;
- incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA;
- }
-
- /* invariant: */
- env->Color.Shift = 0;
- env->Color.Invert = FXFALSE;
- env->Alpha.Shift = 0;
- env->Alpha.Invert = FXFALSE;
-
- switch (envMode) {
- case GL_REPLACE:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceA = incomingRGB;
- }
- else {
- /* Rv = Rt */
- env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- }
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceD = incomingAlpha;
- }
- else {
- /* Av = At */
- env->Alpha.SourceD = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- }
- env->Alpha.SourceA = GR_CMBX_ITALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_MODULATE:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- }
- else {
- /* Result = Frag * Tex */
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.InvertC = FXFALSE;
- }
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- }
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_DECAL:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_RGB) {
- /* Rv = Rt */
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_X;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- }
- else {
- /* Rv = Rf * (1 - At) + Rt * At */
- env->Color.SourceB = incomingRGB;
- env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Color.InvertC = FXFALSE;
- env->Color.SourceD = GR_CMBX_B;
- env->Color.InvertD = FXFALSE;
- }
- env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- /* -- Setup Alpha combiner */
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_BLEND:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- }
- else {
- /* Rv = Rf * (1 - Rt) + Rc * Rt */
- env->Color.SourceA = GR_CMBX_TMU_CCOLOR;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = incomingRGB;
- env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.InvertC = FXFALSE;
- env->Color.SourceD = GR_CMBX_B;
- env->Color.InvertD = FXFALSE;
- }
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ZERO;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af * (1 - It) + Ac * It */
- env->Alpha.SourceA = GR_CMBX_TMU_CALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = incomingAlpha;
- env->Alpha.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Alpha.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.SourceD = GR_CMBX_B;
- env->Alpha.InvertD = FXFALSE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- }
- /* Also have to set up the tex env constant color */
- env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F,
- texUnit->EnvColor[1] * 255.0F,
- texUnit->EnvColor[2] * 255.0F,
- texUnit->EnvColor[3] * 255.0F);
- break;
- case GL_ADD:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- }
- else {
- /* Rv = Rf + Tt */
- env->Color.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.ModeB = GR_FUNC_MODE_X;
- }
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
-
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af + It */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_X;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- }
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_COMBINE_EXT:
- {
- FxU32 A_RGB, B_RGB, C_RGB, D_RGB;
- FxU32 Amode_RGB, Bmode_RGB;
- FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB;
- FxU32 Shift_RGB;
- FxU32 A_A, B_A, C_A, D_A;
- FxU32 Amode_A, Bmode_A;
- FxBool Cinv_A, Dinv_A, Ginv_A;
- FxU32 Shift_A;
-
- /*
- *
- * In the formulas below, we write:
- * o "1(x)" for the identity function applied to x,
- * so 1(x) = x.
- * o "0(x)" for the constant function 0, so
- * 0(x) = 0 for all values of x.
- *
- * Calculate the color combination.
- */
- Shift_RGB = texUnit->CombineScaleShiftRGB;
- Shift_A = texUnit->CombineScaleShiftA;
- switch (texUnit->CombineModeRGB) {
- case GL_REPLACE:
- /*
- * The formula is: Arg0
- * We implement this by the formula:
- * (Arg0 + 0(0))*(1-0) + 0
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
- B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
- Bmode_RGB = GR_FUNC_MODE_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_MODULATE:
- /*
- * The formula is: Arg0 * Arg1
- *
- * We implement this by the formula
- * (Arg0 + 0(0)) * Arg1 + 0(0)
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
- B_RGB = GR_CMBX_ZERO;
- Bmode_RGB = GR_CMBX_ZERO;
- TEXENV_SETUP_ARG_RGB(C_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
- incomingRGB, incomingAlpha);
- Cinv_RGB = TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1]);
- D_RGB = GR_CMBX_ZERO;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_ADD:
- /*
- * The formula is Arg0 + Arg1
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Bmode_RGB,
- texUnit->CombineOperandRGB[1]);
- C_RGB = D_RGB = GR_CMBX_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_ADD_SIGNED_EXT:
- /*
- * The formula is: Arg0 + Arg1 - 0.5.
- * We compute this by calculating:
- * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
- * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
- * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
- * we cannot implement the formula properly.
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
- incomingRGB, incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) {
- /*
- * A is not inverted. So, choose it.
- */
- Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1])) {
- Bmode_RGB = GR_FUNC_MODE_X;
- }
- else {
- Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- }
- }
- else {
- /*
- * A is inverted, so try to subtract 1/2
- * from B.
- */
- Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1])) {
- Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
- }
- else {
- /*
- * Both are inverted. This is the case
- * we cannot handle properly. We just
- * choose to not add the - 1/2.
- */
- Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- return GL_FALSE;
- }
- }
- C_RGB = D_RGB = GR_CMBX_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_INTERPOLATE_EXT:
- /*
- * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
- * We compute this by the formula:
- * (Arg0 - Arg1) * Arg2 + Arg1
- * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
- * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
- * However, if both Arg1 is ONE_MINUS_X, the HW does
- * not support it properly.
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
- incomingRGB, incomingAlpha);
- if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) {
- /*
- * This case is wrong.
- */
- Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
- return GL_FALSE;
- }
- else {
- Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
- }
- /*
- * The Source/Operand for the C value must
- * specify some kind of alpha value.
- */
- TEXENV_SETUP_ARG_A(C_RGB,
- texUnit->CombineSourceRGB[2],
- texUnit->CombineOperandRGB[2],
- incomingAlpha);
- Cinv_RGB = FXFALSE;
- D_RGB = GR_CMBX_B;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- default:
- /*
- * This is here mostly to keep from getting
- * a compiler warning about these not being set.
- * However, this should set all the texture values
- * to zero.
- */
- A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
- Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X;
- Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- }
- /*
- * Calculate the alpha combination.
- */
- switch (texUnit->CombineModeA) {
- case GL_REPLACE:
- /*
- * The formula is: Arg0
- * We implement this by the formula:
- * (Arg0 + 0(0))*(1-0) + 0
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
- B_A = GR_CMBX_ITALPHA;
- Bmode_A = GR_FUNC_MODE_ZERO;
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_MODULATE:
- /*
- * The formula is: Arg0 * Arg1
- *
- * We implement this by the formula
- * (Arg0 + 0(0)) * Arg1 + 0(0)
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
- B_A = GR_CMBX_ZERO;
- Bmode_A = GR_CMBX_ZERO;
- TEXENV_SETUP_ARG_A(C_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
- incomingAlpha);
- Cinv_A = TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1]);
- D_A = GR_CMBX_ZERO;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_ADD:
- /*
- * The formula is Arg0 + Arg1
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Bmode_A,
- texUnit->CombineOperandA[1]);
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_ADD_SIGNED_EXT:
- /*
- * The formula is: Arg0 + Arg1 - 0.5.
- * We compute this by calculating:
- * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
- * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
- * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
- * we cannot implement the formula properly.
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
- incomingAlpha);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
- incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) {
- /*
- * A is not inverted. So, choose it.
- */
- Amode_A = GR_FUNC_MODE_X_MINUS_HALF;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1])) {
- Bmode_A = GR_FUNC_MODE_X;
- } else {
- Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
- }
- } else {
- /*
- * A is inverted, so try to subtract 1/2
- * from B.
- */
- Amode_A = GR_FUNC_MODE_ONE_MINUS_X;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1])) {
- Bmode_A = GR_FUNC_MODE_X_MINUS_HALF;
- } else {
- /*
- * Both are inverted. This is the case
- * we cannot handle properly. We just
- * choose to not add the - 1/2.
- */
- Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
- return GL_FALSE;
- }
- }
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_INTERPOLATE_EXT:
- /*
- * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
- * We compute this by the formula:
- * (Arg0 - Arg1) * Arg2 + Arg1
- * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
- * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
- * However, if both Arg1 is ONE_MINUS_X, the HW does
- * not support it properly.
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
- incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) {
- Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
- }
- else {
- /*
- * This case is wrong.
- */
- Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
- return GL_FALSE;
- }
- /*
- * The Source/Operand for the C value must
- * specify some kind of alpha value.
- */
- TEXENV_SETUP_ARG_A(C_A,
- texUnit->CombineSourceA[2],
- texUnit->CombineOperandA[2],
- incomingAlpha);
- Cinv_A = FXFALSE;
- D_A = GR_CMBX_B;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- default:
- /*
- * This is here mostly to keep from getting
- * a compiler warning about these not being set.
- * However, this should set all the alpha values
- * to one.
- */
- A_A = B_A = C_A = D_A = GR_CMBX_ZERO;
- Amode_A = Bmode_A = GR_FUNC_MODE_X;
- Cinv_A = Dinv_A = FXFALSE;
- Ginv_A = FXTRUE;
- break;
- }
- /*
- * Save the parameters.
- */
- env->Color.SourceA = A_RGB;
- env->Color.ModeA = Amode_RGB;
- env->Color.SourceB = B_RGB;
- env->Color.ModeB = Bmode_RGB;
- env->Color.SourceC = C_RGB;
- env->Color.InvertC = Cinv_RGB;
- env->Color.SourceD = D_RGB;
- env->Color.InvertD = Dinv_RGB;
- env->Color.Shift = Shift_RGB;
- env->Color.Invert = Ginv_RGB;
- env->Alpha.SourceA = A_A;
- env->Alpha.ModeA = Amode_A;
- env->Alpha.SourceB = B_A;
- env->Alpha.ModeB = Bmode_A;
- env->Alpha.SourceC = C_A;
- env->Alpha.InvertC = Cinv_A;
- env->Alpha.SourceD = D_A;
- env->Alpha.InvertD = Dinv_A;
- env->Alpha.Shift = Shift_A;
- env->Alpha.Invert = Ginv_A;
- env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F,
- texUnit->EnvColor[1] * 255.0F,
- texUnit->EnvColor[2] * 255.0F,
- texUnit->EnvColor[3] * 255.0F);
- }
- break;
-
- default:
- _mesa_problem(ctx, "%s: Bad envMode", __FUNCTION__);
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
-
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_TEXTURE_RGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X,
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_TEXTURE_ALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- return GL_TRUE; /* success */
-}
-
-
-
-/*
- * Setup the Voodoo3 texture environment for a single texture unit.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If failure, we'll use software rendering.
- */
-static GLboolean
-SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit,
- GLenum envMode, GLenum baseFormat)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCombineLocal_t localc, locala;
- struct tdfx_combine alphaComb, colorComb;
-
- if (1 /*iteratedRGBA*/)
- localc = locala = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = locala = GR_COMBINE_LOCAL_CONSTANT;
-
- switch (envMode) {
- case GL_DECAL:
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- break;
- case GL_MODULATE:
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- case GL_BLEND:
- /*
- * XXX we can't do real GL_BLEND mode. These settings assume that
- * the TexEnv color is black and incoming fragment color is white.
- */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af * (1 - It) + Ac * It */
- /* XXX this is wrong */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else {
- /* Av = Af * At */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXTRUE;
- }
- /* XXX return GL_FALSE for modes we don't support */
- break;
-
- case GL_REPLACE:
- if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) {
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else {
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- case GL_ADD:
- if (baseFormat == GL_ALPHA ||
- baseFormat == GL_LUMINANCE_ALPHA ||
- baseFormat == GL_RGBA) {
- /* product of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* fragment alpha is unchanged */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else {
- ASSERT(baseFormat == GL_INTENSITY);
- /* sum of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- /* rgb unchanged */
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- /* sum of texel and fragment rgb */
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- default:
- _mesa_problem(ctx, "bad texture env mode in %s", __FUNCTION__);
- }
-
- if (colorComb.Function != fxMesa->ColorCombine.Function ||
- colorComb.Factor != fxMesa->ColorCombine.Factor ||
- colorComb.Local != fxMesa->ColorCombine.Local ||
- colorComb.Other != fxMesa->ColorCombine.Other ||
- colorComb.Invert != fxMesa->ColorCombine.Invert) {
- fxMesa->ColorCombine = colorComb;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- }
-
- if (alphaComb.Function != fxMesa->AlphaCombine.Function ||
- alphaComb.Factor != fxMesa->AlphaCombine.Factor ||
- alphaComb.Local != fxMesa->AlphaCombine.Local ||
- alphaComb.Other != fxMesa->AlphaCombine.Other ||
- alphaComb.Invert != fxMesa->AlphaCombine.Invert) {
- fxMesa->AlphaCombine = alphaComb;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- }
- return GL_TRUE;
-}
-
-
-/*
- * Setup the Voodoo3 texture environment for dual texture units.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If failure, we'll use software rendering.
- */
-static GLboolean
-SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0,
- GLenum envMode0, GLenum baseFormat0,
- GLenum envMode1, GLenum baseFormat1)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GrCombineLocal_t locala = GR_COMBINE_LOCAL_ITERATED;
- const GrCombineLocal_t localc = GR_COMBINE_LOCAL_ITERATED;
- const int tmu1 = 1 - tmu0;
-
- if (envMode0 == GL_MODULATE && envMode1 == GL_MODULATE) {
- GLboolean isalpha[TDFX_NUM_TMU];
-
- if (baseFormat0 == GL_ALPHA)
- isalpha[tmu0] = GL_TRUE;
- else
- isalpha[tmu0] = GL_FALSE;
-
- if (baseFormat1 == GL_ALPHA)
- isalpha[tmu1] = GL_TRUE;
- else
- isalpha[tmu1] = GL_FALSE;
-
- if (isalpha[TDFX_TMU1]) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- if (isalpha[TDFX_TMU0]) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode0 == GL_REPLACE && envMode1 == GL_BLEND) { /* Quake */
- if (tmu1 == TDFX_TMU1) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode0 == GL_REPLACE && envMode1 == GL_MODULATE) {
- /* Quake 2/3 */
- if (tmu1 == TDFX_TMU1) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXTRUE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
-
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- if (baseFormat0 == GL_RGB) {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- }
- else if (envMode0 == GL_MODULATE && envMode1 == GL_ADD) {
- /* Quake 3 sky */
- GLboolean isalpha[TDFX_NUM_TMU];
- if (baseFormat0 == GL_ALPHA)
- isalpha[tmu0] = GL_TRUE;
- else
- isalpha[tmu0] = GL_FALSE;
- if (baseFormat1 == GL_ALPHA)
- isalpha[tmu1] = GL_TRUE;
- else
- isalpha[tmu1] = GL_FALSE;
-
- if (isalpha[TDFX_TMU1]) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- if (isalpha[TDFX_TMU0]) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else {
- /*_mesa_problem(ctx, "%s: Unexpected dual texture mode encountered", __FUNCTION__);*/
- return GL_FALSE;
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- return GL_TRUE;
-}
-
-
-/*
- * This function makes sure that the correct mipmap levels are loaded
- * in the right places in memory and then makes the Glide calls to
- * setup the texture source pointers.
- */
-static void
-setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- const GLcontext *ctx = fxMesa->glCtx;
-
- /* Make sure we're not loaded incorrectly */
- if (ti->isInTM && !shared->umaTexMemory) {
- /* if doing filtering between mipmap levels, alternate mipmap levels
- * must be in alternate TMUs.
- */
- if (ti->LODblend) {
- if (ti->whichTMU != TDFX_TMU_SPLIT)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == TDFX_TMU_SPLIT)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- }
-
- /* Make sure we're loaded correctly */
- if (!ti->isInTM) {
- /* Have to download the texture */
- if (shared->umaTexMemory) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- else {
- /* Voodoo3 (split texture memory) */
- if (ti->LODblend) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU_SPLIT);
- }
- else {
-#if 0
- /* XXX putting textures into the second memory bank when the
- * first bank is full is not working at this time.
- */
- if (fxMesa->haveTwoTMUs) {
- GLint memReq = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- if (shared->freeTexMem[TDFX_TMU0] > memReq) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU1);
- }
- }
- else
-#endif
- {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- }
- }
- }
-
- if (ti->LODblend && ti->whichTMU == TDFX_TMU_SPLIT) {
- /* mipmap levels split between texture banks */
- GLint u;
-
- if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
-
- for (u = 0; u < 2; u++) {
- fxMesa->TexParams[u].sClamp = ti->sClamp;
- fxMesa->TexParams[u].tClamp = ti->tClamp;
- fxMesa->TexParams[u].minFilt = ti->minFilt;
- fxMesa->TexParams[u].magFilt = ti->magFilt;
- fxMesa->TexParams[u].mmMode = ti->mmMode;
- fxMesa->TexParams[u].LODblend = ti->LODblend;
- fxMesa->TexParams[u].LodBias = ctx->Texture.Unit[u].LodBias;
- }
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
-
- fxMesa->TexSource[0].StartAddress = ti->tm[TDFX_TMU0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
- fxMesa->TexSource[0].Info = &(ti->info);
- fxMesa->TexSource[1].StartAddress = ti->tm[TDFX_TMU1]->startAddr;
- fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[1].Info = &(ti->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
- }
- else {
- FxU32 tmu;
-
- if (ti->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti->whichTMU;
-
- if (shared->umaTexMemory) {
- assert(ti->whichTMU == TDFX_TMU0);
- assert(tmu == TDFX_TMU0);
- }
-
- if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
-
- /* KW: The alternative is to do the download to the other tmu. If
- * we get to this point, I think it means we are thrashing the
- * texture memory, so perhaps it's not a good idea.
- */
-
- if (fxMesa->TexParams[tmu].sClamp != ti->sClamp ||
- fxMesa->TexParams[tmu].tClamp != ti->tClamp ||
- fxMesa->TexParams[tmu].minFilt != ti->minFilt ||
- fxMesa->TexParams[tmu].magFilt != ti->magFilt ||
- fxMesa->TexParams[tmu].mmMode != ti->mmMode ||
- fxMesa->TexParams[tmu].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu].LodBias != ctx->Texture.Unit[tmu].LodBias) {
- fxMesa->TexParams[tmu].sClamp = ti->sClamp;
- fxMesa->TexParams[tmu].tClamp = ti->tClamp;
- fxMesa->TexParams[tmu].minFilt = ti->minFilt;
- fxMesa->TexParams[tmu].magFilt = ti->magFilt;
- fxMesa->TexParams[tmu].mmMode = ti->mmMode;
- fxMesa->TexParams[tmu].LODblend = FXFALSE;
- fxMesa->TexParams[tmu].LodBias = ctx->Texture.Unit[tmu].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- /* Glide texture source info */
- fxMesa->TexSource[0].Info = NULL;
- fxMesa->TexSource[1].Info = NULL;
- if (ti->tm[tmu]) {
- fxMesa->TexSource[tmu].StartAddress = ti->tm[tmu]->startAddr;
- fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu].Info = &(ti->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
- }
- }
-
- fxMesa->sScale0 = ti->sScale;
- fxMesa->tScale0 = ti->tScale;
-}
-
-static void
-selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend)
-{
- if (LODblend) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
-
- if (fxMesa->haveTwoTMUs) {
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- int tmu;
-
- if (shared->umaTexMemory)
- tmu = GR_TMU0;
- else
- tmu = GR_TMU1;
-
- fxMesa->TexCombine[tmu].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[tmu].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[tmu].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[tmu].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[tmu].InvertRGB = FXFALSE;
- fxMesa->TexCombine[tmu].InvertAlpha = FXFALSE;
- }
- fxMesa->tmuSrc = TDFX_TMU_SPLIT;
- }
- else {
- if (tmu != TDFX_TMU1) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- if (fxMesa->haveTwoTMUs) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- fxMesa->tmuSrc = TDFX_TMU0;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- fxMesa->tmuSrc = TDFX_TMU1;
- }
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
-}
-
-static void print_state(tdfxContextPtr fxMesa)
-{
- GLcontext *ctx = fxMesa->glCtx;
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D;
- GLenum base0 = tObj0->Image[tObj0->BaseLevel] ? tObj0->Image[tObj0->BaseLevel]->Format : 99;
- GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99;
-
- printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0]._ReallyEnabled,
- fxMesa->TexState.Enabled[0]);
- printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode,
- fxMesa->TexState.EnvMode[0]);
- printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]);
-
-
- printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1]._ReallyEnabled,
- fxMesa->TexState.Enabled[1]);
- printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode,
- fxMesa->TexState.EnvMode[1]);
- printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]);
-}
-
-
-/*
- * When we're only using a single texture unit, we always use the 0th
- * Glide/hardware unit, regardless if it's GL_TEXTURE0_ARB or GL_TEXTURE1_ARB
- * that's enalbed.
- * Input: ctx - the context
- * unit - the OpenGL texture unit to use.
- */
-static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- struct gl_texture_object *tObj;
- int tmu;
- GLenum envMode, baseFormat;
-
- tObj = ctx->Texture.Unit[unit].Current2D;
- if (tObj->Image[tObj->BaseLevel]->Border > 0) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_TRUE);
- return;
- }
-
- setupSingleTMU(fxMesa, tObj);
-
- ti = TDFX_TEXTURE_DATA(tObj);
- if (ti->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti->whichTMU;
-
- if (fxMesa->tmuSrc != tmu) {
- selectSingleTMUSrc(fxMesa, tmu, ti->LODblend);
- }
-
- if (ti->reloadImages)
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES;
-
- /* Check if we really need to update the texenv state */
- envMode = ctx->Texture.Unit[unit].EnvMode;
- baseFormat = tObj->Image[tObj->BaseLevel]->Format;
-
- if (TDFX_IS_NAPALM(fxMesa)) {
- /* see if we really need to update the unit */
- if (fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
- envMode != fxMesa->TexState.EnvMode[0] ||
- envMode == GL_COMBINE_EXT ||
- baseFormat != fxMesa->TexState.TexFormat[0]) {
- struct tdfx_texcombine_ext *otherEnv;
- if (!SetupTexEnvNapalm(ctx, GL_TRUE,
- &ctx->Texture.Unit[unit], baseFormat,
- &fxMesa->TexCombineExt[0])) {
- /* software fallback */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- /* disable other unit */
- otherEnv = &fxMesa->TexCombineExt[1];
- otherEnv->Color.SourceA = GR_CMBX_ZERO;
- otherEnv->Color.ModeA = GR_FUNC_MODE_ZERO;
- otherEnv->Color.SourceB = GR_CMBX_ZERO;
- otherEnv->Color.ModeB = GR_FUNC_MODE_ZERO;
- otherEnv->Color.SourceC = GR_CMBX_ZERO;
- otherEnv->Color.InvertC = FXFALSE;
- otherEnv->Color.SourceD = GR_CMBX_ZERO;
- otherEnv->Color.InvertD = FXFALSE;
- otherEnv->Color.Shift = 0;
- otherEnv->Color.Invert = FXFALSE;
- otherEnv->Alpha.SourceA = GR_CMBX_ITALPHA;
- otherEnv->Alpha.ModeA = GR_FUNC_MODE_ZERO;
- otherEnv->Alpha.SourceB = GR_CMBX_ITALPHA;
- otherEnv->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- otherEnv->Alpha.SourceC = GR_CMBX_ZERO;
- otherEnv->Alpha.InvertC = FXFALSE;
- otherEnv->Alpha.SourceD = GR_CMBX_ZERO;
- otherEnv->Alpha.InvertD = FXFALSE;
- otherEnv->Alpha.Shift = 0;
- otherEnv->Alpha.Invert = FXFALSE;
-
- fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
- fxMesa->TexState.EnvMode[0] = envMode;
- fxMesa->TexState.TexFormat[0] = baseFormat;
- fxMesa->TexState.EnvMode[1] = 0;
- fxMesa->TexState.TexFormat[1] = 0;
- }
- }
- else {
- /* Voodoo3 */
-
- /* see if we really need to update the unit */
- if (fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
- envMode != fxMesa->TexState.EnvMode[0] ||
- envMode == GL_COMBINE_EXT ||
- baseFormat != fxMesa->TexState.TexFormat[0]) {
- if (!SetupSingleTexEnvVoodoo3(ctx, tmu, envMode, baseFormat)) {
- /* software fallback */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
- fxMesa->TexState.EnvMode[0] = envMode;
- fxMesa->TexState.TexFormat[0] = baseFormat;
- fxMesa->TexState.EnvMode[1] = 0;
- fxMesa->TexState.TexFormat[1] = 0;
- }
- }
-}
-
-
-static void
-setupDoubleTMU(tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj0,
- struct gl_texture_object *tObj1)
-{
-#define T0_NOT_IN_TMU 0x01
-#define T1_NOT_IN_TMU 0x02
-#define T0_IN_TMU0 0x04
-#define T1_IN_TMU0 0x08
-#define T0_IN_TMU1 0x10
-#define T1_IN_TMU1 0x20
-
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- const GLcontext *ctx = fxMesa->glCtx;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
- GLuint tstate = 0;
- int tmu0 = 0, tmu1 = 1;
-
- if (shared->umaTexMemory) {
- if (!ti0->isInTM) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0);
- assert(ti0->isInTM);
- }
- if (!ti1->isInTM) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0);
- assert(ti1->isInTM);
- }
- }
- else {
- /* We shouldn't need to do this. There is something wrong with
- multitexturing when the TMUs are swapped. So, we're forcing
- them to always be loaded correctly. !!! */
- if (ti0->whichTMU == TDFX_TMU1)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj0);
- if (ti1->whichTMU == TDFX_TMU0)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj1);
-
- if (ti0->isInTM) {
- switch (ti0->whichTMU) {
- case TDFX_TMU0:
- tstate |= T0_IN_TMU0;
- break;
- case TDFX_TMU1:
- tstate |= T0_IN_TMU1;
- break;
- case TDFX_TMU_BOTH:
- tstate |= T0_IN_TMU0 | T0_IN_TMU1;
- break;
- case TDFX_TMU_SPLIT:
- tstate |= T0_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T0_NOT_IN_TMU;
-
- if (ti1->isInTM) {
- switch (ti1->whichTMU) {
- case TDFX_TMU0:
- tstate |= T1_IN_TMU0;
- break;
- case TDFX_TMU1:
- tstate |= T1_IN_TMU1;
- break;
- case TDFX_TMU_BOTH:
- tstate |= T1_IN_TMU0 | T1_IN_TMU1;
- break;
- case TDFX_TMU_SPLIT:
- tstate |= T1_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T1_NOT_IN_TMU;
-
- /* Move texture maps into TMUs */
-
- if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) ||
- ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) {
- if (tObj0 == tObj1) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU_BOTH);
- }
- else {
- /* Find the minimal way to correct the situation */
- if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) {
- /* We have one in the standard order, setup the other */
- if (tstate & T0_IN_TMU0) {
- /* T0 is in TMU0, put T1 in TMU1 */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0);
- }
- /* tmu0 and tmu1 are setup */
- }
- else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) {
- /* we have one in the reverse order, setup the other */
- if (tstate & T1_IN_TMU0) {
- /* T1 is in TMU0, put T0 in TMU1 */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU1);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0);
- }
- tmu0 = 1;
- tmu1 = 0;
- }
- else { /* Nothing is loaded */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0);
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1);
- /* tmu0 and tmu1 are setup */
- }
- }
- }
- }
-
- ti0->lastTimeUsed = fxMesa->texBindNumber;
- ti1->lastTimeUsed = fxMesa->texBindNumber;
-
-
- if (!ctx->Texture.SharedPalette) {
- if (ti0->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti0->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else if (ti1->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti1->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else {
- fxMesa->TexPalette.Data = NULL;
- }
- }
-
- /*
- * Setup Unit 0
- */
- assert(ti0->isInTM);
- assert(ti0->tm[tmu0]);
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
-
- if (fxMesa->TexParams[tmu0].sClamp != ti0->sClamp ||
- fxMesa->TexParams[tmu0].tClamp != ti0->tClamp ||
- fxMesa->TexParams[tmu0].minFilt != ti0->minFilt ||
- fxMesa->TexParams[tmu0].magFilt != ti0->magFilt ||
- fxMesa->TexParams[tmu0].mmMode != ti0->mmMode ||
- fxMesa->TexParams[tmu0].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu0].LodBias != ctx->Texture.Unit[tmu0].LodBias) {
- fxMesa->TexParams[tmu0].sClamp = ti0->sClamp;
- fxMesa->TexParams[tmu0].tClamp = ti0->tClamp;
- fxMesa->TexParams[tmu0].minFilt = ti0->minFilt;
- fxMesa->TexParams[tmu0].magFilt = ti0->magFilt;
- fxMesa->TexParams[tmu0].mmMode = ti0->mmMode;
- fxMesa->TexParams[tmu0].LODblend = FXFALSE;
- fxMesa->TexParams[tmu0].LodBias = ctx->Texture.Unit[tmu0].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- /*
- * Setup Unit 1
- */
- if (shared->umaTexMemory) {
- ASSERT(ti1->isInTM);
- ASSERT(ti1->tm[0]);
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
- else {
- ASSERT(ti1->isInTM);
- ASSERT(ti1->tm[tmu1]);
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
-
- if (fxMesa->TexParams[tmu1].sClamp != ti1->sClamp ||
- fxMesa->TexParams[tmu1].tClamp != ti1->tClamp ||
- fxMesa->TexParams[tmu1].minFilt != ti1->minFilt ||
- fxMesa->TexParams[tmu1].magFilt != ti1->magFilt ||
- fxMesa->TexParams[tmu1].mmMode != ti1->mmMode ||
- fxMesa->TexParams[tmu1].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu1].LodBias != ctx->Texture.Unit[tmu1].LodBias) {
- fxMesa->TexParams[tmu1].sClamp = ti1->sClamp;
- fxMesa->TexParams[tmu1].tClamp = ti1->tClamp;
- fxMesa->TexParams[tmu1].minFilt = ti1->minFilt;
- fxMesa->TexParams[tmu1].magFilt = ti1->magFilt;
- fxMesa->TexParams[tmu1].mmMode = ti1->mmMode;
- fxMesa->TexParams[tmu1].LODblend = FXFALSE;
- fxMesa->TexParams[tmu1].LodBias = ctx->Texture.Unit[tmu1].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- fxMesa->sScale0 = ti0->sScale;
- fxMesa->tScale0 = ti0->tScale;
- fxMesa->sScale1 = ti1->sScale;
- fxMesa->tScale1 = ti1->tScale;
-
-#undef T0_NOT_IN_TMU
-#undef T1_NOT_IN_TMU
-#undef T0_IN_TMU0
-#undef T1_IN_TMU0
-#undef T0_IN_TMU1
-#undef T1_IN_TMU1
-}
-
-static void setupTextureDoubleTMU(GLcontext * ctx)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
- struct gl_texture_image *baseImage0 = tObj0->Image[tObj0->BaseLevel];
- struct gl_texture_image *baseImage1 = tObj1->Image[tObj1->BaseLevel];
- const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode;
- const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode;
-
- if (baseImage0->Border > 0 || baseImage1->Border > 0) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_TRUE);
- return;
- }
-
- setupDoubleTMU(fxMesa, tObj0, tObj1);
-
- if (ti0->reloadImages || ti1->reloadImages)
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES;
-
- fxMesa->tmuSrc = TDFX_TMU_BOTH;
-
- if (TDFX_IS_NAPALM(fxMesa)) {
- /* Remember, Glide has its texture units numbered in backward
- * order compared to OpenGL.
- */
- GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE;
-
- /* check if we really need to update glide unit 1 */
- if (fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
- envMode0 != fxMesa->TexState.EnvMode[1] ||
- envMode0 == GL_COMBINE_EXT ||
- baseImage0->Format != fxMesa->TexState.TexFormat[1] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) {
- hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0],
- baseImage0->Format, &fxMesa->TexCombineExt[1]);
- fxMesa->TexState.EnvMode[1] = envMode0;
- fxMesa->TexState.TexFormat[1] = baseImage0->Format;
- fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
- }
-
- /* check if we really need to update glide unit 0 */
- if (fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
- envMode1 != fxMesa->TexState.EnvMode[0] ||
- envMode1 == GL_COMBINE_EXT ||
- baseImage1->Format != fxMesa->TexState.TexFormat[0] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) {
- hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1],
- baseImage1->Format, &fxMesa->TexCombineExt[0]);
- fxMesa->TexState.EnvMode[0] = envMode1;
- fxMesa->TexState.TexFormat[0] = baseImage1->Format;
- fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
- }
-
-
- if (!hw1 || !hw2) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- }
- else {
- int unit0, unit1;
- if ((ti0->whichTMU == TDFX_TMU1) || (ti1->whichTMU == TDFX_TMU0))
- unit0 = 1;
- else
- unit0 = 0;
- unit1 = 1 - unit0;
-
- if (fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
- fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
- envMode0 != fxMesa->TexState.EnvMode[unit0] ||
- envMode0 == GL_COMBINE_EXT ||
- envMode1 != fxMesa->TexState.EnvMode[unit1] ||
- envMode1 == GL_COMBINE_EXT ||
- baseImage0->Format != fxMesa->TexState.TexFormat[unit0] ||
- baseImage1->Format != fxMesa->TexState.TexFormat[unit1] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) {
-
- if (!SetupDoubleTexEnvVoodoo3(ctx, unit0,
- ctx->Texture.Unit[0].EnvMode, baseImage0->Format,
- ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
-
- fxMesa->TexState.EnvMode[unit0] = envMode0;
- fxMesa->TexState.TexFormat[unit0] = baseImage0->Format;
- fxMesa->TexState.EnvMode[unit1] = envMode1;
- fxMesa->TexState.TexFormat[unit1] = baseImage1->Format;
- fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
- fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
- }
- }
-}
-
-
-void
-tdfxUpdateTextureState( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_FALSE);
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_FALSE);
-
- if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[1]._ReallyEnabled == 0) {
- LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */
- setupTextureSingleTMU(ctx, 0);
- UNLOCK_HARDWARE( fxMesa );
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
- ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
- LOCK_HARDWARE( fxMesa );
- setupTextureSingleTMU(ctx, 1);
- UNLOCK_HARDWARE( fxMesa );
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
- LOCK_HARDWARE( fxMesa );
- setupTextureDoubleTMU(ctx);
- UNLOCK_HARDWARE( fxMesa );
- }
- else {
- /* disable hardware texturing */
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
- }
- else {
- /* Voodoo 3*/
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
-
- fxMesa->TexState.Enabled[0] = 0;
- fxMesa->TexState.Enabled[1] = 0;
- fxMesa->TexState.EnvMode[0] = 0;
- fxMesa->TexState.EnvMode[1] = 0;
-
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled != 0 ||
- ctx->Texture.Unit[1]._ReallyEnabled != 0) {
- /* software texture (cube map, rect tex, etc */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- }
-}
-
-
-
-/*
- * This is a special case of texture state update.
- * It's used when we've simply bound a new texture to a texture
- * unit and the new texture has the exact same attributes as the
- * previously bound texture.
- * This is very common in Quake3.
- */
-void
-tdfxUpdateTextureBinding( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
-
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
-
- if (ti0) {
- fxMesa->sScale0 = ti0->sScale;
- fxMesa->tScale0 = ti0->tScale;
- if (ti0->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti0->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else if (ti1 && ti1->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT;
- fxMesa->TexPalette.Data = &(ti1->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- }
- if (ti1) {
- fxMesa->sScale1 = ti1->sScale;
- fxMesa->tScale1 = ti1->tScale;
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[0]._ReallyEnabled == 0) {
- /* Only unit 0 2D enabled */
- if (shared->umaTexMemory) {
- fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[0].Info = &(ti0->info);
- }
- else {
- if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) {
- fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
- fxMesa->TexSource[0].Info = &(ti0->info);
- fxMesa->TexSource[1].StartAddress = ti0->tm[TDFX_TMU1]->startAddr;
- fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[1].Info = &(ti0->info);
- }
- else {
- FxU32 tmu;
- if (ti0->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti0->whichTMU;
- fxMesa->TexSource[0].Info = NULL;
- fxMesa->TexSource[1].Info = NULL;
- if (ti0->tm[tmu]) {
- fxMesa->TexSource[tmu].StartAddress = ti0->tm[tmu]->startAddr;
- fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu].Info = &(ti0->info);
- }
- }
- }
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
- ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) {
- /* Only unit 1 2D enabled */
- if (shared->umaTexMemory) {
- fxMesa->TexSource[0].StartAddress = ti1->tm[0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[0].Info = &(ti1->info);
- }
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) {
- /* Both 2D enabled */
- if (shared->umaTexMemory) {
- const FxU32 tmu0 = 0, tmu1 = 1;
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
-
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
- else {
- const FxU32 tmu0 = 0, tmu1 = 1;
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
-
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
- }
-
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h
deleted file mode 100644
index 234ed4439..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h,v 1.1 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_TEXSTATE_H__
-#define __TDFX_TEXSTATE_H__
-
-extern void tdfxUpdateTextureState( GLcontext *ctx );
-extern void tdfxUpdateTextureBinding( GLcontext *ctx );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
deleted file mode 100644
index 7ab25e7b9..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
+++ /dev/null
@@ -1,1258 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c,v 1.4 2002/10/30 12:52:01 alanh Exp $ */
-
-/* Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "tdfx_tris.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_lock.h"
-#include "tdfx_render.h"
-
-
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim );
-static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_triangle( fxMesa, a, b, c ); \
- else \
- fxMesa->Glide.grDrawTriangle( a, b, c ); \
-} while (0) \
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- fxMesa->draw_triangle( fxMesa, a, b, d ); \
- fxMesa->draw_triangle( fxMesa, b, c, d ); \
- } else { \
- fxMesa->Glide.grDrawTriangle( a, b, d ); \
- fxMesa->Glide.grDrawTriangle( b, c, d ); \
- } \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_line( fxMesa, v0, v1 ); \
- else { \
- v0->v.x += LINE_X_OFFSET - TRI_X_OFFSET; \
- v0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
- v1->v.x += LINE_X_OFFSET - TRI_X_OFFSET; \
- v1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
- fxMesa->Glide.grDrawLine( v0, v1 ); \
- v0->v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \
- v0->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \
- v1->v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \
- v1->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \
- } \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_point( fxMesa, v0 ); \
- else { \
- v0->v.x += PNT_X_OFFSET - TRI_X_OFFSET; \
- v0->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; \
- fxMesa->Glide.grDrawPoint( v0 ); \
- v0->v.x -= PNT_X_OFFSET - TRI_X_OFFSET; \
- v0->v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \
- } \
-} while (0)
-
-
-/***********************************************************************
- * Fallback to swrast for basic primitives *
- ***********************************************************************/
-
-/* Build an SWvertex from a hardware vertex.
- *
- * This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->vertexFormat == TDFX_LAYOUT_TINY) {
- dst->win[0] = src->tv.x - fxMesa->x_offset;
- dst->win[1] = src->tv.y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->tv.z;
- dst->win[3] = 1.0;
-
- dst->color[0] = src->tv.color.red;
- dst->color[1] = src->tv.color.green;
- dst->color[2] = src->tv.color.blue;
- dst->color[3] = src->tv.color.alpha;
- }
- else {
- GLfloat w = 1.0 / src->v.rhw;
-
- dst->win[0] = src->v.x - fxMesa->x_offset;
- dst->win[1] = fxMesa->screen_height - fxMesa->y_offset - src->v.y;
- dst->win[2] = src->v.z;
- dst->win[3] = src->v.rhw;
-
- dst->color[0] = src->v.color.red;
- dst->color[1] = src->v.color.green;
- dst->color[2] = src->v.color.blue;
- dst->color[3] = src->v.color.alpha;
-
- if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJECT) {
- dst->texcoord[0][0] = fxMesa->sScale0 * w * src->pv.tu0;
- dst->texcoord[0][1] = fxMesa->tScale0 * w * src->pv.tv0;
- dst->texcoord[0][3] = w * src->pv.tq0;
-
- if (fxMesa->SetupIndex & TDFX_TEX1_BIT) {
- dst->texcoord[1][0] = fxMesa->sScale1 * w * src->pv.tu1;
- dst->texcoord[1][1] = fxMesa->tScale1 * w * src->pv.tv1;
- dst->texcoord[1][3] = w * src->pv.tq1;
- }
- } else if (fxMesa->SetupIndex & TDFX_TEX0_BIT) {
- dst->texcoord[0][0] = fxMesa->sScale0 * w * src->v.tu0;
- dst->texcoord[0][1] = fxMesa->tScale0 * w * src->v.tv0;
- dst->texcoord[0][3] = 1.0;
-
- if (fxMesa->SetupIndex & TDFX_TEX1_BIT) {
- dst->texcoord[1][0] = fxMesa->sScale1 * w * src->v.tu1;
- dst->texcoord[1][1] = fxMesa->tScale1 * w * src->v.tv1;
- dst->texcoord[1][3] = 1.0;
- }
- }
- }
-
- dst->pointSize = ctx->Point._Size;
-}
-
-
-static void
-tdfx_fallback_tri( tdfxContextPtr fxMesa,
- tdfxVertex *v0,
- tdfxVertex *v1,
- tdfxVertex *v2 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[3];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- tdfx_translate_vertex( ctx, v1, &v[1] );
- tdfx_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-tdfx_fallback_line( tdfxContextPtr fxMesa,
- tdfxVertex *v0,
- tdfxVertex *v1 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[2];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- tdfx_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-tdfx_fallback_point( tdfxContextPtr fxMesa,
- tdfxVertex *v0 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[1];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Functions to draw basic primitives *
- ***********************************************************************/
-
-static void tdfx_print_vertex( GLcontext *ctx, const tdfxVertex *v )
-{
- tdfxContextPtr imesa = TDFX_CONTEXT( ctx );
-
- fprintf(stderr, "vertex at %p\n", v);
-
- if (imesa->vertexFormat == TDFX_LAYOUT_TINY) {
- fprintf(stderr, "x %f y %f z %f\n", v->v.x, v->v.y, v->v.z);
- fprintf(stderr, "r %d g %d b %d a %d\n",
- v->tv.color.red,
- v->tv.color.green,
- v->tv.color.blue,
- v->tv.color.alpha);
- }
- else {
- fprintf(stderr, "x %f y %f z %f oow %f\n",
- v->v.x, v->v.y, v->v.z, v->v.rhw);
- fprintf(stderr, "r %d g %d b %d a %d\n",
- v->v.color.red,
- v->v.color.green,
- v->v.color.blue,
- v->v.color.alpha);
- }
-
- fprintf(stderr, "\n");
-}
-
-#define DO_FALLBACK 0
-
-/* Need to do clip loop at each triangle when mixing swrast and hw
- * rendering. These functions are only used when mixed-mode rendering
- * is occurring.
- */
-static void tdfx_draw_quad( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0,
- tdfxVertexPtr v1,
- tdfxVertexPtr v2,
- tdfxVertexPtr v3 )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- QUAD( v0, v1, v2, v3 );
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-static void tdfx_draw_triangle( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0,
- tdfxVertexPtr v1,
- tdfxVertexPtr v2 )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-/* tdfx_print_vertex( fxMesa->glCtx, v0 ); */
-/* tdfx_print_vertex( fxMesa->glCtx, v1 ); */
-/* tdfx_print_vertex( fxMesa->glCtx, v2 ); */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- TRI( v0, v1, v2 );
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-static void tdfx_draw_line( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0,
- tdfxVertexPtr v1 )
-{
- /* No support for wide lines (avoid wide/aa line fallback).
- */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- LINE(v0, v1);
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-static void tdfx_draw_point( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0 )
-{
- /* No support for wide points.
- */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- POINT( v0 );
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-#undef DO_FALLBACK
-
-
-#define TDFX_UNFILLED_BIT 0x1
-#define TDFX_OFFSET_BIT 0x2
-#define TDFX_TWOSIDE_BIT 0x4
-#define TDFX_FLAT_BIT 0x8
-#define TDFX_FALLBACK_BIT 0x10
-#define TDFX_MAX_TRIFUNC 0x20
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[TDFX_MAX_TRIFUNC];
-
-#define DO_FALLBACK (IND & TDFX_FALLBACK_BIT)
-#define DO_OFFSET (IND & TDFX_OFFSET_BIT)
-#define DO_UNFILLED (IND & TDFX_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & TDFX_TWOSIDE_BIT)
-#define DO_FLAT (IND & TDFX_FLAT_BIT)
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_HW_FLATSHADE 0
-#define HAVE_BACK_COLORS 0
-#define VERTEX tdfxVertex
-#define TAB rast_tab
-
-#define TDFX_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (fxMesa->verts + (e<<fxMesa->vertex_stride_shift))
-
-#define VERT_SET_RGBA( v, c ) TDFX_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define LOCAL_VARS(n) \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GLuint coloroffset = (fxMesa->vertexFormat == \
- TDFX_LAYOUT_TINY) ? 3 : 4; \
- GLuint color[n]; \
- (void) color; (void)coloroffset
-
-
-
-/***********************************************************************
- * Functions to draw basic unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (fxMesa->raster_primitive != x) \
- tdfxRasterPrimitive( ctx, x )
-#define RENDER_PRIMITIVE fxMesa->render_primitive
-#define IND TDFX_FALLBACK_BIT
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Functions to draw GL primitives *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT| \
- TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Tdfx doesn't support provoking-vertex flat-shading?
- */
-#define IND (TDFX_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT| \
- TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-
- init_flat();
- init_offset_flat();
- init_twoside_flat();
- init_twoside_offset_flat();
- init_unfilled_flat();
- init_offset_unfilled_flat();
- init_twoside_unfilled_flat();
- init_twoside_offset_unfilled_flat();
- init_fallback_flat();
- init_offset_fallback_flat();
- init_twoside_fallback_flat();
- init_twoside_offset_fallback_flat();
- init_unfilled_fallback_flat();
- init_offset_unfilled_fallback_flat();
- init_twoside_unfilled_fallback_flat();
- init_twoside_offset_unfilled_fallback_flat();
-}
-
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-
-/* Accelerate vertex buffer rendering when renderindex == 0 and
- * there is no clipping.
- */
-
-static void tdfx_render_vb_points( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- int stride = 1<<shift;
- GLubyte *tmp;
- GLint i;
- (void) flags;
-
- /* Adjust point coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x += PNT_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_POINTS, count-start,
- fxVB, stride);
- /* restore point coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x -= PNT_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void tdfx_render_vb_line_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- int stride = 1<<shift;
- GLubyte *tmp;
- GLint i;
- (void) flags;
-
- /* adjust line coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
- fxVB, 1<<shift);
-
- /* restore line coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void tdfx_render_vb_line_loop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- int stride = 1<<shift;
- GLubyte *tmp, *tmp2 = fxVB;
- GLint i;
- GLint j = start;
- (void) flags;
-
- if (!(flags & PRIM_BEGIN)) {
- fxVB += (1 << shift);
- j++;
- }
-
- /* adjust line coords */
- for (i = start, tmp = tmp2; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
- fxVB, 1<<shift);
-
- if (flags & PRIM_END)
- fxMesa->Glide.grDrawLine( fxMesa->verts + ((count - 1)<<shift),
- fxMesa->verts + (start<<shift) );
-
- /* restore line coords */
- for (i = start, tmp = tmp2; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void tdfx_render_vb_lines( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- int stride = 1<<shift;
- GLubyte *tmp;
- GLint i;
- (void) flags;
-
- /* adjust line coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINES, count-start,
- fxVB, 1<<shift);
-
- /* restore line coords */
- for (i = start, tmp = fxVB; i < count; i++, tmp += stride) {
- ((tdfxVertexPtr)tmp)->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- ((tdfxVertexPtr)tmp)->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void tdfx_render_vb_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- (void) flags;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLES, count-start,
- fxVB, 1<<shift);
-}
-
-
-static void tdfx_render_vb_tri_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- int mode;
- (void) flags;
-
-/* fprintf(stderr, "%s/%d\n", __FUNCTION__, 1<<shift); */
-/* if(!prevLockLine) abort(); */
-
- if (flags & PRIM_PARITY)
- mode = GR_TRIANGLE_STRIP_CONTINUE;
- else
- mode = GR_TRIANGLE_STRIP;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( mode, count-start,
- fxVB, 1<<shift);
-}
-
-
-static void tdfx_render_vb_tri_fan( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- (void) flags;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
- fxVB, 1<<shift );
-}
-
-static void tdfx_render_vb_quads( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts;
- GLuint i;
- (void) flags;
-
- for (i = start ; i < count-3 ; i += 4 ) {
-#define VERT(x) (fxVB + ((x)<<shift))
- fxMesa->Glide.grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );
- fxMesa->Glide.grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );
-#undef VERT
- }
-}
-
-static void tdfx_render_vb_quad_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- (void) flags;
-
- count -= (count-start)&1;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,
- count-start, fxVB, 1<<shift);
-}
-
-static void tdfx_render_vb_poly( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint shift = fxMesa->vertex_stride_shift;
- GLubyte *fxVB = fxMesa->verts + (start << shift);
- (void) flags;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_POLYGON, count-start,
- fxVB, 1<<shift);
-}
-
-static void tdfx_render_vb_noop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- (void) (ctx && start && count && flags);
-}
-
-static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
- GLuint,
- GLuint,
- GLuint) =
-{
- tdfx_render_vb_points,
- tdfx_render_vb_lines,
- tdfx_render_vb_line_loop,
- tdfx_render_vb_line_strip,
- tdfx_render_vb_triangles,
- tdfx_render_vb_tri_strip,
- tdfx_render_vb_tri_fan,
- tdfx_render_vb_quads,
- tdfx_render_vb_quad_strip,
- tdfx_render_vb_poly,
- tdfx_render_vb_noop,
-};
-
-
-/**********************************************************************/
-/* Render whole (indexed) begin/end objects */
-/**********************************************************************/
-
-
-#define VERT(x) (tdfxVertex *)(vertptr + ((x)<<vertshift))
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- fxMesa->Glide.grDrawPoint( VERT(ELT(start)) );
-
-#define RENDER_LINE( v0, v1 ) \
- fxMesa->Glide.grDrawLine( VERT(v0), VERT(v1) )
-
-#define RENDER_TRI( v0, v1, v2 ) \
- fxMesa->Glide.grDrawTriangle( VERT(v0), VERT(v1), VERT(v2) )
-
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- tdfx_draw_quad( fxMesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-
-#define INIT(x) tdfxRenderPrimitive( ctx, x )
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)fxMesa->verts; \
- const GLuint vertshift = fxMesa->vertex_stride_shift; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-
-/* Elts, no clipping.
- */
-#undef ELT
-#undef TAG
-#define TAG(x) tdfx_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl_dd/t_dd_rendertmp.h"
-
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = fxMesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void tdfxRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLubyte *vertptr = (GLubyte *)fxMesa->verts;
- const GLuint vertshift = fxMesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i;
-
- for (i = 2 ; i < n ; i++) {
- fxMesa->Glide.grDrawTriangle( VERT(elts[i-1]), VERT(elts[i]), start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \
- DD_TRI_UNFILLED)
-
-
-/* All state referenced below:
- */
-#define _TDFX_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-
-static void tdfxChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (0) {
- fxMesa->draw_point = tdfx_draw_point;
- fxMesa->draw_line = tdfx_draw_line;
- fxMesa->draw_triangle = tdfx_draw_triangle;
- index |= TDFX_FALLBACK_BIT;
- }
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= TDFX_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= TDFX_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= TDFX_UNFILLED_BIT;
- if (flags & DD_FLATSHADE) index |= TDFX_FLAT_BIT;
- }
-
- fxMesa->draw_point = tdfx_draw_point;
- fxMesa->draw_line = tdfx_draw_line;
- fxMesa->draw_triangle = tdfx_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- *
- * DD_TRI_UNFILLED is here because the unfilled_tri functions use
- * fxMesa->draw_tri *always*, and thus can't use the multipass
- * approach to cliprects.
- *
- */
- if (flags & (POINT_FALLBACK|
- LINE_FALLBACK|
- TRI_FALLBACK|
- DD_TRI_STIPPLE|
- DD_TRI_UNFILLED))
- {
- if (flags & POINT_FALLBACK)
- fxMesa->draw_point = tdfx_fallback_point;
-
- if (flags & LINE_FALLBACK)
- fxMesa->draw_line = tdfx_fallback_line;
-
- if (flags & TRI_FALLBACK)
- fxMesa->draw_triangle = tdfx_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !fxMesa->haveHwStipple)
- fxMesa->draw_triangle = tdfx_fallback_tri;
-
- index |= TDFX_FALLBACK_BIT;
- }
- }
-
- if (fxMesa->RenderIndex != index) {
- fxMesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = tdfx_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = tdfx_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = tdfxFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = tdfxRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = tdfxRenderClippedPoly;
- }
- }
-}
-
-/**********************************************************************/
-/* Use multipass rendering for cliprects */
-/**********************************************************************/
-
-
-
-/* TODO: Benchmark this.
- * TODO: Use single back-buffer cliprect where possible.
- * NOTE: <pass> starts at 1, not zero!
- */
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (pass >= fxMesa->numClipRects)
- return GL_FALSE;
- else {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[pass].x1,
- fxMesa->screen_height - fxMesa->pClipRects[pass].y2,
- fxMesa->pClipRects[pass].x2,
- fxMesa->screen_height - fxMesa->pClipRects[pass].y1);
-
- return GL_TRUE;
- }
-}
-
-
-/**********************************************************************/
-/* Runtime render state and callbacks */
-/**********************************************************************/
-
-static void tdfxRunPipeline( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->new_state) {
- tdfxDDUpdateHwState( ctx );
- }
-
- if (!fxMesa->Fallback && fxMesa->new_gl_state) {
- if (fxMesa->new_gl_state & _TDFX_NEW_RASTERSETUP)
- tdfxChooseVertexState( ctx );
-
- if (fxMesa->new_gl_state & _TDFX_NEW_RENDERSTATE)
- tdfxChooseRenderState( ctx );
-
- fxMesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-static void tdfxRenderStart( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- tdfxCheckTexSizes( ctx );
-
- LOCK_HARDWARE(fxMesa);
-
- /* Make sure vertex format changes get uploaded before we start
- * sending triangles.
- */
- if (fxMesa->dirty) {
- tdfxEmitHwStateLocked( fxMesa );
- }
-
- if (fxMesa->numClipRects && !(fxMesa->RenderIndex & TDFX_FALLBACK_BIT)) {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[0].x1,
- fxMesa->screen_height - fxMesa->pClipRects[0].y2,
- fxMesa->pClipRects[0].x2,
- fxMesa->screen_height - fxMesa->pClipRects[0].y1);
- if (fxMesa->numClipRects > 1)
- tnl->Driver.Render.Multipass = multipass_cliprect;
- else
- tnl->Driver.Render.Multipass = NULL;
- }
- else
- tnl->Driver.Render.Multipass = NULL;
-}
-
-
-static GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-
-
-/* Always called between RenderStart and RenderFinish --> We already
- * hold the lock.
- */
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
-
- fxMesa->raster_primitive = prim;
-
- tdfxUpdateCull(ctx);
- if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- fxMesa->Glide.grCullMode( fxMesa->CullMode );
- fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
- }
-
- tdfxUpdateStipple(ctx);
- if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) {
- fxMesa->Glide.grStipplePattern ( fxMesa->Stipple.Pattern );
- fxMesa->Glide.grStippleMode ( fxMesa->Stipple.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
- }
-}
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in tdfx_render.c.
- */
-static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- fxMesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (fxMesa->raster_primitive != rprim) {
- tdfxRasterPrimitive( ctx, rprim );
- }
-}
-
-static void tdfxRenderFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->RenderIndex & TDFX_FALLBACK_BIT)
- _swrast_flush( ctx );
-
- UNLOCK_HARDWARE(fxMesa);
-}
-
-
-/**********************************************************************/
-/* Manage total rasterization fallbacks */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "1D/3D Texture map",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "Separate specular color",
- "glEnable/Disable(GL_STENCIL_TEST)",
- "glRenderMode(selection or feedback)",
- "glLogicOp()",
- "Texture env mode",
- "Texture border",
- "glColorMask",
- "blend mode",
- "line stipple"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint oldfallback = fxMesa->Fallback;
-
- if (mode) {
- fxMesa->Fallback |= bit;
- if (oldfallback == 0) {
- /*printf("Go to software rendering, bit = 0x%x\n", bit);*/
- FLUSH_BATCH(fxMesa);
- _swsetup_Wakeup( ctx );
- fxMesa->RenderIndex = ~0;
- if (fxMesa->debugFallbacks) {
- fprintf(stderr, "Tdfx begin software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- fxMesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- /*printf("Go to hardware rendering, bit = 0x%x\n", bit);*/
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = tdfxRenderStart;
- tnl->Driver.Render.PrimitiveNotify = tdfxRenderPrimitive;
- tnl->Driver.Render.Finish = tdfxRenderFinish;
- tnl->Driver.Render.BuildVertices = tdfxBuildVertices;
- fxMesa->new_gl_state |= (_TDFX_NEW_RENDERSTATE|
- _TDFX_NEW_RASTERSETUP);
- if (fxMesa->debugFallbacks) {
- fprintf(stderr, "Tdfx end software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void tdfxDDInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- fxMesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = tdfxRunPipeline;
- tnl->Driver.Render.Start = tdfxRenderStart;
- tnl->Driver.Render.Finish = tdfxRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = tdfxRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = tdfxBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-
- (void) tdfx_print_vertex;
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h
deleted file mode 100644
index 57e5d9b0a..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h,v 1.5 2002/10/30 12:52:01 alanh Exp $ */
-
-#ifndef TDFX_TRIS_INC
-#define TDFX_TRIS_INC
-
-#include "mtypes.h"
-
-extern void tdfxDDInitTriFuncs( GLcontext *ctx );
-
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c
deleted file mode 100644
index de5b9360e..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c,v 1.3 2002/10/30 12:52:01 alanh Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "math/m_translate.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tdfx_context.h"
-#include "tdfx_vb.h"
-#include "tdfx_tris.h"
-#include "tdfx_state.h"
-#include "tdfx_render.h"
-
-static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLubyte *tdfxverts = (GLubyte *)fxMesa->verts;
- GLuint shift = fxMesa->vertex_stride_shift;
- tdfxVertex *dst = (tdfxVertex *)(tdfxverts + (edst << shift));
- tdfxVertex *src = (tdfxVertex *)(tdfxverts + (esrc << shift));
- dst->ui[4] = src->ui[4];
-}
-
-static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLubyte *tdfxverts = (GLubyte *)fxMesa->verts;
- GLuint shift = fxMesa->vertex_stride_shift;
- tdfxVertex *dst = (tdfxVertex *)(tdfxverts + (edst << shift));
- tdfxVertex *src = (tdfxVertex *)(tdfxverts + (esrc << shift));
- dst->ui[3] = src->ui[3];
-}
-
-typedef void (*emit_func)( GLcontext *, GLuint, GLuint, void *, GLuint );
-
-static struct {
- emit_func emit;
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[TDFX_MAX_SETUP];
-
-
-static void import_float_colors( GLcontext *ctx )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct gl_client_array *from = VB->ColorPtr[0];
- struct gl_client_array *to = &TDFX_CONTEXT(ctx)->UbyteColor;
- GLuint count = VB->Count;
-
- if (!to->Ptr) {
- to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLubyte), 32 );
- to->Type = GL_UNSIGNED_BYTE;
- }
-
- /* No need to transform the same value 3000 times.
- */
- if (!from->StrideB) {
- to->StrideB = 0;
- count = 1;
- }
- else
- to->StrideB = 4 * sizeof(GLubyte);
-
- _math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
- from->Ptr,
- from->StrideB,
- from->Type,
- from->Size,
- 0,
- count);
-
- VB->ColorPtr[0] = to;
-}
-
-
-#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx])
-
-
-static void interp_extras( GLcontext *ctx,
- GLfloat t,
- GLuint dst, GLuint out, GLuint in,
- GLboolean force_boundary )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /*fprintf(stderr, "%s\n", __FUNCTION__);*/
-
- if (VB->ColorPtr[1]) {
- INTERP_4CHAN( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
- }
-
- if (VB->EdgeFlag) {
- VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
- }
-
- setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].interp(ctx, t, dst, out, in,
- force_boundary);
-}
-
-static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (VB->ColorPtr[1]) {
- COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
- }
-
- setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src);
-}
-
-
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tdfx_vbtmp.h"
-
-/* Special for tdfx: fog requires w
- */
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT)
-#define TAG(x) x##_wg_fog
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT|\
- TDFX_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT|TDFX_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tdfx_vbtmp.h"
-
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wg_fog();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgpt0t1();
-
- init_g();
- init_t0();
- init_t0t1();
- init_gt0();
- init_gt0t1();
-}
-
-
-void tdfxPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & TDFX_XYZ_BIT) ? " xyz," : "",
- (flags & TDFX_W_BIT) ? " w," : "",
- (flags & TDFX_RGBA_BIT) ? " rgba," : "",
- (flags & TDFX_TEX0_BIT) ? " tex-0," : "",
- (flags & TDFX_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-
-void tdfxCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- if (!setup_tab[fxMesa->SetupIndex].check_tex_sizes(ctx)) {
- GLuint ind = fxMesa->SetupIndex |= (TDFX_PTEX_BIT|TDFX_RGBA_BIT);
-
- /* Tdfx handles projective textures nicely; just have to change
- * up to the new vertex format.
- */
- if (setup_tab[ind].vertex_format != fxMesa->vertexFormat) {
- FLUSH_BATCH(fxMesa);
- fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT;
- fxMesa->vertexFormat = setup_tab[ind].vertex_format;
- fxMesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
-
- /* This is required as we have just changed the vertex
- * format, so the interp and copy routines must also change.
- * In the unfilled and twosided cases we are using the
- * swrast_setup ones anyway, so leave them in place.
- */
- if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[fxMesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[fxMesa->SetupIndex].copy_pv;
- }
- }
- }
-}
-
-
-void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLubyte *v = (fxMesa->verts + (start<<fxMesa->vertex_stride_shift));
- GLuint stride = 1<<fxMesa->vertex_stride_shift;
-
- newinputs |= fxMesa->SetupNewInputs;
- fxMesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_CLIP) {
- setup_tab[fxMesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= TDFX_RGBA_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= TDFX_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= TDFX_TEX0_BIT|TDFX_TEX1_BIT;
-
- if (fxMesa->SetupIndex & TDFX_PTEX_BIT)
- ind = ~0;
-
- ind &= fxMesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-
-void tdfxChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLuint ind = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= TDFX_W_BIT|TDFX_TEX1_BIT|TDFX_TEX0_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= TDFX_W_BIT|TDFX_TEX0_BIT;
- else if (ctx->Fog.Enabled)
- ind |= TDFX_W_BIT;
-
- fxMesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = interp_extras;
- tnl->Driver.Render.CopyPV = copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != fxMesa->vertexFormat) {
- FLUSH_BATCH(fxMesa);
- fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT;
- fxMesa->vertexFormat = setup_tab[ind].vertex_format;
- fxMesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-
-
-void tdfxInitVB( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
-
- fxMesa->verts = (GLubyte *)ALIGN_MALLOC(size * sizeof(tdfxVertex), 32);
- fxMesa->vertexFormat = setup_tab[TDFX_XYZ_BIT|TDFX_RGBA_BIT].vertex_format;
- fxMesa->vertex_stride_shift = setup_tab[(TDFX_XYZ_BIT|
- TDFX_RGBA_BIT)].vertex_stride_shift;
- fxMesa->SetupIndex = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
-}
-
-
-void tdfxFreeVB( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (fxMesa->verts) {
- ALIGN_FREE(fxMesa->verts);
- fxMesa->verts = 0;
- }
-
- if (fxMesa->UbyteColor.Ptr) {
- ALIGN_FREE(fxMesa->UbyteColor.Ptr);
- fxMesa->UbyteColor.Ptr = 0;
- }
-
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h
deleted file mode 100644
index 7cb90f5a5..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel tdfx
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-#ifndef TDFXVB_INC
-#define TDFXVB_INC
-
-#include "mtypes.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "math/m_xform.h"
-
-#define TDFX_XYZ_BIT 0x1
-#define TDFX_W_BIT 0x2
-#define TDFX_RGBA_BIT 0x4
-#define TDFX_TEX1_BIT 0x8
-#define TDFX_TEX0_BIT 0x10
-#define TDFX_PTEX_BIT 0x20
-#define TDFX_MAX_SETUP 0x40
-
-#define _TDFX_NEW_RASTERSETUP (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void tdfxValidateBuildProjVerts(GLcontext *ctx,
- GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void tdfxPrintSetupFlags(char *msg, GLuint flags );
-
-extern void tdfxInitVB( GLcontext *ctx );
-
-extern void tdfxFreeVB( GLcontext *ctx );
-
-extern void tdfxCheckTexSizes( GLcontext *ctx );
-
-extern void tdfxChooseVertexState( GLcontext *ctx );
-
-extern void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h
deleted file mode 100644
index 9925a10ea..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h
+++ /dev/null
@@ -1,442 +0,0 @@
-
-#if (IND & (TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT))
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest,
- GLuint stride )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*tc0)[4], (*tc1)[4];
- GLubyte (*col)[4];
- GLuint tc0_stride, tc1_stride, col_stride;
- GLuint tc0_size, tc1_size;
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- tdfxVertex *v = (tdfxVertex *)dest;
- GLfloat u0scale,v0scale,u1scale,v1scale;
- const GLubyte *mask = VB->ClipMask;
- const GLfloat *s = fxMesa->hw_viewport;
- int i;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
- ASSERT(stride > 16);
-
-
- if (IND & TDFX_TEX0_BIT) {
- tc0_stride = VB->TexCoordPtr[0]->stride;
- tc0 = VB->TexCoordPtr[0]->data;
- u0scale = fxMesa->sScale0;
- v0scale = fxMesa->tScale0;
- if (IND & TDFX_PTEX_BIT)
- tc0_size = VB->TexCoordPtr[0]->size;
- }
-
- if (IND & TDFX_TEX1_BIT) {
- tc1 = VB->TexCoordPtr[1]->data;
- tc1_stride = VB->TexCoordPtr[1]->stride;
- u1scale = fxMesa->sScale1;
- v1scale = fxMesa->tScale1;
- if (IND & TDFX_PTEX_BIT)
- tc1_size = VB->TexCoordPtr[1]->size;
- }
-
- if (IND & TDFX_RGBA_BIT) {
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- import_float_colors( ctx );
- col = VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
- }
-
- if (VB->importable_data) {
- /* May have nonstandard strides:
- */
- if (start) {
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
- if (IND & TDFX_TEX0_BIT)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (IND & TDFX_TEX1_BIT)
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (IND & TDFX_RGBA_BIT)
- STRIDE_4UB(col, start * col_stride);
- }
-
- for (i=start; i < end; i++, v = (tdfxVertex *)((GLubyte *)v + stride)) {
- if (IND & TDFX_XYZ_BIT) {
- if (mask[i] == 0) {
- /* unclipped */
- v->v.x = s[0] * proj[0][0] + s[12];
- v->v.y = s[5] * proj[0][1] + s[13];
- v->v.z = s[10] * proj[0][2] + s[14];
- v->v.rhw = proj[0][3];
- } else {
- /* clipped */
- v->v.rhw = 1.0;
- }
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
- }
- if (IND & TDFX_RGBA_BIT) {
-#if 0
- *(GLuint *)&v->v.color = *(GLuint *)col;
-#else
- GLubyte *b = (GLubyte *) &v->v.color;
- b[0] = col[0][2];
- b[1] = col[0][1];
- b[2] = col[0][0];
- b[3] = col[0][3];
-
-#endif
- STRIDE_4UB(col, col_stride);
- }
- if (IND & TDFX_TEX0_BIT) {
- GLfloat w = v->v.rhw;
- if (IND & TDFX_PTEX_BIT) {
- v->pv.tu0 = tc0[0][0] * u0scale * w;
- v->pv.tv0 = tc0[0][1] * v0scale * w;
- v->pv.tq0 = w;
- if (tc0_size == 4)
- v->pv.tq0 = tc0[0][3] * w;
- }
- else {
- v->v.tu0 = tc0[0][0] * u0scale * w;
- v->v.tv0 = tc0[0][1] * v0scale * w;
- }
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (IND & TDFX_TEX1_BIT) {
- GLfloat w = v->v.rhw;
- if (IND & TDFX_PTEX_BIT) {
- v->pv.tu1 = tc1[0][0] * u1scale * w;
- v->pv.tv1 = tc1[0][1] * v1scale * w;
- v->pv.tq1 = w;
- if (tc1_size == 4)
- v->pv.tq1 = tc1[0][3] * w;
- }
- else {
- v->v.tu1 = tc1[0][0] * u1scale * w;
- v->v.tv1 = tc1[0][1] * v1scale * w;
- }
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- }
- }
- else {
- for (i=start; i < end; i++, v = (tdfxVertex *)((GLubyte *)v + stride)) {
- if (IND & TDFX_XYZ_BIT) {
- if (mask[i] == 0) {
- v->v.x = s[0] * proj[i][0] + s[12];
- v->v.y = s[5] * proj[i][1] + s[13];
- v->v.z = s[10] * proj[i][2] + s[14];
- v->v.rhw = proj[i][3];
- } else {
- v->v.rhw = 1.0;
- }
- }
- if (IND & TDFX_RGBA_BIT) {
-#if 0
- *(GLuint *)&v->v.color = *(GLuint *)&col[i];
-#else
- GLubyte *b = (GLubyte *) &v->v.color;
- b[0] = col[i][2];
- b[1] = col[i][1];
- b[2] = col[i][0];
- b[3] = col[i][3];
-
-#endif
- }
- if (IND & TDFX_TEX0_BIT) {
- GLfloat w = v->v.rhw;
- if (IND & TDFX_PTEX_BIT) {
- v->pv.tu0 = tc0[i][0] * u0scale * w;
- v->pv.tv0 = tc0[i][1] * v0scale * w;
- v->pv.tq0 = w;
- if (tc0_size == 4)
- v->pv.tq0 = tc0[i][3] * w;
- }
- else {
- v->v.tu0 = tc0[i][0] * u0scale * w;
- v->v.tv0 = tc0[i][1] * v0scale * w;
- }
- }
- if (IND & TDFX_TEX1_BIT) {
- GLfloat w = v->v.rhw;
- if (IND & TDFX_PTEX_BIT) {
- v->pv.tu1 = tc1[i][0] * u1scale * w;
- v->pv.tv1 = tc1[i][1] * v1scale * w;
- v->pv.tq1 = w;
- if (tc1_size == 4)
- v->pv.tq1 = tc1[i][3] * w;
- }
- else {
- v->v.tu1 = tc1[i][0] * u1scale * w;
- v->v.tv1 = tc1[i][1] * v1scale * w;
- }
- }
- }
- }
-}
-#else
-#if (IND & TDFX_XYZ_BIT)
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
- void *dest, GLuint stride )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte (*col)[4];
- GLuint col_stride;
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- GLfloat *v = (GLfloat *)dest;
- const GLubyte *mask = VB->ClipMask;
- const GLfloat *s = fxMesa->hw_viewport;
- int i;
-
-/* fprintf(stderr, "%s %d..%d dest %p stride %d\n", __FUNCTION__, */
-/* start, end, dest, stride); */
-
- ASSERT(fxMesa->SetupIndex == (TDFX_XYZ_BIT|TDFX_RGBA_BIT));
- ASSERT(stride == 16);
-
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- import_float_colors( ctx );
-
- col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
- ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE);
-
- /* Pack what's left into a 4-dword vertex. Color is in a different
- * place, and there is no 'w' coordinate.
- */
- if (VB->importable_data) {
- if (start) {
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
- STRIDE_4UB(col, start * col_stride);
- }
-
- for (i=start; i < end; i++, v+=4) {
- if (mask[i] == 0) {
- v[0] = s[0] * proj[0][0] + s[12];
- v[1] = s[5] * proj[0][1] + s[13];
- v[2] = s[10] * proj[0][2] + s[14];
- }
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
- {
- GLubyte *b = (GLubyte *)&v[3];
- b[0] = col[0][2];
- b[1] = col[0][1];
- b[2] = col[0][0];
- b[3] = col[0][3];
- STRIDE_4UB(col, col_stride);
- }
- }
- }
- else {
- for (i=start; i < end; i++, v+=4) {
- if (mask[i] == 0) {
- v[0] = s[0] * proj[i][0] + s[12];
- v[1] = s[5] * proj[i][1] + s[13];
- v[2] = s[10] * proj[i][2] + s[14];
- }
- {
- GLubyte *b = (GLubyte *)&v[3];
- b[0] = col[i][2];
- b[1] = col[i][1];
- b[2] = col[i][0];
- b[3] = col[i][3];
- }
- }
- }
-}
-#else
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
- void *dest, GLuint stride )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte (*col)[4];
- GLuint col_stride;
- GLfloat *v = (GLfloat *)dest;
- int i;
-
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- import_float_colors( ctx );
-
- col = VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
-
- if (start)
- STRIDE_4UB(col, col_stride * start);
-
- /* Need to figure out where color is:
- */
- if (fxMesa->SetupIndex & TDFX_W_BIT )
- v += 4;
- else
- v += 3;
-
- for (i=start; i < end; i++, STRIDE_F(v, stride)) {
- GLubyte *b = (GLubyte *)v;
- b[0] = col[0][2];
- b[1] = col[0][1];
- b[2] = col[0][0];
- b[3] = col[0][3];
- STRIDE_4UB( col, col_stride );
- }
-}
-#endif
-#endif
-
-#if (IND & TDFX_XYZ_BIT) && (IND & TDFX_RGBA_BIT)
-
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (IND & TDFX_PTEX_BIT)
- return GL_TRUE;
-
- if (IND & TDFX_TEX0_BIT) {
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (IND & TDFX_TEX1_BIT) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (VB->TexCoordPtr[1]->size == 4)
- return GL_FALSE;
- }
-
- if (VB->TexCoordPtr[0]->size == 4)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void TAG(interp)( GLcontext *ctx,
- GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- const GLuint shift = fxMesa->vertex_stride_shift;
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- const GLfloat oow = (dstclip[3] == 0.0F) ? 1.0F : (1.0F / dstclip[3]);
- const GLfloat *s = fxMesa->hw_viewport;
- GLubyte *tdfxverts = (GLubyte *)fxMesa->verts;
- tdfxVertex *dst = (tdfxVertex *) (tdfxverts + (edst << shift));
- const tdfxVertex *out = (const tdfxVertex *) (tdfxverts + (eout << shift));
- const tdfxVertex *in = (const tdfxVertex *) (tdfxverts + (ein << shift));
- const GLfloat wout = 1.0F / out->v.rhw;
- const GLfloat win = 1.0F / in->v.rhw;
-
- dst->v.x = s[0] * dstclip[0] * oow + s[12];
- dst->v.y = s[5] * dstclip[1] * oow + s[13];
- dst->v.z = s[10] * dstclip[2] * oow + s[14];
-
- if (IND & (TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT)) {
- dst->v.rhw = oow;
-
- INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] );
- INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] );
- INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] );
- INTERP_UB( t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3] );
-
- if (IND & TDFX_TEX0_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- INTERP_F( t, dst->pv.tu0, out->pv.tu0 * wout, in->pv.tu0 * win );
- INTERP_F( t, dst->pv.tv0, out->pv.tv0 * wout, in->pv.tv0 * win );
- INTERP_F( t, dst->pv.tq0, out->pv.tq0 * wout, in->pv.tq0 * win );
- dst->pv.tu0 *= oow;
- dst->pv.tv0 *= oow;
- dst->pv.tq0 *= oow;
- } else {
- INTERP_F( t, dst->v.tu0, out->v.tu0 * wout, in->v.tu0 * win );
- INTERP_F( t, dst->v.tv0, out->v.tv0 * wout, in->v.tv0 * win );
- dst->v.tu0 *= oow;
- dst->v.tv0 *= oow;
- }
- }
- if (IND & TDFX_TEX1_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- INTERP_F( t, dst->pv.tu1, out->pv.tu1 * wout, in->pv.tu1 * win );
- INTERP_F( t, dst->pv.tv1, out->pv.tv1 * wout, in->pv.tv1 * win );
- INTERP_F( t, dst->pv.tq1, out->pv.tq1 * wout, in->pv.tq1 * win );
- dst->pv.tu1 *= oow;
- dst->pv.tv1 *= oow;
- dst->pv.tq1 *= oow;
- } else {
- INTERP_F( t, dst->v.tu1, out->v.tu1 * wout, in->v.tu1 * win );
- INTERP_F( t, dst->v.tv1, out->v.tv1 * wout, in->v.tv1 * win );
- dst->v.tu1 *= oow;
- dst->v.tv1 *= oow;
- }
- }
- } else {
- /* 4-dword vertex. Color is in v[3] and there is no oow coordinate.
- */
- INTERP_UB( t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0] );
- INTERP_UB( t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1] );
- INTERP_UB( t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2] );
- INTERP_UB( t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3] );
- }
-}
-#endif
-
-
-static void TAG(init)( void )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- setup_tab[IND].emit = TAG(emit);
-
-#if ((IND & TDFX_XYZ_BIT) && (IND & TDFX_RGBA_BIT))
- setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
- setup_tab[IND].interp = TAG(interp);
-
- if (IND & (TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT))
- setup_tab[IND].copy_pv = copy_pv_rgba4;
- else
- setup_tab[IND].copy_pv = copy_pv_rgba3;
-
-
- if (IND & TDFX_TEX1_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_PROJECT;
- setup_tab[IND].vertex_size = 12;
- setup_tab[IND].vertex_stride_shift = 6;
- }
- else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_MULTI;
- setup_tab[IND].vertex_size = 10;
- setup_tab[IND].vertex_stride_shift = 6;
- }
- }
- else if (IND & TDFX_TEX0_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_PROJECT;
- setup_tab[IND].vertex_size = 12;
- setup_tab[IND].vertex_stride_shift = 6;
- } else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_SINGLE;
- setup_tab[IND].vertex_size = 8;
- setup_tab[IND].vertex_stride_shift = 5;
- }
- }
- else if (IND & TDFX_W_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_NOTEX;
- setup_tab[IND].vertex_size = 6;
- setup_tab[IND].vertex_stride_shift = 5;
- } else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_TINY;
- setup_tab[IND].vertex_size = 4;
- setup_tab[IND].vertex_stride_shift = 4;
- }
-#endif
-}
-
-
-#undef IND
-#undef TAG
diff --git a/xc/lib/GL/mesa/src/tnl/Imakefile.inc b/xc/lib/GL/mesa/src/tnl/Imakefile.inc
deleted file mode 100644
index e2c8a2341..000000000
--- a/xc/lib/GL/mesa/src/tnl/Imakefile.inc
+++ /dev/null
@@ -1,152 +0,0 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/tnl/Imakefile.inc,v 1.2 2002/11/14 21:01:17 tsi Exp $
-
-#ifndef MesaTnlBuildDir
-#define MesaTnlBuildDir $(GLXLIBSRC)/mesa/src/tnl/
-#endif
-
-MESATNLBUILDDIR = MesaTnlBuildDir
-
- MESA_TNL_SRCS = $(MESATNLBUILDDIR)t_array_api.c \
- $(MESATNLBUILDDIR)t_array_import.c \
- $(MESATNLBUILDDIR)t_context.c \
- $(MESATNLBUILDDIR)t_eval_api.c \
- $(MESATNLBUILDDIR)t_imm_alloc.c \
- $(MESATNLBUILDDIR)t_imm_api.c \
- $(MESATNLBUILDDIR)t_imm_debug.c \
- $(MESATNLBUILDDIR)t_imm_dlist.c \
- $(MESATNLBUILDDIR)t_imm_elt.c \
- $(MESATNLBUILDDIR)t_imm_eval.c \
- $(MESATNLBUILDDIR)t_imm_exec.c \
- $(MESATNLBUILDDIR)t_imm_fixup.c \
- $(MESATNLBUILDDIR)t_pipeline.c \
- $(MESATNLBUILDDIR)t_vb_fog.c \
- $(MESATNLBUILDDIR)t_vb_light.c \
- $(MESATNLBUILDDIR)t_vb_normals.c \
- $(MESATNLBUILDDIR)t_vb_points.c \
- $(MESATNLBUILDDIR)t_vb_program.c \
- $(MESATNLBUILDDIR)t_vb_render.c \
- $(MESATNLBUILDDIR)t_vb_texgen.c \
- $(MESATNLBUILDDIR)t_vb_texmat.c \
- $(MESATNLBUILDDIR)t_vb_vertex.c
-
-#ifdef NeedToLinkMesaSrc
-LinkSourceFile(t_array_api.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_array_import.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_context.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_eval_api.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_alloc.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_api.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_debug.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_dlist.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_elt.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_eval.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_exec.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_imm_fixup.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_pipeline.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_fog.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_light.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_normals.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_points.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_program.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_render.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_texgen.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_texmat.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_vb_vertex.c, $(MESASRCDIR)/src/tnl)
-#endif
-
- MESA_TNL_OBJS = $(MESATNLBUILDDIR)t_array_api.o \
- $(MESATNLBUILDDIR)t_array_import.o \
- $(MESATNLBUILDDIR)t_context.o \
- $(MESATNLBUILDDIR)t_eval_api.o \
- $(MESATNLBUILDDIR)t_imm_alloc.o \
- $(MESATNLBUILDDIR)t_imm_api.o \
- $(MESATNLBUILDDIR)t_imm_debug.o \
- $(MESATNLBUILDDIR)t_imm_dlist.o \
- $(MESATNLBUILDDIR)t_imm_elt.o \
- $(MESATNLBUILDDIR)t_imm_eval.o \
- $(MESATNLBUILDDIR)t_imm_exec.o \
- $(MESATNLBUILDDIR)t_imm_fixup.o \
- $(MESATNLBUILDDIR)t_pipeline.o \
- $(MESATNLBUILDDIR)t_vb_fog.o \
- $(MESATNLBUILDDIR)t_vb_light.o \
- $(MESATNLBUILDDIR)t_vb_normals.o \
- $(MESATNLBUILDDIR)t_vb_points.o \
- $(MESATNLBUILDDIR)t_vb_program.o \
- $(MESATNLBUILDDIR)t_vb_render.o \
- $(MESATNLBUILDDIR)t_vb_texgen.o \
- $(MESATNLBUILDDIR)t_vb_texmat.o \
- $(MESATNLBUILDDIR)t_vb_vertex.o
-
-#if defined(DoSharedLib) && DoSharedLib
- MESA_TNL_UOBJS = $(MESATNLBUILDDIR)unshared/t_array_api.o \
- $(MESATNLBUILDDIR)unshared/t_array_import.o \
- $(MESATNLBUILDDIR)unshared/t_context.o \
- $(MESATNLBUILDDIR)unshared/t_eval_api.o \
- $(MESATNLBUILDDIR)unshared/t_imm_alloc.o \
- $(MESATNLBUILDDIR)unshared/t_imm_api.o \
- $(MESATNLBUILDDIR)unshared/t_imm_debug.o \
- $(MESATNLBUILDDIR)unshared/t_imm_dlist.o \
- $(MESATNLBUILDDIR)unshared/t_imm_elt.o \
- $(MESATNLBUILDDIR)unshared/t_imm_eval.o \
- $(MESATNLBUILDDIR)unshared/t_imm_exec.o \
- $(MESATNLBUILDDIR)unshared/t_imm_fixup.o \
- $(MESATNLBUILDDIR)unshared/t_pipeline.o \
- $(MESATNLBUILDDIR)unshared/t_vb_fog.o \
- $(MESATNLBUILDDIR)unshared/t_vb_light.o \
- $(MESATNLBUILDDIR)unshared/t_vb_normals.o \
- $(MESATNLBUILDDIR)unshared/t_vb_points.o \
- $(MESATNLBUILDDIR)unshared/t_vb_program.o \
- $(MESATNLBUILDDIR)unshared/t_vb_render.o \
- $(MESATNLBUILDDIR)unshared/t_vb_texgen.o \
- $(MESATNLBUILDDIR)unshared/t_vb_texmat.o \
- $(MESATNLBUILDDIR)unshared/t_vb_vertex.o
-#else
- MESA_TNL_UOBJS = $(MESA_TNL_OBJS)
-#endif
-
- MESA_TNL_DOBJS = $(MESATNLBUILDDIR)debugger/t_array_api.o \
- $(MESATNLBUILDDIR)debugger/t_array_import.o \
- $(MESATNLBUILDDIR)debugger/t_context.o \
- $(MESATNLBUILDDIR)debugger/t_eval_api.o \
- $(MESATNLBUILDDIR)debugger/t_imm_alloc.o \
- $(MESATNLBUILDDIR)debugger/t_imm_api.o \
- $(MESATNLBUILDDIR)debugger/t_imm_debug.o \
- $(MESATNLBUILDDIR)debugger/t_imm_dlist.o \
- $(MESATNLBUILDDIR)debugger/t_imm_elt.o \
- $(MESATNLBUILDDIR)debugger/t_imm_eval.o \
- $(MESATNLBUILDDIR)debugger/t_imm_exec.o \
- $(MESATNLBUILDDIR)debugger/t_imm_fixup.o \
- $(MESATNLBUILDDIR)debugger/t_pipeline.o \
- $(MESATNLBUILDDIR)debugger/t_vb_fog.o \
- $(MESATNLBUILDDIR)debugger/t_vb_light.o \
- $(MESATNLBUILDDIR)debugger/t_vb_normals.o \
- $(MESATNLBUILDDIR)debugger/t_vb_points.o \
- $(MESATNLBUILDDIR)debugger/t_vb_program.o \
- $(MESATNLBUILDDIR)debugger/t_vb_render.o \
- $(MESATNLBUILDDIR)debugger/t_vb_texgen.o \
- $(MESATNLBUILDDIR)debugger/t_vb_texmat.o \
- $(MESATNLBUILDDIR)debugger/t_vb_vertex.o
-
- MESA_TNL_POBJS = $(MESATNLBUILDDIR)profiled/t_array_api.o \
- $(MESATNLBUILDDIR)profiled/t_array_import.o \
- $(MESATNLBUILDDIR)profiled/t_context.o \
- $(MESATNLBUILDDIR)profiled/t_eval_api.o \
- $(MESATNLBUILDDIR)profiled/t_imm_alloc.o \
- $(MESATNLBUILDDIR)profiled/t_imm_api.o \
- $(MESATNLBUILDDIR)profiled/t_imm_profiled.o \
- $(MESATNLBUILDDIR)profiled/t_imm_dlist.o \
- $(MESATNLBUILDDIR)profiled/t_imm_elt.o \
- $(MESATNLBUILDDIR)profiled/t_imm_eval.o \
- $(MESATNLBUILDDIR)profiled/t_imm_exec.o \
- $(MESATNLBUILDDIR)profiled/t_imm_fixup.o \
- $(MESATNLBUILDDIR)profiled/t_pipeline.o \
- $(MESATNLBUILDDIR)profiled/t_vb_fog.o \
- $(MESATNLBUILDDIR)profiled/t_vb_light.o \
- $(MESATNLBUILDDIR)profiled/t_vb_normals.o \
- $(MESATNLBUILDDIR)profiled/t_vb_points.o \
- $(MESATNLBUILDDIR)profiled/t_vb_program.o \
- $(MESATNLBUILDDIR)profiled/t_vb_render.o \
- $(MESATNLBUILDDIR)profiled/t_vb_texgen.o \
- $(MESATNLBUILDDIR)profiled/t_vb_texmat.o \
- $(MESATNLBUILDDIR)profiled/t_vb_vertex.o
-
diff --git a/xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc b/xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc
deleted file mode 100644
index c55dd846e..000000000
--- a/xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc
+++ /dev/null
@@ -1,38 +0,0 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc,v 1.2 2002/11/14 21:01:18 tsi Exp $
-
-#ifndef MesaTnlDdBuildDir
-#define MesaTnlDdBuildDir $(GLXLIBSRC)/mesa/src/tnl_dd/
-#endif
-
-MESATNLDDBUILDDIR = MesaTnlDdBuildDir
-
- MESA_TNL_DD_SRCS = $(MESATNLDDBUILDDIR)t_array_api.c \
- $(MESATNLDDBUILDDIR)t_dd.c \
- $(MESATNLDDBUILDDIR)t_dd_vb.c
-
-#ifdef NeedToLinkMesaSrc
-LinkSourceFile(t_array_api.c, $(MESASRCDIR)/src/tnl)
-LinkSourceFile(t_dd.c, $(MESASRCDIR)/src/tnl_dd)
-LinkSourceFile(t_dd_vb.c, $(MESASRCDIR)/src/tnl_dd)
-#endif
-
- MESA_TNL_DD_OBJS = $(MESATNLDDBUILDDIR)t_array_api.o \
- $(MESATNLDDBUILDDIR)t_dd.o \
- $(MESATNLDDBUILDDIR)t_dd_vb.o
-
-#if defined(DoSharedLib) && DoSharedLib
-MESA_TNL_DD_UOBJS = $(MESATNLDDBUILDDIR)unshared/t_array_api.o \
- $(MESATNLDDBUILDDIR)unshared/t_dd.o \
- $(MESATNLDDBUILDDIR)unshared/t_dd_vb.o
-#else
-MESA_TNL_DD_UOBJS = $(MESA_TNL_DD_OBJS)
-#endif
-
-MESA_TNL_DD_DOBJS = $(MESATNLDDBUILDDIR)debugger/t_array_api.o \
- $(MESATNLDDBUILDDIR)debugger/t_dd.o \
- $(MESATNLDDBUILDDIR)debugger/t_dd_vb.o
-
-MESA_TNL_DD_POBJS = $(MESATNLDDBUILDDIR)profiled/t_array_api.o \
- $(MESATNLDDBUILDDIR)profiled/t_dd.o \
- $(MESATNLDDBUILDDIR)profiled/t_dd_vb.o
-
diff --git a/xc/lib/GL/mesa/src/swrast/Imakefile b/xc/lib/GL/mesa/swrast/Imakefile
index 15caa185a..b11952fd9 100644
--- a/xc/lib/GL/mesa/src/swrast/Imakefile
+++ b/xc/lib/GL/mesa/swrast/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/swrast/Imakefile,v 1.9 2002/11/25 14:04:52 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/swrast/Imakefile,v 1.8 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -43,7 +43,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if defined(i386Architecture) && MesaUseX86Asm
- ASM_DIR = X86
+ ASM_DIR = x86
ASM_SRCS =
ASM_OBJS =
#if MesaUseMMX
@@ -59,7 +59,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef SparcArchitecture
- ASM_DIR = SPARC
+ ASM_DIR = sparc
ASM_SRCS =
ASM_OBJS =
ASM_DEFS = -DUSE_SPARC_ASM
@@ -69,11 +69,13 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
MATHDEF = -DCCPML
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/swrast \
- -I$(MESASRCDIR)/src/$(ASM_DIR) \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/array_cache \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/swrast \
+ -I$(MESASRCDIR)/src/mesa/$(ASM_DIR) \
-I$(MESASRCDIR)/include \
-I../../../include -I$(XINCLUDESRC)
diff --git a/xc/lib/GL/mesa/src/swrast/Imakefile.inc b/xc/lib/GL/mesa/swrast/Imakefile.inc
index 517d7ecd3..c9c8d567f 100644
--- a/xc/lib/GL/mesa/src/swrast/Imakefile.inc
+++ b/xc/lib/GL/mesa/swrast/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/swrast/Imakefile.inc,v 1.2 2002/11/14 21:01:17 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/swrast/Imakefile.inc,v 1.1tsi Exp $
#ifndef MesaSwrastBuildDir
-#define MesaSwrastBuildDir $(GLXLIBSRC)/mesa/src/swrast/
+#define MesaSwrastBuildDir $(GLXLIBSRC)/mesa/swrast/
#endif
MESASWRASTBUILDDIR = MesaSwrastBuildDir
@@ -20,11 +20,11 @@ MESASWRASTBUILDDIR = MesaSwrastBuildDir
$(MESASWRASTBUILDDIR)s_drawpix.c \
$(MESASWRASTBUILDDIR)s_feedback.c \
$(MESASWRASTBUILDDIR)s_fog.c \
- $(MESASWRASTBUILDDIR)s_histogram.c \
$(MESASWRASTBUILDDIR)s_imaging.c \
$(MESASWRASTBUILDDIR)s_lines.c \
$(MESASWRASTBUILDDIR)s_logic.c \
$(MESASWRASTBUILDDIR)s_masking.c \
+ $(MESASWRASTBUILDDIR)s_nvfragprog.c \
$(MESASWRASTBUILDDIR)s_pixeltex.c \
$(MESASWRASTBUILDDIR)s_points.c \
$(MESASWRASTBUILDDIR)s_readpix.c \
@@ -36,34 +36,64 @@ MESASWRASTBUILDDIR = MesaSwrastBuildDir
$(MESASWRASTBUILDDIR)s_zoom.c
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(s_aaline.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_aatriangle.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_accum.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_alpha.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_alphabuf.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_bitmap.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_blend.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_buffers.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_context.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_copypix.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_depth.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_drawpix.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_feedback.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_fog.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_histogram.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_imaging.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_lines.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_logic.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_masking.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_pixeltex.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_points.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_readpix.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_span.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_stencil.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_texstore.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_texture.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_triangle.c, $(MESASRCDIR)/src/swrast)
-LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/swrast)
+LinkSourceFile(s_aaline.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_aaline.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_aalinetemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_aatriangle.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_aatriangle.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_aatritemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_accum.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_accum.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_alpha.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_alpha.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_alphabuf.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_alphabuf.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_bitmap.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_blend.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_blend.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_buffers.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_context.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_context.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_copypix.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_depth.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_depth.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_drawpix.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_drawpix.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_feedback.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_feedback.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_fog.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_fog.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_imaging.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_lines.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_lines.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_linetemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_logic.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_logic.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_masking.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_masking.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_nvfragprog.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_nvfragprog.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_pixeltex.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_pixeltex.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_points.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_points.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_pointtemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_readpix.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_span.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_span.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_spantemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_stencil.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_stencil.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_texstore.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_texture.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_texture.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_triangle.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_triangle.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_trispan.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_tritemp.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(s_zoom.h, $(MESASRCDIR)/src/mesa/swrast)
+LinkSourceFile(swrast.h, $(MESASRCDIR)/src/mesa/swrast)
#endif
MESA_SWRAST_OBJS = $(MESASWRASTBUILDDIR)s_aaline.o \
@@ -80,11 +110,11 @@ LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/swrast)
$(MESASWRASTBUILDDIR)s_drawpix.o \
$(MESASWRASTBUILDDIR)s_feedback.o \
$(MESASWRASTBUILDDIR)s_fog.o \
- $(MESASWRASTBUILDDIR)s_histogram.o \
$(MESASWRASTBUILDDIR)s_imaging.o \
$(MESASWRASTBUILDDIR)s_lines.o \
$(MESASWRASTBUILDDIR)s_logic.o \
$(MESASWRASTBUILDDIR)s_masking.o \
+ $(MESASWRASTBUILDDIR)s_nvfragprog.o \
$(MESASWRASTBUILDDIR)s_pixeltex.o \
$(MESASWRASTBUILDDIR)s_points.o \
$(MESASWRASTBUILDDIR)s_readpix.o \
@@ -110,11 +140,11 @@ LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/swrast)
$(MESASWRASTBUILDDIR)unshared/s_drawpix.o \
$(MESASWRASTBUILDDIR)unshared/s_feedback.o \
$(MESASWRASTBUILDDIR)unshared/s_fog.o \
- $(MESASWRASTBUILDDIR)unshared/s_histogram.o \
$(MESASWRASTBUILDDIR)unshared/s_imaging.o \
$(MESASWRASTBUILDDIR)unshared/s_lines.o \
$(MESASWRASTBUILDDIR)unshared/s_logic.o \
$(MESASWRASTBUILDDIR)unshared/s_masking.o \
+ $(MESASWRASTBUILDDIR)unshared/s_nvfragprog.o \
$(MESASWRASTBUILDDIR)unshared/s_pixeltex.o \
$(MESASWRASTBUILDDIR)unshared/s_points.o \
$(MESASWRASTBUILDDIR)unshared/s_readpix.o \
@@ -142,11 +172,11 @@ LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/swrast)
$(MESASWRASTBUILDDIR)debugger/s_drawpix.o \
$(MESASWRASTBUILDDIR)debugger/s_feedback.o \
$(MESASWRASTBUILDDIR)debugger/s_fog.o \
- $(MESASWRASTBUILDDIR)debugger/s_histogram.o \
$(MESASWRASTBUILDDIR)debugger/s_imaging.o \
$(MESASWRASTBUILDDIR)debugger/s_lines.o \
$(MESASWRASTBUILDDIR)debugger/s_logic.o \
$(MESASWRASTBUILDDIR)debugger/s_masking.o \
+ $(MESASWRASTBUILDDIR)debugger/s_nvfragprog.o \
$(MESASWRASTBUILDDIR)debugger/s_pixeltex.o \
$(MESASWRASTBUILDDIR)debugger/s_points.o \
$(MESASWRASTBUILDDIR)debugger/s_readpix.o \
@@ -171,11 +201,11 @@ LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/swrast)
$(MESASWRASTBUILDDIR)profiled/s_drawpix.o \
$(MESASWRASTBUILDDIR)profiled/s_feedback.o \
$(MESASWRASTBUILDDIR)profiled/s_fog.o \
- $(MESASWRASTBUILDDIR)profiled/s_histogram.o \
$(MESASWRASTBUILDDIR)profiled/s_imaging.o \
$(MESASWRASTBUILDDIR)profiled/s_lines.o \
$(MESASWRASTBUILDDIR)profiled/s_logic.o \
$(MESASWRASTBUILDDIR)profiled/s_masking.o \
+ $(MESASWRASTBUILDDIR)profiled/s_nvfragprog.o \
$(MESASWRASTBUILDDIR)profiled/s_pixeltex.o \
$(MESASWRASTBUILDDIR)profiled/s_points.o \
$(MESASWRASTBUILDDIR)profiled/s_readpix.o \
diff --git a/xc/lib/GL/mesa/src/swrast_setup/Imakefile b/xc/lib/GL/mesa/swrast_setup/Imakefile
index d77cea578..eae6f157a 100644
--- a/xc/lib/GL/mesa/src/swrast_setup/Imakefile
+++ b/xc/lib/GL/mesa/swrast_setup/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/swrast_setup/Imakefile,v 1.9 2002/11/25 14:04:52 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/swrast_setup/Imakefile,v 1.8 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -42,7 +42,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if defined(i386Architecture) && MesaUseX86Asm
- ASM_DIR = X86
+ ASM_DIR = x86
ASM_SRCS =
ASM_OBJS =
#if MesaUseMMX
@@ -58,7 +58,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef SparcArchitecture
- ASM_DIR = SPARC
+ ASM_DIR = sparc
ASM_SRCS =
ASM_OBJS =
ASM_DEFS = -DUSE_SPARC_ASM
@@ -68,11 +68,13 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
MATHDEF = -DCCPML
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/$(ASM_DIR) \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/swrast_setup \
- -I$(MESASRCDIR)/src/tnl \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/$(ASM_DIR) \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/swrast_setup \
+ -I$(MESASRCDIR)/src/mesa/tnl \
-I$(MESASRCDIR)/include \
-I../../../include -I$(XINCLUDESRC)
diff --git a/xc/lib/GL/mesa/src/swrast_setup/Imakefile.inc b/xc/lib/GL/mesa/swrast_setup/Imakefile.inc
index ac68c55cc..19b363672 100644
--- a/xc/lib/GL/mesa/src/swrast_setup/Imakefile.inc
+++ b/xc/lib/GL/mesa/swrast_setup/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/swrast_setup/Imakefile.inc,v 1.2 2002/11/14 21:01:17 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/swrast_setup/Imakefile.inc,v 1.1tsi Exp $
#ifndef MesaSwrastSetupBuildDir
-#define MesaSwrastSetupBuildDir $(GLXLIBSRC)/mesa/src/swrast_setup/
+#define MesaSwrastSetupBuildDir $(GLXLIBSRC)/mesa/swrast_setup/
#endif
MESASWRSETUPDIR = MesaSwrastSetupBuildDir
@@ -11,9 +11,15 @@ MESASWRSETUPDIR = MesaSwrastSetupBuildDir
$(MESASWRSETUPDIR)ss_vb.c
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(ss_context.c, $(MESASRCDIR)/src/swrast_setup)
-LinkSourceFile(ss_triangle.c, $(MESASRCDIR)/src/swrast_setup)
-LinkSourceFile(ss_vb.c, $(MESASRCDIR)/src/swrast_setup)
+LinkSourceFile(ss_context.c, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_context.h, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_triangle.c, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_triangle.h, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_tritmp.h, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_vb.c, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_vb.h, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(ss_vbtmp.h, $(MESASRCDIR)/src/mesa/swrast_setup)
+LinkSourceFile(swrast_setup.h, $(MESASRCDIR)/src/mesa/swrast_setup)
#endif
MESA_SWR_SETUP_OBJS = $(MESASWRSETUPDIR)ss_context.o \
diff --git a/xc/lib/GL/mesa/src/tnl/Imakefile b/xc/lib/GL/mesa/tnl/Imakefile
index 15e76f4b1..4e43cdd97 100644
--- a/xc/lib/GL/mesa/src/tnl/Imakefile
+++ b/xc/lib/GL/mesa/tnl/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/tnl/Imakefile,v 1.9 2002/11/25 14:04:52 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/tnl/Imakefile,v 1.8 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -43,7 +43,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if defined(i386Architecture) && MesaUseX86Asm
- ASM_DIR = X86
+ ASM_DIR = x86
ASM_SRCS =
ASM_OBJS =
#if MesaUseMMX
@@ -59,7 +59,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef SparcArchitecture
- ASM_DIR = SPARC
+ ASM_DIR = sparc
ASM_SRCS =
ASM_OBJS =
ASM_DEFS = -DUSE_SPARC_ASM
@@ -69,12 +69,14 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
MATHDEF = -DCCPML
#endif
-MESA_INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/$(ASM_DIR) \
- -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/swrast_setup \
- -I$(MESASRCDIR)/src/tnl \
+MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/$(ASM_DIR) \
+ -I$(MESASRCDIR)/src/mesa/array_cache \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/swrast_setup \
+ -I$(MESASRCDIR)/src/mesa/tnl \
-I$(MESASRCDIR)/include \
-I../../../include -I$(XINCLUDESRC)
diff --git a/xc/lib/GL/mesa/tnl/Imakefile.inc b/xc/lib/GL/mesa/tnl/Imakefile.inc
new file mode 100644
index 000000000..701311ebf
--- /dev/null
+++ b/xc/lib/GL/mesa/tnl/Imakefile.inc
@@ -0,0 +1,143 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/tnl/Imakefile.inc,v 1.1tsi Exp $
+
+#ifndef MesaTnlBuildDir
+#define MesaTnlBuildDir $(GLXLIBSRC)/mesa/tnl/
+#endif
+
+MESATNLBUILDDIR = MesaTnlBuildDir
+
+ MESA_TNL_SRCS = $(MESATNLBUILDDIR)t_array_api.c \
+ $(MESATNLBUILDDIR)t_array_import.c \
+ $(MESATNLBUILDDIR)t_context.c \
+ $(MESATNLBUILDDIR)t_pipeline.c \
+ $(MESATNLBUILDDIR)t_save_api.c \
+ $(MESATNLBUILDDIR)t_save_loopback.c \
+ $(MESATNLBUILDDIR)t_save_playback.c \
+ $(MESATNLBUILDDIR)t_vb_fog.c \
+ $(MESATNLBUILDDIR)t_vb_light.c \
+ $(MESATNLBUILDDIR)t_vb_normals.c \
+ $(MESATNLBUILDDIR)t_vb_points.c \
+ $(MESATNLBUILDDIR)t_vb_program.c \
+ $(MESATNLBUILDDIR)t_vb_render.c \
+ $(MESATNLBUILDDIR)t_vb_texgen.c \
+ $(MESATNLBUILDDIR)t_vb_texmat.c \
+ $(MESATNLBUILDDIR)t_vb_vertex.c \
+ $(MESATNLBUILDDIR)t_vtx_api.c \
+ $(MESATNLBUILDDIR)t_vtx_eval.c \
+ $(MESATNLBUILDDIR)t_vtx_exec.c
+
+#ifdef NeedToLinkMesaSrc
+LinkSourceFile(t_array_api.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_array_api.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_array_import.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_array_import.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_context.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_context.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(tnl.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_pipeline.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_pipeline.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_save_api.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_save_api.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_save_loopback.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_save_playback.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_cliptmp.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_fog.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_light.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_lighttmp.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_normals.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_points.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_program.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_render.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_rendertmp.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_texgen.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_texmat.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_vertex.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vtx_api.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vtx_api.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vtx_eval.c, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vtx_exec.c, $(MESASRCDIR)/src/mesa/tnl)
+#endif
+
+ MESA_TNL_OBJS = $(MESATNLBUILDDIR)t_array_api.o \
+ $(MESATNLBUILDDIR)t_array_import.o \
+ $(MESATNLBUILDDIR)t_context.o \
+ $(MESATNLBUILDDIR)t_pipeline.o \
+ $(MESATNLBUILDDIR)t_save_api.o \
+ $(MESATNLBUILDDIR)t_save_loopback.o \
+ $(MESATNLBUILDDIR)t_save_playback.o \
+ $(MESATNLBUILDDIR)t_vb_fog.o \
+ $(MESATNLBUILDDIR)t_vb_light.o \
+ $(MESATNLBUILDDIR)t_vb_normals.o \
+ $(MESATNLBUILDDIR)t_vb_points.o \
+ $(MESATNLBUILDDIR)t_vb_program.o \
+ $(MESATNLBUILDDIR)t_vb_render.o \
+ $(MESATNLBUILDDIR)t_vb_texgen.o \
+ $(MESATNLBUILDDIR)t_vb_texmat.o \
+ $(MESATNLBUILDDIR)t_vb_vertex.o \
+ $(MESATNLBUILDDIR)t_vtx_api.o \
+ $(MESATNLBUILDDIR)t_vtx_eval.o \
+ $(MESATNLBUILDDIR)t_vtx_exec.o
+
+#if defined(DoSharedLib) && DoSharedLib
+ MESA_TNL_UOBJS = $(MESATNLBUILDDIR)unshared/t_array_api.o \
+ $(MESATNLBUILDDIR)unshared/t_array_import.o \
+ $(MESATNLBUILDDIR)unshared/t_context.o \
+ $(MESATNLBUILDDIR)unshared/t_pipeline.o \
+ $(MESATNLBUILDDIR)unshared/t_save_api.o \
+ $(MESATNLBUILDDIR)unshared/t_save_loopback.o \
+ $(MESATNLBUILDDIR)unshared/t_save_playback.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_fog.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_light.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_normals.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_points.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_program.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_render.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_texgen.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_texmat.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_vertex.o \
+ $(MESATNLBUILDDIR)unshared/t_vtx_api.o \
+ $(MESATNLBUILDDIR)unshared/t_vtx_eval.o \
+ $(MESATNLBUILDDIR)unshared/t_vtx_exec.o
+#else
+ MESA_TNL_UOBJS = $(MESA_TNL_OBJS)
+#endif
+
+ MESA_TNL_DOBJS = $(MESATNLBUILDDIR)debugger/t_array_api.o \
+ $(MESATNLBUILDDIR)debugger/t_array_import.o \
+ $(MESATNLBUILDDIR)debugger/t_context.o \
+ $(MESATNLBUILDDIR)debugger/t_pipeline.o \
+ $(MESATNLBUILDDIR)debugger/t_save_api.o \
+ $(MESATNLBUILDDIR)debugger/t_save_loopback.o \
+ $(MESATNLBUILDDIR)debugger/t_save_playback.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_fog.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_light.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_normals.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_points.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_program.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_render.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_texgen.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_texmat.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_vertex.o \
+ $(MESATNLBUILDDIR)debugger/t_vtx_api.o \
+ $(MESATNLBUILDDIR)debugger/t_vtx_eval.o \
+ $(MESATNLBUILDDIR)debugger/t_vtx_exec.o
+
+ MESA_TNL_POBJS = $(MESATNLBUILDDIR)profiled/t_array_api.o \
+ $(MESATNLBUILDDIR)profiled/t_array_import.o \
+ $(MESATNLBUILDDIR)profiled/t_context.o \
+ $(MESATNLBUILDDIR)profiled/t_pipeline.o \
+ $(MESATNLBUILDDIR)profiled/t_save_api.o \
+ $(MESATNLBUILDDIR)profiled/t_save_loopback.o \
+ $(MESATNLBUILDDIR)profiled/t_save_playback.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_fog.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_light.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_normals.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_points.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_program.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_render.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_texgen.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_texmat.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_vertex.o \
+ $(MESATNLBUILDDIR)profiled/t_vtx_api.o \
+ $(MESATNLBUILDDIR)profiled/t_vtx_eval.o \
+ $(MESATNLBUILDDIR)profiled/t_vtx_exec.o
diff --git a/xc/lib/GL/mesa/src/tnl_dd/Imakefile b/xc/lib/GL/mesa/tnl_dd/Imakefile
index 1fb94f9c8..22995e6f1 100644
--- a/xc/lib/GL/mesa/src/tnl_dd/Imakefile
+++ b/xc/lib/GL/mesa/tnl_dd/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/tnl_dd/Imakefile,v 1.7 2002/11/25 14:04:53 eich Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/tnl_dd/Imakefile,v 1.6 2002/11/25 12:58:55 tsi Exp $
#include <Threads.tmpl>
@@ -49,33 +49,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
-I../../../include
INCLUDES = $(MESA_INCLUDES) $(DRI_INCLUDES)
- SRCS = $(MESA_TNL_DD_SRCS)
- OBJS = $(MESA_TNL_DD_OBJS)
-
-#if defined(i386Architecture) && MesaUseX86Asm
- ASM_SRCS =
- ASM_OBJS =
-#if MesaUseMMX
- MMX_DEFS = -DUSE_MMX_ASM
-#endif
-#if MesaUse3DNow
- 3DNOW_DEFS = -DUSE_3DNOW_ASM
-#endif
-#if MesaUseSSE
- SSE_DEFS = -DUSE_SSE_ASM
-#endif
- ASM_DEFS = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(SSE_DEFS)
-#endif
-
-#ifdef SparcArchitecture
- ASM_SRCS =
- ASM_OBJS =
- ASM_DEFS = -DUSE_SPARC_ASM
-#endif
-
-#ifdef UseCompaqMathLibrary
- MATHDEF = -DCCPML
-#endif
DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFS) $(MATHDEF)
@@ -83,7 +56,4 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src \
LibraryObjectRule()
-SubdirLibraryRule($(OBJS))
-NormalLintTarget($(SRCS))
-
DependTarget()
diff --git a/xc/lib/GL/mesa/tnl_dd/Imakefile.inc b/xc/lib/GL/mesa/tnl_dd/Imakefile.inc
new file mode 100644
index 000000000..8d5d3da2d
--- /dev/null
+++ b/xc/lib/GL/mesa/tnl_dd/Imakefile.inc
@@ -0,0 +1,40 @@
+XCOMM $XFree86: xc/lib/GL/mesa/src/tnl_dd/Imakefile.inc,v 1.1tsi Exp $
+
+#ifndef MesaTnlDdBuildDir
+#define MesaTnlDdBuildDir $(GLXLIBSRC)/mesa/tnl_dd/
+#endif
+
+MESATNLDDBUILDDIR = MesaTnlDdBuildDir
+
+ MESA_TNL_DD_SRCS = $(MESATNLDDBUILDDIR)t_dd.c \
+ $(MESATNLDDBUILDDIR)t_dd_vb.c
+
+#ifdef NeedToLinkMesaSrc
+LinkSourceFile(t_dd.c, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_vb.c, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_dmatmp2.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_dmatmp.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_rendertmp.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_triemit.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_tritmp.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_unfilled.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_vbtmp.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+LinkSourceFile(t_dd_vertex.h, $(MESASRCDIR)/src/mesa/tnl_dd)
+#endif
+
+ MESA_TNL_DD_OBJS = $(MESATNLDDBUILDDIR)t_dd.o \
+ $(MESATNLDDBUILDDIR)t_dd_vb.o
+
+#if defined(DoSharedLib) && DoSharedLib
+MESA_TNL_DD_UOBJS = $(MESATNLDDBUILDDIR)unshared/t_dd.o \
+ $(MESATNLDDBUILDDIR)unshared/t_dd_vb.o
+#else
+MESA_TNL_DD_UOBJS = $(MESA_TNL_DD_OBJS)
+#endif
+
+MESA_TNL_DD_DOBJS = $(MESATNLDDBUILDDIR)debugger/t_dd.o \
+ $(MESATNLDDBUILDDIR)debugger/t_dd_vb.o
+
+MESA_TNL_DD_POBJS = $(MESATNLDDBUILDDIR)profiled/t_dd.o \
+ $(MESATNLDDBUILDDIR)profiled/t_dd_vb.o
+
diff --git a/xc/lib/GL/mesa/src/X86/Imakefile b/xc/lib/GL/mesa/x86/Imakefile
index d32d565d7..2a41dc89a 100644
--- a/xc/lib/GL/mesa/src/X86/Imakefile
+++ b/xc/lib/GL/mesa/x86/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.26 2003/03/06 22:24:50 herrb Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.23 2002/07/14 17:08:16 alanh Exp $
/*
* Need both shared and unshared Mesa objects in the following cases:
@@ -10,7 +10,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.26 2003/03/06 22:24:50 herr
* driver modules.
*/
-#if BuildOSMesaLib || (BuildXF86DRI && (GlxDriverUsesMesa || GlxBuiltInXMesa || BuildOSMesaLib))
+#if GlxDriverUsesMesa || GlxBuiltInXMesa || BuildOSMesaLib
#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC)
#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC)
#define DoExtraLib SharedLibGlx
@@ -34,9 +34,12 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#include "Imakefile.inc"
DEFINES = $(ALLOC_DEFINES) GlxDefines $(MESA_ASM_DEFINES)
- INCLUDES = -I$(INCLUDESRC) -I$(EXTINCSRC) -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/X86 \
- -I../../../include
+ INCLUDES = /*-I$(INCLUDESRC) -I$(EXTINCSRC)*/ -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/include \
+ -I$(GLXLIBSRC)/include \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/x86 \
+ -I$(MESASRCDIR)/src/mesa/glapi
SRCS = $(MESA_ASM_SRCS) gen_matypes.c
OBJS = $(MESA_ASM_OBJS)
@@ -77,7 +80,7 @@ ObjectFromAsmSource(sse_xform3, NullParameter)
ObjectFromAsmSource(sse_xform4, NullParameter)
#endif
-LinkSourceFile(gen_matypes.c, $(MESASRCDIR)/src/X86)
+LinkSourceFile(gen_matypes.c, $(MESASRCDIR)/src/mesa/x86)
MATYPES = ./gen_matypes
diff --git a/xc/lib/GL/mesa/src/X86/Imakefile.inc b/xc/lib/GL/mesa/x86/Imakefile.inc
index ff16a3373..9aaf02b4a 100644
--- a/xc/lib/GL/mesa/src/X86/Imakefile.inc
+++ b/xc/lib/GL/mesa/x86/Imakefile.inc
@@ -1,7 +1,7 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile.inc,v 1.6 2002/11/25 12:58:55 tsi Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile.inc,v 1.5 2002/11/14 21:01:16 tsi Exp $
#ifndef MesaX86BuildDir
-#define MesaX86BuildDir $(GLXLIBSRC)/mesa/src/X86/
+#define MesaX86BuildDir $(GLXLIBSRC)/mesa/x86/
#endif
MESAX86BUILDDIR = MesaX86BuildDir
@@ -16,14 +16,14 @@ MESA_X86_SRCS = $(MESAX86BUILDDIR)common_x86.c \
$(MESAX86BUILDDIR)x86_xform4.S
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(common_x86.c, $(MESASRCDIR)/src/X86)
-LinkSourceFile(common_x86_asm.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(x86.c, $(MESASRCDIR)/src/X86)
-LinkSourceFile(x86_cliptest.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(x86_xform2.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(x86_xform3.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(x86_xform4.S, $(MESASRCDIR)/src/X86)
+LinkSourceFile(common_x86.c, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(common_x86_asm.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(x86.c, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(x86_cliptest.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(x86_xform2.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(x86_xform3.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(x86_xform4.S, $(MESASRCDIR)/src/mesa/x86)
#endif
MESA_X86_OBJS = $(MESAX86BUILDDIR)common_x86.o \
@@ -69,7 +69,7 @@ MESA_X86_DEFS = -DUSE_X86_ASM
MESA_MMX_SRCS = $(MESAX86BUILDDIR)mmx_blend.S
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(mmx_blend.S, $(MESASRCDIR)/src/X86)
+LinkSourceFile(mmx_blend.S, $(MESASRCDIR)/src/mesa/x86)
#endif
MESA_MMX_OBJS = $(MESAX86BUILDDIR)mmx_blend.o
@@ -90,12 +90,12 @@ MESA_3DNOW_SRCS = $(MESAX86BUILDDIR)3dnow.c \
$(MESAX86BUILDDIR)3dnow_xform4.S
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(3dnow.c, $(MESASRCDIR)/src/X86)
-LinkSourceFile(3dnow_normal.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(3dnow_xform1.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(3dnow_xform2.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(3dnow_xform3.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(3dnow_xform4.S, $(MESASRCDIR)/src/X86)
+LinkSourceFile(3dnow.c, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(3dnow_normal.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(3dnow_xform1.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(3dnow_xform2.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(3dnow_xform3.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(3dnow_xform4.S, $(MESASRCDIR)/src/mesa/x86)
#endif
MESA_3DNOW_OBJS = $(MESAX86BUILDDIR)3dnow.o \
$(MESAX86BUILDDIR)3dnow_normal.o \
@@ -141,12 +141,12 @@ MESA_SSE_SRCS = $(MESAX86BUILDDIR)sse.c \
$(MESAX86BUILDDIR)sse_xform4.S
#ifdef NeedToLinkMesaSrc
-LinkSourceFile(sse.c, $(MESASRCDIR)/src/X86)
-LinkSourceFile(sse_normal.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(sse_xform1.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(sse_xform2.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(sse_xform3.S, $(MESASRCDIR)/src/X86)
-LinkSourceFile(sse_xform4.S, $(MESASRCDIR)/src/X86)
+LinkSourceFile(sse.c, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(sse_normal.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(sse_xform1.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(sse_xform2.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(sse_xform3.S, $(MESASRCDIR)/src/mesa/x86)
+LinkSourceFile(sse_xform4.S, $(MESASRCDIR)/src/mesa/x86)
#endif
MESA_SSE_OBJS = $(MESAX86BUILDDIR)sse.o \
diff --git a/xc/programs/Xserver/GL/dri/Imakefile b/xc/programs/Xserver/GL/dri/Imakefile
index eec83ee85..e94194947 100644
--- a/xc/programs/Xserver/GL/dri/Imakefile
+++ b/xc/programs/Xserver/GL/dri/Imakefile
@@ -1,5 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.4 1999/08/14 10:49:23 dawes Exp $
-XCOMM $PI: xc/programs/Xserver/GL/dri/Imakefile,v 1.13 1999/06/07 12:55:30 faith Exp $
+XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.7 2003/02/11 21:34:04 tsi Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -12,7 +11,8 @@ MOBJ = drimodule.o
SRCS = xf86dri.c dri.c $(MSRC)
OBJS = xf86dri.o dri.o $(MOBJ)
- INCLUDES = -I$(SERVERSRC)/include -I$(XTOP)/include -I$(EXTINCSRC) \
+ INCLUDES = -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(XINCLUDESRC) \
+ -I$(EXTINCSRC) -I$(MESASRCDIR)/include \
-I$(XF86OSSRC) -I$(XF86COMSRC) \
-I../include -I../glx -I$(LIBSRC)/GL/include \
-I$(SERVERSRC)/mi -I$(FONTINCSRC)
diff --git a/xc/programs/Xserver/GL/glx/Imakefile b/xc/programs/Xserver/GL/glx/Imakefile
index e032ee08e..af7d1a118 100644
--- a/xc/programs/Xserver/GL/glx/Imakefile
+++ b/xc/programs/Xserver/GL/glx/Imakefile
@@ -29,7 +29,7 @@ SUBDIRS = module
g_render.o g_renderswap.o g_single.o g_singleswap.o \
$(MOBJS)
- INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) \
+ INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \
-I$(XINCLUDESRC) -I$(SERVERSRC)/mi \
-I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \
-I$(XF86SRC)
diff --git a/xc/programs/Xserver/GL/mesa/GLcore/Imakefile b/xc/programs/Xserver/GL/mesa/GLcore/Imakefile
index 2800627e5..416fc866a 100644
--- a/xc/programs/Xserver/GL/mesa/GLcore/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/GLcore/Imakefile
@@ -13,38 +13,39 @@ SUBDIRS = module
#define NeedAllMesaSrc
#define MesaInXServer
-#define MesaBuildDir ../src/
-#define MesaACBuildDir ../src/array_cache/
-#define MesaMathBuildDir ../src/math/
-#define MesaSwrastBuildDir ../src/swrast/
-#define MesaSwrastSetupBuildDir ../src/swrast_setup/
-#define MesaTnlBuildDir ../src/tnl/
-#define MesaXBuildDir ../src/X/
-
-#include "../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/swrast/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/tnl/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/math/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/X/Imakefile.inc"
-#include "../../../../../lib/GL/mesa/src/Imakefile.inc"
+#define MesaBuildDir ../main/
+#define MesaACBuildDir ../array_cache/
+#define MesaMathBuildDir ../math/
+#define MesaSwrastBuildDir ../swrast/
+#define MesaSwrastSetupBuildDir ../swrast_setup/
+#define MesaTnlBuildDir ../tnl/
+#define MesaXBuildDir ../X/
+
+#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/main/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/math/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/Imakefile.inc"
#ifdef IHaveModules
MSRCS = GLcoremodule.c
MOBJS = GLcoremodule.o
#endif
- XOBJS = ../src/X/?*.o
+ XOBJS = ../X/?*.o
OBJS = $(COREMESAOBJS) $(MOBJS)
- DONES = ../src/DONE ../src/X/DONE ../src/array_cache/DONE \
- ../src/math/DONE ../src/swrast/DONE ../src/swrast_setup/DONE \
- ../src/tnl/DONE
+ DONES = ../main/DONE ../X/DONE ../array_cache/DONE \
+ ../math/DONE ../swrast/DONE ../swrast_setup/DONE \
+ ../tnl/DONE
INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \
-I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \
- -I$(MESASRCDIR)/src \
+ -I$(MESASRCDIR)/src/mesa \
-I$(SERVERSRC)/include
DEFINES = $(GLX_DEFINES)
diff --git a/xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile b/xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile
index 95b29fc4e..ea9baab3b 100644
--- a/xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile
@@ -5,39 +5,39 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile,v 1.1 2002/0
#define NeedAllMesaSrc
#define MesaInXServer
-#define MesaBuildDir ../../src/module/
-#define MesaACBuildDir ../../src/array_cache/module/
-#define MesaMathBuildDir ../../src/math/module/
-#define MesaSwrastBuildDir ../../src/swrast/module/
-#define MesaSwrastSetupBuildDir ../../src/swrast_setup/module/
-#define MesaTnlBuildDir ../../src/tnl/module/
-#define MesaXBuildDir ../../src/X/module/
-
-#include "../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/math/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/X/Imakefile.inc"
-#include "../../../../../../lib/GL/mesa/src/Imakefile.inc"
+#define MesaBuildDir ../../main/module/
+#define MesaACBuildDir ../../array_cache/module/
+#define MesaMathBuildDir ../../math/module/
+#define MesaSwrastBuildDir ../../swrast/module/
+#define MesaSwrastSetupBuildDir ../../swrast_setup/module/
+#define MesaTnlBuildDir ../../tnl/module/
+#define MesaXBuildDir ../../X/module/
+
+#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/math/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/Imakefile.inc"
#if DoLoadableServer
MSRCS = GLcoremodule.c
MOBJS = GLcoremodule.o
#endif
- XOBJS = ../../src/X/module/?*.o
+ XOBJS = ../../X/module/?*.o
OBJS = $(COREMESAOBJS) $(MOBJS)
- DONES = ../../src/module/DONE ../../src/X/module/DONE \
- ../../src/array_cache/module/DONE ../../src/math/module/DONE \
- ../../src/swrast/module/DONE \
- ../../src/swrast_setup/module/DONE ../../src/tnl/module/DONE
+ DONES = ../../module/DONE ../../X/module/DONE \
+ ../../array_cache/module/DONE ../../math/module/DONE \
+ ../../swrast/module/DONE \
+ ../../swrast_setup/module/DONE ../../tnl/module/DONE
INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \
-I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \
- -I$(MESASRCDIR)/src \
+ -I$(MESASRCDIR)/src/mesa \
-I$(SERVERSRC)/include
DEFINES = $(GLX_DEFINES)
diff --git a/xc/programs/Xserver/GL/mesa/Imakefile b/xc/programs/Xserver/GL/mesa/Imakefile
index 29b9d7ec9..12b2dad13 100644
--- a/xc/programs/Xserver/GL/mesa/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/Imakefile
@@ -1,14 +1,47 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.6 2002/02/25 00:45:41 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:56:00 tsi Exp $
+#if DoLoadableServer
+#if !BuildModuleInSubdir
#define IHaveModules
-#include <Server.tmpl>
+#elif !defined(IHaveModules)
+ MODSUBDIR = module
+#endif
+#endif
+#if !defined(IHaveModules) || !BuildModuleInSubdir
#define IHaveSubdirs
+ SUBDIRS = main math array_cache swrast swrast_setup tnl X GLcore $(MODSUBDIR)
+#endif
+
+#include <Server.tmpl>
+
+
+#define NeedAllMesaSrc
+#define NeedToLinkMesaSrc
+#define MesaBuildDir /**/
+#if !defined(IHaveModules) || !BuildModuleInSubdir
+#include "../../../../lib/GL/mesa/Imakefile.inc"
+#else
+#include "../../../../../../lib/GL/mesa/Imakefile.inc"
+#endif
+
+ INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \
+ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \
+ -I$(MESASRCDIR)/src/mesa \
+ -I$(SERVERSRC)/include
- SUBDIRS = src GLcore
DEFINES = $(GLX_DEFINES)
+#ifdef IHaveModules
+ModuleObjectRule()
+#else
+NormalLibraryObjectRule()
+#endif
+
+#ifdef IHaveSubdirs
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
-MakeLintLibSubdirs($(SUBDIRS))
-LintSubdirs($(SUBDIRS))
+#endif
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/GL/mesa/src/X/Imakefile b/xc/programs/Xserver/GL/mesa/X/Imakefile
index bf1322065..41358453c 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/X/Imakefile
@@ -16,9 +16,9 @@ SUBDIRS = module
#define MesaXBuildDir /**/
#define MesaInXServer
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/X/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/X/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc"
#endif
@@ -40,9 +40,12 @@ GLXSRV_DEFINES = -DXFree86Server
SRCS = $(DRIVER_SRCS) $(GLX_SRCS)
OBJS = $(DRIVER_OBJS) $(GLX_OBJS)
- INCLUDES = -I$(SERVERSRC)/GL/mesa/src/X -I$(INCLUDESRC) -I$(XINCLUDESRC) \
+ INCLUDES = -I$(SERVERSRC)/GL/mesa/X -I$(XINCLUDESRC) \
-I$(EXTINCSRC) \
- -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/X \
+ -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/mesa/drivers/x11 \
-I$(MESASRCDIR)/include \
-I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \
-I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \
diff --git a/xc/programs/Xserver/GL/mesa/src/X/module/Imakefile b/xc/programs/Xserver/GL/mesa/X/module/Imakefile
index eee4c7556..eee4c7556 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/X/module/Imakefile
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/X/xf86glx.c
index 729749202..19b8ba7c8 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glx.c
@@ -740,7 +740,7 @@ __GLinterface *__MESA_createContext(__GLimports *imports,
if (xm_vis) {
XMesaContext xmshare = m_share ? m_share->DriverCtx : 0;
XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare);
- gl_ctx = xmctx ? xmctx->gl_ctx : 0;
+ gl_ctx = xmctx ? &xmctx->mesa : 0;
}
if (!gl_ctx)
@@ -803,7 +803,7 @@ GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src,
{
XMesaContext xm_dst = (XMesaContext) dst->DriverCtx;
const XMesaContext xm_src = (const XMesaContext) src->DriverCtx;
- _mesa_copy_context(xm_src->gl_ctx, xm_dst->gl_ctx, mask);
+ _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask);
return GL_TRUE;
}
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c b/xc/programs/Xserver/GL/mesa/X/xf86glx_util.c
index ff2654830..ff2654830 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glx_util.c
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h b/xc/programs/Xserver/GL/mesa/X/xf86glx_util.h
index 0716d6c7d..0716d6c7d 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glx_util.h
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h b/xc/programs/Xserver/GL/mesa/X/xf86glxint.h
index 47c8e7608..47c8e7608 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glxint.h
diff --git a/xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile b/xc/programs/Xserver/GL/mesa/array_cache/Imakefile
index 07430ae10..8126c3f30 100644
--- a/xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/array_cache/Imakefile
@@ -15,17 +15,19 @@ SUBDIRS = module
#define NeedToLinkMesaSrc
#define MesaACBuildDir /**/
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc"
#endif
SRCS = $(MESA_AC_SRCS)
OBJS = $(MESA_AC_OBJS)
- INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/array_cache \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
-I$(MESASRCDIR)/include \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
diff --git a/xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile b/xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile
index 86c585012..86c585012 100644
--- a/xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile
diff --git a/xc/programs/Xserver/GL/mesa/main/Imakefile b/xc/programs/Xserver/GL/mesa/main/Imakefile
new file mode 100644
index 000000000..f1333286f
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/main/Imakefile
@@ -0,0 +1,54 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $
+
+#if DoLoadableServer
+#if !BuildModuleInSubdir
+#define IHaveModules
+#elif !defined(IHaveModules)
+#define IHaveSubdirs
+SUBDIRS = module
+#endif
+#endif
+
+#include <Server.tmpl>
+
+#define NeedAllMesaSrc
+#define NeedToLinkMesaSrc
+#define MesaBuildDir /**/
+#if !defined(IHaveModules) || !BuildModuleInSubdir
+#include "../../../../../lib/GL/mesa/main/Imakefile.inc"
+#else
+#include "../../../../../../lib/GL/mesa/main/Imakefile.inc"
+#endif
+
+ SRCS = $(COREMESABASESRCS)
+ OBJS = $(COREMESABASEOBJS)
+
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/include \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
+ -I$(LIBSRC)/GL/include \
+ -I$(XF86SRC) -I$(INCLUDESRC)
+
+ DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/
+
+#ifdef IHaveModules
+ModuleObjectRule()
+#else
+NormalLibraryObjectRule()
+#endif
+
+SubdirLibraryRule($(OBJS))
+
+LintLibraryTarget(dri,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
+#ifdef IHaveSubdirs
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+#endif
+
diff --git a/xc/programs/Xserver/GL/mesa/src/math/module/Imakefile b/xc/programs/Xserver/GL/mesa/main/module/Imakefile
index e21afd5e5..e21afd5e5 100644
--- a/xc/programs/Xserver/GL/mesa/src/math/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/main/module/Imakefile
diff --git a/xc/programs/Xserver/GL/mesa/src/math/Imakefile b/xc/programs/Xserver/GL/mesa/math/Imakefile
index ff5741395..49720974c 100644
--- a/xc/programs/Xserver/GL/mesa/src/math/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/math/Imakefile
@@ -15,16 +15,18 @@ SUBDIRS = module
#define NeedToLinkMesaSrc
#define MesaMathBuildDir /**/
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/math/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/math/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/math/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/math/Imakefile.inc"
#endif
SRCS = $(MESA_MATH_SRCS)
OBJS = $(MESA_MATH_OBJS)
- INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/math \
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
-I$(MESASRCDIR)/include \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
diff --git a/xc/programs/Xserver/GL/mesa/math/module/Imakefile b/xc/programs/Xserver/GL/mesa/math/module/Imakefile
new file mode 100644
index 000000000..e21afd5e5
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/math/module/Imakefile
@@ -0,0 +1,6 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $
+
+#define IHaveModules
+
+#include "../Imakefile"
+
diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile
deleted file mode 100644
index c279b0b27..000000000
--- a/xc/programs/Xserver/GL/mesa/src/Imakefile
+++ /dev/null
@@ -1,52 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:56:00 tsi Exp $
-
-#if DoLoadableServer
-#if !BuildModuleInSubdir
-#define IHaveModules
-#elif !defined(IHaveModules)
- MODSUBDIR = module
-#endif
-#endif
-
-#if !defined(IHaveModules) || !BuildModuleInSubdir
-#define IHaveSubdirs
- SUBDIRS = math array_cache swrast swrast_setup tnl X $(MODSUBDIR)
-#endif
-
-#include <Server.tmpl>
-
-
-#define NeedAllMesaSrc
-#define NeedToLinkMesaSrc
-#define MesaBuildDir /**/
-#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../lib/GL/mesa/src/Imakefile.inc"
-#else
-#include "../../../../../../lib/GL/mesa/src/Imakefile.inc"
-#endif
-
- SRCS = $(COREMESABASESRCS)
- OBJS = $(COREMESABASEOBJS)
-
- INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \
- -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \
- -I$(MESASRCDIR)/src \
- -I$(SERVERSRC)/include
-
- DEFINES = $(GLX_DEFINES)
-
-#ifdef IHaveModules
-ModuleObjectRule()
-#else
-NormalLibraryObjectRule()
-#endif
-
-#ifdef IHaveSubdirs
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-#endif
-
-SubdirLibraryRule($(OBJS))
-
-DependTarget()
-
diff --git a/xc/programs/Xserver/GL/mesa/src/module/Imakefile b/xc/programs/Xserver/GL/mesa/src/module/Imakefile
deleted file mode 100644
index a2525ab95..000000000
--- a/xc/programs/Xserver/GL/mesa/src/module/Imakefile
+++ /dev/null
@@ -1,6 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $
-
-#define IHaveModules
-
-#include "../Imakefile"
-
diff --git a/xc/programs/Xserver/GL/mesa/src/swrast/Imakefile b/xc/programs/Xserver/GL/mesa/swrast/Imakefile
index 808fe5a3f..aa4c62043 100644
--- a/xc/programs/Xserver/GL/mesa/src/swrast/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/swrast/Imakefile
@@ -15,18 +15,20 @@ SUBDIRS = module
#define NeedToLinkMesaSrc
#define MesaSwrastBuildDir /**/
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc"
#endif
SRCS = $(MESA_SWRAST_SRCS)
OBJS = $(MESA_SWRAST_OBJS)
- INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/swrast \
- -I$(MESASRCDIR)/src/swrast_setup \
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/swrast \
+ -I$(MESASRCDIR)/src/mesa/swrast_setup \
-I$(MESASRCDIR)/include \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
diff --git a/xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile b/xc/programs/Xserver/GL/mesa/swrast/module/Imakefile
index 7d9974ed0..7d9974ed0 100644
--- a/xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/swrast/module/Imakefile
diff --git a/xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile b/xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile
index b822adea8..b530457e9 100644
--- a/xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile
@@ -15,16 +15,18 @@ SUBDIRS = module
#define NeedToLinkMesaSrc
#define MesaSwrastSetupBuildDir /**/
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc"
#endif
SRCS = $(MESA_SWR_SETUP_SRCS)
OBJS = $(MESA_SWR_SETUP_OBJS)
- INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/swrast_setup \
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/swrast_setup \
-I$(MESASRCDIR)/include \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
diff --git a/xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile b/xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile
index 5221debc0..5221debc0 100644
--- a/xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile
diff --git a/xc/programs/Xserver/GL/mesa/src/tnl/Imakefile b/xc/programs/Xserver/GL/mesa/tnl/Imakefile
index f5b625be4..da0b2abda 100644
--- a/xc/programs/Xserver/GL/mesa/src/tnl/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/tnl/Imakefile
@@ -15,19 +15,21 @@ SUBDIRS = module
#define NeedToLinkMesaSrc
#define MesaTnlBuildDir /**/
#if !defined(IHaveModules) || !BuildModuleInSubdir
-#include "../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc"
+#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc"
#else
-#include "../../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc"
+#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc"
#endif
SRCS = $(MESA_TNL_SRCS)
OBJS = $(MESA_TNL_OBJS)
- INCLUDES = -I$(MESASRCDIR)/src \
- -I$(MESASRCDIR)/src/array_cache \
- -I$(MESASRCDIR)/src/math \
- -I$(MESASRCDIR)/src/tnl \
+ INCLUDES = -I$(MESASRCDIR)/src/mesa \
+ -I$(MESASRCDIR)/src/mesa/array_cache \
+ -I$(MESASRCDIR)/src/mesa/math \
+ -I$(MESASRCDIR)/src/mesa/main \
+ -I$(MESASRCDIR)/src/mesa/glapi \
+ -I$(MESASRCDIR)/src/mesa/tnl \
-I$(MESASRCDIR)/include \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \
diff --git a/xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile b/xc/programs/Xserver/GL/mesa/tnl/module/Imakefile
index 5d2a4489d..5d2a4489d 100644
--- a/xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/tnl/module/Imakefile
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile
index b831ab402..5b980fe14 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile
@@ -80,7 +80,7 @@ DEFINES = $(DRIDEFINES) $(CHIPDEFINES) $(I830XVDEFINES)
#if BuildXF86DRI
#if !defined(XF86DriverSDK)
-LinkSourceFile(i830_3d_reg.h, $(GLXLIBSRC)/mesa/src/drv/i830)
+LinkSourceFile(i830_3d_reg.h, $(MESASRCDIR)/src/mesa/drivers/dri/i830)
#endif
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h
index a1d0fca08..1ac0b3930 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h
@@ -45,6 +45,7 @@
#define XF86_LIBC_H 1
#include "Xfuncs.h"
+#include <stddef.h>
/*
* The first set of definitions are required both for modules and