summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkem <kem>2000-02-22 22:10:26 +0000
committerkem <kem>2000-02-22 22:10:26 +0000
commit89c78477478cb7a9077de97a3f6d383230102873 (patch)
treef94ac64d070611439fc484dd8a28014699ff940c
parent36bf7d7d30deea2aa3c8789e235685913f922c8e (diff)
-rw-r--r--xc/config/cf/QNX4.cf3
-rw-r--r--xc/config/cf/xfree86.cf720
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/Makefile.in6
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/README59
-rwxr-xr-xxc/extras/FreeType/contrib/ttf2bdf/contrib/create_type60
-rwxr-xr-xxc/extras/FreeType/contrib/ttf2bdf/contrib/create_type_m59
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/remap.c22
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/remap.h6
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.c54
-rw-r--r--xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.man28
-rw-r--r--xc/extras/FreeType/contrib/ttf2pfb/ttf2pfb.c1698
-rw-r--r--xc/extras/FreeType/contrib/ttfbanner/Makefile9
-rw-r--r--xc/extras/FreeType/docs/errstr.txt73
-rw-r--r--xc/extras/FreeType/docs/raster.doc578
-rw-r--r--xc/extras/FreeType/howto/win32.txt136
-rw-r--r--xc/extras/FreeType/lib/changes.txt247
-rw-r--r--xc/extras/FreeType/po/freetype.pot433
-rw-r--r--xc/extras/FreeType/test/arch/win32/Driver32.c104
-rw-r--r--xc/extras/FreeType/test/arch/win32/ReadMe.txt17
-rw-r--r--xc/extras/FreeType/test/arch/win32/Resource.h24
-rw-r--r--xc/extras/FreeType/test/arch/win32/StdAfx.cpp6
-rw-r--r--xc/extras/FreeType/test/arch/win32/StdAfx.h25
-rw-r--r--xc/extras/FreeType/test/arch/win32/TESTW32.DSP190
-rw-r--r--xc/extras/FreeType/test/arch/win32/TESTW32.DSW29
-rw-r--r--xc/extras/FreeType/test/arch/win32/TESTW32.H50
-rw-r--r--xc/extras/FreeType/test/arch/win32/Testw32.cpp79
-rw-r--r--xc/extras/FreeType/test/arch/win32/Testw32.mak533
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_common.c8
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_ftdump.c9
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_ftlint.c9
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_ftstring.c9
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_fttimer.c9
-rw-r--r--xc/extras/FreeType/test/arch/win32/hack_ftview.c9
-rw-r--r--xc/extras/FreeType/test/arch/win32/testw32.mdpbin43008 -> 0 bytes
-rw-r--r--xc/extras/FreeType/test/arch/win32/testw32.rc202
-rw-r--r--xc/extras/FreeType/test/arch/win32/testw32Dlg.cpp358
-rw-r--r--xc/extras/FreeType/test/arch/win32/testw32Dlg.h51
-rw-r--r--xc/extras/FreeType/test/common.c97
-rw-r--r--xc/extras/Mesa/src/linetemp.h150
-rw-r--r--xc/extras/Mesa/src/lnaatemp.h106
-rw-r--r--xc/extras/Mesa/src/tritemp.h138
-rw-r--r--xc/extras/X-TrueType/xttcache.c359
-rw-r--r--xc/extras/X-TrueType/xttcache.h72
-rw-r--r--xc/include/GL/gl.h2
-rw-r--r--xc/include/GL/glx.h2
-rw-r--r--xc/include/GL/glxtokens.h2
-rw-r--r--xc/include/extensions/xf86rush.h29
-rw-r--r--xc/include/extensions/xf86rushstr.h24
-rw-r--r--xc/lib/GL/Imakefile6
-rw-r--r--xc/lib/GL/dri/Imakefile2
-rw-r--r--xc/lib/GL/dri/dri_mesa.c773
-rw-r--r--xc/lib/GL/dri/dri_mesa_init.c813
-rw-r--r--xc/lib/GL/dri/dri_xmesaapi.h77
-rw-r--r--xc/lib/GL/glx/Imakefile2
-rw-r--r--xc/lib/GL/glx/clientattrib.c2
-rw-r--r--xc/lib/GL/glx/glxcmds.c2
-rw-r--r--xc/lib/GL/glx/glxext.c2
-rw-r--r--xc/lib/GL/glx/indirect.h2
-rw-r--r--xc/lib/GL/glx/indirect_init.c2
-rw-r--r--xc/lib/GL/glx/indirect_init.h2
-rw-r--r--xc/lib/GL/glx/indirect_wrap.h2
-rw-r--r--xc/lib/GL/glx/packrender.h2
-rw-r--r--xc/lib/GL/glx/packsingle.h2
-rw-r--r--xc/lib/GL/glx/packvendpriv.h2
-rw-r--r--xc/lib/GL/glx/pixel.c2
-rw-r--r--xc/lib/GL/glx/xfont.c2
-rw-r--r--xc/lib/GL/mesa/src/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/X/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/X86/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/drv/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/drv/common/Imakefile56
-rw-r--r--xc/lib/GL/mesa/src/drv/common/hwlog.c107
-rw-r--r--xc/lib/GL/mesa/src/drv/common/hwlog.h115
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mm.c262
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mm.h101
-rw-r--r--xc/lib/GL/mesa/src/drv/common/mmx.h560
-rw-r--r--xc/lib/GL/mesa/src/drv/common/spantmp.h199
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810fastpath.c530
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810fasttmp.h143
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810ring.c162
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810swap.h6
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/Imakefile68
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c514
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h121
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaclear.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaclear.h7
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgacnvtex.c250
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgacommon.h44
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadd.c146
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadd.h36
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadepth.c636
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadepth.h37
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadma.c59
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadma.h41
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgafastpath.c529
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h143
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.c321
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.h23
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgalib.h266
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgalog.h47
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgapipeline.c138
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgapipeline.h15
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaregs.h1377
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgarender.c334
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgarender.h10
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaspan.c153
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaspan.h6
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgastate.c723
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgastate.h15
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.c1051
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.h119
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatris.c226
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatris.h189
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatritmp.h150
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgavb.c493
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgavb.h132
-rw-r--r--xc/lib/Xxf86rush/XF86Rush.c47
-rw-r--r--xc/programs/Imakefile90
-rw-r--r--xc/programs/Xserver/GL/dri/dri.c2
-rw-r--r--xc/programs/Xserver/GL/dri/dri.h2
-rw-r--r--xc/programs/Xserver/GL/dri/dristruct.h2
-rw-r--r--xc/programs/Xserver/GL/mesa/include/GL/Imakefile2
-rw-r--r--xc/programs/Xserver/GL/mesa/src/Imakefile4
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/Imakefile2
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/xf86glx.c2
-rw-r--r--xc/programs/Xserver/Imakefile39
-rw-r--r--xc/programs/Xserver/Xext/panoramiX.h219
-rw-r--r--xc/programs/Xserver/Xext/panoramiXsrv.h26
-rw-r--r--xc/programs/Xserver/Xext/panoramiXstubs.c59
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.c125
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c36
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c750
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc10
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml8
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml33
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.c864
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h31
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c33
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c1105
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c137
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c174
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c177
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_sarea.h44
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c633
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h50
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h24
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_drm.c100
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_ucode.h11610
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c224
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h930
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c151
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c52
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c491
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h66
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c26
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel2.c472
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c31
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/sdk-list1
-rw-r--r--xc/programs/Xserver/hw/xfree86/fbdevhw/fb.h254
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/extsym.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/xf86sym.c70
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/INT10.HOWTO269
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/Imakefile13
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/generic.c436
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/helper_exec.c617
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/helper_mem.c162
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/pci.c93
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/stub.c55
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.c296
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.h170
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10module.c53
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.c90
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.h46
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel1
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c313
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c86
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c584
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c762
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c583
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h76
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c636
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_clear.c417
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c245
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c978
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.h112
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h218
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c576
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h292
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c362
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.h13
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mgareg_flags.h930
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile79
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/defines.h50
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c234
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c110
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c103
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c65
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h29
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h23
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h201
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h4
240 files changed, 36322 insertions, 12771 deletions
diff --git a/xc/config/cf/QNX4.cf b/xc/config/cf/QNX4.cf
index e04df5c18..28135238f 100644
--- a/xc/config/cf/QNX4.cf
+++ b/xc/config/cf/QNX4.cf
@@ -1,6 +1,5 @@
-XCOMM platform: $XFree86: xc/config/cf/QNX4.cf,v 1.1 1999/12/27 00:45:43 robin Exp $
+XCOMM platform: $XFree86: xc/config/cf/QNX4.cf,v 1.2 2000/01/21 02:29:34 dawes Exp $
-#define NewInput NO
#define StripInstalledPrograms NO
#define BuildServer YES
#define DoLoadableServer NO /* sorry, are u listenning QSSL? */
diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf
index 87bcad5c6..ac71d41ce 100644
--- a/xc/config/cf/xfree86.cf
+++ b/xc/config/cf/xfree86.cf
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.255 2000/01/03 14:29:59 robin Exp $
+XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.269 2000/02/17 13:50:02 dawes Exp $
/*
* This configuration file contains all of the configuration
* information for the XFree86 based X Servers.
@@ -11,6 +11,7 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $
/*
* settings for the config file parser
*/
+
#ifndef XConfigFile
#define XConfigFile XF86Config
#endif
@@ -49,117 +50,126 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $
* are supported on this platform.
*/
#ifdef i386Architecture
-#ifndef XF86Server
-#define XF86Server YES
-#endif
+# ifndef XF86Server
+# define XF86Server YES
+# endif
/* 1bpp module */
-#ifndef XF1Bpp
-#define XF1Bpp YES
-#endif
+# ifndef XF1Bpp
+# define XF1Bpp YES
+# endif
/* 4bpp module */
-#ifndef XF4Bpp
-#define XF4Bpp YES
-#endif
+# ifndef XF4Bpp
+# define XF4Bpp YES
+# endif
/* 8/32bpp overlay module */
-#ifndef XF8_32Bpp
-#define XF8_32Bpp YES
-#endif
+# ifndef XF8_32Bpp
+# define XF8_32Bpp YES
+# endif
/* 8/16bpp dual fb module */
-#ifndef XF8_16Bpp
-#define XF8_16Bpp YES
-#endif
+# ifndef XF8_16Bpp
+# define XF8_16Bpp YES
+# endif
/* 24/32bpp conversion module */
-#ifndef XF24_32Bpp
-#define XF24_32Bpp YES
-#endif
+# ifndef XF24_32Bpp
+# define XF24_32Bpp YES
+# endif
/* shadow fb module */
-#ifndef XFShadowFB
-#define XFShadowFB YES
-#endif
+# ifndef XFShadowFB
+# define XFShadowFB YES
+# endif
/* vgahw module */
-#ifndef XF86VgaHw
-#define XF86VgaHw YES
-#endif
+# ifndef XF86VgaHw
+# define XF86VgaHw YES
+# endif
/* fbdevhw module */
-#ifndef XF86FBDevHw
-#define XF86FBDevHw YES
-#endif
+# ifndef XF86FBDevHw
+# define XF86FBDevHw YES
+# endif
/* XAA module */
-#ifndef XF86XAA
-#define XF86XAA YES
-#endif
+# ifndef XF86XAA
+# define XF86XAA YES
+# endif
/* ramdac module */
-#ifndef XF86Ramdac
-#define XF86Ramdac YES
-#endif
+# ifndef XF86Ramdac
+# define XF86Ramdac YES
+# endif
/* I2C module */
-#ifndef XF86I2C
-#define XF86I2C YES
-#endif
+# ifndef XF86I2C
+# define XF86I2C YES
+# endif
/* DDC module */
-#ifndef XF86DDC
-#define XF86DDC YES
-#endif
+# ifndef XF86DDC
+# define XF86DDC YES
+# endif
/* RAC (Resource Access Control) module */
-#ifndef XF86RAC
-#define XF86RAC YES
-#endif
+# ifndef XF86RAC
+# define XF86RAC YES
+# endif
+
/* int10 module */
-#ifndef XF86INT10
-#define XF86INT10 NO
-#endif
-#define X86EMU_GENERIC 1
-#define X86VM 2
-#define X86EMU_OS 3
+# ifndef XF86Int10
+# define XF86Int10 YES
+# endif
/*
* Amiga framebuffer module.
* This is for build testing only. It isn't actually used on this platform.
*/
-#ifndef XF86AFB
-#define XF86AFB YES
-#endif
+# ifndef XF86AFB
+# define XF86AFB YES
+# endif
+
+/*
+ * XXX Should change this to allow such drivers to be built without agpgart
+ * support (when it is useful to do so).
+ */
+# if HasAgpGart
+# define AgpGartDrivers i810
+# else
+# define AgpGartDrivers /**/
+# endif
/* Pure PCI drivers should go first */
-#ifndef XF86CardDrivers
-#define XF86CardDrivers mga glint nv tga s3virge sis rendition \
+# ifndef XF86CardDrivers
+# define XF86CardDrivers mga glint nv tga s3virge sis rendition \
neomagic i740 tdfx \
cirrus tseng trident chips apm \
GlideDriver fbdev \
- ati r128 vga XF86ExtraCardDrivers
-#endif
+ ati r128 AgpGartDrivers cyrix \
+ vga XF86ExtraCardDrivers
+# endif
#endif
/* Sparc drivers */
#if defined(SparcArchitecture) && !defined(LynxOSArchitecture)
-#ifndef XF86Server
-#define XF86Server YES
-#endif
+# ifndef XF86Server
+# define XF86Server YES
+# endif
/* 1bpp module */
-#ifndef XF1Bpp
-#define XF1Bpp YES
-#endif
+# ifndef XF1Bpp
+# define XF1Bpp YES
+# endif
/* shadow fb module */
-#ifndef XFShadowFB
-#define XFShadowFB YES
-#endif
+# ifndef XFShadowFB
+# define XFShadowFB YES
+# endif
/* fbdevhw module */
-#ifndef XF86FBDevHw
-#define XF86FBDevHw YES
-#endif
+# ifndef XF86FBDevHw
+# define XF86FBDevHw YES
+# endif
/* XAA module */
-#ifndef XF86XAA
-#define XF86XAA YES
-#endif
+# ifndef XF86XAA
+# define XF86XAA YES
+# endif
/* DDC module */
-#ifndef XF86DDC
-#define XF86DDC YES
-#endif
+# ifndef XF86DDC
+# define XF86DDC YES
+# endif
-#ifndef XF86CardDrivers
-#define XF86CardDrivers fbdev XF86ExtraCardDrivers
-#endif
+# ifndef XF86CardDrivers
+# define XF86CardDrivers fbdev XF86ExtraCardDrivers
+# endif
#endif
@@ -168,156 +178,148 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $
* are supported on this platform.
*/
#ifdef AlphaArchitecture
-#ifndef XF86Server
-#define XF86Server YES
-#endif
+# ifndef XF86Server
+# define XF86Server YES
+# endif
/* 1bpp module */
-#ifndef XF1Bpp
-#define XF1Bpp NO
-#endif
+# ifndef XF1Bpp
+# define XF1Bpp NO
+# endif
/* 4bpp module */
-#ifndef XF4Bpp
-#define XF4Bpp YES
-#endif
+# ifndef XF4Bpp
+# define XF4Bpp YES
+# endif
/* 8/32bpp overlay module */
-#ifndef XF8_32Bpp
-#define XF8_32Bpp YES
-#endif
+# ifndef XF8_32Bpp
+# define XF8_32Bpp YES
+# endif
/* 8/16bpp dual fb module */
-#ifndef XF8_16Bpp
-#define XF8_16Bpp YES
-#endif
+# ifndef XF8_16Bpp
+# define XF8_16Bpp YES
+# endif
/* 24/32bpp conversion module */
-#ifndef XF24_32Bpp
-#define XF24_32Bpp YES
-#endif
+# ifndef XF24_32Bpp
+# define XF24_32Bpp YES
+# endif
/* shadow fb module */
-#ifndef XFShadowFB
-#define XFShadowFB YES
-#endif
+# ifndef XFShadowFB
+# define XFShadowFB YES
+# endif
/* vgahw module */
-#ifndef XF86VgaHw
-#define XF86VgaHw YES
-#endif
+# ifndef XF86VgaHw
+# define XF86VgaHw YES
+# endif
/* fbdevhw module */
-#ifndef XF86FBDevHw
-#define XF86FBDevHw YES
-#endif
+# ifndef XF86FBDevHw
+# define XF86FBDevHw YES
+# endif
/* XAA module */
-#ifndef XF86XAA
-#define XF86XAA YES
-#endif
+# ifndef XF86XAA
+# define XF86XAA YES
+# endif
/* ramdac module */
-#ifndef XF86Ramdac
-#define XF86Ramdac YES
-#endif
+# ifndef XF86Ramdac
+# define XF86Ramdac YES
+# endif
/* I2C module */
-#ifndef XF86I2C
-#define XF86I2C YES
-#endif
+# ifndef XF86I2C
+# define XF86I2C YES
+# endif
/* DDC module */
-#ifndef XF86DDC
-#define XF86DDC YES
-#endif
+# ifndef XF86DDC
+# define XF86DDC YES
+# endif
/* RAC (Resource Access Control) module */
-#ifndef XF86RAC
-#define XF86RAC YES
-#endif
+# ifndef XF86RAC
+# define XF86RAC YES
+# endif
-/* Pure PCI drivers should go first */
-#ifndef XF86CardDrivers
-#define XF86CardDrivers mga tdfx glint s3virge rendition tga \
- vga XF86ExtraCardDrivers
-#endif
-#endif
+/* int10 module */
+# ifndef XF86Int10
+# define XF86Int10 YES
+# endif
-/*
- * For Motorola 68k platforms, the default is to build all modules which
- * are supported on this platform.
- */
-#ifdef Mc68020Architecture
-#ifndef XF68LoaderServer
-#define XF68LoaderServer DoLoadableServer
-#endif
-#ifndef XF68FBDevModule
-#define XF68FBDevModule XF68LoaderServer
-#endif
-#ifndef XF68LoaderServer
-#ifndef XF68FBDevServer
-#define XF68FBDevServer YES
-#endif
-#endif
+/* Pure PCI drivers should go first */
+# ifndef XF86CardDrivers
+# define XF86CardDrivers mga tdfx glint s3virge rendition tga \
+ r128 vga XF86ExtraCardDrivers
+# endif
#endif
/*
- * PPC (currently Linux and LynxOS)
+ * For Motorola 68k and PPC (currently Linux & LynxOS)
*/
-#if defined(PpcArchitecture)
-#ifndef XF86Server
-#define XF86Server YES
-#endif
+#if defined(PpcArchitecture) || defined(Mc68020Architecture)
+# ifndef XF86Server
+# define XF86Server YES
+# endif
/* Amiga framebuffer module */
-#ifndef XF86AFB
-#define XF86AFB YES
-#endif
+# ifndef XF86AFB
+# define XF86AFB YES
+# endif
/* 1bpp module */
-#ifndef XF1Bpp
-#define XF1Bpp YES
-#endif
+# ifndef XF1Bpp
+# define XF1Bpp YES
+# endif
/* 4bpp module */
-#ifndef XF4Bpp
-#define XF4Bpp YES
-#endif
+# ifndef XF4Bpp
+# define XF4Bpp YES
+# endif
/* 8/32bpp overlay module */
-#ifndef XF8_32Bpp
-#define XF8_32Bpp YES
-#endif
+# ifndef XF8_32Bpp
+# define XF8_32Bpp YES
+# endif
/* 8/16bpp dual fb module */
-#ifndef XF8_16Bpp
-#define XF8_16Bpp YES
-#endif
+# ifndef XF8_16Bpp
+# define XF8_16Bpp YES
+# endif
/* 24/32bpp conversion module */
-#ifndef XF24_32Bpp
-#define XF24_32Bpp YES
-#endif
+# ifndef XF24_32Bpp
+# define XF24_32Bpp YES
+# endif
/* shadow fb module */
-#ifndef XFShadowFB
-#define XFShadowFB YES
-#endif
+# ifndef XFShadowFB
+# define XFShadowFB YES
+# endif
/* vgahw module */
-#ifndef XF86VgaHw
-#define XF86VgaHw YES
-#endif
+# ifndef XF86VgaHw
+# define XF86VgaHw YES
+# endif
/* fbdevhw module */
-#ifndef XF86FBDevHw
-#define XF86FBDevHw YES
-#endif
+# ifndef XF86FBDevHw
+# define XF86FBDevHw YES
+# endif
/* XAA module */
-#ifndef XF86XAA
-#define XF86XAA YES
-#endif
+# ifndef XF86XAA
+# define XF86XAA YES
+# endif
/* ramdac module */
-#ifndef XF86Ramdac
-#define XF86Ramdac YES
-#endif
+# ifndef XF86Ramdac
+# define XF86Ramdac YES
+# endif
/* I2C module */
-#ifndef XF86I2C
-#define XF86I2C YES
-#endif
+# ifndef XF86I2C
+# define XF86I2C YES
+# endif
/* DDC module */
-#ifndef XF86DDC
-#define XF86DDC YES
-#endif
+# ifndef XF86DDC
+# define XF86DDC YES
+# endif
/* RAC (Resource Access Control) module */
-#ifndef XF86RAC
-#define XF86RAC YES
-#endif
+# ifndef XF86RAC
+# define XF86RAC YES
+# endif
+
+/* int10 module */
+# ifndef XF86Int10
+# define XF86Int10 YES
+# endif
/* Pure PCI drivers should go first */
-#ifndef XF86CardDrivers
-#define XF86CardDrivers mga glint s3virge sis cirrus tseng \
+# ifndef XF86CardDrivers
+# define XF86CardDrivers mga glint s3virge sis cirrus tseng \
trident chips fbdev vga XF86ExtraCardDrivers
-#endif
+# endif
#endif
@@ -325,10 +327,10 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $
* For Mips/Arc platforms, the default is to build all modules which
* are supported on this platform.
*/
-#ifdef ArcArchitecture
-#ifndef XF86Server
-#define XF86Server YES
-#endif
+# ifdef ArcArchitecture
+# ifndef XF86Server
+# define XF86Server YES
+# endif
#endif
@@ -337,19 +339,19 @@ XCOMM $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $
* on different architectures.
*/
#ifndef XF86AFB
-#define XF86AFB NO
+# define XF86AFB NO
#endif
#ifndef XF86ILBM
-#define XF86ILBM NO
+# define XF86ILBM NO
#endif
#ifndef XF86IPLAN2P2
-#define XF86IPLAN2P2 NO
+# define XF86IPLAN2P2 NO
#endif
#ifndef XF86IPLAN2P4
-#define XF86IPLAN2P4 NO
+# define XF86IPLAN2P4 NO
#endif
#ifndef XF86IPLAN2P8
-#define XF86IPLAN2P8 NO
+# define XF86IPLAN2P8 NO
#endif
#if XF86AFB
AFB_DEFS = -DUSE_AFB
@@ -367,7 +369,7 @@ IPLAN2P4_DEFS = -DUSE_IPLAN2P4
IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
#ifndef FbdevDefines
-#define FbdevDefines $(AFB_DEFS) $(ILBM_DEFS) $(IPLAN2P2_DEFS) \
+# define FbdevDefines $(AFB_DEFS) $(ILBM_DEFS) $(IPLAN2P2_DEFS) \
$(IPLAN2P4_DEFS) $(IPLAN2P8_DEFS)
#endif
@@ -376,20 +378,20 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* It the servers are only started by xdm, they should not be setuid-root.
*/
#if !defined(i386MachArchitecture) && !defined(OS2Architecture)
-#ifndef InstallXserverSetUID
-#define InstallXserverSetUID YES
-#endif
+# ifndef InstallXserverSetUID
+# define InstallXserverSetUID YES
+# endif
#endif
/*
* The server-side of PEX is not 64-bit clean.
*/
#if !defined(BuildPexExt)
-#if XF86Server && !defined(AlphaArchitecture)
-#define BuildPexExt YES
-#else
-#define BuildPexExt NO
-#endif
+# if XF86Server && !defined(AlphaArchitecture)
+# define BuildPexExt YES
+# else
+# define BuildPexExt NO
+# endif
#endif
@@ -444,7 +446,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* DRI.
*/
#ifndef BuildXF86DRIDriverSupport
-#define BuildXF86DRIDriverSupport NO
+# define BuildXF86DRIDriverSupport NO
#endif
#if BuildGlxExt
@@ -479,60 +481,76 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
+# ifndef UseX86Emu
+# define UseX86Emu YES
+# endif
+
+#define X86INT10_STUB 0
+#define X86EMU_GENERIC 1
+#define X86VM 2
+#define X86EMU_OS 3
+
+#ifndef XF86INT10_BUILD
+# if UseX86Emu
+# define XF86INT10_BUILD X86EMU_GENERIC
+# else
+# define XF86INT10_BUILD X86INT10_STUB
+# endif
+#endif
/*
* Build the Rush extension library (non standard extension for cooperation
* between glide library and X server). Enabled by default only for Linux.
*/
#ifndef BuildXF86RushExt
-#define BuildXF86RushExt NO
+# define BuildXF86RushExt NO
#endif
/*
* XIE
*/
#ifndef BuildXIE
-#if XF86Server
-#define BuildXIE YES
-#else
-#define BuildXIE NO
-#endif
+# if XF86Server
+# define BuildXIE YES
+# else
+# define BuildXIE NO
+# endif
#endif
#ifndef BuildXIElib
-#define BuildXIElib YES
+# define BuildXIElib YES
#endif
#ifndef BuildDBElib
-#define BuildDBElib YES
+# define BuildDBElib YES
#endif
#ifndef BuildRECORDlib
-#define BuildRECORDlib YES
+# define BuildRECORDlib YES
#endif
#ifndef BuildXKBlib
-#define BuildXKBlib YES
+# define BuildXKBlib YES
#endif
#ifndef BuildScreenSaverExt
-#define BuildScreenSaverExt YES
+# define BuildScreenSaverExt YES
#endif
/*
* Build XInput support
*/
#ifndef BuildXInputExt
-#define BuildXInputExt YES
+# define BuildXInputExt YES
#endif
/* Build Xinerama (aka panoramiX) extension */
#ifndef BuildXinerama
-#define BuildXinerama YES
+# define BuildXinerama YES
#endif
#if 0
#ifndef JoystickSupport
-#define JoystickSupport NO
+# define JoystickSupport NO
#endif
#endif
@@ -541,35 +559,32 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* in the servers
*/
#ifndef BuildScreenSaverLibrary
-#define BuildScreenSaverLibrary YES
+# define BuildScreenSaverLibrary YES
#endif
#ifndef BuildXF86MiscLibrary
-#define BuildXF86MiscLibrary YES
+# define BuildXF86MiscLibrary YES
#endif
#ifndef BuildXF86DGALibrary
-#define BuildXF86DGALibrary YES
+# define BuildXF86DGALibrary YES
#endif
#ifndef BuildXF86VidModeLibrary
-#define BuildXF86VidModeLibrary YES
+# define BuildXF86VidModeLibrary YES
#endif
#ifndef BuildXvLibrary
-#define BuildXvLibrary YES
+# define BuildXvLibrary YES
#endif
#ifndef BuildXantiLibrary
-#define BuildXantiLibrary NO /* See the note for BuildXantiExt */
+# define BuildXantiLibrary NO /* See the note for BuildXantiExt */
#endif
#ifndef BuildGLXLibrary
-#define BuildGLXLibrary YES
-#endif
-#ifndef BuildXF86RushLibrary
-#define BuildXF86RushLibrary BuildXF86RushExt
+# define BuildGLXLibrary YES
#endif
/*
* Build the XFree86-VidMode extension
*/
#ifndef BuildXF86VidModeExt
-#define BuildXF86VidModeExt YES
+# define BuildXF86VidModeExt YES
#endif
/* Don't build this now because the interface hasn't been done yet */
@@ -577,14 +592,14 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* Build the XFree86-Misc extension
*/
#ifndef BuildXF86MiscExt
-#define BuildXF86MiscExt NO
+# define BuildXF86MiscExt NO
#endif
/*
* Build the XFree86-Bigfont extension
*/
#ifndef BuildXF86BigfontExt
-#define BuildXF86BigfontExt HasShm
+# define BuildXF86BigfontExt YES
#endif
/*
@@ -592,43 +607,43 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
*/
/* There are problems building XF86Setup, so turn it off for now */
#ifndef BuildXF86Setup
-#define BuildXF86Setup NO
+# define BuildXF86Setup NO
#endif
#ifndef BuildXF86Setup
-#if HasTk && HasTcl && BuildXF86VidModeLibrary && BuildXF86MiscLibrary && BuildXKBlib
-#define BuildXF86Setup YES
-#else
-#define BuildXF86Setup NO
-#endif
+# if HasTk && HasTcl && BuildXF86VidModeLibrary && BuildXF86MiscLibrary && BuildXKBlib
+# define BuildXF86Setup YES
+# else
+# define BuildXF86Setup NO
+# endif
#endif
#ifndef XF86SetupUsesStaticTk
-#define XF86SetupUsesStaticTk YES
+# define XF86SetupUsesStaticTk YES
#endif
#ifndef XF86SetupUsesStaticTcl
-#define XF86SetupUsesStaticTcl YES
+# define XF86SetupUsesStaticTcl YES
#endif
/*
* Build the XFree86 DGA support
*/
#ifndef BuildXF86DGA
-#define BuildXF86DGA YES
+# define BuildXF86DGA YES
#endif
/*
* Build the DPMS extension support
*/
#ifndef BuildDPMSExt
-#define BuildDPMSExt YES
+# define BuildDPMSExt YES
#endif
/*
* Build the X Video Extension
*/
#ifndef BuildXvExt
-#define BuildXvExt YES
+# define BuildXvExt YES
#endif
/*
@@ -636,27 +651,27 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* temporarily)
*/
#ifndef BuildXantiExt
-#define BuildXantiExt NO
+# define BuildXantiExt NO
#endif
#if Malloc0ReturnsNull
-#ifndef XtMalloc0ReturnsNullDefines
-#define XtMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines -DXTMALLOC_BC
-#endif
+# ifndef XtMalloc0ReturnsNullDefines
+# define XtMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines -DXTMALLOC_BC
+# endif
#endif
#ifndef UseInternalMalloc
-#define UseInternalMalloc YES
+# define UseInternalMalloc YES
#endif
#ifndef HasDlsymBug
-#define HasDlsymBug NO
+# define HasDlsymBug NO
#endif
#ifndef HasMTRRSupport
-#define HasMTRRSupport NO
+# define HasMTRRSupport NO
#endif
/*
@@ -667,99 +682,99 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
* 866332800 is Sun Jun 15 00:00:00 1997 GMT
*/
#ifndef XF86ServerExpiry
-#define XF86ServerExpiry 866332800
+# define XF86ServerExpiry 866332800
#endif
/*
* Build the font server
*/
#ifndef BuildFontServer
-#define BuildFontServer YES
+# define BuildFontServer YES
#endif
/*
* Include fonts support
*/
#ifndef BuildSpeedo
-#define BuildSpeedo YES
+# define BuildSpeedo YES
#endif
#ifndef BuildType1
-#define BuildType1 YES
+# define BuildType1 YES
#endif
#ifndef BuildCID
-#define BuildCID YES
+# define BuildCID YES
#endif
#ifndef BuildFreeType
-#define BuildFreeType YES
+# define BuildFreeType YES
#endif
-#ifndef BuildXTT
-#define BuildXTT YES
+#ifndef BuildXTrueType
+# define BuildXTrueType YES
#endif
/*
* By default, build all of the fonts.
*/
#ifndef Build75DpiFonts
-#define Build75DpiFonts YES
+# define Build75DpiFonts YES
#endif
#ifndef Build100DpiFonts
-#define Build100DpiFonts YES
+# define Build100DpiFonts YES
#endif
#ifndef BuildSpeedoFonts
-#define BuildSpeedoFonts YES
+# define BuildSpeedoFonts YES
#endif
#ifndef BuildType1Fonts
-#define BuildType1Fonts YES
+# define BuildType1Fonts YES
#endif
#ifndef BuildCIDFonts
-#define BuildCIDFonts YES
+# define BuildCIDFonts YES
#endif
#ifndef BuildCyrillicFonts
-#define BuildCyrillicFonts YES
+# define BuildCyrillicFonts YES
#endif
#ifndef BuildLatin2Fonts
-#define BuildLatin2Fonts YES
+# define BuildLatin2Fonts YES
#endif
#ifndef UseKoi8RForCyrillic
-#define UseKoi8RForCyrillic YES
+# define UseKoi8RForCyrillic YES
#endif
/*
* By default, create the local font directory
*/
#ifndef MakeLocalFontDir
-#define MakeLocalFontDir YES
+# define MakeLocalFontDir YES
#endif
/*
* Build scanpci?
*/
#ifndef BuildScanpci
-#if SystemV || SystemV4 || \
+# if SystemV || SystemV4 || \
(defined(LinuxArchitecture) && !defined(Mc68020Architecture) && \
!defined(PpcArchitecture)) || \
defined(i386BsdArchitecture) || defined(LynxOSArchitecture) || \
defined(OS2Architecture)
-#define BuildScanpci YES
-#else
-#define BuildScanpci NO
-#endif
+# define BuildScanpci YES
+# else
+# define BuildScanpci NO
+# endif
#endif
#ifndef CompressAllFonts
-#define CompressAllFonts YES
+# define CompressAllFonts YES
#endif
#ifndef GzipFontCompression
-#define GzipFontCompression YES
+# define GzipFontCompression YES
#endif
#ifndef StripInstalledPrograms
-#define StripInstalledPrograms YES
+# define StripInstalledPrograms YES
#endif
#ifndef InstallJapaneseDocs
@@ -767,52 +782,52 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
#if BuildXF86DGA
-#define XFree86DGADefines -DXFreeXDGA
+# define XFree86DGADefines -DXFreeXDGA
#else
-#define XFree86DGADefines /**/
+# define XFree86DGADefines /**/
#endif
#if BuildXvExt
-#define XFree86XvDefines -DXvExtension
+# define XFree86XvDefines -DXvExtension
#else
-#define XFree86XvDefines /**/
+# define XFree86XvDefines /**/
#endif
#ifndef DlopenHack
-#define DlopenHack -DDLOPEN_HACK
+# define DlopenHack -DDLOPEN_HACK
#endif
#ifndef LoaderDefines
-#if MakeDllModules
-#define ExtraLoaderDefines DlopenHack
-#else
-#define ExtraLoaderDefines /**/
-#endif
+# if MakeDllModules
+# define ExtraLoaderDefines DlopenHack
+# else
+# define ExtraLoaderDefines /**/
+# endif
#endif
#if DoLoadableServer
-#define XFree86LoaderDefines -DXFree86LOADER ExtraLoaderDefines
+# define XFree86LoaderDefines -DXFree86LOADER ExtraLoaderDefines
#else
-#define XFree86LoaderDefines /**/
+# define XFree86LoaderDefines /**/
#endif
#ifndef MakeHasPosixVariableSubstitutions
-#if !HasBsdMake && !defined(SunArchitecture)
-#define MakeHasPosixVariableSubstitutions NO
-#else
-#define MakeHasPosixVariableSubstitutions YES
-#endif
+# if !HasBsdMake && !defined(SunArchitecture)
+# define MakeHasPosixVariableSubstitutions NO
+# else
+# define MakeHasPosixVariableSubstitutions YES
+# endif
#endif
#if !HasSnprintf
-#define ServerSnprintfDefines -DNEED_SNPRINTF
+# define ServerSnprintfDefines -DNEED_SNPRINTF
#else
-#define ServerSnprintfDefines /**/
+# define ServerSnprintfDefines /**/
#endif
/* Server defines required for all OSs */
#ifndef XFree86ServerDefines
-#define XFree86ServerDefines -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \
+# define XFree86ServerDefines -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \
XFree86DGADefines XFree86XvDefines \
XFree86LoaderDefines -DXFree86Server \
VidModeExtensionDefines \
@@ -822,50 +837,59 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
#ifndef XFree86ServerOSDefines
-#define XFree86ServerOSDefines -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \
+# define XFree86ServerOSDefines -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \
-DDDXOSVERRORF -DSMART_SCHEDULE
#endif
#ifndef XFree86ConsoleDefines
-#ifdef i386BsdArchitecture
-#define XFree86ConsoleDefines -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT
-#else
-#define XFree86ConsoleDefines /**/
+# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture)
+# define XFree86ConsoleDefines -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT
+# else
+# define XFree86ConsoleDefines /**/
+# endif
+#endif
+
+/* Support for USB mouse */
+#ifndef UsbMouseSupport
+# define UsbMouseSupport NO
#endif
+/* Does this OS have libusb ? */
+#ifndef HasLibUsb
+# define HasLibUsb NO
#endif
#ifndef UseServerLock
-#define UseServerLock YES
+# define UseServerLock YES
#endif
#ifndef XnestServer
-#define XnestServer YES
+# define XnestServer YES
#endif
#ifndef XVirtualFramebufferServer
-#define XVirtualFramebufferServer YES
+# define XVirtualFramebufferServer YES
#endif
#ifndef XprtServer
-#define XprtServer YES
+# define XprtServer YES
#endif
#ifndef ServerExtraDefines
-#define ServerExtraDefines XFree86ServerDefines
+# define ServerExtraDefines XFree86ServerDefines
#endif
#ifndef ServerOSDefines
-#define ServerOSDefines XFree86ServerOSDefines
+# define ServerOSDefines XFree86ServerOSDefines
#endif
#ifndef DriverSDKDir
-#define DriverSDKDir $(USRLIBDIR)/Server
+# define DriverSDKDir $(USRLIBDIR)/Server
#endif
#ifndef DriverSDKModuleDir
-#define DriverSDKModuleDir $(USRLIBDIR)/Server/modules
+# define DriverSDKModuleDir $(USRLIBDIR)/Server/modules
#endif
#ifndef DriverSDKIncludeDir
-#define DriverSDKIncludeDir $(USRLIBDIR)/Server/include
+# define DriverSDKIncludeDir $(USRLIBDIR)/Server/include
#endif
DRIVERSDKDIR = DriverSDKDir
@@ -919,88 +943,88 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese
*/
#ifndef AsmDefines
-#define AsmDefines /**/
+# define AsmDefines /**/
#endif
#ifndef OtherIConfigFiles
-#define OtherIConfigFiles $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules
+# define OtherIConfigFiles $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules
#endif
#ifndef XFree86Version
-#define XFree86Version 3917
+# define XFree86Version 3918
#endif
#ifndef XVendorString
-#define XVendorString "The XFree86 Project, Inc"
+# define XVendorString "The XFree86 Project, Inc"
#endif
#ifndef XVendorRelease
-#define XVendorRelease XFree86Version
+# define XVendorRelease XFree86Version
#endif
#ifndef UseRgbTxt
-#define UseRgbTxt YES
+# define UseRgbTxt YES
#endif
#ifndef ManSuffix
-#define ManSuffix 1
+# define ManSuffix 1
#endif
/*
* GNU Compiler stuff
*/
#ifndef HasGcc2
-#define HasGcc2 NO
+# define HasGcc2 NO
#endif
#ifndef HasGcc
-#define HasGcc HasGcc2
+# define HasGcc HasGcc2
#endif
#ifndef HasGcc2ForCplusplus
-#define HasGcc2ForCplusplus HasGcc2
+# define HasGcc2ForCplusplus HasGcc2
#endif
#if HasGcc
-#ifndef GccWarningOptions
-#define GccWarningOptions -Wall -Wpointer-arith -Wstrict-prototypes \
+# ifndef GccWarningOptions
+# define GccWarningOptions -Wall -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs
-#endif
-#ifndef DefaultCCOptions
-#if defined(UseInstalled)
-#define DefaultCCOptions /* -ansi */
-#else
-#define DefaultCCOptions -ansi -pedantic GccWarningOptions
-#endif
-#endif
-#if defined(UseInstalled)
-#ifndef UseGccMakeDepend
-#define UseGccMakeDepend YES
-#endif
-#endif
+# endif
+# ifndef DefaultCCOptions
+# if defined(UseInstalled)
+# define DefaultCCOptions /* -ansi */
+# else
+# define DefaultCCOptions -ansi -pedantic GccWarningOptions
+# endif
+# endif
+# if defined(UseInstalled)
+# ifndef UseGccMakeDepend
+# define UseGccMakeDepend YES
+# endif
+# endif
#endif
#if HasGcc2 && defined(i386Architecture)
-#ifndef DefaultGcc2i386Opt
-#define DefaultGcc2i386Opt -O2 -fno-strength-reduce
-#endif
+# ifndef DefaultGcc2i386Opt
+# define DefaultGcc2i386Opt -O2 -fno-strength-reduce
+# endif
#endif
#if HasGcc2 && defined(AlphaArchitecture)
-#ifndef DefaultGcc2AxpOpt
-#define DefaultGcc2AxpOpt -O2
-#endif
+# ifndef DefaultGcc2AxpOpt
+# define DefaultGcc2AxpOpt -O2
+# endif
#endif
#ifndef DefaultGcc2DebugOpt
-#define DefaultGcc2DebugOpt -g
+# define DefaultGcc2DebugOpt -g
#endif
#if HasGcc2 && DebuggableLibraries
-#define LibraryDebugOpt DefaultGcc2DebugOpt
+# define LibraryDebugOpt DefaultGcc2DebugOpt
#endif
#ifndef DontDefineXF86Contrib
-#define XF86Contrib
+# define XF86Contrib
#endif
#include <xf86.rules>
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/Makefile.in b/xc/extras/FreeType/contrib/ttf2bdf/Makefile.in
index 041270a44..a68bb2dfe 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/Makefile.in
+++ b/xc/extras/FreeType/contrib/ttf2bdf/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.2 1999/12/05 23:10:26 daryll Exp $
+# $Id: Makefile.in,v 1.3 2000/02/22 22:10:26 kem Exp $
#
#
@@ -26,6 +26,7 @@
#
RM = @RM@
+MKINSTALLDIRS = ../../mkinstalldirs
CC = @CC@
CFLAGS = @XX_CFLAGS@ @CFLAGS@
@@ -62,8 +63,7 @@ distclean: clean
$(CC) $(CFLAGS) $(INCS) -c $< -o $@
install: ttf2bdf
- @if [ ! -d $(bindir) ] ; then \
- mkdir $(bindir); fi
+ @$(MKINSTALLDIRS) $(bindir) $(mandir)/man1
@cp ttf2bdf $(bindir)/ttf2bdf
@cp ttf2bdf.man $(mandir)/man1/ttf2bdf.1
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/README b/xc/extras/FreeType/contrib/ttf2bdf/README
index 83b6bb9a0..d3f306bcf 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/README
+++ b/xc/extras/FreeType/contrib/ttf2bdf/README
@@ -1,10 +1,10 @@
#
-# $Id: README,v 1.2 1999/12/05 23:10:26 daryll Exp $
+# $Id: README,v 1.3 2000/02/22 22:10:26 kem Exp $
#
#
-# Copyright 1996, 1997, 1998 Computing Research Labs, New Mexico State
-# University
+# Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
+# New Mexico State University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -25,7 +25,7 @@
# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-This is version 2.2 of a program to convert TrueType fonts to BDF fonts using
+This is version 2.7 of a program to convert TrueType fonts to BDF fonts using
the FreeType renderer.
BDF fonts can be edited using the XmBDFEditor which is available from (replace
@@ -37,7 +37,6 @@ the <version> with the most current version number):
[Binaries: Linux/Pentium, Solaris, SunOS]
ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed-<version>-ELF.tar.gz
ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed-<version>-SOLARIS.tar.gz
- ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed-<version>-SUNOS.tar.gz
COMPILING ttf2bdf
-----------------
@@ -101,8 +100,58 @@ Thanks go to the following people:
Roman Czyborra <czyborra@cs.tu-berlin.de> for pointing out the need for a
change from UNICODE-2.0 to ISO10646-1 in the font XLFD name.
+ Mike Blazer <blazer@mail.nevalink.ru> for pointing out the include changes
+ needed to compile on Windows.
+
+ Solofo Ramangalahy <solofo@mpi-sb.mpg.de> for contributing the ISO8859.1 and
+ ISO8859.3 mapping tables.
+
+ Antoine Leca <Antoine.Leca@renault.fr> for suggesting the exchange of
+ columns in the mapping table to better fit the mapping table format used by
+ many.
+
+ Robert Brady <rwb197@ecs.soton.ac.uk> for pointing out a problem with the
+ length of _XFREE86_GLYPH_RANGES properties and an Exceed font compiler.
+
CHANGES
-------
+Version 2.7
+===========
+ 1. Swapped all the columns in the mapping files.
+
+ 2. Changed the mapping table loader to index on the second column instead of
+ the first.
+
+ 3. Reduced the line length of _XFREE86_GLYPH_RANGES properties to 256
+ instead of 512.
+
+Version 2.6
+===========
+ 1. Changed the includes to deal with compilation on Windows.
+
+ 2. Added some new mapping tables.
+
+Version 2.5
+===========
+ 1. Updated the copyright dates.
+
+ 2. Fixed an incorrect parameter for Traditional C compilers.
+
+ 3. Added generation of the _XFREE86_GLYPH_RANGES properties.
+
+Version 2.4
+===========
+ 1. Change all CRLF's, CR's, or LF's in copyright strings to double spaces.
+
+ 2. Changed it so gcc 2.8.1 likes the return type of main() again.
+
+Version 2.3
+===========
+ 1. Changed Makefile.in a bit to make installation more consistent.
+
+ 2. Changed the lower limit for the vertical and horizontal resolutions to be
+ 10dpi instead of 50dpi.
+
Version 2.2
===========
1. Added missing documentation in the manual page.
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type b/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type
deleted file mode 100755
index 4dc27c71b..000000000
--- a/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/csh
-# -*- mode:SH; -*-
-#
-# This script creates series of bdf files from TTF file.
-#
-#
-# Please set up parameters
-#
-# Font dpi:
-set DPI=96
-
-#
-# TrueType files dir.
-set ttf_dir=~/ttf
-
-# TTF files, please specify only base name
-# Script will try to use BolD, Italic and BoldItalic versions of face
-set FACES="ARIAL ARIBLK ARIALN TAHOMA TIMES VERDANA"
-
-
-# Output codepage
-# koi8.r
-# windows.1251
-# iso8859.5
-# iso8859.2
-set LANG_ID=koi8.r
-
-foreach x ( 7 8 9 10 11 12 14 16 18 20 24 30 50 100 150)
-foreach z ( $FACES )
-set y = ${ttf_dir}/${z}
-#
-# Simple face
- if( -e ${y}.TTF ) then
- echo ${y} at ${x}pt
- ./ttf2bdf -m $LANG_ID -p $x -r $DPI ${y}.TTF | bdftopcf | compress > ${DPI}dpi/${z}${x}.pcf.Z
- endif
-#
-# Bold face
- if( -e ${y}BD.TTF ) then
- echo Bold ${y} at ${x}pt
- ./ttf2bdf -m $LANG_ID -p $x -r $DPI -w bold ${y}BD.TTF | bdftopcf | compress > ${DPI}dpi/${z}bd${x}.pcf.Z
- endif
-#
-# Italic face
- if( -e ${y}I.TTF ) then
- echo Italic ${y} at ${x}pt
- ./ttf2bdf -m $LANG_ID -p $x -r $DPI -s o ${y}I.TTF | bdftopcf | compress >${DPI}dpi/${z}i${x}.pcf.Z
- endif
-#
-# Bold Italic face
- if( -e ${y}BI.TTF ) then
- echo Bold Italic ${y} at ${x}pt
- ./ttf2bdf -m $LANG_ID -p $x -r $DPI -w bold -s o ${y}BI.TTF | bdftopcf | compress > ${DPI}dpi/${z}bi${x}.pcf.Z
- endif
-end
-end
-
-echo Creating fonts directory...
-cd ${DPI}dpi
-mkfontdir
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type_m b/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type_m
deleted file mode 100755
index da9d6a1a1..000000000
--- a/xc/extras/FreeType/contrib/ttf2bdf/contrib/create_type_m
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/csh
-# -*- mode:SH; -*-
-#
-# This script creates series of bdf files from TTF file.
-#
-#
-# Please set up parameters
-#
-# Font dpi:
-set DPI=96
-
-#
-# TrueType files dir.
-set ttf_dir=~/ttf
-
-# TTF files, please specify only base name
-# Script will try to use BolD, Italic and BoldItalic versions of face
-set FACES="COUR MONOTYPE"
-
-# Output codepage
-# koi8.r
-# windows.1251
-# iso8859.5
-# iso8859.2
-set LANG_ID=koi8.r
-
-foreach x ( 7 8 9 10 11 12 14 16 18 20 24 30 50 100 150)
-foreach z ( $FACES )
-set y = ${ttf_dir}/${z}
-#
-# Simple face
- if( -e ${y}.TTF ) then
- echo ${z} at ${x}pt
- ./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI ${y}.TTF | bdftopcf | compress > ${DPI}dpi/${z}${x}.pcf.Z
- endif
-#
-# Bold face
- if( -e ${y}BD.TTF ) then
- echo Bold ${z} at ${x}pt
- ./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -w bold ${y}BD.TTF | bdftopcf | compress > ${DPI}dpi/${z}bd${x}.pcf.Z
- endif
-#
-# Italic face
- if( -e ${y}I.TTF ) then
- echo Italic ${z} at ${x}pt
- ./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -s o ${y}I.TTF | bdftopcf | compress >${DPI}dpi/${z}i${x}.pcf.Z
- endif
-#
-# Bold Italic face
- if( -e ${y}BI.TTF ) then
- echo Bold Italic ${z} at ${x}pt
- ./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -w bold -s o ${y}BI.TTF | bdftopcf | compress > ${DPI}dpi/${z}bi${x}.pcf.Z
- endif
-end
-end
-
-#echo Creating fonts directory...
-#cd ${DPI}dpi
-#mkfontdir
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/remap.c b/xc/extras/FreeType/contrib/ttf2bdf/remap.c
index bcd1287b9..0fd880394 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/remap.c
+++ b/xc/extras/FreeType/contrib/ttf2bdf/remap.c
@@ -1,6 +1,6 @@
/*
- * Copyright 1996, 1997, 1998 Computing Research Labs, New Mexico State
- * University
+ * Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
+ * New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,16 +22,21 @@
*/
#ifndef lint
#ifdef __GNUC__
-static char rcsid[] __attribute__ ((unused)) = "$Id: remap.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Id: remap.c,v 1.3 2000/02/22 22:10:26 kem Exp $";
#else
-static char rcsid[] = "$Id: remap.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+static char rcsid[] = "$Id: remap.c,v 1.3 2000/02/22 22:10:26 kem Exp $";
#endif
#endif
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <stdlib.h>
#include <unistd.h>
+#endif
/*
* Structure for managing simple lists in place.
@@ -562,10 +567,11 @@ void *client_data;
}
/*
- * Get the left hand value. Always assume the values are in hex.
+ * Get the second field value as the key (the Unicode value). Always
+ * assume the values are in hex.
*/
- key = my_atous(list.field[0], 0, 16);
- val = my_atous(list.field[1], 0, 16);
+ key = my_atous(list.field[1], 0, 16);
+ val = my_atous(list.field[0], 0, 16);
trie_insert(key, val);
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/remap.h b/xc/extras/FreeType/contrib/ttf2bdf/remap.h
index d1d3ef6d4..46eb4afef 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/remap.h
+++ b/xc/extras/FreeType/contrib/ttf2bdf/remap.h
@@ -1,6 +1,6 @@
/*
- * Copyright 1996, 1997, 1998 Computing Research Labs, New Mexico State
- * University
+ * Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
+ * New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,7 +25,7 @@
#define _h_remap
/*
- * $Id: remap.h,v 1.2 1999/12/05 23:10:26 daryll Exp $
+ * $Id: remap.h,v 1.3 2000/02/22 22:10:26 kem Exp $
*/
#ifdef __cplusplus
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.c b/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.c
index f302831b2..4f208d798 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.c
+++ b/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.c
@@ -1,6 +1,6 @@
/*
- * Copyright 1996, 1997, 1998 Computing Research Labs, New Mexico State
- * University
+ * Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
+ * New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,16 +22,22 @@
*/
#ifndef lint
#ifdef __GNUC__
-static char rcsid[] __attribute__ ((unused)) = "$Id: ttf2bdf.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Id: ttf2bdf.c,v 1.3 2000/02/22 22:10:26 kem Exp $";
#else
-static char rcsid[] = "$Id: ttf2bdf.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+static char rcsid[] = "$Id: ttf2bdf.c,v 1.3 2000/02/22 22:10:26 kem Exp $";
#endif
#endif
#include <stdio.h>
+
+#ifdef WIN32
+#include <windows.h>
+#else
#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
+#endif
+
+#include <string.h>
#include "freetype.h"
@@ -49,7 +55,7 @@ static char rcsid[] = "$Id: ttf2bdf.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
/*
* The version of ttf2bdf.
*/
-#define TTF2BDF_VERSION "2.2"
+#define TTF2BDF_VERSION "2.8"
/*
* Set the default values used to generate a BDF font.
@@ -328,12 +334,12 @@ ttf_get_english_name(char *name, int nameID, int dash)
#else
ttf_get_english_name(name, nameID, dash)
char *name;
-int nameID, dash_to_space;
+int nameID, dash;
#endif
{
TT_UShort slen;
int i, j, encid, nrec;
- short nrPlatformID, nrEncodingID, nrLanguageID, nrNameID;
+ unsigned short nrPlatformID, nrEncodingID, nrLanguageID, nrNameID;
char *s;
nrec = TT_Get_Name_Count(face);
@@ -365,7 +371,12 @@ int nameID, dash_to_space;
for (i = 1; s != 0 && i < slen; i += 2) {
if (dash)
*name++ = (s[i] == '-' || s[i] == ' ') ? dash : s[i];
- else
+ else if (s[i] == '\r' || s[i] == '\n') {
+ if (s[i] == '\r' && i + 2 < slen && s[i + 2] == '\n')
+ i += 2;
+ *name++ = ' ';
+ *name++ = ' ';
+ } else
*name++ = s[i];
}
*name = 0;
@@ -396,7 +407,12 @@ int nameID, dash_to_space;
for (i = 1; s != 0 && i < slen; i += 2) {
if (dash)
*name++ = (s[i] == '-' || s[i] == ' ') ? dash : s[i];
- else
+ else if (s[i] == '\r' || s[i] == '\n') {
+ if (s[i] == '\r' && i + 2 < slen && s[i + 2] == '\n')
+ i += 2;
+ *name++ = ' ';
+ *name++ = ' ';
+ } else
*name++ = s[i];
}
*name = 0;
@@ -746,8 +762,8 @@ char *iname, *oname;
continue;
/*
- * Determine the DWIDTH (device width, or advance width in TT
- * terms) and the SWIDTH (scalable width) values.
+ * Determine the DWIDTH (device width, or advance width in TT terms)
+ * and the SWIDTH (scalable width) values.
*/
dwidth = metrics.advance >> 6;
dw = (double) dwidth;
@@ -943,7 +959,7 @@ char *iname, *oname;
/*
* Print the properties.
*/
- fprintf(out, "STARTPROPERTIES 19\n");
+ fprintf(out, "STARTPROPERTIES %hd\n", 19);
/*
* Print the font properties from the XLFD name.
@@ -1054,7 +1070,7 @@ char *iname, *oname;
#endif
{
TT_Long i;
- TT_Short p, e;
+ TT_UShort p, e;
/*
* Get the requested cmap.
@@ -1219,7 +1235,7 @@ int eval;
exit(eval);
}
-void
+int
#ifdef __STDC__
main(int argc, char *argv[])
#else
@@ -1418,15 +1434,15 @@ char *argv[];
}
/*
- * Arbitrarily limit the resolutions to a minimum of 50dpi and a maximum
+ * Arbitrarily limit the resolutions to a minimum of 10dpi and a maximum
* of 1200dpi.
*/
- if (hres < 50 || hres > 1200) {
+ if (hres < 10 || hres > 1200) {
fprintf(stderr, "%s: invalid horizontal resolution '%ddpi'.\n",
prog, hres);
exit(1);
}
- if (vres < 50 || vres > 1200) {
+ if (vres < 10 || vres > 1200) {
fprintf(stderr, "%s: invalid vertical resolution '%ddpi'.\n",
prog, vres);
exit(1);
@@ -1560,4 +1576,6 @@ char *argv[];
(void) TT_Done_FreeType(engine);
exit(res);
+
+ return 0;
}
diff --git a/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.man b/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.man
index 942abcb5e..5ffd4964f 100644
--- a/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.man
+++ b/xc/extras/FreeType/contrib/ttf2bdf/ttf2bdf.man
@@ -1,7 +1,7 @@
.\"
-.\" $Id: ttf2bdf.man,v 1.2 1999/12/05 23:10:26 daryll Exp $
+.\" $Id: ttf2bdf.man,v 1.3 2000/02/22 22:10:26 kem Exp $
.\"
-.TH TTF2BDF 1 "26 June 1998" "X Version 11"
+.TH TTF2BDF 1 "21 October 1999" "X Version 11"
.SH NAME
ttf2bdf \- TrueType to BDF font converter
@@ -30,17 +30,18 @@ set the desired point size (see default value by running the program with the
.TP 8
.I -r n
set both the horizontal and the vertical resolution (see default value by
-running the program with the -h option).
+running the program with the -h option). The minimum is 10dpi and the maximum
+is 1200dpi.
.PP
.TP 8
.I -rh n
set the horizontal resolution (see default value by running the program with
-the -h option).
+the -h option). The minimum is 10dpi and the maximum is 1200dpi.
.PP
.TP 8
.I -rv n
set the vertical resolution (see default value by running the program with
-the -h option).
+the -h option). The minimum is 10dpi and the maximum is 1200dpi.
.PP
.TP 8
.I -o outfile
@@ -132,12 +133,11 @@ REGISTRY ISO8859
.br
ENCODING 2
.sp
-The remapping data should be two columns of hexadecimal numbers,
-separated by spaces or tabs. The first column should be the hexadecimal
-code of the glyph in the "cmap" table ttf2bdf is using. The second
-column should have the code which should be used in the BDF font. An
-example mapping file is provided which will map fonts from Unicode
-(default cmap table) to ISO8859-2.
+The remapping data should be two columns of hexadecimal numbers, separated by
+spaces or tabs. The first column should have the code which should be used in
+the BDF font. The second column should be the hexadecimal code of the glyph
+in the "cmap" table ttf2bdf is using. An example mapping file is provided
+which will map fonts from Unicode (the default "cmap" table) to ISO8859-2.
.sp
Unicode is not the only option. If you choose another platform and
encoding ID on the command line, then the remapping is assumed to map
@@ -180,6 +180,12 @@ Oleg N. Yakovlev <yashka@optima.dnepropetrovsk.ua> for pointing out a problem.
Bertrand Petit <elrond@phoe.frmug.org> for additional functionality.
.br
Roman Czyborra <czyborra@cs.tu-berlin.de> for pointing out some problems.
+.br
+Mike Blazer <blazer@mail.nevalink.ru> for some Window's compilation advice.
+.br
+Solofo Ramangalahy <solofo@mpi-sb.mpg.de> for contributing some mapping
+tables.
+Antoine Leca <Antoine.Leca@renault.fr> for mapping table suggestions.
.SH AUTHOR
Mark Leisher
.br
diff --git a/xc/extras/FreeType/contrib/ttf2pfb/ttf2pfb.c b/xc/extras/FreeType/contrib/ttf2pfb/ttf2pfb.c
index 93ed78e41..d9dd1d97e 100644
--- a/xc/extras/FreeType/contrib/ttf2pfb/ttf2pfb.c
+++ b/xc/extras/FreeType/contrib/ttf2pfb/ttf2pfb.c
@@ -1,57 +1,53 @@
/*
* ttf2pfb.c -- TrueType to PostScript Type 1 Font converter.
- *
+ *
* Author: Chun-Yu Lee <d791013@ce.ntu.edu.tw>
+ * Maintainer: Werner Lemberg <wl@gnu.org>
+ *
+ * The generated output is in a raw Type 1 Font format. An encoder
+ * (e.g. t1asm or t1binary) is needed to convert it into PFA or PFB format.
+ *
+ * This program was adapted from the ntu2cjk package (which was part of the
+ * LaTeX2e CJK package (by Werner Lemberg <wl@gnu.org>)).
+ *
*
- * The generated output is in a raw Type 1 Font format, required
- * encoders (e.g. t1asm or t1binary) converting to PFA or PFB font.
+ * Modified by Joachim H. Kaiser <jhk@cmpnetmail.com> to include real glyph
+ * names and other font infos (see PS_Head function).
+ * The test programs of the FreeType distribution have been heavily used as
+ * templates.
*
- * This program was adapted from the ntu2cjk package (part of the
- * LaTeX2e CJK package (by Werner Lemberg <wl@gnu.org>))
- * and those of contributed and test programs in the FreeType archive
- * tree.
*/
/*
- * Requirement:
- * - the FreeType (v1.0, maybe higher) Library.
- * - T1asm or similar converter if PFA or PFB format required
- * - getafm or similar one if AFM font metrics required.
- * - afm2tfm or similar one if TFM form metrics required.
- * - CJK package (including the ntu2cjk part) if typesetting LaTeX
- * documents using the generated fonts.
+ * Requirements:
+ * - the FreeType library.
+ * - t1asm or a similar converter if PFA or PFB format is required.
+ * - getafm or a similar program if AFM font metrics are required.
+ * - afm2tfm or a similar program if TFM font metrics are required.
+ * - for compact fonts: the CJK package for typesetting LaTeX documents.
* - dvips 5.66 or higher if self-contained PostScript document
- * outputs are required.
- * - Ghostscript 3.33 or higher to be complement of some packages
- * listed above.
- */
+ * outputs with partially downloaded fonts are required. Note that
+ * the partial download code in dvips is still buggy, causing strange
+ * error messages during loading of the created PS fonts.
+ * - Ghostscript 3.33 or newer (this is optional).
+ */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
+#ifdef TM_IN_SYS_TIME
+#include <sys/time.h>
+#endif
#include <ctype.h>
#include "freetype.h"
+#include "extend/ftxpost.h" /* we are in the FreeType package tree */
-#ifndef lint
-char rcsid[] = "$Id: ttf2pfb.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
-#endif
+char rcsid[] = "$Id: ttf2pfb.c,v 1.3 2000/02/22 22:10:26 kem Exp $";
-#ifndef TTF2PFB_VERSION
-#define TTF2PFB_VERSION "alpha"
-#endif
-
-/* Set default values */
-#ifndef DEFAULT_PLATFORM_ID
-#define DEFAULT_PLATFORM_ID 3 /* for MS platform */
-#endif
-
-#ifndef DEFAULT_ENCODING_ID
-#define DEFAULT_ENCODING_ID 4 /* for Big-5 encoding (ideally) */
-/* #define DEFAULT_ENCODING_ID 1 */ /* for Unicode encoding */
-#endif
#define PID_UNICODE 3
#define EID_UNICODE 1
@@ -61,35 +57,56 @@ char rcsid[] = "$Id: ttf2pfb.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
#define EID_GB 3
#define PID_BIG5 3
#define EID_BIG5 4
-#if 0
-#define PID_KS 3 /* ???? */
-#define EID_KS 5 /* ???? */
+#define PID_KS 3 /* KS is also called Wansung */
+#define EID_KS 5
+#define PID_JOHAB 3
+#define EID_JOHAB 6
+
+/* Set default values */
+#ifndef DEFAULT_PLATFORM_ID
+#define DEFAULT_PLATFORM_ID PID_UNICODE /* MS platform */
+#endif
+
+#ifndef DEFAULT_ENCODING_ID
+#define DEFAULT_ENCODING_ID EID_UNICODE
#endif
/* The possible values for the `force_enc' variable. */
-typedef enum _enc_type
+typedef enum enc_type_
{
- GB = 1, JIS, KS, SJIS, X
+ GB = 1, Big5, JIS, KS, Johab, SJIS, X
} enc_type;
/* A variable to enforce a certain font encoding (if > 0). */
enc_type force_enc = 0;
+
#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef FAILURE
#define FAILURE -1
#endif
+
#define LINELEN 40 /* max # of columns of code range file */
+#define NAMELEN 80 /* max length of name used from LookUp */
+
/*
* Flags and globals
- */
-int verbose = FALSE; /* messages should be printed or not. */
-int compact = FALSE; /* generate compact font? */
-float fontShift = 0;
-/* float fontShift = -0.15; */ /* shift down each char 15 percent of bbox */
+ */
+
+int verbose = FALSE; /* messages should be printed or not. */
+int compact = FALSE; /* generate compact font? */
+int keep = FALSE; /* keep output font in case of error? */
+int mapping = FALSE; /* use encoding file as mapping? */
+float fontShift = 0;
#ifndef UShort
typedef unsigned short UShort;
@@ -101,30 +118,34 @@ typedef unsigned char UChar;
#define TT_Flag_On_Curve 1
/* default platform and encoding ID's. */
-int pid = DEFAULT_PLATFORM_ID;
-int eid = DEFAULT_ENCODING_ID;
+int pid = DEFAULT_PLATFORM_ID;
+int eid = DEFAULT_ENCODING_ID;
+
+
+char* prog; /* program name */
-char* prog; /* program name */
/* for orthogonality with fprintf */
#define Fputs(_string_) fprintf(out, "%s\n", _string_)
+
/* Postscript font related defines and functions */
TT_F26Dot6 lastpsx, lastpsy;
#define Coord(x) (int)(x)
-#define PS_LastPt(x,y) lastpsx = x; lastpsy = y
-#define PS_Moveto(x,y) \
- fprintf(out, "%d %d rmoveto\n", \
- Coord(x-lastpsx),Coord(y-lastpsy)); \
- PS_LastPt(x,y)
-#define PS_Lineto(x,y) \
- fprintf(out, "%d %d rlineto\n", \
- Coord(x-lastpsx),Coord(y-lastpsy)); \
- PS_LastPt(x,y)
+#define PS_LastPt(x, y) lastpsx = x; lastpsy = y
+#define PS_Moveto(x, y) \
+ fprintf(out, "%d %d rmoveto\n", \
+ Coord(x - lastpsx), Coord(y - lastpsy)); \
+ PS_LastPt(x, y)
+#define PS_Lineto(x, y) \
+ fprintf(out, "%d %d rlineto\n", \
+ Coord(x - lastpsx), Coord(y - lastpsy)); \
+ PS_LastPt(x, y)
+
/*
- * Freetype globals.
+ * Freetype globals.
*/
TT_Engine engine;
@@ -133,79 +154,81 @@ TT_Instance instance;
TT_Glyph glyph;
TT_CharMap cmap;
TT_Error error;
+TT_Post post;
-TT_Outline outline;
-TT_Glyph_Metrics metrics;
-TT_Face_Properties properties;
-/* TT_BBox bbox; */
-
-/*
- * Data structures defined for encoding vector
- */
-
-/* A code range file for the encoding vector of a font contains code
- range pairs, each pair a line. Code starting and ending are seperated
- by ' - ', note that the spaces before and after the minus sign are
- significant. Several types of syntax are shown as follows:
-
- (Note that declared code ranges must be appeared in ascending order.)
-
- 1. Absolute range, i.e. code is two byte number, e.g.:
-
- 0xA140 - 0xA17E
- 41280 - 41342
- 0xE00000 - 0xE000FF
-
- The first two lines represent the same range.
-
- 2. Relative range, i.e. code is one byte number. If the line is ended
- with a colon ':', it is designated the high byte(s) range, otherwise the
- low byte range (only the last one byte). If there is no high byte(s)
- range declared before the low byte range, the lastest defined high
- byte(s) range or '0x00 - 0x00:' will be used. e.g.:
-
- 0xA1 - 0xFE:
- 0x40 - 0x7E
- 0xA1 - 0xFE
-
- which is the Big-5 Encoding.
-
- 3. Single code. Similar to absolute or relative range but the second
- number of the range is the same as the first number. E.g.:
+TT_Outline outline;
+TT_Glyph_Metrics metrics;
+TT_Face_Properties properties;
- 0xA141 == 0xA141 - 0xA141
- 0xA1: == 0xA1 - 0xA1:
- 0xA1 == 0xA1 - 0xA1
- 4. If the high byte range is declared and there is no low byte range
- declared consecutively, it is assumed the low byte range is '0x00 - 0xFF'.
-
- 5. Comment line. A hash mark '#' followed by any stuffs to the end of the
- line is ignored. Blank line is also discarded.
+/*
+ * Data structures defined for encoding vectors
+ */
- */
+/*
+ * A code range file for the encoding vector of a font contains code
+ * range pairs, each pair a line. The values for the begin and end of the
+ * ranges are separated by ` - '. Note that the spaces before and after the
+ * minus sign are significant. The possible syntax is as follows:
+ *
+ * (Note that code ranges must appear in ascending order.)
+ *
+ * 1. Absolute range, i.e., the code is at least a two-byte number, e.g.:
+ *
+ * 0xA140 - 0xA17E
+ * 41280 - 41342
+ * 0xE00000 - 0xE000FF
+ *
+ * The first two lines represent the same range.
+ *
+ * 2. Relative range, i.e., the code is a one-byte number. If the line ends
+ * with a colon `:', it designates the high byte(s) range, otherwise the
+ * low byte range. If there is no high byte(s) range declared before the low
+ * byte range, the last defined high byte(s) range or `0x00 - 0x00:' will be
+ * used. e.g.:
+ *
+ * 0xA1 - 0xFE:
+ * 0x40 - 0x7E
+ * 0xA1 - 0xFE
+ *
+ * which is Big-5 Encoding.
+ *
+ * 3. Single code. Similar to absolute or relative range but the second
+ * number of the range is the same as the first number. E.g.:
+ *
+ * 0xA141 == 0xA141 - 0xA141
+ * 0xA1: == 0xA1 - 0xA1:
+ * 0xA1 == 0xA1 - 0xA1
+ *
+ * 4. If the high byte range is declared and there is no low byte range
+ * declared consecutively, the assumed low byte range is `0x00 - 0xFF'.
+ *
+ * 5. Comment line. A line starting with a hash mark `#' followed by any
+ * characters up to the end of the line is ignored. Blank lines are also
+ * discarded.
+ */
typedef struct _EVHigh
{
- UShort start, end;
+ UShort start, end;
} EVHigh;
-typedef struct _EVLow
+typedef struct _EVLow
{
- UChar start, end;
+ UChar start, end;
} EVLow;
-typedef struct _EVcRange
+typedef struct _EVcRange
{
- EVHigh high;
- UShort numLowRanges;
- EVLow* low;
+ EVHigh high;
+ UShort numLowRanges;
+ EVLow* low;
} EVcRange;
-typedef struct _EncVec
+typedef struct _EncVec
{
- UShort numCodeRanges;
- EVcRange* codeRange;
+ UShort numCodeRanges;
+ EVcRange* codeRange;
} EncVec;
/* Select encoding vector with respect to pid and eid */
@@ -214,178 +237,234 @@ EncVec* eVecMap[5][10];
/* Select encoding vector with respect to force_enc */
EncVec* eVecMap_force[10];
-/*
- Functions
-*/
+
+/*************/
+/* Functions */
+/*************/
+
void
-mesg (const char *msg, ...)
+mesg(const char *msg, ...)
{
va_list ap;
- va_start (ap, msg);
- vfprintf (stderr, msg, ap);
- va_end (ap);
+
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
}
+
/*
- * Usage
- */
+ * Usage.
+ */
+
void
-Usage (int eval)
+Usage(int eval)
{
#ifdef DEBUG
- mesg ("Usage: %s [-h][-v][-c][-d charcode][-l][-ng][-nc]\n", prog);
+ mesg("Usage: %s [-h][-v][-c][-k][-m][-d charcode][-l][-ng][-nc]\n", prog);
#else
- mesg ("Usage: %s [-h][-v][-c]\n", prog);
+ mesg("Usage: %s [-h][-v][-c][-k][-m]\n", prog);
#endif
- mesg ("\t[-pid id] [-eid id] [-force enc] [-enc file]\n");
- mesg ("\t[-plane pl] [-f fname] [-uid id] [-s shift]\n");
- mesg ("\t[-o output] [-ttf font.ttf | font.ttf]\n");
- mesg ("-h\t\tThis message.\n");
- mesg ("-v\t\tPrint messages during conversion.\n");
- mesg ("-c\t\tCompact font, ie 256 chars a font");
- mesg (" (useful for the CJK package).\n");
+ mesg("\t[-pid id] [-eid id] [-force enc] [-enc file]\n");
+ mesg("\t[-plane pl] [-f fname] [-uid id] [-s shift]\n");
+ mesg("\t[-o output] [-ttf font.ttf | font.ttf]\n");
+ mesg("-h\t\tThis message.\n");
+ mesg("-v\t\tPrint messages during conversion.\n");
+ mesg("-c\t\tCompact font");
+ mesg(" (256 chars per font; useful for the CJK package).\n");
+ mesg("-k\t\tKeep output file in case of error.\n");
+ mesg("-m\t\tUse encoding file as mapping file.\n");
#ifdef DEBUG
- mesg ("-d charcode\tDebug CharString for the given character code.\n");
- mesg ("-l\t\tDisplay point labels.\n");
- mesg ("-ng\t\tDo not show glyph outline.\n");
- mesg ("-nc\t\tDo not show control paths.\n");
+ mesg("-d charcode\tDebug CharString for the given character code.\n");
+ mesg("-l\t\tDisplay point labels.\n");
+ mesg("-ng\t\tDo not show glyph outline.\n");
+ mesg("-nc\t\tDo not show control paths.\n");
#endif
- mesg ("-pid id\t\tSet the platform ID [%d].\n", DEFAULT_PLATFORM_ID);
- mesg ("-eid id\t\tSet the encoding ID [%d].\n", DEFAULT_ENCODING_ID);
- mesg ("\t\t(use a strange pid & eid pair to list all possible pid,eid)\n");
- mesg ("-force enc\tForce a certain encoding [none].\n");
- mesg ("\t\tpossible values are GB, JIS, KS, SJIS, and X).\n");
- mesg ("-enc file\tFile contains code ranges [none].\n");
- mesg ("-plane pl\tA single font plane [0x0].\n");
- mesg ("-f fname\tFont name [UNKNOWN].\n");
- mesg ("-uid id\t\tThe first four digits of UID of Type1 font [7000].\n");
- mesg ("-s shift\tY-offset factor [%5.3f].\n", fontShift);
- mesg ("-o outfile\tSet the output filename [stdout].\n");
- mesg ("-ttf ttfpath\tThe TTF font pathname.\n");
+ mesg("-pid id\t\tSet the platform ID [%d].\n", DEFAULT_PLATFORM_ID);
+ mesg("-eid id\t\tSet the encoding ID [%d].\n", DEFAULT_ENCODING_ID);
+ mesg("\t\t(Use a strange pid,eid pair to list all possible pid,eid)\n");
+ mesg("-force enc\tForce a certain encoding [none].\n");
+ mesg("\t\t(Possible values are `GB', `JIS', `KS', `SJIS', and `X').\n");
+ mesg("-enc file\tFile contains code ranges [none].\n");
+ mesg("-plane pl\tA single font plane [0x0].\n");
+ mesg("-f fname\tFont name [UNKNOWN].\n");
+ mesg("-uid id\t\tUnique font ID, for private fonts 4000000-4999999 [4999999].\n");
+ mesg("-s shift\tY-offset factor [%5.3f].\n", fontShift);
+ mesg("-o outfile\tSet the output filename [stdout].\n");
+ mesg("-ttf ttfpath\tThe TTF font pathname.\n");
exit(eval);
}
+
void
-fatal (const char *msg, ...)
+fatal(const char *msg,
+ ...)
{
va_list ap;
- va_start (ap, msg);
- fprintf (stderr, "%s: ", prog);
- vfprintf (stderr, msg, ap);
- fprintf (stderr, "\n");
- va_end (ap);
- exit (FAILURE);
+
+ va_start(ap, msg);
+ fprintf(stderr, "%s: ", prog);
+ vfprintf(stderr, msg, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ exit(FAILURE);
}
+
void
-fatal_error (const char *msg, ...)
+fatal_error(const char *msg,
+ ...)
{
va_list ap;
- va_start (ap, msg);
- fprintf (stderr, "%s: error code 0x%04lx: ", prog, error);
- vfprintf (stderr, msg, ap);
- fprintf (stderr, "\n");
- va_end (ap);
- exit (FAILURE);
+
+ va_start(ap, msg);
+ fprintf(stderr, "%s: Error code 0x%04lx: ", prog, error);
+ vfprintf(stderr, msg, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ exit(FAILURE);
}
+
/*
- * Realloc a pointer.
+ * Reallocate a pointer.
*/
+
void *
-re_alloc (void* ptr, size_t size, char* sub)
+re_alloc(void* ptr,
+ size_t size,
+ char* sub)
{
- register void* value = realloc (ptr, size);
+ register void* value = realloc(ptr, size);
+
if (value == NULL)
- fatal ("%s: Virtual memory exhausted.\n", sub);
+ fatal("%s: Virtual memory exhausted", sub);
return value;
}
-/* We have to introduce the `dummy' integer to assure correct handling of
- the stack. Using `UShort' as the first parameter may fail in case
- this type is promoted to a different type (as happens e.g. under
- emx for DOS */
-EncVec*
-Alloc_EncVec (int dummy, ...)
+
+/*
+ * We have to introduce the `dummy' integer to assure correct handling of
+ * the stack. Using `UShort' as the first parameter may fail in case
+ * this type is promoted to a different type (as happens e.g. under
+ * emx for DOS).
+ */
+
+EncVec*
+Alloc_EncVec(int dummy,
+ ...)
{
- va_list vp;
- EncVec* encVec = NULL;
- EVcRange* cRange = NULL;
- EVLow* evLow = NULL;
- UShort numCR, numLows;
- int i,j;
+ va_list vp;
+ EncVec* encVec = NULL;
+ EVcRange* cRange = NULL;
+ EVLow* evLow = NULL;
+ UShort numCR, numLows;
+ int i, j;
- va_start (vp, dummy);
- numCR = va_arg (vp, UShort);
+ va_start(vp, dummy);
+ numCR = va_arg(vp, UShort);
- encVec = re_alloc (encVec, 1*sizeof(EncVec), "Alloc_EncVec");
+ encVec = re_alloc(encVec, 1 * sizeof (EncVec), "Alloc_EncVec");
encVec->numCodeRanges = numCR;
- cRange = re_alloc (cRange, numCR*sizeof(EVcRange), "Alloc_EncVec");
- for (i=0; i<numCR; i++) {
- (cRange+i)->high.start = va_arg (vp, UShort);
- (cRange+i)->high.end = va_arg (vp, UShort);
- (cRange+i)->numLowRanges = numLows = va_arg (vp, UShort);
+ cRange = re_alloc(cRange, numCR * sizeof (EVcRange), "Alloc_EncVec");
+ for (i = 0; i < numCR; i++)
+ {
+ (cRange + i)->high.start = va_arg(vp, UShort);
+ (cRange + i)->high.end = va_arg(vp, UShort);
+ (cRange + i)->numLowRanges = numLows = va_arg(vp, UShort);
evLow = NULL;
- evLow = re_alloc (evLow, numLows*sizeof(EVLow), "Alloc_EncVec");
- for (j=0; j<numLows; j++) {
- (evLow+j)->start = va_arg (vp, UChar);
- (evLow+j)->end = va_arg (vp, UChar);
+ evLow = re_alloc(evLow, numLows * sizeof (EVLow), "Alloc_EncVec");
+ for (j = 0; j < numLows; j++)
+ {
+ (evLow + j)->start = va_arg(vp, UChar);
+ (evLow + j)->end = va_arg(vp, UChar);
}
- (cRange+i)->low = evLow;
+ (cRange + i)->low = evLow;
}
- encVec->codeRange = cRange;
+ encVec->codeRange = cRange;
- va_end (vp);
+ va_end(vp);
return encVec;
}
-
+
+
void
-Known_Encodings (void)
+Known_Encodings(void)
{
- EncVec* encVec;
+ EncVec* encVec;
/* Big-5 encoding */
- encVec = Alloc_EncVec (1, 1, 0xA1, 0xFE, 2, 0x40, 0x7E, 0xA1, 0xFE);
+ encVec = Alloc_EncVec(1,
+ 1, 0xA1, 0xFE,
+ 2, 0x40, 0x7E, 0xA1, 0xFE);
eVecMap[PID_BIG5][EID_BIG5] = encVec;
- /* eVecMap_force[BIG5] = encVec; */
+ eVecMap_force[Big5] = encVec;
/* GB encoding */
- encVec = Alloc_EncVec (2, 1, 0xA1, 0xF7, 1, 0xA1, 0xFE);
+ encVec = Alloc_EncVec(2,
+ 1, 0xA1, 0xF7,
+ 1, 0xA1, 0xFE);
eVecMap[PID_GB][EID_GB] = encVec;
eVecMap_force[GB] = encVec;
/* KS encoding */
- encVec = Alloc_EncVec (3, 1, 0xA1, 0xFE, 1, 0xA1, 0xFE);
- /* eVecMap[PID_KS][EID_KS] = encVec; */
+ encVec = Alloc_EncVec(3,
+ 1, 0xA1, 0xFE,
+ 1, 0xA1, 0xFE);
+ eVecMap[PID_KS][EID_KS] = encVec;
eVecMap_force[KS] = encVec;
+ /* Johab encoding */
+ encVec = Alloc_EncVec(4,
+ 3, 0x84, 0xD3,
+ 2, 0x41, 0x7E,
+ 0x81, 0xFE,
+ 0xD8, 0xDE,
+ 2, 0x31, 0x7E,
+ 0x91, 0xFE,
+ 0xE0, 0xF9,
+ 2, 0x31, 0x7E,
+ 0x91, 0xFE);
+ eVecMap[PID_JOHAB][EID_JOHAB] = encVec;
+ eVecMap_force[Johab] = encVec;
+
/* JIS encoding */
- encVec = Alloc_EncVec (4, 1, 0xA1, 0xF4, 1, 0xA1, 0xFE);
- /* eVecMap[PID_JIS][EID_JIS] = encVec; */
+ encVec = Alloc_EncVec(5,
+ 1, 0xA1, 0xF4,
+ 1, 0xA1, 0xFE);
eVecMap_force[JIS] = encVec;
eVecMap_force[X] = encVec; /* will be internally translated to SJIS */
/* Unicode encoding */
- encVec = Alloc_EncVec (5, 1, 0x00, 0xFF, 1, 0x00, 0xFF);
+ encVec = Alloc_EncVec(6,
+ 1, 0x00, 0xFF,
+ 1, 0x00, 0xFF);
eVecMap[PID_UNICODE][EID_UNICODE] = encVec;
- /* eVecMap_force[UNICODE] = encVec; */
/* SJIS encoding */
- encVec = Alloc_EncVec (6, 3, 0x0, 0x0, 1, 0xA1, 0xDF,
- 0x81, 0x9F, 2, 0x40, 0x7E, 0x80, 0xFC,
- 0xE0, 0xEF, 2, 0x40, 0x7E, 0x80, 0xFC);
+ encVec = Alloc_EncVec(7,
+ 3, 0x0, 0x0,
+ 1, 0xA1, 0xDF,
+ 0x81, 0x9F,
+ 2, 0x40, 0x7E,
+ 0x80, 0xFC,
+ 0xE0, 0xEF,
+ 2, 0x40, 0x7E,
+ 0x80, 0xFC);
eVecMap[PID_SJIS][EID_SJIS] = encVec;
eVecMap_force[SJIS] = encVec;
}
+
/*
- * Convert JIS to SJIS encoding.
+ * Convert JIS to SJIS encoding.
*/
+
UShort
-JIS_to_SJIS (UShort code)
+JIS_to_SJIS(UShort code)
{
UShort index;
UShort cc0 = (code >> 8) & 0xFF;
@@ -406,140 +485,283 @@ JIS_to_SJIS (UShort code)
return (cc0 << 8) + cc1;
}
+
/*
- * Open TTF file and select cmap
+ * Open TTF file and select cmap.
*/
+
int
-Init_Font_Engine (char* infile)
+Init_Font_Engine(char* infile)
{
- short cmapindex, platformID, encodingID, num_cmap;
-
- error = TT_Init_FreeType (&engine);
- if (error)
- fatal_error ("couldn't initialize FreeType engine.");
- /* Open the input file. */
- error = TT_Open_Face (engine, infile, &face);
- if (error) fatal_error ("unable to open input file '%s'", infile);
+ UShort cmapindex, platformID, encodingID, num_cmap;
+
+ if (verbose)
+ printf("Initializing TrueType font engine...\n");
+
+ /* initialization of the FreeType engine */
+ error = TT_Init_FreeType(&engine);
+ if (error)
+ fatal_error("Couldn't initialize FreeType engine");
+
+ /* initialization of the post extension */
+ error = TT_Init_Post_Extension(engine);
+ if (error)
+ fatal_error("Couldn't initialize the post extension");
+
+ /* open the input file */
+ error = TT_Open_Face(engine, infile, &face);
+ if (error)
+ fatal_error("Unable to open input file `%s'", infile);
+
+ /* load full post table */
+ error = TT_Load_PS_Names(face, &post);
+ if (error)
+ fatal_error("Unable to load post table");
+
+ /* get face properties */
+ TT_Get_Face_Properties(face, &properties);
+
/* Load the instance. */
- error = TT_New_Instance (face, &instance);
- if (error) fatal_error ("couldn't create instance.");
-
- error = TT_Set_Instance_Resolutions (instance, 600, 600);
- if (error) fatal_error ("error setting resoluations.");
- error = TT_Set_Instance_CharSize (instance, 120*64);
- if (error) fatal_error ("error setting character size.");
-
- error = TT_New_Glyph (face, &glyph);
- if (error) fatal_error ("couldn't create new glyph.");
- /* Get the requested cmap. */
- num_cmap = TT_Get_CharMap_Count (face);
- for (cmapindex=0; cmapindex < num_cmap; cmapindex++) {
- TT_Get_CharMap_ID (face, cmapindex, &platformID, &encodingID);
- if (platformID == pid && encodingID == eid) break;
+ error = TT_New_Instance(face, &instance);
+ if (error)
+ fatal_error("Couldn't create instance");
+
+ error = TT_Set_Instance_Resolutions(instance, 600, 600);
+ if (error)
+ fatal_error("Error setting resolutions");
+
+ error = TT_Set_Instance_CharSize(instance, 120 * 64);
+ if (error)
+ fatal_error("Error setting character size");
+
+ error = TT_New_Glyph(face, &glyph);
+ if (error)
+ fatal_error("Couldn't create new glyph");
+
+ /* Get the requested cmap. */
+ num_cmap = TT_Get_CharMap_Count(face);
+ for (cmapindex = 0; cmapindex < num_cmap; cmapindex++)
+ {
+ TT_Get_CharMap_ID(face, cmapindex, &platformID, &encodingID);
+ if (platformID == pid && encodingID == eid)
+ break;
}
- if (cmapindex == num_cmap) {
- mesg ("Possible platform and encoding ID pairs:");
- for (cmapindex=0; cmapindex < num_cmap; cmapindex++) {
- TT_Get_CharMap_ID (face, cmapindex, &platformID, &encodingID);
- mesg (" (%d, %d)", platformID, encodingID);
+ if (cmapindex == num_cmap)
+ {
+ mesg("Possible platform and encoding ID pairs:");
+ for (cmapindex = 0; cmapindex < num_cmap; cmapindex++)
+ {
+ TT_Get_CharMap_ID(face, cmapindex, &platformID, &encodingID);
+ mesg(" (%d, %d)", platformID, encodingID);
}
mesg ("\n");
- fatal ("No character map for given platform %d encoding %d.", pid, eid);
+ fatal("No character map for given platform %d, encoding %d", pid, eid);
}
- /* malloc for glyph data */
- error = TT_Get_CharMap (face, cmapindex, &cmap);
- if (error) fatal_error ("cannot load cmap.");
-
+
+ /* malloc for glyph data */
+ error = TT_Get_CharMap(face, cmapindex, &cmap);
+ if (error)
+ fatal_error("Cannot load cmap");
+
return TRUE;
-}
+}
-/*
- * Load glyph's outline and metrics
+
+/*
+ * Get font infos: name, version, copyright.
*/
+
+char*
+LookUp_Name(int index)
+{
+ UShort platform, encoding, language, id;
+ char* string;
+ UShort string_len;
+ UShort i, n;
+
+ n = properties.num_Names;
+
+ for (i = 0; i < n; i++)
+ {
+ TT_Get_Name_ID(face, i, &platform, &encoding, &language, &id);
+ TT_Get_Name_String(face, i, &string, &string_len);
+
+ if (id == index)
+ break;
+ }
+ i = (string_len > NAMELEN) ? NAMELEN : string_len;
+ string[i] = '\0';
+ return string;
+}
+
+
+/*
+ * Load a glyph's outline and metrics.
+ */
+
int
-LoadTrueTypeChar (int idx)
+LoadTrueTypeChar(int idx)
{
- TT_Matrix scale = {(1<<16)/64, 0, 0, (1<<16)/64};
- error = TT_Load_Glyph (instance, glyph, idx, TTLOAD_DEFAULT);
- if (error) fatal_error ("load glyph");
- error = TT_Get_Glyph_Outline (glyph, &outline);
- if (error) fatal_error ("get glyph outlines.");
- TT_Transform_Outline (&outline, &scale);
- error = TT_Get_Glyph_Metrics (glyph, &metrics);
- if (error) fatal_error ("get glyph_metrics.");
+ TT_Matrix scale = {(1 << 16) / 64, 0, 0, (1 << 16) / 64};
+
+ error = TT_Load_Glyph(instance, glyph, idx, TTLOAD_DEFAULT);
+ if (error)
+ fatal_error("Load glyph");
+
+ error = TT_Get_Glyph_Outline(glyph, &outline);
+ if (error)
+ fatal_error("Get glyph outlines");
+
+ TT_Transform_Outline(&outline, &scale);
+
+ error = TT_Get_Glyph_Metrics(glyph, &metrics);
+ if (error)
+ fatal_error("Get glyph_metrics");
return TRUE;
}
+
+/*
+ * Get PS name of a glyph.
+ */
+
+char*
+PS_GlyphName(UShort idx,
+ UShort code)
+{
+ char *glyphname = ".notdef";
+ static char CJK_glyphname[8];
+
+ if (compact)
+ {
+ sprintf(CJK_glyphname, "cjk%04X", code);
+ glyphname = CJK_glyphname;
+ }
+ else
+ {
+ if (idx)
+ TT_Get_PS_Name(face, idx, &glyphname);
+ }
+
+ return glyphname;
+}
+
+
/*
- * Header of Type1 font.
+ * Header of Type 1 font.
*/
-void
-PS_Head(FILE *out, int plane, EncVec* planeEV, char* font, int UID)
+
+void
+PS_Head(FILE *out,
+ int plane,
+ EncVec* planeEV,
+ char* font,
+ int UID)
{
- EVcRange* cRange = planeEV->codeRange;
+ EVcRange* cRange = planeEV->codeRange;
UShort numCR = planeEV->numCodeRanges;
int cjk = 0, nGlyph = 0, irange;
EVLow* pLow = cRange->low;
UShort nLow = cRange->numLowRanges;
int ipl, ilow, ich;
+ int idx;
+ UShort code;
+ time_t curtime;
+ struct tm *loctime;
+ char text[NAMELEN];
+ char fam_name[NAMELEN];
+ char* version;
+ char fullname[NAMELEN];
+ char copyright[NAMELEN];
+
+ /* Get the current time with local representation */
+ curtime = time(NULL);
+ loctime = localtime(&curtime);
+
+ /* Get font infos: family name, version, notice */
+ strcpy(fullname, LookUp_Name(6));
+ strcpy(fam_name, LookUp_Name(1));
+ strcpy(text, LookUp_Name(5));
+ version = &text[strcspn(text, "1234567890.")];
+ version[strspn(version, "1234567890.")] = '\0';
+ strcpy(copyright, LookUp_Name(0));
+
+ fprintf(out, "%%!FontType1-1.0: %s %s\n", font, version);
+ fprintf(out, "%%%%Creator: %s, ", prog);
+ fprintf(out, "%s\n", rcsid);
+ fprintf(out, "%%%%CreationDate: %s", asctime(loctime));
-
- fprintf(out, "%%!FontType1-1.0: CJK-%s 001.001\n",font);
- fprintf(out, "%%%%Creator: %s ", prog);
- fprintf(out, "%s %s\n", TTF2PFB_VERSION, rcsid);
- Fputs("%%CreationDate: Feb 1st, 1998");
Fputs("%%VMusage: 030000 030000");
Fputs("11 dict begin");
Fputs("/FontInfo 8 dict dup begin");
- Fputs("/version (001.001) readonly def");
- if (compact)
- fprintf(out, "/FullName (%s%02d) readonly def\n",font,plane);
- else
- fprintf(out, "/FullName (%s%02X) readonly def\n",font,plane);
- fprintf(out, "/FamilyName (%s) readonly def\n",font);
+ fprintf(out, "/version (%s) readonly def\n", version);
+ fprintf(out, "/Copyright (%s) readonly def\n", copyright);
+ fprintf(out, "/Notice (Plane %d) readonly def\n", plane);
+ fprintf(out, "/FullName (%s) readonly def\n", fullname);
+ fprintf(out, "/FamilyName (%s) readonly def\n", fam_name);
Fputs("/Weight (Regular) readonly def");
Fputs("/ItalicAngle 0 def");
Fputs("/isFixedPitch false def");
- /* Fputs("/UnderlineThickness 50 def"); */
+ /* Fputs("/UnderlineThickness 50 def"); */
Fputs("end readonly def");
- if (compact)
- fprintf(out, "/FontName /%s%02d def\n",font,plane);
- else
- fprintf(out, "/FontName /%s%02X def\n",font,plane);
+ fprintf(out, "/FontName /%s def\n", font);
Fputs("/PaintType 0 def");
Fputs("/FontType 1 def");
- if (fontShift == 0)
+
+ if (fontShift == 0)
Fputs("/FontMatrix [0.001 0 0 0.001 0 0] readonly def");
else
fprintf(out, "/FontMatrix [0.001 0 0 0.001 0 %5.3f] readonly def\n",
fontShift);
+
Fputs("/Encoding 256 array");
Fputs("0 1 255 {1 index exch /.notdef put} for");
- /* encoding vector */
- for (irange=0; irange<numCR; irange++, cRange++) {
+ /* encoding vector */
+ for (irange = 0; irange < numCR; irange++, cRange++)
+ {
pLow = cRange->low;
nLow = cRange->numLowRanges;
- for (ipl=cRange->high.start; ipl<=cRange->high.end; ipl++) {
- if (nLow == 0) {
+ for (ipl = cRange->high.start; ipl <= cRange->high.end; ipl++)
+ {
+ if (nLow == 0)
+ {
nGlyph = 0x100;
- for (ich=0; ich<=0xff; ich++)
- fprintf(out, "dup %d /cjk%02X%02X put\n",ich,ipl,ich);
- } else
- for (ilow = 0; ilow < nLow; ilow++, pLow++) {
- if (!compact) cjk = pLow->start;
+ for (ich = 0; ich <= 0xff; ich++)
+ {
+ code = ipl<<8 | ich;
+ idx = TT_Char_Index(cmap, code);
+ fprintf(out, "dup %d /%s put\n", ich, PS_GlyphName(idx, code));
+ }
+ }
+ else
+ {
+ for (ilow = 0; ilow < nLow; ilow++, pLow++)
+ {
+ if (!compact && !mapping)
+ cjk = pLow->start;
nGlyph += pLow->end - pLow->start + 1;
- for (ich=pLow->start; ich<=pLow->end; ich++, cjk++)
- fprintf(out, "dup %d /cjk%02X%02X put\n",cjk,ipl,ich);
+ for (ich = pLow->start; ich <= pLow->end; ich++, cjk++)
+ {
+ code = ipl<<8 | ich;
+ idx = TT_Char_Index(cmap, code);
+ fprintf(out, "dup %d /%s put\n", cjk, PS_GlyphName(idx, code));
+ if (mapping && cjk == 0xFF)
+ goto done;
+ }
}
+ }
}
}
+done:
+
Fputs("readonly def");
Fputs("/FontBBox [0 -300 1000 1000] readonly def");
- fprintf(out, "/UniqueID %d%03d def\n",UID,plane);
+ fprintf(out, "/UniqueID %d def\n",UID);
Fputs("currentdict end");
Fputs("currentfile eexec");
+
Fputs("dup /Private 8 dict dup begin");
Fputs("/-| { string currentfile exch readstring pop } executeonly def");
Fputs("/|- { noaccess def } executeonly def");
@@ -549,22 +771,26 @@ PS_Head(FILE *out, int plane, EncVec* planeEV, char* font, int UID)
Fputs("/LanguageGroup 1 def");
Fputs("/RndStemUp false def");
Fputs("/MinFeature{16 16} |-");
- Fputs("/password 5839 def");
- fprintf(out, "/UniqueID %d%03d def\n",UID,plane);
+ /* Fputs("/password 5839 def"); */
+ fprintf(out, "/UniqueID %d def\n",UID);
+
Fputs("/Subrs 4 array");
Fputs("dup 0 { 3 0 callothersubr pop pop setcurrentpoint return } |");
Fputs("dup 1 { 0 1 callothersubr return } |");
Fputs("dup 2 { 0 2 callothersubr return } |");
Fputs("dup 3 { return } |");
Fputs("|-");
- fprintf(out, "2 index /CharStrings %d dict dup begin\n", nGlyph+1);
+
+ fprintf(out, "2 index /CharStrings %d dict dup begin\n", nGlyph + 1);
}
+
/*
- * tail of Type1 font
+ * Tail of Type 1 font.
*/
+
void
-PS_Tail (FILE *out)
+PS_Tail(FILE *out)
{
Fputs("/.notdef { 0 250 hsbw endchar } |-");
Fputs("end end readonly put noaccess put");
@@ -572,76 +798,94 @@ PS_Tail (FILE *out)
Fputs("mark currentfile closefile");
}
+
/*
- * use the rrcurveto command on more than one off points
+ * Use the `rrcurveto' command on more than one `off' points.
*/
-void
-PS_Curveto (FILE *out, TT_F26Dot6 x, TT_F26Dot6 y, int s, int e)
+
+void
+PS_Curveto(FILE *out,
+ TT_F26Dot6 x,
+ TT_F26Dot6 y,
+ int s,
+ int e)
{
int N, i;
TT_F26Dot6 sx[3], sy[3], cx[4], cy[4];
- N = e-s+1;
+ N = e - s + 1;
cx[0] = lastpsx; cy[0] = lastpsy;
- if (s == e) {
- cx[1] = (2*outline.points[s].x+outline.points[s-1].x)/3;
- cy[1] = (2*outline.points[s].y+outline.points[s-1].y)/3;
- cx[2] = (2*outline.points[s].x+x)/3;
- cy[2] = (2*outline.points[s].y+y)/3;
+ if (s == e)
+ {
+ cx[1] = (2 * outline.points[s].x + outline.points[s - 1].x) / 3;
+ cy[1] = (2 * outline.points[s].y + outline.points[s - 1].y) / 3;
+ cx[2] = (2 * outline.points[s].x + x) / 3;
+ cy[2] = (2 * outline.points[s].y + y) / 3;
cx[3] = x;
cy[3] = y;
+
fprintf(out, "%d %d %d %d %d %d rrcurveto\n",
- Coord(cx[1]-cx[0]),Coord(cy[1]-cy[0]),
- Coord(cx[2]-cx[1]),Coord(cy[2]-cy[1]),
- Coord(cx[3]-cx[2]),Coord(cy[3]-cy[2]));
- } else {
- for(i=0; i<N; i++) {
- sx[0] = (i==0) ? outline.points[s-1].x :
- (outline.points[i+s].x+outline.points[i+s-1].x)/2;
- sy[0] = (i==0) ? outline.points[s-1].y :
- (outline.points[i+s].y+outline.points[i+s-1].y)/2;
- sx[1] = outline.points[s+i].x;
- sy[1] = outline.points[s+i].y;
- sx[2] = (i==N-1) ? x : (outline.points[s+i].x+outline.points[s+i+1].x)/2;
- sy[2] = (i==N-1) ? y : (outline.points[s+i].y+outline.points[s+i+1].y)/2;
- cx[1] = (2*sx[1]+sx[0])/3;
- cy[1] = (2*sy[1]+sy[0])/3;
- cx[2] = (2*sx[1]+sx[2])/3;
- cy[2] = (2*sy[1]+sy[2])/3;
+ Coord(cx[1] - cx[0]), Coord(cy[1] - cy[0]),
+ Coord(cx[2] - cx[1]), Coord(cy[2] - cy[1]),
+ Coord(cx[3] - cx[2]), Coord(cy[3] - cy[2]));
+ }
+ else
+ {
+ for(i = 0; i < N; i++)
+ {
+ sx[0] = (i == 0) ?
+ outline.points[s - 1].x :
+ (outline.points[i + s].x + outline.points[i + s - 1].x) / 2;
+ sy[0] = (i == 0) ?
+ outline.points[s - 1].y :
+ (outline.points[i + s].y + outline.points[i + s - 1].y) / 2;
+ sx[1] = outline.points[s + i].x;
+ sy[1] = outline.points[s + i].y;
+ sx[2] = (i == N - 1) ?
+ x :
+ (outline.points[s + i].x + outline.points[s + i + 1].x) / 2;
+ sy[2] = (i == N - 1) ?
+ y :
+ (outline.points[s + i].y + outline.points[s + i + 1].y) / 2;
+
+ cx[1] = (2 * sx[1] + sx[0]) / 3;
+ cy[1] = (2 * sy[1] + sy[0]) / 3;
+ cx[2] = (2 * sx[1] + sx[2]) / 3;
+ cy[2] = (2 * sy[1] + sy[2]) / 3;
cx[3] = sx[2];
cy[3] = sy[2];
+
fprintf(out, "%d %d %d %d %d %d rrcurveto\n",
- Coord(cx[1]-cx[0]),Coord(cy[1]-cy[0]),
- Coord(cx[2]-cx[1]),Coord(cy[2]-cy[1]),
- Coord(cx[3]-cx[2]),Coord(cy[3]-cy[2]));
- cx[0] = cx[3]; cy[0] = cy[3];
+ Coord(cx[1] - cx[0]), Coord(cy[1] - cy[0]),
+ Coord(cx[2] - cx[1]), Coord(cy[2] - cy[1]),
+ Coord(cx[3] - cx[2]), Coord(cy[3] - cy[2]));
+
+ cx[0] = cx[3];
+ cy[0] = cy[3];
}
}
- PS_LastPt(x,y);
+ PS_LastPt(x, y);
}
+
#ifdef DEBUG
-int debug_Char_Code = 0xFFFF;
-FILE* tmpout;
-int showlabel = FALSE;
-int no_glyph = FALSE;
-int no_control= FALSE;
+int debug_Char_Code = 0xFFFF;
+FILE* tmpout;
+int showlabel = FALSE;
+int no_glyph = FALSE;
+int no_control= FALSE;
+
#define Fputps(_msg_) fprintf(tmpout, "%s\n", _msg_)
-void
-tmp_out (FILE* tmpout)
+
+void
+tmp_out(FILE* tmpout)
{
int i, j;
- /* backup the line for easy coding this postscript program */
- /*
- fprintf(tmpout,"/llx %d.0 def /lly %d.0 def /urx %d.0 def /ury %d.0 def\n",
- Coord(metrics.bbox.xMin/64), Coord(metrics.bbox.yMin/64),
- Coord(metrics.bbox.xMax/64), Coord(metrics.bbox.yMax/64));
- */
Fputps("%!PS");
Fputps("%%% CharString debugging program.");
- Fputps("%%% Generated by: ttf2pfb $Revision: 1.2 $");
+ Fputps("%%% Generated by: ttf2pfb $Revision: 1.3 $");
Fputps("%%% plot char-string (pathes defined in /cjkxxxx)");
Fputps("");
Fputps("%%% user-defined parameter");
@@ -655,9 +899,10 @@ tmp_out (FILE* tmpout)
Fputps("0 get /pagewidth exch def");
Fputps("1 get /pageheight exch def");
Fputps("");
- fprintf(tmpout,"/llx %d.0 def /lly %d.0 def /urx %d.0 def /ury %d.0 def\n",
- Coord(metrics.bbox.xMin/64), Coord(metrics.bbox.yMin/64),
- Coord(metrics.bbox.xMax/64), Coord(metrics.bbox.yMax/64));
+ fprintf(tmpout,
+ "/llx %d.0 def /lly %d.0 def /urx %d.0 def /ury %d.0 def\n",
+ Coord(metrics.bbox.xMin / 64), Coord(metrics.bbox.yMin / 64),
+ Coord(metrics.bbox.xMax / 64), Coord(metrics.bbox.yMax / 64));
Fputps("/olwidth urx llx sub def");
Fputps("/olheight ury lly sub def");
Fputps("");
@@ -683,12 +928,15 @@ tmp_out (FILE* tmpout)
Fputps("%% scaled to proper size");
Fputps("/addr {scale mul 3 -1 roll add 3 1 roll");
Fputps(" scale mul add exch 2 copy} def");
- if (no_glyph) {
+ if (no_glyph)
+ {
Fputps("/rmoveto {addr pop pop point} def");
Fputps("/rlineto {addr pop pop point} def");
Fputps("/rrcurveto {8 4 roll addr 8 -2 roll addr 8 -2 roll addr");
Fputps(" 8 2 roll 6 {pop} repeat point} def");
- } else {
+ }
+ else
+ {
Fputps("/rmoveto {addr moveto point} def");
Fputps("/rlineto {addr lineto point} def");
Fputps("/rrcurveto {8 4 roll addr 8 -2 roll addr 8 -2 roll addr");
@@ -703,7 +951,7 @@ tmp_out (FILE* tmpout)
Fputps("/T {pop lly sub scale mul yshift add exch");
Fputps(" llx sub scale mul xshift add exch } def");
Fputps("/mt {T 2 copy moveto} def");
- if (no_control)
+ if (no_control)
Fputps("/lt {T} def");
else
Fputps("/lt {T 2 copy lineto} def");
@@ -712,14 +960,21 @@ tmp_out (FILE* tmpout)
Fputps("%%% draw control points and paths");
Fputps("control-point-gray setgray");
- for (i = 0, j = 0; i < outline.n_contours; i++) {
- fprintf (tmpout, "\n");
- fprintf (tmpout, "%d %d %d %d mt\n", j, Coord(outline.points[j].x),
- Coord(outline.points[j].y), outline.flags[j]);
+ for (i = 0, j = 0; i < outline.n_contours; i++)
+ {
+ Fputps("");
+ fprintf(tmpout,
+ "%d %d %d %d mt\n",
+ j,
+ Coord(outline.points[j].x), Coord(outline.points[j].y),
+ outline.flags[j]);
j++;
- for (; j <= outline.contours[i]; j++)
- fprintf (tmpout, "%d %d %d %d lt\n", j, Coord(outline.points[j].x),
- Coord(outline.points[j].y), outline.flags[j]);
+ for (; j <= outline.contours[i]; j++)
+ fprintf(tmpout,
+ "%d %d %d %d lt\n",
+ j,
+ Coord(outline.points[j].x), Coord(outline.points[j].y),
+ outline.flags[j]);
Fputps("closepath");
}
Fputps("stroke");
@@ -734,99 +989,130 @@ tmp_out (FILE* tmpout)
}
#endif
+
/*
- * Construct CharString of a glyph
+ * Construct CharString of a glyph.
*/
+
short
-PS_CharString (FILE *out, UShort char_Code)
+PS_CharString(FILE *out,
+ UShort char_Code)
{
int idx, i, j;
UShort start_offpt, end_offpt = 0, fst;
#if DEBUG
- FILE* oldout = out;
- int loop = 1;
+ FILE* oldout = out;
+ int loop = 1;
#endif
if (force_enc == X)
- char_Code = JIS_to_SJIS (char_Code);
+ char_Code = JIS_to_SJIS(char_Code);
- idx = TT_Char_Index (cmap, char_Code);
- if (idx == 0) {
- fprintf(out, "/cjk%04X { 0 250 hsbw endchar } |-\n", char_Code);
+ idx = TT_Char_Index(cmap, char_Code);
+ if (idx == 0)
return FALSE;
- }
if (!LoadTrueTypeChar(idx))
- fatal ("couldn't load character: %d, code= %d", idx, char_Code);
+ fatal("Couldn't load character with index %d (code %d)", idx, char_Code);
+
+ if (verbose)
+ printf("0x%04x (%05d): %s\n",
+ char_Code, idx, PS_GlyphName(idx, char_Code));
/* Begin string */
- fprintf(out, "/cjk%04X {\n", char_Code);
+ fprintf(out, "/%s {\n", PS_GlyphName(idx, char_Code));
#ifdef DEBUG
- if (char_Code == debug_Char_Code) {
+ if (char_Code == debug_Char_Code)
+ {
tmp_out(tmpout);
out = tmpout;
loop = 0;
}
- for (;loop<2;loop++) {
+ for (; loop < 2; loop++)
+ {
#endif
- /* coordinates are all relative to (0,0) in FreeType */
- fprintf(out, "0 %d hsbw\n", (int)(metrics.advance/64));
+ /* coordinates are all relative to (0,0) in FreeType */
+ fprintf(out, "0 %d hsbw\n", (int)(metrics.advance / 64));
/* Initialize ending contour point, relative coordinates */
lastpsx = lastpsy = 0;
- for (i = 0, j = 0; i < outline.n_contours /*contours*/; i++) {
+ for (i = 0, j = 0; i < outline.n_contours; i++)
+ {
fst = j;
- PS_Moveto (outline.points[j].x, outline.points[j].y);
+ PS_Moveto(outline.points[j].x, outline.points[j].y);
j++;
- start_offpt = 0; /*start at least 1*/
- /* data pts for all contours stored in one array.
- each round j init at last j + 1 */
-
- /* start_offpt means start of off points.
- 0 means no off points in record.
- N means the position of the off point.
- end_offpt means the ending off point.
- lastx, lasty is the last ON point from which Curve and Line
- shall start.
- */
-
- /* start with j=0. into loop, j=1.
- if pt[1] off, if start_offpt == 0, toggle start_offpt
- next j=2. if on, now start_off != 0, run Curveto.
- if pt[1] on, start_off == 0, will run Lineto.
- */
- for (; j <= outline.contours[i]; j++) {
- if (!(outline.flags[j] & TT_Flag_On_Curve)) {
- if (!start_offpt) { start_offpt = end_offpt = j; }
- else end_offpt++;
+ start_offpt = 0; /* start at least 1 */
+
+ /*
+ * data pts for all contours stored in one array.
+ * each round j init at last j + 1
+ */
+
+ /*
+ * start_offpt means start of off points.
+ * 0 means no off points in record.
+ * N means the position of the off point.
+ * end_offpt means the ending off point.
+ * lastx, lasty is the last ON point from which Curve and Line
+ * shall start.
+ */
+
+ /*
+ * start with j=0. into loop, j=1.
+ * if pt[1] off, if start_offpt == 0, toggle start_offpt
+ * next j=2. if on, now start_off != 0, run Curveto.
+ * if pt[1] on, start_off == 0, will run Lineto.
+ */
+
+ for (; j <= outline.contours[i]; j++)
+ {
+ if (!(outline.flags[j] & TT_Flag_On_Curve))
+ {
+ if (!start_offpt)
+ start_offpt = end_offpt = j;
+ else
+ end_offpt++;
}
- else { /*On Curve*/
- if (start_offpt) {
- /* start_offpt stuck at j, end_offpt++.
- end_offpt - start_offpt gives no of off pts.
- start_offpt gives start of sequence.
- why need outline.xCoord[j] outline.yCoord[j]?
- */
- PS_Curveto(out, outline.points[j].x, outline.points[j].y,
+ else
+ { /* On Curve */
+ if (start_offpt)
+ {
+ /*
+ * start_offpt stuck at j, end_offpt++.
+ * end_offpt - start_offpt gives no of off pts.
+ * start_offpt gives start of sequence.
+ * why need outline.xCoord[j] outline.yCoord[j]?
+ */
+
+ PS_Curveto(out,
+ outline.points[j].x, outline.points[j].y,
start_offpt, end_offpt);
start_offpt = 0;
-
- /* also use start_offpt as indicator to save one variable!!
- after curveto, reset condition. */
+
+ /*
+ * also use start_offpt as indicator to save one variable!!
+ * after curveto, reset condition.
+ */
}
- else PS_Lineto(outline.points[j].x, outline.points[j].y);
+ else
+ PS_Lineto(outline.points[j].x, outline.points[j].y);
}
}
- /* looks like closepath fst = first, i.e. go back to first */
+
+ /*
+ * looks like closepath fst = first, i.e. go back to first
+ */
+
if (start_offpt)
- PS_Curveto(out, outline.points[fst].x, outline.points[fst].y,
+ PS_Curveto(out,
+ outline.points[fst].x, outline.points[fst].y,
start_offpt, end_offpt);
else
- Fputs("closepath");
+ Fputs("closepath");
}
Fputs("endchar");
@@ -834,7 +1120,8 @@ PS_CharString (FILE *out, UShort char_Code)
#if DEBUG
out = oldout;
}
- if (char_Code == debug_Char_Code) {
+ if (char_Code == debug_Char_Code)
+ {
if (showlabel && !no_glyph)
Fputps("drawlabel");
else
@@ -851,94 +1138,120 @@ PS_CharString (FILE *out, UShort char_Code)
return TRUE;
}
+
/*
- * Get code ranges of an encoding scheme either from
- * the eVecMap or an code range file.
+ * Get code ranges of an encoding scheme either from
+ * the eVecMap or a code range file.
*/
+
EncVec*
-Get_EncVec (FILE *enc)
+Get_EncVec(FILE *enc)
{
- EncVec* encVec = NULL;
- EVcRange* cRange = NULL;
- EVLow* lByte = NULL;
- UShort numCR = 0, numLow = 0;
- int start, end;
- int buflen = LINELEN, numAssigned;
- char buf[LINELEN];
+ EncVec* encVec = NULL;
+ EVcRange* cRange = NULL;
+ EVLow* lByte = NULL;
+ UShort numCR = 0, numLow = 0;
+ int start, end;
+ int buflen = LINELEN, numAssigned;
+ char buf[LINELEN];
if (force_enc != 0)
return eVecMap_force[force_enc];
if (enc == NULL && eVecMap[pid][eid] != NULL)
return eVecMap[pid][eid];
- /* parse each code range line */
- while (fgets(buf, buflen, enc) != NULL) {
- if (buf[0] != '#' && buf[0] != '\n') {
- if (strrchr(buf,':') != NULL) {
- /* if there is no high declared before low */
- if (lByte != NULL) {
- if (cRange == NULL) {
- /* default code range '0x00-0x00:' */
- cRange = re_alloc (cRange, ++numCR*sizeof(EVcRange), "Get_EncVec");
+
+ /* parse each code range line */
+ while (fgets(buf, buflen, enc) != NULL)
+ {
+ if (buf[0] != '#' && buf[0] != '\n')
+ {
+ if (strrchr(buf,':') != NULL)
+ {
+ /* if there is no high value declared before low value */
+ if (lByte != NULL)
+ {
+ if (cRange == NULL)
+ {
+ /* default code range `0x00-0x00:' */
+ cRange = re_alloc(cRange, ++numCR * sizeof (EVcRange),
+ "Get_EncVec");
cRange->high.start = cRange->high.end = 0;
}
- /* Assign the lastest low */
- cRange->low = lByte;
- cRange->numLowRanges = numLow;
+ /* Assign the last low value */
+ (cRange + numCR - 1)->low = lByte;
+ (cRange + numCR - 1)->numLowRanges = numLow;
}
- /* New high byte range */
- cRange = re_alloc (cRange, ++numCR*sizeof(EVcRange), "Get_EncVec");
- (cRange+numCR-1)->numLowRanges = numLow = 0;
+
+ /* New high byte range */
+ cRange = re_alloc(cRange, ++numCR * sizeof (EVcRange), "Get_EncVec");
+ (cRange + numCR - 1)->numLowRanges = numLow = 0;
lByte = NULL;
- /* Parse code range */
- numAssigned = sscanf (buf, "%i %*40s %i", &start, &end);
- if (numAssigned <= 0 || numAssigned > 2) {
- mesg ("%s: Get_EncVec: wrong code range.\n", prog);
+
+ /* Parse code range */
+ numAssigned = sscanf(buf, "%i %*40s %i", &start, &end);
+ if (numAssigned <= 0 || numAssigned > 2)
+ {
+ mesg("%s: Get_EncVec: Invalid high code range.\n", prog);
return NULL;
- } else {
- (cRange+numCR-1)->high.start = start;
+ }
+ else
+ {
+ (cRange + numCR - 1)->high.start = start;
if (numAssigned == 1)
- (cRange+numCR-1)->high.end = start;
+ (cRange + numCR - 1)->high.end = start;
else
- (cRange+numCR-1)->high.end = end;
+ (cRange + numCR - 1)->high.end = end;
}
- } else {
- lByte = re_alloc (lByte, ++numLow*sizeof(EVLow), "Get_EncVec");
- numAssigned = sscanf (buf, "%i %*40s %i", &start, &end);
- if (numAssigned <= 0 || numAssigned > 2) {
- mesg ("%s: Get_EncVec: wrong code range.\n", prog);
+ }
+ else
+ {
+ lByte = re_alloc(lByte, ++numLow * sizeof (EVLow), "Get_EncVec");
+ numAssigned = sscanf(buf, "%i %*40s %i", &start, &end);
+ if (numAssigned <= 0 || numAssigned > 2)
+ {
+ mesg("%s: Get_EncVec: Invalid long code range.\n", prog);
return NULL;
- } else {
- (lByte+numLow-1)->start = start;
+ }
+ else
+ {
+ (lByte + numLow - 1)->start = start;
if (numAssigned == 1)
- (lByte+numLow-1)->end = start;
+ (lByte + numLow - 1)->end = start;
else
- (lByte+numLow-1)->end = end;
+ (lByte + numLow - 1)->end = end;
}
}
}
}
- if (cRange == NULL) {
- cRange = re_alloc (cRange, ++numCR*sizeof(EVcRange), "Get_EncVec");
+
+ if (cRange == NULL)
+ {
+ cRange = re_alloc(cRange, ++numCR * sizeof (EVcRange), "Get_EncVec");
cRange->high.start = cRange->high.end = 0;
cRange->numLowRanges = 0;
}
- if (lByte != NULL) {
- cRange->low = lByte;
- cRange->numLowRanges = numLow;
+
+ if (lByte != NULL)
+ {
+ (cRange + numCR - 1)->low = lByte;
+ (cRange + numCR - 1)->numLowRanges = numLow;
}
- encVec = re_alloc (encVec, 1*sizeof(EncVec), "Get_EncVec");
+
+ encVec = re_alloc(encVec, 1 * sizeof (EncVec), "Get_EncVec");
encVec->numCodeRanges = numCR;
encVec->codeRange = cRange;
return encVec;
}
+
/*
- * Match code ranges by a font plane.
+ * Match code ranges by a font plane.
*/
EncVec*
-Get_PlaneEV (EncVec* encVec, int plane)
+Get_PlaneEV(EncVec* encVec,
+ int plane)
{
UShort numCR = encVec->numCodeRanges;
EVcRange* cRange = encVec->codeRange;
@@ -950,78 +1263,105 @@ Get_PlaneEV (EncVec* encVec, int plane)
int icr;
- if (compact) {
- int iChar = 0; /* summed # of chars */
+ if (compact)
+ {
+ int iChar = 0; /* summed # of chars */
int nChar = (plane-1) * 256; /* the first char code ranges recorded */
int recording = 0;
- /* if compact, plane starts from 1 to be */
- /* compatible to the CJK package */
- if (plane < 1 || plane > 256)
- fatal ("Get_PlaneEV: given plane out of range.");
- for (icr = 0; icr < numCR; icr++, cRange++) {
+ /* if compact, plane starts from 1 to be */
+ /* compatible with the CJK package */
+ if (plane < 1 || plane > 99)
+ fatal("Get_PlaneEV: Given plane out of range");
+
+ for (icr = 0; icr < numCR; icr++, cRange++)
+ {
UShort numLow = cRange->numLowRanges;
int ipl;
- for (ipl=cRange->high.start; ipl<=cRange->high.end; ipl++) {
- EVLow* pLow = cRange->low;
+ for (ipl = cRange->high.start; ipl <= cRange->high.end; ipl++)
+ {
+ EVLow* pLow = cRange->low;
int ilow;
-
- if (recording) { /* if we have made a hit */
- if (planeLow != NULL) { /* if low byte range has not been saved */
- (planeCR+nCR-1)->low = planeLow;
- (planeCR+nCR-1)->numLowRanges = nLow;
+
+ if (recording)
+ { /* if we have made a hit */
+ if (planeLow != NULL)
+ { /* if low byte range has not been saved */
+ (planeCR + nCR - 1)->low = planeLow;
+ (planeCR + nCR - 1)->numLowRanges = nLow;
planeLow = NULL;
}
- /* each new plane starts a EVcRange if */
- /* iChar is still less than nChar */
- if (iChar <= nChar) {
- planeCR = re_alloc (planeCR, ++nCR*sizeof(EVcRange), "Get_PlaneEV");
- (planeCR+nCR-1)->high.start = (planeCR+nCR-1)->high.end = ipl;
- (planeCR+nCR-1)->numLowRanges = nLow = 0;
+
+ /* each new plane starts a EVcRange if */
+ /* iChar is still less than nChar */
+ if (iChar <= nChar)
+ {
+ planeCR = re_alloc(planeCR, ++nCR * sizeof (EVcRange),
+ "Get_PlaneEV");
+ (planeCR + nCR - 1)->high.start =
+ (planeCR + nCR - 1)->high.end = ipl;
+ (planeCR + nCR - 1)->numLowRanges = nLow = 0;
}
}
- /* scan each low byte range */
- for (ilow = 0; ilow < (numLow==0?1:numLow); ilow++, pLow++) {
+
+ /* scan each low byte range */
+ for (ilow = 0; ilow < (numLow == 0 ? 1 : numLow); ilow++, pLow++)
+ {
int start, end, nLowChar;
- if (numLow == 0) { /* default range */
+ if (numLow == 0)
+ { /* default range */
start = 0x0;
end = 0xff;
- } else {
+ }
+ else
+ {
start = pLow->start;
end = pLow->end;
}
nLowChar = end - start + 1;
- if (iChar+nLowChar > nChar) { /* a hit! */
+ if (iChar + nLowChar > nChar)
+ { /* a hit! */
int bchar = start + nChar - iChar;
- if (planeCR == NULL) { /* the first time code range is recorded */
- planeCR = re_alloc (planeCR, ++nCR*sizeof(EVcRange), "Get_PlaneEV");
- (planeCR+nCR-1)->high.start = ipl;
- (planeCR+nCR-1)->high.end = ipl;
+ if (planeCR == NULL)
+ {
+ /* the first time code range is recorded */
+ planeCR = re_alloc(planeCR, ++nCR * sizeof (EVcRange),
+ "Get_PlaneEV");
+ (planeCR + nCR - 1)->high.start = ipl;
+ (planeCR + nCR - 1)->high.end = ipl;
}
- /* adjust range boundary */
- if (recording==0)
+
+ /* adjust range boundary */
+ if (recording == 0)
start = bchar;
- else
- end = bchar;
+ else
+ end = bchar;
nChar += 0xff;
- /* recording starts */
+
+ /* recording starts */
recording++;
}
+
iChar += nLowChar; /* next range */
- if (recording) {
- /* a new low range */
- if (iChar <= nChar) {
- planeLow = re_alloc (planeLow, ++nLow*sizeof(EVLow), "Get_PlaneEV");
- (planeLow+nLow-1)->start = start;
- (planeLow+nLow-1)->end = end;
+ if (recording)
+ {
+ /* a new low range */
+ if (iChar <= nChar)
+ {
+ planeLow = re_alloc(planeLow, ++nLow * sizeof (EVLow),
+ "Get_PlaneEV");
+ (planeLow + nLow - 1)->start = start;
+ (planeLow + nLow - 1)->end = end;
}
- if (recording > 1 || iChar > nChar) { /* beyond recording range */
- (planeCR+nCR-1)->numLowRanges = nLow;
- (planeCR+nCR-1)->low = planeLow;
- encV = re_alloc (encV, 1*sizeof(EncVec), "Get_PlaneEV");
+ if (recording > 1 || iChar > nChar)
+ {
+ /* beyond recording range */
+ (planeCR + nCR - 1)->numLowRanges = nLow;
+ (planeCR + nCR - 1)->low = planeLow;
+ encV = re_alloc(encV, 1 * sizeof (EncVec), "Get_PlaneEV");
encV->numCodeRanges = nCR;
encV->codeRange = planeCR;
return encV;
@@ -1030,11 +1370,25 @@ Get_PlaneEV (EncVec* encVec, int plane)
}
}
}
- } else
- for (icr = 0; icr < numCR; icr++, cRange++) {
- if (plane >= cRange->high.start && plane <= cRange->high.end) {
- encV = re_alloc (encV, 1*sizeof(EncVec), "Get_PlaneEV");
- planeCR = re_alloc (planeCR, 1*sizeof(EVcRange), "Get_PlaneEV");
+ /* we must finalize the ranges */
+ if (recording)
+ {
+ (planeCR + nCR - 1)->numLowRanges = nLow;
+ (planeCR + nCR - 1)->low = planeLow;
+ encV = re_alloc(encV, 1 * sizeof (EncVec), "Get_PlaneEV");
+ encV->numCodeRanges = nCR;
+ encV->codeRange = planeCR;
+ return encV;
+ }
+ }
+ else
+ {
+ for (icr = 0; icr < numCR; icr++, cRange++)
+ {
+ if (plane >= cRange->high.start && plane <= cRange->high.end)
+ {
+ encV = re_alloc(encV, 1 * sizeof (EncVec), "Get_PlaneEV");
+ planeCR = re_alloc(planeCR, 1 * sizeof (EVcRange), "Get_PlaneEV");
planeCR->high.start = planeCR->high.end = plane;
planeCR->numLowRanges = cRange->numLowRanges;
@@ -1044,249 +1398,327 @@ Get_PlaneEV (EncVec* encVec, int plane)
return encV;
}
}
+ }
return NULL;
}
+
/*
- * The main subroutine for generate Type1 font.
- * One subfont per call.
+ * The main subroutine for generating Type 1 fonts.
+ * One subfont per call.
*/
+
short
-Generate_Fonts (FILE *out, int plane, FILE *enc, char *fname, int pfxUID)
+Generate_Font(FILE *out,
+ int plane,
+ FILE *enc,
+ char *fname,
+ int UID)
{
- EncVec* encVec = Get_EncVec (enc);
- EncVec* planeEncVec;
- EVcRange* cRange;
- UShort numCR;
- UShort code;
- int ilow, iplan, ichar, irange;
-
+ EncVec* encVec = Get_EncVec(enc);
+ EncVec* planeEncVec;
+ EVcRange* cRange;
+ UShort numCR;
+ UShort code;
+ int ilow, iplan, ichar, irange;
+
+ if (verbose)
+ printf("Generating fonts...\n\n");
+
if (encVec == NULL)
return FALSE;
- if ((planeEncVec = Get_PlaneEV (encVec, plane)) == NULL) {
- mesg ("%s: can't find encoding vector for the font plane 0x%X.\n",
- prog, plane);
- return FALSE;
- }
- /* Header of Type1 font */
- PS_Head (out, plane, planeEncVec, fname, pfxUID);
-
+ if (mapping)
+ planeEncVec = encVec;
+ else
+ if ((planeEncVec = Get_PlaneEV(encVec, plane)) == NULL)
+ {
+ mesg("%s: Can't find encoding vector for the font plane 0x%X.\n",
+ prog, plane);
+ return FALSE;
+ }
+
+ /* Header of Type1 font */
+ PS_Head(out, plane, planeEncVec, fname, UID);
+
numCR = planeEncVec->numCodeRanges;
cRange = planeEncVec->codeRange;
- for (irange=0; irange<numCR; irange++, cRange++) {
+
+ for (irange = 0; irange < numCR; irange++, cRange++)
+ {
EVLow* pLow = cRange->low;
UShort nLow = cRange->numLowRanges;
- for (iplan=cRange->high.start; iplan<=cRange->high.end; iplan++) {
- if (nLow == 0) {
- for (ichar=0; ichar<=0xff; ichar++) {
- code = iplan<<8 | ichar;
- PS_CharString (out, code);
+
+ for (iplan = cRange->high.start; iplan <= cRange->high.end; iplan++)
+ {
+ if (nLow == 0)
+ {
+ for (ichar = 0; ichar <= 0xff; ichar++)
+ {
+ code = iplan << 8 | ichar;
+ PS_CharString(out, code);
}
- } else
+ }
+ else
+ {
for (ilow = 0; ilow < nLow; ilow++, pLow++)
- for (ichar=pLow->start; ichar<=pLow->end; ichar++) {
- code = iplan<<8 | ichar;
- PS_CharString (out, code);
+ {
+ for (ichar = pLow->start; ichar <= pLow->end; ichar++)
+ {
+ code = iplan << 8 | ichar;
+ PS_CharString(out, code);
}
+ }
+ }
}
}
- PS_Tail (out);
-
+ PS_Tail(out);
+
return TRUE;
}
+
/*
- * Main: process options, file I/O, etc.
+ * Main: process options, file I/O, etc.
*/
-void
-main(int argc, char *argv[])
+
+int
+main(int argc,
+ char *argv[])
{
- char *infile, *outfile, *encFile, *fname = "UNKNOWN";
- FILE *out, *enc;
- int result, plane = 0, pfxUID = 7000;
-
+ char *infile, *outfile, *encFile, *fname = "UNKNOWN";
+ FILE *out, *enc;
+ int result, plane = 0, UID = 4999999;
+
if ((prog = strrchr(argv[0], '/')))
prog++;
else
prog = argv[0];
-
- /* setup encoding vectors of all I known */
- Known_Encodings ();
+
+ /* set up known encoding vectors */
+ Known_Encodings();
out = stdout;
enc = NULL;
infile = outfile = encFile = NULL;
-
+
argc--;
argv++;
-
- while (argc > 0) {
- if (argv[0][0] == '-') {
- switch (argv[0][1]) {
- case 'v': case 'V':
+
+ while (argc > 0)
+ {
+ if (argv[0][0] == '-')
+ {
+ switch (argv[0][1])
+ {
+ case 'v':
+ case 'V':
verbose = TRUE;
break;
- case 'c': case 'C':
+ case 'c':
+ case 'C':
compact = TRUE;
break;
- case 'p': case 'P':
+ case 'k':
+ case 'K':
+ keep = TRUE;
+ break;
+ case 'm':
+ case 'M':
+ mapping = TRUE;
+ break;
+ case 'p':
+ case 'P':
result = argv[0][2];
argc--;
argv++;
- if (result == 'i' || result == 'I') {
+ if (result == 'i' || result == 'I')
+ {
/* Set the platform ID. Assumed upper bound is 64 */
- if ((pid = atoi(argv[0])) < 0 || pid > 64)
- /* Check the platform and encoding IDs. */
- fatal ("%s: invalid platform ID '%d'.\n", prog, pid);
+ if ((pid = atoi(argv[0])) < 0 || pid > 64)
+ /* Check the platform and encoding IDs. */
+ fatal("Invalid platform ID %d", pid);
}
- else if (result == 'l' || result == 'L') {
+ else if (result == 'l' || result == 'L')
+ {
result = 0;
while (argv[0][result] == '0' &&
- toupper(argv[0][result+1]) != 'X')
+ toupper(argv[0][result + 1]) != 'X')
result++; /* no octal number */
- sscanf (&argv[0][result], "%i", &plane);
+ sscanf(&argv[0][result], "%i", &plane);
}
break;
- case 'e': case 'E':
- /* Set the encoding ID. */
+ case 'e':
+ case 'E':
result = argv[0][2];
argc--;
argv++;
- if (result == 'i' || result == 'I') {
- if ((eid = atoi(argv[0])) < 0 || eid > 64) {
- fatal ("%s: invalid encoding ID '%d'.\n", prog, eid);
- exit (1);
- }}
+ if (result == 'i' || result == 'I')
+ {
+ /* Set the encoding ID. */
+ if ((eid = atoi(argv[0])) < 0 || eid > 64)
+ fatal("Invalid encoding ID %d", eid);
+ }
else if (result == 'n' || result == 'N')
encFile = argv[0];
break;
- case 'u': case 'U':
+ case 'u':
+ case 'U':
argc--;
argv++;
- pfxUID = atoi(argv[0]);
+ UID = atoi(argv[0]);
break;
- case 'f': case 'F':
+ case 'f':
+ case 'F':
result = argv[0][2];
argc--;
argv++;
if (result == '\0')
fname = argv[0];
- else if (result == 'o' || result == 'O') {
- switch (argv[0][0]) {
- case 'g': case 'G':
+ else if (result == 'o' || result == 'O')
+ {
+ switch (argv[0][0])
+ {
+ case 'g':
+ case 'G':
force_enc = GB;
break;
- case 'k': case 'K':
+ case 'k':
+ case 'K':
force_enc = KS;
break;
- case 'j': case 'J':
- force_enc = JIS;
+ case 'b':
+ case 'B':
+ force_enc = Big5;
break;
- case 's': case 'S':
+ case 'j':
+ case 'J':
+ result = argv[0][1];
+ if (result == 'o' || result == 'O')
+ force_enc = Johab;
+ else
+ force_enc = JIS;
+ break;
+ case 's':
+ case 'S':
force_enc = SJIS;
break;
- case 'x': case 'X':
+ case 'x':
+ case 'X':
force_enc = X;
}
}
break;
- case 't': case 'T':
- /* Get the TTF file name. */
+ case 't': /* Get the TTF file name. */
+ case 'T':
argc--;
argv++;
infile = argv[0];
break;
- case 'o': case 'O':
- /* Set the output file name. */
+ case 'o': /* Set the output file name. */
+ case 'O':
argc--;
argv++;
outfile = argv[0];
break;
- case 's': case 'S': /* shift font bbox up or down */
- argc--; argv++;
- sscanf(argv[0], "%f", &fontShift);
+ case 's': /* shift font bbox up or down */
+ case 'S':
+ argc--;
+ argv++;
+ sscanf(argv[0], "%f", &fontShift);
break;
#ifdef DEBUG
- case 'd': case 'D': /* character code for debuging */
- argc--; argv++;
- sscanf(argv[0], "%i", &debug_Char_Code);
- tmpout = fopen("charstr-debug.ps", "wt");
- mesg ("You have specified the character code 0x%04x for debugging.\n",
- debug_Char_Code);
- mesg ("A PostScript program named charstr-debug.ps will be created.\n");
+ case 'd': /* character code for debugging */
+ case 'D':
+ argc--;
+ argv++;
+ sscanf(argv[0], "%i", &debug_Char_Code);
+ tmpout = fopen("ch-debug.ps", "wt");
+ mesg("You have specified the character code 0x%04x for debugging.\n",
+ debug_Char_Code);
+ mesg("A PostScript program named `ch-debug.ps' will be created.\n");
break;
- case 'l': case 'L':
+ case 'l':
+ case 'L':
showlabel = TRUE;
break;
- case 'n': case 'N':
+ case 'n':
+ case 'N':
result = argv[0][2];
- if (result == 'g' || result == 'G')
+ if (result == 'g' || result == 'G')
no_glyph = TRUE;
- else if (result == 'c' || result == 'C')
+ else if (result == 'c' || result == 'C')
no_control = TRUE;
break;
#endif
default:
Usage(1);
}
- } else
- /* Set the input file name. */
+ }
+ else
+ /* Set the input file name. */
infile = argv[0];
argc--;
argv++;
}
- /* Open the output file if specified. */
+ /* Open the output file if specified. */
if (outfile != NULL)
- /* Attempt to open the output file. */
- if ((out = fopen(outfile, "wt")) == 0) {
- fatal ("%s: unable to open the output file '%s'.\n",
- prog, outfile);
- exit(1);
+ /* Attempt to open the output file. */
+ if ((out = fopen(outfile, "wt")) == 0)
+ {
+ fatal("Unable to open the output file `%s'", outfile);
+ exit(FAILURE);
}
-
- /* Validate the values passed on the
- command line. */
- if (infile == NULL) {
- mesg ("%s: no input TTF file provided.\n", prog);
+
+ /* Validate the values passed on the command line. */
+ if (infile == NULL)
+ {
+ mesg("%s: No input TTF file provided\n", prog);
Usage(1);
}
- if (encFile != NULL) {
- if ((enc = fopen(encFile, "rt")) == 0) {
- fatal ("%s: no input code range file.\n", prog);
- exit (1);
- }
+ if (encFile != NULL)
+ {
+ if ((enc = fopen(encFile, "rt")) == 0)
+ fatal("No input code range file");
}
- /* Initialize font engine */
- if (! Init_Font_Engine (infile)) {
- if (out != stdout) {
+
+ /* Initialize font engine */
+ if (!Init_Font_Engine(infile))
+ {
+ if (out != stdout)
+ {
fclose(out);
- (void) unlink(outfile);
+ if (!keep)
+ (void)unlink(outfile);
}
- exit (1);
+ exit(FAILURE);
}
- /* Generate the disassembled PFB font
- from the TrueType font. */
- if (Generate_Fonts (out, plane, enc, fname, pfxUID))
+
+ /* Generate the disassembled PFB font from the TrueType font */
+ if (Generate_Font(out, plane, enc, fname, UID))
result = 0;
else
result = 2;
- if (out != stdout) {
+ if (out != stdout)
+ {
fclose(out);
- if (result != 0) {
- mesg ("%s: An error occured when generating", prog);
- mesg (" the font, so delete the output file.\n");
- /* (void) unlink(outfile); */
+ if (result != 0)
+ {
+ mesg("%s: An error occurred while generating the font", prog);
+ if (!keep)
+ (void)unlink(outfile);
}
}
- TT_Close_Face (face);
- TT_Done_FreeType (engine);
+ TT_Close_Face(face);
+ TT_Done_FreeType(engine);
exit(result);
+
+ return 0; /* never reached */
}
diff --git a/xc/extras/FreeType/contrib/ttfbanner/Makefile b/xc/extras/FreeType/contrib/ttfbanner/Makefile
deleted file mode 100644
index b1eb1dcdc..000000000
--- a/xc/extras/FreeType/contrib/ttfbanner/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile for ttfbanner
-
-all: ttfbanner
-
-ttfbanner: ttfbanner.o
- cc -O -o ttfbanner ttfbanner.o -lttf
-
-ttfbanner.o: ttfbanner.c
- cc -O -c ttfbanner.c \ No newline at end of file
diff --git a/xc/extras/FreeType/docs/errstr.txt b/xc/extras/FreeType/docs/errstr.txt
deleted file mode 100644
index c27dc474b..000000000
--- a/xc/extras/FreeType/docs/errstr.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-Using ftxerr18
-==============
-
-21. 1. 1998
-Erwin Dieterich
-
-
-If you don't like error messages containing error codes like this:
-
- test> ftlint 24 furiosot.ttf
- furiosot.ttf: Could not find or open file.
- Error code = 0x0087.
-
-and prefer something more informative, like this:
-
- test> ftlint 24 furiosot.ttf
- furiosot.ttf: Could not find or open file.
- FreeType error message: OS/2 table missing.
-
-then read on. This information could be helpful to you. If you
-don't care, you can read on anyway.
-
-The core engine of FreeType has defined about 50 different error
-codes. Nearly all FreeType functions are able to return an
-intelligible error code in case something goes wrong. If you can't
-memorize the error codes, you can look them up in apiref.txt.
-However, if you are writing a program that is intended for "normal"
-users (e.g. a font lister) you should give those users more than
-just an integer or hex number. Ftxerr18 (located in lib/extend)
-offers the possibility to translate a FreeType error code into a
-string describing the error with one function call. Ftxerr18 is
-fully internationalized on Unix computers. So if your environment
-variables are set accordingly, ftxerr18 can return error strings in
-your language (assuming it is supported). See i18n.txt on how to
-use national language support (NLS), on the languages that are
-supported now, and on how to disable NLS. IF NLS is disabled,
-ftxerr18 contains no operating system specific components.
-
-Ftxerr18 offers only one function:
-
- char* TT_ErrToString18( int error )
-
-It returns a pointer to a string describing the error that occurred.
-A simple example on how to use ftxerr18, extending the code given in
-apiref.txt on TT_Open_Face():
-
- error = TT_Open_Face( engine, "/var/fonts/wingding.ttf", &face );
- if ( error )
- {
- fprintf( stderr, "Could not open face.\n" );
- fprintf( stderr, "Reason: %s\n", TT_ErrToString18( error ) );
- }
-
-Note that in this example no NLS has been used for the strings.
-With NLS the code would be written as:
-
- error = TT_Open_Face( engine, "/var/fonts/wingding.ttf", &face );
- if ( error )
- {
- fprintf( stderr, gettext ("Could not open face.\n" ) );
- fprintf( stderr, gettext( "Reason: %s\n" ),
- TT_ErrToString18( error ) );
- }
-
-See i18n.txt for more information on NLS.
-
-If you have any questions or comments regarding this short
-introduction to an even shorter function, feel free to email me at
-
- Erwin.Dieterich.ED@Bayer-AG.de
-
-
---- END ---
diff --git a/xc/extras/FreeType/docs/raster.doc b/xc/extras/FreeType/docs/raster.doc
deleted file mode 100644
index 2b3f81b98..000000000
--- a/xc/extras/FreeType/docs/raster.doc
+++ /dev/null
@@ -1,578 +0,0 @@
-This file is an attempt at explaining the internals of the FreeType
-rasterizer. This component is quite general purpose and could
-easily be integrated into other programs (but still under the
-current license).
-
---------------------------------------------------------------------
-
- HOWs and WHYs of the FreeType rasterizer
-
- by David Turner
-
-
- I. Introduction
-
- II. Rendering Technology
-
-III. Implementation Details
-
- IV. Gray-Level Support
-
-
-
-I. Introduction:
-
- A rasterizer is a library in charge of converting a vectorial
- representation of a shape into a bitmap. The FreeType rasterizer
- has been developed to render the glyphs found in TrueType files,
- made up of segments and second-order Beziers. This document is an
- explanation of its design and implementation.
-
- Though these explanations start from the basics, a knowledge of
- common rasterization techniques is assumed.
-
-
-II. Rendering Technology:
-
- 1. Requirements:
-
- We will assume that all scaling/rotating/hinting/whatever have
- been already done. The glyph is thus described, as in the
- TrueType specification, by a list of points. Each point has an x
- and y coordinate, as well as a flag that indicates whether the
- point is _on_ or _off_ the curve.
-
- More precisely:
-
- - All point coordinates are in the 26.6 fixed float format as
- defined by the specification. The orientation used is:
-
- ^ y
- | reference orientation
- |
- *----> x
- 0
-
- This means that the 'distance' between two neighbouring pixels
- is 64 'units' (1 unit = 1/64th of a pixel).
-
- Note that, for the rasterizer, pixel centers are located at
- integer coordinates, i.e. (0.0, 0.0) is the coordinate of the
- origin's center (unlike what happens within the TrueType
- bytecode interpreter where this point's center lies at
- (0.5, 0.5)).
-
- A pixel line in the target bitmap is called a 'scanline'.
-
-
- - A glyph is usually made of several contours, also called
- outlines. A contour is simply a closed curve that delimits an
- outer or inner region of the glyph. It is described by a
- series of successive points of the points table.
-
- Each point of the glyph has an associated flag that indicates
- whether it is "on" or "off" the curve. Two successive "on"
- points indicate a line segment joining the two points.
-
- One "off" point amidst two "on" points indicates a second
- degree Bezier parametric arc, defined by these three points
- (the "off" point being the control point, and the "on" ones the
- start and end points).
-
- Finally, two successive "off" points forces the rasterizer to
- create, during rendering, an "on" point amidst them, at their
- exact middle. This greatly facilitates the definition of
- successive Bezier arcs.
-
- * # on
- * off
- __---__
- #-__ _-- -_
- --__ _- -
- --__ # \
- --__ #
- -#
- Two "on" points
- Two "on" points and one "off" point
- between them
-
- *
- # __ Two "on" points with two "off"
- \ - - points between them. The point
- \ / \ marked '0' is the middle of the
- - 0 \ "off" points, and is a 'virtual'
- -_ _- # "on" point where the curve passes.
- -- It does not appear in the point
- * list.
-
-
- The FreeType rasterizer, as intended to render TrueType glyphs,
- does not support third order Beziers, usually found in Type 1
- fonts. Type 1 support may lead to further development of the
- engine.
-
- The parametric form of a second-order Bezier is:
-
- P(t) = (1-t)^2*P1 + 2*t*(1-t)*P2 + t^2*P3
-
- with t a real number in the range [0..1]
-
- P1 and P3 are the endpoints, P2 the control point.
-
- Note that the rasterizer does not use this formula. It
- exhibits, however, one very useful property of Bezier arcs:
- each point of the curve is a weighted average of the control
- points.
-
- As all weights are positive and always sum up to 1, whatever
- the value of t, each arc point lies within the triangle defined
- by the arc's three control points.
-
-
- 2. Profiles and Spans:
-
- The following is a basic explanation of the _kind_ of
- computations made by the rasterizer to build a bitmap from a
- vector representation. Note that the actual implementation is
- slightly different, due to performance tuning and other factors.
-
- However, the following ideas remain in the same category, and are
- more convenient to understand.
-
-
- a. Sweeping the shape:
-
- The best way to fill a shape is to decompose it into a number
- of simple horizontal segments, then turn them on in the target
- bitmap. These segments are called 'spans'.
-
- __---__
- _-- -_
- _- -
- - \
- / \
- / \
- | \
-
- __---__ Example: filling a shape
- _----------_ with spans.
- _--------------
- ----------------\
- /-----------------\ This is typically done from the top
- / \ to the bottom of the shape, in a
- | | \ movement called a "sweep".
- V
-
- __---__
- _----------_
- _--------------
- ----------------\
- /-----------------\
- /-------------------\
- |---------------------\
-
-
- In order to draw a span, the rasterizer must compute its
- coordinates, which are simply the shape's contours'
- x-coordinates taken on the y scanlines.
-
-
- /---/ |---| Note that there are usually several
- /---/ |---| spans per scanline.
- | /---/ |---|
- | /---/_______|---| When rendering this shape to the
- V /----------------| current scanline y, we must compute
- /-----------------| the x values of the points a, b, c,
- a /----| |---| and d.
-- - - * * - - - - * * - - y -
- / / b c| |d
-
-
- /---/ |---|
- /---/ |---| And then turn on the spans a-b and c-d.
- /---/ |---|
- /---/_______|---|
- /----------------|
- /-----------------|
- a /----| |---|
-- - - ####### - - - - ##### - - y -
- / / b c| |d
-
-
-
- b. Decomposing outlines into profiles:
-
- For each scanline during the sweep, we need the following
- information:
-
- o The number of spans on the current scanline, given by the
- number of shape points intersecting the scanline (these are
- the points a, b, c, and d in the above example).
-
- o The x coordinates of these points.
-
- These are computed before the sweep, in a phase called
- 'decomposition' which converts the glyph into *profiles*.
-
- Put it simply, a "profile" is a contour's portion that can only
- be either ascending or descending, i.e., it is monotonic in the
- vertical direction (we will also say Y-monotonic). There is no
- such thing as a horizontal profile, as we shall see.
-
- Here are a few examples:
-
-
- this square
- 1 2
- ---->---- is made of two
- | | | |
- | | profiles | |
- ^ v ^ + v
- | | | |
- | | | |
- ----<----
-
- up down
-
-
- this triangle
-
- P2 1 2
-
- |\ is made of two | \
- ^ | \ \ | \
- | | \ \ profiles | \ |
- | | \ v ^ | \ |
- | \ | | + \ v
- | \ | | \
- P1 ---___ \ ---___ \
- ---_\ ---_ \
- <--__ P3 up down
-
-
-
- A more general contour can be made of more than
- two profiles:
-
- __ ^
- / | / ___ / |
- / | / | / | / |
- | | / / => | v / /
- | | | | | | ^ |
- ^ | |___| | | ^ + | + | + v
- | | | v | |
- | | | up |
- |___________| | down |
-
- <-- up down
-
-
- Successive profiles are always joined by horizontal segments
- that are not part of the profiles themselves.
-
- Note that for the rasterizer, a profile is simply an _array_
- that associates one horizontal *pixel* coordinate to each
- bitmap *scanline* crossed by the contour's section containing
- the profile. Note also that profiles are *oriented* up or down
- along the glyph's original flow orientation.
-
- In other graphics libraries, profiles are also called 'edges'
- or 'edgelists'.
-
-
- c. The Render Pool:
-
- FreeType has been designed to be able to run well on _very_
- light systems, including embedded systems with very few memory.
-
-
- A render pool will be allocated once; the rasterizer uses this
- pool for all its needs by managing this memory directly in it.
- The algorithms that are used for profile computation make it
- possible to use the pool as a simple growing heap. This means
- that this memory management is actually easy, and faster than
- any kind of malloc()/free() combination.
-
- Moreover, we'll see later that the rasterizer is able, when
- dealing with profiles too large and numerous to lie all at once
- in the render pool, to immediately decompose recursively the
- rendering process into independent sub-tasks, each taking less
- memory to be performed (see "sub-banding" below).
-
- The render pool doesn't need to be large. A 4kByte pool is
- enough for nearly all renditions, though nearly 100% slower
- than a more confortable 16 or 32kByte pool (that was tested
- with complex glyphs at sizes over 500 pixels).
-
-
- d. Computing Profiles Extents:
-
- Remember that a profile is an array, associating a _scanline_
- to the x pixel coordinate of its intersection with a contour.
-
- Though it's not exactly how the FreeType rasterizer works, it
- is convenient to think that we need a profile's height before
- allocating it in the pool and computing its coordinates.
-
- The profile's height is the number of scanlines crossed by the
- Y-monotonic section of a contour. We thus need to compute
- these sections from the vectorial description. In order to do
- that, we are obliged to compute all (local and global)
- Y-extrema of the glyph (minima and maxima).
-
-
- P2 For instance, this triangle has only
- two Y-extrema, which are simply
- |\
- | \ P2.y as an Y-maximum
- | \ P3.y as an Y-minimum
- | \
- | \ P1.y is not an Y-extremum (though it is
- | \ a X-minimum, which we don't need).
- P1 ---___ \
- ---_\
- P3
-
- Note that the extrema are expressed in pixel units, not in
- scanlines. The triangle's height is certainly (P3.y-P2.y+1)
- pixel units, but its profiles' heights are computed in
- scanlines. The exact conversion is simply:
-
- - min scanline = FLOOR ( min y )
- - max scanline = CEILING( max y )
-
- A problem arises with Bezier Arcs. While a segment is always
- necessarily Y-monotonic (i.e., flat, ascending, or descending),
- which makes extrema computations easy, the ascent of a arc can
- vary between its control points.
-
- P2
- *
- # on
- * off
- __-x--_
- _-- -_
- P1 _- - A non Y-monotonic Bezier arc.
- # \
- - The arc goes from P1 to P3.
- \
- \ P3
- #
-
- We first need to be able to easily detect non-monotonic arcs,
- according to their control points. I will state here, without
- proof, that the monotony condition can be expressed as:
-
- P1.y <= P2.y <= P3.y for an ever-ascending arc
-
- P1.y >= P2.y >= P3.y for an ever_descending arc
-
- with the special case of
-
- P1.y = P2.y = P3.y where the arc is said to be 'flat'.
-
- As you can see, these conditions can be very easily tested.
- They are, however, extremely important, as any arc that does
- not satisfy them necessarily contains an extremum.
-
- Note also that a monotonic arc can contain an extremum too,
- which is then one of its 'on' points:
-
- P1 P2
- #---__ * P1P2P3 is ever-descending, but P1
- -_ is an Y-extremum.
- -
- ---_ \
- -> \
- \ P3
- #
-
-
- Let's go back to our previous example:
-
- P2
- *
- # on
- * off
- __-x--_
- _-- -_
- P1 _- - A non Y-monotonic Bezier arc.
- # \
- - here we have
- \ P2.y >= P1.y &&
- \ P3 P2.y >= P3.y (!)
- #
-
- We need to compute the y-maximum of this arc to be able to
- compute a profile's height (the point marked by an 'x'). The
- arc's equation indicates that a direct computation is possible,
- but we'll rely on a different technique, which use will become
- apparent a bit later...
-
-
- Bezier arcs have the special property of being very easily
- decomposed into two other sub-arcs, which are themselves
- Beziers arcs. Moreover, it is easy to prove that there is at
- most one Y-extremum on each Bezier arc (for second degree
- ones).
-
- For instance, the following arc P1P2P3 can be decomposed into
- two sub-arcs Q1Q2Q3 and R1R2R3 that look like:
-
- P2
- *
- # on curve
- * off curve
-
-
- Original Bezier Arc P1P2P3
- __---__
- _-- --_
- _- -_
- - -
- / \
- / \
- # #
- P1 P3
- P2
- *
-
-
-
- Q3 Decomposed into two subarcs
- Q2 R2
- * __-#-__ * Q1Q2Q3 and R1R2R3 with
- _-- --_
- _- R1 -_ Q1 = P1 R3 = P3
- - - Q2 = (P1+P2)/2 R2 = (P2+P3)/2
- / \
- / \ Q3 = R1 = (Q2+R2)/2
- # #
- Q1 R3 Note that Q2, R2, and Q3=R1
- are on a single line which is
- tangent to the curve.
-
- We have then decomposed a non-Y-monotonic bezier into two
- smaller sub-arcs. Note that in the above drawing, both sub-arcs
- are monotonic, and that the extremum is then Q3=R1. However, in
- a more general case, only one sub-arc is guaranteed to be
- monotonic. Getting back to our former example:
-
- Q2
- *
-
- __-x--_ R1
- _-- #_
- Q1 _- Q3 - R2
- # \ *
- -
- \
- \ R3
- #
-
-
- Here, we see that, though Q1Q2Q3 is still non-monotonic, R1R2R3
- is ever descending: we thus know that it doesn't contain the
- extremum. We can then re-subdivide Q1Q2Q3 into two sub-arcs,
- and go on recursively, stopping when we encounter two monotonic
- subarcs, or when the subarcs become simply too small.
-
- We will finally find the y-extremum. Note that the iterative
- process of finding an extremum is called 'flattening'.
-
-
- e. Computing Profiles coordinates:
-
- Once we have the height of each profile, we're able to allocate
- it in the render pool. We now have to compute its coordinate
- for each scanline.
-
- In the case of segments, the computation is straightforward, and
- uses good old Euclide (also known as Bresenham ;-). However,
- for Bezier arcs, things get a little more complicated.
-
- We assume that all Beziers that are part of a profile are the
- result of 'flattening' the curve, which means that they're all
- y-monotonic (ascending or descending, and never flat). We now
- have to compute the arcs' intersections with the profile's
- scanlines. One way is to use a similar scheme to 'flattening',
- called 'stepping'.
-
- Consider this arc, going from P1 to
- --------------------- P3. Suppose that we need to
- compute its intersections with the
- drawn scanlines. Again, this is
- --------------------- feasible directly, if we dare
- to compute one square root per
- * P2 _---# P3 scanline (how great!).
- ------------- _-- --
- _-
- _/ Rather, it is still possible to use
- ---------/----------- the decomposition property in the
- / same recursive way, i.e. subdivide
- | the arc into subarcs until these
- ------|-------------- get too small to cross more than
- | one scanline!
- |
- -----|--------------- This is very easily done using a
- | rasterizer-managed stack of
- | subarcs.
- # P1
-
-
- f. Sweeping and Sorting the spans:
-
- Once all our profiles have been computed, we begin the sweep to
- build (and fill) the spans.
-
- As the TrueType specification uses the winding fill rule, we
- place on each scanline the profiles present in two separate
- lists.
-
- One list, called the 'left' one, only contains ascending
- profiles, while the other 'right' list contains the descending
- profiles.
-
- As each glyph is made of closed curves, a simple geometric
- property is that the two lists necessarily contain the same
- number of elements.
-
- Creating spans is there straightforward:
-
- 1. We sort each list in increasing X order.
-
- 2. We pair each value of the left list, with its
- corresponding value in the right one.
-
-
- / / | | For example, we have here four
- / / | | profiles. Two of them are
- >/ / | | | ascending (1 & 3), while the two
- 1// / ^ | | | 2 others are descending (2 & 4).
- // // 3| | | v
- / //4 | | | On the given scanline, the left
- a / /< | | list is (1,3) and the right one
-- - - *-----* - - - - *---* - - y - is (4,2) (sorted).
- / / b c| |d
- There are then two spans, joining
- 1 to 4 (i.e. a-b) and 3 to 2
- (i.e. c-d)!
-
- Sorting doesn't necessarily take much time, as in 99 cases out
- of 100, the lists' order is kept from one scanline to the next.
- We can thus implement it with two simple singly-linked lists,
- sorted by a classic bubble-sort, which takes a minimum amount of
- time when the lists are already sorted.
-
- A previous version of the rasterizer used more elaborate
- structures, like arrays to perform 'faster' sorting. It turned
- out that this old scheme is not faster than the one described
- above.
-
- Once the spans have been 'created', we can simply draw them in
- the target bitmap.
-
-
- g. Drop-out control:
-
- /* to be continued */
diff --git a/xc/extras/FreeType/howto/win32.txt b/xc/extras/FreeType/howto/win32.txt
deleted file mode 100644
index b4f59ef96..000000000
--- a/xc/extras/FreeType/howto/win32.txt
+++ /dev/null
@@ -1,136 +0,0 @@
- The FreeType Win32 Compilation HowTo
-
-
-Introduction:
-
-This file describes the compilation of the FreeType package on an
-Win32 system. Unlike other systems, only the library can be
-compiled on such a system, as the demo programs still lack a Win32
-component (we welcome any contribution).
-
-Nevertheless, we _do_ provide project/workspace files for the
-following compilers: Borland C++ 5.0, Visual C++ 4.0, and Visual C++
-5.0. They can be found in the "freetype/lib/arch/win32" directory:
-
- freetype.ide for Borland C++ 5.0
-
- freetype.dsp project and workspace files for
- freetype.dsw Visual C++ 5.0
-
- freetype.mdp project and makefile files for
- freetype.mak Visual C++ 4.0
-
-They generate a static library, which contain the core engine as a
-single object file, as well as all standard extensions.
-
-Notes:
-
- - You may need to update the include paths in the Borland C++
- workspace settings. The current one looks in the directory
- "c:\Program Files\Borland\BC 5.0\Include" for include files.
-
- - Take care that some compilers may overwrite these files when
- generating the library (e.g. Borland C++ creates its own
- "freetype.mdp" file, which isn't a Visual C++ project during
- compilation).
-
- This is only important if you try to compile the lib with
- several compilers.
-
-We gladly accept project files for other compilers. The rest of
-this document will show you all the steps required to compile the
-library by hand.
-
-
-
-1. Static compilation:
-
- Here are explained the steps that are required to compile FreeType
- as a *static* library. Explanations follow to build a DLL.
-
- a. Set include paths:
-
- Simply add the following to your project's include paths:
-
- "freetype/lib"
-
- It contains all core library sources (tt*.c files),
- including the API in "freetype.h", which can be used by
- client applications to use the library.
-
- "freetype/lib/arch/win32"
-
- Here you'll find the file "ft_conf.h" which contains various
- configuration macros which have been set for the Win32
- platform. You can also play with some options by
- setting/undefining the TT_CONFIG_OPTION_???? macros. (Read
- the comments carefully before that!)
-
- You might as well decide to compile some extensions (which are
- separately compilable and linkable units used to extend the
- engine's capabilities). To do so, add the directory
-
- "freetype/lib/extend"
-
-
- b. Set the warning level:
-
- Set the warning level to 3 under Visual C++, you should get no
- warnings during compilation. (Compilation produces warnings in
- level 4, but we're not going to correct this for deep technical
- reasons.)
-
- Under BC++, set the warning level to ANSI, and disable the
- "unused parameter" and "unused variable" warnings. You'll
- probably get a slew of warnings, because BC is probably the most
- pedantic and bad-ass ANSI compiler I've ever seen. The library
- will work perfectly though.
-
- c. Compile in "normal mode":
-
- Add all the files in "tt*.c" found in "freetype/lib" to your
- project. You can also add some extensions from
- "freetype/lib/extend" provided that you've added this directory
- to your include path.
-
- Build. Voila!
-
- d. Or compile in "single object mode":
-
- This allows you to build a single object file for the core
- library. Use the single file "freetype/arch/win32/freetype.c"
- instead of _all_ the individual "tt*.c" source components (they
- are included by freetype.c).
-
- The resulting library file should be smaller, because it got rid
- of lots of internal extern symbols which are needed for
- inter-component interfacing.
-
- You still can add extensions individually to the project.
- They'll link with the single object too.
-
-
-2. DLL Compilation:
-
- Some people have expressed the need to compile FreeType as a DLL.
- This is possible with very, very few changes. Simply follow these
- instructions:
-
- - Edit the source of "freetype/arch/win32/freetype.c" and define
- the EXPORT macro before the first #include.
-
- - Compile in single object mode.
-
- This should be enough.
-
-
-3. Other contributions in the package:
-
- All other parts of the FreeType distribution are currently
- unsupported on Win32. This includes the test/demo programs, as
- well as the many tools found in "freetype/contrib" (nevertheless,
- ttf2pk may compile provided you've got the web2c port to Win32,
- including the kpathsea library).
-
-
---- end of win32.txt ---
diff --git a/xc/extras/FreeType/lib/changes.txt b/xc/extras/FreeType/lib/changes.txt
deleted file mode 100644
index aabf678d7..000000000
--- a/xc/extras/FreeType/lib/changes.txt
+++ /dev/null
@@ -1,247 +0,0 @@
-- Werner made an impressive work by reviewing and fixing the source
- code for 16-bitness
-
-- Thread-safety and reentrancy support is now coded in the engine.
- This is still untested though, one must specialize the component
- ttmutex.c before even trying this.., as well as change a configuration
- macro in its ft_conf.h
-
-==========================================================================
-
-
-- Changed the structure of a TT_Outline. Now, coordinates are placed
- in a single array of TT_Vector elements, instead of two parallel
- arrays of TT_PCoordinates.
- (many changes in ttapi, ttobjs, ttgload, ttraster and ttinterp)
-
-- Introduced the new TT_MulDiv and TT_MulFix functions.
- TT_MulFix is used for 16.16 multiplications
-
-- re-designed the cache manager to get rid of ttlists. It is
- now smaller and simpler (it's now certain that no other component
- needs a generic list :-)
-
-- _big_ changes in the object management scheme :
-
- Execution contexts are not childs of a face anymore. Rather,
- they're now listed by the engine, and their arrays (i.e loadStack,
- stack and glyphIns) grow whenever necessary in function "Context_Load"
-
- This should save between 7 and 15 Kb per opened face (except for the
- first one, of course). Great when having a lot of opened fonts at
- once.
-
- Also, the twilight zone and storage area are now part of a TInstance
- and are thus shared by all glyphs of a same instance.
-
-- Corrected the Makefiles and freetype.c so that the extensions aren't
- compiled with the engine into a single object. Rather, they're now
- compiled separately, and added to 'libttf' so that only the
- applications that need them will really link them.
-
- Also made some changes to allow to compile statically the test
- program with electric fence, in order to track memory overwrites.
- So far, no error was detected !! :-)
-
-
-- All in all, code size was reduced, and performance slightly increased
-
-
-==========================================================================
-
-- Fixed some problems within the interpreter in SWITCH mode.
- Rather than trying to track the bug, and potentially lose
- several hours, I defined some macros from the functional
- definitions, and moved the non-trivial opcode like SCFS, GC and MD
- out of the switch.
-
- This means that the macro shouldn't interfere with debugging, as
- they're only used for trivial stuff now. All problems seem
- fixed now.
-
- ( previous problems : error 0x408 (invalid reference) in many
- glyphs of common fonts like times.ttf, etc..
-
-
-- Some functions are now "EXPORTED", though they're not defined in
- the file "freetype.h". They're reserved for extensions that should
- now be able to link separately with the single-object freetype.o
-
- These functions are :
-
- o Memory management, i.e. TT_Alloc and TT_Free
-
- o File and Frame access : in ttfile.c, os2file.c and ttmmap.c
-
- o The function Extension_Register, defined in ttextend.h, has been
- renamed TT_Register_Extension and is now exported. current
- extensions have been modified accordingly
-
- o The function LookUp_TrueType_Table, defined in ttload.c has been
- renamed to TT_LookUp_Table and is now exported. Of course, changes,
- etc...
-
- Extensions are still free to #include all relevant FreeType header
- files, however, they should not try to call functions that are not
- exported now.
-
- If some internal function call is dearly needed, please contact us
- to discuss the issue..
-
-
-- Updated Load_TrueType_Any (in ttload.c), as well as updated the
- documentation for this function (called by TT_Get_Font_Data)
-
-
-- added a #define TT_MAKE_OPTION_SINGLE_OBJECT to all the "freetype.c"
- files, to make sure to export only the correct symbols..
-
-
-- removed the implementation of the TT_Get_Byte, TT_Get_UShort and
- TT_Get_ULong function, replacing them with simple macros in ttfile.h
- (there isn't a good reason to have two functions which perform
- _exactly_ the same task but return values of different signess).
-
-
-- fixed TT_Get_Face_Metrics : two serious bugs.. Oopss :-( !!
- Credits go to Michal..
-
-
-- the macro TT_MAKE_TAG referenced the 'Long' type, instead of 'long'
-
-----------------------------------------------------------------------
-
-Many relatively important changes :
-
-- Major code clean-up to eliminate warnings when compiling with
- Visual C++ (4.0 and 5.0, warning level 3 now ok) and Borland C++
- (5.0, some warnings must be deselected from the 'ANSI' set though..)
-
-- Vertical information support. The glyph loader uses the vertical data
- found in the file to build big glyph metrics.. Loading is automatic.
-
- NOTE: The glyph is _still_ placed relative to the horizontal roman
- metrics. You'll have to translate it yourself to position it
- correctly for vertical layouts..
-
- (translation vector is :
-
- ( vertBearingX - bbox.xMin, vertBearingY - bbox.yMax ) )
-
-- new APIS :
-
- o TT_Get_Face_Metrics :
-
- used to returned glyph metrics expressed in font units, as found
- in the "hmtx" and/or "vmtx" tables.. Much faster than loading
- each glyph individually..
-
-
- o TT_Get_Big_Glyph_Metrics :
-
- used to return a glyph's big metrics, which include vertical
- bearings and advance.
-
-
-- huge re-organisation in the bytecode interpreter, to introduce a
- giant "switch" statement to interpret opcodes. This usually produce
- smaller and faster code, though this is HIGHLY dependent on your
- compiler.
-
- You can revert back to the old "call-jump-table" by undefining the
- macro TT_CONFIG_OPTION_INTERPRETER_SWITCH in ttconfig.h
-
-
-- removed tterror.h. All its functions and macros were moved to
- ttdebug.h/c. Fixed all references in the sources and Makefiles.
-
-
-- removed "ttcommon.h" which is now useless with the single object
- compilation mode. NOTE : It may be a good idea to get rid of all
- those ".lo" relocatable objects when compiling freetype as a shared
- library on Unix !!
-
-
-- introduced an opcode counter. The "RunIns" function will return an
- error code when an infinite loop is detected. See macro
- MAX_RUNNABLE_OPCODES in ttinterp.c, currently set to 10000
-
-
-- two new error codes :
-
- TT_Err_No_Vertical_Data 0x030 /* there is no vertical data in */
- /* the file. Returned by the new */
- /* TT_Get_Face_Metrics API */
-
- TT_Err_Execution_Too_Long 0x411 /* infinite loop detected */
-
-
-- introduced four new fields in TT_Big_Glyph_Metrics to reflect un-hinted
- scaled glyph metrics (useful for device-independent positioning) :
-
- linearHoriBearingX left side bearing - horizontal layouts
- linearHoriAdvance advance width - "
- linearVertBearingY top side bearing - vertical layouts
- linearVertAdvance advance height - "
-
-
---------------------------------------------------------------------------
-
-Some more planned changes :
-
- - REENTRANCY SUPPORT !!!!!!!!!! I just printed the code on _lots_
- of sheets of paper to study it carefully..
-
- - A set of regression tests. Will probably help locate some evil
- bugs for the next "big change".
-
- - re-organisation of the outline coordinates layout,
- going from two parallel arrays to one single array of
- points (i.e. x & y) structures.
-
- This will require huge concurrent changes in the scan-line converter,
- the interpreter as well as the glyph loader. However, it should
- help reduce code size while improving performance
-
- (Actually, this is already done in the Pascal source..)
-
- - support for third-order beziers in the scan-line converter.
- (an easy but necessary "evil" ;-)
-
- - introducing an special "outline path iterator" function, much
- like "Decompose_Curve" but slightly more generic. It will be
- used to :
-
- 1. scan-line convert the curve into a bit/pixmap
- 2. compute a shape's _exact_ bounding box !
- 3. provide clients with an API that will let them convert
- FreeType outlines to wathever format they choose
-
- The current, and speedy, TT_Get_Outline_BBox API will probably
- be renamed TT_Get_Outline_CBox (for "Control BOX") and thus
- still be available to speed-expecting clients..
-
-
- - some fix in the raster, because I found some weird cases where
- some drop-outs can be generated outside of the current bbox
- (future "cbox") ! Darn !!
-
-
- - a faster and better anti-alias routine (with the ability to select
- between 5 or 17 shades of gray..)
-
-
- - in general, as most of the code seems now rock solid, the C version
- will progressively become more C-ish in style, mainly in order
- to reduce code size. Performance is already satisfying but some
- tricks might be introduced too..
-
-
- - some new apis for ttfile.h in order to "load" permanently a
- frame in memory. For memory mapped files, this will do nothing but
- return a pointer to it. Very similar to the current frame scheme
- but persistent and nesting..
-
- This will get rid of some stupid copies and allocations (programs,
- location table, etc...) and will reduce heap memory comsuption in
- the case of memory-mapped files and ROM/memory-placed fonts.
diff --git a/xc/extras/FreeType/po/freetype.pot b/xc/extras/FreeType/po/freetype.pot
deleted file mode 100644
index c3a23a39d..000000000
--- a/xc/extras/FreeType/po/freetype.pot
+++ /dev/null
@@ -1,433 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1998-10-20 09:10+0000\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: ENCODING\n"
-
-#: lib/extend/ftxerr18.c:44
-msgid "Successful function call, no error."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:47
-msgid "Invalid face handle."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:49
-msgid "Invalid instance handle."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:51
-msgid "Invalid glyph handle."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:53
-msgid "Invalid charmap handle."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:55
-msgid "Invalid result address."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:57
-msgid "Invalid glyph index."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:59
-msgid "Invalid argument."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:61
-msgid "Could not open file."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:63
-msgid "File is not a TrueType collection."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:66
-msgid "Mandatory table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:68
-msgid "Invalid horizontal metrics (hmtx table broken)."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:70
-msgid "Invalid charmap format."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:73
-msgid "Invalid file format."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:76
-msgid "Invalid engine."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:78
-msgid "Too many extensions (max: 8)."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:80
-msgid "Extensions unsupported."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:82
-msgid "Invalid extension id."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:85
-msgid "No vertical data in font."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:88
-msgid "Maximum Profile (maxp) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:90
-msgid "Font Header (head) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:92
-msgid "Horizontal Header (hhea) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:94
-msgid "Index to Location (loca) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:96
-msgid "Naming (name) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:98
-msgid "Character to Glyph Index Mapping (cmap) tables missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:100
-msgid "Horizontal Metrics (hmtx) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:102
-msgid "OS/2 table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:104
-msgid "PostScript (post) table missing."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:109
-msgid "Out of memory."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:114
-msgid "Invalid file offset."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:116
-msgid "Invalid file read."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:118
-msgid "Invalid frame access."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:123
-msgid "Too many points."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:125
-msgid "Too many contours."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:127
-msgid "Invalid composite glyph."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:129
-msgid "Too many instructions."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:134
-msgid "Invalid opcode."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:136
-msgid "Too few arguments."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:138
-msgid "Stack overflow."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:140
-msgid "Code overflow."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:142
-msgid "Bad argument."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:144
-msgid "Divide by zero."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:146
-msgid "Storage overflow."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:148
-msgid "Control Value (cvt) table overflow."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:150
-msgid "Invalid reference."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:152
-msgid "Invalid distance."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:154
-msgid "Interpolate twilight points."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:156
-msgid "`DEBUG' opcode found."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:158
-msgid "`ENDF' in byte-code stream."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:160
-msgid "Out of code ranges."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:162
-msgid "Nested function definitions."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:164
-msgid "Invalid code range."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:166
-msgid "Invalid displacement."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:168
-msgid "Endless loop encountered while executing instructions."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:173
-msgid "Nested frame access."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:175
-msgid "Invalid cache list."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:177
-msgid "Could not find context."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:179
-msgid "Unlisted object."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:184
-msgid "Raster pool overflow."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:186
-msgid "Raster: negative height encountered."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:188
-msgid "Raster: invalid value."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:190
-msgid "Raster not initialized."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:195
-msgid "Invalid kerning (kern) table format."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:197
-msgid "Invalid kerning (kern) table."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:199
-msgid "Invalid PostScript (post) table format."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:201
-msgid "Invalid PostScript (post) table."
-msgstr ""
-
-#: lib/extend/ftxerr18.c:208
-msgid "Invalid Error Number."
-msgstr ""
-
-#: test/fterror.c:59
-msgid "Start of fterror.\n"
-msgstr ""
-
-#: test/fterror.c:67
-msgid "End of fterror.\n"
-msgstr ""
-
-#: test/ftdump.c:148 test/ftlint.c:197
-msgid "Could not create glyph container.\n"
-msgstr ""
-
-#: test/ftdump.c:155
-msgid " Could not create instance.\n"
-msgstr ""
-
-#: test/ftdump.c:161
-msgid "Could not create 2nd instance.\n"
-msgstr ""
-
-#: test/ftdump.c:165
-msgid "Memory footprint statistics:\n"
-msgstr ""
-
-#: test/ftdump.c:173
-msgid "face object"
-msgstr ""
-
-#: test/ftdump.c:174
-msgid "glyph_object"
-msgstr ""
-
-#: test/ftdump.c:175
-msgid "instance object"
-msgstr ""
-
-#: test/ftdump.c:179
-msgid "exec. context object"
-msgstr ""
-
-#: test/ftdump.c:185
-msgid "total memory usage"
-msgstr ""
-
-#: test/ftdump.c:262
-msgid "font name table entries\n"
-msgstr ""
-
-#: test/ftdump.c:291
-msgid "character map encodings\n"
-msgstr ""
-
-#: test/ftdump.c:297 test/ftdump.c:438
-msgid "The file doesn't seem to have any encoding table.\n"
-msgstr ""
-
-#: test/ftdump.c:301 test/ftdump.c:442
-#, c-format
-msgid ""
-"There are %d encodings:\n"
-"\n"
-msgstr ""
-
-#: test/ftdump.c:306
-#, c-format
-msgid "encoding %2d: "
-msgstr ""
-
-#: test/ftdump.c:333 test/ftdump.c:342 test/ftdump.c:405
-#, c-format
-msgid "Unknown %d"
-msgstr ""
-
-#: test/ftdump.c:412
-msgid "Unknown"
-msgstr ""
-
-#: test/ftdump.c:432
-msgid "ftxcmap test\n"
-msgstr ""
-
-#: test/ftdump.c:448
-#, c-format
-msgid "encoding %2d:\n"
-msgstr ""
-
-#: test/ftdump.c:484
-msgid "ftdump: simple TrueType Dumper -- part of the FreeType project\n"
-msgstr ""
-
-#: test/ftdump.c:487
-#, c-format
-msgid ""
-"Usage: %s fontname[.ttf|.ttc]\n"
-"\n"
-msgstr ""
-
-#: test/ftdump.c:518 test/ftlint.c:125
-#, c-format
-msgid "Error while initializing engine: %s\n"
-msgstr ""
-
-#: test/ftdump.c:534
-#, c-format
-msgid "Error while opening %s.\n"
-msgstr ""
-
-#: test/ftdump.c:535 test/ftlint.c:182 test/ftlint.c:199 test/ftlint.c:211
-#: test/ftlint.c:225
-#, c-format
-msgid "FreeType error message: %s\n"
-msgstr ""
-
-#: test/ftlint.c:87
-msgid ""
-"ftlint: simple TrueType instruction tester -- part of the FreeType project\n"
-msgstr ""
-
-#: test/ftlint.c:90
-#, c-format
-msgid "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
-msgstr ""
-
-#: test/ftlint.c:180
-msgid "Could not find or open file.\n"
-msgstr ""
-
-#: test/ftlint.c:209
-msgid "Could not create instance.\n"
-msgstr ""
-
-#: test/ftlint.c:223
-#, c-format
-msgid "Could not set point size to %d.\n"
-msgstr ""
-
-#: test/ftlint.c:239
-#, c-format
-msgid "glyph %4u: %s\n"
-msgstr ""
-
-#: test/ftlint.c:252
-msgid "1 fail.\n"
-msgstr ""
-
-#: test/ftlint.c:254
-#, c-format
-msgid "%d fails.\n"
-msgstr ""
diff --git a/xc/extras/FreeType/test/arch/win32/Driver32.c b/xc/extras/FreeType/test/arch/win32/Driver32.c
deleted file mode 100644
index 4031c8661..000000000
--- a/xc/extras/FreeType/test/arch/win32/Driver32.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#include <windows.h>
-#include "gdriver.h"
-#include "freetype.h"
-//#include <varargs.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
-#include <setjmp.h>
-HANDLE evgetevent,evdriverdisplaybitmap,this_wnd,main_thread,listbox,bitmap;
-TEvent evevent;
-char message_32[256];
-char *ev_buffer;
-jmp_buf Env;
-long TTMemory_Allocated = 0; // just to have a clean link with ftdump
-// save last rendered image Data
-int save_lines,save_cols,exit_code;
-char *save_buffer;
-extern int vio_Width,vio_Height,vio_ScanLineWidth;
-extern TT_Raster_Map Bit;
-HDC hdc,memdc;
-HBITMAP hbm,hbm1;
-
-//________________________________________________________________________________
-void Get_Event(TEvent *event)
-{
- WaitForSingleObject(evgetevent,INFINITE); // wait for completion
- *event=evevent; //set by message handler before posting waited upon event
- return;
-}
-
-int Driver_Set_Graphics( int mode )
-{ RECT rect;
- GetClientRect(bitmap,&rect);
- vio_Width=rect.right-rect.left;
- vio_Height = rect.bottom-rect.top;
- vio_ScanLineWidth=vio_Width;
- return 1;
-
- }
-int Driver_Restore_Mode()
-{return 1;}
-
-int Driver_Display_Bitmap( char* buffer, int lines, int cols )
- {
- long rc;
- int i;
- char *top,*bottom;
- HANDLE rgdi;
- RECT rect;
- char *w_buffer;
-// bitmap=listbox;
- hdc=GetDC(bitmap);
- memdc=CreateCompatibleDC(hdc);
- GetClientRect(bitmap,&rect);
- //hbm=CreateCompatibleBitmap(hdc,lines,cols);
- // need to set upside down bitmap .
- if (buffer != save_buffer) //new buffer
- {
- if (save_buffer!=NULL)
- free(save_buffer);
- save_buffer=(char *)malloc(Bit.size);
- memcpy(save_buffer,buffer,Bit.size);
- }
- w_buffer=malloc(Bit.size); // hope it succeeds
- top=buffer;
- bottom=w_buffer+Bit.size-cols;
- for(i=0;i<Bit.size;i+=cols)
- {
- memcpy(bottom,top,cols);
- top+=cols;
- bottom-=cols;
- };
- save_lines=lines;
- save_cols=cols;
- hbm=CreateBitmap(vio_Width,vio_Height,1,1,w_buffer);
- rgdi=SelectObject(memdc,hbm);
- // rc=SetBitmapBits(hbm,Bit.size,buffer); //redundant
- rc=StretchBlt(hdc,0,0,rect.right,rect.bottom,memdc,0,0,rect.right,rect.bottom,MERGECOPY);
- ReleaseDC(bitmap,hdc);
- DeleteObject(memdc);
- rc=UpdateWindow(bitmap);
- return 1;
- }
-
-
-int call_test_program(int (*program)(int,char**),int argc,char **argv)
-{int rc;
-// prepare return address ( for exit)
-if(0==setjmp(Env)) //env set : call prog
- rc=program(argc,argv);
- return rc;
-}
-
-void force_exit(int code)
-{ char *p=NULL;
- longjmp(Env,code);
- //disable piping
-} \ No newline at end of file
diff --git a/xc/extras/FreeType/test/arch/win32/ReadMe.txt b/xc/extras/FreeType/test/arch/win32/ReadMe.txt
deleted file mode 100644
index 4356a2f42..000000000
--- a/xc/extras/FreeType/test/arch/win32/ReadMe.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-The purpose of this application is to serve as a running environment for
-some of the freetype project test programs:
-currently available programa aree ftdump,ftlint,,ftstring,ftview;
-others may be convinced to run but you may need to change the source
-code to avoid duplicate problems with the linker.
-This work has been based on a large amount of guesswork
-and a small amount of my (little) spare time;
-however it seems to be working pretty well as far as I can tell
-( -g -r options are not working but I don't care 'bout them).
-It can be compiled both under MS VC++ Version 4.X and Version 5.
-and has been tested under Windows 95 & NT 4.0 .
-
-Have Fun .
- Giancarlo Ramat
- (gcramat@radiostudio.it)
-
- \ No newline at end of file
diff --git a/xc/extras/FreeType/test/arch/win32/Resource.h b/xc/extras/FreeType/test/arch/win32/Resource.h
deleted file mode 100644
index f1a409420..000000000
--- a/xc/extras/FreeType/test/arch/win32/Resource.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by testw32.rc
-//
-#define IDD_TESTW32_DIALOG 102
-#define IDR_MAINFRAME 128
-#define IDC_FONT_NAME 1000
-#define IDC_BITMAP 1001
-#define IDC_LIST_BOX 1002
-#define IDC_SELECT_ACTION 1003
-#define IDC_ACTION 1004
-#define IDC_TEST_PROGRAM 1005
-#define IDC_OPTIONS 1007
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 130
-#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1008
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/xc/extras/FreeType/test/arch/win32/StdAfx.cpp b/xc/extras/FreeType/test/arch/win32/StdAfx.cpp
deleted file mode 100644
index 7b5c0a771..000000000
--- a/xc/extras/FreeType/test/arch/win32/StdAfx.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// testw32.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
diff --git a/xc/extras/FreeType/test/arch/win32/StdAfx.h b/xc/extras/FreeType/test/arch/win32/StdAfx.h
deleted file mode 100644
index 30170c575..000000000
--- a/xc/extras/FreeType/test/arch/win32/StdAfx.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__70F52CAD_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
-#define AFX_STDAFX_H__70F52CAD_06A4_11D2_9AC4_0060978849F3__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__70F52CAD_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
diff --git a/xc/extras/FreeType/test/arch/win32/TESTW32.DSP b/xc/extras/FreeType/test/arch/win32/TESTW32.DSP
deleted file mode 100644
index 2b1a1d740..000000000
--- a/xc/extras/FreeType/test/arch/win32/TESTW32.DSP
+++ /dev/null
@@ -1,190 +0,0 @@
-# Microsoft Developer Studio Project File - Name="testw32" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=testw32 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "testw32.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "testw32.mak" CFG="testw32 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "testw32 - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "testw32 - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
-# ADD LINK32 /nologo /subsystem:windows /machine:I386
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /G5 /MDd /W3 /Gm /Zi /Od /I "../../../LIB" /I "../" /I "../../../lib/arch/win32" /I "../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "WIN32_GR_TEST" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 freetype.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\arch\win32\release" /libpath:"..\..\..\lib\arch\win32\debug" /FORCE:MULTIPLE /FORCE:UNRESOLVED
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "testw32 - Win32 Release"
-# Name "testw32 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\display.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\driver32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gmain.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_common.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_ftdump.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_ftlint.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_ftstring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_fttimer.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hack_ftview.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\testw32.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\testw32.rc
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\testw32Dlg.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\Resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\testw32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\testw32Dlg.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\res\testw32.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\testw32.rc2
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/xc/extras/FreeType/test/arch/win32/TESTW32.DSW b/xc/extras/FreeType/test/arch/win32/TESTW32.DSW
deleted file mode 100644
index 6c37bebc5..000000000
--- a/xc/extras/FreeType/test/arch/win32/TESTW32.DSW
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "testw32"=.\testw32.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/xc/extras/FreeType/test/arch/win32/TESTW32.H b/xc/extras/FreeType/test/arch/win32/TESTW32.H
deleted file mode 100644
index e8740af71..000000000
--- a/xc/extras/FreeType/test/arch/win32/TESTW32.H
+++ /dev/null
@@ -1,50 +0,0 @@
-// testw32.h : main header file for the TESTW32 application
-//
-
-#if !defined(AFX_TESTW32_H__70F52CA9_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
-#define AFX_TESTW32_H__70F52CA9_06A4_11D2_9AC4_0060978849F3__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-#ifndef __AFXWIN_H__
- #error include 'stdafx.h' before including this file for PCH
-#endif
-
-#include "resource.h" // main symbols
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32App:
-// See testw32.cpp for the implementation of this class
-//
-
-class CTestw32App : public CWinApp
-{
-public:
- CTestw32App();
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTestw32App)
- public:
- virtual BOOL InitInstance();
- virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
- //}}AFX_VIRTUAL
-
-// Implementation
-
- //{{AFX_MSG(CTestw32App)
- // NOTE - the ClassWizard will add and remove member functions here.
- // DO NOT EDIT what you see in these blocks of generated code !
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_TESTW32_H__70F52CA9_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
diff --git a/xc/extras/FreeType/test/arch/win32/Testw32.cpp b/xc/extras/FreeType/test/arch/win32/Testw32.cpp
deleted file mode 100644
index 5591d6f47..000000000
--- a/xc/extras/FreeType/test/arch/win32/Testw32.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-// testw32.cpp : Defines the class behaviors for the application.
-//
-
-#include "stdafx.h"
-#include "testw32.h"
-#include "testw32Dlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32App
-
-BEGIN_MESSAGE_MAP(CTestw32App, CWinApp)
- //{{AFX_MSG_MAP(CTestw32App)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG
- ON_COMMAND(ID_HELP, CWinApp::OnHelp)
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32App construction
-
-CTestw32App::CTestw32App()
-{
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// The one and only CTestw32App object
-
-CTestw32App theApp;
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32App initialization
-
-BOOL CTestw32App::InitInstance()
-{
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
-
- CTestw32Dlg dlg;
- m_pMainWnd = &dlg;
- int nResponse = dlg.DoModal();
- if (nResponse == IDOK)
- {
- // TODO: Place code here to handle when the dialog is
- // dismissed with OK
- }
- else if (nResponse == IDCANCEL)
- {
- // TODO: Place code here to handle when the dialog is
- // dismissed with Cancel
- }
-
- // Since the dialog has been closed, return FALSE so that we exit the
- // application, rather than start the application's message pump.
- return FALSE;
-}
-
-BOOL CTestw32App::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
-{
- // TODO: Add your specialized code here and/or call the base class
-
- return CWinApp::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
-}
diff --git a/xc/extras/FreeType/test/arch/win32/Testw32.mak b/xc/extras/FreeType/test/arch/win32/Testw32.mak
deleted file mode 100644
index 1d999e87c..000000000
--- a/xc/extras/FreeType/test/arch/win32/Testw32.mak
+++ /dev/null
@@ -1,533 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-!IF "$(CFG)" == ""
-CFG=testw32 - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to testw32 - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "testw32 - Win32 Release" && "$(CFG)" !=\
- "testw32 - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE on this makefile
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Testw32.mak" CFG="testw32 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "testw32 - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "testw32 - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-################################################################################
-# Begin Project
-# PROP Target_Last_Scanned "testw32 - Win32 Debug"
-MTL=mktyplib.exe
-RSC=rc.exe
-CPP=cl.exe
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-OUTDIR=.\Release
-INTDIR=.\Release
-
-ALL : "$(OUTDIR)\Testw32.exe" "$(OUTDIR)\Testw32.pch"
-
-CLEAN :
- -@erase ".\Release\Testw32.pch"
- -@erase ".\Release\Testw32.exe"
- -@erase ".\Release\hack_ftview.obj"
- -@erase ".\Release\testw32.obj"
- -@erase ".\Release\hack_fttimer.obj"
- -@erase ".\Release\hack_common.obj"
- -@erase ".\Release\Driver32.obj"
- -@erase ".\Release\StdAfx.obj"
- -@erase ".\Release\hack_ftlint.obj"
- -@erase ".\Release\testw32Dlg.obj"
- -@erase ".\Release\Gmain.obj"
- -@erase ".\Release\hack_ftdump.obj"
- -@erase ".\Release\hack_ftstring.obj"
- -@erase ".\Release\Display.obj"
- -@erase ".\Release\testw32.res"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\lib" /I "..\..\" /I "..\..\..\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX"stdafx.h" /c
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\..\..\lib" /I "..\..\" /I "..\..\..\"\
- /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS"\
- /Fp"$(INTDIR)/Testw32.pch" /YX"stdafx.h" /Fo"$(INTDIR)/" /c
-CPP_OBJS=.\Release/
-CPP_SBRS=
-# ADD BASE MTL /nologo /D "NDEBUG" /win32
-# ADD MTL /nologo /D "NDEBUG" /win32
-MTL_PROJ=/nologo /D "NDEBUG" /win32
-# ADD BASE RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
-RSC_PROJ=/l 0x410 /fo"$(INTDIR)/testw32.res" /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/Testw32.bsc"
-BSC32_SBRS=
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
-# ADD LINK32 freetype.lib /nologo /subsystem:windows /machine:I386
-LINK32_FLAGS=freetype.lib /nologo /subsystem:windows /incremental:no\
- /pdb:"$(OUTDIR)/Testw32.pdb" /machine:I386 /out:"$(OUTDIR)/Testw32.exe"
-LINK32_OBJS= \
- "$(INTDIR)/hack_ftview.obj" \
- "$(INTDIR)/testw32.obj" \
- "$(INTDIR)/hack_fttimer.obj" \
- "$(INTDIR)/hack_common.obj" \
- "$(INTDIR)/Driver32.obj" \
- "$(INTDIR)/StdAfx.obj" \
- "$(INTDIR)/hack_ftlint.obj" \
- "$(INTDIR)/testw32Dlg.obj" \
- "$(INTDIR)/Gmain.obj" \
- "$(INTDIR)/hack_ftdump.obj" \
- "$(INTDIR)/hack_ftstring.obj" \
- "$(INTDIR)/Display.obj" \
- "$(INTDIR)/testw32.res"
-
-"$(OUTDIR)\Testw32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-OUTDIR=.\Debug
-INTDIR=.\Debug
-
-ALL : "$(OUTDIR)\Testw32.exe" "$(OUTDIR)\Testw32.pch"
-
-CLEAN :
- -@erase ".\Debug\vc40.pdb"
- -@erase ".\Debug\vc40.idb"
- -@erase ".\Debug\Testw32.pch"
- -@erase ".\Debug\Testw32.exe"
- -@erase ".\Debug\StdAfx.obj"
- -@erase ".\Debug\Display.obj"
- -@erase ".\Debug\hack_ftlint.obj"
- -@erase ".\Debug\hack_fttimer.obj"
- -@erase ".\Debug\hack_ftdump.obj"
- -@erase ".\Debug\Driver32.obj"
- -@erase ".\Debug\hack_ftview.obj"
- -@erase ".\Debug\testw32Dlg.obj"
- -@erase ".\Debug\testw32.obj"
- -@erase ".\Debug\Gmain.obj"
- -@erase ".\Debug\hack_ftstring.obj"
- -@erase ".\Debug\hack_common.obj"
- -@erase ".\Debug\testw32.res"
- -@erase ".\Debug\Testw32.ilk"
- -@erase ".\Debug\Testw32.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\winlib\freetype.orig\test" /I "..\..\..\lib" /I "..\..\..\lib\arch\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX"stdafx.h" /c
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\winlib\freetype.orig\test" /I\
- "..\..\..\lib" /I "..\..\..\lib\arch\win32" /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/Testw32.pch" /YX"stdafx.h"\
- /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=
-# ADD BASE MTL /nologo /D "_DEBUG" /win32
-# ADD MTL /nologo /D "_DEBUG" /win32
-MTL_PROJ=/nologo /D "_DEBUG" /win32
-# ADD BASE RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
-RSC_PROJ=/l 0x410 /fo"$(INTDIR)/testw32.res" /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/Testw32.bsc"
-BSC32_SBRS=
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
-# ADD LINK32 ..\..\..\lib\arch\win32\debug\freetype.lib /nologo /subsystem:windows /debug /machine:I386
-LINK32_FLAGS=..\..\..\lib\arch\win32\debug\freetype.lib /nologo\
- /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)/Testw32.pdb" /debug\
- /machine:I386 /out:"$(OUTDIR)/Testw32.exe"
-LINK32_OBJS= \
- "$(INTDIR)/StdAfx.obj" \
- "$(INTDIR)/Display.obj" \
- "$(INTDIR)/hack_ftlint.obj" \
- "$(INTDIR)/hack_fttimer.obj" \
- "$(INTDIR)/hack_ftdump.obj" \
- "$(INTDIR)/Driver32.obj" \
- "$(INTDIR)/hack_ftview.obj" \
- "$(INTDIR)/testw32Dlg.obj" \
- "$(INTDIR)/testw32.obj" \
- "$(INTDIR)/Gmain.obj" \
- "$(INTDIR)/hack_ftstring.obj" \
- "$(INTDIR)/hack_common.obj" \
- "$(INTDIR)/testw32.res"
-
-"$(OUTDIR)\Testw32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.c{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-################################################################################
-# Begin Target
-
-# Name "testw32 - Win32 Release"
-# Name "testw32 - Win32 Debug"
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-!ENDIF
-
-################################################################################
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\testw32.cpp
-DEP_CPP_TESTW=\
- ".\StdAfx.h"\
- ".\testw32.h"\
- ".\testw32Dlg.h"\
-
-
-"$(INTDIR)\testw32.obj" : $(SOURCE) $(DEP_CPP_TESTW) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\testw32Dlg.cpp
-DEP_CPP_TESTW3=\
- ".\StdAfx.h"\
- ".\testw32.h"\
- ".\testw32Dlg.h"\
- ".\..\..\gdriver.h"\
- ".\..\..\gevents.h"\
-
-
-"$(INTDIR)\testw32Dlg.obj" : $(SOURCE) $(DEP_CPP_TESTW3) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-DEP_CPP_STDAF=\
- ".\StdAfx.h"\
-
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-# ADD CPP /Yc"stdafx.h"
-
-BuildCmds= \
- $(CPP) /nologo /MD /W3 /GX /O2 /I "..\..\..\lib" /I "..\..\" /I "..\..\..\" /D\
- "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS"\
- /Fp"$(INTDIR)/Testw32.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
-
-
-"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
- $(BuildCmds)
-
-"$(INTDIR)\Testw32.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
- $(BuildCmds)
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-# ADD CPP /Yc"stdafx.h"
-
-BuildCmds= \
- $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\winlib\freetype.orig\test" /I\
- "..\..\..\lib" /I "..\..\..\lib\arch\win32" /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/Testw32.pch" /Yc"stdafx.h"\
- /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \
-
-
-"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
- $(BuildCmds)
-
-"$(INTDIR)\Testw32.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
- $(BuildCmds)
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\testw32.rc
-DEP_RSC_TESTW32=\
- ".\res\testw32.ico"\
- ".\res\testw32.rc2"\
-
-
-"$(INTDIR)\testw32.res" : $(SOURCE) $(DEP_RSC_TESTW32) "$(INTDIR)"
- $(RSC) $(RSC_PROJ) $(SOURCE)
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_ftview.c
-DEP_CPP_HACK_=\
- ".\..\..\ftview.c"\
- ".\..\..\..\lib\freetype.h"\
- ".\..\..\common.h"\
- ".\..\..\gmain.h"\
- ".\..\..\gevents.h"\
- ".\..\..\gdriver.h"\
- ".\..\..\display.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-NODEP_CPP_HACK_=\
- ".\..\..\std.h"\
- ".\..\..\graflink.h"\
- ".\..\..\armsup.c"\
-
-
-"$(INTDIR)\hack_ftview.obj" : $(SOURCE) $(DEP_CPP_HACK_) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_common.c
-DEP_CPP_HACK_C=\
- ".\..\..\common.c"\
- ".\..\..\common.h"\
-
-
-"$(INTDIR)\hack_common.obj" : $(SOURCE) $(DEP_CPP_HACK_C) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_ftdump.c
-
-!IF "$(CFG)" == "testw32 - Win32 Release"
-
-DEP_CPP_HACK_F=\
- ".\..\..\ftdump.c"\
- ".\..\..\..\lib\freetype.h"\
- ".\..\..\common.h"\
- ".\..\..\..\lib\ttobjs.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
- ".\..\..\..\lib\ttconfig.h"\
- ".\..\..\..\lib\ttengine.h"\
- ".\..\..\..\lib\ttmutex.h"\
- ".\..\..\..\lib\ttcache.h"\
- ".\..\..\..\lib\tttables.h"\
- ".\..\..\..\lib\ttcmap.h"\
- ".\..\..\..\lib\tttypes.h"\
-
-NODEP_CPP_HACK_F=\
- ".\..\..\std.h"\
- ".\..\..\graflink.h"\
- ".\..\..\armsup.c"\
- ".\..\..\ftxerr18.h"\
- ".\..\..\..\lib\ft_conf.h"\
-
-
-"$(INTDIR)\hack_ftdump.obj" : $(SOURCE) $(DEP_CPP_HACK_F) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "testw32 - Win32 Debug"
-
-DEP_CPP_HACK_F=\
- ".\..\..\ftdump.c"\
-
-
-"$(INTDIR)\hack_ftdump.obj" : $(SOURCE) $(DEP_CPP_HACK_F) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_ftlint.c
-DEP_CPP_HACK_FT=\
- ".\..\..\ftlint.c"\
- ".\..\..\..\lib\freetype.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-NODEP_CPP_HACK_FT=\
- ".\..\..\std.h"\
- ".\..\..\graflink.h"\
- ".\..\..\armsup.c"\
- ".\..\..\ftxerr18.h"\
-
-
-"$(INTDIR)\hack_ftlint.obj" : $(SOURCE) $(DEP_CPP_HACK_FT) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_ftstring.c
-DEP_CPP_HACK_FTS=\
- ".\..\..\ftstring.c"\
- ".\..\..\..\lib\freetype.h"\
- ".\..\..\common.h"\
- ".\..\..\gmain.h"\
- ".\..\..\gevents.h"\
- ".\..\..\gdriver.h"\
- ".\..\..\display.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-NODEP_CPP_HACK_FTS=\
- ".\..\..\std.h"\
- ".\..\..\graflink.h"\
- ".\..\..\armsup.c"\
-
-
-"$(INTDIR)\hack_ftstring.obj" : $(SOURCE) $(DEP_CPP_HACK_FTS) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\hack_fttimer.c
-DEP_CPP_HACK_FTT=\
- ".\..\..\fttimer.c"\
- ".\..\..\..\lib\freetype.h"\
- ".\..\..\common.h"\
- ".\..\..\gmain.h"\
- ".\..\..\gdriver.h"\
- ".\..\..\gevents.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-
-"$(INTDIR)\hack_fttimer.obj" : $(SOURCE) $(DEP_CPP_HACK_FTT) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\Driver32.c
-DEP_CPP_DRIVE=\
- ".\..\..\gdriver.h"\
- ".\..\..\..\lib\freetype.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-
-"$(INTDIR)\Driver32.obj" : $(SOURCE) $(DEP_CPP_DRIVE) "$(INTDIR)"
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=\Winlib\freetype.orig\Test\Gmain.c
-DEP_CPP_GMAIN=\
- ".\..\..\gmain.h"\
- ".\..\..\gdriver.h"\
-
-
-"$(INTDIR)\Gmain.obj" : $(SOURCE) $(DEP_CPP_GMAIN) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=\Winlib\freetype.orig\Test\Display.c
-DEP_CPP_DISPL=\
- ".\..\..\..\lib\freetype.h"\
- ".\..\..\gmain.h"\
- ".\..\..\display.h"\
- "..\..\..\Lib\Fterrid.h"\
- "..\..\..\Lib\Ftnameid.h"\
-
-
-"$(INTDIR)\Display.obj" : $(SOURCE) $(DEP_CPP_DISPL) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-# End Source File
-# End Target
-# End Project
-################################################################################
diff --git a/xc/extras/FreeType/test/arch/win32/hack_common.c b/xc/extras/FreeType/test/arch/win32/hack_common.c
deleted file mode 100644
index df573255e..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_common.c
+++ /dev/null
@@ -1,8 +0,0 @@
-
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-#define exit(code) force_exit(code)
-#include <common.c>
diff --git a/xc/extras/FreeType/test/arch/win32/hack_ftdump.c b/xc/extras/FreeType/test/arch/win32/hack_ftdump.c
deleted file mode 100644
index 9b2a25ea9..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_ftdump.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#define exit(code) force_exit(code)
-#define main(A,B) ftdump(A,B)
-#include <ftdump.c>
diff --git a/xc/extras/FreeType/test/arch/win32/hack_ftlint.c b/xc/extras/FreeType/test/arch/win32/hack_ftlint.c
deleted file mode 100644
index 80468ac87..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_ftlint.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#define exit(code) force_exit(code)
-#define main(A,B) ftlint(A,B)
-#include <ftlint.c>
diff --git a/xc/extras/FreeType/test/arch/win32/hack_ftstring.c b/xc/extras/FreeType/test/arch/win32/hack_ftstring.c
deleted file mode 100644
index 39953be56..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_ftstring.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#define exit(code) force_exit(code)
-#define main(A,B) ftstring(A,B)
-#include <ftstring.c>
diff --git a/xc/extras/FreeType/test/arch/win32/hack_fttimer.c b/xc/extras/FreeType/test/arch/win32/hack_fttimer.c
deleted file mode 100644
index b438db367..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_fttimer.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#define exit(code) force_exit(code)
-#define main(A,B) fttimer(A,B)
-#include <fttimer.c>
diff --git a/xc/extras/FreeType/test/arch/win32/hack_ftview.c b/xc/extras/FreeType/test/arch/win32/hack_ftview.c
deleted file mode 100644
index dc9b26515..000000000
--- a/xc/extras/FreeType/test/arch/win32/hack_ftview.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-#define exit(code) force_exit(code)
-#define main(A,B) ftview(A,B)
-#include <ftview.c>
diff --git a/xc/extras/FreeType/test/arch/win32/testw32.mdp b/xc/extras/FreeType/test/arch/win32/testw32.mdp
deleted file mode 100644
index 51d051996..000000000
--- a/xc/extras/FreeType/test/arch/win32/testw32.mdp
+++ /dev/null
Binary files differ
diff --git a/xc/extras/FreeType/test/arch/win32/testw32.rc b/xc/extras/FreeType/test/arch/win32/testw32.rc
deleted file mode 100644
index 558133664..000000000
--- a/xc/extras/FreeType/test/arch/win32/testw32.rc
+++ /dev/null
@@ -1,202 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Italian (Italy) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
-#ifdef _WIN32
-LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
- "#define _AFX_NO_OLE_RESOURCES\r\n"
- "#define _AFX_NO_TRACKER_RESOURCES\r\n"
- "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
- "\r\n"
- "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)\r\n"
- "#ifdef _WIN32\r\n"
- "LANGUAGE 16, 1\r\n"
- "#pragma code_page(1252)\r\n"
- "#endif\r\n"
- "#include ""res\\testw32.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
- "#include ""l.ita\\afxres.rc"" // Standard components\r\n"
- "#endif\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDR_MAINFRAME ICON DISCARDABLE "res\\testw32.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_TESTW32_DIALOG DIALOGEX 0, 0, 331, 274
-STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_APPWINDOW
-CAPTION "testw32"
-FONT 8, "MS Sans Serif"
-BEGIN
- DEFPUSHBUTTON "Run",IDOK,105,100,28,14
- PUSHBUTTON "Exit",IDCANCEL,105,116,28,14
- CONTROL "",IDC_BITMAP,"Static",SS_BLACKRECT,146,47,178,120
- LISTBOX IDC_LIST_BOX,7,171,317,97,LBS_NOINTEGRALHEIGHT |
- WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
- PUSHBUTTON "<-Select Action (q to quit test pgm)",IDC_SELECT_ACTION,
- 34,56,110,15
- EDITTEXT IDC_ACTION,23,56,9,12,ES_AUTOHSCROLL
- COMBOBOX IDC_TEST_PROGRAM,13,12,90,64,CBS_DROPDOWN | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP
- LTEXT "Test Program",IDC_STATIC,13,1,60,8
- EDITTEXT IDC_OPTIONS,111,12,204,12,ES_AUTOHSCROLL
- LTEXT "Options/Arguments",IDC_STATIC,109,2,73,8
- LTEXT "Show Window",IDC_STATIC,146,37,70,8
-END
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "041004B0"
- BEGIN
- VALUE "CompanyName", "\0"
- VALUE "FileDescription", "testw32 Applicazione MFC\0"
- VALUE "FileVersion", "1, 0, 0, 1\0"
- VALUE "InternalName", "testw32\0"
- VALUE "LegalCopyright", "Copyright (C) 1998\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "testw32.EXE\0"
- VALUE "ProductName", "testw32 Applicazione\0"
- VALUE "ProductVersion", "1, 0, 0, 1\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x410, 1200
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
-BEGIN
- IDD_TESTW32_DIALOG, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 324
- BOTTOMMARGIN, 268
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog Info
-//
-
-IDD_TESTW32_DIALOG DLGINIT
-BEGIN
- IDC_TEST_PROGRAM, 0x403, 7, 0
-0x5446, 0x4956, 0x5745, "\000"
- IDC_TEST_PROGRAM, 0x403, 7, 0
-0x5446, 0x5544, 0x504d, "\000"
- IDC_TEST_PROGRAM, 0x403, 9, 0
-0x5446, 0x5453, 0x4952, 0x474e, "\000"
- IDC_TEST_PROGRAM, 0x403, 7, 0
-0x5446, 0x494c, 0x544e, "\000"
- 0
-END
-
-#endif // Italian (Italy) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-#define _AFX_NO_SPLITTER_RESOURCES
-#define _AFX_NO_OLE_RESOURCES
-#define _AFX_NO_TRACKER_RESOURCES
-#define _AFX_NO_PROPERTY_RESOURCES
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
-#ifdef _WIN32
-LANGUAGE 16, 1
-#pragma code_page(1252)
-#endif
-#include "res\testw32.rc2" // non-Microsoft Visual C++ edited resources
-#include "l.ita\afxres.rc" // Standard components
-#endif
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/xc/extras/FreeType/test/arch/win32/testw32Dlg.cpp b/xc/extras/FreeType/test/arch/win32/testw32Dlg.cpp
deleted file mode 100644
index b523b01cf..000000000
--- a/xc/extras/FreeType/test/arch/win32/testw32Dlg.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/*********************************************************/
-/* Test program driver for freetype on Win32 Platform */
-/* CopyRight(left) G. Ramat 1998 (gcramat@radiostudio.it)*/
-/* */
-/*********************************************************/
-
-// testw32Dlg.cpp : implementation file
-//
-
-#include "stdafx.h"
-#include "testw32.h"
-#include "testw32Dlg.h"
-#include "gdriver.h"
-#include "gevents.h"
-#include <fcntl.h>
-#include <errno.h>
-#include <io.h>
-CWnd *button_OK,*button_Cancel;
-DWORD thrd_spool; // output spooler
-HANDLE spool_thread;
-
-//Sync data:
-extern "C" {
- HANDLE evgetevent,evdriverdisplaybitmap,this_cwnd,main_thread,listbox,bitmap;
- TEvent evevent;
- char *ev_buffer;
- int ev_lines,ev_columns;
- char *save_buffer;
- int save_lines,save_cols,exit_code;
- int ftview(int,char**);
- int ftdump(int,char**);
- int ftlint(int,char**);
- int ftstring(int,char**);
- int ftstrpnm(int,char**);
- int ftzoom(int,char**);
- int call_test_program(int (*)(int,char**),int,char **);
-
-}
-//pipe handling variables
-int pipe_std[2]={2*0},pipe_err[2]={2*0},error;
-int old_std,old_err;
-//end of pipe handling variables
-
-
-#define TEST_PROG_N 4
-//Sync data end
-char ProgramName[16];
-char fontname[16];
-char fullfont[MAX_PATH];
-char *argv[255];
-int argc;
-DWORD WINAPI ThreadHead(LPVOID );
-DWORD WINAPI ThreadSpool(LPVOID );
-void readpipe(int);
-
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-extern main(int,char **);
-extern int X_Link;
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32Dlg dialog
-
-CTestw32Dlg::CTestw32Dlg(CWnd* pParent /*=NULL*/)
- : CDialog(CTestw32Dlg::IDD, pParent)
-{
- //{{AFX_DATA_INIT(CTestw32Dlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
-}
-
-void CTestw32Dlg::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CTestw32Dlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
-}
-
-BEGIN_MESSAGE_MAP(CTestw32Dlg, CDialog)
- //{{AFX_MSG_MAP(CTestw32Dlg)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_BN_CLICKED(IDC_SELECT_ACTION, OnSelectAction)
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32Dlg message handlers
-
-BOOL CTestw32Dlg::OnInitDialog()
-{ int error;
- FILE *retf;
- CDialog::OnInitDialog();
-
- // Set the icon for this dialog. The framework does this automatically
- // when the application's main window is not a dialog
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
-
- // TODO: Add extra initialization here
- //save CWnd objects for utility fns;
- evgetevent=CreateEvent(NULL,FALSE,FALSE,"Get_Event");
- evdriverdisplaybitmap=CreateEvent(NULL,FALSE,FALSE,"Driver_Display_Bitmap");
- listbox=(GetDlgItem(IDC_LIST_BOX))->m_hWnd;
- bitmap=(GetDlgItem(IDC_BITMAP))->m_hWnd;
- button_OK=GetDlgItem(IDOK);
- button_Cancel=GetDlgItem(IDCANCEL);
- error=_pipe(pipe_std,1024,_O_TEXT);
-// error=_pipe(pipe_err,1024,_O_TEXT);
- // enable piping
- if(-1==_fileno(stdout))
- {retf=freopen("throwaway_stdout.tmp","wt",stdout);
- }
- if(-1==_fileno(stderr))
- {retf=freopen("throwaway_stderr.tmp","wt",stderr);
- }
- old_std=dup(_fileno(stdout));
- old_err=dup(_fileno(stderr));
- error=dup2(pipe_std[1],_fileno(stdout));
- error=dup2(pipe_std[1],_fileno(stderr)); //error=dup2(pipe_err[1],_fileno(stderr));
- save_buffer=NULL;
-// error=write(pipe_std[1],"Pipe_test:Write\n",16);
-// error=fprintf(stdout,"Pipe_test:fprintf");
-// error=fflush(stdout);
-// activate spooler
- spool_thread=CreateThread(NULL,0,ThreadSpool,NULL,0,&thrd_spool);
-
-
- return TRUE; // return TRUE unless you set the focus to a control
-}
-
-// If you add a minimize button to your dialog, you will need the code below
-// to draw the icon. For MFC applications using the document/view model,
-// this is automatically done for you by the framework.
-
-void CTestw32Dlg::OnPaint()
-{
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
-
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
-
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
-
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
-}
-
-// The system calls this to obtain the cursor to display while the user drags
-// the minimized window.
-HCURSOR CTestw32Dlg::OnQueryDragIcon()
-{
- return (HCURSOR) m_hIcon;
-}
-
-void CTestw32Dlg::OnOK()
-{
- DWORD thrd_id;
- char Options[256];
- char *p,*pb,*pe;
- int i;
- // TODO: Add extra validation here
- GetDlgItemText(IDC_TEST_PROGRAM,ProgramName,sizeof(ProgramName)-1);
- GetDlgItemText(IDC_OPTIONS,Options,sizeof(Options)-1);
- argv[0]=ProgramName;
- p=Options;
- i=1;
- while (*p!=0)
- {
- while (*p==' ') p++;
- pb=p;
- while (*p>' ') p++;
- pe=p;
- if (pe>pb)
- {
- argv[i]=new char[1+pe-pb];
- strncpy(argv[i],pb,pe-pb);
- argv[i][pe-pb]=0;
- i++;
- }
- }
- argv[0]=ProgramName;
- argc=i;
- main_thread=CreateThread(NULL,0,ThreadHead,NULL,0,&thrd_id);
-
-// CDialog::OnOK();
-}
-
-DWORD WINAPI ThreadHead(LPVOID Parm)
-{ int i,rc;
-
-struct {
- char pname[16];
- int (*program)(int,char**);
-} tab[TEST_PROG_N]=
-{
- {"FTVIEW",&ftview},
- {"FTDUMP",&ftdump},
- {"FTLINT",&ftlint},
- {"FTSTRING",&ftstring}
-// {"FTSTRPNM",&ftstrpnm},
-// {"FTZOOM",&ftzoom}
-};
-//disable Ok button
- rc=button_OK->EnableWindow(FALSE);
- rc=button_Cancel->EnableWindow(FALSE);
-
- for (i=0;(i< TEST_PROG_N) &&strcmp(tab[i].pname,ProgramName);i++);
- if (i>= TEST_PROG_N)
- {
- MessageBox(NULL,"Please select a valid Test Program Name","FreeType Test ",MB_ICONQUESTION);
- }
- else
- call_test_program(tab[i].program,argc,(char **)&argv);
- //enable buttons again
- rc=button_OK->EnableWindow(TRUE);
- rc=button_Cancel->EnableWindow(TRUE);
- rc=fflush(stdout);
- rc=fflush(stderr);
- ExitThread(1);
- return 1;
-}
-
-
-
-void translate_command(char nChar)
-{ int rc,i;
- // TODO: Add your message handler code here and/or call default
- typedef struct _Translator
- {
- char key;
- GEvent event_class;
- int event_info;
- } Translator;
-
-#define NUM_Translators 20
-
- static const Translator trans[ NUM_Translators] =
- {
- { 'q', event_Quit, 0 },
- { (char)27, event_Quit, 0 },
-
- { 'x', event_Rotate_Glyph, -1 },
- { 'c', event_Rotate_Glyph, 1 },
- { 'v', event_Rotate_Glyph, -16 },
- { 'b', event_Rotate_Glyph, 16 },
-
- { '{', event_Change_Glyph, -10000 },
- { '}', event_Change_Glyph, 10000 },
- { '(', event_Change_Glyph, -1000 },
- { ')', event_Change_Glyph, 1000 },
- { '9', event_Change_Glyph, -100 },
- { '0', event_Change_Glyph, 100 },
- { 'i', event_Change_Glyph, -10 },
- { 'o', event_Change_Glyph, 10 },
- { 'k', event_Change_Glyph, -1 },
- { 'l', event_Change_Glyph, 1 },
-
- { '+', event_Scale_Glyph, 10 },
- { '-', event_Scale_Glyph, -10 },
- { 'u', event_Scale_Glyph, 1 },
- { 'j', event_Scale_Glyph, -1 }
- };
- for ( i = 0; i < NUM_Translators; i++ )
- {
- if ( nChar == trans[i].key )
- {
- evevent.what = trans[i].event_class;
- evevent.info = trans[i].event_info;
- break;
- }
- }
- if (i>= NUM_Translators)
- {
- evevent.what=event_Keyboard;
- evevent.what=nChar;
- }
- rc=SetEvent(evgetevent);
-}
-
-void CTestw32Dlg::OnSelectAction()
-{
- char c[2];
- GetDlgItemText(IDC_ACTION,c,2);
- translate_command(c[0]);
-}
-
-
-DWORD WINAPI ThreadSpool(LPVOID Parm)
-{
- while(1)
- {
- if (pipe_std[0]) readpipe(pipe_std[0]); // will never get out of there !!!!
-// if (pipe_err[0]) readpipe(pipe_err[0]);
- Sleep(1000);
- }
- return 1;
-}
-
-void readpipe(int h)
- { int i,j,rc;
-
- char buffer[1024],line[1024];
- rc=1;
- while(rc)
- {
- rc=read(h,buffer,sizeof(buffer));
- if (rc)
- { j=0;
- for(i=0;i<rc;i++)
- {
- if (buffer[i]=='\n')
- { line[j]=0;
- ::SendMessage((HWND)listbox,LB_ADDSTRING,0,(LPARAM)line);
- j=0;
- }
- else
- line[j++]=buffer[i];
- }
- line[j]=0; //flush the buffer
- ::SendMessage((HWND)listbox,LB_ADDSTRING,0,(LPARAM)line);
- }
- }
-
-}
-
-
-void CTestw32Dlg::OnDestroy()
-{ int rc;
- CDialog::OnDestroy();
- if (spool_thread!=0)
- {
- rc=TerminateThread(spool_thread,2);
- spool_thread=0;
- }
- dup2(old_std,_fileno(stdout));
- dup2(old_err,_fileno(stderr));
-}
diff --git a/xc/extras/FreeType/test/arch/win32/testw32Dlg.h b/xc/extras/FreeType/test/arch/win32/testw32Dlg.h
deleted file mode 100644
index 238800360..000000000
--- a/xc/extras/FreeType/test/arch/win32/testw32Dlg.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// testw32Dlg.h : header file
-//
-
-#if !defined(AFX_TESTW32DLG_H__70F52CAB_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
-#define AFX_TESTW32DLG_H__70F52CAB_06A4_11D2_9AC4_0060978849F3__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-/////////////////////////////////////////////////////////////////////////////
-// CTestw32Dlg dialog
-
-class CTestw32Dlg : public CDialog
-{
-// Construction
-public:
- CTestw32Dlg(CWnd* pParent = NULL); // standard constructor
-
-// Dialog Data
- //{{AFX_DATA(CTestw32Dlg)
- enum { IDD = IDD_TESTW32_DIALOG };
- // NOTE: the ClassWizard will add data members here
- //}}AFX_DATA
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTestw32Dlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
- HICON m_hIcon;
-
- // Generated message map functions
- //{{AFX_MSG(CTestw32Dlg)
- virtual BOOL OnInitDialog();
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- virtual void OnOK();
- afx_msg void OnSelectAction();
- afx_msg void OnDestroy();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_TESTW32DLG_H__70F52CAB_06A4_11D2_9AC4_0060978849F3__INCLUDED_)
diff --git a/xc/extras/FreeType/test/common.c b/xc/extras/FreeType/test/common.c
index d26451522..c91f00763 100644
--- a/xc/extras/FreeType/test/common.c
+++ b/xc/extras/FreeType/test/common.c
@@ -1,3 +1,15 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-1999 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* common.c: Various utility functions. */
+/* */
+/****************************************************************************/
+
+
/*
* This is a cheap replacement for getopt() because that routine is not
* available on some platforms and behaves differently on other platforms.
@@ -11,19 +23,20 @@
#ifndef lint
#ifdef __GNUC__
- static char rcsid[] __attribute__ ((unused)) = "$Id: common.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+ static char rcsid[] __attribute__ ((unused)) = "$Id: common.c,v 1.3 2000/02/22 22:10:27 kem Exp $";
#else
- static char rcsid[] = "$Id: common.c,v 1.2 1999/12/05 23:10:26 daryll Exp $";
+ static char rcsid[] = "$Id: common.c,v 1.3 2000/02/22 22:10:27 kem Exp $";
#endif
#endif
-#include "common.h"
-
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "common.h"
+#include "freetype.h" /* TT_Raster_Map */
+
/*
* Externals visible to programs.
*/
@@ -46,6 +59,7 @@
static char** cmdav;
#endif
+
int
#ifdef __STDC__
ft_getopt( int ac, char* const* av, const char* pat )
@@ -65,6 +79,7 @@
char* pp;
#endif
+
/*
* If there is no pattern, indicate the parsing is done.
*/
@@ -95,6 +110,7 @@
if ( *p == '/' || *p == '\\' )
cmdname = p;
}
+
/*
* Skip the path separator if the name was assigned.
*/
@@ -175,11 +191,6 @@
/****************************************************************************/
/* */
-/* The FreeType project -- a free and portable quality TrueType renderer. */
-/* */
-/* Copyright 1996-1998 by */
-/* D. Turner, R.Wilhelm, and W. Lemberg */
-/* */
/* ft_basename(): */
/* */
/* a stupid but useful function... */
@@ -190,10 +201,10 @@
char*
#ifdef __STDC__
- ft_basename ( const char* name )
+ ft_basename( const char* name )
#else
- ft_basename ( name )
- char* name;
+ ft_basename( name )
+ char* name;
#endif
{
#ifdef __STDC__
@@ -224,11 +235,12 @@
}
+ void
#ifdef __STDC__
- void Panic( const char* fmt, ... )
+ Panic( const char* fmt, ... )
#else
- void Panic( fmt )
- const char* fmt;
+ Panic( fmt )
+ const char* fmt;
#endif
{
va_list ap;
@@ -242,4 +254,57 @@
}
+ void
+#ifdef __STDC__
+ Show_Single_Glyph( const TT_Raster_Map* map )
+#else
+ Show_Single_Glyph( map )
+ const TT_Raster_Map* map;
+#endif
+ {
+ int y;
+
+ unsigned char* line = map->bitmap;
+
+
+ for ( y = 0; y < map->rows; y++, line += map->cols )
+ {
+ unsigned char* ptr = line;
+ int x;
+ unsigned char mask = 0x80;
+
+
+ for ( x = 0; x < map->width; x++ )
+ {
+ printf( "%c", (ptr[0] & mask) ? '*' : '.' );
+ mask >>= 1;
+ if ( mask == 0 )
+ {
+ mask = 0x80;
+ ptr++;
+ }
+ }
+ printf( "\n" );
+ }
+ }
+
+
+ void
+#ifdef __STDC__
+ separator_line( FILE* out, const int length )
+#else
+ separator_line( out, length )
+ FILE* out;
+ int length;
+#endif
+ {
+ int i;
+
+
+ for ( i = 0; i < length; i++ )
+ fputc( '-', out );
+ fprintf( out, "\n\n" );
+ }
+
+
/* End */
diff --git a/xc/extras/Mesa/src/linetemp.h b/xc/extras/Mesa/src/linetemp.h
index db59ea445..9d74f33c5 100644
--- a/xc/extras/Mesa/src/linetemp.h
+++ b/xc/extras/Mesa/src/linetemp.h
@@ -22,7 +22,7 @@
* 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/extras/Mesa/src/linetemp.h,v 1.7 2000/02/18 12:18:44 tsi Exp $ */
/*
* Line Rasterizer Template
@@ -80,14 +80,14 @@
GLint y0 = (GLint) VB->Win.data[vert0][1];
GLint y1 = (GLint) VB->Win.data[vert1][1];
GLint dx, dy;
-#if INTERP_XY
+#ifdef INTERP_XY
GLint xstep, ystep;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
GLint z0, z1, dz, zPtrXstep, zPtrYstep;
GLdepth *zPtr;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
GLfixed r0 = IntToFixed(VB->ColorPtr->data[vert0][0]);
GLfixed dr = IntToFixed(VB->ColorPtr->data[vert1][0]) - r0;
GLfixed g0 = IntToFixed(VB->ColorPtr->data[vert0][1]);
@@ -95,7 +95,7 @@
GLfixed b0 = IntToFixed(VB->ColorPtr->data[vert0][2]);
GLfixed db = IntToFixed(VB->ColorPtr->data[vert1][2]) - b0;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLfixed sr0 = VB->Specular ? IntToFixed(VB->Specular[vert0][0]) : 0;
GLfixed dsr = VB->Specular ? IntToFixed(VB->Specular[vert1][0]) - sr0 : 0;
GLfixed sg0 = VB->Specular ? IntToFixed(VB->Specular[vert0][1]) : 0;
@@ -103,25 +103,25 @@
GLfixed sb0 = VB->Specular ? IntToFixed(VB->Specular[vert0][2]) : 0;
GLfixed dsb = VB->Specular ? IntToFixed(VB->Specular[vert1][2]) - sb0 : 0;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
GLfixed a0 = IntToFixed(VB->ColorPtr->data[vert0][3]);
GLfixed da = IntToFixed(VB->ColorPtr->data[vert1][3]) - a0;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLint i0 = VB->IndexPtr->data[vert0] << 8;
GLint di = (GLint) (VB->IndexPtr->data[vert1] << 8)-i0;
#endif
-#if INTERP_ST
+#ifdef INTERP_ST
GLfixed s0 = FloatToFixed(VB->TexCoord[vert0][0] * S_SCALE);
GLfixed ds = FloatToFixed(VB->TexCoord[vert1][0] * S_SCALE) - s0;
GLfixed t0 = FloatToFixed(VB->TexCoord[vert0][1] * T_SCALE);
GLfixed dt = FloatToFixed(VB->TexCoord[vert1][1] * T_SCALE) - t0;
#endif
-#if INTERP_STUV0 || INTERP_STUV1
+#if defined(INTERP_STUV0) || defined(INTERP_STUV1)
GLfloat invw0 = VB->Win.data[vert0][3];
GLfloat invw1 = VB->Win.data[vert1][3];
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
/* h denotes hyperbolic */
GLfloat hs0 = invw0 * VB->TexCoordPtr[0]->data[vert0][0];
GLfloat dhs = invw1 * VB->TexCoordPtr[0]->data[vert1][0] - hs0;
@@ -130,7 +130,7 @@
GLfloat hu0 = 0, dhu = 0;
GLfloat hv0 = invw0, dhv = invw1 - invw0;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat hs01 = invw0 * VB->TexCoordPtr[1]->data[vert0][0];
GLfloat dhs1 = invw1 * VB->TexCoordPtr[1]->data[vert1][0] - hs01;
GLfloat ht01 = invw0 * VB->TexCoordPtr[1]->data[vert0][1];
@@ -142,14 +142,14 @@
PIXEL_TYPE *pixelPtr;
GLint pixelXstep, pixelYstep;
#endif
-#if WIDE
+#ifdef WIDE
/* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */
GLint width, min, max;
width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
min = (width-1) / -2;
max = min + width - 1;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
if (VB->TexCoordPtr[0]->size > 2) {
hu0 = invw0 * VB->TexCoordPtr[0]->data[vert0][2];
dhu = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - hu0;
@@ -159,7 +159,7 @@
}
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
if (VB->TexCoordPtr[1]->size > 2) {
hu01 = invw0 * VB->TexCoordPtr[1]->data[vert0][2];
dhu1 = invw1 * VB->TexCoordPtr[1]->data[vert1][2] - hu01;
@@ -177,7 +177,7 @@
* This quick and dirty code nudges the endpoints inside the window if
* necessary.
*/
-#if CLIP_HACK
+#ifdef CLIP_HACK
{
GLint w = ctx->DrawBuffer->Width;
GLint h = ctx->DrawBuffer->Height;
@@ -208,7 +208,7 @@
SETUP_CODE
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtr = Z_ADDRESS(ctx,x0,y0);
# if DEPTH_BITS==16
z0 = FloatToFixed(VB->Win.data[vert0][2]);
@@ -224,7 +224,7 @@
if (dx<0) {
dx = -dx; /* make positive */
-#if INTERP_XY
+#ifdef INTERP_XY
xstep = -1;
#endif
#ifdef INTERP_Z
@@ -235,10 +235,10 @@
#endif
}
else {
-#if INTERP_XY
+#ifdef INTERP_XY
xstep = 1;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtrXstep = ((GLint)sizeof(GLdepth));
#endif
#ifdef PIXEL_ADDRESS
@@ -248,10 +248,10 @@
if (dy<0) {
dy = -dy; /* make positive */
-#if INTERP_XY
+#ifdef INTERP_XY
ystep = -1;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtrYstep = -ctx->DrawBuffer->Width * ((GLint)sizeof(GLdepth));
#endif
#ifdef PIXEL_ADDRESS
@@ -259,10 +259,10 @@
#endif
}
else {
-#if INTERP_XY
+#ifdef INTERP_XY
ystep = 1;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtrYstep = ctx->DrawBuffer->Width * ((GLint)sizeof(GLdepth));
#endif
#ifdef PIXEL_ADDRESS
@@ -280,30 +280,30 @@
GLint errorInc = dy+dy;
GLint error = errorInc-dx;
GLint errorDec = error-dx;
-#if INTERP_Z
+#ifdef INTERP_Z
dz = (z1-z0) / dx;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
dr /= dx; /* convert from whole line delta to per-pixel delta */
dg /= dx;
db /= dx;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
dsr /= dx; /* convert from whole line delta to per-pixel delta */
dsg /= dx;
dsb /= dx;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
da /= dx;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
di /= dx;
#endif
-#if INTERP_ST
+#ifdef INTERP_ST
ds /= dx;
dt /= dx;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
{
GLfloat invDx = 1.0F / (GLfloat) dx;
dhs *= invDx;
@@ -312,7 +312,7 @@
dhv *= invDx;
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
{
GLfloat invDx = 1.0F / (GLfloat) dx;
dhs1 *= invDx;
@@ -322,34 +322,34 @@
}
#endif
for (i=0;i<dx;i++) {
-#if STIPPLE
+#ifdef STIPPLE
GLushort m;
m = 1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf);
if (ctx->Line.StipplePattern & m) {
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
# if DEPTH_BITS==16
GLdepth Z = FixedToInt(z0);
# else
GLdepth Z = z0;
# endif
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLint I = i0 >> 8;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
GLfloat invQ = 1.0F / hv0;
GLfloat s = hs0 * invQ;
GLfloat t = ht0 * invQ;
GLfloat u = hu0 * invQ;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat invQ1 = 1.0F / hv01;
GLfloat s1 = hs01 * invQ1;
GLfloat t1 = ht01 * invQ1;
GLfloat u1 = hu01 * invQ1;
#endif
-#if WIDE
+#ifdef WIDE
GLint yy;
GLint ymin = y0 + min;
GLint ymax = y0 + max;
@@ -363,44 +363,44 @@
PLOT( x0, y0 );
# endif
#endif /*WIDE*/
-#if STIPPLE
+#ifdef STIPPLE
}
ctx->StippleCounter++;
#endif
-#if INTERP_XY
+#ifdef INTERP_XY
x0 += xstep;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrXstep);
z0 += dz;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
r0 += dr;
g0 += dg;
b0 += db;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
sr0 += dsr;
sg0 += dsg;
sb0 += dsb;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
a0 += da;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
i0 += di;
#endif
-#if INTERP_ST
+#ifdef INTERP_ST
s0 += ds;
t0 += dt;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
hs0 += dhs;
ht0 += dht;
hu0 += dhu;
hv0 += dhv;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
hs01 += dhs1;
ht01 += dht1;
hu01 += dhu1;
@@ -414,10 +414,10 @@
}
else {
error += errorDec;
-#if INTERP_XY
+#ifdef INTERP_XY
y0 += ystep;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrYstep);
#endif
#ifdef PIXEL_ADDRESS
@@ -432,30 +432,30 @@
GLint errorInc = dx+dx;
GLint error = errorInc-dy;
GLint errorDec = error-dy;
-#if INTERP_Z
+#ifdef INTERP_Z
dz = (z1-z0) / dy;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
dr /= dy; /* convert from whole line delta to per-pixel delta */
dg /= dy;
db /= dy;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
dsr /= dy; /* convert from whole line delta to per-pixel delta */
dsg /= dy;
dsb /= dy;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
da /= dy;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
di /= dy;
#endif
-#if INTERP_ST
+#ifdef INTERP_ST
ds /= dy;
dt /= dy;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
{
GLfloat invDy = 1.0F / (GLfloat) dy;
dhs *= invDy;
@@ -464,7 +464,7 @@
dhv *= invDy;
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
{
GLfloat invDy = 1.0F / (GLfloat) dy;
dhs1 *= invDy;
@@ -474,34 +474,34 @@
}
#endif
for (i=0;i<dy;i++) {
-#if STIPPLE
+#ifdef STIPPLE
GLushort m;
m = 1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf);
if (ctx->Line.StipplePattern & m) {
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
# if DEPTH_BITS==16
GLdepth Z = FixedToInt(z0);
# else
GLdepth Z = z0;
# endif
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLint I = i0 >> 8;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
GLfloat invQ = 1.0F / hv0;
GLfloat s = hs0 * invQ;
GLfloat t = ht0 * invQ;
GLfloat u = hu0 * invQ;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat invQ1 = 1.0F / hv01;
GLfloat s1 = hs01 * invQ1;
GLfloat t1 = ht01 * invQ1;
GLfloat u1 = hu01 * invQ1;
#endif
-#if WIDE
+#ifdef WIDE
GLint xx;
GLint xmin = x0 + min;
GLint xmax = x0 + max;
@@ -515,44 +515,44 @@
PLOT( x0, y0 );
# endif
#endif /*WIDE*/
-#if STIPPLE
+#ifdef STIPPLE
}
ctx->StippleCounter++;
#endif
-#if INTERP_XY
+#ifdef INTERP_XY
y0 += ystep;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrYstep);
z0 += dz;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
r0 += dr;
g0 += dg;
b0 += db;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
sr0 += dsr;
sg0 += dsg;
sb0 += dsb;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
a0 += da;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
i0 += di;
#endif
-#if INTERP_ST
+#ifdef INTERP_ST
s0 += ds;
t0 += dt;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
hs0 += dhs;
ht0 += dht;
hu0 += dhu;
hv0 += dhv;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
hs01 += dhs1;
ht01 += dht1;
hu01 += dhu1;
@@ -566,10 +566,10 @@
}
else {
error += errorDec;
-#if INTERP_XY
+#ifdef INTERP_XY
x0 += xstep;
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrXstep);
#endif
#ifdef PIXEL_ADDRESS
diff --git a/xc/extras/Mesa/src/lnaatemp.h b/xc/extras/Mesa/src/lnaatemp.h
index 02b26bd48..43923e851 100644
--- a/xc/extras/Mesa/src/lnaatemp.h
+++ b/xc/extras/Mesa/src/lnaatemp.h
@@ -22,7 +22,7 @@
* 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/extras/Mesa/src/lnaatemp.h,v 1.7 2000/02/18 12:18:45 tsi Exp $ */
/*
* Antialiased Line Rasterizer Template
@@ -61,22 +61,22 @@
GLint dy = y1 - y0;
GLint xStep, yStep;
GLint z0, z1;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
GLfixed fr, fg, fb, fa; /* fixed-pt RGBA */
GLfixed dfr, dfg, dfb, dfa; /* fixed-pt RGBA deltas */
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLfixed fsr, fsg, fsb; /* fixed-pt specular RGBA */
GLfixed dfsr, dfsg, dfsb; /* fixed-pt specular RGBA deltas */
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLfixed fi, dfi;
#endif
-#if INTERP_STUV0 || INTERP_STUV1
+#if defined(INTERP_STUV0) || defined(INTERP_STUV1)
GLfloat invw0 = VB->Win.data[vert0][3];
GLfloat invw1 = VB->Win.data[vert1][3];
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
/* h denotes hyperbolic */
GLfloat hs0 = invw0 * VB->TexCoordPtr[0]->data[vert0][0];
GLfloat dhs = invw1 * VB->TexCoordPtr[0]->data[vert1][0] - hs0;
@@ -85,7 +85,7 @@
GLfloat hu0 = 0, dhu = 0;
GLfloat hv0 = invw0, dhv = invw1 - invw0;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat hs01 = invw0 * VB->TexCoordPtr[1]->data[vert0][0];
GLfloat dhs1 = invw1 * VB->TexCoordPtr[1]->data[vert1][0] - hs01;
GLfloat ht01 = invw0 * VB->TexCoordPtr[1]->data[vert0][1];
@@ -105,7 +105,7 @@
z1 = (int) VB->Win.data[vert1][2];
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
if (VB->TexCoordPtr[0]->size > 2) {
hu0 = invw0 * VB->TexCoordPtr[0]->data[vert0][2];
dhu = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - hu0;
@@ -116,7 +116,7 @@
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
if (VB->TexCoordPtr[1]->size > 2) {
hu01 = invw0 * VB->TexCoordPtr[1]->data[vert0][2];
dhu1 = invw1 * VB->TexCoordPtr[1]->data[vert1][2] - hu01;
@@ -127,7 +127,7 @@
}
#endif
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
fr = IntToFixed(VB->ColorPtr->data[vert0][0]);
fg = IntToFixed(VB->ColorPtr->data[vert0][1]);
@@ -142,7 +142,7 @@
dfr = dfg = dfb = dfa = 0;
}
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
fsr = IntToFixed(VB->Specular[vert0][0]);
fsg = IntToFixed(VB->Specular[vert0][1]);
@@ -155,7 +155,7 @@
dfsr = dfsg = dfsb = 0;
}
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
if (ctx->Light.ShadeModel == GL_SMOOTH) {
fi = IntToFixed(VB->IndexPtr->data[vert0]);
}
@@ -197,7 +197,7 @@
GLint dz = (z1 - z0) / dx;
GLfloat invDx = 1.0F / dx;
(void) invDx;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDx;
dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDx;
@@ -205,20 +205,20 @@
dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDx;
}
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDx;
dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDx;
dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDx;
}
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
dhs *= invDx;
dht *= invDx;
dhu *= invDx;
dhv *= invDx;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
dhs1 *= invDx;
dht1 *= invDx;
dhu1 *= invDx;
@@ -232,19 +232,19 @@
GLint yTopi = (GLint) yTop;
GLint yBoti = (GLint) yBot;
GLint iy;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
GLubyte red = FixedToInt(fr);
GLubyte green = FixedToInt(fg);
GLubyte blue = FixedToInt(fb);
GLubyte alpha = FixedToInt(fa);
GLint coverage;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLubyte specRed = FixedToInt(fsr);
GLubyte specGreen = FixedToInt(fsg);
GLubyte specBlue = FixedToInt(fsb);
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLuint index = FixedToInt(fi) & 0xfffffff0;
GLuint coverage;
#endif
@@ -256,13 +256,13 @@
ASSERT(yBoti <= yTopi);
{
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
GLfloat invQ = 1.0F / hv0;
GLfloat s = hs0 * invQ;
GLfloat t = ht0 * invQ;
GLfloat u = hu0 * invQ;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat invQ1 = 1.0F / hv01;
GLfloat s1 = hs01 * invQ1;
GLfloat t1 = ht01 * invQ1;
@@ -270,30 +270,30 @@
#endif
/* bottom pixel of swipe */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = (GLint) (alpha * (1.0F - (yBot - yBoti)));
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = (GLuint) (15.0F * (1.0F - (yBot - yBoti)));
#endif
PLOT(x, yBoti);
yBoti++;
/* top pixel of swipe */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = (GLint) (alpha * (yTop - yTopi));
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = (GLuint) (15.0F * (yTop - yTopi));
#endif
PLOT(x, yTopi);
yTopi--;
/* pixels between top and bottom with 100% coverage */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = alpha;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = 15;
#endif
for (iy = yBoti; iy <= yTopi; iy++) {
@@ -307,30 +307,30 @@
x += xStep;
y += yStep;
z0 += dz;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
fr += dfr;
fg += dfg;
fb += dfb;
fa += dfa;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fsr += dfsr;
fsg += dfsg;
fsb += dfsb;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
hs0 += dhs;
ht0 += dht;
hu0 += dhu;
hv0 += dhv;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
hs01 += dhs1;
ht01 += dht1;
hu01 += dhu1;
hv01 += dhv1;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fi += dfi;
#endif
@@ -347,7 +347,7 @@
GLint dz = (z1 - z0) / dy;
GLfloat invDy = 1.0F / dy;
(void) invDy;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDy;
dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDy;
@@ -355,26 +355,26 @@
dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDy;
}
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDy;
dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDy;
dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDy;
}
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
dhs *= invDy;
dht *= invDy;
dhu *= invDy;
dhv *= invDy;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
dhs1 *= invDy;
dht1 *= invDy;
dhu1 *= invDy;
dhv1 *= invDy;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
if (ctx->Light.ShadeModel == GL_SMOOTH) {
dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) / dy;
}
@@ -386,19 +386,19 @@
GLint xRighti = (GLint) xRight;
GLint xLefti = (GLint) xLeft;
GLint ix;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
GLubyte red = FixedToInt(fr);
GLubyte green = FixedToInt(fg);
GLubyte blue = FixedToInt(fb);
GLubyte alpha = FixedToInt(fa);
GLint coverage;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLubyte specRed = FixedToInt(fsr);
GLubyte specGreen = FixedToInt(fsg);
GLubyte specBlue = FixedToInt(fsb);
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLuint index = FixedToInt(fi) & 0xfffffff0;
GLuint coverage;
#endif
@@ -411,13 +411,13 @@
ASSERT(xLefti < xRight);
{
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
GLfloat invQ = 1.0F / hv0;
GLfloat s = hs0 * invQ;
GLfloat t = ht0 * invQ;
GLfloat u = hu0 * invQ;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat invQ1 = 1.0F / hv01;
GLfloat s1 = hs01 * invQ1;
GLfloat t1 = ht01 * invQ1;
@@ -425,30 +425,30 @@
#endif
/* left pixel of swipe */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = (GLint) (alpha * (1.0F - (xLeft - xLefti)));
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = (GLuint) (15.0F * (1.0F - (xLeft - xLefti)));
#endif
PLOT(xLefti, y);
xLefti++;
/* right pixel of swipe */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = (GLint) (alpha * (xRight - xRighti));
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = (GLuint) (15.0F * (xRight - xRighti));
#endif
PLOT(xRighti, y)
xRighti--;
/* pixels between top and bottom with 100% coverage */
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
coverage = alpha;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
coverage = 15;
#endif
for (ix = xLefti; ix <= xRighti; ix++) {
@@ -461,30 +461,30 @@
x += xStep;
y += yStep;
z0 += dz;
-#if INTERP_RGBA
+#ifdef INTERP_RGBA
fr += dfr;
fg += dfg;
fb += dfb;
fa += dfa;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fsr += dfsr;
fsg += dfsg;
fsb += dfsb;
#endif
-#if INTERP_STUV0
+#ifdef INTERP_STUV0
hs0 += dhs;
ht0 += dht;
hu0 += dhu;
hv0 += dhv;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
hs01 += dhs1;
ht01 += dht1;
hu01 += dhu1;
hv01 += dhv1;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fi += dfi;
#endif
if (!solid)
diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h
index 2a0d3344d..ed2b8324f 100644
--- a/xc/extras/Mesa/src/tritemp.h
+++ b/xc/extras/Mesa/src/tritemp.h
@@ -22,7 +22,7 @@
* 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/extras/Mesa/src/tritemp.h,v 1.7 2000/02/18 12:18:46 tsi Exp $ */
/*
* Triangle Rasterizer Template
@@ -221,36 +221,36 @@
{
GLint ltor; /* true if scanning left-to-right */
-#if INTERP_Z
+#ifdef INTERP_Z
GLfloat dzdx, dzdy; GLfixed fdzdx;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
GLfloat drdx, drdy; GLfixed fdrdx;
GLfloat dgdx, dgdy; GLfixed fdgdx;
GLfloat dbdx, dbdy; GLfixed fdbdx;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLfloat dsrdx, dsrdy; GLfixed fdsrdx;
GLfloat dsgdx, dsgdy; GLfixed fdsgdx;
GLfloat dsbdx, dsbdy; GLfixed fdsbdx;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
GLfloat dadx, dady; GLfixed fdadx;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLfloat didx, didy; GLfixed fdidx;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
GLfloat dsdx, dsdy; GLfixed fdsdx;
GLfloat dtdx, dtdy; GLfixed fdtdx;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
GLfloat dsdx, dsdy;
GLfloat dtdx, dtdy;
GLfloat dudx, dudy;
GLfloat dvdx, dvdy;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat ds1dx, ds1dy;
GLfloat dt1dx, dt1dy;
GLfloat du1dx, du1dy;
@@ -267,7 +267,7 @@
ltor = (oneOverArea < 0.0F);
/* compute d?/dx and d?/dy derivatives */
-#if INTERP_Z
+#ifdef INTERP_Z
{
GLfloat eMaj_dz, eBot_dz;
eMaj_dz = VB->Win.data[vMax][2] - VB->Win.data[vMin][2];
@@ -288,7 +288,7 @@
#endif
}
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
{
GLfloat eMaj_dr, eBot_dr;
eMaj_dr = (GLint) VB->ColorPtr->data[vMax][0] - (GLint) VB->ColorPtr->data[vMin][0];
@@ -314,7 +314,7 @@
dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
}
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
{
GLfloat eMaj_dsr, eBot_dsr;
eMaj_dsr = (GLint) VB->Specular[vMax][0] - (GLint) VB->Specular[vMin][0];
@@ -340,7 +340,7 @@
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
}
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
{
GLfloat eMaj_da, eBot_da;
eMaj_da = (GLint) VB->ColorPtr->data[vMax][3] - (GLint) VB->ColorPtr->data[vMin][3];
@@ -350,7 +350,7 @@
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
}
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
{
GLfloat eMaj_di, eBot_di;
eMaj_di = (GLint) VB->IndexPtr->data[vMax] - (GLint) VB->IndexPtr->data[vMin];
@@ -360,7 +360,7 @@
didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
}
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
{
GLfloat eMaj_ds, eBot_ds;
eMaj_ds = (VB->TexCoordPtr[0]->data[vMax][0] - VB->TexCoordPtr[0]->data[vMin][0]) * S_SCALE;
@@ -384,7 +384,7 @@
}
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
{
GLfloat wMax = VB->Win.data[vMax][3];
GLfloat wMin = VB->Win.data[vMin][3];
@@ -436,7 +436,7 @@
}
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
{
GLfloat wMax = VB->Win.data[vMax][3];
GLfloat wMin = VB->Win.data[vMin][3];
@@ -554,38 +554,38 @@
PIXEL_TYPE *pRow;
int dPRowOuter, dPRowInner; /* offset in bytes */
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
GLdepth *zRow;
int dZRowOuter, dZRowInner; /* offset in bytes */
GLfixed fz, fdzOuter, fdzInner;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
GLfixed fr, fdrOuter, fdrInner;
GLfixed fg, fdgOuter, fdgInner;
GLfixed fb, fdbOuter, fdbInner;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLfixed fsr, fdsrOuter, fdsrInner;
GLfixed fsg, fdsgOuter, fdsgInner;
GLfixed fsb, fdsbOuter, fdsbInner;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
GLfixed fa, fdaOuter, fdaInner;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLfixed fi, fdiOuter, fdiInner;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
GLfixed fs, fdsOuter, fdsInner;
GLfixed ft, fdtOuter, fdtInner;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
GLfloat sLeft, dsOuter, dsInner;
GLfloat tLeft, dtOuter, dtInner;
GLfloat uLeft, duOuter, duInner;
GLfloat vLeft, dvOuter, dvInner;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat s1Left, ds1Outer, ds1Inner;
GLfloat t1Left, dt1Outer, dt1Inner;
GLfloat u1Left, du1Outer, du1Inner;
@@ -674,7 +674,7 @@
* pixel that's actually inside the triangle.
*/
-#if INTERP_Z
+#ifdef INTERP_Z
{
GLfloat z0, tmp;
z0 = VB->Win.data[vLower][2] + ctx->PolygonZoffset;
@@ -696,7 +696,7 @@
dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(GLdepth);
}
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
fr = (GLfixed)(IntToFixed(VB->ColorPtr->data[vLower][0]) + drdx * adjx + drdy * adjy)
+ FIXED_HALF;
fdrOuter = SignedFloatToFixed(drdy + dxOuter * drdx);
@@ -709,7 +709,7 @@
+ FIXED_HALF;
fdbOuter = SignedFloatToFixed(dbdy + dxOuter * dbdx);
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fsr = (GLfixed)(IntToFixed(VB->Specular[vLower][0]) + dsrdx * adjx + dsrdy * adjy)
+ FIXED_HALF;
fdsrOuter = SignedFloatToFixed(dsrdy + dxOuter * dsrdx);
@@ -722,17 +722,17 @@
+ FIXED_HALF;
fdsbOuter = SignedFloatToFixed(dsbdy + dxOuter * dsbdx);
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
fa = (GLfixed)(IntToFixed(VB->ColorPtr->data[vLower][3]) + dadx * adjx + dady * adjy)
+ FIXED_HALF;
fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fi = (GLfixed)(VB->IndexPtr->data[vLower] * FIXED_SCALE + didx * adjx
+ didy * adjy) + FIXED_HALF;
fdiOuter = SignedFloatToFixed(didy + dxOuter * didx);
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
{
GLfloat s0, t0;
s0 = VB->TexCoordPtr[0]->data[vLower][0] * S_SCALE;
@@ -753,7 +753,7 @@
}
}
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
{
GLfloat invW = VB->Win.data[vLower][3];
GLfloat s0, t0, u0, v0;
@@ -786,7 +786,7 @@
dvOuter = dvdy + dxOuter * dvdx;
}
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
{
GLfloat invW = VB->Win.data[vLower][3];
GLfloat s0, t0, u0, v0;
@@ -837,37 +837,37 @@
#ifdef PIXEL_ADDRESS
dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE);
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
dZRowInner = dZRowOuter + sizeof(GLdepth);
fdzInner = fdzOuter + fdzdx;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
fdrInner = fdrOuter + fdrdx;
fdgInner = fdgOuter + fdgdx;
fdbInner = fdbOuter + fdbdx;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fdsrInner = fdsrOuter + fdsrdx;
fdsgInner = fdsgOuter + fdsgdx;
fdsbInner = fdsbOuter + fdsbdx;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
fdaInner = fdaOuter + fdadx;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fdiInner = fdiOuter + fdidx;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
fdsInner = fdsOuter + fdsdx;
fdtInner = fdtOuter + fdtdx;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
dsInner = dsOuter + dsdx;
dtInner = dtOuter + dtdx;
duInner = duOuter + dudx;
dvInner = dvOuter + dvdx;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
ds1Inner = ds1Outer + ds1dx;
dt1Inner = dt1Outer + dt1dx;
du1Inner = du1Outer + du1dx;
@@ -877,35 +877,35 @@
while (lines>0) {
/* initialize the span interpolants to the leftmost value */
/* ff = fixed-pt fragment */
-#if INTERP_Z
+#ifdef INTERP_Z
GLfixed ffz = fz;
/*GLdepth *zp = zRow;*/
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
GLfixed ffr = fr, ffg = fg, ffb = fb;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
GLfixed ffsr = fsr, ffsg = fsg, ffsb = fsb;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
GLfixed ffa = fa;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
GLfixed ffi = fi;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
GLfixed ffs = fs, fft = ft;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
GLfloat ss = sLeft, tt = tLeft, uu = uLeft, vv = vLeft;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
GLfloat ss1 = s1Left, tt1 = t1Left, uu1 = u1Left, vv1 = v1Left;
#endif
GLint left = FixedToInt(fxLeftEdge);
GLint right = FixedToInt(fxRightEdge);
-#if INTERP_RGB
+#ifdef INTERP_RGB
{
/* need this to accomodate round-off errors */
GLfixed ffrend = ffr+(right-left-1)*fdrdx;
@@ -919,7 +919,7 @@
if (ffb<0) ffb = 0;
}
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
{
/* need this to accomodate round-off errors */
GLfixed ffsrend = ffsr+(right-left-1)*fdsrdx;
@@ -933,14 +933,14 @@
if (ffsb<0) ffsb = 0;
}
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
{
GLfixed ffaend = ffa+(right-left-1)*fdadx;
if (ffaend<0) ffa -= ffaend;
if (ffa<0) ffa = 0;
}
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
if (ffi<0) ffi = 0;
#endif
@@ -965,32 +965,32 @@
#ifdef PIXEL_ADDRESS
pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowOuter);
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zRow = (GLdepth*) ((GLubyte*)zRow + dZRowOuter);
fz += fdzOuter;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
fr += fdrOuter; fg += fdgOuter; fb += fdbOuter;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fsr += fdsrOuter; fsg += fdsgOuter; fsb += fdsbOuter;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
fa += fdaOuter;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fi += fdiOuter;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
fs += fdsOuter; ft += fdtOuter;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
sLeft += dsOuter;
tLeft += dtOuter;
uLeft += duOuter;
vLeft += dvOuter;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
s1Left += ds1Outer;
t1Left += dt1Outer;
u1Left += du1Outer;
@@ -1001,32 +1001,32 @@
#ifdef PIXEL_ADDRESS
pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowInner);
#endif
-#if INTERP_Z
+#ifdef INTERP_Z
zRow = (GLdepth*) ((GLubyte*)zRow + dZRowInner);
fz += fdzInner;
#endif
-#if INTERP_RGB
+#ifdef INTERP_RGB
fr += fdrInner; fg += fdgInner; fb += fdbInner;
#endif
-#if INTERP_SPEC
+#ifdef INTERP_SPEC
fsr += fdsrInner; fsg += fdsgInner; fsb += fdsbInner;
#endif
-#if INTERP_ALPHA
+#ifdef INTERP_ALPHA
fa += fdaInner;
#endif
-#if INTERP_INDEX
+#ifdef INTERP_INDEX
fi += fdiInner;
#endif
-#if INTERP_INT_ST
+#ifdef INTERP_INT_ST
fs += fdsInner; ft += fdtInner;
#endif
-#if INTERP_STUV
+#ifdef INTERP_STUV
sLeft += dsInner;
tLeft += dtInner;
uLeft += duInner;
vLeft += dvInner;
#endif
-#if INTERP_STUV1
+#ifdef INTERP_STUV1
s1Left += ds1Inner;
t1Left += dt1Inner;
u1Left += du1Inner;
diff --git a/xc/extras/X-TrueType/xttcache.c b/xc/extras/X-TrueType/xttcache.c
deleted file mode 100644
index 561536abd..000000000
--- a/xc/extras/X-TrueType/xttcache.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */
-/* ===FileName: ===
- Copyright (c) 1997 Jyunji Takagi, All rights reserved.
- Copyright (c) 1998 X-TrueType Server Project, All rights reserved.
-
-===Notice
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- Major Release ID: X-TrueType Server Version 1.2 [Aoi MATSUBARA Release 2]
-
-Notice===
-*/
-
-#include "xttversion.h"
-
-static char const * const releaseID =
- _XTT_RELEASE_NAME;
-
-/*
- * B-Tree
- */
-
-#include "xttcommon.h"
-#include "fontmisc.h"
-#include "xttcache.h"
-
-BTreePtr BTree_Alloc()
-{
- BTreePtr this = (BTreePtr) xalloc(sizeof(BTreeRec));
- if (this != NULL) {
- memset(this, 0x00, sizeof(BTreeRec));
- }
- return this;
-}
-
-int BTree_Search(BTreePtr this, int key, void **value)
-{
- PagePtr ptr;
- int i;
- NodePtr np;
-
- for (ptr = this->root; ptr; ) {
- i = 0;
- np = ptr->node;
- while ((i < ptr->n) && np->key < key) {
- i++;
- np++;
- }
- if ((i < ptr->n) && (np->key == key)) {
- *value = np->value;
- return 1;
- }
- ptr = ptr->branch[i];
- }
- *value = NULL;
- return 0;
-}
-
-static void BTree_InsertItem(BTreePtr this, PagePtr ptr, int index)
-{
- int i;
-
- for (i = ptr->n; i > index; i--) {
- ptr->node[i] = ptr->node[i - 1];
- ptr->branch[i + 1] = ptr->branch[i];
- }
- ptr->node[index] = this->node;
- ptr->branch[index + 1] = this->page;
- ptr->n++;
-}
-
-static void BTree_Split(BTreePtr this, PagePtr ptr, int index)
-{
- PagePtr p;
- int i, m;
-
- p = (PagePtr) xalloc(sizeof(PageRec));
- m = (index <= BTreeHalfSize) ? BTreeHalfSize : BTreeHalfSize + 1;
- for (i = m + 1; i <= BTreeHalfSize * 2; i++) {
- p->node[i - m - 1] = ptr->node[i - 1];
- p->branch[i - m] = ptr->branch[i];
- }
- ptr->n = m;
- p->n = BTreeHalfSize * 2 - m;
- if (index <= BTreeHalfSize) {
- BTree_InsertItem(this, ptr, index);
- } else {
- BTree_InsertItem(this, p, index - m);
- }
- this->node = ptr->node[ptr->n - 1];
- p->branch[0] = ptr->branch[ptr->n];
- ptr->n--;
- this->page = p;
-}
-
-static int BTree_InsertSub(BTreePtr this, PagePtr ptr)
-{
- int i;
- NodePtr np;
-
- if (ptr == NULL) {
- this->page = NULL;
- return 0;
- }
- i = 0;
- np = ptr->node;
- while ((i < ptr->n) && (np->key < this->node.key)) {
- i++;
- np++;
- }
- if ((i < ptr->n) && np->key == this->node.key) {
- /* already registered */
- return 1;
- }
- if (BTree_InsertSub(this, ptr->branch[i])) {
- return 1;
- }
- if (ptr->n < BTreeHalfSize * 2) {
- BTree_InsertItem(this, ptr, i);
- return 1;
- } else {
- BTree_Split(this, ptr, i);
- return 0;
- }
-}
-
-void BTree_Insert(BTreePtr this, int key, void *value)
-{
- PagePtr ptr;
-
- this->node.key = key;
- this->node.value = value;
- if (BTree_InsertSub(this, this->root)) {
- return;
- }
- ptr = (PagePtr) xalloc(sizeof(PageRec));
- ptr->n = 1;
- ptr->branch[0] = this->root;
- ptr->node[0] = this->node;
- ptr->branch[1] = this->page;
- this->root = ptr;
-}
-
-#if 0 /* delete functions are not tested. */
-static void BTree_RemoveItem(BTreePtr this, PagePtr ptr, int index)
-{
- while (++index < ptr->n) {
- ptr->node[index - 1] = ptr->node[index];
- ptr->branch[index] = ptr->branch[index + 1];
- }
- this->under = --(ptr->n) < BTreeHalfSize;
-}
-
-static void BTree_MoveRight(BTreePtr this, PagePtr ptr, int index)
-{
- PagePtr left, right;
- int i;
-
- left = ptr->branch[index - 1];
- right = ptr->branch[index];
- for (i = right->n; i > 0; i--) {
- right->node[i] = right->node[i - 1];
- right->branch[i + 1] = right->branch[i];
- }
- right->branch[1] = right->branch[0];
- right->n++;
- right->node[0] = ptr->node[index - 1];
- ptr->node[index - 1] = left->node[left->n - 1];
- right->branch[0] = left->branch[left->n];
- left->n--;
-}
-
-static void BTree_MoveLeft(BTreePtr this, PagePtr ptr, int index)
-{
- PagePtr left, right;
- int i;
-
- right = ptr->branch[index];
- left = ptr->branch[index - 1];
- left->n++;
- left->node[left->n - 1] = ptr->node[index - 1];
- left->branch[left->n] = right->branch[0];
- ptr->node[index - 1] = right->node[0];
- right->branch[0] = right->branch[1];
- right->n--;
- for (i = 1; i < right ->n; i++) {
- right->node[i - 1] = right->node[i];
- right->branch[i] = right->branch[i + 1];
- }
-}
-
-static void BTree_Combine(BTreePtr this, PagePtr ptr, int index)
-{
- PagePtr left, right;
- int i;
-
- right = ptr->branch[index];
- left = ptr->branch[index - 1];
- left->n++;
- left->node[left->n - 1] = ptr->node[index - 1];
- left->branch[left->n] = right->branch[0];
- for (i = 1; i <= right->n; i++) {
- left->n++;
- left->node[left->n - 1] = right->node[i - 1];
- left->branch[left->n] = right->branch[i];
- }
- BTree_RemoveItem(this, ptr, i - 1);
- xfree(right);
-
-}
-
-static void BTree_Restore(BTreePtr this, PagePtr ptr, int index)
-{
- this->under = 0;
- if (index > 0) {
- if (ptr->branch[index - 1]->n > BTreeHalfSize) {
- BTree_MoveRight(this, ptr, index);
- } else {
- BTree_Combine(this, ptr, index);
- }
- } else {
- if (ptr->branch[1]->n > BTreeHalfSize) {
- BTree_MoveLeft(this, ptr, 1);
- } else {
- BTree_Combine(this, ptr, 1);
- }
- }
-}
-
-static void BTree_DeleteSub(BTreePtr this, PagePtr ptr)
-{
- PagePtr p;
- int i;
- NodePtr np;
-
- if (ptr == NULL) {
- return;
- }
- i = 0;
- np = ptr->node;
- while ((i < ptr->n) && (np->key < this->node.key)) {
- i++;
- np++;
- }
- if ((i < ptr->n) && (np->key == this->node.key)) {
- this->del = 1;
- if ((p = ptr->branch[i + 1]) != NULL) {
- while (p->branch[0] != NULL) {
- p = p->branch[0];
- }
- ptr->node[i] = this->node = p->node[0];
- BTree_DeleteSub(this, ptr->branch[i + 1]);
- if (this->under) {
- BTree_Restore(this, ptr, i + 1);
- }
- } else {
- BTree_RemoveItem(this, ptr, i);
- }
- } else {
- BTree_DeleteSub(this, ptr->branch[i]);
- if (this->under) {
- BTree_Restore(this, ptr, i);
- }
- }
-}
-
-int BTree_Delete(BTreePtr this, int key, void *value)
-{
- PagePtr ptr;
-
- this->node.key = key;
- this->node.value = value;
- this->del = this->under = 0;
- BTree_DeleteSub(this, this->root);
- if (this->del) {
- if (this->root->n == 0) {
- ptr = this->root;
- this->root = this->root->branch[0];
- xfree(ptr);
- }
- /* deleted */
- return 1;
- }
- /* not found */
- return 0;
-}
-#endif /* 0 */
-
-static void BTree_FreeSub(PagePtr ptr)
-{
- int i;
-
- if (ptr != NULL) {
- for (i = 0; i <= ptr->n; i++) {
- BTree_FreeSub(ptr->branch[i]);
- }
- xfree(ptr);
- }
-}
-
-void BTree_Free(BTreePtr this)
-{
- BTree_FreeSub(this->root);
-}
-
-#if 0
-static int count, depth, maxdepth;
-
-static int BTree_PrintSub(PagePtr ptr)
-{
- int i;
-
- if (ptr == NULL) {
- fprintf(stderr, ".");
- return;
- }
- fprintf(stderr, " (");
- depth++;
- maxdepth = depth;
- for (i = 0; i < ptr->n; i++) {
- BTree_PrintSub(ptr->branch[i]);
- fprintf(stderr, "%x", ptr->node[i].key);
- count++;
- }
- BTree_PrintSub(ptr->branch[ptr->n]);
- fprintf(stderr, ") ");
- depth--;
-}
-
-void BTree_Print(BTreePtr this)
-{
- count = depth = maxdepth = 0;
- BTree_PrintSub(this->root);
- fprintf(stderr, "count %d depth %d\n", count, maxdepth);
-}
-#endif /* 0 */
-
-/*
- * End Of File
- */
diff --git a/xc/extras/X-TrueType/xttcache.h b/xc/extras/X-TrueType/xttcache.h
deleted file mode 100644
index 160081a33..000000000
--- a/xc/extras/X-TrueType/xttcache.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */
-/* ===FileName: ===
- Copyright (c) 1997 Jyunji Takagi, All rights reserved.
- Copyright (c) 1998 X-TrueType Server Project, All rights reserved.
-
-===Notice
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- Major Release ID: X-TrueType Server Version 1.2 [Aoi MATSUBARA Release 2]
-
-Notice===
-*/
-
-/*
- * B-Tree
- */
-
-#ifndef _XTTCACHE_H_
-#define _XTTCACHE_H_
-
-#define BTreeHalfSize 4
-
-typedef struct _NodeRec {
- int key;
- void *value;
-} NodeRec, *NodePtr;
-
-typedef struct _PageRec {
- int n;
- NodeRec node[BTreeHalfSize * 2];
- struct _PageRec *branch[BTreeHalfSize * 2 + 1];
-} PageRec, *PagePtr;
-
-typedef struct _BTree {
-/* private */
- NodeRec node;
- PagePtr page;
- int del, under;
-/* public */
- PagePtr root;
-} BTreeRec, *BTreePtr;
-
-extern BTreePtr BTree_Alloc(void);
-extern int BTree_Search(BTreePtr this, int key, void **value);
-extern void BTree_Insert(BTreePtr this, int key, void *value);
-extern void BTree_Free(BTreePtr this);
-extern void BTree_Print(BTreePtr this);
-
-#endif /* _BTREE_H_ */
-
-/*
- * End Of File
- */
diff --git a/xc/include/GL/gl.h b/xc/include/GL/gl.h
index 0efbe646d..4228ae914 100644
--- a/xc/include/GL/gl.h
+++ b/xc/include/GL/gl.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-/* $XFree86: xc/include/GL/gl.h,v 1.2 1999/06/14 07:23:27 dawes Exp $ */
+/* $XFree86: xc/include/GL/gl.h,v 1.6 2000/02/15 07:13:21 martin Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h
index 78d34212a..54c4abf4c 100644
--- a/xc/include/GL/glx.h
+++ b/xc/include/GL/glx.h
@@ -1,7 +1,7 @@
#ifndef __GLX_glx_h__
#define __GLX_glx_h__
-/* $XFree86: xc/include/GL/glx.h,v 1.2 1999/06/14 07:23:28 dawes Exp $ */
+/* $XFree86: xc/include/GL/glx.h,v 1.4 2000/02/15 07:13:24 martin Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/include/GL/glxtokens.h b/xc/include/GL/glxtokens.h
index 5361b0937..5a3e219c3 100644
--- a/xc/include/GL/glxtokens.h
+++ b/xc/include/GL/glxtokens.h
@@ -1,7 +1,7 @@
#ifndef __GLX_glxtokens_h__
#define __GLX_glxtokens_h__
-/* $XFree86: xc/include/GL/glxtokens.h,v 1.2 1999/06/14 07:23:29 dawes Exp $ */
+/* $XFree86: xc/include/GL/glxtokens.h,v 1.3 2000/02/15 07:13:24 martin Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/include/extensions/xf86rush.h b/xc/include/extensions/xf86rush.h
index a4fc5eb71..346069086 100644
--- a/xc/include/extensions/xf86rush.h
+++ b/xc/include/extensions/xf86rush.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/include/extensions/xf86rush.h,v 1.2 1999/09/27 06:29:07 dawes Exp $ */
+/* $XFree86: xc/include/extensions/xf86rush.h,v 1.3 2000/02/11 22:35:44 dawes Exp $ */
/*
Copyright (c) 1998 Daryll Strauss
@@ -8,14 +8,18 @@ Copyright (c) 1998 Daryll Strauss
#ifndef _XF86RUSH_H_
#define _XF86RUSH_H_
+#include <X11/extensions/Xv.h>
#include <X11/Xfuncproto.h>
#define X_XF86RushQueryVersion 0
#define X_XF86RushLockPixmap 1
#define X_XF86RushUnlockPixmap 2
#define X_XF86RushUnlockAllPixmaps 3
-#define X_XF86RushSetCopyMode 4
-#define X_XF86RushSetPixelStride 5
+#define X_XF86RushGetCopyMode 4
+#define X_XF86RushSetCopyMode 5
+#define X_XF86RushGetPixelStride 6
+#define X_XF86RushSetPixelStride 7
+#define X_XF86RushOverlayPixmap 8
#define XF86RushNumberEvents 0
@@ -81,6 +85,25 @@ Bool XF86RushSetPixelStride(
#endif
);
+Bool XF86RushOverlayPixmap(
+#if NeedFunctionPrototypes
+ Display * /* dpy */,
+ XvPortID /* port */,
+ Drawable /* d */,
+ GC /* gc */,
+ Pixmap /* pixmap */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* src_w */,
+ unsigned int /* src_h */,
+ int /* dest_x */,
+ int /* dest_y */,
+ unsigned int /* dest_w */,
+ unsigned int /* dest_h */,
+ unsigned int /* id */
+#endif
+);
+
_XFUNCPROTOEND
#endif /* _XF86RUSH_SERVER_ */
diff --git a/xc/include/extensions/xf86rushstr.h b/xc/include/extensions/xf86rushstr.h
index dbf17b4ba..f38233d9d 100644
--- a/xc/include/extensions/xf86rushstr.h
+++ b/xc/include/extensions/xf86rushstr.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/include/extensions/xf86rushstr.h,v 1.2 1999/09/27 06:29:07 dawes Exp $ */
+/* $XFree86: xc/include/extensions/xf86rushstr.h,v 1.3 2000/02/11 22:35:44 dawes Exp $ */
/*
Copyright (c) 1998 Daryll Strauss
@@ -13,7 +13,7 @@ Copyright (c) 1998 Daryll Strauss
#define XF86RUSHNAME "XFree86-Rush"
#define XF86RUSH_MAJOR_VERSION 1 /* current version numbers */
-#define XF86RUSH_MINOR_VERSION 0
+#define XF86RUSH_MINOR_VERSION 1
typedef struct _XF86RushQueryVersion {
CARD8 reqType; /* always RushReqCode */
@@ -99,4 +99,24 @@ typedef struct _XF86RushSetPixelStride {
} xXF86RushSetPixelStrideReq;
#define sz_xXF86RushSetPixelStrideReq 12
+typedef struct {
+ CARD8 reqType; /* always RushReqCode */
+ CARD8 rushReqType; /* always X_RushOverlayPixmap */
+ CARD16 length B16;
+ XvPortID port B32;
+ Drawable drawable B32;
+ GContext gc B32;
+ Pixmap pixmap B32;
+ CARD32 id B32;
+ INT16 src_x B16;
+ INT16 src_y B16;
+ CARD16 src_w B16;
+ CARD16 src_h B16;
+ INT16 drw_x B16;
+ INT16 drw_y B16;
+ CARD16 drw_w B16;
+ CARD16 drw_h B16;
+} xXF86RushOverlayPixmapReq;
+#define sz_xXF86RushOverlayPixmapReq 40
+
#endif /* _XF86RUSHSTR_H_ */
diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile
index 21e0e559a..6de10bb32 100644
--- a/xc/lib/GL/Imakefile
+++ b/xc/lib/GL/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.10 1999/12/14 01:32:21 robin Exp $
+XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.15 2000/02/16 17:26:30 dawes Exp $
#include <Threads.tmpl>
@@ -106,7 +106,7 @@ DRIMESADONES = mesa/dri/DONE
DONES = $(GLXDONES) $(DRIDONES) $(DRVDONES)
#if LocalThreads
- OBJS += $(THREADS_LIBS)
+ THREADOBJS = $(THREADS_LIBS)
#endif
#include <Library.tmpl>
@@ -119,7 +119,7 @@ NormalDepLibraryTarget($(LIBNAME),$(SUBDIRS) $(DONES),$(UOBJS))
InstallLibrary($(LIBNAME),$(USRLIBDIR))
#endif
#if SharedLibGlx
-SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(OBJS),.,.)
+SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(OBJS) $(THREADOBJS),.,.)
InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR))
#endif
#if DebugLibGlx
diff --git a/xc/lib/GL/dri/Imakefile b/xc/lib/GL/dri/Imakefile
index f5bde177a..bd1e11042 100644
--- a/xc/lib/GL/dri/Imakefile
+++ b/xc/lib/GL/dri/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/dri/Imakefile,v 1.3 1999/12/14 01:32:22 robin Exp $
+XCOMM $XFree86: xc/lib/GL/dri/Imakefile,v 1.5 2000/02/15 07:13:25 martin Exp $
#include <Threads.tmpl>
diff --git a/xc/lib/GL/dri/dri_mesa.c b/xc/lib/GL/dri/dri_mesa.c
deleted file mode 100644
index bc934345e..000000000
--- a/xc/lib/GL/dri/dri_mesa.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/dri_mesa.c,v 1.4 1999/12/14 01:32:22 robin 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>
- *
- * $PI: xc/lib/GL/dri/dri_mesa.c,v 1.18 1999/08/04 18:13:27 faith Exp $
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <unistd.h>
-#include <Xlibint.h>
-#include <Xext.h>
-#include <extutil.h>
-#include "glxclient.h"
-#include "GL/xmesa.h"
-#include "xf86dri.h"
-#include "sarea.h"
-#include "dri_mesaint.h"
-#include "dri_mesa_init.h"
-#include "dri_xmesaapi.h"
-
-/* Context binding */
-static Bool driMesaBindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc);
-static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc);
-
-/* Drawable methods */
-static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw,
- VisualID vid, __DRIdrawable *pdraw);
-static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw);
-static void driMesaSwapBuffers(Display *dpy, void *private);
-static void driMesaDestroyDrawable(Display *dpy, void *private);
-
-/* Context methods */
-static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared,
- __DRIcontext *pctx);
-static void driMesaDestroyContext(Display *dpy, int scrn, void *private);
-
-/* Screen methods */
-static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config);
-static void driMesaDestroyScreen(Display *dpy, int scrn, void *private);
-
-/* Display methods */
-static void *driMesaCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
-static void driMesaDestroyDisplay(Display *dpy, void *private);
-
-/*****************************************************************/
-
-/* Maintain a list of drawables */
-
-void *drawHash = NULL; /* Hash table to hold DRI drawables */
-
-static Bool __driMesaAddDrawable(__DRIdrawable *pdraw)
-{
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
-
- /* Create the hash table */
- if (!drawHash) drawHash = drmHashCreate();
-
- if (drmHashInsert(drawHash, pdp->draw, pdraw))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-static __DRIdrawable *__driMesaFindDrawable(GLXDrawable draw)
-{
- int retcode;
- __DRIdrawable *pdraw;
-
- /* Create the hash table */
- if (!drawHash) drawHash = drmHashCreate();
-
- retcode = drmHashLookup(drawHash, draw, (void **)&pdraw);
- if (retcode)
- return NULL;
-
- return pdraw;
-}
-
-static void __driMesaRemoveDrawable(__DRIdrawable *pdraw)
-{
- int retcode;
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
-
- /* Create the hash table */
- if (!drawHash) drawHash = drmHashCreate();
-
- retcode = drmHashLookup(drawHash, pdp->draw, (void **)&pdraw);
- if (!retcode) { /* Found */
- drmHashDelete(drawHash, pdp->draw);
- }
-}
-
-/*****************************************************************/
-
-static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc)
-{
- __DRIdrawable *pdraw;
- __DRIcontextPrivate *pcp;
- __DRIscreenPrivate *psp;
- __DRIdrawablePrivate *pdp;
-
- /*
- ** Assume error checking is done properly in glXMakeCurrent before
- ** calling driMesaUnbindContext.
- */
-
- if (gc == NULL || draw == None) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pdraw = __driMesaFindDrawable(draw);
- if (!pdraw) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pcp = (__DRIcontextPrivate *)gc->driContext.private;
- pdp = (__DRIdrawablePrivate *)pdraw->private;
- psp = pdp->driScreenPriv;
- if (!psp) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- /* Unbind Mesa's drawable from Mesa's context */
- (*psp->XMesaAPI.UnbindContext)(pcp->xm_ctx);
-
- if (pdp->refcount == 0) {
- /* ERROR!!! */
- return GL_FALSE;
- } else if (--pdp->refcount == 0) {
-#if 0
- /*
- ** NOT_DONE: When a drawable is unbound from one direct
- ** rendering context and then bound to another, we do not want
- ** to destroy the drawable data structure each time only to
- ** recreate it immediatly afterwards when binding to the next
- ** context. This also causes conflicts with caching of the
- ** drawable stamp.
- **
- ** When GLX 1.3 is integrated, the create and destroy drawable
- ** functions will have user level counterparts and the memory
- ** will be able to be recovered.
- */
-
- /* Delete drawable if no longer referenced by any contexts */
- (*pdraw->destroyDrawable)(dpy, pdraw->private);
- __driMesaRemoveDrawable(pdraw);
- Xfree(pdraw);
-#endif
- }
-
- /* Unbind the drawable */
- pcp->driDrawablePriv = NULL;
- pdp->driContextPriv = &psp->dummyContextPriv;
-
- return GL_TRUE;
-}
-
-static Bool driMesaBindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc)
-{
- __DRIdrawable *pdraw;
- __DRIdrawablePrivate *pdp;
- __DRIscreenPrivate *psp;
- __DRIcontextPrivate *pcp;
-
- /*
- ** Assume error checking is done properly in glXMakeCurrent before
- ** calling driMesaBindContext.
- */
-
- if (gc == NULL || draw == None) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pdraw = __driMesaFindDrawable(draw);
- if (!pdraw) {
- /* Allocate a new drawable */
- pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable));
- if (!pdraw) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- /* Create a new drawable */
- pdraw->private = driMesaCreateDrawable(dpy, scrn, draw, gc->vid,
- pdraw);
- if (!pdraw->private) {
- /* ERROR!!! */
- Xfree(pdraw);
- return GL_FALSE;
- }
-
- /* Add pdraw to drawable list */
- if (!__driMesaAddDrawable(pdraw)) {
- /* ERROR!!! */
- (*pdraw->destroyDrawable)(dpy, pdraw->private);
- Xfree(pdraw);
- return GL_FALSE;
- }
- }
-
- pdp = (__DRIdrawablePrivate *)pdraw->private;
- psp = pdp->driScreenPriv;
- if (!psp) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- /* Bind the drawable to the context */
- pcp = (__DRIcontextPrivate *)gc->driContext.private;
- pcp->driDrawablePriv = pdp;
- pdp->driContextPriv = pcp;
- gc->glAPI = psp->glAPI;
- pdp->refcount++;
-
- /*
- ** Now that we have a context associated with this drawable, we can
- ** initialize the drawable information if has not been done before.
- */
- if (!pdp->pStamp) {
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- driMesaUpdateDrawableInfo(dpy, scrn, pdp);
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- }
-
- /* Bind Mesa's drawable to Mesa's context */
- (*psp->XMesaAPI.MakeCurrent)(pcp->xm_ctx, pdp->xm_buf);
-
- return GL_TRUE;
-}
-
-/*****************************************************************/
-
-void driMesaUpdateDrawableInfo(Display *dpy, int scrn,
- __DRIdrawablePrivate *pdp)
-{
- __DRIscreenPrivate *psp;
- __DRIcontextPrivate *pcp = pdp->driContextPriv;
-
- if (!pcp || (pdp != pcp->driDrawablePriv)) {
- /* ERROR!!! */
- return;
- }
-
- psp = pdp->driScreenPriv;
- if (!psp) {
- /* ERROR!!! */
- return;
- }
-
- if (pdp->pClipRects) {
- Xfree(pdp->pClipRects);
- }
-
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-
- if (!XF86DRIGetDrawableInfo(dpy, scrn, pdp->draw,
- &pdp->index, &pdp->lastStamp,
- &pdp->x, &pdp->y, &pdp->w, &pdp->h,
- &pdp->numClipRects, &pdp->pClipRects)) {
- pdp->numClipRects = 0;
- pdp->pClipRects = NULL;
- /* ERROR!!! */
- }
-
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-
- pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp);
-}
-
-/*****************************************************************/
-
-static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw,
- VisualID vid, __DRIdrawable *pdraw)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
- __DRIdrawablePrivate *pdp;
- int i;
- XMesaVisual xm_vis = NULL;
-
- pdp = (__DRIdrawablePrivate *)Xmalloc(sizeof(__DRIdrawablePrivate));
- if (!pdp) {
- return NULL;
- }
-
- if (!XF86DRICreateDrawable(dpy, scrn, draw, &pdp->hHWDrawable)) {
- Xfree(pdp);
- return NULL;
- }
-
- pdp->draw = draw;
- pdp->refcount = 0;
- pdp->pStamp = NULL;
- pdp->lastStamp = 0;
- pdp->index = 0;
- pdp->x = 0;
- pdp->y = 0;
- pdp->w = 0;
- pdp->h = 0;
- pdp->numClipRects = 0;
- pdp->pClipRects = NULL;
-
- pDRIScreen = __glXFindDRIScreen(dpy, scrn);
- pdp->driScreenPriv = psp = (__DRIscreenPrivate *)pDRIScreen->private;
-
- pdp->driContextPriv = &psp->dummyContextPriv;
-
- for (i = 0; i < psp->numVisuals; i++) {
- if (vid == psp->visuals[i].vid) {
- xm_vis = psp->visuals[i].xm_vis;
- break;
- }
- }
-
- if (1 /* NOT_DONE: Determine if it is a pixmap or not */) {
- pdp->xm_buf = (*psp->XMesaAPI.CreateWindowBuffer)(xm_vis, draw, pdp);
- } else {
- XMesaVisual xm_vis = NULL;
- XMesaColormap cmap = 0;
- pdp->xm_buf = (*psp->XMesaAPI.CreatePixmapBuffer)(xm_vis, draw, cmap,
- pdp);
- }
- if (!pdp->xm_buf) {
- (void)XF86DRIDestroyDrawable(dpy, scrn, pdp->draw);
- Xfree(pdp);
- return NULL;
- }
-
- pdraw->destroyDrawable = driMesaDestroyDrawable;
- pdraw->swapBuffers = driMesaSwapBuffers;
-
- return (void *)pdp;
-}
-
-static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw)
-{
- /*
- ** Make sure this routine returns NULL if the drawable is not bound
- ** to a direct rendering context!
- */
- return __driMesaFindDrawable(draw);
-}
-
-static void driMesaSwapBuffers(Display *dpy, void *private)
-{
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private;
- __DRIscreenPrivate *psp = pdp->driScreenPriv;
-
- (*psp->XMesaAPI.SwapBuffers)(pdp->xm_buf);
-}
-
-static void driMesaDestroyDrawable(Display *dpy, void *private)
-{
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private;
- __DRIscreenPrivate *psp = pdp->driScreenPriv;
- int scrn = psp->myNum;
-
- if (pdp) {
- (*psp->XMesaAPI.DestroyBuffer)(pdp->xm_buf);
- (void)XF86DRIDestroyDrawable(dpy, scrn, pdp->draw);
- if (pdp->pClipRects)
- Xfree(pdp->pClipRects);
- Xfree(pdp);
- }
-}
-
-/*****************************************************************/
-
-static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared,
- __DRIcontext *pctx)
-{
- __DRIcontextPrivate *pcp;
- __DRIcontextPrivate *pshare = (__DRIcontextPrivate *)shared;
- XMesaContext shared_xm_ctx = (pshare ?
- pshare->xm_ctx : (XMesaContext)NULL);
- __DRIscreenPrivate *psp;
- __DRIscreen *pDRIScreen;
- int i;
-
- pDRIScreen = __glXFindDRIScreen(dpy, vis->screen);
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
-
- if (!psp->dummyContextPriv.driScreenPriv) {
- if (!XF86DRICreateContext(dpy, vis->screen, vis->visual,
- &psp->dummyContextPriv.contextID,
- &psp->dummyContextPriv.hHWContext)) {
- return NULL;
- }
- psp->dummyContextPriv.driScreenPriv = psp;
- psp->dummyContextPriv.xm_ctx = NULL;
- psp->dummyContextPriv.driDrawablePriv = NULL;
- /* No other fields should be used! */
- }
-
- pcp = (__DRIcontextPrivate *)Xmalloc(sizeof(__DRIcontextPrivate));
- if (!pcp) {
- return NULL;
- }
-
- pcp->driScreenPriv = psp;
- pcp->xm_ctx = NULL;
- pcp->driDrawablePriv = NULL;
-
- if (!XF86DRICreateContext(dpy, vis->screen, vis->visual,
- &pcp->contextID, &pcp->hHWContext)) {
- Xfree(pcp);
- return NULL;
- }
-
- for (i = 0; i < psp->numVisuals; i++)
- if (psp->visuals[i].vid == vis->visualid)
- pcp->xm_ctx = (*psp->XMesaAPI.CreateContext)
- (psp->visuals[i].xm_vis, shared_xm_ctx, pcp);
-
- if (!pcp->xm_ctx) {
- (void)XF86DRIDestroyContext(dpy, vis->screen, pcp->contextID);
- Xfree(pcp);
- return NULL;
- }
-
- pctx->destroyContext = driMesaDestroyContext;
- pctx->bindContext = driMesaBindContext;
- pctx->unbindContext = driMesaUnbindContext;
-
- return pcp;
-}
-
-static void driMesaDestroyContext(Display *dpy, int scrn, void *private)
-{
- __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)private;
-
- if (pcp) {
- (void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID);
- (*pcp->driScreenPriv->XMesaAPI.DestroyContext)(pcp->xm_ctx);
- Xfree(pcp);
- }
-}
-
-/*****************************************************************/
-
-static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- int directCapable, i, n;
- __DRIscreenPrivate *psp;
- XVisualInfo visTmpl, *visinfo;
- drmHandle hFB, hSAREA;
- char *BusID, *driverName;
- drmMagic magic;
-
- if (!XF86DRIQueryDirectRenderingCapable(dpy, scrn, &directCapable)) {
- return NULL;
- }
-
- if (!directCapable) {
- return NULL;
- }
-
- psp = (__DRIscreenPrivate *)Xmalloc(sizeof(__DRIscreenPrivate));
- if (!psp) {
- return NULL;
- }
-
- psp->myNum = scrn;
-
- if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
- Xfree(psp);
- return NULL;
- }
-
- /*
- ** NOT_DONE: This is used by the X server to detect when the client
- ** has died while holding the drawable lock. The client sets the
- ** drawable lock to this value.
- */
- psp->drawLockID = 1;
-
- psp->fd = drmOpen(NULL,BusID);
- if (!psp->fd) {
- Xfree(BusID);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
- Xfree(BusID); /* No longer needed */
-
- if (drmGetMagic(psp->fd, &magic)) {
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- if (!XF86DRIAuthConnection(dpy, scrn, magic)) {
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- if (!XF86DRIGetClientDriverName(dpy, scrn,
- &psp->major,
- &psp->minor,
- &psp->patch,
- &driverName)) {
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- psp->hLibrary = driMesaInitAPI(driverName, &psp->XMesaAPI, &psp->glAPI);
- if (!psp->hLibrary) {
- (void)drmClose(psp->fd);
- Xfree(driverName);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
- Xfree(driverName); /* No longer needed */
-
- if (!XF86DRIGetDeviceInfo(dpy, scrn,
- &hFB,
- &psp->fbOrigin,
- &psp->fbSize,
- &psp->fbStride,
- &psp->devPrivSize,
- &psp->pDevPriv)) {
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
- psp->fbWidth = DisplayWidth(dpy, scrn);
- psp->fbHeight = DisplayHeight(dpy, scrn);
- psp->fbBPP = 32; /* NOT_DONE: Get this from X server */
-
- if (drmMap(psp->fd, hFB, psp->fbSize, (drmAddressPtr)&psp->pFB)) {
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- if (drmMap(psp->fd, hSAREA, SAREA_MAX, (drmAddressPtr)&psp->pSAREA)) {
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- psp->numVisuals = numConfigs;
- psp->visuals = (__DRIvisualPrivate *)Xmalloc(numConfigs *
- sizeof(__DRIvisualPrivate));
- if (!psp->visuals) {
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- visTmpl.screen = scrn;
- visinfo = XGetVisualInfo(dpy, VisualScreenMask, &visTmpl, &n);
- if (n != numConfigs) {
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
-
- for (i = 0; i < numConfigs; i++, config++) {
- psp->visuals[i].vid = visinfo[i].visualid;
- psp->visuals[i].xm_vis =
- (*psp->XMesaAPI.CreateVisual)(dpy,
- &visinfo[i],
- config->rgba,
- (config->alphaSize > 0),
- config->doubleBuffer,
- config->stereo,
- GL_TRUE, /* ximage_flag */
- config->depthSize,
- config->stencilSize,
- config->accumRedSize,
- config->level);
- if (!psp->visuals[i].xm_vis) {
- /* Free the visuals so far created */
- while (--i >= 0) {
- (*psp->XMesaAPI.DestroyVisual)(psp->visuals[i].xm_vis);
- }
- Xfree(psp->visuals);
- XFree(visinfo);
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
- }
- XFree(visinfo);
-
- /* Initialize the screen specific GLX driver */
- if (psp->XMesaAPI.InitDriver) {
- if (!(*psp->XMesaAPI.InitDriver)(psp)) {
- while (--psp->numVisuals >= 0) {
- (*psp->XMesaAPI.DestroyVisual)
- (psp->visuals[psp->numVisuals].xm_vis);
- }
- Xfree(psp->visuals);
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
- (void)XF86DRICloseConnection(dpy, scrn);
- return NULL;
- }
- }
-
- /*
- ** Do not init dummy context here; actual initialization will be
- ** done when the first DRI context is created. Init screen priv ptr
- ** to NULL to let CreateContext routine that it needs to be inited.
- */
- psp->dummyContextPriv.driScreenPriv = NULL;
-
- psc->destroyScreen = driMesaDestroyScreen;
- psc->createContext = driMesaCreateContext;
- psc->createDrawable = driMesaCreateDrawable;
- psc->getDrawable = driMesaGetDrawable;
-
- return (void *)psp;
-}
-
-static void driMesaDestroyScreen(Display *dpy, int scrn, void *private)
-{
- __DRIscreenPrivate *psp = (__DRIscreenPrivate *)private;
-
- if (psp) {
- if (psp->dummyContextPriv.driScreenPriv) {
- (void)XF86DRIDestroyContext(dpy, scrn,
- psp->dummyContextPriv.contextID);
- }
- if (psp->XMesaAPI.ResetDriver)
- (*psp->XMesaAPI.ResetDriver)(psp);
- while (--psp->numVisuals >= 0) {
- (*psp->XMesaAPI.DestroyVisual)
- (psp->visuals[psp->numVisuals].xm_vis);
- }
- Xfree(psp->visuals);
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- Xfree(psp->pDevPriv);
- driMesaDestroyAPI(psp->hLibrary);
- (void)drmClose(psp->fd);
- Xfree(psp);
-
-#if 0
- /*
- ** NOT_DONE: Normally, we would call XF86DRICloseConnection()
- ** here, but since this routine is called after the
- ** XCloseDisplay() function has already shut down the connection
- ** to the Display, there is no protocol stream open to the X
- ** server anymore. Luckily, XF86DRICloseConnection() does not
- ** really do anything (for now).
- */
- (void)XF86DRICloseConnection(dpy, scrn);
-#endif
- }
-}
-
-/*****************************************************************/
-
-static void *driMesaCreateDisplay(Display *dpy, __DRIdisplay *pdisp)
-{
- __DRIdisplayPrivate *pdpyp;
- int eventBase, errorBase;
- int major, minor, patch;
-
- if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
- return NULL;
- }
-
- if (!XF86DRIQueryVersion(dpy, &major, &minor, &patch)) {
- return NULL;
- }
-
- pdpyp = (__DRIdisplayPrivate *)Xmalloc(sizeof(__DRIdisplayPrivate));
- if (!pdpyp) {
- return NULL;
- }
-
- pdpyp->major = major;
- pdpyp->minor = minor;
- pdpyp->patch = patch;
-
- pdisp->destroyDisplay = driMesaDestroyDisplay;
- pdisp->createScreen = driMesaCreateScreen;
-
- return (void *)pdpyp;
-}
-
-static void driMesaDestroyDisplay(Display *dpy, void *private)
-{
- __DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private;
-
- if (pdpyp)
- Xfree(pdpyp);
-}
-
-/*****************************************************************/
-
-void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp)
-{
- return driMesaCreateDisplay(dpy, pdisp);
-}
-
-#endif
diff --git a/xc/lib/GL/dri/dri_mesa_init.c b/xc/lib/GL/dri/dri_mesa_init.c
deleted file mode 100644
index dd6484a20..000000000
--- a/xc/lib/GL/dri/dri_mesa_init.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/dri_mesa_init.c,v 1.3 1999/12/14 01:32:22 robin 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>
- *
- * $PI: xc/lib/GL/dri/dri_mesa_init.c,v 1.5 1999/06/21 05:13:54 martin Exp $
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#ifdef GLX_USE_DLOPEN
-#include <stdio.h>
-#include <dlfcn.h>
-#endif
-#include "mesa_api.h"
-#include "dri_mesa.h"
-#include "dri_glapi.h"
-#include "dri_xmesaapi.h"
-#include "dri_mesa_init.h"
-
-
-int dlopen_error;
-
-#ifdef GLX_USE_DLOPEN
-static void *resolveSymbol(void *handle, char *name)
-{
- char *error;
- void *func;
-
- func = dlsym(handle, name);
- if ((error = dlerror()) != NULL) {
- fputs(error, stderr);
- fputs("\n", stderr);
- dlopen_error = True;
- return NULL;
- }
-
- return func;
-}
-#endif
-
-void *driMesaInitAPI(char *name, __XMESAapi *XMesaAPI, __GLapi *glAPI)
-{
- void *handle = (void *)NULL;
-#ifdef GLX_USE_DLOPEN
- char libname[256];
-
- dlopen_error = False;
-
- if (name) {
- snprintf(libname, 256, "%s_dri.so", name);
- } else {
- return NULL;
- }
-
- handle = dlopen(libname, RTLD_NOW);
- if (!handle) {
- fputs(dlerror(), stderr);
- fputs("\n", stderr);
- return NULL;
- }
-
- XMesaAPI->InitDriver = resolveSymbol(handle, "XMesaInitDriver");
- XMesaAPI->ResetDriver = resolveSymbol(handle, "XMesaResetDriver");
- XMesaAPI->CreateVisual = resolveSymbol(handle, "XMesaCreateVisual");
- XMesaAPI->DestroyVisual = resolveSymbol(handle, "XMesaDestroyVisual");
- XMesaAPI->CreateContext = resolveSymbol(handle, "XMesaCreateContext");
- XMesaAPI->DestroyContext = resolveSymbol(handle, "XMesaDestroyContext");
- XMesaAPI->CreateWindowBuffer =
- resolveSymbol(handle, "XMesaCreateWindowBuffer");
- XMesaAPI->CreatePixmapBuffer =
- resolveSymbol(handle, "XMesaCreatePixmapBuffer");
- XMesaAPI->DestroyBuffer = resolveSymbol(handle, "XMesaDestroyBuffer");
- XMesaAPI->SwapBuffers = resolveSymbol(handle, "XMesaSwapBuffers");
- XMesaAPI->MakeCurrent = resolveSymbol(handle, "XMesaMakeCurrent");
- XMesaAPI->UnbindContext = resolveSymbol(handle, "XMesaUnbindContext");
-
- glAPI->Accum = resolveSymbol(handle, "glAccum");
- glAPI->AlphaFunc = resolveSymbol(handle, "glAlphaFunc");
- glAPI->AreTexturesResident =
- resolveSymbol(handle, "glAreTexturesResident");
- glAPI->ArrayElement = resolveSymbol(handle, "glArrayElement");
- glAPI->Begin = resolveSymbol(handle, "glBegin");
- glAPI->BindTexture = resolveSymbol(handle, "glBindTexture");
- glAPI->Bitmap = resolveSymbol(handle, "glBitmap");
- glAPI->BlendFunc = resolveSymbol(handle, "glBlendFunc");
- glAPI->CallList = resolveSymbol(handle, "glCallList");
- glAPI->CallLists = resolveSymbol(handle, "glCallLists");
- glAPI->Clear = resolveSymbol(handle, "glClear");
- glAPI->ClearAccum = resolveSymbol(handle, "glClearAccum");
- glAPI->ClearColor = resolveSymbol(handle, "glClearColor");
- glAPI->ClearDepth = resolveSymbol(handle, "glClearDepth");
- glAPI->ClearIndex = resolveSymbol(handle, "glClearIndex");
- glAPI->ClearStencil = resolveSymbol(handle, "glClearStencil");
- glAPI->ClipPlane = resolveSymbol(handle, "glClipPlane");
- glAPI->Color3b = resolveSymbol(handle, "glColor3b");
- glAPI->Color3bv = resolveSymbol(handle, "glColor3bv");
- glAPI->Color3d = resolveSymbol(handle, "glColor3d");
- glAPI->Color3dv = resolveSymbol(handle, "glColor3dv");
- glAPI->Color3f = resolveSymbol(handle, "glColor3f");
- glAPI->Color3fv = resolveSymbol(handle, "glColor3fv");
- glAPI->Color3i = resolveSymbol(handle, "glColor3i");
- glAPI->Color3iv = resolveSymbol(handle, "glColor3iv");
- glAPI->Color3s = resolveSymbol(handle, "glColor3s");
- glAPI->Color3sv = resolveSymbol(handle, "glColor3sv");
- glAPI->Color3ub = resolveSymbol(handle, "glColor3ub");
- glAPI->Color3ubv = resolveSymbol(handle, "glColor3ubv");
- glAPI->Color3ui = resolveSymbol(handle, "glColor3ui");
- glAPI->Color3uiv = resolveSymbol(handle, "glColor3uiv");
- glAPI->Color3us = resolveSymbol(handle, "glColor3us");
- glAPI->Color3usv = resolveSymbol(handle, "glColor3usv");
- glAPI->Color4b = resolveSymbol(handle, "glColor4b");
- glAPI->Color4bv = resolveSymbol(handle, "glColor4bv");
- glAPI->Color4d = resolveSymbol(handle, "glColor4d");
- glAPI->Color4dv = resolveSymbol(handle, "glColor4dv");
- glAPI->Color4f = resolveSymbol(handle, "glColor4f");
- glAPI->Color4fv = resolveSymbol(handle, "glColor4fv");
- glAPI->Color4i = resolveSymbol(handle, "glColor4i");
- glAPI->Color4iv = resolveSymbol(handle, "glColor4iv");
- glAPI->Color4s = resolveSymbol(handle, "glColor4s");
- glAPI->Color4sv = resolveSymbol(handle, "glColor4sv");
- glAPI->Color4ub = resolveSymbol(handle, "glColor4ub");
- glAPI->Color4ubv = resolveSymbol(handle, "glColor4ubv");
- glAPI->Color4ui = resolveSymbol(handle, "glColor4ui");
- glAPI->Color4uiv = resolveSymbol(handle, "glColor4uiv");
- glAPI->Color4us = resolveSymbol(handle, "glColor4us");
- glAPI->Color4usv = resolveSymbol(handle, "glColor4usv");
- glAPI->ColorMask = resolveSymbol(handle, "glColorMask");
- glAPI->ColorMaterial = resolveSymbol(handle, "glColorMaterial");
- glAPI->ColorPointer = resolveSymbol(handle, "glColorPointer");
- glAPI->CopyPixels = resolveSymbol(handle, "glCopyPixels");
- glAPI->CopyTexImage1D = resolveSymbol(handle, "glCopyTexImage1D");
- glAPI->CopyTexImage2D = resolveSymbol(handle, "glCopyTexImage2D");
- glAPI->CopyTexSubImage1D = resolveSymbol(handle, "glCopyTexSubImage1D");
- glAPI->CopyTexSubImage2D = resolveSymbol(handle, "glCopyTexSubImage2D");
- glAPI->CullFace = resolveSymbol(handle, "glCullFace");
- glAPI->DeleteLists = resolveSymbol(handle, "glDeleteLists");
- glAPI->DeleteTextures = resolveSymbol(handle, "glDeleteTextures");
- glAPI->DepthFunc = resolveSymbol(handle, "glDepthFunc");
- glAPI->DepthMask = resolveSymbol(handle, "glDepthMask");
- glAPI->DepthRange = resolveSymbol(handle, "glDepthRange");
- glAPI->Disable = resolveSymbol(handle, "glDisable");
- glAPI->DisableClientState = resolveSymbol(handle, "glDisableClientState");
- glAPI->DrawArrays = resolveSymbol(handle, "glDrawArrays");
- glAPI->DrawBuffer = resolveSymbol(handle, "glDrawBuffer");
- glAPI->DrawElements = resolveSymbol(handle, "glDrawElements");
- glAPI->DrawPixels = resolveSymbol(handle, "glDrawPixels");
- glAPI->EdgeFlag = resolveSymbol(handle, "glEdgeFlag");
- glAPI->EdgeFlagPointer = resolveSymbol(handle, "glEdgeFlagPointer");
- glAPI->EdgeFlagv = resolveSymbol(handle, "glEdgeFlagv");
- glAPI->Enable = resolveSymbol(handle, "glEnable");
- glAPI->EnableClientState = resolveSymbol(handle, "glEnableClientState");
- glAPI->End = resolveSymbol(handle, "glEnd");
- glAPI->EndList = resolveSymbol(handle, "glEndList");
- glAPI->EvalCoord1d = resolveSymbol(handle, "glEvalCoord1d");
- glAPI->EvalCoord1dv = resolveSymbol(handle, "glEvalCoord1dv");
- glAPI->EvalCoord1f = resolveSymbol(handle, "glEvalCoord1f");
- glAPI->EvalCoord1fv = resolveSymbol(handle, "glEvalCoord1fv");
- glAPI->EvalCoord2d = resolveSymbol(handle, "glEvalCoord2d");
- glAPI->EvalCoord2dv = resolveSymbol(handle, "glEvalCoord2dv");
- glAPI->EvalCoord2f = resolveSymbol(handle, "glEvalCoord2f");
- glAPI->EvalCoord2fv = resolveSymbol(handle, "glEvalCoord2fv");
- glAPI->EvalMesh1 = resolveSymbol(handle, "glEvalMesh1");
- glAPI->EvalMesh2 = resolveSymbol(handle, "glEvalMesh2");
- glAPI->EvalPoint1 = resolveSymbol(handle, "glEvalPoint1");
- glAPI->EvalPoint2 = resolveSymbol(handle, "glEvalPoint2");
- glAPI->FeedbackBuffer = resolveSymbol(handle, "glFeedbackBuffer");
- glAPI->Finish = resolveSymbol(handle, "glFinish");
- glAPI->Flush = resolveSymbol(handle, "glFlush");
- glAPI->Fogf = resolveSymbol(handle, "glFogf");
- glAPI->Fogfv = resolveSymbol(handle, "glFogfv");
- glAPI->Fogi = resolveSymbol(handle, "glFogi");
- glAPI->Fogiv = resolveSymbol(handle, "glFogiv");
- glAPI->FrontFace = resolveSymbol(handle, "glFrontFace");
- glAPI->Frustum = resolveSymbol(handle, "glFrustum");
- glAPI->GenLists = resolveSymbol(handle, "glGenLists");
- glAPI->GenTextures = resolveSymbol(handle, "glGenTextures");
- glAPI->GetBooleanv = resolveSymbol(handle, "glGetBooleanv");
- glAPI->GetClipPlane = resolveSymbol(handle, "glGetClipPlane");
- glAPI->GetDoublev = resolveSymbol(handle, "glGetDoublev");
- glAPI->GetError = resolveSymbol(handle, "glGetError");
- glAPI->GetFloatv = resolveSymbol(handle, "glGetFloatv");
- glAPI->GetIntegerv = resolveSymbol(handle, "glGetIntegerv");
- glAPI->GetLightfv = resolveSymbol(handle, "glGetLightfv");
- glAPI->GetLightiv = resolveSymbol(handle, "glGetLightiv");
- glAPI->GetMapdv = resolveSymbol(handle, "glGetMapdv");
- glAPI->GetMapfv = resolveSymbol(handle, "glGetMapfv");
- glAPI->GetMapiv = resolveSymbol(handle, "glGetMapiv");
- glAPI->GetMaterialfv = resolveSymbol(handle, "glGetMaterialfv");
- glAPI->GetMaterialiv = resolveSymbol(handle, "glGetMaterialiv");
- glAPI->GetPixelMapfv = resolveSymbol(handle, "glGetPixelMapfv");
- glAPI->GetPixelMapuiv = resolveSymbol(handle, "glGetPixelMapuiv");
- glAPI->GetPixelMapusv = resolveSymbol(handle, "glGetPixelMapusv");
- glAPI->GetPointerv = resolveSymbol(handle, "glGetPointerv");
- glAPI->GetPolygonStipple = resolveSymbol(handle, "glGetPolygonStipple");
- glAPI->GetString = resolveSymbol(handle, "glGetString");
- glAPI->GetTexEnvfv = resolveSymbol(handle, "glGetTexEnvfv");
- glAPI->GetTexEnviv = resolveSymbol(handle, "glGetTexEnviv");
- glAPI->GetTexGendv = resolveSymbol(handle, "glGetTexGendv");
- glAPI->GetTexGenfv = resolveSymbol(handle, "glGetTexGenfv");
- glAPI->GetTexGeniv = resolveSymbol(handle, "glGetTexGeniv");
- glAPI->GetTexImage = resolveSymbol(handle, "glGetTexImage");
- glAPI->GetTexLevelParameterfv =
- resolveSymbol(handle, "glGetTexLevelParameterfv");
- glAPI->GetTexLevelParameteriv =
- resolveSymbol(handle, "glGetTexLevelParameteriv");
- glAPI->GetTexParameterfv = resolveSymbol(handle, "glGetTexParameterfv");
- glAPI->GetTexParameteriv = resolveSymbol(handle, "glGetTexParameteriv");
- glAPI->Hint = resolveSymbol(handle, "glHint");
- glAPI->IndexMask = resolveSymbol(handle, "glIndexMask");
- glAPI->IndexPointer = resolveSymbol(handle, "glIndexPointer");
- glAPI->Indexd = resolveSymbol(handle, "glIndexd");
- glAPI->Indexdv = resolveSymbol(handle, "glIndexdv");
- glAPI->Indexf = resolveSymbol(handle, "glIndexf");
- glAPI->Indexfv = resolveSymbol(handle, "glIndexfv");
- glAPI->Indexi = resolveSymbol(handle, "glIndexi");
- glAPI->Indexiv = resolveSymbol(handle, "glIndexiv");
- glAPI->Indexs = resolveSymbol(handle, "glIndexs");
- glAPI->Indexsv = resolveSymbol(handle, "glIndexsv");
- glAPI->Indexub = resolveSymbol(handle, "glIndexub");
- glAPI->Indexubv = resolveSymbol(handle, "glIndexubv");
- glAPI->InitNames = resolveSymbol(handle, "glInitNames");
- glAPI->InterleavedArrays = resolveSymbol(handle, "glInterleavedArrays");
- glAPI->IsEnabled = resolveSymbol(handle, "glIsEnabled");
- glAPI->IsList = resolveSymbol(handle, "glIsList");
- glAPI->IsTexture = resolveSymbol(handle, "glIsTexture");
- glAPI->LightModelf = resolveSymbol(handle, "glLightModelf");
- glAPI->LightModelfv = resolveSymbol(handle, "glLightModelfv");
- glAPI->LightModeli = resolveSymbol(handle, "glLightModeli");
- glAPI->LightModeliv = resolveSymbol(handle, "glLightModeliv");
- glAPI->Lightf = resolveSymbol(handle, "glLightf");
- glAPI->Lightfv = resolveSymbol(handle, "glLightfv");
- glAPI->Lighti = resolveSymbol(handle, "glLighti");
- glAPI->Lightiv = resolveSymbol(handle, "glLightiv");
- glAPI->LineStipple = resolveSymbol(handle, "glLineStipple");
- glAPI->LineWidth = resolveSymbol(handle, "glLineWidth");
- glAPI->ListBase = resolveSymbol(handle, "glListBase");
- glAPI->LoadIdentity = resolveSymbol(handle, "glLoadIdentity");
- glAPI->LoadMatrixd = resolveSymbol(handle, "glLoadMatrixd");
- glAPI->LoadMatrixf = resolveSymbol(handle, "glLoadMatrixf");
- glAPI->LoadName = resolveSymbol(handle, "glLoadName");
- glAPI->LogicOp = resolveSymbol(handle, "glLogicOp");
- glAPI->Map1d = resolveSymbol(handle, "glMap1d");
- glAPI->Map1f = resolveSymbol(handle, "glMap1f");
- glAPI->Map2d = resolveSymbol(handle, "glMap2d");
- glAPI->Map2f = resolveSymbol(handle, "glMap2f");
- glAPI->MapGrid1d = resolveSymbol(handle, "glMapGrid1d");
- glAPI->MapGrid1f = resolveSymbol(handle, "glMapGrid1f");
- glAPI->MapGrid2d = resolveSymbol(handle, "glMapGrid2d");
- glAPI->MapGrid2f = resolveSymbol(handle, "glMapGrid2f");
- glAPI->Materialf = resolveSymbol(handle, "glMaterialf");
- glAPI->Materialfv = resolveSymbol(handle, "glMaterialfv");
- glAPI->Materiali = resolveSymbol(handle, "glMateriali");
- glAPI->Materialiv = resolveSymbol(handle, "glMaterialiv");
- glAPI->MatrixMode = resolveSymbol(handle, "glMatrixMode");
- glAPI->MultMatrixd = resolveSymbol(handle, "glMultMatrixd");
- glAPI->MultMatrixf = resolveSymbol(handle, "glMultMatrixf");
- glAPI->NewList = resolveSymbol(handle, "glNewList");
- glAPI->Normal3b = resolveSymbol(handle, "glNormal3b");
- glAPI->Normal3bv = resolveSymbol(handle, "glNormal3bv");
- glAPI->Normal3d = resolveSymbol(handle, "glNormal3d");
- glAPI->Normal3dv = resolveSymbol(handle, "glNormal3dv");
- glAPI->Normal3f = resolveSymbol(handle, "glNormal3f");
- glAPI->Normal3fv = resolveSymbol(handle, "glNormal3fv");
- glAPI->Normal3i = resolveSymbol(handle, "glNormal3i");
- glAPI->Normal3iv = resolveSymbol(handle, "glNormal3iv");
- glAPI->Normal3s = resolveSymbol(handle, "glNormal3s");
- glAPI->Normal3sv = resolveSymbol(handle, "glNormal3sv");
- glAPI->NormalPointer = resolveSymbol(handle, "glNormalPointer");
- glAPI->Ortho = resolveSymbol(handle, "glOrtho");
- glAPI->PassThrough = resolveSymbol(handle, "glPassThrough");
- glAPI->PixelMapfv = resolveSymbol(handle, "glPixelMapfv");
- glAPI->PixelMapuiv = resolveSymbol(handle, "glPixelMapuiv");
- glAPI->PixelMapusv = resolveSymbol(handle, "glPixelMapusv");
- glAPI->PixelStoref = resolveSymbol(handle, "glPixelStoref");
- glAPI->PixelStorei = resolveSymbol(handle, "glPixelStorei");
- glAPI->PixelTransferf = resolveSymbol(handle, "glPixelTransferf");
- glAPI->PixelTransferi = resolveSymbol(handle, "glPixelTransferi");
- glAPI->PixelZoom = resolveSymbol(handle, "glPixelZoom");
- glAPI->PointSize = resolveSymbol(handle, "glPointSize");
- glAPI->PolygonMode = resolveSymbol(handle, "glPolygonMode");
- glAPI->PolygonOffset = resolveSymbol(handle, "glPolygonOffset");
- glAPI->PolygonStipple = resolveSymbol(handle, "glPolygonStipple");
- glAPI->PopAttrib = resolveSymbol(handle, "glPopAttrib");
- glAPI->PopClientAttrib = resolveSymbol(handle, "glPopClientAttrib");
- glAPI->PopMatrix = resolveSymbol(handle, "glPopMatrix");
- glAPI->PopName = resolveSymbol(handle, "glPopName");
- glAPI->PrioritizeTextures = resolveSymbol(handle, "glPrioritizeTextures");
- glAPI->PushAttrib = resolveSymbol(handle, "glPushAttrib");
- glAPI->PushClientAttrib = resolveSymbol(handle, "glPushClientAttrib");
- glAPI->PushMatrix = resolveSymbol(handle, "glPushMatrix");
- glAPI->PushName = resolveSymbol(handle, "glPushName");
- glAPI->RasterPos2d = resolveSymbol(handle, "glRasterPos2d");
- glAPI->RasterPos2dv = resolveSymbol(handle, "glRasterPos2dv");
- glAPI->RasterPos2f = resolveSymbol(handle, "glRasterPos2f");
- glAPI->RasterPos2fv = resolveSymbol(handle, "glRasterPos2fv");
- glAPI->RasterPos2i = resolveSymbol(handle, "glRasterPos2i");
- glAPI->RasterPos2iv = resolveSymbol(handle, "glRasterPos2iv");
- glAPI->RasterPos2s = resolveSymbol(handle, "glRasterPos2s");
- glAPI->RasterPos2sv = resolveSymbol(handle, "glRasterPos2sv");
- glAPI->RasterPos3d = resolveSymbol(handle, "glRasterPos3d");
- glAPI->RasterPos3dv = resolveSymbol(handle, "glRasterPos3dv");
- glAPI->RasterPos3f = resolveSymbol(handle, "glRasterPos3f");
- glAPI->RasterPos3fv = resolveSymbol(handle, "glRasterPos3fv");
- glAPI->RasterPos3i = resolveSymbol(handle, "glRasterPos3i");
- glAPI->RasterPos3iv = resolveSymbol(handle, "glRasterPos3iv");
- glAPI->RasterPos3s = resolveSymbol(handle, "glRasterPos3s");
- glAPI->RasterPos3sv = resolveSymbol(handle, "glRasterPos3sv");
- glAPI->RasterPos4d = resolveSymbol(handle, "glRasterPos4d");
- glAPI->RasterPos4dv = resolveSymbol(handle, "glRasterPos4dv");
- glAPI->RasterPos4f = resolveSymbol(handle, "glRasterPos4f");
- glAPI->RasterPos4fv = resolveSymbol(handle, "glRasterPos4fv");
- glAPI->RasterPos4i = resolveSymbol(handle, "glRasterPos4i");
- glAPI->RasterPos4iv = resolveSymbol(handle, "glRasterPos4iv");
- glAPI->RasterPos4s = resolveSymbol(handle, "glRasterPos4s");
- glAPI->RasterPos4sv = resolveSymbol(handle, "glRasterPos4sv");
- glAPI->ReadBuffer = resolveSymbol(handle, "glReadBuffer");
- glAPI->ReadPixels = resolveSymbol(handle, "glReadPixels");
- glAPI->Rectd = resolveSymbol(handle, "glRectd");
- glAPI->Rectdv = resolveSymbol(handle, "glRectdv");
- glAPI->Rectf = resolveSymbol(handle, "glRectf");
- glAPI->Rectfv = resolveSymbol(handle, "glRectfv");
- glAPI->Recti = resolveSymbol(handle, "glRecti");
- glAPI->Rectiv = resolveSymbol(handle, "glRectiv");
- glAPI->Rects = resolveSymbol(handle, "glRects");
- glAPI->Rectsv = resolveSymbol(handle, "glRectsv");
- glAPI->RenderMode = resolveSymbol(handle, "glRenderMode");
- glAPI->Rotated = resolveSymbol(handle, "glRotated");
- glAPI->Rotatef = resolveSymbol(handle, "glRotatef");
- glAPI->Scaled = resolveSymbol(handle, "glScaled");
- glAPI->Scalef = resolveSymbol(handle, "glScalef");
- glAPI->Scissor = resolveSymbol(handle, "glScissor");
- glAPI->SelectBuffer = resolveSymbol(handle, "glSelectBuffer");
- glAPI->ShadeModel = resolveSymbol(handle, "glShadeModel");
- glAPI->StencilFunc = resolveSymbol(handle, "glStencilFunc");
- glAPI->StencilMask = resolveSymbol(handle, "glStencilMask");
- glAPI->StencilOp = resolveSymbol(handle, "glStencilOp");
- glAPI->TexCoord1d = resolveSymbol(handle, "glTexCoord1d");
- glAPI->TexCoord1dv = resolveSymbol(handle, "glTexCoord1dv");
- glAPI->TexCoord1f = resolveSymbol(handle, "glTexCoord1f");
- glAPI->TexCoord1fv = resolveSymbol(handle, "glTexCoord1fv");
- glAPI->TexCoord1i = resolveSymbol(handle, "glTexCoord1i");
- glAPI->TexCoord1iv = resolveSymbol(handle, "glTexCoord1iv");
- glAPI->TexCoord1s = resolveSymbol(handle, "glTexCoord1s");
- glAPI->TexCoord1sv = resolveSymbol(handle, "glTexCoord1sv");
- glAPI->TexCoord2d = resolveSymbol(handle, "glTexCoord2d");
- glAPI->TexCoord2dv = resolveSymbol(handle, "glTexCoord2dv");
- glAPI->TexCoord2f = resolveSymbol(handle, "glTexCoord2f");
- glAPI->TexCoord2fv = resolveSymbol(handle, "glTexCoord2fv");
- glAPI->TexCoord2i = resolveSymbol(handle, "glTexCoord2i");
- glAPI->TexCoord2iv = resolveSymbol(handle, "glTexCoord2iv");
- glAPI->TexCoord2s = resolveSymbol(handle, "glTexCoord2s");
- glAPI->TexCoord2sv = resolveSymbol(handle, "glTexCoord2sv");
- glAPI->TexCoord3d = resolveSymbol(handle, "glTexCoord3d");
- glAPI->TexCoord3dv = resolveSymbol(handle, "glTexCoord3dv");
- glAPI->TexCoord3f = resolveSymbol(handle, "glTexCoord3f");
- glAPI->TexCoord3fv = resolveSymbol(handle, "glTexCoord3fv");
- glAPI->TexCoord3i = resolveSymbol(handle, "glTexCoord3i");
- glAPI->TexCoord3iv = resolveSymbol(handle, "glTexCoord3iv");
- glAPI->TexCoord3s = resolveSymbol(handle, "glTexCoord3s");
- glAPI->TexCoord3sv = resolveSymbol(handle, "glTexCoord3sv");
- glAPI->TexCoord4d = resolveSymbol(handle, "glTexCoord4d");
- glAPI->TexCoord4dv = resolveSymbol(handle, "glTexCoord4dv");
- glAPI->TexCoord4f = resolveSymbol(handle, "glTexCoord4f");
- glAPI->TexCoord4fv = resolveSymbol(handle, "glTexCoord4fv");
- glAPI->TexCoord4i = resolveSymbol(handle, "glTexCoord4i");
- glAPI->TexCoord4iv = resolveSymbol(handle, "glTexCoord4iv");
- glAPI->TexCoord4s = resolveSymbol(handle, "glTexCoord4s");
- glAPI->TexCoord4sv = resolveSymbol(handle, "glTexCoord4sv");
- glAPI->TexCoordPointer = resolveSymbol(handle, "glTexCoordPointer");
- glAPI->TexEnvf = resolveSymbol(handle, "glTexEnvf");
- glAPI->TexEnvfv = resolveSymbol(handle, "glTexEnvfv");
- glAPI->TexEnvi = resolveSymbol(handle, "glTexEnvi");
- glAPI->TexEnviv = resolveSymbol(handle, "glTexEnviv");
- glAPI->TexGend = resolveSymbol(handle, "glTexGend");
- glAPI->TexGendv = resolveSymbol(handle, "glTexGendv");
- glAPI->TexGenf = resolveSymbol(handle, "glTexGenf");
- glAPI->TexGenfv = resolveSymbol(handle, "glTexGenfv");
- glAPI->TexGeni = resolveSymbol(handle, "glTexGeni");
- glAPI->TexGeniv = resolveSymbol(handle, "glTexGeniv");
- glAPI->TexImage1D = resolveSymbol(handle, "glTexImage1D");
- glAPI->TexImage2D = resolveSymbol(handle, "glTexImage2D");
- glAPI->TexParameterf = resolveSymbol(handle, "glTexParameterf");
- glAPI->TexParameterfv = resolveSymbol(handle, "glTexParameterfv");
- glAPI->TexParameteri = resolveSymbol(handle, "glTexParameteri");
- glAPI->TexParameteriv = resolveSymbol(handle, "glTexParameteriv");
- glAPI->TexSubImage1D = resolveSymbol(handle, "glTexSubImage1D");
- glAPI->TexSubImage2D = resolveSymbol(handle, "glTexSubImage2D");
- glAPI->Translated = resolveSymbol(handle, "glTranslated");
- glAPI->Translatef = resolveSymbol(handle, "glTranslatef");
- glAPI->Vertex2d = resolveSymbol(handle, "glVertex2d");
- glAPI->Vertex2dv = resolveSymbol(handle, "glVertex2dv");
- glAPI->Vertex2f = resolveSymbol(handle, "glVertex2f");
- glAPI->Vertex2fv = resolveSymbol(handle, "glVertex2fv");
- glAPI->Vertex2i = resolveSymbol(handle, "glVertex2i");
- glAPI->Vertex2iv = resolveSymbol(handle, "glVertex2iv");
- glAPI->Vertex2s = resolveSymbol(handle, "glVertex2s");
- glAPI->Vertex2sv = resolveSymbol(handle, "glVertex2sv");
- glAPI->Vertex3d = resolveSymbol(handle, "glVertex3d");
- glAPI->Vertex3dv = resolveSymbol(handle, "glVertex3dv");
- glAPI->Vertex3f = resolveSymbol(handle, "glVertex3f");
- glAPI->Vertex3fv = resolveSymbol(handle, "glVertex3fv");
- glAPI->Vertex3i = resolveSymbol(handle, "glVertex3i");
- glAPI->Vertex3iv = resolveSymbol(handle, "glVertex3iv");
- glAPI->Vertex3s = resolveSymbol(handle, "glVertex3s");
- glAPI->Vertex3sv = resolveSymbol(handle, "glVertex3sv");
- glAPI->Vertex4d = resolveSymbol(handle, "glVertex4d");
- glAPI->Vertex4dv = resolveSymbol(handle, "glVertex4dv");
- glAPI->Vertex4f = resolveSymbol(handle, "glVertex4f");
- glAPI->Vertex4fv = resolveSymbol(handle, "glVertex4fv");
- glAPI->Vertex4i = resolveSymbol(handle, "glVertex4i");
- glAPI->Vertex4iv = resolveSymbol(handle, "glVertex4iv");
- glAPI->Vertex4s = resolveSymbol(handle, "glVertex4s");
- glAPI->Vertex4sv = resolveSymbol(handle, "glVertex4sv");
- glAPI->VertexPointer = resolveSymbol(handle, "glVertexPointer");
- glAPI->Viewport = resolveSymbol(handle, "glViewport");
-#else
-
- XMesaAPI->InitDriver = XMesaInitDriver;
- XMesaAPI->ResetDriver = XMesaResetDriver;
- XMesaAPI->CreateVisual = XMesaCreateVisual;
- XMesaAPI->DestroyVisual = XMesaDestroyVisual;
- XMesaAPI->CreateContext = XMesaCreateContext;
- XMesaAPI->DestroyContext = XMesaDestroyContext;
- XMesaAPI->CreateWindowBuffer = XMesaCreateWindowBuffer;
- XMesaAPI->CreatePixmapBuffer = XMesaCreatePixmapBuffer;
- XMesaAPI->DestroyBuffer = XMesaDestroyBuffer;
- XMesaAPI->SwapBuffers = XMesaSwapBuffers;
- XMesaAPI->MakeCurrent = XMesaMakeCurrent;
- XMesaAPI->UnbindContext = XMesaUnbindContext;
-
- glAPI->Accum = __glAccum;
- glAPI->AlphaFunc = __glAlphaFunc;
- glAPI->AreTexturesResident = __glAreTexturesResident;
- glAPI->ArrayElement = __glArrayElement;
- glAPI->Begin = __glBegin;
- glAPI->BindTexture = __glBindTexture;
- glAPI->Bitmap = __glBitmap;
- glAPI->BlendFunc = __glBlendFunc;
- glAPI->CallList = __glCallList;
- glAPI->CallLists = __glCallLists;
- glAPI->Clear = __glClear;
- glAPI->ClearAccum = __glClearAccum;
- glAPI->ClearColor = __glClearColor;
- glAPI->ClearDepth = __glClearDepth;
- glAPI->ClearIndex = __glClearIndex;
- glAPI->ClearStencil = __glClearStencil;
- glAPI->ClipPlane = __glClipPlane;
- glAPI->Color3b = __glColor3b;
- glAPI->Color3bv = __glColor3bv;
- glAPI->Color3d = __glColor3d;
- glAPI->Color3dv = __glColor3dv;
- glAPI->Color3f = __glColor3f;
- glAPI->Color3fv = __glColor3fv;
- glAPI->Color3i = __glColor3i;
- glAPI->Color3iv = __glColor3iv;
- glAPI->Color3s = __glColor3s;
- glAPI->Color3sv = __glColor3sv;
- glAPI->Color3ub = __glColor3ub;
- glAPI->Color3ubv = __glColor3ubv;
- glAPI->Color3ui = __glColor3ui;
- glAPI->Color3uiv = __glColor3uiv;
- glAPI->Color3us = __glColor3us;
- glAPI->Color3usv = __glColor3usv;
- glAPI->Color4b = __glColor4b;
- glAPI->Color4bv = __glColor4bv;
- glAPI->Color4d = __glColor4d;
- glAPI->Color4dv = __glColor4dv;
- glAPI->Color4f = __glColor4f;
- glAPI->Color4fv = __glColor4fv;
- glAPI->Color4i = __glColor4i;
- glAPI->Color4iv = __glColor4iv;
- glAPI->Color4s = __glColor4s;
- glAPI->Color4sv = __glColor4sv;
- glAPI->Color4ub = __glColor4ub;
- glAPI->Color4ubv = __glColor4ubv;
- glAPI->Color4ui = __glColor4ui;
- glAPI->Color4uiv = __glColor4uiv;
- glAPI->Color4us = __glColor4us;
- glAPI->Color4usv = __glColor4usv;
- glAPI->ColorMask = __glColorMask;
- glAPI->ColorMaterial = __glColorMaterial;
- glAPI->ColorPointer = __glColorPointer;
- glAPI->CopyPixels = __glCopyPixels;
- glAPI->CopyTexImage1D = __glCopyTexImage1D;
- glAPI->CopyTexImage2D = __glCopyTexImage2D;
- glAPI->CopyTexSubImage1D = __glCopyTexSubImage1D;
- glAPI->CopyTexSubImage2D = __glCopyTexSubImage2D;
- glAPI->CullFace = __glCullFace;
- glAPI->DeleteLists = __glDeleteLists;
- glAPI->DeleteTextures = __glDeleteTextures;
- glAPI->DepthFunc = __glDepthFunc;
- glAPI->DepthMask = __glDepthMask;
- glAPI->DepthRange = __glDepthRange;
- glAPI->Disable = __glDisable;
- glAPI->DisableClientState = __glDisableClientState;
- glAPI->DrawArrays = __glDrawArrays;
- glAPI->DrawBuffer = __glDrawBuffer;
- glAPI->DrawElements = __glDrawElements;
- glAPI->DrawPixels = __glDrawPixels;
- glAPI->EdgeFlag = __glEdgeFlag;
- glAPI->EdgeFlagPointer = __glEdgeFlagPointer;
- glAPI->EdgeFlagv = __glEdgeFlagv;
- glAPI->Enable = __glEnable;
- glAPI->EnableClientState = __glEnableClientState;
- glAPI->End = __glEnd;
- glAPI->EndList = __glEndList;
- glAPI->EvalCoord1d = __glEvalCoord1d;
- glAPI->EvalCoord1dv = __glEvalCoord1dv;
- glAPI->EvalCoord1f = __glEvalCoord1f;
- glAPI->EvalCoord1fv = __glEvalCoord1fv;
- glAPI->EvalCoord2d = __glEvalCoord2d;
- glAPI->EvalCoord2dv = __glEvalCoord2dv;
- glAPI->EvalCoord2f = __glEvalCoord2f;
- glAPI->EvalCoord2fv = __glEvalCoord2fv;
- glAPI->EvalMesh1 = __glEvalMesh1;
- glAPI->EvalMesh2 = __glEvalMesh2;
- glAPI->EvalPoint1 = __glEvalPoint1;
- glAPI->EvalPoint2 = __glEvalPoint2;
- glAPI->FeedbackBuffer = __glFeedbackBuffer;
- glAPI->Finish = __glFinish;
- glAPI->Flush = __glFlush;
- glAPI->Fogf = __glFogf;
- glAPI->Fogfv = __glFogfv;
- glAPI->Fogi = __glFogi;
- glAPI->Fogiv = __glFogiv;
- glAPI->FrontFace = __glFrontFace;
- glAPI->Frustum = __glFrustum;
- glAPI->GenLists = __glGenLists;
- glAPI->GenTextures = __glGenTextures;
- glAPI->GetBooleanv = __glGetBooleanv;
- glAPI->GetClipPlane = __glGetClipPlane;
- glAPI->GetDoublev = __glGetDoublev;
- glAPI->GetError = __glGetError;
- glAPI->GetFloatv = __glGetFloatv;
- glAPI->GetIntegerv = __glGetIntegerv;
- glAPI->GetLightfv = __glGetLightfv;
- glAPI->GetLightiv = __glGetLightiv;
- glAPI->GetMapdv = __glGetMapdv;
- glAPI->GetMapfv = __glGetMapfv;
- glAPI->GetMapiv = __glGetMapiv;
- glAPI->GetMaterialfv = __glGetMaterialfv;
- glAPI->GetMaterialiv = __glGetMaterialiv;
- glAPI->GetPixelMapfv = __glGetPixelMapfv;
- glAPI->GetPixelMapuiv = __glGetPixelMapuiv;
- glAPI->GetPixelMapusv = __glGetPixelMapusv;
- glAPI->GetPointerv = __glGetPointerv;
- glAPI->GetPolygonStipple = __glGetPolygonStipple;
- glAPI->GetString = __glGetString;
- glAPI->GetTexEnvfv = __glGetTexEnvfv;
- glAPI->GetTexEnviv = __glGetTexEnviv;
- glAPI->GetTexGendv = __glGetTexGendv;
- glAPI->GetTexGenfv = __glGetTexGenfv;
- glAPI->GetTexGeniv = __glGetTexGeniv;
- glAPI->GetTexImage = __glGetTexImage;
- glAPI->GetTexLevelParameterfv = __glGetTexLevelParameterfv;
- glAPI->GetTexLevelParameteriv = __glGetTexLevelParameteriv;
- glAPI->GetTexParameterfv = __glGetTexParameterfv;
- glAPI->GetTexParameteriv = __glGetTexParameteriv;
- glAPI->Hint = __glHint;
- glAPI->IndexMask = __glIndexMask;
- glAPI->IndexPointer = __glIndexPointer;
- glAPI->Indexd = __glIndexd;
- glAPI->Indexdv = __glIndexdv;
- glAPI->Indexf = __glIndexf;
- glAPI->Indexfv = __glIndexfv;
- glAPI->Indexi = __glIndexi;
- glAPI->Indexiv = __glIndexiv;
- glAPI->Indexs = __glIndexs;
- glAPI->Indexsv = __glIndexsv;
- glAPI->Indexub = __glIndexub;
- glAPI->Indexubv = __glIndexubv;
- glAPI->InitNames = __glInitNames;
- glAPI->InterleavedArrays = __glInterleavedArrays;
- glAPI->IsEnabled = __glIsEnabled;
- glAPI->IsList = __glIsList;
- glAPI->IsTexture = __glIsTexture;
- glAPI->LightModelf = __glLightModelf;
- glAPI->LightModelfv = __glLightModelfv;
- glAPI->LightModeli = __glLightModeli;
- glAPI->LightModeliv = __glLightModeliv;
- glAPI->Lightf = __glLightf;
- glAPI->Lightfv = __glLightfv;
- glAPI->Lighti = __glLighti;
- glAPI->Lightiv = __glLightiv;
- glAPI->LineStipple = __glLineStipple;
- glAPI->LineWidth = __glLineWidth;
- glAPI->ListBase = __glListBase;
- glAPI->LoadIdentity = __glLoadIdentity;
- glAPI->LoadMatrixd = __glLoadMatrixd;
- glAPI->LoadMatrixf = __glLoadMatrixf;
- glAPI->LoadName = __glLoadName;
- glAPI->LogicOp = __glLogicOp;
- glAPI->Map1d = __glMap1d;
- glAPI->Map1f = __glMap1f;
- glAPI->Map2d = __glMap2d;
- glAPI->Map2f = __glMap2f;
- glAPI->MapGrid1d = __glMapGrid1d;
- glAPI->MapGrid1f = __glMapGrid1f;
- glAPI->MapGrid2d = __glMapGrid2d;
- glAPI->MapGrid2f = __glMapGrid2f;
- glAPI->Materialf = __glMaterialf;
- glAPI->Materialfv = __glMaterialfv;
- glAPI->Materiali = __glMateriali;
- glAPI->Materialiv = __glMaterialiv;
- glAPI->MatrixMode = __glMatrixMode;
- glAPI->MultMatrixd = __glMultMatrixd;
- glAPI->MultMatrixf = __glMultMatrixf;
- glAPI->NewList = __glNewList;
- glAPI->Normal3b = __glNormal3b;
- glAPI->Normal3bv = __glNormal3bv;
- glAPI->Normal3d = __glNormal3d;
- glAPI->Normal3dv = __glNormal3dv;
- glAPI->Normal3f = __glNormal3f;
- glAPI->Normal3fv = __glNormal3fv;
- glAPI->Normal3i = __glNormal3i;
- glAPI->Normal3iv = __glNormal3iv;
- glAPI->Normal3s = __glNormal3s;
- glAPI->Normal3sv = __glNormal3sv;
- glAPI->NormalPointer = __glNormalPointer;
- glAPI->Ortho = __glOrtho;
- glAPI->PassThrough = __glPassThrough;
- glAPI->PixelMapfv = __glPixelMapfv;
- glAPI->PixelMapuiv = __glPixelMapuiv;
- glAPI->PixelMapusv = __glPixelMapusv;
- glAPI->PixelStoref = __glPixelStoref;
- glAPI->PixelStorei = __glPixelStorei;
- glAPI->PixelTransferf = __glPixelTransferf;
- glAPI->PixelTransferi = __glPixelTransferi;
- glAPI->PixelZoom = __glPixelZoom;
- glAPI->PointSize = __glPointSize;
- glAPI->PolygonMode = __glPolygonMode;
- glAPI->PolygonOffset = __glPolygonOffset;
- glAPI->PolygonStipple = __glPolygonStipple;
- glAPI->PopAttrib = __glPopAttrib;
- glAPI->PopClientAttrib = __glPopClientAttrib;
- glAPI->PopMatrix = __glPopMatrix;
- glAPI->PopName = __glPopName;
- glAPI->PrioritizeTextures = __glPrioritizeTextures;
- glAPI->PushAttrib = __glPushAttrib;
- glAPI->PushClientAttrib = __glPushClientAttrib;
- glAPI->PushMatrix = __glPushMatrix;
- glAPI->PushName = __glPushName;
- glAPI->RasterPos2d = __glRasterPos2d;
- glAPI->RasterPos2dv = __glRasterPos2dv;
- glAPI->RasterPos2f = __glRasterPos2f;
- glAPI->RasterPos2fv = __glRasterPos2fv;
- glAPI->RasterPos2i = __glRasterPos2i;
- glAPI->RasterPos2iv = __glRasterPos2iv;
- glAPI->RasterPos2s = __glRasterPos2s;
- glAPI->RasterPos2sv = __glRasterPos2sv;
- glAPI->RasterPos3d = __glRasterPos3d;
- glAPI->RasterPos3dv = __glRasterPos3dv;
- glAPI->RasterPos3f = __glRasterPos3f;
- glAPI->RasterPos3fv = __glRasterPos3fv;
- glAPI->RasterPos3i = __glRasterPos3i;
- glAPI->RasterPos3iv = __glRasterPos3iv;
- glAPI->RasterPos3s = __glRasterPos3s;
- glAPI->RasterPos3sv = __glRasterPos3sv;
- glAPI->RasterPos4d = __glRasterPos4d;
- glAPI->RasterPos4dv = __glRasterPos4dv;
- glAPI->RasterPos4f = __glRasterPos4f;
- glAPI->RasterPos4fv = __glRasterPos4fv;
- glAPI->RasterPos4i = __glRasterPos4i;
- glAPI->RasterPos4iv = __glRasterPos4iv;
- glAPI->RasterPos4s = __glRasterPos4s;
- glAPI->RasterPos4sv = __glRasterPos4sv;
- glAPI->ReadBuffer = __glReadBuffer;
- glAPI->ReadPixels = __glReadPixels;
- glAPI->Rectd = __glRectd;
- glAPI->Rectdv = __glRectdv;
- glAPI->Rectf = __glRectf;
- glAPI->Rectfv = __glRectfv;
- glAPI->Recti = __glRecti;
- glAPI->Rectiv = __glRectiv;
- glAPI->Rects = __glRects;
- glAPI->Rectsv = __glRectsv;
- glAPI->RenderMode = __glRenderMode;
- glAPI->Rotated = __glRotated;
- glAPI->Rotatef = __glRotatef;
- glAPI->Scaled = __glScaled;
- glAPI->Scalef = __glScalef;
- glAPI->Scissor = __glScissor;
- glAPI->SelectBuffer = __glSelectBuffer;
- glAPI->ShadeModel = __glShadeModel;
- glAPI->StencilFunc = __glStencilFunc;
- glAPI->StencilMask = __glStencilMask;
- glAPI->StencilOp = __glStencilOp;
- glAPI->TexCoord1d = __glTexCoord1d;
- glAPI->TexCoord1dv = __glTexCoord1dv;
- glAPI->TexCoord1f = __glTexCoord1f;
- glAPI->TexCoord1fv = __glTexCoord1fv;
- glAPI->TexCoord1i = __glTexCoord1i;
- glAPI->TexCoord1iv = __glTexCoord1iv;
- glAPI->TexCoord1s = __glTexCoord1s;
- glAPI->TexCoord1sv = __glTexCoord1sv;
- glAPI->TexCoord2d = __glTexCoord2d;
- glAPI->TexCoord2dv = __glTexCoord2dv;
- glAPI->TexCoord2f = __glTexCoord2f;
- glAPI->TexCoord2fv = __glTexCoord2fv;
- glAPI->TexCoord2i = __glTexCoord2i;
- glAPI->TexCoord2iv = __glTexCoord2iv;
- glAPI->TexCoord2s = __glTexCoord2s;
- glAPI->TexCoord2sv = __glTexCoord2sv;
- glAPI->TexCoord3d = __glTexCoord3d;
- glAPI->TexCoord3dv = __glTexCoord3dv;
- glAPI->TexCoord3f = __glTexCoord3f;
- glAPI->TexCoord3fv = __glTexCoord3fv;
- glAPI->TexCoord3i = __glTexCoord3i;
- glAPI->TexCoord3iv = __glTexCoord3iv;
- glAPI->TexCoord3s = __glTexCoord3s;
- glAPI->TexCoord3sv = __glTexCoord3sv;
- glAPI->TexCoord4d = __glTexCoord4d;
- glAPI->TexCoord4dv = __glTexCoord4dv;
- glAPI->TexCoord4f = __glTexCoord4f;
- glAPI->TexCoord4fv = __glTexCoord4fv;
- glAPI->TexCoord4i = __glTexCoord4i;
- glAPI->TexCoord4iv = __glTexCoord4iv;
- glAPI->TexCoord4s = __glTexCoord4s;
- glAPI->TexCoord4sv = __glTexCoord4sv;
- glAPI->TexCoordPointer = __glTexCoordPointer;
- glAPI->TexEnvf = __glTexEnvf;
- glAPI->TexEnvfv = __glTexEnvfv;
- glAPI->TexEnvi = __glTexEnvi;
- glAPI->TexEnviv = __glTexEnviv;
- glAPI->TexGend = __glTexGend;
- glAPI->TexGendv = __glTexGendv;
- glAPI->TexGenf = __glTexGenf;
- glAPI->TexGenfv = __glTexGenfv;
- glAPI->TexGeni = __glTexGeni;
- glAPI->TexGeniv = __glTexGeniv;
- glAPI->TexImage1D = __glTexImage1D;
- glAPI->TexImage2D = __glTexImage2D;
- glAPI->TexParameterf = __glTexParameterf;
- glAPI->TexParameterfv = __glTexParameterfv;
- glAPI->TexParameteri = __glTexParameteri;
- glAPI->TexParameteriv = __glTexParameteriv;
- glAPI->TexSubImage1D = __glTexSubImage1D;
- glAPI->TexSubImage2D = __glTexSubImage2D;
- glAPI->Translated = __glTranslated;
- glAPI->Translatef = __glTranslatef;
- glAPI->Vertex2d = __glVertex2d;
- glAPI->Vertex2dv = __glVertex2dv;
- glAPI->Vertex2f = __glVertex2f;
- glAPI->Vertex2fv = __glVertex2fv;
- glAPI->Vertex2i = __glVertex2i;
- glAPI->Vertex2iv = __glVertex2iv;
- glAPI->Vertex2s = __glVertex2s;
- glAPI->Vertex2sv = __glVertex2sv;
- glAPI->Vertex3d = __glVertex3d;
- glAPI->Vertex3dv = __glVertex3dv;
- glAPI->Vertex3f = __glVertex3f;
- glAPI->Vertex3fv = __glVertex3fv;
- glAPI->Vertex3i = __glVertex3i;
- glAPI->Vertex3iv = __glVertex3iv;
- glAPI->Vertex3s = __glVertex3s;
- glAPI->Vertex3sv = __glVertex3sv;
- glAPI->Vertex4d = __glVertex4d;
- glAPI->Vertex4dv = __glVertex4dv;
- glAPI->Vertex4f = __glVertex4f;
- glAPI->Vertex4fv = __glVertex4fv;
- glAPI->Vertex4i = __glVertex4i;
- glAPI->Vertex4iv = __glVertex4iv;
- glAPI->Vertex4s = __glVertex4s;
- glAPI->Vertex4sv = __glVertex4sv;
- glAPI->VertexPointer = __glVertexPointer;
- glAPI->Viewport = __glViewport;
-
- handle = (void *)1;
-#endif
-
- if (dlopen_error) {
- return NULL;
- }
-
- return handle;
-}
-
-void driMesaDestroyAPI(void *handle)
-{
-#ifdef GLX_USE_DLOPEN
- if (handle) dlclose(handle);
-#endif
-}
-
-#endif
diff --git a/xc/lib/GL/dri/dri_xmesaapi.h b/xc/lib/GL/dri/dri_xmesaapi.h
deleted file mode 100644
index a71704987..000000000
--- a/xc/lib/GL/dri/dri_xmesaapi.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/dri_xmesaapi.h,v 1.1 1999/06/14 07:23:33 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>
- *
- * $PI: xc/lib/GL/dri/dri_xmesaapi.h,v 1.4 1999/04/05 05:24:31 martin Exp $
- */
-
-#ifndef _DRI_XMESAAPI_H_
-#define _DRI_XMESAAPI_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "GL/xmesa.h"
-#include "dri_mesa.h"
-
-typedef struct __XMESAapiRec __XMESAapi;
-
-struct __XMESAapiRec {
- /* XMESA Functions */
- GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv);
- void (*ResetDriver)(__DRIscreenPrivate *driScrnPriv);
- XMesaVisual (*CreateVisual)(XMesaDisplay *display,
- XMesaVisualInfo visinfo,
- GLboolean rgb_flag,
- GLboolean alpha_flag,
- GLboolean db_flag,
- GLboolean stereo_flag,
- GLboolean ximage_flag,
- GLint depth_size,
- GLint stencil_size,
- GLint accum_size,
- GLint level);
- void (*DestroyVisual)(XMesaVisual v);
- XMesaContext (*CreateContext)(XMesaVisual v, XMesaContext share_list,
- __DRIcontextPrivate *driContextPriv);
- void (*DestroyContext)(XMesaContext c);
- XMesaBuffer (*CreateWindowBuffer)(XMesaVisual v, XMesaWindow w,
- __DRIdrawablePrivate *driDrawPriv);
- XMesaBuffer (*CreatePixmapBuffer)(XMesaVisual v, XMesaPixmap p,
- XMesaColormap c,
- __DRIdrawablePrivate *driDrawPriv);
- void (*DestroyBuffer)(XMesaBuffer b);
- void (*SwapBuffers)(XMesaBuffer b);
- GLboolean (*MakeCurrent)(XMesaContext c, XMesaBuffer b);
- GLboolean (*UnbindContext)(XMesaContext c);
-};
-
-#endif
-#endif /* _DRI_XMESAAPI_H_ */
diff --git a/xc/lib/GL/glx/Imakefile b/xc/lib/GL/glx/Imakefile
index 72312ca1d..9ca788e73 100644
--- a/xc/lib/GL/glx/Imakefile
+++ b/xc/lib/GL/glx/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/glx/Imakefile,v 1.3 1999/12/14 01:32:23 robin Exp $
+XCOMM $XFree86: xc/lib/GL/glx/Imakefile,v 1.8 2000/02/15 19:19:17 dawes Exp $
XCOMM The contents of this file are subject to the GLX Public License Version 1.0
XCOMM (the "License"). You may not use this file except in compliance with the
XCOMM License. You may obtain a copy of the License at Silicon Graphics, Inc.,
diff --git a/xc/lib/GL/glx/clientattrib.c b/xc/lib/GL/glx/clientattrib.c
index 83fd20a14..0e23c09ad 100644
--- a/xc/lib/GL/glx/clientattrib.c
+++ b/xc/lib/GL/glx/clientattrib.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.2 1999/06/14 07:23:34 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.4 2000/02/18 16:23:09 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c
index 034452c27..79e453af2 100644
--- a/xc/lib/GL/glx/glxcmds.c
+++ b/xc/lib/GL/glx/glxcmds.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.4 1999/12/14 01:32:23 robin Exp $ */
+/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.7 2000/02/21 18:05:33 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c
index e76fe7c22..2367f49a0 100644
--- a/xc/lib/GL/glx/glxext.c
+++ b/xc/lib/GL/glx/glxext.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.3 1999/12/14 01:32:24 robin Exp $ */
+/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.6 2000/02/15 19:19:18 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
diff --git a/xc/lib/GL/glx/indirect.h b/xc/lib/GL/glx/indirect.h
index 40aeb57b1..4e18e0cde 100644
--- a/xc/lib/GL/glx/indirect.h
+++ b/xc/lib/GL/glx/indirect.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/indirect.h,v 1.1 1999/06/14 07:23:37 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/indirect.h,v 1.2 2000/02/15 19:19:18 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/lib/GL/glx/indirect_init.c b/xc/lib/GL/glx/indirect_init.c
index 84d5e59fc..8c8227a5b 100644
--- a/xc/lib/GL/glx/indirect_init.c
+++ b/xc/lib/GL/glx/indirect_init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/indirect_init.c,v 1.1 1999/06/14 07:23:37 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/indirect_init.c,v 1.4 2000/02/15 19:19:19 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/lib/GL/glx/indirect_init.h b/xc/lib/GL/glx/indirect_init.h
index 766eefd9d..46eade8c5 100644
--- a/xc/lib/GL/glx/indirect_init.h
+++ b/xc/lib/GL/glx/indirect_init.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/indirect_init.h,v 1.1 1999/06/14 07:23:37 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/indirect_init.h,v 1.3 2000/02/15 19:19:19 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/lib/GL/glx/indirect_wrap.h b/xc/lib/GL/glx/indirect_wrap.h
index 7875509da..047576157 100644
--- a/xc/lib/GL/glx/indirect_wrap.h
+++ b/xc/lib/GL/glx/indirect_wrap.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/indirect_wrap.h,v 1.1 1999/06/14 07:23:38 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/indirect_wrap.h,v 1.3 2000/02/15 19:19:19 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/lib/GL/glx/packrender.h b/xc/lib/GL/glx/packrender.h
index 66beb0510..cc699ada5 100644
--- a/xc/lib/GL/glx/packrender.h
+++ b/xc/lib/GL/glx/packrender.h
@@ -1,7 +1,7 @@
#ifndef __GLX_packrender_h__
#define __GLX_packrender_h__
-/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.2 1999/06/14 07:23:38 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.5 2000/02/18 16:23:10 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/packsingle.h b/xc/lib/GL/glx/packsingle.h
index d774db7f2..830944262 100644
--- a/xc/lib/GL/glx/packsingle.h
+++ b/xc/lib/GL/glx/packsingle.h
@@ -1,7 +1,7 @@
#ifndef __GLX_packsingle_h__
#define __GLX_packsingle_h__
-/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.2 1999/06/14 07:23:38 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.3 2000/02/08 17:18:33 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/packvendpriv.h b/xc/lib/GL/glx/packvendpriv.h
index 74bd6d82b..aa3cf8146 100644
--- a/xc/lib/GL/glx/packvendpriv.h
+++ b/xc/lib/GL/glx/packvendpriv.h
@@ -1,7 +1,7 @@
#ifndef __GLX_packvendpriv_h__
#define __GLX_packvendpriv_h__
-/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.2 1999/06/14 07:23:38 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.3 2000/02/08 17:18:34 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/pixel.c b/xc/lib/GL/glx/pixel.c
index 5f6a2f0ec..a1dd3637c 100644
--- a/xc/lib/GL/glx/pixel.c
+++ b/xc/lib/GL/glx/pixel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.2 1999/06/14 07:23:38 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.3 2000/02/08 17:18:34 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
diff --git a/xc/lib/GL/glx/xfont.c b/xc/lib/GL/glx/xfont.c
index 6e063a84c..c242239d7 100644
--- a/xc/lib/GL/glx/xfont.c
+++ b/xc/lib/GL/glx/xfont.c
@@ -1,4 +1,4 @@
-/* $Id: xfont.c,v 1.1 1999/12/08 00:51:37 daryll Exp $ */
+/* $Id: xfont.c,v 1.2 2000/02/22 22:10:27 kem Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile
index 41562f4f2..b3dade36c 100644
--- a/xc/lib/GL/mesa/src/Imakefile
+++ b/xc/lib/GL/mesa/src/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.5 1999/12/14 01:32:25 robin Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.9 2000/02/15 07:13:29 martin Exp $
#include <Threads.tmpl>
diff --git a/xc/lib/GL/mesa/src/X/Imakefile b/xc/lib/GL/mesa/src/X/Imakefile
index ef7e1bfc2..b01a469e9 100644
--- a/xc/lib/GL/mesa/src/X/Imakefile
+++ b/xc/lib/GL/mesa/src/X/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.3 1999/12/14 01:33:34 robin Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X/Imakefile,v 1.4 2000/02/08 17:18:40 dawes Exp $
XCOMM $PI: xc/lib/GL/mesa/src/X/Imakefile,v 1.4 1999/06/21 05:13:55 martin Exp $
#define DoNormalLib NormalLibGlx
diff --git a/xc/lib/GL/mesa/src/X86/Imakefile b/xc/lib/GL/mesa/src/X86/Imakefile
index a40d88271..99dfd8ea8 100644
--- a/xc/lib/GL/mesa/src/X86/Imakefile
+++ b/xc/lib/GL/mesa/src/X86/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.3 1999/06/27 14:07:25 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.4 2000/02/18 16:23:10 dawes Exp $
#define DoNormalLib NormalLibGlx
#define DoSharedLib SharedLibGlx
diff --git a/xc/lib/GL/mesa/src/drv/Imakefile b/xc/lib/GL/mesa/src/drv/Imakefile
index d22e1576c..471021749 100644
--- a/xc/lib/GL/mesa/src/drv/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.4 1999/12/29 00:44:13 robin Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.6 2000/02/14 06:27:12 martin Exp $
XCOMM $PI: xc/lib/GL/mesa/src/drv/Imakefile,v 1.3 1999/06/14 21:10:41 faith Exp $
#define DoNormalLib NormalLibGlx
diff --git a/xc/lib/GL/mesa/src/drv/common/Imakefile b/xc/lib/GL/mesa/src/drv/common/Imakefile
new file mode 100644
index 000000000..2bd674ffd
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/Imakefile
@@ -0,0 +1,56 @@
+XCOMM $PI:$
+
+#define DoNormalLib NormalLibGlx
+#define DoSharedLib SharedLibGlx
+#define DoExtraLib SharedLibGlx
+#define DoDebugLib DebugLibGlx
+#define DoProfileLib ProfileLibGlx
+
+#if Malloc0ReturnsNull
+ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
+#endif
+
+#if BuildXF86DRI
+ DRI_DEFINES = GlxDefines -DDRIVERTS
+ DRI_INCLUDES = -I../../../../dri -I../../../../glx \
+ -I$(TOP)/include -I$(TOP)/include/GL \
+ -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \
+ -I../../../include -I../.. -I../common -I../../X
+#endif
+
+MESA_INCLUDES = -I. -I.. -I../../include
+
+
+
+ DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES)
+ INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) \
+ -I/usr/include/glide
+ DRISRCS = hwlog.c mm.c
+ DRIOBJS = hwlog.o mm.o
+
+ SRCS = $(DRISRCS)
+ OBJS = $(DRIOBJS)
+
+#if !GlxUseBuiltInDRIDriver
+#undef DoNormalLib NormalLibGlx
+#undef DoExtraLib SharedLibGlx
+#undef DoDebugLib DebugLibGlx
+#undef DoProfileLib ProfileLibGlx
+#endif
+
+#include <Library.tmpl>
+
+LibraryObjectRule()
+
+SubdirLibraryRule($(OBJS))
+NormalLintTarget($(SRCS))
+
+#if !GlxUseBuiltInDRIDriver
+LIBNAME = i810_dri.so
+ALL_OBJS = $(OBJS)
+ALL_DEPS = DONE
+SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS))
+InstallDynamicModule($(LIBNAME),$(MODULEDIR),.)
+#endif
+
+DependTarget()
diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.c b/xc/lib/GL/mesa/src/drv/common/hwlog.c
new file mode 100644
index 000000000..d8d69703a
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/hwlog.c
@@ -0,0 +1,107 @@
+/*
+ * 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>
+ */
+
+#include "hwlog.h"
+hwlog_t hwlog = { 0,0,0, "[???] "};
+
+
+/* Should be shared, but is this a good place for it?
+ */
+#include <sys/time.h>
+
+
+int usec( void )
+{
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday( &tv, &tz );
+
+ return (tv.tv_sec & 2047) * 1000000 + tv.tv_usec;
+}
+
+
+#ifdef HW_LOG_ENABLED
+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);
+ }
+}
+
+#else /* ifdef HW_LOG_ENABLED */
+
+int hwlogdummy()
+{
+ return 0;
+}
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.h b/xc/lib/GL/mesa/src/drv/common/hwlog.h
new file mode 100644
index 000000000..42e378afd
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/hwlog.h
@@ -0,0 +1,115 @@
+/*
+ * 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>
+ */
+
+/* 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 <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
+#include <stdarg.h>
+
+/* open and close log file. */
+int hwOpenLog(const char *filename, char *prefix);
+void hwCloseLog();
+
+/* return 1 if log file is succesfully opened */
+int hwIsLogReady();
+
+/* 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();
+
+/* 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. */
+#define hwMsg(level_,format, args...) if ( level_ <= hwlog.level ) { \
+ if (hwIsLogReady()) { \
+ int __t=usec();hwLog(level_,"%6i:",__t-hwlog.timeTemp);hwlog.timeTemp=__t; \
+ hwLog(level_,format, ## args); \
+ } else { \
+ if (level_ <= hwGetLogLevel()) { \
+ fprintf(stderr,hwlog.prefix); \
+ fprintf(stderr,format, ## args); \
+ } \
+ } \
+}
+
+#define hwError(format, args...) do { \
+ fprintf(stderr, hwlog.prefix); \
+ fprintf(stderr, format, ## args); \
+ hwLog(0,format, ## args); \
+} while(0)
+
+#else
+
+static __inline__ int hwOpenLog(const char *f, char *prefix) { hwlog.prefix=prefix; return -1; }
+static __inline__ int hwIsLogReady( void ) { return 0; }
+static __inline__ int hwGetLogLevel( void ) { return -1; }
+static __inline__ int hwLogLevel(int level) { return 0; }
+
+#define hwCloseLog()
+#define hwSetLogLevel(x)
+#define hwLog(l,f,a...)
+#define hwLogv(l,f,a)
+#define hwMsg(l,f,a...)
+
+#define hwError(format, args...) do { \
+ fprintf(stderr, hwlog.prefix); \
+ fprintf(stderr, format, ## args); \
+} while(0)
+
+#endif
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/common/mm.c b/xc/lib/GL/mesa/src/drv/common/mm.c
new file mode 100644
index 000000000..c4ff8ae71
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/mm.c
@@ -0,0 +1,262 @@
+/*
+ * 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.
+ *
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mm.h"
+#include "hwlog.h"
+
+#define ISFREE(bptr) ((bptr)->free)
+/* #define PRINTF(f,a...) hwMsg(1,f, ## a) */
+#define PRINTF(f,a...) fprintf(stderr, f, ## a)
+
+void mmDumpMemInfo( memHeap_t *heap )
+{
+ TMemBlock *p;
+
+ PRINTF("Memory heap %p:\n", heap);
+ if (heap == 0) {
+ PRINTF(" heap == 0\n");
+ } else {
+ p = (TMemBlock *)heap;
+ while (p) {
+ PRINTF(" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+ p->free ? '.':'U',
+ p->reserved ? 'R':'.');
+ p = p->next;
+ }
+ }
+ PRINTF("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;
+}
+
+/* Kludgey workaround for existing i810 server. Remove soon.
+ */
+memHeap_t *mmAddRange( memHeap_t *heap,
+ int ofs,
+ int size )
+{
+ PMemBlock blocks;
+ blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock));
+ if (blocks) {
+ blocks[0].size = size;
+ blocks[0].free = 1;
+ blocks[0].ofs = ofs;
+ blocks[0].next = &blocks[1];
+
+ /* Discontinuity - stops JoinBlock from trying to join non-adjacent
+ * ranges.
+ */
+ blocks[1].size = 0;
+ blocks[1].free = 0;
+ blocks[1].ofs = ofs+size;
+ blocks[1].next = (PMemBlock) heap;
+ return (memHeap_t *)blocks;
+ }
+ else
+ return heap;
+}
+
+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));
+ 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));
+ 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 (ISFREE(p)) {
+ 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;
+}
+
+int mmReserveMem(memHeap_t *heap, int offset,int size)
+{
+ int endofs;
+ TMemBlock *p;
+
+ if (!heap || size <= 0)
+ return -1;
+ endofs = offset+size;
+ p = (TMemBlock *)heap;
+ while (p && p->ofs <= offset) {
+ if (ISFREE(p) && endofs <= (p->ofs+p->size)) {
+ SliceBlock(p,offset,size,1,1);
+ return 0;
+ }
+ p = p->next;
+ }
+ return -1;
+}
+
+int mmFreeReserved(memHeap_t *heap, int offset)
+{
+ TMemBlock *p,*prev;
+
+ if (!heap)
+ return -1;
+ p = (TMemBlock *)heap;
+ prev = NULL;
+ while (p && p->ofs != offset) {
+ prev = p;
+ p = p->next;
+ }
+ if (!p || !p->reserved)
+ return -1;
+ p->free = 1;
+ p->reserved = 0;
+ 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
new file mode 100644
index 000000000..6fa6e8b69
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/mm.h
@@ -0,0 +1,101 @@
+/*
+ * 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; }
+
+static __inline__ void mmMarkReserved(PMemBlock b)
+{ b->reserved = 1; }
+
+/*
+ * input: total size in bytes
+ * return: a heap pointer if OK, NULL if error
+ */
+memHeap_t *mmInit( int ofs, int size );
+
+
+
+memHeap_t *mmAddRange( memHeap_t *heap,
+ 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 );
+
+/*
+ * Reserve 'size' bytes block start at offset
+ * This is used to prevent allocation of memory already used
+ * by the X server for the front buffer, pixmaps, and cursor
+ * input: size, offset
+ * output: 0 if OK, -1 if error
+ */
+int mmReserveMem( memHeap_t *heap, int offset,int size );
+int mmFreeReserved( memHeap_t *heap, int offset );
+
+/*
+ * 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
new file mode 100644
index 000000000..49ce7e3e3
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/mmx.h
@@ -0,0 +1,560 @@
+/* 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
new file mode 100644
index 000000000..e10dca1a2
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/common/spantmp.h
@@ -0,0 +1,199 @@
+
+static void TAG(WriteRGBASpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ const GLubyte rgba[][4],
+ const GLubyte mask[] )
+{
+ GLuint x1,n1;
+ LOCAL_VARS;
+
+ y = Y_FLIP(y);
+
+ if (DBG) fprintf(stderr, "WriteRGBASpan\n");
+
+ HW_CLIPLOOP()
+ {
+ GLuint i = 0;
+ CLIPSPAN(x,y,n,x1,n1,i);
+ if (mask)
+ {
+ for (i=0;i<n1;i++,x1++)
+ if (mask[i])
+ WRITE_RGBA( x1, y,
+ rgba[i][0], rgba[i][1],
+ rgba[i][2], rgba[i][3] );
+ }
+ else
+ {
+ for (i=0;i<n1;i++,x1++)
+ WRITE_RGBA( x1, y,
+ rgba[i][0], rgba[i][1],
+ rgba[i][2], rgba[i][3] );
+ }
+ }
+ HW_ENDCLIPLOOP();
+}
+
+static void TAG(WriteRGBSpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ const GLubyte rgb[][3],
+ const GLubyte mask[] )
+{
+ GLuint x1,n1;
+ LOCAL_VARS;
+
+ y = Y_FLIP(y);
+
+
+ if (DBG) fprintf(stderr, "WriteRGBSpan\n");
+
+ HW_CLIPLOOP()
+ {
+ GLuint i = 0;
+ CLIPSPAN(x,y,n,x1,n1,i);
+
+ if (mask)
+ {
+ for (;i<n1;i++,x1++)
+ if (mask[i])
+ WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 0 );
+ }
+ else
+ {
+ for (;i<n1;i++,x1++)
+ WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 0 );
+ }
+ }
+ HW_ENDCLIPLOOP();
+}
+
+static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
+ GLuint n,
+ const GLint x[],
+ const GLint y[],
+ const GLubyte rgba[][4],
+ const GLubyte mask[] )
+{
+ GLuint i;
+ LOCAL_VARS;
+
+ if (DBG) fprintf(stderr, "WriteRGBAPixels\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_RGBA( x[i], fy,
+ rgba[i][0], rgba[i][1],
+ rgba[i][2], rgba[i][3] );
+ }
+ }
+ }
+ HW_ENDCLIPLOOP();
+}
+
+
+static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ const GLubyte mask[] )
+{
+ GLuint x1,n1;
+ LOCAL_VARS;
+ INIT_MONO_PIXEL(p);
+
+ y = Y_FLIP( y );
+
+ if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
+
+ HW_CLIPLOOP()
+ {
+ GLuint i = 0;
+ CLIPSPAN(x,y,n,x1,n1,i);
+ for (;i<n1;i++,x1++)
+ if (mask[i])
+ WRITE_PIXEL( x1, y, p );
+ }
+ HW_ENDCLIPLOOP();
+}
+
+
+static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
+ GLuint n,
+ const GLint x[], const GLint y[],
+ const GLubyte mask[] )
+{
+ GLuint i;
+ LOCAL_VARS;
+ INIT_MONO_PIXEL(p);
+
+ if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
+
+ HW_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();
+}
+
+
+
+/*
+ * Read a horizontal span of color pixels.
+ */
+static void TAG(ReadRGBASpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ GLubyte rgba[][4])
+{
+ GLuint x1,n1;
+ LOCAL_VARS;
+
+ y = Y_FLIP(y);
+
+ if (DBG) fprintf(stderr, "ReadRGBASpan\n");
+
+ HW_CLIPLOOP()
+ {
+ GLuint i = 0;
+ CLIPSPAN(x,y,n,x1,n1,i);
+ for (;i<n1;i++)
+ READ_RGBA( rgba[i], x1+i, y );
+ }
+ HW_ENDCLIPLOOP();
+}
+
+static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLubyte rgba[][4], const GLubyte mask[] )
+{
+ GLuint i;
+ LOCAL_VARS;
+
+ if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
+
+ HW_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();
+}
+
+
+
+
+#undef WRITE_PIXEL
+#undef WRITE_RGBA
+#undef READ_RGBA
+#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile b/xc/lib/GL/mesa/src/drv/gamma/Imakefile
index 467ccce1b..98caebf5d 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/gamma/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.4 1999/12/14 01:33:38 robin Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.6 2000/02/15 07:13:30 martin Exp $
XCOMM $PI: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.6 1999/06/21 05:13:55 martin Exp $
#define DoNormalLib NormalLibGlx
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810fastpath.c b/xc/lib/GL/mesa/src/drv/i810/i810fastpath.c
new file mode 100644
index 000000000..9223060e7
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/i810/i810fastpath.c
@@ -0,0 +1,530 @@
+/*
+ * 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 <stdio.h>
+
+#include "types.h"
+#include "enums.h"
+#include "cva.h"
+#include "vertices.h"
+
+/* #include "mmath.h" */
+
+#include "i810context.h"
+#include "i810pipeline.h"
+#include "i810tris.h"
+#include "i810state.h"
+#include "i810vb.h"
+
+
+extern void i810DDResizeVB( struct vertex_buffer *VB, GLuint size );
+
+extern void gl_fast_copy_vb( struct vertex_buffer *VB );
+
+struct i810_fast_tab {
+ void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest );
+ void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J );
+};
+
+
+
+
+#define POINT(x) i810_draw_point(imesa, &ivert[x].v, psize)
+#define LINE(x,y) i810_draw_line(imesa, &ivert[x].v, &ivert[y].v, lwidth)
+#define TRI(x,y,z) i810_draw_triangle(imesa, &ivert[x].v, &ivert[y].v, &ivert[z].v)
+
+
+
+
+/* Direct, and no clipping required. I haven't written the clip funcs
+ * yet, so this is only useful for the fast path.
+ */
+#define RENDER_POINTS( start, count ) \
+do { \
+ GLuint e; \
+ for(e=start;e<=count;e++) \
+ POINT(elt[e]); \
+} while (0)
+
+#define RENDER_LINE( i1, i ) \
+do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ LINE( e1, e ); \
+} while (0)
+
+
+#define RENDER_TRI( i2, i1, i, pv, parity) \
+do { \
+{ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ TRI(e2, e1, e); \
+}} while (0)
+
+
+#define RENDER_QUAD( i3, i2, i1, i, pv) \
+do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ TRI(e3, e2, e); \
+ TRI(e2, e1, e); \
+} while (0)
+
+#define LOCAL_VARS \
+ i810VertexPtr ivert = I810_DRIVER_DATA(VB)->verts; \
+ const GLuint *elt = VB->EltPtr->data; \
+ GLcontext *ctx = VB->ctx; \
+ i810ContextPtr imesa = I810_CONTEXT(ctx); \
+ const GLfloat lwidth = ctx->Line.Width; \
+ const GLfloat psize = ctx->Point.Size; \
+ (void) lwidth; (void)psize; (void) ivert;
+
+
+#define TAG(x) x##_i810_smooth_indirect
+#include "render_tmp.h"
+
+
+
+static void i810_render_elements_direct( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ i810ContextPtr imesa = I810_CONTEXT( ctx );
+ GLenum prim = ctx->CVA.elt_mode;
+ GLuint nr = VB->EltPtr->count;
+ render_func func = render_tab_i810_smooth_indirect[prim];
+ GLuint p = 0;
+
+ if (imesa->new_state)
+ i810DDUpdateHwState( ctx );
+
+ BEGIN_CLIP_LOOP(imesa)
+ {
+ do {
+ func( VB, 0, nr, 0 );
+ } while (ctx->Driver.MultipassFunc &&
+ ctx->Driver.MultipassFunc( VB, ++p ));
+ }
+ END_CLIP_LOOP(imesa);
+}
+
+
+
+#define NEGATIVE(f) (f < 0)
+#define DIFFERENT_SIGNS(a,b) ((a*b) < 0)
+#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
+
+
+#define INTERP_RGBA(t, out, a, b) { \
+ int i; \
+ for (i = 0; i < 4; i++) { \
+ GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]); \
+ GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]); \
+ GLfloat fo = LINTERP(t, fa, fb); \
+ FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo); \
+ } \
+}
+
+
+#define CLIP(SGN,V,PLANE) \
+if (mask & PLANE) { \
+ GLuint *indata = inlist[in]; \
+ GLuint *outdata = inlist[in ^= 1]; \
+ GLuint nr = n; \
+ GLfloat *J = verts[indata[nr-1]].f; \
+ GLfloat dpJ = (SGN J[V]) + J[3]; \
+ \
+ inlist[0] = vlist1; \
+ for (i = n = 0 ; i < nr ; i++) { \
+ GLuint elt_i = indata[i]; \
+ GLfloat *I = verts[elt_i].f; \
+ GLfloat dpI = (SGN I[V]) + I[3]; \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ \
+ GLfloat *O = verts[next_vert].f; \
+ GLfloat t, *in, *out; \
+ \
+ if (NEGATIVE(dpI)) { \
+ t = dpI / (dpI - dpJ); \
+ in = I; \
+ out = J; \
+ } \
+ else \
+ { \
+ t = dpJ / (dpJ - dpI); \
+ in = J; \
+ out = I; \
+ } \
+ \
+ interp(t, O, in, out); \
+ \
+ clipmask[next_vert] = 0; \
+ outdata[n++] = next_vert++; \
+ } \
+ \
+ clipmask[elt_i] |= PLANE; /* don't set up */ \
+ \
+ if (!NEGATIVE(dpI)) { \
+ outdata[n++] = elt_i; \
+ clipmask[elt_i] &= ~PLANE; /* set up after all */ \
+ } \
+ \
+ J = I; \
+ dpJ = dpI; \
+ } \
+ \
+ if (n < 3) return; \
+}
+
+#define LINE_CLIP(x,y,z,w,PLANE) \
+if (mask & PLANE) { \
+ GLfloat dpI = DOT4V(I,x,y,z,w); \
+ GLfloat dpJ = DOT4V(J,x,y,z,w); \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ GLfloat *O = verts[next_vert].f; \
+ GLfloat t = dpI / (dpI - dpJ); \
+ \
+ interp(t, O, I, J); \
+ \
+ clipmask[next_vert] = 0; \
+ \
+ if (NEGATIVE(dpI)) { \
+ clipmask[elts[0]] |= PLANE; \
+ I = O; elts[0] = next_vert++; \
+ } else { \
+ clipmask[elts[1]] |= PLANE; \
+ J = O; elts[1] = next_vert++; \
+ } \
+ } \
+ else if (NEGATIVE(dpI)) \
+ return; \
+}
+
+
+static __inline void i810_tri_clip( GLuint **p_elts,
+ i810Vertex *verts,
+ GLubyte *clipmask,
+ GLuint *p_next_vert,
+ GLubyte mask,
+ i810_interp_func interp )
+{
+ GLuint *elts = *p_elts;
+ GLuint next_vert = *p_next_vert;
+ GLuint vlist1[VB_MAX_CLIPPED_VERTS];
+ GLuint vlist2[VB_MAX_CLIPPED_VERTS];
+ GLuint *inlist[2];
+ GLuint *out;
+ GLuint in = 0;
+ GLuint n = 3;
+ GLuint i;
+
+ inlist[0] = elts;
+ inlist[1] = vlist2;
+
+ CLIP(-,0,CLIP_RIGHT_BIT);
+ CLIP(+,0,CLIP_LEFT_BIT);
+ CLIP(-,1,CLIP_TOP_BIT);
+ CLIP(+,1,CLIP_BOTTOM_BIT);
+ CLIP(-,2,CLIP_FAR_BIT);
+ CLIP(+,2,CLIP_NEAR_BIT);
+
+ /* Convert the planar polygon to a list of triangles.
+ */
+ out = inlist[in];
+
+ for (i = 2 ; i < n ; i++) {
+ elts[0] = out[0];
+ elts[1] = out[i-1];
+ elts[2] = out[i];
+ elts += 3;
+ }
+
+ *p_next_vert = next_vert;
+ *p_elts = elts;
+}
+
+
+static __inline void i810_line_clip( GLuint **p_elts,
+ i810Vertex *verts,
+ GLubyte *clipmask,
+ GLuint *p_next_vert,
+ GLubyte mask,
+ i810_interp_func interp )
+{
+ GLuint *elts = *p_elts;
+ GLfloat *I = verts[elts[0]].f;
+ GLfloat *J = verts[elts[1]].f;
+ GLuint next_vert = *p_next_vert;
+
+ LINE_CLIP(1,0,0,-1,CLIP_LEFT_BIT);
+ LINE_CLIP(-1,0,0,1,CLIP_RIGHT_BIT);
+ LINE_CLIP(0,1,0,-1,CLIP_TOP_BIT);
+ LINE_CLIP(0,-1,0,1,CLIP_BOTTOM_BIT);
+ LINE_CLIP(0,0,1,-1,CLIP_FAR_BIT);
+ LINE_CLIP(0,0,-1,1,CLIP_NEAR_BIT);
+
+ *p_next_vert = next_vert;
+ *p_elts += 2;
+}
+
+
+
+#define CLIP_POINT( e ) \
+ if (mask[e]) \
+ *out++ = e
+
+#define CLIP_LINE( e1, e0 ) \
+do { \
+ GLubyte ormask = mask[e0] | mask[e1]; \
+ out[0] = e1; \
+ out[1] = e0; \
+ out+=2; \
+ if (ormask) { \
+ out-=2; \
+ if (!(mask[e0] & mask[e1])) { \
+ i810_line_clip( &out, verts, mask, &next_vert, ormask, interp); \
+ } \
+ } \
+} while (0)
+
+#define CLIP_TRIANGLE( e2, e1, e0 ) \
+do { \
+ GLubyte ormask; \
+ out[0] = e2; \
+ out[1] = e1; \
+ out[2] = e0; \
+ out += 3; \
+ ormask = mask[e2] | mask[e1] | mask[e0]; \
+ if (ormask) { \
+ out -= 3; \
+ if ( !(mask[e2] & mask[e1] & mask[e0])) { \
+ i810_tri_clip( &out, verts, mask, &next_vert, ormask, interp ); \
+ } \
+ } \
+} while (0)
+
+
+
+
+
+
+/* Build a table of functions to clip each primitive type. These
+ * produce a list of elements in the appropriate 'reduced' primitive,
+ * ie (points, lines, triangles) containing all the clipped and
+ * unclipped primitives from the original list.
+ */
+#define LOCAL_VARS \
+ i810ContextPtr imesa = I810_CONTEXT( VB->ctx ); \
+ GLuint *elt = VB->EltPtr->data; \
+ i810Vertex *verts = I810_DRIVER_DATA(VB)->verts; \
+ GLuint next_vert = I810_DRIVER_DATA(VB)->last_vert; \
+ GLuint *out = I810_DRIVER_DATA(VB)->clipped_elements.data; \
+ GLubyte *mask = VB->ClipMask; \
+ i810_interp_func interp = imesa->interp; \
+ (void) interp; (void) verts;
+
+#define POSTFIX \
+ I810_DRIVER_DATA(VB)->clipped_elements.count = \
+ out - I810_DRIVER_DATA(VB)->clipped_elements.data; \
+ I810_DRIVER_DATA(VB)->last_vert = next_vert;
+
+
+#define INIT(x)
+
+#define RENDER_POINTS(start, count) \
+do { \
+ GLuint i; \
+ for (i = start ; i < count ; i++ ) \
+ CLIP_POINT( elt[i] ); \
+} while (0)
+
+#define RENDER_LINE(i1, i0) \
+ CLIP_LINE(elt[i1], elt[i0])
+
+#define RENDER_TRI(i2, i1, i0, pv, parity) \
+do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \
+ if (parity) e2 = elt[i1], e1 = elt[i2]; \
+ CLIP_TRIANGLE( e2, e1, e0 ); \
+} while (0)
+
+#define RENDER_QUAD(i3, i2, i1, i0, pv ) \
+ CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \
+ CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0])
+
+#define TAG(x) i810_clip_##x##_elt
+#include "render_tmp.h"
+
+
+
+static void i810_project_vertices( struct vertex_buffer *VB )
+{
+ i810VertexBufferPtr i810VB = I810_DRIVER_DATA(VB);
+ GLcontext *ctx = VB->ctx;
+ GLmatrix *mat = &ctx->Viewport.WindowMap;
+ GLfloat m[16];
+
+ m[MAT_SX] = mat->m[MAT_SX];
+ m[MAT_TX] = mat->m[MAT_TX] - .5;
+ m[MAT_SY] = (- mat->m[MAT_SY]);
+ m[MAT_TY] = (- mat->m[MAT_TY]) + I810_CONTEXT(ctx)->driDrawable->h - .5;
+ m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000);
+ m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000);
+
+ gl_project_v16( i810VB->verts[VB->CopyStart].f,
+ i810VB->verts[i810VB->last_vert].f,
+ m,
+ 16 * 4 );
+}
+
+static void i810_project_clipped_vertices( struct vertex_buffer *VB )
+{
+ i810VertexBufferPtr i810VB = I810_DRIVER_DATA(VB);
+ GLcontext *ctx = VB->ctx;
+ GLmatrix *mat = &ctx->Viewport.WindowMap;
+ GLfloat m[16];
+
+ m[MAT_SX] = mat->m[MAT_SX];
+ m[MAT_TX] = mat->m[MAT_TX] - .5;
+ m[MAT_SY] = (- mat->m[MAT_SY]);
+ m[MAT_TY] = (- mat->m[MAT_TY]) + I810_CONTEXT(ctx)->driDrawable->h - .5;
+ m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000);
+ m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000);
+
+ gl_project_clipped_v16( i810VB->verts[VB->CopyStart].f,
+ i810VB->verts[i810VB->last_vert].f,
+ m,
+ 16 * 4,
+ VB->ClipMask + VB->CopyStart );
+}
+
+
+/* Pack rgba and/or texture into the remaining half of a 32 byte vertex.
+ */
+#define CLIP_UBYTE_COLOR 4
+#define CLIP_UBYTE_B 0
+#define CLIP_UBYTE_G 1
+#define CLIP_UBYTE_R 2
+#define CLIP_UBYTE_A 3
+#define CLIP_S0 6
+#define CLIP_T0 7
+#define CLIP_S1 8
+#define CLIP_T1 9
+
+#define TYPE (0)
+#define TAG(x) x
+#include "i810fasttmp.h"
+
+#define TYPE (I810_RGBA_BIT)
+#define TAG(x) x##_RGBA
+#include "i810fasttmp.h"
+
+#define TYPE (I810_TEX0_BIT)
+#define TAG(x) x##_TEX0
+#include "i810fasttmp.h"
+
+#define TYPE (I810_RGBA_BIT|I810_TEX0_BIT)
+#define TAG(x) x##_RGBA_TEX0
+#include "i810fasttmp.h"
+
+#define TYPE (I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
+#define TAG(x) x##_RGBA_TEX0_TEX1
+#include "i810fasttmp.h"
+
+/* This one *could* get away with sneaking TEX1 into the color and
+ * specular slots, thus fitting inside a cache line. Would be even
+ * better to switch to a smaller vertex.
+ */
+#define TYPE (I810_TEX0_BIT|I810_TEX1_BIT)
+#define TAG(x) x##_TEX0_TEX1
+#include "i810fasttmp.h"
+
+
+/* Very sparsely popluated array - fix the indices.
+ */
+static struct i810_fast_tab i810FastTab[0x80];
+
+void i810DDFastPathInit( void )
+{
+ i810_clip_render_init_elt();
+ render_init_i810_smooth_indirect();
+
+ i810_init_fastpath( &i810FastTab[0] );
+ i810_init_fastpath_RGBA( &i810FastTab[I810_RGBA_BIT] );
+ i810_init_fastpath_TEX0( &i810FastTab[I810_TEX0_BIT] );
+ i810_init_fastpath_RGBA_TEX0( &i810FastTab[I810_RGBA_BIT|I810_TEX0_BIT] );
+ i810_init_fastpath_TEX0_TEX1( &i810FastTab[I810_TEX0_BIT|I810_TEX1_BIT] );
+ i810_init_fastpath_RGBA_TEX0_TEX1( &i810FastTab[I810_RGBA_BIT|I810_TEX0_BIT|
+ I810_TEX1_BIT] );
+}
+
+#define VALID_SETUP (I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
+
+
+void i810DDFastPath( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ GLenum prim = ctx->CVA.elt_mode;
+ i810ContextPtr imesa = I810_CONTEXT( ctx );
+ struct i810_fast_tab *tab = &i810FastTab[imesa->setupindex & VALID_SETUP];
+ GLuint do_cliptest = 1;
+
+ gl_prepare_arrays_cva( VB ); /* still need this */
+
+ /* Reserve enough space for the pathological case.
+ */
+ if (VB->EltPtr->count * 12 > I810_DRIVER_DATA(VB)->size) {
+ i810DDResizeVB( VB, VB->EltPtr->count * 12 );
+ do_cliptest = 1;
+ }
+
+ tab->build_vertices( VB, do_cliptest ); /* object->clip space */
+
+ if (imesa->new_state)
+ i810DDUpdateHwState( ctx );
+
+ if (VB->ClipOrMask) {
+ if (!VB->ClipAndMask) {
+ render_func *clip = i810_clip_render_tab_elt;
+
+ imesa->interp = tab->interp;
+
+ clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */
+
+ ctx->CVA.elt_mode = gl_reduce_prim[prim];
+ VB->EltPtr = &(I810_DRIVER_DATA(VB)->clipped_elements);
+
+ i810_project_clipped_vertices( VB ); /* clip->device space */
+ i810_render_elements_direct( VB ); /* render using new list */
+ }
+ } else {
+ i810_project_vertices( VB ); /* clip->device space */
+ i810_render_elements_direct( VB ); /* render using orig list */
+ }
+
+ /* This indicates that there is no cached data to reuse.
+ */
+ VB->pipeline->data_valid = 0;
+ VB->pipeline->new_state = 0;
+}
+
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810fasttmp.h b/xc/lib/GL/mesa/src/drv/i810/i810fasttmp.h
new file mode 100644
index 000000000..115fe7b24
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/i810/i810fasttmp.h
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ *
+ */
+
+
+
+/* The first part of setup is applied to all vertices, clipped or
+ * unclipped. This data w!ill be used for clipping, and then all
+ * vertices with a zero clipmask will be projected to device space.
+ *
+ * This could be split into several loops, but - it seems that the
+ * large stride of the fxVertices makes cache issues the big
+ * performance factor, and that multiple loops mean multiple cache
+ * misses....
+ */
+static void TAG(i810_setup_full)( struct vertex_buffer *VB, GLuint do_cliptest )
+{
+ GLcontext *ctx = VB->ctx;
+ const GLfloat * const m = ctx->ModelProjectMatrix.m;
+ GLuint start = VB->CopyStart;
+ GLuint count = VB->Count;
+ GLuint i;
+
+ gl_xform_points3_v16_general(I810_DRIVER_DATA(VB)->verts[start].f,
+ m,
+ VB->ObjPtr->start,
+ VB->ObjPtr->stride,
+ count - start);
+
+ if (do_cliptest)
+ {
+ VB->ClipAndMask = ~0;
+ VB->ClipOrMask = 0;
+ gl_cliptest_points4_v16(I810_DRIVER_DATA(VB)->verts[start].f,
+ I810_DRIVER_DATA(VB)->verts[count].f,
+ &(VB->ClipOrMask),
+ &(VB->ClipAndMask),
+ VB->ClipMask + start);
+ }
+
+ /* These branches are all resolved at compile time. Hopefully all
+ * the pointers are valid addresses even when not enabled.
+ */
+ if (TYPE) {
+ GLubyte *color = VB->ColorPtr->start;
+ GLfloat *tex0_data = VB->TexCoordPtr[0]->start;
+ GLfloat *tex1_data = VB->TexCoordPtr[1]->start;
+
+ GLuint color_stride = VB->ColorPtr->stride;
+ GLuint tex0_stride = VB->TexCoordPtr[0]->stride;
+ GLuint tex1_stride = VB->TexCoordPtr[1]->stride;
+
+ GLfloat *f = I810_DRIVER_DATA(VB)->verts[start].f;
+
+ for (i = start ; i < count ; i++, f += 16) {
+ if (TYPE & I810_RGBA_BIT) {
+ GLubyte *b = (GLubyte *)&f[CLIP_UBYTE_COLOR];
+ GLubyte *col = color; color += color_stride;
+ b[CLIP_UBYTE_R] = col[0];
+ b[CLIP_UBYTE_G] = col[1];
+ b[CLIP_UBYTE_B] = col[2];
+ b[CLIP_UBYTE_A] = col[3];
+ }
+ if (TYPE & I810_TEX0_BIT) {
+ f[CLIP_S0] = tex0_data[0];
+ f[CLIP_T0] = tex0_data[1];
+ STRIDE_F(tex0_data, tex0_stride);
+ }
+ if (TYPE & I810_TEX1_BIT) {
+ f[CLIP_S1] = tex1_data[0];
+ f[CLIP_T1] = tex1_data[1];
+ STRIDE_F(tex1_data, tex1_stride);
+ }
+ }
+ }
+
+ I810_DRIVER_DATA(VB)->clipped_elements.count = start;
+ I810_DRIVER_DATA(VB)->last_vert = count;
+}
+
+
+/* Changed to just put the interp func instead of the whole clip
+ * routine into the header. Less code and better chance of doing some
+ * of this stuff in assembly.
+ */
+static void TAG(i810_interp_vert)( GLfloat t,
+ GLfloat *O,
+ const GLfloat *I,
+ const GLfloat *J )
+{
+ O[0] = LINTERP(t, I[0], J[0]);
+ O[1] = LINTERP(t, I[1], J[1]);
+ O[2] = LINTERP(t, I[2], J[2]);
+ O[3] = LINTERP(t, I[3], J[3]);
+
+ if (TYPE & I810_RGBA_BIT) {
+ INTERP_RGBA(t,
+ ((GLubyte *)&(O[4])),
+ ((GLubyte *)&(I[4])),
+ ((GLubyte *)&(J[4])));
+ }
+
+ if (TYPE & I810_TEX0_BIT) {
+ O[6] = LINTERP(t, I[6], J[6]);
+ O[7] = LINTERP(t, I[7], J[7]);
+ }
+
+ if (TYPE & I810_TEX1_BIT) {
+ O[8] = LINTERP(t, I[8], J[8]);
+ O[9] = LINTERP(t, I[9], J[9]);
+ }
+}
+
+
+static void TAG(i810_init_fastpath)( struct i810_fast_tab *tab )
+{
+ tab->interp = TAG(i810_interp_vert);
+ tab->build_vertices = TAG(i810_setup_full);
+}
+
+#undef TYPE
+#undef TAG
+#undef SIZE
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ring.c b/xc/lib/GL/mesa/src/drv/i810/i810ring.c
new file mode 100644
index 000000000..2e5909e9f
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/i810/i810ring.c
@@ -0,0 +1,162 @@
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include "mm.h"
+#include "i810dd.h"
+#include "i810lib.h"
+#include "i810state.h"
+
+
+#include "i810dma.h"
+
+static void
+I810PrintErrorState( void )
+{
+ fprintf(stderr, "pgetbl_ctl: 0x%x pgetbl_err: 0x%x\n",
+ INREG(PGETBL_CTL),
+ INREG(PGE_ERR));
+
+ fprintf(stderr, "ipeir: %x iphdr: %x\n",
+ INREG(IPEIR),
+ INREG(IPEHR));
+
+ fprintf(stderr, "LP ring tail: %x head: %x len: %x start %x\n",
+ INREG(LP_RING + RING_TAIL),
+ INREG(LP_RING + RING_HEAD) & HEAD_ADDR,
+ INREG(LP_RING + RING_LEN),
+ INREG(LP_RING + RING_START));
+
+ fprintf(stderr, "eir: %x esr: %x emr: %x\n",
+ INREG16(EIR),
+ INREG16(ESR),
+ INREG16(EMR));
+
+ fprintf(stderr, "instdone: %x instpm: %x\n",
+ INREG16(INST_DONE),
+ INREG8(INST_PM));
+
+ fprintf(stderr, "memmode: %x instps: %x\n",
+ INREG(MEMMODE),
+ INREG(INST_PS));
+
+ fprintf(stderr, "hwstam: %x ier: %x imr: %x iir: %x\n",
+ INREG16(HWSTAM),
+ INREG16(IER),
+ INREG16(IMR),
+ INREG16(IIR));
+}
+
+
+
+
+static int
+I810USec( void )
+{
+ struct timeval tv;
+ struct timezone tz;
+ gettimeofday( &tv, &tz );
+ return (tv.tv_sec & 2047) * 1000000 + tv.tv_usec;
+}
+
+
+
+void
+_I810RefreshLpRing( i810ContextPtr imesa, int update )
+{
+ struct i810_ring_buffer *ring = &(i810glx.LpRing);
+
+ ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
+ ring->tail = INREG(LP_RING + RING_TAIL);
+ ring->space = ring->head - (ring->tail+8);
+
+ if (ring->space < 0) {
+ ring->space += ring->mem.Size;
+ if (update)
+ imesa->sarea->lastWrap = ++imesa->sarea->ringAge;
+ }
+}
+
+int
+_I810WaitLpRing( i810ContextPtr imesa, int n, int timeout_usec )
+{
+ struct i810_ring_buffer *ring = &(i810glx.LpRing);
+ int iters = 0;
+ int startTime = 0;
+ int curTime = 0;
+
+ if (timeout_usec == 0)
+ timeout_usec = 15000000;
+
+ if (I810_DEBUG & DEBUG_VERBOSE_API)
+ fprintf(stderr, "I810WaitLpRing %d\n", n);
+
+ while (ring->space < n)
+ {
+ int i;
+
+ ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
+ ring->space = ring->head - (ring->tail+8);
+
+ if (ring->space < 0) {
+ imesa->sarea->lastWrap = ++imesa->sarea->ringAge;
+ ring->space += ring->mem.Size;
+ }
+
+ iters++;
+ curTime = I810USec();
+ if ( startTime == 0 || curTime < startTime /*wrap case*/) {
+ startTime = curTime;
+ } else if ( curTime - startTime > timeout_usec ) {
+ I810PrintErrorState();
+ fprintf(stderr, "space: %d wanted %d\n",
+ ring->space, n );
+ UNLOCK_HARDWARE(imesa);
+ exit(1);
+ }
+
+ for (i = 0 ; i < 2000 ; i++)
+ ;
+ }
+
+ return iters;
+}
+
+int
+_I810Sync( i810ContextPtr imesa )
+{
+ int rv;
+
+ if (I810_DEBUG & DEBUG_VERBOSE_API)
+ fprintf(stderr, "I810Sync\n");
+
+ /* Send a flush instruction and then wait till the ring is empty.
+ * This is stronger than waiting for the blitter to finish as it also
+ * flushes the internal graphics caches.
+ */
+ {
+ BEGIN_LP_RING( imesa, 2 );
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH );
+ OUT_RING( 0 ); /* pad to quadword */
+ ADVANCE_LP_RING();
+ }
+
+
+ i810glx.LpRing.synced = 1; /* ?? */
+
+ rv = _I810WaitLpRing( imesa, i810glx.LpRing.mem.Size - 8, 0 );
+ imesa->sarea->lastSync = ++imesa->sarea->ringAge;
+
+ return rv;
+}
+
+
+
+
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810swap.h b/xc/lib/GL/mesa/src/drv/i810/i810swap.h
new file mode 100644
index 000000000..1657a717d
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/i810/i810swap.h
@@ -0,0 +1,6 @@
+#ifndef I810_SWAP_H
+#define I810_SWAP_H
+
+extern void i810SwapBuffers( i810ContextPtr imesa );
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile
new file mode 100644
index 000000000..9ff1203ee
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile
@@ -0,0 +1,68 @@
+XCOMM $PI:$
+
+#define DoNormalLib NormalLibGlx
+#define DoSharedLib SharedLibGlx
+#define DoExtraLib SharedLibGlx
+#define DoDebugLib DebugLibGlx
+#define DoProfileLib ProfileLibGlx
+
+#if Malloc0ReturnsNull
+ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
+#endif
+
+#if BuildXF86DRI
+ DRI_DEFINES = GlxDefines -DDRIVERTS
+ DRI_INCLUDES = -I../../../../dri -I../../../../glx \
+ -I$(TOP)/include -I$(TOP)/include/GL \
+ -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \
+ -I$(XF86DRIVERSRC)/mga \
+ -I../../../include -I../.. -I../../X -I../common \
+ -I$(XF86OSSRC)/linux/drm/kernel
+#endif
+
+MESA_INCLUDES = -I. -I.. -I../../include
+
+
+
+ DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES)
+ INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) \
+ -I/usr/include/glide
+ DRISRCS = mgaclear.c mgacnvtex.c mgadd.c mgadepth.c \
+ mgafastpath.c \
+ mgapipeline.c \
+ mgaspan.c mgastate.c mgatex.c \
+ mgatris.c mgavb.c mgaioctl.c mga_xmesa.c
+
+ DRIOBJS = mgaclear.o mgacnvtex.o mgadd.o mgadepth.o \
+ mgafastpath.o \
+ mgapipeline.o \
+ mgaspan.o mgastate.o mgatex.o \
+ mgatris.o mgavb.o mgaioctl.o mga_xmesa.o
+
+
+ SRCS = $(DRISRCS)
+ OBJS = $(DRIOBJS)
+
+#if !GlxUseBuiltInDRIDriver
+#undef DoNormalLib NormalLibGlx
+#undef DoExtraLib SharedLibGlx
+#undef DoDebugLib DebugLibGlx
+#undef DoProfileLib ProfileLibGlx
+#endif
+
+#include <Library.tmpl>
+
+LibraryObjectRule()
+
+SubdirLibraryRule($(OBJS))
+NormalLintTarget($(SRCS))
+
+#if !GlxUseBuiltInDRIDriver
+LIBNAME = mga_dri.so
+ALL_OBJS = $(OBJS)
+ALL_DEPS = DONE
+SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS))
+InstallDynamicModule($(LIBNAME),$(MODULEDIR),.)
+#endif
+
+DependTarget()
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
new file mode 100644
index 000000000..8c42d0842
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
@@ -0,0 +1,514 @@
+/**************************************************************************
+
+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:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ *
+ * $PI: $
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <X11/Xlibint.h>
+#include <stdio.h>
+
+#include "mga_xmesa.h"
+#include "context.h"
+#include "vbxform.h"
+#include "matrix.h"
+#include "simple_list.h"
+
+#include "mgadd.h"
+#include "mgastate.h"
+#include "mgatex.h"
+#include "mgaspan.h"
+#include "mgadepth.h"
+#include "mgatris.h"
+#include "mgapipeline.h"
+
+#include "xf86dri.h"
+#include "mga_dri.h"
+#include "mga_drm_public.h"
+#include "mga_xmesa.h"
+
+
+
+
+
+#ifndef MGA_DEBUG
+int MGA_DEBUG = (0
+/* | MGA_DEBUG_ALWAYS_SYNC */
+/* | MGA_DEBUG_VERBOSE_MSG */
+ );
+#endif
+
+
+static mgaContextPtr mgaCtx = 0;
+
+mgaGlx_t mgaglx;
+
+static int count_bits(unsigned int n)
+{
+ int bits = 0;
+
+ while (n > 0) {
+ if (n & 1) bits++;
+ n >>= 1;
+ }
+ return bits;
+}
+
+/* These functions are accessed by dlsym from dri_mesa_init.c:
+ *
+ * XMesaInitDriver
+ * XMesaResetDriver
+ * XMesaCreateVisual
+ * XMesaDestroyVisual
+ * XMesaCreateContext
+ * XMesaDestroyContext
+ * XMesaCreateWindowBuffer
+ * XMesaCreatePixmapBuffer
+ * XMesaDestroyBuffer
+ * XMesaSwapBuffers
+ * XMesaMakeCurrent
+ *
+ * So this is kind of the public interface to the driver. The driver
+ * uses the X11 mesa driver context as a kind of wrapper around its
+ * own driver context - but there isn't much justificiation for doing
+ * it that way - the DRI might as well use a (void *) to refer to the
+ * driver contexts. Nothing in the X context really gets used.
+ */
+
+
+GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv)
+{
+ mgaScreenPrivate *mgaScreen;
+ MGADRIPtr gDRIPriv = (MGADRIPtr)sPriv->pDevPriv;
+
+ /* Allocate the private area */
+ mgaScreen = (mgaScreenPrivate *)Xmalloc(sizeof(mgaScreenPrivate));
+ if (!mgaScreen) return GL_FALSE;
+
+ mgaScreen->sPriv = sPriv;
+ sPriv->private = (void *)mgaScreen;
+
+ mgaScreen->chipset=gDRIPriv->chipset;
+ mgaScreen->width=gDRIPriv->width;
+ mgaScreen->height=gDRIPriv->height;
+ mgaScreen->mem=gDRIPriv->mem;
+ mgaScreen->cpp=gDRIPriv->cpp;
+ mgaScreen->frontPitch=gDRIPriv->frontPitch;
+ mgaScreen->frontOffset=gDRIPriv->frontOffset;
+ mgaScreen->backOffset=gDRIPriv->backOffset;
+ mgaScreen->backPitch = gDRIPriv->backPitch;
+ mgaScreen->depthOffset=gDRIPriv->depthOffset;
+ mgaScreen->depthPitch = gDRIPriv->depthPitch;
+ mgaScreen->textureOffset=gDRIPriv->textureOffset;
+ mgaScreen->textureSize=gDRIPriv->textureSize;
+ mgaScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
+
+
+ mgaScreen->bufs = drmMapBufs(sPriv->fd);
+
+
+ /* Other mgaglx stuff, too??
+ */
+ memset(&mgaglx, 0, sizeof(mgaglx));
+
+ mgaDDFastPathInit();
+ mgaDDTrifuncInit();
+ mgaDDSetupInit();
+
+ return GL_TRUE;
+}
+
+/* Accessed by dlsym from dri_mesa_init.c
+ */
+void XMesaResetDriver(__DRIscreenPrivate *sPriv)
+{
+ Xfree(sPriv->private);
+}
+
+/* Accessed by dlsym from dri_mesa_init.c
+ */
+XMesaVisual XMesaCreateVisual(XMesaDisplay *display,
+ XMesaVisualInfo visinfo,
+ GLboolean rgb_flag,
+ GLboolean alpha_flag,
+ GLboolean db_flag,
+ GLboolean stereo_flag,
+ GLboolean ximage_flag,
+ GLint depth_size,
+ GLint stencil_size,
+ GLint accum_size,
+ GLint level)
+{
+ XMesaVisual v;
+
+ /* Only RGB visuals are supported on the MGA boards */
+ if (!rgb_flag) return 0;
+
+ v = (XMesaVisual)Xmalloc(sizeof(struct xmesa_visual));
+ if (!v) return 0;
+
+ v->visinfo = (XVisualInfo *)Xmalloc(sizeof(*visinfo));
+ if(!v->visinfo) {
+ Xfree(v);
+ return 0;
+ }
+ memcpy(v->visinfo, visinfo, sizeof(*visinfo));
+
+ v->display = display;
+ v->level = level;
+
+ v->gl_visual = (GLvisual *)Xmalloc(sizeof(GLvisual));
+ if (!v->gl_visual) {
+ Xfree(v->visinfo);
+ XFree(v);
+ return 0;
+ }
+
+ v->gl_visual->RGBAflag = rgb_flag;
+ v->gl_visual->DBflag = db_flag;
+ v->gl_visual->StereoFlag = stereo_flag;
+
+ v->gl_visual->RedBits = count_bits(visinfo->red_mask);
+ v->gl_visual->GreenBits = count_bits(visinfo->green_mask);
+ v->gl_visual->BlueBits = count_bits(visinfo->blue_mask);
+ v->gl_visual->AlphaBits = 0; /* Not currently supported */
+
+ v->gl_visual->AccumBits = accum_size;
+ v->gl_visual->DepthBits = depth_size;
+ v->gl_visual->StencilBits = stencil_size;
+
+ return v;
+}
+
+void XMesaDestroyVisual(XMesaVisual v)
+{
+ Xfree(v->gl_visual);
+ Xfree(v->visinfo);
+ Xfree(v);
+}
+
+XMesaContext XMesaCreateContext(XMesaVisual v, XMesaContext share_list,
+ __DRIcontextPrivate *driContextPriv)
+{
+ GLcontext *ctx;
+ XMesaContext c;
+ mgaContextPtr mmesa;
+ __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+ mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
+ drm_mga_sarea_t *saPriv=(drm_mga_sarea_t*)(((char*)sPriv->pSAREA)+
+ sizeof(XF86DRISAREARec));
+ GLcontext *shareCtx = 0;
+
+ c = (XMesaContext)Xmalloc(sizeof(struct xmesa_context));
+ if (!c) {
+ return 0;
+ }
+
+ mmesa = (mgaContextPtr)Xmalloc(sizeof(mgaContext));
+ if (!mmesa) {
+ Xfree(c);
+ return 0;
+ }
+
+ c->driContextPriv = driContextPriv;
+ c->xm_visual = v;
+ c->xm_buffer = 0; /* Set by MakeCurrent */
+ c->display = v->display;
+ c->private = (void *)mmesa;
+
+ if (share_list)
+ shareCtx=((mgaContextPtr)(share_list->private))->glCtx;
+
+ ctx = mmesa->glCtx = gl_create_context(v->gl_visual, shareCtx,
+ (void*)mmesa, GL_TRUE);
+
+ /* Dri stuff
+ */
+ mmesa->display = v->display;
+ mmesa->hHWContext = driContextPriv->hHWContext;
+ mmesa->driFd = sPriv->fd;
+ mmesa->driHwLock = &sPriv->pSAREA->lock;
+
+ mmesa->mgaScreen = mgaScreen;
+ mmesa->driScreen = sPriv;
+ mmesa->sarea = saPriv;
+
+ mmesa->glBuffer=gl_create_framebuffer(v->gl_visual);
+
+
+ mmesa->needClip=1;
+
+ mmesa->texHeap = mmInit( 0, mgaScreen->textureSize );
+
+ /* Utah stuff
+ */
+ mmesa->renderindex = -1; /* impossible value */
+ mmesa->new_state = ~0;
+ mmesa->dirty = ~0;
+
+ mmesa->warp_pipe = 0;
+
+
+ make_empty_list(&mmesa->SwappedOut);
+ make_empty_list(&mmesa->TexObjList);
+
+ mmesa->CurrentTexObj[0] = 0;
+ mmesa->CurrentTexObj[1] = 0;
+
+ mgaDDExtensionsInit( ctx );
+
+ mgaDDInitStateFuncs( ctx );
+ mgaDDInitTextureFuncs( ctx );
+ mgaDDInitSpanFuncs( ctx );
+ mgaDDInitDepthFuncs( ctx );
+ mgaDDInitDriverFuncs( ctx );
+ mgaDDInitIoctlFuncs( ctx );
+
+
+ ctx->Driver.TriangleCaps = (DD_TRI_CULL|
+ DD_TRI_LIGHT_TWOSIDE|
+ DD_TRI_OFFSET);
+
+ /* Ask mesa to clip fog coordinates for us.
+ */
+ ctx->TriangleCaps |= DD_CLIP_FOG_COORD;
+
+ ctx->Shared->DefaultD[2][0].DriverData = 0;
+ ctx->Shared->DefaultD[2][1].DriverData = 0;
+
+ if (ctx->VB)
+ mgaDDRegisterVB( ctx->VB );
+
+ if (ctx->NrPipelineStages)
+ ctx->NrPipelineStages =
+ mgaDDRegisterPipelineStages(ctx->PipelineStage,
+ ctx->PipelineStage,
+ ctx->NrPipelineStages);
+ return c;
+}
+
+void XMesaDestroyContext(XMesaContext c)
+{
+ mgaContextPtr mmesa = (mgaContextPtr) c->private;
+
+ if (mmesa) {
+/* mgaTextureObjectPtr next_t, t; */
+
+ gl_destroy_context(mmesa->glCtx);
+ gl_destroy_framebuffer(mmesa->glBuffer);
+
+/* foreach_s (t, next_t, &(mmesa->TexObjList)) */
+/* mgaDestroyTexObj(mmesa, t); */
+
+/* foreach_s (t, next_t, &(mmesa->SwappedOut)) */
+/* mgaDestroyTexObj(mmesa, t); */
+
+ Xfree(mmesa);
+
+ c->private = 0;
+ }
+}
+
+XMesaBuffer XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w,
+ __DRIdrawablePrivate *driDrawPriv)
+{
+ return (XMesaBuffer)1;
+}
+
+XMesaBuffer XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p,
+ XMesaColormap c,
+ __DRIdrawablePrivate *driDrawPriv)
+{
+ return (XMesaBuffer)1;
+}
+
+void XMesaDestroyBuffer(XMesaBuffer b)
+{
+}
+
+void XMesaSwapBuffers(XMesaBuffer bogus_value_do_not_use)
+{
+ mgaContextPtr mmesa = mgaCtx;
+ FLUSH_VB( mmesa->glCtx, "swap buffers" );
+ mgaSwapBuffers(mmesa);
+}
+
+
+
+
+
+void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
+{
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+
+ mmesa->numClipRects = dPriv->numClipRects;
+ mmesa->pClipRects = dPriv->pClipRects;
+ mmesa->drawX = dPriv->x;
+ mmesa->drawY = dPriv->y;
+
+ mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
+}
+
+
+void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
+{
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+
+ if (dPriv->numAuxClipRects == 0)
+ {
+ mmesa->numClipRects = dPriv->numClipRects;
+ mmesa->pClipRects = dPriv->pClipRects;
+ mmesa->drawX = dPriv->x;
+ mmesa->drawY = dPriv->y;
+ } else {
+ mmesa->numClipRects = dPriv->numAuxClipRects;
+ mmesa->pClipRects = dPriv->pAuxClipRects;
+ mmesa->drawX = dPriv->auxX;
+ mmesa->drawY = dPriv->auxY;
+ }
+
+ mmesa->drawOffset = mmesa->mgaScreen->backOffset;
+}
+
+
+static void mgaXMesaWindowMoved( mgaContextPtr mmesa )
+{
+ /* Clear any contaminated CVA data.
+ */
+ mmesa->setupdone = 0;
+
+ switch (mmesa->glCtx->Color.DriverDrawBuffer) {
+ case GL_FRONT_LEFT:
+ mgaXMesaSetFrontClipRects( mmesa );
+ break;
+ case GL_BACK_LEFT:
+ mgaXMesaSetBackClipRects( mmesa );
+ break;
+ default:
+ fprintf(stderr, "fallback buffer\n");
+ break;
+ }
+
+}
+
+
+/* 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???
+ */
+GLboolean XMesaMakeCurrent(XMesaContext c, XMesaBuffer b)
+{
+
+ if (c->private==(void *)mgaCtx) return GL_TRUE;
+
+ if (c) {
+ __DRIdrawablePrivate *dPriv = c->driContextPriv->driDrawablePriv;
+
+ mgaCtx = (mgaContextPtr)c->private;
+
+
+ gl_make_current(mgaCtx->glCtx, mgaCtx->glBuffer);
+
+ mgaXMesaWindowMoved( mgaCtx );
+ mgaCtx->driDrawable = dPriv;
+ mgaCtx->dirty = ~0;
+
+ if (!mgaCtx->glCtx->Viewport.Width)
+ gl_Viewport(mgaCtx->glCtx, 0, 0, dPriv->w, dPriv->h);
+
+ } else {
+ gl_make_current(0,0);
+ mgaCtx = NULL;
+ }
+
+ return GL_TRUE;
+}
+
+
+void mgaXMesaUpdateState( mgaContextPtr mmesa )
+{
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+ __DRIscreenPrivate *sPriv = mmesa->driScreen;
+ drm_mga_sarea_t *sarea = mmesa->sarea;
+
+ int me = mmesa->hHWContext;
+ int stamp = dPriv->lastStamp;
+
+ /* 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:
+ */
+ XMESA_VALIDATE_DRAWABLE_INFO(mmesa->display, sPriv, dPriv);
+
+ if (sarea->ctxOwner != me) {
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+ }
+
+ if (sarea->texAge != mmesa->texAge) {
+ int sz = 1 << (mmesa->mgaScreen->logTextureGranularity);
+ int idx, nr = 0;
+
+ /* Have to go right round from the back to ensure stuff ends up
+ * LRU in our local list...
+ */
+ for (idx = sarea->texList[MGA_NR_TEX_REGIONS].prev ;
+ idx != MGA_NR_TEX_REGIONS && nr < MGA_NR_TEX_REGIONS ;
+ idx = sarea->texList[idx].prev, nr++)
+ {
+ if (sarea->texList[idx].age > mmesa->texAge)
+ mgaTexturesGone(mmesa, idx * sz, sz, 1);
+ }
+
+ if (nr == MGA_NR_TEX_REGIONS) {
+ mgaTexturesGone(mmesa, 0, mmesa->mgaScreen->textureSize, 0);
+ mgaResetGlobalLRU( mmesa );
+ }
+
+ mmesa->texAge = sarea->texAge;
+ mmesa->dirty |= MGA_UPLOAD_TEX0IMAGE | MGA_UPLOAD_TEX1IMAGE;
+ }
+
+ if (dPriv->lastStamp != stamp)
+ mgaXMesaWindowMoved( mmesa );
+
+ sarea->ctxOwner=me;
+}
+
+
+
+
+
+
+#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
new file mode 100644
index 000000000..c24e982d0
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h
@@ -0,0 +1,121 @@
+/**************************************************************************
+
+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 <keithw@precisioninsight.com>
+ * Daryll Strauss <daryll@precisioninsight.com> (Origninal tdfx driver).
+ *
+ * $PI: $
+ */
+
+#ifndef _MGA_INIT_H_
+#define _MGA_INIT_H_
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <sys/time.h>
+#include "dri_tmm.h"
+#include "dri_mesaint.h"
+#include "dri_mesa.h"
+#include "types.h"
+#include "xmesaP.h"
+
+typedef struct {
+
+ int chipset;
+ int width;
+ int height;
+ int mem;
+
+ int cpp; /* for front and back buffers */
+
+ int Attrib;
+
+ int frontOffset;
+ int frontPitch;
+ int backOffset;
+ int backPitch;
+
+ int depthOffset;
+ int depthPitch;
+ int depthCpp;
+
+ int textureOffset;
+ int textureSize;
+ int logTextureGranularity;
+
+ __DRIscreenPrivate *sPriv;
+ drmBufMapPtr bufs;
+
+} mgaScreenPrivate;
+
+
+#include "mgalib.h"
+
+extern void mgaXMesaUpdateState( mgaContextPtr mmesa );
+extern void mgaEmitHwStateLocked( mgaContextPtr mmesa );
+extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit );
+extern void mgaXMesaSetBackClipRects( mgaContextPtr mmesa );
+extern void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa );
+
+
+
+/* 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) { \
+ drmGetLock(mmesa->driFd, mmesa->hHWContext, 0); \
+ mgaXMesaUpdateState( mmesa ); \
+ } \
+ } 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 ); \
+ UNLOCK_HARDWARE( mmesa ); \
+} while (0)
+
+
+#define GET_DRAWABLE_LOCK( mmesa ) while(0)
+#define RELEASE_DRAWABLE_LOCK( mmesa ) while(0)
+
+#endif
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaclear.c b/xc/lib/GL/mesa/src/drv/mga/mgaclear.c
new file mode 100644
index 000000000..48b9b30a7
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaclear.c
@@ -0,0 +1,10 @@
+#include "types.h"
+#include "vbrender.h"
+
+#include <stdio.h>
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgadd.h"
+#include "mgaclear.h"
+#include "mgastate.h"
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaclear.h b/xc/lib/GL/mesa/src/drv/mga/mgaclear.h
new file mode 100644
index 000000000..15a723d65
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaclear.h
@@ -0,0 +1,7 @@
+#ifndef _MGA_CLEAR_H
+#define _MGA_CLEAR_H
+
+extern GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
+ GLint x, GLint y, GLint width, GLint height );
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacnvtex.c b/xc/lib/GL/mesa/src/drv/mga/mgacnvtex.c
new file mode 100644
index 000000000..ae8d95037
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgacnvtex.c
@@ -0,0 +1,250 @@
+/* -*- mode: C; c-basic-offset:8 -*- */
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * original by Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ * 9/20/99 rewrite by John Carmack <johnc@idsoftware.com>
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <GL/gl.h>
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgatex.h"
+
+
+/*
+ * mgaConvertTexture
+ * Converts a mesa format texture to the apropriate hardware format
+ * Note that sometimes width may be larger than the texture, like 64x1
+ * for an 8x8 texture. This happens when we have to crutch the pitch
+ * limits of the mga by uploading a block of texels as a single line.
+ */
+void mgaConvertTexture( mgaUI32 *destPtr, int texelBytes,
+ struct gl_texture_image *image,
+ int x, int y, int width, int height ) {
+ register int i, j;
+ mgaUI8 *src;
+ int stride;
+
+ /* FIXME: g400 luminance_alpha internal format */
+ switch (texelBytes) {
+ case 1:
+ switch (image->Format) {
+ case GL_COLOR_INDEX:
+ case GL_INTENSITY:
+ case GL_LUMINANCE:
+ case GL_ALPHA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 2 ; j ; j-- ) {
+
+ *destPtr++ = src[0] | ( src[1] << 8 ) | ( src[2] << 16 ) | ( src[3] << 24 );
+ src += 4;
+ }
+ src += stride;
+ }
+ break;
+ default:
+ goto format_error;
+ }
+ break;
+ case 2:
+ switch (image->Format) {
+ case GL_RGB:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 3;
+ stride = (image->Width - width) * 3;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR565(src[0],src[1],src[2]) |
+ ( MGAPACKCOLOR565(src[3],src[4],src[5]) << 16 );
+ src += 6;
+ }
+ src += stride;
+ }
+ break;
+ case GL_RGBA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 4;
+ stride = (image->Width - width) * 4;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR4444(src[0],src[1],src[2],src[3]) |
+ ( MGAPACKCOLOR4444(src[4],src[5],src[6],src[7]) << 16 );
+ src += 8;
+ }
+ src += stride;
+ }
+ break;
+ case GL_LUMINANCE:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+ /* FIXME: should probably use 555 texture to get true grey */
+ *destPtr++ = MGAPACKCOLOR565(src[0],src[0],src[0]) |
+ ( MGAPACKCOLOR565(src[1],src[1],src[1]) << 16 );
+ src += 2;
+ }
+ src += stride;
+ }
+ break;
+ case GL_INTENSITY:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[0]) |
+ ( MGAPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16 );
+ src += 2;
+ }
+ src += stride;
+ }
+ break;
+ case GL_ALPHA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR4444(255,255,255,src[0]) |
+ ( MGAPACKCOLOR4444(255,255,255,src[1]) << 16 );
+ src += 2;
+ }
+ src += stride;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 2;
+ stride = (image->Width - width) * 2;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[1]) |
+ ( MGAPACKCOLOR4444(src[2],src[2],src[2],src[3]) << 16 );
+ src += 4;
+ }
+ src += stride;
+ }
+ break;
+ default:
+ goto format_error;
+ }
+ break;
+ case 4:
+ switch (image->Format) {
+ case GL_RGB:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 3;
+ stride = (image->Width - width) * 3;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(src[0],src[1],src[2], 255);
+ src += 3;
+ }
+ src += stride;
+ }
+ break;
+ case GL_RGBA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 4;
+ stride = (image->Width - width) * 4;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(src[0],src[1],src[2],src[3]);
+ src += 4;
+ }
+ src += stride;
+ }
+ break;
+ case GL_LUMINANCE:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(src[0],src[0],src[0], 255);
+ src += 1;
+ }
+ src += stride;
+ }
+ break;
+ case GL_INTENSITY:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(src[0],src[0],src[0],src[0]);
+ src += 1;
+ }
+ src += stride;
+ }
+ break;
+ case GL_ALPHA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x );
+ stride = (image->Width - width);
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(255,255,255,src[0]);
+ src += 1;
+ }
+ src += stride;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ src = (mgaUI8 *)image->Data + ( y * image->Width + x ) * 2;
+ stride = (image->Width - width) * 2;
+ for ( i = height ; i ; i-- ) {
+ for ( j = width ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR8888(src[0],src[0],
+ src[0],src[1]);
+ src += 2;
+ }
+ src += stride;
+ }
+ break;
+ default:
+ goto format_error;
+ }
+ break;
+ default:
+ goto format_error;
+ }
+
+ return;
+
+format_error:
+
+ mgaError( "Unsupported texelBytes %i, image->Format %i\n",
+ texelBytes, image->Format );
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacommon.h b/xc/lib/GL/mesa/src/drv/mga/mgacommon.h
new file mode 100644
index 000000000..fd7c7987f
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgacommon.h
@@ -0,0 +1,44 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+
+#ifndef MGACOMMON_INC
+#define MGACOMMON_INC
+
+typedef unsigned int mgaUI32;
+typedef unsigned short mgaUI16;
+typedef unsigned char mgaUI8;
+typedef int mgaI32;
+typedef short mgaI16;
+typedef char mgaI8;
+
+typedef mgaUI8 mgaColor[4];
+
+struct mga_context_t;
+typedef struct mga_context_t mgaContext;
+typedef struct mga_context_t *mgaContextPtr;
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c
new file mode 100644
index 000000000..ad56cbbc3
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c
@@ -0,0 +1,146 @@
+/*
+ * GLX Hardware Device Driver for Matrox G200/G400
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+
+
+#include "types.h"
+#include "vbrender.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgaclear.h"
+#include "mgadd.h"
+#include "mgadepth.h"
+#include "mgalog.h"
+#include "mgastate.h"
+#include "mgaspan.h"
+#include "mgatex.h"
+#include "mgatris.h"
+#include "mgavb.h"
+#include "mgapipeline.h"
+#include "extensions.h"
+#include "vb.h"
+#include "dd.h"
+
+
+
+/***************************************
+ * Mesa's Driver Functions
+ ***************************************/
+
+
+static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ switch (name) {
+ case GL_VENDOR:
+ return "Utah GLX";
+ case GL_RENDERER:
+ if (MGA_IS_G200(mmesa)) return "GLX-MGA-G200";
+ if (MGA_IS_G400(mmesa)) return "GLX-MGA-G400";
+ return "GLX-MGA";
+ default:
+ return 0;
+ }
+}
+
+
+static GLint mgaGetParameteri(const GLcontext *ctx, GLint param)
+{
+ switch (param) {
+ case DD_HAVE_HARDWARE_FOG:
+ return 1;
+ default:
+ mgaError("mgaGetParameteri(): unknown parameter!\n");
+ return 0;
+ }
+}
+
+
+static void mgaBufferSize(GLcontext *ctx, GLuint *width, GLuint *height)
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+/* LOCK_HARDWARE( mmesa ); */
+ *width = mmesa->driDrawable->w;
+ *height = mmesa->driDrawable->h;
+/* UNLOCK_HARDWARE( mmesa ); */
+}
+
+void mgaDDExtensionsInit( GLcontext *ctx )
+{
+ /* paletted_textures currently doesn't work, but we could fix them later */
+ gl_extensions_disable( ctx, "GL_EXT_shared_texture_palette" );
+ gl_extensions_disable( ctx, "GL_EXT_paletted_texture" );
+
+ /* Support multitexture only on the g400.
+ */
+ if (!MGA_IS_G400(MGA_CONTEXT(ctx)))
+ {
+ gl_extensions_disable( ctx, "GL_EXT_multitexture" );
+ gl_extensions_disable( ctx, "GL_SGIS_multitexture" );
+ gl_extensions_disable( ctx, "GL_ARB_multitexture" );
+ }
+
+ /* Turn on texenv_add for the G400.
+ */
+ if (MGA_IS_G400(MGA_CONTEXT(ctx)))
+ {
+ gl_extensions_enable( ctx, "GL_EXT_texture_env_add" );
+ }
+
+ /* we don't support point parameters in hardware yet */
+ gl_extensions_disable( ctx, "GL_EXT_point_parameters" );
+
+ /* No support for fancy imaging stuff. This should kill off
+ * a few rogue fallbacks.
+ */
+ gl_extensions_disable( ctx, "ARB_imaging" );
+ gl_extensions_disable( ctx, "GL_EXT_blend_minmax" );
+ gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" );
+ gl_extensions_disable( ctx, "GL_EXT_blend_subtract" );
+ gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" );
+}
+
+
+
+
+
+
+
+void mgaDDInitDriverFuncs( GLcontext *ctx )
+{
+ ctx->Driver.GetBufferSize = mgaBufferSize;
+ ctx->Driver.GetString = mgaDDGetString;
+ ctx->Driver.GetParameteri = mgaGetParameteri;
+ ctx->Driver.RegisterVB = mgaDDRegisterVB;
+ ctx->Driver.UnregisterVB = mgaDDUnregisterVB;
+ ctx->Driver.BuildPrecalcPipeline = mgaDDBuildPrecalcPipeline;
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.h b/xc/lib/GL/mesa/src/drv/mga/mgadd.h
new file mode 100644
index 000000000..0bd4c712e
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.h
@@ -0,0 +1,36 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+
+#ifndef MGADD_INC
+#define MGADD_INC
+
+#include "context.h"
+
+void mgaDDInitDriverFuncs( GLcontext *ctx );
+void mgaDDExtensionsInit( GLcontext *ctx );
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadepth.c b/xc/lib/GL/mesa/src/drv/mga/mgadepth.c
new file mode 100644
index 000000000..0d55137d1
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadepth.c
@@ -0,0 +1,636 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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.
+ */
+
+/*
+ * This file has been modified by Wittawat Yamwong for GLX module.
+ */
+
+/*
+ * Depth buffer functions
+ */
+
+
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include <stdlib.h>
+#include <string.h>
+#include "context.h"
+#include "mgadepth.h"
+#include "types.h"
+#include "mm.h"
+#include "mgalib.h"
+#endif
+
+
+
+/*
+ * Return the address of the Z-buffer value for window coordinate (x,y):
+ */
+#define Z_SETUP \
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
+ __DRIscreenPrivate *sPriv = mmesa->driScreen; \
+ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
+ GLdepth *zbstart = (GLdepth *)(sPriv->pFB + mgaScreen->depthOffset);\
+ GLint zbpitch = mgaScreen->depthPitch
+
+#define Z_ADDRESS( X, Y ) \
+ (zbstart + zbpitch * (Y) + (X))
+
+
+/**********************************************************************/
+/***** Depth Testing Functions *****/
+/**********************************************************************/
+
+
+/*
+ * Depth test horizontal spans of fragments. These functions are called
+ * via ctx->Driver.depth_test_span only.
+ *
+ * Input: n - number of pixels in the span
+ * x, y - location of leftmost pixel in span in window coords
+ * z - array [n] of integer depth values
+ * In/Out: mask - array [n] of flags (1=draw pixel, 0=don't draw)
+ * Return: number of pixels which passed depth test
+ */
+
+
+/*
+ * glDepthFunc( any ) and glDepthMask( GL_TRUE or GL_FALSE ).
+ */
+static GLuint mga_depth_test_span_generic( GLcontext* ctx,
+ GLuint n, GLint x, GLint y,
+ const GLdepth z[],
+ GLubyte mask[] )
+{
+ Z_SETUP;
+ GLdepth *zptr = Z_ADDRESS( x, y );
+ GLubyte *m = mask;
+ GLuint i;
+ GLuint passed = 0;
+
+ LOCK_HARDWARE(mmesa);
+
+ /* switch cases ordered from most frequent to less frequent */
+ switch (ctx->Depth.Func) {
+ case GL_LESS:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] < *zptr) {
+ /* pass */
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ /* fail */
+ *m = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] < *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_LEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] <= *zptr) {
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] <= *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_GEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] >= *zptr) {
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] >= *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_GREATER:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] > *zptr) {
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] > *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_NOTEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] != *zptr) {
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] != *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_EQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] == *zptr) {
+ *zptr = z[i];
+ passed++;
+ }
+ else {
+ *m =0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ if (z[i] == *zptr) {
+ /* pass */
+ passed++;
+ }
+ else {
+ *m =0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_ALWAYS:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0;i<n;i++,zptr++,m++) {
+ if (*m) {
+ *zptr = z[i];
+ passed++;
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer or mask */
+ passed = n;
+ }
+ break;
+ case GL_NEVER:
+ for (i=0;i<n;i++) {
+ mask[i] = 0;
+ }
+ break;
+ default:
+ }
+
+ UNLOCK_HARDWARE(mmesa);
+
+ return passed;
+}
+
+
+
+
+
+/*
+ * Depth test an array of randomly positioned fragments.
+ */
+
+/*
+ * glDepthFunc( any ) and glDepthMask( GL_TRUE or GL_FALSE ).
+ */
+static void mga_depth_test_pixels_generic( GLcontext* ctx,
+ GLuint n,
+ const GLint x[], const GLint y[],
+ const GLdepth z[], GLubyte mask[] )
+{
+ Z_SETUP;
+ register GLdepth *zptr;
+ register GLuint i;
+
+ LOCK_HARDWARE(mmesa);
+
+ /* switch cases ordered from most frequent to less frequent */
+ switch (ctx->Depth.Func) {
+ case GL_LESS:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] < *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] < *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_LEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] <= *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] <= *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_GEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] >= *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] >= *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_GREATER:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] > *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] > *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_NOTEQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] != *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] != *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_EQUAL:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] == *zptr) {
+ /* pass */
+ *zptr = z[i];
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ if (z[i] == *zptr) {
+ /* pass */
+ }
+ else {
+ /* fail */
+ mask[i] = 0;
+ }
+ }
+ }
+ }
+ break;
+ case GL_ALWAYS:
+ if (ctx->Depth.Mask) {
+ /* Update Z buffer */
+ for (i=0; i<n; i++) {
+ if (mask[i]) {
+ zptr = Z_ADDRESS(x[i],y[i]);
+ *zptr = z[i];
+ }
+ }
+ }
+ else {
+ /* Don't update Z buffer or mask */
+ }
+ break;
+ case GL_NEVER:
+ /* depth test never passes */
+ for (i=0;i<n;i++) {
+ mask[i] = 0;
+ }
+ break;
+ default:
+ }
+
+ UNLOCK_HARDWARE(mmesa);
+}
+
+
+
+/**********************************************************************/
+/***** Read Depth Buffer *****/
+/**********************************************************************/
+
+
+/*
+ * Return a span of depth values from the depth buffer as floats in [0,1].
+ * This function is only called through Driver.read_depth_span_float()
+ * Input: n - how many pixels
+ * x,y - location of first pixel
+ * Output: depth - the array of depth values
+ */
+static void mga_read_depth_span_float( GLcontext* ctx,
+ GLuint n, GLint x, GLint y,
+ GLfloat depth[] )
+{
+ Z_SETUP;
+ GLdepth *zptr;
+ GLfloat scale;
+ GLuint i;
+
+ LOCK_HARDWARE(mmesa);
+
+ scale = 1.0F / DEPTH_SCALE;
+
+ if (ctx->Buffer->Depth) {
+ zptr = Z_ADDRESS( x, y );
+ for (i=0;i<n;i++) {
+ depth[i] = (GLfloat) zptr[i] * scale;
+ }
+ }
+ else {
+ for (i=0;i<n;i++) {
+ depth[i] = 0.0F;
+ }
+ }
+
+ UNLOCK_HARDWARE(mmesa);
+}
+
+
+/*
+ * Return a span of depth values from the depth buffer as integers in
+ * [0,MAX_DEPTH].
+ * This function is only called through Driver.read_depth_span_int()
+ * Input: n - how many pixels
+ * x,y - location of first pixel
+ * Output: depth - the array of depth values
+ */
+static void mga_read_depth_span_int( GLcontext* ctx,
+ GLuint n, GLint x, GLint y,
+ GLdepth depth[] )
+{
+ Z_SETUP;
+
+ LOCK_HARDWARE(mmesa);
+
+ if (ctx->Buffer->Depth) {
+ GLdepth *zptr = Z_ADDRESS( x, y );
+ MEMCPY( depth, zptr, n * sizeof(GLdepth) );
+ }
+ else {
+ GLuint i;
+ for (i=0;i<n;i++) {
+ depth[i] = 0;
+ }
+ }
+
+ UNLOCK_HARDWARE(mmesa);
+}
+
+
+void mgaDDInitDepthFuncs( GLcontext *ctx )
+{
+ ctx->Driver.ReadDepthSpanFloat = mga_read_depth_span_float;
+ ctx->Driver.ReadDepthSpanInt = mga_read_depth_span_int;
+ ctx->Driver.DepthTestSpan = mga_depth_test_span_generic;
+ ctx->Driver.DepthTestPixels = mga_depth_test_pixels_generic;
+}
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadepth.h b/xc/lib/GL/mesa/src/drv/mga/mgadepth.h
new file mode 100644
index 000000000..e47a114ee
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadepth.h
@@ -0,0 +1,37 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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.
+ */
+
+/*
+ * This file has been modified by Wittawat Yamwong for GLX module.
+ */
+
+
+#ifndef MGADEPTH_INC
+#define MGADEPTH_INC
+
+
+#include "types.h"
+void mgaDDInitDepthFuncs( GLcontext *ctx );
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadma.c b/xc/lib/GL/mesa/src/drv/mga/mgadma.c
new file mode 100644
index 000000000..becfb32f5
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadma.c
@@ -0,0 +1,59 @@
+/* -*- mode: C; c-basic-offset:8 -*- */
+/*
+ * GLX Hardware Device Driver for Matrox G200/G400
+ * Copyright (C) 1999 Jeff Hartmann
+ *
+ * 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
+ * JEFF HARTMANN, 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.
+ *
+ *
+ * original by Jeff Hartmann <slicer@ionet.net>
+ * 6/16/99: rewrite by John Carmack <johnc@idsoftware.com>
+ * 1/13/00: rewrite for DRI by Keith Whitwell <keithw@precisioninsight.com>
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include "mm.h"
+#include "mgabuf.h"
+#include "mgadd.h"
+#include "mgalib.h"
+#include "mgalog.h"
+#include "mgastate.h"
+#include "mgaglx.h"
+
+#include "pb.h"
+
+
+
+
+
+
+
+
+
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadma.h b/xc/lib/GL/mesa/src/drv/mga/mgadma.h
new file mode 100644
index 000000000..9a02d1f36
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadma.h
@@ -0,0 +1,41 @@
+/*
+ GLX Hardware Device Driver for Matrox Millenium G200
+ Copyright (C) 1999 Stephen Crowley (crow@debian.org)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ original by Jeff Hartmann <slicer@ionet.net>
+ 6/16/99: rewrite by John Carmack <johnc@idsoftware.com>
+*/
+
+#ifndef MGADMA_H
+#define MGADMA_H
+
+#include "mgacommon.h"
+#include "mm.h"
+#include <stdio.h>
+
+
+
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c
new file mode 100644
index 000000000..8017e7f02
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c
@@ -0,0 +1,529 @@
+/*
+ * 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 <stdio.h>
+
+#include "types.h"
+#include "enums.h"
+#include "cva.h"
+#include "vertices.h"
+#include "mmath.h"
+
+#include "mgalib.h"
+#include "mgapipeline.h"
+#include "mgatris.h"
+#include "mgastate.h"
+#include "mgavb.h"
+
+
+extern void mgaDDResizeVB( struct vertex_buffer *VB, GLuint size );
+
+extern void gl_fast_copy_vb( struct vertex_buffer *VB );
+
+struct mga_fast_tab {
+ void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest );
+ void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J );
+};
+
+
+
+
+#define POINT(x) mga_draw_point(mmesa, &ivert[x], psize)
+#define LINE(x,y) mga_draw_line(mmesa, &ivert[x], &ivert[y], lwidth)
+#define TRI(x,y,z) mga_draw_triangle(mmesa, &ivert[x], &ivert[y], &ivert[z])
+
+
+
+
+/* Direct, and no clipping required. I haven't written the clip funcs
+ * yet, so this is only useful for the fast path.
+ */
+#define RENDER_POINTS( start, count ) \
+do { \
+ GLuint e; \
+ for(e=start;e<=count;e++) \
+ POINT(elt[e]); \
+} while (0)
+
+#define RENDER_LINE( i1, i ) \
+do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ LINE( e1, e ); \
+} while (0)
+
+
+#define RENDER_TRI( i2, i1, i, pv, parity) \
+do { \
+{ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ TRI(e2, e1, e); \
+}} while (0)
+
+
+#define RENDER_QUAD( i3, i2, i1, i, pv) \
+do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ TRI(e3, e2, e); \
+ TRI(e2, e1, e); \
+} while (0)
+
+#define LOCAL_VARS \
+ mgaVertexPtr ivert = MGA_DRIVER_DATA(VB)->verts; \
+ const GLuint *elt = VB->EltPtr->data; \
+ GLcontext *ctx = VB->ctx; \
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
+ const GLfloat lwidth = ctx->Line.Width; \
+ const GLfloat psize = ctx->Point.Size; \
+ (void) lwidth; (void)psize; (void) ivert;
+
+
+#define TAG(x) x##_mga_smooth_indirect
+#include "render_tmp.h"
+
+
+
+static void mga_render_elements_direct( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLenum prim = ctx->CVA.elt_mode;
+ GLuint nr = VB->EltPtr->count;
+ render_func func = render_tab_mga_smooth_indirect[prim];
+ GLuint p = 0;
+
+ if (mmesa->new_state)
+ mgaDDUpdateHwState( ctx );
+
+ do {
+ func( VB, 0, nr, 0 );
+ } while (ctx->Driver.MultipassFunc &&
+ ctx->Driver.MultipassFunc( VB, ++p ));
+}
+
+
+
+#define NEGATIVE(f) (f < 0)
+#define DIFFERENT_SIGNS(a,b) ((a*b) < 0)
+#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
+
+
+#define INTERP_RGBA(t, out, a, b) { \
+ int i; \
+ for (i = 0; i < 4; i++) { \
+ GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]); \
+ GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]); \
+ GLfloat fo = LINTERP(t, fa, fb); \
+ FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo); \
+ } \
+}
+
+
+#define CLIP(SGN,V,PLANE) \
+if (mask & PLANE) { \
+ GLuint *indata = inlist[in]; \
+ GLuint *outdata = inlist[in ^= 1]; \
+ GLuint nr = n; \
+ GLfloat *J = verts[indata[nr-1]].f; \
+ GLfloat dpJ = (SGN J[V]) + J[3]; \
+ \
+ inlist[0] = vlist1; \
+ for (i = n = 0 ; i < nr ; i++) { \
+ GLuint elt_i = indata[i]; \
+ GLfloat *I = verts[elt_i].f; \
+ GLfloat dpI = (SGN I[V]) + I[3]; \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ \
+ GLfloat *O = verts[next_vert].f; \
+ GLfloat t, *in, *out; \
+ \
+ if (NEGATIVE(dpI)) { \
+ t = dpI / (dpI - dpJ); \
+ in = I; \
+ out = J; \
+ } \
+ else \
+ { \
+ t = dpJ / (dpJ - dpI); \
+ in = J; \
+ out = I; \
+ } \
+ \
+ interp(t, O, in, out); \
+ \
+ clipmask[next_vert] = 0; \
+ outdata[n++] = next_vert++; \
+ } \
+ \
+ clipmask[elt_i] |= PLANE; /* don't set up */ \
+ \
+ if (!NEGATIVE(dpI)) { \
+ outdata[n++] = elt_i; \
+ clipmask[elt_i] &= ~PLANE; /* set up after all */ \
+ } \
+ \
+ J = I; \
+ dpJ = dpI; \
+ } \
+ \
+ if (n < 3) return; \
+}
+
+#define LINE_CLIP(x,y,z,w,PLANE) \
+if (mask & PLANE) { \
+ GLfloat dpI = DOT4V(I,x,y,z,w); \
+ GLfloat dpJ = DOT4V(J,x,y,z,w); \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ GLfloat *O = verts[next_vert].f; \
+ GLfloat t = dpI / (dpI - dpJ); \
+ \
+ interp(t, O, I, J); \
+ \
+ clipmask[next_vert] = 0; \
+ \
+ if (NEGATIVE(dpI)) { \
+ clipmask[elts[0]] |= PLANE; \
+ I = O; elts[0] = next_vert++; \
+ } else { \
+ clipmask[elts[1]] |= PLANE; \
+ J = O; elts[1] = next_vert++; \
+ } \
+ } \
+ else if (NEGATIVE(dpI)) \
+ return; \
+}
+
+
+static __inline void mga_tri_clip( GLuint **p_elts,
+ mgaVertex *verts,
+ GLubyte *clipmask,
+ GLuint *p_next_vert,
+ GLubyte mask,
+ mga_interp_func interp )
+{
+ GLuint *elts = *p_elts;
+ GLuint next_vert = *p_next_vert;
+ GLuint vlist1[VB_MAX_CLIPPED_VERTS];
+ GLuint vlist2[VB_MAX_CLIPPED_VERTS];
+ GLuint *inlist[2];
+ GLuint *out;
+ GLuint in = 0;
+ GLuint n = 3;
+ GLuint i;
+
+ inlist[0] = elts;
+ inlist[1] = vlist2;
+
+ CLIP(-,0,CLIP_RIGHT_BIT);
+ CLIP(+,0,CLIP_LEFT_BIT);
+ CLIP(-,1,CLIP_TOP_BIT);
+ CLIP(+,1,CLIP_BOTTOM_BIT);
+ CLIP(-,2,CLIP_FAR_BIT);
+ CLIP(+,2,CLIP_NEAR_BIT);
+
+ /* Convert the planar polygon to a list of triangles.
+ */
+ out = inlist[in];
+
+ for (i = 2 ; i < n ; i++) {
+ elts[0] = out[0];
+ elts[1] = out[i-1];
+ elts[2] = out[i];
+ elts += 3;
+ }
+
+ *p_next_vert = next_vert;
+ *p_elts = elts;
+}
+
+
+static __inline void mga_line_clip( GLuint **p_elts,
+ mgaVertex *verts,
+ GLubyte *clipmask,
+ GLuint *p_next_vert,
+ GLubyte mask,
+ mga_interp_func interp )
+{
+ GLuint *elts = *p_elts;
+ GLfloat *I = verts[elts[0]].f;
+ GLfloat *J = verts[elts[1]].f;
+ GLuint next_vert = *p_next_vert;
+
+ LINE_CLIP(1,0,0,-1,CLIP_LEFT_BIT);
+ LINE_CLIP(-1,0,0,1,CLIP_RIGHT_BIT);
+ LINE_CLIP(0,1,0,-1,CLIP_TOP_BIT);
+ LINE_CLIP(0,-1,0,1,CLIP_BOTTOM_BIT);
+ LINE_CLIP(0,0,1,-1,CLIP_FAR_BIT);
+ LINE_CLIP(0,0,-1,1,CLIP_NEAR_BIT);
+
+ *p_next_vert = next_vert;
+ *p_elts += 2;
+}
+
+
+
+#define CLIP_POINT( e ) \
+ if (mask[e]) \
+ *out++ = e
+
+#define CLIP_LINE( e1, e0 ) \
+do { \
+ GLubyte ormask = mask[e0] | mask[e1]; \
+ out[0] = e1; \
+ out[1] = e0; \
+ out+=2; \
+ if (ormask) { \
+ out-=2; \
+ if (!(mask[e0] & mask[e1])) { \
+ mga_line_clip( &out, verts, mask, &next_vert, ormask, interp); \
+ } \
+ } \
+} while (0)
+
+#define CLIP_TRIANGLE( e2, e1, e0 ) \
+do { \
+ GLubyte ormask; \
+ out[0] = e2; \
+ out[1] = e1; \
+ out[2] = e0; \
+ out += 3; \
+ ormask = mask[e2] | mask[e1] | mask[e0]; \
+ if (ormask) { \
+ out -= 3; \
+ if ( !(mask[e2] & mask[e1] & mask[e0])) { \
+ mga_tri_clip( &out, verts, mask, &next_vert, ormask, interp ); \
+ } \
+ } \
+} while (0)
+
+
+
+
+
+
+/* Build a table of functions to clip each primitive type. These
+ * produce a list of elements in the appropriate 'reduced' primitive,
+ * ie (points, lines, triangles) containing all the clipped and
+ * unclipped primitives from the original list.
+ */
+#define LOCAL_VARS \
+ mgaContextPtr mmesa = MGA_CONTEXT( VB->ctx ); \
+ GLuint *elt = VB->EltPtr->data; \
+ mgaVertex *verts = MGA_DRIVER_DATA(VB)->verts; \
+ GLuint next_vert = MGA_DRIVER_DATA(VB)->last_vert; \
+ GLuint *out = MGA_DRIVER_DATA(VB)->clipped_elements.data; \
+ GLubyte *mask = VB->ClipMask; \
+ mga_interp_func interp = mmesa->interp; \
+ (void) interp; (void) verts;
+
+#define POSTFIX \
+ MGA_DRIVER_DATA(VB)->clipped_elements.count = \
+ out - MGA_DRIVER_DATA(VB)->clipped_elements.data; \
+ MGA_DRIVER_DATA(VB)->last_vert = next_vert;
+
+
+#define INIT(x)
+
+#define RENDER_POINTS(start, count) \
+do { \
+ GLuint i; \
+ for (i = start ; i < count ; i++ ) \
+ CLIP_POINT( elt[i] ); \
+} while (0)
+
+#define RENDER_LINE(i1, i0) \
+ CLIP_LINE(elt[i1], elt[i0])
+
+#define RENDER_TRI(i2, i1, i0, pv, parity) \
+do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \
+ if (parity) e2 = elt[i1], e1 = elt[i2]; \
+ CLIP_TRIANGLE( e2, e1, e0 ); \
+} while (0)
+
+#define RENDER_QUAD(i3, i2, i1, i0, pv ) \
+ CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \
+ CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0])
+
+#define TAG(x) mga_clip_##x##_elt
+#include "render_tmp.h"
+
+
+
+static void mga_project_vertices( struct vertex_buffer *VB )
+{
+ mgaVertexBufferPtr mgaVB = MGA_DRIVER_DATA(VB);
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+ GLmatrix *mat = &ctx->Viewport.WindowMap;
+ GLfloat m[16];
+
+ m[MAT_SX] = mat->m[MAT_SX];
+ m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX - .5;
+ m[MAT_SY] = (- mat->m[MAT_SY]);
+ m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5;
+ m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000);
+ m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000);
+
+ gl_project_v16( mgaVB->verts[VB->CopyStart].f,
+ mgaVB->verts[mgaVB->last_vert].f,
+ m,
+ 16 * 4 );
+}
+
+static void mga_project_clipped_vertices( struct vertex_buffer *VB )
+{
+ mgaVertexBufferPtr mgaVB = MGA_DRIVER_DATA(VB);
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+ GLmatrix *mat = &ctx->Viewport.WindowMap;
+ GLfloat m[16];
+
+ m[MAT_SX] = mat->m[MAT_SX];
+ m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX - .5;
+ m[MAT_SY] = (- mat->m[MAT_SY]);
+ m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5;
+ m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000);
+ m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000);
+
+ gl_project_clipped_v16( mgaVB->verts[VB->CopyStart].f,
+ mgaVB->verts[mgaVB->last_vert].f,
+ m,
+ 16 * 4,
+ VB->ClipMask + VB->CopyStart );
+}
+
+
+/* Pack rgba and/or texture into the remaining half of a 32 byte vertex.
+ */
+#define CLIP_UBYTE_COLOR 4
+#define CLIP_UBYTE_B 0
+#define CLIP_UBYTE_G 1
+#define CLIP_UBYTE_R 2
+#define CLIP_UBYTE_A 3
+#define CLIP_S0 6
+#define CLIP_T0 7
+#define CLIP_S1 8
+#define CLIP_T1 9
+
+#define TYPE (0)
+#define TAG(x) x
+#include "mgafasttmp.h"
+
+#define TYPE (MGA_RGBA_BIT)
+#define TAG(x) x##_RGBA
+#include "mgafasttmp.h"
+
+#define TYPE (MGA_TEX0_BIT)
+#define TAG(x) x##_TEX0
+#include "mgafasttmp.h"
+
+#define TYPE (MGA_RGBA_BIT|MGA_TEX0_BIT)
+#define TAG(x) x##_RGBA_TEX0
+#include "mgafasttmp.h"
+
+#define TYPE (MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
+#define TAG(x) x##_RGBA_TEX0_TEX1
+#include "mgafasttmp.h"
+
+#define TYPE (MGA_TEX0_BIT|MGA_TEX1_BIT)
+#define TAG(x) x##_TEX0_TEX1
+#include "mgafasttmp.h"
+
+
+/* Very sparsely popluated array - fix the indices.
+ */
+static struct mga_fast_tab mgaFastTab[0x80];
+
+void mgaDDFastPathInit( void )
+{
+ mga_clip_render_init_elt();
+ render_init_mga_smooth_indirect();
+
+ mga_init_fastpath( &mgaFastTab[0] );
+ mga_init_fastpath_RGBA( &mgaFastTab[MGA_RGBA_BIT] );
+ mga_init_fastpath_TEX0( &mgaFastTab[MGA_TEX0_BIT] );
+ mga_init_fastpath_RGBA_TEX0( &mgaFastTab[MGA_RGBA_BIT|MGA_TEX0_BIT] );
+ mga_init_fastpath_TEX0_TEX1( &mgaFastTab[MGA_TEX0_BIT|MGA_TEX1_BIT] );
+ mga_init_fastpath_RGBA_TEX0_TEX1( &mgaFastTab[MGA_RGBA_BIT|MGA_TEX0_BIT|
+ MGA_TEX1_BIT] );
+}
+
+#define VALID_SETUP (MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
+
+
+void mgaDDFastPath( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ GLenum prim = ctx->CVA.elt_mode;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ struct mga_fast_tab *tab = &mgaFastTab[mmesa->setupindex & VALID_SETUP];
+ GLuint do_cliptest = 1;
+
+ gl_prepare_arrays_cva( VB ); /* still need this */
+
+ /* Reserve enough space for the pathological case.
+ */
+ if (VB->EltPtr->count * 12 > MGA_DRIVER_DATA(VB)->size) {
+ mgaDDResizeVB( VB, VB->EltPtr->count * 12 );
+ do_cliptest = 1;
+ }
+
+ tab->build_vertices( VB, do_cliptest ); /* object->clip space */
+
+ if (mmesa->new_state)
+ mgaDDUpdateHwState( ctx );
+
+ if (VB->ClipOrMask) {
+ if (!VB->ClipAndMask) {
+ render_func *clip = mga_clip_render_tab_elt;
+
+ mmesa->interp = tab->interp;
+
+ clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */
+
+ ctx->CVA.elt_mode = gl_reduce_prim[prim];
+ VB->EltPtr = &(MGA_DRIVER_DATA(VB)->clipped_elements);
+
+ LOCK_HARDWARE( mmesa );
+ mga_project_clipped_vertices( VB ); /* clip->device space */
+ mga_render_elements_direct( VB ); /* render using new list */
+ mgaFlushVerticesLocked( mmesa );
+ UNLOCK_HARDWARE( mmesa );
+ }
+ } else {
+ LOCK_HARDWARE( mmesa );
+ mga_project_vertices( VB ); /* clip->device space */
+ mga_render_elements_direct( VB ); /* render using orig list */
+ mgaFlushVerticesLocked( mmesa );
+ UNLOCK_HARDWARE( mmesa );
+ }
+
+ /* This indicates that there is no cached data to reuse.
+ */
+ VB->pipeline->data_valid = 0;
+ VB->pipeline->new_state = 0;
+}
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h b/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h
new file mode 100644
index 000000000..43caddcac
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h
@@ -0,0 +1,143 @@
+/*
+ * DRI Hardware Device Driver for G200/G400
+ * 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.
+ *
+ */
+
+
+
+/* The first part of setup is applied to all vertices, clipped or
+ * unclipped. This data will be used for clipping, and then all
+ * vertices with a zero clipmask will be projected to device space.
+ *
+ * This could be split into several loops, but - it seems that the
+ * large stride of the fxVertices makes cache issues the big
+ * performance factor, and that multiple loops mean multiple cache
+ * misses....
+ */
+static void TAG(mga_setup_full)( struct vertex_buffer *VB, GLuint do_cliptest )
+{
+ GLcontext *ctx = VB->ctx;
+ const GLfloat * const m = ctx->ModelProjectMatrix.m;
+ GLuint start = VB->CopyStart;
+ GLuint count = VB->Count;
+ GLuint i;
+
+ gl_xform_points3_v16_general(MGA_DRIVER_DATA(VB)->verts[start].f,
+ m,
+ VB->ObjPtr->start,
+ VB->ObjPtr->stride,
+ count - start);
+
+ if (do_cliptest)
+ {
+ VB->ClipAndMask = ~0;
+ VB->ClipOrMask = 0;
+ gl_cliptest_points4_v16(MGA_DRIVER_DATA(VB)->verts[start].f,
+ MGA_DRIVER_DATA(VB)->verts[count].f,
+ &(VB->ClipOrMask),
+ &(VB->ClipAndMask),
+ VB->ClipMask + start);
+ }
+
+ /* These branches are all resolved at compile time. Hopefully all
+ * the pointers are valid addresses even when not enabled.
+ */
+ if (TYPE) {
+ GLubyte *color = VB->ColorPtr->start;
+ GLfloat *tex0_data = VB->TexCoordPtr[0]->start;
+ GLfloat *tex1_data = VB->TexCoordPtr[1]->start;
+
+ GLuint color_stride = VB->ColorPtr->stride;
+ GLuint tex0_stride = VB->TexCoordPtr[0]->stride;
+ GLuint tex1_stride = VB->TexCoordPtr[1]->stride;
+
+ GLfloat *f = MGA_DRIVER_DATA(VB)->verts[start].f;
+
+ for (i = start ; i < count ; i++, f += 16) {
+ if (TYPE & MGA_RGBA_BIT) {
+ GLubyte *b = (GLubyte *)&f[CLIP_UBYTE_COLOR];
+ GLubyte *col = color; color += color_stride;
+ b[CLIP_UBYTE_R] = col[0];
+ b[CLIP_UBYTE_G] = col[1];
+ b[CLIP_UBYTE_B] = col[2];
+ b[CLIP_UBYTE_A] = col[3];
+ }
+ if (TYPE & MGA_TEX0_BIT) {
+ f[CLIP_S0] = tex0_data[0];
+ f[CLIP_T0] = tex0_data[1];
+ STRIDE_F(tex0_data, tex0_stride);
+ }
+ if (TYPE & MGA_TEX1_BIT) {
+ f[CLIP_S1] = tex1_data[0];
+ f[CLIP_T1] = tex1_data[1];
+ STRIDE_F(tex1_data, tex1_stride);
+ }
+ }
+ }
+
+ MGA_DRIVER_DATA(VB)->clipped_elements.count = start;
+ MGA_DRIVER_DATA(VB)->last_vert = count;
+}
+
+
+/* Changed to just put the interp func instead of the whole clip
+ * routine into the header. Less code and better chance of doing some
+ * of this stuff in assembly.
+ */
+static void TAG(mga_interp_vert)( GLfloat t,
+ GLfloat *O,
+ const GLfloat *I,
+ const GLfloat *J )
+{
+ O[0] = LINTERP(t, I[0], J[0]);
+ O[1] = LINTERP(t, I[1], J[1]);
+ O[2] = LINTERP(t, I[2], J[2]);
+ O[3] = LINTERP(t, I[3], J[3]);
+
+ if (TYPE & MGA_RGBA_BIT) {
+ INTERP_RGBA(t,
+ ((GLubyte *)&(O[4])),
+ ((GLubyte *)&(I[4])),
+ ((GLubyte *)&(J[4])));
+ }
+
+ if (TYPE & MGA_TEX0_BIT) {
+ O[6] = LINTERP(t, I[6], J[6]);
+ O[7] = LINTERP(t, I[7], J[7]);
+ }
+
+ if (TYPE & MGA_TEX1_BIT) {
+ O[8] = LINTERP(t, I[8], J[8]);
+ O[9] = LINTERP(t, I[9], J[9]);
+ }
+}
+
+
+static void TAG(mga_init_fastpath)( struct mga_fast_tab *tab )
+{
+ tab->interp = TAG(mga_interp_vert);
+ tab->build_vertices = TAG(mga_setup_full);
+}
+
+#undef TYPE
+#undef TAG
+#undef SIZE
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
new file mode 100644
index 000000000..c1819924d
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
@@ -0,0 +1,321 @@
+#include <stdio.h>
+
+
+#include "types.h"
+#include "pb.h"
+#include "dd.h"
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgadd.h"
+#include "mgastate.h"
+#include "mgadepth.h"
+#include "mgatex.h"
+#include "mgalog.h"
+#include "mgavb.h"
+#include "mgatris.h"
+
+#include "drm.h"
+#include <sys/ioctl.h>
+
+static void mga_iload_dma_ioctl(mgaContextPtr mmesa,
+ int x1, int y1, int x2, int y2,
+ unsigned long dest, unsigned int maccess)
+{
+ int retcode;
+ drm_mga_iload_t iload;
+ drmBufPtr buf = mmesa->dma_buffer;
+
+ iload.idx = buf->idx;
+ iload.destOrg = dest;
+ iload.mAccess = maccess;
+ iload.texture.x1 = x1;
+ iload.texture.y1 = y1;
+ iload.texture.y2 = x2;
+ iload.texture.x2 = y2;
+
+ if ((retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_ILOAD, &iload))) {
+ printf("send iload retcode = %d\n", retcode);
+ exit(1);
+ }
+}
+
+
+static void mga_vertex_dma_ioctl(mgaContextPtr mmesa)
+{
+ int retcode;
+ int size = MGA_DMA_BUF_SZ;
+ drmDMAReq dma;
+ drmBufPtr buf = mmesa->dma_buffer;
+
+ dma.context = mmesa->hHWContext;
+ dma.send_count = 1;
+ dma.send_list = &buf->idx;
+ dma.send_sizes = &size;
+ dma.flags = DRM_DMA_WAIT;
+ dma.request_count = 0;
+ dma.request_size = 0;
+ dma.request_list = 0;
+ dma.request_sizes = 0;
+
+ if ((retcode = drmDMA(mmesa->driFd, &dma))) {
+ printf("send iload retcode = %d\n", retcode);
+ exit(1);
+ }
+}
+
+
+static void mga_get_buffer_ioctl( mgaContextPtr mmesa )
+{
+ int idx = 0;
+ int size = 0;
+ drmDMAReq dma;
+ int retcode;
+
+ fprintf(stderr, "Getting dma buffer\n");
+
+ dma.context = mmesa->hHWContext;
+ dma.send_count = 0;
+ dma.send_list = NULL;
+ dma.send_sizes = NULL;
+ dma.flags = DRM_DMA_WAIT;
+ dma.request_count = 1;
+ dma.request_size = MGA_DMA_BUF_SZ;
+ dma.request_list = &idx;
+ dma.request_sizes = &size;
+
+ if ((retcode = drmDMA(mmesa->driFd, &dma))) {
+ fprintf(stderr, "request drmDMA retcode = %d\n", retcode);
+ exit(1);
+ }
+
+ mmesa->dma_buffer = &mmesa->mgaScreen->bufs->list[idx];
+}
+
+static void mga_swap_ioctl( mgaContextPtr mmesa )
+{
+ int retcode;
+ drm_mga_swap_t swap;
+
+ if((retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_SWAP, &swap))) {
+ printf("send swap retcode = %d\n", retcode);
+ exit(1);
+ }
+}
+
+
+
+static void mga_clear_ioctl( mgaContextPtr mmesa, int flags, int col, int zval )
+{
+ int retcode;
+ drm_mga_clear_t clear;
+
+ clear.flags = flags;
+ clear.clear_color = col;
+ clear.clear_depth = zval;
+
+ if((retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_CLEAR, &clear))) {
+ printf("send clear retcode = %d\n", retcode);
+ exit(1);
+ }
+}
+
+
+
+
+
+
+
+GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
+ GLint cx, GLint cy, GLint cw, GLint ch )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint c = mmesa->ClearColor;
+ mgaUI32 zval = (mgaUI32) (ctx->Depth.Clear * DEPTH_SCALE);
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+ int flags = 0;
+ int i;
+
+ mgaMsg( 10, "mgaClear( %i, %i, %i, %i, %i )\n",
+ mask, x, y, width, height );
+
+
+ mgaFlushVertices( mmesa );
+
+
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) {
+ flags |= MGA_CLEAR_FRONT;
+ mask &= ~GL_COLOR_BUFFER_BIT;
+ } else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) {
+ flags |= MGA_CLEAR_BACK;
+ mask &= ~GL_COLOR_BUFFER_BIT;
+ }
+ }
+
+ if ((flags & GL_DEPTH_BUFFER_BIT) && ctx->Depth.Mask) {
+ flags |= MGA_CLEAR_DEPTH;
+ mask &= ~GL_DEPTH_BUFFER_BIT;
+ }
+
+ if (!flags)
+ return mask;
+
+ LOCK_HARDWARE( mmesa );
+
+ /* flip top to bottom */
+ cy = dPriv->h-cy-ch;
+ cx += mmesa->drawX;
+ cy += mmesa->drawY;
+
+ for (i = 0 ; i < dPriv->numClipRects ; ) {
+
+ /* Use the cliprects for the current draw buffer
+ */
+ int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, mmesa->numClipRects);
+ XF86DRIClipRectRec *box = mmesa->pClipRects;
+ xf86drmClipRectRec *b = mmesa->sarea->boxes;
+ mmesa->sarea->nbox = nr - i;
+
+ 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++;
+ }
+ } else {
+ for ( ; i < nr ; i++)
+ *b++ = *(xf86drmClipRectRec *)&box[i];
+ }
+
+ mga_clear_ioctl( mmesa, mask, c, zval );
+ }
+
+ UNLOCK_HARDWARE( mmesa );
+ return mask;
+}
+
+
+
+
+/*
+ * Copy the back buffer to the front buffer.
+ */
+void mgaSwapBuffers( mgaContextPtr mmesa )
+{
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+ int i;
+
+ mgaFlushVertices( mmesa );
+
+ LOCK_HARDWARE( mmesa );
+ {
+ /* Use the frontbuffer cliprects
+ */
+ XF86DRIClipRectPtr pbox = dPriv->pClipRects;
+ int nbox = dPriv->numClipRects;
+
+ for (i = 0 ; i < nbox ; )
+ {
+ int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
+ XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)mmesa->sarea->boxes;
+ mmesa->sarea->nbox = nr - i;
+
+ for ( ; i < nr ; i++)
+ *b++ = pbox[i];
+
+ mga_swap_ioctl( mmesa );
+ }
+ }
+
+
+#if 1
+ UNLOCK_HARDWARE(mmesa);
+#else
+ {
+ last_enqueue = mmesa->sarea->lastEnqueue;
+ last_dispatch = mmesa->sarea->lastDispatch;
+ UNLOCK_HARDWARE;
+
+ /* Throttle runaway apps - there should be an easier way to sleep
+ * on dma without locking out the rest of the system!
+ */
+ if (mmesa->lastSwap > last_dispatch) {
+ drmGetLock(mmesa->driFd, mmesa->hHWContext, DRM_LOCK_QUIESCENT);
+ DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext);
+ }
+
+ mmesa->lastSwap = last_enqueue;
+ }
+#endif
+}
+
+
+/* This is overkill
+ */
+void mgaDDFinish( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ drmGetLock(mmesa->driFd, mmesa->hHWContext, DRM_LOCK_QUIESCENT);
+ DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext);
+}
+
+
+
+
+void mgaFlushVertices( mgaContextPtr mmesa )
+{
+ LOCK_HARDWARE( mmesa );
+ mgaFlushVerticesLocked( mmesa );
+ UNLOCK_HARDWARE( mmesa );
+}
+
+
+void mgaFlushVerticesLocked( mgaContextPtr mmesa )
+{
+ XF86DRIClipRectPtr pbox = mmesa->pClipRects;
+ int nbox = mmesa->numClipRects;
+ int i;
+
+ if (mmesa->dirty)
+ mgaEmitHwStateLocked( mmesa );
+
+ for (i = 0 ; i < nbox ; )
+ {
+ int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox);
+ XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)mmesa->sarea->boxes;
+ mmesa->sarea->nbox = nr - i;
+
+ for ( ; i < nr ; i++)
+ *b++ = pbox[i];
+
+ mga_vertex_dma_ioctl( mmesa );
+
+ break; /* fix dma multiple dispatch */
+ }
+
+ mga_get_buffer_ioctl( mmesa );
+}
+
+
+
+void mgaDDInitIoctlFuncs( GLcontext *ctx )
+{
+ ctx->Driver.Clear = mgaClear;
+ ctx->Driver.Flush = 0;
+ 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
new file mode 100644
index 000000000..22ca26e17
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
@@ -0,0 +1,23 @@
+#ifndef MGA_IOCTL_H
+#define MGA_IOCTL_H
+
+#include "mgalib.h"
+
+GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
+ GLint cx, GLint cy, GLint cw, GLint ch );
+
+
+void mgaSwapBuffers( mgaContextPtr mmesa );
+
+void mgaFlushVertices( mgaContextPtr mmesa );
+void mgaFlushVerticesLocked( mgaContextPtr mmesa );
+
+/* upload texture
+ */
+
+void mgaDDFinish( GLcontext *ctx );
+
+void mgaDDInitIoctlFuncs( GLcontext *ctx );
+
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgalib.h b/xc/lib/GL/mesa/src/drv/mga/mgalib.h
new file mode 100644
index 000000000..4600a69a0
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgalib.h
@@ -0,0 +1,266 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+
+#ifndef MGALIB_INC
+#define MGALIB_INC
+
+#include <X11/Xlibint.h>
+#include "dri_tmm.h"
+#include "dri_mesaint.h"
+#include "dri_mesa.h"
+#include "xmesaP.h"
+
+#include "types.h"
+
+#include "mgacommon.h"
+#include "mm.h"
+#include "mgalog.h"
+#include "mgaioctl.h"
+#include "mgatex.h"
+#include "mgavb.h"
+
+#include "mga_drm_public.h"
+#include "mga_xmesa.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_CHIP_MGAG200 0
+#define MGA_CHIP_MGAG400 1
+
+#define MGA_IS_G200(mmesa) (mmesa->mgaScreen->chipset == MGA_CHIP_MGAG200)
+#define MGA_IS_G400(mmesa) (mmesa->mgaScreen->chipset == MGA_CHIP_MGAG400)
+
+
+/* SoftwareFallback
+ * - texture env GL_BLEND -- can be fixed
+ * - 1D and 3D textures
+ * - incomplete textures
+ */
+#define MGA_FALLBACK_TEXTURE 0x1
+#define MGA_FALLBACK_BUFFER 0x2
+
+
+/* For mgaCtx->new_state.
+ */
+#define MGA_NEW_DEPTH 0x1
+#define MGA_NEW_ALPHA 0x2
+#define MGA_NEW_FOG 0x4
+#define MGA_NEW_CLIP 0x8
+#define MGA_NEW_MASK 0x10
+#define MGA_NEW_TEXTURE 0x20
+#define MGA_NEW_CULL 0x40
+#define MGA_NEW_WARP 0x80
+#define MGA_NEW_CONTEXT 0x100
+
+
+typedef void (*mga_interp_func)( GLfloat t,
+ GLfloat *result,
+ const GLfloat *in,
+ const GLfloat *out );
+
+
+
+
+/* if type == MGA_COLORBUFFER */
+#define MGA_PF_MASK 0xf0
+#define MGA_PF_INDEX 0
+#define MGA_PF_565 (1 << 4)
+#define MGA_PF_555 (9 << 4)
+#define MGA_PF_888 (3 << 4)
+#define MGA_PF_8888 (10 << 4)
+#define MGA_PF_HASALPHA (8 << 4)
+
+struct mga_context_t {
+
+ GLcontext *glCtx;
+
+ /* Hardware state - moved from mgabuf.h
+ */
+ mgaUI32 Setup[MGA_CTX_SETUP_SIZE];
+
+ /* Variable sized vertices
+ */
+ mgaUI32 vertsize;
+
+ /* Map GL texture units onto hardware.
+ */
+ mgaUI32 multitex;
+ mgaUI32 tmu_source[2];
+ mgaUI32 tex_dest[2];
+
+
+
+ /* bookkeeping for textureing */
+ struct mga_texture_object_s TexObjList;
+ struct mga_texture_object_s SwappedOut;
+ struct mga_texture_object_s *CurrentTexObj[2];
+
+
+ /* shared texture palette */
+ mgaUI16 GlobalPalette[256];
+
+ int Fallback; /* or'ed values of FALLBACK_* */
+
+ /* Support for CVA and the fast paths */
+ unsigned int setupdone;
+ unsigned int setupindex;
+ unsigned int renderindex;
+ unsigned int using_fast_path;
+ unsigned int using_immediate_fast_path;
+ mga_interp_func interp;
+
+ /* Shortcircuit some state changes */
+ points_func PointsFunc;
+ line_func LineFunc;
+ triangle_func TriangleFunc;
+ quad_func QuadFunc;
+
+ /* Manage our own state */
+ GLuint new_state;
+ GLuint dirty;
+
+ GLubyte clearcolor[4];
+ GLushort MonoColor;
+ GLushort ClearColor;
+
+
+ /* DRI stuff
+ */
+ drmBufPtr dma_buffer;
+
+ GLframebuffer *glBuffer;
+ memHeap_t *texHeap;
+
+ GLuint needClip;
+ GLuint warp_pipe;
+
+ /* These refer to the current draw (front vs. back) buffer:
+ */
+ int drawOffset; /* draw buffer address in agp space */
+ int drawX; /* origin of drawable in draw buffer */
+ int drawY;
+ GLuint numClipRects; /* cliprects for that buffer */
+ XF86DRIClipRectPtr pClipRects;
+
+ int texAge;
+
+ XF86DRIClipRectRec draw_rect;
+
+ drmContext hHWContext;
+ drmLock *driHwLock;
+ int driFd;
+ Display *display;
+
+ __DRIdrawablePrivate *driDrawable;
+ __DRIscreenPrivate *driScreen;
+ mgaScreenPrivate *mgaScreen;
+ drm_mga_sarea_t *sarea;
+};
+
+
+
+
+typedef struct {
+
+ /* dma stuff */
+ mgaUI32 systemTexture;
+ mgaUI32 noSetupDma;
+
+ mgaUI32 default32BitTextures;
+ mgaUI32 swapBuffersCount;
+
+ /* options */
+ mgaUI32 nullprims; /* skip all primitive generation */
+ mgaUI32 noFallback; /* don't fall back to software, do
+ best-effort rendering */
+ mgaUI32 skipDma; /* don't send anything to the hardware */
+
+ /* performance counters */
+ mgaUI32 c_textureUtilization;
+ mgaUI32 c_textureSwaps;
+ mgaUI32 c_setupPointers;
+ mgaUI32 c_triangles;
+ mgaUI32 c_points;
+ mgaUI32 c_lines;
+ mgaUI32 c_drawWaits;
+ mgaUI32 c_dmaFlush;
+ mgaUI32 c_overflows;
+
+} mgaGlx_t;
+
+extern mgaGlx_t mgaglx;
+
+
+#define MGAPACKCOLOR555(r,g,b,a) \
+ ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
+ ((a) ? 0x8000 : 0))
+
+#define MGAPACKCOLOR565(r,g,b) \
+ ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
+
+#define MGAPACKCOLOR888(r,g,b) \
+ (((r) << 16) | ((g) << 8) | (b))
+
+#define MGAPACKCOLOR8888(r,g,b,a) \
+ (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
+
+#define MGAPACKCOLOR4444(r,g,b,a) \
+ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
+
+
+#define MGA_DEBUG 0
+#ifndef MGA_DEBUG
+extern int MGA_DEBUG;
+#endif
+
+#define MGA_DEBUG_ALWAYS_SYNC 0x1
+#define MGA_DEBUG_VERBOSE_MSG 0x2
+#define MGA_DEBUG_VERBOSE_LRU 0x4
+#define MGA_DEBUG_VERBOSE_DRI 0x8
+
+static __inline__ mgaUI32 mgaPackColor(mgaUI32 format,
+ mgaUI8 r, mgaUI8 g,
+ mgaUI8 b, mgaUI8 a)
+{
+ switch (format & MGA_PF_MASK) {
+ case MGA_PF_555:
+ return MGAPACKCOLOR555(r,g,b,a);
+ case MGA_PF_565:
+ return MGAPACKCOLOR565(r,g,b);
+ case MGA_PF_888:
+ return MGAPACKCOLOR888(r,g,b);
+ case MGA_PF_8888:
+ return MGAPACKCOLOR8888(r,g,b,a);
+ default:
+ return 0;
+ }
+}
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgalog.h b/xc/lib/GL/mesa/src/drv/mga/mgalog.h
new file mode 100644
index 000000000..74f52f8d6
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgalog.h
@@ -0,0 +1,47 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+/* 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 MGALOG_INC
+#define MGALOG_INC
+#include "hwlog.h"
+
+/* Mapping between old function names and new common code: */
+/* (Feel free to replace all mgaMsg with hwMsg etc. in all *.c
+ * files, I was to lazy to do this...) */
+#define mgaOpenLog(f) hwOpenLog(f,"[mga] ")
+#define mgaCloseLog hwCloseLog
+#define mgaIsLogReady hwIsLogReady
+#define mgaSetLogLevel hwSetLogLevel
+#define mgaGetLogLevel hwGetLogLevel
+#define mgaMsg hwMsg
+#define mgaError hwError
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c
new file mode 100644
index 000000000..8f8fea669
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c
@@ -0,0 +1,138 @@
+/* #include "mgapipeline.h" */
+
+#include <stdio.h>
+#include "mgavb.h"
+#include "mgadd.h"
+#include "mgalib.h"
+#include "mgatris.h"
+#include "mgapipeline.h"
+#include "fog.h"
+
+static struct gl_pipeline_stage mga_fast_stage = {
+ "MGA fast path",
+ (PIPE_OP_VERT_XFORM|PIPE_OP_RAST_SETUP_0|
+ PIPE_OP_RAST_SETUP_1|PIPE_OP_RENDER),
+ PIPE_PRECALC,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ mgaDDFastPath
+};
+
+
+#define ILLEGAL_ENABLES (TEXTURE0_3D| \
+ TEXTURE1_3D| \
+ ENABLE_TEXMAT0 | \
+ ENABLE_TEXMAT1 | \
+ ENABLE_TEXGEN0 | \
+ ENABLE_TEXGEN1 | \
+ ENABLE_USERCLIP | \
+ ENABLE_LIGHT | \
+ ENABLE_FOG)
+
+
+/* The driver gets first shot at building the pipeline - make some
+ * quick tests to see if we can use the fast path.
+ */
+GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx )
+{
+ struct gl_pipeline *pipe = &ctx->CVA.pre;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+
+ if (mmesa->renderindex == 0 &&
+ (ctx->Enabled & ILLEGAL_ENABLES) == 0 &&
+ (ctx->Array.Flags & (VERT_OBJ_234|
+ VERT_TEX0_4|
+ VERT_TEX1_4|
+ VERT_ELT)) == (VERT_OBJ_23|VERT_ELT))
+ {
+ pipe->stages[0] = &mga_fast_stage;
+ pipe->stages[1] = 0;
+ pipe->new_inputs = ctx->RenderFlags & VERT_DATA;
+ pipe->ops = pipe->stages[0]->ops;
+ mmesa->using_fast_path = 1;
+ return 1;
+ }
+
+ if (mmesa->using_fast_path)
+ {
+ mmesa->using_fast_path = 0;
+ ctx->CVA.VB->ClipOrMask = 0;
+ ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS;
+ ctx->Array.NewArrayState |= ctx->Array.Summary;
+ return 0;
+ }
+
+ return 0;
+}
+
+
+
+
+/* Still do the normal fixup and copy-to-current, so this isn't so
+ * bad.
+ */
+#define ILLEGAL_INPUTS_IMM (VERT_OBJ_4| \
+ VERT_TEX0_4| \
+ VERT_TEX1_4| \
+ VERT_MATERIAL)
+
+
+static void mgaDDCheckRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d )
+{
+ d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
+ d->inputs = ctx->RenderFlags;
+
+ /* MGA requires an extra input:
+ */
+ if (ctx->FogMode == FOG_FRAGMENT)
+ d->inputs |= VERT_FOG_COORD;
+
+ d->outputs = VERT_SETUP_FULL;
+
+ if (ctx->IndirectTriangles & DD_SW_SETUP)
+ d->type = PIPE_IMMEDIATE;
+}
+
+
+GLuint mgaDDRegisterPipelineStages( struct gl_pipeline_stage *out,
+ const struct gl_pipeline_stage *in,
+ GLuint nr )
+{
+ GLuint i, o;
+
+ for (i = o = 0 ; i < nr ; i++) {
+ switch (in[i].ops) {
+
+ /* Completely replace Mesa's fog processing to generate fog
+ * coordinates instead of messing with colors.
+ */
+ case PIPE_OP_FOG:
+ out[o] = gl_fog_coord_stage;
+ o++;
+ break;
+
+ case PIPE_OP_RAST_SETUP_0:
+ out[o] = in[i];
+ out[o].cva_state_change = NEW_LIGHTING|NEW_TEXTURING|NEW_RASTER_OPS;
+ out[o].state_change = ~0;
+ out[o].check = mgaDDCheckPartialRasterSetup;
+ out[o].run = mgaDDPartialRasterSetup;
+ o++;
+ break;
+
+ case PIPE_OP_RAST_SETUP_0|PIPE_OP_RAST_SETUP_1:
+ out[o] = in[i];
+ out[o].check = mgaDDCheckRasterSetup;
+ out[o].run = mgaDDDoRasterSetup;
+ o++;
+ break;
+
+ default:
+ out[o++] = in[i];
+ break;
+ }
+ }
+
+ return o;
+}
+
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h
new file mode 100644
index 000000000..d42abddfe
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h
@@ -0,0 +1,15 @@
+#ifndef _MGA_PIPELINE_H
+#define _MGA_PIPELINE_H
+
+
+extern GLuint mgaDDRegisterPipelineStages( struct gl_pipeline_stage *out,
+ const struct gl_pipeline_stage *in,
+ GLuint nr );
+
+extern GLboolean mgaDDBuildImmediatePipeline( GLcontext *ctx );
+extern GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx );
+
+extern void mgaDDFastPath( struct vertex_buffer *VB );
+extern void mgaDDFastPathInit( void );
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaregs.h b/xc/lib/GL/mesa/src/drv/mga/mgaregs.h
new file mode 100644
index 000000000..3842ee258
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaregs.h
@@ -0,0 +1,1377 @@
+/* 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.
+ */
+
+#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_tw422 0xa /* val 10, 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_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_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 ******************/
+
+#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
new file mode 100644
index 000000000..6f406db2d
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgarender.c
@@ -0,0 +1,334 @@
+#include <stdio.h>
+#include "mgadd.h"
+#include "mgavb.h"
+#include "mgadma.h"
+#include "mgalib.h"
+#include "mgatris.h"
+#include "mgastate.h"
+#include "xsmesaP.h"
+#include "enums.h"
+
+#define POINT(x) mga_draw_point(&gWin[x], psize)
+#define LINE(x,y) mga_draw_line(&gWin[x], &gWin[y], lwidth)
+#define TRI(x,y,z) mga_draw_triangle(&gWin[x], &gWin[y], &gWin[z])
+
+
+/* Direct, and no clipping required. I haven't written the clip funcs
+ * yet, so this is only useful for the fast path, which does its own
+ * clipping.
+ */
+#define RENDER_POINTS( start, count ) \
+do { \
+ GLuint e; \
+ for(e=start;e<=count;e++) \
+ POINT(elt[e]); \
+} while (0)
+
+#define RENDER_LINE( i1, i ) \
+do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ LINE( e1, e ); \
+} while (0)
+
+
+#define RENDER_TRI( i2, i1, i, pv, parity) \
+do { \
+{ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ TRI(e2, e1, e); \
+}} while (0)
+
+
+#define RENDER_QUAD( i3, i2, i1, i, pv) \
+do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ TRI(e3, e2, e); \
+ TRI(e2, e1, e); \
+} while (0)
+
+#define LOCAL_VARS \
+ mgaVertexPtr gWin = MGA_DRIVER_DATA(VB)->verts; \
+ const GLuint *elt = VB->EltPtr->data; \
+ const GLfloat lwidth = VB->ctx->Line.Width; \
+ const GLfloat psize = VB->ctx->Point.Size; \
+ GLcontext *ctx = VB->ctx; \
+ (void) lwidth; (void)psize; (void)ctx; (void) gWin;
+
+
+#define TAG(x) x##_mga_smooth_indirect
+#include "render_tmp.h"
+
+
+
+
+#define RENDER_POINTS( start, count ) \
+do { \
+ GLuint e; \
+ for(e=start;e<=count;e++) \
+ POINT(e); \
+} while (0)
+
+#define RENDER_LINE( i1, i ) \
+do { \
+ LINE( i1, i ); \
+} while (0)
+
+
+#define RENDER_TRI( i2, i1, i, pv, parity) \
+do { \
+ GLuint e2 = i2, e1 = i1; \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ TRI(e2, e1, i); \
+} while (0)
+
+
+#define RENDER_QUAD( i3, i2, i1, i, pv) \
+do { \
+ TRI(i3, i2, i); \
+ TRI(i2, i1, i); \
+} while (0)
+
+#define LOCAL_VARS \
+ mgaVertexPtr gWin = MGA_DRIVER_DATA(VB)->verts; \
+ const GLfloat lwidth = VB->ctx->Line.Width; \
+ const GLfloat psize = VB->ctx->Point.Size; \
+ GLcontext *ctx = VB->ctx; \
+ (void) lwidth; (void)psize; (void)ctx; (void) gWin;
+
+#define TAG(x) x##_mga_smooth_direct
+#include "render_tmp.h"
+
+
+
+
+
+/* Vertex array rendering via. the SetupDma function - no clipping required.
+ */
+#define RENDER_POINTS( start, count ) \
+do { \
+ FatalError("Dead code in mgarender.c\n"); \
+} while (0)
+
+#define RENDER_LINE( i1, i ) \
+do { \
+ FatalError("Dead code in mgarender.c\n"); \
+} while (0)
+
+
+#define RENDER_TRI( i2, i1, i, pv, parity) \
+do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (/*parity*/0) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ TRI(e2, e1, e); \
+} while (0)
+
+#define RENDER_QUAD( i3, i2, i1, i, pv) \
+do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ TRI(e3, e2, e); \
+ TRI(e2, e1, e); \
+} while (0)
+
+#define LOCAL_VARS \
+ mgaVertexBufferPtr mgaVB = MGA_DRIVER_DATA(VB); \
+ mgaUI32 phys = mgaVB->vert_phys_start; \
+ const GLuint *elt = VB->EltPtr->data; \
+ (void) phys; (void) elt;
+
+#define PRESERVE_VB_DEFS
+#undef TRI
+#define VERT_ADDR_10( phys, elt ) ( phys + elt * 48 )
+#define TRI( ee0, ee1, ee2 ) \
+{ \
+ mgaVB->elt_buf[0] = VERT_ADDR_10(phys, ee0); \
+ mgaVB->elt_buf[1] = VERT_ADDR_10(phys, ee1); \
+ mgaVB->elt_buf[2] = VERT_ADDR_10(phys, ee2); \
+ mgaVB->elt_buf += 3; \
+}
+#define TAG(x) x##_mga_elt_10
+#include "render_tmp.h"
+
+
+#define TAG(x) x##_mga_elt_8
+#undef TRI
+#define VERT_ADDR_8( phys, elt ) ( phys + elt * 32 )
+#define TRI( ee0, ee1, ee2 ) \
+{ \
+ mgaVB->elt_buf[0] = VERT_ADDR_8(phys, ee0); \
+ mgaVB->elt_buf[1] = VERT_ADDR_8(phys, ee1); \
+ mgaVB->elt_buf[2] = VERT_ADDR_8(phys, ee2); \
+ mgaVB->elt_buf += 3; \
+}
+#include "render_tmp.h"
+
+
+
+
+/* Currently only used on the fast path - need a set of render funcs
+ * for clipped primitives.
+ */
+void mgaDDRenderElementsDirect( struct vertex_buffer *VB )
+{
+ mgaVertexBufferPtr mgaVB = MGA_DRIVER_DATA(VB);
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLenum prim = ctx->CVA.elt_mode;
+ GLuint nr = VB->EltPtr->count;
+ render_func func = render_tab_mga_smooth_indirect[prim];
+ GLuint p = 0;
+ mgaUI32 *start = mgaVB->elt_buf;
+
+ struct vertex_buffer *saved_vb = ctx->VB;
+
+ if (mmesa->new_state)
+ mgaDDUpdateHwState( ctx );
+
+ /* Are we using Setup DMA?
+ */
+ if (start) {
+ switch (MGA_CONTEXT(ctx)->vertsize) {
+ case 10:
+ func = render_tab_mga_elt_10[prim];
+ break;
+ case 8:
+ func = render_tab_mga_elt_8[prim];
+ break;
+ default:
+ }
+ }
+
+ ctx->VB = VB;
+
+ do {
+ func( VB, 0, nr, 0 );
+ } while (ctx->Driver.MultipassFunc &&
+ ctx->Driver.MultipassFunc( VB, ++p ));
+
+ ctx->VB = saved_vb;
+
+
+ if (start && nr) {
+ if (0)
+ fprintf(stderr, "%d/%d elts\n", nr, mgaVB->elt_buf-start);
+ mgaSetupDma( start, mgaVB->elt_buf - start );
+ mgaVB->elt_buf = mgaVB->vert_buf = 0;
+ }
+}
+
+
+void mgaDDRenderElementsImmediate( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint nr = VB->EltPtr->count;
+ render_func *tab = render_tab_mga_smooth_indirect;
+ GLuint parity = VB->Parity;
+ GLuint p = 0;
+ GLuint i, next;
+
+ if (mmesa->new_state)
+ mgaDDUpdateHwState( ctx );
+
+ do {
+ for ( i= VB->CopyStart ; i < nr ; parity = 0, i = next )
+ {
+ GLenum prim = VB->Primitive[i];
+ next = VB->NextPrimitive[i];
+ tab[prim]( VB, i, next, parity );
+ }
+ } while (ctx->Driver.MultipassFunc &&
+ ctx->Driver.MultipassFunc( VB, ++p ));
+}
+
+
+void mgaDDRenderDirect( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint nr = VB->Count;
+ render_func *tab = render_tab_mga_smooth_direct;
+ GLuint parity = VB->Parity;
+ GLuint p = 0;
+ GLuint i, next;
+
+ if (mmesa->new_state)
+ mgaDDUpdateHwState( ctx );
+
+ do {
+ for ( i= VB->CopyStart ; i < nr ; parity = 0, i = next )
+ {
+ GLenum prim = VB->Primitive[i];
+ next = VB->NextPrimitive[i];
+ tab[prim]( VB, i, next, parity );
+ }
+ } while (ctx->Driver.MultipassFunc &&
+ ctx->Driver.MultipassFunc( VB, ++p ));
+}
+
+
+static void optimized_render_vb_triangle_mga_smooth_indirect(struct vertex_buffer *VB,
+ GLuint start,
+ GLuint count,
+ GLuint parity)
+{
+ mgaVertexPtr gWin = MGA_DRIVER_DATA(VB)->verts;
+ const GLuint *elt = VB->EltPtr->data;
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+
+ mgaUI32 vertsize = mmesa->vertsize;
+
+ /* We know how many dwords we need so we can allocate all of it
+ * in one call */
+ mgaUI32 *wv = mgaAllocSecondaryBuffer( count * vertsize );
+
+ int vertex;
+
+ (void)ctx; (void) gWin; (void) parity;
+
+
+ for(vertex=start+2;vertex<count;vertex+=3){
+ GLuint e2=elt[vertex-2],e1=elt[vertex-1],e=elt[vertex];
+ mgaUI32 *src;
+
+ int j;
+
+ if(parity){
+ GLuint tmp=e2;
+ e2=e1;
+ e1=tmp;
+ }
+
+ src=&gWin[e2].ui[0];
+
+ for(j=vertsize;j;j--){
+ *wv++=*src++;
+ }
+
+ src=&gWin[e1].ui[0];
+ for(j=vertsize;j;j--){
+ *wv++=*src++;
+ }
+
+ src=&gWin[e].ui[0];
+ for(j=vertsize;j;j--){
+ *wv++=*src++;
+ }
+ }
+
+}
+
+
+void mgaDDRenderInit()
+{
+
+ render_init_mga_smooth_indirect();
+ render_init_mga_smooth_direct();
+ render_init_mga_elt_10();
+ render_init_mga_elt_8();
+
+ render_tab_mga_smooth_indirect[GL_TRIANGLES] =
+ optimized_render_vb_triangle_mga_smooth_indirect;
+}
+
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgarender.h b/xc/lib/GL/mesa/src/drv/mga/mgarender.h
new file mode 100644
index 000000000..c772ac459
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgarender.h
@@ -0,0 +1,10 @@
+
+#ifndef _MGA_RENDER_H
+#define _MGA_RENDER_H
+
+extern void mgaDDRenderElementsDirect( struct vertex_buffer *VB );
+extern void mgaDDRenderElementsImmediate( struct vertex_buffer *VB );
+extern void mgaDDRenderDirect( struct vertex_buffer *VB );
+extern void mgaDDRenderInit();
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
new file mode 100644
index 000000000..38e3cdde8
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
@@ -0,0 +1,153 @@
+#include "types.h"
+#include "mgadd.h"
+#include "mgalib.h"
+#include "mgadma.h"
+#include "mgalog.h"
+#include "mgaspan.h"
+
+
+#define LOCAL_VARS \
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx ); \
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
+ __DRIscreenPrivate *sPriv = mmesa->driScreen; \
+ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
+ GLuint pitch = mgaScreen->backPitch; \
+ GLuint height = dPriv->h; \
+ char *buf = (char *)(sPriv->pFB + \
+ mmesa->drawOffset + \
+ dPriv->x * 2 + \
+ dPriv->y * pitch)
+
+#define INIT_MONO_PIXEL(p) \
+ GLushort p = MGA_CONTEXT( ctx )->MonoColor;
+
+#define CLIPPIXEL(_x,_y) (_x >= minx && _x <= maxx && \
+ _y >= miny && _y <= maxy)
+
+
+#define CLIPSPAN(_x,_y,_n,_x1,_n1) \
+ if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \
+ else { \
+ _n1 = _n; \
+ _x1 = _x; \
+ if (_x1 < minx) _n1 -= (minx - _x1), _x1 = minx; \
+ if (_x1 + _n1 > maxx) n1 -= (_x1 + n1 - maxx); \
+ }
+
+
+
+
+
+#define HW_CLIPLOOP() \
+ do { \
+ int _nc = mmesa->numClipRects; \
+ LOCK_HARDWARE_QUIESCENT(mmesa); \
+ 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() \
+ } \
+ UNLOCK_HARDWARE(mmesa); \
+ } while (0)
+
+
+#define Y_FLIP(_y) (height - _y)
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 11) | \
+ ((g & 0x3f) << 5) | \
+ ((b & 0x1f)))
+#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; \
+ rgba[1] = (p >> 5) & 0x3f; \
+ rgba[2] = (p >> 0) & 0x1f; \
+ rgba[3] = 0; /* or 255? */ \
+} while(0)
+
+#define TAG(x) mga##x##_565
+#include "spantmp.h"
+
+
+
+
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 10) | \
+ ((g & 0x1f) << 5) | \
+ ((b & 0x1f)))
+
+#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 >> 10) & 0x1f; \
+ rgba[1] = (p >> 5) & 0x1f; \
+ rgba[2] = (p >> 0) & 0x1f; \
+ rgba[3] = 0; /* or 255? */ \
+} while(0)
+
+#define TAG(x) mga##x##_555
+#include "spantmp.h"
+
+
+
+#if 0
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ *(GLuint *)(buf + _x*4 + _y*pitch) = ( ((r) << 16) | \
+ ((g) << 8) | \
+ ((b)))
+
+#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] = 0; /* or 255? */ \
+} while(0)
+
+#define TAG(x) mga##x##_888
+#include "spantmp.h"
+#endif
+
+void mgaDDInitSpanFuncs( GLcontext *ctx )
+{
+ if (1) {
+ ctx->Driver.WriteRGBASpan = mgaWriteRGBASpan_565;
+ ctx->Driver.WriteRGBSpan = mgaWriteRGBSpan_565;
+ ctx->Driver.WriteMonoRGBASpan = mgaWriteMonoRGBASpan_565;
+ ctx->Driver.WriteRGBAPixels = mgaWriteRGBAPixels_565;
+ ctx->Driver.WriteMonoRGBAPixels = mgaWriteMonoRGBAPixels_565;
+ ctx->Driver.ReadRGBASpan = mgaReadRGBASpan_565;
+ ctx->Driver.ReadRGBAPixels = mgaReadRGBAPixels_565;
+ } else {
+ ctx->Driver.WriteRGBASpan = mgaWriteRGBASpan_555;
+ ctx->Driver.WriteRGBSpan = mgaWriteRGBSpan_555;
+ ctx->Driver.WriteMonoRGBASpan = mgaWriteMonoRGBASpan_555;
+ ctx->Driver.WriteRGBAPixels = mgaWriteRGBAPixels_555;
+ ctx->Driver.WriteMonoRGBAPixels = mgaWriteMonoRGBAPixels_555;
+ ctx->Driver.ReadRGBASpan = mgaReadRGBASpan_555;
+ ctx->Driver.ReadRGBAPixels = mgaReadRGBAPixels_555;
+ }
+
+ ctx->Driver.WriteCI8Span =NULL;
+ ctx->Driver.WriteCI32Span =NULL;
+ ctx->Driver.WriteMonoCISpan =NULL;
+ ctx->Driver.WriteCI32Pixels =NULL;
+ ctx->Driver.WriteMonoCIPixels =NULL;
+ ctx->Driver.ReadCI32Span =NULL;
+ ctx->Driver.ReadCI32Pixels =NULL;
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.h b/xc/lib/GL/mesa/src/drv/mga/mgaspan.h
new file mode 100644
index 000000000..5db0fb976
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.h
@@ -0,0 +1,6 @@
+#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
new file mode 100644
index 000000000..ff9063e0b
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c
@@ -0,0 +1,723 @@
+
+#include <stdio.h>
+
+
+#include "types.h"
+#include "pb.h"
+#include "dd.h"
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgadd.h"
+#include "mgastate.h"
+#include "mgadepth.h"
+#include "mgatex.h"
+#include "mgalog.h"
+#include "mgavb.h"
+#include "mgatris.h"
+#include "mgaregs.h"
+#include "mga_drm_public.h"
+
+static void mgaUpdateZMode(const GLcontext *ctx)
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ int zmode = 0;
+
+ if (ctx->Depth.Test) {
+ switch(ctx->Depth.Func) {
+ case GL_NEVER:
+ zmode = DC_zmode_nozcmp; break;
+ 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:
+ break;
+ }
+ if (ctx->Depth.Mask)
+ zmode |= DC_atype_zi;
+ else
+ zmode |= DC_atype_i;
+ } else {
+ zmode |= DC_zmode_nozcmp | DC_atype_i;
+ }
+
+ mmesa->Setup[MGA_CTXREG_DWGCTL] &= DC_zmode_MASK & DC_atype_MASK;
+ mmesa->Setup[MGA_CTXREG_DWGCTL] |= zmode;
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+}
+
+
+static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+}
+
+
+static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+}
+
+static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+}
+
+static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
+ GLenum dfactorRGB, GLenum sfactorA,
+ GLenum dfactorA )
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+}
+
+
+
+static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
+ const GLfloat *param)
+{
+ if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+ }
+}
+
+
+static void mgaDDShadeModel(GLcontext *ctx, GLenum mode)
+{
+ if (1) {
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+ mgaMsg(8, "mgaDDShadeModel: %x\n", mode);
+ }
+}
+
+
+static void mgaDDDepthFunc(GLcontext *ctx, GLenum func)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_DEPTH;
+}
+
+static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_DEPTH;
+}
+
+
+
+
+static void mgaUpdateFogAttrib( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ mgaUI32 color = MGAPACKCOLOR888((mgaUI8)(ctx->Fog.Color[0]*255.0F),
+ (mgaUI8)(ctx->Fog.Color[1]*255.0F),
+ (mgaUI8)(ctx->Fog.Color[2]*255.0F));
+
+ if (color != mmesa->Setup[MGA_CTXREG_FOGCOLOR])
+ mmesa->Setup[MGA_CTXREG_FOGCOLOR] = color;
+
+ mmesa->Setup[MGA_CTXREG_MACCESS] &= ~MA_fogen_enable;
+ if (ctx->FogMode == FOG_FRAGMENT)
+ mmesa->Setup[MGA_CTXREG_MACCESS] |= MA_fogen_enable;
+
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+}
+
+static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_FOG;
+}
+
+
+
+
+/* =============================================================
+ * Alpha blending
+ */
+
+
+static void mgaUpdateAlphaMode(GLcontext *ctx)
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ int a = 0;
+
+ /* determine source of alpha for blending and testing */
+ if ( !ctx->Texture.Enabled || (mmesa->Fallback & MGA_FALLBACK_TEXTURE))
+ a |= AC_alphasel_diffused;
+ else {
+ switch (ctx->Texture.Unit[0].EnvMode) {
+ case GL_DECAL:
+ case GL_REPLACE:
+ a |= AC_alphasel_fromtex;
+ break;
+ case GL_BLEND:
+ case GL_MODULATE:
+ a |= AC_alphasel_modulated;
+ break;
+ default:
+ }
+ }
+
+
+ /* alpha test control - disabled by default.
+ */
+ if (ctx->Color.AlphaEnabled) {
+ GLubyte ref = ctx->Color.AlphaRef;
+ switch (ctx->Color.AlphaFunc) {
+ case GL_NEVER:
+ a |= AC_atmode_alt;
+ ref = 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 |= MGA_FIELD(AC_atref,ref);
+ }
+
+ /* blending control */
+ if (ctx->Color.BlendEnabled) {
+ switch (ctx->Color.BlendSrcRGB) {
+ case GL_ZERO:
+ a |= AC_src_zero; break;
+ case GL_SRC_ALPHA:
+ a |= AC_src_src_alpha; break;
+ case GL_ONE:
+ a |= AC_src_one; break;
+ case GL_DST_COLOR:
+ a |= AC_src_dst_color; break;
+ case GL_ONE_MINUS_DST_COLOR:
+ a |= AC_src_om_dst_color; break;
+ case GL_ONE_MINUS_SRC_ALPHA:
+ a |= AC_src_om_src_alpha; break;
+ case GL_DST_ALPHA:
+ if (0) /*(mgaScreen->Attrib & MGA_PF_HASALPHA)*/
+ a |= AC_src_dst_alpha;
+ else
+ a |= AC_src_one;
+ break;
+ case GL_ONE_MINUS_DST_ALPHA:
+ if (0) /*(mgaScreen->Attrib & MGA_PF_HASALPHA)*/
+ a |= AC_src_om_dst_alpha;
+ else
+ a |= AC_src_zero;
+ break;
+ case GL_SRC_ALPHA_SATURATE:
+ a |= AC_src_src_alpha_sat;
+ break;
+ default: /* never happens */
+ }
+
+ switch (ctx->Color.BlendDstRGB) {
+ case GL_SRC_ALPHA:
+ a |= AC_dst_src_alpha; break;
+ case GL_ONE_MINUS_SRC_ALPHA:
+ a |= AC_dst_om_src_alpha; break;
+ case GL_ZERO:
+ a |= AC_dst_zero; break;
+ case GL_ONE:
+ a |= AC_dst_one; break;
+ case GL_SRC_COLOR:
+ a |= AC_dst_src_color; break;
+ case GL_ONE_MINUS_SRC_COLOR:
+ a |= AC_dst_om_src_color; break;
+ case GL_DST_ALPHA:
+ if (0) /*(mgaDB->Attrib & MGA_PF_HASALPHA)*/
+ a |= AC_dst_dst_alpha;
+ else
+ a |= AC_dst_one;
+ break;
+ case GL_ONE_MINUS_DST_ALPHA:
+ if (0) /*(mgaScreen->Attrib & MGA_PF_HASALPHA)*/
+ a |= AC_dst_om_dst_alpha;
+ else
+ a |= AC_dst_zero;
+ break;
+ default: /* never happens */
+ }
+ } else {
+ a |= AC_src_one|AC_dst_zero;
+ }
+
+ mmesa->Setup[MGA_CTXREG_ALPHACTRL] = (AC_amode_alpha_channel |
+ AC_astipple_disable |
+ AC_aten_disable |
+ AC_atmode_noacmp |
+ a);
+
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+}
+
+
+
+/* =============================================================
+ * Hardware clipping
+ */
+
+static void mgaUpdateClipping(const GLcontext *ctx)
+{
+#if 0
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+ int x1,x2,y1,y2;
+
+ if ( ctx->Scissor.Enabled) {
+ x1 = ctx->Scissor.X;
+ x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
+ y1 = dPriv->Height - ctx->Scissor.Y - ctx->Scissor.Height;
+ y2 = dPriv->Height - ctx->Scissor.Y - 1;
+ } else {
+ x1 = 0;
+ y1 = 0;
+ x2 = mgaDB->Width-1;
+ y2 = mgaDB->Height-1;
+ }
+
+ if (x1 < 0) x1 = 0;
+ if (y1 < 0) y1 = 0;
+ if (x2 >= mgaDB->Width) x2 = mgaDB->Width-1;
+ if (y2 >= mgaDB->Height) y2 = mgaDB->Height-1;
+
+ if (x1 > x2 || y1 > y2) {
+ x1 = 0; x2 = 0;
+ y2 = 0; y1 = 1;
+ }
+
+
+ mmesa->Setup[MGA_CTXREG_CXBNDRY] = (MGA_FIELD(CXB_cxright,x2) |
+ MGA_FIELD(CXB_cxleft,x1));
+ mmesa->Setup[MGA_CTXREG_YTOP] = y1*mgaDB->Pitch;
+ mmesa->Setup[MGA_CTXREG_YBOT] = y2*mgaDB->Pitch;
+
+
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+#endif
+}
+
+
+static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
+ GLsizei w, GLsizei h )
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_CLIP;
+}
+
+
+/* ======================================================================
+ * New stuff for DRI state.
+ */
+
+static void mgaDDDither(GLcontext *ctx, GLboolean enable)
+{
+}
+
+
+static GLboolean mgaDDSetBuffer(GLcontext *ctx, GLenum mode )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ mmesa->Fallback &= ~MGA_FALLBACK_BUFFER;
+
+ if (mode == GL_FRONT_LEFT)
+ {
+ mmesa->drawOffset = mmesa->mgaScreen->fbOffset;
+ mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->mgaScreen->fbOffset;
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+ mgaXMesaSetFrontClipRects( mmesa );
+ return GL_TRUE;
+ }
+ else if (mode == GL_BACK_LEFT)
+ {
+ mmesa->drawOffset = mmesa->mgaScreen->backOffset;
+ mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->mgaScreen->backOffset;
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+ mgaXMesaSetBackClipRects( mmesa );
+ return GL_TRUE;
+ }
+ else
+ {
+ mmesa->Fallback |= MGA_FALLBACK_BUFFER;
+ return GL_FALSE;
+ }
+}
+
+
+
+static void mgaDDSetColor(GLcontext *ctx,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ mmesa->MonoColor = mgaPackColor( mmesa->mgaScreen->fbFormat,
+ r, g, b, a );
+}
+
+
+static void mgaDDClearColor(GLcontext *ctx,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ mmesa->ClearColor = mgaPackColor( mmesa->mgaScreen->fbFormat,
+ r, g, b, a );
+}
+
+
+/* =============================================================
+ * Culling
+ */
+
+#define _CULL_DISABLE 0
+#define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16))
+#define _CULL_POSITIVE (1<<11)
+
+
+static void mgaUpdateCull( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+ GLuint mode = _CULL_DISABLE;
+
+ if (ctx->Polygon.CullFlag &&
+ ctx->PB->primitive == GL_POLYGON &&
+ ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK)
+ {
+ mode = _CULL_NEGATIVE;
+ if (ctx->Polygon.CullFaceMode == GL_FRONT)
+ mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
+ if (ctx->Polygon.FrontFace != GL_CCW)
+ mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
+ if (mmesa->multitex)
+ mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE); /* why??? */
+ }
+
+ mmesa->Setup[MGA_CTXREG_WFLAG] = mode;
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+}
+
+
+static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum mode)
+{
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_CULL;
+}
+
+
+
+
+/* =============================================================
+ * Color masks
+ */
+
+/* Mesa calls this from the wrong place:
+ */
+static GLboolean mgaDDColorMask(GLcontext *ctx,
+ GLboolean r, GLboolean g,
+ GLboolean b, GLboolean a )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
+
+
+ GLuint mask = mgaPackColor(mgaScreen->Attrib,
+ ctx->Color.ColorMask[RCOMP],
+ ctx->Color.ColorMask[GCOMP],
+ ctx->Color.ColorMask[BCOMP],
+ ctx->Color.ColorMask[ACOMP]);
+
+ switch (mgaScreen->Attrib & MGA_PF_MASK)
+ {
+ case MGA_PF_555:
+ case MGA_PF_565:
+ mask = mask | (mask << 16);
+ break;
+ }
+
+ if (mmesa->Setup[MGA_CTXREG_PLNWT] != mask) {
+ mmesa->Setup[MGA_CTXREG_PLNWT] = mask;
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_MASK;
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+ }
+
+ return 1;
+}
+
+/* =============================================================
+ */
+
+
+
+
+static void mgaDDPrintDirty( const char *msg, GLuint state )
+{
+ fprintf(stderr, "%s (0x%x): %s%s%s%s%s%s\n",
+ msg,
+ (unsigned int) state,
+ (state & MGA_REQUIRE_QUIESCENT) ? "req-quiescent, " : "",
+ (state & MGA_UPLOAD_TEX0IMAGE) ? "upload-tex0-img, " : "",
+ (state & MGA_UPLOAD_TEX1IMAGE) ? "upload-tex1-img, " : "",
+ (state & MGA_UPLOAD_CTX) ? "upload-ctx, " : "",
+ (state & MGA_UPLOAD_TEX0) ? "upload-tex0, " : "",
+ (state & MGA_UPLOAD_TEX1) ? "upload-tex1, " : ""
+ );
+}
+
+
+/* Push the state into the sarea and/or texture memory.
+ */
+void mgaEmitHwStateLocked( mgaContextPtr mmesa )
+{
+ if (MGA_DEBUG & MGA_DEBUG_VERBOSE_MSG)
+ mgaDDPrintDirty( "mgaEmitHwStateLocked", mmesa->dirty );
+
+ if ((mmesa->dirty & MGA_UPLOAD_TEX0IMAGE) && mmesa->CurrentTexObj[0])
+ mgaUploadTexImages(mmesa, mmesa->CurrentTexObj[0]);
+
+ if ((mmesa->dirty & MGA_UPLOAD_TEX1IMAGE) && mmesa->CurrentTexObj[1])
+ mgaUploadTexImages(mmesa, mmesa->CurrentTexObj[1]);
+
+ if (mmesa->dirty & MGA_UPLOAD_CTX) {
+ memcpy( mmesa->sarea->ContextState,
+ mmesa->Setup,
+ sizeof(mmesa->Setup));
+
+ if (mmesa->CurrentTexObj[0])
+ memcpy(mmesa->sarea->TexState[0],
+ mmesa->CurrentTexObj[0]->Setup,
+ sizeof(mmesa->sarea->TexState[0]));
+
+ if (mmesa->CurrentTexObj[1])
+ memcpy(mmesa->sarea->TexState[1],
+ mmesa->CurrentTexObj[1]->Setup,
+ sizeof(mmesa->sarea->TexState[1]));
+ }
+
+ if (mmesa->dirty & MGA_UPLOAD_PIPE)
+ mmesa->sarea->WarpPipe = mmesa->setupindex & MGA_WARP_T2GZSAF;
+
+ mmesa->sarea->dirty |= mmesa->dirty;
+ mmesa->dirty = 0;
+}
+
+
+
+/* =============================================================
+ */
+
+static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
+{
+ switch(cap) {
+ case GL_ALPHA_TEST:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+ break;
+ case GL_BLEND:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
+ break;
+ case GL_DEPTH_TEST:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_DEPTH;
+ break;
+ case GL_SCISSOR_TEST:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_CLIP;
+ break;
+ case GL_FOG:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_FOG;
+ break;
+ case GL_CULL_FACE:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_CULL;
+ break;
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+ break;
+ default:
+ ;
+ }
+}
+
+
+/* =============================================================
+ */
+
+/* Just need to note that it has changed - the kernel will do the
+ * upload the next time we fire a dma buffer.
+ */
+static void mgaWarpUpdateState( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ int index = mmesa->setupindex;
+
+ index &= ~(MGA_WIN_BIT|MGA_TEX0_BIT|MGA_RGBA_BIT);
+ index |= MGA_ALPHA_BIT;
+
+ if (index != mmesa->warp_pipe)
+ {
+ mmesa->warp_pipe = index;
+ mmesa->new_state |= MGA_NEW_WARP;
+ }
+}
+
+
+
+/* =============================================================
+ */
+
+static void mgaDDPrintState( const char *msg, GLuint state )
+{
+ mgaMsg(1, "%s (0x%x): %s%s%s%s%s%s%s%s\n",
+ msg,
+ state,
+ (state & MGA_NEW_DEPTH) ? "depth, " : "",
+ (state & MGA_NEW_ALPHA) ? "alpha, " : "",
+ (state & MGA_NEW_FOG) ? "fog, " : "",
+ (state & MGA_NEW_CLIP) ? "clip, " : "",
+ (state & MGA_NEW_MASK) ? "colormask, " : "",
+ (state & MGA_NEW_CULL) ? "cull, " : "",
+ (state & MGA_NEW_TEXTURE) ? "texture, " : "",
+ (state & MGA_NEW_CONTEXT) ? "context, " : "");
+}
+
+void mgaDDUpdateHwState( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ int new_state = mmesa->new_state;
+
+ if (new_state)
+ {
+ mmesa->new_state = 0;
+
+ /* Emit any vertices for the current state. This will also
+ * push the current state into the sarea.
+ */
+/* mgaFlushVertices( mmesa ); */
+
+ if (MESA_VERBOSE&VERBOSE_DRIVER)
+ mgaDDPrintState("UpdateHwState", new_state);
+
+ if (new_state & MGA_NEW_DEPTH)
+ {
+ mgaUpdateZMode(ctx);
+ mgaDDInitDepthFuncs(ctx);
+ }
+
+ if (new_state & MGA_NEW_ALPHA)
+ mgaUpdateAlphaMode(ctx);
+
+ if (new_state & MGA_NEW_FOG)
+ mgaUpdateFogAttrib(ctx);
+
+ if (new_state & MGA_NEW_CLIP)
+ mgaUpdateClipping(ctx);
+
+ if (new_state & (MGA_NEW_WARP|MGA_NEW_CULL))
+ mgaUpdateCull(ctx);
+
+ if (new_state & (MGA_NEW_WARP|MGA_NEW_TEXTURE))
+ mgaUpdateTextureState(ctx);
+
+ mmesa->new_state = 0; /* tex uploads scribble newstate */
+ }
+}
+
+
+
+
+
+
+
+void mgaDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim )
+{
+ mgaFlushVertices( MGA_CONTEXT(ctx) );
+ mgaUpdateCull(ctx);
+}
+
+
+#define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|\
+ NEW_TEXTURE_MATRIX|\
+ NEW_USER_CLIP|NEW_CLIENT_STATE|\
+ NEW_TEXTURE_ENABLE))
+
+void mgaDDUpdateState( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaglx.c_setupPointers++;
+
+ if (ctx->NewState & INTERESTED) {
+ mgaDDChooseRenderState(ctx);
+ mgaChooseRasterSetupFunc(ctx);
+ mgaWarpUpdateState(ctx);
+ }
+
+ /* Have to do this here to detect texture fallbacks in time:
+ */
+ if (MGA_CONTEXT(ctx)->new_state & MGA_NEW_TEXTURE)
+ mgaDDUpdateHwState( ctx );
+
+ if (!mmesa->Fallback || mgaglx.noFallback) {
+ ctx->Driver.PointsFunc=mmesa->PointsFunc;
+ ctx->Driver.LineFunc=mmesa->LineFunc;
+ ctx->Driver.TriangleFunc=mmesa->TriangleFunc;
+ ctx->Driver.QuadFunc=mmesa->QuadFunc;
+ }
+}
+
+
+void mgaDDInitStateFuncs( GLcontext *ctx )
+{
+ ctx->Driver.UpdateState = mgaDDUpdateState;
+ 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.ShadeModel = mgaDDShadeModel;
+ ctx->Driver.CullFace = mgaDDCullFaceFrontFace;
+ ctx->Driver.FrontFace = mgaDDCullFaceFrontFace;
+ ctx->Driver.ColorMask = mgaDDColorMask;
+ ctx->Driver.ReducedPrimitiveChange = mgaDDReducedPrimitiveChange;
+ ctx->Driver.RenderStart = mgaDDUpdateHwState;
+ ctx->Driver.RenderFinish = 0;
+
+ ctx->Driver.SetBuffer = mgaDDSetBuffer;
+ ctx->Driver.Color = mgaDDSetColor;
+ ctx->Driver.ClearColor = mgaDDClearColor;
+ ctx->Driver.Dither = mgaDDDither;
+
+ ctx->Driver.Index = 0;
+ ctx->Driver.ClearIndex = 0;
+ ctx->Driver.IndexMask = 0;
+
+}
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.h b/xc/lib/GL/mesa/src/drv/mga/mgastate.h
new file mode 100644
index 000000000..5ada1b23c
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.h
@@ -0,0 +1,15 @@
+#ifndef _MGA_STATE_H
+#define _MGA_STATE_H
+
+
+extern void mgaDDInitStateFuncs(GLcontext *ctx);
+extern void mgaDDUpdateHwState( GLcontext *ctx );
+extern void mgaDDUpdateState( GLcontext *ctx );
+extern void mgaDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim );
+
+/* reprograms the current registers without updating them, used to
+reset state after a dma buffer overflow */
+void mgaUpdateRegs( GLuint regs );
+
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
new file mode 100644
index 000000000..be7ad6018
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
@@ -0,0 +1,1051 @@
+/* -*- mode: C; c-basic-offset:8 -*- */
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * original by Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ * 9/20/99 rewrite by John Carmack <johnc@idsoftware.com>
+ * 13/1/00 port to DRI by Keith Whitwell <keithw@precisioninsight.com>
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <GL/gl.h>
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgadma.h"
+#include "mgatex.h"
+#include "mgalog.h"
+#include "mgaregs.h"
+
+#include "simple_list.h"
+
+
+/*
+ * mgaDestroyTexObj
+ * Free all memory associated with a texture and NULL any pointers
+ * to it.
+ */
+static void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ) {
+ int i;
+
+ if ( !t ) return;
+
+ /* free the texture memory */
+ mmFreeMem( t->MemBlock );
+
+ /* free mesa's link */
+ t->tObj->DriverData = NULL;
+
+ /* see if it was the driver's current object */
+ for ( i = 0 ; i < 2 ; i++ ) {
+ if ( mmesa->CurrentTexObj[i] == t ) {
+ mmesa->CurrentTexObj[i] = NULL;
+ }
+ }
+
+ remove_from_list(t);
+ free( t );
+}
+
+static void mgaSwapOutTexObj(mgaContextPtr mmesa, mgaTextureObjectPtr t)
+{
+ if (t->MemBlock) {
+ mmFreeMem(t->MemBlock);
+ t->MemBlock = 0;
+ }
+
+ t->dirty_images = ~0;
+ move_to_tail(&(mmesa->SwappedOut), t);
+}
+
+
+void mgaResetGlobalLRU( mgaContextPtr mmesa )
+{
+ mgaTexRegion *list = mmesa->sarea->texList;
+ int sz = 1 << mmesa->mgaScreen->logTextureGranularity;
+ int i;
+
+ /* (Re)initialize the global circular LRU list. The last element
+ * in the array (MGA_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 < mmesa->mgaScreen->textureSize ; i++) {
+ list[i].prev = i-1;
+ list[i].next = i+1;
+ list[i].age = 0;
+ }
+
+ i--;
+ list[0].prev = MGA_NR_TEX_REGIONS;
+ list[i].prev = i-1;
+ list[i].next = MGA_NR_TEX_REGIONS;
+ list[MGA_NR_TEX_REGIONS].prev = i;
+ list[MGA_NR_TEX_REGIONS].next = 0;
+ mmesa->sarea->texAge = 0;
+}
+
+
+static void mgaUpdateTexLRU( mgaContextPtr mmesa, mgaTextureObjectPtr t )
+{
+ int i;
+ int logsz = mmesa->mgaScreen->logTextureGranularity;
+ int start = t->MemBlock->ofs >> logsz;
+ int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz;
+ mgaTexRegion *list = mmesa->sarea->texList;
+
+ mmesa->texAge = ++mmesa->sarea->texAge;
+
+ /* Update our local LRU
+ */
+ move_to_head( &(mmesa->TexObjList), t );
+
+ /* Update the global LRU
+ */
+ for (i = start ; i <= end ; i++) {
+
+ list[i].in_use = 1;
+ list[i].age = mmesa->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 = MGA_NR_TEX_REGIONS;
+ list[i].next = list[MGA_NR_TEX_REGIONS].next;
+ list[(unsigned)list[MGA_NR_TEX_REGIONS].next].prev = i;
+ list[MGA_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 mgaTexturesGone( mgaContextPtr mmesa,
+ GLuint offset,
+ GLuint size,
+ GLuint in_use )
+{
+ mgaTextureObjectPtr t, tmp;
+
+ foreach_s ( t, tmp, &mmesa->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.
+ */
+ if (t == mmesa->CurrentTexObj[0] || t == mmesa->CurrentTexObj[1])
+ mgaSwapOutTexObj( mmesa, t );
+ else
+ mgaDestroyTexObj( mmesa, t );
+ }
+
+
+ if (in_use) {
+ t = (mgaTextureObjectPtr) calloc(1,sizeof(*t));
+ if (!t) return;
+
+ t->MemBlock = mmAllocMem( mmesa->texHeap, size, 0, offset);
+ insert_at_head( &mmesa->TexObjList, t );
+ }
+}
+
+
+/*
+ * mgaSetTexWrappings
+ */
+static void mgaSetTexWrapping( mgaTextureObjectPtr t,
+ GLenum sWrap, GLenum tWrap ) {
+ if (sWrap == GL_REPEAT) {
+ t->Setup[MGA_TEXREG_CTL] &= ~TMC_clampu_enable;
+ } else {
+ t->Setup[MGA_TEXREG_CTL] |= TMC_clampu_enable;
+ }
+ if (tWrap == GL_REPEAT) {
+ t->Setup[MGA_TEXREG_CTL] &= ~TMC_clampv_enable;
+ } else {
+ t->Setup[MGA_TEXREG_CTL] |= TMC_clampv_enable;
+ }
+}
+
+/*
+ * mgaSetTexFilter
+ */
+static void mgaSetTexFilter(mgaTextureObjectPtr t, GLenum minf, GLenum magf) {
+ switch (minf) {
+ case GL_NEAREST:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_nrst);
+ break;
+ case GL_LINEAR:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_bilin);
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_mm1s);
+ break;
+ case GL_LINEAR_MIPMAP_NEAREST:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_mm4s);
+ break;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_mm2s);
+ break;
+ case GL_LINEAR_MIPMAP_LINEAR:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_minfilter_MASK, TF_minfilter_mm8s);
+ break;
+ default:
+ mgaError("mgaSetTexFilter(): not supported min. filter %d\n",
+ (int)minf);
+ break;
+ }
+
+ switch (magf) {
+ case GL_NEAREST:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_magfilter_MASK,TF_magfilter_nrst);
+ break;
+ case GL_LINEAR:
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],
+ TF_magfilter_MASK,TF_magfilter_bilin);
+ break;
+ default:
+ mgaError("mgaSetTexFilter(): not supported mag. filter %d\n",
+ (int)magf);
+ break;
+ }
+
+ /* See OpenGL 1.2 specification */
+ if (magf == GL_LINEAR && (minf == GL_NEAREST_MIPMAP_NEAREST ||
+ minf == GL_NEAREST_MIPMAP_LINEAR)) {
+ /* c = 0.5 */
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],TF_fthres_MASK,
+ 0x20 << TF_fthres_SHIFT);
+ } else {
+ /* c = 0 */
+ MGA_SET_FIELD(t->Setup[MGA_TEXREG_FILTER],TF_fthres_MASK,
+ 0x10 << TF_fthres_SHIFT);
+ }
+
+}
+
+/*
+ * mgaSetTexBorderColor
+ */
+static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4]) {
+ t->Setup[MGA_TEXREG_BORDERCOL] =
+ MGAPACKCOLOR8888(color[0],color[1],color[2],color[3]);
+
+}
+
+
+
+
+
+
+
+/*
+ * mgaUploadSubImage
+ *
+ * Perform an iload based update of a resident buffer. This is used for
+ * both initial loading of the entire image, and texSubImage updates.
+ *
+ * Performed with the hardware lock held.
+ */
+static void mgaUploadSubImage( mgaContextPtr mmesa,
+ mgaTextureObjectPtr t,
+ int level,
+ int x, int y, int width, int height ) {
+ int x2;
+ int dwords;
+ int dstorg;
+ struct gl_texture_image *image;
+ int texelBytes, texelsPerDword, texelMaccess;
+
+ if ( level < 0 || level >= MGA_TEX_MAXLEVELS ) {
+ mgaMsg( 1, "mgaUploadSubImage: bad level: %i\n", level );
+ return;
+ }
+
+ image = t->tObj->Image[level];
+ if ( !image ) {
+ mgaError( "mgaUploadSubImage: NULL image\n" );
+ return;
+ }
+
+ /* find the proper destination offset for this level */
+ dstorg = (mmesa->mgaScreen->textureOffset + t->MemBlock->ofs +
+ t->offsets[level]);
+
+ /* turn on PCI/AGP if needed
+ if ( textureHeapPhysical ) {
+ dstorg |= 1 | mgaglx.use_agp;
+ }
+ */
+
+ texelBytes = t->texelBytes;
+ switch( texelBytes ) {
+ case 1:
+ texelsPerDword = 4;
+ texelMaccess = 0;
+ break;
+ case 2:
+ texelsPerDword = 2;
+ texelMaccess = 1;
+ break;
+ case 4:
+ texelsPerDword = 1;
+ texelMaccess = 2;
+ break;
+ default:
+ return;
+ }
+
+
+ /* We can't do a subimage update if pitch is < 32 texels due
+ * to hardware XY addressing limits, so we will need to
+ * linearly upload all modified rows.
+ */
+ if ( image->Width < 32 ) {
+ x = 0;
+ width = image->Width * height;
+ height = 1;
+
+ /* Assume that 1x1 textures aren't going to cause a
+ * bus error if we read up to four texels from that
+ * location:
+ */
+ if ( width < texelsPerDword ) {
+ width = texelsPerDword;
+ }
+ } else {
+ /* pad the size out to dwords. The image is a pointer
+ to the entire image, so we can safely reference
+ outside the x,y,width,height bounds if we need to */
+ x2 = x + width;
+ x2 = (x2 + (texelsPerDword-1)) & ~(texelsPerDword-1);
+ x = (x + (texelsPerDword-1)) & ~(texelsPerDword-1);
+ width = x2 - x;
+ }
+
+ /* we may not be able to upload the entire texture in one
+ batch due to register limits or dma buffer limits.
+ Recursively split it up. */
+ while ( 1 ) {
+ dwords = height * width / texelsPerDword;
+ if ( dwords * 4 <= MGA_DMA_BUF_SZ ) {
+ break;
+ }
+ mgaMsg(10, "mgaUploadSubImage: recursively subdividing\n" );
+
+ mgaUploadSubImage( mmesa, t, level, x, y, width, height >> 1 );
+ y += ( height >> 1 );
+ height -= ( height >> 1 );
+ }
+
+ mgaMsg(10, "mgaUploadSubImage: %i,%i of %i,%i at %i,%i\n",
+ width, height, image->Width, image->Height, x, y );
+
+ /* bump the performance counter */
+ mgaglx.c_textureSwaps += ( dwords << 2 );
+
+
+#if 0
+
+ /* fill in the secondary buffer with properly converted texels
+ from the mesa buffer */
+ mgaConvertTexture( dest, texelBytes, image, x, y, width, height );
+
+ /* send the secondary data */
+ mgaSecondaryDma( TT_BLIT, dest, dwords );
+#endif
+
+}
+
+
+
+static void mgaUploadTexLevel( mgaContextPtr mmesa,
+ mgaTextureObjectPtr t,
+ int l )
+{
+ mgaUploadSubImage( mmesa,
+ t,
+ l,
+ 0, 0,
+ t->tObj->Image[l]->Width,
+ t->tObj->Image[l]->Height);
+}
+
+
+
+/*
+ * mgaCreateTexObj
+ * 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 void mgaCreateTexObj(mgaContextPtr mmesa, struct gl_texture_object *tObj)
+{
+ mgaTextureObjectPtr t;
+ int i, ofs, size;
+ struct gl_texture_image *image;
+ int LastLevel;
+ int s, s2;
+ int textureFormat;
+
+ mgaMsg( 10,"mgaCreateTexObj( %p )\n", tObj );
+
+ t = malloc( sizeof( *t ) );
+ if ( !t ) {
+ mgaError( "mgaCreateTexObj: Failed to malloc mgaTextureObject\n" );
+ return;
+ }
+ memset( t, 0, sizeof( *t ) );
+
+ image = tObj->Image[ 0 ];
+ if ( !image ) {
+ return;
+ }
+
+ if ( 0 ) {
+ /* G400 texture format options */
+
+ } else {
+ /* G200 texture format options */
+
+ switch( image->Format ) {
+ case GL_RGB:
+ case GL_LUMINANCE:
+ if ( image->IntFormat != GL_RGB5 &&
+ ( image->IntFormat == GL_RGB8 ||
+ mgaglx.default32BitTextures ) ) {
+ t->texelBytes = 4;
+ textureFormat = TMC_tformat_tw32;
+ } else {
+ t->texelBytes = 2;
+ textureFormat = TMC_tformat_tw16;
+ }
+ break;
+ case GL_ALPHA:
+ case GL_LUMINANCE_ALPHA:
+ case GL_INTENSITY:
+ case GL_RGBA:
+ if ( image->IntFormat != GL_RGBA4 &&
+ ( image->IntFormat == GL_RGBA8 ||
+ mgaglx.default32BitTextures ) ) {
+ t->texelBytes = 4;
+ textureFormat = TMC_tformat_tw32;
+ } else {
+ t->texelBytes = 2;
+ textureFormat = TMC_tformat_tw12;
+ }
+ break;
+ case GL_COLOR_INDEX:
+ textureFormat = TMC_tformat_tw8;
+ t->texelBytes = 1;
+ break;
+ default:
+ mgaError( "mgaCreateTexObj: bad image->Format\n" );
+ free( t );
+ return;
+ }
+ }
+
+ /* we are going to upload all levels that are present, even if
+ later levels wouldn't be used by the current filtering mode. This
+ allows the filtering mode to change without forcing another upload
+ of the images */
+ LastLevel = MGA_TEX_MAXLEVELS-1;
+
+ ofs = 0;
+ for ( i = 0 ; i <= LastLevel ; i++ ) {
+ int levelWidth, levelHeight;
+
+ t->offsets[i] = ofs;
+ image = tObj->Image[ i ];
+ if ( !image ) {
+ LastLevel = i - 1;
+ mgaMsg( 10, " missing images after LastLevel: %i\n",
+ LastLevel );
+ break;
+ }
+ /* the G400 doesn't work with textures less than 8
+ units in size */
+ levelWidth = image->Width;
+ levelHeight = image->Height;
+ if ( levelWidth < 8 ) {
+ levelWidth = 8;
+ }
+ if ( levelHeight < 8 ) {
+ levelHeight = 8;
+ }
+ size = levelWidth * levelHeight * t->texelBytes;
+ size = ( size + 31 ) & ~31; /* 32 byte aligned */
+ ofs += size;
+ t->dirty_images |= (1<<i);
+ }
+ t->totalSize = ofs;
+ t->lastLevel = LastLevel;
+
+
+ /* fill in our mga texture object */
+ t->tObj = tObj;
+ t->ctx = mmesa;
+
+
+ insert_at_tail(&(mmesa->TexObjList), t);
+
+ t->MemBlock = 0;
+
+ /* base image */
+ image = tObj->Image[ 0 ];
+
+ /* setup hardware register values */
+ t->Setup[MGA_TEXREG_CTL] = (TMC_takey_1 |
+ TMC_tamask_0 |
+ textureFormat );
+
+ if (image->WidthLog2 >= 3) {
+ t->Setup[MGA_TEXREG_CTL] |= ((image->WidthLog2 - 3) <<
+ TMC_tpitch_SHIFT);
+ } else {
+ t->Setup[MGA_TEXREG_CTL] |= (TMC_tpitchlin_enable |
+ (image->Width <<
+ TMC_tpitchext_SHIFT));
+ }
+
+
+ t->Setup[MGA_TEXREG_CTL2] = TMC_ckstransdis_enable;
+
+ if ( mmesa->glCtx->Light.Model.ColorControl ==
+ GL_SEPARATE_SPECULAR_COLOR )
+ {
+ t->Setup[MGA_TEXREG_CTL2] |= TMC_specen_enable;
+ }
+
+ t->Setup[MGA_TEXREG_FILTER] = (TF_minfilter_nrst |
+ TF_magfilter_nrst |
+ TF_filteralpha_enable |
+ (0x10 << TF_fthres_SHIFT) |
+ (LastLevel << TF_mapnb_SHIFT));
+
+ /* warp texture registers */
+ if (MGA_IS_G200(mmesa)) {
+ ofs = 28;
+ } else {
+ ofs = 11;
+ }
+
+ s = image->Width;
+ s2 = image->WidthLog2;
+ t->Setup[MGA_TEXREG_WIDTH] =
+ MGA_FIELD(TW_twmask, s - 1) |
+ MGA_FIELD(TW_rfw, (10 - s2 - 8) & 63 ) |
+ MGA_FIELD(TW_tw, (s2 + ofs ) | 0x40 );
+
+
+ s = image->Height;
+ s2 = image->HeightLog2;
+ t->Setup[MGA_TEXREG_HEIGHT] =
+ MGA_FIELD(TH_thmask, s - 1) |
+ MGA_FIELD(TH_rfh, (10 - s2 - 8) & 63 ) |
+ MGA_FIELD(TH_th, (s2 + ofs ) | 0x40 );
+
+
+ /* set all the register values for filtering, border, etc */
+ mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
+ mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
+ mgaSetTexBorderColor( t, tObj->BorderColor );
+
+ tObj->DriverData = t;
+}
+
+
+
+int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t )
+{
+
+ int i;
+ int ofs;
+ mgaglx.c_textureSwaps++;
+
+ /* Do we need to eject LRU texture objects?
+ */
+ if (!t->MemBlock) {
+ while (1)
+ {
+ t->MemBlock = mmAllocMem( mmesa->texHeap, t->totalSize, 12, 0 );
+ if (t->MemBlock)
+ break;
+
+ if (mmesa->TexObjList.prev == &(mmesa->TexObjList)) {
+ fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize);
+ mmDumpMemInfo( mmesa->texHeap );
+ return -1;
+ }
+
+ mgaDestroyTexObj( mmesa, mmesa->TexObjList.prev );
+ }
+
+ ofs = t->MemBlock->ofs;
+
+ t->Setup[MGA_TEXREG_ORG] = ofs;
+ t->Setup[MGA_TEXREG_ORG1] = ofs + t->offsets[1];
+ t->Setup[MGA_TEXREG_ORG2] = ofs + t->offsets[2];
+ t->Setup[MGA_TEXREG_ORG3] = ofs + t->offsets[3];
+ t->Setup[MGA_TEXREG_ORG4] = ofs + t->offsets[4];
+
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+ }
+
+ /* Let the world know we've used this memory recently.
+ */
+ mgaUpdateTexLRU( mmesa, t );
+
+ if (t->dirty_images) {
+ if (MGA_DEBUG & MGA_DEBUG_VERBOSE_MSG)
+ fprintf(stderr, "*");
+
+ for (i = 0 ; i <= t->lastLevel ; i++)
+ if (t->dirty_images & (1<<i))
+ mgaUploadTexLevel( mmesa, t, i );
+ }
+
+
+ t->dirty_images = 0;
+ return 0;
+}
+
+/*
+============================================================================
+
+PUBLIC MGA FUNCTIONS
+
+============================================================================
+*/
+
+
+
+static void mgaUpdateTextureEnvG200( GLcontext *ctx )
+{
+ struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current;
+ mgaTextureObjectPtr t;
+
+ if (!tObj || !tObj->DriverData)
+ return;
+
+ t = (mgaTextureObjectPtr)tObj->DriverData;
+
+ switch (ctx->Texture.Unit[0].EnvMode) {
+ case GL_REPLACE:
+ t->Setup[MGA_TEXREG_CTL] &= ~TMC_tmodulate_enable;
+ t->Setup[MGA_TEXREG_CTL2] &= ~TMC_decaldis_enable;
+ break;
+ case GL_MODULATE:
+ t->Setup[MGA_TEXREG_CTL] |= TMC_tmodulate_enable;
+ t->Setup[MGA_TEXREG_CTL2] &= ~TMC_decaldis_enable;
+ break;
+ case GL_DECAL:
+ t->Setup[MGA_TEXREG_CTL] &= ~TMC_tmodulate_enable;
+ t->Setup[MGA_TEXREG_CTL2] &= ~TMC_decaldis_enable;
+ break;
+ case GL_BLEND:
+ t->ctx->Fallback |= MGA_FALLBACK_TEXTURE;
+ break;
+ default:
+ }
+}
+
+/* I don't have the alpha values correct yet:
+ */
+static void mgaUpdateTextureStage( GLcontext *ctx, int unit )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaUI32 *reg = &mmesa->Setup[MGA_CTXREG_TDUAL0 + unit];
+ GLuint source = mmesa->tmu_source[unit];
+ struct gl_texture_object *tObj = ctx->Texture.Unit[source].Current;
+
+ *reg = 0;
+ if (unit == 1)
+ *reg = mmesa->Setup[MGA_CTXREG_TDUAL0];
+
+ if ( tObj != ctx->Texture.Unit[source].CurrentD[2] )
+ return;
+
+ if ( ((ctx->Enabled>>(source*4))&TEXTURE0_ANY) != TEXTURE0_2D )
+ return;
+
+ if (!tObj || !tObj->Complete)
+ return;
+
+ switch (ctx->Texture.Unit[source].EnvMode) {
+ case GL_REPLACE:
+ *reg = (TD0_color_sel_arg1 |
+ TD0_alpha_sel_arg1 );
+ break;
+
+ case GL_MODULATE:
+ if (unit == 0)
+ *reg = ( TD0_color_arg2_diffuse |
+ TD0_color_sel_mul |
+ TD0_alpha_arg2_diffuse |
+ TD0_alpha_sel_arg1);
+ else
+ *reg = ( TD0_color_arg2_prevstage |
+ TD0_color_alpha_prevstage |
+ TD0_color_sel_mul |
+ TD0_alpha_arg2_prevstage |
+ TD0_alpha_sel_arg1);
+ break;
+ case GL_DECAL:
+ *reg = (TD0_color_arg2_fcol |
+ TD0_color_alpha_currtex |
+ TD0_color_alpha2inv_enable |
+ TD0_color_arg2mul_alpha2 |
+ TD0_color_arg1mul_alpha1 |
+ TD0_color_add_add |
+ TD0_color_sel_add |
+ TD0_alpha_arg2_fcol |
+ TD0_alpha_sel_arg2 );
+ break;
+
+ case GL_ADD:
+ if (unit == 0)
+ *reg = ( TD0_color_arg2_diffuse |
+ TD0_color_add_add |
+ TD0_color_sel_add |
+ TD0_alpha_arg2_diffuse |
+ TD0_alpha_sel_arg1);
+ else
+ *reg = ( TD0_color_arg2_prevstage |
+ TD0_color_alpha_prevstage |
+ TD0_color_add_add |
+ TD0_color_sel_add |
+ TD0_alpha_arg2_prevstage |
+ TD0_alpha_sel_arg1);
+ break;
+
+ case GL_BLEND:
+ /* Use a multipass mechanism to do this:
+ */
+ mmesa->Fallback |= MGA_FALLBACK_TEXTURE;
+ break;
+ default:
+ }
+}
+
+
+
+static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) {
+ mgaTextureObjectPtr t;
+ struct gl_texture_object *tObj;
+ GLuint enabled;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint source = mmesa->tmu_source[unit];
+
+ mgaMsg(15,"mgaUpdateTextureState %d\n", unit);
+
+ /* disable texturing until it is known to be good */
+ mmesa->Setup[MGA_CTXREG_DWGCTL] =
+ (( mmesa->Setup[MGA_CTXREG_DWGCTL] & DC_opcod_MASK ) |
+ DC_opcod_trap);
+
+ enabled = (ctx->Texture.Enabled>>(source*4))&TEXTURE0_ANY;
+ if (enabled != TEXTURE0_2D) {
+ if (enabled)
+ mmesa->Fallback |= MGA_FALLBACK_TEXTURE;
+ return;
+ }
+
+ tObj = ctx->Texture.Unit[source].Current;
+
+ if ( !tObj || tObj != ctx->Texture.Unit[source].CurrentD[2] )
+ return;
+
+ /* if the texture object doesn't exist at all (never used or
+ swapped out), create it now, uploading all texture images */
+
+ if ( !tObj->DriverData ) {
+ /* clear the current pointer so that texture object can be
+ swapped out if necessary to make room */
+ mmesa->CurrentTexObj[source] = NULL;
+ mgaCreateTexObj( mmesa, tObj );
+
+ if ( !tObj->DriverData ) {
+ mgaMsg( 5, "mgaUpdateTextureState: create failed\n" );
+ mmesa->Fallback |= MGA_FALLBACK_TEXTURE;
+ return; /* can't create a texture object */
+ }
+ }
+
+ /* we definately have a valid texture now */
+ mmesa->Setup[MGA_CTXREG_DWGCTL] =
+ (( mmesa->Setup[MGA_CTXREG_DWGCTL] & DC_opcod_MASK ) |
+ DC_opcod_texture_trap);
+
+ t = (mgaTextureObjectPtr)tObj->DriverData;
+
+ if (t->dirty_images)
+ mmesa->dirty |= (MGA_UPLOAD_TEX0IMAGE << unit);
+
+ mmesa->CurrentTexObj[unit] = t;
+
+ t->Setup[MGA_TEXREG_CTL2] &= ~TMC_dualtex_enable;
+ if (ctx->Texture.Enabled == (TEXTURE0_2D|TEXTURE1_2D))
+ t->Setup[MGA_TEXREG_CTL2] |= TMC_dualtex_enable;
+
+ t->Setup[MGA_TEXREG_CTL2] &= ~TMC_specen_enable;
+ if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
+ t->Setup[MGA_TEXREG_CTL2] |= TMC_specen_enable;
+
+}
+
+
+
+
+
+
+/* The G400 is now programmed quite differently wrt texture environment.
+ */
+void mgaUpdateTextureState( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mmesa->Fallback &= ~MGA_FALLBACK_TEXTURE;
+
+ if (MGA_IS_G400(mmesa)) {
+ mgaUpdateTextureObject( ctx, 0 );
+ mgaUpdateTextureStage( ctx, 0 );
+
+ mmesa->Setup[MGA_CTXREG_TDUAL1] = mmesa->Setup[MGA_CTXREG_TDUAL0];
+
+ if (mmesa->multitex) {
+ mgaUpdateTextureObject( ctx, 1 );
+ mgaUpdateTextureStage( ctx, 1 );
+ }
+ } else {
+ mgaUpdateTextureObject( ctx, 0 );
+ mgaUpdateTextureEnvG200( ctx );
+ }
+
+ /* schedule the register writes */
+ mmesa->dirty |= MGA_UPLOAD_CTX;
+}
+
+
+
+/*
+============================================================================
+
+Driver functions called directly from mesa
+
+============================================================================
+*/
+
+/*
+ * mgaTexEnv
+ */
+void mgaTexEnv( GLcontext *ctx, GLenum pname, const GLfloat *param ) {
+ mgaMsg( 10, "mgaTexEnv( %i )\n", pname );
+
+ if (pname == GL_TEXTURE_ENV_MODE) {
+ /* force the texture state to be updated */
+ MGA_CONTEXT(ctx)->CurrentTexObj[0] = 0;
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+ }
+}
+
+/*
+ * mgaTexImage
+ */
+void mgaTexImage( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj, GLint level,
+ GLint internalFormat,
+ const struct gl_texture_image *image )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaTextureObjectPtr t;
+
+ mgaMsg( 10,"mgaTexImage( %p, level %i )\n", tObj, level );
+
+ /* just free the mga texture if it exists, it will be recreated at
+ mgaUpdateTextureState time. */
+ t = (mgaTextureObjectPtr) tObj->DriverData;
+ if ( t ) {
+ /* if this is the current object, it will force an update */
+ mgaDestroyTexObj( mmesa, t );
+ mmesa->new_state |= MGA_NEW_TEXTURE;
+ }
+}
+
+/*
+ * mgaTexSubImage
+ */
+void mgaTexSubImage( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLint internalFormat,
+ const struct gl_texture_image *image )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaTextureObjectPtr t;
+
+ mgaMsg(10,"mgaTexSubImage() Size: %d,%d of %d,%d; Level %d\n",
+ width, height, image->Width,image->Height, level);
+
+ t = (mgaTextureObjectPtr) tObj->DriverData;
+
+
+ /* just free the mga texture if it exists, it will be recreated at
+ mgaUpdateTextureState time. */
+ t = (mgaTextureObjectPtr) tObj->DriverData;
+ if ( t ) {
+ /* if this is the current object, it will force an update */
+ mgaDestroyTexObj( mmesa, t );
+ mmesa->new_state |= MGA_NEW_TEXTURE;
+ }
+
+
+
+#if 0
+ /* the texture currently exists, so directly update it */
+ mgaUploadSubImage( t, level, xoffset, yoffset, width, height );
+#endif
+}
+
+/*
+ * mgaTexParameter
+ * This just changes variables and flags for a state update, which
+ * will happen at the next mgaUpdateTextureState
+ */
+void mgaTexParameter( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj,
+ GLenum pname, const GLfloat *params ) {
+ mgaTextureObjectPtr t;
+
+ mgaMsg( 10, "mgaTexParameter( %p, %i )\n", tObj, pname );
+
+ 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 || target != GL_TEXTURE_2D ) {
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
+ break;
+
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ mgaSetTexWrapping(t,tObj->WrapS,tObj->WrapT);
+ break;
+
+ case GL_TEXTURE_BORDER_COLOR:
+ mgaSetTexBorderColor(t,tObj->BorderColor);
+ break;
+
+ default:
+ return;
+ }
+ /* force the texture state to be updated */
+ MGA_CONTEXT(ctx)->CurrentTexObj[0] = NULL;
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+}
+
+/*
+ * mgaBindTexture
+ */
+void mgaBindTexture( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj ) {
+
+ mgaMsg( 10, "mgaBindTexture( %p )\n", tObj );
+
+ /* force the texture state to be updated
+ */
+ MGA_CONTEXT(ctx)->CurrentTexObj[0] = NULL;
+ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE;
+}
+
+/*
+ * mgaDeleteTexture
+ */
+void mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) {
+
+ mgaMsg( 10, "mgaDeleteTexture( %p )\n", tObj );
+
+ /* delete our driver data */
+ if ( tObj->DriverData ) {
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaDestroyTexObj( mmesa,
+ (mgaTextureObjectPtr)(tObj->DriverData) );
+ mmesa->new_state |= MGA_NEW_TEXTURE;
+ }
+}
+
+
+/* Have to grab the lock to find out if anyone has kicked out our
+ * textures.
+ */
+GLboolean mgaIsTextureResident( GLcontext *ctx, struct gl_texture_object *t )
+{
+ mgaTextureObjectPtr mt;
+
+/* LOCK_HARDWARE; */
+ mt = (mgaTextureObjectPtr)t->DriverData;
+/* UNLOCK_HARDWARE; */
+
+ return mt && mt->MemBlock;
+}
+
+void mgaDDInitTextureFuncs( GLcontext *ctx )
+{
+ ctx->Driver.TexEnv = mgaTexEnv;
+ ctx->Driver.TexImage = mgaTexImage;
+ ctx->Driver.TexSubImage = mgaTexSubImage;
+ ctx->Driver.BindTexture = mgaBindTexture;
+ ctx->Driver.DeleteTexture = mgaDeleteTexture;
+ ctx->Driver.TexParameter = mgaTexParameter;
+ ctx->Driver.UpdateTexturePalette = 0;
+ ctx->Driver.IsTextureResident = mgaIsTextureResident;
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.h b/xc/lib/GL/mesa/src/drv/mga/mgatex.h
new file mode 100644
index 000000000..1e8e7e86f
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.h
@@ -0,0 +1,119 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * John Carmack <johnc@idsoftware.com>
+ * Keith Whitwell <keithw@precisioninsight.com>
+ */
+
+#ifndef MGATEX_INC
+#define MGATEX_INC
+
+#include "mga_drm_public.h"
+#include "types.h"
+#include "mgacommon.h"
+#include "mm.h"
+
+
+#define MGA_TEX_MAXLEVELS 5
+
+
+typedef struct mga_texture_object_s {
+ struct mga_texture_object_s *next;
+ struct mga_texture_object_s *prev;
+ struct gl_texture_object *tObj;
+ mgaContextPtr ctx;
+ PMemBlock MemBlock;
+ mgaUI32 offsets[MGA_TEX_MAXLEVELS];
+ int lastLevel;
+ mgaUI32 dirty_images;
+ mgaUI32 totalSize;
+ int texelBytes;
+ mgaUI32 age;
+ mgaUI32 Setup[MGA_TEX_SETUP_SIZE];
+} mgaTextureObject_t;
+
+typedef mgaTextureObject_t *mgaTextureObjectPtr;
+
+/* called to check for environment variable options */
+void mgaInitTextureSystem( void );
+
+/* called when a context is being destroyed */
+void mgaDestroyContextTextures( mgaContextPtr ctx );
+
+/* 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 );
+
+
+/* Driver functions which are called directly from mesa */
+
+void mgaTexEnv( GLcontext *ctx, GLenum pname, const GLfloat *param );
+
+void mgaTexImage( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj, GLint level,
+ GLint internalFormat,
+ const struct gl_texture_image *image );
+
+void mgaTexSubImage( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLint internalFormat,
+ const struct gl_texture_image *image );
+
+void mgaTexParameter( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj,
+ GLenum pname, const GLfloat *params );
+
+void mgaBindTexture( GLcontext *ctx, GLenum target,
+ struct gl_texture_object *tObj );
+
+void mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj );
+
+void mgaUpdateTexturePalette( GLcontext *ctx, struct gl_texture_object *tObj );
+
+GLboolean mgaIsTextureResident( GLcontext *ctx, struct gl_texture_object *t );
+
+void mgaConvertTexture( mgaUI32 *destPtr, int texelBytes,
+ struct gl_texture_image *image,
+ int x, int y, int width, int height );
+
+
+
+int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t );
+
+
+
+
+void mgaResetGlobalLRU( mgaContextPtr mmesa );
+void mgaTexturesGone( mgaContextPtr mmesa, GLuint offset,
+ GLuint size, GLuint in_use );
+
+void mgaDDInitTextureFuncs( GLcontext *ctx );
+
+
+
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c
new file mode 100644
index 000000000..bd8ef083f
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c
@@ -0,0 +1,226 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+#include <stdio.h>
+#include <math.h>
+
+#include "vb.h"
+#include "pipeline.h"
+
+#include "mm.h"
+#include "mgalib.h"
+#include "mgatris.h"
+#include "mgavb.h"
+#include "mgalog.h"
+
+
+static void mga_null_quad( GLcontext *ctx, GLuint v0,
+ GLuint v1, GLuint v2, GLuint v3, GLuint pv ) {
+}
+static void mga_null_triangle( GLcontext *ctx, GLuint v0,
+ GLuint v1, GLuint v2, GLuint pv ) {
+}
+static void mga_null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) {
+}
+
+static void mga_null_points( GLcontext *ctx, GLuint first, GLuint last ) {
+}
+
+
+#define MGA_COLOR(to, from) { \
+ (to)[0] = (from)[2]; \
+ (to)[1] = (from)[1]; \
+ (to)[2] = (from)[0]; \
+ (to)[3] = (from)[3]; \
+}
+
+
+
+static triangle_func tri_tab[0x20];
+static quad_func quad_tab[0x20];
+static line_func line_tab[0x20];
+static points_func points_tab[0x20];
+
+static void mgaPrintRenderState( const char *msg, GLuint state )
+{
+ mgaMsg(1, "%s: (%x) %s%s%s%s%s%s\n",
+ msg, state,
+ (state & MGA_FLAT_BIT) ? "flat, " : "",
+ (state & MGA_OFFSET_BIT) ? "offset, " : "",
+ (state & MGA_TWOSIDE_BIT) ? "twoside, " : "",
+ (state & MGA_ANTIALIAS_BIT) ? "antialias, " : "",
+ (state & MGA_NODRAW_BIT) ? "no-draw, " : "",
+ (state & MGA_FALLBACK_BIT) ? "fallback" : "");
+}
+
+#define IND (0)
+#define TAG(x) x
+#include "mgatritmp.h"
+
+#define IND (MGA_FLAT_BIT)
+#define TAG(x) x##_flat
+#include "mgatritmp.h"
+
+#define IND (MGA_OFFSET_BIT)
+#define TAG(x) x##_offset
+#include "mgatritmp.h"
+
+#define IND (MGA_OFFSET_BIT|MGA_FLAT_BIT)
+#define TAG(x) x##_offset_flat
+#include "mgatritmp.h"
+
+#define IND (MGA_TWOSIDE_BIT)
+#define TAG(x) x##_twoside
+#include "mgatritmp.h"
+
+#define IND (MGA_TWOSIDE_BIT|MGA_FLAT_BIT)
+#define TAG(x) x##_twoside_flat
+#include "mgatritmp.h"
+
+#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT)
+#define TAG(x) x##_twoside_offset
+#include "mgatritmp.h"
+
+#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FLAT_BIT)
+#define TAG(x) x##_twoside_offset_flat
+#include "mgatritmp.h"
+
+void mgaDDTrifuncInit()
+{
+ int i;
+
+
+ init();
+ init_flat();
+ init_offset();
+ init_offset_flat();
+ init_twoside();
+ init_twoside_flat();
+ init_twoside_offset();
+ init_twoside_offset_flat();
+
+ /* Hmmm...
+ */
+ for (i = 0 ; i < 0x20 ; i++) {
+ if (i & ~MGA_FLAT_BIT) {
+ points_tab[i] = points_tab[i&MGA_FLAT_BIT];
+ line_tab[i] = line_tab[i&MGA_FLAT_BIT];
+ }
+ }
+
+ for (i = 0 ; i < 0x20 ; i++)
+ if ((i & (MGA_NODRAW_BIT|MGA_FALLBACK_BIT)) == MGA_NODRAW_BIT ||
+ mgaglx.nullprims)
+ {
+ quad_tab[i] = mga_null_quad;
+ tri_tab[i] = mga_null_triangle;
+ line_tab[i] = mga_null_line;
+ points_tab[i] = mga_null_points;
+ }
+
+ if (mgaglx.noFallback) {
+ for (i = 0 ; i < 0x10 ; i++) {
+ points_tab[i|MGA_FALLBACK_BIT] = points_tab[i];
+ line_tab[i|MGA_FALLBACK_BIT] = line_tab[i];
+ tri_tab[i|MGA_FALLBACK_BIT] = tri_tab[i];
+ quad_tab[i|MGA_FALLBACK_BIT] = quad_tab[i];
+ }
+ }
+
+}
+
+
+
+
+
+
+void mgaDDChooseRenderState( GLcontext *ctx )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint flags = ctx->TriangleCaps;
+
+ ctx->IndirectTriangles &= ~DD_SW_RASTERIZE;
+
+ if (flags) {
+ GLuint ind = 0;
+ GLuint shared = 0;
+ GLuint fallback = MGA_FALLBACK_BIT;
+
+ if (mgaglx.noFallback) fallback = 0;
+
+ if (flags & DD_Z_NEVER) shared |= MGA_NODRAW_BIT;
+ if (flags & DD_FLATSHADE) shared |= MGA_FLAT_BIT;
+ if (flags & DD_MULTIDRAW) shared |= fallback;
+ if (flags & (DD_SELECT|DD_FEEDBACK)) shared |= MGA_FALLBACK_BIT;
+ if (flags & DD_STENCIL) shared |= MGA_FALLBACK_BIT;
+
+ ind = shared;
+ if (flags & DD_POINT_SMOOTH) ind |= MGA_ANTIALIAS_BIT;
+ if (flags & DD_POINT_ATTEN) ind |= fallback;
+
+ mmesa->renderindex = ind;
+ mmesa->PointsFunc = points_tab[ind];
+ if (ind & MGA_FALLBACK_BIT)
+ ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE;
+
+ ind = shared;
+ if (flags & DD_LINE_SMOOTH) ind |= MGA_ANTIALIAS_BIT;
+ if (flags & DD_LINE_STIPPLE) ind |= fallback;
+
+ mmesa->renderindex |= ind;
+ mmesa->LineFunc = line_tab[ind];
+ if (ind & MGA_FALLBACK_BIT)
+ ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE;
+
+ ind = shared;
+ if (flags & DD_TRI_SMOOTH) ind |= MGA_ANTIALIAS_BIT;
+ if (flags & DD_TRI_OFFSET) ind |= MGA_OFFSET_BIT;
+ if (flags & DD_TRI_LIGHT_TWOSIDE) ind |= MGA_TWOSIDE_BIT;
+ if (flags & (DD_TRI_UNFILLED|DD_TRI_STIPPLE)) ind |= fallback;
+
+ mmesa->renderindex |= ind;
+ mmesa->TriangleFunc = tri_tab[ind];
+ mmesa->QuadFunc = quad_tab[ind];
+ if (ind & MGA_FALLBACK_BIT)
+ ctx->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE);
+ }
+ else if (mmesa->renderindex)
+ {
+ mmesa->renderindex = 0;
+ mmesa->PointsFunc = points_tab[0];
+ mmesa->LineFunc = line_tab[0];
+ mmesa->TriangleFunc = tri_tab[0];
+ mmesa->QuadFunc = quad_tab[0];
+ }
+
+ if (0) {
+ gl_print_tri_caps("tricaps", ctx->TriangleCaps);
+ mgaPrintRenderState("mga: Render state", mmesa->renderindex);
+ }
+}
+
+
+
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h
new file mode 100644
index 000000000..3b41900f1
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.h
@@ -0,0 +1,189 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+#ifndef MGATIS_INC
+#define MGATIS_INC
+
+#include "types.h"
+
+extern void mgaDDChooseRenderState(GLcontext *ctx);
+extern void mgaDDTrifuncInit( void );
+
+
+/* Todo:
+ * - multidraw, ...
+ * - Antialiasing (?)
+ * - line and polygon stipple
+ * - select and feedback
+ * - stencil
+ * - point parameters
+ * -
+ */
+#define MGA_ANTIALIAS_BIT 0 /* ignored for now, no fallback */
+#define MGA_FLAT_BIT 0x1
+#define MGA_OFFSET_BIT 0x2 /* 3.1 only */
+#define MGA_TWOSIDE_BIT 0x4 /* 3.1 only */
+#define MGA_NODRAW_BIT 0x8
+#define MGA_FALLBACK_BIT 0x10
+
+/* Not in use:
+ */
+#define MGA_FEEDBACK_BIT 0x20
+#define MGA_SELECT_BIT 0x40
+#define MGA_POINT_PARAM_BIT 0x80 /* not needed? */
+
+
+
+
+static __inline void mga_draw_triangle( mgaContextPtr mmesa,
+ mgaVertex *v0,
+ mgaVertex *v1,
+ mgaVertex *v2 )
+{
+ mgaUI32 vertsize = mmesa->vertsize;
+ mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 3 * vertsize );
+ int j;
+
+ for (j = 0 ; j < vertsize ; j++)
+ wv[j] = v0->ui[j];
+
+ wv += vertsize;
+ for (j = 0 ; j < vertsize ; j++)
+ wv[j] = v1->ui[j];
+
+ wv += vertsize;
+ for (j = 0 ; j < vertsize ; j++)
+ wv[j] = v2->ui[j];
+}
+
+
+static __inline void mga_draw_point( mgaContextPtr mmesa,
+ mgaVertex *tmp, float sz )
+{
+ mgaUI32 vertsize = mmesa->vertsize;
+ mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 6*vertsize);
+ int j;
+
+ *(float *)&wv[0] = tmp->warp1.x - sz;
+ *(float *)&wv[1] = tmp->warp1.y - sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp->warp1.x + sz;
+ *(float *)&wv[1] = tmp->warp1.y - sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp->warp1.x + sz;
+ *(float *)&wv[1] = tmp->warp1.y + sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp->warp1.x + sz;
+ *(float *)&wv[1] = tmp->warp1.y + sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp->warp1.x - sz;
+ *(float *)&wv[1] = tmp->warp1.y + sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp->warp1.x - sz;
+ *(float *)&wv[1] = tmp->warp1.y - sz;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp->ui[j];
+}
+
+
+static __inline void mga_draw_line( mgaContextPtr mmesa,
+ const mgaVertex *tmp0,
+ const mgaVertex *tmp1,
+ float width )
+{
+ mgaUI32 vertsize = mmesa->vertsize;
+ mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 6 * vertsize );
+ float dx, dy, ix, iy;
+ int j;
+
+ dx = tmp0->warp1.x - tmp1->warp1.x;
+ dy = tmp0->warp1.y - tmp1->warp1.y;
+
+ ix = width * .5; iy = 0;
+
+ if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width
+ 0.5 also */
+
+ if (dx * dx > dy * dy) {
+ iy = ix; ix = 0;
+ }
+
+ *(float *)&wv[0] = tmp0->warp1.x - ix;
+ *(float *)&wv[1] = tmp0->warp1.y - iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp0->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp1->warp1.x + ix;
+ *(float *)&wv[1] = tmp1->warp1.y + iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp1->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp0->warp1.x + ix;
+ *(float *)&wv[1] = tmp0->warp1.y + iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp0->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp0->warp1.x - ix;
+ *(float *)&wv[1] = tmp0->warp1.y - iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp0->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp1->warp1.x - ix;
+ *(float *)&wv[1] = tmp1->warp1.y - iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp1->ui[j];
+ wv += vertsize;
+
+ *(float *)&wv[0] = tmp1->warp1.x + ix;
+ *(float *)&wv[1] = tmp1->warp1.y + iy;
+ for (j = 2 ; j < vertsize ; j++)
+ wv[j] = tmp1->ui[j];
+ wv += vertsize;
+}
+
+
+
+
+#endif
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h
new file mode 100644
index 000000000..ac5a545d2
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h
@@ -0,0 +1,150 @@
+
+static __inline void TAG(triangle)( GLcontext *ctx, GLuint e0,
+ GLuint e1, GLuint e2, GLuint pv )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint vertsize = mmesa->vertsize;
+ mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 3 * vertsize);
+
+ struct vertex_buffer *VB = ctx->VB;
+ mgaVertexPtr mgaVB = MGA_DRIVER_DATA(VB)->verts;
+ const mgaVertex *v[3];
+ int i, j;
+
+#if (IND & MGA_OFFSET_BIT)
+ GLfloat offset = ctx->Polygon.OffsetUnits * 1.0/0x10000;
+#endif
+
+#if (IND & (MGA_FLAT_BIT|MGA_TWOSIDE_BIT))
+ mgaUI32 c[3];
+
+ c[2] = c[1] = c[0] = *(mgaUI32 *)&mgaVB[pv].warp2.color;
+#endif
+
+ (void) VB;
+
+ v[0] = &mgaVB[e0];
+ v[1] = &mgaVB[e1];
+ v[2] = &mgaVB[e2];
+
+
+#if (IND & (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT))
+ {
+ GLfloat ex = v[0]->warp1.x - v[2]->warp1.x;
+ GLfloat ey = v[0]->warp1.y - v[2]->warp1.y;
+ GLfloat fx = v[1]->warp1.x - v[2]->warp1.x;
+ GLfloat fy = v[1]->warp1.y - v[2]->warp1.y;
+ GLfloat cc = ex*fy-ey*fx;
+
+#if (IND & MGA_TWOSIDE_BIT)
+ {
+ GLuint facing = (cc>0.0) ^ ctx->Polygon.FrontBit;
+ GLubyte (*vbcolor)[4] = VB->Color[facing]->data;
+ if (IND & MGA_FLAT_BIT) {
+ MGA_COLOR((char *)&c[0],vbcolor[pv]);
+ c[2] = c[1] = c[0];
+ } else {
+ MGA_COLOR((char *)&c[0],vbcolor[e0]);
+ MGA_COLOR((char *)&c[1],vbcolor[e1]);
+ MGA_COLOR((char *)&c[2],vbcolor[e2]);
+ }
+ }
+#endif
+
+#if (IND & MGA_OFFSET_BIT)
+ {
+ if (cc * cc > 1e-16) {
+ GLfloat factor = ctx->Polygon.OffsetFactor;
+ GLfloat ez = v[0]->warp1.z - v[2]->warp1.z;
+ GLfloat fz = v[1]->warp1.z - v[2]->warp1.z;
+ GLfloat a = ey*fz-ez*fy;
+ GLfloat b = ez*fx-ex*fz;
+ GLfloat ic = 1.0 / cc;
+ GLfloat ac = a * ic;
+ GLfloat bc = b * ic;
+ if (ac<0.0F) ac = -ac;
+ if (bc<0.0F) bc = -bc;
+ offset += MAX2( ac, bc ) * factor;
+ }
+ }
+#endif
+ }
+#endif
+
+ mgaglx.c_triangles++;
+
+ for (j = 0 ; j < 3 ; j++, wv += vertsize) {
+
+ for (i = 0 ; i < vertsize ; i++)
+ wv[i] = v[j]->ui[i];
+
+#if (IND & (MGA_FLAT_BIT|MGA_TWOSIDE_BIT))
+ wv[4] = c[j]; /* color is the fifth element... */
+#endif
+#if (IND & MGA_OFFSET_BIT)
+ *(float *)&wv[2] = v[j]->warp1.z + offset;
+#endif
+ }
+}
+
+
+
+static void TAG(quad)( GLcontext *ctx, GLuint v0,
+ GLuint v1, GLuint v2, GLuint v3,
+ GLuint pv )
+{
+ TAG(triangle)( ctx, v0, v1, v3, pv );
+ TAG(triangle)( ctx, v1, v2, v3, pv );
+}
+
+
+#if ((IND & ~MGA_FLAT_BIT) == 0)
+
+static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ mgaVertexPtr mgaVB = MGA_DRIVER_DATA(ctx->VB)->verts;
+ float width = ctx->Line.Width;
+
+ if (IND & MGA_FLAT_BIT) {
+ mgaVertex tmp0 = mgaVB[v0];
+ mgaVertex tmp1 = mgaVB[v1];
+ *(int *)&tmp0.warp1.color = *(int *)&mgaVB[pv].warp1.color;
+ *(int *)&tmp1.warp1.color = *(int *)&mgaVB[pv].warp1.color;
+ mga_draw_line( mmesa, &tmp0, &tmp1, width );
+ }
+ else
+ mga_draw_line( mmesa, &mgaVB[v0], &mgaVB[v1], width );
+}
+
+
+static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ struct vertex_buffer *VB = ctx->VB;
+ mgaVertexPtr mgaVB = MGA_DRIVER_DATA(VB)->verts;
+ GLfloat sz = ctx->Point.Size * .5;
+ int i;
+
+ for(i=first;i<=last;i++)
+ if(VB->ClipMask[i]==0)
+ mga_draw_point( mmesa, &mgaVB[i], sz );
+}
+
+#endif
+
+
+static void TAG(init)( void )
+{
+ tri_tab[IND] = TAG(triangle);
+ quad_tab[IND] = TAG(quad);
+
+#if ((IND & ~MGA_FLAT_BIT) == 0)
+ line_tab[IND] = TAG(line);
+ points_tab[IND] = TAG(points);
+#endif
+}
+
+
+#undef IND
+#undef TAG
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c
new file mode 100644
index 000000000..f78c542c8
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c
@@ -0,0 +1,493 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+#include "mgalib.h"
+#include "mgavb.h"
+#include "mgalog.h"
+#include "stages.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TEX0 { \
+ v->warp2.tu0 = tc0[i][0]; \
+ v->warp2.tv0 = tc0[i][1]; \
+}
+
+#define TEX1 { \
+ v->warp2.tu1 = tc1[i][0]; \
+ v->warp2.tv1 = tc1[i][1]; \
+}
+
+#define SPC { \
+ GLubyte *spec = &(VB->Spec[0][i][0]); \
+ v->warp2.specular.red = spec[0]; \
+ v->warp2.specular.green = spec[1]; \
+ v->warp2.specular.blue = spec[2]; \
+}
+
+#define FOG { \
+ GLubyte *spec = &(VB->Spec[0][i][0]); \
+ v->warp2.specular.alpha = spec[3]; \
+}
+
+#define COL { \
+ GLubyte *col = &(VB->Color[0]->data[i][0]); \
+ v->warp2.color.blue = col[2]; \
+ v->warp2.color.green = col[1]; \
+ v->warp2.color.red = col[0]; \
+ v->warp2.color.alpha = col[3]; \
+}
+
+/* The warp2 code we have doesn't seem to support projective texturing
+ * in the multitexture case. (Would require another 1/w value for the
+ * second set of texcoords). This may be a problem for the g400.
+ */
+#define TEX0_4 \
+ if (VB->TexCoordPtr[0]->size == 4) \
+ { \
+ GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \
+ v = &(MGA_DRIVER_DATA(VB)->verts[start]); \
+ mmesa->setupdone &= ~MGA_WIN_BIT; \
+ for (i=start; i < end; i++, v++) { \
+ float oow = 1.0 / tc[i][3]; \
+ v->warp2.rhw *= tc[i][3]; \
+ v->warp2.tu0 *= oow; \
+ v->warp2.tv0 *= oow; \
+ } \
+ }
+
+
+#define COORD \
+ GLfloat *win = VB->Win.data[i]; \
+ v->warp2.rhw = win[3]; \
+ v->warp2.z = (1.0/0x10000) * win[2]; \
+ v->warp2.x = win[0] + xoffset; \
+ v->warp2.y = - win[1] + yoffset;
+
+#define NOP
+
+
+
+
+#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,spec,fog) \
+static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \
+{ \
+ mgaContextPtr mmesa = MGA_CONTEXT( VB->ctx ); \
+ mgaVertexPtr v; \
+ GLfloat (*tc0)[4]; \
+ GLfloat (*tc1)[4]; \
+ GLfloat xoffset = 0.5 + mmesa->drawX; \
+ GLfloat yoffset = mmesa->driDrawable->h - 0.5 + mmesa->drawY; \
+ int i; \
+ (void) xoffset; (void) yoffset; \
+ \
+ gl_import_client_data( VB, VB->ctx->RenderFlags, \
+ (VB->ClipOrMask \
+ ? VEC_WRITABLE|VEC_GOOD_STRIDE \
+ : VEC_GOOD_STRIDE)); \
+ \
+ tc0 = VB->TexCoordPtr[mmesa->tmu_source[0]]->data; \
+ tc1 = VB->TexCoordPtr[mmesa->tmu_source[1]]->data; \
+ \
+ v = &(MGA_DRIVER_DATA(VB)->verts[start]); \
+ \
+ if (VB->ClipOrMask == 0) \
+ for (i=start; i < end; i++, v++) { \
+ win; \
+ col; \
+ tex0; \
+ tex1; \
+ spec; \
+ fog; \
+ } \
+ else \
+ for (i=start; i < end; i++, v++) { \
+ if (VB->ClipMask[i] == 0) { \
+ win; \
+ tex0; \
+ tex1; \
+ spec; \
+ fog; \
+ } \
+ col; \
+ } \
+ tex0_4; \
+}
+
+
+
+SETUPFUNC(rs_wt0, COORD,NOP,TEX0,NOP,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_wt0t1, COORD,NOP,TEX0,TEX1,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_wft0, COORD,NOP,TEX0,NOP,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_wft0t1, COORD,NOP,TEX0,TEX1,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_wg, COORD,COL,NOP,NOP,NOP,NOP,NOP)
+SETUPFUNC(rs_wgs, COORD,COL,NOP,NOP,NOP,SPC,NOP)
+SETUPFUNC(rs_wgt0, COORD,COL,TEX0,NOP,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_wgt0t1, COORD,COL,TEX0,TEX1,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_wgst0, COORD,COL,TEX0,NOP,TEX0_4,SPC,NOP)
+SETUPFUNC(rs_wgst0t1, COORD,COL,TEX0,TEX1,TEX0_4,SPC,NOP)
+SETUPFUNC(rs_wgf, COORD,COL,NOP,NOP,NOP,NOP,FOG)
+SETUPFUNC(rs_wgfs, COORD,COL,NOP,NOP,NOP,SPC,FOG)
+SETUPFUNC(rs_wgft0, COORD,COL,TEX0,NOP,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_wgft0t1, COORD,COL,TEX0,TEX1,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_wgfst0, COORD,COL,TEX0,NOP,TEX0_4,SPC,FOG)
+SETUPFUNC(rs_wgfst0t1, COORD,COL,TEX0,TEX1,TEX0_4,SPC,FOG)
+
+SETUPFUNC(rs_t0, NOP,NOP,TEX0,NOP,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_t0t1, NOP,NOP,TEX0,TEX1,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_f, NOP,NOP,NOP,NOP,NOP,NOP,FOG)
+SETUPFUNC(rs_ft0, NOP,NOP,TEX0,NOP,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_ft0t1, NOP,NOP,TEX0,TEX1,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_g, NOP,COL,NOP,NOP,NOP,NOP,NOP)
+SETUPFUNC(rs_gs, NOP,COL,NOP,NOP,NOP,SPC,NOP)
+SETUPFUNC(rs_gt0, NOP,COL,TEX0,NOP,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_gt0t1, NOP,COL,TEX0,TEX1,TEX0_4,NOP,NOP)
+SETUPFUNC(rs_gst0, NOP,COL,TEX0,NOP,TEX0_4,SPC,NOP)
+SETUPFUNC(rs_gst0t1, NOP,COL,TEX0,TEX1,TEX0_4,SPC,NOP)
+SETUPFUNC(rs_gf, NOP,COL,NOP,NOP,NOP,NOP,FOG)
+SETUPFUNC(rs_gfs, NOP,COL,NOP,NOP,NOP,SPC,FOG)
+SETUPFUNC(rs_gft0, NOP,COL,TEX0,NOP,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_gft0t1, NOP,COL,TEX0,TEX1,TEX0_4,NOP,FOG)
+SETUPFUNC(rs_gfst0, NOP,COL,TEX0,NOP,TEX0_4,SPC,FOG)
+SETUPFUNC(rs_gfst0t1, NOP,COL,TEX0,TEX1,TEX0_4,SPC,FOG)
+
+
+static void rs_invalid(struct vertex_buffer *VB, GLuint start, GLuint end)
+{
+ mgaError("mgaRasterSetup(): invalid combination\n");
+}
+
+typedef void (*setupFunc)(struct vertex_buffer *,GLuint,GLuint);
+
+static setupFunc setup_func[0x80];
+
+void mgaDDSetupInit( void )
+{
+ int i;
+
+ for (i = 0 ; i < 0x80 ; i++)
+ setup_func[i] = rs_invalid;
+
+ /* Functions to build vert's from scratch */
+ setup_func[MGA_WIN_BIT|MGA_TEX0_BIT] = rs_wt0;
+ setup_func[MGA_WIN_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wt0t1;
+ setup_func[MGA_WIN_BIT|MGA_FOG_BIT|MGA_TEX0_BIT] = rs_wft0;
+ setup_func[MGA_WIN_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wft0t1;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT] = rs_wg;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT] = rs_wgs;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT] = rs_wgt0;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wgt0t1;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT] = rs_wgst0;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wgst0t1;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT] = rs_wgf;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT] = rs_wgfs;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT] = rs_wgft0;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wgft0t1;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT] = rs_wgfst0;
+ setup_func[MGA_WIN_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wgfst0t1;
+
+ /* Repair functions */
+ setup_func[MGA_TEX0_BIT] = rs_t0;
+ setup_func[MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_t0t1;
+ setup_func[MGA_FOG_BIT] = rs_f;
+ setup_func[MGA_FOG_BIT|MGA_TEX0_BIT] = rs_ft0;
+ setup_func[MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_ft0t1;
+ setup_func[MGA_RGBA_BIT] = rs_g;
+ setup_func[MGA_RGBA_BIT|MGA_SPEC_BIT] = rs_gs;
+ setup_func[MGA_RGBA_BIT|MGA_TEX0_BIT] = rs_gt0;
+ setup_func[MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_gt0t1;
+ setup_func[MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT] = rs_gst0;
+ setup_func[MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_gst0t1;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT] = rs_gf;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT] = rs_gfs;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT] = rs_gft0;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_gft0t1;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT] = rs_gfst0;
+ setup_func[MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_gfst0t1;
+
+}
+
+
+void mgaPrintSetupFlags(char *msg, GLuint flags )
+{
+ fprintf(stderr, "%s: %d %s%s%s%s%s%s%s\n",
+ msg,
+ (int)flags,
+ (flags & MGA_WIN_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," : "",
+ (flags & MGA_ALPHA_BIT) ? " alpha," : "");
+}
+
+
+
+
+void mgaChooseRasterSetupFunc(GLcontext *ctx)
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ int funcindex = (MGA_WIN_BIT | MGA_RGBA_BIT);
+
+ mmesa->vertsize = 8;
+ mmesa->tmu_source[0] = 0;
+ mmesa->tmu_source[1] = 1;
+ mmesa->tex_dest[0] = MGA_TEX0_BIT;
+ mmesa->tex_dest[1] = MGA_TEX1_BIT;
+ mmesa->multitex = 0;
+
+ if (ctx->Texture.Enabled & 0xf) {
+ if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE)
+ funcindex &= ~MGA_RGBA_BIT;
+
+ funcindex |= MGA_TEX0_BIT;
+ }
+
+ if (ctx->Texture.Enabled & 0xf0) {
+ if (ctx->Texture.Enabled & 0xf) {
+ mmesa->multitex = 1;
+ mmesa->vertsize = 10;
+ funcindex |= MGA_TEX1_BIT;
+ } else {
+ /* Just a funny way of doing single texturing
+ */
+ mmesa->tmu_source[0] = 1;
+ mmesa->tex_dest[1] = MGA_TEX0_BIT;
+
+ if (ctx->Texture.Unit[1].EnvMode == GL_REPLACE)
+ funcindex &= ~MGA_RGBA_BIT;
+
+ funcindex |= MGA_TEX0_BIT;
+ }
+ }
+
+ if (ctx->Color.BlendEnabled)
+ funcindex |= MGA_ALPHA_BIT;
+
+ if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
+ funcindex |= MGA_SPEC_BIT;
+
+ if (ctx->Fog.Enabled)
+ funcindex |= MGA_FOG_BIT;
+
+ if (0)
+ mgaPrintSetupFlags("xsmesa: full setup function", funcindex);
+
+ mmesa->setupindex = funcindex;
+
+ /* Called by mesa's clip functons:
+ */
+ ctx->Driver.RasterSetup = setup_func[funcindex & ~MGA_ALPHA_BIT];
+}
+
+
+
+
+void mgaDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+ GLuint tmp = mmesa->setupdone;
+
+ d->type = 0;
+ mmesa->setupdone = 0; /* cleared if we return */
+
+ if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0)
+ return;
+
+ if (ctx->IndirectTriangles)
+ return;
+
+ mmesa->setupdone = tmp;
+
+ /* disabled until we have a merge&render op */
+ /* d->inputs = available; */
+ /* d->outputs = VERT_RAST_SETUP_PART; */
+ /* d->type = PIPE_PRECALC; */
+}
+
+
+/* Repair existing precalculated vertices with new data.
+ */
+void mgaDDPartialRasterSetup( struct vertex_buffer *VB )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT( VB->ctx );
+ GLuint new = VB->pipeline->new_outputs;
+ GLuint available = VB->pipeline->outputs;
+ GLuint ind = 0;
+
+ if (new & VERT_WIN) {
+ new = available;
+ ind |= MGA_WIN_BIT | MGA_FOG_BIT;
+ }
+
+ if (new & VERT_RGBA)
+ ind |= MGA_RGBA_BIT | MGA_SPEC_BIT;
+
+ if (new & VERT_TEX0_ANY)
+ ind |= MGA_TEX0_BIT;
+
+ if (new & VERT_TEX1_ANY)
+ ind |= mmesa->tex_dest[1];
+
+ if (new & VERT_FOG_COORD)
+ ind |= MGA_FOG_BIT;
+
+ mmesa->setupdone &= ~ind;
+ ind &= mmesa->setupindex;
+ mmesa->setupdone |= ind;
+
+ if (0)
+ mgaPrintSetupFlags("xsmesa: partial setup function", ind);
+
+ if (ind)
+ setup_func[ind&~MGA_ALPHA_BIT]( VB, VB->Start, VB->Count );
+}
+
+
+void mgaDDDoRasterSetup( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ mgaContextPtr mmesa = MGA_CONTEXT( ctx );
+
+ /* Can't lock, won't lock
+ */
+ REFRESH_DRAWABLE_INFO( mmesa );
+
+ if (VB->Type == VB_CVA_PRECALC)
+ mgaDDPartialRasterSetup( VB );
+ else if (ctx->Driver.RasterSetup)
+ ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count );
+}
+
+static void FatalError( char *s )
+{
+ fprintf(stderr, s);
+ exit(1);
+}
+
+
+
+void mgaDDResizeVB( struct vertex_buffer *VB, GLuint size )
+{
+ mgaVertexBufferPtr mvb = MGA_DRIVER_DATA(VB);
+
+ while (mvb->size < size)
+ mvb->size *= 2;
+
+ free( mvb->vert_store );
+ mvb->vert_store = malloc( sizeof(mgaVertex) * mvb->size + 31);
+ if (!mvb->vert_store)
+ FatalError("mga-glx: out of memory !\n");
+
+ mvb->verts = (mgaVertexPtr)(((unsigned long)mvb->vert_store + 31) & ~31);
+
+ gl_vector1ui_free( &mvb->clipped_elements );
+ gl_vector1ui_alloc( &mvb->clipped_elements, VEC_WRITABLE, mvb->size, 32 );
+ if (!mvb->clipped_elements.start)
+ FatalError("mga-glx: out of memory !\n");
+
+ free( VB->ClipMask );
+ VB->ClipMask = (GLubyte *)malloc(sizeof(GLubyte) * mvb->size);
+ if (!VB->ClipMask)
+ FatalError("mga-glx: out of memory !\n");
+
+ if (VB->Type == VB_IMMEDIATE) {
+ free( mvb->primitive );
+ free( mvb->next_primitive );
+ mvb->primitive = (GLuint *)malloc( sizeof(GLuint) * mvb->size );
+ mvb->next_primitive = (GLuint *)malloc( sizeof(GLuint) * mvb->size );
+ if (!mvb->primitive || !mvb->next_primitive)
+ FatalError("mga-glx: out of memory!");
+ }
+}
+
+
+void mgaDDRegisterVB( struct vertex_buffer *VB )
+{
+ mgaVertexBufferPtr mvb;
+
+ mvb = (mgaVertexBufferPtr)calloc( 1, sizeof(*mvb) );
+
+ /* This looks like it allocates a lot of memory, but it basically
+ * just sets an upper limit on how much can be used - nothing like
+ * this amount will ever be turned into 'real' memory.
+ */
+ mvb->size = VB->Size * 5;
+ mvb->vert_store = malloc( sizeof(mgaVertex) * mvb->size + 31);
+ if (!mvb->vert_store)
+ FatalError("mga-glx: out of memory !\n");
+
+ mvb->verts = (mgaVertexPtr)(((unsigned long)mvb->vert_store + 31) & ~31);
+
+ gl_vector1ui_alloc( &mvb->clipped_elements, VEC_WRITABLE, mvb->size, 32 );
+ if (!mvb->clipped_elements.start)
+ FatalError("mga-glx: out of memory !\n");
+
+ free( VB->ClipMask );
+ VB->ClipMask = (GLubyte *)malloc(sizeof(GLubyte) * mvb->size);
+ if (!VB->ClipMask)
+ FatalError("mga-glx: out of memory !\n");
+
+ mvb->primitive = (GLuint *)malloc( sizeof(GLuint) * mvb->size );
+ mvb->next_primitive = (GLuint *)malloc( sizeof(GLuint) * mvb->size );
+ if (!mvb->primitive || !mvb->next_primitive)
+ FatalError("mga-glx: out of memory!");
+
+ VB->driver_data = mvb;
+}
+
+
+void mgaDDUnregisterVB( struct vertex_buffer *VB )
+{
+ mgaVertexBufferPtr mvb = MGA_DRIVER_DATA(VB);
+
+ if (mvb) {
+ if (mvb->vert_store) free(mvb->vert_store);
+ if (mvb->primitive) free(mvb->primitive);
+ if (mvb->next_primitive) free(mvb->next_primitive);
+ gl_vector1ui_free( &mvb->clipped_elements );
+ free(mvb);
+ VB->driver_data = 0;
+ }
+}
+
+
+mgaUI32 *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords )
+{
+ int bytes = dwords * 4;
+ mgaUI32 *head;
+
+ if (mmesa->dma_buffer->used + bytes > mmesa->dma_buffer->total)
+ mgaFlushVertices( mmesa );
+
+ head = (mgaUI32 *)((char *)mmesa->dma_buffer->address +
+ mmesa->dma_buffer->used);
+
+ mmesa->dma_buffer->used += bytes;
+ return head;
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.h b/xc/lib/GL/mesa/src/drv/mga/mgavb.h
new file mode 100644
index 000000000..8d7c65207
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.h
@@ -0,0 +1,132 @@
+/*
+ * GLX Hardware Device Driver for Matrox Millenium G200
+ * 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.
+ *
+ *
+ * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
+ */
+
+#ifndef MGAVB_INC
+#define MGAVB_INC
+
+#include "vb.h"
+#include "mgacommon.h"
+
+
+/* common datatypes for the mga warp engines */
+
+/*
+ * color type for the vertex data
+ * we probably want to use an internal datatype here?
+ */
+typedef struct mga_warp_color_t {
+ GLubyte blue;
+ GLubyte green;
+ GLubyte red;
+ GLubyte alpha;
+} mga_warp_color;
+
+
+/*
+ * vertex type used for the single-warp g200
+ */
+typedef struct mga_warp_vertex_t {
+ GLfloat x,y,z; /* coordinates in screen space*/
+ GLfloat rhw; /* reciprocal homogeneous w */
+ mga_warp_color color; /* vertex color */
+ mga_warp_color specular; /* specular color, alpha is fog */
+ GLfloat tu0,tv0; /* texture coordinates */
+} mga_warp_vertex1;
+
+/*
+ * vertex type used for the dual-warp g400
+ */
+typedef struct mga_warp_vertex2_t {
+ GLfloat x,y,z; /* coordinates in screen space*/
+ GLfloat rhw; /* reciprocal homogeneous w */
+ mga_warp_color color; /* vertex color */
+ mga_warp_color specular; /* specular color, alpha is fog */
+ GLfloat tu0,tv0; /* texture coordinates */
+ GLfloat tu1,tv1; /* same for second stage */
+} mga_warp_vertex2;
+
+
+/* The fastpath code still expects a 16-float stride vertex.
+ */
+union mga_vertex_t {
+ mga_warp_vertex1 warp1;
+ mga_warp_vertex2 warp2;
+ float f[16];
+ mgaUI32 ui[16];
+};
+
+typedef union mga_vertex_t mgaVertex;
+typedef union mga_vertex_t *mgaVertexPtr;
+
+struct mga_vertex_buffer_t {
+ GLvector1ui clipped_elements;
+ mgaVertexPtr verts;
+ int last_vert;
+ GLuint *primitive;
+ GLuint *next_primitive;
+ void *vert_store;
+ GLuint size;
+
+ mgaUI32 *vert_buf;
+ mgaUI32 *elt_buf;
+ mgaUI32 vert_phys_start;
+};
+
+typedef struct mga_vertex_buffer_t *mgaVertexBufferPtr;
+
+#define MGA_CONTEXT(ctx) ((mgaContextPtr)((ctx)->DriverCtx))
+#define MGA_DRIVER_DATA(vb) ((mgaVertexBufferPtr)((vb)->driver_data))
+
+
+#define MGA_FOG_BIT MGA_F
+#define MGA_ALPHA_BIT MGA_A
+#define MGA_SPEC_BIT MGA_S
+#define MGA_TEX1_BIT MGA_T2
+#define MGA_TEX0_BIT 0x10 /* non-warp parameters */
+#define MGA_RGBA_BIT 0x20
+#define MGA_WIN_BIT 0x40
+
+struct gl_pipeline_stage;
+
+extern void mgaChooseRasterSetupFunc(GLcontext *ctx);
+extern void mgaPrintSetupFlags(char *msg, GLuint flags );
+extern void mgaDDDoRasterSetup( struct vertex_buffer *VB );
+extern void mgaDDPartialRasterSetup( struct vertex_buffer *VB );
+extern void mgaDDCheckPartialRasterSetup( GLcontext *ctx,
+ struct gl_pipeline_stage *d );
+
+
+extern void mgaDDUnregisterVB( struct vertex_buffer *VB );
+extern void mgaDDRegisterVB( struct vertex_buffer *VB );
+extern void mgaDDResizeVB( struct vertex_buffer *VB, GLuint size );
+
+extern void mgaDDSetupInit( void );
+
+
+extern mgaUI32 *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords );
+
+
+#endif
diff --git a/xc/lib/Xxf86rush/XF86Rush.c b/xc/lib/Xxf86rush/XF86Rush.c
index a6dd27b1d..6281b1742 100644
--- a/xc/lib/Xxf86rush/XF86Rush.c
+++ b/xc/lib/Xxf86rush/XF86Rush.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/Xxf86rush/XF86Rush.c,v 1.2 1999/09/27 06:29:15 dawes Exp $ */
+/* $XFree86: xc/lib/Xxf86rush/XF86Rush.c,v 1.3 2000/02/11 22:35:45 dawes Exp $ */
/*
Copyright (c) 1998 Daryll Strauss
@@ -104,14 +104,15 @@ Bool XF86RushLockPixmap(Display *dpy, int screen, Pixmap pixmap, void **addr)
GetReq(XF86RushLockPixmap, req);
req->reqType = info->codes->major_opcode;
req->rushReqType = X_XF86RushLockPixmap;
- req->screen=screen;
- req->pixmap=pixmap;
+ req->screen = screen;
+ req->pixmap = pixmap;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
- *addr=(void*)rep.addr;
+ if (addr)
+ *addr = (void *)rep.addr;
UnlockDisplay(dpy);
SyncHandle();
return True;
@@ -182,3 +183,41 @@ Bool XF86RushSetPixelStride(Display *dpy, int screen, int stride)
SyncHandle();
return True;
}
+
+int XF86RushOverlayPixmap (Display *dpy, XvPortID port, Drawable d,
+ GC gc, Pixmap pixmap, int src_x, int src_y,
+ unsigned int src_w, unsigned int src_h,
+ int dest_x, int dest_y,
+ unsigned int dest_w, unsigned int dest_h,
+ unsigned int id)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86RushOverlayPixmapReq *req;
+
+ XF86RushCheckExtension (dpy, info, False);
+
+ FlushGC(dpy, gc);
+
+ LockDisplay(dpy);
+ GetReq(XF86RushOverlayPixmap, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->rushReqType = X_XF86RushOverlayPixmap;
+ req->port = port;
+ req->drawable = d;
+ req->gc = gc->gid;
+ req->id = id;
+ req->pixmap = pixmap;
+ req->src_x = src_x;
+ req->src_y = src_y;
+ req->src_w = src_w;
+ req->src_h = src_h;
+ req->drw_x = dest_x;
+ req->drw_y = dest_y;
+ req->drw_w = dest_w;
+ req->drw_h = dest_h;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return Success;
+}
diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile
new file mode 100644
index 000000000..88e77c7c5
--- /dev/null
+++ b/xc/programs/Imakefile
@@ -0,0 +1,90 @@
+XCOMM $TOG: Imakefile /main/85 1998/02/26 17:14:44 kaleb $
+XCOMM
+XCOMM
+XCOMM
+XCOMM $XFree86: xc/programs/Imakefile,v 3.26 2000/02/13 03:26:04 dawes Exp $
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+#if BuildServer
+ RGBSRCDIR = rgb
+ XSSRCDIR = Xserver
+#endif
+#ifndef Win32Architecture
+#if HasXServer
+ XINITSRCDIR = xinit
+#endif
+#if BuildFontServer
+ XFSSRCDIR = xfs
+#endif
+#if BuildXKBlib
+ XKBSRCDIRS = xkbcomp xkbevd xkbprint xkbutils
+#endif
+#if BuildScreenSaverExt
+SCREENSAVESRCDIR = beforelight
+#endif
+#if BuildXF86VidModeExt
+ XVIDTUNESRCDIR = xvidtune
+#endif
+#if BuildXF86DGA
+ XF86DGASRCDIR = xf86dga
+#endif
+#if BuildXAServer
+ XASSRCDIR = Xaserver
+#endif
+#if BuildLBX
+ LBXPROXYSRCDIR = lbxproxy
+#endif
+ PROXYMGRSRCDIR = proxymngr
+ RSTARTSRCDIR = rstart
+ SMPROXYSRCDIR = smproxy
+ TWMSRCDIR = twm
+ XCONSOLESRCDIR = xconsole
+ XDMSRCDIR = xdm
+XFINDPROXYSRCDIR = xfindproxy
+ XFWPSRCDIR = xfwp
+ XGAMMASRCDIR = xgamma
+ XHOSTSRCDIR = xhost
+#if BuildPlugin
+ XRXSRCDIR = xrx
+#endif
+ XSMSRCDIR = xsm
+ XTERMSRCDIR = xterm
+ SCRIPTSDIR = scripts
+#endif
+#if BuildCID
+ MKCFMSRCDIR = mkcfm
+#endif
+
+#if BuildDPSLibraries
+ MAKEPSRESDIR = makepsres
+#endif
+
+ XPMCLIENTDIRS = cxpm sxpm
+
+#if BuildServersOnly
+SUBDIRS = $(XSSRCDIR)
+#else
+SUBDIRS = \
+ appres bdftopcf bitmap \
+ $(SCREENSAVESRCDIR) editres fsinfo fslsfonts fstobdf iceauth \
+ ico listres \
+ $(MAKEPSRESDIR) $(MKCFMSRCDIR) \
+ mkfontdir oclock $(PROXYMGRSRCDIR) $(RGBSRCDIR) $(RSTARTSRCDIR) \
+ setxkbmap showfont \
+ $(SMPROXYSRCDIR) $(TWMSRCDIR) viewres x11perf xauth xbiff xcalc \
+ xclipboard xclock \
+ xcmsdb $(XCONSOLESRCDIR) $(XDMSRCDIR) xdpyinfo \
+ $(XF86DGASRCDIR) xedit xev xeyes xfd $(XFSSRCDIR) \
+ $(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) xgc $(XHOSTSRCDIR) \
+ xieperf $(XINITSRCDIR) $(XKBSRCDIRS) xkill xload xlogo xlsatoms \
+ xlsclients xlsfonts xmag xman xmessage xmodmap xprop xrdb \
+ xrefresh $(XRXSRCDIR) xset \
+ xsetroot $(XSMSRCDIR) xstdcmap xsetmode xsetpointer \
+ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \
+ $(XPMCLIENTDIRS) \
+ $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR)
+#endif
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c
index e3160efa3..4add901fd 100644
--- a/xc/programs/Xserver/GL/dri/dri.c
+++ b/xc/programs/Xserver/GL/dri/dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.7 1999/12/14 01:33:38 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.11 2000/02/15 07:13:32 martin Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h
index 060efb121..810711086 100644
--- a/xc/programs/Xserver/GL/dri/dri.h
+++ b/xc/programs/Xserver/GL/dri/dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.4 1999/12/14 01:33:39 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.7 2000/02/14 06:27:13 martin Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h
index 2f5320c95..0ebfc720c 100644
--- a/xc/programs/Xserver/GL/dri/dristruct.h
+++ b/xc/programs/Xserver/GL/dri/dristruct.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.3 1999/09/25 14:36:42 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.5 2000/02/14 06:27:14 martin Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile
index f4a4af7ec..654d183fd 100644
--- a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.2 1999/06/14 07:31:42 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.3 2000/02/08 17:18:51 dawes Exp $
XCOMM $PI: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.6 1999/03/15 21:36:09 martin Exp $
#define IHaveModules
diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile
index fe3340c60..1dd376dce 100644
--- a/xc/programs/Xserver/GL/mesa/src/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/src/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.5 1999/12/14 01:33:40 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.11 2000/02/18 12:18:56 tsi Exp $
XCOMM $PI: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.9 1999/05/27 03:43:46 jens Exp $
#define IHaveModules
@@ -216,7 +216,7 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src)
hash.c \
hint.c \
image.c \
- imaging.o \
+ imaging.c \
light.c \
lines.c \
logic.c \
diff --git a/xc/programs/Xserver/GL/mesa/src/X/Imakefile b/xc/programs/Xserver/GL/mesa/src/X/Imakefile
index 9a112fafa..9dd8819e4 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/Imakefile
+++ b/xc/programs/Xserver/GL/mesa/src/X/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.5 1999/12/14 01:33:40 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.6 2000/02/08 17:18:52 dawes Exp $
XCOMM $PI: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.6 1999/03/15 21:36:10 martin Exp $
#define IHaveModules
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
index a3d626354..3555ba070 100644
--- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
+++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.5 1999/09/25 14:36:42 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.6 2000/02/08 17:18:52 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile
index ab6d833e0..f0ca1ff94 100644
--- a/xc/programs/Xserver/Imakefile
+++ b/xc/programs/Xserver/Imakefile
@@ -2,7 +2,7 @@ XCOMM $TOG: Imakefile /main/249 1997/12/11 11:18:14 kaleb $
/*
* Server Master Makefile
*/
-XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.172 1999/12/30 03:56:17 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.180 2000/02/11 18:06:39 dawes Exp $
#ifndef InstallXserverSetUID
#define InstallXserverSetUID NO
@@ -46,6 +46,8 @@ INSTPGMFLAGS =
#define FbPostFbLibs $(FB) NoMfbPostFbLibs
#define FBLibs PreFbLibs FbPostFbLibs
+#define AllFBLibs PreFbLibs $(FB) $(CFB) PostFbLibs
+
#if BuildPexExt
PEXLIBS = PEX5/dipex/dispatch/ModuleLibraryTargetName(didipex) \
PEX5/dipex/swap/ModuleLibraryTargetName(diswapex) \
@@ -239,13 +241,21 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs)
$(FONTLIBSRC)/LibraryTargetName(fontbase)
FONT = $(XFONTLIB) $(XPFBLIBS)
FONTLIBS = $(LDPRELIB) $(FONT)
+#if UsbMouseSupport
+#if !HasLibUsb
+ USB = $(XF86OSSRC)/bsd/libusb/LibraryTargetName(usb)
+#else
+ USB = -lusb
+#endif
+#endif
#ifdef ServerExtraSysLibs
EXTRASYSLIBS = ServerExtraSysLibs
#endif
#if SystemV4 || defined(SGIArchitecture) || UseRgbTxt
- SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(EXTRASYSLIBS)
+ SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(USB) $(EXTRASYSLIBS)
#else
- SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(EXTRASYSLIBS)
+ SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(USB) \
+ $(EXTRASYSLIBS)
#endif
CBRT = mi/LibraryTargetName(cbrt)
STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS)
@@ -526,7 +536,7 @@ XVFB = Xvfb
#if defined(XF86Server) || (!MakeDllModules && (defined(XnestServer) || defined(XVirtualFramebufferServer)))
MakeMutex($(XF86SERVER) $(XNEST) $(XVFB))
#endif
-MakeMutex($(STDDIRS) mfb cfb cfb16 cfb32)
+MakeMutex($(STDDIRS) mfb fb cfb cfb16 cfb24 cfb32)
#endif
@@ -534,6 +544,7 @@ MakeMutex($(STDDIRS) mfb cfb cfb16 cfb32)
XCOMM
XCOMM XFree86 Server
XCOMM
+FBDIR = fb
MFBDIR = mfb
CFB8DIR = cfb
CFB16DIR = cfb16
@@ -543,7 +554,7 @@ CFB32DIR = cfb32
AFBDIR = afb
#endif
DDXDIR1 = hw/xfree86
-XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(AFBDIR) $(DDXDIR1) $(DEPDIRS)
+XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(FBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(AFBDIR) $(DDXDIR1) $(DEPDIRS)
XF86INIT = $(XF86COMSRC)/xf86Init.o $(XF86COMSRC)/xf86IniExt.o
XF86COMLIB = $(XF86COMSRC)/LibraryTargetName(xf86)
XF86PARSLIB= $(XF86PARSERSRC)/LibraryTargetName(xf86config)
@@ -592,10 +603,10 @@ XF86DDCLIB = $(XF86SRC)/ddc/LibraryTargetName(ddc)
#if XF86RAC
XF86RACLIB = $(XF86SRC)/rac/LibraryTargetName(rac)
#endif
-#if XF86INT10
+#if XF86INT10_BUILD > X86EMU_GENERIC
XF86INT10LIB = $(XF86OSSRC)/LibraryTargetName(int10)
#else
-XF86INT10LIB = $(XF86OSSRC)/int10/stub.o
+XF86INT10LIB = $(XF86SRC)/int10/LibraryTargetName(int10)
#endif
XF86IDRIVERLIB = $(XF86SRC)/input/LibraryTargetName(idriver)
#if !DoLoadableServer
@@ -616,10 +627,8 @@ XF86LOADERLIB = $(XF86SRC)/loader/LibraryTargetName(loader)
XF86MAINLIBS = PreFbLibsNoFont $(FONTBASE) $(OTHEREXTS) $(XF86COMLIB) \
NoMfbPostFbLibs
XF86SERVERSYSLIBS = $(SYSLIBS) $(LIBDL) $(LIBREGEX)
-/* Mouse driver */
-XF86IDRVOBJS = $(XF86SRC)/input/mouse/mouse_drv.o
#else
-XF86MAINLIBS = CFBLibs $(XF86COMLIB) $(MI)
+XF86MAINLIBS = AllFBLibs $(XF86COMLIB) $(MI)
XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX)
#endif
XF86SERVEROBJS = $(XF86DRVOBJS) $(XF86IDRVOBJS)
@@ -862,13 +871,10 @@ CFB8DIR = cfb
CFB32DIR = cfb32
XPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DEPDIRS)
#if PrintOnlyServer
-#if BuildXinerama
-XPPANSTUBOBJS = Xprint/panoramiXstubs.o
-#endif
#if BuildDPMS
XPDPMSSTUBOBJS = Xprint/dpmsstubs.o
#endif
-XPOBJS = Xprint/ddxInit.o Xprint/miinitext.o $(XPPANSTUBOBJS) $(XPDPMSSTUBOBJS)
+XPOBJS = Xprint/ddxInit.o Xprint/miinitext.o $(XPDPMSSTUBOBJS)
XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs
#else
XPOBJS = Xprint/ddxInit.o
@@ -954,13 +960,10 @@ XVFBDDXDIR = hw
#endif
XVFBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XVFBDDXDIR) $(DEPDIRS)
#ifndef Win32Architecture
-#if BuildXinerama
-XVFBPANSTUBOBJS = hw/vfb/panoramiXstubs.o
-#endif
#if BuildDPMS
XVFBDPMSSTUBOBJS = hw/vfb/dpmsstubs.o
#endif
-XVFBOBJS = hw/vfb/stubs.o hw/vfb/miinitext.o $(XVFBPANSTUBOBJS) $(XVFBDPMSSTUBOBJS)
+XVFBOBJS = hw/vfb/stubs.o hw/vfb/miinitext.o $(XVFBDPMSSTUBOBJS)
#else
XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o
#endif
diff --git a/xc/programs/Xserver/Xext/panoramiX.h b/xc/programs/Xserver/Xext/panoramiX.h
index 5f5b91c20..063eda3bf 100644
--- a/xc/programs/Xserver/Xext/panoramiX.h
+++ b/xc/programs/Xserver/Xext/panoramiX.h
@@ -19,7 +19,7 @@
* or in FAR 52.227-19, as applicable. *
* *
*****************************************************************/
-/* $XFree86: xc/programs/Xserver/Xext/panoramiX.h,v 1.1 1999/09/27 06:29:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/Xext/panoramiX.h,v 1.4 2000/01/22 01:59:03 mvojkovi Exp $ */
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
@@ -43,223 +43,54 @@ typedef struct _PanoramiXData {
typedef struct _PanoramiXInfo {
XID id ;
- pointer pntr;
} PanoramiXInfo;
-typedef struct _PanoramiXList {
+typedef struct {
PanoramiXInfo info[MAXSCREENS];
- struct _PanoramiXList *next;
- Bool FreeMe;
+ RESTYPE type;
union {
struct {
- unsigned int visibility;
+ char visibility;
+ char class;
} win;
struct {
Bool shared;
} pix;
char raw_data[4];
} u;
-} PanoramiXList;
+} PanoramiXRes;
-typedef PanoramiXList PanoramiXWindow;
-typedef PanoramiXList PanoramiXGC;
-typedef PanoramiXList PanoramiXCmap;
-typedef PanoramiXList PanoramiXPmap;
+#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
+#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
+#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
-#define XE_PTR (xE->u.keyButtonPointer)
#define BREAK_IF(a) if ((a)) break
#define IF_RETURN(a,b) if ((a)) return (b)
-#define PANORAMIXWIN_SIZE() (sizeof(PanoramiXWindow))
-#define PANORAMIXGC_SIZE() (sizeof(PanoramiXGC))
-#define PANORAMIXCMAP_SIZE() (sizeof(PanoramiXCmap))
-#define PANORAMIXPMAP_SIZE() (sizeof(PanoramiXPmap))
-#define PANORAMIXFIND_ID_BY_SCRNUM(a, b ,i) \
- for (; (a) && ((a)->info[i].id != (b)); (a) = (a)->next)
-
-/*
- * NEW lookup
- * more complex - reorders list putting newly lookup up elemtn at the front
- * (2nd place after root) of the list speeding up lookups for commonly
- * accessed elements
- */
-#define PANORAMIXFIND_ID(a, b) \
-{\
- PanoramiXList *_m_original_a, *_m_tmp_previous_a = NULL;\
- int _m_i = 0;\
- _m_original_a = (PanoramiXList *)a;\
- for (; (a) && ((a)->info[0].id != (b)); _m_tmp_previous_a = (a), (a) = (a)->next, _m_i++);\
- if ((a) && (_m_tmp_previous_a) && (_m_tmp_previous_a != _m_original_a))\
- {\
- _m_tmp_previous_a->next = (a)->next;\
- (a)->next = _m_original_a->next;\
- _m_original_a->next = (a);\
- }\
-}
-
-/* new macro - inserts elemnt b into list a (a is root of list) */
-/* FIXME: we need to use this for adding id's to lists - not to the end */
-#define PANORAMIXFIND_ADD(a, b) \
-(b)->next = (a)->next;\
-(a)->next = (b);
-
-#define PANORAMIXFIND_LAST(a,b) \
- for ((a) = (b); (a)->next; (a) = (a)->next)
-
-#define FOR_NSCREENS_OR_ONCE(a, b) \
- for ((b)=(PanoramiXNumScreens - 1); (b) >= 0; (b)--)
-
-#define RECTA_SUBSUMES_RECTB(a, b) \
- (((a).x <= (b).x) && (((a).x + (a).width) >= ((b).x + (b).width) \
- && ((a).y <= (b).y) && (((a).y + (a).height) >= ((b).y + (b).height))))
-
-#define FORCE_ROOT(a, b) { \
- for ((b) = PanoramiXNumScreens - 1; (b); (b)--) \
- if ((a).root == PanoramiXWinRoot->info[(b)].id) \
+#define FORCE_ROOT(a) { \
+ int _j; \
+ for (_j = PanoramiXNumScreens - 1; _j; _j--) \
+ if ((a).root == WindowTable[_j]->drawable.id) \
break; \
- if ((b)) { \
- (a).rootX += panoramiXdataPtr[(b)].x; \
- (a).rootY += panoramiXdataPtr[(b)].y; \
- (a).root = PanoramiXWinRoot->info[0].id; \
- } \
+ (a).rootX += panoramiXdataPtr[_j].x; \
+ (a).rootY += panoramiXdataPtr[_j].y; \
+ (a).root = WindowTable[0]->drawable.id; \
}
-#define FORCE_WIN(a, b) { \
- for (; pPanoramiXWin; pPanoramiXWin = pPanoramiXWin->next) { \
- for ((b) = PanoramiXNumScreens - 1; (b); (b)--) \
- if (pPanoramiXWin->info[(b)].id == (a)) \
- break; \
- if (b) \
- break; \
- } \
- if ( (b) && pPanoramiXWin) { \
- (a) = pPanoramiXWin->info[0].id; /* Real ID */ \
+#define FORCE_WIN(a) { \
+ if ((win = PanoramiXFindIDOnAnyScreen(XRT_WINDOW, a))) { \
+ (a) = win->info[0].id; /* Real ID */ \
} \
}
-#define SKIP_FAKE_WINDOW(a, b) { \
- for (; pPanoramiXWin; pPanoramiXWin = pPanoramiXWin->next) \
- for ((b) = PanoramiXNumScreens - 1; (b); (b)--) \
- if (pPanoramiXWin->info[(b)].id == (a)) \
- return; \
+#define FORCE_CMAP(a) { \
+ if ((win = PanoramiXFindIDOnAnyScreen(XRT_COLORMAP, a))) { \
+ (a) = win->info[0].id; /* Real ID */ \
+ } \
}
-#define PANORAMIX_FREE(client) \
- if (!noPanoramiXExtension) { \
- if ((PanoramiXCmapRoot) && (PanoramiXCmapRootFreeable)) { \
- for ( pPanoramiXFreeCmap = PanoramiXCmapRoot->next, \
- pPanoramiXFreeCmapback = PanoramiXCmapRoot; \
- pPanoramiXFreeCmap; \
- pPanoramiXFreeCmap = pPanoramiXFreeCmapback->next ) { \
- if (pPanoramiXFreeCmap->FreeMe){ \
- pPanoramiXFreeCmapback->next = pPanoramiXFreeCmap->next; \
- Xfree(pPanoramiXFreeCmap); \
- PanoramiXCmapRootFreeable = FALSE; \
- } \
- else \
- pPanoramiXFreeCmapback = pPanoramiXFreeCmap; \
- } \
- } \
- if ((PanoramiXPmapRoot) && (PanoramiXPmapRootFreeable)) { \
- for ( pPanoramiXFreePmap = PanoramiXPmapRoot->next, \
- pPanoramiXFreePmapback = PanoramiXPmapRoot; \
- pPanoramiXFreePmap; \
- pPanoramiXFreePmap = pPanoramiXFreePmapback->next ) { \
- if (pPanoramiXFreePmap->FreeMe){ \
- pPanoramiXFreePmapback->next = pPanoramiXFreePmap->next; \
- Xfree(pPanoramiXFreePmap); \
- PanoramiXPmapRootFreeable = FALSE; \
- } \
- else \
- pPanoramiXFreePmapback = pPanoramiXFreePmap; \
- } \
- } \
- if ((PanoramiXWinRoot) && (PanoramiXWinRootFreeable)) { \
- for ( pPanoramiXFreeWin = PanoramiXWinRoot->next, \
- pPanoramiXFreeWinback = PanoramiXWinRoot; \
- pPanoramiXFreeWin; \
- pPanoramiXFreeWin = pPanoramiXFreeWinback->next ) { \
- if (pPanoramiXFreeWin->FreeMe){ \
- pPanoramiXFreeWinback->next = pPanoramiXFreeWin->next; \
- Xfree(pPanoramiXFreeWin); \
- PanoramiXWinRootFreeable = FALSE; \
- } \
- else \
- pPanoramiXFreeWinback = pPanoramiXFreeWin; \
- } \
- } \
- if ((PanoramiXGCRoot) && (PanoramiXGCRootFreeable)) { \
- for ( pPanoramiXFreeGC = PanoramiXGCRoot->next, \
- pPanoramiXFreeGCback = PanoramiXGCRoot; \
- pPanoramiXFreeGC; \
- pPanoramiXFreeGC = pPanoramiXFreeGCback->next ) { \
- if (pPanoramiXFreeGC->FreeMe){ \
- pPanoramiXFreeGCback->next = pPanoramiXFreeGC->next; \
- Xfree(pPanoramiXFreeGC); \
- PanoramiXGCRootFreeable = FALSE; \
- } \
- else \
- pPanoramiXFreeGCback = pPanoramiXFreeGC; \
- } \
- } \
- }
-
-#define PANORAMIX_MARKFREE(FreeID,PanoramiXType) \
- if (!noPanoramiXExtension) { \
- if ((!FoundID) && (PanoramiXGCRoot) && (PanoramiXType == RT_GC)) { \
- for ( pPanoramiXGC = PanoramiXGCRoot->next, \
- pPanoramiXGCback = PanoramiXGCRoot; \
- ((!FoundID) && pPanoramiXGC && \
- (pPanoramiXGC->info[0].id != FreeID)); \
- pPanoramiXGC = pPanoramiXGC->next ) \
- pPanoramiXGCback = pPanoramiXGC; \
- if (pPanoramiXGC){ \
- FoundID = pPanoramiXGC->info[0].id; \
- pPanoramiXGC->FreeMe = TRUE; \
- PanoramiXGCRootFreeable = TRUE; \
- } \
- } \
- if ((!FoundID) && (PanoramiXPmapRoot) && (PanoramiXType == RT_PIXMAP)) { \
- for ( pPanoramiXPmap = PanoramiXPmapRoot->next, \
- pPanoramiXPmapback = PanoramiXPmapRoot; \
- ((!FoundID) && pPanoramiXPmap && \
- (pPanoramiXPmap->info[0].id != FreeID)); \
- pPanoramiXPmap = pPanoramiXPmap->next ) \
- pPanoramiXPmapback = pPanoramiXPmap; \
- if (pPanoramiXPmap){ \
- FoundID = pPanoramiXPmap->info[0].id; \
- pPanoramiXPmap->FreeMe = TRUE; \
- PanoramiXPmapRootFreeable = TRUE; \
- } \
- } \
- if ((!FoundID) && (PanoramiXWinRoot) && (PanoramiXType == RT_WINDOW)) { \
- for ( pPanoramiXWin = PanoramiXWinRoot->next, \
- pPanoramiXWinback = PanoramiXWinRoot; \
- ((!FoundID) && pPanoramiXWin && \
- (pPanoramiXWin->info[0].id != FreeID)); \
- pPanoramiXWin = pPanoramiXWin->next ) \
- pPanoramiXWinback = pPanoramiXWin; \
- if (pPanoramiXWin){ \
- FoundID = pPanoramiXWin->info[0].id; \
- pPanoramiXWin->FreeMe = TRUE; \
- PanoramiXWinRootFreeable = TRUE; \
- } \
- } \
- if ((!FoundID) && (PanoramiXCmapRoot) && (PanoramiXType == RT_COLORMAP)) { \
- for ( pPanoramiXCmap = PanoramiXCmapRoot->next, \
- pPanoramiXCmapback = PanoramiXCmapRoot; \
- ((!FoundID) && pPanoramiXCmap && \
- (pPanoramiXCmap->info[0].id != FreeID)); \
- pPanoramiXCmap = pPanoramiXCmap->next ) \
- pPanoramiXCmapback = pPanoramiXCmap; \
- if (pPanoramiXCmap){ \
- FoundID = pPanoramiXCmap->info[0].id; \
- pPanoramiXCmap->FreeMe = TRUE; \
- PanoramiXCmapRootFreeable = TRUE; \
- } \
- } \
- }
+#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
-void PrintList(PanoramiXList *head);
+#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return
#endif /* _PANORAMIX_H_ */
diff --git a/xc/programs/Xserver/Xext/panoramiXsrv.h b/xc/programs/Xserver/Xext/panoramiXsrv.h
index 1fbf3cd48..0020cd2eb 100644
--- a/xc/programs/Xserver/Xext/panoramiXsrv.h
+++ b/xc/programs/Xserver/Xext/panoramiXsrv.h
@@ -1,29 +1,27 @@
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.1 1999/09/27 06:29:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.4 2000/01/22 01:59:03 mvojkovi Exp $ */
#ifndef _PANORAMIXSRV_H_
#define _PANORAMIXSRV_H_
extern int PanoramiXNumScreens;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXGC *PanoramiXGCRoot;
-extern PanoramiXCmap *PanoramiXCmapRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
extern PanoramiXData *panoramiXdataPtr;
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
-extern RegionRec PanoramiXScreenRegion[MAXSCREENS];
+extern RegionRec PanoramiXScreenRegion;
+extern XID PanoramiXVisualTable[256][MAXSCREENS];
extern void PanoramiXConsolidate(void);
extern Bool PanoramiXCreateConnectionBlock(void);
-extern Bool PanoramiXCreateScreenRegion(WindowPtr);
+extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
+extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID);
+extern WindowPtr PanoramiXChangeWindow(int, WindowPtr);
+extern RegionRec XineramaScreenRegions[MAXSCREENS];
-/*
- * Free list flags added as pre-test before running through list to free ids
- */
-extern Bool PanoramiXWinRootFreeable;
-extern Bool PanoramiXGCRootFreeable;
-extern Bool PanoramiXCmapRootFreeable;
-extern Bool PanoramiXPmapRootFreeable;
+extern unsigned long XRC_DRAWABLE;
+extern unsigned long XRT_WINDOW;
+extern unsigned long XRT_PIXMAP;
+extern unsigned long XRT_GC;
+extern unsigned long XRT_COLORMAP;
extern void XineramaGetImageData(
DrawablePtr *pDrawables,
diff --git a/xc/programs/Xserver/Xext/panoramiXstubs.c b/xc/programs/Xserver/Xext/panoramiXstubs.c
deleted file mode 100644
index 6974da17a..000000000
--- a/xc/programs/Xserver/Xext/panoramiXstubs.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $XFree86: xc/programs/Xserver/Xext/panoramiXstubs.c,v 3.6 1999/06/27 16:56:07 dawes Exp $ */
-/*
- * HISTORY
- * Log
- * Revision 1.1.2.3 1996/05/21 18:18:34 Madeline_Asmus
- * Add new dummy panoramiX routines for symbol resolution
- * [1996/05/21 15:24:11 Madeline_Asmus]
- *
- * Revision 1.1.2.2 1995/12/06 19:55:26 Madeline_Asmus
- * Build in stubs for PanoramiX for symbol resolution
- * [1995/12/06 19:28:14 Madeline_Asmus]
- *
- * EndLog
- */
-/* $TOG: panoramiXstubs.c /main/3 1997/10/30 16:04:17 kaleb $ */
-
-typedef int Bool;
-
-void *panoramiXdataPtr = 0;
-
-void PanoramiXConsolidate()
-{
- /* Not supported with Xnest */
-}
-
-Bool PanoramiXCreateConnectionBlock()
-{
- /* Not supported with Xnest */
- return 0;
-}
-
-void* PanoramiXWinRoot = 0;
-
-void* PanoramiXGCRoot = 0;
-
-void* PanoramiXCmapRoot = 0;
-
-void* PanoramiXPmapRoot = 0;
-
-int PanoramiXNumScreens = 0;
-
-void PanoramiXExtensionInit()
-{
- /* Not supported with Xnest */
-}
-
-Bool PanoramiXCreateScreenRegion()
-{
- /* Not supported with Xnest */
- return 0;
-}
-
-void* PanoramiXScreenRegion = 0;
-
-Bool PanoramiXWinRootFreeable = 0;
-Bool PanoramiXGCRootFreeable = 0;
-Bool PanoramiXCmapRootFreeable = 0;
-Bool PanoramiXPmapRootFreeable = 0;
-
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
index 6bf7cb555..18baa01f7 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.197 1999/12/13 23:52:56 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.209 2000/02/18 00:47:35 dawes Exp $ */
/*
@@ -38,7 +38,7 @@ extern Bool noPanoramiXExtension;
#if (defined(i386) || defined(__i386__)) && \
(defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \
- defined(SVR4))
+ (defined(SVR4) && !defined(sun)))
#define SUPPORT_PC98
#endif
@@ -272,9 +272,11 @@ xf86DriverlistFromConfig()
* XXX The set of inactive "Device" sections needs to be handled too,
* when the rest of the supporting code is done.
*/
- slp = xf86ConfigLayout.screens;
- while ((slp++)->screen) {
- count++;
+ if (xf86ConfigLayout.screens) {
+ slp = xf86ConfigLayout.screens;
+ while ((slp++)->screen) {
+ count++;
+ }
}
if (count == 0)
@@ -310,7 +312,7 @@ xf86DriverlistFromConfig()
Bool
xf86BuiltinInputDriver(const char *name)
{
- if (xf86NameCmp(name, "keyboard") == 0 || xf86NameCmp(name, "mouse") == 0)
+ if (xf86NameCmp(name, "keyboard") == 0)
return TRUE;
else
return FALSE;
@@ -338,11 +340,13 @@ xf86InputDriverlistFromConfig()
* Walk the list of driver lines in active "InputDevice" sections to
* determine now many implicitly loaded modules there are.
*/
- idp = xf86ConfigLayout.inputs;
- while (idp->identifier) {
- if (!xf86BuiltinInputDriver(idp->driver))
- count++;
- idp++;
+ if (xf86ConfigLayout.inputs) {
+ idp = xf86ConfigLayout.inputs;
+ while (idp->identifier) {
+ if (!xf86BuiltinInputDriver(idp->driver))
+ count++;
+ idp++;
+ }
}
if (count == 0)
@@ -404,6 +408,7 @@ configFiles(XF86ConfFilesPtr fileconf)
/* Try XF86Config FontPath first */
if (!xf86fpFlag) {
+ if (fileconf) {
if (fileconf->file_fontpath) {
char *f = xf86ValidateFontPath(fileconf->file_fontpath);
pathFrom = X_CONFIG;
@@ -415,11 +420,12 @@ configFiles(XF86ConfFilesPtr fileconf)
fontPath = NULL;
pathFrom = X_DEFAULT;
}
- } else {
+ }
+ } else {
xf86Msg(X_WARNING,
"No FontPath specified. Using compiled-in default.\n");
pathFrom = X_DEFAULT;
- }
+ }
} else {
/* Use fontpath specified with '-fp' */
if (fontPath)
@@ -428,14 +434,26 @@ configFiles(XF86ConfFilesPtr fileconf)
}
pathFrom = X_CMDLINE;
}
- if (!fileconf->file_fontpath) {
- /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ if (!fileconf) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
could be static, so we make a copy. */
char *f = xnfalloc(strlen(defaultFontPath) + 1);
f[0] = '\0';
strcpy (f, defaultFontPath);
defaultFontPath = xf86ValidateFontPath(f);
xfree(f);
+ } else {
+ if (fileconf) {
+ if (!fileconf->file_fontpath) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ could be static, so we make a copy. */
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
+ f[0] = '\0';
+ strcpy (f, defaultFontPath);
+ defaultFontPath = xf86ValidateFontPath(f);
+ xfree(f);
+ }
+ }
}
/* If defaultFontPath is still empty, exit here */
@@ -451,9 +469,11 @@ configFiles(XF86ConfFilesPtr fileconf)
if (xf86coFlag)
pathFrom = X_CMDLINE;
- else if (fileconf->file_rgbpath) {
- rgbPath = fileconf->file_rgbpath;
- pathFrom = X_CONFIG;
+ else if (fileconf) {
+ if (fileconf->file_rgbpath) {
+ rgbPath = fileconf->file_rgbpath;
+ pathFrom = X_CONFIG;
+ }
}
xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath);
@@ -461,9 +481,11 @@ configFiles(XF86ConfFilesPtr fileconf)
#ifdef XFree86LOADER
/* ModulePath */
- if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
- xf86ModulePath = fileconf->file_modulepath;
- xf86ModPathFrom = X_CONFIG;
+ if (fileconf) {
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
+ }
}
xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
@@ -510,7 +532,8 @@ typedef enum {
FLAG_DPMS_OFFTIME,
FLAG_PIXMAP,
FLAG_PC98,
- FLAG_ESTIMATE_SIZES_AGGRESSIVELY
+ FLAG_ESTIMATE_SIZES_AGGRESSIVELY,
+ FLAG_NOPM
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -554,7 +577,7 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER,
{0}, FALSE },
- { FLAG_PC98, "PC98", OPTV_BOOLEAN,
+ { FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE }
@@ -597,7 +620,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if (layoutopts) {
tmp = OptionListDup(layoutopts);
if (optp)
- OptionListMerge(optp, tmp);
+ optp = OptionListMerge(optp, tmp);
else
optp = tmp;
}
@@ -650,12 +673,18 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.pciFlags = PCIForceConfig1;
if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2))
xf86Info.pciFlags = PCIForceConfig2;
-
+ if (xf86IsOptionSet(FlagOptions, FLAG_NOPM))
+ xf86Info.pmFlag = FALSE;
+ else
+ xf86Info.pmFlag = TRUE;
+
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i);
if (i >= 0)
- xf86EstimateSizesAggressively = i;
-
+ xf86Info.estimateSizesAggressively = i;
+ else
+ xf86Info.estimateSizesAggressively = 0;
+
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
if (i >= 0)
@@ -733,6 +762,7 @@ configInputKbd(IDevPtr inputp)
xf86Info.xleds = 0L;
xf86Info.kbdDelay = 500;
xf86Info.kbdRate = 30;
+
xf86Info.kbdProc = NULL;
xf86Info.vtinit = NULL;
xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
@@ -793,7 +823,6 @@ configInputKbd(IDevPtr inputp)
return FALSE;
}
}
-
s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
if (s) {
char *l, *end;
@@ -918,15 +947,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* Check if a core pointer or core keyboard is needed. */
for (indp = servlayoutp->inputs; indp->identifier; indp++) {
if ((indp->commonOptions &&
- xf86FindOption(indp->extraOptions, "CorePointer")) ||
+ xf86FindOption(indp->commonOptions, "CorePointer")) ||
(indp->extraOptions &&
- xf86FindOption(indp->commonOptions, "CorePointer"))) {
+ xf86FindOption(indp->extraOptions, "CorePointer"))) {
havePointer = TRUE;
}
if ((indp->commonOptions &&
- xf86FindOption(indp->extraOptions, "CoreKeyboard")) ||
+ xf86FindOption(indp->commonOptions, "CoreKeyboard")) ||
(indp->extraOptions &&
- xf86FindOption(indp->commonOptions, "CoreKeyboard"))) {
+ xf86FindOption(indp->extraOptions, "CoreKeyboard"))) {
haveKeyboard = TRUE;
}
count++;
@@ -1067,7 +1096,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
ErrorF("Found %d screens in the layout section %s",
count, conf_layout->lay_identifier);
#endif
- slp = xnfalloc((count + 1) * sizeof(screenLayoutRec));
+ slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
slp[count].screen = NULL;
/*
* now that we have storage, loop over the list again and fill in our
@@ -1077,7 +1106,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
adjp = conf_layout->lay_adjacency_lst;
count = 0;
while (adjp) {
- slp[count].screen = xnfalloc(sizeof(confScreenRec));
+ slp[count].screen = xnfcalloc(1, sizeof(confScreenRec));
if (adjp->adj_scrnum < 0)
scrnum = count;
else
@@ -1240,6 +1269,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
servlayoutp->inputs = indp;
servlayoutp->options = conf_layout->lay_option_lst;
from = X_DEFAULT;
+#ifdef PANORAMIX
if (!noPanoramiXExtension)
from = X_CMDLINE;
else if (xf86FindOption(conf_layout->lay_option_lst, "Xinerama")) {
@@ -1249,6 +1279,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
}
if (!noPanoramiXExtension)
xf86Msg(from, "Xinerama: enabled\n");
+#endif
if (!checkCoreInputDevices(servlayoutp, FALSE))
return FALSE;
@@ -1295,8 +1326,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
/* We have exactly one screen */
- slp = xnfalloc(2 * sizeof(screenLayoutRec));
- slp[0].screen = xnfalloc(sizeof(confScreenRec));
+ slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec));
+ slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
slp[1].screen = NULL;
if (!configScreen(slp[0].screen, conf_screen, 0, from))
return FALSE;
@@ -1369,10 +1400,10 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
screenp->defaultdepth = conf_screen->scrn_defaultdepth;
screenp->defaultbpp = conf_screen->scrn_defaultbpp;
screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
- screenp->monitor = xnfalloc(sizeof(MonRec));
+ screenp->monitor = xnfcalloc(1, sizeof(MonRec));
if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
return FALSE;
- screenp->device = xnfalloc(sizeof(GDevRec));
+ screenp->device = xnfcalloc(1, sizeof(GDevRec));
configDevice(screenp->device,conf_screen->scrn_device, TRUE);
screenp->device->myScreenSection = screenp;
screenp->options = conf_screen->scrn_option_lst;
@@ -1848,15 +1879,23 @@ xf86HandleConfigFile(void)
return FALSE;
}
} else {
- char *dfltlayout = NULL;
- pointer optlist = xf86configptr->conf_flags->flg_option_lst;
-
- if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
+ if (xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL);
- if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
dfltlayout)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
return FALSE;
+ }
+ } else {
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ NULL)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c b/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c
index d3297f499..81d79ddd0 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c
@@ -1,5 +1,5 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.4 1999/10/26 15:58:12 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.7 2000/02/18 17:16:25 tsi Exp $ */
/*
* finish setting up the server
* Load the driver modules and call their probe functions.
@@ -28,7 +28,7 @@ void
DoProbe()
{
int i;
- Bool probeResult;
+ Bool probeResultISA, probeResultPCI, probeResultFBDEV;
#ifdef XFree86LOADER
/* Find the list of video driver modules. */
@@ -61,12 +61,32 @@ DoProbe()
/* Call all of the probe functions, reporting the results. */
for (i = 0; i < xf86NumDrivers; i++) {
- probeResult = FALSE;
- if (xf86DriverList[i]->Probe != NULL)
- probeResult = xf86DriverList[i]->Probe(xf86DriverList[i],
- PROBE_DETECT);
- ErrorF("Probe in driver `%s' returns %s\n",
- xf86DriverList[i]->driverName, BOOLTOSTRING(probeResult));
+ probeResultISA = probeResultPCI = probeResultFBDEV = FALSE;
+ if (xf86DriverList[i]->Probe != NULL) {
+ probeResultISA =
+ xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTISA);
+ ErrorF("Probe ISA capabilities in driver `%s' returns %s\n",
+ xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultISA));
+ }
+ if (xf86DriverList[i]->Probe != NULL) {
+ probeResultPCI =
+ xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTPCI);
+ ErrorF("Probe PCI capabilities in driver `%s' returns %s\n",
+ xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultPCI));
+ }
+ if (xf86DriverList[i]->Probe != NULL) {
+ probeResultFBDEV =
+ xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTFBDEV);
+ ErrorF("Probe FBDEV capabilities in driver `%s' returns %s\n",
+ xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultFBDEV));
+ }
+
+ /* If we have a result, then call driver's Identify function */
+ if (probeResultISA || probeResultPCI || probeResultFBDEV) {
+ if (xf86DriverList[i]->Identify != NULL) {
+ xf86DriverList[i]->Identify(0);
+ }
+ }
}
#ifdef XFree86LOADER
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c
index ad71fafb0..74c76701b 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.2 1999/12/06 03:52:40 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.3 2000/02/08 13:13:06 eich Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -105,3 +105,9 @@ xf86IsPrimaryIsa(void)
{
return ( primaryBus.type == BUS_ISA );
}
+
+void
+isaConvertRange2Host(resRange *pRange)
+{
+ return;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
index fe00fe3c9..4e583bf9c 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.2 1999/12/06 03:52:40 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.10 2000/02/21 18:09:59 dawes Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -17,10 +17,13 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Resources.h"
+#include "xf86ScanPci.h"
/* Bus-specific headers */
+#undef DECLARE_CARD_DATASTRUCTURES
#define DECLARE_CARD_DATASTRUCTURES TRUE
#include "xf86PciInfo.h"
+#include "xf86ScanPci.h"
#include "xf86Bus.h"
@@ -30,8 +33,6 @@
#include "xf86RAC.h"
-resRange PciAvoid[] = {_PCI_AVOID, _END};
-
/* Bus-specific globals */
pciConfigPtr *xf86PciInfo = NULL; /* Full PCI probe info */
pciVideoPtr *xf86PciVideoInfo = NULL; /* PCI probe for video hw */
@@ -76,11 +77,46 @@ static PciBusPtr xf86PciBus = NULL;
#undef MIN
#define MIN(x,y) ((x<y)?x:y)
+#define B2M(tag,base) pciBusAddrToHostAddr(tag,PCI_MEM,base)
+#define B2I(tag,base) (base)
+#define B2H(tag,base,type) ((type & ResMem) ? (B2M(tag,base)) : (B2I(tag,base)))
+#define M2B(tag,base) pciHostAddrToBusAddr(tag,PCI_IO,base)
+#define I2B(tag,base) (base)
+#define H2B(tag,base,type) (type & ResMem) ? M2B(tag,base) : I2B(tag,base)
+#define TAG(pvp) (pciTag(pvp->bus,pvp->device,pvp->func))
+#define SIZE(size) ((1 << size) - 1)
+#define PCI_SIZE(type,tag,size) ((type & ResMem) \
+ ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \
+ : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size))
+#define PCI_M_RANGE(range,tag,begin,end,type) \
+ { RANGE(range,B2M(tag,begin),B2M(tag,end),type); }
+#define PCI_I_RANGE(range,tag,begin,end,type) \
+ { RANGE(range,B2I(tag,begin),B2I(tag,end),type); }
+#define PCI_X_RANGE(range,tag,begin,end,type) \
+{ if (type & ResMem) PCI_M_RANGE(range,tag,begin,end,type); \
+ else PCI_I_RANGE(range,tag,begin,end,type); }
+#define P_M_RANGE(range,tag,begin,size,type) \
+ PCI_M_RANGE(range,tag,begin,(begin + SIZE(size)),type)
+#define P_I_RANGE(range,tag,begin,size,type) \
+ PCI_I_RANGE(range,tag,begin,(begin + SIZE(size)),type)
+#define P_X_RANGE(range,tag,begin,size,type) \
+{ if (type & ResMem) P_M_RANGE(range,tag,begin,size,type); \
+ else P_I_RANGE(range,tag,begin,size,type); }
+#define PV_M_RANGE(range,pvp,i,type) \
+ P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],type)
+#define PV_B_RANGE(range,pvp,type) \
+ P_M_RANGE(range,TAG(pvp),pvp->biosBase,pvp->biosSize,type)
+#define PV_I_RANGE(range,pvp,i,type) \
+ P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type)
+
SymTabPtr xf86PCIVendorNameInfo;
pciVendorCardInfo *xf86PCICardInfo;
pciVendorDeviceInfo * xf86PCIVendorInfo;
static void
+getPciClassFlags(pciConfigPtr *pcrpp);
+
+static void
FindPCIVideoInfo(void)
{
pciConfigPtr pcrp, *pcrpp;
@@ -90,7 +126,8 @@ FindPCIVideoInfo(void)
Bool mem64 = FALSE;
pcrpp = xf86PciInfo = xf86scanpci(0);
-
+ getPciClassFlags(pcrpp);
+
if (pcrpp == NULL) {
xf86PciVideoInfo = NULL;
return;
@@ -98,7 +135,18 @@ FindPCIVideoInfo(void)
xf86PciBus = xf86GetPciBridgeInfo(xf86PciInfo);
while ((pcrp = pcrpp[i])) {
- if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) {
+ int baseclass;
+ int subclass;
+
+ if (pcrp->listed_class & 0xffff) {
+ baseclass = (pcrp->listed_class >> 8) & 0xff;
+ subclass = pcrp->listed_class & 0xff;
+ } else {
+ baseclass = pcrp->pci_base_class;
+ subclass = pcrp->pci_sub_class;
+ }
+
+ if (PCIINFOCLASSES(baseclass, subclass)) {
num++;
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
sizeof(pciVideoPtr) * (num + 1));
@@ -113,14 +161,14 @@ FindPCIVideoInfo(void)
info->bus = pcrp->busnum;
info->device = pcrp->devnum;
info->func = pcrp->funcnum;
- info->class = pcrp->pci_base_class;
+ info->class = baseclass;
info->subclass = pcrp->pci_sub_class;
info->interface = pcrp->pci_prog_if;
info->biosBase = PCIGETROM(pcrp->pci_baserom);
info->biosSize = pciGetBaseSize(pcrp->tag, 6, TRUE, NULL);
info->thisCard = pcrp;
info->validate = FALSE;
- if ((PCISHAREDIOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class))
+ if ((PCISHAREDIOCLASSES(baseclass, subclass))
&& (pcrp->pci_command & PCI_CMD_IO_ENABLE) &&
(pcrp->pci_prog_if == 0)) {
/* assumption: primary bus is always VGA */
@@ -257,6 +305,7 @@ FindPCIVideoInfo(void)
info->memBase[5] = (memType)PCIGETMEMORY(pcrp->pci_base5);
}
}
+ info->listed_class = pcrp->listed_class;
}
i++;
}
@@ -294,7 +343,11 @@ FindPCIVideoInfo(void)
if ((!vendorname || !chipname) &&
!PCIALWAYSPRINTCLASSES(info->class, info->subclass))
continue;
- xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device,
+ if (xf86IsPrimaryPci(info))
+ xf86Msg(X_PROBED, "PCI:*(%d:%d:%d) ", info->bus, info->device,
+ info->func);
+ else
+ xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device,
info->func);
if (vendorname)
ErrorF("%s ", vendorname);
@@ -367,22 +420,24 @@ fixPciSizeInfo(int entityIndex)
while (pAcc) {
if (((pAcc->res_type & (ResMem | ResBlock))
== (ResMem | ResBlock))
- && (pAcc->block_begin == pvp->memBase[j]) /*@@@*/
- && (pAcc->block_end == pvp->memBase[j] /*@@@*/
- + (1 << (pvp->size[j])) - 1)) break;
+ && (pAcc->block_begin == B2M(TAG(pvp),pvp->memBase[j]))
+ && (pAcc->block_end == B2M(TAG(pvp),pvp->memBase[j]
+ + SIZE(pvp->size[j])))) break;
pAcc = pAcc->next;
} else if (pvp->ioBase[j])
while (pAcc) {
if (((pAcc->res_type & (ResIo | ResBlock)) ==
(ResIo | ResBlock))
- && (pAcc->block_begin == pvp->ioBase[j]) /*@@@*/
- && (pAcc->block_end == pvp->ioBase[j] /*@@@*/
- + (1 << (pvp->size[j])) - 1)) break;
+ && (pAcc->block_begin == B2I(TAG(pvp),pvp->ioBase[j]))
+ && (pAcc->block_end == B2I(TAG(pvp),pvp->ioBase[j]
+ + SIZE(pvp->size[j])))) break;
pAcc = pAcc->next;
} else continue;
pvp->size[j] = pciGetBaseSize(tag, j, TRUE, &pvp->validSize);
if (pAcc) {
- pAcc->block_end = pAcc->block_begin + (1 << (pvp->size[j])) - 1;
+ pAcc->block_end = pvp->memBase[j] ?
+ B2M(TAG(pvp),pvp->memBase[j] + SIZE(pvp->size[j]))
+ : B2I(TAG(pvp),pvp->ioBase[j] + SIZE(pvp->size[j]));
pAcc->res_type &= ~ResEstimated;
pAcc->res_type |= ResBios;
}
@@ -391,14 +446,14 @@ fixPciSizeInfo(int entityIndex)
pAcc = Acc;
while (pAcc) {
if (((pAcc->res_type & (ResMem | ResBlock)) == (ResMem | ResBlock))
- && (pAcc->block_begin == pvp->biosBase)/*@@@*/
- && (pAcc->block_end == pvp->biosBase/*@@@*/
- + (1 << (pvp->biosSize)) - 1)) break;
+ && (pAcc->block_begin == B2M(TAG(pvp),pvp->biosBase))
+ && (pAcc->block_end == B2M(TAG(pvp),pvp->biosBase
+ + SIZE(pvp->biosSize)))) break;
pAcc = pAcc->next;
}
pvp->biosSize = pciGetBaseSize(tag, 6, TRUE, &pvp->validSize);
if (pAcc) {
- pAcc->block_end = pAcc->block_begin + (1 << (pvp->biosSize))- 1;
+ pAcc->block_end = B2M(TAG(pvp),pvp->biosBase+SIZE(pvp->biosSize));
pAcc->res_type &= ~ResEstimated;
pAcc->res_type |= ResBios;
}
@@ -415,8 +470,13 @@ pciIoAccessEnable(void* arg)
#ifdef DEBUG
ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl |= SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
SETBITS, SETBITS);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
static void
@@ -425,7 +485,12 @@ pciIoAccessDisable(void* arg)
#ifdef DEBUG
ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl &= ~SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
#undef SETBITS
@@ -436,8 +501,13 @@ pciIo_MemAccessEnable(void* arg)
#ifdef DEBUG
ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl |= SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
SETBITS, SETBITS);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
static void
@@ -446,7 +516,12 @@ pciIo_MemAccessDisable(void* arg)
#ifdef DEBUG
ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl &= ~SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
#undef SETBITS
@@ -457,8 +532,13 @@ pciMemAccessEnable(void* arg)
#ifdef DEBUG
ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl |= SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
SETBITS, SETBITS);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
static void
@@ -467,7 +547,12 @@ pciMemAccessDisable(void* arg)
#ifdef DEBUG
ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
#endif
+ ((pciArg*)arg)->ctrl &= ~SETBITS;
+#ifdef notanymore
((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,SETBITS, 0);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ ((pciArg*)arg)->ctrl);
}
#undef SETBITS
@@ -602,14 +687,13 @@ correctPciSize(memType base, int oldsize, int newsize, long type)
int j = i;
if (basep[i] && (pcrp->basesize[i] == old_bits))
if (((type & ResIo) && PCI_MAP_IS_IO(basep[i])
- && (PCIGETIO(basep[i]) == base))
+ && (B2I(pcrp->tag,PCIGETIO(basep[i])) == base))
|| ((type & ResMem) && PCI_MAP_IS_MEM(basep[i])
&& (((!PCI_MAP_IS64BITMEM(basep[i]))
- && (PCIGETMEMORY(basep[i]) == base))
+ && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base))
#if defined LONG64 || defined WORD64
- || (((PCIGETMEMORY(basep[i])
- | ((memType)basep[++i] << 32)) == base))
-#endif
+ || (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base)
+#endif
))) {
pcrp->basesize[j] = new_bits;
return;
@@ -623,9 +707,9 @@ correctPciSize(memType base, int oldsize, int newsize, long type)
for (i = 0; i < 6; i++) {
if (pvp->size[i] == old_bits) {
if (((type & ResIo) && pvp->ioBase[i]
- && (pvp->ioBase[i] == base)) ||
- ((type & ResMem) && pvp->memBase[i]
- && (pvp->memBase[i] == base))) {
+ && (B2I(TAG(pvp),pvp->ioBase[i]) == base)) ||
+ ((type & ResMem) && pvp->memBase[i]
+ && (B2M(TAG(pvp),pvp->memBase[i]) == base))) {
pvp->size[i] = new_bits;
return;
}
@@ -703,16 +787,12 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
for (i = 0; i < 6; i++) {
if (pvp->ioBase[i]) {
- RANGE(range, pvp->ioBase[i],/*@@@*/
- pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
- ResExcIoBlock | resMisc);
+ PV_I_RANGE(range,pvp,i,ResExcIoBlock | resMisc);
tmp = xf86AddResToList(NULL, &range, -1);
removeOverlapsWithBridges(pvp->bus,tmp);
*res = xf86JoinResLists(tmp,*res);
} else if (pvp->memBase[i]) {
- RANGE(range, pvp->memBase[i],/*@@@*/
- pvp->memBase[i] + (1 << pvp->size[i]) - 1,
- ResExcMemBlock | resMisc);
+ PV_M_RANGE(range, pvp,i, ResExcMemBlock | resMisc);
tmp = xf86AddResToList(NULL, &range, -1);
removeOverlapsWithBridges(pvp->bus,tmp);
*res = xf86JoinResLists(tmp,*res);
@@ -722,9 +802,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
* checking but reserve them!
*/
if (pvp->biosBase) {
- RANGE(range, pvp->biosBase,/*@@@*/
- pvp->biosBase + (1 << pvp->biosSize) - 1,
- ResExcMemBlock | resMisc);
+ PV_B_RANGE(range, pvp, ResExcMemBlock | resMisc);
tmp = xf86AddResToList(NULL, &range, -1);
removeOverlapsWithBridges(pvp->bus,tmp);
*res = xf86JoinResLists(tmp,*res);
@@ -754,38 +832,37 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
basep = &pcrp->pci_base0;
for (i = 0; i < 6; i++) {
if (basep[i]) {
- if (PCI_MAP_IS_IO(basep[i]))
- RANGE(range,PCIGETIO(basep[i]),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[i]) - 1,
- ResExcIoBlock | resMisc)
- else if (!PCI_MAP_IS64BITMEM(basep[i]))
- RANGE(range,PCIGETMEMORY(basep[i]),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[i]) - 1,
- ResExcMemBlock | resMisc)
+ if (PCI_MAP_IS_IO(basep[i]))
+ P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]),
+ pcrp->basesize[i], ResExcIoBlock | resMisc)
+ else if (!PCI_MAP_IS64BITMEM(basep[i]))
+ P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]),
+ pcrp->basesize[i], ResExcMemBlock | resMisc)
else {
i++;
#if defined LONG64 || defined WORD64
- RANGE(range,PCIGETMEMORY(basep[i-1])/*@@@*/
- | ((memType)basep[i] << 32),
- range.rBegin + (1<<pcrp->basesize[i-1]) - 1,
- ResExcMemBlock | resMisc)
+ P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]),
+ pcrp->basesize[i-1], ResExcMemBlock | resMisc)
#else
- continue;
+ continue;
#endif
- }
+ }
+ if (range.rBegin) { /* catch cases where PCI base is unset */
+ tmp = xf86AddResToList(NULL, &range, -1);
+ removeOverlapsWithBridges(pcrp->busnum,tmp);
+ *res = xf86JoinResLists(tmp,*res);
+ }
+ }
+ }
+ if (pcrp->pci_baserom) {
+ P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom),
+ pcrp->basesize[6], ResExcMemBlock | resMisc);
+ if (range.rBegin) {
tmp = xf86AddResToList(NULL, &range, -1);
removeOverlapsWithBridges(pcrp->busnum,tmp);
*res = xf86JoinResLists(tmp,*res);
}
}
- if (pcrp->pci_baserom) {
- RANGE(range,PCIGETROM(pcrp->pci_baserom),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[6]) - 1,
- ResExcMemBlock | resMisc);
- tmp = xf86AddResToList(NULL, &range, -1);
- removeOverlapsWithBridges(pcrp->busnum,tmp);
- *res = xf86JoinResLists(tmp,*res);
- }
}
if (*activeRes) {
@@ -812,7 +889,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
range = pRes->val;
RemoveOverlaps(pRes, *activeRes, TRUE);
- if (xf86EstimateSizesAggressively > 0)
+ if (xf86Info.estimateSizesAggressively > 0)
RemoveOverlaps(pRes, *inactiveRes, TRUE);
if (range.rEnd > pRes->block_end) {
@@ -832,7 +909,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
xf86PrintResList(3, *activeRes);
}
- if (*inactiveRes && (xf86EstimateSizesAggressively > 1)) {
+ if (*inactiveRes && (xf86Info.estimateSizesAggressively > 1)) {
/* Check for overlaps */
for (pRes = *inactiveRes; pRes; pRes = pRes->next) {
if (ResIsEstimated(&pRes->val)) {
@@ -898,13 +975,13 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
int *p_size;
unsigned char p_type;
resPtr AccTmp = NULL;
+ resPtr orgAcc = NULL;
resPtr *pAcc = &AccTmp;
resPtr avoid = NULL;
- resList p_avoid = PciAvoid;
resRange range;
resPtr resSize = NULL;
resPtr w_tmp, w = NULL, w_2nd = NULL;
- PCITAG tag;
+ PCITAG tag = pciTag(pvp->bus,pvp->device,pvp->func);
PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus;
resPtr tmp;
@@ -920,7 +997,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
p_size = &(pvp->size[res_n]);
p_type = pvp->type[res_n];
if (!PCI_MAP_IS64BITMEM(pvp->type[res_n])) {
- RANGE(range,0,0xffffffff,ResExcMemBlock);/*@@@*/
+ PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock);
resSize = xf86AddResToList(resSize,&range,-1);
}
} else if (pvp->ioBase[prt]){
@@ -937,7 +1014,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
p_size = &(pvp->biosSize);
/* XXX This should also include the PCI_MAP_MEMORY_TYPE_MASK part */
p_type = 0;
- RANGE(range,0,0xffffffff,ResExcMemBlock);/*@@@*/
+ PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock);
resSize = xf86AddResToList(resSize,&range,-1);
} else return FALSE;
@@ -945,8 +1022,8 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
type |= ResBlock;
- /* setup avoid */
- avoid = xf86AddRangesToList(avoid,p_avoid,-1);
+ /* setup avoid: PciAvoid is bus range: convert later */
+ avoid = xf86AddRangesToList(avoid,PciAvoid,-1);
while (pbp) {
if (pbp->secondary == pvp->bus) {
@@ -986,7 +1063,10 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
}
pbp = pbp->next;
}
-
+
+ /* convert bus based entries in avoid list to host base */
+ xf86ConvertListToHost(xf86GetEntityForPciInfo(pvp),avoid);
+
if (!w)
w = xf86DupResList(ResRange);
xf86MsgVerb(X_INFO, 3, "window:\n");
@@ -1010,15 +1090,16 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
if (!alignment)
alignment = (1 << (*p_size)) - 1;
-
+
/* Access list holds bios resources -- remove this one */
#ifdef NOTYET
AccTmp = xf86DupResList(Acc);
while ((*pAcc)) {
if ((((*pAcc)->res_type & (type & ~ResAccMask))
== (type & ~ResAccMask))
- && ((*pAcc)->block_begin == (*p_base))/*@@@*/
- && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) {
+ && ((*pAcc)->block_begin == (B2H(tag,(*p_base),type)))
+ && ((*pAcc)->block_end == (B2H(tag,
+ (*p_base)+SIZE(*p_size),type)))) {
resPtr acc_tmp = (*pAcc)->next;
xfree((*pAcc));
(*pAcc) = acc_tmp;
@@ -1027,12 +1108,13 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
pAcc = &((*pAcc)->next);
}
/* check if we really need to fix anything */
- RANGE(range, (*p_base), (*p_base) + (1 << (*p_size)) - 1, type);/*@@@*/
+ P_X_RANGE(range,tag,(*p_base),(*p_base) + SIZE((*p_size)),type);
if (!ChkConflict(&range,avoid,SETUP)
&& !ChkConflict(&range,AccTmp,SETUP)
- && (((*p_base) & alignment) == (*p_base)->block_begin)/*@@@*/
- && ((isSubsetOf(range,w)
- || (w_2nd && isSubsetOf(range,w_2n))))) {
+ && ((B2H(tag,(*p_base),type) & PCI_SIZE(type,tag,alignment)
+ == range->block_begin)
+ && ((xf86IsSubsetOf(range,w)
+ || (w_2nd && xf86IsSubsetOf(range,w_2n))))) {
#ifdef DEBUG
ErrorF("nothing to fix\n");
#endif
@@ -1045,16 +1127,18 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
#ifdef DEBUG
ErrorF("removing old resource\n");
#endif
- xf86FreeResList(Acc);
+ orgAcc = Acc;
Acc = AccTmp;
}
#else
+ orgAcc = xf86DupResList(Acc);
pAcc = &Acc;
while ((*pAcc)) {
if ((((*pAcc)->res_type & (type & ~ResAccMask))
== (type & ~ResAccMask))
- && ((*pAcc)->block_begin == (*p_base))/*@@@*/
- && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) {
+ && ((*pAcc)->block_begin == B2H(tag,(*p_base),type))
+ && ((*pAcc)->block_end == B2H(tag,(*p_base) + SIZE(*p_size),
+ type))) {
#ifdef DEBUG
ErrorF("removing old resource\n");
#endif
@@ -1066,8 +1150,8 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
#endif
#ifdef DEBUG
- ErrorF("base: 0x%lx alignment: 0x%lx size[bit]: 0x%x\n",
- (*p_base),alignment,(*p_size));
+ ErrorF("base: 0x%lx alignment: 0x%lx host alignment: 0x%lx size[bit]: 0x%x\n",
+ (*p_base),alignment,PCI_SIZE(type,tag,alignment),(*p_size));
xf86MsgVerb(X_INFO, 3, "window:\n");
xf86PrintResList(3, w);
if (w_2nd)
@@ -1083,8 +1167,9 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w->block_begin,
w->block_end);
#endif
- range = xf86GetBlock(type,alignment + 1, w->block_begin,
- w->block_end, alignment,avoid);
+ range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1),
+ w->block_begin, w->block_end,
+ PCI_SIZE(type,tag,alignment),avoid);
if (range.type != ResEnd)
break;
}
@@ -1100,8 +1185,9 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w_2nd->block_begin,
w_2nd->block_end);
#endif
- range = xf86GetBlock(type,alignment + 1, w_2nd->block_begin,
- w_2nd->block_end,alignment,avoid);
+ range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1),
+ w_2nd->block_begin, w_2nd->block_end,
+ PCI_SIZE(type,tag,alignment),avoid);
if (range.type != ResEnd)
break;
}
@@ -1113,8 +1199,11 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
if (range.type == ResEnd) {
xf86MsgVerb(X_ERROR,3,"Cannot find a replacement memory range\n");
+ xf86FreeResList(Acc);
+ Acc = orgAcc;
return FALSE;
}
+ xf86FreeResList(orgAcc);
#ifdef DEBUG
ErrorF("begin: 0x%lx, end: 0x%lx\n",range.a,range.b);
#endif
@@ -1122,13 +1211,12 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
(*p_size) = 0;
while (alignment >> (*p_size))
(*p_size)++;
- (*p_base) = range.rBegin;/*@@@*/
+ (*p_base) = H2B(tag,range.rBegin,type);
#ifdef DEBUG
ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n",
res_n,(*p_base),(1 << (*p_size)),type | ResMem ? "Mem" : "Io");
#endif
- tag = pciTag(pvp->bus,pvp->device,pvp->func);
if (res_n != 0xff) {
pciWriteLong(tag,PCI_CMD_BASE_REG + res_n * sizeof(CARD32),
@@ -1171,22 +1259,23 @@ xf86ReallocatePciResources(int entityIndex, resPtr pRes)
while (pRes) {
switch (pRes->res_type & ResPhysMask) {
case ResMem:
- if (pRes->block_begin == pvp->biosBase &&/*@@@*/
- pRes->block_end == pvp->biosBase + (1 << (pvp->biosSize)) - 1)
+ if (pRes->block_begin == B2M(TAG(pvp),pvp->biosBase) &&
+ pRes->block_end == B2M(TAG(pvp),pvp->biosBase
+ + SIZE(pvp->biosSize)))
prt = 6;
else for (i = 0 ; i < 6; i++)
- if (pRes->block_begin == pvp->memBase[i]/*@@@*/
- && pRes->block_end
- == pvp->memBase[i] + (1 << (pvp->size[i])) - 1) {
+ if ((pRes->block_begin == B2M(TAG(pvp),pvp->memBase[i]))
+ && (pRes->block_end == B2M(TAG(pvp),pvp->memBase[i]
+ + SIZE(pvp->size[i])))) {
prt = i;
break;
}
break;
case ResIo:
for (i = 0 ; i < 6; i++)
- if (pRes->block_begin == pvp->ioBase[i]/*@@@*/
- && pRes->block_end
- == pvp->ioBase[i] + (1 << (pvp->size[i])) - 1) {
+ if (pRes->block_begin == B2I(TAG(pvp),pvp->ioBase[i])
+ && pRes->block_end == B2I(TAG(pvp),pvp->ioBase[i]
+ + SIZE(pvp->size[i]))) {
prt = i;
break;
}
@@ -1216,8 +1305,7 @@ getValidBIOSBase(PCITAG tag, int num)
{
pciVideoPtr pvp = NULL;
PciBusPtr pbp, pbp1;
- memType start_mp = 0, start_m = 0;
- memType end_mp, end_m;
+ resPtr m = NULL;
resPtr tmp, avoid;
resRange range;
int n = 0;
@@ -1235,19 +1323,20 @@ getValidBIOSBase(PCITAG tag, int num)
biosSize = pvp->biosSize;
alignment = (1 << biosSize) - 1;
if (biosSize > 24)
- biosSize = 1 << 24;
+ biosSize = 24;
avoid = NULL;
- end_m = end_mp = PCI_MEM32_LENGTH_MAX;
+
pbp = pbp1 = xf86PciBus;
while (pbp) {
if (pbp->secondary == pvp->bus) {
- if (pbp->pmem) {
- start_mp = pbp->pmem->block_begin;
- end_mp = MIN(end_mp,pbp->pmem->block_end);
- }
- if (pbp->mem) {
- start_m = pbp->mem->block_begin;
- end_m = MIN(end_m,pbp->mem->block_end);
+ tmp = xf86DupResList(pbp->pmem);
+ m = xf86JoinResLists(m,tmp);
+ tmp = xf86DupResList(pbp->mem);
+ m = xf86JoinResLists(m,tmp);
+ tmp = m;
+ while (tmp) {
+ tmp->block_end = MIN(tmp->block_end,PCI_MEM32_LENGTH_MAX);
+ tmp = tmp->next;
}
}
while (pbp1) {
@@ -1263,40 +1352,42 @@ getValidBIOSBase(PCITAG tag, int num)
}
if (pvp->biosBase) { /* try biosBase first */
- RANGE(range, pvp->biosBase,/*@@@*/
- pvp->biosBase + (1 << biosSize) - 1,
- ResExcMemBlock);
- if (((range.rBegin >= start_m && range.rEnd <= end_m) ||
- (range.rBegin >= start_mp && range.rEnd <= end_mp))
- && ! ChkConflict(&range,avoid,SETUP)) {
+ P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock);
+ if (xf86IsSubsetOf(range,m) && ! ChkConflict(&range,avoid,SETUP)) {
xf86FreeResList(avoid);
+ xf86FreeResList(m);
return pvp->biosBase;
}
}
-#if 1
if (num >= 0 && num <= 5 && pvp->memBase[num])
maxnum = num;
else {
num = 0;
}
for (; num <= maxnum; num++) {
- /* then try suggested memBase */
- RANGE(range, pvp->memBase[num],/*@@@*/
- pvp->memBase[num] + (1 << biosSize) - 1,
- ResExcMemBlock); /* keep bios size ! */
- if ( pvp->size[num] >= biosSize
- && ((range.rBegin >= start_m && range.rEnd <= end_m)
- || (range.rBegin >= start_mp && range.rEnd <= end_mp))
+ /* then try suggested memBase */
+ /* keep bios size ! */
+ P_M_RANGE(range,TAG(pvp),pvp->memBase[num],biosSize,ResExcMemBlock);
+ if ( pvp->size[num] >= biosSize && xf86IsSubsetOf(range,m)
&& ! ChkConflict(&range,avoid,SETUP)) {
xf86FreeResList(avoid);
+ xf86FreeResList(m);
return pvp->memBase[num];
}
}
-#endif
- range = xf86GetBlock(ResExcMemBlock, (1 << biosSize),start_m,end_m,
- alignment, avoid);
+ while (m) {
+ range = xf86GetBlock(ResExcMemBlock,
+ PCI_SIZE(ResMem,TAG(pvp),(1 << biosSize)),
+ m->block_begin, m->block_end,
+ PCI_SIZE(ResMem,TAG(pvp),alignment), avoid);
+ if (range.type != ResEnd)
+ break;
+ m = m->next;
+ }
+
xf86FreeResList(avoid);
- return range.rBase;/*@@@*/
+ xf86FreeResList(m);
+ return M2B(TAG(pvp),range.rBase);
}
/*
@@ -1306,21 +1397,20 @@ getValidBIOSBase(PCITAG tag, int num)
void
xf86PciProbe(void)
{
+ void (* DataSetupFunc)(SymTabPtr *, pciVendorDeviceInfo **,
+ pciVendorCardInfo **);
#ifdef XFree86LOADER
/*
* we need to get the pointer to the pci data structures initialized
*/
- xf86PCIVendorNameInfo =
- (SymTabPtr)LoaderSymbol("xf86PCIVendorNameInfoData");
- xf86PCIVendorInfo =
- (pciVendorDeviceInfo*)LoaderSymbol("xf86PCIVendorInfoData");
- xf86PCICardInfo =
- (pciVendorCardInfo*)LoaderSymbol("xf86PCICardInfoData");
+
+ DataSetupFunc = LoaderSymbol("xf86SetupPciData");
#else
- xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData;
- xf86PCIVendorInfo = xf86PCIVendorInfoData;
- xf86PCICardInfo = xf86PCICardInfoData;
+ DataSetupFunc = xf86SetupScanPci;
#endif
+
+ (*DataSetupFunc)(&xf86PCIVendorNameInfo, &xf86PCIVendorInfo, &
+ xf86PCICardInfo);
FindPCIVideoInfo();
}
@@ -1343,15 +1433,18 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
for (pcrpp = pciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) {
if (pcrp->busnum > MaxBus)
MaxBus = pcrp->busnum;
- if (pcrp->pci_base_class == PCI_CLASS_BRIDGE)
- switch (pcrp->pci_sub_class) {
+ if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE)
+ || (((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) {
+ int sub_class;
+ sub_class = (pcrp->listed_class & 0xffff)
+ ? (pcrp->listed_class & 0xff) : pcrp->pci_sub_class;
+ switch (sub_class) {
case PCI_SUBCLASS_BRIDGE_PCI:
/* something fishy about the header? If so: just ignore! */
if ((pcrp->pci_header_type & 0x7f) != 0x01) {
- xf86MsgVerb(X_WARNING, 3, "PCI-PCI bridge at %x:%x:%x has "
- "funny header: 0x%x", pcrp->busnum,
- pcrp->devnum, pcrp->funcnum,
- pcrp->pci_header_type);
+ xf86MsgVerb(3,X_WARNING,"PCI-PCI bridge at %x:%x:%x has "
+ "funny header: 0x%x",pcrp->busnum,pcrp->devnum,
+ pcrp->funcnum,pcrp->pci_header_type);
break;
}
*pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec));
@@ -1362,39 +1455,39 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->brbus = pcrp->busnum;
PciBus->brdev = pcrp->devnum;
PciBus->brfunc = pcrp->funcnum;
- PciBus->subclass = pcrp->pci_sub_class;
+ PciBus->subclass = sub_class;
PciBus->brcontrol = pcrp->pci_bridge_control;
if (pcrp->pci_io_base <= pcrp->pci_io_limit
&& (pcrp->pci_command & PCI_CMD_IO_ENABLE)) {
- RANGE(range,pcrp->pci_io_base << 8
- | (pcrp->pci_upper_io_base << 16),/*@@@*/
- (pcrp->pci_io_limit << 8)
- | (pcrp->pci_upper_io_limit << 16) | 0xfff,
- ResIo | ResBlock | ResExclusive);
+ PCI_I_RANGE(range,pcrp->tag,pcrp->pci_io_base << 8
+ | (pcrp->pci_upper_io_base << 16),
+ (pcrp->pci_io_limit << 8)
+ | (pcrp->pci_upper_io_limit << 16) | 0xfff,
+ ResIo | ResBlock | ResExclusive);
PciBus->io = xf86AddResToList(NULL, &range, -1);
}
if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) {
if (pcrp->pci_mem_base <= pcrp->pci_mem_limit) {
- RANGE(range,pcrp->pci_mem_base << 16,/*@@@*/
- (pcrp->pci_mem_limit << 16) | 0xfffff,
- ResMem | ResBlock | ResExclusive);
+ PCI_M_RANGE(range,pcrp->tag,pcrp->pci_mem_base << 16,
+ (pcrp->pci_mem_limit << 16) | 0xfffff,
+ ResMem | ResBlock | ResExclusive);
PciBus->mem = xf86AddResToList(NULL, &range, -1);
}
if (pcrp->pci_prefetch_mem_base
<= pcrp->pci_prefetch_mem_limit) {
#if !defined(LONG64) && !defined(WORD64)
- RANGE(range,pcrp->pci_prefetch_mem_base << 16,
- (pcrp->pci_prefetch_mem_limit << 16) | 0xfffff,
- ResMem | ResBlock | ResExclusive);
+ PCI_M_RANGE(range,pcrp->tag,
+ pcrp->pci_prefetch_mem_base << 16,
+ (pcrp->pci_prefetch_mem_limit << 16)
+ | 0xfffff,
+ ResMem | ResBlock | ResExclusive);
#else
- RANGE(range,pcrp->pci_prefetch_mem_base << 16
- | ((memType)pcrp->pci_prefetch_upper_mem_base
- << 32),/*@@@*/
- (pcrp->pci_prefetch_mem_limit
- << 16) | 0xfffff
- | ((memType)pcrp->pci_prefetch_upper_mem_limit
- << 32),
- ResMem | ResBlock | ResExclusive);
+ PCI_M_RANGE(range, pcrp->tag,
+ pcrp->pci_prefetch_mem_base << 16
+ | ((memType)pcrp->pci_prefetch_upper_mem_base << 32),
+ (pcrp->pci_prefetch_mem_limit << 16) | 0xfffff
+ | ((memType)pcrp->pci_prefetch_upper_mem_limit << 32),
+ ResMem | ResBlock | ResExclusive);
#endif
PciBus->pmem = xf86AddResToList(NULL, &range, -1);
}
@@ -1408,27 +1501,29 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->brbus = pcrp->busnum;
PciBus->brdev = pcrp->devnum;
PciBus->brfunc = pcrp->funcnum;
- PciBus->subclass = pcrp->pci_sub_class;
+ PciBus->subclass = sub_class;
break;
case PCI_SUBCLASS_BRIDGE_HOST:
*pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec));
pnPciBus = &PciBus->next;
PciBus->primary = -1;
- PciBus->secondary = 0;
- PciBus->subclass = pcrp->pci_sub_class;
- RANGE(range, 0, 0xFFFFFFFF, ResIo | ResBlock | ResExclusive);
- PciBus->io = xf86AddResToList(NULL, &range, -1);
- RANGE(range, 0, ~(memType)0, ResMem | ResBlock | ResExclusive);
- PciBus->mem = xf86AddResToList(NULL, &range, -1);
- PciBus->pmem = xf86AddResToList(NULL, &range, -1);
+ PciBus->secondary = -1; /* to be set below */
+ PciBus->subclass = sub_class;
+ PciBus->io = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResIo);
+ PciBus->mem = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResMem);
+ PciBus->pmem = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResMem);
break;
default:
break;
}
+ }
}
for (i = 0; i <= MaxBus; i++) { /* find PCI buses not attached to bridge */
for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next)
- if (PciBus->secondary) break;
+ if (PciBus->secondary == i) break;
if (!PciBus) { /* We assume it's behind a HOST-PCI bridge */
int minTag = 0xFFFFFF; /*find the 'smallest' free HOST-PCI bridge*/
int tag; /*'small' is in the order of pciTag() */
@@ -1449,11 +1544,12 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->primary = -1;
PciBus->secondary = i;
PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST;
- RANGE(range, 0, 0xFFFFFFFF, ResIo | ResBlock | ResExclusive);
- PciBus->io = xf86AddResToList(NULL, &range, -1);
- RANGE(range, 0, ~(memType)0, ResMem | ResBlock | ResExclusive);
- PciBus->mem = xf86AddResToList(NULL, &range, -1);
- PciBus->pmem = xf86AddResToList(NULL, &range, -1);
+ PciBus->io = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResIo);
+ PciBus->mem = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResMem);
+ PciBus->pmem = xf86ExtractTypeFromList(
+ xf86PciBusAccWindowsFromOS(),ResMem);
}
}
}
@@ -1560,14 +1656,10 @@ ValidatePci(void)
for (i = 0; i<6; i++) {
if (pvp->ioBase[i]) {
- RANGE(range,pvp->ioBase[i],/*@@@*/
- pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
- ResExcIoBlock);
+ PV_I_RANGE(range,pvp,i,ResExcIoBlock);
Sys = xf86AddResToList(Sys,&range,-1);
} else if (pvp->memBase[i]) {
- RANGE(range,pvp->memBase[i],/*@@@*/
- pvp->memBase[i] + (1 << pvp->size[i]) - 1,
- ResExcMemBlock);
+ PV_M_RANGE(range,pvp,i,ResExcMemBlock);
Sys = xf86AddResToList(Sys,&range,-1);
}
}
@@ -1584,20 +1676,16 @@ ValidatePci(void)
for (i = 0; i < 6; i++) {
if (basep[i]) {
if (PCI_MAP_IS_IO(basep[i]))
- RANGE(range,PCIGETIO(basep[i]),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[i]) - 1,
- ResExcIoBlock)
+ P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]),
+ pcrp->basesize[i], ResExcIoBlock)
else if (!PCI_MAP_IS64BITMEM(basep[i]))
- RANGE(range,PCIGETMEMORY(basep[i]),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[i]) - 1,
- ResExcMemBlock)
+ P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]),
+ pcrp->basesize[i],ResExcMemBlock)
else {
i++;
#if defined LONG64 || defined WORD64
- RANGE(range,PCIGETMEMORY(basep[i-1])/*@@@*/
- | ((memType)basep[i] << 32),
- range.rBegin + (1<<pcrp->basesize[i-1]) - 1,
- ResExcMemBlock)
+ P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]),
+ pcrp->basesize[i-1],ResExcMemBlock)
#else
continue;
#endif
@@ -1606,9 +1694,8 @@ ValidatePci(void)
}
}
if (pcrp->pci_baserom) {
- RANGE(range,PCIGETROM(pcrp->pci_baserom),/*@@@*/
- range.rBegin + (1 << pcrp->basesize[6]) - 1,
- ResExcMemBlock);
+ P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom),
+ pcrp->basesize[6],ResExcMemBlock);
Sys = xf86AddResToList(Sys, &range, -1);
}
}
@@ -1625,7 +1712,7 @@ ValidatePci(void)
resPtr res_mp = NULL, res_m_io = NULL;
resPtr NonSys = NULL;
resPtr tmp, avoid = NULL;
-
+
if (!pvp->validate) continue;
NonSys = xf86DupResList(Sys);
m = n;
@@ -1633,14 +1720,10 @@ ValidatePci(void)
if (!pvp1->validate) continue;
for (i = 0; i<6; i++) {
if (pvp1->ioBase[i]) {
- RANGE(range,pvp1->ioBase[i],/*@@@*/
- pvp1->ioBase[i] + (1 << pvp1->size[i]) - 1,
- ResExcIoBlock);
+ PV_I_RANGE(range,pvp1,i,ResExcIoBlock);
NonSys = xf86AddResToList(NonSys,&range,-1);
} else if (pvp1->memBase[i]) {
- RANGE(range,pvp1->memBase[i],/*@@@*/
- pvp1->memBase[i] + (1 << pvp1->size[i]) - 1,
- ResExcMemBlock);
+ PV_M_RANGE(range,pvp1,i,ResExcMemBlock);
NonSys = xf86AddResToList(NonSys,&range,-1);
}
}
@@ -1649,7 +1732,6 @@ ValidatePci(void)
xf86MsgVerb(X_INFO, 3,"NonSys:\n");
xf86PrintResList(3,NonSys);
#endif
- avoid = NULL;
pbp = pbp1 = xf86PciBus;
while (pbp) {
if (pbp->secondary == pvp->bus) {
@@ -1694,14 +1776,10 @@ ValidatePci(void)
resPtr own = NULL;
for (j = i+1; j < 6; j++) {
if (pvp->ioBase[j]) {
- RANGE(range,pvp->ioBase[j],/*@@@*/
- pvp->ioBase[j] + (1 << pvp->size[j]) - 1,
- ResExcIoBlock);
+ PV_I_RANGE(range,pvp,j,ResExcIoBlock);
own = xf86AddResToList(own,&range,-1);
- } else if (pvp->memBase[j]) {/*@@@*/
- RANGE(range,pvp->memBase[j],
- pvp->memBase[j] + (1 << pvp->size[j]) - 1,
- ResExcMemBlock);
+ } else if (pvp->memBase[j]) {
+ PV_M_RANGE(range,pvp,j,ResExcMemBlock);
own = xf86AddResToList(own,&range,-1);
}
}
@@ -1710,10 +1788,8 @@ ValidatePci(void)
xf86PrintResList(3,own);
#endif
if (pvp->ioBase[i]) {
- RANGE(range,pvp->ioBase[i],/*@@@*/
- pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
- ResExcIoBlock);
- if (isSubsetOf(range,res_m_io)
+ PV_I_RANGE(range,pvp,i,ResExcIoBlock);
+ if (xf86IsSubsetOf(range,res_m_io)
&& ! ChkConflict(&range,own,SETUP)
&& ! ChkConflict(&range,avoid,SETUP)
&& ! ChkConflict(&range,NonSys,SETUP))
@@ -1726,17 +1802,15 @@ ValidatePci(void)
#endif
fixPciResource(i, 0, pvp, range.type);
} else if (pvp->memBase[i]) {
- RANGE(range,pvp->memBase[i],/*@@@*/
- pvp->memBase[i] + (1 << pvp->size[i]) - 1,
- ResExcMemBlock);
+ PV_M_RANGE(range,pvp,i,ResExcMemBlock);
if (pvp->type[i] & PCI_MAP_MEMORY_CACHABLE) {
- if (isSubsetOf(range,res_mp)
+ if (xf86IsSubsetOf(range,res_mp)
&& ! ChkConflict(&range,own,SETUP)
&& ! ChkConflict(&range,avoid,SETUP)
&& ! ChkConflict(&range,NonSys,SETUP))
continue;
}
- if (isSubsetOf(range,res_m_io)
+ if (xf86IsSubsetOf(range,res_m_io)
&& ! ChkConflict(&range,own,SETUP)
&& ! ChkConflict(&range,avoid,SETUP)
&& ! ChkConflict(&range,NonSys,SETUP))
@@ -1786,22 +1860,16 @@ GetImplicitPciResources(int entityIndex)
for (i = 0; i < 6; i++) {
if (pvp->ioBase[i]) {
list = xnfrealloc(list,sizeof(resRange) * (++num));
- RANGE(list[num - 1],pvp->ioBase[i],/*@@@*/
- pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
- ResShrIoBlock | ResBios);
+ PV_I_RANGE(list[num - 1],pvp,i,ResShrIoBlock | ResBios);
} else if (pvp->memBase[i]) {
list = xnfrealloc(list,sizeof(resRange) * (++num));
- RANGE(list[num - 1],pvp->memBase[i],/*@@@*/
- pvp->memBase[i] + (1 << pvp->size[i]) - 1,
- ResShrMemBlock | ResBios);
+ PV_M_RANGE(list[num - 1],pvp,i,ResShrMemBlock | ResBios);
}
}
#if 0
if (pvp->biosBase) {
list = xnfrealloc(list,sizeof(resRange) * (++num));
- RANGE(list[num - 1], pvp->biosBase,
- pvp->biosBase + (1 << pvp->biosSize) - 1,
- ResShrMemBlock | ResBios);
+ PV_B_RANGE(list[num - 1],pvp,ResShrMemBlock | ResBios);
}
#endif
list = xnfrealloc(list,sizeof(resRange) * (++num));
@@ -1836,7 +1904,10 @@ initPciState(void)
pcaccp->funcnum = pvp->func;
pcaccp->arg.tag = pciTag(pvp->bus, pvp->device, pvp->func);
pcaccp->arg.func =
- (SetBitsProcPtr)pciLongFunc(pcaccp->arg.tag,SET_BITS);
+#ifdef notanymore
+ (SetBitsProcPtr)pciLongFunc(pcaccp->arg.tag,SET_BITS);
+#endif
+ (WriteProcPtr)pciLongFunc(pcaccp->arg.tag,WRITE);
pcaccp->ioAccess.AccessDisable = pciIoAccessDisable;
pcaccp->ioAccess.AccessEnable = pciIoAccessEnable;
pcaccp->ioAccess.arg = &pcaccp->arg;
@@ -1851,6 +1922,7 @@ initPciState(void)
else
pcaccp->ctrl = FALSE;
savePciState(pcaccp->arg.tag, &pcaccp->save);
+ pcaccp->arg.ctrl = pcaccp->save.command;
}
}
@@ -1957,6 +2029,7 @@ PciStateEnter(void)
continue;
savePciState(paccp->arg.tag, &paccp->save);
restorePciState(paccp->arg.tag, &paccp->restore);
+ paccp->arg.ctrl = paccp->restore.command;
}
}
@@ -2388,6 +2461,23 @@ xf86GetPciInfoForEntity(int entityIndex)
return NULL;
}
+int
+xf86GetEntityForPciInfo(pciVideoPtr pvp)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ EntityPtr p = xf86Entities[i];
+ if (p->busType != BUS_PCI) continue;
+
+ if (p->pciBusId.bus == pvp->bus &&
+ p->pciBusId.device == pvp->device &&
+ p->pciBusId.func == pvp->func)
+ return i;
+ }
+ return -1;
+}
+
/*
* xf86CheckPciMemBase() checks that the memory base value matches one of the
* PCI base address register values for the given PCI device.
@@ -2424,3 +2514,215 @@ xf86CheckPciSlot(int bus, int device, int func)
return TRUE;
}
+
+CARD32 (*FindPCIClassInCardList)(
+ unsigned short vendorID, unsigned short subsystemID);
+CARD32 (*FindPCIClassInDeviceList)(
+ unsigned short vendorID, unsigned short deviceID);
+
+static void
+getPciClassFlags(pciConfigPtr *pcrpp)
+{
+ pciConfigPtr pcrp;
+ int i = 0;
+#ifdef XFree86LOADER
+ pointer scan_mod = NULL;
+#endif
+
+ if (!pcrpp)
+ return;
+
+#ifdef XFree86LOADER
+ if (!(scan_mod = xf86LoadOneModule("scanpci", NULL))) {
+ xf86Msg(X_WARNING,"Could not load scanpci module\n");
+ return;
+ } else {
+ FindPCIClassInCardList = (CARD32 (*)(unsigned short, unsigned short))
+ LoaderSymbol("xf86FindPCIClassInCardList");
+ FindPCIClassInDeviceList = (CARD32 (*)(unsigned short, unsigned short))
+ LoaderSymbol("xf86FindPCIClassInDeviceList");
+ }
+#else
+ FindPCIClassInCardList = xf86FindPCIClassInCardList;
+ FindPCIClassInDeviceList = xf86FindPCIClassInDeviceList;
+#endif
+
+ while ((pcrp = pcrpp[i])) {
+ if (!(pcrp->listed_class = FindPCIClassInCardList(
+ pcrp->pci_subsys_vendor,pcrp->pci_subsys_card)))
+ pcrp->listed_class = FindPCIClassInDeviceList(
+ pcrp->pci_vendor,pcrp->pci_device);
+ i++;
+ }
+
+#ifdef XFree86LOADER
+ UnloadModule(scan_mod);
+#endif
+}
+
+/*
+ * xf86FindPciVendorDevice() xf86FindPciClass(): These functions
+ * are ment to be used by the pci bios emulation. Some bioses
+ * need to see if there are _other_ chips of the same type around
+ * so by setting pvp_exclude one pci device can be explicitely
+ * _excluded if required.
+ */
+pciVideoPtr
+xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
+ char n, pciVideoPtr pvp_exclude)
+{
+ pciVideoPtr pvp, *ppvp;
+ n++;
+
+ for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) {
+ if (pvp == pvp_exclude) continue;
+ if ((pvp->vendor == vendorID) && (pvp->chipType == deviceID)) {
+ if (!(--n)) break;
+ }
+ }
+ return pvp;
+}
+
+pciVideoPtr
+xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
+ char n, pciVideoPtr pvp_exclude)
+{
+ pciVideoPtr pvp, *ppvp;
+ n++;
+
+ for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) {
+ if (pvp == pvp_exclude) continue;
+ if ((pvp->interface == intf) && (pvp->subclass == subClass)
+ && (pvp->class == class)) {
+ if (!(--n)) break;
+ }
+ }
+ return pvp;
+}
+
+/*
+ * This attempts to detect a multi-device card and set up a list
+ * of pci tags of the devices of this card. On some of these
+ * cards the BIOS is not visible from all chipsets. We therefore
+ * need to us the bios from a chipset where it is visible.
+ * We do the following heuristics:
+ * If we detect only identical pci devices on a bus we assume it's
+ * a multi-device card. This assumption isn't true alwaus, however.
+ * One might just use identical cards on a bus. We therefore don't
+ * detect this situation when we set up the PCI video info. Instead
+ * we wait until an attempt to read the BIOS fails.
+ */
+int
+pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag)
+{
+ pciConfigPtr *ppcrp = xf86PciInfo;
+ pciConfigPtr pcrp = NULL;
+ int i,j;
+ Bool multicard = FALSE;
+ Bool multifunc = FALSE;
+ char str[256];
+ char *str1;
+
+ str1 = str;
+ if (!pTag)
+ return 0;
+
+ *pTag = NULL;
+
+ for (i=0; i < 8; i++) {
+ j = 0;
+
+ while (ppcrp[j]) {
+ if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i) {
+ pcrp = ppcrp[j];
+ break;
+ }
+ j++;
+ }
+
+ if (!pcrp) return 0;
+ /*
+ * we check all functions here: since multifunc devices need
+ * to implement func 0 we catch all devices on the bus when
+ * i = 0
+ */
+ if (pcrp->pci_header_type &0x80)
+ multifunc = TRUE;
+
+ ppcrp = xf86PciInfo;
+
+ while (ppcrp[j]) {
+ if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i
+ && ppcrp[j]->devnum != pcrp->devnum) {
+ /* don't test subsys ID here. It might be set by POST
+ - however some cars might not have been POSTed */
+ if (ppcrp[j]->pci_device_vendor != pcrp->pci_device_vendor
+ || ppcrp[j]->pci_class_revision != pcrp->pci_class_revision
+ || ppcrp[j]->pci_header_type != pcrp->pci_header_type )
+ return 0;
+ else
+ multicard = TRUE;
+ }
+ j++;
+ }
+ if (!multifunc)
+ break;
+ }
+
+ if (!multicard)
+ return 0;
+
+ j = 0;
+ i = 0;
+ while (ppcrp[i]) {
+ if (ppcrp[i]->busnum == bus && ppcrp[i]->funcnum == func) {
+ str1 += sprintf(str1,"[%x:%x:%x]",ppcrp[i]->busnum,
+ ppcrp[i]->devnum,ppcrp[i]->funcnum);
+ *pTag = xnfrealloc(*pTag,sizeof(PCITAG) * (j + 1));
+ (*pTag)[j++] = pciTag(ppcrp[i]->busnum,
+ ppcrp[i]->devnum,ppcrp[i]->funcnum);
+ }
+ i++;
+ }
+ xf86MsgVerb(X_INFO,3,"Multi Device Card detected: %s\n",str);
+ return j;
+}
+
+void
+pciConvertRange2Host(int entityIndex, resRange *pRange)
+{
+ PCITAG tag = TAG(xf86GetPciInfoForEntity(entityIndex));
+
+ switch(pRange->type & ResPhysMask) {
+ case ResMem:
+ switch(pRange->type & ResExtMask) {
+ case ResBlock:
+ pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rBegin);
+ pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rEnd);
+ break;
+ case ResSparse:
+ pRange->rBase = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_BASE,
+ pRange->rBegin);
+ pRange->rMask = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_MASK,
+ pRange->rEnd);
+ break;
+ }
+ break;
+ case ResIo:
+ switch(pRange->type & ResExtMask) {
+ case ResBlock:
+ pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rBegin);
+ pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rEnd);
+ break;
+ case ResSparse:
+ pRange->rBase = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_BASE
+ , pRange->rBegin);
+ pRange->rMask = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_MASK
+ , pRange->rEnd);
+ break;
+ }
+ break;
+ }
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h
index ca5fe747a..19434edfa 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.2 1999/12/06 03:52:41 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.4 2000/02/12 23:59:10 eich Exp $ */
#ifndef _XF86_PCI_BUS_H
#define _XF86_PCI_BUS_H
@@ -12,10 +12,15 @@ typedef struct {
} pciSave, *pciSavePtr;
typedef void (*SetBitsProcPtr)(PCITAG, int, CARD32, CARD32);
+typedef void (*WriteProcPtr)(PCITAG, int, CARD32);
typedef struct {
PCITAG tag;
+#ifdef notanymore
SetBitsProcPtr func;
+#endif
+ WriteProcPtr func;
+ CARD32 ctrl;
} pciArg;
typedef struct pci_io {
@@ -51,6 +56,8 @@ void PciBusStateEnter(void);
void PciStateLeave(void);
void PciBusStateLeave(void);
resPtr ResourceBrokerInitPci(resPtr *osRes);
+void pciConvertRange2Host(int entityIndex, resRange *pRange);
+void isaConvertRange2Host(resRange *pRange);
extern pciAccPtr * xf86PciAccInfo;
diff --git a/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc b/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc
index 0e22d5939..33208b39c 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc
+++ b/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc
@@ -890,7 +890,7 @@ potentially subtler problems with overdriving a multisync monitor which you
should be aware of.
Having a pixel clock higher than the monitor's maximum bandwidth is rather
-harmless, in contrast. (Note: the theoretical limit of discernable features
+harmless, in contrast. (Note: the theoretical limit of discernible features
is reached when the pixel clock reaches double the monitor's bandwidth. This
is a straightforward application of Nyquist's Theorem: consider the pixels as
a spatially distributed series of samples of the drive signals and you'll see
@@ -1123,7 +1123,7 @@ Here is a copy of modeplot:
#
# Do `modeplot -?' to see the control options.
#
- # ($Id: VideoModes.doc,v 1.2 1999/12/05 23:10:30 daryll Exp $)
+ # ($Id: VideoModes.doc,v 1.3 2000/02/22 22:10:27 kem Exp $)
# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz
# and vertical frequencies in Hz.
@@ -1162,7 +1162,7 @@ Here is a copy of modeplot:
The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on
analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de>
- This is modeplot $Revision: 1.2 $
+ This is modeplot $Revision: 1.3 $
EOF
exit;;
esac
@@ -1314,9 +1314,9 @@ using gnuplot to make mode diagrams and did the mathematical analysis behind
modeplot. The distributed modeplot was redesigned and generalized by ESR
from Martin's original gnuplot code for one case.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.14 1997/11/16 10:52:47 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.15 2000/01/24 19:38:29 dawes Exp $
$XConsortium: VidModes.sgml /main/7 1996/02/21 17:46:17 kaleb $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc,v 3.18 1999/04/15 03:35:09 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc,v 3.20 2000/02/21 22:44:46 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml
index 8fcf006a0..29a2b96ae 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml
@@ -940,7 +940,7 @@ multisync monitor which you should be aware of.
Having a pixel clock higher than the monitor's maximum bandwidth is
rather harmless, in contrast. (Note: the theoretical limit of
-discernable features is reached when the pixel clock reaches double
+discernible features is reached when the pixel clock reaches double
the monitor's bandwidth. This is a straightforward application of
Nyquist's Theorem: consider the pixels as a spatially distributed
series of samples of the drive signals and you'll see why.)
@@ -1196,7 +1196,7 @@ Here is a copy of modeplot:
#
# Do `modeplot -?' to see the control options.
#
-# ($Id: VidModes.sgml,v 1.2 1999/12/05 23:10:30 daryll Exp $)
+# ($Id: VidModes.sgml,v 1.3 2000/02/22 22:10:27 kem Exp $)
# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz
# and vertical frequencies in Hz.
@@ -1235,7 +1235,7 @@ output can be redirected to a printer. See gnuplot(1) for details.
The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on
analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de>
-This is modeplot $Revision: 1.2 $
+This is modeplot $Revision: 1.3 $
EOF
exit;;
esac
@@ -1408,7 +1408,7 @@ mathematical analysis behind <TT>modeplot</TT>. The distributed
<TT>modeplot</TT> was redesigned and generalized by ESR from
Martin's original gnuplot code for one case.
<verb>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.14 1997/11/16 10:52:47 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.15 2000/01/24 19:38:29 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml
index 2175e1d67..94f3997bf 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml
@@ -1,9 +1,19 @@
-<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN">
+<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
<article>
<title>Information for ATI Rage 128 Users
-<author>Precision Insight, Inc., SuSE GmBH
+<author>Precision Insight, Inc., SuSE GmbH
<date>12 November 1999
+
+<ident>
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.4 2000/01/24 19:38:30 dawes Exp $
+</ident>
+<!--
+$PI: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.2 1999/10/21 20:51:15 faith Exp $
+-->
+
<toc>
<sect>Supported Hardware
@@ -50,7 +60,8 @@ initialize the card. The only lines you need in the "Device"
section of your XF86Config file are:
<verb>
Section "Device"
- Identifier "r128"
+ Identifier "Rage 128"
+ Driver "r128"
EndSection
</verb>
or let xf86config or XF86Setup do this for you.
@@ -86,8 +97,8 @@ However, if you have problems with auto-detection, you can specify:
<p>
The XFree86 3.9 driver was ported from XFree86 3.3 and enhanced by:
<itemize>
- <item>Rickard E. (Rik) Faith <it>&lt;faith@precisioninsight.com&gt;</it>
- <item>Kevin E. Martin <it>&lt;kevin@precisioninsight.com&gt;</it>
+ <item>Rickard E. (Rik) Faith <email>faith@precisioninsight.com</email>
+ <item>Kevin E. Martin <email>kevin@precisioninsight.com</email>
</itemize>
<p>
The XFree86 3.9 driver was funded by ATI and was donated to The XFree86
@@ -100,15 +111,15 @@ Project by:
<p>
The XFree86 3.3 driver used for the port was written by:
<itemize>
- <item>Rickard E. (Rik) Faith <it>&lt;faith@precisioninsight.com&gt;</it>
- <item>Kevin E. Martin <it>&lt;kevin@precisioninsight.com&gt;</it>
+ <item>Rickard E. (Rik) Faith <email>faith@precisioninsight.com</email>
+ <item>Kevin E. Martin <email>kevin@precisioninsight.com</email>
</itemize>
The XFree86 3.3 driver was funded by ATI and was donated to The XFree86
Project by Precision Insight, Inc. It was based in part on an earlier
driver that was written by:
<itemize>
- <item>Alan Hourihane <it>&lt;alanh@fairlite.demon.co.uk&lt;</it>
- <item>Dirk Hohndel <it>&lt;hohndel@suse.de&gt;</it>
+ <item>Alan Hourihane <email>alanh@fairlite.demon.co.uk</email>
+ <item>Dirk Hohndel <email>hohndel@suse.de</email>
</itemize>
<p>This early driver was funded and donated to The XFree86 Project by:
<verb>
@@ -125,9 +136,5 @@ driver that was written by:
<htmlurl name="http://www.suse.com"
url="http://www.suse.com">
-<verb>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.2 1999/11/19 13:54:28 hohndel Exp $
-$PI: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.2 1999/10/21 20:51:15 faith Exp $
-</verb>
</article>
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.c
deleted file mode 100644
index 869596e0d..000000000
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.c,v 1.7 1999/08/21 13:48:31 dawes Exp $ */
-/*
- * Copyright 1997 through 1999 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
- *
- * 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 Marc Aurele La France not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Marc Aurele La France makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as-is" without express or implied warranty.
- *
- * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- * EVENT SHALL MARC AURELE LA FRANCE 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.
- */
-
-#include "ati.h"
-#include "atiadapter.h"
-#include "atichip.h"
-#include "atidac.h"
-#include "atidsp.h"
-#include "atimach64.h"
-#include "atiprint.h"
-#include "ativga.h"
-#include "atiwonder.h"
-
-/*
- * ATICopyVGAMemory --
- *
- * This function is called to copy one or all banks of a VGA plane.
- */
-static void
-ATICopyVGAMemory
-(
- ATIPtr pATI,
- ATIHWPtr pATIHW,
- pointer *saveptr,
- pointer *from,
- pointer *to
-)
-{
- unsigned int iBank;
-
- for (iBank = 0; iBank < pATIHW->nBank; iBank++)
- {
- (*pATIHW->SetBank)(pATI, iBank);
- (void) memcpy(*to, *from, 0x00010000U);
- *saveptr = (char *)(*saveptr) + 0x00010000U;
- }
-}
-
-/*
- * ATISwap --
- *
- * This function saves/restores video memory contents during video mode
- * switches.
- */
-static void
-ATISwap
-(
- ScrnInfoPtr pScreenInfo,
- ATIPtr pATI,
- ATIHWPtr pATIHW,
- Bool ToFB
-)
-{
- pointer save, *from, *to;
- unsigned int iPlane = 0, PlaneMask = 1;
- CARD8 seq2, seq4, gra1, gra3, gra4, gra5, gra6, gra8;
-
- /*
- * This is only done for non-accelerator modes. If the video state on
- * server entry was an accelerator mode, the application that relinquished
- * the console had better do the Right Thing (tm) anyway by saving and
- * restoring its own video memory contents.
- */
- if (pATIHW->crtc != ATI_CRTC_VGA)
- return;
-
- if (ToFB)
- {
- if (!pATIHW->frame_buffer)
- return;
-
- from = &save;
- to = &pATI->pBank;
- }
- else
- {
- /* Allocate the memory */
- if (!pATIHW->frame_buffer)
- {
- pATIHW->frame_buffer =
- (pointer)xalloc(pATIHW->nBank * pATIHW->nPlane * 0x00010000U);
- if (!pATIHW->frame_buffer)
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Temporary frame buffer could not be allocated.\n");
- return;
- }
- }
-
- from = &pATI->pBank;
- to = &save;
- }
-
- /* Turn off screen */
- ATIVGASaveScreen(pATI, FALSE);
-
- /* Save register values to be modified */
- seq2 = GetReg(SEQX, 0x02U);
- seq4 = GetReg(SEQX, 0x04U);
- gra1 = GetReg(GRAX, 0x01U);
- gra3 = GetReg(GRAX, 0x03U);
- gra4 = GetReg(GRAX, 0x04U);
- gra5 = GetReg(GRAX, 0x05U);
- gra6 = GetReg(GRAX, 0x06U);
- gra8 = GetReg(GRAX, 0x08U);
-
- save = pATIHW->frame_buffer;
-
- /* Temporarily normalize the mode */
- if (gra1 != 0x00U)
- PutReg(GRAX, 0x01U, 0x00U);
- if (gra3 != 0x00U)
- PutReg(GRAX, 0x03U, 0x00U);
- if (gra6 != 0x05U)
- PutReg(GRAX, 0x06U, 0x05U);
- if (gra8 != 0xFFU)
- PutReg(GRAX, 0x08U, 0xFFU);
-
- if (seq4 & 0x08U)
- {
- /* Setup packed mode memory */
- if (seq2 != 0x0FU)
- PutReg(SEQX, 0x02U, 0x0FU);
- if (seq4 != 0x0AU)
- PutReg(SEQX, 0x04U, 0x0AU);
- if (pATI->Chip < ATI_CHIP_264CT)
- {
- if (gra5 != 0x00U)
- PutReg(GRAX, 0x05U, 0x00U);
- }
- else
- {
- if (gra5 != 0x40U)
- PutReg(GRAX, 0x05U, 0x40U);
- }
-
- ATICopyVGAMemory(pATI, pATIHW, &save, from, to);
-
- if (seq2 != 0x0FU)
- PutReg(SEQX, 0x02U, seq2);
- if (seq4 != 0x0AU)
- PutReg(SEQX, 0x04U, seq4);
- if (pATI->Chip < ATI_CHIP_264CT)
- {
- if (gra5 != 0x00U)
- PutReg(GRAX, 0x05U, gra5);
- }
- else
- {
- if (gra5 != 0x40U)
- PutReg(GRAX, 0x05U, gra5);
- }
- }
- else
- {
- gra4 = GetReg(GRAX, 0x04U);
-
- /* Setup planar mode memory */
- if (seq4 != 0x06U)
- PutReg(SEQX, 0x04U, 0x06U);
- if (gra5 != 0x00U)
- PutReg(GRAX, 0x05U, 0x00U);
-
- for (; iPlane < pATIHW->nPlane; iPlane++)
- {
- PutReg(SEQX, 0x02U, PlaneMask);
- PutReg(GRAX, 0x04U, iPlane);
- ATICopyVGAMemory(pATI, pATIHW, &save, from, to);
- PlaneMask <<= 1;
- }
-
- PutReg(SEQX, 0x02U, seq2);
- if (seq4 != 0x06U)
- PutReg(SEQX, 0x04U, seq4);
- PutReg(GRAX, 0x04U, gra4);
- if (gra5 != 0x00U)
- PutReg(GRAX, 0x05U, gra5);
- }
-
- /* Restore registers */
- if (gra1 != 0x00U)
- PutReg(GRAX, 0x01U, gra1);
- if (gra3 != 0x00U)
- PutReg(GRAX, 0x03U, gra3);
- if (gra6 != 0x05U)
- PutReg(GRAX, 0x06U, gra6);
- if (gra8 != 0xFFU)
- PutReg(GRAX, 0x08U, gra8);
-
- /* Back to bank 0 */
- (*pATIHW->SetBank)(pATI, 0);
-
- /*
- * If restoring video memory for a server video mode, free the frame buffer
- * save area.
- */
- if (ToFB && (pATIHW == &pATI->NewHW))
- {
- xfree(pATIHW->frame_buffer);
- pATIHW->frame_buffer = NULL;
- }
-}
-
-/*
- * ATICRTCPreInit --
- *
- * This function initializes an ATIHWRec with information common to all video
- * states generated by the driver.
- */
-void
-ATICRTCPreInit
-(
- ScrnInfoPtr pScreenInfo,
- ATIPtr pATI,
- ATIHWPtr pATIHW
-)
-{
- CARD32 lcd_index;
-
- if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
- {
- /* Fill in VGA data */
- ATIVGAPreInit(pScreenInfo, pATI, pATIHW);
-
- /* Fill in VGA Wonder data */
- if (pATI->CPIO_VGAWonder)
- ATIVGAWonderPreInit(pScreenInfo, pATI, pATIHW);
- }
-
- /* Fill in Mach64 data */
- if (pATI->Chip >= ATI_CHIP_88800GXC)
- ATIMach64PreInit(pScreenInfo, pATI, pATIHW);
-
- /* For now disable extended reference and feedback dividers */
- if (pATI->Chip >= ATI_CHIP_264LT)
- pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL) &
- ~(PLL_EXT_VPLL_EN | PLL_EXT_VPLL_VGA_EN | PLL_EXT_VPLL_INSYNC);
-
- /* Initialize CRTC data for LCD panels */
- if (pATI->LCDPanelID >= 0)
- {
- int HDisplay, VDisplay;
-
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- pATIHW->lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL);
- pATIHW->power_management = inl(pATI->CPIO_POWER_MANAGEMENT);
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- lcd_index = inl(pATI->CPIO_LCD_INDEX);
- pATIHW->lcd_index = (lcd_index &
- ~(LCD_REG_INDEX | LCD_DISPLAY_DIS | LCD_SRC_SEL)) |
- (LCD_SRC_SEL_CRTC1 | LCD_CRTC2_DISPLAY_DIS);
- pATIHW->config_panel =
- ATIGetLTProLCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND;
- pATIHW->lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL);
- pATIHW->power_management =
- ATIGetLTProLCDReg(LCD_POWER_MANAGEMENT);
- outl(pATI->CPIO_LCD_INDEX, lcd_index);
- }
-
- /*
- * Use primary CRTC to drive the panel. Turn off CRT interface.
- */
- pATIHW->lcd_gen_ctrl &=
- ~(CRT_ON | CRTC_RW_SELECT | HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 |
- USE_SHADOWED_VEND | USE_SHADOWED_ROWCUR | SHADOW_EN |
- SHADOW_RW_EN);
- pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT;
-
- /* Disable power management */
- pATIHW->power_management &= ~PWR_MGT_ON;
-
- /*
- * XXX
- *
- * Determine porch data. This is ugly and will be removed when the
- * common layer's mode validation is changed to better deal with
- * panels. The intent here is to produce stretched modes that
- * approximate the horizontal sync and vertical refresh rates of the
- * mode on server entry (which, BTW, hasn't been saved yet). The
- * following is inaccurate (but still good enough) when BIOS
- * initialization has set things up so that the registers read here are
- * not the ones actually in use by the panel.
- */
- if (inl(pATI->CPIO_CRTC_GEN_CNTL) & CRTC_EXT_DISP_EN)
- {
- pATIHW->crtc_h_total_disp = inl(pATI->CPIO_CRTC_H_TOTAL_DISP);
- pATIHW->crtc_h_sync_strt_wid =
- inl(pATI->CPIO_CRTC_H_SYNC_STRT_WID);
- pATIHW->crtc_v_total_disp = inl(pATI->CPIO_CRTC_V_TOTAL_DISP);
- pATIHW->crtc_v_sync_strt_wid =
- inl(pATI->CPIO_CRTC_V_SYNC_STRT_WID);
-
- HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP);
- VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP);
-
- pATI->LCDHSyncStart =
- (GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT_HI) *
- (MaxBits(CRTC_H_SYNC_STRT) + 1)) +
- GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT) -
- HDisplay;
- pATI->LCDHSyncWidth =
- GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_WID);
- pATI->LCDHBlankWidth =
- GetBits(pATIHW->crtc_h_total_disp, CRTC_H_TOTAL) - HDisplay;
- pATI->LCDVSyncStart =
- GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_STRT) -
- VDisplay;
- pATI->LCDVSyncWidth =
- GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_WID);
- pATI->LCDVBlankWidth =
- GetBits(pATIHW->crtc_v_total_disp, CRTC_V_TOTAL) - VDisplay;
- }
- else
- {
- pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U);
- pATIHW->crt[1] = GetReg(CRTX(pATI->CPIO_VGABase), 0x01U);
- pATIHW->crt[4] = GetReg(CRTX(pATI->CPIO_VGABase), 0x04U);
- pATIHW->crt[5] = GetReg(CRTX(pATI->CPIO_VGABase), 0x05U);
- pATIHW->crt[6] = GetReg(CRTX(pATI->CPIO_VGABase), 0x06U);
- pATIHW->crt[7] = GetReg(CRTX(pATI->CPIO_VGABase), 0x07U);
- pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U);
- pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U);
- pATIHW->crt[18] = GetReg(CRTX(pATI->CPIO_VGABase), 0x12U);
-
- HDisplay = pATIHW->crt[1] + 1;
- VDisplay = (((pATIHW->crt[7] << 3) & 0x0200U) |
- ((pATIHW->crt[7] << 7) & 0x0100U) |
- pATIHW->crt[18]) + 1;
-
- pATI->LCDHSyncStart = pATIHW->crt[4] - HDisplay;
- pATI->LCDHSyncWidth = (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU;
- pATI->LCDHBlankWidth = pATIHW->crt[0] + 5 - HDisplay;
- pATI->LCDVSyncStart = (((pATIHW->crt[7] << 2) & 0x0200U) |
- ((pATIHW->crt[7] << 6) & 0x0100U) |
- pATIHW->crt[16]) - VDisplay;
- pATI->LCDVSyncWidth = (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU;
- pATI->LCDVBlankWidth = (((pATIHW->crt[7] << 4) & 0x0200U) |
- ((pATIHW->crt[7] << 8) & 0x0100U) |
- pATIHW->crt[6]) + 2 - VDisplay;
- }
-
- pATI->LCDHSyncStart <<= 3;
- pATI->LCDHSyncWidth <<= 3;
- pATI->LCDHBlankWidth <<= 3;
- }
-
- /* Set RAMDAC data */
- ATIDACPreInit(pScreenInfo, pATIHW);
-}
-
-/*
- * ATICRTCSave --
- *
- * This function saves the curent video state.
- */
-void
-ATICRTCSave
-(
- ScrnInfoPtr pScreenInfo,
- ATIPtr pATI,
- ATIHWPtr pATIHW
-)
-{
- int Index;
-
- /* Get bank to bank 0 */
- (*pATIHW->SetBank)(pATI, 0);
-
- /* Save clock data */
- ATIClockSave(pScreenInfo, pATI, pATIHW);
- if (pATI->Chip >= ATI_CHIP_264LT)
- pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL);
-
- /* Save LCD registers */
- if (pATI->LCDPanelID >= 0)
- {
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- pATIHW->horz_stretching = inl(pATI->CPIO_HORZ_STRETCHING);
- pATIHW->vert_stretching = inl(pATI->CPIO_VERT_STRETCHING);
- pATIHW->lcd_gen_ctrl = inl(pATI->CPIO_LCD_GEN_CTRL);
- pATIHW->power_management = inl(pATI->CPIO_POWER_MANAGEMENT);
-
- /* Set up to save non-shadow registers */
- outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl &
- ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- pATIHW->lcd_index = inl(pATI->CPIO_LCD_INDEX);
- pATIHW->config_panel = ATIGetLTProLCDReg(LCD_CONFIG_PANEL);
- pATIHW->lcd_gen_ctrl = ATIGetLTProLCDReg(LCD_GEN_CNTL);
- pATIHW->horz_stretching = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING);
- pATIHW->vert_stretching = ATIGetLTProLCDReg(LCD_VERT_STRETCHING);
- pATIHW->ext_vert_stretch = ATIGetLTProLCDReg(LCD_EXT_VERT_STRETCH);
- pATIHW->power_management = ATIGetLTProLCDReg(LCD_POWER_MANAGEMENT);
-
- /* Set up to save non-shadow registers */
- ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
- ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
- }
- }
-
- if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
- {
- /* Save VGA data */
- ATIVGASave(pATI, pATIHW);
-
- /* Save VGA Wonder data */
- if (pATI->CPIO_VGAWonder)
- ATIVGAWonderSave(pATI, pATIHW);
- }
-
- /* Save Mach64 data */
- if (pATI->Chip >= ATI_CHIP_88800GXC)
- ATIMach64Save(pATI, pATIHW);
-
- /* Save DSP data */
- if ((pATI->Chip >= ATI_CHIP_264VTB) && (pATI->CPIODecoding == BLOCK_IO))
- ATIDSPSave(pATI, pATIHW);
-
- if (pATI->LCDPanelID >= 0)
- {
- /* Switch to shadow registers */
- if (pATI->Chip == ATI_CHIP_264LT)
- outl(pATI->CPIO_LCD_GEN_CTRL,
- (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
- (SHADOW_EN | SHADOW_RW_EN));
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- ATIPutLTProLCDReg(LCD_GEN_CNTL,
- (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
- (SHADOW_EN | SHADOW_RW_EN));
-
- /* Save shadow VGA CRTC registers */
- for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++)
- pATIHW->shadow_vga[Index] =
- GetReg(CRTX(pATI->CPIO_VGABase), Index);
-
- /* Save shadow Mach64 CRTC registers */
- pATIHW->shadow_h_total_disp = inl (pATI->CPIO_CRTC_H_TOTAL_DISP);
- pATIHW->shadow_h_sync_strt_wid = inl(pATI->CPIO_CRTC_H_SYNC_STRT_WID);
- pATIHW->shadow_v_total_disp = inl (pATI->CPIO_CRTC_V_TOTAL_DISP);
- pATIHW->shadow_v_sync_strt_wid = inl(pATI->CPIO_CRTC_V_SYNC_STRT_WID);
-
- /* Restore CRTC selection and shadow state */
- if (pATI->Chip == ATI_CHIP_264LT)
- outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl);
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl);
- outl(pATI->CPIO_LCD_INDEX, pATIHW->lcd_index);
- }
- }
-
- /*
- * For some unknown reason, CLKDIV2 needs to be turned off to save the
- * DAC's LUT reliably on VGA Wonder VLB adapters.
- */
- if ((pATI->Adapter == ATI_ADAPTER_NONISA) && (pATIHW->seq[1] & 0x08U))
- PutReg(SEQX, 0x01U, pATIHW->seq[1] & ~0x08U);
-
- /* Save RAMDAC state */
- ATIDACSave(pATI, pATIHW);
-
- if ((pATI->Adapter == ATI_ADAPTER_NONISA) && (pATIHW->seq[1] & 0x08U))
- PutReg(SEQX, 0x01U, pATIHW->seq[1]);
-
- /*
- * The server has already saved video memory contents when switching out of
- * its virtual console, so don't do it again.
- */
- if (pATIHW != &pATI->NewHW)
- {
- pATIHW->FeedbackDivider = 0; /* Don't programme clock */
-
- ATISwap(pScreenInfo, pATI, pATIHW, FALSE); /* Save video memory */
- }
-
- if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
- ATIVGASaveScreen(pATI, TRUE); /* Turn on screen */
-}
-
-/*
- * ATICRTCCalculate --
- *
- * This function fills in the an ATIHWRec with all register values needed to
- * enable a video state. It's important that this be done without modifying
- * the current video state.
- */
-Bool
-ATICRTCCalculate
-(
- ScrnInfoPtr pScreenInfo,
- ATIPtr pATI,
- ATIHWPtr pATIHW,
- DisplayModePtr pMode
-)
-{
- CARD32 lcd_index;
- int Index;
-
- /* XXX Clobber mode timings */
- if ((pATI->LCDPanelID >= 0) &&
- !(pMode->CrtcHAdjusted) &&
- !(pMode->CrtcVAdjusted))
- {
- pMode->Flags &= ~(V_DBLSCAN | V_INTERLACE | V_CLKDIV2);
-
- pMode->HSyncStart = pMode->HDisplay + pATI->LCDHSyncStart;
- pMode->HSyncEnd = pMode->HSyncStart + pATI->LCDHSyncWidth;
- pMode->HTotal = pMode->HDisplay + pATI->LCDHBlankWidth;
-
- pMode->VSyncStart = pMode->VDisplay + pATI->LCDVSyncStart;
- pMode->VSyncEnd = pMode->VSyncStart + pATI->LCDVSyncWidth;
- pMode->VTotal = pMode->VDisplay + pATI->LCDVBlankWidth;
-
- pMode->VScan = 0;
- }
-
- switch (pATIHW->crtc)
- {
- case ATI_CRTC_VGA:
- /* Fill in VGA data */
- ATIVGACalculate(pATI, pATIHW, pMode);
-
- /* Fill in VGA Wonder data */
- if (pATI->CPIO_VGAWonder)
- ATIVGAWonderCalculate(pScreenInfo, pATI, pATIHW, pMode);
-
- if (pATI->Chip >= ATI_CHIP_88800GXC)
- {
- pATIHW->crtc_gen_cntl = inl(pATI->CPIO_CRTC_GEN_CNTL) &
- ~(CRTC_DBL_SCAN_EN | CRTC_INTERLACE_EN |
- CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | CRTC_CSYNC_EN |
- CRTC_PIX_BY_2_EN | CRTC_DISPLAY_DIS |
- CRTC_VGA_XOVERSCAN | CRTC_VGA_128KAP_PAGING |
- CRTC_VFC_SYNC_TRISTATE |
- CRTC_LOCK_REGS | /* Already off, but ... */
- CRTC_SYNC_TRISTATE | CRTC_EXT_DISP_EN |
- CRTC_DISP_REQ_EN | CRTC_VGA_LINEAR | CRTC_VGA_TEXT_132 |
- CRTC_CUR_B_TEST);
-#if 0 /* This isn't needed, but is kept for reference */
- if (pMode->Flags & V_DBLSCAN)
- pATIHW->crtc_gen_cntl |= CRTC_DBL_SCAN_EN;
-#endif
- if (pMode->Flags & V_INTERLACE)
- pATIHW->crtc_gen_cntl |= CRTC_INTERLACE_EN;
- if ((pMode->Flags & (V_CSYNC | V_PCSYNC)) || pATI->OptionCSync)
- pATIHW->crtc_gen_cntl |= CRTC_CSYNC_EN;
- if (pScreenInfo->depth <= 4)
- pATIHW->crtc_gen_cntl |= CRTC_EN | CRTC_CNT_EN;
- else
- pATIHW->crtc_gen_cntl |=
- CRTC_EN | CRTC_VGA_LINEAR | CRTC_CNT_EN;
- }
- break;
-
- case ATI_CRTC_MACH64:
- /*
- * Fill in Mach64 data.
- */
- ATIMach64Calculate(pScreenInfo, pATI, pATIHW, pMode);
- break;
-
- default:
- break;
- }
-
- /* Set up LCD register values */
- if (pATI->LCDPanelID >= 0)
- {
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- pATIHW->horz_stretching = inl(pATI->CPIO_HORZ_STRETCHING);
- pATIHW->vert_stretching = inl(pATI->CPIO_VERT_STRETCHING);
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- lcd_index = inl(pATI->CPIO_LCD_INDEX);
- pATIHW->horz_stretching = ATIGetLTProLCDReg(LCD_HORZ_STRETCHING);
- pATIHW->vert_stretching = ATIGetLTProLCDReg(LCD_VERT_STRETCHING);
- pATIHW->ext_vert_stretch =
- ATIGetLTProLCDReg(LCD_EXT_VERT_STRETCH) &
- ~(AUTO_VERT_RATIO | VERT_STRETCH_MODE);
-
- /*
- * Don't use vertical blending if the mode is too wide, too short,
- * or not vertically stretched.
- */
- if ((pMode->HDisplay <= pATI->LCDVBlendFIFOSize) &&
- (pMode->VDisplay < pATI->LCDVertical) &&
- (pMode->VDisplay >= (pATI->LCDVertical / 2)))
- pATIHW->ext_vert_stretch |= VERT_STRETCH_MODE;
-
- outl(pATI->CPIO_LCD_INDEX, lcd_index);
- }
-
- pATIHW->horz_stretching &=
- ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | HORZ_STRETCH_MODE |
- HORZ_STRETCH_EN);
- if (pMode->HDisplay < pATI->LCDHorizontal)
- pATIHW->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN) |
- SetBits(((pMode->HDisplay & ~7) *
- (MaxBits(HORZ_STRETCH_BLEND) + 1)) /
- pATI->LCDHorizontal, HORZ_STRETCH_BLEND);
-
- if (pMode->VDisplay >= pATI->LCDVertical)
- pATIHW->vert_stretching &= ~VERT_STRETCH_EN;
- else
- {
- pATIHW->vert_stretching &= ~VERT_STRETCH_RATIO0;
- pATIHW->vert_stretching |= (VERT_STRETCH_USE0 | VERT_STRETCH_EN) |
- SetBits((pMode->VDisplay *
- (MaxBits(VERT_STRETCH_RATIO0) + 1)) /
- pATI->LCDVertical, VERT_STRETCH_RATIO0);
- }
-
- /* Copy non-shadow CRTC register values to the shadow set */
- for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++)
- pATIHW->shadow_vga[Index] = pATIHW->crt[Index];
-
- pATIHW->shadow_h_total_disp = pATIHW->crtc_h_total_disp;
- pATIHW->shadow_h_sync_strt_wid = pATIHW->crtc_h_sync_strt_wid;
- pATIHW->shadow_v_total_disp = pATIHW->crtc_v_total_disp;
- pATIHW->shadow_v_sync_strt_wid = pATIHW->crtc_v_sync_strt_wid;
- }
-
- /* Fill in clock data */
- return ATIClockCalculate(pScreenInfo, pATI, pATIHW, pMode);
-}
-
-/*
- * ATICRTCSet --
- *
- * This function sets a video mode. It writes out all video state data that
- * has been previously calculated or saved.
- */
-void
-ATICRTCSet
-(
- ScrnInfoPtr pScreenInfo,
- ATIPtr pATI,
- ATIHWPtr pATIHW
-)
-{
- int Index;
-
- /* Get back to bank 0 */
- (*pATIHW->SetBank)(pATI, 0);
-
- if (pATI->Chip >= ATI_CHIP_264LT)
- ATIPutMach64PLLReg(PLL_EXT_VPLL_CNTL, pATIHW->pll_ext_vpll_cntl);
-
- /* Load LCD registers */
- if (pATI->LCDPanelID >= 0)
- {
- /* Stop CRTC */
- outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl &
- ~(CRTC_EXT_DISP_EN | CRTC_EN));
-
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- /* Update non-shadow registers first */
- outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl &
- ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
-
- /* Temporarily disable stretching */
- outl(pATI->CPIO_HORZ_STRETCHING, pATIHW->horz_stretching &
- ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
- outl(pATI->CPIO_VERT_STRETCHING, pATIHW->vert_stretching &
- ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 |
- VERT_STRETCH_USE0 | VERT_STRETCH_EN));
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- /* Update non-shadow registers first */
- ATIPutLTProLCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel);
- ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
- ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
-
- /* Temporarily disable stretching */
- ATIPutLTProLCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching &
- ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
- ATIPutLTProLCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching &
- ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 |
- VERT_STRETCH_USE0 | VERT_STRETCH_EN));
- }
- }
-
- switch (pATIHW->crtc)
- {
- case ATI_CRTC_VGA:
- /* Stop CRTC */
- if (pATI->Chip >= ATI_CHIP_88800GXC)
- outl(pATI->CPIO_CRTC_GEN_CNTL,
- pATIHW->crtc_gen_cntl & ~CRTC_EN);
-
- /* Start sequencer reset */
- PutReg(SEQX, 0x00U, 0x00U);
-
- /* Set pixel clock */
- if ((pATIHW->FeedbackDivider > 0) &&
- (pATI->ProgrammableClock != ATI_CLOCK_FIXED))
- ATIClockSet(pATI, pATIHW);
-
- /* Load VGA Wonder */
- if (pATI->CPIO_VGAWonder)
- ATIVGAWonderSet(pATI, pATIHW);
-
- /* Load VGA device */
- ATIVGASet(pATI, pATIHW);
-
- /* Load Mach64 registers */
- if (pATI->Chip >= ATI_CHIP_88800GXC)
- {
- outl(pATI->CPIO_CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl);
- outl(pATI->CPIO_MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel);
- outl(pATI->CPIO_MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel);
- if (pATI->Chip >= ATI_CHIP_264CT)
- {
- outl(pATI->CPIO_CRTC_OFF_PITCH, pATIHW->crtc_off_pitch);
- outl(pATI->CPIO_BUS_CNTL, pATIHW->bus_cntl);
- outl(pATI->CPIO_DAC_CNTL, pATIHW->dac_cntl);
- outl(pATI->CPIO_CONFIG_CNTL, pATIHW->config_cntl);
- }
- }
-
- break;
-
- case ATI_CRTC_MACH64:
- /* Load Mach64 CRTC registers */
- ATIMach64Set(pATI, pATIHW);
-
- if (pATI->UseSmallApertures)
- {
- /* Oddly enough, these need to be set also, maybe others */
- PutReg(SEQX, 0x02U, pATIHW->seq[2]);
- PutReg(SEQX, 0x04U, pATIHW->seq[4]);
- PutReg(GRAX, 0x06U, pATIHW->gra[6]);
- if (pATI->CPIO_VGAWonder)
- ATIModifyExtReg(pATI, 0xB6U, -1, 0x00U, pATIHW->b6);
- }
-
- break;
-
- default:
- break;
- }
-
- if (pATI->LCDPanelID >= 0)
- {
- if (!pATI->OptionDevel || (pATIHW == &pATI->OldHW))
- {
- /* Switch to shadow registers */
- if (pATI->Chip == ATI_CHIP_264LT)
- outl(pATI->CPIO_LCD_GEN_CTRL,
- (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
- (SHADOW_EN | SHADOW_RW_EN));
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- ATIPutLTProLCDReg(LCD_GEN_CNTL,
- (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
- (SHADOW_EN | SHADOW_RW_EN));
-
- /* Restore shadow registers */
- switch (pATIHW->crtc)
- {
- case ATI_CRTC_VGA:
- for (Index = 0;
- Index < NumberOf(pATIHW->shadow_vga);
- Index++)
- PutReg(CRTX(pATI->CPIO_VGABase), Index,
- pATIHW->shadow_vga[Index]);
- break;
-
- case ATI_CRTC_MACH64:
- outl(pATI->CPIO_CRTC_H_TOTAL_DISP,
- pATIHW->shadow_h_total_disp);
- outl(pATI->CPIO_CRTC_H_SYNC_STRT_WID,
- pATIHW->shadow_h_sync_strt_wid);
- outl(pATI->CPIO_CRTC_V_TOTAL_DISP,
- pATIHW->shadow_v_total_disp);
- outl(pATI->CPIO_CRTC_V_SYNC_STRT_WID,
- pATIHW->shadow_v_sync_strt_wid);
- break;
-
- default:
- break;
- }
- }
-
- /* Restore CRTC selection & shadow state and enable stretching */
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- outl(pATI->CPIO_LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl);
- outl(pATI->CPIO_HORZ_STRETCHING, pATIHW->horz_stretching);
- outl(pATI->CPIO_VERT_STRETCHING, pATIHW->vert_stretching);
- outl(pATI->CPIO_POWER_MANAGEMENT, pATIHW->power_management);
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL)) */
- {
- ATIPutLTProLCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl);
- ATIPutLTProLCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching);
- ATIPutLTProLCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching);
- ATIPutLTProLCDReg(LCD_EXT_VERT_STRETCH, pATIHW->ext_vert_stretch);
- ATIPutLTProLCDReg(LCD_POWER_MANAGEMENT, pATIHW->power_management);
- outl(pATI->CPIO_LCD_INDEX, pATIHW->lcd_index);
- }
- }
-
- /*
- * Set DSP registers. Note that sequencer resets clear the DSP_CONFIG
- * register, for some reason.
- */
- if ((pATI->Chip >= ATI_CHIP_264VTB) && (pATI->CPIODecoding == BLOCK_IO))
- ATIDSPSet(pATI, pATIHW);
-
- /* Load RAMDAC */
- ATIDACSet(pATI, pATIHW);
-
- /* Restore video memory */
- ATISwap(pScreenInfo, pATI, pATIHW, TRUE);
-
- if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
- ATIVGASaveScreen(pATI, TRUE); /* Turn screen back on */
-
- if ((xf86GetVerbosity() > 3) && (pATIHW == &pATI->NewHW))
- {
- xf86ErrorFVerb(4, "\n After setting mode \"%s\":\n\n",
- pScreenInfo->currentMode->name);
- ATIPrintMode(pScreenInfo->currentMode);
- ATIPrintRegisters(pATI);
- }
-}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h
index ad1aa7e46..8fdf05b12 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.1 1999/12/26 18:24:15 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.2 2000/02/08 13:13:13 eich Exp $ */
/* (c) Itai Nahshon */
@@ -9,6 +9,7 @@
/* Saved registers that are not part of the core VGA */
/* CRTC >= 0x19; Sequencer >= 0x05; Graphics >= 0x09; Attribute >= 0x15 */
+
enum {
/* CR regs */
CR1A,
@@ -33,28 +34,28 @@ typedef struct {
unsigned char ExtVga[CIR_NSAVED];
} AlpRegRec, *AlpRegPtr;
-/* Card-specific driver information */
-#define ALPPTR(p) ((AlpPtr)((p)->driverPrivate))
+extern Bool AlpHWCursorInit(ScreenPtr pScreen, int size);
+extern Bool AlpXAAInit(ScreenPtr pScreen);
+extern Bool AlpXAAInitMMIO(ScreenPtr pScreen);
+extern Bool AlpDGAInit(ScreenPtr pScreen);
+extern Bool AlpI2CInit(ScrnInfoPtr pScrn);
-typedef struct {
- CirRec CirRec;
+/* Card-specific driver information */
+#define ALPPTR(p) ((AlpPtr)((p)->chip.alp))
+typedef struct alpRec {
unsigned char * HWCursorBits;
unsigned char * CursorBits;
AlpRegRec SavedReg;
AlpRegRec ModeReg;
-
+ int CursorWidth;
+ int CursorHeight;
+ int waitMsk;
+ Bool autoStart;
/* XXX For XF86Config based mem configuration */
- CARD32 SR0F, SR17;
-
+ CARD32 sr0f, sr17;
} AlpRec, *AlpPtr;
-
-extern Bool AlpHWCursorInit(ScreenPtr pScreen);
-extern Bool AlpXAAInit(ScreenPtr pScreen);
-extern Bool AlpXAAInitMMIO(ScreenPtr pScreen);
-extern Bool AlpDGAInit(ScreenPtr pScreen);
-extern Bool AlpI2CInit(ScrnInfoPtr pScrn);
-
#endif /* ALP_H */
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c
index b8e38a7da..544a3aa77 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c,v 1.1 1999/12/26 18:24:15 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */
/* (c) Itai Nahshon */
@@ -13,40 +13,39 @@
#include "vgaHW.h"
#include "cir.h"
-#include "alp.h"
static Bool
-AlpDGAGetParams(int scrnIndex, unsigned long *offset, int *banksize,
+CirDGAGetParams(int scrnIndex, unsigned long *offset, int *banksize,
int *memsize)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- CIRPtr pCir = &ALPPTR(pScrn)->CirRec;
+ CIRPtr pCir = &CIRPTR(pScrn)->CirRec;
*offset = pCir->FbAddress;
*banksize = pScrn->videoRam * 1024;
*memsize = pScrn->videoRam * 1024;
-#ifdef ALP_DEBUG
- ErrorF("AlpDGAGetParams %d = 0x%08x, %d, %d\n",
+#ifdef CIR_DEBUG
+ ErrorF("CirDGAGetParams %d = 0x%08x, %d, %d\n",
scrnIndex, *banksize, *memsize);
#endif
return TRUE;
}
static Bool
-AlpDGASetDirect(int scrnIndex, Bool enable)
+CirDGASetDirect(int scrnIndex, Bool enable)
{
return TRUE;
}
static Bool
-AlpDGASetBank(int scrnIndex, int bank, int flags)
+CirDGASetBank(int scrnIndex, int bank, int flags)
{
return TRUE;
}
static Bool
-AlpDGASetViewport(int scrnIndex, int x, int y, int flags)
+CirDGASetViewport(int scrnIndex, int x, int y, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
(*pScrn->AdjustFrame)(scrnIndex, x, y, 0);
@@ -54,16 +53,16 @@ AlpDGASetViewport(int scrnIndex, int x, int y, int flags)
}
static Bool
-AlpDGAViewportChanged(int scrnIndex, int n, int flags)
+CirDGAViewportChanged(int scrnIndex, int n, int flags)
{
return TRUE;
}
Bool
-AlpDGAInit(ScreenPtr pScreen)
+CirDGAInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CIRPtr pCir = &ALPPTR(pScrn)->CirRec;
+ CIRPtr pCir = &CIRPTR(pScrn)->CirRec;
DGAInfoPtr pDGAInfo;
pDGAInfo = DGACreateInfoRec();
@@ -72,11 +71,11 @@ AlpDGAInit(ScreenPtr pScreen)
pCir->DGAInfo = pDGAInfo;
- pDGAInfo->GetParams = AlpDGAGetParams;
- pDGAInfo->SetDirectMode = AlpDGASetDirect;
- pDGAInfo->SetBank = AlpDGASetBank;
- pDGAInfo->SetViewport = AlpDGASetViewport;
- pDGAInfo->ViewportChanged = AlpDGAViewportChanged;;
+ pDGAInfo->GetParams = CirDGAGetParams;
+ pDGAInfo->SetDirectMode = CirDGASetDirect;
+ pDGAInfo->SetBank = CirDGASetBank;
+ pDGAInfo->SetViewport = CirDGASetViewport;
+ pDGAInfo->ViewportChanged = CirDGAViewportChanged;;
return DGAInit(pScreen, pDGAInfo, 0);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
index deac3c1ba..2da62431a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
@@ -9,7 +9,7 @@
* Guy DESBIEF
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.1 1999/12/26 18:24:15 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.6 2000/02/21 19:22:59 dawes Exp $ */
/* Everything using inb/outb, etc needs "compiler.h" */
#include "compiler.h"
@@ -32,6 +32,7 @@
#include "vgaHW.h"
#include "xf86RAC.h"
+#include "xf86Resources.h"
/* All drivers initialising the SW cursor need this */
#include "mipointer.h"
@@ -41,6 +42,9 @@
#include "micmap.h"
+/* Needed by the Shadow Framebuffer */
+#include "shadowfb.h"
+
/*
* If using cfb, cfb.h is required. Select the others for the bpp values
* the driver supports.
@@ -64,6 +68,7 @@
#endif
#include "xf86DDC.h"
+#include "xf86int10.h"
#include "cir.h"
#include "alp.h"
@@ -91,7 +96,7 @@ Bool AlpScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
Bool AlpEnterVT(int scrnIndex, int flags);
void AlpLeaveVT(int scrnIndex, int flags);
static Bool AlpCloseScreen(int scrnIndex, ScreenPtr pScreen);
-static Bool AlpSaveScreen(ScreenPtr pScreen, Bool unblank);
+static Bool AlpSaveScreen(ScreenPtr pScreen, int mode);
/* Required if the driver supports mode switching */
Bool AlpSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
@@ -120,11 +125,12 @@ static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn,
static int pix24bpp = 0;
typedef enum {
- OPTION_SW_CURSOR,
OPTION_HW_CURSOR,
OPTION_PCI_RETRY,
OPTION_NOACCEL,
OPTION_MMIO,
+ OPTION_ROTATE,
+ OPTION_SHADOW_FB,
OPTION_MEMCFG1,
OPTION_MEMCFG2
} CirOpts;
@@ -133,6 +139,8 @@ static OptionInfoRec CirOptions[] = {
{ OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_MMIO, "MMIO", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_MEMCFG1, "MemCFG1", OPTV_INTEGER, {0}, -1 },
{ OPTION_MEMCFG2, "MemCFG2", OPTV_INTEGER, {0}, -1 },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
@@ -203,6 +211,17 @@ static const char *ramdacSymbols[] = {
NULL
};
+static const char *int10Symbols[] = {
+ "xf86InitInt10",
+ "xf86FreeInt10",
+ NULL
+};
+
+static const char *shadowSymbols[] = {
+ "ShadowFBInit",
+ NULL
+};
+
#define ALPuseI2C 0
static const char *ddcSymbols[] = {
@@ -220,12 +239,6 @@ static const char *i2cSymbols[] = {
NULL
};
-static const char *shadowSymbols[] = {
- "ShadowFBInit",
- NULL
-};
-
-
#ifdef XFree86LOADER
#define ALP_MAJOR_VERSION 1
@@ -258,41 +271,23 @@ static pointer
alpSetup(pointer module, pointer opts, int *errmaj, int *errmin)
{
static Bool setupDone = FALSE;
-
- /* This module should be loaded only once, but check to be sure. */
-
if (!setupDone) {
setupDone = TRUE;
-
- /*
- * Modules that this driver always requires may be loaded here
- * by calling LoadSubModule().
- *
- * Although this driver currently always requires the vgahw module
- * that dependency will be removed later, so we don't load it here.
- */
-
- /*
- * Tell the loader about symbols from other modules that this module
- * might refer to.
- */
LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols,
- xf8_32bppSymbols, ramdacSymbols,
- ddcSymbols, i2cSymbols, shadowSymbols, NULL);
-
- /*
- * The return value must be non-NULL on success even though there
- * is no TearDownProc.
- */
- return (pointer)1;
+ xf8_32bppSymbols, ramdacSymbols,int10Symbols,
+ ddcSymbols, i2cSymbols, shadowSymbols, NULL);
}
-
- if (errmaj) *errmaj = LDR_ONCEONLY;
- return NULL;
+ return (pointer)1;
}
#endif /* XFree86LOADER */
+OptionInfoPtr
+AlpAvailableOptions(int chipid)
+{
+ return CirOptions;
+}
+
Bool
AlpProbe(int entity, ScrnInfoPtr pScrn)
{
@@ -318,19 +313,14 @@ AlpGetRec(ScrnInfoPtr pScrn)
#ifdef ALP_DEBUG
ErrorF("AlpGetRec\n");
#endif
- /*
- * Allocate an AlpRec, and hook it into pScrn->driverPrivate.
- * pScrn->driverPrivate is initialised to NULL, so we can check if
- * the allocation has already been done.
- */
if (pScrn->driverPrivate != NULL)
return TRUE;
- pScrn->driverPrivate = xnfcalloc(sizeof(AlpRec), 1);
- /* Initialise it */
+ pScrn->driverPrivate = xnfcalloc(sizeof(CirRec), 1);
+ ((CirPtr)pScrn->driverPrivate)->chip.alp = xnfcalloc(sizeof(AlpRec),1);
#ifdef ALP_DEBUG
- ErrorF("AlpGetRec 0x%x\n", ALPPTR(pScrn));
+ ErrorF("AlpGetRec 0x%x\n", CIRPTR(pScrn));
#endif
return TRUE;
}
@@ -355,103 +345,115 @@ AlpFreeRec(ScrnInfoPtr pScrn)
static int
AlpCountRam(ScrnInfoPtr pScrn)
{
- AlpPtr pAlp = ALPPTR(pScrn);
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- MessageType from;
- int videoram = 0;
-
- /* Map the Alp memory and MMIO areas */
- pAlp->CirRec.FbMapSize = 1024*1024; /* XX temp */
- pAlp->CirRec.IoMapSize = 0x4000; /* 16K for moment */
- if (!CirMapMem(&pAlp->CirRec, pScrn->scrnIndex))
- return 0;
-
- if (pAlp->CirRec.UseMMIO)
- vgaHWSetMmioFuncs(hwp, pAlp->CirRec.IOBase, -0x3C0);
-
- if (pAlp->SR0F != (CARD32)-1) {
- from = X_CONFIG;
- hwp->writeSeq(hwp, 0x0F, pAlp->SR0F);
+ CirPtr pCir = CIRPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ MessageType from;
+ int videoram = 0;
+
+ /* Map the Alp memory and MMIO areas */
+ pCir->FbMapSize = 1024*1024; /* XX temp */
+ pCir->IoMapSize = 0x4000; /* 16K for moment */
+ if (!CirMapMem(pCir, pScrn->scrnIndex))
+ return 0;
+
+ if (pCir->UseMMIO)
+ vgaHWSetMmioFuncs(hwp, pCir->IOBase, -0x3C0);
+
+ if (pCir->chip.alp->sr0f != (CARD32)-1) {
+ from = X_CONFIG;
+ hwp->writeSeq(hwp, 0x0F, pCir->chip.alp->sr0f);
+ } else {
+ from = X_PROBED;
+ pCir->chip.alp->sr0f = hwp->readSeq(hwp, 0x0F);
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 1 is 0x%02X\n",
+ pCir->chip.alp->sr0f);
+
+ switch (pCir->Chipset) {
+ case PCI_CHIP_GD5430:
+/* case PCI_CHIP_GD5440: */
+ switch (pCir->chip.alp->sr0f & 0x18) {
+ case 0x08:
+ videoram = 512;
+ break;
+ case 0x10:
+ videoram = 1024;
+ break;
+ case 0x18:
+ videoram = 2048;
+ break;
+ }
+ break;
+
+ case PCI_CHIP_GD5434_4:
+ case PCI_CHIP_GD5434_8:
+ case PCI_CHIP_GD5436:
+ switch (pCir->chip.alp->sr0f & 0x18) {
+ case 0x10:
+ videoram = 1024;
+ break;
+ case 0x18:
+ videoram = 2048;
+ if (pCir->chip.alp->sr0f & 0x80)
+ videoram = 4096;
+ break;
+ }
+
+ case PCI_CHIP_GD5446:
+ videoram = 1024;
+
+ if (pCir->chip.alp->sr17 != (CARD32)-1) {
+ from = X_CONFIG;
+ hwp->writeSeq(hwp, 0x17, pCir->chip.alp->sr17);
} else {
- from = X_PROBED;
- pAlp->SR0F = hwp->readSeq(hwp, 0x0F);
+ from = X_PROBED;
+ pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17);
}
- xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 1 is 0x%02X\n",
- pAlp->SR0F);
-
- switch (pAlp->CirRec.Chipset) {
- case PCI_CHIP_GD5430:
-/* case PCI_CHIP_GD5440: */
- switch (pAlp->SR0F & 0x18) {
- case 0x08:
- videoram = 512;
- break;
- case 0x10:
- videoram = 1024;
- break;
- case 0x18:
- videoram = 2048;
- break;
- }
- break;
-
- case PCI_CHIP_GD5434_4:
- case PCI_CHIP_GD5434_8:
- case PCI_CHIP_GD5436:
- switch (pAlp->SR0F & 0x18) {
- case 0x10:
- videoram = 1024;
- break;
- case 0x18:
- videoram = 2048;
- if (pAlp->SR0F & 0x80)
- videoram = 4096;
- break;
- }
-
- case PCI_CHIP_GD5446:
- videoram = 1024;
-
- if (pAlp->SR17 != (CARD32)-1) {
- from = X_CONFIG;
- hwp->writeSeq(hwp, 0x17, pAlp->SR17);
- } else {
- from = X_PROBED;
- pAlp->SR17 = hwp->readSeq(hwp, 0x17);
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n",
- pAlp->SR17);
-
- if ((pAlp->SR0F & 0x18) == 0x18) {
- if (pAlp->SR0F & 0x80) {
- if (pAlp->SR17 & 0x80)
- videoram = 2048;
- else if (pAlp->SR17 & 0x02)
- videoram = 3072;
- else
- videoram = 4096;
- } else {
- if ((pAlp->SR17 & 80) == 0)
- videoram = 2048;
- }
- }
- break;
-
- case PCI_CHIP_GD5480:
- videoram = 1024;
- if ((pAlp->SR0F & 0x18) == 0x18) { /* 2 or 4 MB */
- videoram *= 2048;
- if (pAlp->SR0F & 0x80) /* Second bank enable */
- videoram = 4096;
- }
- break;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n",
+ pCir->chip.alp->sr17);
+
+ if ((pCir->chip.alp->sr0f & 0x18) == 0x18) {
+ if (pCir->chip.alp->sr0f & 0x80) {
+ if (pCir->chip.alp->sr17 & 0x80)
+ videoram = 2048;
+ else if (pCir->chip.alp->sr17 & 0x02)
+ videoram = 3072;
+ else
+ videoram = 4096;
+ } else {
+ if ((pCir->chip.alp->sr17 & 80) == 0)
+ videoram = 2048;
+ }
}
-
- /* UNMap the Alp memory and MMIO areas */
- if (!CirUnmapMem(&pAlp->CirRec, pScrn->scrnIndex))
- return 0;
-
- return videoram;
+ break;
+
+ case PCI_CHIP_GD5480:
+ if (pCir->chip.alp->sr17 != (CARD32)-1) {
+ from = X_CONFIG;
+ hwp->writeSeq(hwp, 0x17, pCir->chip.alp->sr17);
+ } else {
+ from = X_PROBED;
+ pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17);
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n",
+ pCir->chip.alp->sr17);
+ videoram = 1024;
+ if ((pCir->chip.alp->sr0f & 0x18) == 0x18) { /* 2 or 4 MB */
+ videoram = 2048;
+ if (pCir->chip.alp->sr0f & 0x80) /* Second bank enable */
+ videoram = 4096;
+ }
+ if (pCir->chip.alp->sr17 & 0x80)
+ videoram <<= 1;
+ break;
+ }
+
+ /* UNMap the Alp memory and MMIO areas */
+ if (!CirUnmapMem(pCir, pScrn->scrnIndex))
+ return 0;
+ vgaHWSetStdFuncs(hwp);
+
+ return videoram;
}
@@ -466,7 +468,7 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
{
int *linePitches = NULL;
int i, n = 0;
- AlpPtr pAlp = ALPPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
/* XXX ajv - 512, 576, and 1536 may not be supported
line pitches. see sdk pp 4-59 for more
@@ -483,7 +485,7 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
#endif
for (i = 0; accelWidths[i] != 0; i++) {
- if (accelWidths[i] % pAlp->CirRec.Rounding == 0) {
+ if (accelWidths[i] % pCir->Rounding == 0) {
n++;
linePitches = xnfrealloc(linePitches, n * sizeof(int));
linePitches[n - 1] = accelWidths[i];
@@ -502,34 +504,22 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
Bool
AlpPreInit(ScrnInfoPtr pScrn, int flags)
{
- AlpPtr pAlp;
+ CirPtr pCir;
+ vgaHWPtr hwp;
MessageType from;
int i;
ClockRangePtr clockRanges;
char *mod = NULL;
-
+ char *s;
+
#ifdef ALP_DEBUG
ErrorF("AlpPreInit\n");
#endif
- /*
- * Note: This function is only called once at server startup, and
- * not at the start of each server generation. This means that
- * only things that are persistent across server generations can
- * be initialised here. xf86Screens[] is (pScrn is a pointer to one
- * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex()
- * are too, and should be used for data that must persist across
- * server generations.
- *
- * Per-generation data should be allocated with
- * AllocateScreenPrivateIndex() from the ScreenInit() function.
- */
-
/* Check the number of entities, and fail if it isn't one. */
if (pScrn->numEntities != 1)
return FALSE;
- /* The vgahw module should be loaded here when needed */
if (!xf86LoadSubModule(pScrn, "vgahw"))
return FALSE;
@@ -540,34 +530,41 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
*/
if (!vgaHWGetHWRec(pScrn))
return FALSE;
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
/* Allocate the AlpRec driverPrivate */
if (!AlpGetRec(pScrn))
return FALSE;
- pAlp = ALPPTR(pScrn);
- pAlp->CirRec.pScrn = pScrn;
+ pCir = CIRPTR(pScrn);
+ pCir->pScrn = pScrn;
/* Get the entity, and make sure it is PCI. */
- pAlp->CirRec.pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- if (pAlp->CirRec.pEnt->location.type != BUS_PCI)
+ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (pCir->pEnt->location.type != BUS_PCI)
return FALSE;
+ pCir->Chipset = pCir->pEnt->chipset;
/* Find the PCI info for this screen */
- pAlp->CirRec.PciInfo = xf86GetPciInfoForEntity(pAlp->CirRec.pEnt->index);
- pAlp->CirRec.PciTag = pciTag(pAlp->CirRec.PciInfo->bus,
- pAlp->CirRec.PciInfo->device,
- pAlp->CirRec.PciInfo->func);
+ pCir->PciInfo = xf86GetPciInfoForEntity(pCir->pEnt->index);
+ pCir->PciTag = pciTag(pCir->PciInfo->bus,
+ pCir->PciInfo->device,
+ pCir->PciInfo->func);
- /*
- * XXX Check which of the VGA resources are decode and/or actually
- * required in operating mode? For now, assume everything is needed,
- * so don't call xf86SetOperatingState().
- */
- pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
- pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+#if 1
+ if (xf86LoadSubModule(pScrn, "int10")) {
+ xf86Int10InfoPtr pInt;
+ xf86LoaderReqSymLists(int10Symbols,NULL);
+#if 1
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
+ pInt = xf86InitInt10(pCir->pEnt->index);
+ xf86FreeInt10(pInt);
+#endif
+ }
+#endif
- /* Set pScrn->monitor */
+ /* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
/*
@@ -630,17 +627,6 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- /* The gamma fields must be initialised when using the new cmap code */
- if (pScrn->depth > 1) {
- Gamma zeros = {0.0, 0.0, 0.0};
-
- if (!xf86SetGamma(pScrn, zeros))
- return FALSE;
- }
-
- /* We use a programamble clock */
- pScrn->progClock = TRUE;
-
/* Collect all of the relevant option flags (fill in pScrn->options) */
xf86CollectOptions(pScrn, NULL);
@@ -649,83 +635,49 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->rgbBits = 6;
from = X_DEFAULT;
- pAlp->CirRec.HWCursor = FALSE;
- if (xf86GetOptValBool(CirOptions, OPTION_HW_CURSOR, &pAlp->CirRec.HWCursor))
+ pCir->HWCursor = FALSE;
+ if (xf86GetOptValBool(CirOptions, OPTION_HW_CURSOR, &pCir->HWCursor))
from = X_CONFIG;
- if (xf86ReturnOptValBool(CirOptions, OPTION_SW_CURSOR, FALSE)) {
- from = X_CONFIG;
- pAlp->CirRec.HWCursor = FALSE;
- }
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
- pAlp->CirRec.HWCursor ? "HW" : "SW");
+ pCir->HWCursor ? "HW" : "SW");
if (xf86ReturnOptValBool(CirOptions, OPTION_NOACCEL, FALSE)) {
- pAlp->CirRec.NoAccel = TRUE;
+ pCir->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
}
if(pScrn->bitsPerPixel < 8) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Cannot use accelerations in less than 8 bpp\n");
- pAlp->CirRec.NoAccel = TRUE;
+ pCir->NoAccel = TRUE;
}
/*
- * Set the Chipset and ChipRev, allowing config file entries to
+ * Set the ChipRev, allowing config file entries to
* override.
*/
- if (pAlp->CirRec.pEnt->device->chipset && *pAlp->CirRec.pEnt->device->chipset) {
- pScrn->chipset = pAlp->CirRec.pEnt->device->chipset;
- pAlp->CirRec.Chipset = xf86StringToToken(CIRChipsets, pScrn->chipset);
- from = X_CONFIG;
- } else if (pAlp->CirRec.pEnt->device->chipID >= 0) {
- pAlp->CirRec.Chipset = pAlp->CirRec.pEnt->device->chipID;
- pScrn->chipset = (char *)xf86TokenToString(CIRChipsets, pAlp->CirRec.Chipset);
- from = X_CONFIG;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
- pAlp->CirRec.Chipset);
- } else {
- from = X_PROBED;
- pAlp->CirRec.Chipset = pAlp->CirRec.PciInfo->chipType;
- pScrn->chipset = (char *)xf86TokenToString(CIRChipsets, pAlp->CirRec.Chipset);
- }
- if (pAlp->CirRec.pEnt->device->chipRev >= 0) {
- pAlp->CirRec.ChipRev = pAlp->CirRec.pEnt->device->chipRev;
+ if (pCir->pEnt->device->chipRev >= 0) {
+ pCir->ChipRev = pCir->pEnt->device->chipRev;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
- pAlp->CirRec.ChipRev);
+ pCir->ChipRev);
} else {
- pAlp->CirRec.ChipRev = pAlp->CirRec.PciInfo->chipRev;
+ pCir->ChipRev = pCir->PciInfo->chipRev;
}
- /*
- * This shouldn't happen because such problems should be caught in
- * CIRProbe(), but check it just in case.
- */
- if (pScrn->chipset == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "ChipID 0x%04X is not recognised\n", pAlp->CirRec.Chipset);
- return FALSE;
- }
- if (pAlp->CirRec.Chipset < 0) {
+ /* Find the frame buffer base address */
+ if (pCir->pEnt->device->MemBase != 0) {
+ if (!xf86CheckPciMemBase(pCir->PciInfo, pCir->pEnt->device->MemBase)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Chipset \"%s\" is not recognised\n", pScrn->chipset);
+ "MemBase 0x%08lX doesn't match any PCI base register.\n",
+ pCir->pEnt->device->MemBase);
return FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
-
- /* Find the frame buffer base address */
- if (pAlp->CirRec.pEnt->device->MemBase != 0) {
- /*
- * XXX Should check that the config file value matches one of the
- * PCI base address values.
- */
- pAlp->CirRec.FbAddress = pAlp->CirRec.pEnt->device->MemBase;
+ }
+ pCir->FbAddress = pCir->pEnt->device->MemBase;
from = X_CONFIG;
} else {
- if (pAlp->CirRec.PciInfo->memBase[0] != 0) {
+ if (pCir->PciInfo->memBase[0] != 0) {
/* 5446B and 5480 use mask of 0xfe000000.
5446A uses 0xff000000. */
- pAlp->CirRec.FbAddress = pAlp->CirRec.PciInfo->memBase[0] & 0xff000000;
+ pCir->FbAddress = pCir->PciInfo->memBase[0] & 0xff000000;
from = X_PROBED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -735,14 +687,21 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
}
xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
- (unsigned long)pAlp->CirRec.FbAddress);
+ (unsigned long)pCir->FbAddress);
- if (pAlp->CirRec.pEnt->device->IOBase != 0) {
- pAlp->CirRec.IOAddress = pAlp->CirRec.pEnt->device->IOBase;
+ if (pCir->pEnt->device->IOBase != 0) {
+ /* Require that the config file value matches one of the PCI values. */
+ if (!xf86CheckPciMemBase(pCir->PciInfo, pCir->pEnt->device->IOBase)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "IOBase 0x%08lX doesn't match any PCI base register.\n",
+ pCir->pEnt->device->IOBase);
+ return FALSE;
+ }
+ pCir->IOAddress = pCir->pEnt->device->IOBase;
from = X_CONFIG;
} else {
- if (pAlp->CirRec.PciInfo->memBase[1] != 0) {
- pAlp->CirRec.IOAddress = pAlp->CirRec.PciInfo->memBase[1] & 0xfffff000;
+ if (pCir->PciInfo->memBase[1] != 0) {
+ pCir->IOAddress = pCir->PciInfo->memBase[1] & 0xfffff000;
from = X_PROBED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -751,57 +710,141 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
/* We do not really need that YET. */
}
}
- if(pAlp->CirRec.IOAddress != 0) {
+ if(pCir->IOAddress != 0) {
xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
- (unsigned long)pAlp->CirRec.IOAddress);
+ (unsigned long)pCir->IOAddress);
/* Default to MMIO if we have a separate IOAddress and
not in monochrome mode (IO 0x3Bx is not relocated!) */
if (pScrn->bitsPerPixel != 1)
- pAlp->CirRec.UseMMIO = TRUE;
+ pCir->UseMMIO = TRUE;
}
/* User options can override the MMIO default */
#if 0
/* Will we ever support MMIO on 5446A or older? */
if (xf86ReturnOptValBool(CirOptions, OPTION_MMIO, FALSE)) {
- pAlp->CirRec.UseMMIO = TRUE;
+ pCir->UseMMIO = TRUE;
from = X_CONFIG;
}
#endif
if (!xf86ReturnOptValBool(CirOptions, OPTION_MMIO, TRUE)) {
- pAlp->CirRec.UseMMIO = FALSE;
+ pCir->UseMMIO = FALSE;
from = X_CONFIG;
}
- if (pAlp->CirRec.UseMMIO)
+ if (pCir->UseMMIO)
xf86DrvMsg(pScrn->scrnIndex, from, "Using MMIO\n");
+
+ /*
+ * XXX Check if this is correct
+ */
+ if (!pCir->UseMMIO) {
+ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+ xf86SetOperatingState(resVgaMemShared, pCir->pEnt->index,ResUnusedOpr);
+ } else {
+ xf86SetOperatingState(RES_SHARED_VGA, pCir->pEnt->index, ResUnusedOpr);
+ }
+
+ /* Register the PCI-assigned resources. */
+ if (xf86RegisterResources(pCir->pEnt->index, NULL, ResExclusive)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "xf86RegisterResources() found resource conflicts\n");
+ return FALSE;
+ }
+
+ if (!xf86LoadSubModule(pScrn, "i2c")) {
+ AlpFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(i2cSymbols,NULL);
+
+ if (!xf86LoadSubModule(pScrn, "ddc")) {
+ AlpFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
+
+ if(!AlpI2CInit(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "I2C initialization failed\n");
+ }
+ else
+ xf86SetDDCproperties(pScrn,xf86PrintEDID(
+ xf86DoEDID_DDC2(pScrn->scrnIndex,pCir->I2CPtr1)));
+
+#ifdef CIRPROBEI2C
+ CirProbeI2C(pScrn->scrnIndex);
+#endif
+
+ /* The gamma fields must be initialised when using the new cmap code */
+ if (pScrn->depth > 1) {
+ Gamma zeros = {0.0, 0.0, 0.0};
+
+ if (!xf86SetGamma(pScrn, zeros))
+ return FALSE;
+ }
+
+ /* XXX If UseMMIO == TRUE and for any reason we cannot do MMIO,
+ abort here */
- /* Register the PCI-assigned resources. */
- if (xf86RegisterResources(pAlp->CirRec.pEnt->index, NULL, ResExclusive)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "xf86RegisterResources() found resource conflicts\n");
- return FALSE;
+ if (xf86GetOptValBool(CirOptions,
+ OPTION_SHADOW_FB,&pCir->shadowFB))
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n",
+ pCir->shadowFB ? "enabled" : "disabled");
+
+ if ((s = xf86GetOptValString(CirOptions, OPTION_ROTATE))) {
+ if(!xf86NameCmp(s, "CW")) {
+ /* accel is disabled below for shadowFB */
+ pCir->shadowFB = TRUE;
+ pCir->rotate = 1;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen clockwise - acceleration disabled\n");
+ } else if(!xf86NameCmp(s, "CCW")) {
+ pCir->shadowFB = TRUE;
+ pCir->rotate = -1;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen"
+ "counter clockwise - acceleration disabled\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
+ "value for Option \"Rotate\"\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"CW\" or \"CCW\"\n");
+ }
+ }
+ if (pCir->shadowFB && (pScrn->depth < 8)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "shadowFB not supported at this depth.\n");
+ pCir->shadowFB = FALSE;
+ pCir->rotate = 0;
}
- /* XXX If UseMMIO == TRUE and for any reason we cannot do MMIO,
- abort here */
+ if (pCir->shadowFB && !pCir->NoAccel) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "HW acceleration not supported with \"shadowFB\".\n");
+ pCir->NoAccel = TRUE;
+ }
+ if (pCir->rotate && pCir->HWCursor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "HW cursor not supported with \"rotate\".\n");
+ pCir->HWCursor = FALSE;
+ }
+
/* XXX We do not know yet how to configure memory on this card.
Use options MemCFG1 and MemCFG2 to set registers SR0F and
SR17 before trying to count ram size. */
- pAlp->SR0F = (CARD32)-1;
- pAlp->SR17 = (CARD32)-1;
-
- (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG1, &pAlp->SR0F);
- (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG2, &pAlp->SR17);
+ pCir->chip.alp->sr0f = (CARD32)-1;
+ pCir->chip.alp->sr17 = (CARD32)-1;
+ (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG1, (unsigned long *)&pCir->chip.alp->sr0f);
+ (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG2, (unsigned long *)&pCir->chip.alp->sr17);
/*
* If the user has specified the amount of memory in the XF86Config
* file, we respect that setting.
*/
- if (pAlp->CirRec.pEnt->device->videoRam != 0) {
- pScrn->videoRam = pAlp->CirRec.pEnt->device->videoRam;
- pAlp->CirRec.IoMapSize = 0x4000; /* 16K for moment */
+ if (pCir->pEnt->device->videoRam != 0) {
+ pScrn->videoRam = pCir->pEnt->device->videoRam;
+ pCir->IoMapSize = 0x4000; /* 16K for moment */
from = X_CONFIG;
} else {
pScrn->videoRam = AlpCountRam(pScrn);
@@ -809,25 +852,42 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam);
- pAlp->CirRec.FbMapSize = pScrn->videoRam * 1024;
+ pCir->FbMapSize = pScrn->videoRam * 1024;
+
+ /* properties */
+ pCir->properties = 0;
+
+ if ((pCir->chip.alp->sr0f & 0x18) > 0x8)
+ pCir->properties |= HWCUR64;
+ switch (pCir->Chipset) {
+ case PCI_CHIP_GD5436:
+ case PCI_CHIP_GD5480:
+ pCir->properties |= ACCEL_AUTOSTART;
+ break;
+ default:
+ break;
+ }
+ /* We use a programamble clock */
+ pScrn->progClock = TRUE;
+
/* XXX Set HW cursor use */
/* Set the min pixel clock */
- pAlp->CirRec.MinClock = 12000; /* XXX Guess, need to check this */
+ pCir->MinClock = 12000; /* XXX Guess, need to check this */
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n",
- pAlp->CirRec.MinClock / 1000);
+ pCir->MinClock / 1000);
/*
* If the user has specified ramdac speed in the XF86Config
* file, we respect that setting.
*/
- if (pAlp->CirRec.pEnt->device->dacSpeeds[0]) {
+ if (pCir->pEnt->device->dacSpeeds[0]) {
ErrorF("Do not specily a Clocks line for Cirrus chips\n");
return FALSE;
} else {
int speed;
int *p = NULL;
- switch (pAlp->CirRec.Chipset) {
+ switch (pCir->Chipset) {
case PCI_CHIP_GD5430:
case PCI_CHIP_GD5434_4:
case PCI_CHIP_GD5434_8:
@@ -867,11 +927,11 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
speed = 0;
break;
}
- pAlp->CirRec.MaxClock = speed;
+ pCir->MaxClock = speed;
from = X_PROBED;
}
xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n",
- pAlp->CirRec.MaxClock / 1000);
+ pCir->MaxClock / 1000);
/*
* Setup the ClockRanges, which describe what clock ranges are available,
@@ -879,8 +939,8 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
*/
clockRanges = xnfalloc(sizeof(ClockRange));
clockRanges->next = NULL;
- clockRanges->minClock = pAlp->CirRec.MinClock;
- clockRanges->maxClock = pAlp->CirRec.MaxClock;
+ clockRanges->minClock = pCir->MinClock;
+ clockRanges->maxClock = pCir->MaxClock;
clockRanges->clockIndex = -1; /* programmable */
clockRanges->interlaceAllowed = FALSE; /* XXX check this */
clockRanges->doubleScanAllowed = FALSE; /* XXX check this */
@@ -890,13 +950,13 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->ClockDivFactor = 1;
clockRanges->PrivFlags = 0;
- pAlp->CirRec.Rounding = 128 >> pAlp->CirRec.BppShift;
+ pCir->Rounding = 128 >> pCir->BppShift;
#if 0
- if (pAlp->CirRec.Chipset != PCI_CHIP_GD5446 &&
- pAlp->CirRec.Chipset != PCI_CHIP_GD5480) {
+ if (pCir->Chipset != PCI_CHIP_GD5446 &&
+ pCir->Chipset != PCI_CHIP_GD5480) {
/* XXX Kludge */
- pAlp->CirRec.NoAccel = TRUE;
+ pCir->NoAccel = TRUE;
}
#endif
@@ -908,7 +968,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
*/
/* Select valid modes from those available */
- if (pAlp->CirRec.NoAccel) {
+ if (pCir->NoAccel) {
/*
* XXX Assuming min pitch 256, max 2048
* XXX Assuming min height 128, max 2048
@@ -916,10 +976,10 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
NULL, 256, 2048,
- pAlp->CirRec.Rounding * pScrn->bitsPerPixel, 128, 2048,
+ pCir->Rounding * pScrn->bitsPerPixel, 128, 2048,
pScrn->display->virtualX,
pScrn->display->virtualY,
- pAlp->CirRec.FbMapSize,
+ pCir->FbMapSize,
LOOKUP_BEST_REFRESH);
} else {
/*
@@ -928,10 +988,10 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
GetAccelPitchValues(pScrn), 0, 0,
- pAlp->CirRec.Rounding * pScrn->bitsPerPixel, 128, 2048,
+ pCir->Rounding * pScrn->bitsPerPixel, 128, 2048,
pScrn->display->virtualX,
pScrn->display->virtualY,
- pAlp->CirRec.FbMapSize,
+ pCir->FbMapSize,
LOOKUP_BEST_REFRESH);
}
if (i == -1) {
@@ -987,7 +1047,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Load XAA if needed */
- if (!pAlp->CirRec.NoAccel) {
+ if (!pCir->NoAccel) {
if (!xf86LoadSubModule(pScrn, "xaa")) {
AlpFreeRec(pScrn);
return FALSE;
@@ -996,7 +1056,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Load ramdac if needed */
- if (pAlp->CirRec.HWCursor) {
+ if (pCir->HWCursor) {
if (!xf86LoadSubModule(pScrn, "ramdac")) {
AlpFreeRec(pScrn);
return FALSE;
@@ -1004,17 +1064,13 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(ramdacSymbols, NULL);
}
- if (!xf86LoadSubModule(pScrn, "i2c")) {
+ if (pCir->shadowFB) {
+ if (!xf86LoadSubModule(pScrn, "shadowfb")) {
AlpFreeRec(pScrn);
return FALSE;
+ }
+ xf86LoaderReqSymLists(shadowSymbols, NULL);
}
- xf86LoaderReqSymLists(i2cSymbols,NULL);
-
- if (!xf86LoadSubModule(pScrn, "ddc")) {
- AlpFreeRec(pScrn);
- return FALSE;
- }
- xf86LoaderReqSymLists(ddcSymbols, NULL);
return TRUE;
}
@@ -1025,52 +1081,32 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
static void
AlpSave(ScrnInfoPtr pScrn)
{
- AlpPtr pAlp;
- vgaHWPtr hwp;
+ CirPtr pCir = CIRPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpSave\n");
#endif
-
- hwp = VGAHWPTR(pScrn);
- pAlp = ALPPTR(pScrn);
-
vgaHWSave(pScrn, &VGAHWPTR(pScrn)->SavedReg, VGA_SR_ALL);
-#if 1
- pAlp->ModeReg.ExtVga[CR1A] = pAlp->SavedReg.ExtVga[CR1A] = hwp->readCrtc(hwp, 0x1A);
- pAlp->ModeReg.ExtVga[CR1B] = pAlp->SavedReg.ExtVga[CR1B] = hwp->readCrtc(hwp, 0x1B);
- pAlp->ModeReg.ExtVga[CR1D] = pAlp->SavedReg.ExtVga[CR1D] = hwp->readCrtc(hwp, 0x1D);
- pAlp->ModeReg.ExtVga[SR07] = pAlp->SavedReg.ExtVga[SR07] = hwp->readSeq(hwp, 0x07);
- pAlp->ModeReg.ExtVga[SR0E] = pAlp->SavedReg.ExtVga[SR0E] = hwp->readSeq(hwp, 0x0E);
- pAlp->ModeReg.ExtVga[SR12] = pAlp->SavedReg.ExtVga[SR12] = hwp->readSeq(hwp, 0x12);
- pAlp->ModeReg.ExtVga[SR13] = pAlp->SavedReg.ExtVga[SR13] = hwp->readSeq(hwp, 0x13);
- pAlp->ModeReg.ExtVga[SR1E] = pAlp->SavedReg.ExtVga[SR1E] = hwp->readSeq(hwp, 0x1E);
- pAlp->ModeReg.ExtVga[GR17] = pAlp->SavedReg.ExtVga[GR17] = hwp->readGr(hwp, 0x17);
- pAlp->ModeReg.ExtVga[GR18] = pAlp->SavedReg.ExtVga[GR18] = hwp->readGr(hwp, 0x18);
- /* The first 4 reads are for the pixel mask register. After 4 times that
- this register is accessed in succession reading/writing this address
- accesses the HDR. */
- hwp->readDacMask(hwp); hwp->readDacMask(hwp);
- hwp->readDacMask(hwp); hwp->readDacMask(hwp);
- pAlp->ModeReg.ExtVga[HDR] = pAlp->SavedReg.ExtVga[HDR] = hwp->readDacMask(hwp);
-#else
- outb(hwp->IOBase+4, 0x1A); pAlp->ModeReg.ExtVga[CR1A] = pAlp->SavedReg.ExtVga[CR1A] = inb(hwp->IOBase + 5);
- outb(hwp->IOBase+4, 0x1B); pAlp->ModeReg.ExtVga[CR1B] = pAlp->SavedReg.ExtVga[CR1B] = inb(hwp->IOBase + 5);
- outb(hwp->IOBase+4, 0x1D); pAlp->ModeReg.ExtVga[CR1D] = pAlp->SavedReg.ExtVga[CR1D] = inb(hwp->IOBase + 5);
- outb(0x3C4, 0x07); pAlp->ModeReg.ExtVga[SR07] = pAlp->SavedReg.ExtVga[SR07] = inb(0x3C5);
- outb(0x3C4, 0x0E); pAlp->ModeReg.ExtVga[SR0E] = pAlp->SavedReg.ExtVga[SR0E] = inb(0x3C5);
- outb(0x3C4, 0x12); pAlp->ModeReg.ExtVga[SR12] = pAlp->SavedReg.ExtVga[SR12] = inb(0x3C5);
- outb(0x3C4, 0x13); pAlp->ModeReg.ExtVga[SR13] = pAlp->SavedReg.ExtVga[SR13] = inb(0x3C5);
- outb(0x3C4, 0x1E); pAlp->ModeReg.ExtVga[SR1E] = pAlp->SavedReg.ExtVga[SR1E] = inb(0x3C5);
- outb(0x3CE, 0x17); pAlp->ModeReg.ExtVga[GR17] = pAlp->SavedReg.ExtVga[GR17] = inb(0x3CF);
- outb(0x3CE, 0x18); pAlp->ModeReg.ExtVga[GR18] = pAlp->SavedReg.ExtVga[GR18] = inb(0x3CF);
+ pCir->chip.alp->ModeReg.ExtVga[CR1A] = pCir->chip.alp->SavedReg.ExtVga[CR1A] = hwp->readCrtc(hwp, 0x1A);
+ pCir->chip.alp->ModeReg.ExtVga[CR1B] = pCir->chip.alp->SavedReg.ExtVga[CR1B] = hwp->readCrtc(hwp, 0x1B);
+ pCir->chip.alp->ModeReg.ExtVga[CR1D] = pCir->chip.alp->SavedReg.ExtVga[CR1D] = hwp->readCrtc(hwp, 0x1D);
+ pCir->chip.alp->ModeReg.ExtVga[SR07] = pCir->chip.alp->SavedReg.ExtVga[SR07] = hwp->readSeq(hwp, 0x07);
+ pCir->chip.alp->ModeReg.ExtVga[SR0E] = pCir->chip.alp->SavedReg.ExtVga[SR0E] = hwp->readSeq(hwp, 0x0E);
+ pCir->chip.alp->ModeReg.ExtVga[SR12] = pCir->chip.alp->SavedReg.ExtVga[SR12] = hwp->readSeq(hwp, 0x12);
+ pCir->chip.alp->ModeReg.ExtVga[SR13] = pCir->chip.alp->SavedReg.ExtVga[SR13] = hwp->readSeq(hwp, 0x13);
+ pCir->chip.alp->ModeReg.ExtVga[SR1E] = pCir->chip.alp->SavedReg.ExtVga[SR1E] = hwp->readSeq(hwp, 0x1E);
+ pCir->chip.alp->ModeReg.ExtVga[GR17] = pCir->chip.alp->SavedReg.ExtVga[GR17] = hwp->readGr(hwp, 0x17);
+ pCir->chip.alp->ModeReg.ExtVga[GR18] = pCir->chip.alp->SavedReg.ExtVga[GR18] = hwp->readGr(hwp, 0x18);
/* The first 4 reads are for the pixel mask register. After 4 times that
this register is accessed in succession reading/writing this address
accesses the HDR. */
- inb(0x3C6); inb(0x3C6); inb(0x3C6); inb(0x3C6);
- pAlp->ModeReg.ExtVga[HDR] = pAlp->SavedReg.ExtVga[HDR] = inb(0x3C6);
-#endif
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ pCir->chip.alp->ModeReg.ExtVga[HDR] = pCir->chip.alp->SavedReg.ExtVga[HDR] = hwp->readDacMask(hwp);
}
/* XXX */
@@ -1083,15 +1119,33 @@ AlpFix1bppColorMap(ScrnInfoPtr pScrn)
black. I'm sure there's a better way to do that, just lazy to
search the docs. */
-#if 1
hwp->writeDacWriteAddr(hwp, 0x00);
hwp->writeDacData(hwp, 0x00); hwp->writeDacData(hwp, 0x00); hwp->writeDacData(hwp, 0x00);
hwp->writeDacWriteAddr(hwp, 0x3F);
hwp->writeDacData(hwp, 0x3F); hwp->writeDacData(hwp, 0x3F); hwp->writeDacData(hwp, 0x3F);
-#else
- outb(0x3C8, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00);
- outb(0x3C8, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F);
-#endif
+}
+
+static void
+alpRestore(vgaHWPtr hwp, AlpRegPtr cirReg)
+{
+ hwp->writeCrtc(hwp, 0x1A, cirReg->ExtVga[CR1A]);
+ hwp->writeCrtc(hwp, 0x1B, cirReg->ExtVga[CR1B]);
+ hwp->writeCrtc(hwp, 0x1D, cirReg->ExtVga[CR1D]);
+ hwp->writeSeq(hwp, 0x07, cirReg->ExtVga[SR07]);
+ hwp->writeSeq(hwp, 0x0E, cirReg->ExtVga[SR0E]);
+ hwp->writeSeq(hwp, 0x12, cirReg->ExtVga[SR12]);
+ hwp->writeSeq(hwp, 0x13, cirReg->ExtVga[SR13]);
+ hwp->writeSeq(hwp, 0x1E, cirReg->ExtVga[SR1E]);
+ hwp->writeGr(hwp, 0x17, cirReg->ExtVga[GR17]);
+ hwp->writeGr(hwp, 0x18, cirReg->ExtVga[GR18]);
+ /* The first 4 reads are for the pixel mask register. After 4 times that
+ this register is accessed in succession reading/writing this address
+ accesses the HDR. */
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ hwp->readDacMask(hwp);
+ hwp->writeDacMask(hwp, cirReg->ExtVga[HDR ]);
}
@@ -1099,6 +1153,7 @@ AlpFix1bppColorMap(ScrnInfoPtr pScrn)
* Initialise a new mode. This is currently still using the old
* "initialise struct, restore/write struct to HW" model. That could
* be changed.
+ * Why?? (EE)
*/
static Bool
@@ -1106,7 +1161,7 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
vgaHWPtr hwp;
vgaRegPtr vgaReg;
- AlpPtr pAlp;
+ CirPtr pCir;
int depthcode;
int width;
Bool HDiv2 = FALSE, VDiv2 = FALSE;
@@ -1127,16 +1182,18 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
ErrorF("AlpModeInit: depth %d bits\n", pScrn->depth);
#endif
- pAlp = ALPPTR(pScrn);
+ pCir = CIRPTR(pScrn);
hwp = VGAHWPTR(pScrn);
vgaHWUnlock(hwp);
+ pCir->pitch = pScrn->displayWidth * pScrn->bitsPerPixel >> 3;
+
depthcode = pScrn->depth;
if (pScrn->bitsPerPixel == 32)
depthcode = 32;
- if ((pAlp->CirRec.Chipset == PCI_CHIP_GD5480 && mode->Clock > 135100) ||
- (pAlp->CirRec.Chipset == PCI_CHIP_GD5446 && mode->Clock > 85500)) {
+ if ((pCir->Chipset == PCI_CHIP_GD5480 && mode->Clock > 135100) ||
+ (pCir->Chipset == PCI_CHIP_GD5446 && mode->Clock > 85500)) {
/* The actual DAC register value is set later. */
/* The CRTC is clocked at VCLK / 2, so we must half the */
/* horizontal timings. */
@@ -1170,16 +1227,13 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
pScrn->vtSema = TRUE;
- /* Program the registers */
- vgaHWProtect(pScrn, TRUE);
-
/* Turn off HW cursor, gamma correction, overscan color protect. */
- pAlp->ModeReg.ExtVga[SR12] = 0;
-#if 1
- hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]);
-#else
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR12] << 8) | 0x12);
-#endif
+ pCir->chip.alp->ModeReg.ExtVga[SR12] = 0;
+ if ((pCir->properties & HWCUR64) == HWCUR64)
+ pCir->chip.alp->ModeReg.ExtVga[SR12] = 0x4;
+ else
+ pCir->chip.alp->ModeReg.ExtVga[SR12] = 0;
+
if(VDiv2)
hwp->ModeReg.CRTC[0x17] |= 0x04;
@@ -1187,22 +1241,16 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifdef ALP_DEBUG
ErrorF("SynthClock = %d\n", mode->SynthClock);
#endif
- AlpSetClock(&pAlp->CirRec, hwp, mode->SynthClock);
/* Disable DCLK pin driver, interrupts. */
- pAlp->ModeReg.ExtVga[GR17] |= 0x08;
- pAlp->ModeReg.ExtVga[GR17] &= ~0x04;
-#if 1
- hwp->writeGr(hwp, 0x17, pAlp->ModeReg.ExtVga[GR17]);
-#else
- outw(0x3CE, (pAlp->ModeReg.ExtVga[GR17] << 8) | 0x17);
-#endif
+ pCir->chip.alp->ModeReg.ExtVga[GR17] |= 0x08;
+ pCir->chip.alp->ModeReg.ExtVga[GR17] &= ~0x04;
vgaReg = &hwp->ModeReg;
- pAlp->ModeReg.ExtVga[HDR] = 0;
+ pCir->chip.alp->ModeReg.ExtVga[HDR] = 0;
/* Enable linear mode and high-res packed pixel mode */
- pAlp->ModeReg.ExtVga[SR07] &= 0xe0;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] &= 0xe0;
#ifdef ALP_DEBUG
ErrorF("depthcode = %d\n", depthcode);
#endif
@@ -1218,37 +1266,37 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
switch (depthcode) {
case 1:
case 4:
- pAlp->ModeReg.ExtVga[SR07] |= 0x10;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x10;
break;
case 8:
- pAlp->ModeReg.ExtVga[SR07] |= 0x11;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x11;
break;
case 64+8:
- pAlp->ModeReg.ExtVga[SR07] |= 0x17;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x17;
break;
case 15:
- pAlp->ModeReg.ExtVga[SR07] |= 0x17;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC0;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x17;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC0;
break;
case 64+15:
- pAlp->ModeReg.ExtVga[SR07] |= 0x19;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC0;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x19;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC0;
break;
case 16:
- pAlp->ModeReg.ExtVga[SR07] |= 0x17;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC1;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x17;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC1;
break;
case 64+16:
- pAlp->ModeReg.ExtVga[SR07] |= 0x19;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC1;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x19;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC1;
break;
case 24:
- pAlp->ModeReg.ExtVga[SR07] |= 0x15;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC5;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x15;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC5;
break;
case 32:
- pAlp->ModeReg.ExtVga[SR07] |= 0x19;
- pAlp->ModeReg.ExtVga[HDR ] = 0xC5;
+ pCir->chip.alp->ModeReg.ExtVga[SR07] |= 0x19;
+ pCir->chip.alp->ModeReg.ExtVga[HDR ] = 0xC5;
break;
default:
ErrorF("X11: Internal error: AlpModeInit: Cannot Initialize display to requested mode\n");
@@ -1258,54 +1306,29 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
}
if (HDiv2)
- pAlp->ModeReg.ExtVga[GR18] |= 0x20;
+ pCir->chip.alp->ModeReg.ExtVga[GR18] |= 0x20;
else
- pAlp->ModeReg.ExtVga[GR18] &= ~0x20;
+ pCir->chip.alp->ModeReg.ExtVga[GR18] &= ~0x20;
/* No support for interlace (yet) */
- pAlp->ModeReg.ExtVga[CR1A] = 0x00;
-
-#if 1
- hwp->writeGr(hwp, 0x18, pAlp->ModeReg.ExtVga[GR18]);
-#else
- outw(0x3CE, (pAlp->ModeReg.ExtVga[GR18] << 8) | 0x18);
-#endif
-
-#if 1
- hwp->writeMiscOut(hwp, hwp->ModeReg.MiscOutReg);
-#else
- outb(0x3C2, hwp->ModeReg.MiscOutReg);
-#endif
-
-#if 1
- hwp->writeSeq(hwp, 0x07, pAlp->ModeReg.ExtVga[SR07]);
- hwp->readDacMask(hwp); hwp->readDacMask(hwp); hwp->readDacMask(hwp); hwp->readDacMask(hwp);
- hwp->writeDacMask(hwp, pAlp->ModeReg.ExtVga[HDR ]);
-#else
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR07] << 8) | 0x07);
- inb(0x3C6); inb(0x3C6); inb(0x3C6); inb(0x3C6);
- outb(0x3C6, pAlp->ModeReg.ExtVga[HDR ]);
-#endif
+ pCir->chip.alp->ModeReg.ExtVga[CR1A] = 0x00;
width = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
if (pScrn->bitsPerPixel == 1)
width <<= 2;
hwp->ModeReg.CRTC[0x13] = width >> 3;
/* Offset extension (see CR13) */
- pAlp->ModeReg.ExtVga[CR1B] &= 0xAF;
- pAlp->ModeReg.ExtVga[CR1B] |= (width >> (3+4)) & 0x10;
- pAlp->ModeReg.ExtVga[CR1B] |= (width >> (3+3)) & 0x40;
- pAlp->ModeReg.ExtVga[CR1B] |= 0x22;
-
-#if 1
- hwp->writeCrtc(hwp, 0x1A, pAlp->ModeReg.ExtVga[CR1A]);
- hwp->writeCrtc(hwp, 0x1B, pAlp->ModeReg.ExtVga[CR1B]);
-#else
- outw(hwp->IOBase + 4, (pAlp->ModeReg.ExtVga[CR1A] << 8) | 0x1A);
- outw(hwp->IOBase + 4, (pAlp->ModeReg.ExtVga[CR1B] << 8) | 0x1B);
-#endif
+ pCir->chip.alp->ModeReg.ExtVga[CR1B] &= 0xAF;
+ pCir->chip.alp->ModeReg.ExtVga[CR1B] |= (width >> (3+4)) & 0x10;
+ pCir->chip.alp->ModeReg.ExtVga[CR1B] |= (width >> (3+3)) & 0x40;
+ pCir->chip.alp->ModeReg.ExtVga[CR1B] |= 0x22;
/* Programme the registers */
+ vgaHWProtect(pScrn, TRUE);
+ hwp->writeMiscOut(hwp, hwp->ModeReg.MiscOutReg);
+ alpRestore(hwp,&pCir->chip.alp->ModeReg);
+ AlpSetClock(pCir, hwp, mode->SynthClock);
+
vgaHWRestore(pScrn, &hwp->ModeReg, VGA_SR_MODE | VGA_SR_CMAP);
/* XXX */
@@ -1325,7 +1348,7 @@ AlpRestore(ScrnInfoPtr pScrn)
{
vgaHWPtr hwp;
vgaRegPtr vgaReg;
- AlpPtr pAlp;
+ CirPtr pCir;
AlpRegPtr alpReg;
#ifdef ALP_DEBUG
@@ -1333,50 +1356,15 @@ AlpRestore(ScrnInfoPtr pScrn)
#endif
hwp = VGAHWPTR(pScrn);
- pAlp = ALPPTR(pScrn);
+ pCir = CIRPTR(pScrn);
vgaReg = &hwp->SavedReg;
- alpReg = &pAlp->SavedReg;
+ alpReg = &pCir->chip.alp->SavedReg;
vgaHWProtect(pScrn, TRUE);
-#if 1
- hwp->writeCrtc(hwp, 0x1A, alpReg->ExtVga[CR1A]);
- hwp->writeCrtc(hwp, 0x1B, alpReg->ExtVga[CR1B]);
- hwp->writeCrtc(hwp, 0x1D, alpReg->ExtVga[CR1D]);
- hwp->writeSeq(hwp, 0x07, alpReg->ExtVga[SR07]);
- hwp->writeSeq(hwp, 0x0E, alpReg->ExtVga[SR0E]);
- hwp->writeSeq(hwp, 0x12, alpReg->ExtVga[SR12]);
- hwp->writeSeq(hwp, 0x13, alpReg->ExtVga[SR13]);
- hwp->writeSeq(hwp, 0x1E, alpReg->ExtVga[SR1E]);
- hwp->writeGr(hwp, 0x17, alpReg->ExtVga[GR17]);
- hwp->writeGr(hwp, 0x18, alpReg->ExtVga[GR18]);
- /* The first 4 reads are for the pixel mask register. After 4 times that
- this register is accessed in succession reading/writing this address
- accesses the HDR. */
- hwp->readDacMask(hwp); hwp->readDacMask(hwp); hwp->readDacMask(hwp); hwp->readDacMask(hwp);
- hwp->writeDacMask(hwp, pAlp->SavedReg.ExtVga[HDR]);
-#else
- outw(hwp->IOBase + 4, (alpReg->ExtVga[CR1A] << 8) | 0x1A);
- outw(hwp->IOBase + 4, (alpReg->ExtVga[CR1B] << 8) | 0x1B);
- outw(hwp->IOBase + 4, (alpReg->ExtVga[CR1D] << 8) | 0x1D);
- outw(0x3C4, (alpReg->ExtVga[SR07] << 8) | 0x07);
- outw(0x3C4, (alpReg->ExtVga[SR0E] << 8) | 0x0E);
- outw(0x3C4, (alpReg->ExtVga[SR12] << 8) | 0x12);
- outw(0x3C4, (alpReg->ExtVga[SR13] << 8) | 0x13);
- outw(0x3C4, (alpReg->ExtVga[SR1E] << 8) | 0x1E);
- outw(0x3CE, (alpReg->ExtVga[GR17] << 8) | 0x17);
- outw(0x3CE, (alpReg->ExtVga[GR18] << 8) | 0x18);
- /* The first 4 reads are for the pixel mask register. After 4 times that
- this register is accessed in succession reading/writing this address
- accesses the HDR. */
- inb(0x3C6); inb(0x3C6); inb(0x3C6); inb(0x3C6);
- outb(0x3C6, pAlp->SavedReg.ExtVga[HDR]);
-#endif
-
- if (xf86IsPrimaryPci(pAlp->CirRec.PciInfo))
- vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
- else
- vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
+ alpRestore(hwp,alpReg);
+
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
vgaHWProtect(pScrn, FALSE);
}
@@ -1387,13 +1375,14 @@ AlpRestore(ScrnInfoPtr pScrn)
Bool
AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
- /* The vgaHW references will disappear one day */
ScrnInfoPtr pScrn;
vgaHWPtr hwp;
- AlpPtr pAlp;
+ CirPtr pCir;
int i, ret;
VisualPtr visual;
-
+ int displayWidth,width,height;
+ unsigned char * FbBase = NULL;
+
#ifdef ALP_DEBUG
ErrorF("AlpScreenInit\n");
#endif
@@ -1404,21 +1393,18 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn = xf86Screens[pScreen->myNum];
hwp = VGAHWPTR(pScrn);
- pAlp = ALPPTR(pScrn);
+ pCir = CIRPTR(pScrn);
/* Map the VGA memory when the primary video */
- if (xf86IsPrimaryPci(pAlp->CirRec.PciInfo)) {
- hwp->MapSize = 0x10000; /* Standard 64k VGA window */
- if (!vgaHWMapMem(pScrn))
- return FALSE;
- }
+ if (!vgaHWMapMem(pScrn))
+ return FALSE;
/* Map the Alp memory and MMIO areas */
- if (!CirMapMem(&pAlp->CirRec, pScrn->scrnIndex))
+ if (!CirMapMem(pCir, pScrn->scrnIndex))
return FALSE;
- if(pAlp->CirRec.UseMMIO)
- vgaHWSetMmioFuncs(hwp, pAlp->CirRec.IOBase, -0x3C0);
+ if(pCir->UseMMIO)
+ vgaHWSetMmioFuncs(hwp, pCir->IOBase, -0x3C0);
vgaHWGetIOBase(hwp);
@@ -1472,7 +1458,25 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef ALP_DEBUG
ErrorF("AlpScreenInit after miSetVisualTypes\n");
#endif
-
+ displayWidth = pScrn->displayWidth;
+ if (pCir->rotate) {
+ height = pScrn->virtualX;
+ width = pScrn->virtualY;
+ } else {
+ width = pScrn->virtualX;
+ height = pScrn->virtualY;
+ }
+
+ if(pCir->shadowFB) {
+ pCir->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+ pCir->ShadowPtr = xalloc(pCir->ShadowPitch * height);
+ displayWidth = pCir->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FbBase = pCir->ShadowPtr;
+ } else {
+ pCir->ShadowPtr = NULL;
+ FbBase = pCir->FbBase;
+ }
+
/*
* Call the framebuffer layer's ScreenInit function, and fill in other
* pScreen fields.
@@ -1480,53 +1484,53 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
switch (pScrn->bitsPerPixel) {
case 1:
- ret = xf1bppScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ ret = xf1bppScreenInit(pScreen, FbBase,
+ width, height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
case 4:
- ret = xf4bppScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ ret = xf4bppScreenInit(pScreen, FbBase,
+ width, height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
case 8:
- ret = cfbScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ ret = cfbScreenInit(pScreen, FbBase,
+ width,height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
case 16:
- ret = cfb16ScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ ret = cfb16ScreenInit(pScreen, FbBase,
+ width,height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
case 24:
- if (pix24bpp == 24)
- ret = cfb24ScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- else
- ret = cfb24_32ScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ if (pix24bpp == 24)
+ ret = cfb24ScreenInit(pScreen, FbBase,
+ width,height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ else
+ ret = cfb24_32ScreenInit(pScreen, FbBase,
+ width,height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
case 32:
- ret = cfb32ScreenInit(pScreen, pAlp->CirRec.FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
+ ret = cfb32ScreenInit(pScreen, FbBase,
+ width,height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth);
+ break;
default:
- xf86DrvMsg(scrnIndex, X_ERROR,
- "X11: Internal error: invalid bpp (%d) in AlpScreenInit\n",
- pScrn->bitsPerPixel);
- ret = FALSE;
- break;
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "X11: Internal error: invalid bpp (%d) in AlpScreenInit\n",
+ pScrn->bitsPerPixel);
+ ret = FALSE;
+ break;
}
if (!ret)
return FALSE;
@@ -1557,8 +1561,8 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
xf86SetBlackWhitePixels(pScreen);
- if (!pAlp->CirRec.NoAccel) { /* Initialize XAA functions */
- if (!(pAlp->CirRec.UseMMIO ? AlpXAAInitMMIO(pScreen) :
+ if (!pCir->NoAccel) { /* Initialize XAA functions */
+ if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) :
AlpXAAInit(pScreen)))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not initialize XAA\n");
}
@@ -1566,8 +1570,17 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Initialise cursor functions */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
- if (pAlp->CirRec.HWCursor) { /* Initialize HW cursor layer */
- if (!AlpHWCursorInit(pScreen))
+ if (pCir->HWCursor) { /* Initialize HW cursor layer */
+ int offscreen_size = pScrn->videoRam * 1024 -
+ (BitmapBytePad(pScrn->displayWidth
+ * pScrn->bitsPerPixel) * pScrn->virtualY);
+ int cursor_size = 32;
+ if ((pCir->properties & HWCUR64)
+ && (offscreen_size >= 64*8*2))
+ cursor_size = 64;
+ else if (offscreen_size < 32*4*2)
+ cursor_size = 0;
+ if (!AlpHWCursorInit(pScreen,cursor_size))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Hardware cursor initialization failed\n");
}
@@ -1575,15 +1588,25 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!AlpDGAInit(pScreen))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DGA initialization failed\n");
#endif
-
- if (!AlpI2CInit(pScrn))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I2C initialization failed\n");
- else
- xf86PrintEDID(xf86DoEDID_DDC2(pScrn->scrnIndex, pAlp->CirRec.I2CPtr1));
-
-#ifdef ALPPROBEI2C
- AlpProbeI2C(pScrn->scrnIndex);
-#endif
+ if (pCir->shadowFB) {
+ RefreshAreaFuncPtr refreshArea = cirRefreshArea;
+
+ if(pCir->rotate) {
+ if (!pCir->PointerMoved) {
+ pCir->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = cirPointerMoved;
+ }
+
+ switch(pScrn->bitsPerPixel) {
+ case 8: refreshArea = cirRefreshArea8; break;
+ case 16: refreshArea = cirRefreshArea16; break;
+ case 24: refreshArea = cirRefreshArea24; break;
+ case 32: refreshArea = cirRefreshArea32; break;
+ }
+ }
+
+ ShadowFBInit(pScreen, refreshArea);
+ }
/* Initialise default colourmap */
if (!miCreateDefColormap(pScreen))
@@ -1596,7 +1619,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DPMSInit(pScreen, AlpDisplayPowerManagementSet, 0);
#endif
- pScrn->memPhysBase = pAlp->CirRec.FbAddress;
+ pScrn->memPhysBase = pCir->FbAddress;
pScrn->fbOffset = 0;
#ifdef XvExtension
@@ -1614,7 +1637,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* Wrap the CloseScreen vector and set SaveScreen.
*/
pScreen->SaveScreen = AlpSaveScreen;
- pAlp->CirRec.CloseScreen = pScreen->CloseScreen;
+ pCir->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = AlpCloseScreen;
/* Report any unused options (only for the first generation) */
@@ -1662,34 +1685,17 @@ AlpAdjustFrame(int scrnIndex, int x, int y, int flags)
return;
}
-#if 1
hwp->writeCrtc(hwp, 0x0C, (Base >> 8) & 0xff);
hwp->writeCrtc(hwp, 0x0D, Base & 0xff);
tmp = hwp->readCrtc(hwp, 0x1B);
-#else
- outw(hwp->IOBase + 4, (Base & 0x00FF00) | 0x0C);
- outw(hwp->IOBase + 4, ((Base & 0x0000FF) << 8) | 0x0D);
- outb(hwp->IOBase + 4, 0x1B);
- tmp = inb(hwp->IOBase + 5);
-#endif
tmp &= 0xF2;
tmp |= (Base >> 16) & 0x01;
tmp |= (Base >> 15) & 0x0C;
-#if 1
hwp->writeCrtc(hwp, 0x1B, tmp);
tmp = hwp->readCrtc(hwp, 0x1D);
-#else
- outb(hwp->IOBase + 5, tmp);
- outb(hwp->IOBase + 4, 0x1D);
- tmp = inb(hwp->IOBase + 5);
-#endif
tmp &= 0x7F;
tmp |= (Base >> 12) & 0x80;
-#if 1
hwp->writeCrtc(hwp, 0x1D, tmp);
-#else
- outb(hwp->IOBase + 5, tmp);
-#endif
}
/*
@@ -1748,27 +1754,27 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
vgaHWPtr hwp = VGAHWPTR(pScrn);
- AlpPtr pAlp = ALPPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
AlpRestore(pScrn);
vgaHWLock(hwp);
- CirUnmapMem(&pAlp->CirRec, pScrn->scrnIndex);
- if (pAlp->CirRec.AccelInfoRec)
- XAADestroyInfoRec(pAlp->CirRec.AccelInfoRec);
- pAlp->CirRec.AccelInfoRec = NULL;
- if (pAlp->CirRec.CursorInfoRec)
- xf86DestroyCursorInfoRec(pAlp->CirRec.CursorInfoRec);
- pAlp->CirRec.CursorInfoRec = NULL;
+ CirUnmapMem(pCir, pScrn->scrnIndex);
+ if (pCir->AccelInfoRec)
+ XAADestroyInfoRec(pCir->AccelInfoRec);
+ pCir->AccelInfoRec = NULL;
+ if (pCir->CursorInfoRec)
+ xf86DestroyCursorInfoRec(pCir->CursorInfoRec);
+ pCir->CursorInfoRec = NULL;
#if 0
- if (pAlp->CirRec.DGAInfo)
- DGADestroyInfoRec(pAlp->CirRec.DGAInfo);
- pAlp->CirRec.DGAInfo = NULL;
+ if (pCir->DGAInfo)
+ DGADestroyInfoRec(pCir->DGAInfo);
+ pCir->DGAInfo = NULL;
#endif
pScrn->vtSema = FALSE;
- pScreen->CloseScreen = pAlp->CirRec.CloseScreen;
+ pScreen->CloseScreen = pCir->CloseScreen;
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
@@ -1786,7 +1792,8 @@ AlpFreeScreen(int scrnIndex, int flags)
* This only gets called when a screen is being deleted. It does not
* get called routinely at the end of a server generation.
*/
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(xf86Screens[scrnIndex]);
AlpFreeRec(xf86Screens[scrnIndex]);
}
@@ -1819,9 +1826,9 @@ AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
/* Mandatory */
static Bool
-AlpSaveScreen(ScreenPtr pScreen, Bool unblank)
+AlpSaveScreen(ScreenPtr pScreen, int mode)
{
- return vgaHWSaveScreen(pScreen, unblank);
+ return vgaHWSaveScreen(pScreen, mode);
}
/*
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c
index fb342c7e0..36c4f7e74 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.1 1999/12/26 18:24:16 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.3 2000/02/10 22:33:38 dawes Exp $ */
/* (c) Itai Nahshon */
@@ -15,19 +15,19 @@
#include "cir.h"
#include "alp.h"
-#define CURSORWIDTH 32
-#define CURSORHEIGHT 32
+#define CURSORWIDTH pAlp->CursorWidth
+#define CURSORHEIGHT pAlp->CursorHeight
#define CURSORSIZE (CURSORWIDTH*CURSORHEIGHT/8)
+#define MAXCURSORSIZE (64*64>>3)
static void
AlpSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ const AlpPtr pAlp = ALPPTR(CIRPTR(pScrn));
vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpSetCursorColors\n");
#endif
-#if 1
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]|0x02);
hwp->writeDacWriteAddr(hwp, 0x00);
hwp->writeDacData(hwp, 0x3f & (bg >> 18));
@@ -38,32 +38,33 @@ AlpSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
hwp->writeDacData(hwp, 0x3F & (fg >> 10));
hwp->writeDacData(hwp, 0x3F & (fg >> 2));
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]);
-#else
- outw(0x3C4, ((pAlp->ModeReg.ExtVga[SR12] | 0x02) << 8) | 0x12);
- outb(0x3c8, 0x00); outb(0x3c9, 0x3f & (bg >> 18)); outb(0x3c9, 0x3f & (bg >> 10)); outb(0x3c9, 0x3f & (bg >> 2));
- outb(0x3c8, 0x0f); outb(0x3c9, 0x3f & (fg >> 18)); outb(0x3c9, 0x3f & (fg >> 10)); outb(0x3c9, 0x3f & (fg >> 2));
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR12] << 8) | 0x12);
-#endif
}
static void
-AlpLoadSkewedCursor(unsigned char *memx, unsigned char *CursorBits,
- int x, int y)
-{
- unsigned char mem[2*CURSORSIZE];
+AlpLoadSkewedCursor(CirPtr pCir, int x, int y) {
+
+ const AlpPtr pAlp = ALPPTR(pCir);
+
+ unsigned char *memx = pAlp->HWCursorBits;
+ unsigned char *CursorBits = pAlp->CursorBits;
+
+ unsigned char mem[2*MAXCURSORSIZE];
unsigned char *p1, *p2;
int i, j, m, a, b;
+ Bool cur64 = (CURSORWIDTH == 64);
+ int shift = (cur64? 1 : 0);
if (x > 0) x = 0; else x = -x;
if (y > 0) y = 0; else y = -y;
- a = (x+y*CURSORWIDTH)>>3;
+
+ a = ((y*CURSORWIDTH<<shift)+x)>>3;
b = x & 7;
/* Copy the skewed mask bits */
p1 = mem;
- p2 = CursorBits+a;
- for (i = 0; i < CURSORSIZE-a-1; i++) {
+ p2 = CursorBits + a;
+ for (i = 0; i < (CURSORSIZE << shift)-a-1; i++) {
*p1++ = (p2[0] << b) | (p2[1] >> (8-b));
p2++;
}
@@ -71,19 +72,21 @@ AlpLoadSkewedCursor(unsigned char *memx, unsigned char *CursorBits,
*p1++ = (p2[0] << b);
/* Clear to end (bottom) of mask. */
- for (i = i+1; i < CURSORSIZE; i++)
+ for (i = i+1; i < (CURSORSIZE << shift); i++)
*p1++ = 0;
- /* Now copy the cursor bits */
- /* p1 is already right */
- p2 = CursorBits+CURSORSIZE+a;
- for (i = 0; i < CURSORSIZE-a-1; i++) {
+ if (!cur64) {
+ /* Now copy the cursor bits */
+ /* p1 is already right */
+ p2 = CursorBits+CURSORSIZE+a;
+ for (i = 0; i < CURSORSIZE-a-1; i++) {
*p1++ = (p2[0] << b) | (p2[1] >> (8-b));
p2++;
+ }
+ /* last cursor byte */
+ *p1++ = (p2[0] << b);
}
- /* last cursor byte */
- *p1++ = (p2[0] << b);
-
+
/* Clear to end (bottom) of cursor. */
for (i = i+1; i < CURSORSIZE; i++)
*p1++ = 0;
@@ -108,7 +111,8 @@ AlpLoadSkewedCursor(unsigned char *memx, unsigned char *CursorBits,
static void
AlpSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ const CirPtr pCir = CIRPTR(pScrn);
+ const AlpPtr pAlp = ALPPTR(pCir);
vgaHWPtr hwp = VGAHWPTR(pScrn);
#if 0
@@ -119,36 +123,26 @@ AlpSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
if (x < 0 || y < 0) {
if (x+CURSORWIDTH <= 0 || y+CURSORHEIGHT <= 0) {
-#if 1
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12] & ~0x01);
-#else
- outw(0x3C4, ((pAlp->ModeReg.ExtVga[SR12] & ~0x01) << 8) | 0x12);
-#endif
return;
}
- AlpLoadSkewedCursor(pAlp->HWCursorBits, pAlp->CursorBits, x, y);
- pAlp->CirRec.CursorIsSkewed = TRUE;
+ AlpLoadSkewedCursor(pCir, x, y);
+ pCir->CursorIsSkewed = TRUE;
if (x < 0) x = 0;
if (y < 0) y = 0;
- } else if (pAlp->CirRec.CursorIsSkewed) {
+ } else if (pCir->CursorIsSkewed) {
memcpy(pAlp->HWCursorBits, pAlp->CursorBits, 2*CURSORSIZE);
- pAlp->CirRec.CursorIsSkewed = FALSE;
+ pCir->CursorIsSkewed = FALSE;
}
-#if 1
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]);
hwp->writeSeq(hwp, ((x << 5)|0x10)&0xff, x >> 3);
hwp->writeSeq(hwp, ((y << 5)|0x11)&0xff, y >> 3);
-#else
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR12] << 8) | 0x12);
- outw(0x3C4, (x << 5) | 0x10);
- outw(0x3C4, (y << 5) | 0x11);
-#endif
}
static void
AlpLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ const AlpPtr pAlp = ALPPTR(CIRPTR(pScrn));
vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
@@ -157,46 +151,35 @@ AlpLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
pAlp->CursorBits = bits;
memcpy(pAlp->HWCursorBits, bits, 2*CURSORSIZE);
+ /* this should work for both 64 and 32 bit cursors */
pAlp->ModeReg.ExtVga[SR13] = 0x3f;
-#if 1
- hwp->writeSeq(hwp, 0x13, 0x3f);
-#else
- outw(0x3C4, 0x3f13);
-#endif
+ hwp->writeSeq(hwp, 0x13, pAlp->ModeReg.ExtVga[SR13]);
}
static void
AlpHideCursor(ScrnInfoPtr pScrn)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ AlpPtr pAlp = ALPPTR(CIRPTR(pScrn));
vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpHideCursor\n");
#endif
pAlp->ModeReg.ExtVga[SR12] &= ~0x01;
-#if 1
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]);
-#else
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR12] << 8) | 0x12);
-#endif
}
static void
AlpShowCursor(ScrnInfoPtr pScrn)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ AlpPtr pAlp = ALPPTR(CIRPTR(pScrn));
vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpShowCursor\n");
#endif
pAlp->ModeReg.ExtVga[SR12] |= 0x01;
-#if 1
hwp->writeSeq(hwp, 0x12, pAlp->ModeReg.ExtVga[SR12]);
-#else
- outw(0x3C4, (pAlp->ModeReg.ExtVga[SR12] << 8) | 0x12);
-#endif
}
static Bool
@@ -213,32 +196,49 @@ AlpUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
}
Bool
-AlpHWCursorInit(ScreenPtr pScreen)
+AlpHWCursorInit(ScreenPtr pScreen, int size)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- AlpPtr pAlp = ALPPTR(pScrn);
+ const CirPtr pCir = CIRPTR(pScrn);
+ const AlpPtr pAlp = ALPPTR(pCir);
+
xf86CursorInfoPtr infoPtr;
#ifdef ALP_DEBUG
ErrorF("AlpHWCursorInit\n");
#endif
+ if (!size) return FALSE;
infoPtr = xf86CreateCursorInfoRec();
if (!infoPtr) return FALSE;
- pAlp->CirRec.CursorInfoRec = infoPtr;
- pAlp->HWCursorBits = pAlp->CirRec.FbBase + 1024*pScrn->videoRam - 2*CURSORSIZE;
- pAlp->CirRec.CursorIsSkewed = FALSE;
+ pCir->CursorInfoRec = infoPtr;
+ pCir->CursorIsSkewed = FALSE;
pAlp->CursorBits = NULL;
+ if (size == 64)
+ CURSORWIDTH = CURSORHEIGHT = 64;
+ else
+ CURSORWIDTH = CURSORHEIGHT = 32;
+
+ pAlp->HWCursorBits = pCir->FbBase + 1024*pScrn->videoRam - 2*CURSORSIZE;
+
infoPtr->MaxWidth = CURSORWIDTH;
infoPtr->MaxHeight = CURSORHEIGHT;
- infoPtr->Flags =
+ if (CURSORWIDTH == 64)
+ infoPtr->Flags =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+#endif
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
+ else
+ infoPtr->Flags =
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
#endif
- HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
+
infoPtr->SetCursorColors = AlpSetCursorColors;
infoPtr->SetCursorPosition = AlpSetCursorPosition;
infoPtr->LoadCursorImage = AlpLoadCursorImage;
@@ -250,6 +250,9 @@ AlpHWCursorInit(ScreenPtr pScreen)
#ifdef ALP_DEBUG
ErrorF("AlpHWCursorInit before xf86InitCursor\n");
#endif
-
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Hardware cursor: %ix%i\n",
+ CURSORWIDTH,CURSORHEIGHT);
return(xf86InitCursor(pScreen, infoPtr));
}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c
index 515382f6c..c92b7e1ec 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c
@@ -1,6 +1,6 @@
/* (c) Itai Nahshon */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c,v 1.1 1999/12/26 18:24:16 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -23,21 +23,22 @@
static Bool
AlpI2CSwitchToBus(I2CBusPtr b)
{
- AlpPtr pAlp = ((AlpPtr)b->DriverPrivate.ptr);
- vgaHWPtr hwp = VGAHWPTR(pAlp->CirRec.pScrn);
- if (b == pAlp->CirRec.I2CPtr1) {
- if ((pAlp->ModeReg.ExtVga[GR17] & 0x60) == 0)
- return TRUE;
- pAlp->ModeReg.ExtVga[GR17] &= ~0x60;
- } else if (b == pAlp->CirRec.I2CPtr2) {
- if ((pAlp->ModeReg.ExtVga[GR17] & 0x60) != 0)
- return TRUE;
- pAlp->ModeReg.ExtVga[GR17] |= 0x60;
- } else
- return FALSE;
+ CirPtr pCir = ((CirPtr)b->DriverPrivate.ptr);
+ vgaHWPtr hwp = VGAHWPTR(pCir->pScrn);
+ CARD8 reg = hwp->readGr(hwp, 0x17);
+ if (b == pCir->I2CPtr1) {
+ if ((reg & 0x60) == 0)
+ return TRUE;
+ reg &= ~0x60;
+ }
+ else if(b == pCir->I2CPtr2) {
+ if ((reg & 0x60) != 0)
+ return TRUE;
+ reg |= 0x60;
+ } else return FALSE;
/* ErrorF("AlpI2CSwitchToBus: \"%s\"\n", b->BusName); */
- hwp->writeGr(hwp, 0x17, pAlp->ModeReg.ExtVga[GR17]);
+ hwp->writeGr(hwp, 0x17, reg);
return TRUE;
}
@@ -45,8 +46,8 @@ static void
AlpI2CPutBits(I2CBusPtr b, int clock, int data)
{
unsigned int reg = 0xfc;
- AlpPtr pAlp = ((AlpPtr)b->DriverPrivate.ptr);
- vgaHWPtr hwp = VGAHWPTR(pAlp->CirRec.pScrn);
+ CirPtr pCir = ((CirPtr)b->DriverPrivate.ptr);
+ vgaHWPtr hwp = VGAHWPTR(pCir->pScrn);
if (!AlpI2CSwitchToBus(b))
return;
@@ -61,8 +62,8 @@ static void
AlpI2CGetBits(I2CBusPtr b, int *clock, int *data)
{
unsigned int reg;
- AlpPtr pAlp = ((AlpPtr)b->DriverPrivate.ptr);
- vgaHWPtr hwp = VGAHWPTR(pAlp->CirRec.pScrn);
+ CirPtr pCir = ((CirPtr)b->DriverPrivate.ptr);
+ vgaHWPtr hwp = VGAHWPTR(pCir->pScrn);
if (!AlpI2CSwitchToBus(b))
return;
@@ -76,14 +77,14 @@ AlpI2CGetBits(I2CBusPtr b, int *clock, int *data)
Bool
AlpI2CInit(ScrnInfoPtr pScrn)
{
- AlpPtr pAlp = ALPPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
I2CBusPtr I2CPtr;
#ifdef ALP_DEBUG
ErrorF("AlpI2CInit\n");
#endif
- switch(pAlp->CirRec.Chipset) {
+ switch(pCir->Chipset) {
case PCI_CHIP_GD5446:
case PCI_CHIP_GD5480:
break;
@@ -95,13 +96,13 @@ AlpI2CInit(ScrnInfoPtr pScrn)
I2CPtr = xf86CreateI2CBusRec();
if (!I2CPtr) return FALSE;
- pAlp->CirRec.I2CPtr1 = I2CPtr;
+ pCir->I2CPtr1 = I2CPtr;
I2CPtr->BusName = "I2C bus 1";
I2CPtr->scrnIndex = pScrn->scrnIndex;
I2CPtr->I2CPutBits = AlpI2CPutBits;
I2CPtr->I2CGetBits = AlpI2CGetBits;
- I2CPtr->DriverPrivate.ptr = pAlp;
+ I2CPtr->DriverPrivate.ptr = pCir;
if (!xf86I2CBusInit(I2CPtr))
return FALSE;
@@ -109,13 +110,13 @@ AlpI2CInit(ScrnInfoPtr pScrn)
I2CPtr = xf86CreateI2CBusRec();
if (!I2CPtr) return FALSE;
- pAlp->CirRec.I2CPtr2 = I2CPtr;
+ pCir->I2CPtr2 = I2CPtr;
I2CPtr->BusName = "I2C bus 2";
I2CPtr->scrnIndex = pScrn->scrnIndex;
I2CPtr->I2CPutBits = AlpI2CPutBits;
I2CPtr->I2CGetBits = AlpI2CGetBits;
- I2CPtr->DriverPrivate.ptr = pAlp;
+ I2CPtr->DriverPrivate.ptr = pCir;
if (!xf86I2CBusInit(I2CPtr))
return FALSE;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
index 31d026076..c101559e2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
@@ -1,6 +1,6 @@
/* (c) Itai Nahshon */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.1 1999/12/26 18:24:16 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -15,16 +15,15 @@
#include "cir.h"
#include "alp.h"
+#define WAIT outb(0x3CE,0x31); while(inb(0x3CF) & pCir->chip.alp->waitMsk){};
+#define WAIT_1 outb(0x3CE,0x31); while(inb(0x3CF) & 0x1){};
+
static void AlpSync(ScrnInfoPtr pScrn)
{
#ifdef ALP_DEBUG
ErrorF("AlpSync\n");
#endif
-
- outb(0x3CE, 0x31);
- while (inb(0x3CF) & 0x01)
- ;
-
+ WAIT_1;
return;
}
@@ -33,57 +32,35 @@ AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
int rop, unsigned int planemask,
int trans_color)
{
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- outb(0x3CE, 0x31);
- while (inb(0x3CF) & 0x01)
- ;
+ CirPtr pCir = CIRPTR(pScrn);
+ int pitch = pCir->pitch;
#ifdef ALP_DEBUG
ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n",
xdir, ydir, rop, planemask, trans_color);
#endif
-
- outb(0x3CE, 0x32); outb(0x3CF, 0x0d);
-
+ WAIT;
+ outw(0x3CE,0x0d32);
/* Set dest pitch */
- outb(0x3CE, 0x24);
- outb(0x3CF, pitch & 0xff);
- outb(0x3CE, 0x25);
- outb(0x3CF, (pitch >> 8) & 0x1f);
+ outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24);
+ outw(0x3CE, ((pitch) & 0x1f00) | 0x25);
/* Set source pitch */
- outb(0x3CE, 0x26);
- outb(0x3CF, pitch & 0xff);
- outb(0x3CE, 0x27);
- outb(0x3CF, (pitch >> 8) & 0x1f);
+ outw(0x3CE, ((pitch << 8) & 0xff00) | 0x26);
+ outw(0x3CE, ((pitch) & 0x1f00) | 0x27);
}
static void
AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
int y2, int w, int h)
{
+ CirPtr pCir = CIRPTR(pScrn);
int source, dest;
int hh, ww;
int decrement = 0;
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- outb(0x3CE, 0x31);
- while (inb(0x3CF) & 0x01)
- ;
+ int pitch = pCir->pitch;
ww = (w * pScrn->bitsPerPixel / 8) - 1;
hh = h - 1;
- /* Width */
- outb(0x3CE, 0x20);
- outb(0x3CF, ww & 0xff);
- outb(0x3CE, 0x21);
- outb(0x3CF, (ww >> 8)& 0x1f);
- /* Height */
- outb(0x3CE, 0x22);
- outb(0x3CF, hh & 0xff);
- outb(0x3CE, 0x23);
- outb(0x3CF, (hh >> 8) & 0x07);
-
dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8;
source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8;
if (dest > source) {
@@ -91,20 +68,32 @@ AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
dest += hh * pitch + ww;
source += hh * pitch + ww;
}
- /* dest */
- outb(0x3CE, 0x28);
- outb(0x3CF, dest & 0xff);
- outb(0x3CE, 0x29);
- outb(0x3CF, (dest >> 8) & 0xff);
- outb(0x3CE, 0x2A);
- outb(0x3CF, (dest >> 16) & 0x3f);
+
+ WAIT;
+
+ outb(0x3CE, 0x30);
+ outb(0x3CF, decrement);
+ outb(0x3CE, 0x31);
+
+ /* Width */
+ outw(0x3CE, ((ww << 8) & 0xff00) | 0x20);
+ outw(0x3CE, ((ww) & 0x1f00) | 0x21);
+ /* Height */
+ outw(0x3CE, ((hh << 8) & 0xff00) | 0x22);
+ outw(0x3CE, ((hh) & 0x0700) | 0x23);
+
+
/* source */
- outb(0x3CE, 0x2C);
- outb(0x3CF, source & 0xff);
- outb(0x3CE, 0x2D);
- outb(0x3CF, (source >> 8) & 0xff);
- outb(0x3CE, 0x2E);
- outb(0x3CF, (source >> 16) & 0x3f);
+ outw(0x3CE, ((source << 8) & 0xff00) | 0x2C);
+ outw(0x3CE, ((source) & 0xff00) | 0x2D);
+ outw(0x3CE, ((source >> 8) & 0x3f00)| 0x2E);
+
+ /* dest */
+ outw(0x3CE, ((dest << 8) & 0xff00) | 0x28);
+ outw(0x3CE, ((dest) & 0xff00) | 0x29);
+ outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A);
+ if (!pCir->chip.alp->autoStart)
+ outw(0x3CE,0x0231);
#ifdef ALP_DEBUG
ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n",
@@ -113,26 +102,20 @@ AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
source, dest, ww, hh);
#endif
- outb(0x3CE, 0x30);
- outb(0x3CF, decrement);
- outb(0x3CE, 0x31);
- outb(0x3CF, 2);
}
static void
AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask)
{
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- outb(0x3CE, 0x31);
- while (inb(0x3CF) & 0x01)
- ;
+ CirPtr pCir = CIRPTR(pScrn);
+ int pitch = pCir->pitch;
#ifdef ALP_DEBUG
ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n",
color, rop, planemask);
#endif
+ WAIT;
outb(0x3CE, 0x32); outb(0x3CF, 0x0d);
@@ -141,69 +124,57 @@ AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
outb(0x3CE, 0x30);
outb(0x3CF, 0xC0|((pScrn->bitsPerPixel - 8) << 1));
- outb(0x3CE, 0x01);
- outb(0x3CF, color & 0xff);
- outb(0x3CE, 0x11);
- outb(0x3CF, (color >> 8) & 0xff);
- outb(0x3CE, 0x13);
- outb(0x3CF, (color >> 16) & 0xff);
- outb(0x3CE, 0x15);
- outb(0x3CF, 0);
+ outw(0x3CE, ((color << 8) & 0xff00) | 0x01);
+ outw(0x3CE, ((color) & 0xff00) | 0x11);
+ outw(0x3CE, ((color >> 8) & 0xff00) | 0x13);
+ outw(0x3CE, 0x15);
/* Set dest pitch */
- outb(0x3CE, 0x24);
- outb(0x3CF, pitch & 0xff);
- outb(0x3CE, 0x25);
- outb(0x3CF, (pitch >> 8) & 0x1f);
+ outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24);
+ outw(0x3CE, ((pitch) & 0x1f00) | 0x25);
}
static void
AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
+ CirPtr pCir = CIRPTR(pScrn);
int dest;
int hh, ww;
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- outb(0x3CE, 0x31);
- while (inb(0x3CF) & 0x01)
- ;
+ int pitch = pCir->pitch;
ww = (w * pScrn->bitsPerPixel / 8) - 1;
hh = h - 1;
+ dest = y * pitch + x * pScrn->bitsPerPixel / 8;
+
+ WAIT;
+
/* Width */
- outb(0x3CE, 0x20);
- outb(0x3CF, ww & 0xff);
- outb(0x3CE, 0x21);
- outb(0x3CF, (ww >> 8)& 0x1f);
+ outw(0x3CE, ((ww << 8) & 0xff00) | 0x20);
+ outw(0x3CE, ((ww) & 0x1f00) | 0x21);
/* Height */
- outb(0x3CE, 0x22);
- outb(0x3CF, hh & 0xff);
- outb(0x3CE, 0x23);
- outb(0x3CF, (hh >> 8) & 0x07);
+ outw(0x3CE, ((hh << 8) & 0xff00) | 0x22);
+ outw(0x3CE, ((hh) & 0x0700) | 0x23);
- dest = y * pitch + x * pScrn->bitsPerPixel / 8;
/* dest */
- outb(0x3CE, 0x28);
- outb(0x3CF, dest & 0xff);
- outb(0x3CE, 0x29);
- outb(0x3CF, (dest >> 8) & 0xff);
- outb(0x3CE, 0x2A);
- outb(0x3CF, (dest >> 16) & 0x3f);
+ outw(0x3CE, ((dest << 8) & 0xff00) | 0x28);
+ outw(0x3CE, ((dest) & 0xff00) | 0x29);
+ outw(0x3CE, ((dest >> 8) & 0x3f00) | 0x2A);
+ if (!pCir->chip.alp->autoStart)
+ outw(0x3CE,0x0231);
#ifdef ALP_DEBUG
ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n",
x, y, w, h);
#endif
- outb(0x3CE, 0x31);
- outb(0x3CF, 2);
}
+
Bool
AlpXAAInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- AlpPtr pAlp = ALPPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
XAAInfoRecPtr XAAPtr;
#ifdef ALP_DEBUG
@@ -217,8 +188,8 @@ AlpXAAInit(ScreenPtr pScreen)
XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy;
XAAPtr->ScreenToScreenCopyFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK;
- if (pAlp->CirRec.Chipset == PCI_CHIP_GD5446 ||
- pAlp->CirRec.Chipset == PCI_CHIP_GD5480) {
+ if (pCir->Chipset == PCI_CHIP_GD5446 ||
+ pCir->Chipset == PCI_CHIP_GD5480) {
XAAPtr->SetupForSolidFill = AlpSetupForSolidFill;
XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect;
@@ -229,7 +200,14 @@ AlpXAAInit(ScreenPtr pScreen)
XAAPtr->Sync = AlpSync;
outw(0x3CE, 0x200E); /* enable writes to gr33 */
-
+ if (pCir->properties & ACCEL_AUTOSTART) {
+ outw(0x3CE, 0x8031); /* enable autostart */
+ pCir->chip.alp->waitMsk = 0x10;
+ pCir->chip.alp->autoStart = TRUE;
+ } else {
+ pCir->chip.alp->waitMsk = 0x1;
+ pCir->chip.alp->autoStart = FALSE;
+ }
if (!XAAInit(pScreen, XAAPtr))
return FALSE;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c
index 010629e73..e2f6c4873 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c
@@ -1,6 +1,6 @@
/* (c) Itai Nahshon */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.1 1999/12/26 18:24:16 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -18,18 +18,21 @@
#define minb(p) MMIO_IN8(hwp->MMIOBase, hwp->MMIOOffset + (p))
#define moutb(p,v) \
MMIO_OUT8(hwp->MMIOBase, hwp->MMIOOffset + (p),(v))
+#define minl(p) MMIO_IN32(pCir->IOBase, (p))
+#define moutl(p,v) \
+ MMIO_OUT32(pCir->IOBase, (p),(v))
+
+
+#define WAIT while(minl(0x140) & pCir->chip.alp->waitMsk){};
+#define WAIT_1 while(minl(0x140) & 0x100){};
static void AlpSync(ScrnInfoPtr pScrn)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpSync mm\n");
#endif
-
- moutb(0x3CE, 0x31);
- while (minb(0x3CF) & 0x01)
- ;
-
+ WAIT_1;
return;
}
@@ -37,59 +40,31 @@ static void
AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
unsigned int planemask, int trans_color)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
+ CirPtr pCir = CIRPTR(pScrn);
+ int pitch = pCir->pitch;
- moutb(0x3CE, 0x31);
- while (minb(0x3CF) & 0x01)
- ;
+ WAIT;
#ifdef ALP_DEBUG
ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n",
xdir, ydir, rop, planemask, trans_color);
#endif
+ moutl(0x10C, (pitch << 16) | pitch);
- moutb(0x3CE, 0x32); moutb(0x3CF, 0x0d);
-
- /* Set dest pitch */
- moutb(0x3CE, 0x24);
- moutb(0x3CF, pitch & 0xff);
- moutb(0x3CE, 0x25);
- moutb(0x3CF, (pitch >> 8) & 0x1f);
- /* Set source pitch */
- moutb(0x3CE, 0x26);
- moutb(0x3CF, pitch & 0xff);
- moutb(0x3CE, 0x27);
- moutb(0x3CF, (pitch >> 8) & 0x1f);
}
static void
AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
int y2, int w, int h)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
int source, dest;
int hh, ww;
int decrement = 0;
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- moutb(0x3CE, 0x31);
- while (minb(0x3CF) & 0x01)
- ;
-
- ww = (w * pScrn->bitsPerPixel / 8) - 1;
- hh = h - 1;
- /* Width */
- moutb(0x3CE, 0x20);
- moutb(0x3CF, ww & 0xff);
- moutb(0x3CE, 0x21);
- moutb(0x3CF, (ww >> 8)& 0x1f);
- /* Height */
- moutb(0x3CE, 0x22);
- moutb(0x3CF, hh & 0xff);
- moutb(0x3CE, 0x23);
- moutb(0x3CF, (hh >> 8) & 0x07);
+ int pitch = pCir->pitch;
+ ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff;
+ hh = (h - 1) & 0x1fff;
dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8;
source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8;
if (dest > source) {
@@ -97,20 +72,18 @@ AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
dest += hh * pitch + ww;
source += hh * pitch + ww;
}
- /* dest */
- moutb(0x3CE, 0x28);
- moutb(0x3CF, dest & 0xff);
- moutb(0x3CE, 0x29);
- moutb(0x3CF, (dest >> 8) & 0xff);
- moutb(0x3CE, 0x2A);
- moutb(0x3CF, (dest >> 16) & 0x3f);
+
+ WAIT;
+
+ /* Width / Height */
+ moutl(0x108, (hh << 16) | ww);
/* source */
- moutb(0x3CE, 0x2C);
- moutb(0x3CF, source & 0xff);
- moutb(0x3CE, 0x2D);
- moutb(0x3CF, (source >> 8) & 0xff);
- moutb(0x3CE, 0x2E);
- moutb(0x3CF, (source >> 16) & 0x3f);
+ moutl(0x114, source & 0x3fffff);
+ moutl(0x118, 0x0d0000 | decrement);
+
+ /* dest */
+ write_mem_barrier();
+ moutl(0x110, dest & 0x3fffff);
#ifdef ALP_DEBUG
ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n",
@@ -118,93 +91,61 @@ AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n",
source, dest, ww, hh);
#endif
-
- moutb(0x3CE, 0x30);
- moutb(0x3CF, decrement);
- moutb(0x3CE, 0x31);
- moutb(0x3CF, 2);
+ if (!pCir->chip.alp->autoStart)
+ moutl(0x140,0x02);
+ write_mem_barrier();
}
+
static void
AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
+ CirPtr pCir = CIRPTR(pScrn);
+ int pitch = pCir->pitch;
- moutb(0x3CE, 0x31);
- while (minb(0x3CF) & 0x01)
- ;
+ WAIT;
#ifdef ALP_DEBUG
ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n",
color, rop, planemask);
#endif
- moutb(0x3CE, 0x32); moutb(0x3CF, 0x0d);
-
- moutb(0x3CE, 0x33);
- moutb(0x3CF, 0x04);
- moutb(0x3CE, 0x30);
- moutb(0x3CF, 0xC0|((pScrn->bitsPerPixel - 8) << 1));
-
- moutb(0x3CE, 0x01);
- moutb(0x3CF, color & 0xff);
- moutb(0x3CE, 0x11);
- moutb(0x3CF, (color >> 8) & 0xff);
- moutb(0x3CE, 0x13);
- moutb(0x3CF, (color >> 16) & 0xff);
- moutb(0x3CE, 0x15);
- moutb(0x3CF, 0);
+ moutl(0x104, color & 0xffffff);
/* Set dest pitch */
- moutb(0x3CE, 0x24);
- moutb(0x3CF, pitch & 0xff);
- moutb(0x3CE, 0x25);
- moutb(0x3CF, (pitch >> 8) & 0x1f);
+ moutl(0x10C, pitch & 0x1fff);
+ moutl(0x118, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000);
}
static void
AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
int dest;
int hh, ww;
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- moutb(0x3CE, 0x31);
- while (minb(0x3CF) & 0x01)
- ;
-
- ww = (w * pScrn->bitsPerPixel / 8) - 1;
- hh = h - 1;
- /* Width */
- moutb(0x3CE, 0x20);
- moutb(0x3CF, ww & 0xff);
- moutb(0x3CE, 0x21);
- moutb(0x3CF, (ww >> 8)& 0x1f);
- /* Height */
- moutb(0x3CE, 0x22);
- moutb(0x3CF, hh & 0xff);
- moutb(0x3CE, 0x23);
- moutb(0x3CF, (hh >> 8) & 0x07);
+ CirPtr pCir = CIRPTR(pScrn);
+ int pitch = pCir->pitch;
+ ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff;
+ hh = (h - 1) & 0x7ff;
dest = y * pitch + x * pScrn->bitsPerPixel / 8;
- /* dest */
- moutb(0x3CE, 0x28);
- moutb(0x3CF, dest & 0xff);
- moutb(0x3CE, 0x29);
- moutb(0x3CF, (dest >> 8) & 0xff);
- moutb(0x3CE, 0x2A);
- moutb(0x3CF, (dest >> 16) & 0x3f);
+
+ WAIT;
+
+ /* Width / Height */
+ write_mem_barrier();
+ moutl(0x108, (hh << 16) | ww);
#ifdef ALP_DEBUG
ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n",
x, y, w, h);
#endif
+ /* dest */
+ moutl(0x110, (dest & 0x3fffff));
- moutb(0x3CE, 0x31);
- moutb(0x3CF, 2);
+ if (!pCir->chip.alp->autoStart)
+ moutl(0x140,0x02);
+ write_mem_barrier();
}
Bool
@@ -212,6 +153,7 @@ AlpXAAInitMMIO(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CirPtr pCir = CIRPTR(pScrn);
XAAInfoRecPtr XAAPtr;
#ifdef ALP_DEBUG
@@ -234,9 +176,18 @@ AlpXAAInitMMIO(ScreenPtr pScreen)
moutb(0x3CE, 0x0E); /* enable writes to gr33 */
moutb(0x3CF, 0x20); /* enable writes to gr33 */
+ if (pCir->properties & ACCEL_AUTOSTART) {
+ moutl(0x140, 0x80); /* enable autostart */
+ pCir->chip.alp->waitMsk = 0x1000;
+ pCir->chip.alp->autoStart = TRUE;
+ } else {
+ pCir->chip.alp->waitMsk = 0x100;
+ pCir->chip.alp->autoStart = FALSE;
+ }
if (!XAAInit(pScreen, XAAPtr))
return FALSE;
return TRUE;
}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_sarea.h
new file mode 100644
index 000000000..3dd0ada84
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_sarea.h
@@ -0,0 +1,44 @@
+#ifndef I810_SAPRIV_H
+#define I810_SAPRIV_H
+
+/* Each region is a minimum of 32k, and there are at most 128 of them.
+ */
+#define I810_NR_TEX_REGIONS 128
+
+
+
+typedef struct {
+ unsigned char next, prev; /* array indices to form a circular LRU list */
+ unsigned char in_use; /* owned by a client, or free? */
+ int age; /* tracked by clients to update local LRU's */
+} i810TexRegion;
+
+typedef struct {
+ int ringOwner; /* not used */
+ int ctxOwner; /* last context to upload state */
+
+ /* Maintain an LRU of contiguous regions of texture space. If
+ * you think you own a region of texture memory, and it has an age
+ * different to the one you set, then you are mistaken and it has
+ * been stolen by another client. If texAge hasn't changed, there
+ * is no need to walk the list.
+ *
+ * These regions can be used as a proxy for the fine-grained texture
+ * information of other clients - by maintaining them in the same
+ * lru which is used to age their own textures, clients have an
+ * approximate lru for the whole of global texture space, and can
+ * make informed decisions as to which areas to kick out. There is
+ * no need to choose whether to kick out your own texture or someone
+ * else's - simply eject them all in LRU order.
+ */
+ i810TexRegion texList[I810_NR_TEX_REGIONS+1]; /* Last element is sentinal */
+ int texAge; /* Current age counter */
+
+
+ int lastWrap;
+ int lastSync;
+ int ringAge;
+
+} I810SAREAPriv;
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
new file mode 100644
index 000000000..df23db4f6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -0,0 +1,633 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.1 2000/02/11 17:25:55 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Priv.h"
+
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h"
+#include "cfb32.h"
+
+#include "miline.h"
+
+#include "GL/glxtokens.h"
+
+#include "mga_bios.h"
+#include "mga_reg.h"
+#include "mga.h"
+#include "mga_macros.h"
+#include "mga_dri.h"
+#include "mga_dripriv.h"
+
+static char MGAKernelDriverName[] = "mga";
+static char MGAClientDriverName[] = "mga";
+
+static Bool MGAInitVisualConfigs(ScreenPtr pScreen);
+static Bool MGACreateContext(ScreenPtr pScreen, VisualPtr visual,
+ drmContext hwContext, void *pVisualConfigPriv,
+ DRIContextType contextStore);
+static void MGADestroyContext(ScreenPtr pScreen, drmContext hwContext,
+ DRIContextType contextStore);
+static void MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType readContextType,
+ void *readContextStore,
+ DRIContextType writeContextType,
+ void *writeContextStore);
+extern void Mga8DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
+extern void Mga8DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index);
+extern void Mga16DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
+extern void Mga16DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index);
+extern void Mga24DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
+extern void Mga24DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index);
+extern void Mga32DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
+extern void Mga32DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc, CARD32 index);
+
+static Bool
+MGAInitVisualConfigs(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ int numConfigs = 0;
+ __GLXvisualConfig *pConfigs = 0;
+ MGAConfigPrivPtr pMGAConfigs = 0;
+ MGAConfigPrivPtr *pMGAConfigPtrs = 0;
+ int i;
+
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ case 24:
+ case 32:
+ break;
+ case 16:
+ numConfigs = 4;
+
+ if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig),
+ numConfigs))) {
+ return FALSE;
+ }
+ if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec),
+ numConfigs))) {
+ xfree(pConfigs);
+ return FALSE;
+ }
+ if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr),
+ numConfigs))) {
+ xfree(pConfigs);
+ xfree(pMGAConfigs);
+ return FALSE;
+ }
+ for (i=0; i<numConfigs; i++)
+ pMGAConfigPtrs[i] = &pMGAConfigs[i];
+
+ /* config 0: db=FALSE, depth=0
+ config 1: db=FALSE, depth=16
+ config 2: db=TRUE, depth=0;
+ config 3: db=TRUE, depth=16
+ */
+ pConfigs[0].vid = -1;
+ pConfigs[0].class = -1;
+ pConfigs[0].rgba = TRUE;
+ pConfigs[0].redSize = 8;
+ pConfigs[0].greenSize = 8;
+ pConfigs[0].blueSize = 8;
+ pConfigs[0].redMask = 0x00FF0000;
+ pConfigs[0].greenMask = 0x0000FF00;
+ pConfigs[0].blueMask = 0x000000FF;
+ pConfigs[0].alphaMask = 0;
+ pConfigs[0].accumRedSize = 0;
+ pConfigs[0].accumGreenSize = 0;
+ pConfigs[0].accumBlueSize = 0;
+ pConfigs[0].accumAlphaSize = 0;
+ pConfigs[0].doubleBuffer = FALSE;
+ pConfigs[0].stereo = FALSE;
+ pConfigs[0].bufferSize = 16;
+ pConfigs[0].depthSize = 0;
+ pConfigs[0].stencilSize = 0;
+ pConfigs[0].auxBuffers = 0;
+ pConfigs[0].level = 0;
+ pConfigs[0].visualRating = 0;
+ pConfigs[0].transparentPixel = 0;
+ pConfigs[0].transparentRed = 0;
+ pConfigs[0].transparentGreen = 0;
+ pConfigs[0].transparentBlue = 0;
+ pConfigs[0].transparentAlpha = 0;
+ pConfigs[0].transparentIndex = 0;
+
+ pConfigs[1].vid = -1;
+ pConfigs[1].class = -1;
+ pConfigs[1].rgba = TRUE;
+ pConfigs[1].redSize = 8;
+ pConfigs[1].greenSize = 8;
+ pConfigs[1].blueSize = 8;
+ pConfigs[1].redMask = 0x00FF0000;
+ pConfigs[1].greenMask = 0x0000FF00;
+ pConfigs[1].blueMask = 0x000000FF;
+ pConfigs[1].alphaMask = 0;
+ pConfigs[1].accumRedSize = 0;
+ pConfigs[1].accumGreenSize = 0;
+ pConfigs[1].accumBlueSize = 0;
+ pConfigs[1].accumAlphaSize = 0;
+ pConfigs[1].doubleBuffer = FALSE;
+ pConfigs[1].stereo = FALSE;
+ pConfigs[1].bufferSize = 16;
+ pConfigs[1].depthSize = 16;
+ pConfigs[1].stencilSize = 0;
+ pConfigs[1].auxBuffers = 0;
+ pConfigs[1].level = 0;
+ pConfigs[1].visualRating = 0;
+ pConfigs[1].transparentPixel = 0;
+ pConfigs[1].transparentRed = 0;
+ pConfigs[1].transparentGreen = 0;
+ pConfigs[1].transparentBlue = 0;
+ pConfigs[1].transparentAlpha = 0;
+ pConfigs[1].transparentIndex = 0;
+
+ pConfigs[2].vid = -1;
+ pConfigs[2].class = -1;
+ pConfigs[2].rgba = TRUE;
+ pConfigs[2].redSize = 8;
+ pConfigs[2].greenSize = 8;
+ pConfigs[2].blueSize = 8;
+ pConfigs[2].redMask = 0x00FF0000;
+ pConfigs[2].greenMask = 0x0000FF00;
+ pConfigs[2].blueMask = 0x000000FF;
+ pConfigs[2].alphaMask = 0;
+ pConfigs[2].accumRedSize = 0;
+ pConfigs[2].accumGreenSize = 0;
+ pConfigs[2].accumBlueSize = 0;
+ pConfigs[2].accumAlphaSize = 0;
+ pConfigs[2].doubleBuffer = TRUE;
+ pConfigs[2].stereo = FALSE;
+ pConfigs[2].bufferSize = 16;
+ pConfigs[2].depthSize = 0;
+ pConfigs[2].stencilSize = 0;
+ pConfigs[2].auxBuffers = 0;
+ pConfigs[2].level = 0;
+ pConfigs[2].visualRating = 0;
+ pConfigs[2].transparentPixel = 0;
+ pConfigs[2].transparentRed = 0;
+ pConfigs[2].transparentGreen = 0;
+ pConfigs[2].transparentBlue = 0;
+ pConfigs[2].transparentAlpha = 0;
+ pConfigs[2].transparentIndex = 0;
+
+ pConfigs[3].vid = -1;
+ pConfigs[3].class = -1;
+ pConfigs[3].rgba = TRUE;
+ pConfigs[3].redSize = 8;
+ pConfigs[3].greenSize = 8;
+ pConfigs[3].blueSize = 8;
+ pConfigs[3].redMask = 0x00FF0000;
+ pConfigs[3].greenMask = 0x0000FF00;
+ pConfigs[3].blueMask = 0x000000FF;
+ pConfigs[3].alphaMask = 0;
+ pConfigs[3].accumRedSize = 0;
+ pConfigs[3].accumGreenSize = 0;
+ pConfigs[3].accumBlueSize = 0;
+ pConfigs[3].accumAlphaSize = 0;
+ pConfigs[3].doubleBuffer = TRUE;
+ pConfigs[3].stereo = FALSE;
+ pConfigs[3].bufferSize = 16;
+ pConfigs[3].depthSize = 16;
+ pConfigs[3].stencilSize = 0;
+ pConfigs[3].auxBuffers = 0;
+ pConfigs[3].level = 0;
+ pConfigs[3].visualRating = 0;
+ pConfigs[3].transparentPixel = 0;
+ pConfigs[3].transparentRed = 0;
+ pConfigs[3].transparentGreen = 0;
+ pConfigs[3].transparentBlue = 0;
+ pConfigs[3].transparentAlpha = 0;
+ pConfigs[3].transparentIndex = 0;
+ break;
+ }
+ pMGA->numVisualConfigs = numConfigs;
+ pMGA->pVisualConfigs = pConfigs;
+ pMGA->pVisualConfigsPriv = pMGAConfigs;
+ GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pMGAConfigPtrs);
+ return TRUE;
+}
+
+Bool MGADRIScreenInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ DRIInfoPtr pDRIInfo;
+ MGADRIPtr pMGADRI;
+ MGADRIServerPrivatePtr pMGADRIServer;
+ int bufs;
+ int prim_size;
+ int init_offset;
+
+ pDRIInfo = DRICreateInfoRec();
+ if (!pDRIInfo) return FALSE;
+ pMGA->pDRIInfo = pDRIInfo;
+
+ pDRIInfo->drmDriverName = MGAKernelDriverName;
+ pDRIInfo->clientDriverName = MGAClientDriverName;
+ pDRIInfo->busIdString = xalloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pciConfigPtr)pMGA->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pMGA->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pMGA->PciInfo->thisCard)->funcnum);
+ pDRIInfo->ddxDriverMajorVersion = 0;
+ pDRIInfo->ddxDriverMinorVersion = 1;
+ pDRIInfo->ddxDriverPatchVersion = 0;
+ pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress;
+ pDRIInfo->frameBufferSize = pMGA->FbMapSize;
+ pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8);
+ pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES;
+
+ if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES)
+ pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
+ else
+ pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES;
+
+#ifdef NOT_DONE
+ /* FIXME need to extend DRI protocol to pass this size back to client
+ * for SAREA mapping that includes a device private record
+ */
+ pDRIInfo->SAREASize =
+ ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
+ /* + shared memory device private rec */
+#else
+ /* For now the mapping works by using a fixed size defined
+ * in the SAREA header
+ */
+ if (sizeof(XF86DRISAREARec)+sizeof(drm_mga_sarea_t)>SAREA_MAX) {
+ ErrorF("Data does not fit in SAREA\n");
+ return FALSE;
+ }
+ pDRIInfo->SAREASize = SAREA_MAX;
+#endif
+
+ if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) {
+ DRIDestroyInfoRec(pMGA->pDRIInfo);
+ pMGA->pDRIInfo=0;
+ ErrorF("Failed to allocate memory for private record \n");
+ return FALSE;
+ }
+ if (!(pMGADRIServer = (MGADRIServerPrivatePtr)
+ xnfcalloc(sizeof(MGADRIServerPrivate),1))) {
+ xfree(pMGADRI);
+ DRIDestroyInfoRec(pMGA->pDRIInfo);
+ pMGA->pDRIInfo=0;
+ ErrorF("Failed to allocate memory for private record \n");
+ return FALSE;
+ }
+
+ pDRIInfo->devPrivate = pMGADRI;
+ pMGA->DRIServerInfo = pMGADRIServer;
+ pDRIInfo->devPrivateSize = sizeof(MGADRIRec);
+ pDRIInfo->contextSize = sizeof(MGADRIContextRec);
+
+ pDRIInfo->CreateContext = MGACreateContext;
+ pDRIInfo->DestroyContext = MGADestroyContext;
+ pDRIInfo->SwapContext = MGADRISwapContext;
+
+ switch( pScrn->bitsPerPixel ) {
+ case 8:
+ pDRIInfo->InitBuffers = Mga8DRIInitBuffers;
+ pDRIInfo->MoveBuffers = Mga8DRIMoveBuffers;
+ case 16:
+ pDRIInfo->InitBuffers = Mga16DRIInitBuffers;
+ pDRIInfo->MoveBuffers = Mga16DRIMoveBuffers;
+ case 24:
+ pDRIInfo->InitBuffers = Mga24DRIInitBuffers;
+ pDRIInfo->MoveBuffers = Mga24DRIMoveBuffers;
+ case 32:
+ pDRIInfo->InitBuffers = Mga32DRIInitBuffers;
+ pDRIInfo->MoveBuffers = Mga32DRIMoveBuffers;
+ }
+
+ pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+
+ if (!DRIScreenInit(pScreen, pDRIInfo, &pMGA->drmSubFD)) {
+ xfree(pMGADRIServer);
+ pMGA->DRIServerInfo = 0;
+ xfree(pDRIInfo->devPrivate);
+ pDRIInfo->devPrivate = 0;
+ DRIDestroyInfoRec(pMGA->pDRIInfo);
+ pMGA->pDRIInfo = 0;
+ ErrorF("DRIScreenInit Failed\n");
+ return FALSE;
+ }
+
+ pMGADRIServer->regsSize = MGAIOMAPSIZE;
+ if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress,
+ pMGADRIServer->regsSize, DRM_REGISTERS, 0,
+ &pMGADRIServer->regs)<0) {
+ DRICloseScreen(pScreen);
+ ErrorF("drmAddMap failed Register MMIO region\n");
+ return FALSE;
+ }
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
+ pMGADRIServer->regs);
+
+ /* Agp Support */
+ if(drmAgpAcquire(pMGA->drmSubFD) < 0) {
+ DRICloseScreen(pScreen);
+ ErrorF("drmAgpAcquire failed\n");
+ return FALSE;
+ }
+ pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen);
+ if(pMGADRIServer->warp_ucode_size == 0) {
+ ErrorF("microcodeSize is zero\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+
+ prim_size = 65536;
+ init_offset = ((prim_size + pMGADRIServer->warp_ucode_size +
+ 4096 - 1) / 4096) * 4096;
+
+ pMGADRIServer->agpSizep = drmAgpSize(pMGA->drmSubFD);
+ pMGADRIServer->agpBase = drmAgpBase(pMGA->drmSubFD);
+ if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agpBase,
+ init_offset, DRM_AGP, 0,
+ &pMGADRIServer->agp_private) < 0) {
+ DRICloseScreen(pScreen);
+ ErrorF("drmAddMap failed on AGP aperture\n");
+ return FALSE;
+ }
+
+ if (drmMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agp_private,
+ init_offset,
+ (drmAddressPtr)&pMGADRIServer->agp_map) < -1) {
+ DRICloseScreen(pScreen);
+ ErrorF("drmMap failed on AGP aperture\n");
+ return FALSE;
+ }
+
+ /* Now allocate and bind a default of 8 megs */
+
+ pMGADRIServer->agpHandle = drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0);
+ if(pMGADRIServer->agpHandle == 0) {
+ ErrorF("drmAgpAlloc failed\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ if(drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) {
+ DRICloseScreen(pScreen);
+ ErrorF("drmAgpBind failed\n");
+ return FALSE;
+ }
+
+ mgaInstallMicrocode(pScreen, prim_size);
+
+ ErrorF("init_offset: %x\n", init_offset);
+ pMGADRI->agpSize = pMGADRIServer->agpSizep - init_offset;
+ ErrorF("pMGADRI->agpSize: %x\n", pMGADRI->agpSize);
+
+ if(drmAddMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agpBase + init_offset,
+ pMGADRI->agpSize, DRM_AGP, 0,
+ &pMGADRI->agp) < 0) {
+ ErrorF("Failed to map public agp area\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ ErrorF("Mapped public agp area\n");
+ /* Here is where we need to do initialization of the dma engine */
+
+ pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD);
+ /* Default to 1X agp mode */
+ pMGADRIServer->agpMode &= ~0x00000002;
+ if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) {
+ ErrorF("drmAgpEnable failed\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ ErrorF("drmAgpEnabled succeeded\n");
+ if((bufs = drmAddBufs(pMGA->drmSubFD,
+ /*63*/ 15,
+ /* 65536 */ 524288,
+ DRM_AGP_BUFFER,
+ init_offset)) <= 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] failure adding %d %d byte DMA buffers\n",
+ /* 63 */ 15,
+ /* 65536 */ 524288);
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] added %d %d byte DMA buffers\n",
+ bufs, /* 65536 */ 524288);
+
+
+ if((mgadrmInitDma(pScrn, prim_size)) != TRUE) {
+ ErrorF("Failed to initialize dma engine\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+
+ ErrorF("Initialized Dma Engine\n");
+
+
+ if(drmMarkBufs(pMGA->drmSubFD, 0.133333, 0.266666) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] failure marking DMA buffers\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ if (!(pMGADRIServer->drmBufs = drmMapBufs(pMGA->drmSubFD))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] failure mapping DMA buffers\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] buffers mapped with %p\n",
+ pMGADRIServer->drmBufs);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n",
+ pMGADRIServer->drmBufs->count);
+ if (!pMGADRIServer->irq) {
+ pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD,
+ ((pciConfigPtr)pMGA->PciInfo
+ ->thisCard)->busnum,
+ ((pciConfigPtr)pMGA->PciInfo
+ ->thisCard)->devnum,
+ ((pciConfigPtr)pMGA->PciInfo
+ ->thisCard)->funcnum);
+ drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq);
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] dma control initialized, using IRQ %d\n",
+ pMGADRIServer->irq);
+
+
+ if (!(MGAInitVisualConfigs(pScreen))) {
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" );
+
+ return TRUE;
+}
+
+void
+MGADRICloseScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] unmapping %d buffers\n",
+ pMGADRIServer->drmBufs->count);
+ if (drmUnmapBufs(pMGADRIServer->drmBufs)) {
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] unable to unmap DMA buffers\n");
+ }
+ mgadrmCleanupDma(pScrn);
+
+ DRICloseScreen(pScreen);
+
+ if (pMGA->pDRIInfo) {
+ if (pMGA->pDRIInfo->devPrivate) {
+ xfree(pMGA->pDRIInfo->devPrivate);
+ pMGA->pDRIInfo->devPrivate = 0;
+ }
+ DRIDestroyInfoRec(pMGA->pDRIInfo);
+ pMGA->pDRIInfo = 0;
+ }
+ if(pMGA->DRIServerInfo) {
+ xfree(pMGA->DRIServerInfo);
+ pMGA->DRIServerInfo = 0;
+ }
+ if (pMGA->pVisualConfigs) {
+ xfree(pMGA->pVisualConfigs);
+ }
+ if (pMGA->pVisualConfigsPriv) {
+ xfree(pMGA->pVisualConfigsPriv);
+ }
+}
+
+static Bool
+MGACreateContext(ScreenPtr pScreen, VisualPtr visual,
+ drmContext hwContext, void *pVisualConfigPriv,
+ DRIContextType contextStore)
+{
+ MGADRIContextPtr ctx;
+
+ ctx = (MGADRIContextPtr)contextStore;
+ return TRUE;
+}
+
+static void
+MGADestroyContext(ScreenPtr pScreen, drmContext hwContext,
+ DRIContextType contextStore)
+{
+ MGADRIContextPtr ctx;
+ ctx = (MGADRIContextPtr)contextStore;
+}
+
+Bool
+MGADRIFinishScreenInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ MGADRIPtr pMGADRI;
+ int size;
+
+ pMGA->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
+ /* pMGA->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
+
+ pMGADRI = (MGADRIPtr)pMGA->pDRIInfo->devPrivate;
+ pMGADRI->deviceID = pMGA->PciInfo->chipType;
+ pMGADRI->width = pScrn->virtualX;
+ pMGADRI->height = pScrn->virtualY;
+ pMGADRI->mem = pScrn->videoRam * 1024;
+ pMGADRI->cpp = pScrn->bitsPerPixel / 8;
+ pMGADRI->stride = pScrn->displayWidth * (pScrn->bitsPerPixel / 8);
+ pMGADRI->backOffset = ((pScrn->virtualY+129) * pScrn->displayWidth *
+ (pScrn->bitsPerPixel / 8) + 4095) & ~0xFFF;
+ size = 2 * pScrn->virtualX * pScrn->virtualY;
+ pMGADRI->depthOffset = (pMGADRI->backOffset + size + 4095) & ~0xFFF;
+ pMGADRI->textureOffset = pMGADRI->depthOffset + size;
+ /*
+ * The rest of the framebuffer is for textures except for the
+ * memory for the hardware cursor.
+ */
+ pMGADRI->textureSize = pMGA->FbUsableSize - pMGADRI->textureOffset;
+ pMGADRI->fbOffset = pMGA->YDstOrg * (pScrn->bitsPerPixel / 8);
+
+ return DRIFinishScreenInit(pScreen);
+}
+
+void MGASwapContext(ScreenPtr pScreen)
+{
+#if 0
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGAFBLayout *pLayout = &pMga->CurrentLayout;
+
+ usleep(500);
+ ErrorF("Syncing : swap\n");
+ MGABUSYWAIT();
+ ErrorF("Sync : swap 1\n");
+ MGAStormSync(pScrn);
+ ErrorF("Syncing done\n");
+ pMga->AccelInfoRec->NeedToSync = TRUE;
+
+ WAITFIFO(12);
+ OUTREG(MGAREG_MACCESS, pMga->MAccess);
+ OUTREG(MGAREG_PITCH, pLayout->displayWidth);
+ OUTREG(MGAREG_YDSTORG, pMga->YDstOrg);
+ OUTREG(MGAREG_PLNWT, pMga->PlaneMask);
+ OUTREG(MGAREG_BCOL, pMga->BgColor);
+ OUTREG(MGAREG_FCOL, pMga->FgColor);
+ OUTREG(MGAREG_SRCORG, pMga->SrcOrg);
+ OUTREG(MGAREG_DSTORG, pMga->DstOrg);
+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
+ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
+ OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
+ pMga->AccelFlags &= ~CLIPPER_ON;
+#endif
+}
+
+void MGALostContext(ScreenPtr pScreen)
+{
+#if 0
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGAFBLayout *pLayout = &pMga->CurrentLayout;
+
+ ErrorF("Syncing : lost\n");
+ MGAStormSync(pScrn);
+ ErrorF("Sync : lost 1\n");
+ MGABUSYWAIT();
+ ErrorF("Syncing done\n");
+#endif
+}
+
+static void
+MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType oldContextType, void *oldContext,
+ DRIContextType newContextType, void *newContext)
+{
+ if ((syncType == DRI_3D_SYNC) && (oldContextType == DRI_2D_CONTEXT) &&
+ (newContextType == DRI_2D_CONTEXT)) { /* Entering from Wakeup */
+ MGASwapContext(pScreen);
+ }
+ if ((syncType == DRI_2D_SYNC) && (oldContextType == DRI_NO_CONTEXT) &&
+ (newContextType == DRI_2D_CONTEXT)) { /* Exiting from Block Handler */
+ MGALostContext(pScreen);
+ }
+}
+
+/* Needs to be written */
+void MGASelectBuffer(MGAPtr pMGA, int which)
+{
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h
new file mode 100644
index 000000000..7196bc954
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h
@@ -0,0 +1,50 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.1 2000/02/11 17:25:55 dawes Exp $ */
+
+#ifndef _MGA_DRI_
+#define _MGA_DRI_
+
+#include <xf86drm.h>
+#include "mga_drm_public.h"
+
+typedef struct _mga_dri_server_private {
+ int reserved_map_agpstart;
+ int reserved_map_idx;
+ int buffer_map_idx;
+ int sarea_priv_offset;
+ int primary_size;
+ int warp_ucode_size;
+ int chipset;
+ int sgram;
+ unsigned long agpMode;
+ unsigned long agpHandle;
+ drmHandle agp_private;
+ drmSize agpSizep;
+ drmAddress agpBase;
+ int irq;
+ drmHandle regs;
+ drmSize regsSize;
+ drmAddress regsMap;
+ mgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES];
+ drmBufMapPtr drmBufs;
+ CARD8 *agp_map;
+} MGADRIServerPrivate, *MGADRIServerPrivatePtr;
+
+typedef struct {
+ int deviceID;
+ int width;
+ int height;
+ int mem;
+ int cpp;
+ int stride;
+ int fbOffset;
+ int backOffset;
+ int depthOffset;
+ int textureOffset;
+ int textureSize;
+ drmHandle agp;
+ drmSize agpSize;
+} MGADRIRec, *MGADRIPtr;
+
+
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h
new file mode 100644
index 000000000..841c17cb9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h
@@ -0,0 +1,24 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.1 2000/02/11 17:25:55 dawes Exp $ */
+
+#ifndef _MGA_DRIPRIV_H_
+#define _MGA_DRIPRIV_H_
+
+#define MGA_MAX_DRAWABLES 256
+
+extern void GlxSetVisualConfigs(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **configprivs
+);
+
+typedef struct {
+ /* Nothing here yet */
+ int dummy;
+} MGAConfigPrivRec, *MGAConfigPrivPtr;
+
+typedef struct {
+ /* Nothing here yet */
+ int dummy;
+} MGADRIContextRec, *MGADRIContextPtr;
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_drm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_drm.c
new file mode 100644
index 000000000..6dbebb162
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_drm.c
@@ -0,0 +1,100 @@
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "xf86Priv.h"
+#include "mga_bios.h"
+#include "mga_reg.h"
+#include "mga.h"
+#include "mga_macros.h"
+#include "mga_dri.h"
+
+#ifndef XFree86LOADER
+#include <sys/stat.h>
+#include <sys/mman.h>
+#endif
+
+#include "xf86drm.h"
+#include "drm.h"
+#include "mga_drm_public.h"
+
+Bool mgadrmCleanupDma(ScrnInfoPtr pScrn)
+{
+ MGAPtr pMGA = MGAPTR(pScrn);
+ drm_mga_init_t init;
+
+ memset(&init, 0, sizeof(drm_mga_init_t));
+ init.func = MGA_CLEANUP_DMA;
+
+ if(ioctl(pMGA->drmSubFD, DRM_IOCTL_MGA_INIT, &init)) {
+ ErrorF("Mga Dma Cleanup Failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int mgadrmInitDma(ScrnInfoPtr pScrn, int prim_size)
+{
+ MGAPtr pMGA = MGAPTR(pScrn);
+ MGADRIPtr pMGADRI = (MGADRIPtr)pMGA->pDRIInfo->devPrivate;
+ MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
+ drm_mga_init_t init;
+
+ memset(&init, 0, sizeof(drm_mga_init_t));
+ init.func = MGA_INIT_DMA;
+ init.reserved_map_agpstart = 0;
+ init.reserved_map_idx = 3;
+ init.buffer_map_idx = 4;
+ init.sarea_priv_offset = sizeof(XF86DRISAREARec);
+ init.primary_size = prim_size;
+ init.warp_ucode_size = pMGADRIServer->warp_ucode_size;
+
+ switch(pMGA->Chipset) {
+ case PCI_CHIP_MGAG400:
+ init.chipset = MGA_CARD_TYPE_G400;
+ break;
+ case PCI_CHIP_MGAG200:
+ init.chipset = MGA_CARD_TYPE_G200;
+ break;
+ case PCI_CHIP_MGAG200_PCI:
+ default:
+ ErrorF("Direct rendering not supported on this card/chipset\n");
+ return FALSE;
+ }
+
+ init.fbOffset = pMGADRI->fbOffset;
+ init.backOffset = pMGADRI->backOffset;
+ init.depthOffset = pMGADRI->depthOffset;
+ init.textureOffset = pMGADRI->textureOffset;
+ init.textureSize = pMGADRI->textureSize;
+ init.cpp = pMGADRI->cpp;
+ init.stride = pMGADRI->stride;
+
+ init.frontOrg = pMGA->DstOrg;
+ init.backOrg = pMGADRI->backOffset; /* */
+ init.depthOrg = pMGADRI->textureOffset;
+ init.mAccess = pMGA->MAccess;
+
+ if (pMGA->HasSDRAM)
+ init.sgram = 0;
+ else
+ init.sgram = 1;
+
+ memcpy(&init.WarpIndex, &pMGADRIServer->WarpIndex,
+ sizeof(mgaWarpIndex) * MGA_MAX_WARP_PIPES);
+
+
+
+ ErrorF("Mga Dma Initialization start\n");
+
+ if(ioctl(pMGA->drmSubFD, DRM_IOCTL_MGA_INIT, &init)) {
+ ErrorF("Mga Dma Initialization Failed\n");
+ return FALSE;
+ }
+ ErrorF("Mga Dma Initialization done\n");
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_ucode.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_ucode.h
new file mode 100644
index 000000000..2921ceb13
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_ucode.h
@@ -0,0 +1,11610 @@
+/*
+ * GLX Hardware Device Driver for Matrox G200/G400
+ *
+ * Warp Engine Microcode
+ *
+ * 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
+ * MATROX GRAPHICS INC., 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.
+ *
+ * (c) 1999 Matrox Graphics Inc.
+ *
+ */
+
+
+unsigned char WARP_G200_tgz[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 0xE0,
+
+0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80, 0x00, 0xE8,
+0x25, 0x30,
+0x2D, 0x30,
+
+0x35, 0x30,
+0xB5, 0x30,
+0xBD, 0x30,
+0x3D, 0x30,
+
+0x9C, 0xA7, 0x5B, 0x9F,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x84, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x82, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x7F, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgza[] = {
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 0xE0,
+
+0x41, 0xCC, 0x41, 0xCD,
+0x49, 0xCC, 0x49, 0xCD,
+
+0xD1, 0x41, 0xC0, 0xEC,
+0x51, 0xCC, 0x51, 0xCD,
+
+0x80, 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00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzaf[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 0xE0,
+
+0x41, 0xCC, 0x41, 0xCD,
+0x49, 0xCC, 0x49, 0xCD,
+
+0xD1, 0x41, 0xC0, 0xEC,
+0x51, 0xCC, 0x51, 0xCD,
+
+0x80, 0x04,
+0x10, 0x04,
+0x08, 0x04,
+0x00, 0xE0,
+
+0x00, 0xCC, 0xC0, 0xCD,
+0xD1, 0x49, 0xC0, 0xEC,
+
+0x8A, 0x1F, 0x20, 0xE9,
+0x8B, 0x3F, 0x20, 0x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A,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x6E, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzf[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 0xE0,
+
+0x41, 0xCC, 0x41, 0xCD,
+0x49, 0xCC, 0x49, 0xCD,
+
+0xD1, 0x41, 0xC0, 0xEC,
+0x51, 0xC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
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x72, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzs[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 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BD,
+
+0x9F, 0x41, 0x49, 0xBD,
+0x00, 0x80, 0x00, 0xE8,
+
+0x25, 0x41, 0x49, 0xBD,
+0x2D, 0x41, 0x51, 0xBD,
+
+0x0D, 0x80, 0x07, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x35, 0x40, 0x48, 0xBD,
+0x3D, 0x40, 0x50, 0xBD,
+
+0x00, 0x80, 0x00, 0xE8,
+0x25, 0x30,
+0x2D, 0x30,
+
+0x35, 0x30,
+0xB5, 0x30,
+0xBD, 0x30,
+0x3D, 0x30,
+
+0x9C, 0xA7, 0x5B, 0x9F,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x6B, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x69, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x66, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzsa[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+0x81, 0x04,
+0x89, 0x04,
+0x01, 0x04,
+0x09, 0x04,
+
+0xC9, 0x41, 0xC0, 0xEC,
+0x11, 0x04,
+0x00, 0xE0,
+
+0x41, 0xCC, 0x41, 0xCD,
+0x49, 0xCC, 0x49, 0xCD,
+
+0xD1, 0x41, 0xC0, 0xEC,
+0x51, 0xCC, 0x51, 0xCD,
+
+0x80, 0x04,
+0x10, 0x04,
+0x08, 0x04,
+0x00, 0xE0,
+
+0x00, 0xCC, 0xC0, 0xCD,
+0xD1, 0x49, 0xC0, 0xEC,
+
+0x8A, 0x1F, 0x20, 0xE9,
+0x8B, 0x3F, 0x20, 0xE9,
+
+0x41, 0x3C, 0x41, 0xAD,
+0x49, 0x3C, 0x49, 0xAD,
+
+0x10, 0xCC, 0x10, 0xCD,
+0x08, 0xCC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, 0x00, 0xE8,
+
+0x35, 0x40, 0x48, 0xBD,
+0x3D, 0x40, 0x50, 0xBD,
+
+0x00, 0x80, 0x00, 0xE8,
+0x25, 0x30,
+0x2D, 0x30,
+
+0x35, 0x30,
+0xB5, 0x30,
+0xBD, 0x30,
+0x3D, 0x30,
+
+0x9C, 0xA7, 0x5B, 0x9F,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x67, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x65, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x62, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzsaf[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE9,
+0x40, 0x40, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0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0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x62, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x60, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x5D, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G200_tgzsf[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x98, 0xA0, 0xE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0xE0,
+
+0x65, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x62, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+unsigned char WARP_G400_t2gz[] = {
+
+0x00, 0x8A, 0x98, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x0A, 0x40, 0x50, 0xBF,
+0x2A, 0x40, 0x60, 0xBF,
+
+0x32, 0x41, 0x51, 0xBF,
+0x3A, 0x41, 0x61, 0xBF,
+
+0xC3, 0x6B,
+0xD3, 0x6B,
+0x00, 0x8A, 0x98, 0xE9,
+
+0x73, 0x7B, 0xC8, 0xEC,
+0x96, 0xE2,
+0x41, 0x04,
+
+0x7B, 0x43, 0xA0, 0xE8,
+0x73, 0x53, 0xA0, 0xE8,
+
+0xAD, 0xEE, 0x23, 0x9F,
+0x00, 0xE0,
+0x51, 0x04,
+
+0x90, 0xE2,
+0x61, 0x04,
+0x31, 0x46, 0xB1, 0xE8,
+
+0x51, 0x41, 0xE0, 0xEC,
+0x39, 0x67, 0xB1, 0xE8,
+
+0x00, 0x04,
+0x46, 0xE2,
+0x73, 0x63, 0xA0, 0xE8,
+
+0x61, 0x41, 0xE0, 0xEC,
+0x31, 0x00,
+0x39, 0x00,
+
+0x78, 0x80, 0x15, 0xEA,
+0x10, 0x04,
+0x20, 0x04,
+
+0x61, 0x51, 0xE0, 0xEC,
+0x2F, 0x41, 0x60, 0xEA,
+
+0x31, 0x20,
+0x39, 0x20,
+0x1F, 0x42, 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+0x68, 0x33, 0x68, 0xCF,
+0x49, 0x3B, 0x49, 0xCF,
+
+0xBA, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x58, 0x33, 0x58, 0xCF,
+0x69, 0x3B, 0x69, 0xCF,
+
+0x79, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+unsigned char WARP_G400_t2gzaf[] = {
+
+0x00, 0x8A, 0x98, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x0A, 0x40, 0x50, 0xBF,
+0x2A, 0x40, 0x60, 0xBF,
+
+0x32, 0x41, 0x51, 0xBF,
+0x3A, 0x41, 0x61, 0xBF,
+
+0xC3, 0x6B,
+0xD3, 0x6B,
+0x00, 0x8A, 0x98, 0xE9,
+
+0x73, 0x7B, 0xC8, 0xEC,
+0x96, 0xE2,
+0x41, 0x04,
+
+0x7B, 0x43, 0xA0, 0xE8,
+0x73, 0x53, 0xA0, 0xE8,
+
+0xAD, 0xEE, 0x23, 0x9F,
+0x00, 0xE0,
+0x51, 0x04,
+
+0x90, 0xE2,
+0x61, 0x04,
+0x31, 0x46, 0xB1, 0xE8,
+
+0x51, 0x41, 0xE0, 0xEC,
+0x39, 0x67, 0xB1, 0xE8,
+
+0x00, 0x04,
+0x46, 0xE2,
+0x73, 0x63, 0xA0, 0xE8,
+
+0x61, 0x41, 0xE0, 0xEC,
+0x31, 0x00,
+0x39, 0x00,
+
+0x81, 0x80, 0x15, 0xEA,
+0x10, 0x04,
+0x20, 0x04,
+
+0x61, 0x51, 0xE0, 0xEC,
+0x2F, 0x41, 0x60, 0xEA,
+
+0x31, 0x20,
+0x39, 0x20,
+0x1F, 0x42, 0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igned char WARP_G400_tgzf[] = {
+
+0x00, 0x88, 0x98, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x22, 0x40, 0x48, 0xBF,
+0x2A, 0x40, 0x50, 0xBF,
+
+0x32, 0x41, 0x49, 0xBF,
+0x3A, 0x41, 0x51, 0xBF,
+
+0xC3, 0x6B,
+0xCB, 0x6B,
+0x00, 0x88, 0x98, 0xE9,
+
+0x73, 0x7B, 0xC8, 0xEC,
+0x96, 0xE2,
+0x41, 0x04,
+
+0x7B, 0x43, 0xA0, 0xE8,
+0x73, 0x4B, 0xA0, 0xE8,
+
+0xAD, 0xEE, 0x29, 0x9F,
+0x00, 0xE0,
+0x49, 0x04,
+
+0x90, 0xE2,
+0x51, 0x04,
+0x31, 0x46, 0xB1, 0xE8,
+
+0x49, 0x41, 0xC0, 0xEC,
+0x39, 0x57, 0xB1, 0xE8,
+
+0x00, 0x04,
+0x46, 0xE2,
+0x73, 0x53, 0xA0, 0xE8,
+
+0x51, 0x41, 0xC0, 0xEC,
+0x31, 0x00,
+0x39, 0x00,
+
+0x5D, 0x80, 0x15, 0xEA,
+0x08, 0x04,
+0x10, 0x04,
+
+0x51, 0x49, 0xC0, 0xEC,
+0x2F, 0x41, 0x60, 0xEA,
+
+0x31, 0x20,
+0x39, 0x20,
+0x1F, 0x42, 0xA0, 0xE8,
+
+0x2A, 0x42, 0x4A, 0xBF,
+0x27, 0x4A, 0xA0, 0xE8,
+
+0x1A, 0x42, 0x52, 0xBF,
+0x1E, 0x49, 0x60, 0xEA,
+
+0x73, 0x7B, 0xC8, 0xEC,
+0x26, 0x51, 0x60, 0xEA,
+
+0x32, 0x40, 0x48, 0xBD,
+0x22, 0x40, 0x50, 0xBD,
+
+0x12, 0x41, 0x49, 0xBD,
+0x3A, 0x41, 0x51, 0xBD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+0x57, 0x3B, 0x57, 0xCF,
+
+0x98, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+unsigned char WARP_G400_tgzs[] = {
+
+0x00, 0x88, 0x98, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+0xFF, 0x80, 0xC0, 0xE9,
+0x00, 0x80, 0x00, 0xE8,
+
+0x22, 0x40, 0x48, 0xBF,
+0x2A, 0x40, 0x50, 0xBF,
+
+0x32, 0x41, 0x49, 0xBF,
+0x3A, 0x41, 0x51, 0xBF,
+
+0xC3, 0x6B,
+0xCB, 0x6B,
+0x00, 0x88, 0x98, 0xE9,
+
+0x73, 0x7B, 0xC8, 0xEC,
+0x96, 0xE2,
+0x41, 0x04,
+
+0x7B, 0x43, 0xA0, 0xE8,
+0x73, 0x4B, 0xA0, 0xE8,
+
+0xAD, 0xEE, 0x29, 0x9F,
+0x00, 0xE0,
+0x49, 0x04,
+
+0x90, 0xE2,
+0x51, 0x04,
+0x31, 0x46, 0xB1, 0xE8,
+
+0x49, 0x41, 0xC0, 0xEC,
+0x39, 0x57, 0xB1, 0xE8,
+
+0x00, 0x04,
+0x46, 0xE2,
+0x73, 0x53, 0xA0, 0xE8,
+
+0x51, 0x41, 0xC0, 0xEC,
+0x31, 0x00,
+0x39, 0x00,
+
+0x65, 0x80, 0x15, 0xEA,
+0x08, 0x04,
+0x10, 0x04,
+
+0x51, 0x49, 0xC0, 0xEC,
+0x2F, 0x41, 0x60, 0xEA,
+
+0x31, 0x20,
+0x39, 0x20,
+0x1F, 0x42, 0xA0, 0xE8,
+
+0x2A, 0x42, 0x4A, 0xBF,
+0x27, 0x4A, 0xA0, 0xE8,
+
+0x1A, 0x42, 0x52, 0xBF,
+0x1E, 0x49, 0x60, 0xEA,
+
+0x73, 0x7B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0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
index 1474d5f40..88c1784d4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.7 1999/12/30 21:40:50 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.8 2000/01/18 16:35:51 tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -36,9 +36,9 @@ static void MGAQueryBestSizeG(ScrnInfoPtr, Bool,
short, short, short, short, unsigned int *, unsigned int *, pointer);
static int MGAPutImageG( ScrnInfoPtr,
short, short, short, short, short, short, short, short,
- int, char*, short, short, Bool, RegionPtr, pointer);
+ int, unsigned char*, short, short, Bool, RegionPtr, pointer);
static int MGAQueryImageAttributesG(ScrnInfoPtr,
- int, short *, short *, int *, int *);
+ int, unsigned short *, unsigned short *, int *, int *);
static void MGABlockHandler(int, pointer, pointer, pointer);
@@ -528,7 +528,7 @@ MGAPutImageG(
short drw_x, short drw_y,
short src_w, short src_h,
short drw_w, short drw_h,
- int id, char* buf,
+ int id, unsigned char* buf,
short width, short height,
Bool sync,
RegionPtr clipBoxes, pointer data
@@ -723,7 +723,7 @@ static int
MGAQueryImageAttributesG(
ScrnInfoPtr pScrn,
int id,
- short *w, short *h,
+ unsigned short *w, unsigned short *h,
int *pitches, int *offsets
){
int size, tmp;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c
new file mode 100644
index 000000000..9bd43318a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c
@@ -0,0 +1,224 @@
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "mga_bios.h"
+#include "mga_reg.h"
+#include "mga.h"
+#include "mga_macros.h"
+#include "mgareg_flags.h"
+#include "mga_ucode.h"
+#include "mga_dri.h"
+
+Bool mgaConfigureWarp(ScrnInfoPtr pScrn)
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+ int wmisc;
+
+ WAITFIFO(3);
+
+ switch(pMga->Chipset) {
+ case PCI_CHIP_MGAG400:
+ OUTREG(MGAREG_WIADDR2, WIA_wmode_suspend);
+ OUTREG(MGAREG_WGETMSB, 0x00000E00);
+ OUTREG(MGAREG_WVRTXSZ, 0x00001807);
+ OUTREG(MGAREG_WACCEPTSEQ, 0x18000000);
+ break;
+
+ case PCI_CHIP_MGAG200:
+#if 0
+ case PCI_CHIP_MGAG200_PCI:
+#endif
+ OUTREG(MGAREG_WIADDR, WIA_wmode_suspend);
+ OUTREG(MGAREG_WGETMSB, 0x1606);
+ OUTREG(MGAREG_WVRTXSZ, 7); /* may be set on something else later on*/
+ break;
+
+ default:
+ ErrorF("Only Matrox G200 and G400 work correctly under the DRI\n");
+ return FALSE;
+ }
+
+ WAITFIFO(1);
+ OUTREG(MGAREG_WMISC, WM_wucodecache_enable |
+ WM_wmaster_enable |
+ WM_wcacheflush_enable);
+ wmisc = INREG(MGAREG_WMISC);
+ if(wmisc != (WM_wucodecache_enable | WM_wmaster_enable)) {
+ FatalError("[mga] WARP engine wrongly configured (%d != %d)."
+ " Switch off your PC and try again.\n", wmisc,
+ WM_wmaster_enable | WM_wucodecache_enable);
+ }
+
+ return TRUE;
+}
+
+static unsigned int mgaG400GetMicrocodeSize(MGAPtr pMGA)
+{
+#define CODESIZE(which) ((sizeof(which)/256 + 1)*256)
+
+ unsigned int microcode_size = 0;
+
+ microcode_size = CODESIZE(WARP_G400_t2gz) + CODESIZE(WARP_G400_t2gza) +
+ CODESIZE(WARP_G400_t2gzaf) + CODESIZE(WARP_G400_t2gzf) +
+ CODESIZE(WARP_G400_t2gzs) + CODESIZE(WARP_G400_t2gzsa) +
+ CODESIZE(WARP_G400_t2gzsaf) + CODESIZE(WARP_G400_t2gzsf) +
+ CODESIZE(WARP_G400_tgz) + CODESIZE(WARP_G400_tgza) +
+ CODESIZE(WARP_G400_tgzaf) + CODESIZE(WARP_G400_tgzf) +
+ CODESIZE(WARP_G400_tgzs) + CODESIZE(WARP_G400_tgzsa) +
+ CODESIZE(WARP_G400_tgzsaf) + CODESIZE(WARP_G400_tgzsf);
+ microcode_size = ((microcode_size + 4096 - 1) / 4096) * 4096;
+ return(microcode_size);
+
+#undef CODESIZE
+}
+
+static unsigned int mgaG200GetMicrocodeSize(MGAPtr pMGA)
+{
+#define CODESIZE(which) ((sizeof(which)/256 + 1)*256)
+
+ unsigned int microcode_size;
+
+ microcode_size = CODESIZE(WARP_G200_tgz) +
+ CODESIZE(WARP_G200_tgza) + CODESIZE(WARP_G200_tgzaf) +
+ CODESIZE(WARP_G200_tgzf) + CODESIZE(WARP_G200_tgzs) +
+ CODESIZE(WARP_G200_tgzsa) + CODESIZE(WARP_G200_tgzsaf) +
+ CODESIZE(WARP_G200_tgzsf);
+ microcode_size = ((microcode_size + 4096 - 1) / 4096) * 4096;
+ return(microcode_size);
+#undef CODESIZE
+}
+static unsigned int mgaG400InstallMicrocode(MGAPtr pMGA, int agp_offset)
+{
+#define mgaWarpInstallCode(which, where) {\
+ pMGADRIServer->WarpIndex[where].installed = 1; \
+ pMGADRIServer->WarpIndex[where].phys_addr = pcbase; \
+ pMGADRIServer->WarpIndex[where].size = sizeof(WARP_G400_ ## which); \
+ memcpy(vcbase, WARP_G400_ ## which, sizeof(WARP_G400_ ## which)); \
+ pcbase += (sizeof(WARP_G400_ ## which) / 256 + 1) * 256; \
+ vcbase += (sizeof(WARP_G400_ ## which) / 256 + 1) * 256; \
+ }
+
+ MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
+ CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset;
+ CARD32 pcbase = (CARD32)pMGADRIServer->agpBase + agp_offset;
+ unsigned int microcode_size = 0;
+
+ memset(pMGADRIServer->WarpIndex, 0,
+ sizeof(mgaWarpIndex) * MGA_MAX_WARP_PIPES);
+ microcode_size = mgaG400GetMicrocodeSize(pMGA);
+
+ mgaWarpInstallCode(tgz, MGA_WARP_TGZ);
+ mgaWarpInstallCode(tgzf, MGA_WARP_TGZF);
+ mgaWarpInstallCode(tgza, MGA_WARP_TGZA);
+ mgaWarpInstallCode(tgzaf, MGA_WARP_TGZAF);
+ mgaWarpInstallCode(tgzs, MGA_WARP_TGZS);
+ mgaWarpInstallCode(tgzsf, MGA_WARP_TGZSF);
+ mgaWarpInstallCode(tgzsa, MGA_WARP_TGZSA);
+ mgaWarpInstallCode(tgzsaf, MGA_WARP_TGZSAF);
+ mgaWarpInstallCode(t2gz, MGA_WARP_T2GZ);
+ mgaWarpInstallCode(t2gzf, MGA_WARP_T2GZF);
+ mgaWarpInstallCode(t2gza, MGA_WARP_T2GZA);
+ mgaWarpInstallCode(t2gzaf, MGA_WARP_T2GZAF);
+ mgaWarpInstallCode(t2gzs, MGA_WARP_T2GZS);
+ mgaWarpInstallCode(t2gzsf, MGA_WARP_T2GZSF);
+ mgaWarpInstallCode(t2gzsa, MGA_WARP_T2GZSA);
+ mgaWarpInstallCode(t2gzsaf, MGA_WARP_T2GZSAF);
+
+#undef mgaWarpInstallCode
+
+ return microcode_size;
+}
+
+static unsigned int mgaG200InstallMicrocode(MGAPtr pMGA, int agp_offset)
+{
+#define mgaWarpInstallCode(which,where) {\
+ pMGADRIServer->WarpIndex[where].installed = 1; \
+ pMGADRIServer->WarpIndex[where].phys_addr = pcbase; \
+ pMGADRIServer->WarpIndex[where].size = sizeof(WARP_G200_ ## which); \
+ memcpy(vcbase, WARP_G200_ ## which, sizeof(WARP_G200_ ## which)); \
+ pcbase += (sizeof(WARP_G200_ ## which) / 256 + 1) * 256; \
+ vcbase += (sizeof(WARP_G200_ ## which) / 256 + 1) * 256; \
+ }
+
+ MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
+ CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset;
+ CARD32 pcbase = (CARD32)pMGADRIServer->agpBase + agp_offset;
+ unsigned int microcode_size = 0;
+
+ memset(pMGADRIServer->WarpIndex, 0,
+ sizeof(mgaWarpIndex) * MGA_MAX_WARP_PIPES);
+
+ microcode_size = mgaG400GetMicrocodeSize(pMGA);
+ mgaWarpInstallCode(tgz, MGA_WARP_TGZ);
+ mgaWarpInstallCode(tgza, MGA_WARP_TGZA);
+ mgaWarpInstallCode(tgzaf, MGA_WARP_TGZAF);
+ mgaWarpInstallCode(tgzf, MGA_WARP_TGZF);
+ mgaWarpInstallCode(tgzs, MGA_WARP_TGZS);
+ mgaWarpInstallCode(tgzsa, MGA_WARP_TGZSA);
+ mgaWarpInstallCode(tgzsaf, MGA_WARP_TGZSAF);
+ mgaWarpInstallCode(tgzsf, MGA_WARP_TGZSF);
+
+#undef mgaWarpInstallCode
+
+ return microcode_size;
+}
+
+unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ int retval;
+
+ switch(pMGA->Chipset) {
+ case PCI_CHIP_MGAG400:
+ retval = mgaG400GetMicrocodeSize(pMGA);
+ break;
+ case PCI_CHIP_MGAG200:
+ retval = mgaG200GetMicrocodeSize(pMGA);
+ break;
+#if 0
+ case PCI_CHIP_MGAG200_PCI:
+ retval = mgaG200GetMicrocodeSize(pMGA);
+ break;
+#endif
+
+ default:
+ ErrorF("Only Matrox G200 and G400 work correctly under the DRI\n");
+ retval = 0;
+ }
+
+ return(retval);
+}
+
+unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMGA = MGAPTR(pScrn);
+ int retval;
+
+ switch(pMGA->Chipset) {
+ case PCI_CHIP_MGAG400:
+ retval = mgaG400InstallMicrocode(pMGA, agp_offset);
+ break;
+ case PCI_CHIP_MGAG200:
+ retval = mgaG200InstallMicrocode(pMGA, agp_offset);
+ break;
+#if 0
+ case PCI_CHIP_MGAG200_PCI:
+ retval = mgaG200InstallMicrocode(pMGA);
+ break;
+#endif
+
+ default:
+ ErrorF("Only Matrox G200 and G400 work correctly under the DRI\n");
+ retval = 0;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "WARP Microcode Loaded\n");
+
+ return retval;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h
new file mode 100644
index 000000000..901f18310
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h
@@ -0,0 +1,930 @@
+/* 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.
+ */
+
+#ifndef _MGAREGS_H_
+#define _MGAREGS_H_
+
+/*************** (START) AUTOMATICLY GENERATED REGISTER FILE *****************/
+/*
+ * Generated on Sat Nov 20 21:25:36 CST 1999
+ */
+
+
+
+/*
+ * Power Graphic Mode Memory Space Registers
+ */
+
+ #define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */
+ #define AGP_PLL_agp2xpllen_disable 0x0
+ #define AGP_PLL_agp2xpllen_enable 0x1
+
+ #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 AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR0_ar0_SHIFT 0
+
+ #define AR1_ar1_MASK 0xff000000 /* bits 0-23 */
+ #define AR1_ar1_SHIFT 0
+
+ #define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR2_ar2_SHIFT 0
+
+ #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 AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR4_ar4_SHIFT 0
+
+ #define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR5_ar5_SHIFT 0
+
+ #define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR6_ar6_SHIFT 0
+
+ #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 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 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 BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */
+ #define BHISF_beshiscal_SHIFT 2
+
+ #define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */
+ #define BHSE_beshsrcend_SHIFT 2
+
+ #define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */
+ #define BHSL_beshsrclst_SHIFT 16
+
+ #define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */
+ #define BHSS_beshsrcst_SHIFT 2
+
+ #define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */
+ #define BP_bespitch_SHIFT 0
+
+ #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 BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */
+ #define BSF_besv1srclast_SHIFT 0
+
+ #define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */
+ #define BSF_besv2srclst_SHIFT 0
+
+ #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 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 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 BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */
+ #define BVISF_besviscal_SHIFT 2
+
+ #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 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 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 DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */
+ #define DS_dwgsyncaddr_SHIFT 2
+
+ #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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 SETDCA_setupmod_MASK 0xfffffffc /* bits 0-1 */
+ #define SETDCA_setupmod_vertlist 0x0 /* val 0, shift 0 */
+ #define SETDCA_setupaddress_MASK 0x3 /* bits 2-31 */
+ #define SETDCA_setupaddress_SHIFT 2
+
+ #define SETDEA_setupagpxfer_MASK 0xfffffffd /* bit 1 */
+ #define SETDEA_setupagpxfer_disable 0x0
+ #define SETDEA_setupagpxfer_enable 0x2
+ #define SETDEA_setupend_MASK 0x3 /* bits 2-31 */
+ #define SETDEA_setupend_SHIFT 2
+
+ #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 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 STH_softraphand_MASK 0x3 /* bits 2-31 */
+ #define STH_softraphand_SHIFT 2
+
+ #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 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 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 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 TD1_color1arg2selMASK 0xfffffffc /* bits 0-1 */
+ #define TD1_color1alphaselMASK 0xffffffe3 /* bits 2-4 */
+ #define TD1_color1alphaselSHIFT 2
+ #define TD1_color1arg1alphaMASK 0xffffffdf /* bit 5 */
+ #define TD1_color1arg1alphadisable 0x0
+ #define TD1_color1arg1alphaenable 0x20
+ #define TD1_color1arg1invMASK 0xffffffbf /* bit 6 */
+ #define TD1_color1arg1invdisable 0x0
+ #define TD1_color1arg1invenable 0x40
+ #define TD1_color1arg2alphaMASK 0xffffff7f /* bit 7 */
+ #define TD1_color1arg2alphadisable 0x0
+ #define TD1_color1arg2alphaenable 0x80
+ #define TD1_color1arg2invMASK 0xfffffeff /* bit 8 */
+ #define TD1_color1arg2invdisable 0x0
+ #define TD1_color1arg2invenable 0x100
+ #define TD1_color1alpha1invMASK 0xfffffdff /* bit 9 */
+ #define TD1_color1alpha1invdisable 0x0
+ #define TD1_color1alpha1invenable 0x200
+ #define TD1_color1alpha2invMASK 0xfffffbff /* bit 10 */
+ #define TD1_color1alpha2invdisable 0x0
+ #define TD1_color1alpha2invenable 0x400
+ #define TD1_color1selMASK 0xff9fffff /* bits 21-22 */
+ #define TD1_color1selarg1 0x0 /* val 0, shift 21 */
+ #define TD1_color1selarg2 0x200000 /* val 1, shift 21 */
+ #define TD1_color1seladd 0x400000 /* val 2, shift 21 */
+ #define TD1_color1selmul 0x600000 /* val 3, shift 21 */
+ #define TD1_alpha1selMASK 0x3fffffff /* bits 30-31 */
+ #define TD1_alpha1selarg1 0x0 /* val 0, shift 30 */
+ #define TD1_alpha1selarg2 0x40000000 /* val 1, shift 30 */
+ #define TD1_alpha1seladd 0x80000000 /* val 2, shift 30 */
+ #define TD1_alpha1selmul 0xc0000000 /* val 3, shift 30 */
+
+ #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 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_tw422 0xa /* val 10, 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 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 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_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 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 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_texorg_MASK 0x1f /* bits 5-31 */
+ #define TO_texorg_SHIFT 5
+
+ #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 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 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 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 WMA_wcodeaddr_MASK 0xff /* bits 8-31 */
+ #define WMA_wcodeaddr_SHIFT 8
+
+ #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 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 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 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 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 WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */
+ #define WIMA_wimemaddr_SHIFT 0
+
+ #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 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 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 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 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 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 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 ******************/
+
+#endif /* _MGAREGS_H_ */
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c
index 08f4bd11c..fc6762c4c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c
@@ -2,7 +2,7 @@
Copyright (c) 1999, The XFree86 Project Inc.
Written by Mark Vojkovich <markv@valinux.com>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.3 1999/12/28 18:27:58 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.4 2000/02/08 17:19:10 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -12,6 +12,7 @@
#include "xf86Pci.h"
#include "shadowfb.h"
#include "servermd.h"
+#include "nv_local.h"
#include "nv_type.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
index ccb80961a..86cf766a4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile,v 1.1 1999/11/19 13:54:42 hohndel Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile,v 1.4 2000/02/14 19:20:49 dawes Exp $
XCOMM
XCOMM This is the Imakefile for the ATI Rage 128 (r128) driver.
XCOMM
@@ -16,9 +16,11 @@ INCLUDES = -I. -I../../include
INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
-I$(XF86SRC)/xaa -I$(XF86SRC)/rac \
+ -I$(SERVERSRC)/fb \
-I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \
- -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
- -I$(SERVERSRC)/Xext \
+ -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \
+ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+ -I$(XF86SRC)/int10 -I$(SERVERSRC)/Xext \
-I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
-I$(EXTINCSRC) -I$(XF86SRC)/xf24_32bpp
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
index b0e4d70af..bf282c937 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.1 1999/11/19 13:54:42 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.7 2000/02/18 16:23:22 dawes Exp $ */
/**************************************************************************
Copyright 1999 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -37,7 +37,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _R128_H_
#define _R128_H_
-#define R128_DEBUG 0 /* Turn on debugging output */
+#define R128_DEBUG 0 /* Turn off debugging output */
#define R128_TIMEOUT 2000000 /* Fall out of wait loops after this count */
#define R128_MMIOSIZE 0x80000
@@ -92,6 +92,7 @@ typedef struct {
CARD32 gen_int_cntl;
CARD32 cap0_trig_cntl;
CARD32 cap1_trig_cntl;
+ CARD32 bus_cntl;
/* Other registers to save for VT switches */
CARD32 dp_datatype;
@@ -146,6 +147,8 @@ typedef struct {
PCITAG PciTag;
int Chipset;
Bool Primary;
+
+ Bool FBDev;
unsigned long LinearAddr; /* Frame buffer physical address */
unsigned long MMIOAddr; /* MMIO region physical address */
@@ -155,6 +158,7 @@ typedef struct {
unsigned char *FB; /* Map of frame buffer */
CARD32 MemCntl;
+ CARD32 BusCntl;
unsigned long FbMapSize; /* Size of frame buffer, in bytes */
int Flags; /* Saved copy of mode flags */
@@ -202,6 +206,7 @@ extern int INPLL(ScrnInfoPtr pScrn, int addr);
extern void R128WaitForVerticalSync(ScrnInfoPtr pScrn);
extern Bool R128AccelInit(ScreenPtr pScreen);
+extern void R128EngineInit(ScrnInfoPtr pScrn);
extern Bool R128CursorInit(ScreenPtr pScreen);
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
index 4a0a1089c..cb3faf061 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c,v 1.1 1999/11/19 13:54:43 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c,v 1.6 2000/02/13 19:33:55 martin Exp $ */
/**************************************************************************
Copyright 1999 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -76,6 +76,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R128_TRAPEZOIDS 0 /* Trapezoids don't work */
/* X and server generic header files */
+#include "Xarch.h"
#include "xf86.h"
#include "xf86_ansic.h"
#include "xf86_OSproc.h"
@@ -124,8 +125,8 @@ static struct {
/* Flush all dirty data in the Pixel Cache to memory. */
static void R128EngineFlush(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
+ int i;
+ R128MMIO_VARS();
OUTREGP(R128_PC_NGUI_CTLSTAT, R128_PC_FLUSH_ALL, ~R128_PC_FLUSH_ALL);
for (i = 0; i < R128_TIMEOUT; i++) {
@@ -136,10 +137,10 @@ static void R128EngineFlush(ScrnInfoPtr pScrn)
/* Reset graphics card to known state. */
static void R128EngineReset(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- CARD32 clock_cntl_index;
- CARD32 mclk_cntl;
- CARD32 gen_reset_cntl;
+ CARD32 clock_cntl_index;
+ CARD32 mclk_cntl;
+ CARD32 gen_reset_cntl;
+ R128MMIO_VARS();
R128EngineFlush(pScrn);
@@ -170,9 +171,9 @@ do { \
these slots are empty. */
static void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int i;
+ R128InfoPtr info = R128PTR(pScrn);
+ int i;
+ R128MMIO_VARS();
for (;;) {
for (i = 0; i < R128_TIMEOUT; i++) {
@@ -194,8 +195,8 @@ static void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
standard "sync" function that will make the hardware "quiescent". */
static void R128WaitForIdle(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
+ int i;
+ R128MMIO_VARS();
R128WaitForFifoFunction(pScrn, 64);
@@ -220,16 +221,18 @@ static void R128WaitForIdle(ScrnInfoPtr pScrn)
static void R128SetupForSolidFill(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
- R128WaitForFifo(pScrn, 3);
+ R128WaitForFifo(pScrn, 4);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
| R128_GMC_BRUSH_SOLID_COLOR
| R128_GMC_SRC_DATATYPE_COLOR
| R128_ROP[rop].pattern));
OUTREG(R128_DP_BRUSH_FRGD_CLR, color);
OUTREG(R128_DP_WRITE_MASK, planemask);
+ OUTREG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT
+ | R128_DST_Y_TOP_TO_BOTTOM));
}
/* Subsequent XAA SolidFillRect.
@@ -239,8 +242,8 @@ static void R128SetupForSolidFill(ScrnInfoPtr pScrn,
static void R128SubsequentSolidFillRect(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 2);
OUTREG(R128_DST_Y_X, (y << 16) | x);
@@ -251,8 +254,8 @@ static void R128SubsequentSolidFillRect(ScrnInfoPtr pScrn,
static void R128SetupForSolidLine(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 3);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -282,9 +285,9 @@ static void R128SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
int major, int minor,
int err, int len, int octant)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int flags = 0;
+ R128InfoPtr info = R128PTR(pScrn);
+ int flags = 0;
+ R128MMIO_VARS();
if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR;
if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT;
@@ -309,6 +312,13 @@ static void R128SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
static void R128SubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
int x, int y, int len, int dir )
{
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
+
+ R128WaitForFifo(pScrn, 1);
+ OUTREG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT
+ | R128_DST_Y_TOP_TO_BOTTOM));
+
if (dir == DEGREES_0) {
R128SubsequentSolidFillRect(pScrn, x, y, len, 1);
} else {
@@ -335,9 +345,9 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn,
int rop, unsigned int planemask,
int length, unsigned char *pattern)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- CARD32 pat = *(CARD32 *)pattern;
+ R128InfoPtr info = R128PTR(pScrn);
+ CARD32 pat = *(CARD32 *)pattern;
+ R128MMIO_VARS();
switch (length) {
case 2: pat |= pat << 2; /* fall through */
@@ -366,9 +376,9 @@ static void R128SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
int err, int len, int octant,
int phase)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int flags = 0;
+ R128InfoPtr info = R128PTR(pScrn);
+ int flags = 0;
+ R128MMIO_VARS();
if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR;
if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT;
@@ -399,12 +409,12 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int flags = 0;
- int Lymajor = 0;
- int Rymajor = 0;
- int origdxL = dxL;
- int origdxR = dxR;
+ int flags = 0;
+ int Lymajor = 0;
+ int Rymajor = 0;
+ int origdxL = dxL;
+ int origdxR = dxR;
+ R128MMIO_VARS();
R128TRACE(("Trap %d %d; L %d %d %d %d; R %d %d %d %d\n",
y, h,
@@ -462,8 +472,8 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
static void R128SetClippingRectangle(ScrnInfoPtr pScrn,
int left, int top, int right, int bottom)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
if (left > 8191 || top > 8191 || right > 8191 || bottom > 8191
|| left < 0 || top < 0 || right < 0 || bottom < 0
@@ -479,8 +489,8 @@ static void R128SetClippingRectangle(ScrnInfoPtr pScrn,
static void R128DisableClipping (ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 2);
OUTREG(R128_SC_TOP_LEFT, 0);
@@ -499,8 +509,8 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
unsigned int planemask,
int trans_color)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
info->xdir = xdir;
info->ydir = ydir;
@@ -532,8 +542,8 @@ static void R128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int x2, int y2,
int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
if (info->xdir < 0) x1 += w - 1, x2 += w - 1;
if (info->ydir < 0) y1 += h - 1, y2 += h - 1;
@@ -561,8 +571,8 @@ static void R128SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 6);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -584,8 +594,8 @@ static void R128SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
int patternx, int patterny,
int x, int y, int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 3);
OUTREG(R128_BRUSH_Y_X, (patterny << 8) | patternx);
@@ -603,8 +613,8 @@ static void R128SetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
int rop, unsigned int planemask,
int trans_color)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128TRACE(("Color8x8 %d %d %d\n", trans_color, patx, paty));
@@ -631,7 +641,7 @@ static void R128SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
int patx, int paty,
int x, int y, int w, int h)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
R128TRACE(("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h));
R128WaitForFifo(pScrn, 3);
@@ -690,8 +700,8 @@ static void R128SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
unsigned int
planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128WaitForFifo(pScrn, 4);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -714,8 +724,8 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int w, int h,
int skipleft)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
info->scanline_y = y;
info->scanline_x = x;
@@ -743,12 +753,12 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
once for each scanline. */
static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ R128InfoPtr info = R128PTR(pScrn);
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
int i;
- int left = info->scanline_words;
+ int left = info->scanline_words;
volatile CARD32 *d;
+ R128MMIO_VARS();
--info->scanline_h;
if (info->scanline_direct) {
@@ -800,8 +810,8 @@ static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn,
int bpp,
int depth)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
info->scanline_bpp = bpp;
@@ -831,8 +841,8 @@ static void R128SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
int w, int h,
int skipleft)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
info->scanline_y = y;
info->scanline_x = x;
@@ -860,12 +870,12 @@ static void R128SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
scanline. */
static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ R128InfoPtr info = R128PTR(pScrn);
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
int i;
- int left = info->scanline_words;
+ int left = info->scanline_words;
volatile CARD32 *d;
+ R128MMIO_VARS();
--info->scanline_h;
if (info->scanline_direct) {
@@ -902,10 +912,10 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
#endif
/* Initialize the acceleration hardware. */
-static void R128EngineInit(ScrnInfoPtr pScrn)
+void R128EngineInit(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128MMIO_VARS();
R128TRACE(("EngineInit (%d/%d)\n", info->pixel_code, pScrn->bitsPerPixel));
@@ -996,6 +1006,11 @@ Bool R128AccelInit(ScreenPtr pScreen)
| BIT_ORDER_IN_BYTE_LSBFIRST);
/* Indirect CPU-To-Screen Color Expand */
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ a->ScanlineCPUToScreenColorExpandFillFlags = 0;
+#else
+ a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST;
+#endif
a->NumScanlineColorExpandBuffers = 1;
a->ScanlineColorExpandBuffers = info->scratch_buffer;
#if R128_IMAGEWRITE
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
index 58b751e1c..eb9f93381 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c,v 1.1 1999/11/19 13:54:43 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c,v 1.4 2000/02/13 19:33:56 martin Exp $ */
/**************************************************************************
Copyright 1999 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -44,6 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* X and server generic header files */
+#include "Xarch.h"
#include "xf86.h"
#include "xf86_ansic.h"
#include "xf86_OSproc.h"
@@ -64,10 +65,19 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128.h"
#include "r128_reg.h"
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define P_SWAP( a , b ) \
+ ((char *)a)[0] = ((char *)b)[3]; \
+ ((char *)a)[1] = ((char *)b)[2]; \
+ ((char *)a)[2] = ((char *)b)[1]; \
+ ((char *)a)[3] = ((char *)b)[0]
+#endif
+
+
/* Set cursor foreground and background colors. */
static void R128SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREG(R128_CUR_CLR0, bg);
OUTREG(R128_CUR_CLR1, fg);
@@ -77,11 +87,11 @@ static void R128SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
(xorigin,yorigin). */
static void R128SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int xorigin = 0;
- int yorigin = 0;
- int total_y = pScrn->frameY1 - pScrn->frameY0;
+ R128InfoPtr info = R128PTR(pScrn);
+ int xorigin = 0;
+ int yorigin = 0;
+ int total_y = pScrn->frameY1 - pScrn->frameY0;
+ R128MMIO_VARS();
if (x < 0) xorigin = -x;
if (y < 0) yorigin = -y;
@@ -99,20 +109,31 @@ static void R128SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
will be called after this, so we can ignore xorigin and yorigin. */
static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- CARD32 *s = (CARD32 *)image;
- CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
+ R128InfoPtr info = R128PTR(pScrn);
+ CARD32 *s = (CARD32 *)image;
+ CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
int y;
CARD32 save;
+ R128MMIO_VARS();
save = INREG(R128_CRTC_GEN_CNTL);
OUTREG(R128_CRTC_GEN_CNTL, save & ~R128_CRTC_CUR_EN);
for (y = 0; y < 64; y++) {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ P_SWAP(d,s);
+ d++; s++;
+ P_SWAP(d,s);
+ d++; s++;
+ P_SWAP(d,s);
+ d++; s++;
+ P_SWAP(d,s);
+ d++; s++;
+#else
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
+#endif
}
OUTREG(R128_CRTC_GEN_CNTL, save);
}
@@ -120,7 +141,7 @@ static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
/* Hide hardware cursor. */
static void R128HideCursor(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREGP(R128_CRTC_GEN_CNTL, 0, ~R128_CRTC_CUR_EN);
}
@@ -128,7 +149,7 @@ static void R128HideCursor(ScrnInfoPtr pScrn)
/* Show hardware cursor. */
static void R128ShowCursor(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREGP(R128_CRTC_GEN_CNTL, R128_CRTC_CUR_EN, ~R128_CRTC_CUR_EN);
}
@@ -158,7 +179,10 @@ Bool R128CursorInit(ScreenPtr pScreen)
cursor->MaxWidth = 64;
cursor->MaxHeight = 64;
cursor->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
- | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+#endif
| HARDWARE_CURSOR_INVERT_MASK
| HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
| HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
index c26f1b959..11fdc40b1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.2 1999/12/27 00:16:08 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.18 2000/02/21 19:23:07 dawes Exp $ */
/**************************************************************************
Copyright 1999 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -64,13 +64,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86RAC.h"
#include "xf86cmap.h"
#include "xf86fbman.h"
-
+#include "xf86int10.h"
/* Backing store, software cursor, and
colormap initialization */
#include "mibstore.h"
#include "mipointer.h"
#include "micmap.h"
+#undef USE_FB /* not until overlays and 24->32 code added */
+#ifdef USE_FB
+#include "fb.h"
+#else
/* CFB support */
#define PSZ 8
#include "cfb.h"
@@ -79,7 +83,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "cfb24.h"
#include "cfb32.h"
#include "cfb24_32.h"
-
+#endif
/* Xv support */
#include "xf86xv.h"
#include "Xv.h"
@@ -87,6 +91,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* vgahw module (for VC save/restore only) */
#include "vgaHW.h"
+#include "fbdevhw.h"
+
/* XAA and Cursor Support */
#include "xaa.h"
#include "xf86Cursor.h"
@@ -109,6 +115,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Forward definitions for driver functions */
+static OptionInfoPtr R128AvailableOptions(int chipid, int busid);
static Bool R128Probe(DriverPtr drv, int flags);
static void R128Identify(int flags);
static Bool R128PreInit(ScrnInfoPtr pScrn, int flags);
@@ -122,13 +129,15 @@ static Bool R128EnterVT(int scrnIndex, int flags);
static void R128LeaveVT(int scrnIndex, int flags);
static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen);
static void R128FreeScreen(int scrnIndex, int flags);
-static Bool R128SaveScreen(ScreenPtr pScreen, Bool unblank);
+static Bool R128SaveScreen(ScreenPtr pScreen, int mode);
static void R128Save(ScrnInfoPtr pScrn);
static void R128Restore(ScrnInfoPtr pScrn);
static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
static Bool R128SwitchMode(int ScrnIndex, DisplayModePtr mode, int flags);
static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode, int flags);
+static Bool R128EnterVTFBDev(int scrnIndex, int flags);
+static void R128LeaveVTFBDev(int scrnIndex, int flags);
/* Define driver */
DriverRec R128 = {
@@ -136,6 +145,7 @@ DriverRec R128 = {
"ATI Rage 128",
R128Identify,
R128Probe,
+ R128AvailableOptions,
NULL
};
@@ -163,7 +173,8 @@ typedef enum {
OPTION_SW_CURSOR,
OPTION_HW_CURSOR,
OPTION_DAC_6BIT,
- OPTION_DAC_8BIT
+ OPTION_DAC_8BIT,
+ OPTION_FBDEV
} R128Opts;
static OptionInfoRec R128Options[] = {
@@ -172,6 +183,7 @@ static OptionInfoRec R128Options[] = {
{ OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, TRUE },
{ OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE },
+ { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -195,6 +207,34 @@ static const char *vgahwSymbols[] = {
NULL
};
+static const char *fbdevHWSymbols[] = {
+ "fbdevHWInit",
+ "fbdevHWUseBuildinMode",
+
+ "fbdevHWGetDepth",
+ "fbdevHWGetVidmem",
+
+ /* colormap */
+ "fbdevHWLoadPalette",
+
+ /* ScrnInfo hooks */
+ "fbdevHWSwitchMode",
+ "fbdevHWAdjustFrame",
+ "fbdevHWEnterVT",
+ "fbdevHWLeaveVT",
+ "fbdevHWValidMode",
+ "fbdevHWRestore",
+ "fbdevHWModeInit",
+ "fbdevHWSave",
+
+ "fbdevHWUnmapMMIO",
+ "fbdevHWUnmapVidmem",
+ "fbdevHWMapMMIO",
+ "fbdevHWMapVidmem",
+
+ NULL
+};
+
#if 0
/* Not used until DDC is supported. */
static const char *ddcSymbols[] = {
@@ -212,6 +252,12 @@ static const char *i2cSymbols[] = {
#endif
#ifdef XFree86LOADER
+#ifdef USE_FB
+static const char *fbSymbols[] = {
+ "fbScreenInit",
+ NULL
+};
+#else
static const char *cfbSymbols[] = {
"cfbScreenInit",
"cfb16ScreenInit",
@@ -220,6 +266,7 @@ static const char *cfbSymbols[] = {
"cfb24_32ScreenInit",
NULL
};
+#endif
static const char *xf8_32bppSymbols[] = {
"xf86Overlay8Plus32Init",
@@ -284,14 +331,18 @@ static pointer R128Setup(pointer module, pointer opts, int *errmaj,
* might refer to.
*/
LoaderRefSymLists(vgahwSymbols,
+#ifdef USE_FB
+ fbSymbols,
+#else
cfbSymbols,
+#endif
xaaSymbols,
xf8_32bppSymbols,
ramdacSymbols,
+ fbdevHWSymbols,
0 /* ddcsymbols */,
0 /* i2csymbols */,
0 /* shadowSymbols */,
- 0 /* fbdevsymbols */,
NULL);
/*
@@ -330,11 +381,15 @@ static Bool R128MapMMIO(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- info->MMIO = xf86MapPciMem(pScrn->scrnIndex,
- VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
- info->PciTag,
- info->MMIOAddr,
- R128_MMIOSIZE);
+ if (info->FBDev) {
+ info->MMIO = fbdevHWMapMMIO(pScrn);
+ } else {
+ info->MMIO = xf86MapPciMem(pScrn->scrnIndex,
+ VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
+ info->PciTag,
+ info->MMIOAddr,
+ R128_MMIOSIZE);
+ }
if (!info->MMIO) return FALSE;
return TRUE;
@@ -346,7 +401,11 @@ static Bool R128UnmapMMIO(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, R128_MMIOSIZE);
+ if (info->FBDev)
+ fbdevHWUnmapMMIO(pScrn);
+ else {
+ xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, R128_MMIOSIZE);
+ }
info->MMIO = NULL;
return TRUE;
}
@@ -356,11 +415,15 @@ static Bool R128MapFB(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- info->FB = xf86MapPciMem(pScrn->scrnIndex,
- VIDMEM_FRAMEBUFFER,
- info->PciTag,
- info->LinearAddr,
- info->FbMapSize);
+ if (info->FBDev) {
+ info->FB = fbdevHWMapVidmem(pScrn);
+ } else {
+ info->FB = xf86MapPciMem(pScrn->scrnIndex,
+ VIDMEM_FRAMEBUFFER,
+ info->PciTag,
+ info->LinearAddr,
+ info->FbMapSize);
+ }
if (!info->FB) return FALSE;
return TRUE;
@@ -371,7 +434,10 @@ static Bool R128UnmapFB(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- xf86UnMapVidMem(pScrn->scrnIndex, info->FB, info->FbMapSize);
+ if(info->FBDev)
+ fbdevHWUnmapVidmem(pScrn);
+ else
+ xf86UnMapVidMem(pScrn->scrnIndex, info->FB, info->FbMapSize);
info->FB = NULL;
return TRUE;
}
@@ -397,7 +463,7 @@ static Bool R128UnmapMem(ScrnInfoPtr pScrn)
/* Read PLL information */
int INPLL(ScrnInfoPtr pScrn, int addr)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREG8(R128_CLOCK_CNTL_INDEX, addr & 0x1f);
return INREG(R128_CLOCK_CNTL_DATA);
@@ -407,7 +473,7 @@ int INPLL(ScrnInfoPtr pScrn, int addr)
/* Read PAL information (only used for debugging). */
static int INPAL(int idx)
{
- unsigned char *R128MMIO = R128PTR(NULL)->MMIO;
+ R128MMIO_VARS();
OUTREG(R128_PALETTE_INDEX, idx << 16);
return INREG(R128_PALETTE_DATA);
@@ -417,8 +483,8 @@ static int INPAL(int idx)
/* Wait for vertical sync. */
void R128WaitForVerticalSync(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
+ int i;
+ R128MMIO_VARS();
OUTREG(R128_GEN_INT_STATUS, R128_VSYNC_INT_AK);
for (i = 0; i < R128_TIMEOUT; i++) {
@@ -429,7 +495,7 @@ void R128WaitForVerticalSync(ScrnInfoPtr pScrn)
/* Blank screen. */
static void R128Blank(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_DISPLAY_DIS, ~R128_CRTC_DISPLAY_DIS);
}
@@ -437,7 +503,7 @@ static void R128Blank(ScrnInfoPtr pScrn)
/* Unblank screen. */
static void R128Unblank(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREGP(R128_CRTC_EXT_CNTL, 0, ~R128_CRTC_DISPLAY_DIS);
}
@@ -467,8 +533,24 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
CARD16 bios_header;
CARD16 pll_info_block;
CARD8 tmp[64];
+ Bool BIOSFromPCI = TRUE;
- xf86ReadPciBIOS(0, info->PciTag, 0, tmp, sizeof(tmp));
+#define R128ReadBIOS(offset, buffer, length) \
+ (BIOSFromPCI ? \
+ xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \
+ xf86ReadBIOS(info->BIOSAddr, offset, buffer, length))
+
+ R128ReadBIOS(0, tmp, sizeof(tmp));
+ if (tmp[0] != 0x55 || tmp[1] != 0xaa)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video BIOS not detected in PCI space!\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Attempting to read Video BIOS from legacy ISA space!\n");
+ BIOSFromPCI = FALSE;
+ info->BIOSAddr = 0x000c0000;
+ R128ReadBIOS(0, tmp, sizeof(tmp));
+ }
if (tmp[0] != 0x55 || tmp[1] != 0xaa) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Video BIOS not detected, using default PLL parameters!\n");
@@ -482,27 +564,27 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
pll->max_pll_freq = 25000;
pll->xclk = 10300;
} else {
- xf86ReadPciBIOS(0x48, info->PciTag, 0,
- (CARD8 *)&bios_header, sizeof(bios_header));
- xf86ReadPciBIOS(bios_header + 0x30, info->PciTag, 0,
- (CARD8 *)&pll_info_block, sizeof(pll_info_block));
+ R128ReadBIOS(0x48,
+ (CARD8 *)&bios_header, sizeof(bios_header));
+ R128ReadBIOS(bios_header + 0x30,
+ (CARD8 *)&pll_info_block, sizeof(pll_info_block));
R128TRACE(("Header at 0x%04x; PLL Information at 0x%04x\n",
bios_header, pll_info_block));
- xf86ReadPciBIOS(pll_info_block + 0x0e, info->PciTag, 0,
+ R128ReadBIOS(pll_info_block + 0x0e,
(CARD8 *)&pll->reference_freq,
sizeof(pll->reference_freq));
- xf86ReadPciBIOS(pll_info_block + 0x10, info->PciTag, 0,
- (CARD8 *)&pll->reference_div,
- sizeof(pll->reference_div));
- xf86ReadPciBIOS(pll_info_block + 0x12, info->PciTag, 0,
- (CARD8 *)&pll->min_pll_freq,
- sizeof(pll->min_pll_freq));
- xf86ReadPciBIOS(pll_info_block + 0x16, info->PciTag, 0,
- (CARD8 *)&pll->max_pll_freq,
- sizeof(pll->max_pll_freq));
- xf86ReadPciBIOS(pll_info_block + 0x08, info->PciTag, 0,
- (CARD8 *)&pll->xclk, sizeof(pll->xclk));
+ R128ReadBIOS(pll_info_block + 0x10,
+ (CARD8 *)&pll->reference_div,
+ sizeof(pll->reference_div));
+ R128ReadBIOS(pll_info_block + 0x12,
+ (CARD8 *)&pll->min_pll_freq,
+ sizeof(pll->min_pll_freq));
+ R128ReadBIOS(pll_info_block + 0x16,
+ (CARD8 *)&pll->max_pll_freq,
+ sizeof(pll->max_pll_freq));
+ R128ReadBIOS(pll_info_block + 0x08,
+ (CARD8 *)&pll->xclk, sizeof(pll->xclk));
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -516,6 +598,13 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
return TRUE;
}
+static
+OptionInfoPtr
+R128AvailableOptions(int chipid, int busid)
+{
+ return R128Options;
+}
+
/* Return the string name for supported chipset 'n'; NULL otherwise. */
static void R128Identify(int flags)
{
@@ -535,6 +624,9 @@ static Bool R128Probe(DriverPtr drv, int flags)
Bool foundScreen = FALSE;
int i;
+ if (flags & PROBE_DETECTISA) return FALSE;
+ if (flags & PROBE_DETECTFBDEV) return FALSE;
+
if ((numDevSections = xf86MatchDevice(R128_NAME, &devSections)) <= 0)
return FALSE;
@@ -549,6 +641,11 @@ static Bool R128Probe(DriverPtr drv, int flags)
drv,
&usedChips);
+ if (numUsed<=0) return FALSE;
+
+ if (flags & PROBE_DETECTPCI)
+ return TRUE;
+
for (i = 0; i < numUsed; i++) {
pEnt = xf86GetEntityInfo(usedChips[i]);
@@ -589,7 +686,10 @@ static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
if (!xf86SetDepthBpp(pScrn, 8, 8, 8, (Support24bppFb
| Support32bppFb
- | SupportConvert32to24)))
+#ifndef USE_FB
+ | SupportConvert32to24
+#endif
+ )))
return FALSE;
switch (pScrn->depth) {
@@ -674,7 +774,6 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
int offset = 0; /* RAM Type */
MessageType from;
unsigned char *R128MMIO;
-
/* Chipset */
from = X_PROBED;
if (dev->chipset && *dev->chipset) {
@@ -742,8 +841,8 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
"MMIO registers at 0x%08lx\n", info->MMIOAddr);
/* BIOS */
- from = X_PROBED;
- info->BIOSAddr = info->PciInfo->biosBase & 0xfffe0000;
+ from = X_PROBED;
+ info->BIOSAddr = info->PciInfo->biosBase & 0xfffe0000;
if (dev->BiosBase) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"BIOS address override, using 0x%08x instead of 0x%08x\n",
@@ -761,8 +860,12 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
from = X_PROBED;
R128MapMMIO(pScrn);
R128MMIO = info->MMIO;
- pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024;
+ if (info->FBDev)
+ pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024;
+ else
+ pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024;
info->MemCntl = INREG(R128_MEM_CNTL);
+ info->BusCntl = INREG(R128_BUS_CNTL);
R128MMIO = NULL;
R128UnmapMMIO(pScrn);
switch (info->MemCntl & 0x3) {
@@ -787,7 +890,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
pScrn->videoRam);
from = X_CONFIG;
pScrn->videoRam = dev->videoRam;
- }
+ }
pScrn->videoRam &= ~1023;
info->FbMapSize = pScrn->videoRam * 1024;
xf86DrvMsg(pScrn->scrnIndex, from,
@@ -817,7 +920,8 @@ static Bool R128PreInitDDC(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I2C initialization failed\n");
ret = FALSE;
} else {
- xf86PrintEDID(xf86DoEDID_DDC2(pScrn->scrnIndex, info->i2c));
+ xf86SetDDCProperties(pScrn,xf86PrintEDID(
+ xf86DoEDID_DDC2(pScrn->scrnIndex, info->i2c)));
}
R128UnmapMMIO(pScrn);
return ret;
@@ -870,6 +974,12 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn)
info->FbMapSize,
LOOKUP_BEST_REFRESH);
+ if (modesFound < 1 && info->FBDev) {
+ fbdevHWUseBuildinMode(pScrn);
+ pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */
+ modesFound = 1;
+ }
+
if (modesFound == -1) return FALSE;
xf86PruneDriverModes(pScrn);
if (!modesFound || !pScrn->modes) {
@@ -884,6 +994,9 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn)
xf86SetDpi(pScrn, 0, 0);
/* Get ScreenInit function */
+#ifdef USE_FB
+ mod = "fb"; Sym = "fbScreenInit";
+#else
switch (pScrn->bitsPerPixel) {
case 8: mod = "cfb"; Sym = "cfbScreenInit"; break;
case 16: mod = "cfb16"; Sym = "cfb16ScreenInit"; break;
@@ -896,6 +1009,7 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn)
break;
case 32: mod = "cfb32"; Sym = "cfb32ScreenInit"; break;
}
+#endif
if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE;
xf86LoaderReqSymbols(Sym, NULL);
@@ -920,6 +1034,20 @@ static Bool R128PreInitAccel(ScrnInfoPtr pScrn)
return TRUE;
}
+static Bool R128PreInitInt10(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+#if 1
+ if (xf86LoadSubModule(pScrn, "int10")) {
+ xf86Int10InfoPtr pInt;
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
+ pInt = xf86InitInt10(info->pEnt->index);
+ xf86FreeInt10(pInt);
+ }
+#endif
+ return TRUE;
+}
+
/* R128PreInit is called once at server startup. */
static Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
{
@@ -963,9 +1091,30 @@ static Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
pScrn->display. */
xf86CollectOptions(pScrn, NULL);
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, R128Options);
-
+
if (!R128PreInitWeight(pScrn)) goto fail;
+ if (xf86ReturnOptValBool(R128Options, OPTION_FBDEV, FALSE)) {
+ info->FBDev = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using framebuffer device\n");
+ }
+
+ if (info->FBDev) {
+ /* check for linux framebuffer device */
+ if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE;
+ xf86LoaderReqSymLists(fbdevHWSymbols, NULL);
+ if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE;
+ pScrn->SwitchMode = fbdevHWSwitchMode;
+ pScrn->AdjustFrame = fbdevHWAdjustFrame;
+ pScrn->EnterVT = R128EnterVTFBDev;
+ pScrn->LeaveVT = R128LeaveVTFBDev;
+ pScrn->ValidMode = fbdevHWValidMode;
+ }
+
+ if (!info->FBDev)
+ if (!R128PreInitInt10(pScrn)) goto fail;
+
if (!R128PreInitConfig(pScrn)) goto fail;
if (!R128GetPLLParameters(pScrn)) goto fail;
@@ -993,10 +1142,10 @@ static Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
static void R128LoadPalette15(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO *colors, VisualPtr pVisual)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
int i;
int idx;
unsigned char r, g, b;
+ R128MMIO_VARS();
for (i = 0; i < numColors; i++) {
idx = indices[i];
@@ -1011,10 +1160,10 @@ static void R128LoadPalette15(ScrnInfoPtr pScrn, int numColors,
static void R128LoadPalette16(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO *colors, VisualPtr pVisual)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
int i;
int idx;
unsigned char r, g, b;
+ R128MMIO_VARS();
/* There are twice as many green values as
there are values for red and blue. So,
@@ -1034,10 +1183,10 @@ static void R128LoadPalette16(ScrnInfoPtr pScrn, int numColors,
static void R128LoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO *colors, VisualPtr pVisual)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
int i;
int idx;
unsigned char r, g, b;
+ R128MMIO_VARS();
for (i = 0; i < numColors; i++) {
idx = indices[i];
@@ -1063,10 +1212,14 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
pScrn->fbOffset = 0;
R128Save(pScrn);
- if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ if (info->FBDev) {
+ if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ } else {
+ if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ }
- R128SaveScreen(pScreen, FALSE);
- R128AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ R128SaveScreen(pScreen, SCREEN_SAVER_ON);
+ pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
/* Visual setup */
miClearVisualTypes();
@@ -1075,6 +1228,13 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
pScrn->rgbBits,
pScrn->defaultVisual)) return FALSE;
+#ifdef USE_FB
+ if (!fbScreenInit (pScreen, info->FB,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+ pScrn->bitsPerPixel))
+ return FALSE;
+#else
switch (pScrn->bitsPerPixel) {
case 8:
if (!cfbScreenInit(pScreen, info->FB,
@@ -1114,6 +1274,7 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
"Invalid bpp (%d)\n", pScrn->bitsPerPixel);
return FALSE;
}
+#endif
xf86SetBlackWhitePixels(pScreen);
if (pScrn->bitsPerPixel > 8) {
@@ -1133,51 +1294,6 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
- /* Backing store setup */
- miInitializeBackingStore(pScreen);
- xf86SetBackingStore(pScreen);
-
- /* Cursor setup */
- miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
-
- /* Colormap setup */
- if (!miCreateDefColormap(pScreen)) return FALSE;
- if (pScrn->depth == 15) {
- if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
- R128LoadPalette15, NULL,
- CMAP_PALETTED_TRUECOLOR
- | CMAP_RELOAD_ON_MODE_SWITCH
- | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
- } else if (pScrn->depth == 16) {
- if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
- R128LoadPalette16, NULL,
- CMAP_PALETTED_TRUECOLOR
- | CMAP_RELOAD_ON_MODE_SWITCH
- | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
- } else {
- if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
- R128LoadPalette, NULL,
- CMAP_PALETTED_TRUECOLOR
- | CMAP_RELOAD_ON_MODE_SWITCH
- | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
- }
-
- /* DPMS setup */
-#ifdef DPMSExtension
- xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0);
-#endif
-
- /* Xv setup */
-#ifdef XvExtension
- {
- XF86VideoAdaptorPtr *ptr;
- int n;
-
- if ((n = xf86XVListGenericAdaptors(&ptr)))
- xf86XVScreenInit(pScreen, ptr, n);
- }
-#endif
-
/* Memory manager setup */
MemBox.x1 = 0;
MemBox.y1 = 0;
@@ -1219,6 +1335,26 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
+ /* Backing store setup */
+ miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ /* Acceleration setup */
+ if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) {
+ if (R128AccelInit(pScreen)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Acceleration initialization failed\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ }
+
+ /* Cursor setup */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
/* Hardware cursor setup */
if (!xf86ReturnOptValBool(R128Options, OPTION_SW_CURSOR, FALSE)) {
if (R128CursorInit(pScreen)) {
@@ -1242,18 +1378,46 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
}
- /* Acceleration setup */
- if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) {
- if (R128AccelInit(pScreen)) {
- xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
- } else {
- xf86DrvMsg(scrnIndex, X_ERROR,
- "Acceleration initialization failed\n");
- xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
- }
+ /* Colormap setup */
+ if (!miCreateDefColormap(pScreen)) return FALSE;
+ if (pScrn->depth == 15) {
+ if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ (info->FBDev ? fbdevHWLoadPalette :
+ R128LoadPalette15), NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
+ } else if (pScrn->depth == 16) {
+ if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ (info->FBDev ? fbdevHWLoadPalette :
+ R128LoadPalette16), NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
} else {
- xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ (info->FBDev ? fbdevHWLoadPalette :
+ R128LoadPalette), NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE;
+ }
+
+ /* DPMS setup */
+#ifdef DPMSExtension
+ xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0);
+#endif
+
+ /* Xv setup */
+#ifdef XvExtension
+ {
+ XF86VideoAdaptorPtr *ptr;
+ int n;
+
+ if ((n = xf86XVListGenericAdaptors(&ptr)))
+ xf86XVScreenInit(pScreen, ptr, n);
}
+#endif
/* Provide SaveScreen */
pScreen->SaveScreen = R128SaveScreen;
@@ -1272,7 +1436,7 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
/* Write common registers (initialized to 0). */
static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREG(R128_OVR_CLR, restore->ovr_clr);
OUTREG(R128_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right);
@@ -1286,12 +1450,13 @@ static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
OUTREG(R128_GEN_INT_CNTL, restore->gen_int_cntl);
OUTREG(R128_CAP0_TRIG_CNTL, restore->cap0_trig_cntl);
OUTREG(R128_CAP1_TRIG_CNTL, restore->cap1_trig_cntl);
+ OUTREG(R128_BUS_CNTL, restore->bus_cntl);
}
/* Write CRTC registers. */
static void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREG(R128_CRTC_GEN_CNTL, restore->crtc_gen_cntl);
@@ -1317,16 +1482,15 @@ static void R128PLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn)
static void R128PLLWriteUpdate(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTPLLP(pScrn, R128_PPLL_REF_DIV, R128_PPLL_ATOMIC_UPDATE_W, 0xffff);
}
-
/* Write PLL registers. */
static void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREGP(R128_CLOCK_CNTL_INDEX, R128_PLL_DIV_SEL, 0xffff);
@@ -1370,7 +1534,7 @@ static void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write DDA registers. */
static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
OUTREG(R128_DDA_CONFIG, restore->dda_config);
OUTREG(R128_DDA_ON_OFF, restore->dda_on_off);
@@ -1379,8 +1543,8 @@ static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write palette data. */
static void R128RestorePalette(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
+ int i;
+ R128MMIO_VARS();
if (!restore->palette_valid) return;
@@ -1402,7 +1566,7 @@ static void R128RestoreMode(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Read common registers. */
static void R128SaveCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
save->ovr_clr = INREG(R128_OVR_CLR);
save->ovr_wid_left_right = INREG(R128_OVR_WID_LEFT_RIGHT);
@@ -1416,12 +1580,13 @@ static void R128SaveCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
save->gen_int_cntl = INREG(R128_GEN_INT_CNTL);
save->cap0_trig_cntl = INREG(R128_CAP0_TRIG_CNTL);
save->cap1_trig_cntl = INREG(R128_CAP1_TRIG_CNTL);
+ save->bus_cntl = INREG(R128_BUS_CNTL);
}
/* Read CRTC registers. */
static void R128SaveCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
save->crtc_gen_cntl = INREG(R128_CRTC_GEN_CNTL);
save->crtc_ext_cntl = INREG(R128_CRTC_EXT_CNTL);
@@ -1455,7 +1620,7 @@ static void R128SavePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read DDA registers. */
static void R128SaveDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
+ R128MMIO_VARS();
save->dda_config = INREG(R128_DDA_CONFIG);
save->dda_on_off = INREG(R128_DDA_ON_OFF);
@@ -1464,8 +1629,8 @@ static void R128SaveDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read palette data. */
static void R128SavePalette(ScrnInfoPtr pScrn, R128SavePtr save)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
+ int i;
+ R128MMIO_VARS();
INPAL_START(0);
for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT();
@@ -1489,12 +1654,16 @@ static void R128SaveMode(ScrnInfoPtr pScrn, R128SavePtr save)
/* Save everything needed to restore the original VC state. */
static void R128Save(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128SavePtr save = &info->SavedReg;
- unsigned char *R128MMIO = info->MMIO;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+ R128SavePtr save = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ R128MMIO_VARS();
R128TRACE(("R128Save\n"));
+ if (info->FBDev) {
+ fbdevHWSave(pScrn);
+ return;
+ }
vgaHWUnlock(hwp);
vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */
vgaHWLock(hwp);
@@ -1511,12 +1680,16 @@ static void R128Save(ScrnInfoPtr pScrn)
/* Restore the original (text) mode. */
static void R128Restore(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128SavePtr restore = &info->SavedReg;
- unsigned char *R128MMIO = info->MMIO;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+ R128SavePtr restore = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ R128MMIO_VARS();
R128TRACE(("R128Restore\n"));
+ if (info->FBDev) {
+ fbdevHWRestore(pScrn);
+ return;
+ }
R128Blank(pScrn);
OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask);
@@ -1535,7 +1708,8 @@ static void R128Restore(ScrnInfoPtr pScrn)
}
/* Define common registers for requested video mode. */
-static void R128InitCommonRegisters(R128SavePtr save, DisplayModePtr mode)
+static void R128InitCommonRegisters(R128SavePtr save, DisplayModePtr mode,
+ R128InfoPtr info)
{
save->ovr_clr = 0;
save->ovr_wid_left_right = 0;
@@ -1549,6 +1723,12 @@ static void R128InitCommonRegisters(R128SavePtr save, DisplayModePtr mode)
save->gen_int_cntl = 0;
save->cap0_trig_cntl = 0;
save->cap1_trig_cntl = 0;
+ save->bus_cntl = info->BusCntl;
+ /*
+ * If bursts are enabled, turn on discards and aborts
+ */
+ if (save->bus_cntl & (R128_BUS_WRT_BURST|R128_BUS_READ_BURST))
+ save->bus_cntl |= R128_BUS_RD_DISCARD_EN | R128_BUS_RD_ABORT_EN;
}
/* Define CRTC registers for requested video mode. */
@@ -1817,7 +1997,7 @@ static Bool R128Init(ScrnInfoPtr pScrn, DisplayModePtr mode, R128SavePtr save)
info->Flags = mode->Flags;
- R128InitCommonRegisters(save, mode);
+ R128InitCommonRegisters(save, mode, info);
if (!R128InitCrtcRegisters(pScrn, save, mode, info)) return FALSE;
R128InitPLLRegisters(pScrn, save, mode, &info->pll, dot_clock);
if (!R128InitDDARegisters(pScrn, save, mode, &info->pll, info))
@@ -1840,9 +2020,12 @@ static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return TRUE;
}
-static Bool R128SaveScreen(ScreenPtr pScreen, Bool unblank)
+static Bool R128SaveScreen(ScreenPtr pScreen, int mode)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ Bool unblank;
+
+ unblank = xf86IsUnblank(mode);
if (unblank) R128Unblank(pScrn); else R128Blank(pScrn);
return TRUE;
@@ -1864,10 +2047,10 @@ static int R128ValidMode(int scrnIndex, DisplayModePtr mode,
is (x,y) in virtual space. */
static void R128AdjustFrame(int scrnIndex, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
int Base;
+ R128MMIO_VARS();
Base = y * pScrn->displayWidth + x;
@@ -1898,8 +2081,29 @@ static Bool R128EnterVT(int scrnIndex, int flags)
return TRUE;
}
+static Bool
+R128EnterVTFBDev(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
+ R128SavePtr restore = &info->SavedReg;
+ fbdevHWEnterVT(scrnIndex,flags);
+ R128RestorePalette(pScrn,restore);
+ R128EngineInit(pScrn);
+ return TRUE;
+}
+
/* Called when VT switching away from the X server. Restore the original
text mode. */
+static void R128LeaveVTFBDev(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
+ R128SavePtr save = &info->SavedReg;
+ R128SavePalette(pScrn,save);
+ fbdevHWLeaveVT(scrnIndex,flags);
+}
+
static void R128LeaveVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
@@ -1942,7 +2146,8 @@ static void R128FreeScreen(int scrnIndex, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
R128TRACE(("R128FreeScreen\n"));
- vgaHWFreeHWRec(pScrn);
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(pScrn);
R128FreeRec(pScrn);
}
@@ -1951,10 +2156,10 @@ static void R128FreeScreen(int scrnIndex, int flags)
static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode, int flags)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int mask = (R128_CRTC_DISPLAY_DIS
- | R128_CRTC_HSYNC_DIS
- | R128_CRTC_VSYNC_DIS);
+ int mask = (R128_CRTC_DISPLAY_DIS
+ | R128_CRTC_HSYNC_DIS
+ | R128_CRTC_VSYNC_DIS);
+ R128MMIO_VARS();
switch (PowerManagementMode) {
case DPMSModeOn:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
index 673a48508..e7b5e2b3d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h,v 1.1 1999/11/19 13:54:43 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h,v 1.5 2000/02/18 16:23:23 dawes Exp $ */
/**************************************************************************
Copyright 1999 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -45,16 +45,67 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _R128_REG_H_
#define _R128_REG_H_
+#include <compiler.h>
+
+#if defined(__powerpc__)
+
+static inline void regw(volatile unsigned long base_addr, unsigned long regindex, unsigned long regdata)
+{
+ asm volatile ("stwbrx %1,%2,%3; eieio"
+ : "=m" (*(volatile unsigned *)(base_addr+regindex))
+ : "r" (regdata), "b" (regindex), "r" (base_addr));
+}
+
+static inline void regw16(volatile unsigned long base_addr, unsigned long regindex, unsigned short regdata)
+{
+ asm volatile ("sthbrx %0,%1,%2; eieio": : "r"(regdata), "b"(regindex), "r"(base_addr));
+}
+
+static inline unsigned long regr(volatile unsigned long base_addr, unsigned long regindex)
+{
+ register unsigned long val;
+ asm volatile ("lwbrx %0,%1,%2; eieio"
+ : "=r"(val)
+ : "b"(regindex), "r"(base_addr),
+ "m" (*(volatile unsigned *)(base_addr+regindex)));
+ return(val);
+}
+
+static inline unsigned short regr16(volatile unsigned long base_addr, unsigned long regindex)
+{
+ register unsigned short val;
+ asm volatile ("lhbrx %0,%1,%2; eieio": "=r"(val):"b"(regindex), "r"(base_addr));
+ return(val);
+}
/* Memory mapped register access macros */
+#define INREG(addr) regr(((unsigned long)R128MMIO),(addr))
#define INREG8(addr) *(volatile CARD8 *)(R128MMIO + (addr))
-#define INREG16(addr) *(volatile CARD16 *)(R128MMIO + (addr))
-#define INREG(addr) *(volatile CARD32 *)(R128MMIO + (addr))
+#define INREG16(addr) regr16(((unsigned long)R128MMIO), (addr))
+#define OUTREG(addr, val) regw(((unsigned long)R128MMIO), (addr), (val))
#define OUTREG8(addr, val) *(volatile CARD8 *)(R128MMIO + (addr)) = (val)
-#define OUTREG16(addr, val) *(volatile CARD16 *)(R128MMIO + (addr)) = (val)
-#define OUTREG(addr, val) *(volatile CARD32 *)(R128MMIO + (addr)) = (val)
+#define OUTREG16(addr, val) regw16(((unsigned long)R128MMIO), (addr), (val))
#define ADDRREG(addr) ((volatile CARD32 *)(R128MMIO + (addr)))
+#define R128MMIO_VARS() \
+ unsigned char *R128MMIO = R128PTR(pScrn)->MMIO
+
+#else
+ /* Memory mapped register access macros */
+#define INREG8(addr) MMIO_IN8(R128MMIO, addr)
+#define INREG16(addr) MMIO_IN16(R128MMIO, addr)
+#define INREG(addr) MMIO_IN32(R128MMIO, addr)
+#define OUTREG8(addr, val) MMIO_OUT8(R128MMIO, addr, val)
+#define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val)
+#define OUTREG(addr, val) MMIO_OUT32(R128MMIO, addr, val)
+
+#define ADDRREG(addr) ((volatile CARD32 *)(R128MMIO + (addr)))
+
+#define R128MMIO_VARS() \
+ unsigned char *R128MMIO = R128PTR(pScrn)->MMIO
+
+#endif
+
#define OUTREGP(addr, val, mask) \
do { \
CARD32 tmp = INREG(addr); \
@@ -207,6 +258,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R128_BRUSH_SCALE 0x1470
#define R128_BRUSH_Y_X 0x1474
#define R128_BUS_CNTL 0x0030
+# define R128_BUS_RD_DISCARD_EN (1 << 24)
+# define R128_BUS_RD_ABORT_EN (1 << 25)
+# define R128_BUS_MSTR_DISCONNECT_EN (1 << 28)
+# define R128_BUS_WRT_BURST (1 << 29)
+# define R128_BUS_READ_BURST (1 << 30)
#define R128_BUS_CNTL1 0x0034
#define R128_CACHE_CNTL 0x1724
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c b/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c
index c92ce1efb..d2b3b8426 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c
@@ -3,7 +3,7 @@
*
* accelerator functions for X
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.4 1999/12/14 03:12:09 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.5 2000/01/18 16:35:51 tsi Exp $ */
@@ -117,7 +117,7 @@ void RENDITIONAccelPreInit(ScrnInfoPtr pScreenInfo)
#ifdef DEBUG
ErrorF("RENDITION: RENDITIONAccelPreInit called\n");
- xf86sleep(1);
+ sleep(1);
#endif
#ifdef DEBUG
@@ -126,11 +126,11 @@ void RENDITIONAccelPreInit(ScrnInfoPtr pScreenInfo)
#endif
if (V1000_DEVICE == pRendition->board.chip){
- c=v_load_ucfile(pScreenInfo, xf86strcat ((char *)MICROCODE_DIR,"v10002d.uc"));
+ c=v_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v10002d.uc"));
}
else {
/* V2x00 chip */
- c=v_load_ucfile(pScreenInfo, xf86strcat ((char *)MICROCODE_DIR,"v20002d.uc"));
+ c=v_load_ucfile(pScreenInfo, strcat ((char *)MICROCODE_DIR,"v20002d.uc"));
}
if (c == -1) {
@@ -146,7 +146,7 @@ void RENDITIONAccelPreInit(ScrnInfoPtr pScreenInfo)
#ifdef DEBUG
ErrorF("RENDITION: Offset is now %d\n",pRendition->board.fbOffset);
ErrorF("RENDITION: RENDITIONAccelPreInit End \n");
- xf86sleep(2);
+ sleep(2);
#endif
}
@@ -159,9 +159,9 @@ void RENDITIONAccelXAAInit(ScreenPtr pScreen)
BoxRec AvailFBArea;
-#if DEBUG
+#ifdef DEBUG
ErrorF("RENDITION: RENDITIONAccelInit called\n");
- xf86sleep(2);
+ sleep(2);
#endif
pRendition->AccelInfoRec = pXAAinfo = XAACreateInfoRec();
@@ -207,7 +207,7 @@ void RENDITIONAccelXAAInit(ScreenPtr pScreen)
#ifdef DEBUG
ErrorF("RENDITION: RENDITIONAccelInit restore\n");
- xf86sleep(2);
+ sleep(2);
#endif
/* Restore u-code previously loaded in PreInit-stage */
@@ -251,7 +251,7 @@ void RENDITIONAccelXAAInit(ScreenPtr pScreen)
#ifdef DEBUG
ErrorF("RENDITION: RENDITIONAccelInit End\n");
- xf86sleep(2);
+ sleep(2);
#endif
}
@@ -288,7 +288,7 @@ int RENDITIONLoadUcode(ScrnInfoPtr pScreenInfo)
static int ucode_loaded=0;
-#if DEBUG
+#ifdef DEBUG
ErrorF("RENDITION: RENDITIONLoadUcode called\n");
#endif
@@ -377,7 +377,7 @@ void RENDITIONRestoreUcode(ScrnInfoPtr pScreenInfo)
#ifdef DEBUG
ErrorF("RENDITION: RENDITIONRestoreUcode called\n");
- xf86sleep(2);
+ sleep(2);
#endif
v1k_stop(pScreenInfo);
@@ -414,7 +414,7 @@ void RENDITIONSaveUcode(ScrnInfoPtr pScreenInfo)
#if 1
ErrorF("RENDITION: RENDITIONSaveUcode called\n");
- xf86sleep(2);
+ sleep(2);
#endif
v1k_stop(pScreenInfo);
@@ -615,7 +615,7 @@ void RENDITIONSubsequentSolidFillRect(ScrnInfoPtr pScreenInfo,
#ifdef DEBUG
ErrorF("#SubsequentSolidFill# FIFO_INFREE 0x%x -- \n",v_in8(iob+FIFOINFREE));
ErrorF("#SubsequentSolidFill# FIFO_OUTVALID 0x%x -- \n",v_in8(iob+FIFOOUTVALID));
- xf86sleep(1);
+ sleep(1);
#endif
v_out32(iob, P2(pRendition->board.Rop, CMD_RECT_SOLID_ROP));
v_out32(iob, pRendition->board.Color);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c b/xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c
index 0f6df08d9..a95cd8770 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c,v 1.8 1999/12/14 03:12:10 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vloaduc.c,v 1.9 2000/01/18 16:35:52 tsi Exp $ */
/*
* includes
*/
@@ -60,7 +60,7 @@ int v_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
Elf32_Shdr *pshdr, *orig_pshdr=NULL;
Elf32_Ehdr ehdr ;
-#if DEBUG
+#ifdef DEBUG
ErrorF("RENDITION: Loading microcode %s\n", file_name);
#endif
@@ -68,12 +68,12 @@ int v_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
v1k_stop (pScreenInfo);
/* open file and read ELF-header */
- if (-1 == (fd=xf86open(file_name, O_RDONLY))) {
+ if (-1 == (fd=open(file_name, O_RDONLY, 0))) {
ErrorF("RENDITION: Cannot open microcode %s\n", file_name);
return -1;
}
- if (xf86read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) {
+ if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) {
ErrorF("RENDITION: Cannot read microcode header %s\n", file_name);
return -1;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel2.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel2.c
deleted file mode 100644
index 9fd1a97de..000000000
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel2.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel2.c,v 1.1 1999/03/21 07:35:19 dawes Exp $ */
-
-/*
- *
- * Acceleration for SiS530 SiS620.
- * It is done in a separate file because the register formats are
- * very different from the previous chips.
- *
- *
- *
- * Xavier Ducoin <x.ducoin@lectra.com>
- */
-
-#if 0
-#define PDEBUG(arg) arg
-#else
-#define PDEBUG(arg)
-#endif
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
-
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
-#include "miline.h"
-
-#include "sis_regs2.h"
-#include "sis.h"
-
-static void SiS2Sync(ScrnInfoPtr pScrn);
-static void SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask);
-static void SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x,
- int y, int w, int h);
-static void SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
- int x1, int y1, int x2,
- int y2, int w, int h);
-static void SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
- int xdir, int ydir, int rop,
- unsigned int planemask,
- int transparency_color);
-static void SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny, int fg, int bg,
- int rop, unsigned int planemask);
-static void SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny, int x, int y,
- int w, int h);
-static void SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
-#if 0
-static void SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int srcx, int srcy, int skipleft);
-#endif
-static void SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft);
-static void SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
-
-
-
-static void
-SiS2InitializeAccelerator(ScrnInfoPtr pScrn)
-{
-}
-
-Bool
-SiS2AccelInit(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoPtr;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- SISPtr pSiS = SISPTR(pScrn);
- BoxRec AvailFBArea;
- int offset=0;
- int OffscreenAvailable, BLTPatternOffscreenSize;
-
- pSiS->AccelInfoRec = infoPtr = XAACreateInfoRec();
- if (!infoPtr) return FALSE;
-
- SiS2InitializeAccelerator(pScrn);
-
- /* fill out infoPtr here */
- infoPtr->Flags = PIXMAP_CACHE |
- OFFSCREEN_PIXMAPS |
- LINEAR_FRAMEBUFFER;
-
- /* sync */
- infoPtr->Sync = SiS2Sync;
-
-
- /* solid fills */
- infoPtr->SolidFillFlags = NO_PLANEMASK;
- infoPtr->SetupForSolidFill = SiS2SetupForFillRectSolid;
- infoPtr->SubsequentSolidFillRect = SiS2SubsequentFillRectSolid;
-
-
- /* screen to screen copy */
- infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK;
- infoPtr->SetupForScreenToScreenCopy =
- SiS2SetupForScreenToScreenCopy;
- infoPtr->SubsequentScreenToScreenCopy =
- SiS2SubsequentScreenToScreenCopy;
-
-
- /* 8x8 mono patterns */
- infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS |
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
- NO_TRANSPARENCY | /* transp does not work right now */
- BIT_ORDER_IN_BYTE_MSBFIRST;
-
- infoPtr->SetupForMono8x8PatternFill =
- SiS2SetupForMono8x8PatternFill;
- infoPtr->SubsequentMono8x8PatternFillRect =
- SiS2SubsequentMono8x8PatternFillRect;
-
- /* screen to screen color expansion */
-#if 0
- /* don't know how to specify the with, height of the
- source bitmap for the replication along Width, Height of destination area
- */
- infoPtr->ScreenToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST |
- SCANLINE_PAD_DWORD |
- /*GXCOPY_ONLY | be careful not fully tested */
- TRANSPARENCY_ONLY | /* opaque does not work right now */
- NO_PLANEMASK;
-
- infoPtr->SetupForScreenToScreenColorExpandFill =
- SiS2SetupForScreenToScreenColorExpandFill;
- infoPtr->SubsequentScreenToScreenColorExpandFill =
- SiS2SubsequentScreenToScreenColorExpandFill;
-#endif
-
- if (pSiS->TurboQueue) offset = 32768;
- if (pSiS->HWCursor) offset = 16384;
- if (pSiS->HWCursor && pSiS->TurboQueue) offset = 65536;
-
- /* CPU To screen color expansion indirect method */
- OffscreenAvailable = pSiS->FbMapSize - pScrn->displayWidth * pScrn->virtualY
- * (pScrn->bitsPerPixel / 8) ;
- OffscreenAvailable -= offset;
- BLTPatternOffscreenSize = 2 * (((pScrn->virtualX + 31)/32) * 4);
- if (OffscreenAvailable < BLTPatternOffscreenSize) {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0,
- "Not enough off-screen video memory for expand color.\n");
- }
- else {
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
- SYNC_AFTER_COLOR_EXPAND |
- BIT_ORDER_IN_BYTE_MSBFIRST |
- SCANLINE_PAD_DWORD |
- /*GXCOPY_ONLY | not fully tested */
- TRANSPARENCY_ONLY | /* opaque doesn't work*/
- NO_PLANEMASK;
-
- pSiS->XAAScanlineColorExpandBuffers[0] =
- pSiS->FbBase + pSiS->FbMapSize - offset -
- (((pScrn->virtualX + 31)/32) * 4);
- pSiS->XAAScanlineColorExpandBuffers[1] =
- pSiS->FbBase + pSiS->FbMapSize - offset -
- (((pScrn->virtualX + 31)/32) * 4)*2;
-
- infoPtr->NumScanlineColorExpandBuffers = 2;
- infoPtr->ScanlineColorExpandBuffers =
- pSiS->XAAScanlineColorExpandBuffers;
- offset += BLTPatternOffscreenSize;
-
- infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
- SiS2SetupForScreenToScreenColorExpandFill;
- infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
- SiS2SubsequentScanlineCPUToScreenColorExpandFill;
- infoPtr->SubsequentColorExpandScanline =
- SiS2SubsequentColorExpandScanline;
- }
-
- AvailFBArea.x1 = 0;
- AvailFBArea.y1 = 0;
- AvailFBArea.x2 = pScrn->displayWidth;
- AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth *
- pScrn->bitsPerPixel / 8);
-
- xf86InitFBManager(pScreen, &AvailFBArea);
-
- return(XAAInit(pScreen, infoPtr));
-}
-
-static void
-SiS2Sync(ScrnInfoPtr pScrn) {
- SISPtr pSiS = SISPTR(pScrn);
- sisBLTSync;
-}
-
-static int sisALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0x88, /* dest &= src; DSa, GXand, 0x1 */
- 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
- 0xCC, /* dest = src; S, GXcopy, 0x3 */
- 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
- 0xEE, /* dest |= src; DSo, GXor, 0x7 */
- 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
- 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
- 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
- 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
- 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-/* same ROP but with Pattern as Source */
-static int sisPatALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0xA0, /* dest &= src; DPa, GXand, 0x1 */
- 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
- 0xF0, /* dest = src; P, GXcopy, 0x3 */
- 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
- 0xFA, /* dest |= src; DPo, GXor, 0x7 */
- 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
- 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
- 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
- 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
- 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-
-static void
-SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop,
- unsigned int planemask)
-{
- SISPtr pSiS = SISPTR(pScrn);
-
- PDEBUG(ErrorF("SiS2SetupForFillRectSolid()\n"));
- sisBLTWAIT;
- sisSETPATFGCOLOR(color);
- sisSETROP(sisPatALUConv[rop & 0xF]);
- sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8,
- pScrn->displayWidth * pScrn->bitsPerPixel / 8);
- sisSETDSTHEIGHT(-1); /* disable merge clipping */
-
- sisSETSRCADDR(0);
- sisSETDSTADDR(0);
- sisSETSRCXSRCY(0,0);
-
-}
-
-static void
-SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h)
-{
- SISPtr pSiS = SISPTR(pScrn);
- int op;
-
- op = sisCMDBLT | sisTOP2BOTTOM | sisLEFT2RIGHT | sisROP;
-
- sisSETHEIGHTWIDTH(h, w);
- sisSETDSTXDSTY(x,y);
-
- sisSETCMD(op);
-
-}
-
-static void
-SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int transparency_color)
-{
- SISPtr pSiS = SISPTR(pScrn);
-
- PDEBUG(ErrorF("SiS2SetupForScreenToScreenCopy()\n"));
- sisBLTWAIT;
- sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8,
- pScrn->displayWidth * pScrn->bitsPerPixel / 8);
- sisSETROP(sisALUConv[rop & 0xF]);
- sisSETDSTHEIGHT(-1); /* disable merge clipping */
- sisSETSRCADDR(0);
- sisSETDSTADDR(0);
- pSiS->Xdirection = xdir;
- pSiS->Ydirection = ydir;
-}
-
-static void
-SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
- int y2, int w, int h)
-{
- SISPtr pSiS = SISPTR(pScrn);
- int op ;
-
- op = sisCMDBLT | sisSRCVIDEO | sisROP;
- if (pSiS->Ydirection == -1) {
- op |= sisBOTTOM2TOP;
- y1 += h-1;
- y2 += h-1;
- } else {
- op |= sisTOP2BOTTOM;
- }
- if (pSiS->Xdirection == -1) {
- op |= sisRIGHT2LEFT;
- x1 += w-1;
- x2 += w-1;
- } else {
- op |= sisLEFT2RIGHT;
- }
-
- sisSETHEIGHTWIDTH(h, w);
- sisSETSRCXSRCY(x1,y1);
- sisSETDSTXDSTY(x2,y2);
-
- sisSETCMD(op);
-}
-
-static void
-SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
- int fg, int bg, int rop, unsigned int planemask)
-{
- SISPtr pSiS = SISPTR(pScrn);
- unsigned int *patternRegPtr ;
- int dstpitch;
- int isTransparent = ( bg == -1 );
- int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT |
- sisPATMASK;
-
- PDEBUG(ErrorF("SiS2SetupFor8x8PatternColorExpand()\n"));
-
- dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ;
- /*
- * check transparency
- */
- /* becareful with rop */
- if (isTransparent) {
- op |= sisTRANSPARENT;
- PDEBUG(ErrorF("doesn't work right now: should never be called\n"));
- }
-
- sisBLTWAIT;
- sisSETPATBGCOLOR(bg);
- sisSETPATFGCOLOR(fg);
- sisSETROP(sisPatALUConv[rop & 0xF]); /* pat copy */
-
- sisSETPITCH(1, dstpitch);
- sisSETSRCADDR(0);
- sisSETDSTADDR(0);
- sisSETSRCXSRCY(0,0);
- sisSETDSTHEIGHT(-1); /* disable merge clipping */
- pSiS->CommandReg = op | sisROP ;
-
- patternRegPtr = (unsigned int *)sisSETPATMASKREG();
- patternRegPtr[0] = patternx ;
- patternRegPtr[1] = patterny ;
-}
-
-static void
-SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx,
- int patterny, int x, int y, int w, int h)
-{
- SISPtr pSiS = SISPTR(pScrn);
- /*
- * what do I need to do with patternx, patterny ?
- */
-
- sisSETDSTXDSTY(x,y);
- sisSETHEIGHTWIDTH(h, w);
-
- sisSETCMD(pSiS->CommandReg);
-}
-
-static void
-SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask)
-{
- SISPtr pSiS = SISPTR(pScrn);
-
- int isTransparent = ( bg == -1 );
- int op ;
-
- PDEBUG(ErrorF("SiS2SetupScreenToScreenColorExpand()\n"));
-
- op = sisCMDENHCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT;
-
- if (isTransparent) {
- op |= sisTRANSPARENT;
- }
-
- sisBLTWAIT;
- sisSETPATBGCOLOR(bg);
- sisSETPATFGCOLOR(fg);
- /* becareful with rop */
- sisSETROP(sisPatALUConv[rop & 0xF]);
-
- sisSETDSTADDR(0);
- sisSETSRCADDR(0);
- sisSETSRCXSRCY(0,0);
- sisSETDSTHEIGHT(-1); /* disable merge clipping */
-
- pSiS->CommandReg = op | sisROP;
-
-}
-#if 0
-static void
-SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int srcx, int srcy, int skipleft)
-{
- SISPtr pSiS = SISPTR(pScrn);
-
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
-
- sisBLTWAIT;
- sisSETPITCH(pitch, pitch);
- sisSETHEIGHTWIDTH(h, w);
- sisSETSRCXSRCY(srcx, srcy);
- sisSETDSTXDSTY(x, y);
- sisSETCMD(pSiS->CommandReg);
-}
-#endif
-void
-SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft)
-{
- SISPtr pSiS = SISPTR(pScrn);
- int pitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
- int srcpitch = ((w + 31)& ~31) /8 ;
-
- PDEBUG(ErrorF("SiS2SubsequentScanlineCPUToScreenColorExpandFill\n"));
-
- sisBLTWAIT;
- sisSETDSTXDSTY(x,y);
- sisSETHEIGHTWIDTH(1, w);
- sisSETPITCH(srcpitch, pitch);
-
- pSiS->DstX = x;
- pSiS->DstY = y;
-
-}
-
-void
-SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn,
- int bufno)
-{
- SISPtr pSiS = SISPTR(pScrn);
- int srcaddr;
-
- PDEBUG(ErrorF("SiS2SubsequentColorExpandScanline\n"));
-
- srcaddr = pSiS->XAAScanlineColorExpandBuffers[bufno] - pSiS->FbBase;
-
- sisBLTWAIT;
- sisSETSRCADDR(srcaddr);
- sisSETDSTXDSTY(pSiS->DstX, pSiS->DstY);
- sisSETCMD(pSiS->CommandReg);
- sisBLTWAIT;
- pSiS->DstY++;
-}
-
-
-
-
-
-
-
-
-
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
index c0f83081a..fe93a600f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.8 1999/12/14 01:33:48 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.10 2000/02/15 19:19:21 dawes Exp $
XCOMM
XCOMM This is the Imakefile for the TDFX driver.
XCOMM
@@ -34,7 +34,7 @@ INCLUDES = -I. -I../../include
#else
INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
- -I$(XF86SRC)/xaa -I$(XF86SRC)/rac -I$(XF86OSSRC)/int10 \
+ -I$(XF86SRC)/xaa -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \
-I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \
-I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
-I$(SERVERSRC)/Xext \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
index 48917e552..f64489092 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
@@ -5,7 +5,7 @@
Copyright: 1998,1999
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.7 1999/12/27 01:33:58 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.9 2000/02/18 12:20:02 tsi Exp $ */
#ifndef _TDFX_H_
#define _TDFX_H_
@@ -156,7 +156,7 @@ typedef struct _TDFXRec {
TDFXSyncFunc sync;
int syncDone;
int scanlineWidth;
- int *scanlineColorExpandBuffers[2];
+ unsigned char *scanlineColorExpandBuffers[2];
PROPDATA
#ifdef XF86DRI
Bool directRenderingEnabled;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
index 870809519..022732025 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.4 1999/12/14 01:33:49 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.8 2000/02/20 04:12:40 tsi Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -821,13 +821,13 @@ static void TDFXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
TDFXPtr pTDFX;
int i, size, cnt;
- int *pos;
+ CARD32 *pos;
TDFXTRACEACCEL("SubsequentColorExpandScanline bufno=%d\n", bufno);
pTDFX = TDFXPTR(pScrn);
cnt=(pTDFX->scanlineWidth+31)/32;
- pos=pTDFX->scanlineColorExpandBuffers[bufno];
+ pos=(CARD32 *)pTDFX->scanlineColorExpandBuffers[bufno];
while (cnt>0) {
if (cnt>64) size=64;
else size=cnt;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
index 5e2a1e109..1976e9a7c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.1 1999/08/29 12:21:03 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.2 2000/02/08 17:19:17 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
index 2b9ed89e2..510cfd097 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.4 1999/12/14 01:33:49 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.6 2000/02/15 07:13:42 martin Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h
index 1c9c58336..7da92b83a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.2 1999/12/14 01:33:49 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.3 2000/02/15 07:13:43 martin Exp $ */
#ifndef _TDFX_DRI_
#define _TDFX_DRI_
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index 55e6cd785..658e1f541 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.9 1999/12/30 03:25:24 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.21 2000/02/21 19:23:09 dawes Exp $ */
/*
* Authors:
@@ -133,7 +133,7 @@ static void TDFXLeaveVT(int scrnIndex, int flags);
static Bool TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen);
/* Change screensaver state */
-static Bool TDFXSaveScreen(ScreenPtr pScreen, Bool unblank);
+static Bool TDFXSaveScreen(ScreenPtr pScreen, int mode);
/* Cleanup server private data */
static void TDFXFreeScreen(int scrnIndex, int flags);
@@ -154,6 +154,8 @@ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn,
#define TDFX_MAJOR_VERSION 1
#define TDFX_MINOR_VERSION 0
#define TDFX_PATCHLEVEL 0
+#define PCI_SUBDEVICE_ID_VOODOO3_2000 0x0036
+#define PCI_SUBDEVICE_ID_VOODOO3_3000 0x003a
DriverRec TDFX = {
VERSION,
@@ -186,7 +188,7 @@ static PciChipsets TDFXPciChipsets[] = {
typedef enum {
OPTION_NOACCEL,
OPTION_SW_CURSOR,
- OPTION_USE_PIO,
+ OPTION_USE_PIO
} TDFXOpts;
static OptionInfoRec TDFXOptions[] = {
@@ -753,7 +755,17 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) {
pTDFX->MaxClock = 270000;
break;
case PCI_CHIP_VOODOO3:
- pTDFX->MaxClock = 300000;
+ switch(pTDFX->PciInfo->subsysCard) {
+ case PCI_SUBDEVICE_ID_VOODOO3_2000:
+ pTDFX->MaxClock = 300000;
+ break;
+ case PCI_SUBDEVICE_ID_VOODOO3_3000:
+ pTDFX->MaxClock = 350000;
+ break;
+ default:
+ pTDFX->MaxClock = 300000;
+ break;
+ }
break;
}
}
@@ -1527,7 +1539,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
if (!pTDFX->usePIO) {
TDFXSetMMIOAccess(pTDFX);
hwp->IOBase = ((hwp->readMiscOut(hwp) & 0x01) ?
- VGA_IOBASE_COLOR : VGA_IOBASE_MONO) + pTDFX->MMIOBase - 0x300;
+ VGA_IOBASE_COLOR : VGA_IOBASE_MONO) + (unsigned long)pTDFX->MMIOBase -
+ 0x300;
} else {
vgaHWGetIOBase(hwp);
}
@@ -1827,7 +1840,8 @@ static void
TDFXFreeScreen(int scrnIndex, int flags) {
TDFXTRACE("TDFXFreeScreen start\n");
TDFXFreeRec(xf86Screens[scrnIndex]);
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(xf86Screens[scrnIndex]);
}
static int
@@ -1869,12 +1883,15 @@ TDFXBlankScreen(ScrnInfoPtr pScrn, Bool unblank)
}
static Bool
-TDFXSaveScreen(ScreenPtr pScreen, Bool unblank)
+TDFXSaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ Bool unblank;
TDFXTRACE("TDFXSaveScreen start\n");
+ unblank = xf86IsUnblank(mode);
+
if (unblank)
SetTimeSinceLastInputEvent();
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c
index a9cafe13c..db003c805 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.2 1999/09/27 06:29:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.3 2000/02/15 07:13:43 martin Exp $ */
/*
Voodoo Banshee driver version 1.0.2
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
index 7a7fb9386..e8a75056f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
@@ -1,7 +1,9 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.2 1999/12/16 02:26:29 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.7 2000/02/18 12:20:05 tsi Exp $ */
+#if 0
#include <sys/time.h>
+#endif
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
@@ -69,7 +71,7 @@ void InstallFifo(TDFXPtr pTDFX)
void TDFXResetFifo(TDFXPtr pTDFX)
{
int oldValue;
- INT32 start_sec, end_sec, dummy;
+ CARD32 start_sec, end_sec, dummy;
ErrorF("Resetting FIFO\n");
/* Shut down the fifo */
@@ -105,7 +107,7 @@ void TDFXSyncFifo(ScrnInfoPtr pScrn)
TDFXPtr pTDFX;
int i, cnt;
int stat;
- INT32 start_sec, end_sec, dummy;
+ CARD32 start_sec, end_sec, dummy;
TDFXTRACEACCEL("TDFXSyncFifo start\n");
pTDFX=TDFXPTR(pScrn);
@@ -182,6 +184,7 @@ GetReadPtr(TDFXPtr pTDFX)
return read_ptr;
}
+#ifdef XF86DRI
void TDFXSwapContextPrivate(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn;
@@ -240,6 +243,7 @@ void TDFXLostContext(ScreenPtr pScreen) {
/* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */
}
}
+#endif
static void
TDFXMakeSpace(TDFXPtr pTDFX, uint32 slots)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
index c721e1961..657992d21 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.3 1999/12/28 22:48:14 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.5 2000/02/18 12:20:05 tsi Exp $ */
#ifndef _TDFX_FIFO_H_
@@ -19,7 +19,7 @@ typedef char int8;
#define PROPDATASTD \
volatile unsigned int *fifoPtr; \
- unsigned int *fifoRead; \
+ volatile unsigned int *fifoRead; \
int fifoSlots; \
unsigned int *fifoBase; \
unsigned int *fifoEnd; \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
index fa9ca48e1..bb82da4cd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.3 1999/12/14 01:33:50 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.5 2000/02/15 07:13:44 martin Exp $ */
/*
Voodoo Banshee driver version 1.0.1
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/sdk-list b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/sdk-list
deleted file mode 100644
index d1b39d97e..000000000
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/sdk-list
+++ /dev/null
@@ -1 +0,0 @@
-lib/Server
diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fb.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fb.h
deleted file mode 100644
index 56e7c7252..000000000
--- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fb.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * copyed from from linux kernel 2.2.4
- * removed internal stuff (#ifdef __KERNEL__)
- */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fb.h,v 1.2 1999/04/05 12:43:16 hohndel Exp $ */
-
-#ifndef _LINUX_FB_H
-#define _LINUX_FB_H
-
-#include <asm/types.h>
-
-/* Definitions of frame buffers */
-
-#define FB_MAJOR 29
-
-#define FB_MODES_SHIFT 5 /* 32 modes per framebuffer */
-#define FB_NUM_MINORS 256 /* 256 Minors */
-#define FB_MAX (FB_NUM_MINORS / (1 << FB_MODES_SHIFT))
-#define GET_FB_IDX(node) (MINOR(node) >> FB_MODES_SHIFT)
-
-/* ioctls
- 0x46 is 'F' */
-#define FBIOGET_VSCREENINFO 0x4600
-#define FBIOPUT_VSCREENINFO 0x4601
-#define FBIOGET_FSCREENINFO 0x4602
-#define FBIOGETCMAP 0x4604
-#define FBIOPUTCMAP 0x4605
-#define FBIOPAN_DISPLAY 0x4606
-/* 0x4607-0x460B are defined below */
-/* #define FBIOGET_MONITORSPEC 0x460C */
-/* #define FBIOPUT_MONITORSPEC 0x460D */
-/* #define FBIOSWITCH_MONIBIT 0x460E */
-#define FBIOGET_CON2FBMAP 0x460F
-#define FBIOPUT_CON2FBMAP 0x4610
-
-#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
-#define FB_TYPE_PLANES 1 /* Non interleaved planes */
-#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
-#define FB_TYPE_TEXT 3 /* Text/attributes */
-
-#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
-#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
-#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
-#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
-#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
-
-#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
-#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
-#define FB_VISUAL_TRUECOLOR 2 /* True color */
-#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
-#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
-#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
-
-#define FB_ACCEL_NONE 0 /* no hardware accelerator */
-#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
-#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */
-#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */
-#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */
-#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */
-#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */
-#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */
-#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */
-#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */
-#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */
-#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */
-#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */
-#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */
-#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */
-#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */
-#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */
-#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */
-#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */
-#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
-#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
-#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
-#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
-#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
-#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
-#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
-
-struct fb_fix_screeninfo {
- char id[16]; /* identification string eg "TT Builtin" */
- char *smem_start; /* Start of frame buffer mem */
- /* (physical address) */
- __u32 smem_len; /* Length of frame buffer mem */
- __u32 type; /* see FB_TYPE_* */
- __u32 type_aux; /* Interleave for interleaved Planes */
- __u32 visual; /* see FB_VISUAL_* */
- __u16 xpanstep; /* zero if no hardware panning */
- __u16 ypanstep; /* zero if no hardware panning */
- __u16 ywrapstep; /* zero if no hardware ywrap */
- __u32 line_length; /* length of a line in bytes */
- char *mmio_start; /* Start of Memory Mapped I/O */
- /* (physical address) */
- __u32 mmio_len; /* Length of Memory Mapped I/O */
- __u32 accel; /* Type of acceleration available */
- __u16 reserved[3]; /* Reserved for future compatibility */
-};
-
-/* Interpretation of offset for color fields: All offsets are from the right,
- * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
- * can use the offset as right argument to <<). A pixel afterwards is a bit
- * stream and is written to video memory as that unmodified. This implies
- * big-endian byte order if bits_per_pixel is greater than 8.
- */
-struct fb_bitfield {
- __u32 offset; /* beginning of bitfield */
- __u32 length; /* length of bitfield */
- __u32 msb_right; /* != 0 : Most significant bit is */
- /* right */
-};
-
-#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */
-
-#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/
-#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
-#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
-#define FB_ACTIVATE_MASK 15
- /* values */
-#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
-#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
-#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
-
-#define FB_ACCELF_TEXT 1 /* text mode acceleration */
-
-#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
-#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
-#define FB_SYNC_EXT 4 /* external sync */
-#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
-#define FB_SYNC_BROADCAST 16 /* broadcast video timings */
- /* vtotal = 144d/288n/576i => PAL */
- /* vtotal = 121d/242n/484i => NTSC */
-#define FB_SYNC_ON_GREEN 32 /* sync on green */
-
-#define FB_VMODE_NONINTERLACED 0 /* non interlaced */
-#define FB_VMODE_INTERLACED 1 /* interlaced */
-#define FB_VMODE_DOUBLE 2 /* double scan */
-#define FB_VMODE_MASK 255
-
-#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
-#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
-#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
-
-struct fb_var_screeninfo {
- __u32 xres; /* visible resolution */
- __u32 yres;
- __u32 xres_virtual; /* virtual resolution */
- __u32 yres_virtual;
- __u32 xoffset; /* offset from virtual to visible */
- __u32 yoffset; /* resolution */
-
- __u32 bits_per_pixel; /* guess what */
- __u32 grayscale; /* != 0 Graylevels instead of colors */
-
- struct fb_bitfield red; /* bitfield in fb mem if true color, */
- struct fb_bitfield green; /* else only length is significant */
- struct fb_bitfield blue;
- struct fb_bitfield transp; /* transparency */
-
- __u32 nonstd; /* != 0 Non standard pixel format */
-
- __u32 activate; /* see FB_ACTIVATE_* */
-
- __u32 height; /* height of picture in mm */
- __u32 width; /* width of picture in mm */
-
- __u32 accel_flags; /* acceleration flags (hints) */
-
- /* Timing: All values in pixclocks, except pixclock (of course) */
- __u32 pixclock; /* pixel clock in ps (pico seconds) */
- __u32 left_margin; /* time from sync to picture */
- __u32 right_margin; /* time from picture to sync */
- __u32 upper_margin; /* time from sync to picture */
- __u32 lower_margin;
- __u32 hsync_len; /* length of horizontal sync */
- __u32 vsync_len; /* length of vertical sync */
- __u32 sync; /* see FB_SYNC_* */
- __u32 vmode; /* see FB_VMODE_* */
- __u32 reserved[6]; /* Reserved for future compatibility */
-};
-
-struct fb_cmap {
- __u32 start; /* First entry */
- __u32 len; /* Number of entries */
- __u16 *red; /* Red values */
- __u16 *green;
- __u16 *blue;
- __u16 *transp; /* transparency, can be NULL */
-};
-
-struct fb_con2fbmap {
- __u32 console;
- __u32 framebuffer;
-};
-
-struct fb_monspecs {
- __u32 hfmin; /* hfreq lower limit (Hz) */
- __u32 hfmax; /* hfreq upper limit (Hz) */
- __u16 vfmin; /* vfreq lower limit (Hz) */
- __u16 vfmax; /* vfreq upper limit (Hz) */
- unsigned dpms : 1; /* supports DPMS */
-};
-
-#if 1
-
-#define FBCMD_GET_CURRENTPAR 0xDEAD0005
-#define FBCMD_SET_CURRENTPAR 0xDEAD8005
-
-#endif
-
-
-#if 1 /* Preliminary */
-
- /*
- * Hardware Cursor
- */
-
-#define FBIOGET_FCURSORINFO 0x4607
-#define FBIOGET_VCURSORINFO 0x4608
-#define FBIOPUT_VCURSORINFO 0x4609
-#define FBIOGET_CURSORSTATE 0x460A
-#define FBIOPUT_CURSORSTATE 0x460B
-
-
-struct fb_fix_cursorinfo {
- __u16 crsr_width; /* width and height of the cursor in */
- __u16 crsr_height; /* pixels (zero if no cursor) */
- __u16 crsr_xsize; /* cursor size in display pixels */
- __u16 crsr_ysize;
- __u16 crsr_color1; /* colormap entry for cursor color1 */
- __u16 crsr_color2; /* colormap entry for cursor color2 */
-};
-
-struct fb_var_cursorinfo {
- __u16 width;
- __u16 height;
- __u16 xspot;
- __u16 yspot;
- __u8 data[1]; /* field with [height][width] */
-};
-
-struct fb_cursorstate {
- __s16 xoffset;
- __s16 yoffset;
- __u16 mode;
-};
-
-#define FB_CURSOR_OFF 0
-#define FB_CURSOR_ON 1
-#define FB_CURSOR_FLASH 2
-
-#endif /* Preliminary */
-
-#endif /* _LINUX_FB_H */
diff --git a/xc/programs/Xserver/hw/xfree86/loader/extsym.c b/xc/programs/Xserver/hw/xfree86/loader/extsym.c
index 8e0f0a56d..98441ad28 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/extsym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/extsym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/extsym.c,v 1.1 1999/12/28 15:16:42 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/extsym.c,v 1.3 2000/01/06 20:10:04 mvojkovi Exp $ */
/*
*
@@ -36,11 +36,11 @@ extern int BadShmSegCode;
extern RESTYPE ShmSegType, ShmPixType;
#ifdef PANORAMIX
-extern PanoramiXWindow *PanoramiXWinRoot;
extern Bool noPanoramiXExtension;
extern int PanoramiXNumScreens;
-extern PanoramiXPmap *PanoramiXPmapRoot;
extern PanoramiXData *panoramiXdataPtr;
+extern unsigned long XRT_WINDOW;
+extern unsigned long XRT_PIXMAP;
#endif
LOOKUP extLookupTab[] = {
@@ -50,11 +50,11 @@ LOOKUP extLookupTab[] = {
SYMVAR(ShmSegType)
#ifdef PANORAMIX
- SYMVAR(PanoramiXWinRoot)
SYMVAR(noPanoramiXExtension)
SYMVAR(PanoramiXNumScreens)
- SYMVAR(PanoramiXPmapRoot)
SYMVAR(panoramiXdataPtr)
+ SYMVAR(XRT_WINDOW)
+ SYMVAR(XRT_PIXMAP)
#endif
{ 0, 0 },
diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
index 4253513f5..6048f2c1c 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.120 1999/12/28 13:47:44 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.131 2000/02/21 19:23:14 dawes Exp $ */
/*
*
@@ -71,12 +71,25 @@ extern unsigned long inl(unsigned int a);
#endif
#if defined(__alpha__)
+#ifdef linux
extern void _outb(char val, unsigned short port);
extern void _outw(short val, unsigned short port);
extern void _outl(int val, unsigned short port);
extern unsigned int _inb(unsigned short port);
extern unsigned int _inw(unsigned short port);
extern unsigned int _inl(unsigned short port);
+#endif
+
+#ifdef __FreeBSD__
+#include <sys/types.h>
+extern void outb(u_int32_t port, u_int8_t val);
+extern void outw(u_int32_t port, u_int16_t val);
+extern void outl(u_int32_t port, u_int32_t val);
+extern u_int8_t inb(u_int32_t port);
+extern u_int16_t inw(u_int32_t port);
+extern u_int32_t inl(u_int32_t port);
+#endif
+
extern void* __divl(long, long);
extern void* __reml(long, long);
extern void* __divlu(long, long);
@@ -231,6 +244,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86CheckPciSlot)
SYMFUNC(xf86ClaimPciSlot)
SYMFUNC(xf86GetPciVideoInfo)
+ SYMFUNC(xf86GetEntityForPciInfo)
SYMFUNC(xf86GetPciConfigInfo)
SYMFUNC(xf86SetPciVideo)
SYMFUNC(xf86ClaimIsaSlot)
@@ -263,6 +277,13 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86ChkConflict)
SYMFUNC(xf86IsPciDevPresent)
SYMFUNC(xf86FindScreenForEntity)
+ SYMFUNC(xf86FindPciDeviceVendor)
+ SYMFUNC(xf86FindPciClass)
+ SYMFUNC(xf86RegisterStateChangeNotificationCallback)
+ SYMFUNC(xf86DeregisterStateChangeNotificationCallback)
+#ifdef async
+ SYMFUNC(xf86QueueAsyncEvent)
+#endif
/* xf86Cursor.c XXX not all of these should be exported */
SYMFUNC(xf86LockZoom)
@@ -323,7 +344,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86SetGamma)
SYMFUNC(xf86SetDpi)
SYMFUNC(xf86SetBlackWhitePixels)
- SYMFUNC(xf86SaveRestoreImage)
+ SYMFUNC(xf86EnableDisableFBAccess)
SYMFUNC(xf86VDrvMsgVerb)
SYMFUNC(xf86DrvMsgVerb)
SYMFUNC(xf86DrvMsg)
@@ -358,6 +379,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86IsPc98)
SYMFUNC(xf86GetClocks)
SYMFUNC(xf86LoadSubModule)
+ SYMFUNC(xf86LoaderCheckSymbol)
SYMFUNC(xf86LoaderReqSymLists)
SYMFUNC(xf86LoaderReqSymbols)
SYMFUNC(xf86Break1)
@@ -365,7 +387,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86Break3)
SYMFUNC(xf86SetBackingStore)
SYMFUNC(xf86SetSilkenMouse)
- SYMFUNC(xf86NewSerialNumber)
+ /* SYMFUNC(xf86NewSerialNumber) */
SYMFUNC(xf86FindXvOptions)
SYMFUNC(xf86GetOS)
SYMFUNC(xf86ConfigActivePciEntity)
@@ -374,6 +396,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86ConfigIsaEntityInactive)
SYMFUNC(xf86IsScreenPrimary)
SYMFUNC(xf86RegisterRootWindowProperty)
+ SYMFUNC(xf86IsUnblank)
/* xf86Init.c */
SYMFUNC(xf86GetPixFormat)
@@ -428,6 +451,9 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86GetOptValBool)
SYMFUNC(xf86ReturnOptValBool)
SYMFUNC(xf86NameCmp)
+ SYMFUNC(xf86InitValuatorAxisStruct)
+ SYMFUNC(xf86InitValuatorDefaults)
+
/* xf86fbman.c */
SYMFUNC(xf86InitFBManager)
@@ -631,6 +657,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86fread)
SYMFUNC(xf86free)
SYMFUNC(xf86freopen)
+ SYMFUNC(xf86frexp)
SYMFUNC(xf86fscanf)
SYMFUNC(xf86fseek)
SYMFUNC(xf86fsetpos)
@@ -640,7 +667,6 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86getenv)
SYMFUNC(xf86getpagesize)
SYMFUNC(xf86hypot)
- SYMFUNC(xf86qsort)
SYMFUNC(xf86ioctl)
SYMFUNC(xf86isalnum)
SYMFUNC(xf86isalpha)
@@ -654,6 +680,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86isupper)
SYMFUNC(xf86isxdigit)
SYMFUNC(xf86labs)
+ SYMFUNC(xf86ldexp)
SYMFUNC(xf86log)
SYMFUNC(xf86log10)
SYMFUNC(xf86lseek)
@@ -684,6 +711,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86perror)
SYMFUNC(xf86pow)
SYMFUNC(xf86printf)
+ SYMFUNC(xf86qsort)
SYMFUNC(xf86read)
SYMFUNC(xf86realloc)
SYMFUNC(xf86remove)
@@ -748,6 +776,10 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86chown)
SYMFUNC(xf86sleep)
SYMFUNC(xf86mkdir)
+ SYMFUNC(xf86shmget)
+ SYMFUNC(xf86shmat)
+ SYMFUNC(xf86shmdt)
+ SYMFUNC(xf86shmctl)
#ifdef XF86DRI
/* These may have more general uses, but
for now, they are only used by the DRI.
@@ -757,6 +789,8 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86InstallSIGIOHandler)
SYMFUNC(xf86RemoveSIGIOHandler)
#endif
+ SYMFUNC(xf86BlockSIGIO)
+ SYMFUNC(xf86UnblockSIGIO)
#if defined(__alpha__)
SYMFUNC(__divl)
@@ -768,18 +802,30 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(__remq)
SYMFUNC(__remqu)
+#ifdef linux
SYMFUNC(_outw)
SYMFUNC(_outb)
SYMFUNC(_outl)
SYMFUNC(_inb)
SYMFUNC(_inw)
SYMFUNC(_inl)
- SYMFUNC(xf86ReadSparse32)
- SYMFUNC(xf86ReadSparse16)
- SYMFUNC(xf86ReadSparse8)
- SYMFUNC(xf86WriteSparse32)
- SYMFUNC(xf86WriteSparse16)
- SYMFUNC(xf86WriteSparse8)
+#else
+ SYMFUNC(outw)
+ SYMFUNC(outb)
+ SYMFUNC(outl)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+#endif
+ SYMFUNC(xf86ReadMmio32)
+ SYMFUNC(xf86ReadMmio16)
+ SYMFUNC(xf86ReadMmio8)
+ SYMFUNC(xf86WriteMmio32)
+ SYMFUNC(xf86WriteMmio16)
+ SYMFUNC(xf86WriteMmio8)
+ SYMFUNC(xf86WriteMmioNB32)
+ SYMFUNC(xf86WriteMmioNB16)
+ SYMFUNC(xf86WriteMmioNB8)
SYMFUNC(memcpy)
#endif
#if defined(__powerpc__)
@@ -862,7 +908,9 @@ LOOKUP xfree86LookupTab[] = {
SYMVAR(xf86PCICardInfo)
SYMVAR(xf86PCIVendorInfo)
SYMVAR(xf86PCIVendorNameInfo)
-
+#ifdef async
+ SYMVAR(xf86CurrentScreen)
+#endif
/* predefined resource lists from xf86Bus.h */
SYMVAR(resVgaExclusive)
SYMVAR(resVgaShared)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/INT10.HOWTO b/xc/programs/Xserver/hw/xfree86/os-support/int10/INT10.HOWTO
deleted file mode 100644
index 8b628294c..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/INT10.HOWTO
+++ /dev/null
@@ -1,269 +0,0 @@
-
- INT10 X86 Real Mode executor
- =============================
-
- PRELIMINARY
-
-INT10 is a XFree86 module for softbooting and executing
-real mode int10 BIOS calls. The BIOS call code is largely
-untested, yet.
-
-1. Usage
-========
-
-To use the int10 module in a driver the header file
-xfree86/os-support/int10/xf86int10.h must be included.
-
- a. Initialization
- -----------------
-
-The int10-executer gets initialized by calling:
-
- xf86Int10InfoPtr xf86InitInt10(int entityIndex);
-
-The function will softboot any non-primary device and
-return a pointer to a xf86Int10InfoRec on success. If
-anything fails or if int10 execution is disabled by
-an option in the device section NULL will be returned.
-The driver should store this pointer for later calls
-to other int10 module functions.
-
- b. Memory allocation
- --------------------
-
-To allocate memory in the real mode execution environment
-
- void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
-
-can be called. It allocates num consecutive pagesize chunks.
-It returns the address of the allocated area. off is set to
-its offset in the real mode memory space.
-
- void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
-
-Is used to free num pages beginning at pbase.
-
- c. Doing int10 BIOS calls
- -------------------------
-
-The BIOS call is executed by calling:
-
- void xf86ExecX86int10(xf86Int10InfoPtr pInt);
-
-The number of the interrupt (normally 10) and the initial
-values of the ax, bx, cx, dx, si and di x86-CPU registers
-can be set in the xf86Int10InfoRec passed to the function.
-On return this structure contains the exit values of the
-registers listed above and the CPU flag register.
-
- d. Deinitializing
- -----------------
-
-If no further int10 calls are required for a certain chipset
-the driver should call:
-
- void xf86FreeInt10(xf86Int10InfoPtr pInt);
-
-to free the memory allocated for real mode int10 calls.
-
-
-2. Porting issues
-=================
-
-The int10 real mode executor is designed to run on top
-of various x86 CPU emulators as well as in vm86 mode
-of a real x86 CPU. If used with a CPU emulator the
-emulator and CPU specific interfaces can be held separate
-thus requiring minimal efforts to port the int10 module
-to new platforms.
-Currently an interface to the x86emu real mode emulator
-is provided.
-Since details of setting up and running the vm86 mode
-is platform dependent both the platform dependent environment
-and the emulation layer have to be ported. Several helper
-functions are provided for that.
-
-A CPU emulator should meet certain requirements to be usable
-for the INT10 executor:
-
-1. It must trap calls to intXX intstructions and pass execution
- to an external function which is allowed to modify CPU registers
- including the instruction pointer (IP) before returning to
- the emulator for continuing execution. When the external function
- is called the IP must point to the instruction past the intXX
- call.
-2. The emulator should use externally provided functions to handle
- PIO.
-3. The emulator should be able to use externally provided functions
- to access memory from the real mode memory environment.
- Note, that the vm86 mode usually requires one hunk of consecutive
- memory starting at address 0 in the process virtual memory space.
- Thus if this mode is to be used, the OS environment has to be
- able to provide that, ie. it must be able to remap the processes
- virtual memory space onto itself. If the emulator is able to
- handle memory access thru externally provided functions the
- real mode process memory can be located anywhere in the processes
- virtual memory. It does not even have to be consecutive.
-
-4. The executor should terminate on encountering a 'hlt' instruction.
-
-Functions to implement:
-
-1. xf86Int10InfoPtr xf86InitInt10(int entityIndex);
-
-This function should first call
- Bool int10skip(ScrnInfoPtr pScrn)
-to find out if the user has requested not to initialize int10.
-If so xf86InitInt10() should return NULL. Otherwise an
-xf86Int10InfoRec should be allocated.
-This structure contains the following fields:
- a. int entityIndex - index of the entity whose BIOS is to be executed
- b. pointer cpuRegs - pointer to a emulator/vm86-mode private structure.
- May hold cpu register values for the emulator.
- c. CARD16 BIOSseg - Video BIOS segment address.
- d. pointer private - pointer to a os specific data structure.
- e. int num - number of the int to be called.
- f. int ax..di,flags - CPU register values to pass to int-call.
-The Init function should initialize a-d. To initialize the emulator
-specific execute environment the function
- Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-should be called. If this function returns FALSE any already
-allocated memory should be freed and xf86Int10Init(0 should
-exit returning NULL.
-If the platform has a PC like system BIOS it may be copied to
-or mapped into memory locations SYS_BIOS to SYS_SIZE-1 of the
-real mode memory environment of this process. Otherwise the
-helper function:
- int setup_system_bios(CARD32 base_addr);
-may be called to set up a rudimentary system bios sufficient to
-be used to boot video BIOSes. base_addr specifies the virual address
-corresponding to SYS_BIOS in the real mode inevironment.
-If a PC-like int vector and BIOS data area is available it should
-be copied to 0 to LOW_PAGE_SIZE of the entities real mode environment.
-In this case the video interrupt related entries should be reset
-for all non-primary cards by calling:
- void reset_int_vect(xf86Int10InfoPtr pInt);
-To initialize the correct video BIOS entry points the BIOS must be
-warmbooted.
-If no PC-like int vector is available one can be set up by calling
- void setup_int_vect(xf86Int10InfoPtr pInt);
-In this case the video BIOS has to be warmbooted always.
-If the video BIOS for this entity has been installed during
-boot it may be mapped (or copied) directly to the correct
-address in the real mode memory environment. Otherwise
- int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address);
-should be called to copy the BIOS image from PCI ROM. 'address'
-specifies the address this image should be copied to. Sufficient
-space to hold an entire BIOS image should be allocated prior
-to calling mapPciRom(). This function will return the size of
-the BIOS image in bytes if it was able to successfully copy the
-image and 0 otherwise.
-If the BIOS needs to be warmbooted this should be done before
-leaving xf86InitInt10() by setting num in the xf86Int10InfoRec
-to 0xe6 and calling
- void xf86ExecX86int10(xf86Int10IfoPtr pInt);
-The implementation of this function will be discussed below.
-xf86InitInt10() should return a pointer to the xf86Int10InfoRec
-allocated.
-
-2. void MapCurrentInt10(xf86Int10InfoPtr pInt);
-
-In case a platform specific mapping has to be performed to map
-the memory allocated for the real mode memory environment into
-a specific location prior to executiong the x86 real mode code
-a function
- void MapCurrentInt10(xf86Int10InfoPtr pInt);
-has to be privided. It will be called by a helper function whenever
-the active entity changes. If the vm86 mode is used it is most likely
-that the 1MB real mode memory space located somewhere in the processes
-virtual memory will have to be remapped to address 0 of the virtual
-memory space.
-
-3. void xf86FreeInt10(xf86Int10InfoPtr pInt);
-
-To free all memory allocated for video BIOS calls of a specific
-entity the function
- void xf86FreeInt10(xf86Int10InfoPtr pInt);
-should be provided. If the entity to be freed was mapped by
-MapCurrentInt10() this mapping needs to be undone also.
-
-4.
- void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
- void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-
-xf86Int10AllocPages() should allocate 'num' consecutive pagesize chunks
-of memory. In real mode memory space this range needs to occupy
-consecutive addresses, too. The function must return the address of
-this memory. The offset in real mode memory needs to be returned in
-'off'. If no block of 'num' pages are available the function should
-return NULL.
-xf86Int10FreePages() will free the 'num' pages starting at 'pbase'.
-'num' is equal to the number of pages allocated by a single
-xf86Int10AllocatePages() call. 'pbase' is the address of the range
-previously returned by xf86Int10AllocatePages().
-
-Emulator specific functions
----------------------------
-
-1. Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
-
-This function will be called from xf86InitInt10(). It may be
-used to set up the static emulator specific part of the real mode
-environment. On success it should return TRUE.
-
-2. xf86ExecX86int10(xf86Int10InfoPtr pInt);
-
-This function gets called to execute an int call. It may call
-the helper function:
- void setup_int(xf86Int10InfoPrt pInt);
-to copy the register values to the emulator specific locations
-and to set up the non-static real mode execution environment.
-On return from setup_int() 'Int10Current' holds a pointer to
-the current xf86Int10InfoRec.
-It should start execution by calling
- Bool int_handler(xf86Int10InfoPtr pInt);
-and if this function returns TRUE it should call whatever necessary
-to continue execution until a 'hlt' instruction is encountered.
-To copy the resulting register values back to the xf86Int10InfoRec
-structure
- void finish_int(xf86Int10InfoPtr pInt);
-should be called.
-
-Helper functions are provided to aid the implementation of a
-vm86 call:
- Bool vm86_GP_fault(xf86Int10InfoPtr pInt);
-This function handles instructions which cause a vm86 call to
-trap. PIO access is handled by the in/out calls as defined in
-compiler.h. Optionally the PIO instructions can be logged by
-defining PRINT_PORT in xf96int10.h. This is ment for debuggin
-purposes.
-Unknown instructions and 'hlt' cause vm86_GP_fault() to return
-FALSE. Otherwise TRUE is returned.
-Note: This function is currently based on the Linux vm86 call.
-It might have to be modified or even rewirtten for other OS.
-So your milage may vary.
-
-Functions to dump memory, code, xf86 CPU register values and
-stack are also provided. Take a look at helper.c
-
-A header file 'defines.h' is required to define OS/emulator
-specific ways to access memory and xf86 CPU registers:
-Defines need to be provided for memory byte/work/long read/write
-access (MEM_RB(name,addr),MEM_RW(name,addr),MEM_RL(name,addr),
-MEM_WB(name,addr,val),MEM_WL(name,addr,val),MEM_WL(name,addr,val))
-of the real mode memory environment. 'name' will contain a pointer
-to the current xf86Int10InfoRec.
-Note: Emulators usually are not able to pass this pointer when
-calling memory access functions. In this case a global variable
-should be defined which can hold this pointer. This variable
-can be set in MapCurrentInt10(). It also must be set in
-xf86InitInt10() if this function calls the memory access functions
-either directly or by calling xf86ExecX86int10(pInt).
-Defines to access the emulator specific xf86 CPU register locations
-are also required: X86_EAX,...,X86_EFLAGS for access of the full
-32 bit registers, X86_AX...X86_FLAGS for access of the 16 bit
-registers and XF86_AL,XF86_BL,XF86_CL,XF86_DL to access the
-lower byte of the AX,BX,CX and DX register.
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/INT10.HOWTO,v 1.2 1999/09/27 14:59:19 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/int10/Imakefile
deleted file mode 100644
index d8a5b188a..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/Imakefile
+++ /dev/null
@@ -1,13 +0,0 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/Imakefile,v 1.1 1999/09/27 14:37:00 dawes Exp $
-
-#include <Server.tmpl>
-
-INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
- -I$(XINCLUDESRC) -I$(EXTINCSRC)
-
-SRCS = stub.c
-OBJS = stub.o
-
-all:: $(OBJS)
-
-DependTarget()
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/generic.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/generic.c
deleted file mode 100644
index 315b38c9e..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/generic.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/generic.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
-#include "xf86Pci.h"
-#include "compiler.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#include "defines.h"
-
-static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
-static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
-static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
-static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val);
-static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val);
-static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
-
-/*
- * the emulator cannot pass a pointer to the current xf86Int10InfoRec
- * to the memory access functions therefore store it here.
- */
-
-typedef struct {
- int screen;
- int shift;
- int pagesize_1;
- int entries;
- memType *alloc_rec;
-} genericInt10Priv;
-
-#define INTPriv(x) ((genericInt10Priv*)x->private)
-
-int10MemRec genericMem = {
- read_b,
- read_w,
- read_l,
- write_b,
- write_w,
- write_l
-};
-
-static void MapVRam(xf86Int10InfoPtr pInt);
-static void UnmapVRam(xf86Int10InfoPtr pInt);
-static void setupTable(xf86Int10InfoPtr pInt, memType address,
- int loc,int size);
-
-static void *sysMem = NULL;
-
-xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
- xf86Int10InfoPtr pInt;
- int screen;
- void* intMem;
- void* vbiosMem;
- int pagesize;
- int entries;
- int shift;
- legacyVGARec vga;
-
- screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
- if (int10skip(xf86Screens[screen],entityIndex))
- return NULL;
-
- pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec));
- pInt->entityIndex = entityIndex;
- if (!xf86Int10ExecSetup(pInt))
- goto error0;
- pInt->mem = &genericMem;
- pagesize = xf86getpagesize();
- pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv));
- entries = SYS_SIZE / pagesize;
-
- INTPriv(pInt)->screen = screen;
- INTPriv(pInt)->pagesize_1 = pagesize - 1;
- INTPriv(pInt)->entries = entries;
- INTPriv(pInt)->alloc_rec =
- xnfcalloc(1,sizeof(memType) * entries);
- for (shift = 0 ; (pagesize >> shift) ; shift++) {};
- shift -= 1;
- INTPriv(pInt)->shift = shift;
-
- /*
- * we need to map video RAM MMIO as some chipsets map mmio
- * registers into this range.
- */
-
- MapVRam(pInt);
- intMem = xnfalloc(pagesize);
- setupTable(pInt,(memType)intMem,0,pagesize);
- vbiosMem = xnfalloc(V_BIOS_SIZE);
-
-#ifdef _PC
- if (!sysMem)
- sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE);
- setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE);
- if (xf86ReadBIOS(0,0,(unsigned char *)intMem,LOW_PAGE_SIZE) < 0) {
- xf86Msg(X_ERROR,"Cannot read int vect\n");
- goto error1;
- }
- if (xf86IsEntityPrimary(entityIndex)) {
- int size;
- int cs = MEM_RW(pInt,((0x10<<2)+2));
- xf86Msg(X_INFO,"Primary V_BIOS segmant is: 0x%x\n",cs);
- if (xf86ReadBIOS(cs << 4,0,(unsigned char *)vbiosMem,
- 0x10) < 0) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error1;
- }
- if (!((*(CARD8*)vbiosMem == 0x55)
- && (*((CARD8*)vbiosMem + 1) == 0xAA))) {
- xf86Msg(X_ERROR,"No V_BIOS found\n");
- goto error1;
- }
-
- size = *((CARD8*)vbiosMem + 2) * 512;
- if (xf86ReadBIOS(cs << 4,0,vbiosMem, size) < 0) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error1;
- }
- if (bios_checksum(vbiosMem,size)) {
- xf86Msg(X_ERROR,"Bad checksum of V_BIOS \n");
- goto error1;
- }
-
- setupTable(pInt,(memType)vbiosMem,cs<<4,size);
- set_return_trap(pInt);
- pInt->BIOSseg = cs;
- } else {
- reset_int_vect(pInt);
- set_return_trap(pInt);
- if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error1;
- }
- setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE);
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
- LockLegacyVGA(screen, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(screen, &vga);
- }
-#else
- if (!sysMem) {
- sysMem = xnfalloc(BIOS_SIZE);
- setup_system_bios((memType)sysMem);
- }
- setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE);
- setup_int_vect(pInt);
- set_return_trap(pInt);
- if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error1;
- }
- setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE);
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
- LockLegacyVGA(screen, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(screen, &vga);
-#endif
- return pInt;
-
- error1:
- xfree(vbiosMem);
- xfree(intMem);
- UnmapVRam(pInt);
- xfree(INTPriv(pInt)->alloc_rec);
- xfree(pInt->private);
- error0:
- xfree(pInt);
-
- return NULL;
-}
-
-static void
-MapVRam(xf86Int10InfoPtr pInt)
-{
- int screen = INTPriv(pInt)->screen;
- int pagesize = INTPriv(pInt)->pagesize_1 + 1;
- int pages = (VRAM_SIZE + pagesize - 1)/pagesize;
- void *vidMem;
- int i;
-
- for (i = 0; i < pages; i++) {
- int addr = V_RAM + i * pagesize;
- vidMem = xf86MapVidMem(screen,VIDMEM_MMIO,addr,pagesize);
- setupTable(pInt,(memType)vidMem,addr,pagesize);
- }
-}
-
-static void
-UnmapVRam(xf86Int10InfoPtr pInt)
-{
- int screen = INTPriv(pInt)->screen;
- int pagesize = INTPriv(pInt)->pagesize_1 + 1;
- int pages = (VRAM_SIZE + pagesize - 1)/pagesize;
- int page = (V_RAM + pagesize - 1)/pagesize;
- int i;
-
- for (i = 0; i < pages; i++) {
- xf86UnMapVidMem(screen,
- (pointer)INTPriv(pInt)->
- alloc_rec[page],pagesize);
- page++;
- }
-}
-
-void
-MapCurrentInt10(xf86Int10InfoPtr pInt)
-{
-}
-
-void
-xf86FreeInt10(xf86Int10InfoPtr pInt)
-{
- int pagesize;
-
- if (!pInt)
- return;
- pagesize = INTPriv(pInt)->pagesize_1 + 1;
- if (Int10Current == pInt)
- Int10Current = NULL;
- xfree(INTPriv(pInt)->alloc_rec[V_BIOS/pagesize]);
- xfree(INTPriv(pInt)->alloc_rec[0]);
- UnmapVRam(pInt);
- xfree(INTPriv(pInt)->alloc_rec);
- xfree(pInt->private);
- xfree(pInt);
-}
-
-void *
-xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-{
- void* addr;
- int pagesize = INTPriv(pInt)->pagesize_1 + 1;
- int num_pages = INTPriv(pInt)->entries;
- int i,j;
-
- for (i=0;i<num_pages - num;i++) {
- if (INTPriv(pInt)->alloc_rec[i] == 0) {
- for (j=i;j < num + i;j++)
- if ((INTPriv(pInt)->alloc_rec[j] != 0))
- break;
- if (j == num + i)
- break;
- else
- i = i + num;
- }
- }
- if (i == num_pages - num)
- return NULL;
-
- *off = i * pagesize;
- addr = xnfalloc(pagesize * num);
- setupTable(pInt,(memType)addr,*off,pagesize * num);
-
- return addr;
-}
-
-void
-xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-{
- int num_pages = INTPriv(pInt)->entries;
- int i,j;
- for (i = 0;i<num_pages - num; i++)
- if (INTPriv(pInt)->alloc_rec[i]==(memType)pbase) {
- for (j = 0; j < num; j++)
- INTPriv(pInt)->alloc_rec[i] = 0;
- break;
- }
- xfree(pbase);
- return;
-}
-
-static void
-setupTable(xf86Int10InfoPtr pInt, memType address,int loc,int size)
-{
- int pagesize = INTPriv(pInt)->pagesize_1 + 1;
- int i,j,num;
-
- i = loc / pagesize;
- num = (size + pagesize - 1)/ pagesize; /* round up to the nearest page */
- /* boudary if size is not */
- /* multiple of pagesize */
- for (j = 0; j<num; j++) {
- INTPriv(pInt)->alloc_rec[i+j] = address;
- address += pagesize;
- }
-}
-
-#define OFF(addr) \
- ((addr) & (INTPriv(pInt)->pagesize_1))
-#define SHIFT \
- (INTPriv(pInt)->shift)
-#define BASE(addr,shift) \
- (INTPriv(pInt)->alloc_rec[addr >> shift])
-#define V_ADDR(addr,shift,off) \
- (BASE(addr,shift) + (off))
-
-#define VRAM(addr) ((addr >= 0xA0000) && (addr <= 0xBFFFF))
-#define V_ADDR_RB(addr,shift,off) \
- (VRAM(addr)) ? MMIO_IN8((CARD8*)BASE(addr,shift),off) \
- : *(CARD8*) V_ADDR(addr,shift,off)
-#define V_ADDR_RW(addr,shift,off) \
- (VRAM(addr)) ? MMIO_IN16((CARD16*)BASE(addr,shift),off) \
- : ldw_u((pointer)V_ADDR(addr,shift,off))
-#define V_ADDR_RL(addr,shift,off) \
- (VRAM(addr)) ? MMIO_IN32((CARD32*)BASE(addr,shift),off) \
- : ldl_u((pointer)V_ADDR(addr,shift,off))
-
-#define V_ADDR_WB(addr,shift,off,val) \
- if(VRAM(addr)) \
- MMIO_OUT8((CARD8*)BASE(addr,shift),off,val); \
- else \
- *(CARD8*) V_ADDR(addr,SHIFT,off) = val;
-#define V_ADDR_WW(addr,shift,off,val) \
- if(VRAM(addr)) \
- MMIO_OUT16((CARD16*)BASE(addr,shift),off,val); \
- else \
- stw_u((val),(pointer)(V_ADDR(addr,SHIFT,off)));
-
-#define V_ADDR_WL(addr,shift,off,val) \
- if (VRAM(addr)) \
- MMIO_OUT32((CARD32*)BASE(addr,shift),off,val); \
- else \
- stl_u(val,(pointer)(V_ADDR(addr,SHIFT,off)));
-
-static CARD8
-read_b(xf86Int10InfoPtr pInt, int addr)
-{
- ErrorF("add: 0x%X\n",addr);
- return V_ADDR_RB(addr,SHIFT,OFF(addr));
-}
-
-static CARD16
-read_w(xf86Int10InfoPtr pInt, int addr)
-{
- int shift = SHIFT;
- int off = OFF(addr);
-
-/* ErrorF("add: 0x%X 0x%X\n",addr,V_ADDR(BASE(addr,shift),shift,off)); */
- ErrorF("add: 0x%X\n",addr);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- return ((V_ADDR_RB(addr,shift,off))
- || ((V_ADDR_RB(addr,shift,off + 1)) << 8));
-#else
- if (OFF(addr + 1) > 0) {
- return V_ADDR_RW(addr,SHIFT,OFF(addr));
- } else {
- return ((V_ADDR_RB(addr,shift,off + 1))
- || ((V_ADDR_RB(addr,shift,off)) << 8));
- }
-#endif
-}
-
-static CARD32
-read_l(xf86Int10InfoPtr pInt, int addr)
-{
- int shift = SHIFT;
- int off = OFF(addr);
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- return ((V_ADDR_RB(addr,shift,off))
- || ((V_ADDR_RB(addr,shift,off + 1)) << 8)
- || ((V_ADDR_RB(addr,shift,off + 2)) << 16)
- || ((V_ADDR_RB(addr,shift,off + 3)) << 24));
-#else
- if (OFF(addr + 3) > 2) {
- return V_ADDR_RL(addr,SHIFT,OFF(addr));
- } else {
- return ((V_ADDR_RB(addr,shift,off + 3))
- || ((V_ADDR_RB(addr,shift,off + 2)) << 8)
- || ((V_ADDR_RB(addr,shift,off + 1)) << 16)
- || ((V_ADDR_RB(addr,shift,off)) << 24));
- }
-#endif
-}
-
-static void
-write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
-{
- V_ADDR_WB(addr,SHIFT,OFF(addr),val);
-}
-
-static void
-write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
-{
- int shift = SHIFT;
- int off = OFF(addr);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- (V_ADDR_WB(addr,shift,off),val);
- (V_ADDR_WB(addr,shift,off + 1),val >> 8);
-#else
- if (OFF(addr + 1) > 0) {
- V_ADDR_WW(addr,SHIFT,OFF(addr),val);
- } else {
- V_ADDR_WB(addr,shift,off + 1,val);
- V_ADDR_WB(addr,shift,off,val >> 8);
- }
-#endif
-}
-
-static void
-write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
-{
- int shift = SHIFT;
- int off = OFF(addr);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- V_ADDR_WB(addr,shift,off,val);
- V_ADDR_WB(addr,shift,off + 1, val >> 8);
- V_ADDR_WB(addr,shift,off + 2, val >> 16);
- V_ADDR_WB(addr,shift,off + 3, val >> 24);
-#else
- if (OFF(addr + 3) > 2) {
- V_ADDR_WL(addr,SHIFT,OFF(addr),val);
- } else {
- V_ADDR_WB(addr,shift,off + 3, val);
- V_ADDR_WB(addr,shift,off + 2, val >> 8);
- V_ADDR_WB(addr,shift,off + 1, val >> 16);
- V_ADDR_WB(addr,shift,off, val >> 24);
- }
-#endif
-}
-
-pointer
-xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
-{
- return (pointer) V_ADDR(addr,SHIFT,OFF(addr));
-}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_exec.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_exec.c
deleted file mode 100644
index 0a70e1b6b..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_exec.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/helper_exec.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- *
- * Part of this is based on code taken form DOSEMU
- * (C) Copyright 1992, ..., 1999 the "DOSEMU-Development-Team"
- */
-#include "xf86.h"
-#include "xf86str.h"
-#include "compiler.h"
-#include "xf86Pci.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#include "defines.h"
-#include "xf86_ansic.h"
-#include "xf86_libc.h"
-
-#ifndef _PC
-static int pciCfg1in(CARD16 addr, CARD32 *val);
-static int pciCfg1out(CARD16 addr, CARD32 val);
-#endif
-
-#define REG pInt
-
-void
-setup_int(xf86Int10InfoPtr pInt)
-{
- if (pInt != Int10Current) {
- MapCurrentInt10(pInt);
- Int10Current = pInt;
- }
-
- X86_EAX = (CARD32) pInt->ax;
- X86_EBX = (CARD32) pInt->bx;
- X86_ECX = (CARD32) pInt->cx;
- X86_EDX = (CARD32) pInt->dx;
- X86_EDX = (CARD32) pInt->si;
- X86_EDI = (CARD32) pInt->di;
- X86_ES = (CARD32) pInt->es;
- X86_EBP = 0;
- X86_EIP = 0;
- X86_CS = 0x60; /* address of 'hlt' */
- X86_ESP = 0x100;
- X86_SS = 0x30; /* This is the standard pc bios stack */
- X86_DS = 0x40; /* standard pc ds */
- X86_FS = 0;
- X86_GS = 0;
- X86_EFLAGS |= (X86_VIF_MASK | X86_VIP_MASK | X86_IF_MASK | 2);
-}
-
-void
-finish_int(xf86Int10InfoPtr pInt)
-{
- pInt->ax = (CARD16) X86_EAX;
- pInt->bx = (CARD16) X86_EBX;
- pInt->cx = (CARD16) X86_ECX;
- pInt->dx = (CARD16) X86_EDX;
- pInt->si = (CARD16) X86_ESI;
- pInt->di = (CARD16) X86_EDI;
- pInt->flags = (CARD16) X86_FLAGS;
-}
-
-#define SEG_ADR(type, seg, reg) type((seg << 4) \
- + (X86_E##reg))
-#ifndef _X86EMU
-/* get the linear address */
-#define LIN_PREF_SI ((pref_seg << 4) + X86_SI)
-#define LWECX (prefix66 ^ prefix67 ? X86_ECX : X86_CX)
-#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;}
-#define DF (1 << 10)
-
-
-/* vm86 fault handling */
-Bool
-vm86_GP_fault(xf86Int10InfoPtr pInt)
-{
- unsigned char *csp, *lina;
- CARD32 org_eip;
- int pref_seg;
- int done,is_rep,prefix66,prefix67;
-
-
- csp = lina = SEG_ADR((unsigned char *), X86_CS, IP);
-
- is_rep = 0;
- prefix66 = prefix67 = 0;
- pref_seg = -1;
-
- /* eat up prefixes */
- done = 0;
- do {
- switch (MEM_RB(pInt,(int)csp++)) {
- case 0x66: /* operand prefix */ prefix66=1; break;
- case 0x67: /* address prefix */ prefix67=1; break;
- case 0x2e: /* CS */ pref_seg=X86_CS; break;
- case 0x3e: /* DS */ pref_seg=X86_DS; break;
- case 0x26: /* ES */ pref_seg=X86_ES; break;
- case 0x36: /* SS */ pref_seg=X86_SS; break;
- case 0x65: /* GS */ pref_seg=X86_GS; break;
- case 0x64: /* FS */ pref_seg=X86_FS; break;
- case 0xf2: /* repnz */
- case 0xf3: /* rep */ is_rep=1; break;
- default: done=1;
- }
- } while (!done);
- csp--; /* oops one too many */
- org_eip = X86_EIP;
- X86_IP += (csp - lina);
-
- switch (MEM_RB(pInt,(int)csp)) {
- case 0x6c: /* insb */
- /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
- * but is anyone using extended regs in real mode? */
- /* WARNING: no test for DI wrapping! */
- X86_EDI += port_rep_inb(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI),
- X86_FLAGS & DF, (is_rep? LWECX:1));
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6d: /* (rep) insw / insd */
- /* NOTE: ES can't be overwritten */
- /* WARNING: no test for _DI wrapping! */
- if (prefix66) {
- X86_DI += port_rep_inl(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI),
- X86_EFLAGS & DF, (is_rep? LWECX:1));
- }
- else {
- X86_DI += port_rep_inw(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI),
- X86_FLAGS & DF, (is_rep? LWECX:1));
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6e: /* (rep) outsb */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- X86_SI += port_rep_outb(pInt,X86_DX,(CARD32)LIN_PREF_SI, X86_FLAGS&DF,
- (is_rep? LWECX:1));
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6f: /* (rep) outsw / outsd */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- if (prefix66) {
- X86_SI += port_rep_outl(pInt,X86_DX,(CARD32)LIN_PREF_SI,
- X86_EFLAGS&DF, (is_rep? LWECX:1));
- }
- else {
- X86_SI += port_rep_outw(pInt,X86_DX,(CARD32)LIN_PREF_SI,
- X86_FLAGS & DF, (is_rep? LWECX:1));
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0xe5: /* inw xx, inl xx */
- if (prefix66) X86_EAX = p_inl((int) MEM_RB(pInt,(int)(csp+1)));
- else X86_AX = p_inw((int) (int)(csp[1]));
- X86_IP += 2;
- break;
- case 0xe4: /* inb xx */
- X86_AX &= ~(CARD32)0xff;
- X86_AL |= p_inb((int) MEM_RB(pInt,(int)(csp+1)));
- X86_IP += 2;
- break;
- case 0xed: /* inw dx, inl dx */
- if (prefix66) X86_EAX = p_inl(X86_EDX);
- else X86_AX = p_inw(X86_DX);
- X86_IP += 1;
- break;
- case 0xec: /* inb dx */
- X86_AX &= ~(CARD32)0xff;
- X86_AL |= p_inb(X86_DX);
- X86_IP += 1;
- break;
-
- case 0xe7: /* outw xx */
- if (prefix66) p_outl((int)MEM_RB(pInt,(int)(csp+1)), X86_EAX);
- else p_outw((int)MEM_RB(pInt,(int)(csp+1)), X86_AX);
- X86_IP += 2;
- break;
- case 0xe6: /* outb xx */
- p_outb((int) MEM_RB(pInt,(int)(csp+1)), X86_AL);
- X86_IP += 2;
- break;
- case 0xef: /* outw dx */
- if (prefix66) p_outl(X86_DX, X86_EAX);
- else p_outw(X86_DX, X86_AX);
- X86_IP += 1;
- break;
- case 0xee: /* outb dx */
- p_outb(X86_DX, X86_AL);
- X86_IP += 1;
- break;
-
- case 0xf4:
-#ifdef DEBUG
- ErrorF("hlt at %p\n", lina);
-#endif
- return FALSE;
-
- case 0x0f:
- xf86Msg(X_ERROR,"CPU 0x0f Trap at eip=0x%lx\n",X86_EIP);
- goto op0ferr;
- break;
-
- case 0xf0: /* lock */
- default:
- xf86Msg(X_ERROR,"unknown reason for exception\n");
- dump_registers(pInt);
- stack_trace(pInt);
-
- op0ferr:
- dump_code(pInt);
- xf86Msg(X_ERROR,"cannot continue\n");
- return FALSE;
- } /* end of switch() */
- return TRUE;
-}
-#endif
-/* general software interrupt handler */
-CARD32
-getIntVect(xf86Int10InfoPtr pInt,int num)
-{
- return (MEM_RW(pInt,(num << 2)) + (MEM_RW(pInt,((num << 2) + 2)) << 4));
-}
-
-void
-pushw(xf86Int10InfoPtr pInt, CARD16 val)
-{
- X86_ESP -= 2;
- MEM_WW(pInt,((CARD32) X86_SS << 4) + X86_SP,val);
-}
-
-int
-run_bios_int(int num, xf86Int10InfoPtr pInt)
-{
- CARD32 eflags;
-#ifndef _PC
- /* check if bios vector is initialized */
- if (MEM_RW(pInt,(num<<2)+2) == 0xF000) { /* SYS_BIOS_SEG ?*/
-#ifdef PRINT_INT
- ErrorF("card BIOS not loaded\n");
-#endif
- return 0;
- }
-#endif
-#ifdef PRINT_INT
- ErrorF("calling card BIOS at: ");
-#endif
- eflags = X86_EFLAGS;
-#if 0
- eflags = eflags | IF_MASK;
- X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
-#endif
- pushw(pInt, eflags);
- pushw(pInt, X86_CS);
- pushw(pInt, (CARD16)X86_EIP);
- X86_CS = MEM_RW(pInt,((num << 2) + 2));
- X86_EIP = (X86_EIP & 0xFFFF0000) | MEM_RW(pInt,(num << 2));
-#ifdef PRINT_INT
- ErrorF("0x%x:%lx\n",X86_CS,X86_EIP);
-#endif
- return 1;
-}
-
-/* Debugging stuff */
-void
-dump_code(xf86Int10InfoPtr pInt)
-{
- int i;
- CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
-
- ErrorF("code at 0x%8.8lx: ",lina);
- for (i=0; i<0x10; i++)
- ErrorF("%2.2x ",MEM_RB(pInt,lina + i));
- ErrorF("\n ");
- for (; i<0x20; i++)
- ErrorF("%2.2x ",MEM_RB(pInt,lina + i));
- ErrorF("\n");
-}
-
-#define PRINT(x) ErrorF(#x":%4.4x ",x)
-#define PRINT_FLAGS(x) ErrorF(#x":%8.8x ",x)
-void
-dump_registers(xf86Int10InfoPtr pInt)
-{
- PRINT(X86_IP);
- PRINT(X86_AX);
- PRINT(X86_BX);
- PRINT(X86_CX);
- PRINT(X86_DX);
- PRINT(X86_SI);
- PRINT(X86_DI);
- PRINT(X86_BP);
- ErrorF("\n");
- PRINT(X86_SP);
- PRINT(X86_CS);
- PRINT(X86_SS);
- PRINT(X86_ES);
- PRINT(X86_DS);
- PRINT(X86_FS);
- PRINT(X86_GS);
- PRINT_FLAGS(X86_EFLAGS);
- ErrorF("\n");
-}
-
-void
-stack_trace(xf86Int10InfoPtr pInt)
-{
- int i;
- CARD32 stack = SEG_ADR((CARD32), X86_SS, SP);
-
- ErrorF("stack at 0x%8.8lx:\n",stack);
- for (i=0; i < 0x10; i++)
- ErrorF("%2.2x ",MEM_RB(pInt,stack + i));
- ErrorF("\n");
-}
-/*
- * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make
- * an attempt to detect a legacy ISA card. If they find one they might
- * act very strange for example they might configure the card as a
- * monochrome card. This might cause some drivers to choke.
- * To avoid this we attempt legacy VGA by writing to all know VGA
- * disable registers before we call the BIOS initialization and
- * restore the original values afterwards. In beween we hold our
- * breath. To get to a (possibly exising) ISA card need to disable
- * our current PCI card.
- */
-void
-LockLegacyVGA(int screenIndex,legacyVGAPtr vga)
-{
- xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]);
- vga->save_msr = inb(0x3CC);
- vga->save_vse = inb(0x3C3);
- vga->save_46e8 = inb(0x46e8);
- vga->save_pos102 = inb(0x102);
- outb(0x3C2,~(CARD8)0x03 & vga->save_msr);
- outb(0x3C3,~(CARD8)0x01 & vga->save_vse);
- outb(0x46e8, ~(CARD8)0x08 & vga->save_46e8);
- outb(0x102, ~(CARD8)0x01 & vga->save_pos102);
- xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]);
-}
-
-void
-UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga)
-{
- xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]);
- outb(0x102, vga->save_pos102);
- outb(0x46e8, vga->save_46e8);
- outb(0x3C3, vga->save_vse);
- outb(0x3C2, vga->save_msr);
- xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]);
-}
-
-int
-port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -1 : 1;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_insb(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- MEM_WB(pInt,dst,inb(port));
- dst += inc;
- }
- return (dst-base);
-}
-
-int
-port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_insw(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- MEM_WW(pInt,dst,inw(port));
- dst += inc;
- }
- return (dst-base);
-}
-
-int
-port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_insl(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- MEM_WL(pInt,dst,inl(port));
- dst += inc;
- }
- return (dst-base);
-}
-
-int
-port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -1 : 1;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_outb(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- outb(port,MEM_RB(pInt,dst));
- dst += inc;
- }
- return (dst-base);
-}
-
-int
-port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_outw(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- outw(port,MEM_RW(pInt,dst));
- dst += inc;
- }
- return (dst-base);
-}
-
-int
-port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
-#ifdef PRINT_PORT
- ErrorF(" rep_outl(%#x) %d bytes at %p %s\n",
- port, count, base, d_f?"up":"down");
-#endif
- while (count--) {
- outl(port,MEM_RL(pInt,dst));
- dst += inc;
- }
- return (dst-base);
-}
-
-#if defined(PRINT_PORT) || !defined(_PC)
-CARD8
-x_inb(CARD16 port)
-{
- CARD8 val;
-
- val = inb(port);
-#ifdef PRINT_PORT
- ErrorF(" inb(%#x) = %2.2x\n",port,val);
-#endif
- return val;
-}
-
-CARD16
-x_inw(CARD16 port)
-{
- CARD16 val;
-
- val = inw(port);
-#ifdef PRINT_PORT
- ErrorF(" inw(%#x) = %4.4x\n",port,val);
-#endif
- return val;
-}
-
-void
-x_outb(CARD16 port, CARD8 val)
-{
-#ifdef PRINT_PORT
- ErrorF(" outb(%#x, %2.2x)\n",port,val);
-#endif
- outb(port,val);
-}
-
-void
-x_outw(CARD16 port, CARD16 val)
-{
-#ifdef PRINT_PORT
- ErrorF(" outw(%#x, %4.4x)\n",port,val);
-#endif
- outw(port,val);
-}
-
-CARD32
-x_inl(CARD16 port)
-{
- CARD32 val;
-
-#ifndef _PC
- if (!pciCfg1in(port,&val))
-#endif
- val = inl(port);
-
-#ifdef PRINT_PORT
- ErrorF(" inl(%#x) = %8.8x\n",port,val);
-#endif
- return val;
-}
-
-void
-x_outl(CARD16 port, CARD32 val)
-{
-#ifdef PRINT_PORT
- ErrorF(" outl(%#x, %8.8x)\n",port,val);
-#endif
-#ifndef _PC
- if (!pciCfg1out(port,val))
-#endif
- outl(port,val);
-}
-#endif
-
-CARD8
-Mem_rb(int addr)
-{
- return Int10Current->mem->rb(Int10Current,addr);
-}
-
-CARD16
-Mem_rw(int addr)
-{
- return Int10Current->mem->rw(Int10Current,addr);
-}
-
-CARD32
-Mem_rl(int addr)
-{
- return Int10Current->mem->rl(Int10Current,addr);
-}
-
-void
-Mem_wb(int addr,CARD8 val)
-{
- Int10Current->mem->wb(Int10Current,addr,val);
-}
-
-void
-Mem_ww(int addr,CARD16 val)
-{
- Int10Current->mem->ww(Int10Current,addr,val);
-}
-
-void
-Mem_wl(int addr,CARD32 val)
-{
- Int10Current->mem->wl(Int10Current,addr,val);
-}
-
-#ifndef _PC
-static CARD32 PciCfg1Addr = 0;
-
-#define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00)
-#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
-
-static int
-pciCfg1in(CARD16 addr, CARD32 *val)
-{
- if (addr == 0xCF8) {
- *val = PciCfg1Addr;
- return 1;
- }
- else if (addr == 0xCFC) {
- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr));
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1out(CARD16 addr, CARD32 val)
-{
- if (addr == 0xCF8) {
- PciCfg1Addr = val;
- return 1;
- }
- else if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr),val);
- return 1;
- }
- return 0;
-}
-#endif
-
-CARD8
-bios_checksum(CARD8 *start, int size)
-{
- int i;
- CARD8 val = 0;
-
- for (i = 0; i < size; i++)
- val += *start++;
- return val;
-}
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_mem.c
deleted file mode 100644
index f9b933121..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/helper_mem.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/helper_mem.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include "xf86.h"
-#include "xf86str.h"
-#include "compiler.h"
-#include "xf86Pci.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#include "defines.h"
-#include "xf86_ansic.h"
-#include "xf86_libc.h"
-
-#define REG pInt
-
-typedef enum {
- OPT_NOINT10
-} INT10Opts;
-
-static OptionInfoRec INT10Options[] = {
- {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
-};
-
-
-
-#ifdef DEBUG
-void
-dprint(unsigned long start, unsigned long size)
-{
- int i,j;
- char *c = (char *)start;
-
- for (j = 0; j < (size >> 4); j++) {
- char *d = c;
- ErrorF("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- ErrorF("%2.2x ",(unsigned char) (*(c++)));
- c = d;
- for (i = 0; i<16; i++) {
- ErrorF("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
- (unsigned char) (*(c)): '.');
- c++;
- }
- }
- ErrorF("\n");
-}
-#endif
-
-
-/*
- * here we are really paranoid about faking a "real"
- * BIOS. Most of this information was pulled from
- * dosemu.
- */
-void
-setup_int_vect(xf86Int10InfoPtr pInt)
-{
- const CARD16 cs = 0xF000;
- const CARD16 ip = 0x0;
- int i;
-
- /* let the int vects point to the SYS_BIOS seg */
- for (i=0; i<0x80; i++) {
- MEM_WW(pInt,(i<<2),ip);
- MEM_WW(pInt,((i<<2)+2),cs);
- }
- /* video interrupts default location */
- MEM_WW(pInt,(0x42<<2),0xf065);
- MEM_WW(pInt,(0x10<<2),0xf065);
- MEM_WW(pInt,(0x6D<<2),0xf065);
- /* video param table default location (int 1d) */
- MEM_WW(pInt,(0x1d<<2),0xf0A4);
- /* font tables default location (int 1F) */
- MEM_WW(pInt,(0x1f<<2),0xfa6e);
-
- /* int 11 default location */
- MEM_WW(pInt,(0x11<<2),0xf84d);
- /* int 12 default location */
- MEM_WW(pInt,(0x12<<2),0xf841);
- /* int 15 default location */
- MEM_WW(pInt,(0x15<<2),0xf859);
- /* int 1A default location */
- MEM_WW(pInt,(0x1a<<2),0xff6e);
- /* int 05 default location */
- MEM_WW(pInt,(0x05<<2),0xff54);
- /* int 08 default location */
- MEM_WW(pInt,(0x08<<2),0xfea5);
- /* int 13 default location (fdd) */
- MEM_WW(pInt,(0x13<<2),0xec59);
- /* int 0E default location */
- MEM_WW(pInt,(0x0e<<2),0xef57);
- /* int 17 default location */
- MEM_WW(pInt,(0x17<<2),0xefd2);
- /* fdd table default location (int 1e) */
- MEM_WW(pInt,(0x1e<<2),0xefc7);
-}
-
-int
-setup_system_bios(memType base_addr)
-{
- char *date = "06/01/99";
- char *eisa_ident = "PCI/ISA";
- CARD16 *base = (CARD16*) base_addr;
-
- /*
- * we trap the "industry standard entry points" to the BIOS
- * and all other locations by filling them with "hlt"
- * TODO: implement hlt-handler for these
- */
- memset((void *)(base),0xf4,0x10000);
-
- /* set bios date */
- strcpy((((char *)base) + 0xFFF5),date);
- /* set up eisa ident string */
- strcpy((((char *)base) + 0xFFD9),eisa_ident);
- /* write system model id for IBM-AT */
- *(((unsigned char *)base) + 0xFFFE) = 0xfc;
-
- return 1;
-}
-
-void
-reset_int_vect(xf86Int10InfoPtr pInt)
-{
- MEM_WW(pInt,(0x10<<2),0xf065);
- MEM_WW(pInt,((0x10<<2)+2),0xf000);
- MEM_WW(pInt,(0x42<<2),0xf065);
- MEM_WW(pInt,((0x42<<2)+2),0xf000);
- MEM_WW(pInt,(0x6D<<2),0xf065);
- MEM_WW(pInt,((0x6D<<2)+2),0xf000);
- }
-
-void
-set_return_trap(xf86Int10InfoPtr pInt)
-{
- /*
- * here we also set the exit condition:
- * we return when we encounter 'hlt' (^=0xf4) this
- * will be located at address 0x600 in x86 memory.
- */
- MEM_WB(pInt,0x600,0xf4);
-}
-
-Bool
-int10skip(ScrnInfoPtr pScrn, int entityIndex)
-{
- Bool noint10 = FALSE;
- EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
-
- if (pEnt->device && pEnt->device->options) {
- xf86ProcessOptions(pScrn->scrnIndex, pEnt->device->options,
- INT10Options);
- xf86GetOptValBool(INT10Options, OPT_NOINT10, &noint10);
- }
- xfree(pEnt);
-
- return noint10;
-}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/pci.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/pci.c
deleted file mode 100644
index eb0dfe0a4..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/pci.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/pci.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include "xf86Pci.h"
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86_libc.h"
-#include "xf86_ansic.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-
-int
-mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address)
-{
- PCITAG tag;
- unsigned long offset = 0;
- unsigned char *mem, *ptr;
- unsigned char *scratch = NULL;
- int length = 0;
-
- pciVideoPtr pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
-
- if (pvp == NULL)
- return 0;
-
- tag = pciTag(pvp->bus,pvp->device,pvp->func);
-
- mem = ptr = xnfalloc(0x10000);
- if (! xf86ReadPciBIOS(0,tag,offset,mem,0xFFFF)) {
- xfree(mem);
- return 0;
- }
-
- while ( *ptr == 0x55 && *(ptr+1) == 0xAA) {
- unsigned short data_off = *(ptr+0x18) | (*(ptr+0x19)<< 8);
- unsigned char *data = ptr + data_off;
- unsigned char type;
-
- if (*data!='P' || *(data+1)!='C' || *(data+2)!='I' || *(data+3)!='R')
- break;
- type = *(data + 0x14);
-#ifdef PRINT_PCI
- ErrorF("data segment in BIOS: 0x%x, type: 0x%x ",data_off,type);
-#endif
- if (type != 0) { /* not PC-AT image: find next one */
- unsigned int image_length;
- unsigned char indicator = *(data + 0x15);
- if (indicator & 0x80) /* last image */
- break;
- image_length = (*(data + 0x10)
- | (*(data + 0x11) << 8)) << 9;
-#ifdef PRINT_PCI
- ErrorF("data image length: 0x%x, ind: 0x%x\n",
- image_length,indicator);
-#endif
- offset = offset + image_length;
- if (! xf86ReadPciBIOS(0,tag,offset,mem,0xFFFF)) {
- xfree(mem);
- return 0;
- }
- continue;
- }
- /* OK, we have a PC Image */
- length = (*(ptr + 2) << 9);
-#ifdef PRINT_PCI
- ErrorF("BIOS length: 0x%x\n",length);
-#endif
- scratch = (unsigned char *)xnfalloc(length);
-
- if (! xf86ReadPciBIOS(0,tag,offset,scratch,length)) {
- xfree(mem);
- xfree(scratch);
- return 0;
- }
- break;
- }
- /* unmap/close/disable PCI bios mem */
- xfree(mem);
-
- if (scratch && length) {
- memcpy(address, scratch, length);
- xfree(scratch);
- }
-#ifdef PRINT_PCI
- dprint(address,0x20);
-#endif
- return length;
-}
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/stub.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/stub.c
deleted file mode 100644
index feffbbef3..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/stub.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/stub.c,v 1.4 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86_OSproc.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-
-xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
- return NULL;
-}
-
-void
-MapCurrentInt10(xf86Int10InfoPtr pInt)
-{
- return;
-}
-
-void
-xf86FreeInt10(xf86Int10InfoPtr pInt)
-{
- return;
-}
-
-void *
-xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-{
- *off = 0;
- return NULL;
-}
-
-void
-xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-{
- return;
-}
-
-Bool
-xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-{
- return FALSE;
-}
-
-void
-xf86ExecX86int10(xf86Int10InfoPtr pInt)
-{
- return;
-}
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.c
deleted file mode 100644
index 205b66a02..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-
-#include "xf86.h"
-#include "xf86str.h"
-#include "compiler.h"
-#include "xf86Pci.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#include "defines.h"
-
-xf86Int10InfoPtr Int10Current = NULL;
-
-static int int1A_handler(xf86Int10InfoPtr pInt);
-static int int42_handler(xf86Int10InfoPtr pInt);
-static int intE6_handler(xf86Int10InfoPtr pInt);
-static PCITAG findPci(unsigned short bx);
-static CARD32 pciSlotBX(pciVideoPtr pvp);
-
-int
-int_handler(xf86Int10InfoPtr pInt)
-{
- int num = pInt->num;
-
- switch (num) {
- case 0x10:
- case 0x42:
- if (!(int42_handler(pInt)))
- goto bios_handler;
- else return 1;
- case 0x1A:
- if(!(int1A_handler(pInt)))
- goto bios_handler;
- else return 1;
- case 0xe6:
- if (!(intE6_handler(pInt)))
- goto bios_handler;
- else return 1;
- default:
- goto bios_handler;
- }
- bios_handler:
- return run_bios_int(num,pInt);
-}
-
-/*
- * The system-BIOS provides int10 ax=1200 and ax=1201 functions
- * before the video bios is installed. The int10_handler below
- * provides these functions, too. However there have been cases
- * in which disabling generic video has caused problems. Therefore
- * it has been disabled by default. To reenable it do:
- * #define DO_GENERIC_INT10
- */
-static int
-int42_handler(xf86Int10InfoPtr pInt)
-{
-#define REG pInt
-#ifdef DO_GENERIC_INT10
- unsigned char c;
-#endif
- int num = pInt->num;
-#ifdef PRINT_INT
- ErrorF("int 0x%x: ax:0x%x bx:0x%x cx:0x%x dx:0x%x\n",num,
- X86_EAX,X86_EBX,X86_ECX,X86_EDX);
-#endif
- /*
- * video bios has modified these -
- * leave it to the video bios to do this
- */
-
- if (getIntVect(pInt,num) != I_S_DEFAULT_INT_VECT) {
- return 0;
- }
-
- if ((X86_EBX & 0xff) == 0x32) {
- switch (X86_EAX & 0xFFFF) {
- case 0x1200:
-#ifdef PRINT_INT
- ErrorF("enabling video\n");
-#endif
-#ifdef DO_GENERIC_INT10
- c = inb(0x3cc);
- c |= 0x02;
- outb(0x3c2,c);
-#endif
- return 1;
- case 0x1201:
-#ifdef PRINT_INT
- ErrorF("disabling video\n");
-#endif
-#ifdef DO_GENERIC_INT10
- c = inb(0x3cc);
- c &= ~0x02;
- outb(0x3c2,c);
-#endif
- return 1;
- default:
- break;
- }
- }
- if (num == 0x42)
- return 1;
- else
- return 0;
-}
-
-#define SUCCESSFUL 0x00
-#define DEVICE_NOT_FOUND 0x86
-#define BAD_REGISTER_NUMBER 0x87
-
-static int
-int1A_handler(xf86Int10InfoPtr pInt)
-{
- PCITAG tag;
- pciVideoPtr pvp;
-
- if (! (pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
- return 0; /* oops */
-
-#ifdef PRINT_INT
- ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x\n",
- X86_EAX,X86_EBX,X86_ECX,X86_EDX,X86_EDI);
-#endif
- switch (X86_EAX & 0xFFFF) {
- case 0xb101:
- X86_EAX &= 0xFF00; /* no config space/special cycle support */
- X86_EDX = 0x20494350; /* " ICP" */
- X86_EBX = 0x0210; /* Version 2.10 */
- X86_ECX &= 0xFF00;
- X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
-#ifdef PRINT_INT
- ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX,X86_EDX,X86_EBX,X86_ECX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb102:
- if ((X86_EDX & 0xFFFF) == pvp->vendor &&
- (X86_ECX & 0xFFFF) ==pvp->chipType &&
- X86_ESI == 0) {
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(pvp);
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x bx=0x%x flags=0x%x\n",
- X86_EAX,X86_EBX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb103:
- if ((X86_ECX & 0xFF) == pvp->interface &&
- ((X86_ECX & 0xFF00) >> 8) == pvp->subclass &&
- ((X86_ECX & 0xFFFF0000) >> 16) == pvp->class) {
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EBX = pciSlotBX(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n",X86_EAX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb108:
- if ((tag = findPci(X86_EBX))) {
- X86_ECX &= 0xFFFFFF00;
- X86_ECX |= pciReadByte(tag,X86_EDI);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX,X86_ECX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb109:
- if ((tag = findPci(X86_EBX))) {
- X86_ECX &= 0xFFFF0000;
- X86_ECX |= pciReadWord(tag,X86_EDI);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX,X86_ECX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb10a:
- if ((tag = findPci(X86_EBX))) {
- X86_ECX &= 0;
- X86_ECX |= pciReadLong(tag, X86_EDI);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX,X86_ECX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb10b:
- if ((tag = findPci(X86_EBX))) {
- pciWriteByte(tag,X86_EDI,(CARD8)X86_ECX);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb10c:
- if ((tag = findPci(X86_EBX))) {
- pciWriteWord(tag,X86_EDI,(CARD16)X86_ECX);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-#endif
- return 1;
- case 0xb10d:
- if ((tag = findPci(X86_EBX))) {
- pciWriteLong(tag,X86_EDI,(CARD32)X86_ECX);
- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
-#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-#endif
- return 1;
- default:
- return 0;
- }
-}
-
-static PCITAG
-findPci(unsigned short bx)
-{
- int bus = (bx >> 8) & 0xFF;
- int dev = (bx >> 3) & 0x1F;
- int func = bx & 0x7;
- if (xf86IsPciDevPresent(bus,dev,func))
- return pciTag(bus,dev,func);
- return 0;
-}
-
-static CARD32
-pciSlotBX(pciVideoPtr pvp)
-{
- return ((pvp->bus << 8) | (pvp->device << 3) | (pvp->func));
-}
-
-/*
- * handle initialization
- */
-static int
-intE6_handler(xf86Int10InfoPtr pInt)
-{
- pciVideoPtr pvp;
-
- if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) {
- X86_AX = (CARD16)(((pvp->bus) << 8)
- | (pvp->device << 3) | (pvp->func & 0x7));
- }
- pushw(pInt,X86_CS);
- pushw(pInt,(CARD16)X86_EIP);
- X86_CS = pInt->BIOSseg;
- X86_EIP = 0x0003;
- X86_ES = 0; /* standard pc es */
- return 1;
-}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.h b/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.h
deleted file mode 100644
index df3312b54..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10.h,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-
-#ifndef _XF86INT10_H
-#define _XF86INT10_H
-
-#define SEG_ADDR(x) ((x>>4) & 0xF000)
-#define SEG_OFF(x) (x & 0xFFFF)
-
-/* int10 info structure */
-typedef struct {
- int entityIndex;
- pointer cpuRegs;
- CARD16 BIOSseg;
- pointer private;
- struct _int10Mem* mem;
- int num;
- int ax;
- int bx;
- int cx;
- int dx;
- int si;
- int di;
- int es;
- int flags;
- } xf86Int10InfoRec, *xf86Int10InfoPtr;
-
-typedef struct _int10Mem {
- CARD8(*rb)(xf86Int10InfoPtr,int);
- CARD16(*rw)(xf86Int10InfoPtr,int);
- CARD32(*rl)(xf86Int10InfoPtr,int);
- void(*wb)(xf86Int10InfoPtr,int,CARD8);
- void(*ww)(xf86Int10InfoPtr,int,CARD16);
- void(*wl)(xf86Int10InfoPtr,int,CARD32);
-} int10MemRec, *int10MemPtr;
-
-/* OS dependent functions */
-xf86Int10InfoPtr xf86InitInt10(int entityIndex);
-void xf86FreeInt10(xf86Int10InfoPtr pInt);
-void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
-void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
-pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
-
-/* x86 executor related functions */
-void xf86ExecX86int10(xf86Int10InfoPtr pInt);
-
-#ifdef _INT10_PRIVATE
-
-#define I_S_DEFAULT_INT_VECT 0xFF065
-#define SYS_SIZE 0x100000
-#define SYS_BIOS 0xF0000
-#define BIOS_SIZE 0x10000
-#define LOW_PAGE_SIZE 0x600
-#define V_RAM 0xA0000
-#define VRAM_SIZE 0x20000
-#define V_BIOS_SIZE 0x10000
-#define V_BIOS 0xC0000
-
-#define X86_TF_MASK 0x00000100
-#define X86_IF_MASK 0x00000200
-#define X86_IOPL_MASK 0x00003000
-#define X86_NT_MASK 0x00004000
-#define X86_VM_MASK 0x00020000
-#define X86_AC_MASK 0x00040000
-#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
-#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
-#define X86_ID_MASK 0x00200000
-
-#define MEM_RB(name,addr) name->mem->rb(name,addr)
-#define MEM_RW(name,addr) name->mem->rw(name,addr)
-#define MEM_RL(name,addr) name->mem->rl(name,addr)
-#define MEM_WB(name,addr,val) name->mem->wb(name,addr,val)
-#define MEM_WW(name,addr,val) name->mem->ww(name,addr,val)
-#define MEM_WL(name,addr,val) name->mem->wl(name,addr,val)
-
-typedef struct {
- CARD8 save_msr;
- CARD8 save_pos102;
- CARD8 save_vse;
- CARD8 save_46e8;
-} legacyVGARec, *legacyVGAPtr;
-
-/* OS dependent functions */
-void MapCurrentInt10(xf86Int10InfoPtr pInt);
-/* x86 executor related functions */
-Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
-
-/* int.c */
-extern xf86Int10InfoPtr Int10Current;
-int int_handler(xf86Int10InfoPtr pInt);
-
-/* helper_exec.c */
-void setup_int(xf86Int10InfoPtr pInt);
-void finish_int(xf86Int10InfoPtr);
-CARD32 getIntVect(xf86Int10InfoPtr pInt,int num);
-int vm86_GP_fault(xf86Int10InfoPtr pInt);
-void pushw(xf86Int10InfoPtr pInt, CARD16 val);
-int run_bios_int(int num, xf86Int10InfoPtr pInt);
-void dump_code(xf86Int10InfoPtr pInt);
-void dump_registers(xf86Int10InfoPtr pInt);
-void stack_trace(xf86Int10InfoPtr pInt);
-xf86Int10InfoPtr getInt10Rec(int entityIndex);
-void LockLegacyVGA(int screenIndex, legacyVGAPtr vga);
-void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga);
-int port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-int port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-int port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-int port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-int port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-int port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-CARD8 bios_checksum(CARD8 *start, int size);
-
-CARD8 x_inb(CARD16 port);
-CARD16 x_inw(CARD16 port);
-void x_outb(CARD16 port, CARD8 val);
-void x_outw(CARD16 port, CARD16 val);
-CARD32 x_inl(CARD16 port);
-void x_outl(CARD16 port, CARD32 val);
-
-#if defined(PRINT_PORT) || !defined(_PC)
-# define p_inb x_inb
-# define p_inw x_inw
-# define p_outb x_outb
-# define p_outw x_outw
-# define p_inl x_inl
-# define p_outl x_outl
-#else
-# define p_inb inb
-# define p_inw inw
-# define p_outb outb
-# define p_outw outw
-# define p_inl inl
-# define p_outl outl
-#endif
-
-CARD8 Mem_rb(int addr);
-CARD16 Mem_rw(int addr);
-CARD32 Mem_rl(int addr);
-void Mem_wb(int addr,CARD8 val);
-void Mem_ww(int addr,CARD16 val);
-void Mem_wl(int addr,CARD32 val);
-
-/* helper_mem.c */
-void setup_int_vect(xf86Int10InfoPtr pInt);
-int setup_system_bios(unsigned long base_addr);
-void reset_int_vect(xf86Int10InfoPtr pInt);
-void set_return_trap(xf86Int10InfoPtr pInt);
-Bool int10skip(ScrnInfoPtr pScrn, int entityIndex);
-#ifdef DEBUG
-void dprint(unsigned long start, unsigned long size);
-#endif
-
-/* pci.c */
-int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address);
-
-#endif /* _INT10_PRIVATE */
-#endif /* _XF86INT10_H */
-
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10module.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10module.c
deleted file mode 100644
index abba820fd..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10module.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/xf86int10module.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86Pci.h"
-#include "xf86int10.h"
-
-
-#ifdef XFree86LOADER
-
-static MODULESETUPPROTO(int10Setup);
-
-static XF86ModuleVersionInfo int10VersRec =
-{
- "int10",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XF86_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-XF86ModuleData int10ModuleData = { &int10VersRec, int10Setup, NULL };
-
-static pointer
-int10Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = FALSE;
-
- if (!setupDone) {
- setupDone = TRUE;
- /*
- * Tell the loader about symbols from other modules that this module
- * might refer to.
- */
- }
- /*
- * The return value must be non-NULL on success even though there
- * is no TearDownProc.
- */
- return (pointer)1;
-}
-
-#endif
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.c b/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.c
deleted file mode 100644
index 5f5c963f8..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.c,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#include <x86emu.h>
-#include "xf86.h"
-#include "xf86str.h"
-#include "compiler.h"
-#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
-#include "xf86Pci.h"
-#include "xf86_libc.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#include "defines.h"
-
-#define M _X86EMU_env
-
-static void
-x86emu_do_int(int num)
-{
- Int10Current->num = num;
- if (!int_handler(Int10Current)) {
- xf86Msg(X_ERROR,"\nUnknown vm86_int: %X\n\n",num);
- X86EMU_halt_sys();
- }
- return;
-}
-
-void
-xf86ExecX86int10(xf86Int10InfoPtr pInt)
-{
- setup_int(pInt);
-
- if (int_handler(pInt)) {
- X86EMU_exec();
- }
-
- finish_int(pInt);
-}
-
-Bool
-xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-{
- int i;
- X86EMU_intrFuncs intFuncs[256];
- X86EMU_pioFuncs pioFuncs = {
- (CARD8(*)(CARD16))p_inb,
- (u16(*)(CARD16))p_inw,
- (u32(*)(CARD16))p_inl,
- (void(*)(CARD16,CARD8))p_outb,
- (void(*)(CARD16,CARD16))p_outw,
- (void(*)(CARD16,CARD32))p_outl
- };
-
- X86EMU_memFuncs memFuncs = {
- (CARD8(*)(CARD32))Mem_rb,
- (CARD16(*)(CARD32))Mem_rw,
- (CARD32(*)(CARD32))Mem_rl,
- (void(*)(CARD32,CARD8))Mem_wb,
- (void(*)(CARD32,CARD16))Mem_ww,
- (void(*)(CARD32,CARD32))Mem_wl
- };
-
- X86EMU_setupMemFuncs(&memFuncs);
-
- pInt->cpuRegs = &M;
- M.mem_base = 0;
- M.mem_size = 1024*1024 + 1024;
- X86EMU_setupPioFuncs(&pioFuncs);
-
- for (i=0;i<256;i++)
- intFuncs[i] = x86emu_do_int;
- X86EMU_setupIntrFuncs(intFuncs);
- return TRUE;
-}
-
-void
-printk(const char *fmt, ...)
-{
- va_list argptr;
- va_start(argptr, fmt);
- ErrorF(fmt, argptr);
- fflush(stdout);
- va_end(argptr);
-}
-
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.h b/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.h
deleted file mode 100644
index 1b5aff757..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10/xf86x86emu.h,v 1.3 1999/12/03 19:17:41 eich Exp $ */
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#ifndef XF86X86EMU_H_
-#define XF86X86EMU_H_
-#include <x86emu.h>
-
-#define M _X86EMU_env
-
-#define X86_EAX M.x86.R_EAX
-#define X86_EBX M.x86.R_EBX
-#define X86_ECX M.x86.R_ECX
-#define X86_EDX M.x86.R_EDX
-#define X86_ESI M.x86.R_ESI
-#define X86_EDI M.x86.R_EDI
-#define X86_EBP M.x86.R_EBP
-#define X86_EIP M.x86.R_EIP
-#define X86_ESP M.x86.R_ESP
-#define X86_EFLAGS M.x86.R_EFLG
-
-#define X86_FLAGS M.x86.R_FLG
-#define X86_AX M.x86.R_AX
-#define X86_BX M.x86.R_BX
-#define X86_CX M.x86.R_CX
-#define X86_DX M.x86.R_DX
-#define X86_SI M.x86.R_SI
-#define X86_DI M.x86.R_DI
-#define X86_BP M.x86.R_BP
-#define X86_IP M.x86.R_IP
-#define X86_SP M.x86.R_SP
-#define X86_CS M.x86.R_CS
-#define X86_DS M.x86.R_DS
-#define X86_ES M.x86.R_ES
-#define X86_SS M.x86.R_SS
-#define X86_FS M.x86.R_FS
-#define X86_GS M.x86.R_GS
-
-#define X86_AL M.x86.R_AL
-#define X86_BL M.x86.R_BL
-#define X86_CL M.x86.R_CL
-#define X86_DL M.x86.R_DL
-
-#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel
index 57c6c50ca..44d75c487 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel
@@ -9,6 +9,7 @@
# Note 2! The CFLAGS definitions are now inherited from the
# parent makes..
#
+# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.5 2000/02/14 06:27:25 martin Exp $
L_TARGET := libdrm.a
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
index 63092770a..0f14540d9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
@@ -1,6 +1,6 @@
# Makefile -- For the Direct Rendering Manager module (drm)
# Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com
-# Revised: Mon Jan 17 05:25:12 2000 by faith@precisioninsight.com
+# Revised: Sun Feb 13 23:15:59 2000 by kevin@precisioninsight.com
#
# Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
# All rights reserved.
@@ -25,7 +25,7 @@
# DEALINGS IN THE SOFTWARE.
#
# $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/Makefile.linux,v 1.23 1999/07/02 17:46:30 faith Exp $
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/Makefile.linux,v 1.3 1999/06/27 14:08:21 dawes Exp $
+# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.5 2000/02/14 06:27:25 martin Exp $
#
.SUFFIXES:
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c
new file mode 100644
index 000000000..fb58154d6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c
@@ -0,0 +1,313 @@
+/* agpsupport.c -- DRM support for AGP/GART backend -*- linux-c -*-
+ * Created: Mon Dec 13 09:56:45 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.
+ *
+ * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c,v 1.1 2000/02/11 17:26:02 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+
+/* The C standard says that 'void *' is not guaranteed to hold a function
+ pointer, so we use this union to define a generic pointer that is
+ guaranteed to hold any of the function pointers we care about. */
+typedef union {
+ void (*free_memory)(agp_memory *);
+ agp_memory *(*allocate_memory)(size_t, u32);
+ int (*bind_memory)(agp_memory *, off_t);
+ int (*unbind_memory)(agp_memory *);
+ void (*enable)(u32);
+ int (*acquire)(void);
+ void (*release)(void);
+ void (*copy_info)(agp_kern_info *);
+ unsigned long address;
+} drm_agp_func_u;
+
+typedef struct drm_agp_fill {
+ const char *name;
+ drm_agp_func_u *f;
+} drm_agp_fill_t;
+
+static drm_agp_fill_t drm_agp_fill[] = {
+ { __MODULE_STRING(agp_free_memory),
+ (drm_agp_func_u *)&drm_agp.free_memory },
+ { __MODULE_STRING(agp_allocate_memory),
+ (drm_agp_func_u *)&drm_agp.allocate_memory },
+ { __MODULE_STRING(agp_bind_memory),
+ (drm_agp_func_u *)&drm_agp.bind_memory },
+ { __MODULE_STRING(agp_unbind_memory),
+ (drm_agp_func_u *)&drm_agp.unbind_memory },
+ { __MODULE_STRING(agp_enable),
+ (drm_agp_func_u *)&drm_agp.enable },
+ { __MODULE_STRING(agp_backend_acquire),
+ (drm_agp_func_u *)&drm_agp.acquire },
+ { __MODULE_STRING(agp_backend_release),
+ (drm_agp_func_u *)&drm_agp.release },
+ { __MODULE_STRING(agp_copy_info),
+ (drm_agp_func_u *)&drm_agp.copy_info },
+ { NULL, NULL }
+};
+
+int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ agp_kern_info *kern;
+ drm_agp_info_t info;
+
+ if (!dev->agp->acquired || !drm_agp.copy_info) return -EINVAL;
+
+ kern = &dev->agp->agp_info;
+ info.agp_version_major = kern->version.major;
+ info.agp_version_minor = kern->version.minor;
+ info.mode = kern->mode;
+ info.aperture_base = kern->aper_base;
+ info.aperture_size = kern->aper_size * 1024 * 1024;
+ info.memory_allowed = kern->max_memory << PAGE_SHIFT;
+ info.memory_used = kern->current_memory << PAGE_SHIFT;
+ info.id_vendor = kern->device->vendor;
+ info.id_device = kern->device->device;
+
+ copy_to_user_ret((drm_agp_info_t *)arg, &info, sizeof(info), -EFAULT);
+ return 0;
+}
+
+int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode;
+
+ if (dev->agp->acquired || !drm_agp.acquire) return -EINVAL;
+ if ((retcode = (*drm_agp.acquire)())) return retcode;
+ dev->agp->acquired = 1;
+ return 0;
+}
+
+int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+
+ if (!dev->agp->acquired || !drm_agp.release) return -EINVAL;
+ (*drm_agp.release)();
+ dev->agp->acquired = 0;
+ return 0;
+
+}
+
+int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_agp_mode_t mode;
+
+ if (!dev->agp->acquired || !drm_agp.enable) return -EINVAL;
+
+ copy_from_user_ret(&mode, (drm_agp_mode_t *)arg, sizeof(mode),
+ -EFAULT);
+
+ dev->agp->mode = mode.mode;
+ (*drm_agp.enable)(mode.mode);
+ dev->agp->base = dev->agp->agp_info.aper_base;
+ dev->agp->enabled = 1;
+ return 0;
+}
+
+int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_agp_buffer_t request;
+ drm_agp_mem_t *entry;
+ agp_memory *memory;
+ unsigned long pages;
+ u32 type;
+ if (!dev->agp->acquired) return -EINVAL;
+ copy_from_user_ret(&request, (drm_agp_buffer_t *)arg, sizeof(request),
+ -EFAULT);
+ if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
+ return -ENOMEM;
+
+ pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
+ type = (u32) request.type;
+
+ if (!(memory = drm_alloc_agp(pages, type))) {
+ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ return -ENOMEM;
+ }
+
+ entry->handle = (unsigned long)memory->memory;
+ entry->memory = memory;
+ entry->bound = 0;
+ entry->pages = pages;
+ entry->prev = NULL;
+ entry->next = dev->agp->memory;
+ if (dev->agp->memory) dev->agp->memory->prev = entry;
+ dev->agp->memory = entry;
+
+ request.handle = entry->handle;
+ request.physical = memory->physical;
+
+ if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) {
+ dev->agp->memory = entry->next;
+ dev->agp->memory->prev = NULL;
+ drm_free_agp(memory, pages);
+ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ return -EFAULT;
+ }
+ return 0;
+}
+
+static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev,
+ unsigned long handle)
+{
+ drm_agp_mem_t *entry;
+
+ for (entry = dev->agp->memory; entry; entry = entry->next) {
+ if (entry->handle == handle) return entry;
+ }
+ return NULL;
+}
+
+int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_agp_binding_t request;
+ drm_agp_mem_t *entry;
+
+ if (!dev->agp->acquired) return -EINVAL;
+ copy_from_user_ret(&request, (drm_agp_binding_t *)arg, sizeof(request),
+ -EFAULT);
+ if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+ return -EINVAL;
+ if (!entry->bound) return -EINVAL;
+ return drm_unbind_agp(entry->memory);
+}
+
+int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_agp_binding_t request;
+ drm_agp_mem_t *entry;
+ int retcode;
+ int page;
+
+ if (!dev->agp->acquired || !drm_agp.bind_memory) return -EINVAL;
+ copy_from_user_ret(&request, (drm_agp_binding_t *)arg, sizeof(request),
+ -EFAULT);
+ if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+ return -EINVAL;
+ if (entry->bound) return -EINVAL;
+ page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
+ if ((retcode = drm_bind_agp(entry->memory, page))) return retcode;
+ entry->bound = dev->agp->base + (page << PAGE_SHIFT);
+ return 0;
+}
+
+int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_agp_buffer_t request;
+ drm_agp_mem_t *entry;
+
+ if (!dev->agp->acquired) return -EINVAL;
+ copy_from_user_ret(&request, (drm_agp_buffer_t *)arg, sizeof(request),
+ -EFAULT);
+ if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+ return -EINVAL;
+ if (entry->bound) drm_unbind_agp(entry->memory);
+ entry->prev->next = entry->next;
+ entry->next->prev = entry->prev;
+ drm_free_agp(entry->memory, entry->pages);
+ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ return 0;
+}
+
+drm_agp_head_t *drm_agp_init(void)
+{
+ drm_agp_fill_t *fill;
+ drm_agp_head_t *head = NULL;
+ int agp_available = 1;
+
+ for (fill = &drm_agp_fill[0]; fill->name; fill++) {
+ char *n = (char *)fill->name;
+#if 0
+ *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n);
+#endif
+ *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n);
+ printk("%s resolves to 0x%08lx\n", n, (*fill->f).address);
+ if (!(*fill->f).address) agp_available = 0;
+ }
+
+ printk("agp_available = %d\n", agp_available);
+
+ if (agp_available) {
+ if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
+ return NULL;
+ memset((void *)head, 0, sizeof(*head));
+ (*drm_agp.copy_info)(&head->agp_info);
+ head->memory = NULL;
+ switch (head->agp_info.chipset) {
+ case INTEL_GENERIC: head->chipset = "Intel"; break;
+ case INTEL_LX: head->chipset = "Intel 440LX"; break;
+ case INTEL_BX: head->chipset = "Intel 440BX"; break;
+ case INTEL_GX: head->chipset = "Intel 440GX"; break;
+ case INTEL_I810: head->chipset = "Intel i810"; break;
+ case VIA_GENERIC: head->chipset = "VIA"; break;
+ case VIA_VP3: head->chipset = "VIA VP3"; break;
+ case VIA_MVP3: head->chipset = "VIA MVP3"; break;
+ case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; break;
+ case SIS_GENERIC: head->chipset = "SiS"; break;
+ case AMD_GENERIC: head->chipset = "AMD"; break;
+ case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
+ case ALI_GENERIC: head->chipset = "ALi"; break;
+ case ALI_M1541: head->chipset = "ALi M1541"; break;
+ default:
+ }
+ DRM_INFO("AGP %d.%d on %s @ 0x%08lx %dMB\n",
+ head->agp_info.version.major,
+ head->agp_info.version.minor,
+ head->chipset,
+ head->agp_info.aper_base,
+ head->agp_info.aper_size);
+ }
+ return head;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
index 780c4fb69..289868d31 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
@@ -1,6 +1,6 @@
/* bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 12:11:11 1999 by faith@precisioninsight.com
+ * Revised: Mon Feb 14 00:14:11 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.1 1999/09/25 14:37:57 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.4 2000/02/14 06:27:25 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c
new file mode 100644
index 000000000..f67209d44
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c
@@ -0,0 +1,86 @@
+/* ctxbitmap.c -- Context bitmap management -*- linux-c -*-
+ * Created: Thu Jan 6 03:56:42 2000 by jhartmann@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.
+ *
+ * Author: Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c,v 1.1 2000/02/11 17:26:02 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle)
+{
+ if (ctx_handle < 0) goto failed;
+
+ if (ctx_handle < DRM_MAX_CTXBITMAP) {
+ clear_bit(ctx_handle, dev->ctx_bitmap);
+ return;
+ }
+failed:
+ DRM_ERROR("Attempt to free invalid context handle: %d\n",
+ ctx_handle);
+ return;
+}
+
+int drm_ctxbitmap_next(drm_device_t *dev)
+{
+ int bit;
+
+ bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP);
+ if (bit < DRM_MAX_CTXBITMAP) {
+ set_bit(bit, dev->ctx_bitmap);
+ printk("drm_ctxbitmap_next bit : %d\n", bit);
+ return bit;
+ }
+ return -1;
+}
+
+int drm_ctxbitmap_init(drm_device_t *dev)
+{
+ int i;
+ int temp;
+
+ dev->ctx_bitmap = (unsigned long *) drm_alloc(PAGE_SIZE * 4,
+ DRM_MEM_CTXBITMAP);
+ if(dev->ctx_bitmap == NULL) {
+ return -ENOMEM;
+ }
+ memset((void *) dev->ctx_bitmap, 0, PAGE_SIZE * 4);
+ for(i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
+ temp = drm_ctxbitmap_next(dev);
+ printk("drm_ctxbitmap_init : %d\n", temp);
+ }
+
+ return 0;
+}
+
+void drm_ctxbitmap_cleanup(drm_device_t *dev)
+{
+ drm_free((void *)dev->ctx_bitmap, PAGE_SIZE * 4,
+ DRM_MEM_CTXBITMAP);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c
index ea08a859e..2efeba351 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c
@@ -1,6 +1,6 @@
/* dma.c -- DMA IOCTL and function support -*- linux-c -*-
* Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Thu Sep 16 12:55:39 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:19:45 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.7 1999/09/16 16:56:18 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.4 2000/02/14 06:27:26 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
index 320db51eb..7488a315e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
@@ -1,6 +1,6 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com
+ * Revised: Mon Feb 14 00:15:23 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.4 2000/02/14 06:27:26 martin Exp $
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
index 0d5f7b8f0..25c35425a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
@@ -1,6 +1,6 @@
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:06:49 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:34:30 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.1 1999/09/25 14:37:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.5 2000/02/14 06:27:26 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
index 7af8fcc0d..a0aac6752 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
@@ -1,6 +1,6 @@
/* drmstat.c -- DRM device status and testing program
* Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 10:33:46 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:35:00 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c,v 1.28 1999/08/04 18:12:11 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c,v 1.1 1999/09/25 14:37:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c,v 1.5 2000/02/14 06:27:27 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
index 0bdf2135f..ceef1d8ca 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
@@ -25,12 +25,13 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.1 1999/09/25 14:37:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.5 2000/02/14 06:27:27 martin Exp $
*
*/
#define __NO_VERSION__
#include "drmP.h"
+#include <linux/poll.h>
/* drm_open is called whenever a process opens /dev/drm. */
@@ -226,6 +227,7 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
+
poll_wait(filp, &dev->buf_readers, wait);
if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM;
return 0;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c
index 0ae7814cc..4e1e30e15 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.3 2000/01/20 07:25:35 martin Exp $
*
*/
@@ -52,6 +52,7 @@ static struct file_operations gamma_fops = {
mmap: drm_mmap,
read: drm_read,
fasync: drm_fasync,
+ poll: drm_poll,
};
static struct miscdevice gamma_misc = {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c
new file mode 100644
index 000000000..49455b434
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c
@@ -0,0 +1,584 @@
+/* i810_bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
+ * Created: Thu Jan 6 01:47:26 2000 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c,v 1.1 2000/02/11 17:26:04 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "linux/un.h"
+
+int i810_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ drm_buf_entry_t *entry;
+ drm_buf_t *buf;
+ unsigned long offset;
+ unsigned long agp_offset;
+ int count;
+ int order;
+ int size;
+ int alignment;
+ int page_order;
+ int total;
+ int byte_count;
+ int i;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ count = request.count;
+ order = drm_order(request.size);
+ size = 1 << order;
+ agp_offset = request.agp_start;
+ alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size;
+ page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
+ total = PAGE_SIZE << page_order;
+ byte_count = 0;
+
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ if (dev->queue_count) return -EBUSY; /* Not while in use */
+ spin_lock(&dev->count_lock);
+ if (dev->buf_use) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ atomic_inc(&dev->buf_alloc);
+ spin_unlock(&dev->count_lock);
+
+ down(&dev->struct_sem);
+ entry = &dma->bufs[order];
+ if (entry->buf_count) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM; /* May only call once for each order */
+ }
+
+ entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ if (!entry->buflist) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+ entry->buf_size = size;
+ entry->page_order = page_order;
+
+ while(entry->buf_count < count) {
+ for(offset = 0; offset + size <= total && entry->buf_count < count;
+ offset += alignment, ++entry->buf_count) {
+ buf = &entry->buflist[entry->buf_count];
+ buf->idx = dma->buf_count + entry->buf_count;
+ buf->total = alignment;
+ buf->order = order;
+ buf->used = 0;
+ buf->offset = agp_offset - dev->agp->base + offset;/* ?? */
+ buf->bus_address = agp_offset + offset;
+ buf->address = agp_offset + offset + dev->agp->base;
+ buf->next = NULL;
+ buf->waiting = 0;
+ buf->pending = 0;
+ init_waitqueue_head(&buf->dma_wait);
+ buf->pid = 0;
+#if DRM_DMA_HISTOGRAM
+ buf->time_queued = 0;
+ buf->time_dispatched = 0;
+ buf->time_completed = 0;
+ buf->time_freed = 0;
+#endif
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
+ }
+ byte_count += PAGE_SIZE << page_order;
+ }
+
+ dma->buflist = drm_realloc(dma->buflist,
+ dma->buf_count * sizeof(*dma->buflist),
+ (dma->buf_count + entry->buf_count)
+ * sizeof(*dma->buflist),
+ DRM_MEM_BUFS);
+ for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++)
+ dma->buflist[i] = &entry->buflist[i - dma->buf_count];
+
+ dma->buf_count += entry->buf_count;
+ dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
+
+ drm_freelist_create(&entry->freelist, entry->buf_count);
+ for (i = 0; i < entry->buf_count; i++) {
+ drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]);
+ }
+
+ up(&dev->struct_sem);
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ copy_to_user_ret((drm_buf_desc_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ atomic_dec(&dev->buf_alloc);
+ return 0;
+}
+
+int i810_addbufs_pci(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ int count;
+ int order;
+ int size;
+ int total;
+ int page_order;
+ drm_buf_entry_t *entry;
+ unsigned long page;
+ drm_buf_t *buf;
+ int alignment;
+ unsigned long offset;
+ int i;
+ int byte_count;
+ int page_count;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ count = request.count;
+ order = drm_order(request.size);
+ size = 1 << order;
+
+ DRM_DEBUG("count = %d, size = %d (%d), order = %d, queue_count = %d\n",
+ request.count, request.size, size, order, dev->queue_count);
+
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ if (dev->queue_count) return -EBUSY; /* Not while in use */
+
+ alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size;
+ page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
+ total = PAGE_SIZE << page_order;
+
+ spin_lock(&dev->count_lock);
+ if (dev->buf_use) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ atomic_inc(&dev->buf_alloc);
+ spin_unlock(&dev->count_lock);
+
+ down(&dev->struct_sem);
+ entry = &dma->bufs[order];
+ if (entry->buf_count) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM; /* May only call once for each order */
+ }
+
+ entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ if (!entry->buflist) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+ entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
+ DRM_MEM_SEGS);
+ if (!entry->seglist) {
+ drm_free(entry->buflist,
+ count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->seglist, 0, count * sizeof(*entry->seglist));
+
+ dma->pagelist = drm_realloc(dma->pagelist,
+ dma->page_count * sizeof(*dma->pagelist),
+ (dma->page_count + (count << page_order))
+ * sizeof(*dma->pagelist),
+ DRM_MEM_PAGES);
+ DRM_DEBUG("pagelist: %d entries\n",
+ dma->page_count + (count << page_order));
+
+
+ entry->buf_size = size;
+ entry->page_order = page_order;
+ byte_count = 0;
+ page_count = 0;
+ while (entry->buf_count < count) {
+ if (!(page = drm_alloc_pages(page_order, DRM_MEM_DMA))) break;
+ entry->seglist[entry->seg_count++] = page;
+ for (i = 0; i < (1 << page_order); i++) {
+ DRM_DEBUG("page %d @ 0x%08lx\n",
+ dma->page_count + page_count,
+ page + PAGE_SIZE * i);
+ dma->pagelist[dma->page_count + page_count++]
+ = page + PAGE_SIZE * i;
+ }
+ for (offset = 0;
+ offset + size <= total && entry->buf_count < count;
+ offset += alignment, ++entry->buf_count) {
+ buf = &entry->buflist[entry->buf_count];
+ buf->idx = dma->buf_count + entry->buf_count;
+ buf->total = alignment;
+ buf->order = order;
+ buf->used = 0;
+ buf->offset = (dma->byte_count + byte_count + offset);
+ buf->address = (void *)(page + offset);
+ buf->next = NULL;
+ buf->waiting = 0;
+ buf->pending = 0;
+ init_waitqueue_head(&buf->dma_wait);
+ buf->pid = 0;
+#if DRM_DMA_HISTOGRAM
+ buf->time_queued = 0;
+ buf->time_dispatched = 0;
+ buf->time_completed = 0;
+ buf->time_freed = 0;
+#endif
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
+ }
+ byte_count += PAGE_SIZE << page_order;
+ }
+
+ dma->buflist = drm_realloc(dma->buflist,
+ dma->buf_count * sizeof(*dma->buflist),
+ (dma->buf_count + entry->buf_count)
+ * sizeof(*dma->buflist),
+ DRM_MEM_BUFS);
+ for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++)
+ dma->buflist[i] = &entry->buflist[i - dma->buf_count];
+
+ dma->buf_count += entry->buf_count;
+ dma->seg_count += entry->seg_count;
+ dma->page_count += entry->seg_count << page_order;
+ dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
+
+ drm_freelist_create(&entry->freelist, entry->buf_count);
+ for (i = 0; i < entry->buf_count; i++) {
+ drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]);
+ }
+
+ up(&dev->struct_sem);
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ copy_to_user_ret((drm_buf_desc_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ atomic_dec(&dev->buf_alloc);
+ return 0;
+}
+
+int i810_addbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_buf_desc_t request;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ if(request.flags & _DRM_AGP_BUFFER)
+ return i810_addbufs_agp(inode, filp, cmd, arg);
+ else
+ return i810_addbufs_pci(inode, filp, cmd, arg);
+}
+
+int i810_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_info_t request;
+ int i;
+ int count;
+
+ if (!dma) return -EINVAL;
+
+ spin_lock(&dev->count_lock);
+ if (atomic_read(&dev->buf_alloc)) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ ++dev->buf_use; /* Can't allocate more after this call */
+ spin_unlock(&dev->count_lock);
+
+ copy_from_user_ret(&request,
+ (drm_buf_info_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
+ if (dma->bufs[i].buf_count) ++count;
+ }
+
+ DRM_DEBUG("count = %d\n", count);
+
+ if (request.count >= count) {
+ for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
+ if (dma->bufs[i].buf_count) {
+ copy_to_user_ret(&request.list[count].count,
+ &dma->bufs[i].buf_count,
+ sizeof(dma->bufs[0]
+ .buf_count),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count].size,
+ &dma->bufs[i].buf_size,
+ sizeof(dma->bufs[0].buf_size),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count].low_mark,
+ &dma->bufs[i]
+ .freelist.low_mark,
+ sizeof(dma->bufs[0]
+ .freelist.low_mark),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count]
+ .high_mark,
+ &dma->bufs[i]
+ .freelist.high_mark,
+ sizeof(dma->bufs[0]
+ .freelist.high_mark),
+ -EFAULT);
+ DRM_DEBUG("%d %d %d %d %d\n",
+ i,
+ dma->bufs[i].buf_count,
+ dma->bufs[i].buf_size,
+ dma->bufs[i].freelist.low_mark,
+ dma->bufs[i].freelist.high_mark);
+ ++count;
+ }
+ }
+ }
+ request.count = count;
+
+ copy_to_user_ret((drm_buf_info_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ return 0;
+}
+
+int i810_markbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ int order;
+ drm_buf_entry_t *entry;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("%d, %d, %d\n",
+ request.size, request.low_mark, request.high_mark);
+ order = drm_order(request.size);
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ entry = &dma->bufs[order];
+
+ if (request.low_mark < 0 || request.low_mark > entry->buf_count)
+ return -EINVAL;
+ if (request.high_mark < 0 || request.high_mark > entry->buf_count)
+ return -EINVAL;
+
+ entry->freelist.low_mark = request.low_mark;
+ entry->freelist.high_mark = request.high_mark;
+
+ return 0;
+}
+
+int i810_freebufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_free_t request;
+ int i;
+ int idx;
+ drm_buf_t *buf;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_free_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("%d\n", request.count);
+ for (i = 0; i < request.count; i++) {
+ copy_from_user_ret(&idx,
+ &request.list[i],
+ sizeof(idx),
+ -EFAULT);
+ if (idx < 0 || idx >= dma->buf_count) {
+ DRM_ERROR("Index %d (of %d max)\n",
+ idx, dma->buf_count - 1);
+ return -EINVAL;
+ }
+ buf = dma->buflist[idx];
+ if (buf->pid != current->pid) {
+ DRM_ERROR("Process %d freeing buffer owned by %d\n",
+ current->pid, buf->pid);
+ return -EINVAL;
+ }
+ drm_free_buffer(dev, buf);
+ }
+
+ return 0;
+}
+
+int i810_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ int retcode = 0;
+ const int zero = 0;
+ unsigned long virtual;
+ unsigned long address;
+ drm_buf_map_t request;
+ int i;
+
+ if (!dma) return -EINVAL;
+
+ DRM_DEBUG("\n");
+
+ spin_lock(&dev->count_lock);
+ if (atomic_read(&dev->buf_alloc)) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ ++dev->buf_use; /* Can't allocate more after this call */
+ spin_unlock(&dev->count_lock);
+
+ copy_from_user_ret(&request,
+ (drm_buf_map_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ if (request.count >= dma->buf_count) {
+ if(dma->flags & _DRM_DMA_USE_AGP) {
+ /* This is an ugly vicious hack */
+ drm_map_t *map = NULL;
+ for(i = 0; i < dev->map_count; i++) {
+ map = dev->maplist[i];
+ if(map->type == _DRM_AGP) break;
+ }
+ if (i >= dev->map_count || !map) {
+ retcode = -EINVAL;
+ goto done;
+ }
+
+ virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE,
+ MAP_SHARED, (unsigned long)map->handle);
+ }
+ else {
+ virtual = do_mmap(filp, 0, dma->byte_count,
+ PROT_READ|PROT_WRITE, MAP_SHARED, 0);
+ }
+ if (virtual > -1024UL) {
+ /* Real error */
+ retcode = (signed long)virtual;
+ goto done;
+ }
+ request.virtual = (void *)virtual;
+
+ for (i = 0; i < dma->buf_count; i++) {
+ if (copy_to_user(&request.list[i].idx,
+ &dma->buflist[i]->idx,
+ sizeof(request.list[0].idx))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ if (copy_to_user(&request.list[i].total,
+ &dma->buflist[i]->total,
+ sizeof(request.list[0].total))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ if (copy_to_user(&request.list[i].used,
+ &zero,
+ sizeof(zero))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ address = virtual + dma->buflist[i]->offset;
+ if (copy_to_user(&request.list[i].address,
+ &address,
+ sizeof(address))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ }
+ }
+done:
+ request.count = dma->buf_count;
+ DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode);
+
+ copy_to_user_ret((drm_buf_map_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ return retcode;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c
new file mode 100644
index 000000000..09959b657
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c
@@ -0,0 +1,762 @@
+/* i810_dma.c -- DMA support for the i810 -*- linux-c -*-
+ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c,v 1.1 2000/02/11 17:26:04 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "i810_drv.h"
+
+#include <linux/interrupt.h> /* For task queue support */
+
+#define I810_REG(reg) 2
+#define I810_BASE(reg) ((unsigned long) \
+ dev->maplist[I810_REG(reg)]->handle)
+#define I810_ADDR(reg) (I810_BASE(reg) + reg)
+#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg)
+#define I810_READ(reg) I810_DEREF(reg)
+#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0)
+
+void i810_dma_init(drm_device_t *dev)
+{
+ printk(KERN_INFO "i810_dma_init\n");
+}
+
+void i810_dma_cleanup(drm_device_t *dev)
+{
+ printk(KERN_INFO "i810_dma_cleanup\n");
+}
+
+static inline void i810_dma_dispatch(drm_device_t *dev, unsigned long address,
+ unsigned long length)
+{
+ printk(KERN_INFO "i810_dma_dispatch\n");
+}
+
+static inline void i810_dma_quiescent(drm_device_t *dev)
+{
+}
+
+static inline void i810_dma_ready(drm_device_t *dev)
+{
+ i810_dma_quiescent(dev);
+ printk(KERN_INFO "i810_dma_ready\n");
+}
+
+static inline int i810_dma_is_ready(drm_device_t *dev)
+{
+
+ i810_dma_quiescent(dev);
+
+ printk(KERN_INFO "i810_dma_is_ready\n");
+ return 1;
+}
+
+
+static void i810_dma_service(int irq, void *device, struct pt_regs *regs)
+{
+ drm_device_t *dev = (drm_device_t *)device;
+ drm_device_dma_t *dma = dev->dma;
+
+ atomic_inc(&dev->total_irq);
+ if (i810_dma_is_ready(dev)) {
+ /* Free previous buffer */
+ if (test_and_set_bit(0, &dev->dma_flag)) {
+ atomic_inc(&dma->total_missed_free);
+ return;
+ }
+ if (dma->this_buffer) {
+ drm_free_buffer(dev, dma->this_buffer);
+ dma->this_buffer = NULL;
+ }
+ clear_bit(0, &dev->dma_flag);
+
+ /* Dispatch new buffer */
+ queue_task(&dev->tq, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+ }
+}
+
+/* Only called by i810_dma_schedule. */
+static int i810_do_dma(drm_device_t *dev, int locked)
+{
+ unsigned long address;
+ unsigned long length;
+ drm_buf_t *buf;
+ int retcode = 0;
+ drm_device_dma_t *dma = dev->dma;
+#if DRM_DMA_HISTOGRAM
+ cycles_t dma_start, dma_stop;
+#endif
+
+ if (test_and_set_bit(0, &dev->dma_flag)) {
+ atomic_inc(&dma->total_missed_dma);
+ return -EBUSY;
+ }
+
+#if DRM_DMA_HISTOGRAM
+ dma_start = get_cycles();
+#endif
+
+ if (!dma->next_buffer) {
+ DRM_ERROR("No next_buffer\n");
+ clear_bit(0, &dev->dma_flag);
+ return -EINVAL;
+ }
+
+ buf = dma->next_buffer;
+ address = (unsigned long)buf->bus_address;
+ length = buf->used;
+
+
+ DRM_DEBUG("context %d, buffer %d (%ld bytes)\n",
+ buf->context, buf->idx, length);
+
+ if (buf->list == DRM_LIST_RECLAIM) {
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ clear_bit(0, &dev->dma_flag);
+ return -EINVAL;
+ }
+
+ if (!length) {
+ DRM_ERROR("0 length buffer\n");
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ clear_bit(0, &dev->dma_flag);
+ return 0;
+ }
+
+ if (!i810_dma_is_ready(dev)) {
+ clear_bit(0, &dev->dma_flag);
+ return -EBUSY;
+ }
+
+ if (buf->while_locked) {
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ DRM_ERROR("Dispatching buffer %d from pid %d"
+ " \"while locked\", but no lock held\n",
+ buf->idx, buf->pid);
+ }
+ } else {
+ if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ atomic_inc(&dma->total_missed_lock);
+ clear_bit(0, &dev->dma_flag);
+ return -EBUSY;
+ }
+ }
+
+ if (dev->last_context != buf->context
+ && !(dev->queuelist[buf->context]->flags
+ & _DRM_CONTEXT_PRESERVED)) {
+ /* PRE: dev->last_context != buf->context */
+ if (drm_context_switch(dev, dev->last_context, buf->context)) {
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ }
+ retcode = -EBUSY;
+ goto cleanup;
+
+ /* POST: we will wait for the context
+ switch and will dispatch on a later call
+ when dev->last_context == buf->context.
+ NOTE WE HOLD THE LOCK THROUGHOUT THIS
+ TIME! */
+ }
+
+ drm_clear_next_buffer(dev);
+ buf->pending = 1;
+ buf->waiting = 0;
+ buf->list = DRM_LIST_PEND;
+#if DRM_DMA_HISTOGRAM
+ buf->time_dispatched = get_cycles();
+#endif
+
+ i810_dma_dispatch(dev, address, length);
+ drm_free_buffer(dev, dma->this_buffer);
+ dma->this_buffer = buf;
+
+ atomic_add(length, &dma->total_bytes);
+ atomic_inc(&dma->total_dmas);
+
+ if (!buf->while_locked && !dev->context_flag && !locked) {
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+ }
+cleanup:
+
+ clear_bit(0, &dev->dma_flag);
+
+#if DRM_DMA_HISTOGRAM
+ dma_stop = get_cycles();
+ atomic_inc(&dev->histo.dma[drm_histogram_slot(dma_stop - dma_start)]);
+#endif
+
+ return retcode;
+}
+
+static void i810_dma_schedule_timer_wrapper(unsigned long dev)
+{
+ i810_dma_schedule((drm_device_t *)dev, 0);
+}
+
+static void i810_dma_schedule_tq_wrapper(void *dev)
+{
+ i810_dma_schedule(dev, 0);
+}
+
+int i810_dma_schedule(drm_device_t *dev, int locked)
+{
+ int next;
+ drm_queue_t *q;
+ drm_buf_t *buf;
+ int retcode = 0;
+ int processed = 0;
+ int missed;
+ int expire = 20;
+ drm_device_dma_t *dma = dev->dma;
+#if DRM_DMA_HISTOGRAM
+ cycles_t schedule_start;
+#endif
+
+ if (test_and_set_bit(0, &dev->interrupt_flag)) {
+ /* Not reentrant */
+ atomic_inc(&dma->total_missed_sched);
+ return -EBUSY;
+ }
+ missed = atomic_read(&dma->total_missed_sched);
+
+#if DRM_DMA_HISTOGRAM
+ schedule_start = get_cycles();
+#endif
+
+again:
+ if (dev->context_flag) {
+ clear_bit(0, &dev->interrupt_flag);
+ return -EBUSY;
+ }
+ if (dma->next_buffer) {
+ /* Unsent buffer that was previously
+ selected, but that couldn't be sent
+ because the lock could not be obtained
+ or the DMA engine wasn't ready. Try
+ again. */
+ atomic_inc(&dma->total_tried);
+ if (!(retcode = i810_do_dma(dev, locked))) {
+ atomic_inc(&dma->total_hit);
+ ++processed;
+ }
+ } else {
+ do {
+ next = drm_select_queue(dev,
+ i810_dma_schedule_timer_wrapper);
+ if (next >= 0) {
+ q = dev->queuelist[next];
+ buf = drm_waitlist_get(&q->waitlist);
+ dma->next_buffer = buf;
+ dma->next_queue = q;
+ if (buf && buf->list == DRM_LIST_RECLAIM) {
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ }
+ }
+ } while (next >= 0 && !dma->next_buffer);
+ if (dma->next_buffer) {
+ if (!(retcode = i810_do_dma(dev, locked))) {
+ ++processed;
+ }
+ }
+ }
+
+ if (--expire) {
+ if (missed != atomic_read(&dma->total_missed_sched)) {
+ atomic_inc(&dma->total_lost);
+ if (i810_dma_is_ready(dev)) goto again;
+ }
+ if (processed && i810_dma_is_ready(dev)) {
+ atomic_inc(&dma->total_lost);
+ processed = 0;
+ goto again;
+ }
+ }
+
+ clear_bit(0, &dev->interrupt_flag);
+
+#if DRM_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.schedule[drm_histogram_slot(get_cycles()
+ - schedule_start)]);
+#endif
+ return retcode;
+}
+
+static int i810_dma_priority(drm_device_t *dev, drm_dma_t *d)
+{
+ unsigned long address;
+ unsigned long length;
+ int must_free = 0;
+ int retcode = 0;
+ int i;
+ int idx;
+ drm_buf_t *buf;
+ drm_buf_t *last_buf = NULL;
+ drm_device_dma_t *dma = dev->dma;
+ DECLARE_WAITQUEUE(entry, current);
+
+ /* Turn off interrupt handling */
+ while (test_and_set_bit(0, &dev->interrupt_flag)) {
+ schedule();
+ if (signal_pending(current)) return -EINTR;
+ }
+ if (!(d->flags & _DRM_DMA_WHILE_LOCKED)) {
+ while (!drm_lock_take(&dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ schedule();
+ if (signal_pending(current)) {
+ clear_bit(0, &dev->interrupt_flag);
+ return -EINTR;
+ }
+ }
+ ++must_free;
+ }
+ atomic_inc(&dma->total_prio);
+
+ for (i = 0; i < d->send_count; i++) {
+ idx = d->send_indices[i];
+ if (idx < 0 || idx >= dma->buf_count) {
+ DRM_ERROR("Index %d (of %d max)\n",
+ d->send_indices[i], dma->buf_count - 1);
+ continue;
+ }
+ buf = dma->buflist[ idx ];
+ if (buf->pid != current->pid) {
+ DRM_ERROR("Process %d using buffer owned by %d\n",
+ current->pid, buf->pid);
+ retcode = -EINVAL;
+ goto cleanup;
+ }
+ if (buf->list != DRM_LIST_NONE) {
+ DRM_ERROR("Process %d using %d's buffer on list %d\n",
+ current->pid, buf->pid, buf->list);
+ retcode = -EINVAL;
+ goto cleanup;
+ }
+ /* This isn't a race condition on
+ buf->list, since our concern is the
+ buffer reclaim during the time the
+ process closes the /dev/drm? handle, so
+ it can't also be doing DMA. */
+ buf->list = DRM_LIST_PRIO;
+ buf->used = d->send_sizes[i];
+ buf->context = d->context;
+ buf->while_locked = d->flags & _DRM_DMA_WHILE_LOCKED;
+ address = (unsigned long)buf->address;
+ length = buf->used;
+ if (!length) {
+ DRM_ERROR("0 length buffer\n");
+ }
+ if (buf->pending) {
+ DRM_ERROR("Sending pending buffer:"
+ " buffer %d, offset %d\n",
+ d->send_indices[i], i);
+ retcode = -EINVAL;
+ goto cleanup;
+ }
+ if (buf->waiting) {
+ DRM_ERROR("Sending waiting buffer:"
+ " buffer %d, offset %d\n",
+ d->send_indices[i], i);
+ retcode = -EINVAL;
+ goto cleanup;
+ }
+ buf->pending = 1;
+
+ if (dev->last_context != buf->context
+ && !(dev->queuelist[buf->context]->flags
+ & _DRM_CONTEXT_PRESERVED)) {
+ add_wait_queue(&dev->context_wait, &entry);
+ current->state = TASK_INTERRUPTIBLE;
+ /* PRE: dev->last_context != buf->context */
+ drm_context_switch(dev, dev->last_context,
+ buf->context);
+ /* POST: we will wait for the context
+ switch and will dispatch on a later call
+ when dev->last_context == buf->context.
+ NOTE WE HOLD THE LOCK THROUGHOUT THIS
+ TIME! */
+ schedule();
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&dev->context_wait, &entry);
+ if (signal_pending(current)) {
+ retcode = -EINTR;
+ goto cleanup;
+ }
+ if (dev->last_context != buf->context) {
+ DRM_ERROR("Context mismatch: %d %d\n",
+ dev->last_context,
+ buf->context);
+ }
+ }
+
+#if DRM_DMA_HISTOGRAM
+ buf->time_queued = get_cycles();
+ buf->time_dispatched = buf->time_queued;
+#endif
+ i810_dma_dispatch(dev, address, length);
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+
+ atomic_add(length, &dma->total_bytes);
+ atomic_inc(&dma->total_dmas);
+
+ if (last_buf) {
+ drm_free_buffer(dev, last_buf);
+ }
+ last_buf = buf;
+ }
+
+
+cleanup:
+ if (last_buf) {
+ i810_dma_ready(dev);
+ drm_free_buffer(dev, last_buf);
+ }
+
+ if (must_free && !dev->context_flag) {
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+ }
+ clear_bit(0, &dev->interrupt_flag);
+ return retcode;
+}
+
+static int i810_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
+{
+ DECLARE_WAITQUEUE(entry, current);
+ drm_buf_t *last_buf = NULL;
+ int retcode = 0;
+ drm_device_dma_t *dma = dev->dma;
+
+ if (d->flags & _DRM_DMA_BLOCK) {
+ last_buf = dma->buflist[d->send_indices[d->send_count-1]];
+ add_wait_queue(&last_buf->dma_wait, &entry);
+ }
+
+ if ((retcode = drm_dma_enqueue(dev, d))) {
+ if (d->flags & _DRM_DMA_BLOCK)
+ remove_wait_queue(&last_buf->dma_wait, &entry);
+ return retcode;
+ }
+
+ i810_dma_schedule(dev, 0);
+
+ if (d->flags & _DRM_DMA_BLOCK) {
+ DRM_DEBUG("%d waiting\n", current->pid);
+ current->state = TASK_INTERRUPTIBLE;
+ for (;;) {
+ if (!last_buf->waiting
+ && !last_buf->pending)
+ break; /* finished */
+ schedule();
+ if (signal_pending(current)) {
+ retcode = -EINTR; /* Can't restart */
+ break;
+ }
+ }
+ current->state = TASK_RUNNING;
+ DRM_DEBUG("%d running\n", current->pid);
+ remove_wait_queue(&last_buf->dma_wait, &entry);
+ if (!retcode
+ || (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) {
+ if (!waitqueue_active(&last_buf->dma_wait)) {
+ drm_free_buffer(dev, last_buf);
+ }
+ }
+ if (retcode) {
+ DRM_ERROR("ctx%d w%d p%d c%d i%d l%d %d/%d\n",
+ d->context,
+ last_buf->waiting,
+ last_buf->pending,
+ DRM_WAITCOUNT(dev, d->context),
+ last_buf->idx,
+ last_buf->list,
+ last_buf->pid,
+ current->pid);
+ }
+ }
+ return retcode;
+}
+
+int i810_dma(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ int retcode = 0;
+ drm_dma_t d;
+
+ printk("i810_dma start\n");
+ copy_from_user_ret(&d, (drm_dma_t *)arg, sizeof(d), -EFAULT);
+ DRM_DEBUG("%d %d: %d send, %d req\n",
+ current->pid, d.context, d.send_count, d.request_count);
+
+ if (d.context == DRM_KERNEL_CONTEXT || d.context >= dev->queue_slots) {
+ DRM_ERROR("Process %d using context %d\n",
+ current->pid, d.context);
+ return -EINVAL;
+ }
+
+ if (d.send_count < 0 || d.send_count > dma->buf_count) {
+ DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n",
+ current->pid, d.send_count, dma->buf_count);
+ return -EINVAL;
+ }
+ if (d.request_count < 0 || d.request_count > dma->buf_count) {
+ DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
+ current->pid, d.request_count, dma->buf_count);
+ return -EINVAL;
+ }
+
+ if (d.send_count) {
+#if 0
+ if (d.flags & _DRM_DMA_PRIORITY)
+ retcode = i810_dma_priority(dev, &d);
+ else
+ retcode = i810_dma_send_buffers(dev, &d);
+#endif
+ printk("i810_dma priority\n");
+
+ retcode = i810_dma_priority(dev, &d);
+ }
+
+ d.granted_count = 0;
+
+ if (!retcode && d.request_count) {
+ retcode = drm_dma_get_buffers(dev, &d);
+ }
+
+ DRM_DEBUG("%d returning, granted = %d\n",
+ current->pid, d.granted_count);
+ copy_to_user_ret((drm_dma_t *)arg, &d, sizeof(d), -EFAULT);
+
+ printk("i810_dma end (granted)\n");
+ return retcode;
+}
+
+int i810_irq_install(drm_device_t *dev, int irq)
+{
+ int retcode;
+
+ if (!irq) return -EINVAL;
+
+ down(&dev->struct_sem);
+ if (dev->irq) {
+ up(&dev->struct_sem);
+ return -EBUSY;
+ }
+ dev->irq = irq;
+ up(&dev->struct_sem);
+
+ DRM_DEBUG("%d\n", irq);
+
+ dev->context_flag = 0;
+ dev->interrupt_flag = 0;
+ dev->dma_flag = 0;
+
+ dev->dma->next_buffer = NULL;
+ dev->dma->next_queue = NULL;
+ dev->dma->this_buffer = NULL;
+
+ dev->tq.next = NULL;
+ dev->tq.sync = 0;
+ dev->tq.routine = i810_dma_schedule_tq_wrapper;
+ dev->tq.data = dev;
+
+
+ /* Before installing handler */
+ /* TODO */
+ /* Install handler */
+ if ((retcode = request_irq(dev->irq,
+ i810_dma_service,
+ 0,
+ dev->devname,
+ dev))) {
+ down(&dev->struct_sem);
+ dev->irq = 0;
+ up(&dev->struct_sem);
+ return retcode;
+ }
+
+ /* After installing handler */
+ /* TODO */
+ return 0;
+}
+
+int i810_irq_uninstall(drm_device_t *dev)
+{
+ int irq;
+
+ down(&dev->struct_sem);
+ irq = dev->irq;
+ dev->irq = 0;
+ up(&dev->struct_sem);
+
+ if (!irq) return -EINVAL;
+
+ DRM_DEBUG("%d\n", irq);
+
+ /* TODO : Disable interrupts */
+ free_irq(irq, dev);
+
+ return 0;
+}
+
+
+int i810_control(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_control_t ctl;
+ int retcode;
+
+ printk(KERN_INFO "i810_control\n");
+ i810_dma_init(dev);
+
+ copy_from_user_ret(&ctl, (drm_control_t *)arg, sizeof(ctl), -EFAULT);
+
+ switch (ctl.func) {
+ case DRM_INST_HANDLER:
+ if ((retcode = i810_irq_install(dev, ctl.irq)))
+ return retcode;
+ break;
+ case DRM_UNINST_HANDLER:
+ if ((retcode = i810_irq_uninstall(dev)))
+ return retcode;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ DECLARE_WAITQUEUE(entry, current);
+ int ret = 0;
+ drm_lock_t lock;
+ drm_queue_t *q;
+#if DRM_DMA_HISTOGRAM
+ cycles_t start;
+
+ dev->lck_start = start = get_cycles();
+#endif
+
+ copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+
+ if (lock.context == DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Process %d using kernel context %d\n",
+ current->pid, lock.context);
+ return -EINVAL;
+ }
+
+ if (lock.context < 0 || lock.context >= dev->queue_count) {
+ return -EINVAL;
+ }
+ q = dev->queuelist[lock.context];
+
+ ret = drm_flush_block_and_flush(dev, lock.context, lock.flags);
+
+ if (!ret) {
+ if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
+ != lock.context) {
+ long j = jiffies - dev->lock.lock_time;
+
+ if (j > 0 && j <= DRM_LOCK_SLICE) {
+ /* Can't take lock if we just had it and
+ there is contention. */
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout(j);
+ }
+ }
+ add_wait_queue(&dev->lock.lock_queue, &entry);
+ for (;;) {
+ if (!dev->lock.hw_lock) {
+ /* Device has been unregistered */
+ ret = -EINTR;
+ break;
+ }
+ if (drm_lock_take(&dev->lock.hw_lock->lock,
+ lock.context)) {
+ dev->lock.pid = current->pid;
+ dev->lock.lock_time = jiffies;
+ atomic_inc(&dev->total_locks);
+ atomic_inc(&q->total_locks);
+ break; /* Got lock */
+ }
+
+ /* Contention */
+ atomic_inc(&dev->total_sleeps);
+ current->state = TASK_INTERRUPTIBLE;
+ schedule();
+ if (signal_pending(current)) {
+ ret = -ERESTARTSYS;
+ break;
+ }
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&dev->lock.lock_queue, &entry);
+ }
+
+ drm_flush_unblock(dev, lock.context, lock.flags); /* cleanup phase */
+
+ if (!ret) {
+ if (lock.flags & _DRM_LOCK_READY)
+ i810_dma_ready(dev);
+ if (lock.flags & _DRM_LOCK_QUIESCENT)
+ i810_dma_quiescent(dev);
+ }
+
+#if DRM_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
+#endif
+
+ return ret;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c
new file mode 100644
index 000000000..f33153a36
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c
@@ -0,0 +1,583 @@
+/* i810_drv.c -- I810 driver -*- linux-c -*-
+ * Created: Mon Dec 13 01:56:22 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c,v 1.1 2000/02/11 17:26:05 dawes Exp $
+ *
+ */
+
+#define EXPORT_SYMTAB
+#include "drmP.h"
+#include "i810_drv.h"
+EXPORT_SYMBOL(i810_init);
+EXPORT_SYMBOL(i810_cleanup);
+
+#define I810_NAME "i810"
+#define I810_DESC "Matrox g200/g400"
+#define I810_DATE "19991213"
+#define I810_MAJOR 0
+#define I810_MINOR 0
+#define I810_PATCHLEVEL 1
+
+static drm_device_t i810_device;
+drm_ctx_t i810_res_ctx;
+
+static struct file_operations i810_fops = {
+ open: i810_open,
+ flush: drm_flush,
+ release: i810_release,
+ ioctl: i810_ioctl,
+ mmap: drm_mmap,
+ read: drm_read,
+ fasync: drm_fasync,
+};
+
+static struct miscdevice i810_misc = {
+ minor: MISC_DYNAMIC_MINOR,
+ name: I810_NAME,
+ fops: &i810_fops,
+};
+
+static drm_ioctl_desc_t i810_ioctls[] = {
+ [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { i810_version, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { i810_control, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { i810_addbufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { i810_markbufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { i810_infobufs, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { i810_mapbufs, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { i810_freebufs, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { drm_getctx, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { drm_switchctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { drm_newctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { drm_resctx, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { i810_dma, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { i810_lock, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { i810_unlock, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 },
+};
+
+#define I810_IOCTL_COUNT DRM_ARRAY_SIZE(i810_ioctls)
+
+#ifdef MODULE
+int init_module(void);
+void cleanup_module(void);
+static char *i810 = NULL;
+
+MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas.");
+MODULE_DESCRIPTION("Intel I810");
+MODULE_PARM(i810, "s");
+
+/* init_module is called when insmod is used to load the module */
+
+int init_module(void)
+{
+ printk("doing i810_init()\n");
+ return i810_init();
+}
+
+/* cleanup_module is called when rmmod is used to unload the module */
+
+void cleanup_module(void)
+{
+ i810_cleanup();
+}
+#endif
+
+#ifndef MODULE
+/* i810_setup is called by the kernel to parse command-line options passed
+ * via the boot-loader (e.g., LILO). It calls the insmod option routine,
+ * drm_parse_drm.
+ *
+ * This is not currently supported, since it requires changes to
+ * linux/init/main.c. */
+
+
+void __init i810_setup(char *str, int *ints)
+{
+ if (ints[0] != 0) {
+ DRM_ERROR("Illegal command line format, ignored\n");
+ return;
+ }
+ drm_parse_options(str);
+}
+#endif
+
+static int i810_setup(drm_device_t *dev)
+{
+ int i;
+
+ atomic_set(&dev->ioctl_count, 0);
+ atomic_set(&dev->vma_count, 0);
+ dev->buf_use = 0;
+ atomic_set(&dev->buf_alloc, 0);
+
+ drm_dma_setup(dev);
+
+ atomic_set(&dev->total_open, 0);
+ atomic_set(&dev->total_close, 0);
+ atomic_set(&dev->total_ioctl, 0);
+ atomic_set(&dev->total_irq, 0);
+ atomic_set(&dev->total_ctx, 0);
+ atomic_set(&dev->total_locks, 0);
+ atomic_set(&dev->total_unlocks, 0);
+ atomic_set(&dev->total_contends, 0);
+ atomic_set(&dev->total_sleeps, 0);
+
+ for (i = 0; i < DRM_HASH_SIZE; i++) {
+ dev->magiclist[i].head = NULL;
+ dev->magiclist[i].tail = NULL;
+ }
+ dev->maplist = NULL;
+ dev->map_count = 0;
+ dev->vmalist = NULL;
+ dev->lock.hw_lock = NULL;
+ init_waitqueue_head(&dev->lock.lock_queue);
+ dev->queue_count = 0;
+ dev->queue_reserved = 0;
+ dev->queue_slots = 0;
+ dev->queuelist = NULL;
+ dev->irq = 0;
+ dev->context_flag = 0;
+ dev->interrupt_flag = 0;
+ dev->dma_flag = 0;
+ dev->last_context = 0;
+ dev->last_switch = 0;
+ dev->last_checked = 0;
+ init_timer(&dev->timer);
+ init_waitqueue_head(&dev->context_wait);
+#if DRM_DMA_HISTO
+ memset(&dev->histo, 0, sizeof(dev->histo));
+#endif
+ dev->ctx_start = 0;
+ dev->lck_start = 0;
+
+ dev->buf_rp = dev->buf;
+ dev->buf_wp = dev->buf;
+ dev->buf_end = dev->buf + DRM_BSZ;
+ dev->buf_async = NULL;
+ init_waitqueue_head(&dev->buf_readers);
+ init_waitqueue_head(&dev->buf_writers);
+
+ DRM_DEBUG("\n");
+
+ /* The kernel's context could be created here, but is now created
+ in drm_dma_enqueue. This is more resource-efficient for
+ hardware that does not do DMA, but may mean that
+ drm_select_queue fails between the time the interrupt is
+ initialized and the time the queues are initialized. */
+
+ return 0;
+}
+
+
+static int i810_takedown(drm_device_t *dev)
+{
+ int i;
+ drm_magic_entry_t *pt, *next;
+ drm_map_t *map;
+ drm_vma_entry_t *vma, *vma_next;
+
+ DRM_DEBUG("\n");
+
+ if (dev->irq) i810_irq_uninstall(dev);
+
+ down(&dev->struct_sem);
+ del_timer(&dev->timer);
+
+ if (dev->devname) {
+ drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
+ dev->devname = NULL;
+ }
+
+ if (dev->unique) {
+ drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
+ dev->unique = NULL;
+ dev->unique_len = 0;
+ }
+ /* Clear pid list */
+ for (i = 0; i < DRM_HASH_SIZE; i++) {
+ for (pt = dev->magiclist[i].head; pt; pt = next) {
+ next = pt->next;
+ drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
+ }
+ dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
+ }
+ /* Clear AGP information */
+ if (dev->agp) {
+ drm_agp_mem_t *entry;
+ drm_agp_mem_t *nexte;
+
+ /* Remove AGP resources, but leave dev->agp
+ intact until r128_cleanup is called. */
+ for (entry = dev->agp->memory; entry; entry = nexte) {
+ nexte = entry->next;
+ if (entry->bound) drm_unbind_agp(entry->memory);
+ drm_free_agp(entry->memory, entry->pages);
+ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ }
+ dev->agp->memory = NULL;
+
+ if (dev->agp->acquired && drm_agp.release)
+ (*drm_agp.release)();
+
+ dev->agp->acquired = 0;
+ dev->agp->enabled = 0;
+ }
+ /* Clear vma list (only built for debugging) */
+ if (dev->vmalist) {
+ for (vma = dev->vmalist; vma; vma = vma_next) {
+ vma_next = vma->next;
+ drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
+ }
+ dev->vmalist = NULL;
+ }
+
+ /* Clear map area and mtrr information */
+ if (dev->maplist) {
+ for (i = 0; i < dev->map_count; i++) {
+ map = dev->maplist[i];
+ switch (map->type) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#ifdef CONFIG_MTRR
+ if (map->mtrr >= 0) {
+ int retcode;
+ retcode = mtrr_del(map->mtrr,
+ map->offset,
+ map->size);
+ DRM_DEBUG("mtrr_del = %d\n", retcode);
+ }
+#endif
+ drm_ioremapfree(map->handle, map->size);
+ break;
+ case _DRM_SHM:
+ drm_free_pages((unsigned long)map->handle,
+ drm_order(map->size)
+ - PAGE_SHIFT,
+ DRM_MEM_SAREA);
+ break;
+ case _DRM_AGP:
+ break;
+ }
+ drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+ }
+ drm_free(dev->maplist,
+ dev->map_count * sizeof(*dev->maplist),
+ DRM_MEM_MAPS);
+ dev->maplist = NULL;
+ dev->map_count = 0;
+ }
+
+ if (dev->queuelist) {
+ for (i = 0; i < dev->queue_count; i++) {
+ drm_waitlist_destroy(&dev->queuelist[i]->waitlist);
+ if (dev->queuelist[i]) {
+ drm_free(dev->queuelist[i],
+ sizeof(*dev->queuelist[0]),
+ DRM_MEM_QUEUES);
+ dev->queuelist[i] = NULL;
+ }
+ }
+ drm_free(dev->queuelist,
+ dev->queue_slots * sizeof(*dev->queuelist),
+ DRM_MEM_QUEUES);
+ dev->queuelist = NULL;
+ }
+
+ drm_dma_takedown(dev);
+
+ dev->queue_count = 0;
+ if (dev->lock.hw_lock) {
+ dev->lock.hw_lock = NULL; /* SHM removed */
+ dev->lock.pid = 0;
+ wake_up_interruptible(&dev->lock.lock_queue);
+ }
+ up(&dev->struct_sem);
+
+ return 0;
+}
+
+/* i810_init is called via init_module at module load time, or via
+ * linux/init/main.c (this is not currently supported). */
+
+int i810_init(void)
+{
+ int retcode;
+ drm_device_t *dev = &i810_device;
+
+ DRM_DEBUG("\n");
+
+ memset((void *)dev, 0, sizeof(*dev));
+ dev->count_lock = SPIN_LOCK_UNLOCKED;
+ sema_init(&dev->struct_sem, 1);
+
+#ifdef MODULE
+ drm_parse_options(i810);
+#endif
+ printk("doing misc_register\n");
+ if ((retcode = misc_register(&i810_misc))) {
+ DRM_ERROR("Cannot register \"%s\"\n", I810_NAME);
+ return retcode;
+ }
+ dev->device = MKDEV(MISC_MAJOR, i810_misc.minor);
+ dev->name = I810_NAME;
+
+ printk("doing mem init\n");
+ drm_mem_init();
+ printk("doing proc init\n");
+ drm_proc_init(dev);
+ printk("doing agp init\n");
+ dev->agp = drm_agp_init();
+ printk("doing ctxbitmap init\n");
+ if((retcode = drm_ctxbitmap_init(dev))) {
+ DRM_ERROR("Cannot allocate memory for context bitmap.\n");
+ drm_proc_cleanup();
+ misc_deregister(&i810_misc);
+ i810_takedown(dev);
+ return retcode;
+ }
+#if 0
+ printk("doing i810_dma_init\n");
+ i810_dma_init(dev);
+#endif
+
+ DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+ I810_NAME,
+ I810_MAJOR,
+ I810_MINOR,
+ I810_PATCHLEVEL,
+ I810_DATE,
+ i810_misc.minor);
+
+ return 0;
+}
+
+/* i810_cleanup is called via cleanup_module at module unload time. */
+
+void i810_cleanup(void)
+{
+ drm_device_t *dev = &i810_device;
+
+ DRM_DEBUG("\n");
+
+ drm_proc_cleanup();
+ if (misc_deregister(&i810_misc)) {
+ DRM_ERROR("Cannot unload module\n");
+ } else {
+ DRM_INFO("Module unloaded\n");
+ }
+ drm_ctxbitmap_cleanup(dev);
+ i810_dma_cleanup(dev);
+ i810_takedown(dev);
+ if (dev->agp) {
+ drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
+ dev->agp = NULL;
+ }
+}
+
+int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_version_t version;
+ int len;
+
+ copy_from_user_ret(&version,
+ (drm_version_t *)arg,
+ sizeof(version),
+ -EFAULT);
+
+#define DRM_COPY(name,value) \
+ len = strlen(value); \
+ if (len > name##_len) len = name##_len; \
+ name##_len = strlen(value); \
+ if (len && name) { \
+ copy_to_user_ret(name, value, len, -EFAULT); \
+ }
+
+ version.version_major = I810_MAJOR;
+ version.version_minor = I810_MINOR;
+ version.version_patchlevel = I810_PATCHLEVEL;
+
+ DRM_COPY(version.name, I810_NAME);
+ DRM_COPY(version.date, I810_DATE);
+ DRM_COPY(version.desc, I810_DESC);
+
+ copy_to_user_ret((drm_version_t *)arg,
+ &version,
+ sizeof(version),
+ -EFAULT);
+ return 0;
+}
+
+int i810_open(struct inode *inode, struct file *filp)
+{
+ drm_device_t *dev = &i810_device;
+ int retcode = 0;
+
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
+ if (!(retcode = drm_open_helper(inode, filp, dev))) {
+ MOD_INC_USE_COUNT;
+ atomic_inc(&dev->total_open);
+ spin_lock(&dev->count_lock);
+ if (!dev->open_count++) {
+ spin_unlock(&dev->count_lock);
+ return i810_setup(dev);
+ }
+ spin_unlock(&dev->count_lock);
+ }
+ return retcode;
+}
+
+int i810_release(struct inode *inode, struct file *filp)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode = 0;
+
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
+ if (!(retcode = drm_release(inode, filp))) {
+ MOD_DEC_USE_COUNT;
+ atomic_inc(&dev->total_close);
+ spin_lock(&dev->count_lock);
+ if (!--dev->open_count) {
+ if (atomic_read(&dev->ioctl_count) || dev->blocked) {
+ DRM_ERROR("Device busy: %d %d\n",
+ atomic_read(&dev->ioctl_count),
+ dev->blocked);
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ spin_unlock(&dev->count_lock);
+ return i810_takedown(dev);
+ }
+ spin_unlock(&dev->count_lock);
+ }
+ return retcode;
+}
+
+/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */
+
+int i810_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ int nr = DRM_IOCTL_NR(cmd);
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode = 0;
+ drm_ioctl_desc_t *ioctl;
+ drm_ioctl_t *func;
+
+ atomic_inc(&dev->ioctl_count);
+ atomic_inc(&dev->total_ioctl);
+ ++priv->ioctl_count;
+
+ DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
+ current->pid, cmd, nr, dev->device, priv->authenticated);
+
+ if (nr >= I810_IOCTL_COUNT) {
+ retcode = -EINVAL;
+ } else {
+ ioctl = &i810_ioctls[nr];
+ func = ioctl->func;
+
+ if (!func) {
+ DRM_DEBUG("no function\n");
+ retcode = -EINVAL;
+ } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN))
+ || (ioctl->auth_needed && !priv->authenticated)) {
+ retcode = -EACCES;
+ } else {
+ retcode = (func)(inode, filp, cmd, arg);
+ }
+ }
+
+ atomic_dec(&dev->ioctl_count);
+ return retcode;
+}
+
+int i810_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_lock_t lock;
+
+ copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+
+ if (lock.context == DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Process %d using kernel context %d\n",
+ current->pid, lock.context);
+ return -EINVAL;
+ }
+
+ DRM_DEBUG("%d frees lock (%d holds)\n",
+ lock.context,
+ _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+ atomic_inc(&dev->total_unlocks);
+ if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock))
+ atomic_inc(&dev->total_contends);
+ drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+ i810_dma_schedule(dev, 1);
+ if (!dev->context_flag) {
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+ }
+#if DRM_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles()
+ - dev->lck_start)]);
+#endif
+
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h
new file mode 100644
index 000000000..0f5f42bb6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h
@@ -0,0 +1,76 @@
+/* i810_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*-
+ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h,v 1.1 2000/02/11 17:26:05 dawes Exp $
+ */
+
+#ifndef _I810_DRV_H_
+#define _I810_DRV_H_
+
+ /* i810_drv.c */
+extern int i810_init(void);
+extern void i810_cleanup(void);
+extern int i810_version(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_open(struct inode *inode, struct file *filp);
+extern int i810_release(struct inode *inode, struct file *filp);
+extern int i810_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_unlock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+ /* i810_dma.c */
+extern int i810_dma_schedule(drm_device_t *dev, int locked);
+extern int i810_dma(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_irq_install(drm_device_t *dev, int irq);
+extern int i810_irq_uninstall(drm_device_t *dev);
+extern int i810_control(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_lock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern void i810_dma_init(drm_device_t *dev);
+extern void i810_dma_cleanup(drm_device_t *dev);
+
+
+ /* i810_bufs.c */
+extern int i810_addbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_infobufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_markbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_freebufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_mapbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int i810_addmap(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
index 120817ccc..78d217144 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
@@ -1,6 +1,6 @@
/* lists.c -- Buffer list handling routines -*- linux-c -*-
* Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:37:52 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.4 2000/02/14 06:27:27 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
index e8c1eff10..ae41526f1 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
@@ -1,6 +1,6 @@
/* lock.c -- IOCTLs for locking -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:38:25 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.4 2000/02/14 06:27:27 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
index af8d510b5..4ba911f34 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
@@ -1,6 +1,6 @@
/* memory.c -- Memory management wrappers for DRM -*- linux-c -*-
* Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 10:28:18 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:39:37 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.4 2000/02/14 06:27:28 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c
new file mode 100644
index 000000000..34f1112a6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c
@@ -0,0 +1,636 @@
+/* mga_bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
+ * Created: Thu Jan 6 01:47:26 2000 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c,v 1.1 2000/02/11 17:26:06 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "mga_drv.h"
+#include "mga_dma.h"
+#include "linux/un.h"
+
+
+int mga_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ drm_buf_entry_t *entry;
+ drm_buf_t *buf;
+ unsigned long offset;
+ unsigned long agp_offset;
+ int count;
+ int order;
+ int size;
+ int alignment;
+ int page_order;
+ int total;
+ int byte_count;
+ int i;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ count = request.count;
+ order = drm_order(request.size);
+ size = 1 << order;
+ agp_offset = request.agp_start;
+ alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size;
+ page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
+ total = PAGE_SIZE << page_order;
+ byte_count = 0;
+
+ DRM_DEBUG("count: %d\n", count);
+ DRM_DEBUG("order: %d\n", order);
+ DRM_DEBUG("size: %d\n", size);
+ DRM_DEBUG("agp_offset: %d\n", agp_offset);
+ DRM_DEBUG("alignment: %d\n", alignment);
+ DRM_DEBUG("page_order: %d\n", page_order);
+ DRM_DEBUG("total: %d\n", total);
+ DRM_DEBUG("byte_count: %d\n", byte_count);
+
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ if (dev->queue_count) return -EBUSY; /* Not while in use */
+ spin_lock(&dev->count_lock);
+ if (dev->buf_use) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ atomic_inc(&dev->buf_alloc);
+ spin_unlock(&dev->count_lock);
+
+ down(&dev->struct_sem);
+ entry = &dma->bufs[order];
+ if (entry->buf_count) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM; /* May only call once for each order */
+ }
+
+ entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ if (!entry->buflist) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+ entry->buf_size = size;
+ entry->page_order = page_order;
+ offset = 0;
+
+
+ while(entry->buf_count < count) {
+ buf = &entry->buflist[entry->buf_count];
+ buf->idx = dma->buf_count + entry->buf_count;
+ buf->total = alignment;
+ buf->order = order;
+ buf->used = 0;
+
+ DRM_DEBUG("offset : %d\n", offset);
+
+ buf->offset = offset; /* Hrm */
+ buf->bus_address = dev->agp->base + agp_offset + offset;
+ buf->address = (void *)(agp_offset + offset + dev->agp->base);
+ buf->next = NULL;
+ buf->waiting = 0;
+ buf->pending = 0;
+ init_waitqueue_head(&buf->dma_wait);
+ buf->pid = 0;
+
+ buf->dev_private = drm_alloc(sizeof(drm_mga_buf_priv_t), DRM_MEM_BUFS);
+ buf->dev_priv_size = sizeof(drm_mga_buf_priv_t);
+
+#if DRM_DMA_HISTOGRAM
+ buf->time_queued = 0;
+ buf->time_dispatched = 0;
+ buf->time_completed = 0;
+ buf->time_freed = 0;
+#endif
+ offset = offset + alignment;
+ entry->buf_count++;
+ byte_count += PAGE_SIZE << page_order;
+
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
+ }
+
+ dma->buflist = drm_realloc(dma->buflist,
+ dma->buf_count * sizeof(*dma->buflist),
+ (dma->buf_count + entry->buf_count)
+ * sizeof(*dma->buflist),
+ DRM_MEM_BUFS);
+ for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++)
+ dma->buflist[i] = &entry->buflist[i - dma->buf_count];
+
+ dma->buf_count += entry->buf_count;
+
+ DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+
+ dma->byte_count += byte_count;
+
+ DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+
+ drm_freelist_create(&entry->freelist, entry->buf_count);
+ for (i = 0; i < entry->buf_count; i++) {
+ drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]);
+ }
+
+ up(&dev->struct_sem);
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ copy_to_user_ret((drm_buf_desc_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ atomic_dec(&dev->buf_alloc);
+
+ DRM_DEBUG("count: %d\n", count);
+ DRM_DEBUG("order: %d\n", order);
+ DRM_DEBUG("size: %d\n", size);
+ DRM_DEBUG("agp_offset: %d\n", agp_offset);
+ DRM_DEBUG("alignment: %d\n", alignment);
+ DRM_DEBUG("page_order: %d\n", page_order);
+ DRM_DEBUG("total: %d\n", total);
+ DRM_DEBUG("byte_count: %d\n", byte_count);
+
+ dma->flags = _DRM_DMA_USE_AGP;
+
+ DRM_DEBUG("dma->flags : %lx\n", dma->flags);
+
+ return 0;
+}
+
+int mga_addbufs_pci(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ int count;
+ int order;
+ int size;
+ int total;
+ int page_order;
+ drm_buf_entry_t *entry;
+ unsigned long page;
+ drm_buf_t *buf;
+ int alignment;
+ unsigned long offset;
+ int i;
+ int byte_count;
+ int page_count;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ count = request.count;
+ order = drm_order(request.size);
+ size = 1 << order;
+
+ DRM_DEBUG("count = %d, size = %d (%d), order = %d, queue_count = %d\n",
+ request.count, request.size, size, order, dev->queue_count);
+
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ if (dev->queue_count) return -EBUSY; /* Not while in use */
+
+ alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size;
+ page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
+ total = PAGE_SIZE << page_order;
+
+ spin_lock(&dev->count_lock);
+ if (dev->buf_use) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ atomic_inc(&dev->buf_alloc);
+ spin_unlock(&dev->count_lock);
+
+ down(&dev->struct_sem);
+ entry = &dma->bufs[order];
+ if (entry->buf_count) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM; /* May only call once for each order */
+ }
+
+ entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ if (!entry->buflist) {
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+ entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
+ DRM_MEM_SEGS);
+ if (!entry->seglist) {
+ drm_free(entry->buflist,
+ count * sizeof(*entry->buflist),
+ DRM_MEM_BUFS);
+ up(&dev->struct_sem);
+ atomic_dec(&dev->buf_alloc);
+ return -ENOMEM;
+ }
+ memset(entry->seglist, 0, count * sizeof(*entry->seglist));
+
+ dma->pagelist = drm_realloc(dma->pagelist,
+ dma->page_count * sizeof(*dma->pagelist),
+ (dma->page_count + (count << page_order))
+ * sizeof(*dma->pagelist),
+ DRM_MEM_PAGES);
+ DRM_DEBUG("pagelist: %d entries\n",
+ dma->page_count + (count << page_order));
+
+
+ entry->buf_size = size;
+ entry->page_order = page_order;
+ byte_count = 0;
+ page_count = 0;
+ while (entry->buf_count < count) {
+ if (!(page = drm_alloc_pages(page_order, DRM_MEM_DMA))) break;
+ entry->seglist[entry->seg_count++] = page;
+ for (i = 0; i < (1 << page_order); i++) {
+ DRM_DEBUG("page %d @ 0x%08lx\n",
+ dma->page_count + page_count,
+ page + PAGE_SIZE * i);
+ dma->pagelist[dma->page_count + page_count++]
+ = page + PAGE_SIZE * i;
+ }
+ for (offset = 0;
+ offset + size <= total && entry->buf_count < count;
+ offset += alignment, ++entry->buf_count) {
+ buf = &entry->buflist[entry->buf_count];
+ buf->idx = dma->buf_count + entry->buf_count;
+ buf->total = alignment;
+ buf->order = order;
+ buf->used = 0;
+ buf->offset = (dma->byte_count + byte_count + offset);
+ buf->address = (void *)(page + offset);
+ buf->next = NULL;
+ buf->waiting = 0;
+ buf->pending = 0;
+ init_waitqueue_head(&buf->dma_wait);
+ buf->pid = 0;
+#if DRM_DMA_HISTOGRAM
+ buf->time_queued = 0;
+ buf->time_dispatched = 0;
+ buf->time_completed = 0;
+ buf->time_freed = 0;
+#endif
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
+ }
+ byte_count += PAGE_SIZE << page_order;
+ }
+
+ dma->buflist = drm_realloc(dma->buflist,
+ dma->buf_count * sizeof(*dma->buflist),
+ (dma->buf_count + entry->buf_count)
+ * sizeof(*dma->buflist),
+ DRM_MEM_BUFS);
+ for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++)
+ dma->buflist[i] = &entry->buflist[i - dma->buf_count];
+
+ dma->buf_count += entry->buf_count;
+ dma->seg_count += entry->seg_count;
+ dma->page_count += entry->seg_count << page_order;
+ dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
+
+ drm_freelist_create(&entry->freelist, entry->buf_count);
+ for (i = 0; i < entry->buf_count; i++) {
+ drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]);
+ }
+
+ up(&dev->struct_sem);
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ copy_to_user_ret((drm_buf_desc_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ atomic_dec(&dev->buf_alloc);
+ return 0;
+}
+
+int mga_addbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_buf_desc_t request;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ if(request.flags & _DRM_AGP_BUFFER)
+ return mga_addbufs_agp(inode, filp, cmd, arg);
+ else
+ return mga_addbufs_pci(inode, filp, cmd, arg);
+}
+
+int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_info_t request;
+ int i;
+ int count;
+
+ if (!dma) return -EINVAL;
+
+ spin_lock(&dev->count_lock);
+ if (atomic_read(&dev->buf_alloc)) {
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ ++dev->buf_use; /* Can't allocate more after this call */
+ spin_unlock(&dev->count_lock);
+
+ copy_from_user_ret(&request,
+ (drm_buf_info_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
+ if (dma->bufs[i].buf_count) ++count;
+ }
+
+ DRM_DEBUG("count = %d\n", count);
+
+ if (request.count >= count) {
+ for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
+ if (dma->bufs[i].buf_count) {
+ copy_to_user_ret(&request.list[count].count,
+ &dma->bufs[i].buf_count,
+ sizeof(dma->bufs[0]
+ .buf_count),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count].size,
+ &dma->bufs[i].buf_size,
+ sizeof(dma->bufs[0].buf_size),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count].low_mark,
+ &dma->bufs[i]
+ .freelist.low_mark,
+ sizeof(dma->bufs[0]
+ .freelist.low_mark),
+ -EFAULT);
+ copy_to_user_ret(&request.list[count]
+ .high_mark,
+ &dma->bufs[i]
+ .freelist.high_mark,
+ sizeof(dma->bufs[0]
+ .freelist.high_mark),
+ -EFAULT);
+ DRM_DEBUG("%d %d %d %d %d\n",
+ i,
+ dma->bufs[i].buf_count,
+ dma->bufs[i].buf_size,
+ dma->bufs[i].freelist.low_mark,
+ dma->bufs[i].freelist.high_mark);
+ ++count;
+ }
+ }
+ }
+ request.count = count;
+
+ copy_to_user_ret((drm_buf_info_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ return 0;
+}
+
+int mga_markbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_desc_t request;
+ int order;
+ drm_buf_entry_t *entry;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("%d, %d, %d\n",
+ request.size, request.low_mark, request.high_mark);
+ order = drm_order(request.size);
+ if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL;
+ entry = &dma->bufs[order];
+
+ if (request.low_mark < 0 || request.low_mark > entry->buf_count)
+ return -EINVAL;
+ if (request.high_mark < 0 || request.high_mark > entry->buf_count)
+ return -EINVAL;
+
+ entry->freelist.low_mark = request.low_mark;
+ entry->freelist.high_mark = request.high_mark;
+
+ return 0;
+}
+
+int mga_freebufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_free_t request;
+ int i;
+ int idx;
+ drm_buf_t *buf;
+
+ if (!dma) return -EINVAL;
+
+ copy_from_user_ret(&request,
+ (drm_buf_free_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("%d\n", request.count);
+ for (i = 0; i < request.count; i++) {
+ copy_from_user_ret(&idx,
+ &request.list[i],
+ sizeof(idx),
+ -EFAULT);
+ if (idx < 0 || idx >= dma->buf_count) {
+ DRM_ERROR("Index %d (of %d max)\n",
+ idx, dma->buf_count - 1);
+ return -EINVAL;
+ }
+ buf = dma->buflist[idx];
+ if (buf->pid != current->pid) {
+ DRM_ERROR("Process %d freeing buffer owned by %d\n",
+ current->pid, buf->pid);
+ return -EINVAL;
+ }
+ drm_free_buffer(dev, buf);
+ }
+
+ return 0;
+}
+
+int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ int retcode = 0;
+ const int zero = 0;
+ unsigned long virtual;
+ unsigned long address;
+ drm_buf_map_t request;
+ int i;
+
+ if (!dma) return -EINVAL;
+
+ DRM_DEBUG("\n");
+
+ spin_lock(&dev->count_lock);
+ if (atomic_read(&dev->buf_alloc)) {
+ spin_unlock(&dev->count_lock);
+ DRM_DEBUG("Buzy\n");
+ return -EBUSY;
+ }
+ ++dev->buf_use; /* Can't allocate more after this call */
+ spin_unlock(&dev->count_lock);
+
+ copy_from_user_ret(&request,
+ (drm_buf_map_t *)arg,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("mga_mapbufs\n");
+ DRM_DEBUG("dma->flags : %lx\n", dma->flags);
+
+ if (request.count >= dma->buf_count) {
+ if(dma->flags & _DRM_DMA_USE_AGP) {
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_map_t *map = NULL;
+
+ map = dev->maplist[dev_priv->buffer_map_idx];
+ if (!map) {
+ DRM_DEBUG("map is null\n");
+ retcode = -EINVAL;
+ goto done;
+ }
+
+ DRM_DEBUG("map->offset : %lx\n", map->offset);
+ DRM_DEBUG("map->size : %lx\n", map->size);
+ DRM_DEBUG("map->type : %d\n", map->type);
+ DRM_DEBUG("map->flags : %x\n", map->flags);
+ DRM_DEBUG("map->handle : %lx\n", map->handle);
+ DRM_DEBUG("map->mtrr : %d\n", map->mtrr);
+
+ virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE,
+ MAP_SHARED, (unsigned long)map->offset);
+ } else {
+ virtual = do_mmap(filp, 0, dma->byte_count,
+ PROT_READ|PROT_WRITE, MAP_SHARED, 0);
+ }
+ if (virtual > -1024UL) {
+ /* Real error */
+ DRM_DEBUG("mmap error\n");
+ retcode = (signed long)virtual;
+ goto done;
+ }
+ request.virtual = (void *)virtual;
+
+ for (i = 0; i < dma->buf_count; i++) {
+ if (copy_to_user(&request.list[i].idx,
+ &dma->buflist[i]->idx,
+ sizeof(request.list[0].idx))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ if (copy_to_user(&request.list[i].total,
+ &dma->buflist[i]->total,
+ sizeof(request.list[0].total))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ if (copy_to_user(&request.list[i].used,
+ &zero,
+ sizeof(zero))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ address = virtual + dma->buflist[i]->offset;
+ if (copy_to_user(&request.list[i].address,
+ &address,
+ sizeof(address))) {
+ retcode = -EFAULT;
+ goto done;
+ }
+ }
+ }
+ done:
+ request.count = dma->buf_count;
+ DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode);
+
+ copy_to_user_ret((drm_buf_map_t *)arg,
+ &request,
+ sizeof(request),
+ -EFAULT);
+
+ DRM_DEBUG("retcode : %d\n", retcode);
+
+ return retcode;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_clear.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_clear.c
new file mode 100644
index 000000000..05895415e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_clear.c
@@ -0,0 +1,417 @@
+/* mga_state.c -- State support for mga g200/g400 -*- linux-c -*-
+ *
+ * Created: February 2000 by keithw@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.
+ *
+ * Authors:
+ * Keith Whitwell <keithw@precisioninsight.com>
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "mga_drv.h"
+#include "mgareg_flags.h"
+#include "mga_dma.h"
+#include "mga_state.h"
+
+#define MGA_CLEAR_CMD (DC_opcod_trap | DC_arzero_enable | \
+ DC_sgnzero_enable | DC_shftzero_enable | \
+ (0xC << DC_bop_SHIFT) | DC_clipdis_enable | \
+ DC_solid_enable | DC_transc_enable)
+
+
+#define MGA_COPY_CMD (DC_opcod_bitblt | DC_atype_rpl | DC_linear_xy | \
+ DC_solid_disable | DC_arzero_disable | \
+ DC_sgnzero_enable | DC_shftzero_enable | \
+ (0xC << DC_bop_SHIFT) | DC_bltmod_bfcol | \
+ DC_pattern_disable | DC_transc_disable | \
+ DC_clipdis_enable) \
+
+
+
+/* Build and queue a TT_GENERAL secondary buffer to do the clears.
+ * With Jeff's ringbuffer idea, it might make sense if there are only
+ * one or two cliprects to emit straight to the primary buffer.
+ */
+static int mgaClearBuffers(drm_device_t *dev,
+ int clear_color,
+ int clear_depth,
+ int flags)
+{
+ int cmd, i;
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ xf86drmClipRectRec *pbox = sarea_priv->boxes;
+ int nbox = sarea_priv->nbox;
+ drm_buf_t *buf;
+ drm_dma_t d;
+ int order = 10; /* ??? what orders do we have ???*/
+ DMALOCALS;
+
+
+ if (!nbox)
+ return -EINVAL;
+
+ if ( dev_priv->sgram )
+ cmd = MGA_CLEAR_CMD | DC_atype_blk;
+ else
+ cmd = MGA_CLEAR_CMD | DC_atype_rstr;
+
+ buf = drm_freelist_get(&dma->bufs[order].freelist, _DRM_DMA_WAIT);
+
+
+ DMAGETPTR( buf );
+
+ for (i = 0 ; i < nbox ; i++) {
+ unsigned int height = pbox[i].y2 - pbox[i].y1;
+
+ /* Is it necessary to be this paranoid? I don't think so.
+ if (pbox[i].x1 > dev_priv->width) continue;
+ if (pbox[i].y1 > dev_priv->height) continue;
+ if (pbox[i].x2 > dev_priv->width) continue;
+ if (pbox[i].y2 > dev_priv->height) continue;
+ if (pbox[i].x2 <= pbox[i].x1) continue;
+ if (pbox[i].y2 <= pbox[i].x1) continue;
+ */
+
+ DMAOUTREG(MGAREG_YDSTLEN, (pbox[i].y1<<16)|height);
+ DMAOUTREG(MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1);
+
+ if ( flags & MGA_CLEAR_FRONT ) {
+ DMAOUTREG(MGAREG_FCOL, clear_color);
+ DMAOUTREG(MGAREG_DSTORG, dev_priv->frontOrg);
+ DMAOUTREG(MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ }
+
+ if ( flags & MGA_CLEAR_BACK ) {
+ DMAOUTREG(MGAREG_FCOL, clear_color);
+ DMAOUTREG(MGAREG_DSTORG, dev_priv->backOrg);
+ DMAOUTREG(MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ }
+
+ if ( flags & MGA_CLEAR_DEPTH )
+ {
+ DMAOUTREG(MGAREG_FCOL, clear_depth);
+ DMAOUTREG(MGAREG_DSTORG, dev_priv->depthOrg);
+ DMAOUTREG(MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd );
+ }
+ }
+
+ DMAADVANCE( buf );
+
+ /* Make sure we restore the 3D state next time.
+ */
+ sarea_priv->dirty |= MGASAREA_NEW_CONTEXT;
+
+ ((drm_mga_buf_priv_t *)buf->dev_private)->dma_type = MGA_DMA_GENERAL;
+
+ d.context = DRM_KERNEL_CONTEXT;
+ d.send_count = 1;
+ d.send_indices = &buf->idx;
+ d.send_sizes = &buf->used;
+ d.flags = 0;
+ d.request_count = 0;
+ d.request_size = 0;
+ d.request_indices = NULL;
+ d.request_sizes = NULL;
+ d.granted_count = 0;
+
+ atomic_inc(&dev_priv->pending_bufs);
+ if((drm_dma_enqueue(dev, &d)) != 0)
+ atomic_dec(&dev_priv->pending_bufs);
+ mga_dma_schedule(dev, 1);
+ return 0;
+}
+
+int mgaSwapBuffers(drm_device_t *dev, int flags)
+{
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ xf86drmClipRectRec *pbox = sarea_priv->boxes;
+ int nbox = sarea_priv->nbox;
+ drm_buf_t *buf;
+ drm_dma_t d;
+ int order = 10; /* ??? */
+ int i;
+ DMALOCALS;
+
+ if (!nbox)
+ return -EINVAL;
+
+ buf = drm_freelist_get(&dma->bufs[order].freelist, _DRM_DMA_WAIT);
+
+ DMAGETPTR(buf);
+
+ DMAOUTREG(MGAREG_DSTORG, dev_priv->frontOrg);
+ DMAOUTREG(MGAREG_MACCESS, dev_priv->mAccess);
+ DMAOUTREG(MGAREG_SRCORG, dev_priv->backOrg);
+ DMAOUTREG(MGAREG_AR5, dev_priv->stride); /* unnecessary? */
+ DMAOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
+
+ for (i = 0 ; i < nbox; i++) {
+ unsigned int h = pbox[i].y2 - pbox[i].y1;
+ unsigned int start = pbox[i].y1 * dev_priv->stride;
+
+ /*
+ if (pbox[i].x1 > dev_priv->width) continue;
+ if (pbox[i].y1 > dev_priv->height) continue;
+ if (pbox[i].x2 > dev_priv->width) continue;
+ if (pbox[i].y2 > dev_priv->height) continue;
+ if (pbox[i].x2 <= pbox[i].x1) continue;
+ if (pbox[i].y2 <= pbox[i].x1) continue;
+ */
+
+ DMAOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1);
+ DMAOUTREG(MGAREG_AR3, start + pbox[i].x1);
+ DMAOUTREG(MGAREG_FXBNDRY, pbox[i].x1|((pbox[i].x2 - 1)<<16));
+ DMAOUTREG(MGAREG_YDSTLEN+MGAREG_MGA_EXEC, (pbox[i].y1<<16)|h);
+ }
+
+ DMAOUTREG(MGAREG_SRCORG, 0);
+ DMAADVANCE( buf );
+
+ /* Make sure we restore the 3D state next time.
+ */
+ sarea_priv->dirty |= MGASAREA_NEW_CONTEXT;
+
+ ((drm_mga_buf_priv_t *)buf->dev_private)->dma_type = MGA_DMA_GENERAL;
+
+ d.context = DRM_KERNEL_CONTEXT;
+ d.send_count = 1;
+ d.send_indices = &buf->idx;
+ d.send_sizes = &buf->used;
+ d.flags = 0;
+ d.request_count = 0;
+ d.request_size = 0;
+ d.request_indices = NULL;
+ d.request_sizes = NULL;
+ d.granted_count = 0;
+
+ atomic_inc(&dev_priv->pending_bufs);
+ if((drm_dma_enqueue(dev, &d)) != 0)
+ atomic_dec(&dev_priv->pending_bufs);
+ mga_dma_schedule(dev, 1);
+ return 0;
+}
+
+
+static int mgaIload(drm_device_t *dev, drm_mga_iload_t *args)
+{
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_t *buf = dma->buflist[ args->idx ];
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf->dev_private;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_dma_t d;
+ int pixperdword;
+
+ buf_priv->dma_type = MGA_DMA_ILOAD;
+ buf_priv->boxes[0].y1 = args->texture.y1;
+ buf_priv->boxes[0].y2 = args->texture.y2;
+ buf_priv->boxes[0].x1 = args->texture.x1;
+ buf_priv->boxes[0].x2 = args->texture.x2;
+ buf_priv->ContextState[MGA_CTXREG_DSTORG] = args->destOrg;
+ buf_priv->ContextState[MGA_CTXREG_MACCESS] = args->mAccess;
+ buf_priv->ServerState[MGA_2DREG_PITCH] = args->pitch;
+ buf_priv->nbox = 1;
+ sarea_priv->dirty |= (MGASAREA_NEW_CONTEXT | MGASAREA_NEW_2D);
+ switch((args->mAccess & 0x00000003)) {
+ case 0:
+ pixperdword = 4;
+ break;
+ case 1:
+ pixperdword = 2;
+ break;
+ case 2:
+ pixperdword = 1;
+ break;
+ default:
+ DRM_ERROR("Invalid maccess value passed"
+ " to mgaIload\n");
+ return -EINVAL;
+ }
+ buf->used = ((args->texture.y2 - args->texture.y1) *
+ (args->texture.x2 - args->texture.x1) /
+ pixperdword);
+ DRM_DEBUG("buf->used : %d\n", buf->used);
+ d.context = DRM_KERNEL_CONTEXT;
+ d.send_count = 1;
+ d.send_indices = &buf->idx;
+ d.send_sizes = &buf->used;
+ d.flags = 0;
+ d.request_count = 0;
+ d.request_size = 0;
+ d.request_indices = NULL;
+ d.request_sizes = NULL;
+ d.granted_count = 0;
+
+ atomic_inc(&dev_priv->pending_bufs);
+ if((drm_dma_enqueue(dev, &d)) != 0)
+ atomic_dec(&dev_priv->pending_bufs);
+ mga_dma_schedule(dev, 1);
+
+ return 0;
+}
+
+
+/* Necessary? Not necessary??
+ */
+static int check_lock(void)
+{
+ return 1;
+}
+
+int mga_clear_bufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_clear_t clear;
+ int retcode;
+
+ copy_from_user_ret(&clear, (drm_mga_clear_t *)arg,
+ sizeof(clear), -EFAULT);
+
+/* if (!check_lock( dev )) */
+/* return -EIEIO; */
+
+ retcode = mgaClearBuffers(dev, clear.clear_color,
+ clear.clear_depth,
+ clear.flags);
+
+ return retcode;
+}
+
+int mga_swap_bufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_swap_t swap;
+ int retcode = 0;
+
+/* if (!check_lock( dev )) */
+/* return -EIEIO; */
+
+ copy_from_user_ret(&swap, (drm_mga_swap_t *)arg,
+ sizeof(swap), -EFAULT);
+
+ retcode = mgaSwapBuffers(dev, swap.flags);
+
+ return retcode;
+}
+
+int mga_iload(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_iload_t iload;
+ int retcode = 0;
+
+/* if (!check_lock( dev )) */
+/* return -EIEIO; */
+
+ copy_from_user_ret(&iload, (drm_mga_iload_t *)arg,
+ sizeof(iload), -EFAULT);
+
+ retcode = mgaIload(dev, &iload);
+
+ return retcode;
+}
+
+
+int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ int retcode = 0;
+ drm_dma_t d;
+
+ copy_from_user_ret(&d, (drm_dma_t *)arg, sizeof(d), -EFAULT);
+ DRM_DEBUG("%d %d: %d send, %d req\n",
+ current->pid, d.context, d.send_count, d.request_count);
+
+ /* Per-context queues are unworkable if you are trying to do
+ * state management from the client.
+ */
+ d.context = DRM_KERNEL_CONTEXT;
+ d.flags &= ~_DRM_DMA_WHILE_LOCKED;
+
+ /* Maybe multiple buffers is useful for iload...
+ * But this ioctl is only for *despatching* vertex data...
+ */
+ if (d.send_count < 0 || d.send_count > 1) {
+ DRM_ERROR("Process %d trying to send %d buffers (max 1)\n",
+ current->pid, d.send_count);
+ return -EINVAL;
+ }
+
+
+ /* But it *is* used to request buffers for all types of dma:
+ */
+ if (d.request_count < 0 || d.request_count > dma->buf_count) {
+ DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
+ current->pid, d.request_count, dma->buf_count);
+ return -EINVAL;
+ }
+
+ if (d.send_count) {
+ int idx = d.send_indices[0];
+ drm_mga_buf_priv_t *buf_priv = dma->buflist[ idx ]->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+
+ buf_priv->dma_type = MGA_DMA_VERTEX;
+
+/* if (!check_lock( dev )) */
+/* return -EIEIO; */
+
+ /* Snapshot the relevent bits of the sarea...
+ */
+ mgaCopyAndVerifyState( dev_priv, buf_priv );
+
+ atomic_inc(&dev_priv->pending_bufs);
+ retcode = drm_dma_enqueue(dev, &d);
+ if(retcode != 0)
+ atomic_dec(&dev_priv->pending_bufs);
+ mga_dma_schedule(dev, 1);
+ }
+
+ d.granted_count = 0;
+
+ if (!retcode && d.request_count) {
+ retcode = drm_dma_get_buffers(dev, &d);
+ }
+
+ DRM_DEBUG("%d returning, granted = %d\n",
+ current->pid, d.granted_count);
+ copy_to_user_ret((drm_dma_t *)arg, &d, sizeof(d), -EFAULT);
+
+ return retcode;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c
new file mode 100644
index 000000000..fb0d336fa
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c
@@ -0,0 +1,245 @@
+/* mga_context.c -- IOCTLs for mga contexts -*- linux-c -*-
+ * Created: Mon Dec 13 09:51:35 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.
+ *
+ * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c,v 1.1 2000/02/11 17:26:06 dawes Exp $
+ *
+ */
+
+#include <linux/sched.h>
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "mga_drv.h"
+
+static int mga_alloc_queue(drm_device_t *dev)
+{
+ int temp = drm_ctxbitmap_next(dev);
+ printk("mga_alloc_queue: %d\n", temp);
+ return temp;
+}
+
+int mga_context_switch(drm_device_t *dev, int old, int new)
+{
+ char buf[64];
+
+ atomic_inc(&dev->total_ctx);
+
+ if (test_and_set_bit(0, &dev->context_flag)) {
+ DRM_ERROR("Reentering -- FIXME\n");
+ return -EBUSY;
+ }
+
+#if DRM_DMA_HISTOGRAM
+ dev->ctx_start = get_cycles();
+#endif
+
+ printk("Context switch from %d to %d\n", old, new);
+
+ if (new == dev->last_context) {
+ clear_bit(0, &dev->context_flag);
+ return 0;
+ }
+
+ if (drm_flags & DRM_FLAG_NOCTX) {
+ mga_context_switch_complete(dev, new);
+ } else {
+ sprintf(buf, "C %d %d\n", old, new);
+ drm_write_string(dev, buf);
+ }
+
+ return 0;
+}
+
+int mga_context_switch_complete(drm_device_t *dev, int new)
+{
+ dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
+ dev->last_switch = jiffies;
+
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ DRM_ERROR("Lock isn't held after context switch\n");
+ }
+
+ /* If a context switch is ever initiated
+ when the kernel holds the lock, release
+ that lock here. */
+#if DRM_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles()
+ - dev->ctx_start)]);
+
+#endif
+ clear_bit(0, &dev->context_flag);
+ wake_up(&dev->context_wait);
+
+ return 0;
+}
+
+int mga_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_ctx_res_t res;
+ drm_ctx_t ctx;
+ int i;
+
+ printk("%d\n", DRM_RESERVED_CONTEXTS);
+ copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT);
+ if (res.count >= DRM_RESERVED_CONTEXTS) {
+ memset(&ctx, 0, sizeof(ctx));
+ for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
+ ctx.handle = i;
+ copy_to_user_ret(&res.contexts[i],
+ &i,
+ sizeof(i),
+ -EFAULT);
+ }
+ }
+ res.count = DRM_RESERVED_CONTEXTS;
+ copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT);
+ return 0;
+}
+
+int mga_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_ctx_t ctx;
+
+ copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+ if ((ctx.handle = mga_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) {
+ /* Skip kernel's context and get a new one. */
+ ctx.handle = mga_alloc_queue(dev);
+ }
+ if (ctx.handle == -1) {
+ printk("Not enough free contexts.\n");
+ /* Should this return -EBUSY instead? */
+ return -ENOMEM;
+ }
+ printk("%d\n", ctx.handle);
+ copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT);
+ return 0;
+}
+
+int mga_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ /* This does nothing for the mga */
+ return 0;
+}
+
+int mga_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_ctx_t ctx;
+
+ copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT);
+ /* This is 0, because we don't hanlde any context flags */
+ ctx.flags = 0;
+ copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT);
+ return 0;
+}
+
+int mga_switchctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_ctx_t ctx;
+
+ copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+ printk("%d\n", ctx.handle);
+ return mga_context_switch(dev, dev->last_context, ctx.handle);
+}
+
+int mga_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_ctx_t ctx;
+
+ copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+ printk("%d\n", ctx.handle);
+ mga_context_switch_complete(dev, ctx.handle);
+
+ return 0;
+}
+
+int mga_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_ctx_t ctx;
+ drm_queue_t *q;
+ drm_buf_t *buf;
+
+ copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+ printk("%d\n", ctx.handle);
+ if(ctx.handle == DRM_KERNEL_CONTEXT) {
+ q = dev->queuelist[ctx.handle];
+ atomic_inc(&q->use_count);
+ if (atomic_read(&q->use_count) == 1) {
+ /* No longer in use */
+ atomic_dec(&q->use_count);
+ return -EINVAL;
+ }
+ atomic_inc(&q->finalization); /* Mark queue in finalization state */
+ atomic_sub(2, &q->use_count);
+ /* Mark queue as unused (pending finalization) */
+
+ while (test_and_set_bit(0, &dev->interrupt_flag)) {
+ printk("Calling schedule from rmctx\n");
+ schedule();
+ if (signal_pending(current)) {
+ clear_bit(0, &dev->interrupt_flag);
+ return -EINTR;
+ }
+ }
+
+ /* Remove queued buffers */
+ while ((buf = drm_waitlist_get(&q->waitlist))) {
+ drm_free_buffer(dev, buf);
+ }
+ clear_bit(0, &dev->interrupt_flag);
+
+ /* Wakeup blocked processes */
+ wake_up_interruptible(&q->read_queue);
+ wake_up_interruptible(&q->write_queue);
+ wake_up_interruptible(&q->flush_queue);
+
+ /* Finalization over. Queue is made
+ available when both use_count and
+ finalization become 0, which won't
+ happen until all the waiting processes
+ stop waiting. */
+ atomic_dec(&q->finalization);
+ } else {
+ drm_ctxbitmap_free(dev, ctx.handle);
+ }
+
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c
new file mode 100644
index 000000000..2e24e5b48
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c
@@ -0,0 +1,978 @@
+/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*-
+ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c,v 1.1 2000/02/11 17:26:07 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "mga_drv.h"
+#include "mgareg_flags.h"
+#include "mga_dma.h"
+#include "mga_state.h"
+
+#include <linux/interrupt.h> /* For task queue support */
+
+#define MGA_REG(reg) 2
+#define MGA_BASE(reg) ((unsigned long) \
+ ((drm_device_t *)dev)->maplist[MGA_REG(reg)]->handle)
+#define MGA_ADDR(reg) (MGA_BASE(reg) + reg)
+#define MGA_DEREF(reg) *(__volatile__ int *)MGA_ADDR(reg)
+#define MGA_READ(reg) MGA_DEREF(reg)
+#define MGA_WRITE(reg,val) do { MGA_DEREF(reg) = val; } while (0)
+
+#define PDEA_pagpxfer_enable 0x2
+#define MGA_SYNC_TAG 0x423f4200
+
+typedef enum {
+ TT_GENERAL,
+ TT_BLIT,
+ TT_VECTOR,
+ TT_VERTEX
+} transferType_t;
+
+
+static void mga_delay(void)
+{
+ return;
+}
+
+int mga_dma_cleanup(drm_device_t *dev)
+{
+ if(dev->dev_private) {
+ drm_mga_private_t *dev_priv =
+ (drm_mga_private_t *) dev->dev_private;
+
+ if(dev_priv->ioremap) {
+ int temp = (dev_priv->warp_ucode_size +
+ dev_priv->primary_size +
+ PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE;
+
+ drm_ioremapfree((void *) dev_priv->ioremap, temp);
+ }
+
+ drm_free(dev->dev_private, sizeof(drm_mga_private_t),
+ DRM_MEM_DRIVER);
+ dev->dev_private = NULL;
+ }
+
+ return 0;
+}
+
+static int mga_alloc_kernel_queue(drm_device_t *dev)
+{
+ drm_queue_t *queue = NULL;
+ /* Allocate a new queue */
+ down(&dev->struct_sem);
+
+ if(dev->queue_count != 0) {
+ /* Reseting the kernel context here is not
+ * a race, since it can only happen when that
+ * queue is empty.
+ */
+ queue = dev->queuelist[DRM_KERNEL_CONTEXT];
+ printk("Kernel queue already allocated\n");
+ } else {
+ queue = drm_alloc(sizeof(*queue), DRM_MEM_QUEUES);
+ if(!queue) {
+ up(&dev->struct_sem);
+ printk("out of memory\n");
+ return -ENOMEM;
+ }
+ ++dev->queue_count;
+ dev->queuelist = drm_alloc(sizeof(*dev->queuelist),
+ DRM_MEM_QUEUES);
+ if(!dev->queuelist) {
+ up(&dev->struct_sem);
+ drm_free(queue, sizeof(*queue), DRM_MEM_QUEUES);
+ printk("out of memory\n");
+ return -ENOMEM;
+ }
+ }
+
+ memset(queue, 0, sizeof(*queue));
+ atomic_set(&queue->use_count, 1);
+ atomic_set(&queue->finalization, 0);
+ atomic_set(&queue->block_count, 0);
+ atomic_set(&queue->block_read, 0);
+ atomic_set(&queue->block_write, 0);
+ atomic_set(&queue->total_queued, 0);
+ atomic_set(&queue->total_flushed, 0);
+ atomic_set(&queue->total_locks, 0);
+
+ init_waitqueue_head(&queue->write_queue);
+ init_waitqueue_head(&queue->read_queue);
+ init_waitqueue_head(&queue->flush_queue);
+
+ queue->flags = 0;
+
+ drm_waitlist_create(&queue->waitlist, dev->dma->buf_count);
+
+ dev->queue_slots = 1;
+ dev->queuelist[DRM_KERNEL_CONTEXT] = queue;
+ dev->queue_count--;
+
+ up(&dev->struct_sem);
+ printk("%d (new)\n", dev->queue_count - 1);
+ return DRM_KERNEL_CONTEXT;
+}
+
+static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
+ drm_mga_private_t *dev_priv;
+ drm_map_t *prim_map = NULL;
+ drm_map_t *sarea_map = NULL;
+ int temp;
+
+
+ dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
+ if(dev_priv == NULL) return -ENOMEM;
+ dev->dev_private = (void *) dev_priv;
+
+ printk("dev_private\n");
+
+ memset(dev_priv, 0, sizeof(drm_mga_private_t));
+ atomic_set(&dev_priv->pending_bufs, 0);
+
+ if((init->reserved_map_idx >= dev->map_count) ||
+ (init->buffer_map_idx >= dev->map_count)) {
+ mga_dma_cleanup(dev);
+ printk("reserved_map or buffer_map are invalid\n");
+ return -EINVAL;
+ }
+
+ if(mga_alloc_kernel_queue(dev) != DRM_KERNEL_CONTEXT) {
+ mga_dma_cleanup(dev);
+ DRM_ERROR("Kernel context queue not present\n");
+ }
+
+ dev_priv->reserved_map_idx = init->reserved_map_idx;
+ dev_priv->buffer_map_idx = init->buffer_map_idx;
+ sarea_map = dev->maplist[0];
+ dev_priv->sarea_priv = (drm_mga_sarea_t *)
+ ((u8 *)sarea_map->handle +
+ init->sarea_priv_offset);
+ printk("sarea_priv\n");
+
+ /* Scale primary size to the next page */
+ dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) /
+ PAGE_SIZE) * PAGE_SIZE;
+ dev_priv->warp_ucode_size = init->warp_ucode_size;
+ dev_priv->chipset = init->chipset;
+ dev_priv->fbOffset = init->fbOffset;
+ dev_priv->backOffset = init->backOffset;
+ dev_priv->depthOffset = init->depthOffset;
+ dev_priv->textureOffset = init->textureOffset;
+ dev_priv->textureSize = init->textureSize;
+ dev_priv->cpp = init->cpp;
+ dev_priv->sgram = init->sgram;
+ dev_priv->stride = init->stride;
+
+ dev_priv->frontOrg = init->frontOrg;
+ dev_priv->backOrg = init->backOrg;
+ dev_priv->depthOrg = init->depthOrg;
+ dev_priv->mAccess = init->mAccess;
+
+
+ printk("memcpy\n");
+ memcpy(&dev_priv->WarpIndex, &init->WarpIndex,
+ sizeof(mgaWarpIndex) * MGA_MAX_WARP_PIPES);
+ printk("memcpy done\n");
+ prim_map = dev->maplist[init->reserved_map_idx];
+ dev_priv->prim_phys_head = dev->agp->base + init->reserved_map_agpstart;
+ temp = init->warp_ucode_size + dev_priv->primary_size;
+ temp = ((temp + PAGE_SIZE - 1) /
+ PAGE_SIZE) * PAGE_SIZE;
+ printk("temp : %x\n", temp);
+ printk("dev->agp->base: %lx\n", dev->agp->base);
+ printk("init->reserved_map_agpstart: %x\n", init->reserved_map_agpstart);
+
+
+ dev_priv->ioremap = drm_ioremap(dev->agp->base + init->reserved_map_agpstart,
+ temp);
+ if(dev_priv->ioremap == NULL) {
+ printk("Ioremap failed\n");
+ mga_dma_cleanup(dev);
+ return -ENOMEM;
+ }
+
+
+
+ dev_priv->prim_head = (u32 *)dev_priv->ioremap;
+ printk("dev_priv->prim_head : %p\n", dev_priv->prim_head);
+ dev_priv->current_dma_ptr = dev_priv->prim_head;
+ dev_priv->prim_num_dwords = 0;
+ dev_priv->prim_max_dwords = dev_priv->primary_size / 4;
+
+ printk("dma initialization\n");
+
+ /* Private is now filled in, initialize the hardware */
+ {
+ PRIMLOCALS;
+ PRIMRESET( dev_priv );
+ PRIMGETPTR( dev_priv );
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0);
+ PRIMOUTREG(MGAREG_SOFTRAP, 0);
+ PRIMADVANCE( dev_priv );
+
+ /* Poll for the first buffer to insure that
+ * the status register will be correct
+ */
+ printk("phys_head : %lx\n", phys_head);
+
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) {
+ int i;
+ for(i = 0 ; i < 4096; i++) mga_delay();
+ }
+
+ MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL);
+
+ MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) |
+ PDEA_pagpxfer_enable));
+
+ while(MGA_READ(MGAREG_DWGSYNC) == MGA_SYNC_TAG) {
+ int i;
+ for(i = 0; i < 4096; i++) mga_delay();
+ }
+
+ }
+
+ printk("dma init was successful\n");
+ return 0;
+}
+
+int mga_dma_init(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_init_t init;
+
+ copy_from_user_ret(&init, (drm_mga_init_t *)arg, sizeof(init), -EFAULT);
+
+ switch(init.func) {
+ case MGA_INIT_DMA:
+ return mga_dma_initialize(dev, &init);
+ case MGA_CLEANUP_DMA:
+ return mga_dma_cleanup(dev);
+ }
+
+ return -EINVAL;
+}
+
+#define MGA_ILOAD_CMD (DC_opcod_iload | DC_atype_rpl | \
+ DC_linear_linear | DC_bltmod_bfcol | \
+ (0xC << DC_bop_SHIFT) | DC_sgnzero_enable | \
+ DC_shftzero_enable | DC_clipdis_enable)
+
+static void __mga_iload_small(drm_device_t *dev,
+ drm_buf_t *buf,
+ int use_agp)
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned long address = (unsigned long)buf->bus_address;
+ int length = buf->used;
+ int y1 = buf_priv->boxes[0].y1;
+ int x1 = buf_priv->boxes[0].x1;
+ int y2 = buf_priv->boxes[0].y2;
+ int x2 = buf_priv->boxes[0].x2;
+ int dstorg = buf_priv->ContextState[MGA_CTXREG_DSTORG];
+ int maccess = buf_priv->ContextState[MGA_CTXREG_MACCESS];
+ PRIMLOCALS;
+
+ PRIMRESET(dev_priv);
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG(MGAREG_DSTORG, dstorg | use_agp);
+ PRIMOUTREG(MGAREG_MACCESS, maccess);
+ PRIMOUTREG(MGAREG_PITCH, (1 << 15));
+ PRIMOUTREG(MGAREG_YDST, y1 * (x2 - x1));
+ PRIMOUTREG(MGAREG_LEN, 1);
+ PRIMOUTREG(MGAREG_FXBNDRY, ((x2 - x1) * (y2 - y1) - 1) << 16);
+ PRIMOUTREG(MGAREG_AR0, (x2 - x1) * (y2 - y1) - 1);
+ PRIMOUTREG(MGAREG_AR3, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGCTL+MGAREG_MGA_EXEC, MGA_ILOAD_CMD);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_SECADDRESS, address | TT_BLIT);
+ PRIMOUTREG(MGAREG_SECEND, (address + length) | use_agp);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0);
+ PRIMOUTREG(MGAREG_SOFTRAP, 0);
+ PRIMADVANCE(dev_priv);
+#if 0
+ /* For now we need to set this in the ioctl */
+ sarea_priv->dirty |= MGASAREA_NEW_CONTEXT;
+#endif
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) ;
+
+ MGA_WRITE(MGAREG_PRIMADDRESS, dev_priv->prim_phys_head | TT_GENERAL);
+ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
+}
+
+static void __mga_iload_xy(drm_device_t *dev,
+ drm_buf_t *buf,
+ int use_agp)
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned long address = (unsigned long)buf->bus_address;
+ int length = buf->used;
+ int y1 = buf_priv->boxes[0].y1;
+ int x1 = buf_priv->boxes[0].x1;
+ int y2 = buf_priv->boxes[0].y2;
+ int x2 = buf_priv->boxes[0].x2;
+ int dstorg = buf_priv->ContextState[MGA_CTXREG_DSTORG];
+ int maccess = buf_priv->ContextState[MGA_CTXREG_MACCESS];
+ int pitch = buf_priv->ServerState[MGA_2DREG_PITCH];
+ int width, height;
+ int texperdword = 0;
+ PRIMLOCALS;
+
+ width = (x2 - x1);
+ height = (y2 - y1);
+ switch((maccess & 0x00000003)) {
+ case 0:
+ texperdword = 4;
+ break;
+ case 1:
+ texperdword = 2;
+ break;
+ case 2:
+ texperdword = 1;
+ break;
+ default:
+ DRM_ERROR("Invalid maccess value passed to __mga_iload_xy\n");
+ return;
+ }
+
+ x2 = x1 + width;
+ x2 = (x2 + (texperdword - 1)) & ~(texperdword - 1);
+ x1 = (x1 + (texperdword - 1)) & ~(texperdword - 1);
+ width = x2 - x1;
+
+ PRIMRESET(dev_priv);
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG(MGAREG_DSTORG, dstorg | use_agp);
+ PRIMOUTREG(MGAREG_MACCESS, maccess);
+ PRIMOUTREG(MGAREG_PITCH, pitch);
+ PRIMOUTREG(MGAREG_YDSTLEN, (y1 << 16) | height);
+
+ PRIMOUTREG(MGAREG_FXBNDRY, ((x1+width-1) << 16) | x1);
+ PRIMOUTREG(MGAREG_AR0, width * height - 1);
+ PRIMOUTREG(MGAREG_AR3, 0 );
+ PRIMOUTREG(MGAREG_DWGCTL+MGAREG_MGA_EXEC, MGA_ILOAD_CMD);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_SECADDRESS, address | TT_BLIT);
+ PRIMOUTREG(MGAREG_SECEND, (address + length) | use_agp);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0);
+ PRIMOUTREG(MGAREG_SOFTRAP, 0);
+ PRIMADVANCE(dev_priv);
+#if 0
+ /* For now we need to set this in the ioctl */
+ sarea_priv->dirty |= MGASAREA_NEW_CONTEXT;
+#endif
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) ;
+
+ MGA_WRITE(MGAREG_PRIMADDRESS, dev_priv->prim_phys_head | TT_GENERAL);
+ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
+}
+
+static void mga_dma_dispatch_iload(drm_device_t *dev, drm_buf_t *buf)
+{
+ drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+
+ int use_agp = PDEA_pagpxfer_enable;
+ int x1 = buf_priv->boxes[0].x1;
+ int x2 = buf_priv->boxes[0].x2;
+
+ if((x2 - x1) < 32) {
+ printk("using iload small\n");
+ __mga_iload_small(dev, buf, use_agp);
+ } else {
+ printk("using iload xy\n");
+ __mga_iload_xy(dev, buf, use_agp);
+ }
+}
+
+static void mga_dma_dispatch_vertex(drm_device_t *dev, drm_buf_t *buf)
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ unsigned long address = (unsigned long)buf->bus_address;
+ int length = buf->used;
+ int use_agp = PDEA_pagpxfer_enable;
+ int i, count;
+ PRIMLOCALS;
+
+ PRIMRESET(dev_priv);
+
+ count = buf_priv->nbox;
+ if (count == 0)
+ count = 1;
+
+ mgaEmitState( dev_priv, buf_priv );
+
+ for (i = 0 ; i < count ; i++) {
+ if (i < buf_priv->nbox)
+ mgaEmitClipRect( dev_priv, &buf_priv->boxes[i] );
+
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_SECADDRESS, address | TT_VERTEX);
+ PRIMOUTREG( MGAREG_SECEND, (address + length) | use_agp);
+
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DWGSYNC, 0);
+ PRIMOUTREG( MGAREG_SOFTRAP, 0);
+ PRIMADVANCE(dev_priv);
+ }
+
+ PRIMGETPTR( dev_priv );
+
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) ;
+
+ MGA_WRITE(MGAREG_PRIMADDRESS, dev_priv->prim_phys_head | TT_GENERAL);
+ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
+}
+
+
+/* Used internally for the small buffers generated from client state
+ * information.
+ */
+static void mga_dma_dispatch_general(drm_device_t *dev, drm_buf_t *buf)
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ unsigned long address = (unsigned long)buf->bus_address;
+ int length = buf->used;
+ int use_agp = PDEA_pagpxfer_enable;
+ PRIMLOCALS;
+
+ PRIMRESET(dev_priv);
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_SECADDRESS, address | TT_GENERAL);
+ PRIMOUTREG( MGAREG_SECEND, (address + length) | use_agp);
+
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DMAPAD, 0);
+ PRIMOUTREG( MGAREG_DWGSYNC, 0);
+ PRIMOUTREG( MGAREG_SOFTRAP, 0);
+ PRIMADVANCE(dev_priv);
+
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) ;
+
+ MGA_WRITE(MGAREG_PRIMADDRESS, dev_priv->prim_phys_head | TT_GENERAL);
+ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
+}
+
+/* Frees dispatch lock */
+static inline void mga_dma_quiescent(drm_device_t *dev)
+{
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+
+ while(1) {
+ atomic_inc(&dev_priv->dispatch_lock);
+ if(atomic_read(&dev_priv->dispatch_lock) == 1) {
+ break;
+ } else {
+ atomic_dec(&dev_priv->dispatch_lock);
+ }
+ }
+ while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) ;
+#if 0
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+#endif
+ while(MGA_READ(MGAREG_DWGSYNC) == MGA_SYNC_TAG) ;
+ MGA_WRITE(MGAREG_DWGSYNC, MGA_SYNC_TAG);
+ while(MGA_READ(MGAREG_DWGSYNC) != MGA_SYNC_TAG) ;
+ atomic_dec(&dev_priv->dispatch_lock);
+}
+
+/* Keeps dispatch lock held */
+
+static inline int mga_dma_is_ready(drm_device_t *dev)
+{
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+
+ atomic_inc(&dev_priv->dispatch_lock);
+ if(atomic_read(&dev_priv->dispatch_lock) == 1) {
+ /* We got the lock */
+ return 1;
+ } else {
+ atomic_dec(&dev_priv->dispatch_lock);
+ return 0;
+ }
+}
+
+static inline int mga_dma_is_ready_no_hold(drm_device_t *dev)
+{
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+
+ atomic_inc(&dev_priv->dispatch_lock);
+ if(atomic_read(&dev_priv->dispatch_lock) == 1) {
+ /* We got the lock, but free it */
+ atomic_dec(&dev_priv->dispatch_lock);
+ return 1;
+ } else {
+ atomic_dec(&dev_priv->dispatch_lock);
+ return 0;
+ }
+}
+
+static void mga_dma_service(int irq, void *device, struct pt_regs *regs)
+{
+ drm_device_t *dev = (drm_device_t *)device;
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+
+ atomic_dec(&dev_priv->dispatch_lock);
+ atomic_inc(&dev->total_irq);
+ MGA_WRITE(MGAREG_ICLEAR, 0xfa7);
+
+ /* Free previous buffer */
+ if (test_and_set_bit(0, &dev->dma_flag)) {
+ atomic_inc(&dma->total_missed_free);
+ return;
+ }
+ if (dma->this_buffer) {
+ drm_free_buffer(dev, dma->this_buffer);
+ dma->this_buffer = NULL;
+ }
+ clear_bit(0, &dev->dma_flag);
+
+ /* Dispatch new buffer */
+ queue_task(&dev->tq, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+
+}
+
+/* Only called by mga_dma_schedule. */
+static int mga_do_dma(drm_device_t *dev, int locked)
+{
+ drm_buf_t *buf;
+ int retcode = 0;
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_mga_buf_priv_t *buf_priv;
+
+ printk("mga_do_dma\n");
+ if (test_and_set_bit(0, &dev->dma_flag)) {
+ atomic_inc(&dma->total_missed_dma);
+ return -EBUSY;
+ }
+
+ if (!dma->next_buffer) {
+ DRM_ERROR("No next_buffer\n");
+ clear_bit(0, &dev->dma_flag);
+ return -EINVAL;
+ }
+
+ buf = dma->next_buffer;
+
+ printk("context %d, buffer %d\n", buf->context, buf->idx);
+
+ if (buf->list == DRM_LIST_RECLAIM) {
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ clear_bit(0, &dev->dma_flag);
+ return -EINVAL;
+ }
+
+ if (!buf->used) {
+ DRM_ERROR("0 length buffer\n");
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ clear_bit(0, &dev->dma_flag);
+ return 0;
+ }
+
+ if (mga_dma_is_ready(dev) == 0) {
+ clear_bit(0, &dev->dma_flag);
+ return -EBUSY;
+ }
+
+ /* Always hold the hardware lock while dispatching.
+ */
+ if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ atomic_inc(&dma->total_missed_lock);
+ clear_bit(0, &dev->dma_flag);
+ atomic_dec(&dev_priv->dispatch_lock);
+ return -EBUSY;
+ }
+
+ dma->next_queue = dev->queuelist[DRM_KERNEL_CONTEXT];
+ drm_clear_next_buffer(dev);
+ buf->pending = 1;
+ buf->waiting = 0;
+ buf->list = DRM_LIST_PEND;
+
+ buf_priv = buf->dev_private;
+
+ printk("dispatch!\n");
+ switch (buf_priv->dma_type) {
+ case MGA_DMA_GENERAL:
+ mga_dma_dispatch_general(dev, buf);
+ break;
+ case MGA_DMA_VERTEX:
+ mga_dma_dispatch_vertex(dev, buf);
+ break;
+/* case MGA_DMA_SETUP: */
+/* mga_dma_dispatch_setup(dev, address, length); */
+/* break; */
+ case MGA_DMA_ILOAD:
+ mga_dma_dispatch_iload(dev, buf);
+ break;
+ default:
+ printk("bad buffer type %x in dispatch\n", buf_priv->dma_type);
+ break;
+ }
+ atomic_dec(&dev_priv->pending_bufs);
+
+ drm_free_buffer(dev, dma->this_buffer);
+ dma->this_buffer = buf;
+
+ atomic_add(buf->used, &dma->total_bytes);
+ atomic_inc(&dma->total_dmas);
+
+ if (!locked) {
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+ }
+
+ clear_bit(0, &dev->dma_flag);
+
+ if(!atomic_read(&dev_priv->pending_bufs)) {
+ wake_up_interruptible(&dev->queuelist[DRM_KERNEL_CONTEXT]->flush_queue);
+ }
+
+#if 0
+ wake_up_interruptible(&dev->lock.lock_queue);
+#endif
+
+ /* We hold the dispatch lock until the interrupt handler
+ * frees it
+ */
+ return retcode;
+}
+
+static void mga_dma_schedule_timer_wrapper(unsigned long dev)
+{
+ mga_dma_schedule((drm_device_t *)dev, 0);
+}
+
+static void mga_dma_schedule_tq_wrapper(void *dev)
+{
+ mga_dma_schedule(dev, 0);
+}
+
+int mga_dma_schedule(drm_device_t *dev, int locked)
+{
+ drm_queue_t *q;
+ drm_buf_t *buf;
+ int retcode = 0;
+ int processed = 0;
+ int missed;
+ int expire = 20;
+ drm_device_dma_t *dma = dev->dma;
+
+ printk("mga_dma_schedule\n");
+
+ if (test_and_set_bit(0, &dev->interrupt_flag)) {
+ /* Not reentrant */
+ atomic_inc(&dma->total_missed_sched);
+ return -EBUSY;
+ }
+ missed = atomic_read(&dma->total_missed_sched);
+
+again:
+ /* There is only one queue:
+ */
+ if (!dma->next_buffer && DRM_WAITCOUNT(dev, DRM_KERNEL_CONTEXT)) {
+ q = dev->queuelist[DRM_KERNEL_CONTEXT];
+ buf = drm_waitlist_get(&q->waitlist);
+ dma->next_buffer = buf;
+ dma->next_queue = q;
+ if (buf && buf->list == DRM_LIST_RECLAIM) {
+ drm_clear_next_buffer(dev);
+ drm_free_buffer(dev, buf);
+ }
+ }
+
+ if (dma->next_buffer) {
+ if (!(retcode = mga_do_dma(dev, locked)))
+ ++processed;
+ }
+
+ /* Try again if we succesfully dispatched a buffer, or if someone
+ * tried to schedule while we were working.
+ */
+ if (--expire) {
+ if (missed != atomic_read(&dma->total_missed_sched)) {
+ atomic_inc(&dma->total_lost);
+ if (mga_dma_is_ready_no_hold(dev))
+ goto again;
+ }
+
+ if (processed && mga_dma_is_ready_no_hold(dev)) {
+ atomic_inc(&dma->total_lost);
+ processed = 0;
+ goto again;
+ }
+ }
+
+ clear_bit(0, &dev->interrupt_flag);
+
+ return retcode;
+}
+
+int mga_irq_install(drm_device_t *dev, int irq)
+{
+ int retcode;
+
+ if (!irq) return -EINVAL;
+
+ down(&dev->struct_sem);
+ if (dev->irq) {
+ up(&dev->struct_sem);
+ return -EBUSY;
+ }
+ dev->irq = irq;
+ up(&dev->struct_sem);
+
+ printk("install irq handler %d\n", irq);
+
+ dev->context_flag = 0;
+ dev->interrupt_flag = 0;
+ dev->dma_flag = 0;
+ dev->dma->next_buffer = NULL;
+ dev->dma->next_queue = NULL;
+ dev->dma->this_buffer = NULL;
+ dev->tq.next = NULL;
+ dev->tq.sync = 0;
+ dev->tq.routine = mga_dma_schedule_tq_wrapper;
+ dev->tq.data = dev;
+
+ /* Before installing handler */
+ MGA_WRITE(MGAREG_ICLEAR, 0xfa7);
+ MGA_WRITE(MGAREG_IEN, 0);
+
+ /* Install handler */
+ if ((retcode = request_irq(dev->irq,
+ mga_dma_service,
+ 0,
+ dev->devname,
+ dev))) {
+ down(&dev->struct_sem);
+ dev->irq = 0;
+ up(&dev->struct_sem);
+ return retcode;
+ }
+
+ /* After installing handler */
+ MGA_WRITE(MGAREG_ICLEAR, 0xfa7);
+ MGA_WRITE(MGAREG_IEN, 0x00000001);
+
+ return 0;
+}
+
+int mga_irq_uninstall(drm_device_t *dev)
+{
+ int irq;
+
+ down(&dev->struct_sem);
+ irq = dev->irq;
+ dev->irq = 0;
+ up(&dev->struct_sem);
+
+ if (!irq) return -EINVAL;
+
+ printk("remove irq handler %d\n", irq);
+
+ MGA_WRITE(MGAREG_ICLEAR, 0xfa7);
+ MGA_WRITE(MGAREG_IEN, 0);
+ MGA_WRITE(MGAREG_ICLEAR, 0xfa7);
+
+ free_irq(irq, dev);
+
+ return 0;
+}
+
+
+int mga_control(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_control_t ctl;
+
+ copy_from_user_ret(&ctl, (drm_control_t *)arg, sizeof(ctl), -EFAULT);
+
+ switch (ctl.func) {
+ case DRM_INST_HANDLER:
+ return mga_irq_install(dev, ctl.irq);
+ case DRM_UNINST_HANDLER:
+ return mga_irq_uninstall(dev);
+ default:
+ return -EINVAL;
+ }
+}
+
+int mga_flush_queue(drm_device_t *dev)
+{
+ DECLARE_WAITQUEUE(entry, current);
+ drm_queue_t *q = dev->queuelist[DRM_KERNEL_CONTEXT];
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ int ret = 0;
+
+ printk("mga_flush_queue\n");
+ if(atomic_read(&dev_priv->pending_bufs) != 0) {
+ current->state = TASK_INTERRUPTIBLE;
+ add_wait_queue(&q->flush_queue, &entry);
+ for (;;) {
+ if (!atomic_read(&dev_priv->pending_bufs)) break;
+ printk("Calling schedule from flush_queue : %d\n",
+ atomic_read(&dev_priv->pending_bufs));
+ mga_dma_schedule(dev, 1);
+ schedule();
+ if (signal_pending(current)) {
+ ret = -EINTR; /* Can't restart */
+ break;
+ }
+ }
+ printk("Exited out of schedule from flush_queue\n");
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&q->flush_queue, &entry);
+ }
+
+ return ret;
+}
+
+int mga_lock(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ DECLARE_WAITQUEUE(entry, current);
+ int ret = 0;
+ drm_lock_t lock;
+
+ copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+
+ if (lock.context == DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Process %d using kernel context %d\n",
+ current->pid, lock.context);
+ return -EINVAL;
+ }
+
+ printk("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+ lock.context, current->pid, dev->lock.hw_lock->lock,
+ lock.flags);
+
+
+ if (lock.context < 0) {
+ return -EINVAL;
+ }
+
+ /* Only one queue:
+ */
+
+ if (!ret) {
+ add_wait_queue(&dev->lock.lock_queue, &entry);
+ for (;;) {
+ if (!dev->lock.hw_lock) {
+ /* Device has been unregistered */
+ ret = -EINTR;
+ break;
+ }
+ if (drm_lock_take(&dev->lock.hw_lock->lock,
+ lock.context)) {
+ dev->lock.pid = current->pid;
+ dev->lock.lock_time = jiffies;
+ atomic_inc(&dev->total_locks);
+ break; /* Got lock */
+ }
+
+ /* Contention */
+ atomic_inc(&dev->total_sleeps);
+ current->state = TASK_INTERRUPTIBLE;
+ current->policy |= SCHED_YIELD;
+ printk("Calling lock schedule\n");
+ schedule();
+ if (signal_pending(current)) {
+ ret = -ERESTARTSYS;
+ break;
+ }
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&dev->lock.lock_queue, &entry);
+ }
+
+ if (!ret) {
+ if (lock.flags & _DRM_LOCK_QUIESCENT) {
+ printk("_DRM_LOCK_QUIESCENT\n");
+ ret = mga_flush_queue(dev);
+ if(ret != 0) {
+ drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ lock.context);
+ } else {
+ mga_dma_quiescent(dev);
+ }
+ }
+ }
+ printk("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
+ return ret;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.h
new file mode 100644
index 000000000..7f1c57957
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.h
@@ -0,0 +1,112 @@
+#ifndef MGA_DMA_H
+#define MGA_DMA_H
+
+#include "mga_drm_public.h"
+
+
+/* Isn't this fun. This has to be fixed asap by emitting primary
+ * dma commands in the 'do_dma' ioctl.
+ */
+typedef struct {
+ int dma_type;
+
+ unsigned int ContextState[MGA_CTX_SETUP_SIZE];
+ unsigned int ServerState[MGA_2D_SETUP_SIZE];
+ unsigned int TexState[2][MGA_TEX_SETUP_SIZE];
+ unsigned int WarpPipe;
+ unsigned int dirty;
+
+ unsigned int nbox;
+ xf86drmClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
+} drm_mga_buf_priv_t;
+
+
+#define MGA_DMA_GENERAL 0
+#define MGA_DMA_VERTEX 1
+#define MGA_DMA_SETUP 2
+#define MGA_DMA_ILOAD 3
+
+
+#define DWGREG0 0x1c00
+#define DWGREG0_END 0x1dff
+#define DWGREG1 0x2c00
+#define DWGREG1_END 0x2dff
+
+#define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END)
+#define ADRINDEX0(r) (u8)((r - DWGREG0) >> 2)
+#define ADRINDEX1(r) (u8)(((r - DWGREG1) >> 2) | 0x80)
+#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r))
+
+
+/* Macros for inserting commands into a secondary dma buffer.
+ */
+
+#define DMALOCALS u8 tempIndex[4]; u32 *dma_ptr; \
+ int outcount, num_dwords;
+
+#define DMAGETPTR(buf) do { \
+ dma_ptr = (u32 *)((u8 *)buf->address + buf->used); \
+ outcount = 0; \
+ num_dwords = buf->used / 4; \
+} while(0)
+
+#define DMAADVANCE(buf) do { \
+ buf->used = num_dwords * 4; \
+} while(0)
+
+#define DMAOUTREG(reg, val) do { \
+ tempIndex[outcount]=ADRINDEX(reg); \
+ dma_ptr[++outcount] = val; \
+ if (outcount == 4) { \
+ outcount = 0; \
+ dma_ptr[0] = *(u32 *)tempIndex; \
+ dma_ptr+=5; \
+ num_dwords += 5; \
+ } \
+}while (0)
+
+
+
+#define VERBO 0
+
+
+/* Primary buffer versions of above -- pretty similar really.
+ */
+#define PRIMLOCALS u8 tempIndex[4]; u32 *dma_ptr; u32 phys_head; \
+ int outcount, num_dwords
+
+#define PRIMRESET(dev_priv) do { \
+ dev_priv->prim_num_dwords = 0; \
+ dev_priv->current_dma_ptr = dev_priv->prim_head; \
+} while (0)
+
+#define PRIMGETPTR(dev_priv) do { \
+ dma_ptr = dev_priv->current_dma_ptr; \
+ phys_head = dev_priv->prim_phys_head; \
+ num_dwords = dev_priv->prim_num_dwords; \
+ outcount = 0; \
+} while (0)
+
+#define PRIMADVANCE(dev_priv) do { \
+ dev_priv->prim_num_dwords = num_dwords; \
+ dev_priv->current_dma_ptr = dma_ptr; \
+} while (0)
+
+#define PRIMOUTREG(reg, val) do { \
+ tempIndex[outcount]=ADRINDEX(reg); \
+ dma_ptr[1+outcount] = val; \
+ if( ++outcount == 4) { \
+ outcount = 0; \
+ dma_ptr[0] = *(u32 *)tempIndex; \
+ dma_ptr+=5; \
+ num_dwords += 5; \
+ } \
+ if (VERBO) \
+ printk(KERN_INFO \
+ "OUT %x val %x dma_ptr %p nr_dwords %d\n", \
+ outcount, ADRINDEX(reg), dma_ptr, \
+ num_dwords); \
+}while (0)
+
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h
new file mode 100644
index 000000000..8b21df11f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h
@@ -0,0 +1,218 @@
+/* mga_drm_public.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*-
+ * Created: Tue Jan 25 01:50:01 1999 by jhartmann@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.
+ *
+ * Authors: Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Keith Whitwell <keithw@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h,v 1.1 2000/02/11 17:26:07 dawes Exp $
+ */
+
+#ifndef _MGA_DRM_PUBLIC_H_
+#define _MGA_DRM_PUBLIC_H_
+
+#define MGA_F 0x1 /* fog */
+#define MGA_A 0x2 /* alpha */
+#define MGA_S 0x4 /* specular */
+#define MGA_T2 0x8 /* multitexture */
+
+#define MGA_WARP_TGZ 0
+#define MGA_WARP_TGZF (MGA_F)
+#define MGA_WARP_TGZA (MGA_A)
+#define MGA_WARP_TGZAF (MGA_F|MGA_A)
+#define MGA_WARP_TGZS (MGA_S)
+#define MGA_WARP_TGZSF (MGA_S|MGA_F)
+#define MGA_WARP_TGZSA (MGA_S|MGA_A)
+#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A)
+#define MGA_WARP_T2GZ (MGA_T2)
+#define MGA_WARP_T2GZF (MGA_T2|MGA_F)
+#define MGA_WARP_T2GZA (MGA_T2|MGA_A)
+#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F)
+#define MGA_WARP_T2GZS (MGA_T2|MGA_S)
+#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F)
+#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A)
+#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A)
+
+
+#define MGA_MAX_G400_PIPES 16
+#define MGA_MAX_G200_PIPES 8 /* no multitex */
+
+
+#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
+
+#define MGA_CARD_TYPE_G200 1
+#define MGA_CARD_TYPE_G400 2
+
+
+typedef struct _drm_mga_warp_index {
+ int installed;
+ unsigned long phys_addr;
+ int size;
+} mgaWarpIndex;
+
+typedef struct drm_mga_init {
+ enum {
+ MGA_INIT_DMA = 0x01,
+ MGA_CLEANUP_DMA = 0x02
+ } func;
+ int reserved_map_agpstart;
+ int reserved_map_idx;
+ int buffer_map_idx;
+ int sarea_priv_offset;
+ int primary_size;
+ int warp_ucode_size;
+ int fbOffset;
+ int backOffset;
+ int depthOffset;
+ int textureOffset;
+ int textureSize;
+ int cpp;
+ int stride;
+ int sgram;
+ int chipset;
+ mgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES];
+
+ /* Redundant?
+ */
+ int frontOrg;
+ int backOrg;
+ int depthOrg;
+ int mAccess;
+} drm_mga_init_t;
+
+typedef struct _xf86drmClipRectRec {
+ unsigned short x1;
+ unsigned short y1;
+ unsigned short x2;
+ unsigned short y2;
+} xf86drmClipRectRec;
+
+#define MGA_CLEAR_FRONT 0x1
+#define MGA_CLEAR_BACK 0x2
+#define MGA_CLEAR_DEPTH 0x4
+
+
+/* Each context has a state:
+ */
+#define MGA_CTXREG_DSTORG 0 /* validated */
+#define MGA_CTXREG_MACCESS 1
+#define MGA_CTXREG_PLNWT 2
+#define MGA_CTXREG_DWGCTL 3
+#define MGA_CTXREG_ALPHACTRL 4
+#define MGA_CTXREG_FOGCOLOR 5
+#define MGA_CTXREG_WFLAG 6
+#define MGA_CTXREG_TDUAL0 7
+#define MGA_CTXREG_TDUAL1 8
+#define MGA_CTX_SETUP_SIZE 9
+
+/* 2d state
+ */
+#define MGA_2DREG_PITCH 0
+#define MGA_2D_SETUP_SIZE 1
+
+/* Each texture unit has a state:
+ */
+#define MGA_TEXREG_CTL 0
+#define MGA_TEXREG_CTL2 1
+#define MGA_TEXREG_FILTER 2
+#define MGA_TEXREG_BORDERCOL 3
+#define MGA_TEXREG_ORG 4 /* validated */
+#define MGA_TEXREG_ORG1 5
+#define MGA_TEXREG_ORG2 6
+#define MGA_TEXREG_ORG3 7
+#define MGA_TEXREG_ORG4 8
+#define MGA_TEXREG_WIDTH 9
+#define MGA_TEXREG_HEIGHT 10
+#define MGA_TEX_SETUP_SIZE 11
+
+
+/* What needs to be changed for the current vertex dma buffer?
+ */
+#define MGASAREA_NEW_CONTEXT 0x1
+#define MGASAREA_NEW_TEX0 0x2
+#define MGASAREA_NEW_TEX1 0x4
+#define MGASAREA_NEW_PIPE 0x8
+#define MGASAREA_NEW_2D 0x10
+
+
+/* Keep this small for testing
+ */
+#define MGA_NR_SAREA_CLIPRECTS 2
+
+/* Upto 128 regions. Minimum region size of 256k.
+ */
+#define MGA_NR_TEX_REGIONS 128
+#define MGA_MIN_LOG_TEX_GRANULARITY 18
+
+typedef struct {
+ unsigned char next, prev;
+ unsigned char in_use;
+ int age;
+} mgaTexRegion;
+
+typedef struct
+{
+ unsigned int ContextState[MGA_CTX_SETUP_SIZE];
+ unsigned int ServerState[MGA_2D_SETUP_SIZE];
+ unsigned int TexState[2][MGA_TEX_SETUP_SIZE];
+ unsigned int WarpPipe;
+ unsigned int dirty;
+
+ unsigned int nbox;
+ xf86drmClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
+
+ /* kernel doesn't touch from here down */
+ int ctxOwner;
+ mgaTexRegion texList[MGA_NR_TEX_REGIONS+1];
+ int texAge;
+} drm_mga_sarea_t;
+
+
+/* Device specific ioctls:
+ */
+typedef struct {
+ int clear_color;
+ int clear_depth;
+ int flags;
+} drm_mga_clear_t;
+
+
+typedef struct {
+ int flags; /* not actually used? */
+} drm_mga_swap_t;
+
+typedef struct {
+ unsigned int destOrg;
+ unsigned int mAccess;
+ unsigned int pitch;
+ xf86drmClipRectRec texture;
+ int idx;
+} drm_mga_iload_t;
+
+
+#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
+#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t)
+#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t)
+#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t)
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c
new file mode 100644
index 000000000..8bc25617e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c
@@ -0,0 +1,576 @@
+/* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*-
+ * Created: Mon Dec 13 01:56:22 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c,v 1.1 2000/02/11 17:26:07 dawes Exp $
+ *
+ */
+
+#define EXPORT_SYMTAB
+#include "drmP.h"
+#include "mga_drv.h"
+EXPORT_SYMBOL(mga_init);
+EXPORT_SYMBOL(mga_cleanup);
+
+#define MGA_NAME "mga"
+#define MGA_DESC "Matrox g200/g400"
+#define MGA_DATE "19991213"
+#define MGA_MAJOR 0
+#define MGA_MINOR 0
+#define MGA_PATCHLEVEL 1
+
+static drm_device_t mga_device;
+drm_ctx_t mga_res_ctx;
+
+static struct file_operations mga_fops = {
+ open: mga_open,
+ flush: drm_flush,
+ release: mga_release,
+ ioctl: mga_ioctl,
+ mmap: drm_mmap,
+ read: drm_read,
+ fasync: drm_fasync,
+};
+
+static struct miscdevice mga_misc = {
+ minor: MISC_DYNAMIC_MINOR,
+ name: MGA_NAME,
+ fops: &mga_fops,
+};
+
+static drm_ioctl_desc_t mga_ioctls[] = {
+ [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { mga_version, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { mga_control, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { mga_addbufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { mga_markbufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { mga_infobufs, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { mga_mapbufs, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { mga_freebufs, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { mga_addctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { mga_rmctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { mga_modctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { mga_getctx, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { mga_switchctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { mga_newctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { mga_resctx, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { mga_lock, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { mga_unlock, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_clear_bufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_swap_bufs, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 1 },
+};
+
+#define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls)
+
+#ifdef MODULE
+int init_module(void);
+void cleanup_module(void);
+static char *mga = NULL;
+
+MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas.");
+MODULE_DESCRIPTION("Matrox g200/g400");
+MODULE_PARM(mga, "s");
+
+/* init_module is called when insmod is used to load the module */
+
+int init_module(void)
+{
+ DRM_DEBUG("doing mga_init()\n");
+ return mga_init();
+}
+
+/* cleanup_module is called when rmmod is used to unload the module */
+
+void cleanup_module(void)
+{
+ mga_cleanup();
+}
+#endif
+
+#ifndef MODULE
+/* mga_setup is called by the kernel to parse command-line options passed
+ * via the boot-loader (e.g., LILO). It calls the insmod option routine,
+ * drm_parse_drm.
+ *
+ * This is not currently supported, since it requires changes to
+ * linux/init/main.c. */
+
+
+void __init mga_setup(char *str, int *ints)
+{
+ if (ints[0] != 0) {
+ DRM_ERROR("Illegal command line format, ignored\n");
+ return;
+ }
+ drm_parse_options(str);
+}
+#endif
+
+static int mga_setup(drm_device_t *dev)
+{
+ int i;
+
+ atomic_set(&dev->ioctl_count, 0);
+ atomic_set(&dev->vma_count, 0);
+ dev->buf_use = 0;
+ atomic_set(&dev->buf_alloc, 0);
+
+ drm_dma_setup(dev);
+
+ atomic_set(&dev->total_open, 0);
+ atomic_set(&dev->total_close, 0);
+ atomic_set(&dev->total_ioctl, 0);
+ atomic_set(&dev->total_irq, 0);
+ atomic_set(&dev->total_ctx, 0);
+ atomic_set(&dev->total_locks, 0);
+ atomic_set(&dev->total_unlocks, 0);
+ atomic_set(&dev->total_contends, 0);
+ atomic_set(&dev->total_sleeps, 0);
+
+ for (i = 0; i < DRM_HASH_SIZE; i++) {
+ dev->magiclist[i].head = NULL;
+ dev->magiclist[i].tail = NULL;
+ }
+ dev->maplist = NULL;
+ dev->map_count = 0;
+ dev->vmalist = NULL;
+ dev->lock.hw_lock = NULL;
+ init_waitqueue_head(&dev->lock.lock_queue);
+ dev->queue_count = 0;
+ dev->queue_reserved = 0;
+ dev->queue_slots = 0;
+ dev->queuelist = NULL;
+ dev->irq = 0;
+ dev->context_flag = 0;
+ dev->interrupt_flag = 0;
+ dev->dma_flag = 0;
+ dev->last_context = 0;
+ dev->last_switch = 0;
+ dev->last_checked = 0;
+ init_timer(&dev->timer);
+ init_waitqueue_head(&dev->context_wait);
+
+ dev->ctx_start = 0;
+ dev->lck_start = 0;
+
+ dev->buf_rp = dev->buf;
+ dev->buf_wp = dev->buf;
+ dev->buf_end = dev->buf + DRM_BSZ;
+ dev->buf_async = NULL;
+ init_waitqueue_head(&dev->buf_readers);
+ init_waitqueue_head(&dev->buf_writers);
+
+ DRM_DEBUG("\n");
+
+ /* The kernel's context could be created here, but is now created
+ in drm_dma_enqueue. This is more resource-efficient for
+ hardware that does not do DMA, but may mean that
+ drm_select_queue fails between the time the interrupt is
+ initialized and the time the queues are initialized. */
+
+ return 0;
+}
+
+
+static int mga_takedown(drm_device_t *dev)
+{
+ int i;
+ drm_magic_entry_t *pt, *next;
+ drm_map_t *map;
+ drm_vma_entry_t *vma, *vma_next;
+
+ DRM_DEBUG("\n");
+
+ if (dev->irq) mga_irq_uninstall(dev);
+
+ down(&dev->struct_sem);
+ del_timer(&dev->timer);
+
+ if (dev->devname) {
+ drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
+ dev->devname = NULL;
+ }
+
+ if (dev->unique) {
+ drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
+ dev->unique = NULL;
+ dev->unique_len = 0;
+ }
+ /* Clear pid list */
+ for (i = 0; i < DRM_HASH_SIZE; i++) {
+ for (pt = dev->magiclist[i].head; pt; pt = next) {
+ next = pt->next;
+ drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
+ }
+ dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
+ }
+ /* Clear AGP information */
+ if (dev->agp) {
+ drm_agp_mem_t *entry;
+ drm_agp_mem_t *nexte;
+
+ /* Remove AGP resources, but leave dev->agp
+ intact until cleanup is called. */
+ for (entry = dev->agp->memory; entry; entry = nexte) {
+ nexte = entry->next;
+ if (entry->bound) drm_unbind_agp(entry->memory);
+ drm_free_agp(entry->memory, entry->pages);
+ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ }
+ dev->agp->memory = NULL;
+
+ if (dev->agp->acquired && drm_agp.release)
+ (*drm_agp.release)();
+
+ dev->agp->acquired = 0;
+ dev->agp->enabled = 0;
+ }
+ /* Clear vma list (only built for debugging) */
+ if (dev->vmalist) {
+ for (vma = dev->vmalist; vma; vma = vma_next) {
+ vma_next = vma->next;
+ drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
+ }
+ dev->vmalist = NULL;
+ }
+
+ /* Clear map area and mtrr information */
+ if (dev->maplist) {
+ for (i = 0; i < dev->map_count; i++) {
+ map = dev->maplist[i];
+ switch (map->type) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#ifdef CONFIG_MTRR
+ if (map->mtrr >= 0) {
+ int retcode;
+ retcode = mtrr_del(map->mtrr,
+ map->offset,
+ map->size);
+ DRM_DEBUG("mtrr_del = %d\n", retcode);
+ }
+#endif
+ drm_ioremapfree(map->handle, map->size);
+ break;
+ case _DRM_SHM:
+ drm_free_pages((unsigned long)map->handle,
+ drm_order(map->size)
+ - PAGE_SHIFT,
+ DRM_MEM_SAREA);
+ break;
+ case _DRM_AGP:
+ break;
+ }
+ drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+ }
+ drm_free(dev->maplist,
+ dev->map_count * sizeof(*dev->maplist),
+ DRM_MEM_MAPS);
+ dev->maplist = NULL;
+ dev->map_count = 0;
+ }
+
+ if (dev->queuelist) {
+ for (i = 0; i < dev->queue_count; i++) {
+ drm_waitlist_destroy(&dev->queuelist[i]->waitlist);
+ if (dev->queuelist[i]) {
+ drm_free(dev->queuelist[i],
+ sizeof(*dev->queuelist[0]),
+ DRM_MEM_QUEUES);
+ dev->queuelist[i] = NULL;
+ }
+ }
+ drm_free(dev->queuelist,
+ dev->queue_slots * sizeof(*dev->queuelist),
+ DRM_MEM_QUEUES);
+ dev->queuelist = NULL;
+ }
+
+ drm_dma_takedown(dev);
+
+ dev->queue_count = 0;
+ if (dev->lock.hw_lock) {
+ dev->lock.hw_lock = NULL; /* SHM removed */
+ dev->lock.pid = 0;
+ wake_up_interruptible(&dev->lock.lock_queue);
+ }
+ up(&dev->struct_sem);
+
+ return 0;
+}
+
+/* mga_init is called via init_module at module load time, or via
+ * linux/init/main.c (this is not currently supported). */
+
+int mga_init(void)
+{
+ int retcode;
+ drm_device_t *dev = &mga_device;
+
+ DRM_DEBUG("\n");
+
+ memset((void *)dev, 0, sizeof(*dev));
+ dev->count_lock = SPIN_LOCK_UNLOCKED;
+ sema_init(&dev->struct_sem, 1);
+
+#ifdef MODULE
+ drm_parse_options(mga);
+#endif
+ DRM_DEBUG("doing misc_register\n");
+ if ((retcode = misc_register(&mga_misc))) {
+ DRM_ERROR("Cannot register \"%s\"\n", MGA_NAME);
+ return retcode;
+ }
+ dev->device = MKDEV(MISC_MAJOR, mga_misc.minor);
+ dev->name = MGA_NAME;
+
+ DRM_DEBUG("doing mem init\n");
+ drm_mem_init();
+ DRM_DEBUG("doing proc init\n");
+ drm_proc_init(dev);
+ DRM_DEBUG("doing agp init\n");
+ dev->agp = drm_agp_init();
+ DRM_DEBUG("doing ctxbitmap init\n");
+ if((retcode = drm_ctxbitmap_init(dev))) {
+ DRM_ERROR("Cannot allocate memory for context bitmap.\n");
+ drm_proc_cleanup();
+ misc_deregister(&mga_misc);
+ mga_takedown(dev);
+ return retcode;
+ }
+
+ DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+ MGA_NAME,
+ MGA_MAJOR,
+ MGA_MINOR,
+ MGA_PATCHLEVEL,
+ MGA_DATE,
+ mga_misc.minor);
+
+ return 0;
+}
+
+/* mga_cleanup is called via cleanup_module at module unload time. */
+
+void mga_cleanup(void)
+{
+ drm_device_t *dev = &mga_device;
+
+ DRM_DEBUG("\n");
+
+ drm_proc_cleanup();
+ if (misc_deregister(&mga_misc)) {
+ DRM_ERROR("Cannot unload module\n");
+ } else {
+ DRM_INFO("Module unloaded\n");
+ }
+ drm_ctxbitmap_cleanup(dev);
+ mga_dma_cleanup(dev);
+ mga_takedown(dev);
+ if (dev->agp) {
+ drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
+ dev->agp = NULL;
+ }
+}
+
+int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_version_t version;
+ int len;
+
+ copy_from_user_ret(&version,
+ (drm_version_t *)arg,
+ sizeof(version),
+ -EFAULT);
+
+#define DRM_COPY(name,value) \
+ len = strlen(value); \
+ if (len > name##_len) len = name##_len; \
+ name##_len = strlen(value); \
+ if (len && name) { \
+ copy_to_user_ret(name, value, len, -EFAULT); \
+ }
+
+ version.version_major = MGA_MAJOR;
+ version.version_minor = MGA_MINOR;
+ version.version_patchlevel = MGA_PATCHLEVEL;
+
+ DRM_COPY(version.name, MGA_NAME);
+ DRM_COPY(version.date, MGA_DATE);
+ DRM_COPY(version.desc, MGA_DESC);
+
+ copy_to_user_ret((drm_version_t *)arg,
+ &version,
+ sizeof(version),
+ -EFAULT);
+ return 0;
+}
+
+int mga_open(struct inode *inode, struct file *filp)
+{
+ drm_device_t *dev = &mga_device;
+ int retcode = 0;
+
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
+ if (!(retcode = drm_open_helper(inode, filp, dev))) {
+ MOD_INC_USE_COUNT;
+ atomic_inc(&dev->total_open);
+ spin_lock(&dev->count_lock);
+ if (!dev->open_count++) {
+ spin_unlock(&dev->count_lock);
+ return mga_setup(dev);
+ }
+ spin_unlock(&dev->count_lock);
+ }
+ return retcode;
+}
+
+int mga_release(struct inode *inode, struct file *filp)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode = 0;
+
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
+ if (!(retcode = drm_release(inode, filp))) {
+ MOD_DEC_USE_COUNT;
+ atomic_inc(&dev->total_close);
+ spin_lock(&dev->count_lock);
+ if (!--dev->open_count) {
+ if (atomic_read(&dev->ioctl_count) || dev->blocked) {
+ DRM_ERROR("Device busy: %d %d\n",
+ atomic_read(&dev->ioctl_count),
+ dev->blocked);
+ spin_unlock(&dev->count_lock);
+ return -EBUSY;
+ }
+ spin_unlock(&dev->count_lock);
+ return mga_takedown(dev);
+ }
+ spin_unlock(&dev->count_lock);
+ }
+ return retcode;
+}
+
+/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */
+
+int mga_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ int nr = DRM_IOCTL_NR(cmd);
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode = 0;
+ drm_ioctl_desc_t *ioctl;
+ drm_ioctl_t *func;
+
+ atomic_inc(&dev->ioctl_count);
+ atomic_inc(&dev->total_ioctl);
+ ++priv->ioctl_count;
+
+ DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
+ current->pid, cmd, nr, dev->device, priv->authenticated);
+
+ if (nr >= MGA_IOCTL_COUNT) {
+ retcode = -EINVAL;
+ } else {
+ ioctl = &mga_ioctls[nr];
+ func = ioctl->func;
+
+ if (!func) {
+ DRM_DEBUG("no function\n");
+ retcode = -EINVAL;
+ } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN))
+ || (ioctl->auth_needed && !priv->authenticated)) {
+ retcode = -EACCES;
+ } else {
+ retcode = (func)(inode, filp, cmd, arg);
+ }
+ }
+
+ atomic_dec(&dev->ioctl_count);
+ return retcode;
+}
+
+int mga_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_lock_t lock;
+
+ copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+
+ if (lock.context == DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Process %d using kernel context %d\n",
+ current->pid, lock.context);
+ return -EINVAL;
+ }
+
+ DRM_DEBUG("%d frees lock (%d holds)\n",
+ lock.context,
+ _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+ atomic_inc(&dev->total_unlocks);
+ if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock))
+ atomic_inc(&dev->total_contends);
+ drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+ mga_dma_schedule(dev, 1);
+
+ if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("\n");
+ }
+
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h
new file mode 100644
index 000000000..bc7808b0a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h
@@ -0,0 +1,292 @@
+/* mga_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*-
+ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Jeff Hartmann <jhartmann@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h,v 1.1 2000/02/11 17:26:08 dawes Exp $
+ */
+
+#ifndef _MGA_DRV_H_
+#define _MGA_DRV_H_
+#include "mga_drm_public.h"
+
+typedef struct _drm_mga_private {
+ int reserved_map_idx;
+ int buffer_map_idx;
+ drm_mga_sarea_t *sarea_priv;
+ int primary_size;
+ int warp_ucode_size;
+ int chipset;
+ int fbOffset;
+ int backOffset;
+ int depthOffset;
+ int textureOffset;
+ int textureSize;
+ int cpp;
+ int stride;
+ int sgram;
+ int use_agp;
+ mgaWarpIndex WarpIndex[MGA_MAX_G400_PIPES];
+ __volatile__ unsigned long softrap_age;
+ atomic_t dispatch_lock;
+ atomic_t pending_bufs;
+ void *ioremap;
+ u32 *prim_head;
+ u32 *current_dma_ptr;
+ u32 prim_phys_head;
+ int prim_num_dwords;
+ int prim_max_dwords;
+
+
+ /* Some validated register values:
+ */
+ u32 frontOrg;
+ u32 backOrg;
+ u32 depthOrg;
+ u32 mAccess;
+
+} drm_mga_private_t;
+
+ /* mga_drv.c */
+extern int mga_init(void);
+extern void mga_cleanup(void);
+extern int mga_version(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_open(struct inode *inode, struct file *filp);
+extern int mga_release(struct inode *inode, struct file *filp);
+extern int mga_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_unlock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+ /* mga_dma.c */
+extern int mga_dma_schedule(drm_device_t *dev, int locked);
+extern int mga_dma(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_irq_install(drm_device_t *dev, int irq);
+extern int mga_irq_uninstall(drm_device_t *dev);
+extern int mga_control(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_lock(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+#if 0
+extern void mga_dma_init(drm_device_t *dev);
+extern void mga_dma_cleanup(drm_device_t *dev);
+
+#endif
+extern int mga_dma_init(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_dma_cleanup(drm_device_t *dev);
+
+/* mga_dma_init does init and release */
+
+
+ /* mga_bufs.c */
+extern int mga_addbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_infobufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_markbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_freebufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_mapbufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_addmap(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+ /* mga_state.c */
+extern int mga_clear_bufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_swap_bufs(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_iload(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+ /* mga_context.c */
+extern int mga_resctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_addctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_modctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_getctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_switchctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_newctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int mga_rmctx(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+extern int mga_context_switch(drm_device_t *dev, int old, int new);
+extern int mga_context_switch_complete(drm_device_t *dev, int new);
+
+
+
+#define MGAREG_MGA_EXEC 0x0100
+#define MGAREG_AGP_PLL 0x1e4c
+#define MGAREG_ALPHACTRL 0x2c7c
+#define MGAREG_ALPHASTART 0x2c70
+#define MGAREG_ALPHAXINC 0x2c74
+#define MGAREG_ALPHAYINC 0x2c78
+#define MGAREG_AR0 0x1c60
+#define MGAREG_AR1 0x1c64
+#define MGAREG_AR2 0x1c68
+#define MGAREG_AR3 0x1c6c
+#define MGAREG_AR4 0x1c70
+#define MGAREG_AR5 0x1c74
+#define MGAREG_AR6 0x1c78
+#define MGAREG_BCOL 0x1c20
+#define MGAREG_CXBNDRY 0x1c80
+#define MGAREG_CXLEFT 0x1ca0
+#define MGAREG_CXRIGHT 0x1ca4
+#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 MGAREG_DWG_INDIR_WT 0x1e80
+#define MGAREG_DWGCTL 0x1c00
+#define MGAREG_DWGSYNC 0x2c4c
+#define MGAREG_FCOL 0x1c24
+#define MGAREG_FIFOSTATUS 0x1e10
+#define MGAREG_FOGCOL 0x1cf4
+#define MGAREG_FOGSTART 0x1cc4
+#define MGAREG_FOGXINC 0x1cd4
+#define MGAREG_FOGYINC 0x1ce4
+#define MGAREG_FXBNDRY 0x1c84
+#define MGAREG_FXLEFT 0x1ca8
+#define MGAREG_FXRIGHT 0x1cac
+#define MGAREG_ICLEAR 0x1e18
+#define MGAREG_IEN 0x1e1c
+#define MGAREG_LEN 0x1c5c
+#define MGAREG_MACCESS 0x1c04
+#define MGAREG_MCTLWTST 0x1c08
+#define MGAREG_MEMRDBK 0x1e44
+#define MGAREG_OPMODE 0x1e54
+#define MGAREG_PAT0 0x1c10
+#define MGAREG_PAT1 0x1c14
+#define MGAREG_PITCH 0x1c8c
+#define MGAREG_PLNWT 0x1c1c
+#define MGAREG_PRIMADDRESS 0x1e58
+#define MGAREG_PRIMEND 0x1e5c
+#define MGAREG_PRIMPTR 0x1e50
+#define MGAREG_RST 0x1e40
+#define MGAREG_SECADDRESS 0x2c40
+#define MGAREG_SECEND 0x2c44
+#define MGAREG_SETUPADDRESS 0x2cd0
+#define MGAREG_SETUPEND 0x2cd4
+#define MGAREG_SGN 0x1c58
+#define MGAREG_SHIFT 0x1c50
+#define MGAREG_SOFTRAP 0x2c48
+#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 MGAREG_STATUS 0x1e14
+#define MGAREG_STENCIL 0x2cc8
+#define MGAREG_STENCILCTL 0x2ccc
+#define MGAREG_TDUALSTAGE0 0x2cf8
+#define MGAREG_TDUALSTAGE1 0x2cfc
+#define MGAREG_TEST0 0x1e48
+#define MGAREG_TEXBORDERCOL 0x2c5c
+#define MGAREG_TEXCTL 0x2c30
+#define MGAREG_TEXCTL2 0x2c3c
+#define MGAREG_TEXFILTER 0x2c58
+#define MGAREG_TEXHEIGHT 0x2c2c
+#define MGAREG_TEXORG 0x2c24
+#define MGAREG_TEXORG1 0x2ca4
+#define MGAREG_TEXORG2 0x2ca8
+#define MGAREG_TEXORG3 0x2cac
+#define MGAREG_TEXORG4 0x2cb0
+#define MGAREG_TEXTRANS 0x2c34
+#define MGAREG_TEXTRANSHIGH 0x2c38
+#define MGAREG_TEXWIDTH 0x2c28
+#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 MGAREG_WCODEADDR 0x1e6c
+#define MGAREG_WFLAG 0x1dc4
+#define MGAREG_WFLAG1 0x1de0
+#define MGAREG_WFLAGNB 0x1e64
+#define MGAREG_WFLAGNB1 0x1e08
+#define MGAREG_WGETMSB 0x1dc8
+#define MGAREG_WIADDR 0x1dc0
+#define MGAREG_WIADDR2 0x1dd8
+#define MGAREG_WIADDRNB 0x1e60
+#define MGAREG_WIADDRNB1 0x1e04
+#define MGAREG_WIADDRNB2 0x1e00
+#define MGAREG_WIMEMADDR 0x1e68
+#define MGAREG_WIMEMDATA 0x2000
+#define MGAREG_WIMEMDATA1 0x2100
+#define MGAREG_WMISC 0x1e70
+#define MGAREG_WR 0x2d00
+#define MGAREG_WVRTXSZ 0x1dcc
+#define MGAREG_XDST 0x1cb0
+#define MGAREG_XYEND 0x1c44
+#define MGAREG_XYSTRT 0x1c40
+#define MGAREG_YBOT 0x1c9c
+#define MGAREG_YDST 0x1c90
+#define MGAREG_YDSTLEN 0x1c88
+#define MGAREG_YDSTORG 0x1c94
+#define MGAREG_YTOP 0x1c98
+#define MGAREG_ZORG 0x1c0c
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c
new file mode 100644
index 000000000..d09881bad
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c
@@ -0,0 +1,362 @@
+/* mga_state.c -- State support for mga g200/g400 -*- linux-c -*-
+ * Created: Thu Jan 27 02:53:43 2000 by jhartmann@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.
+ *
+ * Authors: Jeff Hartmann <jhartmann@precisioninsight.com>
+ * Keith Whitwell <keithw@precisioninsight.com>
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c,v 1.1 2000/02/11 17:26:08 dawes Exp $
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "mga_drv.h"
+#include "mgareg_flags.h"
+#include "mga_dma.h"
+#include "mga_state.h"
+#include "drm.h"
+
+void mgaEmitClipRect( drm_mga_private_t *dev_priv, xf86drmClipRectRec *box )
+{
+ PRIMLOCALS;
+
+ PRIMGETPTR( dev_priv );
+
+ /* The G400 seems to have an issue with the second WARP not
+ * stalling clipper register writes. This bothers me, but the only
+ * way I could get it to never clip the last triangle under any
+ * circumstances is by inserting TWO dwgsync commands.
+ */
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
+ PRIMOUTREG( MGAREG_DWGSYNC, 0 );
+ PRIMOUTREG( MGAREG_DWGSYNC, 0 );
+ }
+
+ PRIMOUTREG( MGAREG_CXBNDRY, ((box->x2)<<16)|(box->x1) );
+ PRIMOUTREG( MGAREG_YTOP, box->y1 * dev_priv->stride );
+ PRIMOUTREG( MGAREG_YBOT, box->y2 * dev_priv->stride );
+ PRIMADVANCE( dev_priv );
+}
+
+
+static void mgaEmitContext(drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv)
+{
+ unsigned int *regs = buf_priv->ContextState;
+ PRIMLOCALS;
+
+ PRIMGETPTR( dev_priv );
+ PRIMOUTREG( MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG] );
+ PRIMOUTREG( MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS] );
+ PRIMOUTREG( MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT] );
+ PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] );
+ PRIMOUTREG( MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL] );
+ PRIMOUTREG( MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR] );
+ PRIMOUTREG( MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG] );
+
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
+ PRIMOUTREG( MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG] );
+ PRIMOUTREG( MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0] );
+ PRIMOUTREG( MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1] );
+ }
+
+ PRIMADVANCE( dev_priv );
+}
+
+static void mgaG200EmitTex( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv )
+{
+ unsigned int *regs = buf_priv->TexState[0];
+ PRIMLOCALS;
+
+ PRIMGETPTR( dev_priv );
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
+
+ PRIMOUTREG(0x2d00 + 24*4, regs[MGA_TEXREG_WIDTH] );
+ PRIMOUTREG(0x2d00 + 34*4, regs[MGA_TEXREG_HEIGHT] );
+
+ PRIMADVANCE( dev_priv );
+}
+
+static void mgaG400EmitTex0( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv )
+{
+ unsigned int *regs = buf_priv->TexState[0];
+ int multitex = buf_priv->WarpPipe & MGA_T2;
+
+ PRIMLOCALS;
+ PRIMGETPTR( dev_priv );
+
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
+
+ PRIMOUTREG(0x2d00 + 49*4, 0);
+ PRIMOUTREG(0x2d00 + 57*4, 0);
+ PRIMOUTREG(0x2d00 + 53*4, 0);
+ PRIMOUTREG(0x2d00 + 61*4, 0);
+
+ if (!multitex) {
+ PRIMOUTREG(0x2d00 + 52*4, 0x40 );
+ PRIMOUTREG(0x2d00 + 60*4, 0x40 );
+ }
+
+ PRIMOUTREG(0x2d00 + 54*4, regs[MGA_TEXREG_WIDTH] | 0x40 );
+ PRIMOUTREG(0x2d00 + 62*4, regs[MGA_TEXREG_HEIGHT] | 0x40 );
+
+ PRIMADVANCE( dev_priv );
+}
+
+#define TMC_map1_enable 0x80000000
+
+
+static void mgaG400EmitTex1( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int *regs = sarea_priv->TexState[1];
+
+ PRIMLOCALS;
+ PRIMGETPTR(dev_priv);
+
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | TMC_map1_enable);
+ PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] );
+ PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] );
+ PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] );
+ PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG] );
+ PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] );
+ PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] );
+ PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] );
+ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] );
+ PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] );
+ PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] );
+
+ PRIMOUTREG(0x2d00 + 49*4, 0);
+ PRIMOUTREG(0x2d00 + 57*4, 0);
+ PRIMOUTREG(0x2d00 + 53*4, 0);
+ PRIMOUTREG(0x2d00 + 61*4, 0);
+
+ PRIMOUTREG(0x2d00 + 52*4, regs[MGA_TEXREG_WIDTH] | 0x40 );
+ PRIMOUTREG(0x2d00 + 60*4, regs[MGA_TEXREG_HEIGHT] | 0x40 );
+
+ PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] );
+
+ PRIMADVANCE( dev_priv );
+}
+
+
+static void mgaG400EmitPipe(drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv)
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int pipe = sarea_priv->WarpPipe;
+ float fParam = 12800.0f;
+ PRIMLOCALS;
+
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend);
+
+ /* Establish vertex size.
+ */
+ if (pipe & MGA_T2) {
+ PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000);
+ } else {
+ PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807);
+ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000);
+ }
+
+ PRIMOUTREG(MGAREG_WFLAG, 0);
+ PRIMOUTREG(MGAREG_WFLAG1, 0);
+
+ PRIMOUTREG(0x2d00 + 56*4, *((u32 *)(&fParam)));
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
+ PRIMOUTREG(0x2d00 + 49*4, 0); /* Tex stage 0 */
+ PRIMOUTREG(0x2d00 + 57*4, 0); /* Tex stage 0 */
+ PRIMOUTREG(0x2d00 + 53*4, 0); /* Tex stage 1 */
+ PRIMOUTREG(0x2d00 + 61*4, 0); /* Tex stage 1 */
+
+ PRIMOUTREG(0x2d00 + 54*4, 0x40); /* Tex stage 0 : w */
+ PRIMOUTREG(0x2d00 + 62*4, 0x40); /* Tex stage 0 : h */
+ PRIMOUTREG(0x2d00 + 52*4, 0x40); /* Tex stage 1 : w */
+ PRIMOUTREG(0x2d00 + 60*4, 0x40); /* Tex stage 1 : h */
+
+ /* Dma pading required due to hw bug */
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_WIADDR2, (dev_priv->WarpIndex[pipe].phys_addr |
+ WIA_wmode_start | WIA_wagp_agp));
+ PRIMADVANCE(dev_priv);
+}
+
+static void mgaG200EmitPipe( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int pipe = sarea_priv->WarpPipe;
+ PRIMLOCALS;
+
+ PRIMGETPTR(dev_priv);
+ PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend);
+ PRIMOUTREG(MGAREG_WVRTXSZ, 7);
+ PRIMOUTREG(MGAREG_WFLAG, 0);
+ PRIMOUTREG(0x2d00 + 24*4, 0); /* tex w/h */
+
+ PRIMOUTREG(0x2d00 + 25*4, 0x100);
+ PRIMOUTREG(0x2d00 + 34*4, 0); /* tex w/h */
+ PRIMOUTREG(0x2d00 + 42*4, 0xFFFF);
+ PRIMOUTREG(0x2d00 + 60*4, 0xFFFF);
+
+ /* Dma pading required due to hw bug */
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
+ PRIMOUTREG(MGAREG_WIADDR, (dev_priv->WarpIndex[pipe].phys_addr |
+ WIA_wmode_start | WIA_wagp_agp));
+
+ PRIMADVANCE(dev_priv);
+}
+
+void mgaEmitState( drm_mga_private_t *dev_priv, drm_mga_buf_priv_t *buf_priv )
+{
+ unsigned int dirty = buf_priv->dirty;
+
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
+ if (dirty & MGASAREA_NEW_CONTEXT)
+ mgaEmitContext( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_TEX1)
+ mgaG400EmitTex1( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_TEX0)
+ mgaG400EmitTex0( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_PIPE)
+ mgaG400EmitPipe( dev_priv, buf_priv );
+ } else {
+ if (dirty & MGASAREA_NEW_CONTEXT)
+ mgaEmitContext( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_TEX0)
+ mgaG200EmitTex( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_PIPE)
+ mgaG200EmitPipe( dev_priv, buf_priv );
+ }
+}
+
+
+
+/* Disallow all write destinations except the front and backbuffer.
+ */
+static int mgaCopyContext(drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv)
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int *regs = sarea_priv->ContextState;
+
+ if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOrg &&
+ regs[MGA_CTXREG_DSTORG] != dev_priv->backOrg)
+ return -1;
+
+ memcpy(buf_priv->ContextState, sarea_priv->ContextState,
+ sizeof(buf_priv->ContextState));
+ return 0;
+}
+
+
+/* Disallow texture reads from PCI space.
+ */
+static int mgaCopyTex(drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv,
+ int unit)
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+
+ if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1)
+ return -1;
+
+ memcpy(buf_priv->TexState[unit], sarea_priv->TexState[unit],
+ sizeof(buf_priv->TexState[0]));
+
+ return 0;
+}
+
+
+int mgaCopyAndVerifyState( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int dirty = sarea_priv->dirty ;
+ int rv = 0;
+
+ buf_priv->dirty = sarea_priv->dirty;
+ buf_priv->WarpPipe = sarea_priv->WarpPipe;
+
+ if (dirty & MGASAREA_NEW_CONTEXT)
+ rv |= mgaCopyContext( dev_priv, buf_priv );
+
+ if (dirty & MGASAREA_NEW_TEX0)
+ rv |= mgaCopyTex( dev_priv, buf_priv, 0 );
+
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400)
+ {
+ if (dirty & MGASAREA_NEW_TEX1)
+ rv |= mgaCopyTex( dev_priv, buf_priv, 1 );
+
+ if (dirty & MGASAREA_NEW_PIPE)
+ rv |= (buf_priv->WarpPipe > MGA_MAX_G400_PIPES);
+ }
+ else
+ {
+ if (dirty & MGASAREA_NEW_PIPE)
+ rv |= (buf_priv->WarpPipe > MGA_MAX_G200_PIPES);
+ }
+
+ return rv == 0;
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.h
new file mode 100644
index 000000000..e7b952e0c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.h
@@ -0,0 +1,13 @@
+#ifndef MGA_STATE_H
+#define MGA_STATE_H
+
+#include "mga_drv.h"
+
+int mgaCopyAndVerifyState( drm_mga_private_t *dev_priv,
+ drm_mga_buf_priv_t *buf_priv );
+
+void mgaEmitClipRect( drm_mga_private_t *dev_priv, xf86drmClipRectRec *box );
+
+void mgaEmitState( drm_mga_private_t *dev_priv, drm_mga_buf_priv_t *buf_priv );
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mgareg_flags.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mgareg_flags.h
new file mode 100644
index 000000000..901f18310
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mgareg_flags.h
@@ -0,0 +1,930 @@
+/* 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.
+ */
+
+#ifndef _MGAREGS_H_
+#define _MGAREGS_H_
+
+/*************** (START) AUTOMATICLY GENERATED REGISTER FILE *****************/
+/*
+ * Generated on Sat Nov 20 21:25:36 CST 1999
+ */
+
+
+
+/*
+ * Power Graphic Mode Memory Space Registers
+ */
+
+ #define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */
+ #define AGP_PLL_agp2xpllen_disable 0x0
+ #define AGP_PLL_agp2xpllen_enable 0x1
+
+ #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 AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR0_ar0_SHIFT 0
+
+ #define AR1_ar1_MASK 0xff000000 /* bits 0-23 */
+ #define AR1_ar1_SHIFT 0
+
+ #define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR2_ar2_SHIFT 0
+
+ #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 AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR4_ar4_SHIFT 0
+
+ #define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR5_ar5_SHIFT 0
+
+ #define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */
+ #define AR6_ar6_SHIFT 0
+
+ #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 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 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 BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */
+ #define BHISF_beshiscal_SHIFT 2
+
+ #define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */
+ #define BHSE_beshsrcend_SHIFT 2
+
+ #define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */
+ #define BHSL_beshsrclst_SHIFT 16
+
+ #define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */
+ #define BHSS_beshsrcst_SHIFT 2
+
+ #define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */
+ #define BP_bespitch_SHIFT 0
+
+ #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 BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */
+ #define BSF_besv1srclast_SHIFT 0
+
+ #define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */
+ #define BSF_besv2srclst_SHIFT 0
+
+ #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 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 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 BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */
+ #define BVISF_besviscal_SHIFT 2
+
+ #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 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 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 DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */
+ #define DS_dwgsyncaddr_SHIFT 2
+
+ #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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 SETDCA_setupmod_MASK 0xfffffffc /* bits 0-1 */
+ #define SETDCA_setupmod_vertlist 0x0 /* val 0, shift 0 */
+ #define SETDCA_setupaddress_MASK 0x3 /* bits 2-31 */
+ #define SETDCA_setupaddress_SHIFT 2
+
+ #define SETDEA_setupagpxfer_MASK 0xfffffffd /* bit 1 */
+ #define SETDEA_setupagpxfer_disable 0x0
+ #define SETDEA_setupagpxfer_enable 0x2
+ #define SETDEA_setupend_MASK 0x3 /* bits 2-31 */
+ #define SETDEA_setupend_SHIFT 2
+
+ #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 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 STH_softraphand_MASK 0x3 /* bits 2-31 */
+ #define STH_softraphand_SHIFT 2
+
+ #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 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 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 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 TD1_color1arg2selMASK 0xfffffffc /* bits 0-1 */
+ #define TD1_color1alphaselMASK 0xffffffe3 /* bits 2-4 */
+ #define TD1_color1alphaselSHIFT 2
+ #define TD1_color1arg1alphaMASK 0xffffffdf /* bit 5 */
+ #define TD1_color1arg1alphadisable 0x0
+ #define TD1_color1arg1alphaenable 0x20
+ #define TD1_color1arg1invMASK 0xffffffbf /* bit 6 */
+ #define TD1_color1arg1invdisable 0x0
+ #define TD1_color1arg1invenable 0x40
+ #define TD1_color1arg2alphaMASK 0xffffff7f /* bit 7 */
+ #define TD1_color1arg2alphadisable 0x0
+ #define TD1_color1arg2alphaenable 0x80
+ #define TD1_color1arg2invMASK 0xfffffeff /* bit 8 */
+ #define TD1_color1arg2invdisable 0x0
+ #define TD1_color1arg2invenable 0x100
+ #define TD1_color1alpha1invMASK 0xfffffdff /* bit 9 */
+ #define TD1_color1alpha1invdisable 0x0
+ #define TD1_color1alpha1invenable 0x200
+ #define TD1_color1alpha2invMASK 0xfffffbff /* bit 10 */
+ #define TD1_color1alpha2invdisable 0x0
+ #define TD1_color1alpha2invenable 0x400
+ #define TD1_color1selMASK 0xff9fffff /* bits 21-22 */
+ #define TD1_color1selarg1 0x0 /* val 0, shift 21 */
+ #define TD1_color1selarg2 0x200000 /* val 1, shift 21 */
+ #define TD1_color1seladd 0x400000 /* val 2, shift 21 */
+ #define TD1_color1selmul 0x600000 /* val 3, shift 21 */
+ #define TD1_alpha1selMASK 0x3fffffff /* bits 30-31 */
+ #define TD1_alpha1selarg1 0x0 /* val 0, shift 30 */
+ #define TD1_alpha1selarg2 0x40000000 /* val 1, shift 30 */
+ #define TD1_alpha1seladd 0x80000000 /* val 2, shift 30 */
+ #define TD1_alpha1selmul 0xc0000000 /* val 3, shift 30 */
+
+ #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 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_tw422 0xa /* val 10, 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 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 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_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 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 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_texorg_MASK 0x1f /* bits 5-31 */
+ #define TO_texorg_SHIFT 5
+
+ #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 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 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 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 WMA_wcodeaddr_MASK 0xff /* bits 8-31 */
+ #define WMA_wcodeaddr_SHIFT 8
+
+ #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 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 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 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 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 WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */
+ #define WIMA_wimemaddr_SHIFT 0
+
+ #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 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 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 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 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 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 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 ******************/
+
+#endif /* _MGAREGS_H_ */
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
index f946bdcc7..ec0ebeeb9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
@@ -1,6 +1,6 @@
/* proc.c -- /proc support for DRM -*- linux-c -*-
* Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 09:44:16 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:41:04 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.5 2000/02/14 06:27:28 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
index 769d7adfc..61c917eb4 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI$
- * $XFree86$
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c,v 1.2 2000/01/20 07:25:36 martin Exp $
*
*/
@@ -53,7 +53,7 @@ static struct file_operations tdfx_fops = {
mmap: drm_mmap,
read: drm_read,
fasync: drm_fasync,
- poll: drm_poll
+ poll: drm_poll,
};
static struct miscdevice tdfx_misc = {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
index d649a6e75..5c272eb6c 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
@@ -1,6 +1,6 @@
/* vm.c -- Memory mapping for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:54:35 1999 by faith@precisioninsight.com
+ * Revised: Mon Feb 14 00:16:45 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.4 2000/02/14 06:27:28 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
index fd0c75a7f..25423009a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
@@ -1,6 +1,6 @@
/* xf86drm.c -- User-level interface to DRM device
* Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com
- * Revised: Thu Jan 6 10:32:25 2000 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:43:32 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,7 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.6 1999/12/14 01:33:54 robin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.9 2000/02/14 06:27:24 martin Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile
index db16ff46d..ddc9bff0f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.6 1999/12/13 01:39:53 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.9 2000/02/15 02:00:15 eich Exp $
#define IHaveModules
@@ -7,18 +7,20 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,
SRCS1 = pci.c xf86int10module.c helper_exec.c helper_mem.c xf86int10.c
OBJS1 = pci.o xf86int10module.o helper_exec.o helper_mem.o xf86int10.o
-LinkSourceFile(helper_mem.c,../../int10)
-LinkSourceFile(helper_exec.c,../../int10)
-LinkSourceFile(xf86int10.c,../../int10)
-LinkSourceFile(pci.c,../../int10)
-LinkSourceFile(xf86int10module.c,../../int10)
-LinkSourceFile(xf86x86emu.c,../../int10)
-LinkSourceFile(generic.c,../../int10)
-LinkSourceFile(stub.c,../../int10)
+LinkSourceFile(helper_mem.c,$(XF86SRC)/int10)
+LinkSourceFile(helper_exec.c,$(XF86SRC)/int10)
+LinkSourceFile(xf86int10.c,$(XF86SRC)/int10)
+LinkSourceFile(pci.c,$(XF86SRC)/int10)
+LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10)
+LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10)
+LinkSourceFile(generic.c,$(XF86SRC)/int10)
-INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC)/int10 \
+INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \
-I$(XF86OSSRC) \
- -I$(SERVERSRC)/include -I$(XINCLUDESRC)
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC)
+
+DEFINES=-DHAVE_SYSV_IPC
+
#if 0
/* debugging stuff */
#DEFINES =-D_PC
@@ -31,43 +33,64 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC)/int10 \
DEFINES =-D_PC
#endif
-#if defined(X86EMU_LIBPATH) && (XF86INT10_BUILD == X86EMU_GENERIC)
+/* XXX keep this temporarily for reference */
+#if 0
+#if (XF86INT10_BUILD == X86EMU_GENERIC)
SRCS = $(SRCS1) xf86x86emu.c generic.c
OBJS = $(OBJS1) xf86x86emu.o generic.o x86emu.o
SpecialObjectRule(pci.o, pci.c, -D_X86EMU)
SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU)
-SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU)
+SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES)
SpecialObjectRule(generic.o, generic.c, -D_X86EMU)
SpecialObjectRule(xf86x86emu.o, xf86x86emu.c, -D_X86EMU)
BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu)
+#endif
+#endif
-#elif defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM)
+#if defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM)
SRCS = $(SRCS1) linux.c
OBJS = $(OBJS1) linux.o
SpecialObjectRule(pci.o, pci.c, -D_VM86_LINUX)
SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX)
-SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX)
-SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX)
+SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES)
+SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX -DHAVE_SYSV_IPC)
-#elif defined(X86EMU_LIBPATH) && (XF86INT10_BUILD == X86EMU_OS)
+#elif (XF86INT10_BUILD == X86EMU_OS)
-SRCS = $(SRCS1) xf86x86emu.c linux.c
-OBJS = $(OBJS1) xf86x86emu.o linux.o x86emu.o
SpecialObjectRule(pci.o, pci.c, -D_X86EMU)
SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU)
-SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU)
-SpecialObjectRule(linux.o, linux.c, -D_X86EMU)
+SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES)
+SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC)
+
+X86TOPDIR = $(TOP)/extras/x86emu
+X86SRCDIR = $(X86TOPDIR)/src/x86emu
+X86EMUINCLUDES = -I$(X86TOPDIR)/include -I$(X86SRCDIR)
+
+# if !defined(X86EMU_LIBPATH)
+X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c
+X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o
+
+LinkSourceFile(debug.c,$(X86SRCDIR))
+LinkSourceFile(decode.c,$(X86SRCDIR))
+LinkSourceFile(fpu.c,$(X86SRCDIR))
+LinkSourceFile(ops.c,$(X86SRCDIR))
+LinkSourceFile(ops2.c,$(X86SRCDIR))
+LinkSourceFile(prim_ops.c,$(X86SRCDIR))
+LinkSourceFile(sys.c,$(X86SRCDIR))
+# else
BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu)
+X86EMUOBJS = x86emu.o
+# endif
-#else
-
-SRCS = stub.c
-OBJS = stub.o
+SRCS = $(SRCS1) xf86x86emu.c linux.c $(X86EMUSRCS)
+OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS)
#endif
+#if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC
+
LibraryModuleTarget(int10, $(OBJS))
InstallLibraryModule(int10,$(MODULEDIR),linux)
@@ -77,13 +100,11 @@ all::
RemoveFile(LibraryTargetName(int10)); \
$(LN) linux/int10/LibraryTargetName(int10) . )
-DependTarget()
-
InstallDriverSDKLibraryModule(int10,$(DRIVERSDKMODULEDIR),.)
InstallDriverSDKNonExecFile(../../int10/xf86int10.h,$(DRIVERSDKINCLUDEDIR))
+#endif
-
-
+DependTarget()
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/defines.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/defines.h
deleted file mode 100644
index 4d942b199..000000000
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/defines.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/defines.h,v 1.4 1999/12/03 19:17:43 eich Exp $ */
-#ifdef _VM86_LINUX
-
-#include <asm/vm86.h>
-
-#define CPU_R(type,name) \
- (*((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name)))
-#define CPU_RD(name) CPU_R(CARD32,name)
-#define CPU_RW(name) CPU_R(CARD16,name)
-#define CPU_RB(name) CPU_R(CARD8,name)
-
-#define X86_EAX CPU_RD(eax)
-#define X86_EBX CPU_RD(ebx)
-#define X86_ECX CPU_RD(ecx)
-#define X86_EDX CPU_RD(edx)
-#define X86_ESI CPU_RD(esi)
-#define X86_EDI CPU_RD(edi)
-#define X86_EBP CPU_RD(ebp)
-#define X86_EIP CPU_RD(eip)
-#define X86_ESP CPU_RD(esp)
-#define X86_EFLAGS CPU_RD(eflags)
-
-#define X86_FLAGS CPU_RW(eflags)
-#define X86_AX CPU_RW(eax)
-#define X86_BX CPU_RW(ebx)
-#define X86_CX CPU_RW(ecx)
-#define X86_DX CPU_RW(edx)
-#define X86_SI CPU_RW(esi)
-#define X86_DI CPU_RW(edi)
-#define X86_BP CPU_RW(ebp)
-#define X86_IP CPU_RW(eip)
-#define X86_SP CPU_RW(esp)
-#define X86_CS CPU_RW(cs)
-#define X86_DS CPU_RW(ds)
-#define X86_ES CPU_RW(es)
-#define X86_SS CPU_RW(ss)
-#define X86_FS CPU_RW(fs)
-#define X86_GS CPU_RW(gs)
-
-#define X86_AL CPU_RB(eax)
-#define X86_BL CPU_RB(ebx)
-#define X86_CL CPU_RB(ecx)
-#define X86_DL CPU_RB(edx)
-
-#elif defined(_X86EMU)
-
-#include "xf86x86emu.h"
-
-#endif
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
index 81c49f916..b4a122772 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.4 1999/12/03 19:17:43 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.7 2000/02/08 17:19:23 dawes Exp $ */
/*
* linux specific part of the int10 module
* Copyright 1999 Egbert Eich
@@ -11,7 +11,7 @@
#include "compiler.h"
#define _INT10_PRIVATE
#include "xf86int10.h"
-#include "defines.h"
+#include "int10Defines.h"
#define DEV_MEM "/dev/mem"
#ifndef XFree86LOADER
#include <sys/mman.h>
@@ -19,10 +19,11 @@
#define MAP_FAILED ((void *)-1)
#endif
#endif
-static int base_addr = 0x100000;
#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
#define REG pInt
+static int counter = 0;
+
static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
@@ -40,8 +41,10 @@ int10MemRec linuxMem = {
};
typedef struct {
- int base;
- void* vidMem;
+ int lowMem;
+ int highMem;
+ char* base;
+ char* base_high;
int screen;
char* alloc;
} linuxInt10Priv;
@@ -49,10 +52,15 @@ typedef struct {
xf86Int10InfoPtr
xf86InitInt10(int entityIndex)
{
- xf86Int10InfoPtr pInt;
+ xf86Int10InfoPtr pInt = NULL;
int screen;
int fd;
- void* vidMem;
+ static void* vidMem = NULL;
+ static void* sysMem = NULL;
+ int low_mem;
+ int high_mem;
+ char *base;
+ char *base_high;
int pagesize;
int alloc_entries;
legacyVGARec vga;
@@ -60,8 +68,44 @@ xf86InitInt10(int entityIndex)
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
if (int10skip(xf86Screens[screen],entityIndex))
return NULL;
- vidMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,V_RAM,VRAM_SIZE);
+
+ if ((!vidMem) || (!sysMem)) {
+ if ((fd = open(DEV_MEM,O_RDWR,0)) >= 0) {
+ if (!sysMem) {
+#ifdef DEBUG
+ ErrorF("Mapping sys bios area\n");
+#endif
+ if ((sysMem = mmap((void *)(SYS_BIOS),BIOS_SIZE,PROT_READ
+ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED,fd, SYS_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot map SYS BIOS\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ if (!vidMem) {
+#ifdef DEBUG
+ ErrorF("Mapping VRAM area\n");
+#endif
+ if ((vidMem = mmap((void *)(V_RAM),VRAM_SIZE,PROT_READ
+ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED,fd, V_RAM))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot map V_RAM\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ close(fd);
+ } else {
+ xf86DrvMsg(screen,X_ERROR,"Cannot open %s\n",DEV_MEM);
+ goto error0;
+ }
+ }
+
pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec));
+ pInt->scrnIndex = screen;
pInt->entityIndex = entityIndex;
if (!xf86Int10ExecSetup(pInt))
goto error0;
@@ -69,97 +113,80 @@ xf86InitInt10(int entityIndex)
pagesize = getpagesize();
alloc_entries = ALLOC_ENTRIES(pagesize);
pInt->private = (pointer)xnfcalloc(1,sizeof(linuxInt10Priv));
- ((linuxInt10Priv*)pInt->private)->base = base_addr;
- ((linuxInt10Priv*)pInt->private)->vidMem = vidMem;
((linuxInt10Priv*)pInt->private)->screen = screen;
((linuxInt10Priv*)pInt->private)->alloc =
(pointer)xnfcalloc(1,sizeof(ALLOC_ENTRIES(pagesize)));
#ifdef DEBUG
- ErrorF("Mapping 1 M area\n");
+ ErrorF("Mapping high memory area\n");
#endif
- if ((fd = open("/dev/zero",O_RDWR,0)) < 0
- || mmap((void *)base_addr, SYS_SIZE, PROT_READ | PROT_WRITE
- | PROT_EXEC, MAP_PRIVATE | MAP_FIXED, fd, 0)
- == MAP_FAILED) {
- xf86Msg(X_ERROR,"Cannot map 1 M area\n");
- close(fd);
+ if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
+ IPC_CREAT | SHM_R | SHM_W)) == -1)
goto error1;
- }
- close(fd);
+ ((linuxInt10Priv*)pInt->private)->highMem = high_mem;
#ifdef DEBUG
- ErrorF("Mapping sys bios area\n");
+ ErrorF("Mapping 640kB area\n");
#endif
- if ((fd = open(DEV_MEM,O_RDWR,0)) < 0
- || mmap((void *)(base_addr + SYS_BIOS),BIOS_SIZE,PROT_READ
- | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED,
- fd, SYS_BIOS) == MAP_FAILED) {
- xf86Msg(X_ERROR,"Cannot map SYS BIOS\n");
- close(fd);
+ if ((low_mem = shmget(counter++, V_RAM,
+ IPC_CREAT|SHM_R|SHM_W)) == -1)
goto error2;
- }
- close(fd);
+
+ ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
+ base = shmat(low_mem,0,0);
+ ((linuxInt10Priv *)pInt->private)->base = base;
+ base_high = shmat(high_mem,0,0);
+ ((linuxInt10Priv *)pInt->private)->base_high = base_high;
+
+ MapCurrentInt10(pInt);
+ Int10Current = pInt;
+
#ifdef DEBUG
ErrorF("Mapping int area\n");
#endif
- if (xf86ReadBIOS(0,0,(unsigned char *)base_addr,LOW_PAGE_SIZE) < 0) {
- xf86Msg(X_ERROR,"Cannot read int vect\n");
+ if (xf86ReadBIOS(0,0,(unsigned char *)0,LOW_PAGE_SIZE) < 0) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n");
goto error3;
}
-#ifdef DEBUG
- ErrorF("Mapping VRAM area\n");
-#endif
- if ((fd = open("/proc/self/mem",O_RDWR,0)) < 0
- || mmap((void *)(base_addr + V_RAM),VRAM_SIZE,PROT_READ
- | PROT_WRITE, MAP_SHARED | MAP_FIXED,
- fd, (size_t)vidMem) == MAP_FAILED) {
- xf86Msg(X_ERROR,"Cannot map V_RAM\n");
- close(fd);
- goto error3;
- }
- close(fd);
#ifdef DEBUG
- dprint(base_addr,0x20);
- dprint(base_addr + 0xa0000,0x20);
- dprint(base_addr + 0xf0000,0x20);
+ dprint(0,0x20);
+ dprint(0xa0000,0x20);
+ dprint(0xf0000,0x20);
#endif
if (xf86IsEntityPrimary(entityIndex)) {
- int cs = ((CARD16*)base_addr)[(0x10<<1)+1];
- CARD8 *bios_base = (unsigned char *)base_addr + (cs << 4);
+ int cs = ((CARD16*)0)[(0x10<<1)+1];
+ CARD8 *bios_base = (unsigned char *)(cs << 4);
int size;
- xf86Msg(X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs);
+ xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs);
if (xf86ReadBIOS(cs << 4,0,bios_base, 0x10) < 0) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error4;
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n");
+ goto error3;
}
if (!(*bios_base == 0x55 && *(bios_base + 1) == 0xAA)) {
- xf86Msg(X_ERROR,"No V_BIOS found\n");
- goto error4;
+ xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
+ goto error3;
}
size = *(bios_base + 2) * 512;
if (xf86ReadBIOS(cs << 4,0,bios_base, size) < 0) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error4;
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n");
+ goto error3;
}
if (bios_checksum(bios_base,size)) {
- xf86Msg(X_ERROR,"Bad checksum of V_BIOS \n");
- goto error4;
+ xf86DrvMsg(screen,X_ERROR,"Bad checksum of V_BIOS \n");
+ goto error3;
}
pInt->BIOSseg = cs;
- MapCurrentInt10(pInt); /* required for set_return_trap() */
set_return_trap(pInt);
} else {
- if (!mapPciRom(pInt,(unsigned char *)(base_addr + V_BIOS))) {
- xf86Msg(X_ERROR,"Cannot read V_BIOS\n");
- goto error4;
+ if (!mapPciRom(pInt,(unsigned char *)(V_BIOS))) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n");
+ goto error3;
}
-
+
pInt->BIOSseg = V_BIOS >> 4;
pInt->num = 0xe6;
- MapCurrentInt10(pInt); /* required for reset_int_vect() */
reset_int_vect(pInt);
set_return_trap(pInt);
LockLegacyVGA(screen, &vga);
@@ -167,22 +194,21 @@ xf86InitInt10(int entityIndex)
UnlockLegacyVGA(screen, &vga);
}
#ifdef DEBUG
- dprint(base_addr + 0xc0000,0x20);
+ dprint(0xc0000,0x20);
#endif
- base_addr += SYS_SIZE;
return pInt;
-
- error4:
- munmap((void *)(base_addr + V_RAM),VRAM_SIZE);
- error3:
- munmap((void *)(base_addr + SYS_BIOS),BIOS_SIZE);
- error2:
- munmap((void *)base_addr,SYS_SIZE);
- error1:
- xf86UnMapVidMem(((linuxInt10Priv*)pInt->private)->screen,
- ((linuxInt10Priv*)pInt->private)->vidMem,
- VRAM_SIZE);
+
+ error3:
+ shmdt(base_high);
+ shmdt(base);
+ shmdt(0);
+ shmdt((char*)HIGH_MEM);
+ shmctl(low_mem,IPC_RMID,NULL);
+ Int10Current = NULL;
+ error2:
+ shmctl(high_mem,IPC_RMID,NULL);
+ error1:
xfree(((linuxInt10Priv*)pInt->private)->alloc);
xfree(pInt->private);
error0:
@@ -193,17 +219,12 @@ xf86InitInt10(int entityIndex)
void
MapCurrentInt10(xf86Int10InfoPtr pInt)
{
- int fd;
-
- if (Int10Current)
- munmap((void*)((linuxInt10Priv *)Int10Current->private)->base,
- SYS_SIZE);
- if ((fd = open("/proc/self/mem",O_RDWR,0)) < 0)
- return;
- mmap(0,SYS_SIZE,PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_FIXED, fd,
- ((linuxInt10Priv *)pInt->private)->base);
- close(fd);
+ if (Int10Current) {
+ shmdt(0);
+ shmdt((char*)HIGH_MEM);
+ }
+ shmat(((linuxInt10Priv *)pInt->private)->lowMem,(char*)1,SHM_RND);
+ shmat(((linuxInt10Priv *)pInt->private)->highMem,(char*)HIGH_MEM,0);
}
void
@@ -212,20 +233,17 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
if (!pInt)
return;
if (Int10Current == pInt) {
- munmap((void*)(((linuxInt10Priv *)Int10Current->private)->base),
- SYS_SIZE);
+ shmdt(0);
+ shmdt((char*)HIGH_MEM);
Int10Current = NULL;
}
- munmap((void *)(((linuxInt10Priv *)pInt->private)->base+V_RAM),VRAM_SIZE);
- munmap((void *)(((linuxInt10Priv *)pInt->private)->base+SYS_BIOS),
- BIOS_SIZE);
- munmap((void *)((linuxInt10Priv *)pInt->private)->base,SYS_SIZE);
- xf86UnMapVidMem(((linuxInt10Priv*)pInt->private)->screen,
- ((linuxInt10Priv*)pInt->private)->vidMem,
- VRAM_SIZE);
+ shmdt(((linuxInt10Priv *)pInt->private)->base_high);
+ shmdt(((linuxInt10Priv *)pInt->private)->base);
+ shmctl(((linuxInt10Priv *)pInt->private)->lowMem,IPC_RMID,NULL);
+ shmctl(((linuxInt10Priv *)pInt->private)->highMem,IPC_RMID,NULL);
xfree(((linuxInt10Priv*)pInt->private)->alloc);
- xfree(pInt->private);
- xfree(pInt);
+ xfree(pInt->private);
+ xfree(pInt);
}
void *
@@ -262,7 +280,8 @@ void
xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
{
int pagesize = getpagesize();
- int first = ((CARD32)pbase - ((linuxInt10Priv*)pInt->private)->base)
+ int first = ((unsigned long)pbase
+ - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
/ pagesize - 1;
int i;
@@ -309,7 +328,15 @@ void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val)
pointer
xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
{
- return (pointer)(((linuxInt10Priv*)pInt->private)->base + addr);
+ if (addr < V_RAM)
+ return (pointer)(((linuxInt10Priv*)pInt->private)->base + addr);
+ else if (addr < V_BIOS)
+ return (pointer) addr;
+ else if (addr < SYS_BIOS)
+ return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
+ - V_BIOS + addr);
+ else
+ return (pointer) addr;
}
#ifdef _VM86_LINUX
@@ -342,14 +369,15 @@ do_vm86(xf86Int10InfoPtr pInt)
if (!vm86_GP_fault(pInt)) return 0;
break;
case VM86_STI:
- xf86Msg(X_ERROR,"vm86_sti :-((\n");
+ xf86DrvMsg(pInt->scrnIndex,X_ERROR,"vm86_sti :-((\n");
stack_trace(pInt);
dump_code(pInt);
return 0;
case VM86_INTx:
pInt->num = VM86_ARG(retval);
if (!int_handler(pInt)) {
- xf86Msg(X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval));
+ xf86DrvMsg(pInt->scrnIndex,
+ X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval));
dump_registers(pInt);
return 0;
}
@@ -361,10 +389,10 @@ do_vm86(xf86Int10InfoPtr pInt)
* we used to warn here and bail out - but now the sigio stuff
* always fires signals at us. So we just ignore them for now.
*/
- xf86Msg(X_WARNING,"received signal\n");
+ xf86DrvMsg(pInt->scrnIndex,X_WARNING,"received signal\n");
return 0;
default:
- xf86Msg(X_ERROR,"unknown type(0x%x)=0x%x\n",
+ xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown type(0x%x)=0x%x\n",
VM86_ARG(retval),VM86_TYPE(retval));
dump_registers(pInt);
dump_code(pInt);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
index 26f35df1f..ff8059d8a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.2 1999/12/06 03:54:34 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.6 2000/02/18 16:23:24 dawes Exp $ */
/* Resource information code */
@@ -7,12 +7,114 @@
#include "xf86Priv.h"
#include "xf86Privstr.h"
#include "xf86Pci.h"
+#include "xf86Resources.h"
#define NEED_OS_RAC_PROTOS
#include "xf86_OSlib.h"
+#include "lnx.h"
#ifdef __alpha__
+resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
+
+resPtr
+xf86BusAccWindowsFromOS(void)
+{
+ resPtr ret = NULL;
+ resRange range;
+
+ RANGE(range,0,0xffffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ RANGE(range,0,0xffffffff,ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ return ret;
+}
+
resPtr
-xf86AccWindowsFromOS(void)
+xf86PciBusAccWindowsFromOS(void)
+{
+ resPtr ret = NULL;
+ resRange range;
+ /*
+ * On the Alpha the first 16MB of every 128 Mb segment in
+ * sparse address space are an image of the ISA bus range
+ */
+ if (_bus_base_sparse()) {
+ RANGE(range,0,0x07ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x09000000,0x0fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x11000000,0x17ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x19000000,0x1fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x21000000,0x27ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x29000000,0x2fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x31000000,0x37ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x39000000,0x3fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x41000000,0x47ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x49000000,0x4fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x51000000,0x57ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x59000000,0x5fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x61000000,0x67ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x69000000,0x6fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x71000000,0x77ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x79000000,0x7fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x81000000,0x87ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x89000000,0x8fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x91000000,0x97ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0x99000000,0x9fffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xA1000000,0xa7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xA9000000,0xafffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xB1000000,0xb7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xB9000000,0xbfffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xC1000000,0xc7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xC9000000,0xcfffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xD1000000,0xd7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xD9000000,0xdfffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xE1000000,0xe7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xE9000000,0xefffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xF1000000,0xf7ffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range,0xF9000000,0xffffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ } else {
+ RANGE(range,0,0xffffffff,ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ }
+
+ RANGE(range,0,0xffffffff,ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ return ret;
+}
+
+resPtr
+xf86IsaBusAccWindowsFromOS(void)
{
resPtr ret = NULL;
resRange range;
@@ -48,4 +150,8 @@ xf86AccResFromOS(resPtr ret)
return ret;
}
+#else
+
+#error : Put your platform dependent code here!!
+
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
index 7dcd52bd9..a47431310 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.3 1999/12/31 15:38:33 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.4 2000/02/08 17:19:22 dawes Exp $ */
#include <stdio.h>
#include "X.h"
@@ -38,8 +38,10 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x"ILF LF,
&bus,&devfn,&size[0],&size[1],&size[2],&size[3],
&size[4],&size[5],&size[6]);
- if (num != 9) /* appearantly not 2.3 style */
+ if (num != 9) { /* apparantly not 2.3 style */
+ fclose(file);
return FALSE;
+ }
dev = devfn >> 3;
fn = devfn & 0x7;
if (tag == pciTag(bus,dev,fn)) {
@@ -51,10 +53,12 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
(*bits)++;
}
}
+ fclose(file);
return TRUE;
}
}
} while (res);
+ fclose(file);
return FALSE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
index 320db51eb..7488a315e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
@@ -1,6 +1,6 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com
+ * Revised: Mon Feb 14 00:15:23 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.4 2000/02/14 06:27:26 martin Exp $
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
index 71274deb3..fc08cb51a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.56 1999/12/27 01:34:00 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.60 2000/02/09 15:47:50 dawes Exp $ */
/*
* Copyright 1997 by The XFree86 Project, Inc.
*
@@ -156,7 +156,10 @@ typedef struct dirent DIRENTRY;
#ifdef XNO_SYSCONF
#undef _SC_PAGESIZE
#endif
-
+#ifdef HAVE_SYSV_IPC
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
#if 0
#define SETBUF_RETURNS_INT
@@ -335,7 +338,7 @@ xf86snprintf(char *s, xf86size_t len, const char *format, ...)
void
xf86bzero(void* s, unsigned int n)
{
- bzero(s, n);
+ memset(s, 0, n);
}
#ifdef HAVE_VSSCANF
@@ -1488,6 +1491,12 @@ xf86labs(long x)
}
double
+xf86ldexp(double x, int exp)
+{
+ return ldexp(x, exp);
+}
+
+double
xf86log(double x)
{
return(log(x));
@@ -1671,6 +1680,12 @@ xf86free(void* p)
xfree(p);
}
+double
+xf86frexp(double x, int *exp)
+{
+ return frexp(x, exp);
+}
+
void*
xf86malloc(xf86size_t n)
{
@@ -1762,3 +1777,85 @@ xf86GetErrno ()
#ifdef NEED_SNPRINTF
#include "snprintf.c"
#endif
+
+#ifdef HAVE_SYSV_IPC
+
+int
+xf86shmget(xf86key_t key, int size, int xf86shmflg)
+{
+ int shmflg = 0;
+
+ if (key == XF86IPC_PRIVATE) key = IPC_PRIVATE;
+
+
+ if (xf86shmflg & XF86SHM_R) shmflg |= SHM_R;
+ if (xf86shmflg & XF86SHM_W) shmflg |= SHM_W;
+ if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT;
+ if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL;
+ if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT;
+ return shmget((key_t) key, size, shmflg);
+}
+
+char *
+xf86shmat(int id, char *addr, int xf86shmflg)
+{
+ int shmflg = 0;
+
+ if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY;
+ if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND;
+ if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP;
+
+ return shmat(id,addr,shmflg);
+}
+
+int
+xf86shmdt(char *addr)
+{
+ return shmdt(addr);
+}
+
+/*
+ * for now only implement the rmid command.
+ */
+int
+xf86shmctl(int id, int xf86cmd, pointer *buf)
+{
+ int cmd;
+
+ switch (xf86cmd) {
+ case XF86IPC_RMID:
+ cmd = IPC_RMID;
+ break;
+ default:
+ return 0;
+ }
+
+ return shmctl(id, cmd, NULL);
+}
+#else
+
+int
+xf86shmget(xf86key_t key, int size, int xf86shmflg)
+{
+ return -1;
+
+}
+
+char *
+xf86shmat(int id, char *addr, int xf86shmflg)
+{
+ return (char *)-1;
+}
+
+int
+xf86shmctl(int id, int xf86cmd, pointer *buf)
+{
+ return -1;
+}
+
+int
+xf86shmdt(char *addr)
+{
+ return -1;
+}
+#endif /* HAVE_SYSV_IPC */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
index 034276fdd..331b83d8a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
@@ -24,7 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.7 1999/12/13 23:38:16 robin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.8 2000/02/08 17:19:24 dawes Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile
index ecc4b68e4..ca2a48a01 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.2 1999/12/06 03:57:06 robin Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.4 2000/02/09 20:47:15 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -9,9 +9,10 @@ OBJS = vbe.o vbe_module.o
INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) \
- -I$(XF86OSSRC)/int10 -I$(XF86SRC)/ddc \
+ -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \
-I$(XF86SRC)/i2c
+SubdirLibraryRule($(OBJS))
NormalLibraryObjectRule()
LibraryModuleTarget(vbe, $(OBJS))
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
index 2024c848a..1c9bcc75f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
@@ -1,7 +1,9 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.2 1999/12/06 03:57:06 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.4 2000/02/08 13:13:32 eich Exp $ */
#include "xf86.h"
+#include "xf86_ansic.h"
#include "vbe.h"
+#include "Xarch.h"
#define VERSION(x) *((CARD8*)(&x) + 1),(CARD8)(x)
@@ -33,10 +35,11 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex)
char vbeVersionString[] = "VBE2";
Bool init_int10 = FALSE;
vbeInfoPtr vip = NULL;
+ int screen = pScrn->scrnIndex;
if (!pInt) {
if (xf86LoadSubModule(pScrn, "int10")) {
- xf86Msg(X_INFO,"initializing int10\n");
+ xf86DrvMsg(screen,X_INFO,"initializing int10\n");
pInt = xf86InitInt10(entityIndex);
if (!pInt)
goto error;
@@ -60,39 +63,40 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex)
switch (pInt->ax & 0xff00) {
case 0:
- xf86Msg(X_INFO,"VESA Bios detected\n");
+ xf86DrvMsg(screen,X_INFO,"VESA Bios detected\n");
break;
case 0x100:
- xf86Msg(X_INFO,"VESA Bios function failed\n");
+ xf86DrvMsg(screen,X_INFO,"VESA Bios function failed\n");
goto error;
case 0x200:
- xf86Msg(X_INFO,"VESA Bios not supported\n");
+ xf86DrvMsg(screen,X_INFO,"VESA Bios not supported\n");
goto error;
case 0x300:
- xf86Msg(X_INFO,"VESA Bios not supported in current mode\n");
+ xf86DrvMsg(screen,X_INFO,"VESA Bios not supported in current mode\n");
goto error;
default:
- xf86Msg(X_INFO,"Invalid\n");
+ xf86DrvMsg(screen,X_INFO,"Invalid\n");
goto error;
}
- xf86MsgVerb(X_INFO,3,"VESA VBE Version %i.%i\n",VERSION(vbe->VbeVersion));
- xf86MsgVerb(X_INFO,3,"VESA VBE Total Mem: %i kB\n",vbe->TotalMem * 64);
- xf86MsgVerb(X_INFO,3,"VESA VBE OEM: %s\n",
- (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr)));
-
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Version %i.%i\n",
+ VERSION(vbe->VbeVersion));
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Total Mem: %i kB\n",
+ vbe->TotalMem * 64);
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM: %s\n",
+ (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr)));
+
if (B_O16(vbe->VbeVersion) >= 0x200) {
- xf86MsgVerb(X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n",
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n",
VERSION(vbe->OemSoftwareRev));
- xf86MsgVerb(X_INFO,3,"VESA VBE OEM Vendor: %s\n",
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Vendor: %s\n",
(CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemVendorNamePtr)));
- xf86MsgVerb(X_INFO,3,"VESA VBE OEM Product: %s\n",
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product: %s\n",
(CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductNamePtr)));
- xf86MsgVerb(X_INFO,3,"VESA VBE OEM Product Rev: %s\n",
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product Rev: %s\n",
(CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductRevPtr)));
}
vip = (vbeInfoPtr)xnfalloc(sizeof(vbeInfoRec));
- vip->scrnIndex = pScrn->scrnIndex;
vip->version = B_O16(vbe->VbeVersion);
vip->pInt10 = pInt;
vip->ddc = DDC_UNCHECKED;
@@ -104,10 +108,10 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex)
return vip;
error:
- if (init_int10)
- xf86FreeInt10(pInt);
if (page)
xf86Int10FreePages(pInt, page, 1);
+ if (init_int10)
+ xf86FreeInt10(pInt);
return NULL;
}
@@ -126,7 +130,8 @@ static Bool
vbeProbeDDC(vbeInfoPtr pVbe)
{
char *ddc_level;
-
+ int screen = pVbe->pInt10->scrnIndex;
+
if (!pVbe || (pVbe->ddc == DDC_NONE))
return FALSE;
if (pVbe->ddc != DDC_UNCHECKED)
@@ -148,7 +153,7 @@ vbeProbeDDC(vbeInfoPtr pVbe)
switch ((pVbe->pInt10->ax >> 8) & 0xff) {
case 0:
- xf86Msg(X_INFO,"VESA VBE DDC supported\n");
+ xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n");
switch (pVbe->pInt10->bx & 0x3) {
case 0:
ddc_level = "none";
@@ -171,16 +176,17 @@ vbeProbeDDC(vbeInfoPtr pVbe)
pVbe->ddc = DDC_NONE;
break;
}
- xf86MsgVerb(X_INFO,3,"VESA VBE DDC Level %s\n",ddc_level);
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level %s\n",ddc_level);
if (pVbe->pInt10->bx & 0x4) {
- xf86MsgVerb(X_INFO,3,"VESA VBE DDC Screen blanked"
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked"
"for data transfer\n");
pVbe->ddc_blank = TRUE;
} else
pVbe->ddc_blank = FALSE;
- xf86MsgVerb(X_INFO,3,"VESA VBE DDC transfer in appr. %x sec.\n",
- (pVbe->pInt10->bx >> 8) & 0xff);
+ xf86DrvMsgVerb(screen,X_INFO,3,
+ "VESA VBE DDC transfer in appr. %x sec.\n",
+ (pVbe->pInt10->bx >> 8) & 0xff);
}
return TRUE;
@@ -192,7 +198,8 @@ vbeReadEDID(vbeInfoPtr pVbe)
int RealOff = pVbe->real_mode_base;
pointer page = pVbe->memory;
unsigned char *tmp = NULL;
-
+ int screen = pVbe->pInt10->scrnIndex;
+
if (!page) return NULL;
if (!vbeProbeDDC(pVbe)) goto error;
@@ -209,12 +216,12 @@ vbeReadEDID(vbeInfoPtr pVbe)
goto error;
switch (pVbe->pInt10->ax & 0xff00) {
case 0:
- xf86MsgVerb(X_INFO,3,"VESA VBE DDC read successfully\n");
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read successfully\n");
tmp = (unsigned char *)xnfalloc(128);
memcpy(tmp,page,128);
break;
case 1:
- xf86MsgVerb(X_INFO,3,"VESA VBE DDC read failed\n");
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read failed\n");
break;
default:
break;
@@ -238,7 +245,7 @@ vbeDoEDID(vbeInfoPtr pVbe)
if (!DDC_data)
return NULL;
- if (!xf86LoadSubModule(xf86Screens[pVbe->scrnIndex], "ddc"))
+ if (!xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc"))
return NULL;
xf86LoaderReqSymLists(ddcSymbols, NULL);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h
index e375b300c..070f8e273 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h,v 1.2 1999/12/06 03:57:06 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h,v 1.3 2000/02/08 13:13:32 eich Exp $ */
#ifndef _VBE_H
#define _VBE_H
@@ -16,7 +16,6 @@ ddc_lvl;
typedef struct {
xf86Int10InfoPtr pInt10;
- int scrnIndex;
int version;
pointer memory;
int real_mode_base;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
index 8011b5c42..092cead2f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
@@ -64,7 +64,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.38 1999/12/27 00:39:47 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.39 2000/02/08 13:13:27 eich Exp $ */
#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H
@@ -167,13 +167,16 @@ extern int xf86SerialModemClearBits(int fd, int bits);
#if defined(__alpha__)
-/* entry points for SPARSE memory access routines */
-extern int xf86ReadSparse8(pointer, unsigned long);
-extern int xf86ReadSparse16(pointer, unsigned long);
-extern int xf86ReadSparse32(pointer, unsigned long);
-extern void xf86WriteSparse8(int, pointer, unsigned long);
-extern void xf86WriteSparse16(int, pointer, unsigned long);
-extern void xf86WriteSparse32(int, pointer, unsigned long);
+/* entry points for Mmio memory access routines */
+extern int (*xf86ReadMmio8)(pointer, unsigned long);
+extern int (*xf86ReadMmio16)(pointer, unsigned long);
+extern int (*xf86ReadMmio32)(pointer, unsigned long);
+extern void (*xf86WriteMmio8)(int, pointer, unsigned long);
+extern void (*xf86WriteMmio16)(int, pointer, unsigned long);
+extern void (*xf86WriteMmio32)(int, pointer, unsigned long);
+extern void (*xf86WriteMmioNB8)(int, pointer, unsigned long);
+extern void (*xf86WriteMmioNB16)(int, pointer, unsigned long);
+extern void (*xf86WriteMmioNB32)(int, pointer, unsigned long);
extern void xf86JensenMemToBus(char *, long, long, int);
extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
@@ -194,6 +197,7 @@ extern void xf86AssertBlockedSIGIO (char *);
extern Bool xf86SIGIOSupported (void);
#ifdef XF86_OS_PRIVS
+typedef void (*PMClose)(void);
extern void xf86OpenConsole(void);
extern void xf86CloseConsole(void);
extern Bool xf86VTSwitchPending(void);
@@ -212,15 +216,20 @@ extern int xf86KbdOff(void);
extern void xf86KbdEvents(void);
extern int xf86XqueKbdProc(DeviceIntPtr, int);
extern void xf86XqueEvents(void);
+extern PMClose xf86OSPMOpen(void);
#ifdef NEED_OS_RAC_PROTOS
/* RAC-related privs */
/* internal to os-support layer */
-resPtr xf86StdAccWindowsFromOS(void);
+resPtr xf86StdBusAccWindowsFromOS(void);
+resPtr xf86StdPciAccWindowsFromOS(void);
+resPtr xf86StdIsaAccWindowsFromOS(void);
resPtr xf86StdAccResFromOS(resPtr ret);
/* available to the common layer */
-resPtr xf86AccWindowsFromOS(void);
+resPtr xf86BusAccWindowsFromOS(void);
+resPtr xf86PciBusAccWindowsFromOS(void);
+resPtr xf86IsaBusAccWindowsFromOS(void);
resPtr xf86AccResFromOS(resPtr ret);
#endif /* NEED_OS_RAC_PROTOS */
Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
index ecb72d785..23389ea39 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.32 1999/12/27 01:33:59 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.36 2000/02/16 15:28:34 dawes Exp $ */
#ifndef _XF86_ANSIC_H
#define _XF86_ANSIC_H
@@ -144,6 +144,7 @@ extern char* xf86fgets(char*,INT32,XF86FILE*);
extern double xf86floor(double);
extern double xf86fmod(double,double);
extern XF86FILE* xf86fopen(const char*,const char*);
+extern double xf86frexp(double, int*);
extern int xf86printf(const char*,...);
extern int xf86fprintf(XF86FILE*,const char*,...);
extern int xf86fputc(int,XF86FILE*);
@@ -174,6 +175,7 @@ extern int xf86isspace(int);
extern int xf86isupper(int);
extern int xf86isxdigit(int);
extern long xf86labs(long);
+extern double xf86ldexp(double,int);
extern double xf86log(double);
extern double xf86log10(double);
extern void* xf86malloc(xf86size_t);
@@ -185,6 +187,8 @@ extern void* xf86memset(void*,int,xf86size_t);
extern double xf86modf(double,double*);
extern void xf86perror(const char*);
extern double xf86pow(double,double);
+extern void xf86qsort(void*, xf86size_t, xf86size_t,
+ int(*)(const void*, const void*));
extern void* xf86realloc(void*,xf86size_t);
extern int xf86remove(const char*);
extern int xf86rename(const char*,const char*);
@@ -248,8 +252,6 @@ extern int xf86GetErrno(void);
extern double xf86HUGE_VAL;
extern double xf86hypot(double,double);
-extern void xf86qsort(void *, xf86size_t, xf86size_t,
- int (*)(const void *, const void *));
/* non-ANSI C functions */
extern XF86DIR* xf86opendir(const char*);
@@ -260,7 +262,6 @@ extern void xf86bcopy(const void*,void*,xf86size_t);
extern int xf86ffs(int);
extern char* xf86strdup(const char*);
extern void xf86bzero(void*,unsigned int);
-extern void xf86getsecs(CARD32 *, CARD32 *);
extern int xf86execl(const char *, const char *, ...);
extern long xf86fpossize(void);
extern int xf86chmod(const char *, xf86mode_t);
@@ -269,7 +270,11 @@ extern xf86uid_t xf86geteuid(void);
extern int xf86mknod(const char *, xf86mode_t, xf86dev_t);
extern int xf86mkdir(const char *, xf86mode_t);
unsigned int xf86sleep(unsigned int seconds);
-int xf86getpagesize(void);
+/* sysv IPC */
+extern int xf86shmget(xf86key_t key, int size, int xf86shmflg);
+extern char * xf86shmat(int id, char *addr, int xf86shmflg);
+extern int xf86shmdt(char *addr);
+extern int xf86shmctl(int id, int xf86cmd, pointer *buf);
#else /* XFree86LOADER || NEED_XF86_TYPES */
#include <unistd.h>
@@ -278,6 +283,10 @@ int xf86getpagesize(void);
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
+#ifdef HAVE_SYSV_IPC
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
#endif /* XFree86LOADER NEED_XF86_TYPES */
/*
@@ -285,11 +294,15 @@ int xf86getpagesize(void);
* even for a static server because some OSs don't provide them.
*/
+extern int xf86getpagesize(void);
extern void xf86usleep(unsigned long);
+extern void xf86getsecs(CARD32 *, CARD32 *);
#ifndef DONT_DEFINE_WRAPPERS
#undef getpagesize
#define getpagesize() xf86getpagesize()
#undef usleep
#define usleep(ul) xf86usleep(ul)
+#undef getsecs
+#define getsecs(a, b) xf86getsecs(a, b)
#endif
#endif /* _XF86_ANSIC_H */
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 fcc6d6480..321fd3f13 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.44 1999/12/14 01:33:54 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.47 2000/02/08 17:19:21 dawes Exp $ */
@@ -67,6 +67,9 @@ struct xf86stat {
xf86dev_t st_rdev; /* This is incomplete */
};
+/* sysv IPC */
+typedef int xf86key_t;
+
/* for setvbuf */
#define XF86_IONBF 1
#define XF86_IOFBF 2
@@ -149,6 +152,21 @@ struct xf86stat {
#define xf86_ENODEV 1023
#define xf86_EIO 1024
+/* sysv IPV */
+/* xf86shmget() */
+#define XF86IPC_CREAT 01000
+#define XF86IPC_EXCL 02000
+#define XF86IPC_NOWAIT 04000
+#define XF86SHM_R 0400
+#define XF86SHM_W 0200
+#define XF86IPC_PRIVATE ((xf86key_t)0)
+/* xf86shmat() */
+#define XF86SHM_RDONLY 010000 /* attach read-only else read-write */
+#define XF86SHM_RND 020000 /* round attach address to SHMLBA */
+#define XF86SHM_REMAP 040000 /* take-over region on attach */
+/* xf86shmclt() */
+#define XF86IPC_RMID 0
+
#endif /* defined(XFree86LOADER) || defined(NEED_XF86_TYPES) */
/*
@@ -228,6 +246,8 @@ struct xf86stat {
#define free(vp) xf86free(vp)
#undef freopen
#define freopen(ccp1,ccp2,FP) xf86freopen(ccp1,ccp2,FP)
+#undef frexp
+#define frexp(x,exp) xf86frexp(x,exp)
#undef fscanf
#define fscanf xf86fscanf
#undef fseek
@@ -264,6 +284,8 @@ struct xf86stat {
#define isxdigit(i) xf86isxdigit(i)
#undef labs
#define labs(l) xf86labs(l)
+#undef ldexp
+#define ldexp(x, exp) xf86ldexp(x, exp)
#undef log
#define log(d) xf86log(d)
#undef log10
@@ -407,111 +429,64 @@ struct xf86stat {
#define mkdir(a,b) xf86mkdir(a,b)
#undef getpagesize
#define getpagesize xf86getpagesize
-#ifdef S_ISUID
+#define shmget(a,b,c) xf86shmget(a,b,c)
+#define shmat(a,b,c) xf86shmat(a,b,c)
+#define shmdt(a) xf86shmdt(a)
+#define shmctl(a,b,c) xf86shmctl(a,b,c)
+
#undef S_ISUID
-#endif
#define S_ISUID XF86_S_ISUID
-#ifdef S_ISGID
#undef S_ISGID
-#endif
#define S_ISGID XF86_S_ISGID
-#ifdef S_ISVTX
#undef S_ISVTX
-#endif
#define S_ISVTX XF86_S_ISVTX
-#ifdef S_IRUSR
#undef S_IRUSR
-#endif
#define S_IRUSR XF86_S_IRUSR
-#ifdef S_IWUSR
#undef S_IWUSR
-#endif
#define S_IWUSR XF86_S_IWUSR
-#ifdef S_IXUSR
#undef S_IXUSR
-#endif
#define S_IXUSR XF86_S_IXUSR
-#ifdef S_IRGRP
#undef S_IRGRP
-#endif
#define S_IRGRP XF86_S_IRGRP
-#ifdef S_IWGRP
#undef S_IWGRP
-#endif
#define S_IWGRP XF86_S_IWGRP
-#ifdef S_IXGRP
#undef S_IXGRP
-#endif
#define S_IXGRP XF86_S_IXGRP
-#ifdef S_IROTH
#undef S_IROTH
-#endif
#define S_IROTH XF86_S_IROTH
-#ifdef S_IWOTH
#undef S_IWOTH
-#endif
#define S_IWOTH XF86_S_IWOTH
-#ifdef S_IXOTH
#undef S_IXOTH
-#endif
#define S_IXOTH XF86_S_IXOTH
-#ifdef S_IFREG
#undef S_IFREG
-#endif
#define S_IFREG XF86_S_IFREG
-#ifdef S_IFCHR
#undef S_IFCHR
-#endif
#define S_IFCHR XF86_S_IFCHR
-#ifdef S_IFBLK
#undef S_IFBLK
-#endif
#define S_IFBLK XF86_S_IFBLK
-#ifdef S_IFIFO
#undef S_IFIFO
-#endif
#define S_IFIFO XF86_S_IFIFO
/* some types */
-#ifdef FILE
#undef FILE
-#endif
#define FILE XF86FILE
-#ifdef fpos_t
#undef fpos_t
-#endif
#define fpos_t XF86fpos_t
-#ifdef DIR
#undef DIR
-#endif
#define DIR XF86DIR
-#ifdef DIRENT
#undef DIRENT
-#endif
#define DIRENT XF86DIRENT
-#ifdef size_t
#undef size_t
-#endif
#define size_t xf86size_t
-#ifdef ssize_t
#undef ssize_t
-#endif
#define ssize_t xf86ssize_t
-#ifdef dev_t
#undef dev_t
-#endif
#define dev_t xf86dev_t
-#ifdef mode_t
#undef mode_t
-#endif
#define mode_t xf86mode_t
-#ifdef uid_t
#undef uid_t
-#endif
#define uid_t xf86uid_t
-#ifdef gid_t
#undef gid_t
-#endif
#define gid_t xf86gid_t
/*
@@ -520,30 +495,18 @@ struct xf86stat {
*/
/* some vars */
-#ifdef stdin
#undef stdin
-#endif
#define stdin xf86stdin
-#ifdef stdout
#undef stdout
-#endif
#define stdout xf86stdout
-#ifdef stderr
#undef stderr
-#endif
#define stderr xf86stderr
-#ifdef SEEK_SET
#undef SEEK_SET
-#endif
#define SEEK_SET XF86_SEEK_SET
-#ifdef SEEK_CUR
#undef SEEK_CUR
-#endif
#define SEEK_CUR XF86_SEEK_CUR
-#ifdef SEEK_END
#undef SEEK_END
-#endif
#define SEEK_END XF86_SEEK_END
/*
@@ -560,180 +523,120 @@ struct xf86stat {
#define stat(a,b) xf86stat(a,b)
#define fstat(a,b) xf86fstat(a,b)
#define access(a,b) xf86access(a,b)
-#ifdef O_RDONLY
#undef O_RDONLY
-#endif
#define O_RDONLY XF86_O_RDONLY
-#ifdef O_WRONLY
#undef O_WRONLY
-#endif
#define O_WRONLY XF86_O_WRONLY
-#ifdef O_RDWR
#undef O_RDWR
-#endif
#define O_RDWR XF86_O_RDWR
-#ifdef O_CREAT
#undef O_CREAT
-#endif
#define O_CREAT XF86_O_CREAT
-#ifdef PROT_EXEC
#undef PROT_EXEC
-#endif
#define PROT_EXEC XF86_PROT_EXEC
-#ifdef PROT_READ
#undef PROT_READ
-#endif
#define PROT_READ XF86_PROT_READ
-#ifdef PROT_WRITE
#undef PROT_WRITE
-#endif
#define PROT_WRITE XF86_PROT_WRITE
-#ifdef PROT_NONE
#undef PROT_NONE
-#endif
#define PROT_NONE XF86_PROT_NONE
-#ifdef MAP_FIXED
#undef MAP_FIXED
-#endif
#define MAP_FIXED XF86_MAP_FIXED
-#ifdef MAP_SHARED
#undef MAP_SHARED
-#endif
#define MAP_SHARED XF86_MAP_SHARED
-#ifdef MAP_PRIVATE
#undef MAP_PRIVATE
-#endif
#define MAP_PRIVATE XF86_MAP_PRIVATE
-#ifdef MAP_FAILED
#undef MAP_FAILED
-#endif
#define MAP_FAILED XF86_MAP_FAILED
-#ifdef R_OK
#undef R_OK
-#endif
#define R_OK XF86_R_OK
-#ifdef W_OK
#undef W_OK
-#endif
#define W_OK XF86_W_OK
-#ifdef X_OK
#undef X_OK
-#endif
#define X_OK XF86_X_OK
-#ifdef F_OK
#undef F_OK
-#endif
#define F_OK XF86_F_OK
#ifndef __EMX__
-#ifdef errno
#undef errno
-#endif
#define errno xf86errno
#endif
+#undef putchar
#define putchar(i) xf86fputc(i, xf86stdout)
+#undef puts
#define puts(s) xf86fputs(s, xf86stdout)
-#ifdef EACCES
#undef EACCES
-#endif
#define EACCES xf86_EACCES
-#ifdef EAGAIN
#undef EAGAIN
-#endif
#define EAGAIN xf86_EAGAIN
-#ifdef EBADF
#undef EBADF
-#endif
#define EBADF xf86_EBADF
-#ifdef EEXIST
#undef EEXIST
-#endif
#define EEXIST xf86_EEXIST
-#ifdef EFAULT
#undef EFAULT
-#endif
#define EFAULT xf86_EFAULT
-#ifdef EINTR
#undef EINTR
-#endif
#define EINTR xf86_EINTR
-#ifdef EINVAL
#undef EINVAL
-#endif
#define EINVAL xf86_EINVAL
-#ifdef EISDIR
#undef EISDIR
-#endif
#define EISDIR xf86_EISDIR
-#ifdef ELOOP
#undef ELOOP
-#endif
#define ELOOP xf86_ELOOP
-#ifdef EMFILE
#undef EMFILE
-#endif
#define EMFILE xf86_EMFILE
-#ifdef ENAMETOOLONG
#undef ENAMETOOLONG
-#endif
#define ENAMETOOLONG xf86_ENAMETOOLONG
-#ifdef ENFILE
#undef ENFILE
-#endif
#define ENFILE xf86_ENFILE
-#ifdef ENOENT
#undef ENOENT
-#endif
#define ENOENT xf86_ENOENT
-#ifdef ENOMEM
#undef ENOMEM
-#endif
#define ENOMEM xf86_ENOMEM
-#ifdef ENOSPC
#undef ENOSPC
-#endif
#define ENOSPC xf86_ENOSPC
-#ifdef ENOTDIR
#undef ENOTDIR
-#endif
#define ENOTDIR xf86_ENOTDIR
-#ifdef EPIPE
#undef EPIPE
-#endif
#define EPIPE xf86_EPIPE
-#ifdef EROFS
#undef EROFS
-#endif
#define EROFS xf86_EROFS
-#ifdef ETXTBSY
#undef ETXTBSY
-#endif
#define ETXTBSY xf86_ETXTBSY
-#ifdef ENOTTY
#undef ENOTTY
-#endif
#define ENOTTY xf86_ENOTTY
-#ifdef ENOSYS
#undef ENOSYS
-#endif
#define ENOSYS xf86_ENOSYS
-#ifdef EBUSY
#undef EBUSY
-#endif
#define EBUSY xf86_EBUSY
-#ifdef ENODEV
#undef ENODEV
-#endif
#define ENODEV xf86_ENODEV
-#ifdef EIO
#undef EIO
-#endif
#define EIO xf86_EIO
+/* IPC stuff */
+#undef SHM_RDONLY
+#define SHM_RDONLY XF86SHM_RDONLY
+#undef SHM_RND
+#define SHM_RND XF86SHM_RND
+#undef SHM_REMAP
+#define SHM_REMAP XF86SHM_REMAP
+#undef IPC_RMID
+#define IPC_RMID XF86IPC_RMID
+#undef IPC_CREAT
+#define IPC_CREAT XF86IPC_CREAT
+#undef IPC_EXCL
+#define IPC_EXCL XF86IPC_EXCL
+#undef PC_NOWAIT
+#define IPC_NOWAIT XF86IPC_NOWAIT
+#undef SHM_R
+#define SHM_R XF86SHM_R
+#undef SHM_W
+#define SHM_W XF86SHM_W
+#undef IPC_PRIVATE
+#define IPC_PRIVATE XF86IPC_PRIVATE
+
/* Some ANSI macros */
-#ifdef FILENAME_MAX
#undef FILENAME_MAX
-#endif
#define FILENAME_MAX 1024
#endif /* XFree86LOADER */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
index 4440d9b7a..62b59306b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
@@ -1,6 +1,6 @@
/* xf86drm.h -- OS-independent header for DRM user-level library interface
* Created: Tue Jan 5 08:17:23 1999 by faith@precisioninsight.com
- * Revised: Fri Jul 30 16:03:10 1999 by faith@precisioninsight.com
+ * Revised: Sun Feb 13 23:46:21 2000 by kevin@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.44 1999/08/04 18:14:42 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.4 1999/09/25 14:37:43 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.6 2000/02/14 06:27:24 martin Exp $
*
*/