summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86
diff options
context:
space:
mode:
authordawes <dawes>2001-04-09 16:26:55 +0000
committerdawes <dawes>2001-04-09 16:26:55 +0000
commit98a17368797bb2c64d10b975d8c7222f700a17ed (patch)
tree98ad15ddc2af061115b61bb802da126d6332da7c /xc/programs/Xserver/hw/xfree86
parent7bf7bda7738b2029bc71015f9ea08304c15e7240 (diff)
Import -f XFree86 4.0.99.2X_4_0_99_2
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86')
-rw-r--r--xc/programs/Xserver/hw/xfree86/CHANGELOG358
-rw-r--r--xc/programs/Xserver/hw/xfree86/Imakefile10
-rw-r--r--xc/programs/Xserver/hw/xfree86/Registry4
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Config.man3
-rw-r--r--xc/programs/Xserver/hw/xfree86/XFree86.man796
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/Imakefile12
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/atKeynames.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/compiler.h31
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Bus.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.c44
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DGA.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Events.c71
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Globals.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c74
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h23
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Mode.c17
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Module.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Opt.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Option.c15
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h91
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Priv.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c28
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86xv.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c201
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h134
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Install6
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/LICENSE8
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README7
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DRI287
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp20
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.NetBSD64
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD70
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.ati32
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.dps170
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.fonts14
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/RELNOTES45
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Status14
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml311
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml30
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile5
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml65
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml6
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml73
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml61
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml7
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml28
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml28
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml18
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml192
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml4
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml12
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile20
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c79
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h36
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c85
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c75
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h44
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c19
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c26
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c481
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c407
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c22
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h12
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c918
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h18
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c17
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h39
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c107
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c15
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c17
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h13
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c28
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c131
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h64
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c18
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c404
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm377
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c58
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c12
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c51
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h93
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c1249
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c19
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c46
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c74
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile15
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h142
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c204
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c502
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c1752
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h174
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h43
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c422
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c45
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h53
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h222
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c679
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c204
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c85
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c27
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c1221
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c164
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h81
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h289
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c23
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile70
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h23
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c75
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c59
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c202
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c36
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c86
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h47
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c28
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c36
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h18
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c92
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c106
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c481
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c175
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile53
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/README346
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c1415
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h25
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h30
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h57
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h284
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h167
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h64
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c1426
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h758
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man37
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c283
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c65
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c439
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c62
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c63
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c132
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c47
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c59
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c141
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c80
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c74
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c43
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c274
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c180
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c145
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c62
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/Imakefile6
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c24
-rw-r--r--xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/citron/citron.c578
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/citron/citron.h41
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/citron/citron.man34
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c31
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c23
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c329
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c19
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c573
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c25
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/helper_exec.c36
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/helper_mem.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/xf86int10.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/xf86int10.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/dixsym.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/elfloader.c60
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/hash.c54
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loader.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loader.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loadmod.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/xf86sym.c12
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c56
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h32
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c95
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h82
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c183
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux75
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h1
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c280
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h107
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h606
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h335
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h162
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h829
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h760
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h594
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h51
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h938
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h208
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h112
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h210
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h227
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h251
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h458
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h630
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h152
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h416
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h93
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c428
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c576
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h85
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h112
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c530
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c672
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h85
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h67
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c1379
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h394
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c690
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h1011
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c1544
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h11645
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c215
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h79
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c198
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h12
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c733
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h164
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c261
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h79
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c181
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h34
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c731
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h170
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c312
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h44
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h42
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c689
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c479
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c34
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c307
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c23
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c81
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c15
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c114
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h107
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h10
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c262
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h44
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h84
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h192
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h60
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Configint.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/DRI.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Device.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Input.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Layout.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Monitor.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Vendor.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Video.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/write.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c18
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c26
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c15
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86Version.h10
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile10
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad55
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/config.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c69
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c285
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c883
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86config/Cards4
394 files changed, 45663 insertions, 14667 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG
index d69aa53b2..0befffcb7 100644
--- a/xc/programs/Xserver/hw/xfree86/CHANGELOG
+++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG
@@ -1,3 +1,343 @@
+XFree86 4.0.99.2 (6 April 2001)
+ 360. Fbdev driver updates, including:
+ - Switch from shadowfb to mishadow.
+ - Add RENDER extension support.
+ - Add DGA support.
+ - Fix SaveScreen function
+ - Blank screen in ScreenInit so the former framebuffer contents aren't
+ visible
+ (#4544, Michel Dnzer).
+ 359. Remove references to th_TH compose file from compose.dir (#4543,
+ Theppitak Karoonboonyanan).
+ 358. Fix for improper setting of the maxHValue limit in the tseng driver.
+ This makes modes like 1152x864@24bpp possible (#A.355, Stanislav Brabec).
+ 357. Fix a hw cursor related lockup that shows up with some mga G400
+ 16MB OEM single head cards (#A.351, Ewald Snel).
+ 356. Fix the XKB macintosh/it mapping (the accent-related keys were wrong)
+ (#A.349, Andrea Ghirardini).
+ 355. Add XKB descriptions for the extra keys on a Chicony internet
+ keyboard (#A.356, John Gladkih).
+ 354. Add support for the internal input device interface to mice on
+ Solaris 8, and make it the default protocol ("VUID") (#A.340,
+ Marcus Comstedt).
+ 353. Add XKB descriptions for the extra keys on an IBM Rapid Access II
+ keyboard (#A.332, Patrick D'Cruze).
+ 352. Fix a typo in xvidtune (#A.327, Peter Breitenlohner).
+ 351. Fix Linux/libc5 build problem in the bigfont extension code (#A.327,
+ Peter Breitenlohner).
+ 350. Fix typo in Chooser.ad (#A.327, Peter Breitenlohner).
+ 349. Big endian and PowerPC support for the mga driver (#4540, Ani Joshi).
+ 348. Big endian support for the tdfx driver (#4539, Ani Joshi,
+ Nicolas Dimitrijevic).
+ 347. Build the tdfx and imstt drivers on PowerPC platforms (#4538, Ani Joshi).
+ 346. Add IMS (Integrated Micro Solutions) PCI data for the TwinTurbo128
+ and TwinTurbo3D (#4537, Ani Joshi).
+ 345. Fix some color and accel glitches in the imstt driver (#4536, Ani Joshi).
+ 344. Add ISA I/O support for PowerPC Linux using the __NR_pciconfig_iobase
+ syscall (#4535, Ani Joshi).
+ 343. New Xwin server code from the Cygwin/XFree86 project. This version
+ is more portable across Win32 platforms. Changes include:
+ - Use fb and shadowfb, and use the faster of GDI blitter,
+ DirectDraw blitter and DirectDraw4 blitter to update damaged
+ regions. The video card's framebuffer is no longer mapped.
+ - Works correctly at depths > 8, but colors are not correct at depth 8.
+ - Uses the standard Win32 API messages for processing keyboard and
+ mouse input rather than using DirectInput. This is more reliable.
+ - Improved internal structure and coding conventions.
+ - Builds completely from the XFree86 tree using gcc (the Visual C++
+ compiled xf_dx.dll is no longer used).
+ - The new server can run on machines that don't have DirectDraw/DirectX
+ installed (or installed but not operable) by falling back to the
+ GDI blitter. The best drawing interface is determined at startup,
+ but this can be overriden with the -engine command line option.
+ - The Xrender extension is now supported.
+ - Command line option is available to run in full screen mode.
+ (#4531, 4532, 4534, Cygwin/XFree86 project including Harold L Hunt II,
+ Suhaib M Siddiqi, Dakshinamurthy Karra, Peter Busch).
+ 342. v4l driver bug fixs: catch xalloc() failures, and set the depth
+ correctly for the VIDIOCSPICT ioctl (#4530, Gerd Knorr).
+ 341. Add a driver for VMware virtual SVGA devices. This is for use
+ by X servers running under a VMware guest OS (#4529, VMware, Inc).
+ 340. Remove Cygwin-specific #ifdef in Xserver/os/Waitfor.c, which fixes
+ a crash (#4528, Suhaib Siddiqi).
+ 339. Cygwin build fixes (#4527, Suhaib Siddiqi).
+ 338. Updates to the "citron" input driver. It includes compatibility
+ with the Winbond SIO chip (83977EF), and some new commands to
+ communicate to the touch driver from an application program
+ (via XChangeFeedbackControl) (#4526, Peter Kunzmann, Citron).
+ 337. Updates to the "summa" input driver, including:
+ - "Resolution" replaces "LPI" as option for setting resolution.
+ - Fixed device reporting to give the actual tablet area size and
+ resolution.
+ - Tested and working with: SummaSketch3, Hitachi_1217D, a couple of
+ others emulating the Summa protocol.
+ - Reduce debug message verbosity.
+ - Various cleanups.
+ (#4525, Huver).
+ 336. SunFFB driver bug fixes, including:
+ - Be smarter about restoring Kernel framebuffer state.
+ - Cure build errors when debug defines are enabled.
+ - Do not enable DRI or DGA acceleration if NoAccel option is specified.
+ (#4524, David S. Miller).
+ 335. Mga G450 dual head support, (#4523, Luugi Marsan (Matrox) and
+ David Woodhouse).
+ 334. Fix missing xfree -> Xfree mapping in the Type1 font library code (#4521,
+ Juliusz Chroboczek).
+ 333. Make sure that an initialization assumption in parse_fontdata() in
+ lib/X11/omGeneric.c is met (#4520, Jonathan Kamens).
+ 332. Add checksum verification to detect monitors that give incorrect EDID
+ data (#4517, Andrew C Aitchison).
+ 331. Fix checking of LD_ELFDLOBJECT on big-endian systems (#4514,
+ Guido Guenter).
+ 330. Add an update.fonts target/rule for maintainer use to update
+ the latin1 fonts in the source tree that are derived from the
+ ISO10646-1 masters (David Dawes).
+ 329. Update UCS misc fonts, which includes the addition of the missing
+ 4 DEC VT100 graphics characters from Unicode 3.2 (#4533, Markus Kuhn).
+ 328. Handle build-time generation of 8 bit fonts from the UCS versions,
+ rework the way this is organised, and allow some better control over
+ which fonts are built/installed (David Dawes).
+ 327. Add UCS versions of most of the 75dpi and 100dpi bdf fonts, and generate
+ 8-bit subsets of them. Also, remove the now-redundant latin2
+ bdf font directories (#4512 Markus Kuhn).
+ 326. Add support for Trident CyberBladeXP and CyberBladeXPm (mobile)
+ (Alan Hourihane, Robert V Fleisig).
+ 325. Add XKB descriptions for the extra keys on an IBM Rapid Access keyboard
+ (#4510, Dennis Bjorklund).
+ 324. Update Status and i810 docs to mention i815 support and FreeBSD support
+ (#4509, Andrew C Aitchison, David Dawes).
+ 323. Xprt fixes to make it closer to X.org version (Danny Backx).
+ 322. Fix for reading PCI resource data on Linux/alpha (#4508,
+ Ivan Kokshaysky).
+ 321. Add XKB descriptions for the extra keys on a "Logitech Internet Keyboard"
+ (#4505, Matthew Hand).
+ 320. Build shared libGL and DRI client modules on Linux without PIC for
+ performance reasons.
+ 319. Updates to glxinfo (Brian Paul).
+ 318. Add glxgears (Brian Paul).
+ 317. glxinfo needs libGLU (Marc La France).
+ 316. Rage128 fix to Cards database (Marc La France).
+ 315. Minor fix to PCI resource overlap handling (Marc La France).
+ 314. Loader code simplification and IA-64 cache flushes (Marc La France).
+ 313. Workaround in the ATI driver for troublesome interaction between loader
+ and compiler optimisation (Marc La France).
+ 312. Warning fixes for `gcc -fno-builtin`, which appears to be the default on
+ some systems (Marc La France).
+ 311. Add glyph transformations to Xft (Tuomas J. Lukka)
+ 310. Add XftCache creation to fonts/Type1 (Keith Packard)
+ 309. Add Xmuu library for non-Xt/Xaw dependent applications (Jim Gettys)
+ 308. Add i810 and Xv support to kdrive (Pontus Lidman)
+ 307. Fix Radeon CPUToScreen acceleration on Alpha platforms (Jay Estabrook).
+ 306. Fix bug in ServerLayout option handling when there's no ServerFlags
+ section present (David Dawes).
+ 305. Allow fb to access 16bit devices (Alan Hourihane).
+ 304. XvImage support for GeForce chips in the nv driver (Mark Vojkovich).
+ 303. XvMC build fix (Marc La France).
+ 302. Fix recently introduced bug in xf86cfg (Marc La France).
+ 301. Re-instate warning fixes clobbered by DRI merge (Marc La France).
+ 300. Ignore disabled non-video PCI ROMs (Marc La France).
+ 299. Hardware cursor implementation for Mach64 variants (William Blew,
+ Ani Joshi, Marc La France).
+ 298. Some endianness fixes in the ATI driver (incomplete) (Marc La France).
+ 297. Fix MMIO ordering problems for Mach64 acceleration (Marc La France).
+ 296. Fix ATI driver behaviour when it finds the LCD panel has been disabled
+ on entry (Marc La France).
+ 295. Fix ECP clock for GATOS (Vladimir Dergachev).
+ 294. Undo part of CHANGELOG 36 (Marc La France).
+ 293. Rework the building of libGL and the DRI drivers (David Dawes).
+ 292. Update greek keyboard layout and compose map.
+ (#4513, Katsaloulis Panagiotis)
+ 291. Fix problems in Xnest when MouseKeys is enabled and patched it to
+ use XKB to allow clients to change keyboard description and
+ configuration whithout interfering with the "real" X server
+ (Paulo Csar Pereira de Andrade).
+ 290. Dvorak keymap fix (#A.343, J Phillips).
+ 289. Some vesa driver updates, including:
+ - Wrap CloseScreen().
+ - Call xf86PrintModes().
+ - Add error messages for when PreInit bails out for lack of modes.
+ - Rework how the debugging information is printed.
+ _ Avoid some build warnings.
+ (David Dawes)
+ 288. Make it possible to call xf86PrintModes() when there is no hsync or
+ refresh data available, like from the vesa drivers (David Dawes).
+ 287. Add a "cleanlinks" script for cleaning up dangling links in lndir-created
+ shadow trees (David Dawes).
+ 286. Resync with DRI CVS trunk (VA Linux Systems).
+ 285. Make extension headers available when the extension is enabled but the
+ extension's client library is disabled (David Dawes).
+ 284. Make it possible to enable building selected extension libraries
+ when BuildServersOnly is set, and allow independent control of
+ building docs and clients (David Dawes).
+ 283. Import latest Mesa 3.4.x branch.
+ 282. Lower the default fifo threshold for PM3 chips (Alan Hourihane,
+ Rafael Barbalho, 3DLabs).
+ 281. Fix 3DLabs GLINT driver for use the Flat Panels, use the UseFlatPanel
+ option. Tested with the SGI 1600SW and Permedia3 board (Alan Hourihane).
+ 280. Fix glxinfo to query default display (Alan Hourihane).
+ 279. Convert TGA driver to use fb (Alan Hourihane).
+ 278. Fix XTRAP typo in miinitext.c (Damien Touraine).
+ 277. Major updates to the XFree86(1) man page (David Dawes).
+ 276. A new (perl) version of the mkhtmlindex script that works better than
+ the shell version (David Dawes).
+ 275. Fix the `make depend` scripts to accept -U flags and not require a blank
+ in their -f flag (Marc La France).
+ 274. Bump the video and input driver ABI minor numbers.
+ 273. Add xf86SetRealOption() (Huver).
+ 272. Change Xdarwin do that it processes all pending events instead of
+ just the oldest one on ProcessInputEvents() call ,
+ Quit Xdarwin cleanly, wether from the Xserve or from Cocoa front end,
+ Fix a case typp which cases the Xdarwin server not to start if
+ installed on a case sensitive file system like UFS.
+ (#4504, #4507, #45011, Gegory Parker, Torrey T. Lyons).
+ 271. Move Section DRI/Endsection into the DRI function to be consistant with
+ all of the other sections. (Quentin Neill)
+ 270. Made xf4bpp code moer 64bit clean (still doesn't work on Alphas)
+ (Egbert Eich).
+ 269. Removed disable/enable interrupt call on ia64 platforms.
+ The machine instruction is privileged and not permitted in user space
+ (Egbert Eich).
+ 268. Improved mode setting in Trident driver; added code to ValidMode
+ to reject any modes whose size is larger than the physical LCD
+ size if LCD is enabled (Egbert Eich).
+ 267. Modified error message in TDFX driver to give user a clue how
+ to avoid error (Stefan Dirsch).
+ 266. Fixed appearant typo in SMI driver (Egbert Eich).
+ 265. Changed Savage driver to unmap memory when exiting PreInit() and
+ maps it on every call to ScreenInit() (Egbert Eich).
+ 264. Changed handling of failed vbe call in rage 128 driver.
+ No the driver doesn't fail any more (Egbert Eich).
+ 263. Integrate the currently Panix-specific keycodes into atKeynames.h,
+ since they're not really Panix-specific (David Dawes).
+ 262. Fix problem with a NULL pointer in Xv Xineramification (Benjamin Monate).
+ 261. Bug fixes and improvements for mouse 3 button emulation state machine
+ (Andrew Pimlott).
+ 260. Updates for Hurd support (#A.324, Marcus Brinkmann).
+ 259. Add call to setlocale() in xev (#A.322, Eugene B. Byrganov).
+ 258. Add support fo the charset Big5HKSCS to the X-TrueType module, as
+ well as some basic XLocale support for it (#A.321, Roger So).
+ 257. Fix core dump in XqueueMousePreInit (#A.317, Fiel Cabral).
+ 256. Allow the mga driver's "DigitalScreen" option to work for the first
+ head (#A.297, Niels Gram Jeppesen).
+ 255. Add zh_CN.GBK locale support (#A.293, Yong Li).
+ 254. Fix a problem with the ThinkingMousePS/2 protocol handling of left
+ movement (#A.292, Ian Remmler). (This has been in 3.3.x since 3.3.4.)
+ 253. Make xdm Xinerama-aware so that it can avoid splitting login and
+ chooser windows across physical screens (#A.276,
+ Dmitry Yu. Bolkhovityanov).
+ 252. Fix a resource allocation bug in the DBE code (#A.271, Bill Rugolsky).
+ 251. Only enable Xv support for the 630 in the sis driver (#A.263, Nick Lamb).
+ 250. Modify the sis driver to prefer 24bpp framebuffer layout. Perhaps not
+ all support 32bpp? (#A.263, Nick Lamb).
+ 249. Add missing byte to Intellimouse init string, which fixes problems
+ that show up with some KVM switches (#A.258, Seung-Hyeon Rhee).
+ 248. Some DRM module fixes for FreeBSD 5-current (#A.242, Andrew Atrens).
+ 247. Fix xterm build on Solaris 2.5.1 (based on #A.282 from mark at zang.com).
+ 246. Make the Linux/PPC "custom keycodes" choice a run-time option instead
+ of a build-time option (#A.240, Franz Sirl).
+ 245. Add support to splitting WC MTRR regions on Linux when the regions is
+ not aligned on a size boudary (#A.238, _Usul John Obscurant).
+ 244. Add Acecad support to the "summa" input driver (#A.237, Arpad Gereoffy).
+ 243. Don't try to map 64K blit window aperture on older trident chips
+ (Alan Hourihane).
+ 242. V4L driver cleanups and Xineramification (#4502, Gerd Knorr).
+ 241. Make the X server and the Mac OS X front end run in a single process.
+ Other build fixes for Darwin (#4500, #4501, the XonX team).
+ 240. Don't build xf86config under BuildServersOnly (Marc La France).
+ 239. Potential fix for DGA apps that set colourmaps the normal way rather than
+ through DGA (Mark Vojkovich, Marc La France, Pontus Lidman).
+ 238. Make fstobdf generate correct ATTRIBUTES fields (Ishikawa Mutsumi).
+ 237. Xt man page updates (Paul Vojta).
+ 236. Plug kernel security hole in Linux int10 (Marc La France).
+ 235. Fix Xnest build for newest gcc versions (Marc La France).
+ 234. Fix typo in Xv Xinerama support (Gerd Knorr).
+ 233. Fix a problem with multi-thread support on OpenBSD (released OpenBSD
+ versions don't have getpwuid_r) (Matthieu Herrb)
+ 232. Allow to compile on OpenBSD-current which has completly removed PCVT
+ from its installation. (Matthieu Herrb)
+ 231. Support for ThreadedX on FreeBSD (FreeBSD ports patch-xthread).
+ 230. Updates for console-related FreeBSD system header changes as of 4.1-REL
+ (FreeBSD ports patch-r, patch-s).
+ 229. Don't leave free'd vrotate uninitialised in lib/X11/omGeneric.c
+ (FreeBSD ports patch-q).
+ 228. Protect #define HasPam in FreeBSD.cf (FreeBSD ports patch-d).
+ 227. Fix border garbage for the G400 second head by backing out #4205
+ (David Dawes).
+ 227. Fix a typo in fonts/util/Imakefile (#4499, Juliusz Chroboczek).
+ 226. Add a document describing the DPS code included in the tree, and
+ pointers to web resources (#4498, Juliusz Chroboczek).
+ 225. Use VBE to add runtime DDC support to the i810 driver (#4496,
+ Andrew C. Aitchison).
+ 224. DRM kernel module updates for FreeBSD (#4493, joe at cracktown.org).
+ 223. Add support for the "Internet" keys of the Genius Comfy KB-16M keyboard
+ (#4491, Kamil Toman).
+ 222. Include three DPS sample clients:
+ - dpsinfo: random info about the DPS extension;
+ - dpsexec: interactive DPS ``executive'' (command-line);
+ - texteroids: a demo of font support.
+ (#4489, 4497, Juliusz Chroboczek).
+ 221. Don't build the GLU library when not building GLX. This fixes
+ a build failure when GLX is disabled (#4488, Juliusz Chroboczek).
+ 220. Make the stub files that pswrap generates contain the same set of
+ includes as the Adobe version, which fixes problems building
+ standalone DPS clients (#4487, Juliusz Chroboczek).
+ 219. Fix setxkbmap bugs, including:
+ - Continue working if the appropriate root window property where the
+ current xkb settings are saved can't be read or interpreted.
+ - Make the -keymap option work.
+ - Update the man page to explain how the "-option" option works.
+ - Add primitive sanity checking for 'map name'.
+ (#4482, Ivan Pascal).
+ 218. Fix a server crash while reading DDC data from EDID2 capable monitors
+ (#4481, Andrew C Aitchison).
+ 217. Updates to Thai support, including:
+ - Fix a bug combining characterw with Shift keys.
+ - Remove the th_TH Compose file so that Thai XIM is/can be(?) activated
+ without needing XSetLocaleModifiers().
+ - A more precise context-sensitive input sequence check using
+ XNStringConversionCallback added. This has been tested with
+ xiterm+thai-1.04pre2. The implementation detail might be changed
+ if found inconsistent with the X11 specification.
+ (#4478, Theppitak Karoonboonyanan).
+ 216. Update ucs2any.pl, and replace the special map-* files with the
+ original mapping files from ftp.unicode.org. Changes include:
+ - A bug has been fixed that caused sometimes the FONT property not
+ to be updated correctly.
+ - The FONTBOUNDINGBOX is now recalculated, which makes the script
+ also suitable for proportional fonts.
+ - The mapping table for the DEC VT100 graphic characters is now built
+ into the script. This means the special map-* files are not necessary
+ any more and they could be replaced with the original mapping files
+ found on ftp://ftp.unicode.org/Public/MAPPINGS/
+ - Whether the DEC VT100 graphic characters are added can be controlled
+ with options +d/-d. Default is to add them for upright charcell fonts
+ only.
+ - Slightly improved warning messages.
+ (#4472, Markus Kuhn).
+ 215. Fix libGLU build problem on Cygwin (#4467, Suhaib M. Siddiqi).
+ 214. Fix missing libX11 exported symbols for Cygwin (#4467,
+ Suhaib M. Siddiqi).
+ 213. Updates for Hurd support (#A.209, Marcus Brinkmann).
+ 212. Fix some mis-placed mem_barrier's for Alpha platforms (Jay Estabrook).
+ 211. Fix a Index/DAC register access in glint PM2v, PM3 driver.
+ (#A.319, Romain Dolbeau).
+ 210. Add Xv support to Permedia3 driver (#4480, #4486 Sven Luther).
+ 209. Support for NVIDIA GeForce3 (Mark Vojkovich).
+ 208. Allow GccWarningFlags overrides on Linux (Marc La France).
+ 207. Fix a problem with xvinfo's listing of image formats
+ (Giridhar Pemmasani).
+ 206. Fix bug in XkbSetNamedDeviceIndicator (XkbSetNamedIndicator). This
+ function can be used both for change state of specified indicator
+ (on/off) and for change description (and so behavior) of indicator.
+ Fix bug (in XkbGetPerClientControls). Typo where subroutine apply bit
+ mask (that consist of bitwise OR of three separate masks) to value
+ that have to be returned (#4474, Ivan Pascal).
+ 205. Setxkbmap can crash X server if one specify some illegal string as
+ 'xkb variant' name (#4471, Ivan Pascal).
+ 204. In Grab mode XKB sends 'state' in key events without 'group info'
+ (keyboard map layout) (#4469-4470, Ivan Pascal).
+ 203. Rewrite the X-Video extension's Xineramification (Mark Vojkovich).
+
XFree86 4.0.99.1 (19 February 2001)
202. Gamma correction and DirectColor visual support for NVIDIA RIVA TNT
and newer chipsets (Mark Vojkovich).
@@ -80,7 +420,7 @@ XFree86 4.0.99.1 (19 February 2001)
154. Fixed acceleration on Alpine (Cirrus) driver. PIO and MMIO versions of
the accelerator driver now support the same functionality (Egbert Eich).
153. Removed unneededed call to xfree() in ddc code (Egbert Eich).
- 152. Fix NV, Glint, ati and mga drivers for Alpha EV56 machines
+ 152. -
151. Siliconmotion driver updates, including:
- Color change/flash at 8bpp when switch back to desktop in rotation
mode.
@@ -170,10 +510,8 @@ XFree86 4.0.99.1 (19 February 2001)
improving detection of them and forcing them to be relocated
(Marc La France).
118. Make lndir ignore finder data files on Mac OS X (Matthieu Herrb).
- 117. [SECURITY] complete fix for /tmp race in gccmakedep and makedepend.
- (Branden Robinson).
- 116. [SECURITY] fix possible buffer overflow (NOT on stack) in xdm
- xdmcp code (patch69 from Red Hat SRPMS).
+ 117. -
+ 116. -
115. Undo s3virge changes in 4.0.2 for Xv support on ViRGE chipsets since
they caused problems with plain ViRGE cards. Xv is still supported
for the ViRGE DX (#4414, 4430, Kevin Brosius).
@@ -215,11 +553,11 @@ XFree86 4.0.99.1 (19 February 2001)
100. Add XaaNoWriteBitmap and XaaNoWritePixmap options to XAA (Alan Hourihane).
99. Improve determination of primary adapter (Marc La France).
98. Fix PPC xf86sym.c compile problems (Marc La France).
- 97. Fix int10 option handling for drivers that cann xf86CollectOptions()
+ 97. Fix int10 option handling for drivers that call xf86CollectOptions()
before calling int10 (Marc La France).
96. Properly detect unassigned MMIO address in ATI driver (Marc La France).
95. Fix default compilation on Sparc/Solaris (Marc La France).
- 94. Fix typo in Linux/Arm configuretion (Marc La France).
+ 94. Fix typo in Linux/Arm configuration (Marc La France).
93. By default, don't build libGLU on libc5 systems (Marc La France).
92. Fix HW cursor colors for pm2v/pm3 in the glint driver (Alan Hourihane).
91. Rework the memory detection code for Permedia3, now correctly detects
@@ -390,7 +728,7 @@ XFree86 4.0.99.1 (19 February 2001)
retrieval attempt fails (Marc La France).
30. Temporary kludge to not consider any adapter as primary if more than one
candidate can be found (Marc La France).
- 29. Make deleted mode message less fearsome (Marc La France).
+ 29. Make deleted mode messages less fearsome (Marc La France).
28. Fix -configure to retrieve the correct set of options for ATI, C&T,
Cirrus and NeoMagic adapters (Marc La France).
27. When removing PCI resource overlaps, always consider resources whose size
@@ -679,7 +1017,7 @@ XFree86 4.0.1h (4 December 2000)
1087. Status doc updates for Neomagic an NVIDIA (#4334, Andrew C. Aitchison,
Mark Vojkovich).
1086. Updated Rage 128 DRI support from the DRI CVS (Gareth Hughes, VA Linux).
-1085. Updates for Hurd support (#A.209, Marcus Brinkmann).
+1085. -
1084. Bump the minor revisions of libXmu (UTF8_STRING) and libX11
(Xutf8LookupString).
1083. Fixes for all known bugs in the CompoundText parser and generator,
@@ -12559,4 +12897,4 @@ XFree86 3.0a (28 April 1994)
XFree86 3.0 (26 April 1994)
-$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1586 2001/02/19 20:20:58 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1671 2001/04/06 18:16:27 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile
index 0a4116607..cd00fd573 100644
--- a/xc/programs/Xserver/hw/xfree86/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/Imakefile
@@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/12 1996/12/16 12:31:46 rws $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.71 2001/01/24 00:06:13 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.74 2001/04/03 22:51:00 dawes Exp $
#include <Server.tmpl>
#define IHaveSubdirs
@@ -89,15 +89,15 @@ INPUTDIR = input
DRIVERSDK = sdk
#endif
-#if !BuildServersOnly
-XF86CFGDIR = xf86cfg
+#if !BuildServersOnly || BuildXFree86ConfigTools
+XF86CFGDIRS = xf86cfg xf86config
#endif
SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \
$(XF8_32BPPDIR) $(XF8_16BPPDIR) $(XF24_32BPPDIR) $(SHADOWFBDIR) \
drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \
$(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) parser \
- scanpci doc xf86config dummylib $(XF86CFGDIR) $(XF86SETUPDIR) etc \
+ scanpci doc dummylib $(XF86CFGDIRS) $(XF86SETUPDIR) etc \
$(SUPERPROBE) $(DRIVERSDK) $(XF8_32WIDDIR)
#if !defined(OS2Architecture) && !defined(cygwinArchitecture)
@@ -196,7 +196,7 @@ InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR))
InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR))
#endif
-EXTRAMANCPPDEFS=-D__logdir__=$(LOGDIRECTORY)
+EXTRAMANDEFS=-D__logdir__=$(LOGDIRECTORY)
InstallManPage(XFree86,$(MANDIR))
InstallGenManPage(XF86Config,$(FILEMANDIR),$(FILEMANSUFFIX))
diff --git a/xc/programs/Xserver/hw/xfree86/Registry b/xc/programs/Xserver/hw/xfree86/Registry
index d1a6e0dae..c6dfe6c1a 100644
--- a/xc/programs/Xserver/hw/xfree86/Registry
+++ b/xc/programs/Xserver/hw/xfree86/Registry
@@ -29,6 +29,7 @@ tseng
type1
vga
vgahw
+vmware
xaa
xf1bpp
xf4bpp
@@ -52,6 +53,7 @@ permedia
tseng
vga
vgahw
+vmware
xaa
xf1bpp
xf4bpp
@@ -318,4 +320,4 @@ and underscores removed.
-$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.16 1999/09/25 14:36:55 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.17 2001/04/05 19:29:41 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h
index 2c3ef8232..93d459456 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h
@@ -57,10 +57,16 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.17 2000/09/29 08:59:44 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.18 2001/04/01 14:00:07 tsi Exp $ */
#if defined(__GNUC__)
#if defined(linux) && (defined(__alpha__) || defined(__ia64__))
+#undef inb
+#undef inw
+#undef inl
+#undef outb
+#undef outw
+#undef outl
#define inb _inb
#define inw _inw
#define inl _inl
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c
index 01adde304..f2a4b8769 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.17 2000/06/23 22:42:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.19 2001/03/03 09:53:00 herrb Exp $ */
/*
* (c) Copyright 1993,1994 by David Dawes <dawes@xfree86.org>
*
@@ -78,12 +78,26 @@
/* NetBSD's wscons has a PCVT compatibility module. */
# include <dev/wscons/wsdisplay_usl_io.h>
# else
-# include <machine/pcvt_ioctl.h>
+# if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
+# include <dev/wscons/wsdisplay_usl_io.h>
+# else
+# include <machine/pcvt_ioctl.h>
+# endif
# endif
# endif
# ifdef SYSCONS_SUPPORT
/* both, Free and NetBSD have syscons */
-# include <machine/console.h>
+# if defined(__FreeBSD__)
+# include <osreldate.h>
+# if __FreeBSD_version >= 410000
+# include <sys/consio.h>
+# include <sys/kbio.h>
+# else
+# include <machine/console.h>
+# endif
+# else
+# include <machine/console.h>
+# endif
# endif
# else
# ifdef CODRV_SUPPORT
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Config.man b/xc/programs/Xserver/hw/xfree86/XF86Config.man
index c4e897ba4..b37bece20 100644
--- a/xc/programs/Xserver/hw/xfree86/XF86Config.man
+++ b/xc/programs/Xserver/hw/xfree86/XF86Config.man
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.3 2001/02/13 21:15:17 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.4 2001/04/05 19:29:41 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH XF86Config __filemansuffix__ __vendorversion__
@@ -1589,6 +1589,7 @@ tseng(__drivermansuffix__),
v4l(__drivermansuffix__),
vesa(__drivermansuffix__),
vga(__drivermansuffix__),
+vmware(__drivermansuffix__),
.br
README
.IR <http://www.xfree86.org/current/README.html> ,
diff --git a/xc/programs/Xserver/hw/xfree86/XFree86.man b/xc/programs/Xserver/hw/xfree86/XFree86.man
index b6b43af69..2a2ea232c 100644
--- a/xc/programs/Xserver/hw/xfree86/XFree86.man
+++ b/xc/programs/Xserver/hw/xfree86/XFree86.man
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.48 2001/01/27 18:20:44 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.52 2001/04/05 19:29:41 dawes Exp $
.TH XFree86 1 __vendorversion__
.SH NAME
XFree86 - X11R6 X server
@@ -6,91 +6,42 @@ XFree86 - X11R6 X server
.B XFree86
[:display] [option ...]
.SH DESCRIPTION
-XFree86 is an X servers for UNIX-like OSs on Intel x86 and other platforms.
+XFree86 is an X server that was originally designed for UNIX and UNIX-like
+operating systems running on Intel x86 hardware. It now runs on a wider
+range of hardware and OS platforms.
+.PP
This work is derived from
.I "X386\ 1.2"
which was contributed to X11R5 by Snitily Graphics Consulting Service.
-The current XFree86 release is based on X11R6.3.
-The XFree86 X server architecture was redesigned for the 4.0 release, and
-it includes among other things a loadable module system donated by
-Metro Link, Inc.
+The current XFree86 release is based on X11R6.3. The XFree86 X server
+architecture was redesigned for the 4.0 release, and it includes among
+other things a loadable module system donated by Metro Link, Inc.
.SH CONFIGURATIONS
.PP
.I XFree86
-operates under the following operating systems:
-.RS .5i
-.na
-.PP
--- SVR3.2: SCO 3.2.2, 3.2.4, ISC 3.x, 4.x
-.br
--- SVR4.0: ESIX, Microport, Dell, UHC, Consensys, MST, ISC, AT&T, NCR
-.br
--- SVR4.2: Consensys, Univel (UnixWare)
-.br
--- Solaris (x86) 2.5, 2.6
-.br
--- FreeBSD 2.1.x, 2.2.x, 3.0-current
-.br
--- NetBSD 1.2, 1.3
-.br
--- OpenBSD
-.ig
-.br
--- BSD/386 version 1.1 and BSD/OS 2.0
-.br
--- Mach (from CMU)
-..
-.br
--- Linux
-.ig
-.br
--- Amoeba version 5.1
-.br
--- Minix-386vm version 1.6.25.1
-..
-.br
--- LynxOS AT versions 2.2.1, 2.3.0 and 2.4.0, LynxOS microSPARC 2.4.0
-.ad
-.RE
+operates under a wide range of operating systems and hardware platforms.
+The Intel x86 (IA32) architecture is the most widely supported hardware
+platform. Other hardware platforms include Compaq Alpha, Intel IA64,
+SPARC and PowerPC. The most widely supported operating systems are the
+free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and
+OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and
+UnixWare are also supported. Other supported operating systems include
+LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the
+XDarwin(1) X server. Win32/Cygwin is supported with the XWin X server.
.PP
.SH "NETWORK CONNECTIONS"
\fIXFree86\fP supports connections made using the following reliable
byte-streams:
.TP 4
.I "Local"
-\fIXFree86\fP supports local connections via Streams pipe via various mechanisms,
-using the following paths (\fIn\fP represents the display number):
-.sp .5v
-.in 8
-.nf
-/dev/X/server.\fBn\fR (SVR3 and SVR4)
-/dev/X/Nserver.\fBn\fR (SVR4)
-.ig
-/tmp/.X11-unix/X\fBn\fR (ISC SVR3)
-..
-/dev/X\fBn\fRS and /dev/X\fBn\fRR (SCO SVR3)
-.fi
-.in
-.sp .5v
-On SVR4.0.4, if the \fIAdvanced Compatibility Package\fP
-is installed, and in SVR4.2, \fIXFree86\fP supports local connections
-from clients for SCO XSight/ODT, and (with modifications to the binary)
-clients for ISC SVR3.
-.TP 4
-.I "Unix Domain"
-\fIXFree86\fP uses \fI/tmp/.X11-unix/X\fBn\fR as the filename for the socket,
-where \fIn\fP is the display number.
+On most platforms, the "Local" connection type is a UNIX-domain socket.
+On some System V platforms, the "local" connection types also include
+STREAMS pipes, named pipes, and some other mechanisms.
.TP 4
.I TCP\/IP
-\fIXFree86\fP listens on port htons(6000+\fIn\fP), where \fIn\fP is the display
-number.
-.ig
-.TP 4
-.I "Amoeba RPC"
-This is the default communication medium used under native Amoeba.
-Note that under Amoeba, the server should be started
-with a ``\fIhostname\fP:\fIdisplaynumber\fP'' argument.
-..
+\fIXFree86\fP listens on port 6000+\fIn\fP, where \fIn\fP is the display
+number. This connection type can be disabled with the \fB\-nolisten\fP
+option (see the Xserver(1) man page for details).
.SH "ENVIRONMENT VARIABLES"
For operating systems that support local connections other than Unix Domain
sockets (SVR3 and SVR4), there is a compiled-in list specifying the order
@@ -104,16 +55,16 @@ To use it the connection must be made to \fIunix:0.0\fP.
.PP
The \fIXLOCAL\fP environment variable should contain a list of one more
more of the following:
-.sp .5v
-.in 8
+.PP
+.RS 8
.nf
NAMED
PTS
SCO
ISC
.fi
-.in
-.sp .5v
+.RE
+.PP
which represent SVR4 Named Streams pipe, Old-style USL
Streams pipe, SCO XSight Streams pipe, and ISC Streams pipe, respectively.
You can select a single mechanism (e.g. \fIXLOCAL=NAMED\fP), or an ordered
@@ -132,195 +83,425 @@ In addition to the normal server options described in the \fIXserver(1)\fP
manual page, \fIXFree86\fP accepts the following command line switches:
.TP 8
.B vt\fIXX\fP
-\fIXX\fP specifies the Virtual Terminal device number which
-\fIXFree86\fP will use. Without this option, \fIXFree86\fP will pick the first
+\fIXX\fP specifies the Virtual Terminal device number which \fIXFree86\fP
+will use. Without this option, \fIXFree86\fP will pick the first
available Virtual Terminal that it can locate. This option applies only
-to SVR3, SVR4, Linux, and BSD OSs with the `syscons' or `pcvt' driver.
+to platforms such as Linux, BSD, SVR3 and SVR4, that have virtual terminal
+support.
+.TP
+.B \-allowMouseOpenFail
+Allow the server to start up even if the mouse device can't be opened
+or initialised. This is equivalent to the
+.B AllowMouseOpenFail
+XF86Config(__filemansuffix__) file option.
.TP 8
-.B -crt /dev/tty\fIXX\fP
-SCO only. This is the same as the \fBvt\fP option, and is provided for
-compatibility with the native SCO X server.
+.B \-allowNonLocalModInDev
+Allow changes to keyboard and mouse settings from non-local clients.
+By default, connections from non-local clients are not allowed to do
+this. This is equivalent to the
+.B AllowNonLocalModInDev
+XF86Config(__filemansuffix__) file option.
.TP 8
-.B \-probeonly
-Causes the server to exit after the device probing stage. The XF86Config file
-is still used when this option is given, so information that can be
-auto-detected should be commented out.
+.B \-allowNonLocalXvidtune
+Make the VidMode extension available to remote clients. This allows
+the xvidtune client to connect from another host. This is equivalent
+to the
+.B AllowNonLocalXvidtune
+XF86Config(__filemansuffix__) file option. By default non-local
+connections are not allowed.
.TP 8
-.B \-quiet
-Suppress most informational messages at startup.
+.B \-bgamma \fIvalue\fP
+Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10.
+The default is 1.0. Not all drivers support this. See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-ggamma
+options.
.TP 8
.B \-bpp \fIn\fP
-No longer supported. Use \fB\-depth\fP to set the color depth, and
-use \fB\-fbbpp\fP if you really need to force a non-default
-framebuffer (hardware) pixel format.
+No longer supported. Use \fB\-depth\fP to set the color depth, and use
+\fB\-fbbpp\fP if you really need to force a non-default framebuffer
+(hardware) pixel format.
+.TP
+.B \-configure
+When this option is specified, the X server loads all video driver
+modules, probes for available hardware, and writes out an initial
+XF86Config(__filemansuffix__) file based on what was detected. This
+option currently has some problems on some platforms, but in most cases
+it is a good way to bootstrap the configuration process. This option
+is only available when the server is run as root (i.e, with real-uid
+0).
+.TP 8
+.B \-crt /dev/tty\fIXX\fP
+SCO only. This is the same as the \fBvt\fP option, and is provided for
+compatibility with the native SCO X server.
.TP 8
.B \-depth \fIn\fP
-Sets the default color depth. Legal values are 8, 15, 16, and 24.
-Not all servers support all values.
+Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and
+24. Not all drivers support all values.
.TP 8
-.B \-fbbpp \fIn\fP
-Sets the number of framebuffer bits per pixel. You should only set
-this if you're sure it's necessary; normally the server can deduce the
-correct value from \fB\-depth\fP above. Useful if you want to run a
-depth 24 configuration with a 24 bpp framebuffer rather than the
-(possibly default) 32 bpp framebuffer. Legal values are 8, 16, 24,
-32. Not all servers support all values.
+.B \-disableModInDev
+Disable dynamic modification of input device settings. This is equivalent
+to the
+.B DisableModInDev
+XF86Config(__filemansuffix__) file option.
.TP 8
-.B \-weight \fInnn\fP
-Set RGB weighting at 16 bpp. The default is 565. This applies
-only to those servers which support 16 bpp.
+.B \-disableVidMode
+Disable the the parts of the VidMode extension (used by the xvidtune
+client) that can be used to change the video modes. This is equivalent
+to the
+.B DisableVidModeExtension
+XF86Config(__filemansuffix__) file option.
+.TP 8
+.B \-fbbpp \fIn\fP
+Sets the number of framebuffer bits per pixel. You should only set this
+if you're sure it's necessary; normally the server can deduce the correct
+value from \fB\-depth\fP above. Useful if you want to run a depth 24
+configuration with a 24 bpp framebuffer rather than the (possibly default)
+32 bpp framebuffer (or vice versa). Legal values are 1, 8, 16, 24, 32.
+Not all drivers support all values.
.TP 8
.B \-flipPixels
Swap the default values for the black and white pixels.
.TP 8
-.B \-disableVidMode
-Disable the the parts of the VidMode extension used by the xvidtune client
-that can be used to change the video modes.
+.B \-gamma \fIvalue\fP
+Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The
+default is 1.0. This value is applied equally to the R, G and B values.
+Those values can be set independently with the
+.BR \-rgamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options. Not all drivers support this.
.TP 8
-.B \-allowNonLocalXvidtune
-Allow the xvidtune client to connect from another host. By default non-local
-connections are not allowed.
+.B \-ggamma \fIvalue\fP
+Set the green gamma correction. \fIvalue\fP must be between 0.1 and
+10. The default is 1.0. Not all drivers support this. See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-bgamma
+options.
+.TP 8
+.B \-ignoreABI
+The X server checks the ABI revision levels of each module that it loads.
+It will normally refuse to load modules with ABI revisions that are newer
+than the server's. This is because such modules might use interfaces that
+the server does not have. When this option is specified, mismatches like
+this are downgraded from fatal errors to warnings. This option should
+be used with care.
.TP 8
-.B \-disableModInDev
-Disable dynamic modification of input device settings.
+.B \-keeptty
+Prevent the server from detaching its initial controlling terminal.
+This option is only useful when debugging the server. Not all platforms
+support (or can use) this option.
+.TP 8
+.B \-keyboard \fIkeyboard-name\fP
+Use the XF86Config(__filemansuffix__) file
+.B InputDevice
+section called
+.I keyboard-name
+as the core keyboard.
+By default the core keyboard input device referenced by the default
+.B Layout
+section are used, or the first relevant
+.B InputDevice
+section when there are no
+.B Layout
+sections.
+.TP 8
+.B \-layout \fIlayout-name\fP
+Use the XF86Config(__filemansuffix__) file
+.B Layout
+section called
+.IR layout-name .
+By default the first
+.B Layout
+section is used.
+.TP 8
+.B \-logfile \fIfilename\fP
+Use the file called
+.I filename
+as the X server log file. The default log file is
+.B __logdir__/XFree86.\fIn\fP.log
+on most platforms, where
+.I n
+is the display number of the X server. The default may be in a different
+directory on some platforms. This option is only available when the
+server is run as root (i.e, with real-uid 0).
+.TP 8
+.BR \-logverbose " [\fIn\fP]"
+Sets the verbosity level for information printed to the X server log
+file. If the
+.I n
+value isn't supplied, each occurrance of this option increments the log
+file verbosity level. When the
+.I n
+value is supplied, the log file verbosity level is set to that value.
+The default log file verbosity level is 3.
+.TP 8
+.B \-modulepath \fIsearchpath\fP
+Set the module search path to
+.IR searchpath .
+.I searchpath
+is a comma separated list of directories to search for X server modules.
+This option is only available when the server is run as root (i.e, with
+real-uid 0).
+.TP 8
+.B \-nosilk
+Disable Silken Mouse support.
+.TP 8
+.B \-pixmap24
+Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
+The default is usually 32 bits per pixel. There is normally little
+reason to use this option. Some client applications don't like this
+pixmap format, even though it is a perfectly legal format.
+This is equvalent to the
+.B Pixmap
+XF86Config(__filemansuffix__) file option.
+.TP 8
+.B \-pixmap32
+Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel.
+This is usually the default.
+This is equvalent to the
+.B Pixmap
+XF86Config(__filemansuffix__) file option.
+.TP 8
+.B \-pointer \fIpointer-name\fP
+Use the XF86Config(__filemansuffix__) file
+.B InputDevice
+section called
+.I pointer-name
+as the core pointer.
+By default the core pointer input device referenced by the default
+.B Layout
+section are used, or the first relevant
+.B InputDevice
+section when there are no
+.B Layout
+sections.
.TP 8
-.B \-allowNonLocalModInDev
-Allow changes to keyboard and mouse settings from non-local clients.
-By default, connections from non-local clients are not allowed to do this.
-.TP
-.B \-allowMouseOpenFail
-Allow the server to start up even if the mouse device can't be opened or
-initialised.
+.B \-probeonly
+Causes the server to exit after the device probing stage. The XF86Config
+file is still used when this option is given, so information that can
+be auto-detected should be commented out.
.TP 8
-.B \-gamma \fIvalue\fP
-Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The
-default is 1.0
-This value is applied equally to the R, G and B values. Not all servers
-support this.
+.B \-quiet
+Suppress most informational messages at startup. The verbosity level
+is set to zero.
.TP 8
.B \-rgamma \fIvalue\fP
-Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. The
-default is 1.0
-Not all servers support this.
-.TP 8
-.B \-ggamma \fIvalue\fP
-Set the green gamma correction. \fIvalue\fP must be between 0.1 and 10. The
-default is 1.0
-Not all servers support this.
-.TP 8
-.B \-bgamma \fIvalue\fP
-Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. The
-default is 1.0
-Not all servers support this.
+Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10.
+The default is 1.0. Not all drivers support this. See also the
+.BR \-gamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options.
+.TP 8
+.B \-scanpci
+When this option is specified, the X server scans the PCI bus, and prints
+out some information about each device that was detected. See also
+scanpci(1) and pcitweak(1).
+.TP 8
+.B \-screen \fIscreen-name\fP
+Use the XF86Config(__filemansuffix__) file
+.B Screen
+section called
+.IR screen-name .
+By default the screens referenced by the default
+.B Layout
+section are used, or the first
+.B Screen
+section when there are no
+.B Layout
+sections.
.TP 8
.B \-showconfig
-Print out the server version, patchlevel, and a list of screen drivers
-configured in the server.
+This is the same as the
+.B \-version
+option, and is included for compatibilty reasons. It may be removed in
+a future release, so the
+.B \-version
+options hould be used instead.
.TP 8
-.B \-verbose
-Multiple occurrences of this flag increase the amount of information printed on
-stderr (more than the default).
+.B \-weight \fInnn\fP
+Set RGB weighting at 16 bpp. The default is 565. This applies only to
+those drivers which support 16 bpp.
+.TP 8
+.BR \-verbose " [\fIn\fP]"
+Sets the verbosity level for information printed on stderr. If the
+.I n
+value isn't supplied, each occurrance of this option increments the
+verbosity level. When the
+.I n
+value is supplied, the verbosity level is set to that value. The default
+verbosity level is 1.
.TP 8
.B \-version
-Same as \fB\-showconfig\fP.
+Print out the server version, patchlevel, release date, the operating
+system/platform it was built on, and whether it includes module loader
+support.
.TP 8
.B \-xf86config \fIfile\fP
Read the server configuration from \fIfile\fP. This option will work
for any file when the server is run as root (i.e, with real-uid 0), or
for files relative to a directory in the config search path for all
-other users.
-.TP 8
-.B \-keeptty
-Prevent the server from detaching its initial controlling terminal. This
-option is only useful when debugging the server.
+other users.
.SH "KEYBOARD"
Multiple key presses recognized directly by \fIXFree86\fP are:
.TP 8
.B Ctrl+Alt+Backspace
-Immediately kills the server -- no questions asked. (Can be disabled by
-specifying "DontZap" in the \fBServerFlags\fP section of the XF86Config file.)
+Immediately kills the server -- no questions asked. This can be disabled
+with the
+.B DontZap
+XF86Config(__filemansuffix__) file option.
.TP 8
.B Ctrl+Alt+Keypad-Plus
-Change video mode to next one specified in the configuration file,
-(increasing video resolution order).
+Change video mode to next one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+XF86Config(__filemansuffix__) file option.
.TP 8
.B Ctrl+Alt+Keypad-Minus
-Change video mode to previous one specified in the configuration file,
-(decreasing video resolution order).
+Change video mode to previous one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+XF86Config(__filemansuffix__) file option.
.TP 8
.B Ctrl+Alt+F1...F12
-For BSD systems using the syscons driver and Linux, these keystroke
-combinations are used to switch to Virtual
-Console 1 through 12.
+For BSD and Linux systems with virtual terminal support, these keystroke
+combinations are used to switch to Virtual Console 1 through 12.
.SH SETUP
.I XFree86
uses a configuration file called \fBXF86Config\fP for its initial setup.
Refer to the
-.I XF86Config(4/5)
-manual page for more information.
+.I XF86Config(__filemansuffix__)
+manual page for information about the
+format of this file.
.SH FILES
+The X server config file can be found in a range of locations. These
+are documented fully in the
+.I XF86Config(__filemansuffix__)
+manual page. The most commonly used locations are shown here.
.TP 30
-/etc/XF86Config
+/etc/X11/XF86Config
Server configuration file
.TP 30
-/etc/X11/XF86Config
+/etc/X11/XF86Config-4
Server configuration file
.TP 30
-/usr/X11R6/etc/XF86Config
+/etc/XF86Config
Server configuration file
.TP 30
-<XRoot>/lib/X11/XF86Config.\fIhostname\fP
+__projectroot__/etc/XF86Config
Server configuration file
.TP 30
-<XRoot>/lib/X11/XF86Config
+__projectroot__/lib/X11/XF86Config
Server configuration file
.TP 30
-<XRoot>/bin/\(**
+__logdir__/XFree86.\fIn\fP.log
+Server log file for display \fIn\fP.
+.TP 30
+__projectroot__/bin/\(**
Client binaries
.TP 30
-<XRoot>/include/\(**
+__projectroot__/include/\(**
Header files
.TP 30
-<XRoot>/lib/\(**
+__projectroot__/lib/\(**
Libraries
.TP 30
-<XRoot>/lib/X11/fonts/\(**
+__projectroot__/lib/X11/fonts/\(**
Fonts
.TP 30
-<XRoot>/lib/X11/rgb.txt
+__projectroot__/lib/X11/rgb.txt
Color names to RGB mapping
.TP 30
-<XRoot>/lib/X11/XErrorDB
+__projectroot__/lib/X11/XErrorDB
Client error message database
.TP 30
-<XRoot>/lib/X11/app-defaults/\(**
+__projectroot__/lib/X11/app-defaults/\(**
Client resource specifications
.TP 30
-<XRoot>/man/man?/\(**
+__projectroot__/man/man?/\(**
Manual pages
.TP 30
/etc/X\fIn\fP.hosts
Initial access control list for display \fIn\fP
-.LP
-Note: <XRoot> refers to the root of the X11 install tree.
.SH "SEE ALSO"
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1),
-XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1)
+XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1),
+apm(__drivermansuffix__),
+ati(__drivermansuffix__),
+chips(__drivermansuffix__),
+cirrus(__drivermansuffix__),
+cyrix(__drivermansuffix__),
+fbdev(__drivermansuffix__),
+glide(__drivermansuffix__),
+glint(__drivermansuffix__),
+i128(__drivermansuffix__),
+i740(__drivermansuffix__),
+i810(__drivermansuffix__),
+imstt(__drivermansuffix__),
+mga(__drivermansuffix__),
+neomagic(__drivermansuffix__),
+nv(__drivermansuffix__),
+r128(__drivermansuffix__),
+rendition(__drivermansuffix__),
+s3virge(__drivermansuffix__),
+siliconmotion(__drivermansuffix__),
+sis(__drivermansuffix__),
+sunbw2(__drivermansuffix__),
+suncg14(__drivermansuffix__),
+suncg3(__drivermansuffix__),
+suncg6(__drivermansuffix__),
+sunffb(__drivermansuffix__),
+sunleo(__drivermansuffix__),
+suntcx(__drivermansuffix__),
+tdfx(__drivermansuffix__),
+tga(__drivermansuffix__),
+trident(__drivermansuffix__),
+tseng(__drivermansuffix__),
+v4l(__drivermansuffix__),
+vesa(__drivermansuffix__),
+vga(__drivermansuffix__),
+vmware(__drivermansuffix__),
+.br
+README
+.IR <http://www.xfree86.org/current/README.html> ,
+.br
+RELNOTES
+.IR <http://www.xfree86.org/current/RELNOTES.html> ,
+.br
+README.mouse
+.IR <http://www.xfree86.org/current/mouse.html> ,
+.br
+README.DRI
+.IR <http://www.xfree86.org/current/DRI.html> ,
+.br
+Status
+.IR <http://www.xfree86.org/current/Status.html> ,
+.br
+Install
+.IR <http://www.xfree86.org/current/Install.html> .
+
.SH AUTHORS
+XFree86 has many contributors world wide. The names of most of them
+can be found in the documentation, CHANGELOG files in the source tree,
+and in the actual source code.
.PP
-For X11R5, \fIXF86 1.2\fP was provided by:
-.TP 8
-Thomas Roell, \fIroell@informatik.tu-muenchen.de\fP
-TU-Muenchen: Server and SVR4 stuff
-.TP 8
-Mark W. Snitily, \fImark@sgcs.com\fP
-SGCS: SVR3 support, X Consortium Sponsor
+XFree86 was originally based on \fIX386 1.2\fP by Thomas Roell, which
+was contributed to the then X Consortium's X11R5 distribution by SGCS.
.PP
- ... and many more people out there on the net who helped with ideas and
-bug-fixes.
+The project that became XFree86 was originally founded in 1992 by
+David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
.PP
-XFree86 was integrated into X11R6 by the following team:
+XFree86 was later integrated in the then X Consortium's X11R6 release
+by a group of dedicated XFree86 developers, including the following:
.PP
+.RS 4
.nf
Stuart Anderson \fIanderson@metrolink.com\fP
Doug Anson \fIdanson@lgc.com\fP
@@ -350,228 +531,33 @@ Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP
Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP
Orest Zborowski \fIorestz@eskimo.com\fP
.fi
+.RE
.PP
-The \fIXFree86\fP enhancement package was provided by:
-.TP 8
-David Dawes, \fIdawes@XFree86.org\fP
-Release coordination, administration of FTP repository and mailing lists.
-Source tree management
-and integration, accelerated server integration, fixing, and coding.
-.TP 8
-Glenn Lai, \fIglenn@cs.utexas.edu\fP
-The SpeedUp code for ET4000 based SVGA cards, and ET4000/W32 accelerated
-server.
-.TP 8
-Jim Tsillas, \fIjtsilla@ccs.neu.edu\fP
-Many server speedups from the fX386 series of enhancements.
-.TP 8
-David Wexelblat, \fIdwex@XFree86.org\fP
-Integration of the fX386 code into the default server,
-many driver fixes, and driver documentation, assembly of the VGA
-card/monitor database, development of the generic video mode listing.
-Accelerated server integration, fixing, and coding.
-.TP 8
-Dirk Hohndel, \fIhohndel@XFree86.org\fP
-Linux shared libraries and release coordination. Accelerated server
-integration and fixing. Generic administrivia and documentation.
+The current XFree86 core team consists of:
.PP
-.TP 8
-Amancio Hasty Jr., \fIhasty@netcom.com\fP
-Porting to \fB386BSD\fP version 0.1 and XS3 development.
-.TP 8
-Rich Murphey, \fIrich@XFree86.org\fP
-Ported to \fB386BSD\fP version 0.1 based on the original port by Pace Willison.
-Support for \fB386BSD\fP, \fBFreeBSD\fP, and \fBNetBSD\fP.
-.TP 8
-Robert Baron, \fIRobert.Baron@ernst.mach.cs.cmu.edu\fP
-Ported to \fBMach\fP.
-.TP 8
-Orest Zborowski, \fIorestz@eskimo.com\fP
-Ported to \fBLinux\fP.
-.TP 8
-Doug Anson, \fIdanson@lgc.com\fP
-Ported to \fBSolaris x86\fP.
-.TP 8
-David Holland, \fIdavidh@use.com\fP
-Ported to \fBSolaris x86\fP.
-.TP 8
-David McCullough, \fIdavidm@stallion.oz.au\fP
-Ported to \fBSCO SVR3\fP.
-.TP 8
-Michael Rohleder, \fImichael.rohleder@stadt-frankfurt.de\fP
-Ported to \fBISC SVR3\fP.
-.TP 8
-Kees Verstoep, \fIversto@cs.vu.nl\fP
-Ported to \fBAmoeba\fP based on Leendert van Doorn's original Amoeba port of
-X11R5.
-.TP 8
-Marc Evans, \fIMarc@XFree86.org\fP
-Ported to \fBOSF/1\fP.
-.TP 8
-Philip Homburg, \fIphilip@cs.vu.nl\fP
-Ported to \fBMinix-386vm\fP.
-.TP 8
-Thomas Mueller, \fItm@systrix.de\fP
-Ported to \fBLynxOS\fP.
-.TP 8
-Jon Tombs, \fItombs@XFree86.org\fP
-S3 server and accelerated server coordination.
-.TP 8
-Harald Koenig, \fIkoenig@tat.physik.uni-tuebingen.de\fP
-S3 server development.
-.TP 8
-Bernhard Bender, \fIbr@elsa.mhs.compuserve.com\fP
-S3 server development.
-.TP 8
-Kevin Martin, \fImartin@cs.unc.edu\fP
-Overall work on the base accelerated servers (ATI and 8514/A), and Mach64
-server.
-.TP 8
-Rik Faith, \fIfaith@cs.unc.edu\fP
-Overall work on the base accelerated servers (ATI and 8514/A).
-.TP 8
-Tiago Gons, \fItiago@comosjn.hobby.nl\fP
-Mach8 and 8514/A server development
-.TP 8
-Hans Nasten, \fInasten@everyware.se\fP
-Mach8, 8514/A, and S3 server development and BSD/386 support
-.TP 8
-Mike Bernson, \fImike@mbsun.mlb.org\fP
-Mach32 server development.
-.TP 8
-Mark Weaver, \fIMark_Weaver@brown.edu\fP
-Mach32 server development.
-.TP 8
-Craig Groeschel, \fIcraig@metrolink.com\fP
-Mach32 server development.
-.TP 8
-Henry Worth, \fIHenry.Worth@amail.amdahl.com\fP
-AGX server.
-.TP 8
-Erik Nygren, \fInygren@mit.edu\fP
-P9000 server.
-.TP 8
-Harry Langenbacher \fIharry@brain.jpl.nasa.gov\fP
-P9000 server.
-.TP 8
-Chris Mason, \fImason@mail.csh.rit.edu\fP
-P9000 server.
-.TP 8
-Henrik Harmsen \fIharmsen@eritel.se\fP
-P9000 server.
-.TP 8
-Simon Cooper, \fIscooper@vizlab.rutgers.edu\fP
-Cirrus accelerated code (based on work by Bill Reynolds).
-.TP 8
-Harm Hanemaayer, \fIhhanemaa@cs.ruu.nl\fP
-Cirrus accelerated code, and ARK driver.
-.TP 8
-Thomas Zerucha, \fIzerucha@shell.portal.com\fP
-Support for Cirrus CL-GD7543.
-.TP 8
-Leon Bottou, \fIbottou@laforia.ibp.fr\fP
-ARK driver.
-.TP 8
-Mike Tierney, \fIfloyd@eng.umd.edu\fP
-WD accelerated code.
-.TP 8
-Bill Conn, \fIconn@bnr.ca\fP
-WD accelerated code.
-.TP 8
-Brad Bosch, \fIbrad@lachman.com\fP
-WD 90C24A support.
-.TP 8
-Alan Hourihane, \fIalanh@fairlite.demon.co.uk\fP
-Trident SVGA driver, SiS SVGA driver and DEC 21030 server.
-.TP 8
-Marc Aurele La France, \fItsi@xfree86.org\fP
-ATI SVGA driver
-.TP 8
-Steve Goldman, \fIsgoldman@encore.com\fP
-Oak 067/077 SVGA driver.
-.TP 8
-Jorge Delgado, \fIernar@dit.upm.es\fP
-Oak SVGA driver, and 087 accelerated code.
-.TP 8
-Bill Conn, \fIconn@bnr.ca\fP
-WD accelerated code.
-.TP 8
-Paolo Severini, \fIlendl@dist.dist.unige.it\fP
-AL2101 SVGA driver
-.TP 8
-Ching-Tai Chiu, \fIcchiu@netcom.com\fP
-Avance Logic ALI SVGA driver
-.TP 8
-Manfred Brands, \fImb@oceonics.nl\fP
-Cirrus 64xx SVGA driver
-.TP 8
-Randy Hendry, \fIrandy@sgi.com\fP
-Cirrus 6440 support in the cl64xx SVGA driver
-.TP 8
-Frank Dikker, \fIdikker@cs.utwente.nl\fP
-MX SVGA driver
-.TP 8
-Regis Cridlig, \fIcridlig@dmi.ens.fr\fP
-Chips & Technologies driver
-.TP 8
-Jon Block, \fIblock@frc.com\fP
-Chips & Technologies driver
-.TP 8
-Mike Hollick, \fIhollick@graphics.cis.upenn.edu\fP
-Chips & Technologies driver
-.TP 8
-Nozomi Ytow
-Chips & Technologies driver
-.TP 8
-Egbert Eich, \fIEgbert.Eich@Physik.TH-Darmstadt.DE\fP
-Chips & Technologies driver
-.TP 8
-David Bateman, \fIdbateman@ee.uts.edu.au\fP
-Chips & Technologies driver
-.TP 8
-Xavier Ducoin, \fIxavier@rd.lectra.fr\fP
-Chips & Technologies driver
-.TP 8
-Peter Trattler, \fIpeter@sbox.tu-graz.ac.at\fP
-RealTek SVGA driver
-.TP 8
-Craig Struble, \fIcstruble@acm.vt.edu\fP
-Video7 SVGA driver
-.TP 8
-Gertjan Akkerman, \fIakkerman@dutiba.twi.tudelft.nl\fP
-16 colour VGA server, and XF86Config parser.
-.TP 8
-Davor Matic, \fIdmatic@Athena.MIT.EDU\fP
-Hercules driver.
-.TP 8
-Pascal Haible, \fIhaible@izfm.uni-stuttgart.de\fP
-Banked monochrome VGA support, Hercules support, and mono frame buffer
-support for dumb monochrome devices
-.TP 8
-Martin Schaller,
-.TP 8
-Geert Uytterhoeven,\fIGeert.Uytterhoeven@cs.kuleuven.ac.be\fP
-Linux/m68k Frame Buffer Device driver
-.TP 8
-Andreas Schwab, \fIschwab@issan.informatik.uni-dortmund.de\fP
-Linux/m68k Frame Buffer Device driver
-.TP 8
-Guenther Kelleter, \fIguenther@Pool.Informatik.RWTH-Aachen.de\fP
-Linux/m68k Frame Buffer Device driver
-.TP 8
-Frederic Lepied, \fILepied@XFree86.Org\fP
-XInput extension integration. Wacom, joystick and extended mouse drivers.
-.TP 8
-Patrick Lecoanet, \fIlecoanet@cena.dgac.fr\fP
-Elographics touchscreen driver.
-.TP 8
-Steven Lang, \fItiger@tyger.org\fP
-SummaSketch tablet driver.
-.PP
- ... and many more people out there on the net who helped with beta-testing
-this enhancement.
+.RS 4
+.nf
+Stuart Anderson \fIanderson@metrolink.com\fP
+Preston Brown \fIpbrown@redhat.com\fP
+Robin Cutshaw \fIrobin@xfree86.org\fP
+David Dawes \fIdawes@xfree86.org\fP
+Egbert Eich \fIeich@xfree86.org\fP
+Marc Evans \fImarc@xfree86.org\fP
+Dirk Hohndel \fIhohndel@xfree86.org\fP
+Alan Hourihane \fIalanh@xfree86.org\fP
+Harald Koenig \fIkoenig@xfree86.org\fP
+Marc La France \fItsi@xfree86.org\fP
+Kevin Martin \fImartin@xfree86.org\fP
+Rich Murphey \fIrich@xfree86.org\fP
+Takaaki Nomura \fIamadeus@yk.rim.or.jp\fP
+Keith Packard \fIkeithp@xfree86.org\fP
+Jon Tombs \fIjon@gtex02.us.es\fP
+Mark Vojkovich \fImarkv@xfree86.org\fP
+David Wexelblat \fIdwex@xfree86.org\fP
+.fi
+.RE
.PP
\fIXFree86\fP source is available from the FTP server
-\fIftp.XFree86.org\fP, among others. Send email to
-\fIXFree86@XFree86.org\fP for details.
-.\" $XConsortium: XFree86.man /main/25 1996/12/09 17:33:22 kaleb $
+\fI<ftp://ftp.XFree86.org/pub/XFree86/>\fP, among others. Documentation
+and other information can be found from the XFree86 web site
+\fI<http://www.xfree86.org/>\fP.
diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile
index 1e34a5749..d72ac7aba 100644
--- a/xc/programs/Xserver/hw/xfree86/common/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.126 2001/02/15 18:20:33 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.130 2001/03/24 16:32:41 herrb Exp $
@@ -17,7 +17,8 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.126 2001/02/
KBD = xf86KbdMach
#endif /* GNUMachArchitecture */
#else
-# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture)
+# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \
+ || defined(OpenBSDArchitecture) && defined(PpcArchitecture)
KBD = xf86KbdBSD
# else
# ifdef LinuxArchitecture
@@ -59,10 +60,6 @@ LOGDEFINES = -DDEFAULT_LOGPREFIX=\"$(LOGDIRECTORY)/XLogFile.\"
EXT_MODULES_DEFINES = $(GLX_DEFINES)
#endif
-#if defined(LinuxArchitecture) && defined(PpcArchitecture)
- KBDDEFINES = -DASSUME_CUSTOM_KEYCODES
-#endif
-
#ifndef XF86ExpireServer
#define XF86ExpireServer NO
#endif
@@ -109,6 +106,7 @@ SRCS = \
xf86VidMode.c \
xf86fbman.c \
xf86xv.c \
+ xf86xvmc.c \
xf86cmap.c\
xf86PM.c \
$(DEBUGSRC) \
@@ -143,6 +141,7 @@ OBJS = \
xf86VidMode.o \
xf86fbman.o \
xf86xv.o \
+ xf86xvmc.o \
xf86cmap.o\
xf86PM.o \
$(DEBUGOBJ) \
@@ -180,7 +179,6 @@ CUSTOMVERSION = XFree86CustomVersion
#endif
CONSDEFINES = XFree86ConsoleDefines
EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES)
-PROJECTROOT = ProjectRoot
DRIVERS = XF86CardDrivers
IDRIVERS = XInputDrivers
XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \
diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h
index 134136122..bfaa57499 100644
--- a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h
+++ b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.15 2000/08/11 23:59:48 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.16 2001/03/07 19:53:16 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -189,9 +189,14 @@
#define KEY_F13 /* F13 0x6e */ 110
#define KEY_F14 /* F14 0x6f */ 111
#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
#define KEY_F16 /* F16 0x71 */ 113
#define KEY_F17 /* F17 0x72 */ 114
#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+#define KEY_BSlash2 /* \ _ 0x73 */ 115
+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
+#define KEY_Yen /* Yen 0x7d */ 125
/* These are for "notused" and "uknown" entries in translation maps. */
#define KEY_NOTUSED 0
diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h
index d9e17bfdc..0e93aac95 100644
--- a/xc/programs/Xserver/hw/xfree86/common/compiler.h
+++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.77 2001/01/06 21:29:04 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.79 2001/04/01 14:00:07 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -429,6 +429,19 @@ __ustw (unsigned long r5, unsigned short * r11)
#define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
#define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
+/*
+ * This is overkill, but for different reasons depending on where it is used.
+ * This is thus general enough to be used everywhere cache flushes are needed.
+ * It doesn't handle memory access serialisation by other processors, though.
+ */
+#define ia64_flush_cache(Addr) \
+ __asm__ __volatile__ ( \
+ "fc %0;;;" \
+ "sync.i;;;" \
+ "mf;;;" \
+ "srlz.i;;;" \
+ :: "r"(Addr) : "memory")
+
#undef outb
#undef outw
#undef outl
@@ -1510,27 +1523,28 @@ extern void xf86JensenMemToBus(char *, long, long, int);
extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
+
/* Some macros to hide the system dependencies for MMIO accesses */
/* Changed to kill noise generated by gcc's -Wcast-align */
#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
-# if defined (JENSEN_SUPPORT)
#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
+
+# if defined (JENSEN_SUPPORT)
#define MMIO_OUT32(base, offset, val) \
(*xf86WriteMmio32)((CARD32)(val), base, offset)
#define MMIO_ONB32(base, offset, val) \
(*xf86WriteMmioNB32)((CARD32)(val), base, offset)
# else
-#define MMIO_IN32(base, offset) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
#define MMIO_OUT32(base, offset, val) \
do { \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
write_mem_barrier(); \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
} while (0)
#define MMIO_ONB32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
# endif
+
#define MMIO_OUT8(base, offset, val) \
(*xf86WriteMmio8)((CARD8)(val), base, offset)
#define MMIO_OUT16(base, offset, val) \
@@ -1539,6 +1553,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
(*xf86WriteMmioNB8)((CARD8)(val), base, offset)
#define MMIO_ONB16(base, offset, val) \
(*xf86WriteMmioNB16)((CARD16)(val), base, offset)
+
#elif defined(__powerpc__)
/*
* we provide byteswapping and no byteswapping functions here
@@ -1550,6 +1565,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
xf86WriteMmio8(base, offset, (CARD8)(val))
# define MMIO_ONB8(base, offset, val) \
xf86WriteMmioNB8(base, offset, (CARD8)(val))
+
# if defined(PPC_MMIO_IS_BE) /* No byteswapping */
# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
@@ -1573,6 +1589,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
# define MMIO_ONB32(base, offset, val) \
xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
# endif
+
static __inline__ void ppc_flush_icache(char *addr)
{
__asm__ volatile (
@@ -1597,6 +1614,7 @@ static __inline__ void ppc_flush_icache(char *addr)
xf86WriteMmio8(base, offset, (CARD8)(val))
# define MMIO_ONB8(base, offset, val) \
xf86WriteMmio8NB(base, offset, (CARD8)(val))
+
# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */
# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
@@ -1620,7 +1638,9 @@ static __inline__ void ppc_flush_icache(char *addr)
# define MMIO_ONB32(base, offset, val) \
xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
# endif
+
#else /* !__alpha__ && !__powerpc__ && !__sparc__ */
+
#define MMIO_IN8(base, offset) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset))
#define MMIO_IN16(base, offset) \
@@ -1636,6 +1656,7 @@ static __inline__ void ppc_flush_icache(char *addr)
#define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
#define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
#define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
+
#endif /* __alpha__ */
/*
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h
index 3abc4cf8f..0835d874c 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.147 2000/12/07 20:26:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.150 2001/04/05 17:42:31 dawes Exp $ */
/*
* Copyright (c) 1997 by The XFree86 Project, Inc.
@@ -42,6 +42,8 @@ extern Bool fbSlotClaimed;
#ifdef __sparc__
extern Bool sbusSlotClaimed;
#endif
+extern confDRIRec xf86ConfigDRI;
+
#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
#define XF86FLIP_PIXELS() \
@@ -134,6 +136,7 @@ pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
char n, pciVideoPtr pvp_exclude);
pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
char n, pciVideoPtr pvp_exclude);
+void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable);
void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
#ifdef async
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
index 79b9925f1..3533bb7d4 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.60 2001/02/15 20:31:44 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.61 2001/04/01 14:00:07 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
*/
@@ -1413,23 +1413,21 @@ RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated
/* Possibly ignore estimated resources */
if (!useEstimated && (pRes->res_type & ResEstimated)) continue;
/*
- * target should be a larger region than pRes. If pRes fully
+ * Target should be a larger region than pRes. If pRes fully
* contains target, don't do anything.
*/
if (pRes->block_begin <= target->block_begin &&
pRes->block_end >= target->block_end)
continue;
/*
- * cases where the target and pRes have the same starting address
- * cannot be resolved, so skip them (with a warning).
+ * In cases where the target and pRes have the same starting
+ * address, reduce the size of the target (given it's an estimate).
*/
if (pRes->block_begin == target->block_begin) {
- xf86MsgVerb(X_WARNING, 3, "Unresolvable overlap at 0x%08x\n",
- pRes->block_begin);
- continue;
+ target->block_end = pRes->block_end;
}
/* Otherwise, trim target to remove the overlap */
- if (pRes->block_begin <= target->block_end) {
+ else if (pRes->block_begin <= target->block_end) {
target->block_end = pRes->block_begin - 1;
} else if (!pow2Alignment &&
pRes->block_end >= target->block_begin) {
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
index 676190b55..4f524be61 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.239 2001/02/15 20:31:46 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.241 2001/03/28 17:58:39 dawes Exp $ */
/*
@@ -774,14 +774,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
Bool value;
MessageType from;
- if(flagsconf == NULL)
- return TRUE;
/*
* Merge the ServerLayout and ServerFlags options. The former have
* precedence over the latter.
*/
optp = NULL;
- if (flagsconf->flg_option_lst)
+ if (flagsconf && flagsconf->flg_option_lst)
optp = xf86optionListDup(flagsconf->flg_option_lst);
if (layoutopts) {
tmp = xf86optionListDup(layoutopts);
@@ -938,9 +936,9 @@ static Bool
configInputKbd(IDevPtr inputp)
{
char *s;
-#ifdef XKB
MessageType from = X_DEFAULT;
-#endif
+ Bool customKeycodesDefault = FALSE;
+ int verb = 0;
/* Initialize defaults */
xf86Info.xleds = 0L;
@@ -953,6 +951,7 @@ configInputKbd(IDevPtr inputp)
#if defined(SVR4) && defined(i386)
xf86Info.panix106 = FALSE;
#endif
+ xf86Info.kbdCustomKeycodes = FALSE;
#ifdef XKB
if (!xf86IsPc98()) {
xf86Info.xkbrules = "xfree86";
@@ -1135,6 +1134,39 @@ configInputKbd(IDevPtr inputp)
}
#endif
+ /*
+ * This was once a compile time option (ASSUME_CUSTOM_KEYCODES)
+ * defaulting to 1 on Linux/PPC. It is no longer necessary, but for
+ * backwards compatibility we provide 'Option "CustomKeycodes"'
+ * and try to autoprobe on Linux/PPC.
+ */
+ from = X_DEFAULT;
+ verb = 2;
+#if defined(__linux__) && defined(__powerpc__)
+ {
+ FILE *f;
+
+ f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
+ if (f) {
+ if (fgetc(f) == '0') {
+ customKeycodesDefault = TRUE;
+ from = X_PROBED;
+ verb = 1;
+ }
+ fclose(f);
+ }
+ }
+#endif
+ if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) {
+ from = X_CONFIG;
+ verb = 1;
+ }
+ xf86Info.kbdCustomKeycodes =
+ xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes",
+ customKeycodesDefault);
+ xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n",
+ xf86Info.kbdCustomKeycodes ? "enabled" : "disabled");
+
return TRUE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c
index 3557c9948..24bd7ada2 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c
@@ -3,7 +3,7 @@
Written by Mark Vojkovich
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.39 2001/02/15 20:31:50 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.40 2001/03/04 01:29:03 tsi Exp $ */
#include "xf86.h"
#include "xf86str.h"
@@ -228,7 +228,7 @@ DGAInstallColormap(ColormapPtr pmap)
ScreenPtr pScreen = pmap->pScreen;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if(pScreenPriv->current) {
+ if(pScreenPriv->current && pScreenPriv->dgaColormap) {
if (pmap != pScreenPriv->dgaColormap) {
pScreenPriv->savedColormap = pmap;
pmap = pScreenPriv->dgaColormap;
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
index 76b15f4fd..75badb64b 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.104 2000/12/07 20:32:54 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.107 2001/03/08 00:40:42 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -295,9 +295,9 @@ ProcessInputEvents ()
* ifdefs further (hv).
*/
-#ifdef ASSUME_CUSTOM_KEYCODES
+#ifdef __linux__
extern u_char SpecialServerMap[];
-#endif /* ASSUME_CUSTOM_KEYCODES */
+#endif
#if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__)
void
@@ -347,30 +347,27 @@ xf86PostKbdEvent(unsigned key)
* PANIX returns DICOP standards based keycodes in using 106jp
* keyboard. We need to remap some keys.
*/
-#define KEY_P_UP 0x5A
-#define KEY_P_PGUP 0x5B
-#define KEY_P_LEFT 0x5C
-#define KEY_P_BKSL 0x73
-#define KEY_P_YEN 0x7D
-#define KEY_P_NFER 0x7B
-#define KEY_P_XFER 0x79
-
if(xf86Info.panix106 == TRUE){
switch (scanCode) {
- /* case 0x78: scanCode = KEY_P_UP; break; not needed*/
- case 0x56: scanCode = KEY_P_BKSL; break; /* Backslash */
- case 0x5A: scanCode = KEY_P_NFER; break; /* No Kanji Transfer*/
- case 0x5B: scanCode = KEY_P_XFER; break; /* Kanji Tranfer */
- case 0x5C: scanCode = KEY_P_YEN; break; /* Yen curs pgup */
- case 0x6B: scanCode = KEY_P_LEFT; break; /* Cur Left */
- case 0x6F: scanCode = KEY_P_PGUP; break; /* Cur PageUp */
+ case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */
+ case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/
+ case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */
+ case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */
+ case 0x6B: scanCode = KEY_Left; break; /* Cur Left */
+ case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */
case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
}
}
#endif /* i386 && SVR4 */
-#ifndef ASSUME_CUSTOM_KEYCODES
+#ifdef __linux__
+ if (xf86Info.kbdCustomKeycodes) {
+ specialkey = SpecialServerMap[scanCode];
+ goto customkeycodes;
+ }
+#endif
+
/*
* First do some special scancode remapping ...
*/
@@ -457,18 +454,14 @@ xf86PostKbdEvent(unsigned key)
if (scanCode != KEY_NumLock) return;
scanCode = KEY_Pause; /* pause */
}
-#endif /* !ASSUME_CUSTOM_KEYCODES */
/*
* and now get some special keysequences
*/
-#ifdef ASSUME_CUSTOM_KEYCODES
- specialkey = SpecialServerMap[scanCode];
-#else /* ASSUME_CUSTOM_KEYCODES */
specialkey = scanCode;
-#endif /* ASSUME_CUSTOM_KEYCODES */
+customkeycodes:
if (xf86IsPc98()) {
switch (scanCode) {
case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
@@ -859,25 +852,25 @@ special:
updateLeds = TRUE;
}
-#ifndef ASSUME_CUSTOM_KEYCODES
- /*
- * normal, non-keypad keys
- */
- if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
-#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) && !defined(__CYGWIN__)
+ if (!xf86Info.kbdCustomKeycodes) {
/*
- * magic ALT_L key on AT84 keyboards for multilingual support
+ * normal, non-keypad keys
*/
- if (xf86Info.kbdType == KB_84 &&
- ModifierDown(AltMask) &&
- keysym[2] != NoSymbol)
- {
- UsePrefix = TRUE;
- Direction = TRUE;
- }
+ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
+#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__)
+ /*
+ * magic ALT_L key on AT84 keyboards for multilingual support
+ */
+ if (xf86Info.kbdType == KB_84 &&
+ ModifierDown(AltMask) &&
+ keysym[2] != NoSymbol)
+ {
+ UsePrefix = TRUE;
+ Direction = TRUE;
+ }
#endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */
+ }
}
-#endif /* !ASSUME_CUSTOM_KEYCODES */
if (updateLeds) xf86KbdLeds();
#ifdef XKB
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
index 4ce0bd06a..19a8bc4a0 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.28 2000/03/08 05:38:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.29 2001/03/05 20:18:19 dawes Exp $ */
/*
* Copyright (c) 1997 by The XFree86 Project, Inc.
@@ -137,6 +137,7 @@ xf86InfoRec xf86Info = {
#if defined(i386) || defined(__i386__)
FALSE, /* pc98 */
#endif
+ FALSE, /* kbdCustomKeycodes */
TRUE, /* pmFlag */
0 /* estimateSizesAggressively */
};
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c
index 375cf8391..ba740e464 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.14 2000/08/11 17:27:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.15 2001/03/08 23:23:32 dawes Exp $ */
/*
* Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
* which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
@@ -40,7 +40,7 @@
#define KD_GET_ENTRY(i,n) \
eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-static unsigned char remap[128] = {
+static unsigned char remap[NUM_KEYCODES] = {
0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
@@ -131,6 +131,74 @@ static KeySym eascii_to_x[512] = {
* special marked entries (256 + x)
*/
+#if 1
+ /* This has been checked against what syscons actually does */
+ NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
+ XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
+ XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_F1,
+ XK_F2, XK_F3, XK_F4, XK_F5,
+ XK_F6, XK_F7, XK_F8, XK_F9,
+ XK_F10, XK_F11, XK_F12, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol
+#else
+ /* The old table, supposedly for pcvt. */
NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
@@ -194,6 +262,8 @@ static KeySym eascii_to_x[512] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol
+#endif
};
#ifdef __OpenBSD__
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c
index 5a6d1df28..1f97c0b15 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.15 1999/04/29 05:12:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.16 2001/03/05 20:18:20 dawes Exp $ */
/*
* Linux version of keymapping setup. The kernel (since 0.99.14) has support
* for fully remapping the keyboard, but there are some differences between
@@ -205,8 +205,6 @@ static KeySym linux_to_x[256] = {
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
-#ifndef ASSUME_CUSTOM_KEYCODES
-
/*
* Maps the AT keycodes to Linux keycodes
*/
@@ -279,19 +277,16 @@ static unsigned char at2lnx[NUM_KEYCODES] =
};
#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-#else /* !ASSUME_CUSTOM_KEYCODES */
-
-#define NUM_AT2LNX NR_KEYS
-
-u_char SpecialServerMap[NR_KEYS];
+#define NUM_CUSTOMKEYS NR_KEYS
-#endif /* !ASSUME_CUSTOM_KEYCODES */
+u_char SpecialServerMap[NUM_CUSTOMKEYS];
static void
readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
{
KeySym *k;
int i;
+ int maxkey;
static unsigned char tbl[GLYPHS_PER_KEY] =
{
0, /* unshifted */
@@ -312,20 +307,24 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
tbl[2] = 8; /* alt */
tbl[3] = tbl[2] | 1;
-#ifndef ASSUME_CUSTOM_KEYCODES
- for (i = 0, k = map+GLYPHS_PER_KEY; i < NUM_AT2LNX; ++i)
-#else /* !ASSUME_CUSTOM_KEYCODES */
- for (i = 0, k = map; i < NUM_AT2LNX; ++i)
-#endif /* !ASSUME_CUSTOM_KEYCODES */
+ if (xf86Info.kbdCustomKeycodes) {
+ k = map;
+ maxkey = NUM_CUSTOMKEYS;
+ }
+ else {
+ k = map+GLYPHS_PER_KEY;
+ maxkey = NUM_AT2LNX;
+ }
+
+ for (i = 0; i < maxkey; ++i)
{
struct kbentry kbe;
int j;
-#ifndef ASSUME_CUSTOM_KEYCODES
- kbe.kb_index = at2lnx[i];
-#else /* !ASSUME_CUSTOM_KEYCODES */
- kbe.kb_index = i;
-#endif /* !ASSUME_CUSTOM_KEYCODES */
+ if (xf86Info.kbdCustomKeycodes)
+ kbe.kb_index = i;
+ else
+ kbe.kb_index = at2lnx[i];
for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
{
@@ -335,9 +334,7 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
kbe.kb_table = tbl[j];
if (
-#ifndef ASSUME_CUSTOM_KEYCODES
- kbe.kb_index == 0 ||
-#endif /* !ASSUME_CUSTOM_KEYCODES */
+ (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) ||
ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
continue;
@@ -549,11 +546,14 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
}
-#ifdef ASSUME_CUSTOM_KEYCODES
+
+ if (!xf86Info.kbdCustomKeycodes)
+ return;
+
/*
* Find the Mapping for the special server functions
*/
- for (i = 0; i < NR_KEYS; ++i) {
+ for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
struct kbentry kbe;
int special = 0;
@@ -618,5 +618,4 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
}
SpecialServerMap[i] = special;
}
-#endif /* ASSUME_CUSTOM_KEYCODES */
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h
index d53e0f916..71883403b 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.13 2000/08/11 17:27:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.14 2001/03/08 23:23:32 dawes Exp $ */
/*
*
* For Scancodes see notes in atKeynames.h !!!!
@@ -22,7 +22,7 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
/* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
/* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
- /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
/* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
/* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
/* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
@@ -118,23 +118,24 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol,
/* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol,
/* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ XK_backslash, XK_underscore, NoSymbol, NoSymbol,
/* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol,
/* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol,
/* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
/* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
};
#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && !defined(linux) && !defined(CSRG_BASED)
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
index 13ef6379e..a16bed340 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.38 2001/02/15 20:31:51 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.39 2001/03/22 03:51:39 dawes Exp $ */
/*
* Copyright (c) 1997,1998 by The XFree86 Project, Inc.
@@ -1736,9 +1736,12 @@ xf86PrintModes(ScrnInfoPtr scrp)
desc = desc2 = "";
if (p->HSync > 0.0)
hsync = p->HSync;
- else
+ else if (p->HTotal > 0)
hsync = (float)p->Clock / (float)p->HTotal;
- refresh = hsync * 1000.0 / p->VTotal;
+ else
+ hsync = 0.0;
+ if (p->VTotal > 0)
+ refresh = hsync * 1000.0 / p->VTotal;
if (p->Flags & V_INTERLACE) {
refresh *= 2.0;
desc = " (I)";
@@ -1759,7 +1762,10 @@ xf86PrintModes(ScrnInfoPtr scrp)
prefix = "Default mode";
else
prefix = "Mode";
- if (p->Clock == p->SynthClock) {
+ if (hsync == 0 || refresh == 0) {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s \"%s\"\n", prefix, p->name);
+ } else if (p->Clock == p->SynthClock) {
xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
"%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n",
prefix, p->name, p->Clock / 1000.0, hsync, refresh,
@@ -1771,7 +1777,8 @@ xf86PrintModes(ScrnInfoPtr scrp)
prefix, p->name, p->Clock / 1000.0,
p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
}
- PrintModeline(scrp->scrnIndex,p);
+ if (hsync != 0 && refresh != 0)
+ PrintModeline(scrp->scrnIndex,p);
p = p->next;
} while (p != NULL && p != scrp->modes);
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
index 41c86c6bb..8e02cd11a 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.27 2000/11/14 16:54:49 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.28 2001/03/13 16:03:36 dawes Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -62,8 +62,8 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 1)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 3)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 1)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 4)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 2)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 2)
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h
index 4bb128eaa..85c47b5ba 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.10 2000/08/04 16:13:25 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.11 2001/03/13 16:03:36 dawes Exp $ */
/* Option handling things that ModuleSetup procs can use */
@@ -43,6 +43,7 @@ typedef struct {
} OptionInfoRec, *OptionInfoPtr;
int xf86SetIntOption(pointer optlist, const char *name, int deflt);
+double xf86SetRealOption(pointer optlist, const char *name, double deflt);
char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
int xf86SetBoolOption(pointer list, const char *name, int deflt );
pointer xf86AddNewOption(pointer head, char *name, char *val );
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c
index a3ceb5800..4944d8062 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.21 2000/10/20 14:58:59 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.22 2001/03/13 16:03:36 dawes Exp $ */
/*
* Copyright (c) 1998 by The XFree86 Project, Inc.
@@ -155,6 +155,19 @@ xf86SetIntOption(pointer optlist, const char *name, int deflt)
}
+double
+xf86SetRealOption(pointer optlist, const char *name, double deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_REAL;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.realnum;
+ return deflt;
+}
+
+
char *
xf86SetStrOption(pointer optlist, const char *name, char *deflt)
{
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
index 048a6d887..a1aa5ecdc 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.88 2001/02/17 23:19:51 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.94 2001/04/05 21:29:13 dawes Exp $ */
/*
* PCI Probe
*
@@ -150,6 +150,7 @@
#define PCI_VENDOR_TRITECH 0x1292
#define PCI_VENDOR_NVIDIA_SGS 0x12d2
#define PCI_VENDOR_NETGEAR 0x1385
+#define PCI_VENDOR_VMWARE 0x15AD
#define PCI_VENDOR_SYMPHONY 0x1C1C
#define PCI_VENDOR_TEKRAM_2 0x1DE1
#define PCI_VENDOR_3DLABS 0x3D3D
@@ -341,6 +342,8 @@
#define PCI_CHIP_9750 0x9750
#define PCI_CHIP_9850 0x9850
#define PCI_CHIP_9880 0x9880
+#define PCI_CHIP_9910 0x9910
+#define PCI_CHIP_9930 0x9930
/* ALI */
#define PCI_CHIP_M1435 0x1435
@@ -489,21 +492,25 @@
#define PCI_CHIP_GEFORCE2GTS_1 0x0151
#define PCI_CHIP_GEFORCE2ULTRA 0x0152
#define PCI_CHIP_QUADRO2PRO 0x0153
-#define PCI_CHIP_0200 0x0200
-#define PCI_CHIP_0201 0x0201
-#define PCI_CHIP_0202 0x0202
-#define PCI_CHIP_0203 0x0203
+#define PCI_CHIP_GEFORCE3 0x0200
+#define PCI_CHIP_GEFORCE3_1 0x0201
+#define PCI_CHIP_GEFORCE3_2 0x0202
+#define PCI_CHIP_GEFORCE3_3 0x0203
/* NVIDIA & SGS */
#define PCI_CHIP_RIVA128 0x0018
+/* IMS */
+#define PCI_CHIP_IMSTT128 0x9128
+#define PCI_CHIP_IMSTT3D 0x9135
+
/* Alliance Semiconductor */
#define PCI_CHIP_AP6410 0x3210
#define PCI_CHIP_AP6422 0x6422
#define PCI_CHIP_AT24 0x6424
#define PCI_CHIP_AT3D 0x643D
-/* 3Dfx Interactive */
+/* 3dfx Interactive */
#define PCI_CHIP_VOODOO_GRAPHICS 0x0001
#define PCI_CHIP_VOODOO2 0x0002
#define PCI_CHIP_BANSHEE 0x0003
@@ -524,6 +531,10 @@
#define PCI_CHIP_GAMMA 0x0008
#define PCI_CHIP_PERMEDIA2V 0x0009
#define PCI_CHIP_PERMEDIA3 0x000A
+#define PCI_CHIP_PERMEDIA4 0x000C
+#define PCI_CHIP_R4 0x000D
+#define PCI_CHIP_GAMMA2 0x000E
+#define PCI_CHIP_R4ALT 0x0011
/* S3 */
#define PCI_CHIP_PLATO 0x0551
@@ -598,6 +609,10 @@
#define PCI_CHIP_SMI712 0x712
#define PCI_CHIP_SMI720 0x720
+/* VMware */
+#define PCI_CHIP_VMWARE0405 0x0405
+#define PCI_CHIP_VMWARE0710 0x0710
+
/*
* first the VendorId - VendorName mapping
*/
@@ -699,7 +714,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = {
{PCI_VENDOR_RICOH, "Ricoh"},
{PCI_VENDOR_ZEINET, "Zeinet"},
{PCI_VENDOR_LITEON, "Lite-On"},
- {PCI_VENDOR_3DFX, "3Dfx Interactive"},
+ {PCI_VENDOR_3DFX, "3dfx Interactive"},
{PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"},
{PCI_VENDOR_ENSONIQ, "Ensoniq"},
{PCI_VENDOR_ROCKWELL, "Rockwell"},
@@ -718,6 +733,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = {
{PCI_VENDOR_ARK, "ARK Logic"},
{PCI_VENDOR_YAMAHA, "Yamaha"},
{PCI_VENDOR_SMI, "Silicon Motion Inc."},
+ {PCI_VENDOR_VMWARE, "VMware"},
{0,NULL}
};
#endif
@@ -854,7 +870,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_VENDOR_DIGITAL, {
{PCI_CHIP_DEC21030, "21030/TGA",0},
{0x0001, "DC21050 PCI-PCI Bridge"
- /* print_pcibridge} */,0 },
+ /* print_pcibridge */,0 },
{0x0002, "DC21040 10Mb/s Ethernet",0 },
{0x0009, "DC21140 10/100 Mb/s Ethernet",0 },
{0x000D, "TGA2",0 },
@@ -919,6 +935,8 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_9750, "3DImage975",0},
{PCI_CHIP_9850, "3DImage985",0},
{PCI_CHIP_9880, "Blade3D",0},
+ {PCI_CHIP_9910, "Cyber/BladeXP",0},
+ {PCI_CHIP_9930, "CyberBlade/XPm",0},
{PCI_CHIP_8400, "CyberBlade/i7",0},
{PCI_CHIP_8420, "CyberBlade/DSTN/i7",0},
{PCI_CHIP_8500, "CyberBlade/i1",0},
@@ -1228,11 +1246,19 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0},
{PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0},
{PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0},
+ {PCI_CHIP_GEFORCE3, "GeForce3",0},
+ {PCI_CHIP_GEFORCE3_1, "GeForce3 (rev 1)",0},
+ {PCI_CHIP_GEFORCE3_2, "GeForce3 (rev 2)",0},
+ {PCI_CHIP_GEFORCE3_3, "GeForce3 (rev 3)",0},
{0x0000, NULL,0}}},
-#ifdef VENDOR_INCLUDE_NONVIDEO
{PCI_VENDOR_IMS, {
+ {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0},
+ {PCI_CHIP_IMSTT3D, "TwinTurbo 3D", 0},
+#ifdef VENDOR_INCLUDE_NONVIDEO
{0x8849, "8849",0 },
+#endif
{0x0000, NULL,0}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
{PCI_VENDOR_TEKRAM, {
{0x690C, "DC690C",0 },
{0x0000, NULL,0}}},
@@ -1388,6 +1414,10 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_GAMMA, "GLINT Gamma",0},
{PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0},
{PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0},
+ {PCI_CHIP_PERMEDIA4, "GLINT Permedia 4",0},
+ {PCI_CHIP_R4, "GLINT R4",0},
+ {PCI_CHIP_R4ALT, "GLINT R4 (Alt)",0},
+ {PCI_CHIP_GAMMA2, "GLINT Gamma 2",0},
{0x0000, NULL,0}}},
{PCI_VENDOR_AVANCE_2, {
{PCI_CHIP_ALG2064, "ALG2064",0},
@@ -1521,6 +1551,10 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_SMI712, "LynxEM+",0},
{PCI_CHIP_SMI720, "Lynx3DM",0},
{0x0000, NULL,0}}},
+ {PCI_VENDOR_VMWARE, {
+ {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0},
+ {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0},
+ {0x0000, NULL,0}}},
{0x0000, {
{0x0000, NULL,0}}},
};
@@ -1578,14 +1612,14 @@ static pciVendorCardInfo xf86PCICardInfoData[] = {
{ 0x0000, (char *)NULL,0, NF } } },
#endif
{ PCI_VENDOR_SONY, {
- { 0x8051, "Vaio Video",0,NF },
+ { 0x8051, "Vaio Video",0,NF },
#ifdef VENDOR_INCLUDE_NONVIDEO
- { 0x8052, "Vaio Audio",0,NF },
- { 0x8054, "Vaio Firewire",0,NF },
- { 0x8056, "Vaio Modem",0,NF },
- { 0x8057, "Vaio Ethernet",0,NF },
+ { 0x8052, "Vaio Audio",0,NF },
+ { 0x8054, "Vaio Firewire",0,NF },
+ { 0x8056, "Vaio Modem",0,NF },
+ { 0x8057, "Vaio Ethernet",0,NF },
#endif
- { 0x0000, (char *)NULL,0, NF } } },
+ { 0x0000, (char *)NULL,0, NF } } },
{ PCI_VENDOR_DIAMOND, {
{ 0x0003, "Monster Fusion",0, NF },
{ 0x00b8, "Fire GL1",0, NF },
@@ -1609,8 +1643,25 @@ static pciVendorCardInfo xf86PCICardInfoData[] = {
{ 0x3db3, "Jeronimo Pro",0, NF },
{ 0x0000, (char *)NULL,0, NF } } },
{ PCI_VENDOR_3DLABS, {
- { 0x0106, "GMX2000",0, NF },
- { 0x0116, "GVX1",0, NF },
+ { 0x0096, "Permedia",0, NF },
+ { 0x0098, "PermediaNT",0, NF },
+ { 0x0099, "PermediaLC",0, NF },
+ { 0x0100, "Permedia2 PCI",0, NF },
+ { 0x0101, "Permedia2 AGP",0, NF },
+ { 0x0102, "Oxygen GMX2000 PCI",0, NF },
+ { 0x0106, "Oxygen GMX2000 AGP",0, NF },
+ { 0x0116, "Oxygen GVX1 AGP",0, NF },
+ { 0x0121, "Oxygen VX1 PCI",0, NF },
+ { 0x0122, "Oxygen ACX AGP",0, NF },
+ { 0x0123, "Oxygen ACX PCI",0, NF },
+ { 0x0125, "Oxygen VX1 AGP",0, NF },
+ { 0x0127, "Permedia3 Create!",0, NF },
+ { 0x0134, "Oxygen GVX1 PCI",0, NF },
+ { 0x0136, "Oxygen GVX210 AGP",0, NF },
+ { 0x0140, "Oxygen VX1-16 AGP",0, NF },
+ { 0x0144, "Oxygen VX1-4X AGP",0, NF },
+ { 0x0400, "Oxygen GVX420 AGP",0, NF },
+ { 0x0800, "Oxygen VX1-1600SW PCI",0, NF },
{ 0x0000, (char *)NULL,0, NF } } },
{ PCI_VENDOR_ELSA, {
{ 0x0914, "Winner 1000",0, NF },
@@ -1732,6 +1783,12 @@ static pciVendorCardInfo xf86PCICardInfoData[] = {
{ 0xf004, "FA310-TX Rev. D2",0, NF },
{ 0x0000, (char *)NULL,0, NF } } },
#endif
+#if 0
+ { PCI_VENDOR_VMWARE, {
+ {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0, NF },
+ {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0, NF },
+ {0x0000, NULL,0, NF } } },
+#endif
{0x0000, {
{0x0000, NULL,0, NF } } },
};
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
index 9bd5beb7e..8a8d22ea2 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.69 2000/12/07 15:43:40 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.70 2001/04/05 17:42:32 dawes Exp $ */
/*
* Copyright (c) 1997 by The XFree86 Project, Inc.
@@ -63,7 +63,6 @@ extern const char *xf86LogFile;
extern MessageType xf86LogFileFrom;
extern serverLayoutRec xf86ConfigLayout;
extern Pix24Flags xf86ConfigPix24;
-extern confDRIRec xf86ConfigDRI;
extern unsigned short xf86MouseCflags[];
extern Bool xf86SupportedMouseTypes[];
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
index f1e486434..08b8e2d85 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.22 2001/01/06 20:19:08 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.23 2001/03/05 20:18:21 dawes Exp $ */
/*
* Copyright (c) 1997,1998 by The XFree86 Project, Inc.
@@ -124,6 +124,7 @@ typedef struct {
#endif
Bool pmFlag;
int estimateSizesAggressively;
+ Bool kbdCustomKeycodes;
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
index 745ff0f9d..6e1224dc4 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.62 2000/09/22 23:41:01 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.63 2001/04/01 14:00:08 tsi Exp $ */
#include "Xfuncproto.h"
#include "Xmd.h"
@@ -31,7 +31,6 @@
#include "XIproto.h"
#endif
#include "xf86.h"
-#include "Xpoll.h"
#include "xf86Priv.h"
#include "xf86Xinput.h"
#ifdef XINPUT
@@ -61,7 +60,7 @@
#include <stdarg.h>
#include "osdep.h" /* EnabledDevices */
-
+#include "Xpoll.h"
#include "xf86_OSproc.h" /* sigio stuff */
/******************************************************************************
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
index bd3287834..c8a7fb00b 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.32 2000/11/29 15:51:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.33 2001/03/04 01:37:09 tsi Exp $ */
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
@@ -30,8 +30,7 @@
#ifndef NEED_EVENTS
#define NEED_EVENTS
#endif
-#include "X.h"
-#include "Xproto.h"
+#include "xf86str.h"
#include "inputstr.h"
#ifdef XINPUT
#include "extensions/XI.h"
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
index 7206af98b..f74d0d8b3 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.34 2001/02/16 21:38:38 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.39 2001/04/01 14:00:08 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -211,6 +211,7 @@ FindPCIVideoInfo(void)
if (PCINONSYSTEMCLASSES(baseclass, subclass)) {
info->size[j] =
pciGetBaseSize(pcrp->tag, j, TRUE, &info->validSize);
+ pcrp->minBasesize = info->validSize;
} else {
info->size[j] = pcrp->basesize[j];
info->validSize = pcrp->minBasesize;
@@ -844,7 +845,9 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) {
resPtr *res;
- if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class))
+ if (PCIINFOCLASSES((pcrp->listed_class & 0xffff) ?
+ ((pcrp->listed_class >> 8) & 0x0ff) :
+ pcrp->pci_base_class, pcrp->pci_sub_class))
continue;
/* Only process devices with type 0 headers */
@@ -886,7 +889,9 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
}
}
}
- if (pcrp->pci_baserom) {
+ /* Ignore disabled non-video ROMs */
+ if ((res == activeRes) &&
+ (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) {
P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom),
pcrp->basesize[6], ResExcMemBlock | resMisc);
if (range.rBegin) {
@@ -2985,3 +2990,20 @@ pciConvertRange2Host(int entityIndex, resRange *pRange)
pciTagConvertRange2Host(tag, pRange);
}
+
+void
+xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable)
+{
+ CARD32 temp;
+ PCITAG tag;
+
+ if (!pPci) return;
+
+ tag = pciTag(pPci->bus, pPci->device, pPci->func);
+ temp = pciReadLong(tag, PCI_CMD_STAT_REG);
+ if (enable)
+ pciWriteLong(tag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE);
+ else
+ pciWriteLong(tag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c
index 3c7be73ab..c2a5a1e0c 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c
@@ -20,7 +20,7 @@
* IN AN ACTION 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/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.5 2000/12/06 15:35:11 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.6 2001/03/03 22:16:35 tsi Exp $ */
#include <ctype.h>
#include <stdio.h>
@@ -276,7 +276,7 @@ xf86ParseSbusBusString(const char *busID, int *fbNum)
for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
len = strlen(sbusDeviceTable[i].promName);
if (!strncmp (sbusDeviceTable[i].promName, id, len)
- && isdigit(id + len))
+ && isdigit(id[len]))
break;
}
devId = sbusDeviceTable[i].devId;
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h
index bc0996c56..45fd72540 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.19 2000/11/02 16:33:27 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.20 2001/03/05 04:48:22 mvojkovi Exp $ */
#ifndef _XVDIX_H_
#define _XVDIX_H_
@@ -205,6 +205,7 @@ void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
/*** These are DDX layer privates ***/
+extern int XF86XvScreenIndex;
typedef struct {
CreateWindowProcPtr CreateWindow;
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c
new file mode 100644
index 000000000..4559359ec
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c
@@ -0,0 +1,201 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.3 2001/04/01 14:00:08 tsi Exp $ */
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+
+#ifdef XFree86LOADER
+#include "xvmodproc.h"
+#endif
+
+#include "xf86xvmc.h"
+
+#ifdef XFree86LOADER
+int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
+#else
+int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = XvMCScreenInit;
+#endif
+
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ int num_adaptors;
+ XF86MCAdaptorPtr *adaptors;
+ XvMCAdaptorPtr dixinfo;
+} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
+
+static unsigned long XF86XvMCGeneration = 0;
+static int XF86XvMCScreenIndex = -1;
+
+#define XF86XVMC_GET_PRIVATE(pScreen) \
+ (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr)
+
+
+static int
+xf86XvMCCreateContext (
+ XvPortPtr pPort,
+ XvMCContextPtr pContext,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)(
+ pScrn, pContext, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroyContext ( XvMCContextPtr pContext)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)(
+ pScrn, pContext);
+}
+
+static int
+xf86XvMCCreateSurface (
+ XvMCSurfacePtr pSurface,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)(
+ pScrn, pSurface, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroySurface (XvMCSurfacePtr pSurface)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)(
+ pScrn, pSurface);
+}
+
+static int
+xf86XvMCCreateSubpicture (
+ XvMCSubpicturePtr pSubpicture,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)(
+ pScrn, pSubpicture, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)(
+ pScrn, pSubpicture);
+}
+
+
+static Bool
+xf86XvMCCloseScreen (int i, ScreenPtr pScreen)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+
+ xfree(pScreenPriv->dixinfo);
+ xfree(pScreenPriv);
+
+ return (*pScreen->CloseScreen)(i, pScreen);
+}
+
+Bool xf86XvMCScreenInit(
+ ScreenPtr pScreen,
+ int num_adaptors,
+ XF86MCAdaptorPtr *adaptors
+)
+{
+ XvMCAdaptorPtr pAdapt;
+ xf86XvMCScreenPtr pScreenPriv;
+ XvScreenPtr pxvs =
+ (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr);
+
+ int i, j;
+
+ if(!XvMCScreenInitProc) return FALSE;
+
+ if(XF86XvMCGeneration != serverGeneration) {
+ if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ XF86XvMCGeneration = serverGeneration;
+ }
+
+ if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
+ return FALSE;
+
+ if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) {
+ xfree(pAdapt);
+ return FALSE;
+ }
+
+ pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv;
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86XvMCCloseScreen;
+
+ pScreenPriv->num_adaptors = num_adaptors;
+ pScreenPriv->adaptors = adaptors;
+ pScreenPriv->dixinfo = pAdapt;
+
+ for(i = 0; i < num_adaptors; i++) {
+ pAdapt[i].xv_adaptor = NULL;
+ for(j = 0; j < pxvs->nAdaptors; j++) {
+ if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) {
+ pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]);
+ break;
+ }
+ }
+ if(!pAdapt[i].xv_adaptor) {
+ /* no adaptor by that name */
+ xfree(pAdapt);
+ return FALSE;
+ }
+ pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
+ pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces);
+ pAdapt[i].num_subpictures = (*adaptors)->num_subpictures;
+ pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures);
+ pAdapt[i].CreateContext = xf86XvMCCreateContext;
+ pAdapt[i].DestroyContext = xf86XvMCDestroyContext;
+ pAdapt[i].CreateSurface = xf86XvMCCreateSurface;
+ pAdapt[i].DestroySurface = xf86XvMCDestroySurface;
+ pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture;
+ pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture;
+ adaptors++;
+ }
+
+ if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h
new file mode 100644
index 000000000..fe3320607
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h
@@ -0,0 +1,134 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.3 2001/04/01 14:00:08 tsi Exp $ */
+
+#ifndef _XF86XVMC_H
+#define _XF86XVMC_H
+
+#include "xvmc.h"
+#include "xf86xv.h"
+
+typedef struct {
+ int num_xvimages;
+ int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */
+} XF86MCImageIDList;
+
+typedef struct {
+ int surface_type_id; /* Driver generated. Must be unique on the port */
+ int chroma_format;
+ int color_description;
+ unsigned short max_width;
+ unsigned short max_height;
+ unsigned short subpicture_max_width;
+ unsigned short subpicture_max_height;
+ int mc_type;
+ int flags;
+ XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
+} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
+
+
+/*
+ xf86XvMCCreateContextProc
+
+ DIX will fill everything out in the context except the driver_priv.
+ The port_priv holds the private data specified for the port when
+ Xv was initialized by the driver.
+ The driver may store whatever it wants in driver_priv and edit
+ the width, height and flags. If the driver wants to return something
+ to the client it can allocate space in priv and specify the number
+ of 32 bit words in num_priv. This must be dynamically allocated
+ space because DIX will free it after it passes it to the client.
+*/
+
+
+typedef int (*xf86XvMCCreateContextProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCContextPtr context,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroyContextProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCContextPtr context
+);
+
+/*
+ xf86XvMCCreateSurfaceProc
+
+ DIX will fill everything out in the surface except the driver_priv.
+ The driver may store whatever it wants in driver_priv. The driver
+ may pass data back to the client in the same manner as the
+ xf86XvMCCreateContextProc.
+*/
+
+
+typedef int (*xf86XvMCCreateSurfaceProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroySurfaceProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface
+);
+
+/*
+ xf86XvMCCreateSubpictureProc
+
+ DIX will fill everything out in the subpicture except the driver_priv,
+ num_palette_entries, entry_bytes and component_order. The driver may
+ store whatever it wants in driver_priv and edit the width and height.
+ If it is a paletted subpicture the driver needs to fill out the
+ num_palette_entries, entry_bytes and component_order. These are
+ not communicated to the client until the time the surface is
+ created.
+
+ The driver may pass data back to the client in the same manner as the
+ xf86XvMCCreateContextProc.
+*/
+
+
+typedef int (*xf86XvMCCreateSubpictureProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroySubpictureProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture
+);
+
+
+typedef struct {
+ char *name;
+ int num_surfaces;
+ XF86MCSurfaceInfoPtr *surfaces;
+ int num_subpictures;
+ XF86ImagePtr *subpictures;
+ xf86XvMCCreateContextProcPtr CreateContext;
+ xf86XvMCDestroyContextProcPtr DestroyContext;
+ xf86XvMCCreateSurfaceProcPtr CreateSurface;
+ xf86XvMCDestroySurfaceProcPtr DestroySurface;
+ xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
+ xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
+} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
+
+/*
+ xf86XvMCScreenInit
+
+ Unlike Xv, the adaptor data is not copied from this structure.
+ This structure's data is used so it must stick around for the
+ life of the server. Note that it's an array of pointers not
+ an array of structures.
+*/
+
+Bool xf86XvMCScreenInit(
+ ScreenPtr pScreen,
+ int num_adaptors,
+ XF86MCAdaptorPtr *adaptors
+);
+
+#endif /* _XF86XVMC_H */
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c b/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c
index 2d6ea31ca..3df992941 100644
--- a/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c
+++ b/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c
@@ -3,7 +3,7 @@
*
* Copyright 1999 by Andrew C Aitchison <A.C.Aitchison@dpmms.cam.ac.uk>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.5 2001/02/15 17:31:45 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.7 2001/04/05 17:42:32 dawes Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -26,6 +26,8 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC)
CARD8 *EDID2rawdata = NULL;
CARD8 *VDIFrawdata = NULL;
int i, ret;
+ Bool makeEDID1prop = FALSE;
+ Bool makeEDID2prop = FALSE;
#ifdef DEBUG
ErrorF("xf86SetDDCproperties(%p, %p)\n", pScrnInfo, DDC);
@@ -44,7 +46,36 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC)
pScrnInfo->monitor->DDC = DDC;
if (DDC->ver.version == 1) {
+ makeEDID1prop = TRUE;
+ } else if (DDC->ver.version == 2) {
+ int checksum1 = 0;
+ int checksum2 = 0;
+ makeEDID2prop = TRUE;
+
+ /* Some monitors (eg Panasonic PanaSync4)
+ * report version==2 because they used EDID v2 spec document,
+ * although they use EDID v1 data structure :-(
+ *
+ * Try using checksum to determine when we have such a monitor.
+ */
+ for (i=0; i<256; i++) { checksum2 += DDC->rawData[i]; }
+ if ( (checksum2 % 256) != 0 ) {
+ xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v2 checksum failed\n");
+ xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property may be bad\n");
+ for (i=0; i<128; i++) { checksum1 += DDC->rawData[i]; }
+ if ( (checksum1 % 256) == 0 ) {
+ xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v1 checksum passed,\n");
+ xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property created\n");
+ makeEDID1prop = TRUE;
+ }
+ }
+ } else {
+ xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED,
+ "unexpected EDID version %d revision %d\n",
+ DDC->ver.version, DDC->ver.revision );
+ }
+ if (makeEDID1prop) {
if ( (EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL ) {
return FALSE;
}
@@ -72,7 +103,9 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC)
ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret );
#endif
- } else if (DDC->ver.version == 2) {
+ }
+
+ if (makeEDID2prop) {
if ( (EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL ) {
return FALSE;
}
@@ -91,21 +124,11 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC)
#endif
ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex,
EDID2Atom, XA_INTEGER, 8,
-#if 1
- 256, (unsigned char *)EDID1rawdata
-#else
-#define EDID2_DUMMY_STRING "Dummy EDID2 property - please insert correct values"
- strlen(EDID2_DUMMY_STRING),
- EDID2_DUMMY_STRING
-#endif
+ 256, (unsigned char *)EDID2rawdata
);
#ifdef DEBUG
ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret );
#endif
- } else {
- xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED,
- "unexpected EDID version %d revision %d\n",
- DDC->ver.version, DDC->ver.revision );
}
if (DDC->vdif) {
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/Imakefile
index 0291db948..a0ffbbf17 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/doc/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/33 1996/10/28 05:12:24 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.74 2001/02/07 18:52:27 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.75 2001/03/02 02:45:37 dawes Exp $
#include <Server.tmpl>
#include <lnxdoc.rules>
@@ -81,7 +81,7 @@ MAINDOCS = LICENSE README /*ReadmeFile(Config)*/ /*BUILD*/ RELNOTES \
OTHERDOCS = /*VideoModes.doc*/ /*QuickStart.doc*/ /*xinput*/ \
ReadmeFile(fonts) ReadmeFile(mouse) ReadmeFile(DRI) \
- ReadmeFile(DRIcomp)
+ ReadmeFile(DRIcomp) ReadmeFile(dps)
#endif
MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) ReadmeFile(DGA) \
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Install b/xc/programs/Xserver/hw/xfree86/doc/Install
index 205f8d56a..7846ad0f2 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/Install
+++ b/xc/programs/Xserver/hw/xfree86/doc/Install
@@ -179,7 +179,7 @@ you don't need these features, then you can safely answer "no" if you don't
want them moved.
When installing over an existing version, you will be prompted before each
-set of configuration files is installed. If you haven't made any customisa-
+set of configuration files is installed. If you haven't made any Customisa-
tions to your existing configuration files, then you can safely answer "yes"
for each of these. If you have made customisations, you can try answering
"no". If you run into problems later, you may need to manually merge your
@@ -351,7 +351,7 @@ Once that's done, the main part of the installation can be done:
/sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD
/usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.10 2000/12/15 19:09:06 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11 2001/03/02 17:40:48 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.10 2000/12/15 19:38:06 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.11 2001/03/02 17:47:52 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/LICENSE b/xc/programs/Xserver/hw/xfree86/doc/LICENSE
index a16673c84..c6890edc3 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/LICENSE
+++ b/xc/programs/Xserver/hw/xfree86/doc/LICENSE
@@ -2,14 +2,14 @@
The XFree86 Project
- 1999
+ March 2001
1. XFree86 License
XFree86 code without an explicit copyright is covered by the following copy-
right/license:
-Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -592,7 +592,7 @@ For further information, contact:
<sales@yandy.com> or <design@bigelowandholmes.com>
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7 2000/03/06 22:59:23 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.11 2000/12/01 19:47:45 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.12 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README b/xc/programs/Xserver/hw/xfree86/doc/README
index d0403f5ed..ffc669ceb 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README
+++ b/xc/programs/Xserver/hw/xfree86/doc/README
@@ -40,6 +40,9 @@ whether your hardware is supported before upgrading to the 4.x series.
Specific release enhancements can be viewed in the Release Notes.
+The XFree86 version numbering system has had some changes as of the 4.0.2
+release. Information about this can be found in the Versions Document.
+
Information about binary distributions and the attendant installation
instructions can be found in the Installation Document.
@@ -158,7 +161,7 @@ yourself, send the entire log file with your bug report but not the operating
system core dump. Do not edit the log file as our developers use it to
reproduce and debug your problem.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.110 2000/12/15 16:11:57 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113 2001/03/16 22:13:19 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.109 2000/12/15 18:14:32 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.111 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
index ff5b44c52..15794df56 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
@@ -2,13 +2,13 @@
VA Linux Systems, Inc. Professional Services - Graphics.
- 5 January 2001
+ 15 March 2001
1. Preamble
1.1 Copyright
-Copyright 2000 by VA Linux Systems, Inc. All Rights Reserved.
+Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.
Permission is granted to make and distribute verbatim copies of this document
provided the copyright notice and this permission notice are preserved on all
@@ -71,32 +71,8 @@ functions in the Mesa-based DRI drivers. 3DNow! is supported in most ver-
sions of Linux. Like the SSE optimizations, a runtime check is made to
determine if the CPU can execute 3DNow! instructions.
-The build environment for both of these new architectures have a pre-build
-environment that will correctly build the DRI drivers and Mesa meaning no
-extra configuration is necessary to build the DRI for these architectures.
-
-3.1.1 Alpha Features
-
- "
-
-On newer Alpha processors, it should be noted that a significant performance
-increase can be seen with the addition of the -mcpu= command that should be
-passed to GCC upon compilation. Dependent of the architecture of the proces-
-sor, for example -mcpu=ev6 will build specifically for the EV6 based AXP's,
-giving both byte and word alignment access to the DRI/Mesa drivers.
-
-Use this as an example of compiling with this extra speed. In your host.def
-file that should reside in the xc/config directory, add the line.
-
-#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
-
-Additional speed improvements to 3D rendering can be achieved by installing
-Compaq's Math Libraries (CPML) which can be obtained from the following URL.
-
-http://www.support.compaq.com/alpha-tools/software/index.html
-
-Alpha systems can benefit from several compile-time optimizations which are
-described in the DRI Compile Guide.
+Alpha-based systems can use Compaq's optimized math library for improved 3D
+performance. See the DRI Compilation Guide for details.
3.2 Graphics Hardware
@@ -231,10 +207,13 @@ First, the XF86Config file must load the GLX and DRI modules:
Load "dri"
EndSection
-Next, the DRI section can be used to restrict access to direct rendering.
+Next, the DRI section can be used to restrict access to direct rendering. A
+client can only use direct rendering if it has permission to open the
+/dev/dri/card? file(s). The permissions on these DRI device files is con-
+trolled by the "DRI" section in the XF86Config file.
If you want all of the users on your system to be able to use direct-render-
-ing, then use a simple DRI section:
+ing, then use a simple DRI section like this:
Section "DRI"
Mode 0666
@@ -420,7 +399,57 @@ MESA_DEBUG and MESA_INFO variables.
This section contains information to help you diagnose general problems. See
below for additional information for specific hardware.
-9.1 The X Server
+9.1 Bus Mastering
+
+DMA-based DRI drivers (that's most DRI drivers) cannot function unless bus
+mastering is enabled for your graphics card. By default, some systems don't
+having bus mastering on. You should enable it in your BIOS.
+
+Alternately, you can check the status of bus mastering and change the setting
+from within Linux. There may be similar procedures for other operating sys-
+tems.
+
+Run lspci (as root) and find the information describing your graphics
+adapter. For example:
+
+ 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03)
+ 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03)
+ 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02)
+ 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01)
+ 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01)
+ 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
+ 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08)
+ 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02)
+ 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08)
+ 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01)
+
+The bus, device, and function number comprise the device id, which is conven-
+tionally written in the form bus:dev.func, or in this case 01:00.0.
+
+Use the setpci command to examine bit two of register 4 for your graphics
+card. This will indicate whether or not bus mastering is enabled.
+
+ setpci -s 01:00.0 4.w
+
+A hexidecimal value will be printed. Convert the least significant digit to
+binary. For example, if you see 3, that's 0011 in binary (bit two is 0). If
+you see 7, that's 0111 in binary (bit two is 1). In the first example, bus
+mastering is disabled. It's enabled in the second example.
+
+The following shell script will enabled bus mastering for your graphics card
+and host bridge. Run it as root.
+
+ #!/bin/bash
+ dev=01:00.0 # change as appropriate
+ echo Enabling bus mastering on device $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+ dev=00:00.0
+ echo Enabling bus mastering on host bridge $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+
+You can check if this worked by running the first setpci command again.
+
+9.2 The X Server
1. Before you start the X server, verify the appropriate 3D kernel module
is installed. Type lsmod and look for the appropriate kernel module.
@@ -474,7 +503,7 @@ below for additional information for specific hardware.
SGI-GLX
XFree86-DRI
-9.2 Linking, running and verifying 3D acceleration
+9.3 Linking, running and verifying 3D acceleration
After you've verified that the X server and DRI have started correctly it's
time to verify that the GL library and hardware drivers are working cor-
@@ -602,13 +631,20 @@ Or,
EndSubsection
EndSection
-The kernel module for the Voodoo3 is named tdfx.o and should be installed in
-/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded
-by the Xserver if needed.
+The kernel module for 3dfx hardware is named tdfx.o and should be installed
+in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically
+loaded by the Xserver if needed.
-The DRI 3D driver for the Voodoo3 should be in /usr/X11R6/lib/mod-
+The DRI 3D driver for 3dfx hardware should be in /usr/X11R6/lib/mod-
ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
+The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in
+32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered.
+When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and
+stencil is implemented in software.
+
+A software-based accumulation buffer is available in both 16 and 32bpp modes.
+
10.1.3 Troubleshooting
o If you try to run an OpenGL application and see an error message similar
@@ -626,12 +662,19 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
o The /dev/3dfx device is not used for DRI; it's only for Glide on older
3dfx hardware.
+ o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the
+ DRI website's resources page to download the right version of Glide.
+
+ o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D
+ acceleration is not supported in that mode. 32bpp mode is fully 3D
+ accelerated.
+
10.1.4 Performance
o Normally, buffer swapping in double-buffered applications is synchro-
nized to your monitor's refresh rate. This may be overridden by setting
- the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this
- variable indicates the maximum number of swap buffer commands can be
+ the FX_GLIDE_SWAPINTERVAL environment variable. The value of this vari-
+ able indicates the maximum number of swap buffer commands can be
buffered. Zero allows maximum frame rate.
o On Voodoo4/5, rendering with 16-bits/texel textures is faster than using
@@ -677,80 +720,6 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
o Using glColorMask(r, g, b, a) when r!=g or g!=b.
- o The lowest mipmap level is sometimes miscolored in trilinear- sampled
- polygons.
-
-10.2 3dfx Voodoo5 Series
-
-10.2.1 Dependencies
-
-The Voodoo5 DRI driver requires a special versions of the 3dfx Glide library,
-different than that used for Voodoo3 hardware. It can be downloaded from the
-DRI website.
-
-10.2.2 Configuration
-
-Your XF86Config file's device section must specify the tdfx device:
-
- Section "Device"
- Identifier "Voodoo5"
- VendorName "3dfx"
- Driver "tdfx"
- EndSection
-
-The Screen section should then reference the Voodoo3 device:
-
- Section "Screen"
- Identifier "Screen 1"
- Device "Voodoo5"
- Monitor "High Res Monitor"
- DefaultDepth 24
- Subsection "Display"
- Depth 16
- Modes "1280x1024" "1024x768" "800x600" "640x480"
- ViewPort 0 0
- EndSubsection
- Subsection "Display"
- Depth 24
- Modes "1280x1024" "1024x768" "800x600" "640x480"
- ViewPort 0 0
- EndSubsection
- EndSection
-
-The kernel module for the Voodoo5 is named tdfx.o and should be installed in
-/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded
-by the Xserver if needed.
-
-The DRI 3D driver for the Voodoo5 should be in /usr/X11R6/lib/mod-
-ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
-
-The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in
-32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered.
-When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and
-stencil is implemented in software.
-
-A software-based accumulation buffer is available in both 16 and 32bpp modes.
-
-10.2.3 Troubleshooting
-
- o The /dev/3dfx device is not used for DRI; it's only for Glide on older
- 3dfx hardware.
-
- o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the
- DRI website's resources page to download the right version of Glide.
-
-10.2.4 Performance
-
- o Normally, buffer swapping in double-buffered applications is synchro-
- nized to your monitor's refresh rate. This may be overridden by setting
- the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this
- variable indicates the maximum number of swap buffer commands can be
- buffered. Zero allows maximum frame rate.
-
- o Rendering with 16-bit per texel textures is faster than using 32-bit per
- texel textures. The internalFormat parameter to glTexImage2D can be
- used to control texel size.
-
o The Voodoo5 driver reverts to software rendering under the same condi-
tions Voodoo3 with three exceptions. First, stencil operations are
implemented in hardware when the screen is configured for 32 bits/pixel.
@@ -758,38 +727,37 @@ A software-based accumulation buffer is available in both 16 and 32bpp modes.
Third, glColorMask is fully supported in hardware when the screen is
configured for 32 bits/pixel.
-10.2.5 Known Problems
+ o As of January, 2001 the second VSA-100 chip on the Voodoo5 is not yet
+ operational. Therefore, the board isn't being used to its full capac-
+ ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode
+ for full-screen applications and games, potentially doubling the sys-
+ tem's fill rate. When the second VSA-100 chip is activated glGet-
+ String(GL_RENDERER) will report Voodoo5 instead of Voodoo4.
o The lowest mipmap level is sometimes miscolored in trilinear- sampled
- polygons (Voodoo3/Banshee).
+ polygons.
- o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D
- acceleration is not supported in that mode. 32bpp mode is fully 3D
- accelerated.
+10.1.5 Known Problems
+
+ o The lowest mipmap level is sometimes miscolored in trilinear- sampled
+ polygons (Voodoo3/Banshee).
o Fog doesn't work with orthographic projections.
o The accuracy of blending operations on Voodoo4/5 isn't always very good.
If you run Glean, you'll find some test failures.
- o As of October, 2000 the second VSA-100 chip on the Voodoo5 is not yet
- operational. Therefore, the board isn't being used to its full capac-
- ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode
- for full-screen applications and games, potentially doubling the sys-
- tem's fill rate. When the second VSA-100 chip is activated glGet-
- String(GL_RENDERER) will report Voodoo5 instead of Voodoo4.
-
o The Glide library cannot be used directly; it's only meant to be used
via the tdfx DRI driver.
o SSystem has problems because of poorly set near and far clipping planes.
The office.unc Performer model also suffers from this problem.
-10.3 Intel i810
+10.2 Intel i810
"
-10.3.1 Dependencies
+10.2.1 Dependencies
"
@@ -797,7 +765,7 @@ A Linux kernel with AGP GART support is required. The 2.2.x kernel series
does not have AGP GART support. The 2.4.x test kernels have AGP GART and
have been tested with the i810.
-10.3.2 Configuration
+10.2.2 Configuration
"
@@ -808,6 +776,7 @@ ify a usable amount of video ram to reserve.
Identifier "i810"
VendorName "Intel"
Driver "i810"
+ Option "AGPMode" "1"
VideoRam 10000
EndSection
@@ -832,7 +801,7 @@ by the Xserver if needed.
The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod-
ules/dri/i810_dri.so. This will be automatically loaded by libGL.so.
-10.3.3 Troubleshooting
+10.2.3 Troubleshooting
o 3D acceleration for the i810 is only available in the 16 bit/pixel
screen mode at this time. 32bpp acceleration is not supported by this
@@ -847,18 +816,18 @@ ules/dri/i810_dri.so. This will be automatically loaded by libGL.so.
too little memory is available for DMA buffers, back and depth buffers
and textures, direct rendering will be disabled.
-10.4 Matrox G200 and G400
+10.3 Matrox G200 and G400
"
-10.4.1 Dependencies
+10.3.1 Dependencies
"
A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is
needed.
-10.4.2 Configuration
+10.3.2 Configuration
"
@@ -868,6 +837,7 @@ Your XF86Config file's device section must specify the mga device:
Identifier "MGA"
VendorName "Matrox"
Driver "mga"
+ Option "AGPMode" "1"
VideoRam 32768
EndSection
@@ -907,7 +877,7 @@ by the Xserver if needed.
The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod-
ules/dri/mga_dri.so. This will be automatically loaded by libGL.so.
-10.4.3 Performance
+10.3.3 Performance
Software rendering will be used under any of the following conditions:
@@ -921,9 +891,16 @@ Software rendering will be used under any of the following conditions:
o Using 1D or 3D textures.
+ o Using texture borders.
+
+ o Using glDepthFunc(GL_NEVER).
+
o Using the accumulation buffer.
-10.4.4 IRQ Assignment
+The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP
+speeds may result in unreliable performance depending on your motherboard.
+
+10.3.4 IRQ Assignment
There have been problems in the past with the MGA driver being very sluggish
when the DRI is enabled (to the point of being unusable.) This is caused by
@@ -935,7 +912,7 @@ card. This is something you must turn on in your system BIOS configuration.
Please consult your system BIOS manual for instructions on how to enable an
interrupt for your graphics card.
-10.4.5 MGA HAL lib
+10.3.5 MGA HAL lib
MGAHALlib.a is a binary library Matrox has provided for use under Linux to
expose functionality for which they can not provide documentation. (For
@@ -960,22 +937,22 @@ will be "PCI:1:0:0". Configure your screen section as you would normally
configure XFree86 4.x Multihead. It should be noted that currently the sec-
ond head does not support direct rendering.
-10.4.6 Known Problems
+10.3.6 Known Problems
None.
-10.5 ATI Rage 128
+10.4 ATI Rage 128
"
-10.5.1 Dependencies
+10.4.1 Dependencies
"
A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is
needed.
-10.5.2 Configuration
+10.4.2 Configuration
"
@@ -985,6 +962,8 @@ Your XF86Config file's device section must specify the ati device:
Identifier "Rage128"
VendorName "ATI"
Driver "ati"
+ Option "AGPMode" "1"
+ Option "UseCCEFor2D" "false"
EndSection
The Screen section should then reference the Rage 128 device:
@@ -1015,27 +994,33 @@ ules/dri/r128_dri.so. This will be automatically loaded by libGL.so.
You may also set your screen depth to 32 for 32bpp mode.
-10.5.3 Performance
+10.4.3 Performance
While PCI Rage 128 based cards are supported, they do not yet support PCI
GART, so they will not perform as well as their AGP counterparts.
-10.5.4 Known Problems
+For AGP cards, the AGP mode may be set to 1, 2, or 4. One is used by
+default. Higher AGP speeds may result in unreliable performance depending on
+your motherboard.
-None.
+10.4.4 Known Problems
-10.6 ATI Radeon
+If you experience stability problems you may try setting the UseCCEFor2D
+option to true. This will effectively disable 2D hardware acceleration.
+Performance will be degraded, of course.
+
+10.5 ATI Radeon
"
-10.6.1 Dependencies
+10.5.1 Dependencies
"
A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is
needed.
-10.6.2 Configuration
+10.5.2 Configuration
"
@@ -1045,6 +1030,7 @@ Your XF86Config file's device section must specify the ati device:
Identifier "Radeon"
VendorName "ATI"
Driver "ati"
+ Option "AGPMode" "1"
EndSection
The Screen section should then reference the Radeon device:
@@ -1075,17 +1061,20 @@ ules/dri/radeon_dri.so. This will be automatically loaded by libGL.so.
You may also set your screen depth to 32 for 32bpp mode.
-10.6.3 Performance
+10.5.3 Performance
While this driver supports many of the features of ATI Radeon cards, we do
not yet fully support the card's TCL features. This work is progressing, but
is not yet ready.
-10.6.4 Known Problems
+The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP
+speeds may result in unreliable performance depending on your motherboard.
+
+10.5.4 Known Problems
None.
-10.7 3DLabs Oxygen GMX 2000
+10.6 3DLabs Oxygen GMX 2000
The driver for this hardware was experimental and is no longer being devel-
oped or supported.
@@ -1198,7 +1187,7 @@ forge.net/resources/resources.html
o In the future there may be IHV and Linux vendor support resources for
the DRI.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.16 2001/01/08 01:07:33 martin Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.17 2001/03/21 16:56:18 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.13 2001/01/21 21:19:14 tsi Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.14 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
index e2f847291..921d53457 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
@@ -2,13 +2,13 @@
VA Linux Systems, Inc. Professional Services - Graphics.
- 5 January 2001
+ 15 March 2001
1. Preamble
1.1 Copyright
-Copyright 2000 by VA Linux Systems, Inc. All Rights Reserved.
+Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.
Permission is granted to make and distribute verbatim copies of this document
provided the copyright notice and this permission notice are preserved on all
@@ -55,7 +55,7 @@ You'll need the following:
o FreeBSD support is not currently being maintained and may not work.
The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How-
-ever, there is limited support for Alpha and Sparc.
+ever, there is limited support for Alpha and PowerPC support is underway.
For 3dfx Voodoo3 hardware, you'll also need:
@@ -80,8 +80,9 @@ For ATI Rage 128 and Radeon hardware, you'll also need:
The DRI project closely tracks Linux kernel development. Since the internal
Linux data structures might change in the 2.4 Linux kernel, it's important to
-have use the most recent Linux kernel. As of this writing (Jan 2001), 2.4.0
-is the most recent version of Linux which the DRI is synchronized to.
+use the most recent Linux kernel and not an old, intermediate development
+release. As of this writing (Jan 2001), 2.4.0 is the most recent version of
+Linux which the DRI is synchronized to.
Most of the DRI drivers require AGP support and using Intel Pentium III SSE
optimizations also requires an up-to-date Linux kernel. Configuring your
@@ -214,7 +215,7 @@ the DRI/Mesa drivers.
To enable this optimization edit your xc/config/host.def file and add the
line:
-#define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6
+#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
Additional speed improvements to 3D rendering can be achieved by installing
Compaq's Math Libraries (CPML) which can be obtained from http://www.sup-
@@ -444,7 +445,8 @@ grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/.
To load the appropriate DRI module in your running kernel you can either use
ismod and restart your X server or copy the kernel module to /lib/mod-
-ules/2.4.x/kernel/driver/char/drm/ then run depmod and restart your X server.
+ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X
+server.
Make sure you first unload any older DRI kernel modules that might be already
loaded.
@@ -599,7 +601,7 @@ At this point your X server should be up and running with hardware-acceler-
ated direct rendering. Please read the DRI User Guide for information about
trouble shooting and how to use the DRI-enabled X server for 3D applications.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.10 2001/01/08 01:07:34 martin Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.11 2001/03/21 16:56:18 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.7 2001/01/21 21:19:14 tsi Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.8 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD
index eb704992a..da9b9dafc 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD
@@ -2,14 +2,13 @@
Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb
- Last modified on: 7 December 2000
+ Last modified on: 3 March 2001
1. What and Where is XFree86?
-XFree86 is a port of X11R6.4 that supports several versions of Intel-based
-Unix. It is derived from X386 1.2, which was the X server distributed with
-X11R5. This release consists of many new features and performance improve-
-ments as well as many bug fixes.
+XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev-
+eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat-
+ing systems on Intel and other platforms.
See the Copyright Notice.
@@ -17,7 +16,7 @@ The sources for XFree86 are available by anonymous ftp from:
ftp://ftp.XFree86.org/pub/XFree86/4.0.2
-Binaries for NetBSD 1.3 and later are available from:
+Binaries for NetBSD 1.4 and later are available from:
ftp://ftp.XFree86.org/pub/XFree86/4.0.2/binaries/NetBSD
A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml
@@ -77,8 +76,8 @@ Refer to the Installation Document for detailed installation instructions.
5. Configuring X for Your Hardware
-The /etc/XF86Config file tells the X server what kind of monitor, video card
-and mouse you have. You must create it to tell the server what specific
+The /etc/X11/XF86Config file tells the X server what kind of monitor, video
+card and mouse you have. You must create it to tell the server what specific
hardware you have.
You'll need info on your hardware:
@@ -89,6 +88,11 @@ You'll need info on your hardware:
o Your monitor's sync frequencies.
+The recommended way to generate an XF86Config file is to use the xf86cfg
+utility. The xf86config text utility is still there for the (few) cases
+where xf86cfg can't be used. Also, there is a sample file installed as
+/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point.
+
For details about the XF86Config file format, refer to the XF86Config(5) man-
ual page.
@@ -97,18 +101,19 @@ the xvidtune utility.
5.1 About mouse configuration
-The NetBSD pms mouse driver handles PS/2 style mice as Busmouse. Specify the
-protocol as ``busmouse'' in the mouse section of your XF86Config file if
-you're using a PS/2 mouse.
+XFree86 4.0.2 has support for the mouse driver included in the wscons console
+driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the protocol and
+``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using NetBSD
+1.4 or later with a PS/2 mouse.
+
+For older releases, the NetBSD pms mouse driver handles PS/2 style mice as
+Busmouse. Specify the protocol as ``busmouse'' in the mouse section of your
+XF86Config file if you're using a PS/2 mouse with NetBSD 1.3 or former
+releases.
Only standard PS/2 mice are supported by this driver. Newest PS/2 mice that
send more than three bytes at a time (especially Intellimouse, or MouseMan+
-with a ``3D'' roller) are not supported yet.
-
-XFree86 4.0.2 also has support for the mouse driver included in the new
-wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the
-protocol and ``/dev/wsmouse0'' as the device in /etc/XF86Config if you're
-using NetBSD 1.4 with wscons.
+with a wheel) are not supported by NetBSD 1.3 and former releases.
See README.mouse for general instruction on mouse configuration in XFree86.
@@ -140,8 +145,8 @@ to:
in /etc/rc.conf.
-Under NetBSD 1.4 with the wscons console driver, you must enable a virtual
-console for the X server first. To do this follow these steps:
+Under NetBSD 1.4 and later with the wscons console driver, you must enable a
+virtual console for the X server first. To do this follow these steps:
o Make sure the device file exists. If not, ``cd /dev ; ./MAKEDEV
wscons''.
@@ -182,9 +187,10 @@ configuration of the server itself is required.
The pccons driver is the most widely tested and is the console driver con-
tained in the NetBSD binary distribution's kernels.
-The pcvt console driver is bundled with NetBSD. The pcvt X mode is compatible
-with the pccons driver X mode. It offers several virtual consoles and inter-
-national keyboard support. In order to use this driver, change the line:
+The pcvt console driver was bundled with NetBSD until 1.4. The pcvt X mode is
+compatible with the pccons driver X mode. It offers several virtual consoles
+and international keyboard support. In order to use this driver, change the
+line:
device pc0 at isa? port "IO_KBD" irq 1
@@ -194,8 +200,9 @@ to
in your kernel config file, and rebuild and install your kernel.
-XFree86 will also run with the wscons console driver in NetBSD 1.4. For now,
-it uses the pcvt compatibility mode, so be sure to have the lines:
+Wscons is the current console driver, included in NetBSD 1.4 and later. For
+now, XFree86 supports wscons using the pcvt compatibility mode, so be sure to
+have the lines:
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
@@ -318,6 +325,11 @@ adding:
to xc/config/host.def before rebuilding the server. This has not been thor-
oughly tested, except on the macppc.
+For the i386, you should include both pcvt and wscons support in order to use
+the pcvt compatibility mode of wscons:
+
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT
+
8.4 Building on other architectures
Note that the NetBSD project has now its own source tree, based on the
@@ -358,7 +370,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in
particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko,
Nate Williams, Rod Grimes, Jack Velte and Michael Smith.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12 18:54:29 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60 2001/03/04 09:47:34 herrb Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.75 2000/12/12 19:04:02 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.76 2001/03/04 09:48:47 herrb Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD
index 23617eb9b..452164dda 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD
@@ -2,14 +2,13 @@
Matthieu Herrb
- Last modified on: 2 December 2000
+ Last modified on: 3 March 2000
1. What and Where is XFree86?
-XFree86 is a port of X11R6.4 that supports several versions of Intel-based
-Unix. It is derived from X386 1.2, which was the X server distributed with
-X11R5. This release consists of many new features and performance improve-
-ments as well as many bug fixes.
+XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev-
+eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat-
+ing systems on Intel and other platforms.
See the Copyright Notice.
@@ -35,7 +34,13 @@ if you have comments or suggestions about this file and we'll revise it.
See the Release Notes for non-OS dependent new features in XFree86 4.0.2.
-3.1 New OS dependent features in 4.0.2
+3.1 New OS dependant features in 4.0.3
+
+ o Support for the wscons console driver in post 2.8 OpenBSD.
+
+ o A fix for multi-threaded libraries support.
+
+3.2 New OS dependent features in 4.0.2
o Support for the OpenBSD ports tree,
@@ -46,7 +51,7 @@ See the Release Notes for non-OS dependent new features in XFree86 4.0.2.
o startx now creates an Xauthority magic cookie for the display.
-3.2 New OS dependent features in 4.0.1
+3.3 New OS dependent features in 4.0.1
o Several features from the OpenBSD X11 tree were merged into xdm:
@@ -65,21 +70,21 @@ See the Release Notes for non-OS dependent new features in XFree86 4.0.2.
o The Xsun server can be built again on OpenBSD/sparc.
-3.3 New OS dependent features in 4.0
+3.4 New OS dependent features in 4.0
o Multi-thread safe libraries are built by default on OpenBSD 2.6 and
later,
o Preliminary APM support.
-3.4 New OS dependent features in 3.9.18
+3.5 New OS dependent features in 3.9.18
o Support for USB mices has been added on OpenBSD.
o Soft-booting secondary cards through the int10 BIOS interface is now
possible using the x86emu real mode emulator.
-3.5 New OS dependent features in 3.9.17
+3.6 New OS dependent features in 3.9.17
o Silken mouse is supported for serial mices, and, under post 2.6 OpenBSD-
current for PS/2 mices.
@@ -92,8 +97,8 @@ Refer to the Installation Document for detailed installation instructions.
5. Configuring X for Your Hardware
-The /etc/XF86Config file tells the X server what kind of monitor, video card
-and mouse you have. You must create it to tell the server what specific
+The /etc/X11/XF86Config file tells the X server what kind of monitor, video
+card and mouse you have. You must create it to tell the server what specific
hardware you have.
You'll need info on your hardware:
@@ -104,6 +109,11 @@ You'll need info on your hardware:
o Your monitor's sync frequencies.
+The recommended way to generate an XF86Config file is to use the xf86cfg
+utility. The xf86config text utility is still there for the (few) cases
+where xf86cfg can't be used. Also, there is a sample file installed as
+/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point.
+
For details about the XF86Config file format, refer to the XF86Config(5) man-
ual page.
@@ -112,8 +122,10 @@ the xvidtune utility.
5.1 About mouse configuration
-If your serial mouse does not work try using kermit or tip to connect to the
-mouse serial port and verify that it does indeed generate characters.
+XFree86 4.0.2 has support for the mouse driver included in the new wscons
+console driver introduced by OpenBSD-current after 2.8. Specify ``wsmouse''
+as the protocol and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config
+if you're using OpenBSD-current with a PS/2 mouse.
The OpenBSD pms driver provides both ``raw'' and ``cooked'' (translated)
modes. ``raw'' mode does not do protocol translation, so XFree86 would use
@@ -168,8 +180,11 @@ The server supports the two standard OpenBSD/i386 console drivers: pcvt and
pccons. They are detected at runtime and no configuration of the server
itself is required.
-The pcvt console driver is the default in OpenBSD. It offers several virtual
-consoles and international keyboard support.
+The pcvt console driver is the default in OpenBSD up to OpenBSD 2.8. It
+offers several virtual consoles and international keyboard support.
+
+OpenBSD-current after 2.8 has switched to the wscons console driver. This
+console driver has a pcvt compatibility mode for X support.
7.2 Aperture Driver
@@ -219,6 +234,14 @@ I've also included it below, if you want to edit the source file by hand.
else
return -1;
+In post 2.8 OpenBSD-current, a modified version of this patch has been inte-
+grated. You should set
+
+ machdep.allowaperture=2
+
+in /etc/sysctl.conf in order to achieve this. See the xf86(4) manual page for
+details.
+
Another (less recommended) way to enable linear memory and I/O ports access
is to disable the kernel security feature by adding ``option INSECURE'' in
your kernel configuration file and build a new kernel. You will also need to
@@ -279,11 +302,22 @@ OpenBSD/powerpc and on OpenBSD/i386 -current can be built by adding:
to xc/config/host.def before rebuilding the server. This has not been thor-
oughly tested, except on the macppc.
+For the i386, you should include both pcvt and wscons support in order to use
+the pcvt compatibility mode of wscons:
+
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT
+
8.2 Building on other architectures
XFree86 should also compiles on other OpenBSD architectures. However, please
note that 3.9.x snapshots have only been tested on the i386 for now.
+Note that OpenBSD project has now its own source tree, based on the XFree86
+source tree, with some local modifications. You may want to start with this
+tree to rebuild from sources. The OpenBSD X11 source tree is available by
+anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon-
+cvs.html for details on anoncvs.
+
9. Building New X Clients
The easiest way to build a new client (X application) is to use xmkmf if an
@@ -298,7 +332,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in
particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko,
Nate Williams, Rod Grimes, Jack Velte and Michael Smith.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.16 2001/03/04 09:47:35 herrb Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.20 2000/12/12 19:04:02 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.21 2001/03/04 09:48:47 herrb Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati
index 3745c2067..19b525acb 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.ati
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.ati
@@ -2,7 +2,7 @@
Marc Aurele La France
- 2000 December 6
+ 2001 March 24
Abstract
@@ -216,7 +216,7 @@ been specified instead.
A ChipSet name of ``vgawonder'' is equivalent to ``ativga'', except that only
VGAWonder-capable adapters can be assigned to the ``Device'' section. This
-specifically excludes newer Mach64's with integrated controllers.
+specifically excludes the newer integrated Mach64 controllers.
In some PCI or AGP systems, the driver will not, by default, probe for non-
PCI Mach32's or Mach64's. This is because, before doing any such probe, the
@@ -426,9 +426,19 @@ CRTC or an integrated Mach64 graphics chip. This option disables this linear
aperture.
On non-Intel platforms, the driver requires a linear aperture and, so, this
-option should not be specified.
+option is ignored.
-5.10 Option ``shadowfb''
+5.10 Option ``HWCursor'' and Option ``SWCursor''
+
+Option ``HWCursor'', which is the default, specifies that hardware facilities
+are to be used to paint the mouse pointer on the screen. Option ``SWCursor''
+specifies that the mouse pointer is to by drawn by software, which is much
+slower. If both options are specified, option ``SWCursor'' prevails. Cur-
+rently, these options are only acted upon for 256-colour or higher depth
+modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is
+being used. In all other situations, a software cursor will be used.
+
+5.11 Option ``shadowfb''
If this option is enabled, the driver will cause the CPU to do each drawing
operation first into a shadow frame buffer in system virtual memory and then
@@ -444,19 +454,19 @@ Note that, due to various limitations, this option is forcibly disabled when
a linear video memory aperture is not enabled, when the frame buffer depth is
less than 8, or when acceleration is used.
-5.11 Option ``dpms''
+5.12 Option ``dpms''
This option enables the driver's support for VESA's Display Power Management
Specification.
-5.12 Option ``backingstore''
+5.13 Option ``backingstore''
This is not specifically a driver option. It is used to enable the server's
support for backing store, a mechanism by which pixel data for occluded win-
dow regions is remembered by the server thereby alleviating the need to send
expose events to X clients when the data needs to be redisplayed.
-5.13 MemBase address
+5.14 MemBase address
This specification is only effective for non-PCI Mach64 adapters, and is used
to override the CPU address at which the adapter will map its video memory.
@@ -470,14 +480,14 @@ ing to the PCI Plug'n'Play specification which arbitrates the resource
requirements of most devices in the system. This means the driver can not
easily change the linear aperture address.
-5.14 Option ``ReferenceClock'' ``frequency''
+5.15 Option ``ReferenceClock'' ``frequency''
This option is only applicable to non-Intel platforms, where an adapter BIOS
is not available to the driver. The option specifies the reference frequency
used by the adapter's clock generator. The default is 14.318 MHz, and other
typical values are 28.636, or 29.5 MHz.
-5.15 ClockChip ``name''
+5.16 ClockChip ``name''
This option is only applicable to non-Intel platforms, where an adapter BIOS
is not available to the driver, and the driver cannot reliably determine
@@ -673,7 +683,7 @@ newer driver API of XFree86 4.0 and later.
The introduction of version 6 is a first swipe at porting the driver to non-
Intel architectures.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.35 2001/01/06 20:58:03 tsi Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.54 2001/01/21 21:19:15 tsi Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.55 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.dps b/xc/programs/Xserver/hw/xfree86/doc/README.dps
new file mode 100644
index 000000000..da1bf9fdc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.dps
@@ -0,0 +1,170 @@
+ XFree86 and DPS
+
+ Juliusz Chroboczek, <jch@xfree86.org>
+
+ 27 February 2001
+
+1. Introduction
+
+Display Postscript (or DPS for short) is a rendering extension for X11. DPS
+is slightly atypical in that it is based on code mobility, the ability to
+send executable code from client to server. Thus, a DPS client does not
+request that a line should be rendered; instead, it uploads code to the
+server which, when executed, causes a line to be drawn.
+
+This document does not aim at teaching programming with DPS; it is only a
+summary description of the DPS support code included with XFree86. More
+information about DPS, including a DPS bibliography, is available from the
+DPS extension site <URL:http://dps.sourceforge.net>.
+
+ Note: Adobe, PostScript and Display PostScript are trademarks of
+ Adobe Systems Incorporated which may be registered in certain
+ jurisdictions.
+
+As all X11 extensions, DPS consists of client-side and server-side compo-
+nents. The DPS client side consists of a number of libraries and a number of
+tools for programming and configuration. The DPS server side may consist
+either of an X server extension, or of a client-side process known as the
+``DPS agent.'' In this latter case, the term ``server-side'' is somewhat
+misleading.
+
+At the time of writing, only the client side is included with XFree86; the
+server side must be obtained separately. Please see server side (section 3.,
+page 1) later in this document for more information.
+
+2. The DPS client side
+
+The DPS client side consists of four libraries and a number of basic tools
+for programming and configuration; these are all included with XFree86.
+
+2.1 Libraries
+
+The libpsres library is a library for management of PostScript resources, on-
+disk files representing PostScript data structures such as fonts, font encod-
+ings, procsets, etc. It is closely related to the makepsres tool (see client-
+side tools (section 2.2, page 1) later in this document).
+
+The basic DPS client library is libdps. This library contains a number of
+functions for connection establishment, resource management, as well as stubs
+for all standard PostScript operators. Normally, all DPS clients should link
+with libdps; in addition, libdps may be used for printing by non-DPS clients
+(this is done, for example, by Sun's JDK). This library is documented in
+[CLRM] and [CLSX].
+
+The libdpstk library contains a number of additional utilities for managing
+DPS contexts, user paths and user objects, and for previewing EPS files. It
+is documented in [DPTX].
+
+The libdpstkXm library contains four Motif widgets. The DPS Scrolling Widget
+is a DPS drawing area that automatically manages issues such as scrolling,
+scaling, client-side backing store, incremental redisplay, etc. The Font
+Selection Box, and its associated Font Preview, present a convenient and pow-
+erful interface for choosing scalable fonts. Finally, the Color Picker pre-
+sents an interface for choosing colours using either of the RGB or HSV
+spaces. The latter three widgets are documented in [DPTX]; some summary
+Scrolling Widget documentation is available in the doc subdirectory of the
+DPS.tar.gz file, available from <URL:ftp://dps.source-
+forge.net/pub/dps/DPS.tar.gz>.
+
+The source code for libdpstkXm is included with XFree86; however, as it
+depends on Motif, this library is not built by default. A GTK-based library
+providing some of the functionality of libdpstkXm is available from the
+gtkDPS site <URL:http://www.gyve.org/gtkDPS/>.
+
+2.1.1 Libdps and Xt
+
+In X11R5, libdps did not depend on libXt. In X11R6, however, code was added
+to make the Xt main loop dispatch to sundry code on DPS events; with this
+addition, all programs that link with libdps need to link with libXt, whether
+they use Xt or not.
+
+This state of affairs is unfortunately true of the version of libdps included
+with XFree86. We are currently considering various solutions to this problem
+(including the use of weak linker symbols or splitting off the guilty func-
+tions into a separate library).
+
+2.2 Client-side tools
+
+In addition to the libraries, the client side of DPS consists of two utili-
+ties.
+
+The makepsres utility is used for managing PostScript resources. Its basic
+operation consists in walking recursively a filesystem tree, noting all
+resources, and then writing out a ``Unix PostScript Resources,'' file, basi-
+cally a directory of all the resources found. This utility is documented in
+the makepsres(1) manual page.
+
+The pswrap utility is a stub generator for PostScript clients. Roughly
+speaking, it takes as its input textual PostScript code, and generates a col-
+lection of C functions that transmit that code in pre-tokenised form to the
+DPS extension. Pswrap is documented in [PSWRAP].
+
+2.3 Sample clients
+
+XFree86 contains three sample DPS clients, dpsinfo, dpsexec and texteroids.
+They are documented in their respective manual pages.
+
+A number of sample clients that depend on Motif are available in
+<URL:ftp://dps.sourceforge.net/pub/ftp/DPS.tar.gz>. Additional sample
+clients can be found as part of GtkDPS (see above).
+
+The GNUstep environment can be compiled to use DPS for all rendering; for
+more information, please see the GNUstep site <URL:http://www.gnustep.org>.
+
+3. The DPS server side
+
+In order to use DPS clients, you need to install a DPS server side, which can
+be either a server extension (a ``DPS/X extension''), or a separate process
+(referred to, variously, either as a ``DPS/NX agent'' or, rather confusingly,
+as ``Client-Side DPS'' (CSDPS).
+
+3.1 Display Ghostscript
+
+Display Ghostscript (note the capitalisation), or DGS, is a client-side
+implementation of DPS based on the Ghostscript PostScript interpreter. DGS
+is still in beta at the time of writing; it does, however, provide a very
+usable implementation of DPS, although it still has some problems with the
+semantics of multiple DPS contexts.
+
+DGS is available from the GNUstep download area
+<URL:http://www.gnustep.org/resources/sources.html>.
+
+3.2 The DPS extension
+
+The DPS extension is a much younger project aiming at producing an efficient
+server-side implementation of DPS. The extension is currently in a state
+best described as alpha; current versions are known to crash the X server
+under some circumstances.
+
+The DPS extension is available from the DPS extension site
+<URL:http://dps.sourceforge.net>.
+
+4. References
+
+Links to electronic versions of all of these, and more, are available from
+the DPS extension site <URL:http://dps.sourceforge.net>.
+
+[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison-
+Wesley, 1990. ISBN 0-201-18127-4.
+
+[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd ed.
+Addison-Wesley, 1999. ISBN 0-201-37922-8.
+
+[INTRO] Display PostScript System. Introduction: Perspective for Software
+Developers. 15 April 1993.
+
+[CLRM] Display PostScript System. Client Library Reference Manual. 15 April
+1993.
+
+[CLSX] Display PostScript System. Client Library Supplement for X. 15 April
+1993.
+
+[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 April
+1993.
+
+[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April 1993.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.2 2001/03/02 17:47:53 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fonts b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
index 122b98071..9a3b84b26 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.fonts
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
@@ -2,7 +2,7 @@
Juliusz Chroboczek, <jch@xfree86.org>
- 14 December 2000
+ 21 January 2001
1. Introduction
@@ -238,7 +238,7 @@ On most platforms, the XFree86 servers are modular: the font backends are
included in modules that are loaded at runtime. The modules to be loaded are
specified in the `XF86Config' file using the `Load' directive:
- Load "Type1"
+ Load "type1"
If you have trouble installing fonts in a specific format, you may want to
check the server's log file in order to see whether the relevant modules are
@@ -247,14 +247,16 @@ follows:
o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf');
- o "Type1": Type 1 fonts (`*.pfa' and `*.pfb') and CIDFonts;
+ o "type1": Type 1 fonts (`*.pfa' and `*.pfb') and CIDFonts;
- o "Speedo": Bitstream Speedo fonts (`*.spd');
+ o "speedo": Bitstream Speedo fonts (`*.spd');
o "freetype": TrueType fonts (`*.ttf' and `*.ttc');
o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc').
+Please note that the argument of the `Load' directive is case-sensitive.
+
3. Fonts included with XFree86
3.1 Standard bitmap fonts
@@ -1008,7 +1010,7 @@ The IANA RFC documents, available from a number of sites throughout the
world, often provide interesting information about character set issues; my
favourite is RFC 373.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.11 2000/12/15 20:01:56 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.15 2000/12/15 20:22:16 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.16 2001/03/02 17:47:53 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES
index 226506c6f..a1dd1afdb 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES
+++ b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES
@@ -17,7 +17,7 @@ significant redesign of the XFree86 X server. Not all of the hardware
drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x has some
hardware support not present in 3.3.x. Our Driver Status document summarizes
how the hardware driver support compares between 3.3.6 and 4.0.2. Please
-check there first before downloading 4.0.2.
+check there first before downloading 4.0.2.
The 4.0.1 release introduced a new graphical configuration tool, "xf86cfg",
and a text mode interface was added to it for the 4.0.2 release. It is work
@@ -824,34 +824,35 @@ via DDC, you may want to add that information to XF86Config.
To allow a graceful transition for applications moving from core text render-
ing to the Render extension, Xft can use either core fonts or FreeType and
-the Render extension for text. By default, Xft is configured to support only
-core fonts, see the section on building FreeType support for the changes
-needed to add FreeType/Render fonts.
+the Render extension for text. By default, Xft is configured to support both
+core fonts and FreeType fonts using the supplied version of FreeType 2. See
+the section on FreeType support in Xft for instructions on configuring
+XFree86 to use an existing FreeType installation.
The Xft library uses a configuration file, XftConfig, which contains informa-
tion about which directories contain font files and also provides a sophisti-
cated font aliasing mechanism. Documentation for that file is included in
the Xft man page.
-4.11.2 Building FreeType support for Xft
+4.11.2 FreeType support in Xft
-XFree86 4.0.2 includes sources for FreeType version 2.0.1, but they are not
-built and installed automatically. As a result, Xft is configured to provide
-only core fonts by default.
+XFree86 4.0.2 includes sources for FreeType version 2.0.1, and, by default,
+they are built and installed automatically.
-To build FreeType support for Xft, first FreeType must be built and
-installed, either from the sources included in XFree86 in extras/freetype2 or
-from another FreeType (version 2.0.1 or later) release. Early FreeType ver-
-sion 2 releases used a different header file installation and aren't compati-
-ble with XFree86. Instructions for building and installing FreeType can be
-found in the INSTALL file included with the FreeType release.
+If you prefer, you can configure XFree86 4.0.2 to use an existing Freetype2
+installation by telling XFree86 not to build the internal copy and indicating
+where that external version has been installed. Edit (or create) con-
+fig/cf/host.def to include:
-Second, XFree86 needs to know the installed location for FreeType, usually
-/usr/local. Edit (or create) config/cf/host.def to include:
+ o #define BuildFreetype2Library NO
- #define Freetype2Dir /usr/local
+ o #define Freetype2Dir /usr/local
-Finally, build XFree86 with "make World" from the top.
+Note that XFree86 assumes you'll be using a release FreeType no older than
+version 2.0.1. Early FreeType version 2 releases used a different header
+file installation and aren't compatible with XFree86. Instructions for build-
+ing and installing FreeType can be found in the INSTALL file included with
+the FreeType release.
4.11.3 Application Support For Anti-Aliased Text
@@ -871,8 +872,8 @@ instead:
Xditview will use Xft instead of the core API by default. X11perf includes
tests to measure the performance of text rendered in three ways, anti-
aliased, anti-aliased with sub-pixel sampling and regular chunky text, but
-through the Render extension, a path which has not been optimized within the
-X server yet.
+through the Render extension, a path which is currently somewhat slower than
+core text.
4.12 Other extensions
@@ -1081,7 +1082,7 @@ location pointing to the new location. Some run-time generated files are now
located under the appropriate subdirectories of /var, again with the relevant
symbolic links in the old location.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.58 2000/12/17 23:01:10 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.96 2000/12/18 05:55:38 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.97 2001/03/02 17:47:53 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Status b/xc/programs/Xserver/hw/xfree86/doc/Status
index 6c5669771..0e05bc4ce 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/Status
+++ b/xc/programs/Xserver/hw/xfree86/doc/Status
@@ -8,8 +8,10 @@
This document provides information about the status of the driver
and hardware support in XFree86 4.0.2 compared with that in XFree86
- 3.3.6. Please send updates for this document to
- <fixes@xfree86.org>
+ 3.3.6. Unless otherwise stated, hardware is classified as "sup-
+ ported" if its driver provides basic 2D support. Support for addi-
+ tional features may or may not be present. Please send updates for
+ this document to <fixes@xfree86.org>
1. Introduction
@@ -514,8 +516,8 @@ architectures known to work on (e.g., Alpha, PPC), etc.
some problems with it in this version.
Summary:
- Support for the 86C201, 86C202, 86C215, 86C225, 5597 and 5598 is
- currently only available in 3.3.6.
+ Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and
+ 5598 is currently only available in 3.3.6.
31. Silicon Motion, Inc.
@@ -627,7 +629,7 @@ architectures known to work on (e.g., Alpha, PPC), etc.
Summary:
No Weitek chips are supported in 4.0.2.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14 22:15:48 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.28 2001/03/16 22:13:19 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.21 2000/12/14 22:34:26 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.22 2001/03/25 05:42:43 tsi Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
index 7f7208065..16ebb560c 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
@@ -10,10 +10,10 @@
<author>
<htmlurl url="http://www.valinux.com/"
name="VA Linux Systems, Inc."> Professional Services - Graphics.
- <date>5 January 2001
+ <date>15 March 2001
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.16 2001/01/08 01:07:33 martin Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.20 2001/04/05 19:29:42 dawes Exp $
</ident>
<toc>
@@ -22,7 +22,7 @@
<p>
<sect1>Copyright
<p>
- <bf>Copyright &copy; 2000 by VA Linux Systems, Inc.
+ <bf>Copyright &copy; 2000-2001 by VA Linux Systems, Inc.
All Rights Reserved.</bf>
<p>
<bf>Permission is granted to make and distribute verbatim copies
@@ -74,9 +74,9 @@
to brianp@valinux.com.
<sect>Supported Architectures & Hardware
- <p>
+<p>
<sect1>CPU Architectures
- <p>
+<p>
The architectures currently supported by the DRI have grown
from the initial Intel i386 systems to now include the Alpha
Processor and the Sun SPARC machines.
@@ -94,38 +94,12 @@
Like the SSE optimizations, a runtime check is made to determine
if the CPU can execute 3DNow! instructions.
- The build environment for both of these new architectures
- have a pre-build environment that will correctly build the
- DRI drivers and Mesa meaning no extra configuration is necessary
- to build the DRI for these architectures.
-
- <sect2>Alpha Features
- <p>
- On newer Alpha processors, it should be noted that a
- significant performance increase can be seen with the
- addition of the -mcpu= command that should be passed to
- GCC upon compilation. Dependent of the architecture of the
- processor, for example -mcpu=ev6 will build specifically
- for the EV6 based AXP's, giving both byte and word alignment
- access to the DRI/Mesa drivers.
-
- Use this as an example of compiling with this extra speed.
- In your host.def file that should reside in the xc/config
- directory, add the line.
-
- #define DefaultGcc2AxpOpt -O2 -mcpu=ev6
-
- Additional speed improvements to 3D rendering can be achieved
- by installing Compaq's Math Libraries (CPML) which can be
- obtained from the following URL.
-
- http://www.support.compaq.com/alpha-tools/software/index.html
-
- Alpha systems can benefit from several compile-time optimizations
- which are described in the DRI Compile Guide.
+ Alpha-based systems can use Compaq's optimized math library for
+ improved 3D performance. See the DRI Compilation Guide for
+ details.
<sect1> Graphics Hardware
- <p>
+<p>
XFree86 4.0 (or later versions) includes 3D acceleration for the
following graphics hardware:
@@ -202,7 +176,7 @@
<sect>Kernel Modules
- <p>
+<p>
3D hardware acceleration requires a DRI kernel module that's
specific to your graphics hardware.
<P>
@@ -231,7 +205,7 @@
exists.
<sect>XF86Config file
- <p>
+<p>
The XFree86 configuration file is usually found in
<tt>/etc/X11/XF86Config</tt>.
This section describes the parts which must be specially set for
@@ -251,9 +225,13 @@
Next, the DRI section can be used to restrict access to direct
rendering.
+ A client can only use direct rendering if it has permission to
+ open the <tt>/dev/dri/card?</tt> file(s).
+ The permissions on these DRI device files is controlled by the "DRI"
+ section in the XF86Config file.
<p>
If you want all of the users on your system to be able to use
- direct-rendering, then use a simple DRI section:
+ direct-rendering, then use a simple DRI section like this:
<verb>
Section "DRI"
Mode 0666
@@ -476,8 +454,70 @@
<sect>General Trouble Shooting
<p>
This section contains information to help you diagnose general
- problems.
- See below for additional information for specific hardware.
+ problems.
+ See below for additional information for specific hardware.
+
+ <sect1>Bus Mastering
+<p>
+ DMA-based DRI drivers (that's most DRI drivers) cannot function
+ unless bus mastering is enabled for your graphics card.
+ By default, some systems don't having bus mastering on.
+ You should enable it in your BIOS.
+ <p>
+ Alternately, you can check the status of bus mastering and change
+ the setting from within Linux. There may be similar procedures for
+ other operating systems.
+ <p>
+ Run <tt>lspci</tt> (as root) and find the information
+ describing your graphics adapter. For example:
+ <P>
+
+ <verb>
+ 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03)
+ 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03)
+ 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02)
+ 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01)
+ 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01)
+ 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
+ 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08)
+ 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02)
+ 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08)
+ 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01)
+ </verb>
+ <p>
+ The bus, device, and function number comprise the device id,
+ which is conventionally written in the form bus:dev.func, or
+ in this case 01:00.0.
+ <p>
+ Use the <tt>setpci</tt> command to examine bit two of register 4 for
+ your graphics card. This will indicate whether or not bus mastering
+ is enabled.
+ <p>
+ <verb>
+ setpci -s 01:00.0 4.w
+ </verb>
+ <p>
+ A hexadecimal value will be printed. Convert the least significant
+ digit to binary. For example, if you see 3, that's 0011 in binary
+ (bit two is 0). If you see 7, that's 0111 in binary (bit two is 1).
+ In the first example, bus mastering is disabled. It's enabled in
+ the second example.
+ <p>
+ The following shell script will enabled bus mastering for your
+ graphics card and host bridge. Run it as root.
+ <verb>
+ #!/bin/bash
+ dev=01:00.0 # change as appropriate
+ echo Enabling bus mastering on device $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+ dev=00:00.0
+ echo Enabling bus mastering on host bridge $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+ </verb>
+ <p>
+ You can check if this worked by running the first setpci command again.
+ <p>
+
<sect1>The X Server
<p>
@@ -706,14 +746,22 @@
</verb>
<p>
- The kernel module for the Voodoo3 is named <tt>tdfx.o</tt> and
+ The kernel module for 3dfx hardware is named <tt>tdfx.o</tt> and
should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/.
It will be automatically loaded by the Xserver if needed.
<p>
- The DRI 3D driver for the Voodoo3 should be in
+ The DRI 3D driver for 3dfx hardware should be in
<tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>.
This will be automatically loaded by libGL.so.
<p>
+ The Voodoo5 supports 3D rendering in 16 and 32 bpp modes.
+ When running in 32bpp mode an 8-bit stencil buffer and 24-bit
+ Z (depth) buffer are offered.
+ When running in 16bpp mode only a 16-bit Z (depth) buffer is
+ offered and stencil is implemented in software.
+ <p>
+ A software-based accumulation buffer is available in both
+ 16 and 32bpp modes.
<sect2>Troubleshooting
<p>
@@ -731,9 +779,17 @@
the 16 bit/pixel screen mode.
Use <tt/xdpyinfo/ to verify that all your visuals are depth 16.
Edit your XF86Config file if needed.
- <item>
+ <item>
The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for
Glide on older 3dfx hardware.
+ <item>
+ Different versions of Glide are needed for Voodoo3 and Voodoo5.
+ See the DRI website's resources page to download the right
+ version of Glide.
+ <item>
+ Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default)
+ but 3D acceleration is not supported in that mode.
+ 32bpp mode is fully 3D accelerated.
</itemize>
<sect2>Performance
@@ -742,7 +798,7 @@
<item>
Normally, buffer swapping in double-buffered applications is
synchronized to your monitor's refresh rate.
- This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/
+ This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERVAL/
environment variable.
The value of this variable indicates the maximum number of
swap buffer commands can be buffered.
@@ -798,97 +854,6 @@
Using <tt/glColorMask(r, g, b, a)/ when r!=g or g!=b.
</itemize>
<item>
- The lowest mipmap level is sometimes miscolored in trilinear-
- sampled polygons.
- </itemize>
-
-
- <sect1>3dfx Voodoo5 Series
-<p>
- <sect2>Dependencies
-<p>
- The Voodoo5 DRI driver requires a special versions of
- the 3dfx Glide library, different than that used for Voodoo3
- hardware.
- It can be downloaded from the DRI website.
-<p>
- <sect2>Configuration
-<p>
- Your XF86Config file's device section must specify the
- <tt>tdfx</tt> device:
- <verb>
- Section "Device"
- Identifier "Voodoo5"
- VendorName "3dfx"
- Driver "tdfx"
- EndSection
- </verb>
- The Screen section should then reference the Voodoo3 device:
- <verb>
- Section "Screen"
- Identifier "Screen 1"
- Device "Voodoo5"
- Monitor "High Res Monitor"
- DefaultDepth 24
- Subsection "Display"
- Depth 16
- Modes "1280x1024" "1024x768" "800x600" "640x480"
- ViewPort 0 0
- EndSubsection
- Subsection "Display"
- Depth 24
- Modes "1280x1024" "1024x768" "800x600" "640x480"
- ViewPort 0 0
- EndSubsection
- EndSection
- </verb>
- <p>
- The kernel module for the Voodoo5 is named <tt>tdfx.o</tt> and
- should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/.
- It will be automatically loaded by the Xserver if needed.
- <p>
- The DRI 3D driver for the Voodoo5 should be in
- <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>.
- This will be automatically loaded by libGL.so.
- <p>
- The Voodoo5 supports 3D rendering in 16 and 32 bpp modes.
- When running in 32bpp mode an 8-bit stencil buffer and 24-bit
- Z (depth) buffer are offered.
- When running in 16bpp mode only a 16-bit Z (depth) buffer is
- offered and stencil is implemented in software.
- <p>
- A software-based accumulation buffer is available in both
- 16 and 32bpp modes.
- <p>
-
- <sect2>Troubleshooting
-<p>
- <itemize>
- <item>
- The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for
- Glide on older 3dfx hardware.
- <item>
- Different versions of Glide are needed for Voodoo3 and Voodoo5.
- See the DRI website's resources page to download the right
- version of Glide.
- </itemize>
-
- <sect2>Performance
-<p>
- <itemize>
- <item>
- Normally, buffer swapping in double-buffered applications is
- synchronized to your monitor's refresh rate.
- This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/
- environment variable.
- The value of this variable indicates the maximum number of
- swap buffer commands can be buffered.
- Zero allows maximum frame rate.
- <item>
- Rendering with 16-bit per texel textures is faster than using
- 32-bit per texel textures. The <tt/internalFormat/ parameter
- to <tt/glTexImage2D/ can be used to control texel size.
- <item>
The Voodoo5 driver reverts to software rendering under the
same conditions Voodoo3 with three exceptions.
First, stencil operations are implemented in hardware when the
@@ -897,6 +862,18 @@
hardware.
Third, <tt/glColorMask/ is fully supported in hardware when
the screen is configured for 32 bits/pixel.
+ <item>
+ As of January, 2001 the second VSA-100 chip on the Voodoo5 is
+ not yet operational.
+ Therefore, the board isn't being used to its full capacity.
+ The second VSA-100 chip will allow Scan-Line Interleave (SLI)
+ mode for full-screen applications and games, potentially doubling
+ the system's fill rate.
+ When the second VSA-100 chip is activated
+ glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4.
+ <item>
+ The lowest mipmap level is sometimes miscolored in trilinear-
+ sampled polygons.
</itemize>
<sect2>Known Problems
@@ -906,25 +883,12 @@
The lowest mipmap level is sometimes miscolored in trilinear-
sampled polygons (Voodoo3/Banshee).
<item>
- Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default)
- but 3D acceleration is not supported in that mode.
- 32bpp mode is fully 3D accelerated.
- <item>
Fog doesn't work with orthographic projections.
<item>
The accuracy of blending operations on Voodoo4/5 isn't always
very good.
If you run Glean, you'll find some test failures.
<item>
- As of October, 2000 the second VSA-100 chip on the Voodoo5 is
- not yet operational.
- Therefore, the board isn't being used to its full capacity.
- The second VSA-100 chip will allow Scan-Line Interleave (SLI)
- mode for full-screen applications and games, potentially doubling
- the system's fill rate.
- When the second VSA-100 chip is activated
- glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4.
- <item>
The Glide library cannot be used directly; it's only meant to
be used via the tdfx DRI driver.
<item>
@@ -935,9 +899,9 @@
<sect1>Intel i810
- <p>
+<p>
<sect2>Dependencies
- <p>
+<p>
A Linux kernel with AGP GART support is required.
The 2.2.x kernel series does not have AGP GART support.
The 2.4.x test kernels have AGP GART and have been tested
@@ -945,7 +909,7 @@
<p>
<sect2>Configuration
- <p>
+<p>
Your XF86Config file's device section must specify the
<tt>i810</tt> device, and specify a usable amount of video
ram to reserve.
@@ -954,6 +918,7 @@
Identifier "i810"
VendorName "Intel"
Driver "i810"
+ Option "AGPMode" "1"
VideoRam 10000
EndSection
</verb>
@@ -1004,14 +969,14 @@
<p>
<sect1>Matrox G200 and G400
- <p>
+<p>
<sect2>Dependencies
- <p>
+<p>
A Linux kernel with AGP GART support (such as the 2.4.x test
kernels) is needed.
<p>
<sect2>Configuration
- <p>
+<p>
Your XF86Config file's device section must specify the
<tt>mga</tt> device:
<verb>
@@ -1019,6 +984,7 @@
Identifier "MGA"
VendorName "Matrox"
Driver "mga"
+ Option "AGPMode" "1"
VideoRam 32768
EndSection
</verb>
@@ -1072,9 +1038,14 @@
<item>Using glLogicOp.
<item>Using glPolygonStipple or glLineStipple.
<item>Using 1D or 3D textures.
+ <item>Using texture borders.
+ <item>Using glDepthFunc(GL_NEVER).
<item>Using the accumulation buffer.
</itemize>
-
+<p>
+ The AGP mode may be set to 1, 2, or 4. One is used by default.
+ Higher AGP speeds may result in unreliable performance depending
+ on your motherboard.
<sect2>IRQ Assignment
<p>
@@ -1129,14 +1100,14 @@
<sect1>ATI Rage 128
- <p>
+<p>
<sect2>Dependencies
- <p>
+<p>
A Linux kernel with AGP GART support (such as the 2.4.x test
kernels) is needed.
<p>
<sect2>Configuration
- <p>
+<p>
Your XF86Config file's device section must specify the
<tt>ati</tt> device:
<verb>
@@ -1144,6 +1115,8 @@
Identifier "Rage128"
VendorName "ATI"
Driver "ati"
+ Option "AGPMode" "1"
+ Option "UseCCEFor2D" "false"
EndSection
</verb>
The Screen section should then reference the Rage 128 device:
@@ -1182,21 +1155,30 @@
While PCI Rage 128 based cards are supported, they do not yet
support PCI GART, so they will not perform as well as their
AGP counterparts.
+<p>
+ For AGP cards, the AGP mode may be set to 1, 2, or 4. One is
+ used by default.
+ Higher AGP speeds may result in unreliable performance depending
+ on your motherboard.
<sect2>Known Problems
<p>
- None.
+ If you experience stability problems you may try setting the
+ <tt>UseCCEFor2D</tt> option to <tt>true</tt>. This will
+ effectively disable 2D hardware acceleration. Performance will
+ be degraded, of course.
+<p>
<sect1>ATI Radeon
- <p>
+<p>
<sect2>Dependencies
- <p>
+<p>
A Linux kernel with AGP GART support (such as the 2.4.x test
kernels) is needed.
<p>
<sect2>Configuration
- <p>
+<p>
Your XF86Config file's device section must specify the
<tt>ati</tt> device:
<verb>
@@ -1204,6 +1186,7 @@
Identifier "Radeon"
VendorName "ATI"
Driver "ati"
+ Option "AGPMode" "1"
EndSection
</verb>
The Screen section should then reference the Radeon device:
@@ -1242,6 +1225,10 @@
While this driver supports many of the features of ATI Radeon
cards, we do not <em/yet/ fully support the card's TCL
features. This work is progressing, but is not yet ready.
+<p>
+ The AGP mode may be set to 1, 2, or 4. One is used by default.
+ Higher AGP speeds may result in unreliable performance depending
+ on your motherboard.
<sect2>Known Problems
<p>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
index 135e9ca4d..f77dce508 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
@@ -10,10 +10,10 @@
<author>
<htmlurl url="http://www.valinux.com/"
name="VA Linux Systems, Inc."> Professional Services - Graphics.
- <date>5 January 2001
+ <date>15 March 2001
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.10 2001/01/08 01:07:34 martin Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.13 2001/04/05 19:29:42 dawes Exp $
</ident>
<toc>
@@ -22,7 +22,7 @@
<sect1>Copyright <p>
- <bf>Copyright &copy; 2000 by VA Linux Systems, Inc.
+ <bf>Copyright &copy; 2000-2001 by VA Linux Systems, Inc.
All Rights Reserved.</bf>
<p>
<bf>Permission is granted to make and distribute verbatim copies
@@ -79,7 +79,8 @@
<p>
The DRI 3D drivers generally work on systems with Intel or AMD CPUs.
- However, there is limited support for Alpha and Sparc.
+ However, there is limited support for Alpha and PowerPC support is
+ underway.
<p>
For 3dfx Voodoo3 hardware, you'll also need:
@@ -115,7 +116,8 @@
The DRI project closely tracks Linux kernel development. Since
the internal Linux data structures might change in the 2.4 Linux
- kernel, it's important to have use the most recent Linux kernel.
+ kernel, it's important to use the most recent Linux kernel and
+ not an old, intermediate development release.
As of this writing (Jan 2001), 2.4.0 is the most recent version
of Linux which the DRI is synchronized to.
<p>
@@ -154,7 +156,7 @@
compilation problems.
<item>Read /usr/src/linux/Documentation/Changes.
This file lists the minimum requirements for all software
- packages required to build the kernel. You must upgrage at
+ packages required to build the kernel. You must upgrade at
least gcc, make, binutils and modutils to at least the
versions specified in this file. The other packages may not
be needed. If you are upgrading from Linux 2.2.x you must
@@ -217,22 +219,22 @@
runtime which CPU-dependent optimizations should be used and
enable them where appropriate.
- <sect1>Intel Pentium III Features
- <p>
+ <sect1>Intel Pentium III Features <p>
+
The Pentium III SSE (Katmai) instructions are used in
optimized vertex transformation functions in the Mesa-based
DRI drivers.
On Linux, SSE requires a recent kernel (such as 2.4.0-test11
or later) both at compile time and runtime.
- <sect1>AMD 3DNow! Features
- <p>
+ <sect1>AMD 3DNow! Features <p>
+
AMD's 3DNow! instructions are used in optimized vertex
transformation functions in the Mesa-based DRI drivers.
3DNow! is supported in most versions of Linux.
- <sect1>Alpha Features
- <p>
+ <sect1>Alpha Features <p>
+
On newer Alpha processors a significant performance increase
can be seen with the addition of the -mcpu= option to GCC.
This option is dependent on the architecture of the processor.
@@ -243,7 +245,7 @@
To enable this optimization edit your xc/config/host.def file
and add the line:
- #define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6
+ #define DefaultGcc2AxpOpt -O2 -mcpu=ev6
Additional speed improvements to 3D rendering can be achieved
by installing Compaq's Math Libraries (CPML) which can be
@@ -516,7 +518,7 @@
<p>
To load the appropriate DRI module in your running kernel you can
either use ismod and restart your X server or copy the kernel module
- to <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> then run
+ to <tt>/lib/modules/2.4.x/kernel/drivers/char/drm/</tt> then run
depmod and restart your X server.
<p>
Make sure you first unload any older DRI kernel modules that might
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile
index 7b348d473..c9b0477bb 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile
@@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/28 05:13:04 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.70 2001/02/07 18:49:30 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.71 2001/03/02 02:45:37 dawes Exp $
#include <Server.tmpl>
#include <lnxdoc.rules>
@@ -12,7 +12,7 @@ SGMLDEPENDS = defs.ent
MANSGMLDEPENDS = mdefs.ent
INDEXLIST = README.sgml RELNOTES.sgml Status.sgml LICENSE.sgml Install.sgml \
DESIGN.sgml Versions.sgml \
- mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml \
+ mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml dps.sgml \
Darwin.sgml isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml \
OS2note.sgml \
apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \
@@ -118,6 +118,7 @@ LinuxDocTarget(xinput)
#endif
LinuxDocReadmeTarget(DRI)
LinuxDocReadmeTarget(DRIcomp)
+LinuxDocReadmeTarget(dps)
SGMLMANDEFS=-D__drivermansuffix__='"$(DRIVERMANSUFFIX)"' \
-D__filemansuffix__='"$(FILEMANSUFFIX)"' \
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml
index dc2df49d0..c4b02d73d 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml
@@ -9,7 +9,7 @@
<date>15 December 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.10 2000/12/15 19:09:06 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11 2001/03/02 17:40:48 dawes Exp $
</ident>
<abstract>
@@ -36,7 +36,17 @@ used to install the binaries.
<sect>Downloading the XFree86 &relvers; binaries
<p>
-We provide XFree86 &relvers; binaries for a range
+
+<![ %updaterel [
+XFree86 &relvers; is an update release. The most recent full release
+(&fullrelvers;) needs to be installed before installing this update.
+Information about downloading and installing &fullrelvers; can be found
+in the installation document for that version, which can be found
+on the <url name="XFree86 web site"
+url="http://www.xfree86.org/pub/XFree86/&fullrelvers/Install.html">.
+]]>
+
+We provide XFree86 &relvers; <![ %updaterel [update ]]>binaries for a range
of operating systems at our
<![ %snapshot; [
<url name="ftp site"
@@ -80,11 +90,13 @@ When downloading it under this name, select "save as" on your browser,
and save the file under the name "<tt>Xinstall.sh</tt>".
Once you're run the <tt>Xinstall.sh</tt> script and found which binary
-distribution is suitable for your system, download the necessary files.
-The twelve (12) mandatory files for all installations are listed below.
-If you have not downloaded all of the files, the installer script will
-complain.
+<![ %updaterel; [update ]]>distribution is suitable for your system,
+download the necessary files. The <![ %fullrel [twelve (12)]]><![
+%updaterel [four (4)]]> mandatory files for all installations are listed
+below. If you have not downloaded all of the files, the installer script
+will complain.
+<![ %fullrel [
<quote><verb>
1. Xinstall.sh The installer script
2. extract The utility for extracting tarballs
@@ -99,6 +111,16 @@ complain.
11. Xxserv.tgz XFree86 X server
12. Xmod.tgz XFree86 X server modules
</verb></quote>
+]]>
+
+<![ %updaterel [
+<quote><verb>
+1. Xinstall.sh The installer script
+2. extract The utility for extracting tarballs
+3. Xupdate.tgz Updated files except X server drivers
+4. Xdrivers.tgz Updated X server drivers
+</verb></quote>
+]]>
NOTES:
<itemize>
@@ -107,18 +129,22 @@ NOTES:
version called <tt>extract.exe</tt> instead. This should fix the
problem. (This is not a DOS/Windows executable.)
+<![ %fullrel [
<item>A few distributions don't have or require the <tt>Xvar.tgz</tt>
tarball. If it is present in the <tt>binaries</tt> sub-directory
for your platform, then it is required.
+]]>
<item>The Darwin/Mac OS X distribution doesn't have or require the
- <tt>Xmod.tgz</tt> tarball.
+ <![ %fullrel [<tt>Xmod.tgz</tt>]]><![ %updaterel
+ [<tt>Xdrivers.tgz</tt>]]> tarball.
<item>Some distributions may have additional mandatory tarballs.
While rare, the installer script will tell you if any are missing.
</itemize>
+<![ %fullrel [
The following thirteen (13) tarballs are optional. You should download
the ones you want to install.
@@ -146,15 +172,22 @@ NOTES:
If you miss some and want to install them later, go to the
<ref id="manual-install" name="Manual Installation"> section.
+]]>
<sect>Installing XFree86 &relvers; using the <tt>Xinstall.sh</tt> script
<p>
We strongly recommend that our XFree86 &relvers; binaries be installed
-using the <tt>Xinstall.sh</tt> script that we provide. There are a lot of
+using the <tt>Xinstall.sh</tt> script that we provide.
+<![ %updaterel [It is also important that the previous full release
+(&fullrelvers;) is installed before installing this update release.
+Make sure that you use the &relvers; version of the <tt>Xinstall.sh</tt>
+script to install this update. Older versions may not be able to do it
+correctly.]]>
+There are a lot of
steps in the manual installation process, and those steps can vary
-according to the platform and hardware setup. There is a description of
+according to the platform and hardware setup. <![ %fullrel [There is a description of
the manual installation process for the most common cases <ref
-id="manual-install" name="below">.
+id="manual-install" name="below">.]]>
You must login as the super user (root) to run the installer script.
Place all of the downloaded files into a single directory (choose a
@@ -184,7 +217,9 @@ be a problem, you should exit your X session, including stopping xdm or
equivalent if it is running, before continuing. If you ignore this
warning and run into problems, well, you were warned!
-If you have an existing X installation, you will be warned that proceeding
+<![ %fullrel [If you have an existing X installation, you]]>
+<![ %updaterel [You ]]>
+will be warned that proceeding
with this installation will overwrite it. Only those things that are
part of our standard distribution will be overwritten. Other X
applications that you may have installed will not be removed. Some
@@ -203,6 +238,7 @@ script may remove some old files or directories that would get in the
way of the new installation. It will list which files/directories have
been removed. If none are listed, then none were removed.
+<![ %fullrel [
The next step when installing over an existing version is to check for
existing configuration files. As of XFree86 version 3.9.18, the run-time
configuration files are installed by default under <tt>/etc/X11</tt>
@@ -222,7 +258,7 @@ then you can safely answer "no" if you don't want them moved.
When installing over an existing version, you will be prompted before
each set of configuration files is installed. If you haven't made any
-customisations to your existing configuration files, then you can safely
+Customisations to your existing configuration files, then you can safely
answer "yes" for each of these. If you have made customisations, you
can try answering "no". If you run into problems later, you may need
to manually merge your customisations into the the new version of the
@@ -273,6 +309,8 @@ rm -f /usr/bin/rstartd
ln -s /usr/X11R6/bin/rstartd /usr/bin/rstartd
</verb></tscreen>
+]]>
+
<sect1>After the installation is complete
<p>
The next step is to configure the X server. That is covered in detail
@@ -301,6 +339,7 @@ operation of the new X server, you can safely remove the old
After the X server configuration is done, it may be advisable to reboot,
especially if you run xdm (or equivalent) or the font server (xfs).
+<![ %fullrel [
<sect>Installing XFree86 &relvers; manually<label id="manual-install">
<p>
This section describes how to manually install the XFree86 &relvers; binary
@@ -427,5 +466,7 @@ Once that's done, the main part of the installation can be done:
/usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc
</verb></tscreen>
+]]>
+
</article>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml
index 9aa0de66a..35a248852 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml
@@ -5,10 +5,10 @@
<article>
<title>Licenses</title>
<author>The XFree86 Project</author>
-<date>1999</date>
+<date>March 2001</date>
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7 2000/03/06 22:59:23 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $
</ident>
<sect>XFree86 License
@@ -17,7 +17,7 @@ XFree86 code without an explicit copyright is covered by the following
copyright/license:
<p>
-Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml
index dc4dd743b..47f9d66d4 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml
@@ -9,10 +9,10 @@ David Dawes,
Marc Wandschneider,
Mark Weaver,
Matthieu Herrb
-<Date>Last modified on: 7 December 2000
+<Date>Last modified on: 3 March 2001
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12 18:54:29 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60 2001/03/04 09:47:34 herrb Exp $
</ident>
<toc>
@@ -20,10 +20,9 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12
<sect>What and Where is XFree86?
<p>
-XFree86 is a port of X11R6.4 that supports several versions of
-Intel-based Unix. It is derived from X386 1.2, which was the X server
-distributed with X11R5. This release consists of many new features
-and performance improvements as well as many bug fixes.
+XFree86 is the Open Source port of X.Org's X11R6.4 release that supports
+several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86)
+operating systems on Intel and other platforms.
See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">.
@@ -32,7 +31,7 @@ The sources for XFree86 are available by anonymous ftp from:
<htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;"
url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;">
-Binaries for NetBSD 1.3 and later are available from:
+Binaries for NetBSD 1.4 and later are available from:
<htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/NetBSD"
url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/NetBSD">
@@ -111,7 +110,7 @@ for detailed installation instructions.
<sect>Configuring X for Your Hardware
<p>
-The <tt>/etc/XF86Config</tt> file tells the X server what kind of
+The <tt>/etc/X11/XF86Config</tt> file tells the X server what kind of
monitor,
video card and mouse you have. You <em/must/ create it to tell the
server what specific hardware you have.
@@ -123,13 +122,12 @@ You'll need info on your hardware:
<item>Your monitor's sync frequencies.
</itemize>
-<!--
+
The recommended way to generate an <tt/XF86Config/ file is to use the
-<tt/XF86Setup/ utility. The xf86config text utility is still there
-for the (few) cases where XF86Setup can't be used. Also, there is a
+<tt/xf86cfg/ utility. The xf86config text utility is still there
+for the (few) cases where xf86cfg can't be used. Also, there is a
sample file installed as <tt>/usr/X11R6/lib/X11/XF86Config.eg</tt>,
which can be used as a starting point.
--->
For details about the <tt/XF86Config/ file format, refer to the
<em>XF86Config(5)</em> manual page.
@@ -140,20 +138,21 @@ modes with the <tt>xvidtune</tt> utility.
<sect1>About mouse configuration
<p>
-The NetBSD pms mouse driver handles PS/2 style mice as
-Busmouse. Specify the protocol as ``<bf/busmouse/'' in the mouse
-section of your
-<tt/XF86Config/ file if you're using a PS/2 mouse.
+XFree86 &relvers; has support for the mouse driver included in
+the <bf/wscons/ console driver introduced by NetBSD 1.4. Specify
+``<tt/wsmouse/'' as the protocol and ``<tt>/dev/wsmouse0</tt>'' as the
+device in <tt>/etc/X11/XF86Config</tt> if you're using NetBSD 1.4 or later
+with a PS/2 mouse.
+<p>
+For older releases, the NetBSD <bf/pms/ mouse driver handles PS/2 style
+mice as Busmouse. Specify the protocol as ``<tt/busmouse/'' in the
+mouse section of your <tt/XF86Config/ file if you're using a PS/2
+mouse with NetBSD 1.3 or former releases.
<p>
Only standard PS/2 mice are supported by this driver. Newest PS/2
mice that send more than three bytes at a time (especially
-Intellimouse, or MouseMan+ with a ``3D'' roller) are not supported yet.
-<p>
-XFree86 &relvers; also has support for the mouse driver included in
-the new <bf/wscons/ console driver introduced by NetBSD 1.4. Specify
-``<tt/wsmouse/'' as the protocol and ``<tt>/dev/wsmouse0</tt>'' as the
-device in <tt>/etc/XF86Config</tt> if you're using NetBSD 1.4 with
-wscons.
+Intellimouse, or MouseMan+ with a wheel) are not supported by NetBSD
+1.3 and former releases.
<p>
See <htmlurl url="mouse.html" name="README.mouse"> for general
instruction on mouse configuration in XFree86.
@@ -190,8 +189,9 @@ xdm=YES xdm_flags="" # x11 display manager
in <tt>/etc/rc.conf</tt>.
<p>
-Under NetBSD 1.4 with the wscons console driver, you must enable a
-virtual console for the X server first. To do this follow these steps:
+Under NetBSD 1.4 and later with the wscons console driver, you must
+enable a virtual console for the X server first. To do this follow
+these steps:
<itemize>
<item>Make sure the device file exists. If not, ``<tt>cd /dev ;
./MAKEDEV wscons</tt>''.
@@ -210,8 +210,8 @@ screen 4 - -
screen 5 - vt100
</verb></tscreen>
</itemize>
-(Thanks to Mason Loring Bliss <tt>&lt;mason@acheron.middleboro.ma.us&gt;</tt> for
-this explanation)
+(Thanks to Mason Loring Bliss
+<tt>&lt;mason@acheron.middleboro.ma.us&gt;</tt> for this explanation)
<p>
Note that the binary distributions of XFree86 for NetBSD don't include
support for the XDM-AUTHORIZATION-1 protocol.
@@ -239,7 +239,7 @@ The pccons driver is the most widely tested and is the console driver
contained in the NetBSD binary distribution's kernels.
<p>
-The pcvt console driver is bundled with NetBSD. The pcvt X
+The pcvt console driver was bundled with NetBSD until 1.4. The pcvt X
mode is compatible with the pccons driver X mode. It offers several
virtual consoles and international keyboard support. In order to use
this driver, change the line:
@@ -258,9 +258,9 @@ in your kernel config file, and rebuild and install your kernel.
<p>
<label id="wscons">
-XFree86 will also run with the wscons console driver in
-NetBSD 1.4. For now, it uses the pcvt compatibility mode, so be
-sure to have the lines:
+Wscons is the current console driver, included in NetBSD 1.4 and
+later. For now, XFree86 supports wscons using the pcvt compatibility
+mode, so be sure to have the lines:
<tscreen><verb>
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
@@ -344,11 +344,6 @@ extension.
<sect> Rebuilding the XFree86 Distribution
<p>
-<!-- out of date
-See <htmlurl url="INSTALL.html" name="INSTALL"> for instructions on
-unbundling and building the source distribution.
--->
-
You should configure the distribution by editing
<tt>xc/config/cf/host.def</tt> before compiling. To compile the
sources, invoke ``<tt/make World/'' in the xc directory.
@@ -403,6 +398,12 @@ by adding:
</verb></tscreen>
to <tt>xc/config/host.def</tt> before rebuilding the server.
This has not been thoroughly tested, except on the macppc.
+<p>
+For the i386, you should include both pcvt and wscons support in order
+to use the pcvt compatibility mode of wscons:
+<tscreen><verb>
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT
+</verb></tscreen>
<sect1>Building on other architectures<label id="sparc">
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml
index 09a13a4cc..39db92490 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml
@@ -6,10 +6,10 @@
<title>README for XFree86 &relvers; on OpenBSD
<author>
Matthieu Herrb
-<Date>Last modified on: 2 December 2000
+<Date>Last modified on: 3 March 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.17 2001/04/05 19:29:43 dawes Exp $
</ident>
<toc>
@@ -18,10 +18,9 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12
<sect>What and Where is XFree86?
<p>
-XFree86 is a port of X11R6.4 that supports several versions of
-Intel-based Unix. It is derived from X386 1.2, which was the X server
-distributed with X11R5. This release consists of many new features
-and performance improvements as well as many bug fixes.
+XFree86 is the Open Source port of X.Org's X11R6.4 release that supports
+several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86)
+operating systems on Intel and other platforms.
See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">.
@@ -57,6 +56,13 @@ this file and we'll revise it.
See the <htmlurl url="RELNOTES.html" name="Release Notes"> for
non-OS dependent new features in XFree86 &relvers;.
+<sect1>New OS dependent features in 4.0.3
+<p>
+<itemize>
+<item>Support for the wscons console driver in post 2.8 OpenBSD.
+<item>A fix for multi-threaded libraries support.
+</itemize>
+
<sect1>New OS dependent features in 4.0.2
<p>
<itemize>
@@ -115,7 +121,7 @@ for detailed installation instructions.
<sect>Configuring X for Your Hardware
<p>
-The <tt>/etc/XF86Config</tt> file tells the X server what kind of
+The <tt>/etc/X11/XF86Config</tt> file tells the X server what kind of
monitor,
video card and mouse you have. You <em/must/ create it to tell the
server what specific hardware you have.
@@ -126,13 +132,13 @@ You'll need info on your hardware:
<item>The video card's chipset (e.g. ET4000, S3, etc).
<item>Your monitor's sync frequencies.
</itemize>
-<!--
+
The recommended way to generate an <tt/XF86Config/ file is to use the
-<tt/XF86Setup/ utility. The xf86config text utility is still there
-for the (few) cases where XF86Setup can't be used. Also, there is a
+<tt/xf86cfg/ utility. The xf86config text utility is still there
+for the (few) cases where xf86cfg can't be used. Also, there is a
sample file installed as <tt>/usr/X11R6/lib/X11/XF86Config.eg</tt>,
which can be used as a starting point.
--->
+
For details about the <tt/XF86Config/ file format, refer to the
<em>XF86Config(5)</em> manual page.
@@ -143,9 +149,11 @@ modes with the <tt>xvidtune</tt> utility.
<sect1>About mouse configuration
<p>
-If your serial mouse does not work try using <tt>kermit</tt> or
-<tt>tip</tt> to connect to the mouse serial port and verify that it
-does indeed generate characters.
+XFree86 &relvers; has support for the mouse driver included in
+the new <bf/wscons/ console driver introduced by OpenBSD-current after
+2.8. Specify ``<tt/wsmouse/'' as the protocol and
+``<tt>/dev/wsmouse0</tt>'' as the device in <tt>/etc/X11/XF86Config</tt>
+if you're using OpenBSD-current with a PS/2 mouse.
<p>
The OpenBSD pms driver provides both ``raw'' and ``cooked''
(translated) modes. ``raw'' mode does not do protocol translation, so
@@ -213,9 +221,13 @@ console drivers: pcvt and pccons. They are detected at runtime and no
configuration of the server itself is required.
<p>
-The pcvt console driver is the default in OpenBSD. It offers
-several virtual consoles and international keyboard support.
+The pcvt console driver is the default in OpenBSD up to OpenBSD 2.8.
+It offers several virtual consoles and international keyboard support.
+<p>
+OpenBSD-current after 2.8 has switched to the wscons console
+driver. This console driver has a pcvt compatibility mode for X
+support.
<sect1>Aperture Driver
<p>
@@ -271,6 +283,11 @@ diff -u -r1.14 mem.c
return -1;
</verb></tscreen>
+<p>In post 2.8 OpenBSD-current, a modified version of this patch has
+been integrated. You should set
+<tscreen><verb>machdep.allowaperture=2</verb></tscreen>
+in <tt>/etc/sysctl.conf</tt> in order to achieve this. See the xf86(4)
+manual page for details.
<p>
Another (less recommended) way to enable linear memory and I/O ports
access is to disable the kernel security feature by adding ``option
@@ -314,11 +331,6 @@ changes to the <tt/xf86site.def/, type ``<tt>./mkmf</tt>'' and
``<tt/make/'' to link the server. See <tt>/usr/X11R6/lib/Server/README</tt>
for more info.
-<!-- out of date
-See <htmlurl url="INSTALL.html" name="INSTALL"> for instructions on
-unbundling and building the source distribution.
--->
-
You should configure the distribution by editing
<tt>xc/config/cf/host.def</tt> before compiling. To compile the
sources, invoke ``<tt/make World/'' in the xc directory.
@@ -351,6 +363,11 @@ by adding:
to <tt>xc/config/host.def</tt> before rebuilding the server.
This has not been thoroughly tested, except on the macppc.
+For the i386, you should include both pcvt and wscons support in order
+to use the pcvt compatibility mode of wscons:
+<tscreen><verb>
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT
+</verb></tscreen>
<sect1>Building on other architectures<label id="otherarch">
@@ -360,7 +377,6 @@ XFree86 should also compiles on other OpenBSD architectures. However,
please note that 3.9.x snapshots have only been tested on the i386 for
now.
-<!--
<p>
Note that OpenBSD project has now its own source tree, based on
the XFree86 source tree, with some local modifications. You may want
@@ -368,7 +384,6 @@ to start with this tree to rebuild from sources. The OpenBSD X11
source tree is available by anoncvs from all OpenBSD anoncvs
servers. See <htmlurl url="http://www.openbsd.org/anoncvs.html"
name="http://www.openbsd.org/anoncvs.html"> for details on anoncvs.
--->
<sect>Building New X Clients
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml
index 5d54d012c..55b0f8198 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml
@@ -15,7 +15,7 @@
<date>15 December 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.111 2001/02/09 04:15:35 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113 2001/03/16 22:13:19 dawes Exp $
</ident>
<abstract>
@@ -80,6 +80,10 @@ is supported before upgrading to the 4.x series.
Specific release enhancements can be viewed in the
<htmlurl name="Release Notes" url="RELNOTES.html">.
+The XFree86 version numbering system has had some changes as of the
+4.0.2 release. Information about this can be found in the
+<htmlurl name="Versions Document" url="Versions.html">.
+
Information about binary distributions and the attendant installation
instructions can be found in the <htmlurl name="Installation Document"
url="Install.html">.
@@ -227,7 +231,6 @@ gzip -d &lt; &prevrelvers;-&relvers;.diff.gz | patch -p0 -E
Information about getting the source for &prevrelvers can be found in the
README file for that version, which can be found on the
<url name="XFree86 web site" url="http://www.xfree86.org/pub/XFree86/&prevrelvers;/README.html">.
-.
]]>
<![ %fullrel [
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml
index 517442e02..dbc5d5bd4 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml
@@ -9,7 +9,7 @@
<date>17 December 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.59 2001/02/09 00:35:03 keithp Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $
</ident>
<abstract>
@@ -24,13 +24,20 @@ in XFree86 &relvers; and their status.
<sect>Introduction to the 4.x Release Series
<p>
XFree86 4.0 was the first official release of the new XFree86 4 series.
-The current release (&relvers;) is the latest in that series. XFree86
+<![ %updaterel [
+XFree86 &relvers; is the &whichupdaterel; update to &fullrelvers;, which
+is the latest full release in that series.
+]]>
+<![ %fullrel [
+The current release (&relvers;) is the latest in that series.
+]]>
+XFree86
4 represents a significant redesign of the XFree86 X server.
Not all of the hardware drivers from 3.3.x have been ported to 4.x yet,
but conversely, 4.x has some hardware support not present in 3.3.x.
Our <htmlurl name="Driver Status document" url="Status.html"> summarizes
how the hardware driver support compares between &legacyvers; and &relvers;.
-Please check there first before downloading &relvers;.
+Please check there first before downloading &relvers;.
The 4.0.1 release introduced a new graphical configuration tool,
"<tt>xf86cfg</tt>", and a text mode interface was added to it for the
@@ -60,14 +67,27 @@ this release, please have a quick read through the <htmlurl
name="Installation Document" url="Install.html">. It may save you some
time and help you figure out which of the binary releases you need.
+<![ %updaterel [
+The next sections describe what has changed in the update release(s)
+as well as what is new in the latest full release (&fullrelvers;).
+]]>
+<![ %fullrel [
The next section describes what is new in the latest version (&relvers;).
+]]>
The other sections below describe some of the new features and changes
between 3.3.x and 4.0. There are lot's of new features, and we definitely
don't have enough space to cover them all here.
</sect>
-<sect>Summary of new features in &relvers;.
+<![ %updaterel [
+<sect>Summary of updates in &relvers;.
+<p>
+
+</sect>
+]]>
+
+<sect>Summary of new features in &fullrelvers;.
<p>
<sect1>X server
<p>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
index c817f134a..61b42d3c2 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
@@ -9,7 +9,7 @@
<date>4 December 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14 22:15:48 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.29 2001/04/04 01:34:18 dawes Exp $
</ident>
<abstract>
@@ -17,7 +17,8 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14
This document provides information about the status of the driver and
hardware support in XFree86 &relvers; compared with that in XFree86
&legacyvers;. Please send updates for this document to
-<email>fixes@xfree86.org</email>
+<email>fixes@xfree86.org</email>. Please do not send requests for
+information or support to that address.
</abstract>
@@ -29,7 +30,10 @@ This document contains one section per vendor (organised alphabetically)
for each chipset family that is supported in XFree86 &legacyvers; or
XFree86 &relvers;. It includes information about the status of the
drivers and the hardware they support, including a comparison of the
-level of support between versions &legacyvers; and &relvers;.
+level of support between versions &legacyvers; and &relvers;. Unless
+otherwise stated, hardware is classified as "supported" if its driver
+provides basic 2D support. Support for additional features may or may
+not be present.
In XFree86 &legacyvers;, several X servers are available; much hardware
uses the XF86_SVGA server, which has a set of driver modules that are built
@@ -363,15 +367,17 @@ other architectures known to work on (e.g., Alpha, PPC), etc.
Linux, and requires the agpgart.o kernel module in order to use
modes that require more than 1MB of video memory.
-<tag>&relvers;:</tag>
- Support (accelerated) for the Intel i740 is provided by the
- "i740" driver, and support for the Intel i810 is provided by
- the "i810" driver. The "i810" driver is currently Linux-only,
- and requires the agpgart.o kernel module.
+<tag>&relvers;:</tag> Support (accelerated) for the Intel i740 is
+ provided by the "i740" driver, and support for the Intel i810
+ (including i810-dc100 and i810e) and i815 is provided by the
+ "i810" driver. The "i810" driver is currently supported only on
+ Linux and FreeBSD (4.1 and later), and requires the agpgart
+ kernel support.
<tag>Summary:</tag>
- The i740 and i810 are supported in both versions, but the i810 is
- only supported on Linux/x86 platforms at present.
+ The i740 and i810 are supported in both versions, but the i810
+ is only supported on Linux/x86 and recent FreeBSD/i386 platforms
+ at present.
</descrip>
@@ -614,7 +620,7 @@ other architectures known to work on (e.g., Alpha, PPC), etc.
there are some problems with it in this version.
<tag>Summary:</tag>
- Support for the 86C201, 86C202, 86C215, 86C225, 5597 and 5598
+ Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and 5598
is currently only available in &legacyvers;.
</descrip>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml
index 75f69a29e..44b2e0364 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml
@@ -8,14 +8,14 @@
<title>ATI Adapters README file
<author>Marc Aurele La France
-<date>2000 December 6
+<date>2001 March 24
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.35 2001/01/06 20:58:03 tsi Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $
</ident>
<abstract>
@@ -208,7 +208,7 @@ operate as if ``<it>ativga</it>'' had been specified instead.<p>
A ChipSet name of ``<it>vgawonder</it>'' is equivalent to ``<it>ativga</it>'',
except that only VGAWonder-capable adapters can be assigned to the ``Device''
section.
-This specifically excludes newer Mach64's with integrated controllers.<p>
+This specifically excludes the newer integrated Mach64 controllers.<p>
In some PCI or AGP systems, the driver will not, by default, probe for non-PCI
Mach32's or Mach64's.
This is because, before doing any such probe, the driver attempts to determine
@@ -394,7 +394,17 @@ By default, the driver will enable a linear video memory aperture for
or an integrated Mach64 graphics chip.
This option disables this linear aperture.<p>
On non-Intel platforms, the driver requires a linear aperture and, so, this
-option should not be specified.<p>
+option is ignored.<p>
+<sect1>Option <it>``HWCursor''</it> and Option <it>``SWCursor''</it><p>
+Option <it>``HWCursor''</it>, which is the default, specifies that hardware
+facilities are to be used to paint the mouse pointer on the screen.
+Option <it>``SWCursor''</it> specifies that the mouse pointer is to by drawn by
+software, which is much slower.
+If both options are specified, option <it>``SWCursor''</it> prevails.
+Currently, these options are only acted upon for 256-colour or higher depth
+modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being
+used.
+In all other situations, a software cursor will be used.<p>
<sect1>Option <it>``shadowfb''</it><p>
If this option is enabled, the driver will cause the CPU to do each drawing
operation first into a shadow frame buffer in system virtual memory and then
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml
new file mode 100644
index 000000000..b691d7652
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml
@@ -0,0 +1,192 @@
+<!doctype LINUXDOC PUBLIC "-//XFree86//DTD linuxdoc//EN" [
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<article>
+
+<title>XFree86 and DPS
+<author>Juliusz Chroboczek, <email/jch@xfree86.org/
+<date>27 February 2001</date>
+
+<ident>$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $</ident>
+
+<toc>
+
+<sect>Introduction
+
+<p>Display Postscript (or DPS for short) is a rendering extension for
+X11. DPS is slightly atypical in that it is based on <it/code
+mobility/, the ability to send executable code from client to server.
+Thus, a DPS client does not request that a line should be rendered;
+instead, it uploads code to the server which, when executed, causes a
+line to be drawn.
+
+<p>This document does not aim at teaching programming with DPS; it is
+only a summary description of the DPS support code included with
+XFree86. More information about DPS, including a DPS bibliography, is
+available from
+<url url="http://dps.sourceforge.net" name="the DPS extension site">.
+
+<tscreen>
+<it>Note: Adobe, PostScript and Display PostScript are trademarks of
+Adobe Systems Incorporated which may be registered in certain
+jurisdictions.</it>
+</tscreen>
+
+As all X11 extensions, DPS consists of client-side and server-side
+components. The DPS client side consists of a number of libraries and
+a number of tools for programming and configuration. The DPS server
+side may consist either of an X server extension, or of a client-side
+process known as the ``DPS agent.'' In this latter case, the term
+``server-side'' is somewhat misleading.
+
+At the time of writing, only the client side is included with XFree86;
+the server side must be obtained separately. Please see <ref
+id="sec:server-side" name="server side"> later in this document for
+more information.
+
+<sect>The DPS client side
+
+<p>The DPS client side consists of four libraries and a number of
+basic tools for programming and configuration; these are all included
+with XFree86.
+
+<sect1>Libraries
+
+<p>The <tt/libpsres/ library is a library for management of
+<it/PostScript resources/, on-disk files representing PostScript data
+structures such as fonts, font encodings, procsets, <it/etc./ It is
+closely related to the <tt/makepsres/ tool (see <ref id="sec:tools"
+name="client-side tools"> later in this document).
+
+The basic DPS client library is <tt/libdps/. This library contains a
+number of functions for connection establishment, resource management,
+as well as stubs for all standard PostScript operators. Normally, all
+DPS clients should link with <tt/libdps/; in addition, <tt/libdps/ may
+be used for printing by non-DPS clients (this is done, for example, by
+Sun's JDK). This library is documented in [CLRM] and [CLSX].
+
+The <tt/libdpstk/ library contains a number of additional utilities
+for managing DPS contexts, user paths and user objects, and for
+previewing EPS files. It is documented in [DPTX].
+
+The <tt/libdpstkXm/ library contains four Motif widgets. The <it/DPS
+Scrolling Widget/ is a DPS drawing area that automatically manages
+issues such as scrolling, scaling, client-side backing store,
+incremental redisplay, <it/etc./ The <it/Font Selection Box/, and its
+associated <it/Font Preview/, present a convenient and powerful
+interface for choosing scalable fonts. Finally, the <it/Color Picker/
+presents an interface for choosing colours using either of the RGB or
+HSV spaces. The latter three widgets are documented in [DPTX]; some
+summary Scrolling Widget documentation is available in the <tt/doc/
+subdirectory of the <tt/DPS.tar.gz/ file, available from <url
+url="ftp://dps.sourceforge.net/pub/dps/DPS.tar.gz">.
+
+The source code for <tt/libdpstkXm/ is included with XFree86; however,
+as it depends on Motif, this library is not built by default.
+A GTK-based library providing some of the functionality of
+<tt/libdpstkXm/ is available from
+<url url="http://www.gyve.org/gtkDPS/"
+ name="the gtkDPS site">.
+
+<sect2>Libdps and Xt
+
+<p>In X11R5, <tt/libdps/ did not depend on <tt/libXt/. In X11R6,
+however, code was added to make the Xt main loop dispatch to sundry
+code on DPS events; with this addition, all programs that link with
+<tt/libdps/ need to link with <tt/libXt/, whether they use Xt or not.
+
+This state of affairs is unfortunately true of the version of
+<tt/libdps/ included with XFree86. We are currently considering
+various solutions to this problem (including the use of weak linker
+symbols or splitting off the guilty functions into a separate
+library).
+
+<sect1>Client-side tools <label id="sec:tools">
+
+<p>In addition to the libraries, the client side of DPS consists of two
+utilities.
+
+The <tt/makepsres/ utility is used for managing PostScript resources.
+Its basic operation consists in walking recursively a filesystem tree,
+noting all resources, and then writing out a ``Unix PostScript
+Resources,'' file, basically a directory of all the resources found.
+This utility is documented in the makepsres(1) manual page.
+
+The <tt/pswrap/ utility is a stub generator for PostScript clients.
+Roughly speaking, it takes as its input textual PostScript code, and
+generates a collection of C functions that transmit that code in
+pre-tokenised form to the DPS extension. <tt/Pswrap/ is documented in
+[PSWRAP].
+
+<sect1>Sample clients
+
+<p>XFree86 contains three sample DPS clients, <tt/dpsinfo/,
+<tt/dpsexec/ and <tt/texteroids/. They are documented in their
+respective manual pages.
+
+A number of sample clients that depend on Motif are available in <url
+url="ftp://dps.sourceforge.net/pub/ftp/DPS.tar.gz">. Additional
+sample clients can be found as part of GtkDPS (see above).
+
+The GNUstep environment can be compiled to use DPS for
+all rendering; for more information, please see
+<url url="http://www.gnustep.org" name="the GNUstep site">.
+
+<sect>The DPS server side <label id="sec:server-side">
+
+<p>In order to use DPS clients, you need to install a DPS server side,
+which can be either a server extension (a ``DPS/X extension''), or a
+separate process (referred to, variously, either as a ``DPS/NX agent''
+or, rather confusingly, as ``Client-Side DPS'' (CSDPS).
+
+<sect1>Display Ghostscript
+
+<p>Display Ghostscript (note the capitalisation), or DGS, is a
+client-side implementation of DPS based on the Ghostscript
+PostScript interpreter. DGS is still in beta at the time of writing;
+it does, however, provide a very usable implementation of DPS,
+although it still has some problems with the semantics of multiple DPS
+contexts.
+
+DGS is available from
+<url url="http://www.gnustep.org/resources/sources.html"
+ name="the GNUstep download area">.
+
+<sect1>The DPS extension
+
+<p>The DPS extension is a much younger project aiming at producing an
+efficient server-side implementation of DPS. The extension is
+currently in a state best described as alpha; current versions are
+known to crash the X server under some circumstances.
+
+The DPS extension is available from
+<url url="http://dps.sourceforge.net" name="the DPS extension site">.
+
+<sect>References
+
+<p>Links to electronic versions of all of these, and more, are
+available from <url url="http://dps.sourceforge.net" name="the DPS
+extension site">.
+
+[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison-Wesley, 1990. ISBN 0-201-18127-4.
+
+[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd
+ed. Addison-Wesley, 1999. ISBN 0-201-37922-8.
+
+[INTRO] Display PostScript System. Introduction: Perspective for
+Software Developers. 15 April 1993.
+
+[CLRM] Display PostScript System. Client Library Reference Manual. 15
+April 1993.
+
+[CLSX] Display PostScript System. Client Library Supplement for X. 15
+April 1993.
+
+[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15
+April 1993.
+
+[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April
+1993.
+
+</article>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
index 612824db8..ba2976e23 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
@@ -6,10 +6,10 @@
<title>Fonts in XFree86
<author>Juliusz Chroboczek, <email/jch@xfree86.org/
-<date>21 January 2000</date>
+<date>21 January 2001</date>
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.12 2001/02/13 19:19:15 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $
</ident>
<toc>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml
index ef8c09536..575989f65 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml
@@ -7,7 +7,7 @@
<author>Precision Insight, Inc.
<date>3 March 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:00:30 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.3 2001/04/04 01:34:18 dawes Exp $
</ident>
<toc>
@@ -19,6 +19,7 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:
<item>i810,
<item>i810-dc100,
<item>i810e
+ <item>i815
</itemize>
</itemize>
@@ -43,16 +44,17 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:
in 32 bit per pixel format, and this mode is not supported by
this driver.
<item>Interlace modes cannot be supported.
- <item>This driver currently only works for Linux/ix86, and normal use
- requires the agpgart.o kernel module, included in Linux kernels
- 2.3.42 and higher.
+ <item>This driver currently only works for Linux/ix86 and recent versions
+ of FreeBSD. It requires the agpgart kernel support, which is
+ included in Linux kernels 2.3.42 and higher, and FreeBSD 4.1
+ and higher.
</itemize>
<sect>Reported Working Video Cards
<p>
<itemize>
- <item>Intel evaluation hardware - i810, i810-dc100 and i810e.
+ <item>Intel evaluation hardware - i810, i810-dc100, i810e and i815.
<item>Tyan Tomcat Motherboard.
<item>HappyPC set-top box.
</itemize>
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
index 0e68e1e9f..c8f4b799f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.20 2000/11/28 20:59:17 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.21 2001/04/05 19:29:43 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -15,7 +15,7 @@ OBJS = apm/?*_drv.o ati/?*_drv.o chips/?*_drv.o cirrus/?*_drv.o \
i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \
nv/?*_drv.o rendition/?*_drv.o s3virge/?*_drv.o sis/?*_drv.o \
tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \
- vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o
+ vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o vmware/?*_drv.o
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile
index 236e025cc..756445cd1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.28 2001/01/24 00:06:15 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.29 2001/03/25 05:32:07 tsi Exp $
XCOMM
XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
XCOMM
@@ -107,9 +107,10 @@ DEFINES = $(CPIODEFINES) $(DRIDEFINES)
SRCS1 = ati.c atiadapter.c atibus.c atichip.c atiident.c atioption.c \
atiprobe.c atividmem.c $(MODSRCS1) $(CPIOSRCS1) \
radeon_probe.c r128_probe.c
-SRCS2 = atiadjust.c aticlock.c aticonfig.c aticonsole.c atidac.c atidga.c \
- atidsp.c atilock.c atimach64.c atimach64io.c atimode.c atipreinit.c \
- atiprint.c atiscreen.c atiutil.c ativalid.c $(MODSRCS2) $(CPIOSRCS2)
+SRCS2 = atiaccel.c atiadjust.c aticlock.c aticonfig.c aticonsole.c \
+ aticursor.c atidac.c atidga.c atidsp.c atilock.c atimach64.c \
+ atimach64io.c atimode.c atipreinit.c atiprint.c atiscreen.c atiutil.c \
+ ativalid.c $(MODSRCS2) $(CPIOSRCS2)
SRCS3 = r128_accel.c r128_cursor.c r128_dga.c r128_driver.c r128_video.c \
$(MODSRCS3) $(DRISRCS3)
SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \
@@ -118,9 +119,10 @@ SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \
OBJS1 = ati.o atiadapter.o atibus.o atichip.o atiident.o atioption.o \
atiprobe.o atividmem.o $(MODOBJS1) $(CPIOOBJS1) \
radeon_probe.o r128_probe.o
-OBJS2 = atiadjust.o aticlock.o aticonfig.o aticonsole.o atidac.o atidga.o \
- atidsp.o atilock.o atimach64.o atimach64io.o atimode.o atipreinit.o \
- atiprint.o atiscreen.o atiutil.o ativalid.o $(MODOBJS2) $(CPIOOBJS2)
+OBJS2 = atiaccel.o atiadjust.o aticlock.o aticonfig.o aticonsole.o \
+ aticursor.o atidac.o atidga.o atidsp.o atilock.o atimach64.o \
+ atimach64io.o atimode.o atipreinit.o atiprint.o atiscreen.o atiutil.o \
+ ativalid.o $(MODOBJS2) $(CPIOOBJS2)
OBJS3 = r128_accel.o r128_cursor.o r128_dga.o r128_driver.o r128_video.o \
$(MODOBJS3) $(DRIOBJS3)
OBJS4 = radeon_accel.o radeon_cursor.o radeon_dga.o radeon_driver.o \
@@ -173,6 +175,8 @@ InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(ati.c,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(ati.cpp,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(ati.h,$(DRIVERSDKDIR)/drivers/ati)
+InstallDriverSDKNonExecFile(atiaccel.c,$(DRIVERSDKDIR)/drivers/ati)
+InstallDriverSDKNonExecFile(atiaccel.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atiadapter.c,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atiadapter.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atiadjust.c,$(DRIVERSDKDIR)/drivers/ati)
@@ -192,6 +196,8 @@ InstallDriverSDKNonExecFile(aticonfig.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(aticonsole.c,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(aticonsole.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(aticrtc.h,$(DRIVERSDKDIR)/drivers/ati)
+InstallDriverSDKNonExecFile(aticursor.c,$(DRIVERSDKDIR)/drivers/ati)
+InstallDriverSDKNonExecFile(aticursor.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atidac.c,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atidac.h,$(DRIVERSDKDIR)/drivers/ati)
InstallDriverSDKNonExecFile(atidga.c,$(DRIVERSDKDIR)/drivers/ati)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c
index 6d5e41321..ea431b85c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.15 2001/01/06 20:58:03 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.16 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -66,6 +66,7 @@
* David S. Miller, davem@redhat.com
* A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk
* Linus Torvalds, torvalds@transmeta.com
+ * William Blew <wblew@home.com>
*
* ... and, many, many others from around the world.
*
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c
new file mode 100644
index 000000000..dcac2d8cf
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c
@@ -0,0 +1,79 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.4 2001/04/04 00:19:04 tsi Exp $ */
+/*
+ * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
+ *
+ * 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 "atiaccel.h"
+#include "atiadapter.h"
+#include "atimach64.h"
+#include "atistruct.h"
+
+/*
+ * ATIInitializeAcceleration --
+ *
+ * This function is called to initialise XAA on a screen.
+ */
+Bool
+ATIInitializeAcceleration
+(
+ ScrnInfoPtr pScreenInfo,
+ ScreenPtr pScreen,
+ ATIPtr pATI
+)
+{
+ BoxRec ScreenArea;
+ unsigned int scanlines;
+
+ if (!pATI->OptionAccel)
+ return TRUE;
+
+ if (!(pATI->pXAAInfo = XAACreateInfoRec()))
+ return FALSE;
+
+ switch (pATI->Adapter)
+ {
+ case ATI_ADAPTER_MACH64:
+ if (ATIMach64AccelInit(pATI, pATI->pXAAInfo))
+ break;
+ /* Fall through */
+
+ default:
+ XAADestroyInfoRec(pATI->pXAAInfo);
+ pATI->pXAAInfo = NULL;
+ return FALSE;
+ }
+
+ ScreenArea.x1 = ScreenArea.y1 = 0;
+ ScreenArea.x2 = pATI->displayWidth;
+ scanlines = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth /
+ pATI->bitsPerPixel;
+ if (scanlines > ATIMach64MaxY)
+ scanlines = ATIMach64MaxY;
+ ScreenArea.y2 = (short int)scanlines;
+ xf86InitFBManager(pScreen, &ScreenArea);
+
+ if (XAAInit(pScreen, pATI->pXAAInfo))
+ return TRUE;
+
+ XAADestroyInfoRec(pATI->pXAAInfo);
+ pATI->pXAAInfo = NULL;
+ return FALSE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h
new file mode 100644
index 000000000..d7d730313
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h
@@ -0,0 +1,36 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */
+/*
+ * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
+ *
+ * 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.
+ */
+
+#ifndef ___ATIMODE_H___
+#define ___ATIMODE_H___ 1
+
+#include "atipriv.h"
+#include "atiproto.h"
+
+#include "xf86str.h"
+
+extern Bool ATIInitializeAcceleration FunctionPrototype((ScrnInfoPtr,
+ ScreenPtr,
+ ATIPtr));
+
+#endif /* ___ATIACCEL_H___ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c
index 4199fab09..906e7e4ba 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.17 2001/01/21 21:19:18 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.18 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -582,6 +582,7 @@ ATIChipID
case OldChipID('Q', 'E'): case NewChipID('Q', 'E'):
case OldChipID('Q', 'F'): case NewChipID('Q', 'F'):
case OldChipID('Q', 'G'): case NewChipID('Q', 'G'):
+ case OldChipID('Q', 'Y'): case NewChipID('Q', 'Y'):
return ATI_CHIP_RADEON;
case OldChipID('H', 'D'): case NewChipID('H', 'D'):
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c
index 90a86a027..b1ac91ccb 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.3 2001/02/15 18:04:55 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.5 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -24,11 +24,12 @@
#include "ati.h"
#include "atiadapter.h"
#include "aticonfig.h"
+#include "aticursor.h"
#include "atioption.h"
#include "atistruct.h"
/*
- * Recognised XF86Config options.
+ * Non-publicised XF86Config options.
*/
typedef enum
{
@@ -81,10 +82,18 @@ ATIProcessOptions
# define CRTScreen PublicOption[ATI_OPTION_CRT].value.bool
# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool
# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool
+# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool
+
+#ifndef AVOID_CPIO
+
# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool
+
+#endif /* AVOID_CPIO */
+
# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool
# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool
# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool
+# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool
# define Sync PrivateOption[ATI_OPTION_SYNC].value.bool
# define ReferenceClock \
@@ -102,7 +111,14 @@ ATIProcessOptions
#endif /* AVOID_CPIO */
{
- Accel = Linear = CacheMMIO = TRUE;
+ Accel = CacheMMIO = HWCursor = TRUE;
+
+#ifndef AVOID_CPIO
+
+ Linear = TRUE;
+
+#endif /* AVOID_CPIO */
+
}
ReferenceClock = ((double)157500000.0) / ((double)11.0);
@@ -124,6 +140,8 @@ ATIProcessOptions
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
PrivateOption);
+#ifndef AVOID_CPIO
+
/* Disable linear apertures if the OS doesn't support them */
if (!xf86LinearVidMem() && Linear)
{
@@ -133,39 +151,60 @@ ATIProcessOptions
Linear = FALSE;
}
+#endif /* AVOID_CPIO */
+
/* Move option values into driver private structure */
pATI->OptionAccel = Accel;
pATI->OptionCRT = CRTScreen;
pATI->OptionCSync = CSync;
pATI->OptionDevel = Devel;
+
+#ifndef AVOID_CPIO
+
pATI->OptionLinear = Linear;
+
+#endif /* AVOID_CPIO */
+
pATI->OptionMMIOCache = CacheMMIO;
pATI->OptionProbeClocks = ProbeClocks;
pATI->OptionShadowFB = ShadowFB;
pATI->OptionSync = Sync;
- /* Only set the reference clock if it hasn't already been determined */
- if (pATI->ReferenceNumerator && pATI->ReferenceDenominator) {
- xfree(PublicOption);
- return;
+ /* Validate and set cursor options */
+ if (SWCursor || !HWCursor)
+ {
+ pATI->Cursor = ATI_CURSOR_SOFTWARE;
+ if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Option \"sw_cursor\" overrides Option \"hw_cursor\".\n");
+ }
+ else
+ {
+ pATI->Cursor = ATI_CURSOR_HARDWARE;
}
- switch ((int)(ReferenceClock / ((double)100000.0)))
+
+ /* Only set the reference clock if it hasn't already been determined */
+ if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
{
- case 143:
- pATI->ReferenceNumerator = 157500;
- pATI->ReferenceDenominator = 11;
- break;
-
- case 286:
- pATI->ReferenceNumerator = 315000;
- pATI->ReferenceDenominator = 11;
- break;
-
- default:
- pATI->ReferenceNumerator =
- (int)(ReferenceClock / ((double)1000.0));
- pATI->ReferenceDenominator = 1;
- break;
+ switch ((int)(ReferenceClock / ((double)100000.0)))
+ {
+ case 143:
+ pATI->ReferenceNumerator = 157500;
+ pATI->ReferenceDenominator = 11;
+ break;
+
+ case 286:
+ pATI->ReferenceNumerator = 315000;
+ pATI->ReferenceDenominator = 11;
+ break;
+
+ default:
+ pATI->ReferenceNumerator =
+ (int)(ReferenceClock / ((double)1000.0));
+ pATI->ReferenceDenominator = 1;
+ break;
+ }
}
+
xfree(PublicOption);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c
new file mode 100644
index 000000000..49ee8e8c1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c
@@ -0,0 +1,75 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.1 2001/03/25 05:33:06 tsi Exp $ */
+/*
+ * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
+ *
+ * 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 "atiadapter.h"
+#include "aticursor.h"
+#include "atimach64.h"
+#include "atistruct.h"
+
+#include "xf86.h"
+
+/*
+ * ATIInitializeCursor --
+ *
+ * This function initialises the screen cursor.
+ */
+Bool
+ATIInitializeCursor
+(
+ ScreenPtr pScreen,
+ ATIPtr pATI
+)
+{
+ /* Initialise software cursor */
+ if (!miDCInitialize(pScreen, xf86GetPointerScreenFuncs()))
+ return FALSE;
+
+ if (pATI->Cursor == ATI_CURSOR_SOFTWARE)
+ return TRUE;
+
+ if (!(pATI->pCursorInfo = xf86CreateCursorInfoRec()))
+ return FALSE;
+
+ switch (pATI->Adapter)
+ {
+ case ATI_ADAPTER_MACH64:
+ if (ATIMach64CursorInit(pATI->pCursorInfo))
+ break;
+ /* Fall through */
+
+ default:
+ xf86DestroyCursorInfoRec(pATI->pCursorInfo);
+ pATI->pCursorInfo = NULL;
+ return FALSE;
+ }
+
+ if (xf86InitCursor(pScreen, pATI->pCursorInfo))
+ {
+ xf86SetSilkenMouse(pScreen);
+ return TRUE;
+ }
+
+ xf86DestroyCursorInfoRec(pATI->pCursorInfo);
+ pATI->pCursorInfo = NULL;
+ return FALSE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h
new file mode 100644
index 000000000..86f1878c5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */
+/*
+ * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
+ *
+ * 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.
+ */
+
+#ifndef ___ATICURSOR_H___
+#define ___ATICURSOR_H___ 1
+
+#include "atipriv.h"
+#include "atiproto.h"
+
+#include "screenint.h"
+
+/*
+ * Cursor related definitions.
+ */
+typedef enum
+{
+ ATI_CURSOR_SOFTWARE, /* Software cursor */
+ ATI_CURSOR_HARDWARE, /* Hardware cursor provided by CRTC */
+ ATI_CURSOR_DAC /* Hardware cursor provided by RAMDAC */
+} ATICursorType;
+
+extern Bool ATIInitializeCursor FunctionPrototype((ScreenPtr, ATIPtr));
+
+#endif /* ___ATICURSOR_H___ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c
index 52073a601..a79edfa98 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.5 2001/01/21 21:19:18 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.6 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -24,6 +24,7 @@
#ifdef XFree86LOADER
#include "ati.h"
+#include "aticursor.h"
#include "atiload.h"
#include "atistruct.h"
@@ -79,6 +80,9 @@ ATILoadModules
"XAACreateInfoRec",
"XAADestroyInfoRec",
"XAAInit",
+ "xf86InitCursor",
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
NULL);
/* Load shadow frame buffer code if needed */
@@ -96,6 +100,19 @@ ATILoadModules
xf86LoaderReqSymbols("XAACreateInfoRec", "XAADestroyInfoRec", NULL);
}
+ /* Load ramdac module if needed */
+ if (pATI->Cursor > ATI_CURSOR_SOFTWARE)
+ {
+ if (!ATILoadModule(pScreenInfo, "ramdac", "xf86InitCursor"))
+ return FALSE;
+
+ /* Require more ramdac symbols */
+ xf86LoaderReqSymbols(
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
+ NULL);
+ }
+
/* Load depth-specific entry points */
switch (pATI->bitsPerPixel)
{
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c
index b03ba1fd7..9cc5575a8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.9 2001/01/06 20:58:05 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.10 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -133,6 +133,11 @@ ATIUnlock
~(LCD_MONDET_INT_EN | LCD_MONDET_INT));
}
+ pATI->LockData.mem_cntl = inr(MEM_CNTL);
+ if (pATI->Chip < ATI_CHIP_264CT)
+ outr(MEM_CNTL, pATI->LockData.mem_cntl &
+ ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN));
+
#ifndef AVOID_CPIO
/* Ensure VGA aperture is enabled */
@@ -140,22 +145,8 @@ ATIUnlock
pATI->LockData.dac_cntl = inr(DAC_CNTL);
outr(DAC_CNTL, pATI->LockData.dac_cntl | DAC_VGA_ADR_EN);
outr(CONFIG_CNTL, pATI->LockData.config_cntl & ~CFG_VGA_DIS);
-
-#endif /* AVOID_CPIO */
-
- pATI->LockData.mem_cntl = inr(MEM_CNTL);
- if (pATI->Chip < ATI_CHIP_264CT)
- outr(MEM_CNTL, pATI->LockData.mem_cntl &
- ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN));
- else if (pATI->Chip >= ATI_CHIP_264VTB)
- outr(MEM_CNTL, (pATI->LockData.mem_cntl &
- ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) |
- (SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN) |
- SetBits(CTL_MEM_APER_LONG_ENDIAN, CTL_MEM_UPPER_APER_ENDIAN)));
}
-#ifndef AVOID_CPIO
-
if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
{
if (pATI->CPIO_VGAWonder)
@@ -346,10 +337,10 @@ ATIUnlock
out8(LCD_INDEX, GetByte(pATI->LockData.lcd_index, 0));
}
}
- }
#endif /* AVOID_CPIO */
+ }
}
/*
@@ -508,7 +499,8 @@ ATILock
#endif /* AVOID_CPIO */
- outr(MEM_CNTL, pATI->LockData.mem_cntl);
+ if (pATI->Chip < ATI_CHIP_264CT)
+ outr(MEM_CNTL, pATI->LockData.mem_cntl);
if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT))
outr(LCD_INDEX, pATI->LockData.lcd_index);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c
index 68033eac8..e822d522c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.29 2001/01/12 20:44:58 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.30 2001/03/25 05:32:07 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -47,6 +47,7 @@
#include "ati.h"
#include "atibus.h"
#include "atichip.h"
+#include "aticrtc.h"
#include "atimach64.h"
#include "atimach64io.h"
@@ -116,8 +117,14 @@ ATIMach64PreInit
pATIHW->bus_cntl &= ~(BUS_FIFO_ERR_INT_EN | BUS_ROM_DIS);
pATIHW->bus_cntl |= SetBits(15, BUS_FIFO_WS) | BUS_FIFO_ERR_INT;
}
+ else if (pATI->MMIOInLinear)
+ {
+ pATIHW->bus_cntl &= ~BUS_APER_REG_DIS;
+ }
else
+ {
pATIHW->bus_cntl |= BUS_APER_REG_DIS;
+ }
if (pATI->Chip >= ATI_CHIP_264VT)
pATIHW->bus_cntl |= BUS_EXT_REG_EN; /* Enable Block 1 */
@@ -142,6 +149,8 @@ ATIMach64PreInit
if ((pATI->depth > 8) || (pScreenInfo->rgbBits == 8))
pATIHW->dac_cntl |= DAC_8BIT_EN;
+ pATIHW->gen_test_cntl = pATI->LockData.gen_test_cntl & ~GEN_CUR_EN;
+
pATIHW->config_cntl = config_cntl = inr(CONFIG_CNTL);
#ifndef AVOID_CPIO
@@ -167,6 +176,31 @@ ATIMach64PreInit
pATIHW->config_cntl |= SetBits(2, CFG_MEM_AP_SIZE);
}
+ if (pATI->Chip >= ATI_CHIP_264VTB)
+ {
+ pATIHW->mem_cntl = (pATI->LockData.mem_cntl &
+ ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) |
+ SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN);
+
+ switch (pATI->bitsPerPixel)
+ {
+ default:
+ pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_BYTE_ENDIAN,
+ CTL_MEM_UPPER_APER_ENDIAN);
+ break;
+
+ case 16:
+ pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_WORD_ENDIAN,
+ CTL_MEM_UPPER_APER_ENDIAN);
+ break;
+
+ case 32:
+ pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_LONG_ENDIAN,
+ CTL_MEM_UPPER_APER_ENDIAN);
+ break;
+ }
+ }
+
/* Draw engine setup */
if (pATI->OptionAccel)
{
@@ -296,6 +330,12 @@ ATIMach64Save
pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT);
pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM);
+ pATIHW->cur_clr0 = inr(CUR_CLR0);
+ pATIHW->cur_clr1 = inr(CUR_CLR1);
+ pATIHW->cur_offset = inr(CUR_OFFSET);
+ pATIHW->cur_horz_vert_posn = inr(CUR_HORZ_VERT_POSN);
+ pATIHW->cur_horz_vert_off = inr(CUR_HORZ_VERT_OFF);
+
pATIHW->clock_cntl = inr(CLOCK_CNTL);
pATIHW->bus_cntl = inr(BUS_CNTL);
@@ -307,6 +347,11 @@ ATIMach64Save
pATIHW->config_cntl = inr(CONFIG_CNTL);
+ pATIHW->gen_test_cntl = inr(GEN_TEST_CNTL);
+
+ if (pATI->Chip >= ATI_CHIP_264VTB)
+ pATIHW->mem_cntl = inr(MEM_CNTL);
+
/* Save draw engine state */
if (pATI->OptionAccel && (pATIHW == &pATI->OldHW))
{
@@ -587,14 +632,25 @@ ATIMach64Set
outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch);
- /* Set pixel clock */
- outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE);
-
/* Load overscan registers */
outr(OVR_CLR, pATIHW->ovr_clr);
outr(OVR_WID_LEFT_RIGHT, pATIHW->ovr_wid_left_right);
outr(OVR_WID_TOP_BOTTOM, pATIHW->ovr_wid_top_bottom);
+ /* Load hardware cursor registers */
+ outr(CUR_CLR0, pATIHW->cur_clr0);
+ outr(CUR_CLR1, pATIHW->cur_clr1);
+ outr(CUR_OFFSET, pATIHW->cur_offset);
+ outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn);
+ outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off);
+
+ /* Set pixel clock */
+ outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE);
+
+ outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN);
+ outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl);
+ outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN);
+
/* Finalise CRTC setup and turn on the screen */
outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl);
@@ -733,6 +789,9 @@ ATIMach64Set
outr(CONFIG_CNTL, pATIHW->config_cntl);
outr(BUS_CNTL, pATIHW->bus_cntl);
+
+ if (pATI->Chip >= ATI_CHIP_264VTB)
+ outr(MEM_CNTL, pATIHW->mem_cntl);
}
/*
@@ -1091,23 +1150,11 @@ ATIMach64SetupForScreenToScreenCopy
{
ATIPtr pATI = ATIPTR(pScreenInfo);
- pATI->dst_cntl = 0;
-
- if (ydir > 0)
- pATI->dst_cntl |= DST_Y_DIR;
- if (xdir > 0)
- pATI->dst_cntl |= DST_X_DIR;
-
- if (pATI->XModifier == 1)
- outf(DST_CNTL, pATI->dst_cntl);
- else
- pATI->dst_cntl |= DST_24_ROT_EN;
-
ATIMach64WaitForFIFO(pATI, 3);
- outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(DP_WRITE_MASK, planemask);
outf(DP_SRC, DP_MONO_SRC_ALLONES |
SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
+ outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
if (TransparencyColour == -1)
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
@@ -1117,6 +1164,18 @@ ATIMach64SetupForScreenToScreenCopy
outf(CLR_CMP_CLR, TransparencyColour);
outf(CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D);
}
+
+ pATI->dst_cntl = 0;
+
+ if (ydir > 0)
+ pATI->dst_cntl |= DST_Y_DIR;
+ if (xdir > 0)
+ pATI->dst_cntl |= DST_X_DIR;
+
+ if (pATI->XModifier == 1)
+ outf(DST_CNTL, pATI->dst_cntl);
+ else
+ pATI->dst_cntl |= DST_24_ROT_EN;
}
/*
@@ -1183,17 +1242,17 @@ ATIMach64SetupForSolidFill
{
ATIPtr pATI = ATIPTR(pScreenInfo);
- if (pATI->XModifier == 1)
- outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
-
ATIMach64WaitForFIFO(pATI, 5);
- outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(DP_WRITE_MASK, planemask);
outf(DP_SRC, DP_MONO_SRC_ALLONES |
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
outf(DP_FRGD_CLR, colour);
+ outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
+
+ if (pATI->XModifier == 1)
+ outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
}
/*
@@ -1248,11 +1307,11 @@ ATIMach64SetupForSolidLine
ATIPtr pATI = ATIPTR(pScreenInfo);
ATIMach64WaitForFIFO(pATI, 5);
- outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(DP_WRITE_MASK, planemask);
outf(DP_SRC, DP_MONO_SRC_ALLONES |
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
outf(DP_FRGD_CLR, colour);
+ outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
@@ -1428,8 +1487,11 @@ ATIMach64SetupForScanlineCPUToScreenColorExpandFill
{
ATIPtr pATI = ATIPTR(pScreenInfo);
- if (pATI->XModifier == 1)
- outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
+ ATIMach64WaitForFIFO(pATI, 3);
+ outf(DP_WRITE_MASK, planemask);
+ outf(DP_SRC, DP_MONO_SRC_HOST |
+ SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
+ outf(DP_FRGD_CLR, fg);
if (bg == -1)
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
@@ -1437,18 +1499,15 @@ ATIMach64SetupForScanlineCPUToScreenColorExpandFill
else
{
ATIMach64WaitForFIFO(pATI, 2);
+ outf(DP_BKGD_CLR, bg);
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
SetBits(ATIMach64ALU[rop], DP_BKGD_MIX));
- outf(DP_BKGD_CLR, bg);
}
- ATIMach64WaitForFIFO(pATI, 4);
- outf(DP_WRITE_MASK, planemask);
- outf(DP_SRC, DP_MONO_SRC_HOST |
- SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
- outf(DP_FRGD_CLR, fg);
-
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
+
+ if (pATI->XModifier == 1)
+ outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
}
/*
@@ -1505,12 +1564,13 @@ ATIMach64SubsequentColorExpandScanline
int iBuffer
)
{
- ATIPtr pATI = ATIPTR(pScreenInfo);
- CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer];
- CARD32 *pDst, *pSrc;
- int w = pATI->ExpansionBitmapWidth;
- int nDWord;
- unsigned int iDWord;
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+ CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer];
+ volatile CARD32 *pDst;
+ CARD32 *pSrc;
+ int w = pATI->ExpansionBitmapWidth;
+ int nDWord;
+ unsigned int iDWord;
while (w > 0)
{
@@ -1531,7 +1591,7 @@ ATIMach64SubsequentColorExpandScanline
* only be guaranteed to be on a chunk-sized boundary.
*/
iDWord = 16 - nDWord;
- pDst = (CARD32 *)pATI->pHOST_DATA - iDWord;
+ pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord;
pSrc = pBitmapData - iDWord;
/*
@@ -1658,3 +1718,348 @@ ATIMach64AccelInit
return TRUE;
}
+
+/*
+ * ATIMach64SetCursorColours --
+ *
+ * Set hardware cursor foreground and background colours.
+ */
+static void
+ATIMach64SetCursorColours
+(
+ ScrnInfoPtr pScreenInfo,
+ int fg,
+ int bg
+)
+{
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+
+ outr(CUR_CLR0, SetBits(fg, CUR_CLR));
+ outr(CUR_CLR1, SetBits(bg, CUR_CLR));
+}
+
+/*
+ * ATIMach64SetCursorPosition --
+ *
+ * Set position of hardware cursor.
+ */
+static void
+ATIMach64SetCursorPosition
+(
+ ScrnInfoPtr pScreenInfo,
+ int x,
+ int y
+)
+{
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+ CARD16 CursorXOffset, CursorYOffset;
+
+ /* Adjust x & y when the cursor is partially obscured */
+ if (x < 0)
+ {
+ if ((CursorXOffset = -x) > 63)
+ CursorXOffset = 63;
+ x = 0;
+ }
+ else
+ {
+ CursorXOffset = pScreenInfo->frameX1 - pScreenInfo->frameX0;
+ if (x > CursorXOffset)
+ x = CursorXOffset;
+ CursorXOffset = 0;
+ }
+
+ if (y < 0)
+ {
+ if ((CursorYOffset = -y) > 63)
+ CursorYOffset = 63;
+ y = 0;
+ }
+ else
+ {
+ CursorYOffset = pScreenInfo->frameY1 - pScreenInfo->frameY0;
+ if (y > CursorYOffset)
+ y = CursorYOffset;
+ CursorYOffset = 0;
+ }
+
+ /* Adjust for multiscanned modes */
+ if (pScreenInfo->currentMode->Flags & V_DBLSCAN)
+ y *= 2;
+ if (pScreenInfo->currentMode->VScan > 1)
+ y *= pScreenInfo->currentMode->VScan;
+
+ do
+ {
+ if (CursorYOffset != pATI->CursorYOffset)
+ {
+ pATI->CursorYOffset = CursorYOffset;
+ outr(CUR_OFFSET, ((CursorYOffset << 4) + pATI->CursorOffset) >> 3);
+ }
+ else if (CursorXOffset == pATI->CursorXOffset)
+ break;
+
+ pATI->CursorXOffset = CursorXOffset;
+ outr(CUR_HORZ_VERT_OFF, SetBits(CursorXOffset, CUR_HORZ_OFF) |
+ SetBits(CursorYOffset, CUR_VERT_OFF));
+ } while (0);
+
+ outr(CUR_HORZ_VERT_POSN,
+ SetBits(x, CUR_HORZ_POSN) | SetBits(y, CUR_VERT_POSN));
+}
+
+/*
+ * ATIMach64LoadCursorImage --
+ *
+ * Copy hardware cursor image into offscreen video memory.
+ */
+static void
+ATIMach64LoadCursorImage
+(
+ ScrnInfoPtr pScreenInfo,
+ CARD8 *pImage
+)
+{
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+ CARD32 *pSrc = (pointer)pImage;
+ volatile CARD32 *pDst = pATI->pCursorImage;
+
+ /* This is lengthy, but it does maximise burst modes */
+ pDst[ 0] = pSrc[ 0]; pDst[ 1] = pSrc[ 1];
+ pDst[ 2] = pSrc[ 2]; pDst[ 3] = pSrc[ 3];
+ pDst[ 4] = pSrc[ 4]; pDst[ 5] = pSrc[ 5];
+ pDst[ 6] = pSrc[ 6]; pDst[ 7] = pSrc[ 7];
+ pDst[ 8] = pSrc[ 8]; pDst[ 9] = pSrc[ 9];
+ pDst[ 10] = pSrc[ 10]; pDst[ 11] = pSrc[ 11];
+ pDst[ 12] = pSrc[ 12]; pDst[ 13] = pSrc[ 13];
+ pDst[ 14] = pSrc[ 14]; pDst[ 15] = pSrc[ 15];
+ pDst[ 16] = pSrc[ 16]; pDst[ 17] = pSrc[ 17];
+ pDst[ 18] = pSrc[ 18]; pDst[ 19] = pSrc[ 19];
+ pDst[ 20] = pSrc[ 20]; pDst[ 21] = pSrc[ 21];
+ pDst[ 22] = pSrc[ 22]; pDst[ 23] = pSrc[ 23];
+ pDst[ 24] = pSrc[ 24]; pDst[ 25] = pSrc[ 25];
+ pDst[ 26] = pSrc[ 26]; pDst[ 27] = pSrc[ 27];
+ pDst[ 28] = pSrc[ 28]; pDst[ 29] = pSrc[ 29];
+ pDst[ 30] = pSrc[ 30]; pDst[ 31] = pSrc[ 31];
+ pDst[ 32] = pSrc[ 32]; pDst[ 33] = pSrc[ 33];
+ pDst[ 34] = pSrc[ 34]; pDst[ 35] = pSrc[ 35];
+ pDst[ 36] = pSrc[ 36]; pDst[ 37] = pSrc[ 37];
+ pDst[ 38] = pSrc[ 38]; pDst[ 39] = pSrc[ 39];
+ pDst[ 40] = pSrc[ 40]; pDst[ 41] = pSrc[ 41];
+ pDst[ 42] = pSrc[ 42]; pDst[ 43] = pSrc[ 43];
+ pDst[ 44] = pSrc[ 44]; pDst[ 45] = pSrc[ 45];
+ pDst[ 46] = pSrc[ 46]; pDst[ 47] = pSrc[ 47];
+ pDst[ 48] = pSrc[ 48]; pDst[ 49] = pSrc[ 49];
+ pDst[ 50] = pSrc[ 50]; pDst[ 51] = pSrc[ 51];
+ pDst[ 52] = pSrc[ 52]; pDst[ 53] = pSrc[ 53];
+ pDst[ 54] = pSrc[ 54]; pDst[ 55] = pSrc[ 55];
+ pDst[ 56] = pSrc[ 56]; pDst[ 57] = pSrc[ 57];
+ pDst[ 58] = pSrc[ 58]; pDst[ 59] = pSrc[ 59];
+ pDst[ 60] = pSrc[ 60]; pDst[ 61] = pSrc[ 61];
+ pDst[ 62] = pSrc[ 62]; pDst[ 63] = pSrc[ 63];
+ pDst[ 64] = pSrc[ 64]; pDst[ 65] = pSrc[ 65];
+ pDst[ 66] = pSrc[ 66]; pDst[ 67] = pSrc[ 67];
+ pDst[ 68] = pSrc[ 68]; pDst[ 69] = pSrc[ 69];
+ pDst[ 70] = pSrc[ 70]; pDst[ 71] = pSrc[ 71];
+ pDst[ 72] = pSrc[ 72]; pDst[ 73] = pSrc[ 73];
+ pDst[ 74] = pSrc[ 74]; pDst[ 75] = pSrc[ 75];
+ pDst[ 76] = pSrc[ 76]; pDst[ 77] = pSrc[ 77];
+ pDst[ 78] = pSrc[ 78]; pDst[ 79] = pSrc[ 79];
+ pDst[ 80] = pSrc[ 80]; pDst[ 81] = pSrc[ 81];
+ pDst[ 82] = pSrc[ 82]; pDst[ 83] = pSrc[ 83];
+ pDst[ 84] = pSrc[ 84]; pDst[ 85] = pSrc[ 85];
+ pDst[ 86] = pSrc[ 86]; pDst[ 87] = pSrc[ 87];
+ pDst[ 88] = pSrc[ 88]; pDst[ 89] = pSrc[ 89];
+ pDst[ 90] = pSrc[ 90]; pDst[ 91] = pSrc[ 91];
+ pDst[ 92] = pSrc[ 92]; pDst[ 93] = pSrc[ 93];
+ pDst[ 94] = pSrc[ 94]; pDst[ 95] = pSrc[ 95];
+ pDst[ 96] = pSrc[ 96]; pDst[ 97] = pSrc[ 97];
+ pDst[ 98] = pSrc[ 98]; pDst[ 99] = pSrc[ 99];
+ pDst[100] = pSrc[100]; pDst[101] = pSrc[101];
+ pDst[102] = pSrc[102]; pDst[103] = pSrc[103];
+ pDst[104] = pSrc[104]; pDst[105] = pSrc[105];
+ pDst[106] = pSrc[106]; pDst[107] = pSrc[107];
+ pDst[108] = pSrc[108]; pDst[109] = pSrc[109];
+ pDst[110] = pSrc[110]; pDst[111] = pSrc[111];
+ pDst[112] = pSrc[112]; pDst[113] = pSrc[113];
+ pDst[114] = pSrc[114]; pDst[115] = pSrc[115];
+ pDst[116] = pSrc[116]; pDst[117] = pSrc[117];
+ pDst[118] = pSrc[118]; pDst[119] = pSrc[119];
+ pDst[120] = pSrc[120]; pDst[121] = pSrc[121];
+ pDst[122] = pSrc[122]; pDst[123] = pSrc[123];
+ pDst[124] = pSrc[124]; pDst[125] = pSrc[125];
+ pDst[126] = pSrc[126]; pDst[127] = pSrc[127];
+ pDst[128] = pSrc[128]; pDst[129] = pSrc[129];
+ pDst[130] = pSrc[130]; pDst[131] = pSrc[131];
+ pDst[132] = pSrc[132]; pDst[133] = pSrc[133];
+ pDst[134] = pSrc[134]; pDst[135] = pSrc[135];
+ pDst[136] = pSrc[136]; pDst[137] = pSrc[137];
+ pDst[138] = pSrc[138]; pDst[139] = pSrc[139];
+ pDst[140] = pSrc[140]; pDst[141] = pSrc[141];
+ pDst[142] = pSrc[142]; pDst[143] = pSrc[143];
+ pDst[144] = pSrc[144]; pDst[145] = pSrc[145];
+ pDst[146] = pSrc[146]; pDst[147] = pSrc[147];
+ pDst[148] = pSrc[148]; pDst[149] = pSrc[149];
+ pDst[150] = pSrc[150]; pDst[151] = pSrc[151];
+ pDst[152] = pSrc[152]; pDst[153] = pSrc[153];
+ pDst[154] = pSrc[154]; pDst[155] = pSrc[155];
+ pDst[156] = pSrc[156]; pDst[157] = pSrc[157];
+ pDst[158] = pSrc[158]; pDst[159] = pSrc[159];
+ pDst[160] = pSrc[160]; pDst[161] = pSrc[161];
+ pDst[162] = pSrc[162]; pDst[163] = pSrc[163];
+ pDst[164] = pSrc[164]; pDst[165] = pSrc[165];
+ pDst[166] = pSrc[166]; pDst[167] = pSrc[167];
+ pDst[168] = pSrc[168]; pDst[169] = pSrc[169];
+ pDst[170] = pSrc[170]; pDst[171] = pSrc[171];
+ pDst[172] = pSrc[172]; pDst[173] = pSrc[173];
+ pDst[174] = pSrc[174]; pDst[175] = pSrc[175];
+ pDst[176] = pSrc[176]; pDst[177] = pSrc[177];
+ pDst[178] = pSrc[178]; pDst[179] = pSrc[179];
+ pDst[180] = pSrc[180]; pDst[181] = pSrc[181];
+ pDst[182] = pSrc[182]; pDst[183] = pSrc[183];
+ pDst[184] = pSrc[184]; pDst[185] = pSrc[185];
+ pDst[186] = pSrc[186]; pDst[187] = pSrc[187];
+ pDst[188] = pSrc[188]; pDst[189] = pSrc[189];
+ pDst[190] = pSrc[190]; pDst[191] = pSrc[191];
+ pDst[192] = pSrc[192]; pDst[193] = pSrc[193];
+ pDst[194] = pSrc[194]; pDst[195] = pSrc[195];
+ pDst[196] = pSrc[196]; pDst[197] = pSrc[197];
+ pDst[198] = pSrc[198]; pDst[199] = pSrc[199];
+ pDst[200] = pSrc[200]; pDst[201] = pSrc[201];
+ pDst[202] = pSrc[202]; pDst[203] = pSrc[203];
+ pDst[204] = pSrc[204]; pDst[205] = pSrc[205];
+ pDst[206] = pSrc[206]; pDst[207] = pSrc[207];
+ pDst[208] = pSrc[208]; pDst[209] = pSrc[209];
+ pDst[210] = pSrc[210]; pDst[211] = pSrc[211];
+ pDst[212] = pSrc[212]; pDst[213] = pSrc[213];
+ pDst[214] = pSrc[214]; pDst[215] = pSrc[215];
+ pDst[216] = pSrc[216]; pDst[217] = pSrc[217];
+ pDst[218] = pSrc[218]; pDst[219] = pSrc[219];
+ pDst[220] = pSrc[220]; pDst[221] = pSrc[221];
+ pDst[222] = pSrc[222]; pDst[223] = pSrc[223];
+ pDst[224] = pSrc[224]; pDst[225] = pSrc[225];
+ pDst[226] = pSrc[226]; pDst[227] = pSrc[227];
+ pDst[228] = pSrc[228]; pDst[229] = pSrc[229];
+ pDst[230] = pSrc[230]; pDst[231] = pSrc[231];
+ pDst[232] = pSrc[232]; pDst[233] = pSrc[233];
+ pDst[234] = pSrc[234]; pDst[235] = pSrc[235];
+ pDst[236] = pSrc[236]; pDst[237] = pSrc[237];
+ pDst[238] = pSrc[238]; pDst[239] = pSrc[239];
+ pDst[240] = pSrc[240]; pDst[241] = pSrc[241];
+ pDst[242] = pSrc[242]; pDst[243] = pSrc[243];
+ pDst[244] = pSrc[244]; pDst[245] = pSrc[245];
+ pDst[246] = pSrc[246]; pDst[247] = pSrc[247];
+ pDst[248] = pSrc[248]; pDst[249] = pSrc[249];
+ pDst[250] = pSrc[250]; pDst[251] = pSrc[251];
+ pDst[252] = pSrc[252]; pDst[253] = pSrc[253];
+ pDst[254] = pSrc[254]; pDst[255] = pSrc[255];
+}
+
+/*
+ * ATIMach64HideCursor --
+ *
+ * Turn off hardware cursor.
+ */
+static void
+ATIMach64HideCursor
+(
+ ScrnInfoPtr pScreenInfo
+)
+{
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+
+ if (!(pATI->NewHW.gen_test_cntl & GEN_CUR_EN))
+ return;
+
+ pATI->NewHW.gen_test_cntl &= ~GEN_CUR_EN;
+ outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl);
+}
+
+/*
+ * ATIMach64ShowCursor --
+ *
+ * Turn on hardware cursor.
+ */
+static void
+ATIMach64ShowCursor
+(
+ ScrnInfoPtr pScreenInfo
+)
+{
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+
+ if (pATI->NewHW.gen_test_cntl & GEN_CUR_EN)
+ return;
+
+ pATI->NewHW.gen_test_cntl |= GEN_CUR_EN;
+ outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl);
+}
+
+/*
+ * ATIMach64UseHWCursor --
+ *
+ * Notify cursor layer whether a hardware cursor is configured.
+ */
+static Bool
+ATIMach64UseHWCursor
+(
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+)
+{
+ ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum];
+ ATIPtr pATI = ATIPTR(pScreenInfo);
+
+ if (!pATI->CursorBase)
+ return FALSE;
+
+#ifndef AVOID_CPIO
+
+ /*
+ * For some reason, the hardware cursor isn't vertically scaled when a VGA
+ * doublescanned or multiscanned mode is in effect.
+ */
+ if (pATI->NewHW.crtc == ATI_CRTC_MACH64)
+ return TRUE;
+ if ((pScreenInfo->currentMode->Flags & V_DBLSCAN) ||
+ (pScreenInfo->currentMode->VScan > 1))
+ return FALSE;
+
+#endif /* AVOID_CPIO */
+
+ return TRUE;
+}
+
+/*
+ * ATIMach64CursorInit --
+ *
+ * Initialise xf86CursorInfoRec fields with information specific to Mach64
+ * variants.
+ */
+Bool
+ATIMach64CursorInit
+(
+ xf86CursorInfoPtr pCursorInfo
+)
+{
+ pCursorInfo->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_INVERT_MASK |
+
+#if X_BYTE_ORDER != X_LITTLE_ENDIAN
+
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+
+#endif /* X_BYTE_ORDER */
+
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
+ pCursorInfo->MaxWidth = pCursorInfo->MaxHeight = 64;
+
+ pCursorInfo->SetCursorColors = ATIMach64SetCursorColours;
+ pCursorInfo->SetCursorPosition = ATIMach64SetCursorPosition;
+ pCursorInfo->LoadCursorImage = ATIMach64LoadCursorImage;
+ pCursorInfo->HideCursor = ATIMach64HideCursor;
+ pCursorInfo->ShowCursor = ATIMach64ShowCursor;
+ pCursorInfo->UseHWCursor = ATIMach64UseHWCursor;
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h
index 2fccd2944..52b5f3dbf 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.10 2001/01/06 20:58:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.11 2001/03/25 05:32:08 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -28,6 +28,7 @@
#include "atiproto.h"
#include "xaa.h"
+#include "xf86Cursor.h"
#define ATIMach64MaxX 8191
#define ATIMach64MaxY 32767
@@ -44,4 +45,6 @@ extern void ATIMach64SetDPMSMode FunctionPrototype((ATIPtr, int));
extern Bool ATIMach64AccelInit FunctionPrototype((ATIPtr, XAAInfoRecPtr));
+extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr));
+
#endif /* ___ATIMACH64_H___ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
index 3ca64947a..502081653 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.7 2001/02/12 03:31:05 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.8 2001/03/25 05:32:08 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -187,7 +187,7 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8,
{ \
ATIAccessMach64PLLReg(pATI, _Index, TRUE); \
out8(CLOCK_CNTL + 2, _Value); \
- } while(0)
+ } while (0)
#define ATIGetMach64LCDReg(_Index) \
( \
@@ -199,7 +199,7 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8,
{ \
out8(LCD_INDEX, SetBits(_Index, LCD_REG_INDEX)); \
outr(LCD_DATA, _Value); \
- } while(0)
+ } while (0)
#define ATIGetMach64TVReg(_Index) \
( \
@@ -211,6 +211,6 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8,
{ \
out8(TV_OUT_INDEX, SetBits(_Index, TV_REG_INDEX)); \
outr(TV_OUT_DATA, _Value); \
- } while(0)
+ } while (0)
#endif /* ___ATIMACH64IO_H___ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c
index 2e2ce98e6..c0c2d49cd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.2 2001/01/06 20:58:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.3 2001/03/03 22:27:41 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -30,7 +30,7 @@
static XF86ModuleVersionInfo ATIVersionRec =
{
- ATI_DRIVER_NAME,
+ "atimisc",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c
index 27a889e51..2129b34fd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.3 2001/02/12 03:53:10 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.4 2001/03/25 05:32:08 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -263,68 +263,72 @@ ATIModePreInit
{
ATIMach64PreInit(pScreenInfo, pATI, pATIHW);
- }
-
- if (pATI->Chip >= ATI_CHIP_264CT)
- {
- /* Ensure proper VCLK source */
- pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) |
- (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET);
-
- /* Set provisional values for other PLL registers */
- pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV);
- pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV);
- pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV);
- pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV);
- pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV);
- pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL);
- /* 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);
- }
-
- /* Initialise CRTC data for LCD panels */
- if (pATI->LCDPanelID >= 0)
- {
- if (pATI->Chip == ATI_CHIP_264LT)
+ if (pATI->Chip >= ATI_CHIP_264CT)
{
- pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL);
- }
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL) ||
- (pATI->Chip == ATI_CHIP_MOBILITY)) */
- {
- lcd_index = inr(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 =
- ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND;
- pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL);
- outr(LCD_INDEX, lcd_index);
- }
+ /* Ensure proper VCLK source */
+ pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) |
+ (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET);
+
+ /* Set provisional values for other PLL registers */
+ pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV);
+ pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV);
+ pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV);
+ pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV);
+ pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV);
+ pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL);
+
+ /* 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);
+
+ /* Initialise CRTC data for LCD panels */
+ if (pATI->LCDPanelID >= 0)
+ {
+ if (pATI->Chip == ATI_CHIP_264LT)
+ {
+ pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL);
+ }
+ else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
+ (pATI->Chip == ATI_CHIP_264XL) ||
+ (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ {
+ lcd_index = inr(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 =
+ ATIGetMach64LCDReg(LCD_CONFIG_PANEL) |
+ DONT_SHADOW_HEND;
+ pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL);
+ outr(LCD_INDEX, lcd_index);
+ }
- pATIHW->lcd_gen_ctrl &=
- ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | DIS_HOR_CRT_DIVBY2 |
- VCLK_DAC_PM_EN | XTALIN_PM_EN | CRTC_RW_SELECT |
- USE_SHADOWED_VEND | USE_SHADOWED_ROWCUR |
- SHADOW_EN | SHADOW_RW_EN);
- pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT;
+ pATIHW->lcd_gen_ctrl &=
+ ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET |
+ DIS_HOR_CRT_DIVBY2 | VCLK_DAC_PM_EN | XTALIN_PM_EN |
+ CRTC_RW_SELECT | USE_SHADOWED_VEND |
+ USE_SHADOWED_ROWCUR | SHADOW_EN | SHADOW_RW_EN);
+ pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT;
- if (pATI->OptionCRT)
- {
- /*
- * Use primary CRTC to drive the CRT. Turn off panel interface.
- */
- pATIHW->lcd_gen_ctrl &= ~LCD_ON;
- pATIHW->lcd_gen_ctrl |= CRT_ON;
- }
- else
- {
- /* Use primary CRTC to drive the panel */
- pATIHW->lcd_gen_ctrl |= LCD_ON;
+ if (pATI->OptionCRT)
+ {
+ /*
+ * Use primary CRTC to drive the CRT. Turn off panel
+ * interface.
+ */
+ pATIHW->lcd_gen_ctrl &= ~LCD_ON;
+ pATIHW->lcd_gen_ctrl |= CRT_ON;
+ }
+ else
+ {
+ /* Use primary CRTC to drive the panel */
+ pATIHW->lcd_gen_ctrl |= LCD_ON;
+ }
+ }
}
}
@@ -370,36 +374,38 @@ ATIModeSave
pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL);
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 = inr(HORZ_STRETCHING);
- pATIHW->vert_stretching = inr(VERT_STRETCHING);
- pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL);
-
- /* Set up to save non-shadow registers */
- outr(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) ||
- (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ /* Save LCD registers */
+ if (pATI->LCDPanelID >= 0)
{
- pATIHW->lcd_index = inr(LCD_INDEX);
- pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL);
- pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL);
- pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING);
- pATIHW->vert_stretching = ATIGetMach64LCDReg(LCD_VERT_STRETCHING);
- pATIHW->ext_vert_stretch =
- ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH);
+ if (pATI->Chip == ATI_CHIP_264LT)
+ {
+ pATIHW->horz_stretching = inr(HORZ_STRETCHING);
+ pATIHW->vert_stretching = inr(VERT_STRETCHING);
+ pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL);
- /* Set up to save non-shadow registers */
- ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
- ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
+ /* Set up to save non-shadow registers */
+ outr(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) ||
+ (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ {
+ pATIHW->lcd_index = inr(LCD_INDEX);
+ pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL);
+ pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL);
+ pATIHW->horz_stretching =
+ ATIGetMach64LCDReg(LCD_HORZ_STRETCHING);
+ pATIHW->vert_stretching =
+ ATIGetMach64LCDReg(LCD_VERT_STRETCHING);
+ pATIHW->ext_vert_stretch =
+ ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH);
+
+ /* Set up to save non-shadow registers */
+ ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
+ ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN));
+ }
}
}
@@ -422,52 +428,57 @@ ATIModeSave
{
ATIMach64Save(pATI, pATIHW);
- }
- /* Save DSP data */
- if (pATI->Chip >= ATI_CHIP_264VTB)
- ATIDSPSave(pATI, pATIHW);
-
- if (pATI->LCDPanelID >= 0)
- {
- if (!pATI->OptionCRT)
+ if (pATI->Chip >= ATI_CHIP_264VTB)
{
- /* Switch to shadow registers */
- if (pATI->Chip == ATI_CHIP_264LT)
- outr(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) ||
- (pATI->Chip == ATI_CHIP_MOBILITY)) */
- ATIPutMach64LCDReg(LCD_GEN_CNTL,
- (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
- (SHADOW_EN | SHADOW_RW_EN));
+ /* Save DSP data */
+ ATIDSPSave(pATI, pATIHW);
+
+ if (pATI->LCDPanelID >= 0)
+ {
+ if (!pATI->OptionCRT)
+ {
+ /* Switch to shadow registers */
+ if (pATI->Chip == ATI_CHIP_264LT)
+ outr(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) ||
+ (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ ATIPutMach64LCDReg(LCD_GEN_CNTL,
+ (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) |
+ (SHADOW_EN | SHADOW_RW_EN));
#ifndef AVOID_CPIO
- /* 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 VGA CRTC registers */
+ for (Index = 0;
+ Index < NumberOf(pATIHW->shadow_vga);
+ Index++)
+ pATIHW->shadow_vga[Index] =
+ GetReg(CRTX(pATI->CPIO_VGABase), Index);
#endif /* AVOID_CPIO */
- /* Save shadow Mach64 CRTC registers */
- pATIHW->shadow_h_total_disp = inr(CRTC_H_TOTAL_DISP);
- pATIHW->shadow_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID);
- pATIHW->shadow_v_total_disp = inr(CRTC_V_TOTAL_DISP);
- pATIHW->shadow_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID);
- }
+ /* Save shadow Mach64 CRTC registers */
+ pATIHW->shadow_h_total_disp = inr(CRTC_H_TOTAL_DISP);
+ pATIHW->shadow_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID);
+ pATIHW->shadow_v_total_disp = inr(CRTC_V_TOTAL_DISP);
+ pATIHW->shadow_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID);
+ }
- /* Restore CRTC selection and shadow state */
- if (pATI->Chip == ATI_CHIP_264LT)
- outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl);
- else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
- (pATI->Chip == ATI_CHIP_264XL) ||
- (pATI->Chip == ATI_CHIP_MOBILITY)) */
- {
- ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl);
- outr(LCD_INDEX, pATIHW->lcd_index);
+ /* Restore CRTC selection and shadow state */
+ if (pATI->Chip == ATI_CHIP_264LT)
+ outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl);
+ else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) ||
+ (pATI->Chip == ATI_CHIP_264XL) ||
+ (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ {
+ ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl);
+ outr(LCD_INDEX, pATIHW->lcd_index);
+ }
+ }
}
}
@@ -535,7 +546,7 @@ ATIModeCalculate
)
{
CARD32 lcd_index;
- int Index, ECPClock;
+ int Index, ECPClock, MaxScalerClock;
/* Clobber mode timings */
if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT &&
@@ -748,10 +759,20 @@ ATIModeCalculate
/* Setup ECP clock divider */
if (pATI->Chip >= ATI_CHIP_264VT)
{
+ if (pATI->Chip <= ATI_CHIP_264VT3)
+ MaxScalerClock = 80000;
+ else if (pATI->Chip <= ATI_CHIP_264GT2C)
+ MaxScalerClock = 100000;
+ else if (pATI->Chip == ATI_CHIP_264GTPRO)
+ MaxScalerClock = 125000;
+ else if (pATI->Chip <= ATI_CHIP_MOBILITY)
+ MaxScalerClock = 135000;
+ else
+ MaxScalerClock = 80000; /* Conservative */
pATIHW->pll_vclk_cntl &= ~PLL_ECP_DIV;
/* XXX Don't do this for TVOut! */
ECPClock = pMode->SynthClock;
- for (Index = 0; (ECPClock > 125000) && (Index < 2); Index++)
+ for (Index = 0; (ECPClock > MaxScalerClock) && (Index < 2); Index++)
ECPClock >>= 1;
pATIHW->pll_vclk_cntl |= SetBits(Index, PLL_ECP_DIV);
}
@@ -796,45 +817,47 @@ ATIModeSet
ATIPutMach64PLLReg(PLL_EXT_VPLL_CNTL, pATIHW->pll_ext_vpll_cntl);
ATIPutMach64PLLReg(PLL_VCLK_CNTL,
pATIHW->pll_vclk_cntl & ~PLL_VCLK_RESET);
- }
- /* Load LCD registers */
- if (pATI->LCDPanelID >= 0)
- {
- /* Stop CRTC */
- outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl &
- ~(CRTC_EXT_DISP_EN | CRTC_EN));
-
- if (pATI->Chip == ATI_CHIP_264LT)
- {
- /* Update non-shadow registers first */
- outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl &
- ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT |
- SHADOW_EN | SHADOW_RW_EN));
-
- /* Temporarily disable stretching */
- outr(HORZ_STRETCHING, pATIHW->horz_stretching &
- ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
- outr(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) ||
- (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ /* Load LCD registers */
+ if (pATI->LCDPanelID >= 0)
{
- /* Update non-shadow registers first */
- ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel);
- ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
- ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT |
- SHADOW_EN | SHADOW_RW_EN));
-
- /* Temporarily disable stretching */
- ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching &
- ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
- ATIPutMach64LCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching &
- ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 |
- VERT_STRETCH_USE0 | VERT_STRETCH_EN));
+ /* Stop CRTC */
+ outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl &
+ ~(CRTC_EXT_DISP_EN | CRTC_EN));
+
+ if (pATI->Chip == ATI_CHIP_264LT)
+ {
+ /* Update non-shadow registers first */
+ outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl &
+ ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT |
+ SHADOW_EN | SHADOW_RW_EN));
+
+ /* Temporarily disable stretching */
+ outr(HORZ_STRETCHING, pATIHW->horz_stretching &
+ ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
+ outr(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) ||
+ (pATI->Chip == ATI_CHIP_MOBILITY)) */
+ {
+ /* Update non-shadow registers first */
+ ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel);
+ ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl &
+ ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT |
+ SHADOW_EN | SHADOW_RW_EN));
+
+ /* Temporarily disable stretching */
+ ATIPutMach64LCDReg(LCD_HORZ_STRETCHING,
+ pATIHW->horz_stretching &
+ ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN));
+ ATIPutMach64LCDReg(LCD_VERT_STRETCHING,
+ pATIHW->vert_stretching &
+ ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 |
+ VERT_STRETCH_USE0 | VERT_STRETCH_EN));
+ }
}
}
@@ -867,8 +890,14 @@ ATIModeSet
if (pATI->Chip >= ATI_CHIP_88800GXC)
{
outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl);
+ outr(CUR_CLR0, pATIHW->cur_clr0);
+ outr(CUR_CLR1, pATIHW->cur_clr1);
+ outr(CUR_OFFSET, pATIHW->cur_offset);
+ outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn);
+ outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off);
outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel);
outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel);
+ outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl);
outr(CONFIG_CNTL, pATIHW->config_cntl);
if (pATI->Chip >= ATI_CHIP_264CT)
{
@@ -879,6 +908,8 @@ ATIModeSet
outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch);
outr(BUS_CNTL, pATIHW->bus_cntl);
outr(DAC_CNTL, pATIHW->dac_cntl);
+ if (pATI->Chip >= ATI_CHIP_264VTB)
+ outr(MEM_CNTL, pATIHW->mem_cntl);
}
}
@@ -985,6 +1016,9 @@ ATIModeSet
/* Load RAMDAC */
ATIDACSet(pATI, pATIHW);
+ /* Reset hardware cursor caching */
+ pATI->CursorXOffset = pATI->CursorYOffset = (CARD16)(-1);
+
#ifndef AVOID_CPIO
/* Restore video memory */
@@ -1003,52 +1037,3 @@ ATIModeSet
ATIPrintRegisters(pATI);
}
}
-
-/*
- * ATIModeAccelInit --
- *
- * This function is called to initialise XAA on a screen.
- */
-Bool
-ATIModeAccelInit
-(
- ScrnInfoPtr pScreenInfo,
- ScreenPtr pScreen,
- ATIPtr pATI
-)
-{
- BoxRec ScreenArea;
-
- if (!pATI->OptionAccel)
- return TRUE;
-
- if (!(pATI->pXAAInfo = XAACreateInfoRec()))
- return FALSE;
-
- switch (pATI->Adapter)
- {
- case ATI_ADAPTER_MACH64:
- if (ATIMach64AccelInit(pATI, pATI->pXAAInfo))
- break;
-
- default:
- XAADestroyInfoRec(pATI->pXAAInfo);
- pATI->pXAAInfo = NULL;
- return FALSE;
- }
-
- ScreenArea.x1 = ScreenArea.y1 = 0;
- ScreenArea.x2 = pATI->displayWidth;
- ScreenArea.y2 = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth /
- pATI->bitsPerPixel;
- if ((unsigned)ScreenArea.y2 > ATIMach64MaxY)
- ScreenArea.y2 = ATIMach64MaxY;
- xf86InitFBManager(pScreen, &ScreenArea);
-
- if (XAAInit(pScreen, pATI->pXAAInfo))
- return TRUE;
-
- XAADestroyInfoRec(pATI->pXAAInfo);
- pATI->pXAAInfo = NULL;
- return FALSE;
-}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h
index e3ccda471..88b6f51cc 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.2 2001/01/06 20:58:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.3 2001/03/25 05:32:08 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -38,7 +38,4 @@ extern Bool ATIModeCalculate FunctionPrototype((int, ATIPtr, ATIHWPtr,
extern void ATIModeSet FunctionPrototype((ScrnInfoPtr, ATIPtr,
ATIHWPtr));
-extern Bool ATIModeAccelInit FunctionPrototype((ScrnInfoPtr, ScreenPtr,
- ATIPtr));
-
#endif /* ___ATIMODE_H___ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c
index 1e2f8574d..5d74e13ad 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.15 2001/01/06 20:58:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.16 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -54,12 +54,25 @@ OptionInfoRec ATIPublicOptions[] =
FALSE
},
{
+ ATI_OPTION_HWCURSOR,
+ "hw_cursor",
+ OPTV_BOOLEAN,
+ {0, },
+ FALSE,
+ },
+
+#ifndef AVOID_CPIO
+
+ {
ATI_OPTION_LINEAR,
"linear",
OPTV_BOOLEAN,
{0, },
FALSE
},
+
+#endif /* AVOID_CPIO */
+
{
ATI_OPTION_MMIO_CACHE,
"mmio_cache",
@@ -89,6 +102,13 @@ OptionInfoRec ATIPublicOptions[] =
FALSE
},
{
+ ATI_OPTION_SWCURSOR,
+ "sw_cursor",
+ OPTV_BOOLEAN,
+ {0, },
+ FALSE,
+ },
+ {
-1,
NULL,
OPTV_NONE,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h
index 5d34acbac..475b68144 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.5 2001/01/06 20:58:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.6 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -36,11 +36,19 @@ typedef enum
ATI_OPTION_ACCEL,
ATI_OPTION_CRT,
ATI_OPTION_CSYNC,
+ ATI_OPTION_HWCURSOR,
+
+#ifndef AVOID_CPIO
+
ATI_OPTION_LINEAR,
+
+#endif /* AVOID_CPIO */
+
ATI_OPTION_MMIO_CACHE,
ATI_OPTION_PROBE_CLOCKS,
ATI_OPTION_REFERENCE_CLOCK,
- ATI_OPTION_SHADOW_FB
+ ATI_OPTION_SHADOW_FB,
+ ATI_OPTION_SWCURSOR
} ATIPublicOptionType;
extern OptionInfoRec ATIPublicOptions[];
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c
index e1ab33f86..9b072da5f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.42 2001/02/12 03:53:10 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.44 2001/04/01 14:00:09 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -27,6 +27,7 @@
#include "atibus.h"
#include "atichip.h"
#include "aticonfig.h"
+#include "aticursor.h"
#include "atidac.h"
#include "atidsp.h"
#include "atiident.h"
@@ -404,7 +405,7 @@ ATIPreInit
DisplayModePtr pMode;
unsigned long Block0Base;
CARD32 IOValue;
- int i, j, AcceleratorVideoRAM = 0;
+ int i, j, AcceleratorVideoRAM = 0, ServerVideoRAM;
int Numerator, Denominator;
int MinX, MinY;
ClockRange ATIClockRange = {NULL, 0, 80000, 0, TRUE, TRUE, 1, 1, 0};
@@ -655,7 +656,8 @@ ATIPreInit
}
}
- pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT;
+ pScreenInfo->racIoFlags =
+ RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR;
pScreenInfo->racMemFlags = RAC_FB;
/* Deal with ChipID & ChipRev overrides */
@@ -804,7 +806,7 @@ ATIPreInit
}
ATIMapMach64(pScreenInfo->scrnIndex, pATI);
- } while(0);
+ } while (0);
pATI->Block0Base = Block0Base;
#ifdef AVOID_CPIO
@@ -843,16 +845,16 @@ ATIPreInit
#endif /* AVOID_CPIO */
- IOValue = inr(MEM_CNTL);
+ pATIHW->mem_cntl = inr(MEM_CNTL);
if (pATI->Chip < ATI_CHIP_264VTB)
pATI->VideoRAM =
- videoRamSizes[GetBits(IOValue, CTL_MEM_SIZE) + 2];
+ videoRamSizes[GetBits(pATIHW->mem_cntl, CTL_MEM_SIZE) + 2];
else
{
pATI->nFIFOEntries = /* Don't care */
(unsigned int)(-1) >> 1;
- IOValue = GetBits(IOValue, CTL_MEM_SIZEB);
+ IOValue = GetBits(pATIHW->mem_cntl, CTL_MEM_SIZEB);
if (IOValue < 8)
pATI->VideoRAM = (IOValue + 1) * 512;
else if (IOValue < 12)
@@ -918,12 +920,22 @@ ATIPreInit
* enabled.
*/
if ((pATI->LCDPanelID >= 0) &&
- !pATI->LCDHorizontal &&
- !pATI->LCDVertical &&
!(pATIHW->horz_stretching & HORZ_STRETCH_EN) &&
!(pATIHW->vert_stretching & VERT_STRETCH_EN) &&
!(pATIHW->lcd_gen_ctrl & LCD_ON))
+ {
+ /*
+ * At this point, if an XL or Mobility BIOS hasn't set
+ * panel dimensions, then there is no panel. Otherwise,
+ * keep any panel disabled to allow for modes greater than
+ * the panel's dimensions.
+ */
+ if ((pATI->Chip >= ATI_CHIP_264XL) &&
+ (!pATI->LCDHorizontal || !pATI->LCDVertical))
pATI->LCDPanelID = -1;
+ else
+ pATI->OptionCRT = TRUE;
+ }
}
else
{
@@ -1141,7 +1153,7 @@ ATIPreInit
pATI->DAC = ClockDac; /* For now */
}
- /* Determine panel dimensions and driving clock */
+ /* Determine panel dimensions */
if (pATI->LCDPanelID >= 0)
{
LCDTable = BIOSWord(0x78U);
@@ -1341,10 +1353,10 @@ ATIPreInit
#ifdef AVOID_CPIO
- if (!pATI->OptionLinear)
+ if (!xf86LinearVidMem())
{
xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
- "A linear aperture is not available in this configuration.\n");
+ "A linear aperture is not available.\n");
ATILock(pATI);
ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
@@ -1533,325 +1545,347 @@ ATIPreInit
*/
if (pATI->LCDPanelID >= 0)
{
- int HDisplay, VDisplay;
- CARD8 ClockMask, PostMask;
+ if (pATI->OptionCRT)
+ {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
+ "Using CRT interface and disabling digital flat panel.\n");
+ }
+ else
+ {
+ int HDisplay, VDisplay;
+ CARD8 ClockMask, PostMask;
- /*
- * Determine porch data. The following is inaccurate (but still good
- * enough) when BIOS initialisation has set things up so that the
- * registers read here are not the ones actually in use by the panel.
- * Thus, a further refinement here would be to flip back and forth
- * between shadow and non-shadow registers as dictated by the various
- * LCD_GEN_CNTL and CONFIG_PANEL bits involved.
- *
- * This groks the mode on entry to extract the width and position of
- * its sync and blanking pulses, and considers any overscan as part of
- * the displayed area, given that the overscan is also stretched.
- *
- * This also attempts to determine panel dimensions but cannot do so
- * for one that is "auto-stretched".
- */
+ /*
+ * Determine porch data. The following is inaccurate (but still
+ * good enough) when BIOS initialisation has set things up so that
+ * the registers read here are not the ones actually in use by the
+ * panel. Thus, a further refinement here would be to flip back
+ * and forth between shadow and non-shadow registers as dictated by
+ * the various LCD_GEN_CNTL and CONFIG_PANEL bits involved.
+ *
+ * This groks the mode on entry to extract the width and position
+ * of its sync and blanking pulses, and considers any overscan as
+ * part of the displayed area, given that the overscan is also
+ * stretched.
+ *
+ * This also attempts to determine panel dimensions but cannot do
+ * so for one that is "auto-stretched".
+ */
#ifndef AVOID_CPIO
- if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN))
- {
- pATIHW->clock = (inb(R_GENMO) & 0x0CU) >> 2;
-
- pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U);
- pATIHW->crt[2] = GetReg(CRTX(pATI->CPIO_VGABase), 0x02U);
- pATIHW->crt[3] = GetReg(CRTX(pATI->CPIO_VGABase), 0x03U);
- 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[9] = GetReg(CRTX(pATI->CPIO_VGABase), 0x09U);
- pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U);
- pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U);
- pATIHW->crt[21] = GetReg(CRTX(pATI->CPIO_VGABase), 0x15U);
- pATIHW->crt[22] = GetReg(CRTX(pATI->CPIO_VGABase), 0x16U);
-
- pATI->LCDHSyncWidth = (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU;
- pATI->LCDHBlankWidth = (((pATIHW->crt[3] & 0x1FU) |
- ((pATIHW->crt[5] >> 2) & 0x20U)) -
- pATIHW->crt[2]) & 0x3FU;
- pATI->LCDVSyncWidth = (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU;
- pATI->LCDVBlankWidth = (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU;
-
- HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth;
- VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) |
- ((pATIHW->crt[7] << 8) & 0x0100U) |
- pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth;
-
- pATI->LCDHSyncStart =
- ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1;
- pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) |
- ((pATIHW->crt[7] << 6) & 0x0100U) |
- pATIHW->crt[16]) -
- (((pATIHW->crt[9] << 4) & 0x0200U) |
- ((pATIHW->crt[7] << 5) & 0x0100U) |
- pATIHW->crt[21])) & 0xFFU) + 1;
- }
- else
+ if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN))
+ {
+ pATIHW->clock = (inb(R_GENMO) & 0x0CU) >> 2;
+
+ pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U);
+ pATIHW->crt[2] = GetReg(CRTX(pATI->CPIO_VGABase), 0x02U);
+ pATIHW->crt[3] = GetReg(CRTX(pATI->CPIO_VGABase), 0x03U);
+ 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[9] = GetReg(CRTX(pATI->CPIO_VGABase), 0x09U);
+ pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U);
+ pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U);
+ pATIHW->crt[21] = GetReg(CRTX(pATI->CPIO_VGABase), 0x15U);
+ pATIHW->crt[22] = GetReg(CRTX(pATI->CPIO_VGABase), 0x16U);
+
+ pATI->LCDHSyncWidth =
+ (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU;
+ pATI->LCDHBlankWidth = (((pATIHW->crt[3] & 0x1FU) |
+ ((pATIHW->crt[5] >> 2) & 0x20U)) -
+ pATIHW->crt[2]) & 0x3FU;
+ pATI->LCDVSyncWidth =
+ (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU;
+ pATI->LCDVBlankWidth =
+ (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU;
+
+ HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth;
+ VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) |
+ ((pATIHW->crt[7] << 8) & 0x0100U) |
+ pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth;
+
+ pATI->LCDHSyncStart =
+ ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1;
+ pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) |
+ ((pATIHW->crt[7] << 6) & 0x0100U) |
+ pATIHW->crt[16]) -
+ (((pATIHW->crt[9] << 4) & 0x0200U) |
+ ((pATIHW->crt[7] << 5) & 0x0100U) |
+ pATIHW->crt[21])) & 0xFFU) + 1;
+ }
+ else
#endif /* AVOID_CPIO */
- {
- pATIHW->clock = inr(CLOCK_CNTL) & 0x03U;
-
- pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP);
- pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID);
- pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP);
- pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID);
- pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT);
- pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM);
-
- HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP) +
- GetBits(pATIHW->ovr_wid_left_right, OVR_WID_LEFT) +
- GetBits(pATIHW->ovr_wid_left_right, OVR_WID_RIGHT);
- VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP) +
- GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_TOP) +
- GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_BOTTOM);
-
- 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;
-
- HDisplay++;
- VDisplay++;
- }
+ {
+ pATIHW->clock = inr(CLOCK_CNTL) & 0x03U;
+
+ pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP);
+ pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID);
+ pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP);
+ pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID);
+ pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT);
+ pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM);
+
+ HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP) +
+ GetBits(pATIHW->ovr_wid_left_right, OVR_WID_LEFT) +
+ GetBits(pATIHW->ovr_wid_left_right, OVR_WID_RIGHT);
+ VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP) +
+ GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_TOP) +
+ GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_BOTTOM);
+
+ 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;
+
+ HDisplay++;
+ VDisplay++;
+ }
- HDisplay <<= 3;
- pATI->LCDHSyncStart <<= 3;
- pATI->LCDHSyncWidth <<= 3;
- pATI->LCDHBlankWidth <<= 3;
+ HDisplay <<= 3;
+ pATI->LCDHSyncStart <<= 3;
+ pATI->LCDHSyncWidth <<= 3;
+ pATI->LCDHBlankWidth <<= 3;
- /* Calculate panel dimensions implied by the input timing */
- if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) ==
- HORZ_STRETCH_EN)
- {
- if (pATIHW->horz_stretching & HORZ_STRETCH_MODE)
+ /* Calculate panel dimensions implied by the input timing */
+ if ((pATIHW->horz_stretching &
+ (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) ==
+ HORZ_STRETCH_EN)
{
- if (pATIHW->horz_stretching & HORZ_STRETCH_BLEND)
+ if (pATIHW->horz_stretching & HORZ_STRETCH_MODE)
+ {
+ if (pATIHW->horz_stretching & HORZ_STRETCH_BLEND)
+ {
+ HDisplay =
+ (HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) /
+ GetBits(pATIHW->horz_stretching,
+ HORZ_STRETCH_BLEND);
+ }
+ }
+ else if (((pATIHW->horz_stretching & HORZ_STRETCH_LOOP) >
+ HORZ_STRETCH_LOOP15) ||
+ (pATIHW->horz_stretching &
+ SetBits(1, HORZ_STRETCH_RATIO)))
{
- HDisplay = (HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) /
- GetBits(pATIHW->horz_stretching, HORZ_STRETCH_BLEND);
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Ignoring invalid horizontal stretch ratio in mode on"
+ " server entry.\n");
}
- }
- else if (((pATIHW->horz_stretching & HORZ_STRETCH_LOOP) >
- HORZ_STRETCH_LOOP15) ||
- (pATIHW->horz_stretching &
- SetBits(1, HORZ_STRETCH_RATIO)))
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Ignoring invalid horizontal stretch ratio in mode on"
- " server entry.\n");
- }
- else
- {
- IOValue = GetBits(pATIHW->horz_stretching, HORZ_STRETCH_RATIO);
-
- switch (GetBits(pATIHW->horz_stretching, HORZ_STRETCH_LOOP))
+ else
{
- case GetBits(HORZ_STRETCH_LOOP09, HORZ_STRETCH_LOOP):
- i = 9;
- IOValue &= (1 << 9) - 1;
- break;
+ IOValue =
+ GetBits(pATIHW->horz_stretching, HORZ_STRETCH_RATIO);
- case GetBits(HORZ_STRETCH_LOOP11, HORZ_STRETCH_LOOP):
- i = 11;
- IOValue &= (1 << 11) - 1;
- break;
-
- case GetBits(HORZ_STRETCH_LOOP12, HORZ_STRETCH_LOOP):
- i = 12;
- IOValue &= (1 << 12) - 1;
- break;
+ switch (GetBits(pATIHW->horz_stretching,
+ HORZ_STRETCH_LOOP))
+ {
+ case GetBits(HORZ_STRETCH_LOOP09, HORZ_STRETCH_LOOP):
+ i = 9;
+ IOValue &= (1 << 9) - 1;
+ break;
+
+ case GetBits(HORZ_STRETCH_LOOP11, HORZ_STRETCH_LOOP):
+ i = 11;
+ IOValue &= (1 << 11) - 1;
+ break;
+
+ case GetBits(HORZ_STRETCH_LOOP12, HORZ_STRETCH_LOOP):
+ i = 12;
+ IOValue &= (1 << 12) - 1;
+ break;
+
+ case GetBits(HORZ_STRETCH_LOOP14, HORZ_STRETCH_LOOP):
+ i = 14;
+ IOValue &= (1 << 14) - 1;
+ break;
+
+ case GetBits(HORZ_STRETCH_LOOP15, HORZ_STRETCH_LOOP):
+ default: /* Muffle compiler */
+ i = 15;
+ IOValue &= (1 << 15) - 1;
+ break;
+ }
- case GetBits(HORZ_STRETCH_LOOP14, HORZ_STRETCH_LOOP):
- i = 14;
- IOValue &= (1 << 14) - 1;
- break;
+ if (IOValue)
+ {
+ /* Count the number of bits in IOValue */
+ j = (IOValue >> 1) & 0x36DBU;
+ j = IOValue - j - ((j >> 1) & 0x36DBU);
+ j = ((j + (j >> 3)) & 0x71C7U) % 0x3FU;
- case GetBits(HORZ_STRETCH_LOOP15, HORZ_STRETCH_LOOP):
- default: /* Muffle compiler */
- i = 15;
- IOValue &= (1 << 15) - 1;
- break;
+ HDisplay = (HDisplay * i) / j;
+ }
}
+ }
+
+ if ((pATIHW->vert_stretching & VERT_STRETCH_EN) &&
+ !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
+ {
+ if ((pATIHW->vert_stretching & VERT_STRETCH_USE0) ||
+ (VDisplay <= 350))
+ IOValue =
+ GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO0);
+ else if (VDisplay <= 400)
+ IOValue =
+ GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO1);
+ else if ((VDisplay <= 480) ||
+ !(pATIHW->ext_vert_stretch & VERT_STRETCH_RATIO3))
+ IOValue =
+ GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO2);
+ else
+ IOValue =
+ GetBits(pATIHW->ext_vert_stretch, VERT_STRETCH_RATIO3);
if (IOValue)
- {
- /* Count the number of bits in IOValue */
- j = (IOValue >> 1) & 0x36DBU;
- j = IOValue - j - ((j >> 1) & 0x36DBU);
- j = ((j + (j >> 3)) & 0x71C7U) % 0x3FU;
+ VDisplay =
+ (VDisplay * (MaxBits(VERT_STRETCH_RATIO0) + 1)) /
+ IOValue;
+ }
- HDisplay = (HDisplay * i) / j;
- }
+ /* Match calculated dimensions to probed dimensions */
+ if (!pATI->LCDHorizontal)
+ {
+ if ((pATIHW->horz_stretching &
+ (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) !=
+ (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
+ pATI->LCDHorizontal = HDisplay;
+ }
+ else if (pATI->LCDHorizontal != HDisplay)
+ {
+ if ((pATIHW->horz_stretching &
+ (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) !=
+ (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Inconsistent panel horizontal dimension:"
+ " %d and %d.\n", pATI->LCDHorizontal, HDisplay);
+ HDisplay = pATI->LCDHorizontal;
}
- }
- if ((pATIHW->vert_stretching & VERT_STRETCH_EN) &&
- !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
- {
- if ((pATIHW->vert_stretching & VERT_STRETCH_USE0) ||
- (VDisplay <= 350))
- IOValue =
- GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO0);
- else if (VDisplay <= 400)
- IOValue =
- GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO1);
- else if ((VDisplay <= 480) ||
- !(pATIHW->ext_vert_stretch & VERT_STRETCH_RATIO3))
- IOValue =
- GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO2);
- else
- IOValue =
- GetBits(pATIHW->ext_vert_stretch, VERT_STRETCH_RATIO3);
+ if (!pATI->LCDVertical)
+ {
+ if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) ||
+ !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
+ pATI->LCDVertical = VDisplay;
+ }
+ else if (pATI->LCDVertical != VDisplay)
+ {
+ if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) ||
+ !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Inconsistent panel vertical dimension: %d and %d.\n",
+ pATI->LCDVertical, VDisplay);
+ VDisplay = pATI->LCDVertical;
+ }
- if (IOValue)
- VDisplay =
- (VDisplay * (MaxBits(VERT_STRETCH_RATIO0) + 1)) / IOValue;
- }
+ if (!pATI->LCDHorizontal || !pATI->LCDVertical)
+ {
+ if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO))
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
+ "Unable to determine dimensions of panel (ID %d).\n",
+ pATI->LCDPanelID);
+ else
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
+ "Unable to determine dimensions of panel.\n");
- /* Match calculated dimensions to probed dimensions */
- if (!pATI->LCDHorizontal)
- {
- if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
- != (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
- pATI->LCDHorizontal = HDisplay;
- }
- else if (pATI->LCDHorizontal != HDisplay)
- {
- if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
- != (HORZ_STRETCH_EN | AUTO_HORZ_RATIO))
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Inconsistent panel horizontal dimension: %d and %d.\n",
- pATI->LCDHorizontal, HDisplay);
- HDisplay = pATI->LCDHorizontal;
- }
+ ATILock(pATI);
+ ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
+ ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
+ return FALSE;
+ }
- if (!pATI->LCDVertical)
- {
- if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) ||
- !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
- pATI->LCDVertical = VDisplay;
- }
- else if (pATI->LCDVertical != VDisplay)
- {
- if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) ||
- !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO))
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Inconsistent panel vertical dimension: %d and %d.\n",
- pATI->LCDVertical, VDisplay);
- VDisplay = pATI->LCDVertical;
- }
+ /* If the mode on entry wasn't stretched, adjust timings */
+ if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) &&
+ ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0))
+ {
+ if ((pATI->LCDHSyncStart -= HDisplay) < 0)
+ pATI->LCDHSyncStart = 0;
+ pATI->LCDHBlankWidth -= HDisplay;
+ HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth;
+ if (pATI->LCDHBlankWidth < HDisplay)
+ pATI->LCDHBlankWidth = HDisplay;
+ }
+
+ if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) &&
+ ((VDisplay = pATI->LCDVertical - VDisplay) > 0))
+ {
+ if ((pATI->LCDVSyncStart -= VDisplay) < 0)
+ pATI->LCDVSyncStart = 0;
+ pATI->LCDVBlankWidth -= VDisplay;
+ VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth;
+ if (pATI->LCDVBlankWidth < VDisplay)
+ pATI->LCDVBlankWidth = VDisplay;
+ }
- if (!pATI->LCDHorizontal || !pATI->LCDVertical)
- {
if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO))
- xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
- "Unable to determine dimensions of panel (ID %d).\n",
- pATI->LCDPanelID);
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
+ "%dx%d panel (ID %d) detected.\n",
+ pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID);
else
- xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
- "Unable to determine dimensions of panel.\n");
-
- ATILock(pATI);
- ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
- ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
- return FALSE;
- }
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
+ "%dx%d panel detected.\n",
+ pATI->LCDHorizontal, pATI->LCDVertical);
- /* If the mode on entry wasn't stretched, adjust timings */
- if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) &&
- ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0))
- {
- if ((pATI->LCDHSyncStart -= HDisplay) < 0)
- pATI->LCDHSyncStart = 0;
- pATI->LCDHBlankWidth -= HDisplay;
- HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth;
- if (pATI->LCDHBlankWidth < HDisplay)
- pATI->LCDHBlankWidth = HDisplay;
- }
+ if (LCDPanelInfo)
+ {
+ for (i = 0; i < 24; i++)
+ Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i);
+ for (; --i >= 0; )
+ if (Buffer[i] && Buffer[i] != ' ')
+ {
+ Buffer[i + 1] = '\0';
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
+ "Panel model %s.\n", Buffer);
+ break;
+ }
+ }
- if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) &&
- ((VDisplay = pATI->LCDVertical - VDisplay) > 0))
- {
- if ((pATI->LCDVSyncStart -= VDisplay) < 0)
- pATI->LCDVSyncStart = 0;
- pATI->LCDVBlankWidth -= VDisplay;
- VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth;
- if (pATI->LCDVBlankWidth < VDisplay)
- pATI->LCDVBlankWidth = VDisplay;
- }
+ /*
+ * Determine panel clock. This must be done after option
+ * processing so that the adapter's reference frequency is always
+ * available.
+ *
+ * Get post divider. A GCC bug has caused the following expression
+ * to be broken down into its individual components.
+ */
+ ClockMask = PLL_VCLK0_XDIV << pATIHW->clock;
+ PostMask = PLL_VCLK0_POST_DIV << (pATIHW->clock * 2);
+ i = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask);
+ i *= MaxBits(PLL_VCLK0_POST_DIV) + 1;
+ i |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask);
+
+ /* Calculate clock of mode on entry */
+ Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + pATIHW->clock) *
+ pATI->ReferenceNumerator;
+ Denominator = pATI->ClockDescriptor.MinM *
+ pATI->ReferenceDenominator *
+ pATI->ClockDescriptor.PostDividers[i];
+ pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0);
- if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO))
- xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
- "%dx%d panel (ID %d) detected.\n",
- pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID);
- else
xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
- "%dx%d panel detected.\n",
- pATI->LCDHorizontal, pATI->LCDVertical);
-
- if (LCDPanelInfo)
- {
- for (i = 0; i < 24; i++)
- Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i);
- for (; --i >= 0; )
- if (Buffer[i] && Buffer[i] != ' ')
- {
- Buffer[i + 1] = '\0';
- xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
- "Panel model %s.\n", Buffer);
- break;
- }
- }
+ "Panel clock is %.3f MHz.\n",
+ (double)(pATI->LCDClock) / 1000.0);
- /*
- * Determine panel clock. This must be done after option processing so
- * that the adapter's reference frequency is always available.
- *
- * Get post divider. A GCC bug has caused the following expression to
- * be broken down into its individual components.
- */
- ClockMask = PLL_VCLK0_XDIV << pATIHW->clock;
- PostMask = PLL_VCLK0_POST_DIV << (pATIHW->clock * 2);
- i = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask);
- i *= MaxBits(PLL_VCLK0_POST_DIV) + 1;
- i |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask);
-
- /* Calculate clock of mode on entry */
- Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + pATIHW->clock) *
- pATI->ReferenceNumerator;
- Denominator = pATI->ClockDescriptor.MinM * pATI->ReferenceDenominator *
- pATI->ClockDescriptor.PostDividers[i];
- pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0);
-
- xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
- "Panel clock is %.3f MHz.\n", (double)(pATI->LCDClock) / 1000.0);
-
- if (pATI->OptionCRT)
- xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
- "Using CRT interface and disabling digital flat panel.\n");
- else
xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
"Using digital flat panel interface.\n");
+ }
}
/*
@@ -1943,157 +1977,189 @@ ATIPreInit
#endif /* AVOID_CPIO */
{
- /* Possibly set up for linear aperture */
-
-#ifndef AVOID_CPIO
-
- if (pATI->OptionLinear)
-
-#endif /* AVOID_CPIO */
-
+ /* Get adapter's linear aperture configuration */
+ pATIHW->config_cntl = inr(CONFIG_CNTL);
+ pATI->LinearBase =
+ GetBits(pATIHW->config_cntl, CFG_MEM_AP_LOC) << 22;
+ if ((pATIHW->config_cntl & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE)
{
- /* Get adapter's linear aperture configuration */
- pATIHW->config_cntl = inr(CONFIG_CNTL);
- pATI->LinearBase =
- GetBits(pATIHW->config_cntl, CFG_MEM_AP_LOC) << 22;
- if ((pATIHW->config_cntl & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE)
- {
- pATI->LinearSize =
- GetBits(pATIHW->config_cntl, CFG_MEM_AP_SIZE) << 22;
+ pATI->LinearSize =
+ GetBits(pATIHW->config_cntl, CFG_MEM_AP_SIZE) << 22;
- /*
- * Linear aperture could have been disabled (but still
- * assigned) by BIOS initialisation.
- */
- if (pATI->LinearBase && !pATI->LinearSize)
- {
- if (pATI->VideoRAM < 4096)
- pATI->LinearSize = 4 * 1024 * 1024;
- else
- pATI->LinearSize = 8 * 1024 * 1024;
- }
+ /*
+ * Linear aperture could have been disabled (but still
+ * assigned) by BIOS initialisation.
+ */
+ if (pATI->LinearBase && !pATI->LinearSize)
+ {
+ if (pATI->VideoRAM < 4096)
+ pATI->LinearSize = 4 * 1024 * 1024;
+ else
+ pATI->LinearSize = 8 * 1024 * 1024;
}
+ }
#ifndef AVOID_CPIO
- /* Except for PCI & AGP, allow for user override */
- if (!pATI->PCIInfo)
- {
- if (pATI->Chip == ATI_CHIP_88800CX)
- IOValue = ~((CARD32)((1 << 23) - 1));
- else if (pATI->Chip >= ATI_CHIP_88800GXE)
- IOValue = ~((CARD32)((1 << 24) - 1));
- else if (pATI->VideoRAM >= 4096)
- IOValue = ~((CARD32)((1 << 23) - 1));
- else
- IOValue = ~((CARD32)((1 << 22) - 1));
+ /* Except for PCI & AGP, allow for user override */
+ if (!pATI->PCIInfo)
+ {
+ if (pATI->Chip == ATI_CHIP_88800CX)
+ IOValue = ~((CARD32)((1 << 23) - 1));
+ else if (pATI->Chip >= ATI_CHIP_88800GXE)
+ IOValue = ~((CARD32)((1 << 24) - 1));
+ else if (pATI->VideoRAM >= 4096)
+ IOValue = ~((CARD32)((1 << 23) - 1));
+ else
+ IOValue = ~((CARD32)((1 << 22) - 1));
- if ((IOValue &= pGDev->MemBase) &&
- (IOValue <= (MaxBits(CFG_MEM_AP_LOC) << 22)))
- pATI->LinearBase = IOValue;
+ if ((IOValue &= pGDev->MemBase) &&
+ (IOValue <= (MaxBits(CFG_MEM_AP_LOC) << 22)))
+ pATI->LinearBase = IOValue;
- if (!pATI->LinearBase)
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Linear aperture not configured. Specify"
- " \"MemBase\" override in XF86Config \"Device\""
- " section.\n");
- else
+ if (!pATI->LinearBase)
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Linear aperture not configured. Specify \"MemBase\""
+ " override in XF86Config \"Device\" section.\n");
+ else
+ {
+ if (!pATI->LinearSize)
{
if (pATI->VideoRAM < 4096)
pATI->LinearSize = 4 * 1024 * 1024;
else
pATI->LinearSize = 8 * 1024 * 1024;
+ }
- Resources[0].type = ResExcMemBlock;
- Resources[0].rBegin = pATI->LinearBase;
- Resources[0].rEnd = pATI->LinearBase +
- pATI->LinearSize - 1;
- if (xf86RegisterResources(pATI->iEntity, Resources,
- ResNone))
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
- "Unable to register %d MB linear aperture at"
- " 0x%08X.\n", pATI->LinearSize >> 10,
- pATI->LinearBase);
+ Resources[0].type = ResExcMemBlock;
+ Resources[0].rBegin = pATI->LinearBase;
+ Resources[0].rEnd =
+ pATI->LinearBase + pATI->LinearSize - 1;
+ if (xf86RegisterResources(pATI->iEntity, Resources,
+ ResNone))
+ {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Unable to register %d MB linear aperture at"
+ " 0x%08X.\n", pATI->LinearSize >> 10,
+ pATI->LinearBase);
- pATI->LinearSize = 0;
- }
+ pATI->LinearSize = 0;
}
}
+ }
#endif /* AVOID_CPIO */
- if (!pATI->LinearBase || !pATI->LinearSize)
+ if (pATI->LinearBase && pATI->LinearSize)
+ {
+ /*
+ * Unless specified in PCI configuration space, set MMIO
+ * address to tail end of linear aperture.
+ */
+ if (!pATI->Block0Base)
{
+ pATI->Block0Base =
+ pATI->LinearBase + pATI->LinearSize - 0x00000400U;
+ pATI->MMIOInLinear = pATI->OptionAccel;
+ }
-#ifndef AVOID_CPIO
+ AcceleratorVideoRAM = pATI->LinearSize >> 10;
+
+ /*
+ * Account for MMIO area at the tail end of the linear
+ * aperture, if it is needed or if it cannot be disabled.
+ */
+ if (pATI->MMIOInLinear || (pATI->Chip < ATI_CHIP_264VTB))
+ AcceleratorVideoRAM -= 2;
- if (pATI->VGAAdapter == ATI_ADAPTER_NONE)
+ ServerVideoRAM = pATI->VideoRAM;
-#endif /* AVOID_CPIO */
+ if (pATI->Cursor > ATI_CURSOR_SOFTWARE)
+ {
+ /*
+ * Allocate a 1 kB cursor image area at the top of the
+ * little-endian aperture, just before any MMIO area that
+ * might also be there.
+ */
+ if (ServerVideoRAM > AcceleratorVideoRAM)
+ ServerVideoRAM = AcceleratorVideoRAM;
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
- "A linear aperture is not available through this"
- " adapter.\n");
- ATILock(pATI);
- ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
- ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
- return FALSE;
- }
+ ServerVideoRAM--;
+ pATI->CursorOffset = ServerVideoRAM << 10;
+ pATI->CursorBase = pATI->LinearBase + pATI->CursorOffset;
+
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
+ "Storing hardware cursor image at 0x%08X.\n",
+ pATI->CursorBase);
+ }
#ifndef AVOID_CPIO
- /* Insurance */
- pATI->LinearBase = pATI->LinearSize = 0;
+ if (pATI->OptionLinear)
#endif /* AVOID_CPIO */
- }
- else
{
- /*
- * Unless specified in PCI configuration space, set MMIO
- * address to tail end of linear aperture.
- */
- if (!pATI->Block0Base)
- pATI->Block0Base =
- pATI->LinearBase + pATI->LinearSize - 0x00000400U;
-
- AcceleratorVideoRAM = pATI->LinearSize >> 10;
+ CARD32 PageSize = getpagesize() >> 10;
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
/*
- * Account for MMIO area, if it cannot be disabled. This
- * relinquishes the entire last page of the linear aperture
- * to prevent the server from write-combining it.
+ * MMIO areas must be mmap()'ed separately to avoid write
+ * combining them. Thus, they might not end up still
+ * adjacent with the little-endian linear aperture after
+ * mmap()'ing. So, round down the linear aperture size to
+ * avoid an overlap. Any hardware cursor image area might
+ * not end up being write combined, but this seems
+ * preferable to further reducing the video memory size
+ * advertised to the server.
+ *
+ * XXX Ideally this should be dealt with in the os-support
+ * layer, i.e., it should be possible to reset a
+ * subarea's write combining after it has been
+ * mmap()'ed, but doing so currently causes the removal
+ * of write combining for the entire aperture.
*/
- if (pATI->Chip < ATI_CHIP_264VTB)
- AcceleratorVideoRAM -= getpagesize() >> 10;
+ if (pATI->MMIOInLinear)
+ AcceleratorVideoRAM -= AcceleratorVideoRAM % PageSize;
-#else /* if X_BYTE_ORDER == X_BIG_ENDIAN */
+#else /* if X_BYTE_ORDER != X_LITTLE_ENDIAN */
- /* Big-endian aperture is 8 MB higher */
+ /*
+ * Big-endian apertures are 8 MB higher and don't contain
+ * an MMIO area.
+ */
pATI->LinearBase += 0x00800000U;
+ AcceleratorVideoRAM = pATI->LinearSize >> 10;
#endif /* X_BYTE_ORDER */
- if (AcceleratorVideoRAM < pATI->VideoRAM)
- {
- pScreenInfo->videoRam = AcceleratorVideoRAM;
- xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE,
- "Virtual resolutions will be limited to %d kB due"
- " to linear aperture size.\n",
- AcceleratorVideoRAM);
- }
+ if (ServerVideoRAM > AcceleratorVideoRAM)
+ ServerVideoRAM = AcceleratorVideoRAM;
+ else if (AcceleratorVideoRAM > pATI->VideoRAM)
+ AcceleratorVideoRAM = pATI->VideoRAM;
+
+ PageSize--;
+ AcceleratorVideoRAM =
+ (AcceleratorVideoRAM + PageSize) & ~PageSize;
xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
"Using %d MB linear aperture at 0x%08X.\n",
pATI->LinearSize >> 20, pATI->LinearBase);
/* Only mmap what is needed */
- ApertureSize = pATI->LinearSize = pATI->VideoRAM * 1024;
+ ApertureSize = pATI->LinearSize =
+ AcceleratorVideoRAM << 10;
+ }
+
+ if (ServerVideoRAM < pATI->VideoRAM)
+ {
+ pScreenInfo->videoRam = ServerVideoRAM;
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE,
+ "Virtual resolutions will be limited to %d kB\n due to"
+ " linear aperture size and/or placement of hardware"
+ " cursor image area.\n",
+ ServerVideoRAM);
}
}
}
@@ -2125,8 +2191,9 @@ ATIPreInit
/*
* Unless specified in PCI configuration space, or at the top of
- * of a linear aperture, set MMIO address to the one just above the
- * VGA aperture. This does not work on the CT (maybe others).
+ * of a little-endian linear aperture, set MMIO address to the one
+ * just above the VGA aperture. This does not work on the CT
+ * (maybe others).
*/
if (!pATI->Block0Base &&
((pATI->Chip < ATI_CHIP_264CT) ||
@@ -2135,8 +2202,49 @@ ATIPreInit
pATI->Block0Base = 0x000BFC00U;
}
+ if (!pATI->OptionLinear)
+ pATI->LinearBase = 0; /* Not needed */
+
+#endif /* AVOID_CPIO */
+
+ if (!pATI->LinearBase || !pATI->LinearSize)
+ {
+
+#ifndef AVOID_CPIO
+
+ if (pATI->VGAAdapter == ATI_ADAPTER_NONE)
+
+#endif /* AVOID_CPIO */
+
+ {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
+ "Linear aperture not available.\n");
+ ATILock(pATI);
+ ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
+ ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
+ return FALSE;
+ }
+
+#ifndef AVOID_CPIO
+
+ /* Insurance */
+ pATI->LinearBase = pATI->LinearSize = 0;
+
#endif /* AVOID_CPIO */
+ }
+
+#ifndef AVOID_CPIO
+
+ if (!pATI->OptionAccel)
+ {
+ pATI->Block0Base = 0; /* Not needed */
+ pATI->MMIOInLinear = FALSE;
+ }
+ else
+
+#endif
+
if (pATI->Block0Base)
{
xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
@@ -2219,6 +2327,14 @@ ATIPreInit
#endif /* AVOID_CPIO */
+ if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && !pATI->CursorBase)
+ {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+ "Unable to store hardware cursor image. Reverting to software"
+ " cursor.\n");
+ pATI->Cursor = ATI_CURSOR_SOFTWARE;
+ }
+
/*
* Remap apertures. Must lock and re-unlock around this in case the
* remapping fails.
@@ -2368,7 +2484,7 @@ ATIPreInit
if (pATI->OptionShadowFB)
{
- /* Until ShadowFB becomes a true screen wrapper... */
+ /* Until ShadowFB becomes a true screen wrapper, if it ever does... */
#ifndef AVOID_CPIO
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c
index 1c5db81b1..a7866b489 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.41 2001/02/14 22:04:31 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.42 2001/04/01 14:00:09 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -58,6 +58,32 @@
* largely ignored.
*/
+#ifdef XFree86LOADER
+
+/*
+ * The following exists to prevent the compiler from considering entry points
+ * defined in a separate module from being constants.
+ */
+static xf86PreInitProc * const volatile PreInitProc = ATIPreInit;
+static xf86ScreenInitProc * const volatile ScreenInitProc = ATIScreenInit;
+static xf86SwitchModeProc * const volatile SwitchModeProc = ATISwitchMode;
+static xf86AdjustFrameProc * const volatile AdjustFrameProc = ATIAdjustFrame;
+static xf86EnterVTProc * const volatile EnterVTProc = ATIEnterVT;
+static xf86LeaveVTProc * const volatile LeaveVTProc = ATILeaveVT;
+static xf86FreeScreenProc * const volatile FreeScreenProc = ATIFreeScreen;
+static xf86ValidModeProc * const volatile ValidModeProc = ATIValidMode;
+
+#define ATIPreInit PreInitProc
+#define ATIScreenInit ScreenInitProc
+#define ATISwitchMode SwitchModeProc
+#define ATIAdjustFrame AdjustFrameProc
+#define ATIEnterVT EnterVTProc
+#define ATILeaveVT LeaveVTProc
+#define ATIFreeScreen FreeScreenProc
+#define ATIValidMode ValidModeProc
+
+#endif
+
/* Used as a temporary buffer */
#define Identifier ((char *)(pATI->MMIOCache))
@@ -2248,26 +2274,6 @@ NoVGAWonder:;
xf86LoaderReqSymLists(ATISymbols, NULL);
-#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
-# define ATIPreInit \
- (xf86PreInitProc*) LoaderSymbol("ATIPreInit")
-# define ATIScreenInit \
- (xf86ScreenInitProc*) LoaderSymbol("ATIScreenInit")
-# define ATISwitchMode \
- (xf86SwitchModeProc*) LoaderSymbol("ATISwitchMode")
-# define ATIAdjustFrame \
- (xf86AdjustFrameProc*)LoaderSymbol("ATIAdjustFrame")
-# define ATIEnterVT \
- (xf86EnterVTProc*) LoaderSymbol("ATIEnterVT")
-# define ATILeaveVT \
- (xf86LeaveVTProc*) LoaderSymbol("ATILeaveVT")
-# define ATIFreeScreen \
- (xf86FreeScreenProc*) LoaderSymbol("ATIFreeScreen")
-# define ATIValidMode \
- (xf86ValidModeProc*) LoaderSymbol("ATIValidMode")
-#endif
-
#endif
/* Attach device to screen */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h
index aecd27ce4..a64dc31f9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.15 2001/02/12 03:36:58 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.16 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -735,9 +735,23 @@
#define CRTC2_OFF_PITCH BlockIOTag(0x17u) /* LTPro */
#define CUR_CLR0 IOPortTag(0x0bu, 0x18u)
#define CUR_CLR1 IOPortTag(0x0cu, 0x19u)
+/* These are for both CUR_CLR0 and CUR_CLR1 */
+#define CUR_CLR_I 0x000000fful
+#define CUR_CLR_B 0x0000ff00ul
+#define CUR_CLR_G 0x00ff0000ul
+#define CUR_CLR_R 0xff000000ul
+#define CUR_CLR (CUR_CLR_R | CUR_CLR_G | CUR_CLR_B)
#define CUR_OFFSET IOPortTag(0x0du, 0x1au)
#define CUR_HORZ_VERT_POSN IOPortTag(0x0eu, 0x1bu)
+#define CUR_HORZ_POSN 0x000007fful
+/* ? 0x0000f800ul */
+#define CUR_VERT_POSN 0x07ff0000ul
+/* ? 0xf8000000ul */
#define CUR_HORZ_VERT_OFF IOPortTag(0x0fu, 0x1cu)
+#define CUR_HORZ_OFF 0x0000007ful
+/* ? 0x0000ff80ul */
+#define CUR_VERT_OFF 0x007f0000ul
+/* ? 0xff800000ul */
#define CONFIG_PANEL BlockIOTag(0x1du) /* LT */
#define PANEL_FORMAT 0x00000007ul
/* ? 0x00000008ul */
@@ -1281,7 +1295,7 @@
/* DST_Y_X BlockIOTag(0x4du) */ /* Duplicate */
#define TRAIL_BRES_ERR BlockIOTag(0x4eu) /* GT */
#define TRAIL_BRES_INC BlockIOTag(0x4fu) /* GT */
-#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */
+#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */
#define LEAD_BRES_LNTH BlockIOTag(0x51u) /* GT */
#define Z_OFF_PITCH BlockIOTag(0x52u) /* GT */
#define Z_CNTL BlockIOTag(0x53u) /* GT */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c
index 4b26de811..83c44c698 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.18 2001/02/15 18:04:55 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.19 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -22,7 +22,9 @@
*/
#include "ati.h"
+#include "atiaccel.h"
#include "aticonsole.h"
+#include "aticursor.h"
#include "atidac.h"
#include "atidga.h"
#include "atimode.h"
@@ -227,15 +229,16 @@ ATIScreenInit
(void)ATIDGAInit(pScreenInfo, pScreen, pATI);
/* Setup acceleration */
- if (!ATIModeAccelInit(pScreenInfo, pScreen, pATI))
+ if (!ATIInitializeAcceleration(pScreenInfo, pScreen, pATI))
return FALSE;
/* Initialise backing store */
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
- /* Initialise software cursor */
- miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ /* Initialise cursor */
+ if (!ATIInitializeCursor(pScreen, pATI))
+ return FALSE;
/* Create default colourmap */
if (!miCreateDefColormap(pScreen))
@@ -309,6 +312,12 @@ ATICloseScreen
pATI->Closeable = FALSE;
+ if (pATI->pCursorInfo)
+ {
+ xf86DestroyCursorInfoRec(pATI->pCursorInfo);
+ pATI->pCursorInfo = NULL;
+ }
+
ATILeaveGraphics(pScreenInfo, pATI);
xfree(pATI->ExpansionBitmapScanlinePtr[1]);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h
index 07f78b8c9..9fe89bae4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.24 2001/01/21 21:19:18 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.25 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -28,6 +28,7 @@
#include "aticlock.h"
#include "atiregs.h"
+#include "xf86Cursor.h"
#include "xf86Resources.h"
#include "xaa.h"
@@ -83,8 +84,10 @@ typedef struct _ATIHWRec
crtc_v_total_disp, crtc_v_sync_strt_wid,
crtc_off_pitch, crtc_gen_cntl, dsp_config, dsp_on_off,
ovr_clr, ovr_wid_left_right, ovr_wid_top_bottom,
- clock_cntl, bus_cntl, mem_vga_wp_sel, mem_vga_rp_sel,
- dac_cntl, config_cntl;
+ cur_clr0, cur_clr1, cur_offset,
+ cur_horz_vert_posn, cur_horz_vert_off,
+ clock_cntl, bus_cntl, mem_cntl, mem_vga_wp_sel, mem_vga_rp_sel,
+ dac_cntl, gen_test_cntl, config_cntl;
/* LCD registers */
CARD32 lcd_index, config_panel, lcd_gen_ctrl,
@@ -234,6 +237,10 @@ typedef struct _ATIRec
#ifndef AVOID_CPIO
+ /*
+ * Banking interface.
+ */
+ miBankInfoRec BankInfo;
pointer pBank;
CARD8 UseSmallApertures;
@@ -245,15 +252,6 @@ typedef struct _ATIRec
pointer pMMIO, pBlock[2];
unsigned long Block0Base, Block1Base;
-#ifndef AVOID_CPIO
-
- /*
- * Banking interface.
- */
- miBankInfoRec BankInfo;
-
-#endif /* AVOID_CPIO */
-
/*
* XAA interface.
*/
@@ -268,6 +266,16 @@ typedef struct _ATIRec
int ExpansionBitmapWidth;
/*
+ * Cursor-related definitions.
+ */
+ xf86CursorInfoPtr pCursorInfo;
+ pointer pCursorPage, pCursorImage;
+ unsigned long CursorBase;
+ CARD32 CursorOffset;
+ CARD16 CursorXOffset, CursorYOffset;
+ CARD8 Cursor;
+
+ /*
* MMIO cache.
*/
CARD32 MMIOCache[CacheSlotOf(DWORD_SELECT) + 1];
@@ -364,7 +372,13 @@ typedef struct _ATIRec
CARD8 OptionCRT; /* Prefer CRT over digital panel */
CARD8 OptionCSync; /* Use composite sync */
CARD8 OptionDevel; /* Intentionally undocumented */
+
+#ifndef AVOID_CPIO
+
CARD8 OptionLinear; /* Use linear fb aperture when available */
+
+#endif /* AVOID_CPIO */
+
CARD8 OptionMMIOCache; /* Cache MMIO writes */
CARD8 OptionProbeClocks; /* Force probe for fixed clocks */
CARD8 OptionShadowFB; /* Use shadow frame buffer */
@@ -374,6 +388,7 @@ typedef struct _ATIRec
* State flags.
*/
CARD8 Unlocked, Mapped, Closeable;
+ CARD8 MMIOInLinear;
/*
* Wrapped functions.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h
index beefcab3d..86036b8d2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.31 2001/02/12 04:32:59 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.33 2001/04/01 14:00:09 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -27,11 +27,11 @@
#define ATI_NAME "ATI"
#define ATI_DRIVER_NAME "ati"
-#define ATI_VERSION_NAME "6.2.5"
+#define ATI_VERSION_NAME "6.3.1"
#define ATI_VERSION_MAJOR 6
-#define ATI_VERSION_MINOR 2
-#define ATI_VERSION_PATCH 5
+#define ATI_VERSION_MINOR 3
+#define ATI_VERSION_PATCH 1
#define ATI_VERSION_CURRENT \
((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h
index 1e7fafd75..ae5884619 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.3 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -49,7 +49,7 @@ extern void ATISetVGAIOBase FunctionPrototype((ATIPtr, const CARD8));
{ \
outb(_Register, _Index); \
outb((_Register) + 1, _Value); \
- } while(0)
+ } while (0)
#endif /* AVOID_CPIO */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c
index dcc967bbc..58991c1f4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.11 2001/01/06 20:58:08 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.12 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
@@ -101,8 +101,6 @@ ATIUnmapLinear
ATIPtr pATI
)
{
- unsigned long PageSize;
- int LinearSize;
#ifdef AVOID_CPIO
@@ -116,13 +114,7 @@ ATIUnmapLinear
#endif /* AVOID_CPIO */
{
- PageSize = getpagesize();
- LinearSize = pATI->LinearSize;
- if (((pATI->Block0Base | (PageSize - 1)) + 1) ==
- (pATI->LinearBase + LinearSize))
- LinearSize -= PageSize;
-
- xf86UnMapVidMem(iScreen, pATI->pMemory, LinearSize);
+ xf86UnMapVidMem(iScreen, pATI->pMemory, pATI->LinearSize);
}
pATI->pMemory = NULL;
@@ -147,6 +139,24 @@ ATIUnmapMMIO
}
/*
+ * ATIUnmapCursor --
+ *
+ * Unmap hardware cursor image area.
+ */
+static void
+ATIUnmapCursor
+(
+ int iScreen,
+ ATIPtr pATI
+)
+{
+ if (pATI->pCursorPage)
+ xf86UnMapVidMem(iScreen, pATI->pCursorPage, getpagesize());
+
+ pATI->pCursorPage = pATI->pCursorImage = NULL;
+}
+
+/*
* ATIMapApertures --
*
* This function maps all apertures used by the driver.
@@ -160,8 +170,7 @@ ATIMapApertures
{
pciVideoPtr pVideo;
PCITAG Tag;
- unsigned long PageSize, MMIOBase;
- int LinearSize;
+ unsigned long PageSize;
if (pATI->Mapped)
return TRUE;
@@ -178,10 +187,6 @@ ATIMapApertures
}
PageSize = getpagesize();
- MMIOBase = pATI->Block0Base & ~(PageSize - 1);
- LinearSize = pATI->LinearSize;
- if ((MMIOBase + PageSize) == (pATI->LinearBase + LinearSize))
- LinearSize -= PageSize;
if ((pVideo = pATI->PCIInfo))
Tag = ((pciConfigPtr)(pVideo->thisCard))->tag;
@@ -221,10 +226,10 @@ ATIMapApertures
{
if (pVideo)
pATI->pMemory = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER,
- Tag, pATI->LinearBase, LinearSize);
+ Tag, pATI->LinearBase, pATI->LinearSize);
else
pATI->pMemory = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER,
- pATI->LinearBase, LinearSize);
+ pATI->LinearBase, pATI->LinearSize);
if (!pATI->pMemory)
{
@@ -240,11 +245,22 @@ ATIMapApertures
}
pATI->Mapped = TRUE;
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+
+ if ((pATI->CursorBase >= pATI->LinearBase) &&
+ ((pATI->CursorOffset + 0x00000400UL) <= (CARD32)pATI->LinearSize))
+ pATI->pCursorImage = (char *)pATI->pMemory + pATI->CursorOffset;
+
+#endif /* X_BYTE_ORDER */
+
}
/* Map MMIO aperture */
if (pATI->Block0Base)
{
+ unsigned long MMIOBase = pATI->Block0Base & ~(PageSize - 1);
+
if (pVideo)
pATI->pMMIO = xf86MapPciMem(iScreen, VIDMEM_MMIO,
Tag, MMIOBase, PageSize);
@@ -254,6 +270,13 @@ ATIMapApertures
if (!pATI->pMMIO)
{
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+
+ ATIUnmapCursor(iScreen, pATI);
+
+#endif /* X_BYTE_ORDER */
+
ATIUnmapLinear(iScreen, pATI);
#ifndef AVOID_CPIO
@@ -273,6 +296,51 @@ ATIMapApertures
if (pATI->Block1Base)
pATI->pBlock[1] = (char *)pATI->pBlock[0] - 0x00000400U;
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+
+ if (!pATI->pCursorImage)
+
+#endif /* X_BYTE_ORDER */
+
+ {
+ if ((pATI->CursorBase >= MMIOBase) &&
+ ((pATI->CursorBase + 0x00000400UL) <= (MMIOBase + PageSize)))
+ pATI->pCursorImage = (char *)pATI->pMMIO +
+ (pATI->CursorBase - MMIOBase);
+ }
+ }
+
+ /* Map hardware cursor image area */
+ if (pATI->CursorBase && !pATI->pCursorImage)
+ {
+ unsigned long CursorBase = pATI->CursorBase & ~(PageSize - 1);
+
+ if (pVideo)
+ pATI->pCursorPage = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER,
+ Tag, CursorBase, PageSize);
+ else
+ pATI->pCursorPage = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER,
+ CursorBase, PageSize);
+
+ if (!pATI->pCursorPage)
+ {
+ ATIUnmapCursor(iScreen, pATI);
+ ATIUnmapMMIO(iScreen, pATI);
+ ATIUnmapLinear(iScreen, pATI);
+
+#ifndef AVOID_CPIO
+
+ ATIUnmapVGA(iScreen, pATI);
+
+#endif /* AVOID_CPIO */
+
+ pATI->Mapped = FALSE;
+ return FALSE;
+ }
+
+ pATI->pCursorImage = (char *)pATI->pCursorPage +
+ (pATI->CursorBase - CursorBase);
}
return TRUE;
@@ -294,6 +362,9 @@ ATIUnmapApertures
return;
pATI->Mapped = FALSE;
+ /* Unmap hardware cursor image area */
+ ATIUnmapCursor(iScreen, pATI);
+
/* Unmap MMIO area */
ATIUnmapMMIO(iScreen, pATI);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
index 6cc71a9ce..ffb5fe0d2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.6 2000/12/22 05:27:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.8 2001/03/03 22:26:09 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -402,7 +402,7 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn,
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 pat = *(CARD32 *)pattern;
+ CARD32 pat = *(CARD32 *)(pointer)pattern;
#ifdef XF86DRI
R128CCE_TO_MMIO(pScrn, info);
@@ -820,13 +820,13 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31));
}
-/* Subsequent XAA indirect CPU-to-screen color expandion. This is called
+/* Subsequent XAA indirect CPU-to-screen color expansion. This is called
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];
+ CARD32 *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
volatile CARD32 *d;
@@ -838,6 +838,9 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
if (info->scanline_direct) return;
--info->scanline_h;
while (left) {
+#if defined(__alpha__)
+ write_mem_barrier();
+#endif
if (left <= 8) {
/* Last scanline - finish write to DATA_LAST */
if (info->scanline_h == 0) {
@@ -967,7 +970,7 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ CARD32 *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
volatile CARD32 *d;
@@ -979,6 +982,9 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
if (info->scanline_direct) return;
--info->scanline_h;
while (left) {
+#if defined(__alpha__)
+ write_mem_barrier();
+#endif
if (left <= 8) {
/* Last scanline - finish write to DATA_LAST */
if (info->scanline_h == 0) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
index 44b90300e..4b52c8d25 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.4 2000/12/22 05:27:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.5 2001/03/03 22:26:09 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -107,8 +107,8 @@ 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);
+ CARD32 *s = (pointer)image;
+ CARD32 *d = (pointer)(info->FB + info->cursor_start);
int y;
CARD32 save;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
index 0e9b67bf5..3127aff1d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.9 2001/01/08 01:07:34 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.12 2001/03/21 19:46:26 dawes Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -576,6 +576,8 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen)
OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */
OUTREG(R128_AGP_CNTL, cntl);
+ xf86EnablePciBusMaster(info->PciInfo, TRUE);
+
return TRUE;
}
@@ -735,10 +737,10 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
/* Check the DRI version */
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"R128DRIScreenInit failed "
- "(DRI version = %d.%d.%d, expected 3.1.x). "
+ "(DRI version = %d.%d.%d, expected 4.0.x). "
"Disabling DRI.\n",
major, minor, patch);
return FALSE;
@@ -817,6 +819,9 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = R128DRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n");
xfree(pDRIInfo->devPrivate);
@@ -830,8 +835,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
version = drmGetVersion(info->drmFD);
if (version) {
if (version->version_major != 2 ||
- version->version_minor != 1 ||
- version->version_patchlevel < 0) {
+ version->version_minor < 1) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"R128DRIScreenInit failed "
@@ -954,6 +958,7 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen)
pR128DRI->agpTexMapSize = info->agpTexMapSize;
pR128DRI->log2AGPTexGran = info->log2AGPTexGran;
pR128DRI->agpTexOffset = info->agpTexStart;
+ pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
return TRUE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
index 733bbd6e7..5ef9cdfee 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.5 2001/01/08 01:07:34 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.6 2001/03/21 17:02:21 dawes Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -45,7 +45,7 @@
/* DRI Driver defaults */
#define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM
#define R128_DEFAULT_CCE_BM_MODE R128_PM4_64BM_64VCBM_64INDBM
-#define R128_DEFAULT_AGP_MODE 2
+#define R128_DEFAULT_AGP_MODE 1
#define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */
#define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */
#define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */
@@ -96,6 +96,7 @@ typedef struct {
drmSize agpTexMapSize;
int log2AGPTexGran;
int agpTexOffset;
+ unsigned int sarea_priv_offset;
} R128DRIRec, *R128DRIPtr;
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
index ebbb43a35..0dae469be 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.22 2001/02/15 11:03:56 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.25 2001/04/03 17:10:36 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -107,6 +107,8 @@
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
+#define USE_CRT_ONLY 0
+
/* Forward definitions for driver functions */
static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool R128SaveScreen(ScreenPtr pScreen, int mode);
@@ -134,6 +136,10 @@ typedef enum {
OPTION_BUFFER_SIZE,
OPTION_USE_CCE_2D,
#endif
+#if USE_CRT_ONLY
+ /* FIXME: Disable CRTOnly until it is tested */
+ OPTION_CRT,
+#endif
OPTION_BIOS_DISPLAY,
OPTION_PANEL_WIDTH,
OPTION_PANEL_HEIGHT,
@@ -1418,7 +1424,8 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
if (!R128GetPLLParameters(pScrn)) goto fail;
- if (!R128PreInitDDC(pScrn, pInt10)) goto fail;
+ /* Don't fail on this one */
+ R128PreInitDDC(pScrn, pInt10);
if (!R128PreInitGamma(pScrn)) goto fail;
@@ -1534,6 +1541,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
R128InfoPtr info = R128PTR(pScrn);
BoxRec MemBox;
+ int y2;
R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset));
@@ -1844,13 +1852,14 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
MemBox.x1 = 0;
MemBox.y1 = 0;
MemBox.x2 = pScrn->displayWidth;
- MemBox.y2 = (info->FbMapSize
+ y2 = (info->FbMapSize
/ (pScrn->displayWidth *
info->CurrentLayout.pixel_bytes));
/* The acceleration engine uses 14 bit
signed coordinates, so we can't have any
drawable caches beyond this region. */
- if (MemBox.y2 > 8191) MemBox.y2 = 8191;
+ if (y2 > 8191) y2 = 8191;
+ MemBox.y2 = y2;
if (!xf86InitFBManager(pScreen, &MemBox)) {
xf86DrvMsg(scrnIndex, X_ERROR,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
index 520ec36d9..39921b245 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.8 2001/02/12 04:24:24 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.9 2001/04/01 14:00:09 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -48,6 +48,32 @@
#include "xf86_ansic.h"
#include "xf86Resources.h"
+#ifdef XFree86LOADER
+
+/*
+ * The following exists to prevent the compiler from considering entry points
+ * defined in a separate module from being constants.
+ */
+static xf86PreInitProc * const volatile PreInitProc = R128PreInit;
+static xf86ScreenInitProc * const volatile ScreenInitProc = R128ScreenInit;
+static xf86SwitchModeProc * const volatile SwitchModeProc = R128SwitchMode;
+static xf86AdjustFrameProc * const volatile AdjustFrameProc = R128AdjustFrame;
+static xf86EnterVTProc * const volatile EnterVTProc = R128EnterVT;
+static xf86LeaveVTProc * const volatile LeaveVTProc = R128LeaveVT;
+static xf86FreeScreenProc * const volatile FreeScreenProc = R128FreeScreen;
+static xf86ValidModeProc * const volatile ValidModeProc = R128ValidMode;
+
+#define R128PreInit PreInitProc
+#define R128ScreenInit ScreenInitProc
+#define R128SwitchMode SwitchModeProc
+#define R128AdjustFrame AdjustFrameProc
+#define R128EnterVT EnterVTProc
+#define R128LeaveVT LeaveVTProc
+#define R128FreeScreen FreeScreenProc
+#define R128ValidMode ValidModeProc
+
+#endif
+
SymTabRec R128Chipsets[] = {
{ PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" },
{ PCI_CHIP_RAGE128RF, "ATI Rage 128 RF (AGP)" },
@@ -166,6 +192,7 @@ R128Probe(DriverPtr drv, int flags)
ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
#ifdef XFree86LOADER
+
if (!xf86LoadSubModule(pScrn, "r128")) {
xf86Msg(X_ERROR,
R128_NAME ": Failed to load \"r128\" module.\n");
@@ -175,26 +202,6 @@ R128Probe(DriverPtr drv, int flags)
xf86LoaderReqSymLists(R128Symbols, NULL);
-#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
-# define R128PreInit \
- (xf86PreInitProc*) LoaderSymbol("R128PreInit")
-# define R128ScreenInit \
- (xf86ScreenInitProc*) LoaderSymbol("R128ScreenInit")
-# define R128SwitchMode \
- (xf86SwitchModeProc*) LoaderSymbol("R128SwitchMode")
-# define R128AdjustFrame \
- (xf86AdjustFrameProc*)LoaderSymbol("R128AdjustFrame")
-# define R128EnterVT \
- (xf86EnterVTProc*) LoaderSymbol("R128EnterVT")
-# define R128LeaveVT \
- (xf86LeaveVTProc*) LoaderSymbol("R128LeaveVT")
-# define R128FreeScreen \
- (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen")
-# define R128ValidMode \
- (xf86ValidModeProc*) LoaderSymbol("R128ValidMode")
-#endif
-
#endif
pScrn->driverVersion = R128_VERSION_CURRENT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
index e9d584ab9..b2620ae0a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.9 2001/01/16 05:11:07 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.10 2001/03/03 22:26:09 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -59,7 +59,7 @@
#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 ADDRREG(addr) ((volatile CARD32 *)(pointer)(R128MMIO + (addr)))
#define OUTREGP(addr, val, mask) \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
index f532e15cd..586eec9d4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.17 2001/01/25 02:26:00 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.18 2001/03/03 22:26:10 tsi Exp $ */
#include "r128.h"
#include "r128_reg.h"
@@ -37,7 +37,7 @@ static int R128QueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
static void R128ResetVideo(ScrnInfoPtr);
-static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time);
+static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now);
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -253,8 +253,8 @@ RegionsEqual(RegionPtr A, RegionPtr B)
(A->extents.y2 != B->extents.y2))
return FALSE;
- dataA = (int*)REGION_RECTS(A);
- dataB = (int*)REGION_RECTS(B);
+ dataA = (pointer)REGION_RECTS(A);
+ dataB = (pointer)REGION_RECTS(B);
while(num--) {
if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
@@ -953,21 +953,21 @@ R128QueryImageAttributes(
}
static void
-R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time)
+R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now)
{
R128InfoPtr info = R128PTR(pScrn);
R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
if(pPriv->videoStatus & TIMER_MASK) {
if(pPriv->videoStatus & OFF_TIMER) {
- if(pPriv->offTime < time) {
+ if(pPriv->offTime < now) {
unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_OV0_SCALE_CNTL, 0);
pPriv->videoStatus = FREE_TIMER;
- pPriv->freeTime = time + FREE_DELAY;
+ pPriv->freeTime = now + FREE_DELAY;
}
} else { /* FREE_TIMER */
- if(pPriv->freeTime < time) {
+ if(pPriv->freeTime < now) {
if(pPriv->linear) {
xf86FreeOffscreenLinear(pPriv->linear);
pPriv->linear = NULL;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
index a527234d7..c1b50ace9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.13 2001/01/21 21:19:19 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.16 2001/03/25 05:32:09 tsi Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -58,6 +58,11 @@
#include "GL/glxint.h"
#endif
+ /* Render support */
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
#define RADEON_DEBUG 0 /* Turn off debugging output */
#define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */
#define RADEON_MMIOSIZE 0x80000
@@ -358,6 +363,10 @@ typedef struct {
CARD32 re_width_height;
CARD32 aux_sc_cntl;
+
+#ifdef PER_CONTEXT_SAREA
+ int perctx_sarea_size;
+#endif
#endif
XF86VideoAdaptorPtr adaptor;
@@ -474,7 +483,7 @@ do { \
(n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \
RADEONCPFlushIndirect( pScrn ); \
} \
- __head = (CARD32 *)((char *)info->indirectBuffer->address + \
+ __head = (pointer)((char *)info->indirectBuffer->address + \
info->indirectBuffer->used); \
__count = 0; \
} while (0)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
index bdb30cd74..55c481090 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.9 2001/01/21 21:19:20 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.13 2001/03/28 20:08:22 alanh Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -476,7 +476,7 @@ static void RADEONSetupForDashedLine(ScrnInfoPtr pScrn,
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- CARD32 pat = *(CARD32 *)pattern;
+ CARD32 pat = *(CARD32 *)(pointer)pattern;
switch (length) {
case 2: pat |= pat << 2; /* fall through */
@@ -723,7 +723,13 @@ static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr
info->scanline_h = h;
info->scanline_words = (w + 31) >> 5;
- if ((info->scanline_words * h) <= 9) {
+#ifdef __alpha__
+ /* always use indirect for Alpha */
+ if (0)
+#else
+ if ((info->scanline_words * h) <= 9)
+#endif
+ {
/* Turn on direct for less than 9 dword colour expansion */
info->scratch_buffer[0]
= (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
@@ -745,13 +751,13 @@ static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr
OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31));
}
-/* Subsequent XAA indirect CPU-to-screen color expandion. This is called
+/* Subsequent XAA indirect CPU-to-screen color expansion. This is called
once for each scanline. */
static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ CARD32 *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
volatile CARD32 *d;
@@ -759,6 +765,7 @@ static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
if (info->scanline_direct) return;
--info->scanline_h;
while (left) {
+ write_mem_barrier();
if (left <= 8) {
/* Last scanline - finish write to DATA_LAST */
if (info->scanline_h == 0) {
@@ -836,7 +843,13 @@ static void RADEONSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
info->scanline_h = h;
info->scanline_words = (w * info->scanline_bpp + 31) >> 5;
- if ((info->scanline_words * h) <= 9) {
+#ifdef __alpha__
+ /* always use indirect for Alpha */
+ if (0)
+#else
+ if ((info->scanline_words * h) <= 9)
+#endif
+ {
/* Turn on direct for less than 9 dword colour expansion */
info->scratch_buffer[0]
= (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
@@ -864,7 +877,7 @@ static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ CARD32 *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
volatile CARD32 *d;
@@ -872,6 +885,7 @@ static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
if (info->scanline_direct) return;
--info->scanline_h;
while (left) {
+ write_mem_barrier();
if (left <= 8) {
/* Last scanline - finish write to DATA_LAST */
if (info->scanline_h == 0) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
index fe218e760..1cf9a2bc6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.4 2000/12/22 05:27:47 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.5 2001/03/03 22:26:10 tsi Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -109,8 +109,8 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- CARD32 *s = (CARD32 *)image;
- CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
+ CARD32 *s = (pointer)image;
+ CARD32 *d = (pointer)(info->FB + info->cursor_start);
int y;
CARD32 save;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
index ead827483..407757ef8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.4 2001/01/21 21:19:20 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.10 2001/04/01 14:00:09 tsi Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
* VA Linux Systems Inc., Fremont, California.
@@ -244,7 +244,36 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual,
drmContext hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
- /* Nothing yet */
+#ifdef PER_CONTEXT_SAREA
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONDRIContextPtr ctx_info;
+
+ ctx_info = (RADEONDRIContextPtr)contextStore;
+ if (!ctx_info) return FALSE;
+
+ if (drmAddMap(info->drmFD, 0,
+ info->perctx_sarea_size,
+ DRM_SHM,
+ DRM_REMOVABLE,
+ &ctx_info->sarea_handle) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[DRI] could not create private sarea for ctx id (%d)\n",
+ (int)hwContext);
+ return FALSE;
+ }
+
+ if (drmAddContextPrivateMapping(info->drmFD, hwContext,
+ ctx_info->sarea_handle) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[DRI] could not associate private sarea to ctx id (%d)\n",
+ (int)hwContext);
+ drmRmMap(info->drmFD, ctx_info->sarea_handle);
+ return FALSE;
+ }
+
+ ctx_info->ctx_id = hwContext;
+#endif
return TRUE;
}
@@ -252,7 +281,20 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual,
static void RADEONDestroyContext(ScreenPtr pScreen, drmContext hwContext,
DRIContextType contextStore)
{
- /* Nothing yet */
+#ifdef PER_CONTEXT_SAREA
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONDRIContextPtr ctx_info;
+
+ ctx_info = (RADEONDRIContextPtr) contextStore;
+ if (!ctx_info) return;
+
+ if (drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[DRI] could not remove private sarea for ctx id (%d)\n",
+ (int)hwContext);
+ }
+#endif
}
/* Called when the X server is woken up to allow the last client's
@@ -333,7 +375,7 @@ static CARD32 radeon_mba_z16(RADEONInfoPtr info,
address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */
address |= (y & 0x8) << 7; /* a[10] = y[3] */
address |= ((x & 0x10) ^ (y & 0x10)) << 7; /* a[11] = x[4] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
+ address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */
return address;
}
@@ -355,29 +397,30 @@ static CARD32 radeon_mba_z32(RADEONInfoPtr info,
address |= (y & 0x8) << 7; /* a[10] = y[3] */
address |=
(((x & 0x8) << 1) ^ (y & 0x10)) << 7; /* a[11] = x[3] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
+ address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */
return address;
}
/* 16-bit depth buffer functions */
#define WRITE_DEPTH16(_x, _y, d) \
- *(CARD16 *)(buf + radeon_mba_z16(info, (_x), (_y))) = (d)
+ *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y))) = (d)
#define READ_DEPTH16(d, _x, _y) \
- (d) = *(CARD16 *)(buf + radeon_mba_z16(info, (_x), (_y)))
+ (d) = *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y)))
/* 24 bit depth, 8 bit stencil depthbuffer functions */
#define WRITE_DEPTH32(_x, _y, d) \
do { \
- CARD32 tmp = *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))); \
+ CARD32 tmp = \
+ *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))); \
tmp &= 0xff000000; \
tmp |= ((d) & 0x00ffffff); \
- *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))) = tmp; \
+ *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) = tmp; \
} while (0)
#define READ_DEPTH32(d, _x, _y) \
- d = *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff
+ d = *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff
/* Screen to screen copy of data in the depth buffer */
static void RADEONScreenToScreenCopyDepth(ScrnInfoPtr pScrn,
@@ -428,15 +471,27 @@ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
RADEONSAREAPrivPtr pSAREAPriv;
BoxPtr pbox;
int nbox;
- int depth;
+ unsigned int color, depth;
+ unsigned int color_mask, depth_mask;
/* FIXME: This should be based on the __GLXvisualConfig info */
+ color = 0;
switch (pScrn->bitsPerPixel) {
- case 8: depth = 0x000000ff; break;
- case 16: depth = 0x0000ffff; break;
- case 24: depth = 0x00ffffff; break;
- case 32: depth = 0xffffffff; break;
- default: depth = 0x00000000; break;
+ case 16:
+ depth = 0x0000ffff;
+ color_mask = 0x0000ffff;
+ depth_mask = 0xffffffff;
+ break;
+ case 32:
+ depth = 0x00ffffff;
+ color_mask = 0xffffffff;
+ depth_mask = 0xffffffff;
+ break;
+ default:
+ depth = 0x00000000;
+ color_mask = 0x00000000;
+ depth_mask = 0x00000000;
+ break;
}
/* FIXME: Copy XAAPaintWindow() and use REGION_TRANSLATE() */
@@ -464,11 +519,8 @@ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
ret = drmRadeonClear(info->drmFD,
DRM_RADEON_BACK | DRM_RADEON_DEPTH,
- pbox->x1,
- pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1,
- 0, depth);
+ color, depth, color_mask, depth_mask,
+ pSAREAPriv->boxes, pSAREAPriv->nbox);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"DRIInitBuffers timed out, resetting engine...\n");
@@ -803,9 +855,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen)
/* Enable bus mastering in PCI config
space */
- info->pciCommand = pciReadLong(info->PciTag, PCI_CMD_STAT_REG);
- pciWriteLong(info->PciTag, PCI_CMD_STAT_REG,
- info->pciCommand | PCI_CMD_MASTER_ENABLE);
+ xf86EnablePciBusMaster(info->PciInfo, TRUE);
return TRUE;
}
@@ -1028,9 +1078,10 @@ static void RADEONDRISAREAInit(ScreenPtr pScreen,
ctx->pp_rot_matrix_0 = 0x00000000;
ctx->pp_rot_matrix_1 = 0x00000000;
- ctx->rb3d_stencilrefmask = ((0x000 << RADEON_STENCIL_REF_SHIFT) |
- (0x0ff << RADEON_STENCIL_MASK_SHIFT) |
- (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT));
+ ctx->rb3d_stencilrefmask =
+ (CARD32)((0x000 << RADEON_STENCIL_REF_SHIFT) |
+ (0x0ff << RADEON_STENCIL_MASK_SHIFT) |
+ (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT));
ctx->rb3d_ropcntl = 0x00000000;
ctx->rb3d_planemask = 0xffffffff;
@@ -1133,10 +1184,10 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen)
/* Check the DRI version */
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"RADEONDRIScreenInit failed "
- "(DRI version = %d.%d.%d, expected 3.1.x). "
+ "(DRI version = %d.%d.%d, expected 4.0.x). "
"Disabling DRI.\n",
major, minor, patch);
return FALSE;
@@ -1180,6 +1231,11 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen)
< RADEON_MAX_DRAWABLES
? SAREA_MAX_DRAWABLES
: RADEON_MAX_DRAWABLES);
+#ifdef PER_CONTEXT_SAREA
+ /* This is only here for testing per-context SAREAs. When used, the
+ magic number below would be properly defined in a header file. */
+ info->perctx_sarea_size = 64 * 1024;
+#endif
#ifdef NOT_DONE
/* FIXME: Need to extend DRI protocol to pass this size back to
@@ -1215,6 +1271,9 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = RADEONDRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n");
xfree(pDRIInfo->devPrivate);
@@ -1228,8 +1287,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen)
version = drmGetVersion(info->drmFD);
if (version) {
if (version->version_major != 1 ||
- version->version_minor != 0 ||
- version->version_patchlevel < 0) {
+ version->version_minor < 0) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"RADEONDRIScreenInit failed "
@@ -1323,6 +1381,7 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen)
/* Initialize the SAREA private data structure */
pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen);
memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
+
RADEONDRISAREAInit(pScreen, pSAREAPriv);
pRADEONDRI = (RADEONDRIPtr)info->pDRIInfo->devPrivate;
@@ -1357,6 +1416,13 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen)
pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran;
pRADEONDRI->agpTexOffset = info->agpTexStart;
+ pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
+
+#ifdef PER_CONTEXT_SAREA
+ /* Set per-context SAREA size */
+ pRADEONDRI->perctx_sarea_size = info->perctx_sarea_size;
+#endif
+
return TRUE;
}
@@ -1405,9 +1471,6 @@ void RADEONDRICloseScreen(ScreenPtr pScreen)
drmAgpRelease(info->drmFD);
}
- /* Restore PCI command register */
- pciWriteLong(info->PciTag, PCI_CMD_STAT_REG, info->pciCommand);
-
/* De-allocate all DRI resources */
DRICloseScreen(pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h
index 41b5248ad..553d54526 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.1 2001/01/08 01:07:35 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
* VA Linux Systems Inc., Fremont, California.
@@ -43,7 +43,7 @@
/* DRI Driver defaults */
#define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO
#define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM
-#define RADEON_DEFAULT_AGP_MODE 2
+#define RADEON_DEFAULT_AGP_MODE 1
#define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */
#define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */
#define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */
@@ -96,6 +96,11 @@ typedef struct {
drmSize agpTexMapSize;
int log2AGPTexGran;
int agpTexOffset;
+ unsigned int sarea_priv_offset;
+
+#ifdef PER_CONTEXT_SAREA
+ drmSize perctx_sarea_size;
+#endif
} RADEONDRIRec, *RADEONDRIPtr;
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h
index 90898e534..351713e56 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.1 2001/01/08 01:07:35 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
* VA Linux Systems Inc., Fremont, California.
@@ -38,6 +38,8 @@
#define _RADEON_DRIPRIV_H_
#include "GL/glxint.h"
+#include "xf86drm.h"
+#include "xf86drmRadeon.h"
#define RADEON_MAX_DRAWABLES 256
@@ -50,8 +52,13 @@ typedef struct {
} RADEONConfigPrivRec, *RADEONConfigPrivPtr;
typedef struct {
+#ifdef PER_CONTEXT_SAREA
+ drmContext ctx_id;
+ drmHandle sarea_handle;
+#else
/* Nothing here yet */
int dummy;
+#endif
} RADEONDRIContextRec, *RADEONDRIContextPtr;
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
index 26049b328..0c2180602 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.15 2001/01/22 02:16:49 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.18 2001/04/03 17:10:36 tsi Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -1662,16 +1662,19 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Reserve space for textures */
info->textureOffset = (info->FbMapSize - info->textureSize +
- RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN;
+ RADEON_BUFFER_ALIGN) &
+ ~(CARD32)RADEON_BUFFER_ALIGN;
/* Reserve space for the shared depth buffer */
info->depthOffset = (info->textureOffset - bufferSize +
- RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN;
+ RADEON_BUFFER_ALIGN) &
+ ~(CARD32)RADEON_BUFFER_ALIGN;
info->depthPitch = pScrn->displayWidth;
/* Reserve space for the shared back buffer */
info->backOffset = (info->depthOffset - bufferSize +
- RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN;
+ RADEON_BUFFER_ALIGN) &
+ ~(CARD32)RADEON_BUFFER_ALIGN;
info->backPitch = pScrn->displayWidth;
scanlines = info->backOffset / width_bytes - 1;
@@ -1742,7 +1745,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* The acceleration engine uses 14 bit
signed coordinates, so we can't have any
drawable caches beyond this region. */
- if (y2 > 8191 ) y2 = 8191;
+ if (y2 > 8191) y2 = 8191;
MemBox.y2 = y2;
if (!xf86InitFBManager(pScreen, &MemBox)) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
index 1c0549d5e..e1fdb6c87 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.6 2001/01/06 20:19:11 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.7 2001/04/01 14:00:10 tsi Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -47,6 +47,32 @@
#include "xf86_ansic.h"
#include "xf86Resources.h"
+#ifdef XFree86LOADER
+
+/*
+ * The following exists to prevent the compiler from considering entry points
+ * defined in a separate module from being constants.
+ */
+static xf86PreInitProc * const volatile PreInitProc = RADEONPreInit;
+static xf86ScreenInitProc * const volatile ScreenInitProc = RADEONScreenInit;
+static xf86SwitchModeProc * const volatile SwitchModeProc = RADEONSwitchMode;
+static xf86AdjustFrameProc * const volatile AdjustFrameProc = RADEONAdjustFrame;
+static xf86EnterVTProc * const volatile EnterVTProc = RADEONEnterVT;
+static xf86LeaveVTProc * const volatile LeaveVTProc = RADEONLeaveVT;
+static xf86FreeScreenProc * const volatile FreeScreenProc = RADEONFreeScreen;
+static xf86ValidModeProc * const volatile ValidModeProc = RADEONValidMode;
+
+#define RADEONPreInit PreInitProc
+#define RADEONScreenInit ScreenInitProc
+#define RADEONSwitchMode SwitchModeProc
+#define RADEONAdjustFrame AdjustFrameProc
+#define RADEONEnterVT EnterVTProc
+#define RADEONLeaveVT LeaveVTProc
+#define RADEONFreeScreen FreeScreenProc
+#define RADEONValidMode ValidModeProc
+
+#endif
+
SymTabRec RADEONChipsets[] = {
{ PCI_CHIP_RADEON_QD, "ATI Radeon QD (AGP)" },
{ PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" },
@@ -151,6 +177,7 @@ RADEONProbe(DriverPtr drv, int flags)
ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
#ifdef XFree86LOADER
+
if (!xf86LoadSubModule(pScrn, "radeon")) {
xf86Msg(X_ERROR,
RADEON_NAME ": Failed to load \"radeon\" module.\n");
@@ -160,26 +187,6 @@ RADEONProbe(DriverPtr drv, int flags)
xf86LoaderReqSymLists(RADEONSymbols, NULL);
-#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
-# define RADEONPreInit \
- (xf86PreInitProc*) LoaderSymbol("RADEONPreInit")
-# define RADEONScreenInit \
- (xf86ScreenInitProc*) LoaderSymbol("RADEONScreenInit")
-# define RADEONSwitchMode \
- (xf86SwitchModeProc*) LoaderSymbol("RADEONSwitchMode")
-# define RADEONAdjustFrame \
- (xf86AdjustFrameProc*)LoaderSymbol("RADEONAdjustFrame")
-# define RADEONEnterVT \
- (xf86EnterVTProc*) LoaderSymbol("RADEONEnterVT")
-# define RADEONLeaveVT \
- (xf86LeaveVTProc*) LoaderSymbol("RADEONLeaveVT")
-# define RADEONFreeScreen \
- (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen")
-# define RADEONValidMode \
- (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode")
-#endif
-
#endif
pScrn->driverVersion = RADEON_VERSION_CURRENT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
index 2b725913b..0d006dfa5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.6 2001/01/11 03:36:58 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.8 2001/03/21 17:02:22 dawes Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -69,7 +69,7 @@
#define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val)
#define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val)
-#define ADDRREG(addr) ((volatile CARD32 *)(RADEONMMIO + (addr)))
+#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(RADEONMMIO + (addr)))
#define OUTREGP(addr, val, mask) \
@@ -1073,36 +1073,36 @@
#define RADEON_PP_TXFORMAT_0 0x1c58
#define RADEON_PP_TXFORMAT_1 0x1c70
#define RADEON_PP_TXFORMAT_2 0x1c88
-# define RADEON_TXF_8BPP_I (0 << 0)
-# define RADEON_TXF_16BPP_AI88 (1 << 0)
-# define RADEON_TXF_8BPP_RGB332 (2 << 0)
-# define RADEON_TXF_16BPP_ARGB1555 (3 << 0)
-# define RADEON_TXF_16BPP_RGB565 (4 << 0)
-# define RADEON_TXF_16BPP_ARGB4444 (5 << 0)
-# define RADEON_TXF_32BPP_ARGB8888 (6 << 0)
-# define RADEON_TXF_32BPP_RGBA8888 (7 << 0)
-# define RADEON_TXF_8BPP_Y (8 << 0)
-# define RADEON_TXF_FORMAT_MASK (31 << 0)
-# define RADEON_TXF_FORMAT_SHIFT 0
-# define RADEON_TXF_APPLE_YUV_MODE (1 << 5)
-# define RADEON_TXF_ALPHA_IN_MAP (1 << 6)
-# define RADEON_TXF_NON_POWER2 (1 << 7)
-# define RADEON_TXF_WIDTH_MASK (15 << 8)
-# define RADEON_TXF_WIDTH_SHIFT 8
-# define RADEON_TXF_HEIGHT_MASK (15 << 12)
-# define RADEON_TXF_HEIGHT_SHIFT 12
-# define RADEON_TXF_ST_ROUTE_STQ0 (0 << 24)
-# define RADEON_TXF_ST_ROUTE_MASK (3 << 24)
-# define RADEON_TXF_ST_ROUTE_STQ1 (1 << 24)
-# define RADEON_TXF_ST_ROUTE_STQ2 (2 << 24)
-# define RADEON_TXF_ENDIAN_NO_SWAP (0 << 26)
-# define RADEON_TXF_ENDIAN_16BPP_SWAP (1 << 26)
-# define RADEON_TXF_ENDIAN_32BPP_SWAP (2 << 26)
-# define RADEON_TXF_ENDIAN_HALFDW_SWAP (3 << 26)
-# define RADEON_TXF_ALPHA_MASK_ENABLE (1 << 28)
-# define RADEON_TXF_CHROMA_KEY_ENABLE (1 << 29)
-# define RADEON_TXF_CUBIC_MAP_ENABLE (1 << 30)
-# define RADEON_TXF_PERSPECTIVE_ENABLE (1 << 31)
+# define RADEON_TXFORMAT_I8 (0 << 0)
+# define RADEON_TXFORMAT_AI88 (1 << 0)
+# define RADEON_TXFORMAT_RGB332 (2 << 0)
+# define RADEON_TXFORMAT_ARGB1555 (3 << 0)
+# define RADEON_TXFORMAT_RGB565 (4 << 0)
+# define RADEON_TXFORMAT_ARGB4444 (5 << 0)
+# define RADEON_TXFORMAT_ARGB8888 (6 << 0)
+# define RADEON_TXFORMAT_RGBA8888 (7 << 0)
+# define RADEON_TXFORMAT_Y8 (8 << 0)
+# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0)
+# define RADEON_TXFORMAT_FORMAT_SHIFT 0
+# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5)
+# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6)
+# define RADEON_TXFORMAT_NON_POWER2 (1 << 7)
+# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8)
+# define RADEON_TXFORMAT_WIDTH_SHIFT 8
+# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12)
+# define RADEON_TXFORMAT_HEIGHT_SHIFT 12
+# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
+# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26)
+# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26)
+# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26)
+# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26)
+# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
+# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
+# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
+# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31)
#define RADEON_PP_TXOFFSET_0 0x1c5c
#define RADEON_PP_TXOFFSET_1 0x1c74
#define RADEON_PP_TXOFFSET_2 0x1c8c
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h
index 94cdcc0b2..65fc9f0af 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.1 2001/01/08 01:07:36 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
* VA Linux Systems Inc., Fremont, California.
@@ -81,7 +81,7 @@
/* Vertex/indirect buffer size
*/
-#define RADEON_BUFFER_SIZE 16384
+#define RADEON_BUFFER_SIZE 65536
/* Byte offsets for indirect buffer data
*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
index f18762c72..f4758c793 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.10 2001/01/25 02:27:50 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.11 2001/03/03 22:26:11 tsi Exp $ */
#include "radeon.h"
#include "radeon_reg.h"
@@ -37,7 +37,7 @@ static int RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
static void RADEONResetVideo(ScrnInfoPtr);
-static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time);
+static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now);
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -253,8 +253,8 @@ RegionsEqual(RegionPtr A, RegionPtr B)
(A->extents.y2 != B->extents.y2))
return FALSE;
- dataA = (int*)REGION_RECTS(A);
- dataB = (int*)REGION_RECTS(B);
+ dataA = (pointer)REGION_RECTS(A);
+ dataB = (pointer)REGION_RECTS(B);
while(num--) {
if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
@@ -506,7 +506,7 @@ RADEONCopyMungedData(
w >>= 1;
for(j = 0; j < h; j++) {
- dst = (CARD32*)dst1;
+ dst = (pointer)dst1;
s1 = src1; s2 = src2; s3 = src3;
i = w;
while(i > 4) {
@@ -841,21 +841,21 @@ RADEONQueryImageAttributes(
}
static void
-RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time)
+RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONPortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
if(pPriv->videoStatus & TIMER_MASK) {
if(pPriv->videoStatus & OFF_TIMER) {
- if(pPriv->offTime < time) {
+ if(pPriv->offTime < now) {
unsigned char *RADEONMMIO = info->MMIO;
OUTREG(RADEON_OV0_SCALE_CNTL, 0);
pPriv->videoStatus = FREE_TIMER;
- pPriv->freeTime = time + FREE_DELAY;
+ pPriv->freeTime = now + FREE_DELAY;
}
} else { /* FREE_TIMER */
- if(pPriv->freeTime < time) {
+ if(pPriv->freeTime < now) {
if(pPriv->linear) {
xf86FreeOffscreenLinear(pPriv->linear);
pPriv->linear = NULL;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c
index 3e25a53d8..233550fb7 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5 2001/02/15 17:39:27 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.6 2001/04/01 14:00:10 tsi Exp $ */
/*
* Copyright 2000 by Egbert Eich
*
@@ -143,7 +143,7 @@ Cir_OpenFramebuffer(
CirPtr pCir = CIRPTR(pScrn);
*name = NULL; /* no special device */
- *mem = (unsigned char*)pCir->FbAddress;
+ *mem = (unsigned char*)(long)pCir->FbAddress;
*size = pCir->FbMapSize;
*offset = 0; /* Always */
*flags = 0; /* Root permissions OS-dependent */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile
index 9308b5e71..cfba2fa80 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile
@@ -1,7 +1,7 @@
XCOMM
XCOMM This is an Imakefile for the fbdev driver.
XCOMM
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.9 2001/01/24 00:06:17 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.10 2001/04/06 18:16:30 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -21,7 +21,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(XF86SRC)/rac \
-I$(SERVERSRC)/Xext -I$(XF86SRC)/xf24_32bpp\
-I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
- -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/render
+ -I$(SERVERSRC)/miext/shadow -I$(EXTINCSRC) -I$(SERVERSRC)/render
#endif
DEFINES = FbdevDefines
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c
index 86b653052..82b2d2fd3 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.28 2001/01/21 21:19:25 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.29 2001/04/06 18:16:30 dawes Exp $ */
/*
* Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
@@ -15,11 +15,11 @@
#include "micmap.h"
#include "colormapst.h"
#include "xf86cmap.h"
-#include "shadowfb.h"
+#include "shadow.h"
+#include "dgaproc.h"
/* for visuals */
#include "fb.h"
-#include "cfb24_32.h"
#ifdef USE_AFB
#include "afb.h"
#endif
@@ -55,8 +55,18 @@ static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags);
static Bool FBDevScreenInit(int Index, ScreenPtr pScreen, int argc,
char **argv);
static Bool FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen);
-static Bool FBDevSaveScreen(ScreenPtr pScreen, int mode);
-static void FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
+static void * FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
+ CARD32 *size);
+static Bool FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen);
+
+
+#if 0
+static ShadowUpdateProc updateFuncs[] =
+ { shadowUpdatePacked, shadowUpdateRotate8, shadowUpdateRotUD8, shadowUpdateRotCCW8,
+ shadowUpdatePacked, shadowUpdateRotate16, shadowUpdateRotUD16, shadowUpdateRotCCW16,
+ shadowUpdatePacked, shadowUpdateRotate32, shadowUpdateRotUD32, shadowUpdateRotCCW32 };
+#endif
+
/* -------------------------------------------------------------------- */
@@ -91,23 +101,23 @@ static SymTabRec FBDevChipsets[] = {
#ifdef USE_AFB
{ 0, "afb" },
#endif
-#if 0
- { 0, "cfb8" },
- { 0, "cfb16" },
- { 0, "cfb24" },
- { 0, "cfb32" },
-#endif
{-1, NULL }
};
/* Supported options */
typedef enum {
OPTION_SHADOW_FB,
+#if 0
+ OPTION_ROTATE,
+#endif
OPTION_FBDEV
} FBDevOpts;
static OptionInfoRec FBDevOptions[] = {
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+#if 0
+ { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+#endif
{ OPTION_FBDEV, "fbdev", OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -127,7 +137,9 @@ static const char *cfbSymbols[] = {
};
static const char *shadowSymbols[] = {
- "ShadowFBInit",
+ "shadowAlloc",
+ "shadowInit",
+ "shadowUpdatePacked",
NULL
};
@@ -199,11 +211,17 @@ typedef struct {
unsigned char* fbstart;
unsigned char* fbmem;
int fboff;
+ int lineLength;
unsigned char* shadowmem;
- int shadowPitch;
+#if 0
+ int rotate;
+#endif
Bool shadowFB;
CloseScreenProcPtr CloseScreen;
EntityInfoPtr pEnt;
+ /* DGA info */
+ DGAModePtr pDGAMode;
+ int nDGAMode;
} FBDevRec, *FBDevPtr;
#define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate))
@@ -346,7 +364,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
{
FBDevPtr fPtr;
int default_depth;
- char *mod = NULL;
+ char *mod = NULL, *s;
const char *reqSym = NULL;
Gamma zeros = {0.0, 0.0, 0.0};
@@ -421,10 +439,45 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
/* handle options */
xf86CollectOptions(pScrn, NULL);
xf86ProcessOptions(pScrn->scrnIndex, fPtr->pEnt->device->options, FBDevOptions);
+
+ /* use shadow framebuffer by default */
fPtr->shadowFB = xf86ReturnOptValBool(FBDevOptions, OPTION_SHADOW_FB, TRUE);
- xf86DrvMsg(pScrn->scrnIndex,
- xf86IsOptionSet(FBDevOptions, OPTION_SHADOW_FB) ? X_CONFIG : X_DEFAULT,
- "Option ShadowFB is %s\n",fPtr->shadowFB ? "on" : "off");
+
+#if 0
+ /* rotation (doesn't work yet) */
+ fPtr->rotate = 0;
+ if ((s = xf86GetOptValString(FBDevOptions, OPTION_ROTATE)))
+ {
+ if(!xf86NameCmp(s, "CW"))
+ {
+ fPtr->shadowFB = TRUE;
+ fPtr->rotate = 1;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen clockwise\n");
+ }
+ else if(!xf86NameCmp(s, "CCW"))
+ {
+ fPtr->shadowFB = TRUE;
+ fPtr->rotate = 3;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen counter clockwise\n");
+ }
+ else if(!xf86NameCmp(s, "UD"))
+ {
+ fPtr->shadowFB = TRUE;
+ fPtr->rotate = 2;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen counter clockwise\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\", \"CCW\" or \"UD\"\n");
+ }
+ }
+#endif
/* select video modes */
@@ -469,6 +522,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
case FBDEVHW_PACKED_PIXELS:
mod = "fb";
reqSym = "fbScreenInit";
+ xf86LoaderReqSymbols("fbPictureInit", NULL);
switch (pScrn->bitsPerPixel)
{
@@ -517,83 +571,31 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymbols(reqSym, NULL);
- /* Load shadowFB if needed */
+ /* Load shadow if needed */
if (fPtr->shadowFB) {
- if (!xf86LoadSubModule(pScrn, "shadowfb")) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\"\n");
+ if (!xf86LoadSubModule(pScrn, "shadow")) {
FBDevFreeRec(pScrn);
return FALSE;
}
- xf86LoaderReqSymbols("ShadowFBInit", NULL);
+ xf86LoaderReqSymLists(shadowSymbols, NULL);
}
TRACE_EXIT("PreInit");
return TRUE;
}
-/* for ShadowFB */
-static void
-FBDevRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
-{
- FBDevPtr fPtr = FBDEVPTR(pScrn);
- int width, height, Bpp, FBPitch;
- unsigned char *src, *dst;
-
- Bpp = pScrn->bitsPerPixel >> 3;
- FBPitch = fbdevHWGetLineLength(pScrn);
-
- while(num--) {
- width = (pbox->x2 - pbox->x1) * Bpp;
- height = pbox->y2 - pbox->y1;
- src = fPtr->shadowmem + (pbox->y1 * fPtr->shadowPitch) +
- (pbox->x1 * Bpp);
- dst = fPtr->fbmem + fPtr->fboff + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
-
- while(height--) {
- memcpy(dst, src, width);
- dst += FBPitch;
- src += fPtr->shadowPitch;
- }
- pbox++;
- }
-}
-
-static Bool
-FBDevSaveScreen(ScreenPtr pScreen, int mode)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- FBDevPtr fPtr = FBDEVPTR(pScrn);
- BoxRec box;
- Bool unblank;
-
- TRACE_ENTER("FBDevSaveScreen");
- if (!(fPtr->shadowFB))
- /* Not implemented yet - alloc huge memory block and copy ? */
- return TRUE;
-
- unblank = xf86IsUnblank(mode);
-
- if (unblank) {
- box.x1 = 0;
- box.x2 = pScrn->virtualX;
- box.y1 = 0;
- box.y2 = pScrn->virtualY;
- FBDevRefreshArea(pScrn, 1, &box);
- } else {
- memset(fPtr->fbmem + fPtr->fboff, 0,
- pScrn->virtualX * pScrn->virtualY * ((pScrn->bitsPerPixel+7)/8));
- }
- return TRUE;
-}
-
static Bool
FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
FBDevPtr fPtr = FBDEVPTR(pScrn);
VisualPtr visual;
- int ret,flags;
+ int ret,flags,width,height;
+ ShadowUpdateProc fun;
TRACE_ENTER("FBDevScreenInit");
+
#if DEBUG
ErrorF("\tbitsPerPixel=%d, depth=%d, defaultVisual=%s\n"
"\tmask: %x,%x,%x, offset: %d,%d,%d\n",
@@ -612,6 +614,8 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
return FALSE;
+
+ fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON);
fbdevHWAdjustFrame(scrnIndex,0,0,0);
/* mi layer */
@@ -625,12 +629,28 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->rgbBits, pScrn->defaultVisual))
return FALSE;
}
+ if (!miSetPixmapDepths())
+ return FALSE;
+
+#if 0
+ if(fPtr->rotate==3 || fPtr->rotate==1)
+ {
+ height = pScrn->virtualX;
+ width = pScrn->virtualY;
+ } else {
+#endif
+ height = pScrn->virtualY;
+ width = pScrn->virtualX;
+#if 0
+ }
+#endif
/* shadowfb */
if (fPtr->shadowFB) {
- fPtr->shadowPitch =
- ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L;
- fPtr->shadowmem = xalloc(fPtr->shadowPitch * pScrn->virtualY);
+ if ((fPtr->shadowmem = shadowAlloc(width, height,
+ pScrn->bitsPerPixel)) == NULL)
+ return FALSE;
+
fPtr->fbstart = fPtr->shadowmem;
} else {
fPtr->shadowmem = NULL;
@@ -641,6 +661,22 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
#ifdef USE_AFB
case FBDEVHW_PLANES:
+#if 0
+ if (fPtr->rotate)
+ {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Internal error: Rotate not supported for afb\n");
+ ret = FALSE;
+ break;
+ }
+#endif
+ if (fPtr->shadowFB)
+ {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Internal error: Shadwo framebuffer not supported for afb\n");
+ ret = FALSE;
+ break;
+ }
ret = afbScreenInit
(pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY,
pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth);
@@ -652,16 +688,18 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pix24bpp == 32)
{
ret = cfb24_32ScreenInit
- (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY,
+ (pScreen, fPtr->fbstart, width, height,
pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth);
break;
}
case 8:
case 16:
case 32:
- ret = fbScreenInit
- (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel);
+ ret = fbScreenInit(pScreen, fPtr->fbstart, width, height,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel);
+ if (ret && !fbPictureInit(pScreen, NULL, 0))
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "RENDER extension initialisation failed.\n");
break;
default:
xf86DrvMsg(scrnIndex, X_ERROR,
@@ -719,6 +757,36 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
+#if 0
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ case 16:
+ case 32:
+#endif
+ if (fPtr->shadowFB &&
+ !shadowInit(pScreen, shadowUpdatePacked, /*updateFuncs[fPtr->rotate + (pScrn->bitsPerPixel/4 & 0xc)],*/
+ FBDevWindowLinear))
+ return FALSE;
+#if 0
+ break;
+ default:
+ if (fPtr->rotate)
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Internal error: rotate not supported for %dbpp.\n",
+ pScrn->bitsPerPixel);
+ return FALSE;
+ }
+
+ if (!fPtr->rotate)
+#endif
+ FBDevDGAInit(pScrn, pScreen);
+#if 0
+ else
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Rotated display, disabling DGA\n");
+#endif
+
xf86SetBlackWhitePixels(pScreen);
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
@@ -726,9 +794,6 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* software cursor */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
- if(fPtr->shadowFB)
- ShadowFBInit(pScreen, FBDevRefreshArea);
-
/* colormap */
switch (fbdevHWGetType(pScrn))
{
@@ -767,9 +832,9 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if(!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, NULL, flags))
return FALSE;
- xf86DPMSInit(pScreen, FBDevDPMSSet, 0);
+ xf86DPMSInit(pScreen, fbdevHWDPMSSet, 0);
- pScreen->SaveScreen = FBDevSaveScreen;
+ pScreen->SaveScreen = fbdevHWSaveScreen;
/* Wrap the current CloseScreen function */
fPtr->CloseScreen = pScreen->CloseScreen;
@@ -786,9 +851,8 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
-#if DEBUG
- ErrorF("FBDevScreenInit done\n",pScrn->scrnIndex);
-#endif
+ TRACE_EXIT("FBDevScreenInit");
+
return TRUE;
}
@@ -802,15 +866,169 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
fbdevHWUnmapVidmem(pScrn);
if (fPtr->shadowmem)
xfree(fPtr->shadowmem);
+ if (fPtr->pDGAMode)
+ xfree(fPtr->pDGAMode);
pScrn->vtSema = FALSE;
pScreen->CloseScreen = fPtr->CloseScreen;
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
+static void *
+FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
+ CARD32 *size)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ FBDevPtr fPtr = FBDEVPTR(pScrn);
+
+ if (fPtr->lineLength)
+ *size = fPtr->lineLength;
+ else
+ *size = fPtr->lineLength = fbdevHWGetLineLength(pScrn);
+
+ return ((CARD8 *)fPtr->fbmem + fPtr->fboff + row * fPtr->lineLength + offset);
+}
+
+
+/***********************************************************************
+ * DGA stuff
+ ***********************************************************************/
+static Bool FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName,
+ unsigned char **ApertureBase,
+ int *ApertureSize, int *ApertureOffset,
+ int *flags);
+static Bool FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode);
+static void FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags);
+
+static Bool
+FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName,
+ unsigned char **ApertureBase, int *ApertureSize,
+ int *ApertureOffset, int *flags)
+{
+ *DeviceName = NULL; /* No special device */
+ *ApertureBase = (unsigned char *)(pScrn->memPhysBase);
+ *ApertureSize = pScrn->videoRam;
+ *ApertureOffset = pScrn->fbOffset;
+ *flags = 0;
+
+ return TRUE;
+}
+
+static Bool
+FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode)
+{
+ DisplayModePtr pMode;
+ int scrnIdx = pScrn->pScreen->myNum;
+ int frameX0, frameY0;
+
+ if (pDGAMode) {
+ pMode = pDGAMode->mode;
+ frameX0 = frameY0 = 0;
+ }
+ else {
+ if (!(pMode = pScrn->currentMode))
+ return TRUE;
+
+ frameX0 = pScrn->frameX0;
+ frameY0 = pScrn->frameY0;
+ }
+
+ if (!(*pScrn->SwitchMode)(scrnIdx, pMode, 0))
+ return FALSE;
+ (*pScrn->AdjustFrame)(scrnIdx, frameX0, frameY0, 0);
+
+ return TRUE;
+}
static void
-FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
+FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
+{
+ (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags);
+}
+
+static int
+FBDevDGAGetViewport(ScrnInfoPtr pScrn)
{
- fbdevHWDPMSSet(pScrn, mode, flags);
+ return (0);
+}
+
+static DGAFunctionRec FBDevDGAFunctions =
+{
+ FBDevDGAOpenFramebuffer,
+ NULL, /* CloseFramebuffer */
+ FBDevDGASetMode,
+ FBDevDGASetViewport,
+ FBDevDGAGetViewport,
+ NULL, /* Sync */
+ NULL, /* FillRect */
+ NULL, /* BlitRect */
+ NULL, /* BlitTransRect */
+};
+
+static void
+FBDevDGAAddModes(ScrnInfoPtr pScrn)
+{
+ FBDevPtr fPtr = FBDEVPTR(pScrn);
+ DisplayModePtr pMode = pScrn->modes;
+ DGAModePtr pDGAMode;
+
+ do {
+ pDGAMode = xrealloc(fPtr->pDGAMode,
+ (fPtr->nDGAMode + 1) * sizeof(DGAModeRec));
+ if (!pDGAMode)
+ break;
+
+ fPtr->pDGAMode = pDGAMode;
+ pDGAMode += fPtr->nDGAMode;
+ (void)memset(pDGAMode, 0, sizeof(DGAModeRec));
+
+ ++fPtr->nDGAMode;
+ pDGAMode->mode = pMode;
+ pDGAMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
+ pDGAMode->byteOrder = pScrn->imageByteOrder;
+ pDGAMode->depth = pScrn->depth;
+ pDGAMode->bitsPerPixel = pScrn->bitsPerPixel;
+ pDGAMode->red_mask = pScrn->mask.red;
+ pDGAMode->green_mask = pScrn->mask.green;
+ pDGAMode->blue_mask = pScrn->mask.blue;
+ pDGAMode->visualClass = pScrn->bitsPerPixel > 8 ?
+ TrueColor : PseudoColor;
+ pDGAMode->xViewportStep = 1;
+ pDGAMode->yViewportStep = 1;
+ pDGAMode->viewportWidth = pMode->HDisplay;
+ pDGAMode->viewportHeight = pMode->VDisplay;
+
+ if (fPtr->lineLength)
+ pDGAMode->bytesPerScanline = fPtr->lineLength;
+ else
+ pDGAMode->bytesPerScanline = fPtr->lineLength = fbdevHWGetLineLength(pScrn);
+
+ pDGAMode->imageWidth = pMode->HDisplay;
+ pDGAMode->imageHeight = pMode->VDisplay;
+ pDGAMode->pixmapWidth = pDGAMode->imageWidth;
+ pDGAMode->pixmapHeight = pDGAMode->imageHeight;
+ pDGAMode->maxViewportX = pScrn->virtualX -
+ pDGAMode->viewportWidth;
+ pDGAMode->maxViewportY = pScrn->virtualY -
+ pDGAMode->viewportHeight;
+
+ pDGAMode->address = fPtr->fbstart;
+
+ pMode = pMode->next;
+ } while (pMode != pScrn->modes);
+}
+
+static Bool
+FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
+{
+ FBDevPtr fPtr = FBDEVPTR(pScrn);
+
+ if (pScrn->depth < 8)
+ return FALSE;
+
+ if (!fPtr->nDGAMode)
+ FBDevDGAAddModes(pScrn);
+
+ return (DGAInit(pScreen, &FBDevDGAFunctions,
+ fPtr->pDGAMode, fPtr->nDGAMode));
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile
index 9583be466..9d0d04db1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.31 2001/01/31 16:14:51 alanh Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.32 2001/02/24 14:29:16 alanh Exp $
XCOMM
XCOMM This is an Imakefile for the GLINT driver.
XCOMM
@@ -14,11 +14,11 @@ DRIINCLUDES=-I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri
SRCS = glint_driver.c pm2_dac.c pm2ramdac.c pm2_accel.c pm_dac.c IBMramdac.c \
pm_accel.c tx_dac.c tx_accel.c pm2v_dac.c pm2vramdac.c pm2_video.c \
- pm3_dac.c pm3_accel.c TIramdac.c \
+ pm3_dac.c pm3_accel.c pm3_video.c TIramdac.c \
glint_shadow.c $(DRISRC) sx_accel.c glint_dga.c
OBJS = glint_driver.o pm2_dac.o pm2ramdac.o pm2_accel.o pm_dac.o IBMramdac.o \
pm_accel.o tx_dac.o tx_accel.o pm2v_dac.o pm2vramdac.o pm2_video.o \
- pm3_dac.o pm3_accel.o TIramdac.o \
+ pm3_dac.o pm3_accel.o pm3_video.o TIramdac.o \
glint_shadow.o $(DRIOBJ) sx_accel.o glint_dga.o
#if defined(XF86DriverSDK)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
index 5a79d688e..5285b59ae 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.7 2000/12/20 11:13:01 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.8 2001/02/24 14:29:16 alanh Exp $ */
STATUS as of Mon, 16 Oct 2000 21:24:51 +0200
@@ -7,7 +7,8 @@ Working :
1280x1024 only as my monitor don't support higher modes.
* Endianess clean, thanks to Romain Dolbeau <dolbeaur@club-internet.fr> for
helping me debug this.
- * HW cursor.
+ * HW cursor :
+ - The cursor cannot be hidden, we need to move it offscreen instead.
* ShadowFb works.
* Full 2D Accels.
- Sync.
@@ -24,20 +25,22 @@ Working :
- Pixmap Writes using direct FIFO writes with or without FIFO Disconnect.
* Appian J2000 second head initialization.
* Dual head : The console fonts will get trashed, but dual head works.
- * DRI :
- - Gamma, if available, get's claimed with the UseGamma option.
+ * Xv : Is working, but there are still problems when using smaller displays.
+ * DRI : Work is underway.
+
Not Working :
- * 2D Accel :
+ * [NOT POSSIBLE] 2D Accel :
- Solid & Dashed Lines are not possible on glint hardware.
- 8x8 Color Pattern Fill is almost never used.
- Clipping needs cleaning up.
- - Seems broken on big endian systems, cannot test it though.
- * 2D Accel hooks for the Rendering extension ?
+ * [TODO] 2D Accel hooks for the Rendering extension :
- Render extension initialization.
- CPUToScreenTexture.
- CPUToScreenAlphaTexture.
- * Video Overlay.
- * DRI.
+ * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) :
+ - DRI support should be ok, but accelerated openGL is not yet supported.
+ - The accelerated OpenGL library supposes we are using a gamma together
+ with a MX rasterizer, not a Permedia3 one.
Known Problem :
@@ -49,56 +52,14 @@ Known Problem :
vesafb, it will be a bit slower, but the fonts will no more become
corrupt. Maybe i will even try writting a specific fbdev for the pm3,
which will be much faster and have more functionality.
- * R-B inversion. Sometimes, all of a sudden, it seems as the RGB order
- gets changed. going to console and back solves this.
- * [TRIGGERED IN ENLIGTHENMENT ONLY] When moving a window around a lot
- quicly, the video outputs dies. I have to switch to a console and back
- to have it restored. Is it possible that the accel engine gets
- overloaded or something such ? Don't think so, it happens even when
- PCIRetry is used too ...
+ [FIX2] try : consolechars -d, it should reload the console fonts.
+ * R-B inversion. Sometimes, all of a sudden, it seems as the
+ RGB order gets changed. going to console and back solves this.
+ Well, this is partly fixed, but still appears under very heavy load.
+ * When moving a window around a lot quicly, the video outputs dies.
+ Well, this is partly fixed, but still appears under very heavy load.
* Sometimes there are blue transparent garbage in the form of small
horizontal bands, few pixels high, and more pixels width, maybe 64pixels ?
-
-Video Overlay [NOTHING DONE YET] :
-
- * I have not done anything yet here.
-
-DRI/3D Accels [WORK IS PLANED] :
-
- * First approach would be to use the gamma for one head only (most probably
- the first head, it could be configurable though).
- * Sharing the gamma between both driver instances would need a setup similar
- of what was done for the Matrox dualheaded G400 (mga driver).
- * Alternatively it could be possible to use DRI with the gamma on one head,
- and DRI with the pm3 alone on the second head. This would need writing a
- pm3 drm kernel driver as well as a pm3 OpenGL driver. Could be useful for
- boards without gamma chips though.
-
- * Claiming the Gamma (in the one head only approach) :
- - The first possibility is the use of the UseGamma Option in the driver
- section. The UseGamma option then tries to claim a gamma chip, if
- available, on the same device. This enable the use of the gamma on
- either head, in a two head setup.
- - The second possibility is the automatic claiming of a gamma chip if
- available. This works ok in single headed mode, but in dual head setup,
- only the first head will be accelerated.
- * Using the Gamma :
- - A first try of using the Gamma (for 2D only) gave me a system freeze.
- This is probably due to bad initialization since i only set the IOBase
- to the Gamma registers, and did nothing more to initialize the Gamma.
- I need more info on initialization of the Gamma chip, especially on how
- to tell it which Permedia3 to use.
- - A Second try, after initializing MultiGLINTAperture and MultiGLINT1 did
- end in the same way.
- - Once that is done, i need to write a pm3_dri.c file, inspired on the
- glint_dri.c file, which does the dri setup, and the 2d/3d state saving.
- * Changes to the 2D driver when using the Gamma :
- - Well, there could be some changes, but in particular, the Gamma has only
- a 32 entries deep Input FIFO, and not a 120 entries deep one like
- permedia3.
- - Another idea, is to use Gamma bypass when doing 2D accels. This way, we
- don't have to worry about the Gamma smaller input Fifo. But we need to
- sync the gamma also when doing syncs. Not sure where the right place for
- this is though. Maybe when switching between 2D and 3D ?
+ This seems like a hardware bug.
Sven Luther <luther@dpt-info.u-strasbg.fr>
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
index 52cc1f883..5f190632d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.44 2001/02/07 13:26:18 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.46 2001/03/19 22:50:28 alanh Exp $ */
/*
* Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk>
*
@@ -123,6 +123,7 @@ typedef struct {
Bool HWCursor;
Bool ClippingOn;
Bool UseBlockWrite;
+ Bool UseFlatPanel;
Bool UseFireGL3000;
CARD8 VGAdata[65536];
Bool VGAcore;
@@ -234,6 +235,8 @@ void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg);
Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg);
Bool Permedia3AccelInit(ScreenPtr pScreen);
void Permedia3InitializeEngine(ScrnInfoPtr pScrn);
+void Permedia3Sync(ScrnInfoPtr pScrn);
+void DualPermedia3Sync(ScrnInfoPtr pScrn);
void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg);
void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg);
@@ -303,6 +306,11 @@ void Permedia2VideoUninit(ScrnInfoPtr pScrn);
void Permedia2VideoEnterVT(ScrnInfoPtr pScrn);
void Permedia2VideoLeaveVT(ScrnInfoPtr pScrn);
+void Permedia3VideoInit(ScreenPtr pScreen);
+void Permedia3VideoUninit(ScrnInfoPtr pScrn);
+void Permedia3VideoEnterVT(ScrnInfoPtr pScrn);
+void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn);
+
void Permedia2vOutIndReg(ScrnInfoPtr pScrn,
CARD32, unsigned char mask, unsigned char data);
unsigned char Permedia2vInIndReg(ScrnInfoPtr pScrn, CARD32);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man
index 5856b1360..59ae9427d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.2 2001/01/27 18:20:48 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.3 2001/03/19 22:50:28 alanh Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH GLINT __drivermansuffix__ __vendorversion__
@@ -57,8 +57,8 @@ The following driver
.B Options
are supported:
.TP
-.BI "Option \*qHWCursor\*q \*q" boolean \*q
-Enable or disable the HW cursor. Default: on.
+.BI "Option \*qUseFlatPanel\*q \*q" boolean \*q
+Enable the FlatPanel feature on the Permedia3. Default: off.
.TP
.BI "Option \*qSWCursor\*q \*q" boolean \*q
Enable or disable the SW cursor. Default: off.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
index 67ac50088..2272403c1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.21 2001/02/07 13:26:18 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.25 2001/03/28 11:10:56 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -353,9 +353,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
{
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n",
+ "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n",
major, minor, patch);
return FALSE;
}
@@ -365,6 +365,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
if (pGlint->numMultiDevices > 2) return FALSE;
+ if (pGlint->MultiChip != PCI_CHIP_MX) return FALSE;
+
pDRIInfo = DRICreateInfoRec();
if(pDRIInfo == NULL)
return FALSE;
@@ -427,6 +429,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = GLINTDRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &(pGlint->drmSubFD))) {
DRIDestroyInfoRec(pGlint->pDRIInfo);
xfree(pGlintDRI);
@@ -438,8 +443,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
drmVersionPtr version = drmGetVersion(pGlint->drmSubFD);
if (version) {
if (version->version_major != 1 ||
- version->version_minor != 0 ||
- version->version_patchlevel < 0) {
+ version->version_minor < 0) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"GLINTDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n",
@@ -587,6 +591,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n",
pGlint->drmBufs->count);
+ xf86EnablePciBusMaster(pGlint->PciInfo, TRUE);
+
/* tell the generic kernel driver how to handle Gamma DMA */
if (pGlint->irq <= 0) {
pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
index 638c2298c..e362f31d7 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
@@ -28,7 +28,7 @@
* this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen,
* Siemens Nixdorf Informationssysteme and Appian Graphics.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.117 2001/02/15 11:03:56 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.120 2001/03/19 22:50:28 alanh Exp $ */
#include "fb.h"
#include "cfb8_32.h"
@@ -67,6 +67,7 @@
#include "extensions/dpms.h"
#define DEBUG 0
+#define PM3Video 1
#if DEBUG
# define TRACE_ENTER(str) ErrorF("glint: " str " %d\n",pScrn->scrnIndex)
@@ -188,7 +189,8 @@ typedef enum {
OPTION_FIREGL3000,
OPTION_OVERLAY,
OPTION_SHADOW_FB,
- OPTION_FBDEV
+ OPTION_FBDEV,
+ OPTION_FLATPANEL
} GLINTOpts;
static OptionInfoRec GLINTOptions[] = {
@@ -200,6 +202,7 @@ static OptionInfoRec GLINTOptions[] = {
{ OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FLATPANEL, "UseFlatPanel", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -1145,6 +1148,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
pGlint->HWCursor ? "HW" : "SW");
+ if (xf86ReturnOptValBool(GLINTOptions, OPTION_FLATPANEL, FALSE)) {
+ pGlint->UseFlatPanel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Flat Panel Interface\n");
+ }
if (xf86ReturnOptValBool(GLINTOptions, OPTION_NOACCEL, FALSE)) {
pGlint->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
@@ -2490,6 +2497,10 @@ GLINTRestore(ScrnInfoPtr pScrn)
Permedia2VRestore(pScrn, glintReg);
break;
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3:
+#ifdef PM3Video
+ TRACE("PM3Video : VideoLeaveVT");
+ Permedia3VideoLeaveVT(pScrn);
+#endif
Permedia3Restore(pScrn, glintReg);
break;
case PCI_VENDOR_TI_CHIP_PERMEDIA:
@@ -2518,6 +2529,10 @@ GLINTRestore(ScrnInfoPtr pScrn)
(*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg);
break;
case PCI_CHIP_PERMEDIA3:
+#ifdef PM3Video
+ TRACE("PM3Video : VideoLeaveVT");
+ Permedia3VideoLeaveVT(pScrn);
+#endif
if (pGlint->numMultiDevices == 2) {
ACCESSCHIP2();
Permedia3Restore(pScrn, glintReg2);
@@ -2887,6 +2902,19 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2:
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V:
Permedia2VideoInit(pScreen);
+ break;
+#ifdef PM3Video
+ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoInit");
+ Permedia3VideoInit(pScreen);
+ break;
+ case PCI_VENDOR_3DLABS_CHIP_GAMMA:
+ switch (pGlint->MultiChip) {
+ case PCI_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoInit");
+ Permedia3VideoInit(pScreen);
+ }
+#endif
}
#if 0
@@ -3033,6 +3061,19 @@ GLINTEnterVT(int scrnIndex, int flags)
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2:
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V:
Permedia2VideoEnterVT(pScrn);
+ break;
+#ifdef PM3Video
+ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoEnterVT");
+ Permedia3VideoEnterVT(pScrn);
+ break;
+ case PCI_VENDOR_3DLABS_CHIP_GAMMA:
+ switch (pGlint->MultiChip) {
+ case PCI_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoEnterVT");
+ Permedia3VideoEnterVT(pScrn);
+ }
+#endif
}
if (!pGlint->NoAccel) {
@@ -3125,6 +3166,18 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen)
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2:
case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V:
Permedia2VideoUninit(pScrn);
+ break;
+#ifdef PM3Video
+ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoUninit");
+ Permedia3VideoUninit(pScrn);
+ case PCI_VENDOR_3DLABS_CHIP_GAMMA:
+ switch (pGlint->MultiChip) {
+ case PCI_CHIP_PERMEDIA3:
+ TRACE("PM3Video : VideoUninit");
+ Permedia3VideoUninit(pScrn);
+ }
+#endif
}
if (pScrn->vtSema) {
@@ -3170,6 +3223,7 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen)
static void
GLINTFreeScreen(int scrnIndex, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
TRACE_ENTER("GLINTFreeScreen");
if (xf86LoaderCheckSymbol("fbdevHWFreeRec"))
fbdevHWFreeRec(xf86Screens[scrnIndex]);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c
index ef3a1b1bb..532c56178 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c
@@ -30,7 +30,7 @@
*
* Permedia 2 accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.28 2001/02/15 11:03:57 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.29 2001/02/27 23:04:59 alanh Exp $ */
#include "Xarch.h"
#include "xf86.h"
@@ -1004,7 +1004,7 @@ SECOND_PASS:
height = h;
srcpntr = src;
while(height--) {
- GLINT_WAIT(dwords);
+ GLINT_WAIT(dwords + 1);
/* 0x0D is the TAG value for BitMaskPattern */
GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO);
GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c
index 0279a584a..91b0b9419 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c
@@ -27,7 +27,7 @@
* this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and
* Siemens Nixdorf Informationssysteme
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.24 2001/02/07 13:26:20 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.25 2001/02/27 18:47:25 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -177,7 +177,7 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->DacRegs[PM2VDACRDDClk0PostScale] = p;
}
- pReg->DacRegs[PM2VDACRDIndexControl] = 0x00;
+ pReg->glintRegs[PM2VDACRDIndexControl >> 3] = 0x00;
if (pScrn->rgbBits == 8)
pReg->DacRegs[PM2VDACRDMiscControl] = 0x01; /* 8bit DAC */
@@ -262,8 +262,8 @@ Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
glintReg->cmap[i] = Permedia2ReadData(pScrn);
}
- glintReg->DacRegs[PM2VDACRDIndexControl] =
- Permedia2vInIndReg(pScrn, PM2VDACRDIndexControl);
+ glintReg->glintRegs[PM2VDACRDIndexControl >> 3] =
+ GLINT_READ_REG(PM2VDACRDIndexControl);
glintReg->DacRegs[PM2VDACRDOverlayKey] =
Permedia2vInIndReg(pScrn, PM2VDACRDOverlayKey);
glintReg->DacRegs[PM2VDACRDSyncControl] =
@@ -323,8 +323,8 @@ Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart);
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd);
- Permedia2vOutIndReg(pScrn, PM2VDACRDIndexControl, 0x00,
- glintReg->DacRegs[PM2VDACRDIndexControl]);
+ GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM2VDACRDIndexControl >> 3],
+ PM2VDACRDIndexControl);
Permedia2vOutIndReg(pScrn, PM2VDACRDOverlayKey, 0x00,
glintReg->DacRegs[PM2VDACRDOverlayKey]);
Permedia2vOutIndReg(pScrn, PM2VDACRDSyncControl, 0x00,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
index 604ed1533..4cf9a4a31 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
@@ -26,7 +26,7 @@
*
* Permedia 3 accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.22 2001/02/05 15:10:43 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.23 2001/02/27 23:04:59 alanh Exp $ */
#include "Xarch.h"
#include "xf86.h"
@@ -846,7 +846,12 @@ Permedia3SubsequentScanlineCPUToScreenColorExpandFill(
PM3Render2D_Width(w) | PM3Render2D_Height(h),
PM3Render2D);
- if ((pGlint->dwords*h) < pGlint->FIFOSize) {
+#if defined(__alpha__)
+ if (0) /* force Alpha to use indirect always */
+#else
+ if ((pGlint->dwords*h) < pGlint->FIFOSize)
+#endif
+ {
/* Turn on direct for less than 120 dword colour expansion */
pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4;
pGlint->ScanlineDirect = 1;
@@ -931,7 +936,12 @@ static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
PM3Render2D_Width(w) | PM3Render2D_Height(h),
PM3Render2D);
- if (pGlint->dwords < pGlint->FIFOSize) {
+#if defined(__alpha__)
+ if (0) /* force Alpha to use indirect always */
+#else
+ if (pGlint->dwords < pGlint->FIFOSize)
+#endif
+ {
/* Turn on direct for less than 120 dword colour expansion */
pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4;
pGlint->ScanlineDirect = 1;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
index 2cdcbbea4..29b0a7715 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
@@ -26,7 +26,7 @@
* this work is sponsored by Appian Graphics.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.18 2001/02/05 10:44:58 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.22 2001/03/20 19:08:58 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -305,21 +305,22 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg)
temp1 = 0;
temp2 = 0;
-#if 0 /* Currently commented out while testing Flat Panel support */
- temp1 |= 0x40;
- temp2 |= 0x01;
- STOREREG(VSConfiguration,
- (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06));
- STOREREG(VSBBase, 1<<14);
-#endif
- if (mode->Flags & V_PHSYNC) temp1 |= 0x01; /* invert hsync */
- if (mode->Flags & V_PVSYNC) temp1 |= 0x08; /* invert vsync */
+ temp3 = 0;
+
+ if (pGlint->UseFlatPanel) {
+ temp2 |= PM3RD_DACControl_BLANK_PEDESTAL_ENABLE;
+ temp3 |= PM3RD_MiscControl_VSB_OUTPUT_ENABLE;
+ STOREREG(VSConfiguration, 0x06);
+ STOREREG(VSBBase, 1<<14);
+ }
+
+ if (mode->Flags & V_PHSYNC) temp1 |= PM3RD_SyncControl_HSYNC_ACTIVE_HIGH;
+ if (mode->Flags & V_PVSYNC) temp1 |= PM3RD_SyncControl_VSYNC_ACTIVE_HIGH;
- STOREDAC(PM2VDACRDIndexControl, 0x00);
+ STOREREG(PM2VDACRDIndexControl, 0x00);
STOREDAC(PM2VDACRDSyncControl, temp1);
- STOREDAC(PM2VDACRDDACControl, 0x00);
+ STOREDAC(PM2VDACRDDACControl, temp2);
- temp3 = 0;
if (pScrn->rgbBits == 8)
temp3 |= 0x01; /* 8bit DAC */
@@ -352,6 +353,8 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg)
}
STOREDAC(PM2VDACRDMiscControl, temp3);
+ STOREREG(PM3FifoControl, 0x905); /* Lower the default fifo threshold */
+
return(TRUE);
}
@@ -383,6 +386,7 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg)
SAVEREG(ChipConfig);
SAVEREG(Aperture0);
SAVEREG(Aperture1);
+ SAVEREG(PM3FifoControl);
if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)
SAVEREG(DFIFODis);
@@ -400,17 +404,17 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg)
SAVEREG(PMScreenBase);
SAVEREG(PMVideoControl);
SAVEREG(VClkCtl);
-#if 0 /* Currently commented out while testing Flat Panel support */
- SAVEREG(VSConfiguration);
- SAVEREG(VSBBase);
-#endif
+ if (pGlint->UseFlatPanel) {
+ SAVEREG(VSConfiguration);
+ SAVEREG(VSBBase);
+ }
for (i=0;i<768;i++) {
Permedia2ReadAddress(pScrn, i);
pReg->cmap[i] = Permedia2ReadData(pScrn);
}
- P2VIN(PM2VDACRDIndexControl);
+ SAVEREG(PM2VDACRDIndexControl);
P2VIN(PM2VDACRDOverlayKey);
P2VIN(PM2VDACRDSyncControl);
P2VIN(PM2VDACRDMiscControl);
@@ -452,6 +456,7 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg)
RESTOREREG(ChipConfig);
RESTOREREG(Aperture0);
RESTOREREG(Aperture1);
+ RESTOREREG(PM3FifoControl);
if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)
RESTOREREG(DFIFODis);
RESTOREREG(FIFODis);
@@ -469,12 +474,12 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg)
RESTOREREG(PMVsStart);
RESTOREREG(PMVsEnd);
-#if 0 /* Currently commented out while testing Flat Panel support */
- RESTOREREG(VSConfiguration);
- RESTOREREG(VSBBase);
-#endif
+ if (pGlint->UseFlatPanel) {
+ RESTOREREG(VSConfiguration);
+ RESTOREREG(VSBBase);
+ }
- P2VOUT(PM2VDACRDIndexControl);
+ RESTOREREG(PM2VDACRDIndexControl);
P2VOUT(PM2VDACRDOverlayKey);
P2VOUT(PM2VDACRDSyncControl);
P2VOUT(PM2VDACRDMiscControl);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
index 42946b213..0b6685177 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.4 2001/01/31 16:15:02 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.5 2001/02/24 14:29:18 alanh Exp $ */
/*
* glint register file
@@ -157,22 +157,78 @@
#define PM3MiscControl 0x3088
#define PM3VideoOverlayUpdate 0x3100
+ #define PM3VideoOverlayUpdate_DISABLE (0<<0)
+ #define PM3VideoOverlayUpdate_ENABLE (1<<0)
#define PM3VideoOverlayMode 0x3108
#define PM3VideoOverlayMode_DISABLE (0<<0)
#define PM3VideoOverlayMode_ENABLE (1<<0)
- /* ... */
+ #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1)
+ #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1)
+ #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1)
+ #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4)
+ #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4)
+ #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5)
+ #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5)
+ #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5)
+ #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5))
+ #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5))
+ #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12)
+ #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12)
+ #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13)
+ #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13)
+ #define PM3VideoOverlayMode_FILTER_OFF (0<<14)
+ #define PM3VideoOverlayMode_FILTER_FULL (1<<14)
+ #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14)
+ #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16)
+ #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16)
+ #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18)
+ #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18)
+ #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20)
+ #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20)
+ #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20)
+ #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23)
+ #define PM3VideoOverlayMode_MIRRORX_ON (1<<23)
+ #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24)
+ #define PM3VideoOverlayMode_MIRRORY_ON (1<<24)
#define PM3VideoOverlayFifoControl 0x3110
#define PM3VideoOverlayIndex 0x3118
#define PM3VideoOverlayBase0 0x3120
#define PM3VideoOverlayBase1 0x3128
#define PM3VideoOverlayBase2 0x3130
#define PM3VideoOverlayStride 0x3138
+ #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0)
#define PM3VideoOverlayWidth 0x3140
+ #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0)
#define PM3VideoOverlayHeight 0x3148
+ #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0)
#define PM3VideoOverlayOrigin 0x3150
+ #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0)
+ #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16)
#define PM3VideoOverlayShrinkXDelta 0x3158
+ #define PM3VideoOverlayShrinkXDelta_NONE (1<<16)
+ #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \
+ ((((s)<<16)/(d))&0x0ffffff0)
#define PM3VideoOverlayZoomXDelta 0x3160
+ #define PM3VideoOverlayZoomXDelta_NONE (1<<16)
+ #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \
+ ((((s)<<16)/(d))&0x0001fff0)
#define PM3VideoOverlayYDelta 0x3168
+ #define PM3VideoOverlayYDelta_NONE (1<<16)
+ #define PM3VideoOverlayYDelta_DELTA(s,d) \
+ ((((s)<<16)/(d))&0x0ffffff0)
#define PM3VideoOverlayFieldOffset 0x3170
#define PM3VideoOverlayStatus 0x3178
@@ -314,6 +370,18 @@
#define PM3RD_Scratch 0x01f
#define PM3RD_VideoOverlayControl 0x020
+ #define PM3RD_VideoOverlayControl_DISABLE (0<<0)
+ #define PM3RD_VideoOverlayControl_ENABLE (1<<0)
+ #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1)
+ #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1)
+ #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1)
+ #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1)
+ #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3)
+ #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3)
+ #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4)
+ #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4)
+ #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5)
+ #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5)
#define PM3RD_VideoOverlayXStartLow 0x021
#define PM3RD_VideoOverlayXStartHigh 0x022
#define PM3RD_VideoOverlayYStartLow 0x023
@@ -326,6 +394,10 @@
#define PM3RD_VideoOverlayKeyG 0x02a
#define PM3RD_VideoOverlayKeyB 0x02b
#define PM3RD_VideoOverlayBlend 0x02c
+ #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6)
+ #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6)
+ #define PM3RD_VideoOverlayBlend_FACTOR_59_PERCENT (2<<6)
+ #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (3<<6)
#define PM3RD_DClkSetup1 0x1f0
#define PM3RD_DClkSetup2 0x1f1
@@ -840,6 +912,23 @@
#define PM3TextureIndexMode1And 0xb3d0
#define PM3TextureIndexMode1Or 0xb3d8
/* ... */
+#define PM3TextureMapSize 0xb428
+#define PM3TextureMapWidth0 0x8580
+#define PM3TextureMapWidth1 0x8588
+ #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0)
+ #define PM3TextureMapWidth_BorderLayout (1<<12)
+ #define PM3TextureMapWidth_Layout_Linear (0<<13)
+ #define PM3TextureMapWidth_Layout_Patch64 (1<<13)
+ #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13)
+ #define PM3TextureMapWidth_Layout_Patch2 (3<<13)
+ #define PM3TextureMapWidth_HostTexture (1<<15)
+#define PM3TextureReadMode0 0xb400
+#define PM3TextureReadMode0And 0xac30
+#define PM3TextureReadMode0Or 0xac38
+#define PM3TextureReadMode1 0xb408
+#define PM3TextureReadMode1And 0xad40
+#define PM3TextureReadMode1Or 0xad48
+/* ... */
#define PM3WaitForCompletion 0x80b8
#define PM3Window 0x8980
#define PM3Window_ForceLBUpdate 1<<3
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c
new file mode 100644
index 000000000..400442b8b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c
@@ -0,0 +1,1249 @@
+/*
+ * Permedia 3 Xv Driver
+ *
+ * Copyright (C) 2001 Sven Luther <luther@dpt-info.u-strasbg.fr>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ *
+ * Based on work of Michael H. Schimek <m.schimek@netway.at>
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.1 2001/02/24 14:29:19 alanh Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xf86Xinput.h"
+#include "xf86fbman.h"
+#include "xf86xv.h"
+#include "Xv.h"
+
+#include "glint_regs.h"
+#include "pm3_regs.h"
+#include "glint.h"
+
+#ifndef XvExtension
+
+void Permedia3VideoInit(ScreenPtr pScreen) {}
+void Permedia3VideoUninit(ScrnInfoPtr pScrn) {}
+void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) {}
+void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {}
+
+#else
+
+#undef MIN
+#undef ABS
+#undef CLAMP
+#undef ENTRIES
+
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define ABS(n) (((n) < 0) ? -(n) : (n))
+#define CLAMP(v, min, max) (((v) < (min)) ? (min) : MIN(v, max))
+#define ENTRIES(array) (sizeof(array) / sizeof((array)[0]))
+
+#define ADAPTORS 1
+#define PORTS 1
+
+#define MAX_BUFFERS 3
+
+typedef struct {
+ CARD32 xy, wh; /* 16.0 16.0 */
+ INT32 s, t; /* 12.20 fp */
+ short y1, y2;
+} CookieRec, *CookiePtr;
+
+typedef struct _PortPrivRec {
+ struct _AdaptorPrivRec * pAdaptor;
+
+ INT32 Attribute[8]; /* Brig, Con, Sat, Hue, Int, Filt, BkgCol, Alpha */
+
+ int BuffersRequested;
+ int BuffersAllocated;
+ FBAreaPtr pFBArea[MAX_BUFFERS];
+ CARD32 BufferBase[MAX_BUFFERS]; /* FB byte offset */
+ int CurrentBuffer;
+ CARD32 BufferStride; /* bytes */
+
+ INT32 vx, vy, vw, vh; /* 12.10 fp */
+ int dx, dy, dw, dh;
+ int fw, fh;
+
+ int Id, Bpp; /* Scaler */
+
+ int Plug;
+ int BkgCol; /* RGB 5:6:5; 5:6:5 */
+ int StopDelay;
+
+
+} PortPrivRec, *PortPrivPtr;
+
+enum { VIDEO_OFF, VIDEO_ONE_SHOT, VIDEO_ON };
+
+typedef struct _LFBAreaRec {
+ struct _LFBAreaRec * Next;
+ int Linear;
+ FBAreaPtr pFBArea;
+} LFBAreaRec, *LFBAreaPtr;
+
+typedef struct _AdaptorPrivRec {
+ struct _AdaptorPrivRec * Next;
+ ScrnInfoPtr pScrn;
+
+ OsTimerPtr Timer;
+ int TimerUsers;
+ int Delay, Instant;
+
+ int FramesPerSec;
+ int FrameLines;
+ int IntLine; /* Frame, not field */
+ int LinePer; /* nsec */
+
+ int VideoStd;
+
+ PortPrivRec Port[PORTS];
+
+} AdaptorPrivRec, *AdaptorPrivPtr;
+
+static AdaptorPrivPtr AdaptorPrivList = NULL;
+
+#define PORTNUM(p) ((int)((p) - &pAPriv->Port[0]))
+
+#define DEBUG(x) x
+
+static const Bool ColorBars = FALSE;
+
+/*
+ * Attributes
+ */
+
+#define XV_ENCODING "XV_ENCODING"
+#define XV_BRIGHTNESS "XV_BRIGHTNESS"
+#define XV_CONTRAST "XV_CONTRAST"
+#define XV_SATURATION "XV_SATURATION"
+#define XV_HUE "XV_HUE"
+
+/* Proprietary */
+
+#define XV_INTERLACE "XV_INTERLACE" /* Interlaced (bool) */
+#define XV_FILTER "XV_FILTER" /* Bilinear filter (bool) */
+#define XV_BKGCOLOR "XV_BKGCOLOR" /* Output background (0x00RRGGBB) */
+#define XV_ALPHA "XV_ALPHA" /* Scaler alpha channel (bool) */
+
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue;
+static Atom xvInterlace, xvFilter, xvBkgColor, xvAlpha;
+
+
+/* Scaler */
+
+static XF86VideoEncodingRec
+ScalerEncodings[] =
+{
+ { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }},
+};
+
+static XF86AttributeRec
+ScalerAttributes[] =
+{
+ { XvSettable | XvGettable, 0, 1, XV_FILTER },
+ { XvSettable | XvGettable, 0, 1, XV_ALPHA },
+};
+
+static XF86VideoFormatRec
+ScalerVideoFormats[] =
+{
+ { 8, TrueColor }, /* Dithered */
+ { 15, TrueColor },
+ { 16, TrueColor },
+ { 24, TrueColor },
+};
+
+/*
+ * FOURCC from http://www.webartz.com/fourcc
+ * Generic GUID for legacy FOURCC XXXXXXXX-0000-0010-8000-00AA00389B71
+ */
+#define LE4CC(a,b,c,d) (((CARD32)(a)&0xFF)|(((CARD32)(b)&0xFF)<<8)|(((CARD32)(c)&0xFF)<<16)|(((CARD32)(d)&0xFF)<<24))
+#define GUID4CC(a,b,c,d) { a,b,c,d,0,0,0,0x10,0x80,0,0,0xAA,0,0x38,0x9B,0x71 }
+
+#define NoOrder LSBFirst
+
+static XF86ImageRec
+ScalerImages[] =
+{
+ /* Planar YVU 4:2:0 (emulated) */
+ { LE4CC('Y','V','1','2'), XvYUV, NoOrder, GUID4CC('Y','V','1','2'),
+ 12, XvPlanar, 3, 0, 0, 0, 0,
+ 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU", XvTopToBottom },
+
+ /* Packed YUYV 4:2:2 */
+ { LE4CC('Y','U','Y','2'), XvYUV, NoOrder, GUID4CC('Y','U','Y','2'),
+ 16, XvPacked, 1, 0, 0, 0, 0,
+ 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUYV", XvTopToBottom },
+
+ /* Packed UYVY 4:2:2 */
+ { LE4CC('U','Y','V','Y'), XvYUV, NoOrder, GUID4CC('U','Y','V','Y'),
+ 16, XvPacked, 1, 0, 0, 0, 0,
+ 8, 8, 8, 1, 2, 2, 1, 1, 1, "UYVY", XvTopToBottom },
+
+ /* Packed YUVA 4:4:4 */
+ { LE4CC('Y','U','V','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 },
+ 32, XvPacked, 1, 0, 0, 0, 0,
+ 8, 8, 8, 1, 1, 1, 1, 1, 1, "YUVA", XvTopToBottom },
+
+ /* Packed VUYA 4:4:4 */
+ { LE4CC('V','U','Y','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 },
+ 32, XvPacked, 1, 0, 0, 0, 0,
+ 8, 8, 8, 1, 1, 1, 1, 1, 1, "VUYA", XvTopToBottom },
+
+ /* RGBA 8:8:8:8 */
+ { 0x41, XvRGB, LSBFirst, { 0 },
+ 32, XvPacked, 1, 24, 0x0000FF, 0x00FF00, 0xFF0000,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom },
+
+ /* RGB 5:6:5 */
+ { 0x42, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 16, 0x001F, 0x07E0, 0xF800,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom },
+
+ /* RGBA 5:5:5:1 */
+ { 0x43, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 15, 0x001F, 0x03E0, 0x7C00,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom },
+
+ /* RGBA 4:4:4:4 */
+ { 0x44, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 12, 0x000F, 0x00F0, 0x0F00,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom },
+
+ /* RGB 3:3:2 */
+ { 0x46, XvRGB, NoOrder, { 0 },
+ 8, XvPacked, 1, 8, 0x07, 0x38, 0xC0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom },
+
+ /* BGRA 8:8:8:8 */
+ { 0x47, XvRGB, LSBFirst, { 0 },
+ 32, XvPacked, 1, 24, 0xFF0000, 0x00FF00, 0x0000FF,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom },
+
+ /* BGR 5:6:5 */
+ { 0x48, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 16, 0xF800, 0x07E0, 0x001F,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom },
+
+ /* BGRA 5:5:5:1 */
+ { 0x49, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 15, 0x7C00, 0x03E0, 0x001F,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom },
+
+ /* BGRA 4:4:4:4 */
+ { 0x4A, XvRGB, LSBFirst, { 0 },
+ 16, XvPacked, 1, 12, 0x0F00, 0x00F0, 0x000F,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom },
+
+ /* BGR 2:3:3 */
+ { 0x4C, XvRGB, NoOrder, { 0 },
+ 8, XvPacked, 1, 8, 0xC0, 0x38, 0x07,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom },
+};
+
+/*
+ * Buffer management
+ */
+
+static void
+RemoveAreaCallback(FBAreaPtr pFBArea)
+{
+ PortPrivPtr pPPriv = (PortPrivPtr) pFBArea->devPrivate.ptr;
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+ DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;)
+ int i;
+
+ /* Well, for each buffer, just do nothing ? */
+ for (i = 0; i < MAX_BUFFERS && pPPriv->pFBArea[i] != pFBArea; i++);
+
+ if (i >= MAX_BUFFERS)
+ return;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
+ "RemoveAreaCallback port #%d, buffer #%d, pFB=%p, off=0x%08x\n",
+ PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i]));
+
+ for (; i < MAX_BUFFERS - 1; i++)
+ pPPriv->pFBArea[i] = pPPriv->pFBArea[i + 1];
+
+ pPPriv->pFBArea[MAX_BUFFERS - 1] = NULL;
+
+ pPPriv->BuffersAllocated--;
+}
+
+static void
+RemoveableBuffers(PortPrivPtr pPPriv, Bool remove)
+{
+ int i;
+
+ for (i = 0; i < MAX_BUFFERS; i++)
+ if (pPPriv->pFBArea[i])
+ pPPriv->pFBArea[i]->RemoveAreaCallback =
+ remove ? RemoveAreaCallback : NULL;
+}
+
+static void
+FreeBuffers(PortPrivPtr pPPriv)
+{
+ DEBUG(AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;)
+ DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;)
+ int i;
+
+ RemoveableBuffers(pPPriv, FALSE);
+
+ for (i = MAX_BUFFERS - 1; i >= 0; i--)
+ if (pPPriv->pFBArea[i]) {
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "FreeBuffers port #%d, buffer #%d, pFB=%p, off=0x%08x\n",
+ PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i]));
+
+ xf86FreeOffscreenArea(pPPriv->pFBArea[i]);
+
+ pPPriv->pFBArea[i] = NULL;
+ }
+
+ pPPriv->BuffersAllocated = 0;
+}
+
+enum { FORCE_LINEAR = 1, FORCE_RECT };
+
+static int
+AllocateBuffers(PortPrivPtr pPPriv,
+ int w, int h, int bytespp,
+ int num, int force)
+{
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+ ScrnInfoPtr pScrn = pAPriv->pScrn;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ Bool linear = (force != FORCE_RECT);
+ int i;
+ if (!linear) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Sorry, only linear buffers allowed right now ...\n");
+ return 0;
+ }
+ FreeBuffers(pPPriv);
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : Tryig ot allocate (%d) %s buffer with : %dx%d, bpp = %d.\n",
+ num, (force==FORCE_RECT)?"rectangular":"linear", w, h, bytespp));
+ for (i = 0; i < num; i++) {
+ if (linear) {
+ pPPriv->BufferStride = w * bytespp;
+
+ /* Well, we need to set alignement correctly ... */
+#if 0
+ pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen,
+ (pPPriv->BufferStride * h
+ + (1 << pGlint->BppShift) -1) >> pGlint->BppShift,
+ 16 >> pGlint->BppShift, NULL, NULL, (pointer) pPPriv);
+#endif
+ pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen,
+ pPPriv->BufferStride * h, 0, NULL, NULL, (pointer) pPPriv);
+ /* Well, not that we have allocated a buffer, let's see
+ * to what it correspond in the cards memory space ... */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : Let's see what kind of buffer got allocated ...\n"
+ "\t BOX : x1 = %d, y1 = %d, x2 = %d, y2 = %d.\n"
+ "\t pScrn->virtualX = %d, pGlint->BppShift = %d.\n",
+ pPPriv->pFBArea[i]->box.x1, pPPriv->pFBArea[i]->box.y1,
+ pPPriv->pFBArea[i]->box.x2, pPPriv->pFBArea[i]->box.y2,
+ pScrn->virtualX, pGlint->BppShift));
+
+ if (pPPriv->pFBArea[i])
+ pPPriv->BufferBase[i] =
+ ((pPPriv->pFBArea[i]->box.y1 * pScrn->virtualX) +
+ pPPriv->pFBArea[i]->box.x1) << pGlint->BppShift;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "New linear buffer %dx%d, rec %dx%d -> pFB=%p, off=0x%08x\n"
+ "\tNotice : Framebuffer is at : 0x%08x, 0x%08x.\n",
+ w, h, pPPriv->BufferStride, h, pPPriv->pFBArea[i],
+ pPPriv->BufferBase[i], pGlint->FbAddress, pGlint->FbBase));
+ } else {
+#if 0
+ /* SVEN : well for now, all buffers are linear, so we don't need
+ * to worry. */
+ pPPriv->BufferStride = pScrn->displayWidth << BPPSHIFT(pGlint);
+ pPPriv->pFBArea[i] = xf86AllocateOffscreenArea(pScrn->pScreen,
+ w, h, 8 >> BPPSHIFT(pGlint), NULL, NULL, (pointer) pPPriv);
+ if (pPPriv->pFBArea[i])
+ pPPriv->BufferBase[i] =
+ ((pPPriv->pFBArea[i]->box.y1 * pScrn->displayWidth) +
+ pPPriv->pFBArea[i]->box.x1) << BPPSHIFT(pGlint);
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
+ "New rect buffer %dx%d, stride %d, pFB=%p, off=0x%08x\n",
+ w, h, pPPriv->BufferStride, pPPriv->pFBArea[i],
+ pPPriv->BufferBase[i]));
+#endif
+ }
+ if (pPPriv->pFBArea[i])
+ continue;
+ }
+
+ return pPPriv->BuffersAllocated = i;
+ return pPPriv->CurrentBuffer = 0;
+}
+
+/* os/WaitFor.c */
+
+static CARD32
+TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p)
+{
+ AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) p;
+ int i;
+
+ for (i = 0; i <= PORTS; i++) {
+ if (pAPriv->Port[i].StopDelay >= 0) {
+ if (!(pAPriv->Port[i].StopDelay--)) {
+ FreeBuffers(&pAPriv->Port[i]);
+ pAPriv->TimerUsers &= ~(1 << i);
+ }
+ }
+ }
+
+ if (pAPriv->TimerUsers)
+ return pAPriv->Instant;
+
+ return 0; /* Cancel */
+}
+
+/*
+ * Xv interface
+ */
+
+static void
+CopyYV12LE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
+{
+ int Y_size = width * height;
+ CARD8 *V = Y + Y_size;
+ CARD8 *U = V + (Y_size >> 2);
+ int pad = (pitch >> 2) - (width >> 1);
+ int x;
+
+ width >>= 1;
+
+ for (height >>= 1; height > 0; height--) {
+ for (x = 0; x < width; Y += 2, x++)
+ *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24);
+ dst += pad;
+ for (x = 0; x < width; Y += 2, x++)
+ *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24);
+ dst += pad;
+ U += width;
+ V += width;
+ }
+}
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+
+static void
+CopyYV12BE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
+{
+ int Y_size = width * height;
+ CARD8 *V = Y + Y_size;
+ CARD8 *U = V + (Y_size >> 2);
+ int pad = (pitch >> 2) - (width >> 1);
+ int x;
+
+ width >>= 1;
+
+ for (height >>= 1; height > 0; height--) {
+ for (x = 0; x < width; Y += 2, x++)
+ *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24);
+ dst += pad;
+ for (x = 0; x < width; Y += 2, x++)
+ *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24);
+ dst += pad;
+ U += width;
+ V += width;
+ }
+}
+
+#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */
+
+static void
+CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch)
+{
+ if (width == pitch) {
+ memcpy(dst, src, width * height);
+ return;
+ }
+
+ while (height > 0) {
+ memcpy(dst, src, width);
+ dst += pitch;
+ src += width;
+ height--;
+ }
+}
+
+#define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888
+#define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444
+#define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551
+#define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565
+#define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332
+#define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888
+#define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444
+#define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551
+#define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565
+#define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332
+#define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8
+#define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444
+#define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444
+#define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422
+#define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422
+
+#define RAMDAC_WRITE(data,index) \
+do{ \
+ mem_barrier(); \
+ GLINT_WAIT(3); \
+ mem_barrier(); \
+ GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \
+ mem_barrier(); \
+ GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \
+ mem_barrier(); \
+ GLINT_WRITE_REG(data, PM3RD_IndexedData); \
+ mem_barrier(); \
+}while(0)
+
+/* Notice, have to check that we dont overflow the deltas here ... */
+static void
+compute_scale_factor(
+ unsigned int* src_w, unsigned int* dst_w,
+ unsigned int* shrink_delta, unsigned int* zoom_delta)
+{
+ if (*src_w >= *dst_w) {
+ *dst_w &= ~0x3;
+ *shrink_delta = (((*src_w << 16) / *dst_w) & 0x0ffffff0) + 0x10;
+ *zoom_delta = 1<<16;
+ } else {
+ if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4;
+ *shrink_delta = 1<<16;
+ for (;*dst_w > *src_w; *dst_w--) {
+ *zoom_delta = (*src_w << 16) / *dst_w;
+ if (((((*zoom_delta&0xf)+1) * *dst_w * *dst_w) >> 16) < *src_w) {
+ *zoom_delta = ((*zoom_delta & ~0xf) + 0x10) & 0x0001fff0;
+ return;
+ }
+ }
+ *zoom_delta = 1<<16;
+ }
+}
+
+/* BeginOverlay ...
+ * This is still not workign correctly, in particular if we are
+ * using shrinking, since what we have to check is not a multiple of 4
+ * width is the shrinked width, not the original width.
+ */
+static void
+BeginOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num,
+ int format, int bpp_shift, int alpha)
+{
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+ ScrnInfoPtr pScrn = pAPriv->pScrn;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ unsigned int src_w = pPPriv->vw;
+ unsigned int dst_w = pPPriv->dw;
+ unsigned int shrink_delta, zoom_delta;
+
+ /* Let's adjust the width of source and dest to be compliant with
+ * the Permedia3 overlay unit requirement, and compute the X deltas. */
+ compute_scale_factor(&src_w, &dst_w, &shrink_delta, &zoom_delta);
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "BeginOverlay %08x %08x %d %d\n",
+ BufferBase[0], format, bpp_shift, alpha));
+ if (src_w != pPPriv->vw)
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "BeginOverlay : Padding video width to 4 pixels %d->%d.\n",
+ pPPriv->vw, src_w));
+ if (dst_w != pPPriv->dw)
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "BeginOverlay : Scaling destination width from %d to %d.\n"
+ "\tThe scaling factor is to high, and may cause problems.",
+ pPPriv->dw, dst_w));
+ if (alpha)
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "BeginOverlay Sorry, Alpha is not yet supported, disabling it.\n"));
+
+ GLINT_WAIT(12);
+ GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl);
+ /* Updating the Video Overlay Source Image Parameters */
+ switch (num) {
+ case 0:
+ GLINT_WRITE_REG((BufferBase[0]>>bpp_shift), PM3VideoOverlayBase0);
+ break;
+ case 1:
+ GLINT_WRITE_REG((BufferBase[1]>>bpp_shift), PM3VideoOverlayBase1);
+ break;
+ case 2:
+ GLINT_WRITE_REG((BufferBase[2]>>bpp_shift), PM3VideoOverlayBase2);
+ break;
+ }
+ GLINT_WRITE_REG(num, PM3VideoOverlayIndex);
+ GLINT_WRITE_REG(format |
+ PM3VideoOverlayMode_BUFFERSYNC_MANUAL |
+ PM3VideoOverlayMode_FLIP_VIDEO |
+ PM3VideoOverlayMode_FILTER_FULL |
+ PM3VideoOverlayMode_ENABLE,
+ PM3VideoOverlayMode);
+ /* Let's set the source stride. */
+ GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pPPriv->fw),
+ PM3VideoOverlayStride);
+ /* Let's set the position and size of the visible part of the source. */
+ GLINT_WRITE_REG(PM3VideoOverlayWidth_WIDTH(src_w),
+ PM3VideoOverlayWidth);
+ GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(pPPriv->vh),
+ PM3VideoOverlayHeight);
+ GLINT_WRITE_REG(
+ PM3VideoOverlayOrigin_XORIGIN(pPPriv->vx) |
+ PM3VideoOverlayOrigin_YORIGIN(pPPriv->vy),
+ PM3VideoOverlayOrigin);
+ /* Scale the source to the destinationsize */
+ if (pPPriv->vh == pPPriv->dh) {
+ GLINT_WRITE_REG(
+ PM3VideoOverlayYDelta_NONE,
+ PM3VideoOverlayYDelta);
+ } else {
+ GLINT_WRITE_REG(
+ PM3VideoOverlayYDelta_DELTA(pPPriv->vh,pPPriv->dh),
+ PM3VideoOverlayYDelta);
+ }
+ GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta);
+ GLINT_WRITE_REG(zoom_delta, PM3VideoOverlayZoomXDelta);
+ /* Launch the true update at the next FrameBlank */
+ GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE,
+ PM3VideoOverlayUpdate);
+ /* Setting the ramdac video overlay rgion */
+ /* Begining of overlay region */
+ RAMDAC_WRITE((pPPriv->dx&0xff), PM3RD_VideoOverlayXStartLow);
+ RAMDAC_WRITE((pPPriv->dx&0xf00)>>8, PM3RD_VideoOverlayXStartHigh);
+ RAMDAC_WRITE((pPPriv->dy&0xff), PM3RD_VideoOverlayYStartLow);
+ RAMDAC_WRITE((pPPriv->dy&0xf00)>>8, PM3RD_VideoOverlayYStartHigh);
+ /* End of overlay regions (+1) */
+ RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xff), PM3RD_VideoOverlayXEndLow);
+ RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh);
+ RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xff), PM3RD_VideoOverlayYEndLow);
+ RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh);
+
+ /* And now enable Video Overlay in the RAMDAC */
+ RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE |
+ PM3RD_VideoOverlayControl_MODE_ALWAYS,
+ PM3RD_VideoOverlayControl);
+
+ /* Let's use a double buffering scheme */
+ pPPriv->CurrentBuffer = 1-pPPriv->CurrentBuffer;
+}
+
+static void
+StopOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, int cleanup)
+{
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+ ScrnInfoPtr pScrn = pAPriv->pScrn;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "StopOverlay.\n"));
+ /* Stop the Video Overlay in the RAMDAC */
+ RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE,
+ PM3RD_VideoOverlayControl);
+ /* Stop the Video Overlay in the Video Overlay Unit */
+ GLINT_WAIT(1);
+ GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE,
+ PM3VideoOverlayMode);
+}
+static int
+Permedia3PutImage(ScrnInfoPtr pScrn,
+ short src_x, short src_y, short drw_x, short drw_y,
+ short src_w, short src_h, short drw_w, short drw_h,
+ int id, unsigned char *buf, short width, short height,
+ Bool sync, RegionPtr clipBoxes, pointer data)
+{
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ int i;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "PutImage %d,%d,%d,%d -> %d,%d,%d,%d id=0x%08x buf=%p w=%d h=%d sync=%d\n",
+ src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h,
+ id, buf, width, height, sync));
+
+ /* SVEN : Let's check if the source window is contained in the
+ * actual source */
+ if ((src_x + src_w) > width ||
+ (src_y + src_h) > height)
+ return BadValue;
+
+ pPPriv->vx = src_x;
+ pPPriv->vy = src_y;
+ pPPriv->vw = src_w;
+ pPPriv->vh = src_h;
+
+ pPPriv->dx = drw_x;
+ pPPriv->dy = drw_y;
+ pPPriv->dw = drw_w;
+ pPPriv->dh = drw_h;
+
+ /* SVEN : Let's check if there is a allocated buffer already of the same
+ * id, width and height. If yes, use it, if not, we need to allocate one.
+ */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : PutImage Do we need to allocate buffers ?\n"
+ "\t existing : buffers = %d, id = %d, fw = %d, fh = %d.\n"
+ "\t requested : buffers = %d, id = %d, fw = %d, fh = %d.\n",
+ pPPriv->BuffersAllocated, pPPriv->Id, pPPriv->fw, pPPriv->fh,
+ 3, id, width, height));
+
+ /* Maybe we would test for correct bpp instead of if here, ? */
+ if (pPPriv->BuffersAllocated <= 0 ||
+ id != pPPriv->Id || /* same bpp */
+ width != pPPriv->fw ||
+ height != pPPriv->fh)
+ {
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : PutImage, yes, we need to allocate buffers, isn't it ?.\n"));
+ /* SVEN : search for a ScalerImage corresponding to the id */
+ for (i = 0; i < ENTRIES(ScalerImages); i++)
+ if (id == ScalerImages[i].id)
+ break;
+
+ /* SVEN : If no scaler was found, we stop here and then */
+ if (i >= ENTRIES(ScalerImages))
+ return XvBadAlloc;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : PutImage, We did found a compatible image format (%d).\n", i));
+ /* SVEN : Let's sync the chip ... (we do that a lot ...) */
+ if (pGlint->MultiAperture) DualPermedia3Sync(pScrn);
+ else Permedia3Sync(pScrn);
+#if 0 /* SVEN : This was not disabled by me, don't know what it was */
+ if (pPPriv->BuffersAllocated <= 0 ||
+ pPPriv->Bpp != ScalerImages[i].bits_per_pixel ||
+ width > pPPriv->fw || height > pPPriv->fw ||
+ pPPriv->fw * pPPriv->fh > width * height * 2)
+#else
+ if (1)
+#endif
+ {
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SVEN : PutImage, We will allocate a buffer ...\n"));
+ /* SVEN : Let's allocate a buffer to store the image.
+ * If it is not possible, we exit */
+ if (!AllocateBuffers(pPPriv, width, height,
+ (ScalerImages[i].bits_per_pixel + 7) >> 3, 3, 0)) {
+ pPPriv->Id = 0;
+ pPPriv->Bpp = 0;
+ pPPriv->fw = 0;
+ pPPriv->fh = 0;
+
+ return XvBadAlloc;
+ }
+
+ /* SVEN : We set the id, bpp, width and height values of
+ * the allocated buffer, so that we will not need to
+ * allocate a buffer again on the next frame. */
+ pPPriv->Id = id;
+ pPPriv->Bpp = ScalerImages[i].bits_per_pixel;
+ pPPriv->fw = width;
+ pPPriv->fh = height;
+
+ /* SVEN : Add RemoveAreaCallBack to the pFBAreas of each buffer */
+ /* Let's see if this cause the crash ??? No, it doesn't ... */
+ RemoveableBuffers(pPPriv, TRUE);
+ }
+ } else
+ if (pGlint->MultiAperture) DualPermedia3Sync(pScrn);
+ else Permedia3Sync(pScrn);
+
+ switch (id) {
+ case LE4CC('Y','V','1','2'):
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ CopyYV12LE(buf,
+ (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[pPPriv->CurrentBuffer]),
+ width, height, pPPriv->BufferStride);
+#else
+ if (pGlint->FBDev)
+ CopyYV12LE(buf,
+ (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
+ width, height, pPPriv->BufferStride);
+ else
+ CopyYV12BE(buf,
+ (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
+ width, height, pPPriv->BufferStride);
+#endif
+ BeginOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, FORMAT_YUV422, 1, 0);
+ break;
+
+ case LE4CC('Y','U','Y','2'):
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV422, 1, 0);
+ break;
+
+ case LE4CC('U','Y','V','Y'):
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ /* Not sure about this one ... */
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY422, 1, 0);
+ break;
+
+ case LE4CC('Y','U','V','A'):
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 2, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV444, 2, pPPriv->Attribute[7]);
+ break;
+
+ case LE4CC('V','U','Y','A'):
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 2, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY444, 2, pPPriv->Attribute[7]);
+ break;
+
+ case 0x41: /* RGBA 8:8:8:8 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 2, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB8888, 2, pPPriv->Attribute[7]);
+ break;
+
+ case 0x42: /* RGB 5:6:5 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB565, 1, 0);
+ break;
+
+ case 0x43: /* RGB 1:5:5:5 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB5551, 1, pPPriv->Attribute[7]);
+ break;
+
+ case 0x44: /* RGB 4:4:4:4 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB4444, 1, pPPriv->Attribute[7]);
+ break;
+
+ case 0x46: /* RGB 2:3:3 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB332, 0, 0);
+ break;
+
+ case 0x47: /* BGRA 8:8:8:8 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 2, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR8888, 2, pPPriv->Attribute[7]);
+ break;
+
+ case 0x48: /* BGR 5:6:5 */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "PutImage case (13) BGR565.\n"));
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR565, 1, 0);
+ break;
+
+ case 0x49: /* BGR 1:5:5:5 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR5551, 1, pPPriv->Attribute[7]);
+ break;
+
+ case 0x4A: /* BGR 4:4:4:4 */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "PutImage case (15) BGR4444.\n"));
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 1, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR4444, 1, pPPriv->Attribute[7]);
+ break;
+
+ case 0x4C: /* BGR 2:3:3 */
+ CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0],
+ width << 0, height, pPPriv->BufferStride);
+ BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR332, 0, 0);
+ break;
+
+ default:
+ return XvBadAlloc;
+ }
+
+ /* SVEN : Don't know what these two are for, let them stay as is */
+ pPPriv->StopDelay = pAPriv->Delay;
+ if (!pAPriv->TimerUsers) {
+ pAPriv->TimerUsers |= 1 << PORTNUM(pPPriv);
+ TimerSet(pAPriv->Timer, 0, 80, TimerCallback, pAPriv);
+ }
+
+ if (sync) {
+ if (pGlint->MultiAperture) DualPermedia3Sync(pScrn);
+ else Permedia3Sync(pScrn);
+ }
+
+ return Success;
+}
+
+static void
+Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
+{
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "StopVideo port=%d, exit=%d\n", PORTNUM(pPPriv), cleanup));
+
+ StopOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, cleanup);
+
+ if (cleanup) {
+ FreeBuffers(pPPriv);
+ if (pAPriv->TimerUsers) {
+ pAPriv->TimerUsers &= ~PORTNUM(pPPriv);
+ if (!pAPriv->TimerUsers)
+ TimerCancel(pAPriv->Timer);
+ }
+ }
+}
+
+static int
+Permedia3SetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 value, pointer data)
+{
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SPA attr=%d val=%d port=%d\n",
+ attribute, value, PORTNUM(pPPriv)));
+
+ return Success;
+}
+
+static int
+Permedia3GetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 *value, pointer data)
+{
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;
+
+ if (PORTNUM(pPPriv) >= 2 &&
+ attribute != xvFilter &&
+ attribute != xvAlpha)
+ return BadMatch;
+
+ if (attribute == xvEncoding) {
+ if (pAPriv->VideoStd < 0)
+ return XvBadAlloc;
+ else
+ if (pPPriv == &pAPriv->Port[0])
+ *value = pAPriv->VideoStd * 3 + pPPriv->Plug;
+ else
+ *value = pAPriv->VideoStd * 2 + pPPriv->Plug - 1;
+ } else if (attribute == xvBrightness)
+ *value = pPPriv->Attribute[0];
+ else if (attribute == xvContrast)
+ *value = pPPriv->Attribute[1];
+ else if (attribute == xvSaturation)
+ *value = pPPriv->Attribute[2];
+ else if (attribute == xvHue)
+ *value = pPPriv->Attribute[3];
+ else if (attribute == xvInterlace)
+ *value = pPPriv->Attribute[4];
+ else if (attribute == xvFilter)
+ *value = pPPriv->Attribute[5];
+ else if (attribute == xvBkgColor)
+ *value = pPPriv->Attribute[6];
+ else if (attribute == xvAlpha)
+ *value = pPPriv->Attribute[7];
+ else
+ return BadMatch;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "GPA attr=%d val=%d port=%d\n",
+ attribute, *value, PORTNUM(pPPriv)));
+
+ return Success;
+}
+
+static void
+Permedia3QueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data)
+{
+ unsigned int zoom_delta, shrink_delta, src_w;
+
+ *p_w = drw_w;
+ compute_scale_factor (&src_w, p_w, &shrink_delta, &zoom_delta);
+ *p_h = drw_h;
+}
+
+static int
+Permedia3QueryImageAttributes(ScrnInfoPtr pScrn,
+ int id, unsigned short *width, unsigned short *height,
+ int *pitches, int *offsets)
+{
+ int i, pitch;
+
+ *width = CLAMP(*width, 1, 2047);
+ *height = CLAMP(*height, 1, 2047);
+
+ if (offsets)
+ offsets[0] = 0;
+
+ switch (id) {
+ case LE4CC('Y','V','1','2'): /* Planar YVU 4:2:0 (emulated) */
+ *width = CLAMP((*width + 1) & ~1, 2, 2046);
+ *height = CLAMP((*height + 1) & ~1, 2, 2046);
+
+ pitch = *width; /* luma component */
+
+ if (offsets) {
+ offsets[1] = pitch * *height;
+ offsets[2] = offsets[1] + (offsets[1] >> 2);
+ }
+
+ if (pitches) {
+ pitches[0] = pitch;
+ pitches[1] = pitches[2] = pitch >> 1;
+ }
+
+ return pitch * *height * 3 / 2;
+
+ case LE4CC('Y','U','Y','2'): /* Packed YUYV 4:2:2 */
+ case LE4CC('U','Y','V','Y'): /* Packed UYVY 4:2:2 */
+ *width = CLAMP((*width + 1) & ~1, 2, 2046);
+
+ pitch = *width * 2;
+
+ if (pitches)
+ pitches[0] = pitch;
+
+ return pitch * *height;
+
+ default:
+ for (i = 0; i < ENTRIES(ScalerImages); i++)
+ if (ScalerImages[i].id == id)
+ break;
+
+ if (i >= ENTRIES(ScalerImages))
+ break;
+
+ pitch = *width * (ScalerImages[i].bits_per_pixel >> 3);
+
+ if (pitches)
+ pitches[0] = pitch;
+
+ return pitch * *height;
+ }
+
+ return 0;
+}
+
+static void
+DeleteAdaptorPriv(AdaptorPrivPtr pAPriv)
+{
+ int i;
+
+ for (i = 0; i < PORTS; i++) {
+ FreeBuffers(&pAPriv->Port[i]);
+ }
+
+ TimerFree(pAPriv->Timer);
+
+ xfree(pAPriv);
+}
+
+static AdaptorPrivPtr
+NewAdaptorPriv(ScrnInfoPtr pScrn)
+{
+ AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec));
+ int i;
+
+ if (!pAPriv) return NULL;
+
+ pAPriv->pScrn = pScrn;
+
+ if (!(pAPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pAPriv))) {
+ DeleteAdaptorPriv(pAPriv);
+ return NULL;
+ }
+
+ for (i = 0; i < PORTS; i++) {
+ pAPriv->Port[i].pAdaptor = pAPriv;
+
+ pAPriv->Port[i].StopDelay = -1;
+ pAPriv->Port[i].fw = 0;
+ pAPriv->Port[i].fh = 0;
+ pAPriv->Port[i].BuffersRequested = 1;
+ pAPriv->Delay = 125;
+ pAPriv->Instant = 1000 / 25;
+
+ pAPriv->Port[i].Attribute[5] = 0; /* Bilinear Filter (Bool) */
+ pAPriv->Port[i].Attribute[7] = 0; /* Alpha Enable (Bool) */
+ }
+
+ return pAPriv;
+}
+
+
+/*
+ * Glint interface
+ */
+
+void
+Permedia3VideoEnterVT(ScrnInfoPtr pScrn)
+{
+ AdaptorPrivPtr pAPriv;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv enter VT\n"));
+
+ for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next)
+ if (pAPriv->pScrn == pScrn) {
+ /* SVEN : nothing is done here, since we disabled
+ * input/ouput video support. */
+ }
+}
+
+void
+Permedia3VideoLeaveVT(ScrnInfoPtr pScrn)
+{
+ AdaptorPrivPtr pAPriv;
+
+ for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next)
+ if (pAPriv->pScrn == pScrn) {
+ /* SVEN : nothing is done here, since we disabled
+ * input/ouput video support. */
+ }
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv leave VT\n"));
+}
+
+void
+Permedia3VideoUninit(ScrnInfoPtr pScrn)
+{
+ AdaptorPrivPtr pAPriv, *ppAPriv;
+
+ for (ppAPriv = &AdaptorPrivList; (pAPriv = *ppAPriv); ppAPriv = &(pAPriv->Next))
+ if (pAPriv->pScrn == pScrn) {
+ *ppAPriv = pAPriv->Next;
+ DeleteAdaptorPriv(pAPriv);
+ break;
+ }
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv cleanup\n"));
+}
+
+void
+Permedia3VideoInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ AdaptorPrivPtr pAPriv;
+ DevUnion Private[PORTS];
+ XF86VideoAdaptorRec VAR;
+ XF86VideoAdaptorPtr VARPtrs;
+ int i;
+
+ switch (pGlint->Chipset) {
+ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3:
+ break;
+
+ case PCI_VENDOR_3DLABS_CHIP_GAMMA:
+ if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) break;
+
+ default:
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1,
+ "No Xv support for chipset %d.\n", pGlint->Chipset);
+ return;
+ }
+
+ if (pGlint->NoAccel) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1,
+ "Sorry, need to enable accel for Xv support for Permedia3.\n");
+ return;
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1,
+ "Initializing Xv driver rev. 1\n");
+
+ if (!(pAPriv = NewAdaptorPriv(pScrn))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Xv driver initialization failed\n");
+ return;
+ }
+
+ memset(&VAR, 0, sizeof(VAR));
+
+ for (i = 0; i < PORTS; i++)
+ Private[i].ptr = (pointer) &pAPriv->Port[i];
+
+ VARPtrs = &VAR;
+
+ VAR.type = XvInputMask | XvWindowMask | XvImageMask;
+ VAR.flags = VIDEO_OVERLAID_IMAGES;
+ VAR.name = "Permedia 3 Frontend Scaler";
+ VAR.nEncodings = ENTRIES(ScalerEncodings);
+ VAR.pEncodings = ScalerEncodings;
+ VAR.nFormats = ENTRIES(ScalerVideoFormats);
+ VAR.pFormats = ScalerVideoFormats;
+ VAR.nPorts = 3;
+ VAR.pPortPrivates = &Private[0];
+ VAR.nAttributes = ENTRIES(ScalerAttributes);
+ VAR.pAttributes = ScalerAttributes;
+ VAR.nImages = ENTRIES(ScalerImages);
+ VAR.pImages = ScalerImages;
+
+ VAR.PutVideo = NULL;
+ VAR.PutStill = NULL;
+ VAR.GetVideo = NULL;
+ VAR.GetStill = NULL;
+ VAR.StopVideo = Permedia3StopVideo;
+ VAR.SetPortAttribute = Permedia3SetPortAttribute;
+ VAR.GetPortAttribute = Permedia3GetPortAttribute;
+ VAR.QueryBestSize = Permedia3QueryBestSize;
+ VAR.PutImage = Permedia3PutImage;
+ VAR.QueryImageAttributes = Permedia3QueryImageAttributes;
+
+ if (xf86XVScreenInit(pScreen, &VARPtrs, 1)) {
+ xvEncoding = MAKE_ATOM(XV_ENCODING);
+ xvHue = MAKE_ATOM(XV_HUE);
+ xvSaturation = MAKE_ATOM(XV_SATURATION);
+ xvBrightness = MAKE_ATOM(XV_BRIGHTNESS);
+ xvContrast = MAKE_ATOM(XV_CONTRAST);
+ xvInterlace = MAKE_ATOM(XV_INTERLACE);
+ xvFilter = MAKE_ATOM(XV_FILTER);
+ xvBkgColor = MAKE_ATOM(XV_BKGCOLOR);
+ xvAlpha = MAKE_ATOM(XV_ALPHA);
+
+ /* Add it to the AdaptatorList */
+ pAPriv->Next = AdaptorPrivList;
+ AdaptorPrivList = pAPriv;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Xv frontend scaler enabled\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n");
+ DeleteAdaptorPriv(pAPriv);
+ }
+}
+
+#endif /* XvExtension */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h b/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h
index 7a57c0496..a03835aae 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.1 2000/10/04 23:34:58 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.2 2001/03/03 22:26:11 tsi Exp $ */
/*
* Copyright 1994-2000 by Robin Cutshaw <robin@XFree86.Org>
*
@@ -24,8 +24,6 @@
/* $XConsortium: $ */
#include "compiler.h"
-#include <X11/Xfuncproto.h>
-
/* Indirect indexed registers */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h
index 3e0b14b83..031111ff7 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.4 2000/12/11 01:53:00 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.5 2001/04/01 14:00:11 tsi Exp $ */
/*
* Number Nine I128 functions
*
@@ -135,6 +135,6 @@ Bool I128ProgramSilverHammer(ScrnInfoPtr pScrn, DisplayModePtr mode);
void I128DumpBaseRegisters(ScrnInfoPtr pScrn);
void I128DumpActiveRegisters(ScrnInfoPtr pScrn);
-void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg);
+void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg);
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
index 4ce35cb0a..91aed1167 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.18 2001/01/21 21:19:26 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.19 2001/04/01 14:00:11 tsi Exp $ */
/* All drivers should typically include these */
@@ -2105,7 +2105,7 @@ I128DumpActiveRegisters(ScrnInfoPtr pScrn)
unsigned short iobase;
unsigned long rbase_g, rbase_w, rbase_a, rbase_b, rbase_i, rbase_e;
unsigned long id, config1, config2, sgram, soft_sw, ddc, vga_ctl;
- volatile unsigned long *vrba, *vrbg, *vrbw;
+ volatile CARD32 *vrba, *vrbg, *vrbw;
vrba = pI128->mem.rbase_a;
vrbg = pI128->mem.rbase_g;
@@ -2343,7 +2343,7 @@ static unsigned char ibm52Xmask[0xA0] = {
};
void
-I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg)
+I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg)
{
unsigned char ibmr[0x100];
char buf[128], tbuf[10];
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c
index f5e3c5435..19336e0a6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.1 2000/12/11 01:53:01 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -260,7 +260,7 @@ I128_OpenFramebuffer(
int *flags
){
I128Ptr pI128 = I128PTR(pScrn);
- CARD32 FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000;
+ unsigned long FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000;
*name = NULL; /* no special device */
*mem = (unsigned char*)FbAddress;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c
index 21f5bbbab..70b32a32b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.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/i740/i740_accel.c,v 1.4 2000/04/05 18:13:47 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.5 2001/03/03 22:26:12 tsi Exp $ */
/*
* Authors:
@@ -33,10 +33,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#if 0
-#include <math.h>
-#endif
-
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
index 81a54dcb0..e99307a7f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.14 2000/12/21 12:22:56 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.17 2001/03/21 19:46:27 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -68,14 +68,15 @@ Bool I810InitDma(ScrnInfoPtr pScrn)
{
I810Ptr pI810 = I810PTR(pScrn);
I810RingBuffer *ring = &(pI810->LpRing);
+ I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate;
drmI810Init info;
Bool ret_val;
info.start = ring->mem.Start;
info.end = ring->mem.End;
info.size = ring->mem.Size;
- info.ring_map_idx = 6;
- info.buffer_map_idx = 5;
+ info.mmio_offset = (unsigned int)pI810DRI->regs;
+ info.buffers_offset = (unsigned int)pI810->buffer_map;
info.sarea_off = sizeof(XF86DRISAREARec);
info.front_offset = 0;
@@ -203,7 +204,6 @@ static unsigned int mylog2(unsigned int n)
return log2;
}
-
Bool I810DRIScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -240,9 +240,9 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
{
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n",
+ "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n",
major, minor, patch);
return FALSE;
}
@@ -310,6 +310,8 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = I810DRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
/* This adds the framebuffer as a drm map *before* we have asked agp
* to allocate it. Scary stuff, hold on...
@@ -328,8 +330,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
drmVersionPtr version = drmGetVersion(pI810->drmSubFD);
if (version) {
if (version->version_major != 1 ||
- version->version_minor != 1 ||
- version->version_patchlevel < 0) {
+ version->version_minor < 1) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"I810DRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n",
@@ -683,6 +684,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n",
bufs, I810_DMA_BUF_SZ);
+ xf86EnablePciBusMaster(pI810->PciInfo, TRUE);
I810InitDma(pScrn);
@@ -733,6 +735,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
pI810DRI->auxPitch = pI810->auxPitch;
pI810DRI->auxPitchBits = pI810->auxPitchBits;
+ pI810DRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
if (!(I810InitVisualConfigs(pScreen))) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "I810InitVisualConfigs failed\n");
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h
index bbb0cc927..f8e46ee3a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h
@@ -1,10 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.3 2000/06/17 00:03:18 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.5 2001/03/21 17:02:23 dawes Exp $ */
#ifndef _I810_DRI_
#define _I810_DRI_
-#include <xf86drm.h>
-#include <xf86drmI810.h>
+#include "xf86drm.h"
+#include "xf86drmI810.h"
#define I810_MAX_DRAWABLES 256
@@ -50,6 +50,7 @@ typedef struct {
drmBufMapPtr drmBufs;
int irq;
+ unsigned int sarea_priv_offset;
} I810DRIRec, *I810DRIPtr;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
index 985ff3f10..1d4be078c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_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/i810/i810_driver.c,v 1.43 2001/01/21 21:19:27 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.44 2001/03/02 02:45:38 dawes Exp $ */
/*
* Authors:
@@ -35,7 +35,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* This server does not support these XFree86 4.0 features yet
- * DDC1 & DDC2 (requires I2C)
* shadowFb (if requested or acceleration is off)
* Overlay planes
* DGA
@@ -121,7 +120,8 @@ typedef enum {
OPTION_COLOR_KEY,
OPTION_CACHE_LINES,
OPTION_DAC_6BIT,
- OPTION_DRI
+ OPTION_DRI,
+ OPTION_NO_DDC
} I810Opts;
static OptionInfoRec I810Options[] = {
@@ -131,6 +131,7 @@ static OptionInfoRec I810Options[] = {
{ OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE},
{ OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE},
{ OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE},
+ { OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
{ -1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -164,6 +165,13 @@ static const char *miscSymbols[] = {
static const char *vbeSymbols[] = {
"VBEInit",
"vbeDoEDID",
+ "vbeFree",
+ NULL
+};
+
+static const char *ddcSymbols[] = {
+ "xf86PrintEDID",
+ "xf86SetDDCproperties",
NULL
};
@@ -293,7 +301,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
driSymbols,
#endif
vbeSymbols,
- NULL /* ddcsymbols */,
+ ddcSymbols,
NULL /* i2csymbols */,
NULL /* shadowSymbols */,
NULL /* fbdevsymbols */,
@@ -427,6 +435,29 @@ I810ProbeDDC(ScrnInfoPtr pScrn, int index)
}
}
+static xf86MonPtr
+I810DoDDC(ScrnInfoPtr pScrn, int index)
+{
+ vbeInfoPtr pVbe;
+ xf86MonPtr MonInfo = NULL;
+
+ /* Honour Option "noDDC" */
+ if (xf86ReturnOptValBool(I810Options, OPTION_NO_DDC, FALSE) ) {
+ return MonInfo;
+ }
+
+ if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) {
+ MonInfo = vbeDoEDID(pVbe, NULL);
+ xf86PrintEDID( MonInfo );
+ xf86SetDDCproperties(pScrn, MonInfo);
+ vbeFree(pVbe);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "this driver cannot do DDC without VBE\n");
+ }
+
+ return MonInfo;
+}
+
/*
* I810PreInit --
*
@@ -546,6 +577,13 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) {
ptr->found=FALSE;
}
+ /* Get DDC info from monitor */
+ /* after xf86ProcessOptions,
+ * because it is controlled by options [no]vbe and [no]ddc
+ */
+ pScrn->monitor->DDC = I810DoDDC(pScrn, pI810->pEnt->index);
+
+
/* We have to use PIO to probe, because we haven't mapped yet */
I810SetPIOAccess(pI810);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h
index 84dcafe90..095dead6b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.3 2000/08/02 23:50:49 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.4 2001/04/05 21:29:14 dawes Exp $ */
#ifndef _IMSTT_H
#define _IMSTT_H
@@ -34,6 +34,7 @@ typedef struct _IMSTTRec {
Bool FBDev;
int Chipset, ChipRev;
int ydir;
+ int color;
unsigned long pitch;
unsigned long ll;
unsigned long screen_width;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c
index 6bee19f0a..5eef2aa19 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.4 2000/08/01 20:05:43 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.5 2001/04/05 21:29:14 dawes Exp $ */
/*
* Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
@@ -45,6 +45,7 @@ static void IMSTTSync(ScrnInfoPtr pScrn)
while(INREG(IMSTT_SSTATUS) & 0x80);
while(INREG(IMSTT_SSTATUS) & 0x40);
+
return;
}
@@ -55,11 +56,18 @@ static void IMSTTSetupForSolidFill(ScrnInfoPtr pScrn, int color,
IMSTTPtr iptr = IMSTTPTR(pScrn);
IMSTTMMIO_VARS();
- OUTREG(IMSTT_DP_OCTL, iptr->ll);
- OUTREG(IMSTT_SP, iptr->ll);
- OUTREG(IMSTT_BI, 0xffffffff);
- OUTREG(IMSTT_MBC, 0xffffffff);
- OUTREG(IMSTT_CLR, color);
+ switch (pScrn->depth) {
+ case 8:
+ iptr->color = color | (color << 8) | (color << 16) | (color << 24);
+ break;
+ case 15:
+ case 16:
+ iptr->color = color | (color << 8) | (color << 16);
+ break;
+ default:
+ iptr->color = color;
+ break;
+ }
}
@@ -69,13 +77,28 @@ static void IMSTTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
IMSTTPtr iptr = IMSTTPTR(pScrn);
IMSTTMMIO_VARS();
- OUTREG(IMSTT_DSA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3));
- OUTREG(IMSTT_S1SA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3));
- OUTREG(IMSTT_CNT, ((h - 1) << 16) | (w * (pScrn->bitsPerPixel >> 3) - 1));
+ x *= (pScrn->bitsPerPixel >> 3);
+ y *= iptr->ll;
+ w *= (pScrn->bitsPerPixel >> 3);
+ h--;
+ w--;
+
+ while(INREG(IMSTT_SSTATUS) & 0x80);
+ OUTREG(IMSTT_DSA, x + y);
+ OUTREG(IMSTT_CNT, (h << 16) | w);
+ OUTREG(IMSTT_DP_OCTL, iptr->ll);
+ OUTREG(IMSTT_SP, iptr->ll);
+ OUTREG(IMSTT_BI, 0xffffffff);
+ OUTREG(IMSTT_MBC, 0xffffffff);
+ OUTREG(IMSTT_CLR, iptr->color);
+
if (iptr->rev == 2)
OUTREG(IMSTT_BLTCTL, 0x200000);
else
OUTREG(IMSTT_BLTCTL, 0x840);
+
+ while(INREG(IMSTT_SSTATUS) & 0x80);
+ while(INREG(IMSTT_SSTATUS) & 0x40);
}
@@ -88,17 +111,20 @@ static void IMSTTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
unsigned long sp, dp, ll, cnt;
iptr->bltctl = 0x05;
+
+ ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
ll = iptr->ll;
+
sp = ll << 16;
- if (xdir > 0) {
+ if (xdir < 0) {
iptr->bltctl |= 0x80;
iptr->cnt = 1;
} else {
iptr->cnt = 0;
}
- if (ydir > 0) {
+ if (ydir < 0) {
sp |= -(ll) & 0xffff;
dp = -(ll) & 0xffff;
iptr->ydir = 1;
@@ -110,6 +136,7 @@ static void IMSTTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
iptr->sp = sp;
iptr->dp = dp;
+ iptr->ll = ll;
}
@@ -122,6 +149,9 @@ static void IMSTTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
IMSTTMMIO_VARS();
unsigned long cnt;
+ x1 *= (pScrn->bitsPerPixel >> 3);
+ x2 *= (pScrn->bitsPerPixel >> 3);
+ w *= (pScrn->bitsPerPixel >> 3);
w--;
h--;
cnt = h << 16;
@@ -145,6 +175,8 @@ static void IMSTTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
OUTREG(IMSTT_CNT, cnt);
OUTREG(IMSTT_DP_OCTL, iptr->dp);
OUTREG(IMSTT_BLTCTL, iptr->bltctl);
+ while(INREG(IMSTT_SSTATUS) & 0x80);
+ while(INREG(IMSTT_SSTATUS) & 0x40);
}
@@ -160,14 +192,28 @@ Bool IMSTTAccelInit(ScreenPtr pScreen)
iptr->ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
- iptr->screen_width = iptr->pitch = iptr->ll;
+ switch (pScrn->bitsPerPixel) {
+ case 16:
+ iptr->screen_width = iptr->pitch >> 1;
+ break;
+ case 24:
+ case 32:
+ iptr->screen_width = iptr->pitch >> 2;
+ break;
+ default:
+ iptr->screen_width = iptr->pitch = iptr->ll;
+ break;
+ }
xaaptr->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER);
xaaptr->Sync = IMSTTSync;
- xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill;
- xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect;
+ if (pScrn->bitsPerPixel == 8) {
+ /* FIXME fills are broken > 8bpp, iptr->color needs to be setup right */
+ xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill;
+ xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect;
+ }
xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
xaaptr->SetupForScreenToScreenCopy = IMSTTSetupForScreenToScreenCopy;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c
index b1db68fe4..70d8f9c67 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.10 2000/12/02 15:30:43 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.11 2001/04/05 21:29:14 dawes Exp $ */
/*
* Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
@@ -374,8 +374,7 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- if (pScrn->depth == 8)
- pScrn->rgbBits = 8;
+ pScrn->rgbBits = 8;
if (!xf86SetDefaultVisual(pScrn, -1))
return FALSE;
@@ -423,6 +422,9 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags)
iptr->FBDev = FALSE;
}
+ /* hack */
+ iptr->FBDev = TRUE;
+
if (iptr->FBDev) {
if (!xf86LoadSubModule(pScrn, "fbdevhw"))
return FALSE;
@@ -558,7 +560,6 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags)
xf86SetDpi(pScrn, 0, 0);
xf86LoadSubModule(pScrn, "fb");
-/* xf86LoaderReqSymbols(fbSymbols, NULL); */
xf86LoaderReqSymbols("fbScreenInit", NULL);
if (!xf86LoadSubModule(pScrn, "xaa"))
@@ -772,6 +773,8 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
+ iptr->pitch = pScrn->displayWidth;
+
if (iptr->FBDev) {
if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
return FALSE;
@@ -786,7 +789,7 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen,
if (pScrn->bitsPerPixel > 8) {
if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
- pScrn->rgbBits, pScrn->defaultVisual))
+ pScrn->rgbBits, TrueColor))
return FALSE;
} else {
if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
@@ -813,8 +816,6 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen,
return FALSE;
}
- xf86SetBlackWhitePixels(pScreen);
-
if (pScrn->bitsPerPixel > 8) {
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals) {
@@ -829,6 +830,7 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
+ xf86SetBlackWhitePixels(pScreen);
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
@@ -848,8 +850,8 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen,
if (!miCreateDefColormap(pScreen))
return FALSE;
- if (!xf86HandleColormaps(pScreen, 256, 8, (iptr->FBDev ? fbdevHWLoadPalette : NULL),
- NULL, CMAP_RELOAD_ON_MODE_SWITCH))
+ if (!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette,
+ NULL, CMAP_PALETTED_TRUECOLOR))
return FALSE;
if (serverGeneration == 1)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
index 9ec02c4ea..0291d615a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
@@ -1,6 +1,6 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.41 2001/02/13 19:19:15 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.43 2001/04/05 17:42:32 dawes Exp $
XCOMM
-XCOMM This is an Imakefile for the MGA driver.
+XCOMM This is an Imakefile for the MGA driver.
XCOMM
#define IHaveModules
@@ -12,8 +12,8 @@ SUBDIRS=hallib
#endif
#if BuildXF86DRI
-DRISRCS = mga_dri.c mga_warp.c mga_wrap.c
-DRIOBJS = mga_dri.o mga_warp.o mga_wrap.o
+DRISRCS = mga_dri.c
+DRIOBJS = mga_dri.o
DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \
-I$(TOP)/include
DRIDEFINES = $(GLX_DEFINES)
@@ -57,10 +57,10 @@ hallib/libmga_hal.a: $(SUBDIRS)
MGASRCS = mga_driver.c mga_hwcurs.c /* mga_cmap.c */ mga_dac3026.c mga_dacG.c \
mga_storm8.c mga_storm16.c mga_storm24.c mga_storm32.c mga_arc.c \
- mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c $(DRISRCS)
+ mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c mga_dh.c $(DRISRCS)
MGAOBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \
mga_storm8.o mga_storm16.o mga_storm24.o mga_storm32.o mga_arc.o \
- mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o $(DRIOBJS)
+ mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o mga_dh.o $(DRIOBJS)
SRCS = $(MGASRCS) $(MGAHALSRCS)
OBJS = $(MGAOBJS) $(MGAHALOBJS)
@@ -102,7 +102,7 @@ ObjectFromSpecialSource(mga_storm8, mga_storm, -DPSZ=8)
ObjectFromSpecialSource(mga_storm16, mga_storm, -DPSZ=16)
ObjectFromSpecialSource(mga_storm24, mga_storm, -DPSZ=24)
ObjectFromSpecialSource(mga_storm32, mga_storm, -DPSZ=32)
-
+
InstallObjectModule(mga,$(MODULEDIR),drivers)
#if BuildHalModule
InstallObjectModule(mga_hal,$(MODULEDIR),drivers)
@@ -141,4 +141,3 @@ MakeSubdirs($(SUBDIRS))
ForceSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif
-
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
index eed8b8962..9a83c7c21 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.71 2001/02/13 19:19:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.73 2001/04/05 17:42:32 dawes Exp $ */
/*
* MGA Millennium (MGA2064W) functions
*
@@ -22,16 +22,31 @@
#include "xf86DDC.h"
#include "xf86xv.h"
+
+
#ifdef XF86DRI
#include "xf86drm.h"
-#include "sarea.h"
+
+
#define _XF86DRI_SERVER_
+#include "mga_dripriv.h"
+#include "dri.h"
+#include "GL/glxint.h"
+
+
+
+
#include "xf86dri.h"
#include "dri.h"
+
+
+
#include "GL/glxint.h"
#include "mga_dri.h"
#endif
+
+
#ifdef USEMGAHAL
#include "client.h"
#endif
@@ -59,6 +74,32 @@ void dbg_outreg32(ScrnInfoPtr,int,int);
#define OUTREG(addr,val) dbg_outreg32(pScrn,addr,val)
#endif /* EXTRADEBUG */
+/*
+ * Read/write to the DAC via MMIO
+ */
+
+/*
+ * These were functions. Use macros instead to avoid the need to
+ * pass pMga to them.
+ */
+
+#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg))
+
+#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
+
+#define inMGAdac(reg) \
+ (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA))
+
+#define outMGAdac(reg, val) \
+ (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
+
+#define outMGAdacmsk(reg, mask, val) \
+ do { /* note: mask and reg may get evaluated twice */ \
+ unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \
+ outMGAdreg(MGA1064_INDEX, reg); \
+ outMGAdreg(MGA1064_DATA, tmp | (val)); \
+ } while (0)
+
#define PORT_OFFSET (0x1F00 - 0x300)
#define MGA_VERSION 4000
@@ -74,11 +115,30 @@ typedef struct {
unsigned char ExtVga[6];
unsigned char DacClk[6];
unsigned char * DacRegs;
+ unsigned long crtc2[0x58];
+ unsigned char dac2[0x21];
CARD32 Option;
CARD32 Option2;
CARD32 Option3;
} MGARegRec, *MGARegPtr;
+/* For programming the second CRTC */
+typedef struct {
+ CARD32 ulDispWidth; /* Display Width in pixels*/
+ CARD32 ulDispHeight; /* Display Height in pixels*/
+ CARD32 ulBpp; /* Bits Per Pixels / input format*/
+ CARD32 ulPixClock; /* Pixel Clock in kHz*/
+ CARD32 ulHFPorch; /* Horizontal front porch in pixels*/
+ CARD32 ulHSync; /* Horizontal Sync in pixels*/
+ CARD32 ulHBPorch; /* Horizontal back porch in pixels*/
+ CARD32 ulVFPorch; /* Vertical front porch in lines*/
+ CARD32 ulVSync; /* Vertical Sync in lines*/
+ CARD32 ulVBPorch; /* Vertical back Porch in lines*/
+ CARD32 ulFBPitch; /* Pitch*/
+ CARD32 flSignalMode; /* Signal Mode*/
+} xMODEINFO;
+
+
typedef struct {
int brightness;
int contrast;
@@ -261,7 +321,6 @@ typedef struct {
int MaxBlitDWORDS;
Bool TexturedVideo;
MGAPortPrivPtr portPrivate;
- int numXAALines;
unsigned char *ScratchBuffer;
unsigned char *ColorExpandBase;
int expandRows;
@@ -270,18 +329,21 @@ typedef struct {
int expandHeight;
int expandY;
#ifdef XF86DRI
- int agp_mode;
- Bool ReallyUseIrqZero;
- Bool have_quiescense;
Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
- int drmSubFD;
+ int drmFD;
int numVisualConfigs;
__GLXvisualConfig* pVisualConfigs;
MGAConfigPrivPtr pVisualConfigsPriv;
+ MGADRIServerPrivatePtr DRIServerInfo;
+
MGARegRec DRContextRegs;
- MGADRIServerPrivatePtr DRIServerInfo;
+
+ Bool haveQuiescense;
void (*GetQuiescence)(ScrnInfoPtr pScrn);
+
+ int agpMode;
+
#endif
XF86VideoAdaptorPtr adaptor;
Bool SecondCrtc;
@@ -307,12 +369,6 @@ typedef struct {
#endif
} MGARec, *MGAPtr;
-#ifdef XF86DRI
-extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **configprivs);
-#endif
-
-
extern CARD32 MGAAtype[16];
extern CARD32 MGAAtypeNoBLK[16];
@@ -333,10 +389,6 @@ extern CARD32 MGAAtypeNoBLK[16];
#define TRANSPARENCY_KEY 255
#define KEY_COLOR 0
-#define MGA_FRONT 0x1
-#define MGA_BACK 0x2
-#define MGA_DEPTH 0x4
-
/* Prototypes */
@@ -365,22 +417,6 @@ void MGAPolyArcThinSolid(DrawablePtr, GCPtr, int, xArc*);
Bool MGADGAInit(ScreenPtr pScreen);
-Bool MGADRIScreenInit(ScreenPtr pScreen);
-void MGADRICloseScreen(ScreenPtr pScreen);
-Bool MGADRIFinishScreenInit(ScreenPtr pScreen);
-void MGASwapContext(ScreenPtr pScreen);
-void MGASwapContext_shared(ScreenPtr pScreen);
-Bool mgaConfigureWarp(ScrnInfoPtr pScrn);
-unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset);
-unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen);
-void MGASelectBuffer(ScrnInfoPtr pScrn, int which);
-Bool MgaCleanupDma(ScrnInfoPtr pScrn);
-Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size);
-#ifdef XF86DRI
-Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags);
-void mgaGetQuiescence(ScrnInfoPtr pScrn);
-void mgaGetQuiescence_shared(ScrnInfoPtr pScrn);
-#endif
void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
@@ -412,7 +448,43 @@ void Mga32SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
void MGAPointerMoved(int index, int x, int y);
void MGAInitVideo(ScreenPtr pScreen);
-void MGAResetVideo(ScrnInfoPtr pScrn);
+void MGAResetVideo(ScrnInfoPtr pScrn);
+
+#ifdef XF86DRI
+
+#define MGA_FRONT 0x1
+#define MGA_BACK 0x2
+#define MGA_DEPTH 0x4
+
+Bool MGADRIScreenInit( ScreenPtr pScreen );
+void MGADRICloseScreen( ScreenPtr pScreen );
+Bool MGADRIFinishScreenInit( ScreenPtr pScreen );
+
+Bool MGALockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags );
+
+void MGAGetQuiescence( ScrnInfoPtr pScrn );
+void MGAGetQuiescenceShared( ScrnInfoPtr pScrn );
+
+void MGASelectBuffer(ScrnInfoPtr pScrn, int which);
+Bool MgaCleanupDma(ScrnInfoPtr pScrn);
+Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size);
+
+#define MGA_AGP_1X_MODE 0x01
+#define MGA_AGP_2X_MODE 0x02
+#define MGA_AGP_4X_MODE 0x04
+#define MGA_AGP_MODE_MASK 0x07
+
+#endif
+
+void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo);
+void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo);
+void CRTC2SetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo);
+void CRTC2SetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY);
+void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo);
+void CRTC2GetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo);
+void CRTC2GetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY);
+
double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out);
+void printDac(ScrnInfoPtr pScrn);
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
index 0979a7281..220ef1a49 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.55 2000/11/02 02:51:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.56 2001/04/05 21:29:14 dawes Exp $ */
/*
* Copyright 1994 by Robin Cutshaw <robin@XFree86.org>
*
@@ -1071,7 +1071,10 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn)
MGAdac->HideCursor = MGA3026HideCursor;
MGAdac->ShowCursor = MGA3026ShowCursor;
MGAdac->UseHWCursor = MGA3026UseHWCursor;
- MGAdac->CursorFlags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ MGAdac->CursorFlags =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+#endif
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
index 2d5361f9b..2b3536f3a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
@@ -2,7 +2,7 @@
* MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.43 2001/02/13 19:19:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.46 2001/04/06 16:51:19 dawes Exp $ */
/*
* This is a first cut at a non-accelerated version to work with the
@@ -49,33 +49,6 @@
#define OPTION1_MASK_PRIMARY 0xFFFC0FF
-/*
- * Read/write to the DAC via MMIO
- */
-
-/*
- * These were functions. Use macros instead to avoid the need to
- * pass pMga to them.
- */
-
-#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg))
-
-#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
-
-#define inMGAdac(reg) \
- (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA))
-
-#define outMGAdac(reg, val) \
- (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
-
-#define outMGAdacmsk(reg, mask, val) \
- do { /* note: mask and reg may get evaluated twice */ \
- unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \
- outMGAdreg(MGA1064_INDEX, reg); \
- outMGAdreg(MGA1064_DATA, tmp | (val)); \
- } while (0)
-
-
static void MGAGRamdacInit(ScrnInfoPtr);
static void MGAGSave(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool);
static void MGAGRestore(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool);
@@ -280,7 +253,21 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
MGARegPtr pReg;
vgaRegPtr pVga;
MGAFBLayout *pLayout;
-
+ xMODEINFO ModeInfo;
+
+ ModeInfo.ulDispWidth = mode->HDisplay;
+ ModeInfo.ulDispHeight = mode->VDisplay;
+ ModeInfo.ulFBPitch = mode->HDisplay;
+ ModeInfo.ulBpp = pScrn->bitsPerPixel;
+ ModeInfo.flSignalMode = 0;
+ ModeInfo.ulPixClock = mode->Clock;
+ ModeInfo.ulHFPorch = mode->HSyncStart - mode->HDisplay;
+ ModeInfo.ulHSync = mode->HSyncEnd - mode->HSyncStart;
+ ModeInfo.ulHBPorch = mode->HTotal - mode->HSyncEnd;
+ ModeInfo.ulVFPorch = mode->VSyncStart - mode->VDisplay;
+ ModeInfo.ulVSync = mode->VSyncEnd - mode->VSyncStart;
+ ModeInfo.ulVBPorch = mode->VTotal - mode->VSyncEnd;
+
pMga = MGAPTR(pScrn);
pReg = &pMga->ModeReg;
pVga = &VGAHWPTR(pScrn)->ModeReg;
@@ -545,6 +532,21 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* This disables the VGA memory aperture */
pVga->MiscOutReg &= ~0x02;
+
+ /* Urgh. Why do we define our own xMODEINFO structure instead
+ * of just passing the blinkin' DisplayModePtr? If we're going to
+ * just cut'n'paste routines from the HALlib, it would be better
+ * just to strip the MacroVision stuff out of the HALlib and release
+ * that, surely?
+ */
+ /********************* Second Crtc programming **************/
+ /* Writing values to crtc2[] array */
+ if (pMga->SecondCrtc)
+ {
+ CRTC2Get(pScrn, &ModeInfo);
+ CRTC2GetPitch(pScrn, &ModeInfo);
+ CRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0);
+ }
return(TRUE);
}
@@ -652,62 +654,81 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
MGAPtr pMga = MGAPTR(pScrn);
CARD32 optionMask;
- MGA_NOT_HAL(
- /*
- * Code is needed to get things back to bank zero.
- */
-
- /* restore DAC registers
- * according to the docs we shouldn't write to reserved regs*/
- for (i = 0; i < DACREGSIZE; i++) {
- if( (i <= 0x03) ||
- (i == 0x07) ||
- (i == 0x0b) ||
- (i == 0x0f) ||
- ((i >= 0x13) && (i <= 0x17)) ||
- (i == 0x1b) ||
- (i == 0x1c) ||
- ((i >= 0x1f) && (i <= 0x29)) ||
- ((i >= 0x30) && (i <= 0x37)) ||
- (MGAISG450(pMga) &&
- ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) ||
- (i == 0x4c) || (i == 0x4d) || (i == 0x4e))))
- continue;
- outMGAdac(i, mgaReg->DacRegs[i]);
- }
-
- /* Do not set the memory config for primary cards as it
- should be correct already */
- optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK;
-
- if (!MGAISG450(pMga)) {
- /* restore pci_option register */
- pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask,
- mgaReg->Option);
- if (pMga->Chipset != PCI_CHIP_MGA1064)
- pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK,
- mgaReg->Option2);
- if (pMga->Chipset == PCI_CHIP_MGAG400)
- pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK,
- mgaReg->Option3);
- }
- ); /* MGA_NOT_HAL */
-
- /* restore CRTCEXT regs */
- for (i = 0; i < 6; i++)
- OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i);
-
- /*
- * This function handles restoring the generic VGA registers.
- */
- vgaHWRestore(pScrn, vgaReg,
+ if(!pMga->SecondCrtc) {
+MGA_NOT_HAL(
+ /*
+ * Code is needed to get things back to bank zero.
+ */
+
+ /* restore DAC registers
+ * according to the docs we shouldn't write to reserved regs*/
+ for (i = 0; i < DACREGSIZE; i++) {
+ if( (i <= 0x03) ||
+ (i == 0x07) ||
+ (i == 0x0b) ||
+ (i == 0x0f) ||
+ ((i >= 0x13) && (i <= 0x17)) ||
+ (i == 0x1b) ||
+ (i == 0x1c) ||
+ ((i >= 0x1f) && (i <= 0x29)) ||
+ ((i >= 0x30) && (i <= 0x37)) ||
+ (MGAISG450(pMga) &&
+ ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) ||
+ (i == 0x4c) || (i == 0x4d) || (i == 0x4e))))
+ continue;
+ outMGAdac(i, mgaReg->DacRegs[i]);
+ }
+
+ /* Do not set the memory config for primary cards as it
+ should be correct already */
+ optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK;
+
+ if (!MGAISG450(pMga)) {
+ /* restore pci_option register */
+ pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask,
+ mgaReg->Option);
+ if (pMga->Chipset != PCI_CHIP_MGA1064)
+ pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK,
+ mgaReg->Option2);
+ if (pMga->Chipset == PCI_CHIP_MGAG400)
+ pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK,
+ mgaReg->Option3);
+ }
+); /* MGA_NOT_HAL */
+
+ /* restore CRTCEXT regs */
+ for (i = 0; i < 6; i++)
+ OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i);
+
+ /*
+ * This function handles restoring the generic VGA registers.
+ */
+ vgaHWRestore(pScrn, vgaReg,
VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0));
- MGAGRestorePalette(pScrn, vgaReg->DAC);
-
- /*
- * this is needed to properly restore start address
- */
- OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0);
+ MGAGRestorePalette(pScrn, vgaReg->DAC);
+
+ /*
+ * this is needed to properly restore start address
+ */
+ OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0);
+ } else {
+ /* Second Crtc */
+ xMODEINFO ModeInfo;
+
+ /* Enable Dual Head */
+ CRTC2Set(pScrn, &ModeInfo);
+ EnableSecondOutPut(pScrn, &ModeInfo);
+ CRTC2SetPitch(pScrn, &ModeInfo);
+ CRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0);
+
+ for (i = 0x80; i <= 0xa0; i ++) {
+ if (i== 0x8d) {
+ i = 0x8f;
+ continue;
+ }
+ outMGAdac(i, mgaReg->dac2[ i - 0x80]);
+ }
+ } /* endif pMga->SecondCrtc */
#ifdef DEBUG
ErrorF("Setting DAC:");
@@ -740,7 +761,13 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
int i;
MGAPtr pMga = MGAPTR(pScrn);
- if(pMga->SecondCrtc == TRUE) return;
+ if(pMga->SecondCrtc == TRUE) {
+ for(i = 0x80; i < 0xa0; i++)
+ mgaReg->dac2[i-0x80] = inMGAdac(i);
+
+ return;
+ }
+
MGA_NOT_HAL(
/* Allocate the DacRegs space if not done already */
if (mgaReg->DacRegs == NULL) {
@@ -842,7 +869,10 @@ MGAGSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
while( INREG( MGAREG_Status ) & 0x08 );
/* Output position - "only" 12 bits of location documented */
- OUTREG( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (y << 16) | (x & 0xFFFF));
+ OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (x & 0xFF));
+ OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XHI, (x & 0xF00) >> 8);
+ OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YLOW, (y & 0xFF));
+ OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YHI, (y & 0xF00) >> 8);
}
static void
@@ -986,7 +1016,9 @@ MGAGRamdacInit(ScrnInfoPtr pScrn)
MGAdac->ShowCursor = MGAGShowCursor;
MGAdac->UseHWCursor = MGAGUseHWCursor;
MGAdac->CursorFlags =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+#endif
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c
new file mode 100644
index 000000000..4dae28e97
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c
@@ -0,0 +1,502 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.1 2001/04/05 17:42:32 dawes Exp $ */
+/*********************************************************************
+* G450: This is for Dual Head.
+* Matrox Graphics
+* Author : Luugi Marsan
+**********************************************************************/
+
+
+/* All drivers should typically include these */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+
+/* Drivers for PCI hardware need this */
+#include "xf86PciInfo.h"
+
+/* Drivers that need to access the PCI config space directly need this */
+#include "xf86Pci.h"
+
+#include "mga_bios.h"
+#include "mga_reg.h"
+#include "mga.h"
+
+#define MNP_TABLE_SIZE 64
+#define CLKSEL_MGA 0x0c
+#define PLLLOCK 0x40
+
+/* CRTC2 control field*/
+#define C2_EN_A 0
+#define C2_EN_M (1 << C2_EN_A)
+#define C2_HIPRILVL_A 4
+#define C2_HIPRILVL_M (7 << C2_HIPRILVL_A)
+#define C2_MAXHIPRI_A 8
+#define C2_MAXHIPRI_M (7 << C2_MAXHIPRI_A)
+
+#define C2CTL_PIXCLKSEL_SHIFT 1L
+#define C2CTL_PIXCLKSEL_MASK (3L << C2CTL_PIXCLKSEL_SHIFT)
+#define C2CTL_PIXCLKSELH_SHIFT 14L
+#define C2CTL_PIXCLKSELH_MASK (1L << C2CTL_PIXCLKSELH_SHIFT)
+#define C2CTL_PIXCLKSEL_PCICLK 0L
+#define C2CTL_PIXCLKSEL_VDOCLK (1L << C2CTL_PIXCLKSEL_SHIFT)
+#define C2CTL_PIXCLKSEL_PIXELPLL (2L << C2CTL_PIXCLKSEL_SHIFT)
+#define C2CTL_PIXCLKSEL_VIDEOPLL (3L << C2CTL_PIXCLKSEL_SHIFT)
+#define C2CTL_PIXCLKSEL_VDCLK (1L << C2CTL_PIXCLKSELH_SHIFT)
+
+#define C2CTL_PIXCLKSEL_CRISTAL (1L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT)
+#define C2CTL_PIXCLKSEL_SYSTEMPLL (2L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT)
+
+#define C2CTL_PIXCLKDIS_SHIFT 3L
+#define C2CTL_PIXCLKDIS_MASK (1L << C2CTL_PIXCLKDIS_SHIFT)
+#define C2CTL_PIXCLKDIS_DISABLE (1L << C2CTL_PIXCLKDIS_SHIFT)
+
+#define C2CTL_CRTCDACSEL_SHIFT 20L
+#define C2CTL_CRTCDACSEL_MASK (1L << C2CTL_CRTCDACSEL_SHIFT)
+#define C2CTL_CRTCDACSEL_CRTC1 0
+#define C2CTL_CRTCDACSEL_CRTC2 (1L << C2CTL_CRTCDACSEL_SHIFT)
+
+/* Misc field*/
+#define IOADDSEL 0x01
+#define RAMMAPEN 0x02
+#define CLKSEL_25175 0x00
+#define CLKSEL_28322 0x04
+#define CLKSEL_MGA 0x0c
+#define VIDEODIS 0x10
+#define HPGODDEV 0x20
+#define HSYNCPOL 0x40
+#define VSYNCPOL 0x80
+
+/* XSYNCCTRL field */
+#define XSYNCCTRL_DAC1HSPOL_SHIFT 2
+#define XSYNCCTRL_DAC1HSPOL_MASK (1 << XSYNCCTRL_DAC1HSPOL_SHIFT)
+#define XSYNCCTRL_DAC1HSPOL_NEG (1 << XSYNCCTRL_DAC1HSPOL_SHIFT)
+#define XSYNCCTRL_DAC1HSPOL_POS 0
+#define XSYNCCTRL_DAC1VSPOL_SHIFT 3
+#define XSYNCCTRL_DAC1VSPOL_MASK (1 << XSYNCCTRL_DAC1VSPOL_SHIFT)
+#define XSYNCCTRL_DAC1VSPOL_NEG (1 << XSYNCCTRL_DAC1VSPOL_SHIFT)
+#define XSYNCCTRL_DAC1VSPOL_POS 0
+#define XSYNCCTRL_DAC2HSPOL_SHIFT 6
+#define XSYNCCTRL_DAC2HSPOL_MASK (1 << XSYNCCTRL_DAC2HSPOL_SHIFT)
+#define XSYNCCTRL_DAC2HSPOL_NEG (1 << XSYNCCTRL_DAC2HSPOL_SHIFT)
+#define XSYNCCTRL_DAC2HSPOL_POS 0
+#define XSYNCCTRL_DAC2VSPOL_SHIFT 7
+#define XSYNCCTRL_DAC2VSPOL_MASK (1 << XSYNCCTRL_DAC2VSPOL_SHIFT)
+#define XSYNCCTRL_DAC2VSPOL_NEG (1 << XSYNCCTRL_DAC2VSPOL_SHIFT)
+#define XSYNCCTRL_DAC2VSPOL_POS 0
+#define XSYNCCTRL_DAC1HSOFF_SHIFT 0
+#define XSYNCCTRL_DAC1HSOFF_MASK (1 << XSYNCCTRL_DAC1HSOFF_SHIFT)
+#define XSYNCCTRL_DAC1HSOFF_OFF (1 << XSYNCCTRL_DAC1HSOFF_SHIFT)
+#define XSYNCCTRL_DAC1HSOFF_ON 1
+#define XSYNCCTRL_DAC1VSOFF_SHIFT 1
+#define XSYNCCTRL_DAC1VSOFF_MASK (1 << XSYNCCTRL_DAC1VSOFF_SHIFT)
+#define XSYNCCTRL_DAC1VSOFF_OFF (1 << XSYNCCTRL_DAC1VSOFF_SHIFT)
+#define XSYNCCTRL_DAC1VSOFF_ON 0
+#define XSYNCCTRL_DAC2HSOFF_SHIFT 4
+#define XSYNCCTRL_DAC2HSOFF_MASK (1 << XSYNCCTRL_DAC2HSOFF_SHIFT)
+#define XSYNCCTRL_DAC2HSOFF_OFF (1 << XSYNCCTRL_DAC2HSOFF_SHIFT)
+#define XSYNCCTRL_DAC2HSOFF_ON 0
+#define XSYNCCTRL_DAC2VSOFF_SHIFT 5
+#define XSYNCCTRL_DAC2VSOFF_MASK (1 << XSYNCCTRL_DAC2VSOFF_SHIFT)
+#define XSYNCCTRL_DAC2VSOFF_OFF (1 << XSYNCCTRL_DAC2VSOFF_SHIFT)
+#define XSYNCCTRL_DAC2VSOFF_ON 0
+
+
+/* XDISPCTRL field */
+#define XDISPCTRL_DAC1OUTSEL_SHIFT 0L
+#define XDISPCTRL_DAC1OUTSEL_MASK 1L
+#define XDISPCTRL_DAC1OUTSEL_DIS 0L
+#define XDISPCTRL_DAC1OUTSEL_EN 1L
+#define XDISPCTRL_DAC2OUTSEL_SHIFT 2L
+#define XDISPCTRL_DAC2OUTSEL_MASK (3L << XDISPCTRL_DAC2OUTSEL_SHIFT)
+#define XDISPCTRL_DAC2OUTSEL_DIS 0L
+#define XDISPCTRL_DAC2OUTSEL_CRTC1 (1L << XDISPCTRL_DAC2OUTSEL_SHIFT)
+#define XDISPCTRL_DAC2OUTSEL_CRTC2 (2L << XDISPCTRL_DAC2OUTSEL_SHIFT)
+#define XDISPCTRL_DAC2OUTSEL_TVE (3L << XDISPCTRL_DAC2OUTSEL_SHIFT)
+#define XDISPCTRL_PANOUTSEL_SHIFT 5L
+#define XDISPCTRL_PANOUTSEL_MASK (3L << XDISPCTRL_PANOUTSEL_SHIFT)
+#define XDISPCTRL_PANOUTSEL_DIS 0L
+#define XDISPCTRL_PANOUTSEL_CRTC1 (1L << XDISPCTRL_PANOUTSEL_SHIFT)
+#define XDISPCTRL_PANOUTSEL_CRTC2RGB (2L << XDISPCTRL_PANOUTSEL_SHIFT)
+#define XDISPCTRL_PANOUTSEL_CRTC2656 (3L << XDISPCTRL_PANOUTSEL_SHIFT)
+
+/* XPWRCTRL field*/
+#define XPWRCTRL_DAC2PDN_SHIFT 0
+#define XPWRCTRL_DAC2PDN_MASK (1 << XPWRCTRL_DAC2PDN_SHIFT)
+#define XPWRCTRL_VIDPLLPDN_SHIFT 1
+#define XPWRCTRL_VIDPLLPDN_MASK (1 << XPWRCTRL_VIDPLLPDN_SHIFT)
+#define XPWRCTRL_PANPDN_SHIFT 2
+#define XPWRCTRL_PANPDN_MASK (1 << XPWRCTRL_PANPDN_SHIFT)
+#define XPWRCTRL_RFIFOPDN_SHIFT 3
+#define XPWRCTRL_RFIFOPDN_MASK (1 << XPWRCTRL_RFIFOPDN_SHIFT)
+#define XPWRCTRL_CFIFOPDN_SHIFT 4
+#define XPWRCTRL_CFIFOPDN_MASK (1 << XPWRCTRL_CFIFOPDN_SHIFT)
+
+
+
+#define POS_HSYNC 0x00000004
+#define POS_VSYNC 0x00000008
+
+
+/* Set CRTC 2*/
+/* Uses the mode given by xfree86 to setup the registry */
+/* Does not write to the hard yet */
+void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
+{
+
+
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg = &pMga->ModeReg;
+
+ xMODEINFO tmpModeInfo;
+ CARD32 ulHTotal;
+ CARD32 ulHDispEnd;
+ CARD32 ulHBlkStr;
+ CARD32 ulHBlkEnd;
+ CARD32 ulHSyncStr;
+ CARD32 ulHSyncEnd;
+ CARD32 ulVTotal;
+ CARD32 ulVDispEnd;
+ CARD32 ulVBlkStr;
+ CARD32 ulVBlkEnd;
+ CARD32 ulVSyncStr;
+ CARD32 ulVSyncEnd;
+ CARD32 ulOffset;
+ CARD32 ulCtl2;
+ CARD32 ulDataCtl2;
+ CARD32 ulDispHeight = pModeInfo->ulDispHeight;
+
+#ifdef DEBUG
+ ErrorF("ENTER CRTC2Get\n");
+#endif
+
+ tmpModeInfo = *pModeInfo;
+
+
+ /* First compute the Values */
+
+ ulHTotal = tmpModeInfo.ulDispWidth +
+ tmpModeInfo.ulHFPorch +
+ tmpModeInfo.ulHBPorch +
+ tmpModeInfo.ulHSync;
+
+ ulHDispEnd = tmpModeInfo.ulDispWidth;
+ ulHBlkStr = ulHDispEnd;
+ ulHBlkEnd = ulHBlkStr + tmpModeInfo.ulHBPorch + tmpModeInfo.ulHFPorch + tmpModeInfo.ulHSync;
+ ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch;
+ ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync;
+
+ ulVTotal = ulDispHeight +
+ tmpModeInfo.ulVFPorch +
+ tmpModeInfo.ulVBPorch +
+ tmpModeInfo.ulVSync;
+
+
+ ulVDispEnd = ulDispHeight;
+ ulVBlkStr = ulVDispEnd;
+ ulVBlkEnd = ulVBlkStr + tmpModeInfo.ulVBPorch + tmpModeInfo.ulVFPorch + tmpModeInfo.ulVSync;
+ ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch;
+ ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync;
+
+ ulOffset = tmpModeInfo.ulFBPitch;
+
+
+
+ ulCtl2 = INREG(MGAREG_C2CTL);
+ ulDataCtl2 = INREG(MGAREG_C2DATACTL);
+
+ ulCtl2 &= 0xFF1FFFFF;
+ ulDataCtl2 &= 0xFFFFFF00;
+
+ switch (tmpModeInfo.ulBpp)
+ {
+ case 15: ulCtl2 |= 0x00200000;
+ ulOffset <<= 1;
+ break;
+ case 16: ulCtl2 |= 0x00400000;
+ ulOffset <<= 1;
+ break;
+ case 32: ulCtl2 |= 0x00800000;
+ ulOffset <<= 2;
+ break;
+ }
+
+
+ pReg->crtc2[ MGAREG2_C2CTL ] = ulCtl2;
+ pReg->crtc2[ MGAREG2_C2DATACTL ] = ulDataCtl2;
+
+ /* Horizontal Value*/
+ pReg->crtc2[MGAREG2_C2HPARAM] = (((ulHDispEnd-8) << 16) | (ulHTotal-8)) ;
+ pReg->crtc2[MGAREG2_C2HSYNC] = (((ulHSyncEnd-8) << 16) | (ulHSyncStr-8)) ;
+
+
+ /*Vertical Value*/
+ pReg->crtc2[MGAREG2_C2VPARAM] = (((ulVDispEnd-1) << 16) | (ulVTotal-1)) ;
+ pReg->crtc2[MGAREG2_C2VSYNC] = (((ulVSyncEnd-1) << 16) | (ulVSyncStr-1)) ;
+
+ /** Offset value*/
+
+ pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset;
+
+#ifdef DEBUG
+ ErrorF("EXIT CRTC2Get\n");
+#endif
+
+}
+
+/* Set CRTC 2*/
+/* Writes to the hardware */
+void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
+{
+
+
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg = &pMga->ModeReg;
+
+#ifdef DEBUG
+ ErrorF("ENTER CRTC2Set\n");
+#endif
+
+
+ /* This writes to the registers manually */
+ OUTREG(MGAREG_C2CTL, pReg->crtc2[MGAREG2_C2CTL]);
+ OUTREG(MGAREG_C2DATACTL,pReg->crtc2[MGAREG2_C2DATACTL]);
+
+
+ /* Horizontal Value*/
+ OUTREG(MGAREG_C2HPARAM, pReg->crtc2[MGAREG2_C2HPARAM]);
+ OUTREG(MGAREG_C2HSYNC, pReg->crtc2[MGAREG2_C2HSYNC]);
+
+
+ /*Vertical Value*/
+ OUTREG(MGAREG_C2VPARAM, pReg->crtc2[MGAREG2_C2VPARAM]);
+ OUTREG(MGAREG_C2VSYNC, pReg->crtc2[MGAREG2_C2VSYNC]);
+
+ /** Offset value*/
+
+ OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2VSYNC]);
+#ifdef DEBUG
+ ErrorF("EXIT CRTC2Set\n");
+#endif
+
+}
+
+
+ /* Set CRTC2 on Second OutPut*/
+void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
+{
+ CARD8 ucByte, ucXDispCtrl;
+ CARD32 ulC2CTL, ulStatusReg;
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg;
+ pReg = &pMga->ModeReg;
+#ifdef DEBUG
+ ErrorF("ENTER EnableSecondOutPut\n");
+#endif
+
+
+ /* Route Video PLL on second CRTC */
+ ulC2CTL = INREG( MGAREG_C2CTL);
+
+ /*--- Disable Pixel clock oscillations On Crtc1 */
+ OUTREG( MGAREG_C2CTL, ulC2CTL | C2CTL_PIXCLKDIS_MASK);
+ /*--- Have to wait minimum time (2 acces will be ok) */
+ ulStatusReg = INREG( MGAREG_Status);
+ ulStatusReg = INREG( MGAREG_Status);
+
+
+ ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK);
+
+ ulC2CTL |= C2CTL_PIXCLKSEL_VIDEOPLL;
+
+
+ OUTREG( MGAREG_C2CTL, ulC2CTL);
+ /*--- Enable Pixel clock oscillations on CRTC2*/
+ OUTREG( MGAREG_C2CTL, ulC2CTL & ~C2CTL_PIXCLKDIS_MASK);
+
+
+ /* We don't use MISC synch pol, must be 0*/
+ ucByte = inMGAdreg( MGAREG_MISC_READ);
+
+ OUTREG8(MGAREG_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) ));
+
+
+
+
+ /* Set Rset to 0.7 V*/
+ ucByte = inMGAdac(MGA1064_GEN_IO_CTL);
+ ucByte &= ~0x40;
+ pReg->DacRegs[MGA1064_GEN_IO_CTL] = ucByte;
+ outMGAdac (MGA1064_GEN_IO_CTL, ucByte);
+
+ ucByte = inMGAdac( MGA1064_GEN_IO_DATA);
+ ucByte &= ~0x40;
+ pReg->DacRegs[MGA1064_GEN_IO_DATA]= ucByte;
+ outMGAdac (MGA1064_GEN_IO_DATA, ucByte);
+
+
+
+ /* Route Crtc2 on Dac2*/
+ ulC2CTL = INREG( MGAREG_C2CTL);
+ ucXDispCtrl = inMGAdac( MGA1064_DISP_CTL);
+
+ ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK;
+ ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2;
+
+ /* Enable CRTC2*/
+ ulC2CTL |= C2_EN_M;
+
+ pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl;
+
+
+
+ OUTREG( MGAREG_C2CTL, ulC2CTL);
+
+ /* Set DAC2 Synch polarity*/
+ ucByte = inMGAdac( MGA1064_SYNC_CTL);
+ ucByte &= ~(XSYNCCTRL_DAC2HSPOL_MASK | XSYNCCTRL_DAC2VSPOL_MASK);
+ if ( !(pModeInfo->flSignalMode & POS_HSYNC) )
+ {
+ ucByte |= XSYNCCTRL_DAC2HSPOL_NEG;
+ }
+ if ( !(pModeInfo->flSignalMode & POS_VSYNC) )
+ {
+ ucByte |= XSYNCCTRL_DAC2VSPOL_NEG;
+ }
+
+ /* Enable synch output*/
+ ucByte &= ~(XSYNCCTRL_DAC2HSOFF_MASK | XSYNCCTRL_DAC2VSOFF_MASK);
+ pReg->dac2[ MGA1064_SYNC_CTL - 0x80] = ucByte;
+
+ /* Powerup DAC2*/
+ ucByte = inMGAdac( MGA1064_PWR_CTL);
+ pReg->dac2[ MGA1064_PWR_CTL - 0x80] = /* 0x0b; */ (ucByte | XPWRCTRL_DAC2PDN_MASK);
+
+
+
+ /* Power up Fifo*/
+ ucByte = inMGAdac( MGA1064_PWR_CTL);
+ pReg->dac2[ MGA1064_PWR_CTL - 0x80] = 0x1b; /* (ucByte | XPWRCTRL_CFIFOPDN_MASK) */;
+
+
+#ifdef DEBUG
+ ErrorF("EXIT EnableSecondOutPut\n");
+#endif
+}
+
+
+
+
+
+void CRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
+{
+ CARD32 ulOffset;
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg;
+
+ pReg = &pMga->ModeReg;
+#ifdef DEBUG
+ ErrorF("ENTER CRTC2GetPitch\n");
+#endif
+
+
+ switch(pModeInfo->ulBpp)
+ {
+ case 15:
+ case 16:
+ ulOffset = pModeInfo->ulFBPitch * 2;
+ break;
+ case 32:
+ ulOffset = pModeInfo->ulFBPitch * 4;
+ break;
+ }
+
+ pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset;
+
+#ifdef DEBUG
+ ErrorF("EXIT CRTC2GetPitch\n");
+#endif
+
+}
+
+void CRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
+{
+
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg;
+ pReg = &pMga->ModeReg;
+
+#ifdef DEBUG
+ ErrorF("ENTER CRCT2SetPitch\n");
+#endif
+
+
+ OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]);
+#ifdef DEBUG
+ ErrorF("EXIT CRCT2SetPitch\n");
+#endif
+
+}
+
+
+ /* Set Display Start*/
+ /* base in bytes*/
+void CRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY)
+{
+
+ CARD32 ulAddress;
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg;
+ pReg = &pMga->ModeReg;
+
+#ifdef DEBUG
+ ErrorF("ENTER CRTC2GetDisplayStart\n");
+#endif
+
+
+ pReg = &pMga->ModeReg;
+
+ ulAddress = (pModeInfo->ulFBPitch * ulY + ulX);
+ switch(pModeInfo->ulBpp)
+ {
+ case 15:
+ case 16:
+ ulAddress <<= 1;
+ break;
+ case 32:
+ ulAddress <<= 2;
+ break;
+ }
+
+ pReg->crtc2[MGAREG2_C2STARTADD0] = ulAddress + base;
+#ifdef DEBUG
+ ErrorF("EXIT CRTC2GetDisplayStart\n");
+#endif
+
+}
+
+void CRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY)
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGARegPtr pReg;
+ pReg = &pMga->ModeReg;
+#ifdef DEBUG
+ ErrorF("ENTER CRTC2SetDisplayStart\n");
+#endif
+
+ OUTREG(MGAREG2_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]);
+#ifdef DEBUG
+ ErrorF("EXIT CRTC2GetDisplayStart\n");
+#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
index 10ad53bc9..eba6ecaf8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -1,4 +1,32 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.16 2001/01/08 01:07:37 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.19 2001/03/21 19:46:27 dawes Exp $ */
+
+/*
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -15,219 +43,172 @@
#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_wrap.h"
+#include "mga_sarea.h"
-static char MGAKernelDriverName[] = "mga";
-static char MGAClientDriverName[] = "mga";
+#define _XF86DRI_SERVER_
+#include "GL/glxtokens.h"
+#include "sarea.h"
-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);
-static void MGADRISwapContext_shared(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);
-
-Bool MgaCleanupDma(ScrnInfoPtr pScrn)
-{
- MGAPtr pMGA = MGAPTR(pScrn);
- Bool ret_val;
- ret_val = drmMgaCleanupDma(pMGA->drmSubFD);
- if (ret_val == FALSE)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mga Dma Cleanup Failed\n");
- return ret_val;
-}
-Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags)
-{
- MGAPtr pMGA = MGAPTR(pScrn);
- Bool ret_val;
- ret_val = drmMgaLockUpdate(pMGA->drmSubFD, flags);
- if (ret_val == FALSE)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "LockUpdate failed\n");
+#include "GL/glxtokens.h"
- return ret_val;
-}
+#include "mga_bios.h"
+#include "mga_reg.h"
+#include "mga.h"
+#include "mga_macros.h"
+#include "mga_dri.h"
-Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size)
-{
- MGAPtr pMGA = MGAPTR(pScrn);
- MGADRIPtr pMGADRI = (MGADRIPtr)pMGA->pDRIInfo->devPrivate;
- MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
- drmMgaInit init;
- Bool ret_val;
-
- memset(&init, 0, sizeof(drmMgaInit));
- 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;
+#include "mga_sarea.h"
- switch(pMGA->Chipset) {
- case PCI_CHIP_MGAG400:
- init.chipset = MGA_CARD_TYPE_G400;
- break;
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- init.chipset = MGA_CARD_TYPE_G200;
- break;
- default:
- return FALSE;
- }
-
- init.frontOffset = pMGADRI->frontOffset;
- init.backOffset = pMGADRI->backOffset;
- init.depthOffset = pMGADRI->depthOffset;
- init.textureOffset = pMGADRI->textureOffset;
- init.textureSize = pMGADRI->textureSize;
- init.agpTextureSize = pMGADRI->agpTextureSize;
- init.cpp = pMGADRI->cpp;
- init.stride = pMGADRI->frontPitch;
- init.mAccess = pMGA->MAccess;
- init.sgram = !pMGA->HasSDRAM;
-
- memcpy(&init.WarpIndex, &pMGADRIServer->WarpIndex,
- sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization start\n");
-
- ret_val = drmMgaInitDma(pMGA->drmSubFD, &init);
- if (ret_val == FALSE)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Mga Dma Initialization Failed\n");
- else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization done\n");
- return ret_val;
-}
+static char MGAKernelDriverName[] = "mga";
+static char MGAClientDriverName[] = "mga";
-static Bool
-MGAInitVisualConfigs(ScreenPtr pScreen)
+/* DRI buffer management
+ */
+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 );
+
+
+/* Initialize the visual configs that are supported by the hardware.
+ * These are combined with the visual configs that the indirect
+ * rendering core supports, and the intersection is exported to the
+ * client.
+ */
+static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMGA = MGAPTR(pScrn);
+ MGAPtr pMga = MGAPTR(pScrn);
int numConfigs = 0;
__GLXvisualConfig *pConfigs = 0;
MGAConfigPrivPtr pMGAConfigs = 0;
MGAConfigPrivPtr *pMGAConfigPtrs = 0;
int i, db, depth, stencil, accum;
- switch (pScrn->bitsPerPixel) {
+ switch ( pScrn->bitsPerPixel ) {
case 8:
case 24:
break;
+
case 16:
numConfigs = 8;
- if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig),
- numConfigs))) {
+ pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig),
+ numConfigs );
+ if ( !pConfigs ) {
return FALSE;
}
- if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec),
- numConfigs))) {
- xfree(pConfigs);
+
+ pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec),
+ numConfigs );
+ if ( !pMGAConfigs ) {
+ xfree( pConfigs );
return FALSE;
}
- if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr),
- numConfigs))) {
- xfree(pConfigs);
- xfree(pMGAConfigs);
+
+ pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr),
+ numConfigs );
+ if ( !pMGAConfigPtrs ) {
+ xfree( pConfigs );
+ xfree( pMGAConfigs );
return FALSE;
}
- for (i=0; i<numConfigs; i++)
+
+ for ( i = 0 ; i < numConfigs ; i++ ) {
pMGAConfigPtrs[i] = &pMGAConfigs[i];
+ }
i = 0;
depth = 1;
- for (accum = 0; accum <= 1; accum++) {
- for (stencil = 0; stencil <= 1; stencil++) { /* no stencil for now */
- for (db=1; db>=0; db--) {
- pConfigs[i].vid = -1;
- pConfigs[i].class = -1;
- pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = 5;
- pConfigs[i].greenSize = 6;
- pConfigs[i].blueSize = 5;
- pConfigs[i].alphaSize = 0;
- pConfigs[i].redMask = 0x0000F800;
- pConfigs[i].greenMask = 0x000007E0;
- pConfigs[i].blueMask = 0x0000001F;
- pConfigs[i].alphaMask = 0;
- if (accum) {
- pConfigs[i].accumRedSize = 16;
- pConfigs[i].accumGreenSize = 16;
- pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 0;
+ for ( accum = 0 ; accum <= 1 ; accum++ ) {
+ for ( stencil = 0 ; stencil <= 1 ; stencil++ ) {
+ for ( db = 1 ; db >= 0 ; db-- ) {
+ pConfigs[i].vid = -1;
+ pConfigs[i].class = -1;
+ pConfigs[i].rgba = TRUE;
+ pConfigs[i].redSize = 5;
+ pConfigs[i].greenSize = 6;
+ pConfigs[i].blueSize = 5;
+ pConfigs[i].alphaSize = 0;
+ pConfigs[i].redMask = 0x0000F800;
+ pConfigs[i].greenMask = 0x000007E0;
+ pConfigs[i].blueMask = 0x0000001F;
+ pConfigs[i].alphaMask = 0;
+ if ( accum ) {
+ pConfigs[i].accumRedSize = 16;
+ pConfigs[i].accumGreenSize = 16;
+ pConfigs[i].accumBlueSize = 16;
+ pConfigs[i].accumAlphaSize = 0;
} else {
- pConfigs[i].accumRedSize = 0;
- pConfigs[i].accumGreenSize = 0;
- pConfigs[i].accumBlueSize = 0;
- pConfigs[i].accumAlphaSize = 0;
+ pConfigs[i].accumRedSize = 0;
+ pConfigs[i].accumGreenSize = 0;
+ pConfigs[i].accumBlueSize = 0;
+ pConfigs[i].accumAlphaSize = 0;
}
- if (db)
- pConfigs[i].doubleBuffer = TRUE;
- else
- pConfigs[i].doubleBuffer = FALSE;
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 16;
- if (depth)
- pConfigs[i].depthSize = 16;
- else
- pConfigs[i].depthSize = 0;
- if (stencil)
- pConfigs[i].stencilSize = 8;
- else
- pConfigs[i].stencilSize = 0;
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (stencil || accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
- else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
+ if ( db ) {
+ pConfigs[i].doubleBuffer = TRUE;
+ } else {
+ pConfigs[i].doubleBuffer = FALSE;
+ }
+ pConfigs[i].stereo = FALSE;
+ pConfigs[i].bufferSize = 16;
+ if ( depth ) {
+ pConfigs[i].depthSize = 16;
+ } else {
+ pConfigs[i].depthSize = 0;
+ }
+ if ( stencil ) {
+ pConfigs[i].stencilSize = 8;
+ } else {
+ pConfigs[i].stencilSize = 0;
+ }
+ pConfigs[i].auxBuffers = 0;
+ pConfigs[i].level = 0;
+ if ( accum || stencil ) {
+ pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ } else {
+ pConfigs[i].visualRating = GLX_NONE_EXT;
+ }
+ pConfigs[i].transparentPixel = 0;
+ pConfigs[i].transparentRed = 0;
+ pConfigs[i].transparentGreen = 0;
+ pConfigs[i].transparentBlue = 0;
+ pConfigs[i].transparentAlpha = 0;
+ pConfigs[i].transparentIndex = 0;
i++;
}
}
}
- if (i != numConfigs) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Incorrect initialization of visuals\n");
+ if ( i != numConfigs ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Incorrect initialization of visuals\n" );
return FALSE;
}
break;
@@ -235,152 +216,689 @@ MGAInitVisualConfigs(ScreenPtr pScreen)
case 32:
numConfigs = 8;
- if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig),
- numConfigs))) {
+ pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig),
+ numConfigs );
+ if ( !pConfigs ) {
return FALSE;
}
- if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec),
- numConfigs))) {
- xfree(pConfigs);
+
+ pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec),
+ numConfigs );
+ if ( !pMGAConfigs ) {
+ xfree( pConfigs );
return FALSE;
}
- if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr),
- numConfigs))) {
- xfree(pConfigs);
- xfree(pMGAConfigs);
+
+ pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr),
+ numConfigs );
+ if ( !pMGAConfigPtrs ) {
+ xfree( pConfigs );
+ xfree( pMGAConfigs );
return FALSE;
}
- for (i=0; i<numConfigs; i++)
+
+ for ( i = 0 ; i < numConfigs ; i++ ) {
pMGAConfigPtrs[i] = &pMGAConfigs[i];
+ }
i = 0;
- for (accum = 0; accum <= 1; accum++) {
- for (depth = 0; depth <= 1; depth++) { /* and stencil */
- for (db=1; db>=0; db--) {
- pConfigs[i].vid = -1;
- pConfigs[i].class = -1;
- pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = 8;
- pConfigs[i].greenSize = 8;
- pConfigs[i].blueSize = 8;
- pConfigs[i].alphaSize = 0;
- pConfigs[i].redMask = 0x00FF0000;
- pConfigs[i].greenMask = 0x0000FF00;
- pConfigs[i].blueMask = 0x000000FF;
- pConfigs[i].alphaMask = 0;
- if (accum) {
- pConfigs[i].accumRedSize = 16;
- pConfigs[i].accumGreenSize = 16;
- pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 0;
+ for ( accum = 0 ; accum <= 1 ; accum++ ) {
+ for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */
+ for ( db = 1 ; db >= 0 ; db-- ) {
+ pConfigs[i].vid = -1;
+ pConfigs[i].class = -1;
+ pConfigs[i].rgba = TRUE;
+ pConfigs[i].redSize = 8;
+ pConfigs[i].greenSize = 8;
+ pConfigs[i].blueSize = 8;
+ pConfigs[i].alphaSize = 8;
+ pConfigs[i].redMask = 0x00FF0000;
+ pConfigs[i].greenMask = 0x0000FF00;
+ pConfigs[i].blueMask = 0x000000FF;
+ pConfigs[i].alphaMask = 0;
+ if ( accum ) {
+ pConfigs[i].accumRedSize = 16;
+ pConfigs[i].accumGreenSize = 16;
+ pConfigs[i].accumBlueSize = 16;
+ pConfigs[i].accumAlphaSize = 0;
} else {
- pConfigs[i].accumRedSize = 0;
- pConfigs[i].accumGreenSize = 0;
- pConfigs[i].accumBlueSize = 0;
- pConfigs[i].accumAlphaSize = 0;
+ pConfigs[i].accumRedSize = 0;
+ pConfigs[i].accumGreenSize = 0;
+ pConfigs[i].accumBlueSize = 0;
+ pConfigs[i].accumAlphaSize = 0;
}
- if (db)
- pConfigs[i].doubleBuffer = TRUE;
- else
- pConfigs[i].doubleBuffer = FALSE;
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 32;
- if (depth) {
- pConfigs[i].depthSize = 24;
- pConfigs[i].stencilSize = 8;
+ if ( db ) {
+ pConfigs[i].doubleBuffer = TRUE;
+ } else {
+ pConfigs[i].doubleBuffer = FALSE;
+ }
+ pConfigs[i].stereo = FALSE;
+ pConfigs[i].bufferSize = 32;
+ if ( depth ) {
+ pConfigs[i].depthSize = 24;
+ pConfigs[i].stencilSize = 8;
}
else {
- pConfigs[i].depthSize = 0;
- pConfigs[i].stencilSize = 0;
+ pConfigs[i].depthSize = 0;
+ pConfigs[i].stencilSize = 0;
}
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
- else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
+ pConfigs[i].auxBuffers = 0;
+ pConfigs[i].level = 0;
+ if ( accum ) {
+ pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ } else {
+ pConfigs[i].visualRating = GLX_NONE_EXT;
+ }
+ pConfigs[i].transparentPixel = 0;
+ pConfigs[i].transparentRed = 0;
+ pConfigs[i].transparentGreen = 0;
+ pConfigs[i].transparentBlue = 0;
+ pConfigs[i].transparentAlpha = 0;
+ pConfigs[i].transparentIndex = 0;
i++;
}
}
}
- if (i != numConfigs) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Incorrect initialization of visuals\n");
+ if ( i != numConfigs ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Incorrect initialization of visuals\n" );
return FALSE;
}
break;
default:
- ; /* unexpected bits/pixelx */
+ /* Unexpected bits/pixels */
+ break;
}
- pMGA->numVisualConfigs = numConfigs;
- pMGA->pVisualConfigs = pConfigs;
- pMGA->pVisualConfigsPriv = pMGAConfigs;
- GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pMGAConfigPtrs);
+
+ pMga->numVisualConfigs = numConfigs;
+ pMga->pVisualConfigs = pConfigs;
+ pMga->pVisualConfigsPriv = pMGAConfigs;
+
+ GlxSetVisualConfigs( numConfigs, pConfigs, (void **)pMGAConfigPtrs );
+
+ return TRUE;
+}
+
+static Bool MGACreateContext( ScreenPtr pScreen, VisualPtr visual,
+ drmContext hwContext, void *pVisualConfigPriv,
+ DRIContextType contextStore )
+{
+ /* Nothing yet */
return TRUE;
}
-static unsigned int mylog2(unsigned int n)
+static void MGADestroyContext( ScreenPtr pScreen, drmContext hwContext,
+ DRIContextType contextStore )
+{
+ /* Nothing yet */
+}
+
+
+/* Quiescence, locking
+ */
+#define MGA_TIMEOUT 2048
+
+static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn )
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+ int ret;
+ int i = 0;
+
+ for (;;) {
+ do {
+ ret = drmMGAFlushDMA( pMga->drmFD,
+ DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH );
+ } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) );
+
+ if ( ret == 0 )
+ return;
+
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "Idle timed out, resetting engine...\n" );
+
+ drmMGAEngineReset( pMga->drmFD );
+ }
+}
+
+
+void MGAGetQuiescence( ScrnInfoPtr pScrn )
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ DRILock( screenInfo.screens[pScrn->scrnIndex], 0 );
+ pMga->haveQuiescense = 1;
+
+ if ( pMga->directRenderingEnabled ) {
+ MGAFBLayout *pLayout = &pMga->CurrentLayout;
+
+ MGAWaitForIdleDMA( pScrn );
+
+ WAITFIFO( 11 );
+ OUTREG( MGAREG_MACCESS, pMga->MAccess );
+ OUTREG( MGAREG_PITCH, pLayout->displayWidth );
+
+ pMga->PlaneMask = ~0;
+ OUTREG( MGAREG_PLNWT, pMga->PlaneMask );
+
+ pMga->BgColor = 0;
+ pMga->FgColor = 0;
+ OUTREG( MGAREG_BCOL, pMga->BgColor );
+ OUTREG( MGAREG_FCOL, pMga->FgColor );
+ OUTREG( MGAREG_SRCORG, pMga->realSrcOrg );
+
+ pMga->SrcOrg = 0;
+ 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;
+ }
+}
+
+void MGAGetQuiescenceShared( ScrnInfoPtr pScrn )
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGAEntPtr pMGAEnt = pMga->entityPrivate;
+ MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2);
+
+ DRILock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex], 0 );
+
+ pMga = MGAPTR(pMGAEnt->pScrn_1);
+ pMga->haveQuiescense = 1;
+ pMGA2->haveQuiescense = 1;
+
+ if ( pMGAEnt->directRenderingEnabled ) {
+ MGAWaitForIdleDMA( pMGAEnt->pScrn_1 );
+ pMga->RestoreAccelState( pScrn );
+ xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex );
+ }
+}
+
+static void MGASwapContext( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ /* Arrange for dma_quiescence and xaa sync to be called as
+ * appropriate.
+ */
+ pMga->haveQuiescense = 0;
+ pMga->AccelInfoRec->NeedToSync = TRUE;
+}
+
+static void MGASwapContextShared( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGAEntPtr pMGAEnt = pMga->entityPrivate;
+ MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2);
+
+ pMga = MGAPTR(pMGAEnt->pScrn_1);
+
+ pMga->haveQuiescense = 0;
+ pMga->AccelInfoRec->NeedToSync = TRUE;
+
+ pMGA2->haveQuiescense = 0;
+ pMGA2->AccelInfoRec->NeedToSync = TRUE;
+}
+
+/* This is really only called from validate/postvalidate as we
+ * override the dri lock/unlock. Want to remove validate/postvalidate
+ * processing, but need to remove all client-side use of drawable lock
+ * first (otherwise there is noone recover when a client dies holding
+ * the drawable lock).
+ *
+ * What does this mean?
+ *
+ * - The above code gets executed every time a
+ * window changes shape or the focus changes, which isn't really
+ * optimal.
+ * - The X server therefore believes it needs to do an XAA sync
+ * *and* a dma quiescense ioctl each time that happens.
+ *
+ * We don't wrap wakeuphandler any longer, so at least we can say that
+ * this doesn't happen *every time the mouse moves*...
+ */
+static void
+MGADRISwapContext( ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType oldContextType, void *oldContext,
+ DRIContextType newContextType, void *newContext )
+{
+#if 0
+ if ( syncType == DRI_3D_SYNC &&
+ oldContextType == DRI_2D_CONTEXT &&
+ newContextType == DRI_2D_CONTEXT )
+ {
+ MGASwapContext( pScreen );
+ }
+#endif
+}
+
+static void
+MGADRISwapContextShared( ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType oldContextType, void *oldContext,
+ DRIContextType newContextType, void *newContext )
+{
+#if 0
+ if ( syncType == DRI_3D_SYNC &&
+ oldContextType == DRI_2D_CONTEXT &&
+ newContextType == DRI_2D_CONTEXT )
+ {
+ MGASwapContextShared( pScreen );
+ }
+#endif
+}
+
+
+static void MGAWakeupHandler( int screenNum, pointer wakeupData,
+ unsigned long result, pointer pReadmask )
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if ( xf86IsEntityShared( pScrn->entityList[0] ) ) {
+ MGASwapContextShared( pScreen );
+ } else {
+ MGASwapContext( pScreen );
+ }
+}
+
+static void MGABlockHandler( int screenNum, pointer blockData,
+ pointer pTimeout, pointer pReadmask )
+
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGAEntPtr pMGAEnt;
+
+ if ( pMga->haveQuiescense ) {
+ if ( xf86IsEntityShared( pScrn->entityList[0] ) ) {
+ /* Restore to first screen */
+ pMga->RestoreAccelState( pScrn );
+ xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex );
+ pMGAEnt = pMga->entityPrivate;
+
+ if ( pMGAEnt->directRenderingEnabled ) {
+ DRIUnlock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex] );
+ }
+ } else {
+ if ( pMga->directRenderingEnabled ) {
+ DRIUnlock( pScreen );
+ }
+ }
+ pMga->haveQuiescense = 0;
+ }
+}
+
+void MGASelectBuffer( ScrnInfoPtr pScrn, int which )
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate;
+
+ switch ( which ) {
+ case MGA_BACK:
+ OUTREG( MGAREG_DSTORG, pMGADRI->backOffset );
+ OUTREG( MGAREG_SRCORG, pMGADRI->backOffset );
+ break;
+ case MGA_DEPTH:
+ OUTREG( MGAREG_DSTORG, pMGADRI->depthOffset );
+ OUTREG( MGAREG_SRCORG, pMGADRI->depthOffset );
+ break;
+ default:
+ case MGA_FRONT:
+ OUTREG( MGAREG_DSTORG, pMGADRI->frontOffset );
+ OUTREG( MGAREG_SRCORG, pMGADRI->frontOffset );
+ break;
+ }
+}
+
+
+static unsigned int mylog2( unsigned int n )
{
unsigned int log2 = 1;
- while (n>1) n >>= 1, log2++;
+ while ( n > 1 ) n >>= 1, log2++;
return log2;
}
-static unsigned long MGAParseAgpMode(ScreenPtr pScreen)
+static Bool MGADRIAgpInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
MGAPtr pMga = MGAPTR(pScrn);
- unsigned long mode_mask;
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+ unsigned long mode;
+ unsigned int vendor, device;
+ int ret, count;
+
+ /* FIXME: Make these configurable...
+ */
+ pMGADRIServer->agp.size = 12 * 1024 * 1024;
- switch(pMga->agp_mode) {
+ pMGADRIServer->warp.offset = 0;
+ pMGADRIServer->warp.size = MGA_WARP_UCODE_SIZE;
+
+ pMGADRIServer->primary.offset = (pMGADRIServer->warp.offset +
+ pMGADRIServer->warp.size);
+ pMGADRIServer->primary.size = 1024 * 1024;
+
+ pMGADRIServer->buffers.offset = (pMGADRIServer->primary.offset +
+ pMGADRIServer->primary.size);
+ pMGADRIServer->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE;
+
+ if ( drmAgpAcquire( pMga->drmFD ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" );
+ return FALSE;
+ }
+
+ mode = drmAgpGetMode( pMga->drmFD ); /* Default mode */
+ vendor = drmAgpVendorId( pMga->drmFD );
+ device = drmAgpDeviceId( pMga->drmFD );
+
+ mode &= ~MGA_AGP_MODE_MASK;
+ switch ( pMga->agpMode ) {
case 4:
- mode_mask = ~0x00000003;
- break;
+ mode |= MGA_AGP_4X_MODE;
case 2:
- if (pMga->Chipset == PCI_CHIP_MGAG200) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Enabling AGP 2x pll encoding\n");
- OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_enable);
- }
- mode_mask = ~0x00000005;
- break;
- default:
- /* Default to 1X agp mode */
+ mode |= MGA_AGP_2X_MODE;
case 1:
- if (pMga->Chipset == PCI_CHIP_MGAG200) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Disabling AGP 2x pll encoding\n");
- OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_disable);
+ default:
+ mode |= MGA_AGP_1X_MODE;
+ }
+
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
+ mode, vendor, device,
+ pMga->PciInfo->vendor,
+ pMga->PciInfo->chipType );
+
+ if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" );
+ drmAgpRelease( pMga->drmFD );
+ return FALSE;
+ }
+
+ if ( pMga->Chipset == PCI_CHIP_MGAG200 ) {
+ switch ( pMga->agpMode ) {
+ case 2:
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Enabling AGP 2x PLL encoding\n" );
+ OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE );
+ break;
+
+ case 1:
+ default:
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Disabling AGP 2x PLL encoding\n" );
+ OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_DISABLE );
+ pMga->agpMode = 1;
+ break;
}
- pMga->agp_mode = 1;
- mode_mask = ~0x00000006;
+ }
+
+ ret = drmAgpAlloc( pMga->drmFD, pMGADRIServer->agp.size,
+ 0, NULL, &pMGADRIServer->agp.handle );
+ if ( ret < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret );
+ drmAgpRelease( pMga->drmFD );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] %d kB allocated with handle 0x%08x\n",
+ pMGADRIServer->agp.size/1024, pMGADRIServer->agp.handle );
+
+ if ( drmAgpBind( pMga->drmFD, pMGADRIServer->agp.handle, 0 ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Could not bind memory\n" );
+ drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle );
+ drmAgpRelease( pMga->drmFD );
+ return FALSE;
+ }
+
+ /* WARP microcode space
+ */
+ if ( drmAddMap( pMga->drmFD,
+ pMGADRIServer->warp.offset,
+ pMGADRIServer->warp.size,
+ DRM_AGP, DRM_READ_ONLY,
+ &pMGADRIServer->warp.handle ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not add WARP microcode mapping\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] WARP microcode handle = 0x%08lx\n",
+ pMGADRIServer->warp.handle );
+
+ if ( drmMap( pMga->drmFD,
+ pMGADRIServer->warp.handle,
+ pMGADRIServer->warp.size,
+ &pMGADRIServer->warp.map ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not map WARP microcode\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] WARP microcode mapped at 0x%08lx\n",
+ (unsigned long)pMGADRIServer->warp.map );
+
+ /* Primary DMA space
+ */
+ if ( drmAddMap( pMga->drmFD,
+ pMGADRIServer->primary.offset,
+ pMGADRIServer->primary.size,
+ DRM_AGP, DRM_READ_ONLY,
+ &pMGADRIServer->primary.handle ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not add primary DMA mapping\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] Primary DMA handle = 0x%08lx\n",
+ pMGADRIServer->primary.handle );
+
+ if ( drmMap( pMga->drmFD,
+ pMGADRIServer->primary.handle,
+ pMGADRIServer->primary.size,
+ &pMGADRIServer->primary.map ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not map primary DMA\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] Primary DMA mapped at 0x%08lx\n",
+ (unsigned long)pMGADRIServer->primary.map );
+
+ /* DMA buffers
+ */
+ if ( drmAddMap( pMga->drmFD,
+ pMGADRIServer->buffers.offset,
+ pMGADRIServer->buffers.size,
+ DRM_AGP, 0,
+ &pMGADRIServer->buffers.handle ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not add DMA buffers mapping\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] DMA buffers handle = 0x%08lx\n",
+ pMGADRIServer->buffers.handle );
+
+ if ( drmMap( pMga->drmFD,
+ pMGADRIServer->buffers.handle,
+ pMGADRIServer->buffers.size,
+ &pMGADRIServer->buffers.map ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not map DMA buffers\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] DMA buffers mapped at 0x%08lx\n",
+ (unsigned long)pMGADRIServer->buffers.map );
+
+ count = drmAddBufs( pMga->drmFD,
+ MGA_NUM_BUFFERS, MGA_BUFFER_SIZE,
+ DRM_AGP_BUFFER, pMGADRIServer->buffers.offset );
+ if ( count <= 0 ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "[drm] failure adding %d %d byte DMA buffers\n",
+ MGA_NUM_BUFFERS, MGA_BUFFER_SIZE );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Added %d %d byte DMA buffers\n",
+ count, MGA_BUFFER_SIZE );
+
+ xf86EnablePciBusMaster( pMga->PciInfo, TRUE );
+
+ return TRUE;
+}
+
+static Bool MGADRIMapInit( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+
+ pMGADRIServer->registers.size = MGAIOMAPSIZE;
+
+ if ( drmAddMap( pMga->drmFD,
+ (drmHandle)pMga->IOAddress,
+ pMGADRIServer->registers.size,
+ DRM_REGISTERS, DRM_READ_ONLY,
+ &pMGADRIServer->registers.handle ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] Could not add MMIO registers mapping\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Registers handle = 0x%08lx\n",
+ pMGADRIServer->registers.handle );
+
+ pMGADRIServer->status.size = SAREA_MAX;
+
+ if ( drmAddMap( pMga->drmFD, 0, pMGADRIServer->status.size,
+ DRM_SHM, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL,
+ &pMGADRIServer->status.handle ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] Could not add status page mapping\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Status handle = 0x%08lx\n",
+ pMGADRIServer->status.handle );
+
+ if ( drmMap( pMga->drmFD,
+ pMGADRIServer->status.handle,
+ pMGADRIServer->status.size,
+ &pMGADRIServer->status.map ) < 0 ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[agp] Could not map status page\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[agp] Status page mapped at 0x%08lx\n",
+ (unsigned long)pMGADRIServer->status.map );
+
+ return TRUE;
+}
+
+static Bool MGADRIKernelInit( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+ drmMGAInit init;
+ int ret;
+
+ memset( &init, 0, sizeof(drmMGAInit) );
+
+ init.sarea_priv_offset = sizeof(XF86DRISAREARec);
+
+ switch ( pMga->Chipset ) {
+ case PCI_CHIP_MGAG400:
+ init.chipset = MGA_CARD_TYPE_G400;
+ break;
+ case PCI_CHIP_MGAG200:
+ case PCI_CHIP_MGAG200_PCI:
+ init.chipset = MGA_CARD_TYPE_G200;
break;
+ default:
+ return FALSE;
}
+ init.sgram = !pMga->HasSDRAM;
- return mode_mask;
+ init.maccess = pMga->MAccess;
+
+ init.fb_cpp = pScrn->bitsPerPixel / 8;
+ init.front_offset = pMGADRIServer->frontOffset;
+ init.front_pitch = pMGADRIServer->frontPitch / init.fb_cpp;
+ init.back_offset = pMGADRIServer->backOffset;
+ init.back_pitch = pMGADRIServer->backPitch / init.fb_cpp;
+
+ init.depth_cpp = pScrn->bitsPerPixel / 8;
+ init.depth_offset = pMGADRIServer->depthOffset;
+ init.depth_pitch = pMGADRIServer->depthPitch / init.depth_cpp;
+
+ init.texture_offset[0] = pMGADRIServer->textureOffset;
+ init.texture_size[0] = pMGADRIServer->textureSize;
+
+ init.fb_offset = pMga->FbAddress;
+ init.mmio_offset = pMGADRIServer->registers.handle;
+ init.status_offset = pMGADRIServer->status.handle;
+
+ init.warp_offset = pMGADRIServer->warp.handle;
+ init.primary_offset = pMGADRIServer->primary.handle;
+ init.buffers_offset = pMGADRIServer->buffers.handle;
+
+ ret = drmMGAInitDMA( pMga->drmFD, &init );
+ if ( ret < 0 ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Failed to initialize DMA! (%d)\n", ret );
+ return FALSE;
+ }
+
+#if 0
+ /* FIXME: This is just here to clean up after the engine reset test
+ * in the kernel module. Please remove it later...
+ */
+ pMga->GetQuiescence( pScrn );
+#endif
+
+ return TRUE;
}
-Bool MGADRIScreenInit(ScreenPtr pScreen)
+static Bool MGADRIBuffersInit( ScreenPtr pScreen )
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMGA = MGAPTR(pScrn);
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+
+
+ pMGADRIServer->drmBuffers = drmMapBufs( pMga->drmFD );
+ if ( !pMGADRIServer->drmBuffers ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] Failed to map DMA buffers list\n" );
+ return FALSE;
+ }
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Mapped %d DMA buffers\n",
+ pMGADRIServer->drmBuffers->count );
+
+ return TRUE;
+}
+
+
+Bool MGADRIScreenInit( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
DRIInfoPtr pDRIInfo;
MGADRIPtr pMGADRI;
MGADRIServerPrivatePtr pMGADRIServer;
- int bufs, size;
- int prim_size;
- int init_offset;
- int i;
- unsigned long mode_mask;
- switch(pMGA->Chipset) {
+ switch ( pMga->Chipset ) {
case PCI_CHIP_MGAG400:
case PCI_CHIP_MGAG200:
#if 0
@@ -388,112 +906,131 @@ Bool MGADRIScreenInit(ScreenPtr pScreen)
#endif
break;
default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Direct rendering only supported with G200/G400 AGP\n");
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Direct rendering only supported with AGP G200/G400 cards!\n" );
return FALSE;
}
/* Check that the GLX, DRI, and DRM modules have been loaded by testing
- * for canonical symbols in each module. */
- if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
- if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
- if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
- if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "MGADRIScreenInit failed (libdri.a too old)\n");
+ * for canonical symbols in each module.
+ */
+ if ( !xf86LoaderCheckSymbol( "GlxSetVisualConfigs" ) ) return FALSE;
+ if ( !xf86LoaderCheckSymbol( "DRIScreenInit" ) ) return FALSE;
+ if ( !xf86LoaderCheckSymbol( "drmAvailable" ) ) return FALSE;
+ if ( !xf86LoaderCheckSymbol( "DRIQueryVersion" ) ) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "MGADRIScreenInit failed (libdri.a too old)\n" );
return FALSE;
}
-
+
/* Check the DRI version */
{
int major, minor, patch;
- DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] MGADRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n",
- major, minor, patch);
+ DRIQueryVersion( &major, &minor, &patch );
+ if ( major != 4 || minor < 0) {
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] MGADRIScreenInit failed "
+ "(DRI version = %d.%d.%d, expected 4.0.x). "
+ "Disabling DRI.\n",
+ major, minor, patch );
return FALSE;
}
}
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] bpp: %d depth: %d\n", pScrn->bitsPerPixel, pScrn->depth);
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] bpp: %d depth: %d\n",
+ pScrn->bitsPerPixel, pScrn->depth );
- if ((pScrn->bitsPerPixel / 8) != 2 &&
- (pScrn->bitsPerPixel / 8) != 4) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Direct rendering only supported in 16 and 32 bpp modes\n");
+ if ( (pScrn->bitsPerPixel / 8) != 2 &&
+ (pScrn->bitsPerPixel / 8) != 4 ) {
+ xf86DrvMsg( pScreen->myNum, X_INFO,
+ "[drm] Direct rendering only supported in 16 and 32 bpp modes\n" );
return FALSE;
}
-
+
pDRIInfo = DRICreateInfoRec();
- if (!pDRIInfo)
+ if ( !pDRIInfo )
return FALSE;
- pMGA->pDRIInfo = pDRIInfo;
+ 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);
+ sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum );
pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION;
pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION;
pDRIInfo->ddxDriverPatchVersion = MGA_PATCHLEVEL;
- pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress;
- pDRIInfo->frameBufferSize = pMGA->FbMapSize;
+ pDRIInfo->frameBufferPhysicalAddress = pMga->FbAddress;
+ pDRIInfo->frameBufferSize = pMga->FbMapSize;
pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8);
pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES;
- MGADRIWrapFunctions( pScreen, pDRIInfo );
+ pDRIInfo->wrap.BlockHandler = MGABlockHandler;
+ pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler;
+ pDRIInfo->wrap.ValidateTree = NULL;
+ pDRIInfo->wrap.PostValidateTree = NULL;
- if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES)
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
+ if ( SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES ) {
pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
- else
+ } else {
pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES;
+ }
/* For now the mapping works by using a fixed size defined
- * in the SAREA header
+ * in the SAREA header.
*/
- if (sizeof(XF86DRISAREARec)+sizeof(MGASAREARec)>SAREA_MAX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Data does not fit in SAREA\n");
+ if ( sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) > SAREA_MAX ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Data does not fit in SAREA\n" );
return FALSE;
}
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Sarea %d+%d: %d\n",
- sizeof(XF86DRISAREARec), sizeof(MGASAREARec),
- sizeof(XF86DRISAREARec) + sizeof(MGASAREARec));
+
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "[drm] Sarea %d+%d: %d\n",
+ sizeof(XF86DRISAREARec), sizeof(MGASAREAPrivRec),
+ sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) );
pDRIInfo->SAREASize = SAREA_MAX;
- if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) {
- DRIDestroyInfoRec(pMGA->pDRIInfo);
- pMGA->pDRIInfo=0;
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Failed to allocate memory for private record\n");
+ pMGADRI = (MGADRIPtr)xnfcalloc( sizeof(MGADRIRec), 1 );
+ if ( !pMGADRI ) {
+ DRIDestroyInfoRec( pMga->pDRIInfo );
+ pMga->pDRIInfo = 0;
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Failed to allocate memory for private record\n" );
return FALSE;
}
- if (!(pMGADRIServer = (MGADRIServerPrivatePtr)
- xnfcalloc(sizeof(MGADRIServerPrivateRec),1))) {
- xfree(pMGADRI);
- DRIDestroyInfoRec(pMGA->pDRIInfo);
- pMGA->pDRIInfo=0;
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Failed to allocate memory for private record\n");
+
+ pMGADRIServer = (MGADRIServerPrivatePtr)
+ xnfcalloc( sizeof(MGADRIServerPrivateRec), 1 );
+ if ( !pMGADRIServer ) {
+ xfree( pMGADRI );
+ DRIDestroyInfoRec( pMga->pDRIInfo );
+ pMga->pDRIInfo = 0;
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "[drm] Failed to allocate memory for private record\n" );
return FALSE;
}
+ pMga->DRIServerInfo = pMGADRIServer;
pDRIInfo->devPrivate = pMGADRI;
- pMGA->DRIServerInfo = pMGADRIServer;
pDRIInfo->devPrivateSize = sizeof(MGADRIRec);
pDRIInfo->contextSize = sizeof(MGADRIContextRec);
pDRIInfo->CreateContext = MGACreateContext;
pDRIInfo->DestroyContext = MGADestroyContext;
- if (xf86IsEntityShared(pScrn->entityList[0]))
- pDRIInfo->SwapContext = MGADRISwapContext_shared;
- else
+ if ( xf86IsEntityShared( pScrn->entityList[0] ) ) {
+ pDRIInfo->SwapContext = MGADRISwapContextShared;
+ } else {
pDRIInfo->SwapContext = MGADRISwapContext;
-
+ }
+
switch( pScrn->bitsPerPixel ) {
case 8:
pDRIInfo->InitBuffers = Mga8DRIInitBuffers;
@@ -508,141 +1045,115 @@ Bool MGADRIScreenInit(ScreenPtr pScreen)
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);
+ if ( !DRIScreenInit( pScreen, pDRIInfo, &pMga->drmFD ) ) {
+ xfree( pMGADRIServer );
+ pMga->DRIServerInfo = 0;
+ xfree( pDRIInfo->devPrivate );
pDRIInfo->devPrivate = 0;
- DRIDestroyInfoRec(pMGA->pDRIInfo);
- pMGA->pDRIInfo = 0;
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] DRIScreenInit Failed\n");
+ DRIDestroyInfoRec( pMga->pDRIInfo );
+ pMga->pDRIInfo = 0;
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] DRIScreenInit Failed\n" );
return FALSE;
}
/* Check the MGA DRM version */
{
- drmVersionPtr version = drmGetVersion(pMGA->drmSubFD);
- if (version) {
- if (version->version_major != 2 ||
- version->version_minor != 1 ||
- version->version_patchlevel < 0) {
+ drmVersionPtr version = drmGetVersion(pMga->drmFD);
+ if ( version ) {
+ if ( version->version_major != 3 ||
+ version->version_minor < 0) {
/* incompatible drm version */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] MGADRIScreenInit failed (DRM version = %d.%d.%d, expected 2.1.x). Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel);
-/* MGADRICloseScreen(pScreen); */
-
- drmFreeVersion(version);
+ xf86DrvMsg( pScreen->myNum, X_ERROR,
+ "[drm] MGADRIScreenInit failed "
+ "(DRM version = %d.%d.%d, expected 3.0.x). "
+ "Disabling DRI.\n",
+ version->version_major,
+ version->version_minor,
+ version->version_patchlevel );
+ drmFreeVersion( version );
+ MGADRICloseScreen( pScreen ); /* FIXME: ??? */
return FALSE;
}
- drmFreeVersion(version);
+ drmFreeVersion( version );
}
}
- pMGADRIServer->regsSize = MGAIOMAPSIZE;
- if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress,
- pMGADRIServer->regsSize, DRM_REGISTERS, 0,
- &pMGADRIServer->regs)<0) {
- DRICloseScreen(pScreen);
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAddMap failed Register MMIO region\n");
- return FALSE;
+#if 0
+ /* Calculate texture constants for AGP texture space.
+ * FIXME: move!
+ */
+ {
+ CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR;
+ CARD32 agpTextureSize = pMGADRI->agp.size - agpTextureOffset;
+
+ i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS);
+ if (i < MGA_LOG_MIN_TEX_REGION_SIZE)
+ i = MGA_LOG_MIN_TEX_REGION_SIZE;
+
+ pMGADRI->logAgpTextureGranularity = i;
+ pMGADRI->agpTextureSize = (agpTextureSize >> i) << i;
+ pMGADRI->agpTextureOffset = agpTextureOffset;
}
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
- pMGADRIServer->regs);
-
- /* Agp Support */
- pMGADRIServer->agpAcquired = FALSE;
- pMGADRIServer->agpHandle = 0;
- pMGADRIServer->agpSizep = 0;
- pMGADRIServer->agp_map = 0;
-
- if (drmAgpAcquire(pMGA->drmSubFD) < 0) {
- DRICloseScreen(pScreen);
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n");
+#endif
+
+ if ( !MGADRIAgpInit( pScreen ) ) {
+ DRICloseScreen( pScreen );
return FALSE;
}
- pMGADRIServer->agpAcquired = TRUE;
- pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen);
- if (pMGADRIServer->warp_ucode_size == 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] microcodeSize is zero\n");
- DRICloseScreen(pScreen);
+ if ( !MGADRIMapInit( pScreen ) ) {
+ DRICloseScreen( pScreen );
return FALSE;
}
- mode_mask = MGAParseAgpMode(pScreen);
-
- pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD);
- pMGADRIServer->agpMode &= mode_mask;
- if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
- DRICloseScreen(pScreen);
+ if ( !MGAInitVisualConfigs( pScreen ) ) {
+ DRICloseScreen( pScreen );
return FALSE;
}
- ErrorF("[drm] drmAgpEnabled succeeded for AGP mode %dx\n", pMGA->agp_mode);
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO, "visual configs initialized\n" );
- prim_size = 65536;
- init_offset = ((prim_size + pMGADRIServer->warp_ucode_size +
- 4096 - 1) / 4096) * 4096;
-
- pMGADRIServer->agpSizep = init_offset;
- pMGADRI->agpSize = (drmAgpSize(pMGA->drmSubFD)) - init_offset;
+ return TRUE;
+}
- pMGADRIServer->agpBase = (drmAddress) drmAgpBase(pMGA->drmSubFD);
- if (drmAddMap(pMGA->drmSubFD, 0,
- init_offset, DRM_AGP, 0,
- &pMGADRIServer->agp_private) < 0) {
- DRICloseScreen(pScreen);
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] 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);
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmMap failed on AGP aperture\n");
+
+Bool MGADRIFinishScreenInit( ScreenPtr pScreen )
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+ MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate;
+ int i;
+
+ if ( !pMga->pDRIInfo )
return FALSE;
- }
-
- /* Now allocate and bind a default of 8 megs */
- drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0,
- &pMGADRIServer->agpHandle);
-
- if (pMGADRIServer->agpHandle == 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpAlloc failed\n");
- DRICloseScreen(pScreen);
+
+ pMga->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
+
+ /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit
+ * because *DRIKernelInit requires that the hardware lock is held by
+ * the X server, and the first time the hardware lock is grabbed is
+ * in DRIFinishScreenInit.
+ */
+ if ( !DRIFinishScreenInit( pScreen ) ) {
+ MGADRICloseScreen( pScreen );
return FALSE;
}
-
- if (drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) {
- DRICloseScreen(pScreen);
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpBind failed\n");
+
+ if ( !MGADRIKernelInit( pScreen ) ) {
+ MGADRICloseScreen( pScreen );
return FALSE;
}
- mgaInstallMicrocode(pScreen, prim_size);
-
- if (drmAddMap(pMGA->drmSubFD, (drmHandle)init_offset,
- pMGADRI->agpSize, DRM_AGP, 0,
- &pMGADRI->agp) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to map public agp area\n");
- DRICloseScreen(pScreen);
+ if ( !MGADRIBuffersInit( pScreen ) ) {
+ MGADRICloseScreen( pScreen );
return FALSE;
}
- switch(pMGA->Chipset) {
+ switch ( pMga->Chipset ) {
case PCI_CHIP_MGAG400:
pMGADRI->chipset = MGA_CARD_TYPE_G400;
break;
@@ -653,356 +1164,97 @@ Bool MGADRIScreenInit(ScreenPtr pScreen)
default:
return FALSE;
}
-
- pMGADRI->width = pScrn->virtualX;
- pMGADRI->height = pScrn->virtualY;
- pMGADRI->mem = pScrn->videoRam * 1024;
- pMGADRI->cpp = pScrn->bitsPerPixel / 8;
- pMGADRI->frontPitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8);
-
-
- pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */
- pMGADRI->backOffset = ((pScrn->virtualY + pMGA->numXAALines + 1) *
- pScrn->displayWidth *
- pMGADRI->cpp + 4095) & ~0xFFF;
-
-
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] calced backoffset: 0x%x\n",
- pMGADRI->backOffset);
-
-
- size = pMGADRI->cpp * pScrn->virtualX * pScrn->virtualY;
- size += 4095;
- size &= ~4095;
- pMGADRI->depthOffset = pMGA->FbUsableSize - size;
- pMGADRI->depthOffset &= ~4095;
- pMGADRI->textureOffset = pMGADRI->backOffset + size;
- pMGADRI->textureSize = pMGADRI->depthOffset - pMGADRI->textureOffset;
-
- if (pMGADRI->depthOffset < pMGADRI->textureOffset + 512*1024) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Insufficient memory for direct rendering\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- pMGADRI->mAccess = pMGA->MAccess;
-
- i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS);
- if (i < MGA_LOG_MIN_TEX_REGION_SIZE)
+ pMGADRI->width = pScrn->virtualX;
+ pMGADRI->height = pScrn->virtualY;
+ pMGADRI->mem = pScrn->videoRam * 1024;
+ pMGADRI->cpp = pScrn->bitsPerPixel / 8;
+
+ pMGADRI->agpMode = pMga->agpMode;
+
+ pMGADRI->frontOffset = pMGADRIServer->frontOffset;
+ pMGADRI->frontPitch = pMGADRIServer->frontPitch;
+ pMGADRI->backOffset = pMGADRIServer->backOffset;
+ pMGADRI->backPitch = pMGADRIServer->backPitch;
+ pMGADRI->depthOffset = pMGADRIServer->depthOffset;
+ pMGADRI->depthPitch = pMGADRIServer->depthPitch;
+ pMGADRI->textureOffset = pMGADRIServer->textureOffset;
+ pMGADRI->textureSize = pMGADRIServer->textureSize;
+
+ i = mylog2( pMGADRI->textureSize / MGA_NR_TEX_REGIONS );
+ if ( i < MGA_LOG_MIN_TEX_REGION_SIZE )
i = MGA_LOG_MIN_TEX_REGION_SIZE;
-
+
pMGADRI->logTextureGranularity = i;
pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */
-
- /* Here is where we need to do initialization of the dma engine */
- if((bufs = drmAddBufs(pMGA->drmSubFD,
- MGA_DMA_BUF_NR,
- MGA_DMA_BUF_SZ,
- DRM_AGP_BUFFER,
- init_offset)) <= 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[drm] failure adding %d %d byte DMA buffers\n",
- MGA_DMA_BUF_NR,
- MGA_DMA_BUF_SZ);
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- pMGADRI->agpBufferOffset = init_offset + pMGADRIServer->agp_private;
-
- /* Calculate texture constants for AGP texture space
- */
- {
- CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR;
- CARD32 agpTextureSize = pMGADRI->agpSize - agpTextureOffset;
-
- i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS);
- if (i < MGA_LOG_MIN_TEX_REGION_SIZE)
- i = MGA_LOG_MIN_TEX_REGION_SIZE;
-
- pMGADRI->logAgpTextureGranularity = i;
- pMGADRI->agpTextureSize = (agpTextureSize >> i) << i;
- pMGADRI->agpTextureOffset = agpTextureOffset;
- }
-
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[drm] added %d %d byte DMA buffers\n",
- bufs, MGA_DMA_BUF_SZ);
-
-
- if ((MgaInitDma(pScrn, prim_size)) != TRUE) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to initialize dma engine\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Initialized Dma Engine\n");
-
- if (!pMGADRIServer->irq) {
- pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD,
- ((pciConfigPtr)pMGA->PciInfo
- ->thisCard)->busnum,
- ((pciConfigPtr)pMGA->PciInfo
- ->thisCard)->devnum,
- ((pciConfigPtr)pMGA->PciInfo
- ->thisCard)->funcnum);
-
- if(!pMGADRIServer->irq && !pMGA->ReallyUseIrqZero) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[drm] Your graphics card has Interrupt zero"
- " assigned to it.\n"
- "This is highly unlikely so I'm disabling the DRI.\n"
- "If your graphics card really has Interrupt zero, please"
- "add the config option UseIrqZero\n"
- "to the device section in your XF86Config file.\n"
- "Please be warned that Interrupt zero is normally "
- "the timer interrupt on X86 systems.\n"
- "Using this option could make your system unusable.\n"
- "The more likely solution is that your graphics card has"
- " no interrupt assigned to it.\nPlease consult your"
- " system BIOS manual for instructions on how to enable "
- "an interrupt for your graphics card.\n");
- MGADRICloseScreen(pScreen);
- return FALSE;
- }
- 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" );
-
+ pMGADRI->registers.handle = pMGADRIServer->registers.handle;
+ pMGADRI->registers.size = pMGADRIServer->registers.size;
+ pMGADRI->status.handle = pMGADRIServer->status.handle;
+ pMGADRI->status.size = pMGADRIServer->status.size;
+ pMGADRI->primary.handle = pMGADRIServer->primary.handle;
+ pMGADRI->primary.size = pMGADRIServer->primary.size;
+ pMGADRI->buffers.handle = pMGADRIServer->buffers.handle;
+ pMGADRI->buffers.size = pMGADRIServer->buffers.size;
+ pMGADRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
return TRUE;
}
-void
-MGADRICloseScreen(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMGA = MGAPTR(pScrn);
- MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
-
-/* The DRI will automagically clean these up when driFD is closed */
- if(pMGADRIServer->agp_map) {
- drmUnmap(pMGADRIServer->agp_map, pMGADRIServer->agpSizep);
- pMGADRIServer->agp_map = 0;
- }
- if(pMGADRIServer->agpHandle) {
- pMGADRIServer->agpHandle = 0;
- pMGADRIServer->agpSizep = 0;
- }
- if(pMGADRIServer->agpAcquired == TRUE) {
- pMGADRIServer->agpAcquired = FALSE;
- }
-
- 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)
-{
- return TRUE;
-}
-
-static void
-MGADestroyContext(ScreenPtr pScreen, drmContext hwContext,
- DRIContextType contextStore)
-{
-}
-
-Bool
-MGADRIFinishScreenInit(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGASAREAPtr sPriv;
- MGAPtr pMGA = MGAPTR(pScrn);
-
- if (!pMGA->pDRIInfo) return FALSE;
-
- sPriv = (MGASAREAPtr)DRIGetSAREAPrivate(pScreen);
- pMGA->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
-
- xf86memset( sPriv, 0, sizeof(MGASAREARec) );
-
- return DRIFinishScreenInit(pScreen);
-}
-
-void
-mgaGetQuiescence( ScrnInfoPtr pScrn )
+void MGADRICloseScreen( ScreenPtr pScreen )
{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
- pMga->have_quiescense = 1;
-
- if (pMga->directRenderingEnabled) {
- MGAFBLayout *pLayout = &pMga->CurrentLayout;
-
- MgaLockUpdate(pScrn, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH));
-
- WAITFIFO(11);
- OUTREG(MGAREG_MACCESS, pMga->MAccess);
- OUTREG(MGAREG_PITCH, pLayout->displayWidth);
- pMga->PlaneMask = ~0;
- OUTREG(MGAREG_PLNWT, pMga->PlaneMask);
- pMga->BgColor = 0;
- pMga->FgColor = 0;
- OUTREG(MGAREG_BCOL, pMga->BgColor);
- OUTREG(MGAREG_FCOL, pMga->FgColor);
- OUTREG(MGAREG_SRCORG, pMga->realSrcOrg);
- pMga->SrcOrg = 0;
- 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;
+ if ( pMGADRIServer->drmBuffers ) {
+ drmUnmapBufs( pMGADRIServer->drmBuffers );
+ pMGADRIServer->drmBuffers = NULL;
}
-}
+ drmMGACleanupDMA( pMga->drmFD );
-void
-mgaGetQuiescence_shared( ScrnInfoPtr pScrn )
-{
- MGAPtr pMga = MGAPTR(pScrn);
- MGAEntPtr pMgaEnt = pMga->entityPrivate;
- MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2);
-
- pMga = MGAPTR(pMgaEnt->pScrn_1);
- pMga->have_quiescense = 1;
- pMga2->have_quiescense = 1;
-
- if (pMgaEnt->directRenderingEnabled) {
- MgaLockUpdate(pMgaEnt->pScrn_1, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH));
- pMga->RestoreAccelState(pScrn);
- xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex);
+ if ( pMGADRIServer->status.map ) {
+ drmUnmap( pMGADRIServer->status.map, pMGADRIServer->status.size );
+ pMGADRIServer->status.map = NULL;
}
-}
-
-
-void
-MGASwapContext(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMga = MGAPTR(pScrn);
-
- /* Arrange for dma_quiescence and xaa sync to be called as
- * appropriate.
- */
- pMga->have_quiescense = 0;
- pMga->AccelInfoRec->NeedToSync = TRUE;
-}
-
-void
-MGASwapContext_shared(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMga = MGAPTR(pScrn);
- MGAEntPtr pMgaEnt = pMga->entityPrivate;
- MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2);
-
- pMga = MGAPTR(pMgaEnt->pScrn_1);
- pMga->have_quiescense = 0;
- pMga->AccelInfoRec->NeedToSync = TRUE;
- pMga2->have_quiescense = 0;
- pMga2->AccelInfoRec->NeedToSync = TRUE;
-}
-
-
-/* This is really only called from validate/postvalidate as we
- * override the dri lock/unlock. Want to remove validate/postvalidate
- * processing, but need to remove all client-side use of drawable lock
- * first (otherwise there is noone recover when a client dies holding
- * the drawable lock).
- *
- * What does this mean?
- *
- * - The above code gets executed every time a
- * window changes shape or the focus changes, which isn't really
- * optimal.
- * - The X server therefore believes it needs to do an XAA sync
- * *and* a dma quiescense ioctl each time that happens.
- *
- * We don't wrap wakeuphandler any longer, so at least we can say that
- * this doesn't happen *every time the mouse moves*...
- */
-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)
- {
- MGASwapContext(pScreen);
+ if ( pMGADRIServer->buffers.map ) {
+ drmUnmap( pMGADRIServer->buffers.map, pMGADRIServer->buffers.size );
+ pMGADRIServer->buffers.map = NULL;
+ }
+ if ( pMGADRIServer->primary.map ) {
+ drmUnmap( pMGADRIServer->primary.map, pMGADRIServer->primary.size );
+ pMGADRIServer->primary.map = NULL;
+ }
+ if ( pMGADRIServer->warp.map ) {
+ drmUnmap( pMGADRIServer->warp.map, pMGADRIServer->warp.size );
+ pMGADRIServer->warp.map = NULL;
}
-}
-static void
-MGADRISwapContext_shared(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)
- {
- MGASwapContext_shared(pScreen);
+ if ( pMGADRIServer->agp.handle ) {
+ drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle );
+ drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle );
+ pMGADRIServer->agp.handle = 0;
+ drmAgpRelease( pMga->drmFD );
}
-}
-void
-MGASelectBuffer(ScrnInfoPtr pScrn, int which)
-{
- MGAPtr pMga = MGAPTR(pScrn);
- MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate;
+ DRICloseScreen( pScreen );
- switch (which) {
- case MGA_BACK:
- OUTREG(MGAREG_DSTORG, pMGADRI->backOffset);
- OUTREG(MGAREG_SRCORG, pMGADRI->backOffset);
- break;
- case MGA_DEPTH:
- OUTREG(MGAREG_DSTORG, pMGADRI->depthOffset);
- OUTREG(MGAREG_SRCORG, pMGADRI->depthOffset);
- break;
- default:
- case MGA_FRONT:
- OUTREG(MGAREG_DSTORG, pMGADRI->frontOffset);
- OUTREG(MGAREG_SRCORG, pMGADRI->frontOffset);
- break;
+ 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 );
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h
index 28d710353..97588bff5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h
@@ -1,12 +1,45 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.3 2000/06/22 03:58:25 tsi Exp $ */
-
-#ifndef _MGA_DRI_
-#define _MGA_DRI_
-
-#include <xf86drm.h>
-#include <xf86drmMga.h>
-
-#define MGA_MAX_DRAWABLES 256
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.5 2001/03/21 17:02:24 dawes Exp $ */
+
+/*
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __MGA_DRI_H__
+#define __MGA_DRI_H__
+
+#include "xf86drm.h"
+#include "xf86drmMga.h"
+
+#define MGA_DEFAULT_AGP_MODE 1
+#define MGA_MAX_AGP_MODE 4
+
+/* Buffer are aligned on 4096 byte boundaries.
+ */
+#define MGA_BUFFER_ALIGN 0x00000fff
typedef struct {
int reserved_map_agpstart;
@@ -17,19 +50,33 @@ typedef struct {
int warp_ucode_size;
int chipset;
int sgram;
- unsigned long agpMode;
- unsigned long agpHandle;
- Bool agpAcquired;
- drmHandle agp_private;
- drmSize agpSizep;
- drmAddress agpBase;
- int irq;
- drmHandle regs;
- drmSize regsSize;
- drmAddress regsMap;
- drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES];
- drmBufMapPtr drmBufs;
- CARD8 *agp_map;
+
+ unsigned int frontOffset;
+ unsigned int frontPitch;
+
+ unsigned int backOffset;
+ unsigned int backPitch;
+
+ unsigned int depthOffset;
+ unsigned int depthPitch;
+
+ unsigned int textureOffset;
+ int textureSize;
+
+ drmRegion agp;
+
+ /* PCI mappings */
+ drmRegion registers;
+ drmRegion status;
+
+ /* AGP mappings */
+ drmRegion warp;
+ drmRegion primary;
+ drmRegion buffers;
+ drmRegion agpTextures;
+
+ drmBufMapPtr drmBuffers;
+
} MGADRIServerPrivateRec, *MGADRIServerPrivatePtr;
typedef struct {
@@ -38,6 +85,9 @@ typedef struct {
int height;
int mem;
int cpp;
+
+ int agpMode;
+
unsigned int frontOffset;
unsigned int frontPitch;
@@ -59,83 +109,13 @@ typedef struct {
unsigned int agpTextureSize;
int logAgpTextureGranularity;
- /* Redundant?
- */
- unsigned int frontOrg;
- unsigned int backOrg;
- unsigned int depthOrg;
-
unsigned int mAccess;
- drmHandle agp;
- drmSize agpSize;
+ drmRegion registers;
+ drmRegion status;
+ drmRegion primary;
+ drmRegion buffers;
+ unsigned int sarea_priv_offset;
} MGADRIRec, *MGADRIPtr;
-
-/* WARNING: Do not change the SAREA structure without changing the kernel
- * as well */
-typedef struct {
- unsigned char next, prev;
- unsigned char in_use;
- unsigned int age;
-} MGATexRegionRec, *MGATexRegionPtr;
-
-typedef struct {
- /* The channel for communication of state information to the kernel
- * on firing a vertex dma buffer.
- */
- 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;
- XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
-
- /* Information about the most recently used 3d drawable. The
- * client fills in the req_* fields, the server fills in the
- * exported_ fields and puts the cliprects into boxes, above.
- *
- * The client clears the exported_drawable field before
- * clobbering the boxes data.
- */
- unsigned int req_drawable; /* the X drawable id */
- unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */
-
- unsigned int exported_drawable;
- unsigned int exported_index;
- unsigned int exported_stamp;
- unsigned int exported_buffers;
- int exported_nfront;
- int exported_nback;
- int exported_back_x, exported_front_x, exported_w;
- int exported_back_y, exported_front_y, exported_h;
- XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS];
-
- /* Counters for aging textures and for client-side throttling.
- */
- unsigned int last_enqueue; /* last time a buffer was enqueued */
- unsigned int last_dispatch; /* age of the most recently dispatched buffer */
- unsigned int last_quiescent; /* */
-
- /* LRU lists for texture memory in agp space and on the card */
-
- MGATexRegionRec texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1];
- unsigned int texAge[MGA_NR_TEX_HEAPS];
- /* Mechanism to validate card state.
- */
- int ctxOwner;
-} MGASAREARec, *MGASAREAPtr;
-
-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_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h
index 841c17cb9..ba645d2bd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h
@@ -1,15 +1,42 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.1 2000/02/11 17:25:55 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.3 2001/03/21 17:11:47 dawes Exp $ */
-#ifndef _MGA_DRIPRIV_H_
-#define _MGA_DRIPRIV_H_
+/*
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __MGA_DRIPRIV_H__
+#define __MGA_DRIPRIV_H__
+
+#include "GL/glxint.h"
#define MGA_MAX_DRAWABLES 256
-extern void GlxSetVisualConfigs(
- int nconfigs,
- __GLXvisualConfig *configs,
- void **configprivs
-);
+extern void GlxSetVisualConfigs( int nconfigs,
+ __GLXvisualConfig *configs,
+ void **configprivs );
typedef struct {
/* Nothing here yet */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
index 5797babf1..e9ea1b853 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
@@ -41,9 +41,11 @@
* Doug Merritt
* doug@netcom.com
* Fixed 32bpp hires 8MB horizontal line glitch at middle right
+ * Niels Gram Jeppesen
+ * Added digital screen option for first head
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.189 2001/02/15 18:16:18 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.195 2001/04/06 02:09:12 dawes Exp $ */
/*
* This is a first cut at a non-accelerated version to work with the
@@ -92,7 +94,7 @@
#include "shadowfb.h"
#include "fbdevhw.h"
-#ifdef XF86DRI
+#ifdef XF86DRI
#include "dri.h"
#endif
@@ -140,7 +142,7 @@ static void MGAG100BlackMagic(MGAPtr pMga);
static int MGAEntityIndex = -1;
-/*
+/*
* This contains the functions needed by the server after loading the
* driver module. It must be supplied, and gets added the driver list by
* the Module Setup funtion in the dynamic case. In the static case a
@@ -202,12 +204,10 @@ typedef enum {
OPTION_VIDEO_KEY,
OPTION_ROTATE,
OPTION_TEXTURED_VIDEO,
- OPTION_XAALINES,
OPTION_CRTC2HALF,
OPTION_CRTC2RAM,
OPTION_INT10,
- OPTION_AGP_MODE_2X,
- OPTION_AGP_MODE_4X,
+ OPTION_AGP_MODE,
OPTION_DIGITAL,
OPTION_TV,
OPTION_TVSTANDARD,
@@ -234,17 +234,14 @@ static OptionInfoRec MGAOptions[] = {
{ OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
{ OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_TEXTURED_VIDEO, "TexturedVideo",OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XAALINES, "XAALines", OPTV_INTEGER, {0}, FALSE },
{ OPTION_CRTC2HALF, "Crtc2Half", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_CRTC2RAM, "Crtc2Ram", OPTV_INTEGER, {0}, FALSE },
{ OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_AGP_MODE_2X, "AGPMode2x", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_AGP_MODE_4X, "AGPMode4x", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE },
{ OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE },
- { OPTION_USEIRQZERO, "UseIrqZero", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
@@ -311,7 +308,7 @@ static const char *ramdacSymbols[] = {
NULL
};
-#ifdef XF86DRI
+#ifdef XF86DRI
static const char *drmSymbols[] = {
"drmAvailable",
"drmAddBufs",
@@ -327,9 +324,9 @@ static const char *drmSymbols[] = {
"drmAgpGetMode",
"drmAgpBase",
"drmAgpSize",
- "drmMgaCleanupDma",
- "drmMgaLockUpdate",
- "drmMgaInitDma",
+ "drmMGAInitDMA",
+ "drmMGACleanupDMA",
+ "drmMGAFlushDMA",
"drmFreeVersion",
"drmGetVersion",
NULL
@@ -415,7 +412,7 @@ static const char *fbdevHWSymbols[] = {
"fbdevHWUnmapVidmem",
"fbdevHWMapMMIO",
"fbdevHWMapVidmem",
-
+
NULL
};
@@ -431,7 +428,7 @@ static const char *halSymbols[] = {
"MGAGetBOARDHANDLESize",
"MGAGetHardwareInfo",
"MGAOpenLibrary",
- NULL
+ NULL
};
#endif
#ifdef XFree86LOADER
@@ -479,7 +476,7 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin)
ddcSymbols, i2cSymbols, shadowSymbols,
fbdevHWSymbols, vbeSymbols,
fbSymbols, int10Symbols,
-#ifdef XF86DRI
+#ifdef XF86DRI
drmSymbols, driSymbols,
#endif
#ifdef USEMGAHAL
@@ -501,14 +498,14 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin)
#endif /* XFree86LOADER */
-/*
+/*
* ramdac info structure initialization
*/
static MGARamdacRec DacInit = {
FALSE, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL,
90000, /* maxPixelClock */
0, X_DEFAULT, X_DEFAULT, FALSE
-};
+};
static Bool
MGAGetRec(ScrnInfoPtr pScrn)
@@ -625,14 +622,14 @@ MGAProbe(DriverPtr drv, int flags)
#ifdef DISABLE_VGA_IO
MgaSavePtr smga;
#endif
-
+
/* Allocate a ScrnInfoRec and claim the slot */
pScrn = NULL;
-
+
#ifndef DISABLE_VGA_IO
if ((pScrn = xf86ConfigPciEntity(pScrn, 0,usedChips[i],
MGAPciChipsets, NULL, NULL,
- NULL, NULL, NULL)))
+ NULL, NULL, NULL)))
#else
smga = xnfalloc(sizeof(MgaSave));
smga->pvp = xf86GetPciInfoForEntity(usedChips[i]);
@@ -641,7 +638,7 @@ MGAProbe(DriverPtr drv, int flags)
VgaIOSave, VgaIORestore,smga)))
#endif
{
-
+
/* Fill in what we can of the ScrnInfoRec */
pScrn->driverVersion = MGA_VERSION;
pScrn->driverName = MGA_DRIVER_NAME;
@@ -657,7 +654,7 @@ MGAProbe(DriverPtr drv, int flags)
pScrn->ValidMode = MGAValidMode;
foundScreen = TRUE;
}
-
+
/*
* For cards that can do dual head per entity, mark the entity
* as sharable.
@@ -691,7 +688,7 @@ MGAProbe(DriverPtr drv, int flags)
}
xfree(usedChips);
-
+
return foundScreen;
}
@@ -716,13 +713,13 @@ MGAProbe(DriverPtr drv, int flags)
* HISTORY
* August 31, 1997 - [ajv] Andrew van der Stock
* Fixed to understand Mystique and Millennium II
- *
+ *
* January 11, 1997 - [aem] Andrew E. Mileski
* Set default values for GCLK (= MCLK / pre-scale ).
*
* October 7, 1996 - [aem] Andrew E. Mileski
* Written and tested.
- */
+ */
static void
MGAReadBios(ScrnInfoPtr pScrn)
@@ -730,12 +727,12 @@ MGAReadBios(ScrnInfoPtr pScrn)
CARD8 tmp[ 64 ];
CARD16 offset;
CARD8 chksum;
- CARD8 *pPINSInfo;
+ CARD8 *pPINSInfo;
MGAPtr pMga;
MGABiosInfo *pBios;
MGABios2Info *pBios2;
Bool pciBIOS = TRUE;
-
+
pMga = MGAPTR(pScrn);
pBios = &pMga->Bios;
pBios2 = &pMga->Bios2;
@@ -754,7 +751,7 @@ MGAReadBios(ScrnInfoPtr pScrn)
(pciBIOS ? \
xf86ReadPciBIOS(offset, pMga->PciTag, pMga->FbBaseReg, buf, len) : \
xf86ReadBIOS(pMga->BiosAddress, offset, buf, len))
-
+
MGADoBIOSRead(0, tmp, sizeof( tmp ));
if (
tmp[ 0 ] != 0x55
@@ -786,9 +783,9 @@ MGAReadBios(ScrnInfoPtr pScrn)
( CARD8 * ) & pBios2->PinID, sizeof( MGABios2Info ));
}
-
+
/* matrox millennium-2 and mystique pins info */
- if ( pBios2->PinID == 0x412e ) {
+ if ( pBios2->PinID == 0x412e ) {
int i;
/* check that the pins info is correct */
if ( pBios2->StructLen != 0x40 ) {
@@ -879,8 +876,8 @@ MGASoftReset(ScrnInfoPtr pScrn)
/* wait until drawing engine is ready */
while ( MGAISBUSY() )
usleep(1000);
-
- /* flush FIFO */
+
+ /* flush FIFO */
i = 32;
WAITFIFO(i);
while ( i-- )
@@ -893,7 +890,7 @@ MGASoftReset(ScrnInfoPtr pScrn)
/*
* MGACountRAM --
*
- * Counts amount of installed RAM
+ * Counts amount of installed RAM
*/
static int
MGACountRam(ScrnInfoPtr pScrn)
@@ -906,7 +903,7 @@ MGACountRam(ScrnInfoPtr pScrn)
#if 0
/* This isn't correct. It looks like this can have arbitrary
data for the memconfig even when the bios has initialized
- it. At least, my cards don't advertise the documented
+ it. At least, my cards don't advertise the documented
values (my 8 and 16 Meg G200s have the same values) */
if(pMga->Primary) /* can only trust this for primary cards */
biosInfo = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
@@ -915,7 +912,7 @@ MGACountRam(ScrnInfoPtr pScrn)
switch(pMga->Chipset) {
case PCI_CHIP_MGA2164:
case PCI_CHIP_MGA2164_AGP:
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Unable to probe memory amount due to hardware bug. "
"Assuming 4096 KB\n");
return 4096;
@@ -925,12 +922,12 @@ MGACountRam(ScrnInfoPtr pScrn)
case 0:
return (biosInfo & (1 << 14)) ? 32768 : 16384;
case 1:
- case 2:
+ case 2:
return 16384;
- case 3:
- case 5:
+ case 3:
+ case 5:
return 65536;
- case 4:
+ case 4:
return 32768;
}
}
@@ -964,11 +961,11 @@ MGACountRam(ScrnInfoPtr pScrn)
volatile unsigned char* base;
unsigned char tmp;
int i;
-
+
pMga->FbMapSize = ProbeSize * 1024;
MGAMapMem(pScrn);
base = pMga->FbBase;
-
+
/* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */
OUTREG8(0x1FDE, 3);
tmp = INREG8(0x1FDF);
@@ -984,7 +981,7 @@ MGACountRam(ScrnInfoPtr pScrn)
break;
}
}
-
+
/* restore CRTCEXT3 state */
OUTREG8(0x1FDE, 3);
OUTREG8(0x1FDF, tmp);
@@ -1026,7 +1023,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
"DDC1 disabled - chip not in VGA mode\n");
}
- }
+ }
/* Save the current state */
MGASave(pScrn);
@@ -1080,7 +1077,7 @@ VgaIOSave(int i, void *arg)
#ifdef DEBUG
ErrorF("mga: VgaIOSave: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device,
- sMga->pvp->func);
+ sMga->pvp->func);
#endif
sMga->enable = (pciReadLong(tag, PCI_OPTION_REG) & 0x100) != 0;
}
@@ -1159,6 +1156,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
Bool digital = FALSE;
Bool tv = FALSE;
Bool swap_head = FALSE;
+ ULONG status;
#endif
/*
@@ -1166,7 +1164,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
* 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()
+ * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex()
* are too, and should be used for data that must persist across
* server generations.
*
@@ -1186,7 +1184,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga = MGAPTR(pScrn);
/* Set here until dri is enabled */
#ifdef XF86DRI
- pMga->have_quiescense = 1;
+ pMga->haveQuiescense = 1;
#endif
/* Get the entity, and make sure it is PCI. */
pMga->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
@@ -1256,7 +1254,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access,
&pMga->Access, NULL);
#endif
-
+
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
@@ -1267,7 +1265,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
* unexpected behaviour when the config file marks the primary CRTC
* as the second screen.
*/
- if(xf86IsEntityShared(pScrn->entityList[0]) &&
+ if(xf86IsEntityShared(pScrn->entityList[0]) &&
xf86IsPrimInitDone(pScrn->entityList[0])) {
/* This is the second crtc */
pMga->SecondCrtc = TRUE;
@@ -1275,7 +1273,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->AdjustFrame = MGAAdjustFrameCrtc2;
pMgaEnt->pScrn_2 = pScrn;
#ifdef XF86DRI
- pMga->GetQuiescence = mgaGetQuiescence_shared;
+ pMga->GetQuiescence = MGAGetQuiescenceShared;
#endif
} else {
pMga->SecondCrtc = FALSE;
@@ -1283,11 +1281,11 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if (xf86IsEntityShared(pScrn->entityList[0])) {
pMgaEnt->pScrn_1 = pScrn;
#ifdef XF86DRI
- pMga->GetQuiescence = mgaGetQuiescence_shared;
+ pMga->GetQuiescence = MGAGetQuiescenceShared;
#endif
} else {
#ifdef XF86DRI
- pMga->GetQuiescence = mgaGetQuiescence;
+ pMga->GetQuiescence = MGAGetQuiescence;
#endif
}
}
@@ -1373,6 +1371,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
/* Process the options */
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, MGAOptions);
+#if !defined(__powerpc__)
pMga->softbooted = FALSE;
if (xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) &&
xf86LoadSubModule(pScrn, "int10")) {
@@ -1383,9 +1382,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if (pInt) pMga->softbooted = TRUE;
xf86FreeInt10(pInt);
}
+#endif
/* Set the bits per RGB for 8bpp mode */
- if (pScrn->depth == 8)
+ if (pScrn->depth == 8)
pScrn->rgbBits = 8;
/*
@@ -1444,60 +1444,23 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
-
- if(xf86GetOptValInteger(MGAOptions, OPTION_XAALINES,
- &(pMga->numXAALines))) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Will Use %d lines for "
- "offscreen memory if the DRI is enabled.\n",
- pMga->numXAALines);
- } else {
- /* The default is to use 512 lines on a G400, 128 on a G200 */
- switch (pMga->Chipset) {
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- pMga->numXAALines = 128;
- break;
- default:
- pMga->numXAALines = 512;
- break;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offscreen memory usage "
- "will be limited to %d lines if the DRI is enabled.\n",
- pMga->numXAALines);
- }
-
#ifdef XF86DRI
- {
- Bool temp;
-
- from = X_DEFAULT;
-
- pMga->agp_mode = 1;
- if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_2X,
- &temp)) {
- pMga->agp_mode = 2;
- from = X_CONFIG;
- }
-
- if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_4X,
- &temp)) {
- pMga->agp_mode = 4;
- from = X_CONFIG;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP Mode %dx\n",
- pMga->agp_mode);
-
- pMga->ReallyUseIrqZero = 0;
-
- if (xf86GetOptValBool(MGAOptions, OPTION_USEIRQZERO,
- &temp)) {
- pMga->ReallyUseIrqZero = 1;
- from = X_CONFIG;
- xf86DrvMsg(pScrn->scrnIndex, from, "Enabling use of IRQ "
- "Zero (Dangerous)\n");
- }
+ from = X_DEFAULT;
+ pMga->agpMode = MGA_DEFAULT_AGP_MODE;
+ if (xf86GetOptValInteger(MGAOptions,
+ OPTION_AGP_MODE, &(pMga->agpMode))) {
+ if (pMga->agpMode < 1) {
+ pMga->agpMode = 1;
+ }
+ if (pMga->agpMode > MGA_MAX_AGP_MODE) {
+ pMga->agpMode = MGA_MAX_AGP_MODE;
+ }
+ from = X_CONFIG;
}
+
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP %dx mode\n",
+ pMga->agpMode);
#endif
from = X_DEFAULT;
@@ -1552,38 +1515,38 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if(!xf86GetOptValInteger(
MGAOptions, OPTION_COLOR_KEY,&(pMga->colorKey)))
pMga->colorKey = TRANSPARENCY_KEY;
- pScrn->colorKey = pMga->colorKey;
+ pScrn->colorKey = pMga->colorKey;
pScrn->overlayFlags = OVERLAY_8_32_PLANAR;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"PseudoColor overlay enabled\n");
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Option \"Overlay\" is only supported in 32 bits per pixel on"
"the first CRTC\n");
}
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"\"%s\" is not a valid value for Option \"Overlay\"\n", s);
}
}
-
+
if(xf86GetOptValInteger(MGAOptions, OPTION_VIDEO_KEY, &(pMga->videoKey))) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
pMga->videoKey);
} else {
- pMga->videoKey = (1 << pScrn->offset.red) |
+ pMga->videoKey = (1 << pScrn->offset.red) |
(1 << pScrn->offset.green) |
- (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
+ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
}
if (xf86ReturnOptValBool(MGAOptions, OPTION_SHADOW_FB, FALSE)) {
pMga->ShadowFB = TRUE;
pMga->NoAccel = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Using \"Shadow Framebuffer\" - acceleration disabled\n");
}
if (xf86ReturnOptValBool(MGAOptions, OPTION_FBDEV, FALSE)) {
pMga->FBDev = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Using framebuffer device\n");
}
if (xf86ReturnOptValBool(MGAOptions, OPTION_OVERCLOCK_MEM, FALSE)) {
@@ -1613,7 +1576,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->NoAccel = TRUE;
pMga->HWCursor = FALSE;
pMga->Rotate = 1;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Rotating screen clockwise - acceleration disabled\n");
} else
if(!xf86NameCmp(s, "CCW")) {
@@ -1621,12 +1584,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->NoAccel = TRUE;
pMga->HWCursor = FALSE;
pMga->Rotate = -1;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Rotating screen counter clockwise - acceleration disabled\n");
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"\"%s\" is not a valid value for Option \"Rotate\"\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Valid options are \"CW\" or \"CCW\"\n");
}
}
@@ -1684,6 +1647,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
(unsigned long)pMga->FbAddress);
+#if !defined(__powerpc__)
if (pMga->device->IOBase != 0) {
/* Require that the config file value matches one of the PCI values. */
if (!xf86CheckPciMemBase(pMga->PciInfo, pMga->device->IOBase)) {
@@ -1709,21 +1673,25 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
}
+#else
+ pMga->IOAddress = pMga->PciInfo->memBase[0];
+#endif
xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
(unsigned long)pMga->IOAddress);
-
+
pMga->ILOADAddress = 0;
if ( pMga->Chipset != PCI_CHIP_MGA2064 ) {
if (pMga->PciInfo->memBase[2] != 0) {
pMga->ILOADAddress = pMga->PciInfo->memBase[2] & 0xffffc000;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Pseudo-DMA transfer window at 0x%lX\n",
(unsigned long)pMga->ILOADAddress);
- }
+ }
}
+#if !defined(__powerpc__)
/*
* Find the BIOS base. Get it from the PCI config if possible. Otherwise
* use the VGA default. Allow the config file to override this.
@@ -1762,8 +1730,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
MGAReadBios(pScrn);
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
"MGABios.RamdacType = 0x%x\n", pMga->Bios.RamdacType);
+#endif /* !__powerpc__ */
/* HW bpp matches reported bpp */
pMga->HwBpp = pScrn->bitsPerPixel;
@@ -1794,7 +1763,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if(pMga->SecondCrtc == FALSE) {
Bool UseHalf = FALSE;
int adjust;
-
+
xf86GetOptValBool(MGAOptions, OPTION_CRTC2HALF, &UseHalf);
adjust = pScrn->videoRam / 2;
@@ -1802,7 +1771,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Crtc2 will use %dK of VideoRam\n",
adjust);
- } else {
+ } else {
adjust = min(adjust, 8192);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Crtc2 will use %dK of VideoRam\n",
@@ -1812,9 +1781,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->videoRam = pMgaEnt->mastervideoRam;
pMgaEnt->slavevideoRam = adjust;
pMgaEnt->masterFbAddress = pMga->FbAddress;
- pMga->FbMapSize =
+ pMga->FbMapSize =
pMgaEnt->masterFbMapSize = pScrn->videoRam * 1024;
- pMgaEnt->slaveFbAddress = pMga->FbAddress +
+ pMgaEnt->slaveFbAddress = pMga->FbAddress +
pMgaEnt->masterFbMapSize;
pMgaEnt->slaveFbMapSize = pMgaEnt->slavevideoRam * 1024;
pMga->realSrcOrg = pMga->SrcOrg = 0;
@@ -1823,8 +1792,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->FbAddress = pMgaEnt->slaveFbAddress;
pMga->FbMapSize = pMgaEnt->slaveFbMapSize;
pScrn->videoRam = pMgaEnt->slavevideoRam;
- pMga->DstOrg = pMga->realSrcOrg =
- pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress;
+ pMga->DstOrg = pMga->realSrcOrg =
+ pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress;
pMga->SrcOrg = 0; /* This is not stored in hw format!! */
}
pMgaEnt->refCount++;
@@ -1844,7 +1813,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n",
pScrn->videoRam);
-
+
/* Set the bpp shift value */
pMga->BppShifts[0] = 0;
pMga->BppShifts[1] = 1;
@@ -1857,6 +1826,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
*/
(*pMga->PreInit)(pScrn);
+#if !defined(__powerpc__)
/* Load DDC if we have the code to use it */
/* This gives us DDC1 */
if (pMga->ddc1Read || pMga->i2cInit) {
@@ -1870,7 +1840,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->i2cInit = NULL;
}
}
-#if MGAuseI2C
+#if MGAuseI2C
/* - DDC can use I2C bus */
/* Load I2C if we have the code to use it */
if (pMga->i2cInit) {
@@ -1886,6 +1856,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
/* Read and print the Monitor DDC info */
pScrn->monitor->DDC = MGAdoDDC(pScrn);
+#endif /* !__powerpc__ */
/*
* If the driver can do gamma correction, it should call xf86SetGamma()
@@ -1968,7 +1939,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->ClockMulFactor = 1;
clockRanges->ClockDivFactor = 1;
-
+
/* Only set MemClk if appropriate for the ramdac */
if (pMga->Dac.SetMemClk) {
if (pMga->MemClk == 0) {
@@ -1987,15 +1958,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
* care of this, we don't worry about setting them here.
*/
{
- int Pitches1[] =
+ int Pitches1[] =
{640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0};
- int Pitches2[] =
- {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664,
+ int Pitches2[] =
+ {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664,
1920, 2048, 0};
int *linePitches = NULL;
int minPitch = 256;
- int maxPitch = 2048;
-
+ int maxPitch = 2048;
+
switch(pMga->Chipset) {
case PCI_CHIP_MGA2064:
if (!pMga->NoAccel) {
@@ -2027,7 +1998,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
linePitches, minPitch, maxPitch,
- pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] *
+ pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] *
pScrn->bitsPerPixel, 128, 2048,
pScrn->display->virtualX,
pScrn->display->virtualY,
@@ -2068,9 +2039,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA));
pMga->pClientStruct->pMga = (MGAPtr) pMga;
- MGAMapMem(pScrn);
+ MGAMapMem(pScrn);
MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
- MGAUnmapMem(pScrn);
+ MGAUnmapMem(pScrn);
pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO));
MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
@@ -2082,7 +2053,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
if (!swap_head) {
- mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1;
+ mgaModeInfo.flOutput = (digital == TRUE) ? MGAMODEINFO_DIGITAL2
+ : MGAMODEINFO_ANALOG1;
} else {
mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2;
}
@@ -2090,7 +2062,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
mgaModeInfo.ulDispHeight = pScrn->virtualY;
mgaModeInfo.ulDeskWidth = pScrn->virtualX;
mgaModeInfo.ulDeskHeight = pScrn->virtualY;
- mgaModeInfo.ulBpp = pScrn->bitsPerPixel;
+ mgaModeInfo.ulBpp = pScrn->bitsPerPixel;
mgaModeInfo.ulZoom = 1;
} else { /* Second CRTC && entity is shared */
if (digital == TRUE) {
@@ -2112,15 +2084,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
mgaModeInfo.ulDispHeight = pScrn->virtualY;
mgaModeInfo.ulDeskWidth = pScrn->virtualX;
mgaModeInfo.ulDeskHeight = pScrn->virtualY;
- mgaModeInfo.ulBpp = pScrn->bitsPerPixel;
+ mgaModeInfo.ulBpp = pScrn->bitsPerPixel;
mgaModeInfo.ulZoom = 1;
pMga->pBoard = pMgaEnt->pBoard;
pMga->pClientStruct = pMgaEnt->pClientStruct;
pMga->pMgaHwInfo = pMga->pMgaHwInfo;
}
- if(MGAValidateMode(pMga->pBoard,&mgaModeInfo) != 0) {
+ if((status = MGAValidateMode(pMga->pBoard,&mgaModeInfo)) != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "MGAValidateMode from HALlib found the mode to be invalid\n");
+ "MGAValidateMode from HALlib found the mode to be invalid: 0x%lx\n", status);
return FALSE;
}
pScrn->displayWidth = mgaModeInfo.ulFBPitch;
@@ -2134,9 +2106,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
(pMga->PciInfo->subsysCard == PCI_CARD_PROD_G100_SD)) {
pMga->HasSDRAM = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Has SDRAM\n");
- }
- /*
- * Can we trust HALlib to set the memory configuration
+ }
+ /*
+ * Can we trust HALlib to set the memory configuration
* registers correctly?
*/
else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) &&
@@ -2182,10 +2154,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
*/
pMga->YDstOrg = 0;
- if (((pMga->Chipset == PCI_CHIP_MGA2064) ||
+ if (((pMga->Chipset == PCI_CHIP_MGA2064) ||
(pMga->Chipset == PCI_CHIP_MGA2164) ||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP)) &&
- (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024))
+ (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024))
{
int offset, offset_modulo, ydstorg_modulo;
@@ -2226,12 +2198,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->FbUsableSize = pMgaEnt->masterFbMapSize;
/* Allocate HW cursor buffer at the end of video ram */
if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) {
- if( pScrn->virtualY * pScrn->displayWidth *
+ if( pScrn->virtualY * pScrn->displayWidth *
pScrn->bitsPerPixel / 8 <=
pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) {
pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize;
pMga->FbCursorOffset =
- pMgaEnt->masterFbMapSize -
+ pMgaEnt->masterFbMapSize -
pMga->Dac.CursorOffscreenMemSize;
} else {
pMga->HWCursor = FALSE;
@@ -2248,7 +2220,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->FbUsableSize = pMga->FbMapSize - pMga->YDstOrg * bytesPerPixel;
/* Allocate HW cursor buffer at the end of video ram */
if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) {
- if( pScrn->virtualY * pScrn->displayWidth *
+ if( pScrn->virtualY * pScrn->displayWidth *
pScrn->bitsPerPixel / 8 <=
pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) {
pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize;
@@ -2333,7 +2305,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if(pMgaEnt->refCount == 2) {
/* Both boards have done there initialization */
MGACloseLibrary(pMga->pBoard);
-
+
if (pMga->pBoard)
xfree(pMga->pBoard);
if (pMga->pClientStruct)
@@ -2346,7 +2318,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
} else {
MGACloseLibrary(pMga->pBoard);
-
+
if (pMga->pBoard)
xfree(pMga->pBoard);
if (pMga->pClientStruct)
@@ -2377,7 +2349,7 @@ MGAMapMem(ScrnInfoPtr pScrn)
/*
* Map IO registers to virtual address space
- */
+ */
/*
* For Alpha, we need to map SPARSE memory, since we need
* byte/short access. This is taken care of automatically by the
@@ -2411,7 +2383,7 @@ MGAMapMem(ScrnInfoPtr pScrn)
if (pMga->ILOADAddress) {
pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex,
VIDMEM_MMIO | VIDMEM_MMIO_32BIT |
- VIDMEM_READSIDEEFFECT,
+ VIDMEM_READSIDEEFFECT,
pMga->PciTag, pMga->ILOADAddress, 0x800000);
} else
pMga->ILOADBase = NULL;
@@ -2441,7 +2413,7 @@ MGAMapMemFBDev(ScrnInfoPtr pScrn)
/* Map the ILOAD transfer window if there is one. We only make
DWORD access on DWORD boundaries to this window */
if(pMga->ILOADAddress)
- pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
+ pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
pMga->PciTag, pMga->ILOADAddress, 0x800000);
else pMga->ILOADBase = NULL;
#endif
@@ -2463,7 +2435,7 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
/*
* Unmap IO registers to virtual address space
- */
+ */
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
pMga->IOBase = NULL;
@@ -2511,6 +2483,10 @@ MGASave(ScrnInfoPtr pScrn)
MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard));
#endif
+ /* I need to save the registers for the second head also */
+ /* Save the register for 0x80 to 0xa0 */
+ /* Could call it dac2Saved */
+
/* Only save text mode fonts/text for the primary card */
(*pMga->Save)(pScrn, vgaReg, mgaReg, pMga->Primary);
}
@@ -2529,7 +2505,7 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode)
pMga->pMgaModeInfo->ulDeskWidth = pScrn->virtualX;
pMga->pMgaModeInfo->ulDeskHeight = pScrn->virtualY;
pMga->pMgaModeInfo->ulFBPitch = 0;
- pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel;
+ pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel;
pMga->pMgaModeInfo->ulZoom = 1;
pMga->pMgaModeInfo->flSignalMode = 0x10;
@@ -2651,8 +2627,9 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
} else {
if (!swap_head) {
- pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 |
- MGAMODEINFO_FORCE_PITCH;
+ pMga->pMgaModeInfo->flOutput =
+ ((digital == TRUE) ? MGAMODEINFO_DIGITAL2 : MGAMODEINFO_ANALOG1) |
+ MGAMODEINFO_FORCE_PITCH;
} else {
pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 |
MGAMODEINFO_FORCE_PITCH;
@@ -2690,9 +2667,6 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
); /* MGA_HAL */
-#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
-#define outMGAdac(reg, val) (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
-
MGA_HAL(
if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) {
outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10);
@@ -2714,7 +2688,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
pMga->CurrentLayout.mode = mode;
-
+
#ifdef XF86DRI
if (pMga->directRenderingEnabled)
DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
@@ -2726,7 +2700,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/*
* Restore the initial (text) mode.
*/
-static void
+static void
MGARestore(ScrnInfoPtr pScrn)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -2771,7 +2745,7 @@ MGACrtc2FillStrip(ScrnInfoPtr pScrn)
} else {
xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex);
pMga->RestoreAccelState(pScrn);
- pMga->SetupForSolidFill(pScrn, 0, GXcopy, 0x00000000);
+ pMga->SetupForSolidFill(pScrn, 0, GXcopy, 0xFFFFFFFF);
pMga->SubsequentSolidFillRect(pScrn, pScrn->virtualX, 0,
pScrn->displayWidth - pScrn->virtualX,
pScrn->virtualY);
@@ -2798,7 +2772,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
MGAEntPtr pMgaEnt = NULL;
int f;
- /*
+ /*
* First get the ScrnInfoRec
*/
pScrn = xf86Screens[pScreen->myNum];
@@ -2806,7 +2780,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
hwp = VGAHWPTR(pScrn);
pMga = MGAPTR(pScrn);
MGAdac = &pMga->Dac;
-
+
/* Map the MGA memory and MMIO areas */
if (pMga->FBDev) {
if (!MGAMapMemFBDev(pScrn))
@@ -2838,10 +2812,13 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Detecting for type of display */
if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_TV) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV detected\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "TV detected\n");
+ }
+ if (pMga->pMgaHwInfo->ulCapsFirstOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n");
}
if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital Screen detected\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n");
}
/* Now copy these to the entitystructure */
@@ -2993,14 +2970,14 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* The DRI does not work when textured video is enabled at this time.
*/
- if (!pMga->NoAccel && pMga->TexturedVideo != TRUE &&
+ if (!pMga->NoAccel && pMga->TexturedVideo != TRUE &&
pMga->SecondCrtc == FALSE)
pMga->directRenderingEnabled = MGADRIScreenInit(pScreen);
else
pMga->directRenderingEnabled = FALSE;
#endif
-
-
+
+
if (pMga->Overlay8Plus24) {
ret = cfb8_32ScreenInit(pScreen, FBStart,
width, height,
@@ -3048,15 +3025,15 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
- /* Initialize software cursor.
+ /* Initialize software cursor.
Must precede creation of the default colormap */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
- /* Initialize HW cursor layer.
+ /* Initialize HW cursor layer.
Must follow software cursor initialization*/
- if (pMga->HWCursor) {
+ if (pMga->HWCursor) {
if(!MGAHWCursorInit(pScreen))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Hardware cursor initialization failed\n");
}
@@ -3064,13 +3041,13 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!miCreateDefColormap(pScreen))
return FALSE;
- /* Initialize colormap layer.
+ /* Initialize colormap layer.
Must follow initialization of the default colormap */
if (!pMga->SecondCrtc)
f = CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH;
else
f = CMAP_RELOAD_ON_MODE_SWITCH;
- if(!xf86HandleColormaps(pScreen, 256, 8,
+ if(!xf86HandleColormaps(pScreen, 256, 8,
(pMga->FBDev ? fbdevHWLoadPalette : MGAdac->LoadPalette), NULL, f))
return FALSE;
@@ -3087,7 +3064,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pMga->PointerMoved = pScrn->PointerMoved;
pScrn->PointerMoved = MGAPointerMoved;
}
-
+
switch(pScrn->bitsPerPixel) {
case 8: refreshArea = MGARefreshArea8; break;
case 16: refreshArea = MGARefreshArea16; break;
@@ -3112,26 +3089,22 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
MGAInitVideo(pScreen);
#ifdef XF86DRI
- /* Initialize the Warp engine */
- if (pMga->directRenderingEnabled) {
- pMga->directRenderingEnabled = mgaConfigureWarp(pScrn);
- }
if (pMga->directRenderingEnabled) {
- /* Now that mi, cfb, drm and others have done their thing,
+ /* Now that mi, cfb, drm and others have done their thing,
* complete the DRI setup.
*/
pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen);
}
if (pMga->directRenderingEnabled) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
}
if (xf86IsEntityShared(pScrn->entityList[0]) && pMga->SecondCrtc == FALSE)
pMgaEnt->directRenderingEnabled = pMga->directRenderingEnabled;
- pMga->have_quiescense = 1;
+ pMga->haveQuiescense = 1;
#endif
-
+
/* Wrap the current CloseScreen function */
pMga->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = MGACloseScreen;
@@ -3144,6 +3117,9 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* For the second head, work around display problem. */
if (pMga->SecondCrtc) {
MGACrtc2FillStrip(pScrn);
+ } else {
+ /* shut second head */
+ outMGAdac(0xa0,0x08);
}
/* Done */
@@ -3164,7 +3140,7 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
* displayed location in the video memory.
*/
/* Usually mandatory */
-void
+void
MGAAdjustFrame(int scrnIndex, int x, int y, int flags)
{
ScrnInfoPtr pScrn;
@@ -3191,11 +3167,11 @@ MGAAdjustFrame(int scrnIndex, int x, int y, int flags)
/* find start of retrace */
while (INREG8(0x1FDA) & 0x08);
- while (!(INREG8(0x1FDA) & 0x08));
+ while (!(INREG8(0x1FDA) & 0x08));
/* wait until we're past the start (fixseg.c in the DDK) */
count = INREG(MGAREG_VCOUNT) + 2;
while(INREG(MGAREG_VCOUNT) < count);
-
+
OUTREG16(MGAREG_CRTC_INDEX, (Base & 0x00FF00) | 0x0C);
OUTREG16(MGAREG_CRTC_INDEX, ((Base & 0x0000FF) << 8) | 0x0D);
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x00);
@@ -3225,7 +3201,7 @@ MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags)
* 3-93 c2startadd0
* 3-96 c2vcount
*/
-
+
Base = (y * pLayout->displayWidth + x) * pLayout->bitsPerPixel >> 3;
Base += pMga->DstOrg;
Base &= 0x01ffffc0;
@@ -3245,7 +3221,7 @@ MGAEnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
MGAPtr pMga;
-#ifdef XF86DRI
+#ifdef XF86DRI
ScreenPtr pScreen;
#endif
@@ -3257,7 +3233,11 @@ MGAEnterVT(int scrnIndex, int flags)
DRIUnlock(pScreen);
}
#endif
-
+
+ if (!pMga->SecondCrtc) {
+ outMGAdac(0xa0,0x08);
+ }
+
if (!MGAModeInit(pScrn, pScrn->currentMode))
return FALSE;
MGAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
@@ -3274,12 +3254,12 @@ static Bool
MGAEnterVTFBDev(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-#ifdef XF86DRI
+#ifdef XF86DRI
ScreenPtr pScreen;
- MGAPtr pMGA;
+ MGAPtr pMga;
- pMGA = MGAPTR(pScrn);
- if (pMGA->directRenderingEnabled) {
+ pMga = MGAPTR(pScrn);
+ if (pMga->directRenderingEnabled) {
pScreen = screenInfo.screens[scrnIndex];
DRIUnlock(pScreen);
}
@@ -3303,24 +3283,26 @@ MGALeaveVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ MGAPtr pMga = MGAPTR(pScrn);
#ifdef XF86DRI
ScreenPtr pScreen;
- MGAPtr pMGA;
#endif
+ /* Close second Crtc */
+ outMGAdac(0xa0, 0x08);
+
MGARestore(pScrn);
vgaHWLock(hwp);
if (xf86IsPc98())
outb(0xfac, 0x00);
#ifdef XF86DRI
- pMGA = MGAPTR(pScrn);
- if (pMGA->directRenderingEnabled) {
+ if (pMga->directRenderingEnabled) {
pScreen = screenInfo.screens[scrnIndex];
DRILock(pScreen, 0);
}
#endif
-
+
}
@@ -3339,7 +3321,9 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
vgaHWPtr hwp = VGAHWPTR(pScrn);
MGAPtr pMga = MGAPTR(pScrn);
MGAEntPtr pMgaEnt = NULL;
-
+
+ MGA_NOT_HAL(outMGAdac(0xa0, 0x08));
+
if (pScrn->vtSema) {
if (pMga->FBDev) {
fbdevHWRestore(pScrn);
@@ -3351,7 +3335,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
vgaHWUnmapMem(pScrn);
}
}
-#ifdef XF86DRI
+#ifdef XF86DRI
if (pMga->directRenderingEnabled) {
MGADRICloseScreen(pScreen);
pMga->directRenderingEnabled=FALSE;
@@ -3371,7 +3355,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
if(pMgaEnt->refCount == 0) {
/* Both boards have closed there screen */
MGACloseLibrary(pMga->pBoard);
-
+
if (pMga->pBoard)
xfree(pMga->pBoard);
if (pMga->pClientStruct)
@@ -3383,7 +3367,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
}
} else {
MGACloseLibrary(pMga->pBoard);
-
+
if (pMga->pBoard)
xfree(pMga->pBoard);
if (pMga->pClientStruct)
@@ -3392,7 +3376,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pMga->pMgaModeInfo);
if (pMga->pMgaHwInfo)
xfree(pMga->pMgaHwInfo);
- }
+ }
); /* MGA_HAL */
#endif
@@ -3455,8 +3439,8 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
lace = 1 + ((mode->Flags & V_INTERLACE) != 0);
if ((mode->CrtcHDisplay <= 2048) &&
- (mode->CrtcHSyncStart <= 4096) &&
- (mode->CrtcHSyncEnd <= 4096) &&
+ (mode->CrtcHSyncStart <= 4096) &&
+ (mode->CrtcHSyncEnd <= 4096) &&
(mode->CrtcHTotal <= 4096) &&
(mode->CrtcVDisplay <= 2048 * lace) &&
(mode->CrtcVSyncStart <= 4096 * lace) &&
@@ -3492,24 +3476,24 @@ MGASaveScreenCrtc2(ScreenPtr pScreen, int mode)
MGAPtr pMga = NULL;
Bool on;
CARD32 tmp;
-
+
on = xf86IsUnblank(mode);
-
+
if (on)
SetTimeSinceLastInputEvent();
if (pScreen != NULL)
pScrn = xf86Screens[pScreen->myNum];
-
+
if (pScrn != NULL)
pMga = MGAPTR(pScrn);
-
+
if(pMga != NULL && pScrn->vtSema) {
tmp = INREG(MGAREG_C2CTL);
tmp &= ~0x00000008;
if (!on) tmp |= 0x0000008;
OUTREG(MGAREG_C2CTL, tmp);
}
-
+
return TRUE;
}
@@ -3576,7 +3560,7 @@ MGABlockHandler (
ScrnInfoPtr pScrn = xf86Screens[i];
MGAPtr pMga = MGAPTR(pScrn);
- if(pMga->PaletteLoadCallback)
+ if(pMga->PaletteLoadCallback)
(*pMga->PaletteLoadCallback)(pScrn);
pScreen->BlockHandler = pMga->BlockHandler;
@@ -3588,7 +3572,7 @@ MGABlockHandler (
(*pMga->VideoTimerCallback)(pScrn, currentTime.milliseconds);
}
- if(pMga->RenderCallback)
+ if(pMga->RenderCallback)
(*pMga->RenderCallback)(pScrn);
}
@@ -3679,7 +3663,7 @@ dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val)
MGAPtr pMga;
CARD32 ret;
- if (((addr & 0xff00) == 0x1c00)
+ if (((addr & 0xff00) == 0x1c00)
&& (addr != 0x1c04)
/* && (addr != 0x1c1c) */
&& (addr != 0x1c20)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c
index 943c71b77..64b81bdde 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.1 2001/02/13 19:19:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.2 2001/04/05 17:42:32 dawes Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -15,17 +15,10 @@
#include "mga_reg.h"
#include "mga.h"
-#define DEBUG
-
#define MNP_TABLE_SIZE 64
#define CLKSEL_MGA 0x0c
#define PLLLOCK 0x40
-#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
-
-#define outMGAdac(reg, val) \
- (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
-
static CARD32 G450ApplyPFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn)
{
if(!(ucP & 0x40))
@@ -143,7 +136,10 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
*pulPLLMNP |= (CARD32)ucM << 16;
*pulPLLMNP |= (CARD32)ucN << 8;
*pulPLLMNP |= (CARD32)ucP;
- }
+#ifdef DEBUG
+ ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", ulVCO, (ULONG)ucS, *pulPLLMNP);
+#endif
+ }
return TRUE;
}
@@ -196,12 +192,19 @@ static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP)
{
MGAPtr pMga = MGAPTR(pScrn);
-
- /* Pixel Pll */
- outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16));
- outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8));
- outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP);
- OUTREG8(0x3c00, 0x4f);
+ MGARegPtr pReg;
+
+ pReg = &pMga->ModeReg;
+
+ if (!pMga->SecondCrtc) {
+ outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16));
+ outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8));
+ outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP);
+ } else {
+ outMGAdac(MGA1064_VID_PLL_M, (CARD8)(ulMNP >> 16));
+ outMGAdac(MGA1064_VID_PLL_N, (CARD8)(ulMNP >> 8));
+ outMGAdac(MGA1064_VID_PLL_P, (CARD8) ulMNP);
+ }
return TRUE;
}
@@ -256,7 +259,10 @@ static CARD32 G450IsPllLocked(ScrnInfoPtr pScrn, Bool *lpbLocked)
MGAPtr pMga = MGAPTR(pScrn);
/* Pixel PLL */
- OUTREG8(0x3c00, 0x4f);
+ if (!pMga->SecondCrtc)
+ OUTREG8(0x3c00, 0x4f);
+ else
+ OUTREG8(0x3c00, 0x8f);
ulFallBackCounter = 0;
@@ -290,7 +296,6 @@ double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
Bool bFoundValidPLL;
Bool bLocked;
CARD8 ucMisc;
- CARD8 ucS;
CARD32 ulMaxIndex;
CARD32 ulMNP;
CARD32 ulMNPTable[MNP_TABLE_SIZE];
@@ -359,10 +364,10 @@ double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
{
ulTryMNP = ulMNPTable[ulIndex];
- for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8)
+/* for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8)*/
{
- ulTryMNP &= 0xffffffc7;
- ulTryMNP |= (CARD32)ucS;
+/* ulTryMNP &= 0xffffffc7;*/
+/* ulTryMNP |= (CARD32)ucS;*/
bLocked = TRUE;
if((ulMNPTable[ulIndex] & 0xff00) < 0x300 ||
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
index 85c9b92d6..f8907bc6b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.19 2001/02/13 19:19:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.20 2001/03/21 17:02:24 dawes Exp $ */
#ifndef _MGA_MACROS_H_
#define _MGA_MACROS_H_
@@ -83,7 +83,7 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
#ifdef XF86DRI
#define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \
- if (!pMGA->have_quiescense) { \
+ if (!pMGA->haveQuiescense) { \
pMGA->GetQuiescence( pScrn ); \
} \
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
index ba0d8fabc..c0689c334 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
@@ -2,7 +2,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.14 2000/11/08 05:03:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.16 2001/04/05 17:42:33 dawes Exp $ */
@@ -22,7 +22,7 @@
* g.desbief@aix.pacwan.net
* MGA1064SG Mystique register file
*/
-
+
#ifndef _MGA_REG_H_
#define _MGA_REG_H_
@@ -170,7 +170,7 @@
/* z drawing mode. use MGADWG_NOZCMP for always */
#define MGADWG_NOZCMP ( 0x00 << 8 )
-#define MGADWG_ZE ( 0x02 << 8 )
+#define MGADWG_ZE ( 0x02 << 8 )
#define MGADWG_ZNE ( 0x03 << 8 )
#define MGADWG_ZLT ( 0x04 << 8 )
#define MGADWG_ZLTE ( 0x05 << 8 )
@@ -219,7 +219,7 @@
#define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2)
#define MGAREG_MISC_VIDEO_DIS (0x1 << 4)
#define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5)
-
+
/* MMIO VGA registers */
#define MGAREG_CRTC_INDEX 0x1fd4
#define MGAREG_CRTC_DATA 0x1fd5
@@ -387,6 +387,44 @@
#define MGA1064_PIX_PLL_STAT 0x4f
+/*Added for G450 dual head*/
+/* Supported PLL*/
+#define __PIXEL_PLL 1
+#define __SYSTEM_PLL 2
+#define __VIDEO_PLL 3
+
+#define MGA1064_VID_PLL_P 0x8D
+#define MGA1064_VID_PLL_M 0x8E
+#define MGA1064_VID_PLL_N 0x8F
+
+#define MGA1064_DISP_CTL 0x8a
+#define MGA1064_SYNC_CTL 0x8b
+#define MGA1064_PWR_CTL 0xa0
+/* Using crtc2 */
+#define MGAREG2_C2CTL 0x10
+#define MGAREG2_C2HPARAM 0x14
+#define MGAREG2_C2HSYNC 0x18
+#define MGAREG2_C2VPARAM 0x1c
+#define MGAREG2_C2VSYNC 0x20
+#define MGAREG2_C2STARTADD0 0x28
+
+#define MGAREG2_C2OFFSET 0x40
+#define MGAREG2_C2DATACTL 0x4c
+
+#define MGAREG_C2CTL 0x3c10
+#define MGAREG_C2HPARAM 0x3c14
+#define MGAREG_C2HSYNC 0x3c18
+#define MGAREG_C2VPARAM 0x3c1c
+#define MGAREG_C2VSYNC 0x3c20
+#define MGAREG_C2STARTADD0 0x3c28
+
+#define MGAREG_C2OFFSET 0x3c40
+#define MGAREG_C2DATACTL 0x3c4c
+
+#define MGA1064_DISP_CTL 0x8a
+#define MGA1064_SYNC_CTL 0x8b
+#define MGA1064_PWR_CTL 0xa0
+
/* video register */
#define MGAREG_BESA1C3ORG 0x3d60
@@ -431,9 +469,8 @@
#define MGAREG_ALPHACTRL 0x2c7c
#define MGAREG_DWGSYNC 0x2c4c
-#define MGAREG_AGP_PLL 0x1e4c
-#define AGP_PLL_agp2xpllen_enable 0x1
-#define AGP_PLL_agp2xpllen_disable 0x0
+#define MGAREG_AGP_PLL 0x1e4c
+#define MGA_AGP2XPLL_ENABLE 0x1
+#define MGA_AGP2XPLL_DISABLE 0x0
#endif
-
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h
new file mode 100644
index 000000000..616dee587
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h
@@ -0,0 +1,222 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h,v 1.1 2001/03/21 17:11:47 dawes Exp $ */
+
+/*
+ * Copyright 2000 Gareth Hughes
+ * 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
+ * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __MGA_SAREA_H__
+#define __MGA_SAREA_H__
+
+/* WARNING: If you change any of these defines, make sure to change
+ * the kernel include file as well (mga_drm.h)
+ */
+#ifndef __MGA_SAREA_DEFINES__
+#define __MGA_SAREA_DEFINES__
+
+/* WARP pipe flags
+ */
+#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_G200_PIPES 8 /* no multitex */
+#define MGA_MAX_G400_PIPES 16
+#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
+#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */
+
+#define MGA_CARD_TYPE_G200 1
+#define MGA_CARD_TYPE_G400 2
+
+
+#define MGA_FRONT 0x1
+#define MGA_BACK 0x2
+#define MGA_DEPTH 0x4
+
+/* What needs to be changed for the current vertex dma buffer?
+ */
+#define MGA_UPLOAD_CONTEXT 0x1
+#define MGA_UPLOAD_TEX0 0x2
+#define MGA_UPLOAD_TEX1 0x4
+#define MGA_UPLOAD_PIPE 0x8
+#define MGA_UPLOAD_TEX0IMAGE 0x10
+#define MGA_UPLOAD_TEX1IMAGE 0x20
+#define MGA_UPLOAD_2D 0x40
+#define MGA_WAIT_AGE 0x80 /* handled client-side */
+#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
+#if 0
+#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
+ quiescent */
+#endif
+
+/* 32 buffers of 64k each, total 1 meg.
+ */
+#define MGA_BUFFER_SIZE (1 << 16)
+#define MGA_NUM_BUFFERS 128
+
+/* Keep these small for testing.
+ */
+#define MGA_NR_SAREA_CLIPRECTS 8
+
+/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
+ * regions, subject to a minimum region size of (1<<16) == 64k.
+ *
+ * Clients may subdivide regions internally, but when sharing between
+ * clients, the region size is the minimum granularity.
+ */
+
+#define MGA_CARD_HEAP 0
+#define MGA_AGP_HEAP 1
+#define MGA_NR_TEX_HEAPS 2
+#define MGA_NR_TEX_REGIONS 16
+#define MGA_LOG_MIN_TEX_REGION_SIZE 16
+
+#endif /* __MGA_SAREA_DEFINES__ */
+
+
+/* Setup registers for 3D context
+ */
+typedef struct {
+ unsigned int dstorg;
+ unsigned int maccess;
+ unsigned int plnwt;
+ unsigned int dwgctl;
+ unsigned int alphactrl;
+ unsigned int fogcolor;
+ unsigned int wflag;
+ unsigned int tdualstage0;
+ unsigned int tdualstage1;
+ unsigned int fcol;
+ unsigned int stencil;
+ unsigned int stencilctl;
+} mga_context_regs_t;
+
+/* Setup registers for 2D, X server
+ */
+typedef struct {
+ unsigned int pitch;
+} mga_server_regs_t;
+
+/* Setup registers for each texture unit
+ */
+typedef struct {
+ unsigned int texctl;
+ unsigned int texctl2;
+ unsigned int texfilter;
+ unsigned int texbordercol;
+ unsigned int texorg;
+ unsigned int texwidth;
+ unsigned int texheight;
+ unsigned int texorg1;
+ unsigned int texorg2;
+ unsigned int texorg3;
+ unsigned int texorg4;
+} mga_texture_regs_t;
+
+/* General ageing mechanism
+ */
+typedef struct {
+ unsigned int head; /* Position of head pointer */
+ unsigned int wrap; /* Primary DMA wrap count */
+} mga_age_t;
+
+
+/* WARNING: Do not change the SAREA structure without changing the kernel
+ * as well.
+ */
+typedef struct {
+ /* The channel for communication of state information to the kernel
+ * on firing a vertex dma buffer.
+ */
+ mga_context_regs_t ContextState;
+ mga_server_regs_t ServerState;
+ mga_texture_regs_t TexState[2];
+ unsigned int WarpPipe;
+ unsigned int dirty;
+ unsigned int vertsize;
+
+ /* The current cliprects, or a subset thereof.
+ */
+ XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
+ unsigned int nbox;
+
+ /* Information about the most recently used 3d drawable. The
+ * client fills in the req_* fields, the server fills in the
+ * exported_ fields and puts the cliprects into boxes, above.
+ *
+ * The client clears the exported_drawable field before
+ * clobbering the boxes data.
+ */
+ unsigned int req_drawable; /* the X drawable id */
+ unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */
+
+ unsigned int exported_drawable;
+ unsigned int exported_index;
+ unsigned int exported_stamp;
+ unsigned int exported_buffers;
+ unsigned int exported_nfront; /* FIXME: verify signedness... */
+ unsigned int exported_nback;
+ int exported_back_x, exported_front_x, exported_w;
+ int exported_back_y, exported_front_y, exported_h;
+ XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS];
+
+ /* Counters for aging textures and for client-side throttling.
+ */
+ unsigned int status[4];
+ unsigned int last_wrap;
+
+ mga_age_t last_frame;
+ unsigned int last_enqueue; /* last time a buffer was enqueued */
+ unsigned int last_dispatch; /* age of the most recently dispatched buffer */
+ unsigned int last_quiescent; /* */
+
+ /* LRU lists for texture memory in agp space and on the card.
+ */
+ drmTextureRegion texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1];
+ unsigned int texAge[MGA_NR_TEX_HEAPS];
+
+ /* Last context that uploaded statel
+ */
+ int ctxOwner;
+} MGASAREAPrivRec, *MGASAREAPrivPtr;
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
index 0dc9b145a..4b8b34158 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.84 2001/02/16 15:39:35 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.87 2001/04/05 21:29:15 dawes Exp $ */
/* All drivers should typically include these */
@@ -61,7 +61,7 @@ static void MGANAME(SubsequentColorExpandScanlineIndirect)(ScrnInfoPtr pScrn,
int bufno);
static void MGANAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn,
int x, int y, int w, int h);
-static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
+static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR);
static void MGANAME(SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn,
@@ -78,8 +78,8 @@ static void MGANAME(SubsequentMono8x8PatternFillRect_Additional)(
ScrnInfoPtr pScrn, int patx, int paty,
int x, int y, int w, int h );
static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn,
- int patx, int paty, int y, int h,
- int left, int dxL, int dyL, int eL,
+ int patx, int paty, int y, int h,
+ int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR);
static void MGANAME(SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop,
unsigned int planemask,
@@ -89,7 +89,7 @@ static void MGANAME(SubsequentScanlineImageWriteRect)(ScrnInfoPtr pScrn,
static void MGANAME(SubsequentImageWriteScanline)(ScrnInfoPtr pScrn, int num);
#if PSZ != 24
static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)(
- ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ ScrnInfoPtr pScrn, int fg, int bg, int rop,
unsigned int planemask);
static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
@@ -97,16 +97,16 @@ static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)(
int srcx, int srcy, int skipleft);
#endif
static void MGANAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
+ int fg, int bg, int rop,
unsigned int planemask);
static void MGANAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn,
int x, int y, int w, int h,
int srcx, int srcy, int skipleft);
-static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg,
+static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg,
int rop, unsigned int planemask, int length,
unsigned char *pattern);
static void MGANAME(SubsequentDashedTwoPointLine)(ScrnInfoPtr pScrn,
- int x1, int y1, int x2, int y2,
+ int x1, int y1, int x2, int y2,
int flags, int phase);
void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn);
#if PSZ == 8
@@ -116,7 +116,7 @@ void Mga32RestoreAccelState(ScrnInfoPtr pScrn);
#endif
#ifdef XF86DRI
-void MGANAME(DRIInitBuffers)(WindowPtr pWin,
+void MGANAME(DRIInitBuffers)(WindowPtr pWin,
RegionPtr prgn, CARD32 index);
void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
@@ -126,14 +126,14 @@ void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
extern void MGASetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2);
extern void MGADisableClipping(ScrnInfoPtr pScrn);
-extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop,
+extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop,
unsigned int planemask, int nBox, BoxPtr pBox);
-extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop,
+extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop,
unsigned int planemask, int n, DDXPointPtr ppt,
int *pwidth, int fSorted);
extern void MGAFillMono8x8PatternRectsTwoPass(ScrnInfoPtr pScrn, int fg, int bg,
int rop, unsigned int planemask, int nBox,
- BoxPtr pBox, int pattern0, int pattern1,
+ BoxPtr pBox, int pattern0, int pattern1,
int xorigin, int yorigin);
extern void MGAValidatePolyArc(GCPtr, unsigned long, DrawablePtr);
extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr);
@@ -142,7 +142,7 @@ extern void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr,
#ifdef RENDER
-extern Bool
+extern Bool
MGASetupForCPUToScreenAlphaTexture (
ScrnInfoPtr pScrn,
int op,
@@ -158,7 +158,7 @@ MGASetupForCPUToScreenAlphaTexture (
int flags
);
-extern Bool
+extern Bool
MGASetupForCPUToScreenAlphaTextureFaked (
ScrnInfoPtr pScrn,
int op,
@@ -175,7 +175,7 @@ MGASetupForCPUToScreenAlphaTextureFaked (
);
-extern Bool
+extern Bool
MGASetupForCPUToScreenTexture (
ScrnInfoPtr pScrn,
int op,
@@ -187,7 +187,7 @@ MGASetupForCPUToScreenTexture (
int flags
);
-extern void
+extern void
MGASubsequentCPUToScreenTexture (
ScrnInfoPtr pScrn,
int dstx,
@@ -208,7 +208,7 @@ extern CARD32 MGATextureFormats[2];
CARD32 MGAAlphaTextureFormats[2] = {PICT_a8, 0};
CARD32 MGATextureFormats[2] = {PICT_a8r8g8b8, 0};
-static void
+static void
RemoveLinear (FBLinearPtr linear)
{
MGAPtr pMga = (MGAPtr)(linear->devPrivate.ptr);
@@ -243,19 +243,19 @@ AllocateLinear (
pMga->RenderCallback = RenderCallback;
if(pMga->LinearScratch) {
- if(pMga->LinearScratch->size >= sizeNeeded)
+ if(pMga->LinearScratch->size >= sizeNeeded)
return TRUE;
else {
if(xf86ResizeOffscreenLinear(pMga->LinearScratch, sizeNeeded))
return TRUE;
-
+
xf86FreeOffscreenLinear(pMga->LinearScratch);
pMga->LinearScratch = NULL;
}
}
pMga->LinearScratch = xf86AllocateOffscreenLinear(
- pScrn->pScreen, sizeNeeded, 32,
+ pScrn->pScreen, sizeNeeded, 32,
NULL, RemoveLinear, pMga);
return (pMga->LinearScratch != NULL);
@@ -264,15 +264,15 @@ AllocateLinear (
static int
GetPowerOfTwo(int w)
{
- int Pof2;
+ int Pof2 = 0;
int i = 12;
while(--i) {
if(w & (1 << i)) {
Pof2 = i;
- if(w & ((1 << i) - 1))
+ if(w & ((1 << i) - 1))
Pof2++;
- break;
+ break;
}
}
return Pof2;
@@ -281,7 +281,7 @@ GetPowerOfTwo(int w)
static int tex_padw, tex_padh;
-Bool
+Bool
MGASetupForCPUToScreenAlphaTextureFaked (
ScrnInfoPtr pScrn,
int op,
@@ -318,7 +318,7 @@ MGASetupForCPUToScreenAlphaTextureFaked (
pitch = (width + 15) & ~15;
sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16)
+ if(pScrn->bitsPerPixel == 16)
sizeNeeded <<= 1;
if(!AllocateLinear(pScrn, sizeNeeded))
@@ -328,12 +328,12 @@ MGASetupForCPUToScreenAlphaTextureFaked (
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
- if(pMga->AccelInfoRec->NeedToSync)
+ if(pMga->AccelInfoRec->NeedToSync)
MGAStormSync(pScrn);
XAA_888_plus_PICT_a8_to_8888(
- (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8),
- alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset),
+ (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8),
+ alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset),
pitch, width, height);
tex_padw = 1 << log2w;
@@ -344,24 +344,24 @@ MGASetupForCPUToScreenAlphaTextureFaked (
OUTREG(MGAREG_TMR1, 0); /* sy inc */
OUTREG(MGAREG_TMR2, 0); /* tx inc */
OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */
- OUTREG(MGAREG_TMR4, 0x00000000);
+ OUTREG(MGAREG_TMR4, 0x00000000);
OUTREG(MGAREG_TMR5, 0x00000000);
OUTREG(MGAREG_TMR8, 0x00010000);
- OUTREG(MGAREG_TEXORG, offset);
- OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
+ OUTREG(MGAREG_TEXORG, offset);
+ OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
((width - 1) << 18));
- OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
+ OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
+ OUTREG(MGAREG_DWGCTL, 0x000c7076);
OUTREG(MGAREG_TEXFILTER, 0x01e00020);
OUTREG(MGAREG_ALPHACTRL, 0x00000154);
return TRUE;
}
-Bool
+Bool
MGASetupForCPUToScreenAlphaTexture (
ScrnInfoPtr pScrn,
int op,
@@ -399,7 +399,7 @@ MGASetupForCPUToScreenAlphaTexture (
pitch = (width + 15) & ~15;
sizeNeeded = (pitch * height) >> 1;
- if(pScrn->bitsPerPixel == 32)
+ if(pScrn->bitsPerPixel == 32)
sizeNeeded >>= 1;
if(!AllocateLinear(pScrn, sizeNeeded))
@@ -409,7 +409,7 @@ MGASetupForCPUToScreenAlphaTexture (
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
- if(pMga->AccelInfoRec->NeedToSync)
+ if(pMga->AccelInfoRec->NeedToSync)
MGAStormSync(pScrn);
i = height;
@@ -423,7 +423,7 @@ MGASetupForCPUToScreenAlphaTexture (
tex_padw = 1 << log2w;
tex_padh = 1 << log2h;
-
+
WAITFIFO(12);
OUTREG(MGAREG_DR4, red << 7); /* red start */
OUTREG(MGAREG_DR6, 0);
@@ -435,25 +435,25 @@ MGASetupForCPUToScreenAlphaTexture (
OUTREG(MGAREG_DR14, 0);
OUTREG(MGAREG_DR15, 0);
OUTREG(MGAREG_ALPHASTART, alpha << 7); /* alpha start */
- OUTREG(MGAREG_ALPHAXINC, 0);
- OUTREG(MGAREG_ALPHAYINC, 0);
+ OUTREG(MGAREG_ALPHAXINC, 0);
+ OUTREG(MGAREG_ALPHAYINC, 0);
WAITFIFO(15);
OUTREG(MGAREG_TMR0, (1 << 20) / tex_padw); /* sx inc */
OUTREG(MGAREG_TMR1, 0); /* sy inc */
OUTREG(MGAREG_TMR2, 0); /* tx inc */
OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */
- OUTREG(MGAREG_TMR4, 0x00000000);
+ OUTREG(MGAREG_TMR4, 0x00000000);
OUTREG(MGAREG_TMR5, 0x00000000);
OUTREG(MGAREG_TMR8, 0x00010000);
- OUTREG(MGAREG_TEXORG, offset);
- OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
+ OUTREG(MGAREG_TEXORG, offset);
+ OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
((width - 1) << 18));
- OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
+ OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
OUTREG(MGAREG_TEXCTL, 0x3A000107 | ((pitch & 0x07FF) << 9));
OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
+ OUTREG(MGAREG_DWGCTL, 0x000c7076);
OUTREG(MGAREG_TEXFILTER, 0x01e00020);
OUTREG(MGAREG_ALPHACTRL, 0x02000151);
@@ -461,7 +461,7 @@ MGASetupForCPUToScreenAlphaTexture (
}
-Bool
+Bool
MGASetupForCPUToScreenTexture (
ScrnInfoPtr pScrn,
int op,
@@ -494,7 +494,7 @@ MGASetupForCPUToScreenTexture (
pitch = (width + 15) & ~15;
sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16)
+ if(pScrn->bitsPerPixel == 16)
sizeNeeded <<= 1;
if(!AllocateLinear(pScrn, sizeNeeded))
@@ -504,7 +504,7 @@ MGASetupForCPUToScreenTexture (
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
- if(pMga->AccelInfoRec->NeedToSync)
+ if(pMga->AccelInfoRec->NeedToSync)
MGAStormSync(pScrn);
{
@@ -525,23 +525,23 @@ MGASetupForCPUToScreenTexture (
OUTREG(MGAREG_TMR1, 0); /* sy inc */
OUTREG(MGAREG_TMR2, 0); /* tx inc */
OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */
- OUTREG(MGAREG_TMR4, 0x00000000);
+ OUTREG(MGAREG_TMR4, 0x00000000);
OUTREG(MGAREG_TMR5, 0x00000000);
OUTREG(MGAREG_TMR8, 0x00010000);
- OUTREG(MGAREG_TEXORG, offset);
- OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
+ OUTREG(MGAREG_TEXORG, offset);
+ OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
((width - 1) << 18));
- OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
+ OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
+ OUTREG(MGAREG_DWGCTL, 0x000c7076);
OUTREG(MGAREG_TEXFILTER, 0x01e00020);
OUTREG(MGAREG_ALPHACTRL, 0x00000151);
return TRUE;
}
-void
+void
MGASubsequentCPUToScreenTexture (
ScrnInfoPtr pScrn,
int dstx,
@@ -567,7 +567,7 @@ MGASubsequentCPUToScreenTexture (
#endif
Bool
-MGANAME(AccelInit)(ScreenPtr pScreen)
+MGANAME(AccelInit)(ScreenPtr pScreen)
{
XAAInfoRecPtr infoPtr;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -578,7 +578,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3);
if(!pMga->ScratchBuffer) return FALSE;
-
+
pMga->AccelInfoRec = infoPtr = XAACreateInfoRec();
if(!infoPtr) return FALSE;
@@ -593,7 +593,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
case PCI_CHIP_MGA2164_AGP:
pMga->AccelFlags = BLK_OPAQUE_EXPANSION |
TRANSC_SOLID_FILL |
- USE_RECTS_FOR_LINES;
+ USE_RECTS_FOR_LINES;
break;
case PCI_CHIP_MGAG400:
if(pMga->SecondCrtc == TRUE) {
@@ -638,7 +638,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
}
/* fill out infoPtr here */
- infoPtr->Flags = PIXMAP_CACHE |
+ infoPtr->Flags = PIXMAP_CACHE |
OFFSCREEN_PIXMAPS |
LINEAR_FRAMEBUFFER |
MICROSOFT_ZERO_LINE_BIAS;
@@ -666,7 +666,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->SetupForSolidLine = infoPtr->SetupForSolidFill;
infoPtr->SubsequentSolidHorVertLine =
MGANAME(SubsequentSolidHorVertLine);
- infoPtr->SubsequentSolidTwoPointLine =
+ infoPtr->SubsequentSolidTwoPointLine =
MGANAME(SubsequentSolidTwoPointLine);
/* clipping */
@@ -675,15 +675,16 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE |
HARDWARE_CLIP_DASHED_LINE |
HARDWARE_CLIP_SOLID_FILL |
- HARDWARE_CLIP_MONO_8x8_FILL;
+ HARDWARE_CLIP_MONO_8x8_FILL;
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
/* dashed lines */
infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
infoPtr->SetupForDashedLine = MGANAME(SetupForDashedLine);
- infoPtr->SubsequentDashedTwoPointLine =
+ infoPtr->SubsequentDashedTwoPointLine =
MGANAME(SubsequentDashedTwoPointLine);
infoPtr->DashPatternMaxLength = 128;
-
+#endif
/* 8x8 mono patterns */
infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS |
@@ -691,16 +692,20 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
HARDWARE_PATTERN_SCREEN_ORIGIN |
BIT_ORDER_IN_BYTE_MSBFIRST;
infoPtr->SetupForMono8x8PatternFill = MGANAME(SetupForMono8x8PatternFill);
- infoPtr->SubsequentMono8x8PatternFillRect =
+ infoPtr->SubsequentMono8x8PatternFillRect =
MGANAME(SubsequentMono8x8PatternFillRect);
- infoPtr->SubsequentMono8x8PatternFillTrap =
+ infoPtr->SubsequentMono8x8PatternFillTrap =
MGANAME(SubsequentMono8x8PatternFillTrap);
/* cpu to screen color expansion */
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
+ infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
CPU_TRANSFER_PAD_DWORD |
SCANLINE_PAD_DWORD |
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+#else
BIT_ORDER_IN_BYTE_LSBFIRST |
+#endif
LEFT_EDGE_CLIPPING |
LEFT_EDGE_CLIPPING_NEGATIVE_X;
@@ -719,23 +724,23 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
MGANAME(SubsequentScanlineCPUToScreenColorExpandFill);
infoPtr->SubsequentColorExpandScanline =
MGANAME(SubsequentColorExpandScanline);
- infoPtr->NumScanlineColorExpandBuffers = 1;
+ infoPtr->NumScanlineColorExpandBuffers = 1;
infoPtr->ScanlineColorExpandBuffers = &(pMga->ColorExpandBase);
/* screen to screen color expansion */
if(pMga->AccelFlags & USE_LINEAR_EXPANSION) {
- infoPtr->ScreenToScreenColorExpandFillFlags =
+ infoPtr->ScreenToScreenColorExpandFillFlags =
BIT_ORDER_IN_BYTE_LSBFIRST;
- infoPtr->SetupForScreenToScreenColorExpandFill =
+ infoPtr->SetupForScreenToScreenColorExpandFill =
MGANAME(SetupForScreenToScreenColorExpandFill);
- infoPtr->SubsequentScreenToScreenColorExpandFill =
+ infoPtr->SubsequentScreenToScreenColorExpandFill =
MGANAME(SubsequentScreenToScreenColorExpandFill);
} else {
#if PSZ != 24
/* Alternate (but slower) planar expansions */
- infoPtr->SetupForScreenToScreenColorExpandFill =
+ infoPtr->SetupForScreenToScreenColorExpandFill =
MGANAME(SetupForPlanarScreenToScreenColorExpandFill);
- infoPtr->SubsequentScreenToScreenColorExpandFill =
+ infoPtr->SubsequentScreenToScreenColorExpandFill =
MGANAME(SubsequentPlanarScreenToScreenColorExpandFill);
infoPtr->CacheColorExpandDensity = PSZ;
infoPtr->CacheMonoStipple = XAACachePlanarMonoStipple;
@@ -753,15 +758,15 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
NO_TRANSPARENCY |
NO_GXCOPY;
- infoPtr->SetupForScanlineImageWrite =
+ infoPtr->SetupForScanlineImageWrite =
MGANAME(SetupForScanlineImageWrite);
- infoPtr->SubsequentScanlineImageWriteRect =
+ infoPtr->SubsequentScanlineImageWriteRect =
MGANAME(SubsequentScanlineImageWriteRect);
- infoPtr->SubsequentImageWriteScanline =
+ infoPtr->SubsequentImageWriteScanline =
MGANAME(SubsequentImageWriteScanline);
- infoPtr->NumScanlineImageWriteBuffers = 1;
+ infoPtr->NumScanlineImageWriteBuffers = 1;
infoPtr->ScanlineImageWriteBuffers = &(pMga->ScratchBuffer);
-
+
/* midrange replacements */
@@ -772,13 +777,13 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
if(pMga->AccelFlags & TWO_PASS_COLOR_EXPAND) {
if(infoPtr->SetupForMono8x8PatternFill)
- infoPtr->FillMono8x8PatternRects =
+ infoPtr->FillMono8x8PatternRects =
MGAFillMono8x8PatternRectsTwoPass;
}
if(infoPtr->SetupForSolidFill) {
infoPtr->ValidatePolyArc = MGAValidatePolyArc;
- infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask |
+ infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask |
GCLineStyle | GCFillStyle;
infoPtr->ValidatePolyPoint = MGAValidatePolyPoint;
infoPtr->PolyPointMask = GCFunction | GCPlaneMask;
@@ -790,7 +795,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->SolidFillFlags |= NO_PLANEMASK;
infoPtr->SolidLineFlags |= NO_PLANEMASK;
infoPtr->DashedLineFlags |= NO_PLANEMASK;
- infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK;
+ infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK;
infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK;
infoPtr->FillSolidRectsFlags |= NO_PLANEMASK;
infoPtr->FillSolidSpansFlags |= NO_PLANEMASK;
@@ -798,45 +803,138 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->FillCacheBltRectsFlags |= NO_PLANEMASK;
}
-
+
maxFastBlitMem = (pMga->Interleave ? 4096 : 2048) * 1024;
if(pMga->FbMapSize > maxFastBlitMem) {
pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * PSZ / 8);
}
- maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) /
+ maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) /
(pScrn->displayWidth * PSZ / 8);
+
#ifdef XF86DRI
- if (pMga->directRenderingEnabled) {
- if(maxlines > (pMga->numXAALines + pScrn->virtualY))
- maxlines = pMga->numXAALines + pScrn->virtualY;
-
- if(maxlines < (pMga->numXAALines + pScrn->virtualY))
- pMga->numXAALines = maxlines - pScrn->virtualY;
-
- /* not like the 3D will even work when there's not
- even enough memory for a tiny pixmap cache */
- }
-
+ if ( pMga->directRenderingEnabled ) {
+ MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
+ BoxRec MemBox;
+ int cpp = pScrn->bitsPerPixel / 8;
+ int width_bytes = pScrn->displayWidth * cpp;
+ int bufferSize = ((pScrn->virtualY * width_bytes + MGA_BUFFER_ALIGN)
+ & ~MGA_BUFFER_ALIGN);
+ int scanlines;
+
+ pMGADRIServer->frontOffset = 0;
+ pMGADRIServer->frontPitch = width_bytes;
+
+ /* Try for front, back, depth, and two framebuffers worth of
+ * pixmap cache. Should be enough for a fullscreen background
+ * image plus some leftovers.
+ */
+ pMGADRIServer->textureSize = pMga->FbMapSize - 5 * bufferSize;
+
+ /* If that gives us less than half the available memory, let's
+ * be greedy and grab some more. Sorry, I care more about 3D
+ * performance than playing nicely, and you'll get around a full
+ * framebuffer's worth of pixmap cache anyway.
+ */
+ if ( pMGADRIServer->textureSize < (int)pMga->FbMapSize / 2 ) {
+ pMGADRIServer->textureSize = pMga->FbMapSize - 4 * bufferSize;
+ }
+
+ /* Check to see if there is more room available after the maximum
+ * scanline for textures.
+ */
+ if ( (int)pMga->FbMapSize - maxlines * width_bytes - bufferSize * 2
+ > pMGADRIServer->textureSize ) {
+ pMGADRIServer->textureSize = (pMga->FbMapSize -
+ maxlines * width_bytes -
+ bufferSize * 2);
+ }
+
+ /* Set a minimum usable local texture heap size. This will fit
+ * two 256x256x32bpp textures.
+ */
+ if ( pMGADRIServer->textureSize < 512 * 1024 ) {
+ pMGADRIServer->textureOffset = 0;
+ pMGADRIServer->textureSize = 0;
+ }
+
+ /* Reserve space for textures */
+ pMGADRIServer->textureOffset = (pMga->FbMapSize -
+ pMGADRIServer->textureSize +
+ MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN;
+
+ /* Reserve space for the shared depth buffer */
+ pMGADRIServer->depthOffset = (pMGADRIServer->textureOffset -
+ bufferSize +
+ MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN;
+ pMGADRIServer->depthPitch = width_bytes;
+
+ /* Reserve space for the shared back buffer */
+ pMGADRIServer->backOffset = (pMGADRIServer->depthOffset - bufferSize +
+ MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN;
+ pMGADRIServer->backPitch = width_bytes;
+
+ scanlines = pMGADRIServer->backOffset / width_bytes - 1;
+ if ( scanlines > maxlines ) scanlines = maxlines;
+
+ MemBox.x1 = 0;
+ MemBox.y1 = 0;
+ MemBox.x2 = pScrn->displayWidth;
+ MemBox.y2 = scanlines;
+
+ if ( !xf86InitFBManager( pScreen, &MemBox ) ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "Memory manager initialization to (%d,%d) (%d,%d) failed\n",
+ MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 );
+ return FALSE;
+ } else {
+ int width, height;
+
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "Memory manager initialized to (%d,%d) (%d,%d)\n",
+ MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 );
+
+ if ( xf86QueryLargestOffscreenArea( pScreen, &width,
+ &height, 0, 0, 0 ) ) {
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "Largest offscreen area available: %d x %d\n",
+ width, height );
+ }
+ }
+
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "Reserved back buffer at offset 0x%x\n",
+ pMGADRIServer->backOffset );
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "Reserved depth buffer at offset 0x%x\n",
+ pMGADRIServer->depthOffset );
+ xf86DrvMsg( pScrn->scrnIndex, X_INFO,
+ "Reserved %d kb for textures at offset 0x%x\n",
+ pMGADRIServer->textureSize/1024,
+ pMGADRIServer->textureOffset );
+ }
+ else
#endif
+ {
+ AvailFBArea.x1 = 0;
+ AvailFBArea.x2 = pScrn->displayWidth;
+ AvailFBArea.y1 = 0;
+ AvailFBArea.y2 = maxlines;
+
+ /*
+ * Need to keep a strip of memory to the right of screen to workaround
+ * a display problem with the second CRTC.
+ */
+ if (pMga->SecondCrtc)
+ AvailFBArea.x2 = pScrn->virtualX;
+
+ xf86InitFBManager(pScreen, &AvailFBArea);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen "
+ "memory.\n",
+ maxlines - pScrn->virtualY);
- AvailFBArea.x1 = 0;
- AvailFBArea.x2 = pScrn->displayWidth;
- AvailFBArea.y1 = 0;
- AvailFBArea.y2 = maxlines;
-
- /*
- * Need to keep a strip of memory to the right of screen to workaround
- * a display problem with the second CRTC.
- */
- if (pMga->SecondCrtc)
- AvailFBArea.x2 = pScrn->virtualX;
-
- xf86InitFBManager(pScreen, &AvailFBArea);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen "
- "memory.\n",
- maxlines - pScrn->virtualY);
+ }
{
Bool shared_accel = FALSE;
@@ -855,15 +953,15 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
{
if(pMga->Chipset == PCI_CHIP_MGAG400) {
infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE;
- infoPtr->SetupForCPUToScreenAlphaTexture =
+ infoPtr->SetupForCPUToScreenAlphaTexture =
MGASetupForCPUToScreenAlphaTexture;
} else {
infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE |
XAA_RENDER_NO_SRC_ALPHA;
- infoPtr->SetupForCPUToScreenAlphaTexture =
+ infoPtr->SetupForCPUToScreenAlphaTexture =
MGASetupForCPUToScreenAlphaTextureFaked;
}
- infoPtr->SubsequentCPUToScreenAlphaTexture =
+ infoPtr->SubsequentCPUToScreenAlphaTexture =
MGASubsequentCPUToScreenTexture;
infoPtr->CPUToScreenAlphaTextureFormats = MGAAlphaTextureFormats;
@@ -885,7 +983,7 @@ MGANAME(InitSolidFillRectFuncs)(MGAPtr pMga)
}
/* Support for multiscreen */
-void
+void
MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn)
{
MGAPtr pMga = MGAPTR(pScrn);
@@ -909,42 +1007,42 @@ MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn)
SET_FOREGROUND(tmp);
OUTREG(MGAREG_SRCORG, pMga->realSrcOrg);
OUTREG(MGAREG_DSTORG, pMga->DstOrg);
- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000);
OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
- OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
+ OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
pMga->AccelFlags &= ~CLIPPER_ON;
}
#if PSZ == 8
CARD32 MGAAtype[16] = {
- MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000,
+ MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000,
MGADWG_RSTR | 0x00040000, MGADWG_BLK | 0x000c0000,
- MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000,
+ MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000,
MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000,
- MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000,
+ MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000,
MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000,
- MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000,
+ MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000,
MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000
};
CARD32 MGAAtypeNoBLK[16] = {
- MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000,
+ MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000,
MGADWG_RSTR | 0x00040000, MGADWG_RPL | 0x000c0000,
- MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000,
+ MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000,
MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000,
- MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000,
+ MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000,
MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000,
- MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000,
+ MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000,
MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000
};
-Bool
+Bool
MGAStormAccelInit(ScreenPtr pScreen)
-{
+{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
switch( pScrn->bitsPerPixel )
@@ -964,34 +1062,37 @@ MGAStormAccelInit(ScreenPtr pScreen)
void
-MGAStormSync(ScrnInfoPtr pScrn)
+MGAStormSync(ScrnInfoPtr pScrn)
{
MGAPtr pMga = MGAPTR(pScrn);
CHECK_DMA_QUIESCENT(pMga, pScrn);
-
+
while(MGAISBUSY());
/* flush cache before a read (mga-1064g 5.1.6) */
- OUTREG8(MGAREG_CRTC_INDEX, 0);
+ OUTREG8(MGAREG_CRTC_INDEX, 0);
if(pMga->AccelFlags & CLIPPER_ON) {
pMga->AccelFlags &= ~CLIPPER_ON;
OUTREG(MGAREG_CXBNDRY, 0xFFFF0000);
}
}
-void
+void
MGAStormEngineInit(ScrnInfoPtr pScrn)
{
long maccess = 0;
MGAPtr pMga = MGAPTR(pScrn);
MGAFBLayout *pLayout = &pMga->CurrentLayout;
+ CARD32 opmode;
CHECK_DMA_QUIESCENT(pMga, pScrn);
- if ((pMga->Chipset == PCI_CHIP_MGAG100)
+ if ((pMga->Chipset == PCI_CHIP_MGAG100)
|| (pMga->Chipset == PCI_CHIP_MGAG100_PCI))
maccess = 1 << 14;
-
+
+ opmode = INREG(MGAREG_OPMODE);
+
switch( pLayout->bitsPerPixel )
{
case 8:
@@ -1003,19 +1104,22 @@ MGAStormEngineInit(ScrnInfoPtr pScrn)
maccess |= (1 << 31);
Mga16InitSolidFillRectFuncs(pMga);
pMga->RestoreAccelState = Mga16RestoreAccelState;
+ opmode |= 10000;
break;
case 24:
maccess |= 3;
Mga24InitSolidFillRectFuncs(pMga);
pMga->RestoreAccelState = Mga24RestoreAccelState;
break;
+ opmode |= 20000;
case 32:
maccess |= 2;
Mga32InitSolidFillRectFuncs(pMga);
pMga->RestoreAccelState = Mga32RestoreAccelState;
+ opmode |= 20000;
break;
}
-
+
pMga->fifoCount = 0;
while(MGAISBUSY());
@@ -1041,12 +1145,12 @@ MGAStormEngineInit(ScrnInfoPtr pScrn)
OUTREG(MGAREG_FCOL, pMga->FgColor);
pMga->BgColor = 0;
OUTREG(MGAREG_BCOL, pMga->BgColor);
- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | opmode);
/* put clipping in a known state */
- OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
- OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
- OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
+ OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
+ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
+ OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
pMga->AccelFlags &= ~CLIPPER_ON;
switch(pMga->Chipset) {
@@ -1072,9 +1176,9 @@ void MGASetClippingRectangle(
CHECK_DMA_QUIESCENT(pMga, pScrn);
WAITFIFO(3);
- OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1);
- OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg);
- OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg);
+ OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1);
+ OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg);
+ OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg);
pMga->AccelFlags |= CLIPPER_ON;
}
@@ -1085,9 +1189,9 @@ void MGADisableClipping(ScrnInfoPtr pScrn)
CHECK_DMA_QUIESCENT(pMga, pScrn);
WAITFIFO(3);
- OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
- OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
- OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
+ OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
+ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
+ OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
pMga->AccelFlags &= ~CLIPPER_ON;
}
@@ -1101,40 +1205,40 @@ void MGADisableClipping(ScrnInfoPtr pScrn)
#define BLIT_LEFT 1
#define BLIT_UP 4
-void
+void
MGANAME(SetupForScreenToScreenCopy)(
ScrnInfoPtr pScrn,
int xdir, int ydir,
int rop,
unsigned int planemask,
- int trans
+ int trans
){
MGAPtr pMga = MGAPTR(pScrn);
- CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO |
+ CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO |
MGADWG_BITBLT | MGADWG_BFCOL;
CHECK_DMA_QUIESCENT(pMga, pScrn);
- pMga->AccelInfoRec->SubsequentScreenToScreenCopy =
+ pMga->AccelInfoRec->SubsequentScreenToScreenCopy =
MGANAME(SubsequentScreenToScreenCopy);
pMga->BltScanDirection = 0;
if(ydir == -1) pMga->BltScanDirection |= BLIT_UP;
if(xdir == -1)
pMga->BltScanDirection |= BLIT_LEFT;
- else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent)
- pMga->AccelInfoRec->SubsequentScreenToScreenCopy =
+ else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent)
+ pMga->AccelInfoRec->SubsequentScreenToScreenCopy =
MGANAME(SubsequentScreenToScreenCopy_FastBlit);
- if(pMga->DrawTransparent) {
+ if(pMga->DrawTransparent) {
dwgctl |= MGADWG_TRANSC;
WAITFIFO(2);
SET_FOREGROUND(trans);
trans = ~0;
SET_BACKGROUND(trans);
- }
+ }
- WAITFIFO(4);
+ WAITFIFO(4);
OUTREG(MGAREG_DWGCTL, dwgctl);
OUTREG(MGAREG_SGN, pMga->BltScanDirection);
SET_PLANEMASK(planemask);
@@ -1142,7 +1246,7 @@ MGANAME(SetupForScreenToScreenCopy)(
}
-static void
+static void
MGANAME(SubsequentScreenToScreenCopy)(
ScrnInfoPtr pScrn,
int srcX, int srcY, int dstX, int dstY, int w, int h
@@ -1165,10 +1269,10 @@ MGANAME(SubsequentScreenToScreenCopy)(
start = end = XYADDRESS(srcX, srcY);
if(pMga->BltScanDirection & BLIT_LEFT) start += w;
- else end += w;
+ else end += w;
if (pMga->AccelFlags & LARGE_ADDRESSES) {
- WAITFIFO(7);
+ WAITFIFO(7);
if(DstOrg)
OUTREG(MGAREG_DSTORG, (DstOrg << 6) + pMga->DstOrg);
if(SrcOrg != pMga->SrcOrg) {
@@ -1187,7 +1291,7 @@ MGANAME(SubsequentScreenToScreenCopy)(
if(DstOrg)
OUTREG(MGAREG_DSTORG, pMga->DstOrg);
} else {
- WAITFIFO(4);
+ WAITFIFO(4);
OUTREG(MGAREG_AR0, end);
OUTREG(MGAREG_AR3, start);
OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
@@ -1196,7 +1300,7 @@ MGANAME(SubsequentScreenToScreenCopy)(
}
-static void
+static void
MGANAME(SubsequentScreenToScreenCopy_FastBlit)(
ScrnInfoPtr pScrn,
int srcX, int srcY, int dstX, int dstY, int w, int h
@@ -1228,11 +1332,11 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)(
if(pMga->MaxFastBlitY) {
if(pMga->BltScanDirection & BLIT_UP) {
if((srcY >= pMga->MaxFastBlitY) ||
- (dstY >= pMga->MaxFastBlitY))
+ (dstY >= pMga->MaxFastBlitY))
goto FASTBLIT_BAILOUT;
} else {
if(((srcY + h) > pMga->MaxFastBlitY) ||
- ((dstY + h) > pMga->MaxFastBlitY))
+ ((dstY + h) > pMga->MaxFastBlitY))
goto FASTBLIT_BAILOUT;
}
}
@@ -1247,7 +1351,7 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)(
if((dstX & (1 << 5)) && (((fxright >> 5) - (dstX >> 5)) & 7) == 7) {
fxright |= 1 << 5;
#elif PSZ == 24
- if(((dstX * 3) & (1 << 6)) &&
+ if(((dstX * 3) & (1 << 6)) &&
((((fxright * 3 + 2) >> 6) - ((dstX * 3) >> 6)) & 7) == 7) {
fxright = ((fxright * 3 + 2) | (1 << 6)) / 3;
#elif PSZ == 32
@@ -1261,39 +1365,39 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)(
OUTREG(MGAREG_AR3, start);
OUTREG(MGAREG_FXBNDRY, (fxright << 16) | (dstX & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h);
- OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] |
+ OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] |
MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL);
OUTREG(MGAREG_CXRIGHT, 0xFFFF);
return;
} /* } } } (preserve pairs for pair matching) */
}
-
- WAITFIFO(6);
+
+ WAITFIFO(6);
OUTREG(MGAREG_DWGCTL, 0x040A400C);
OUTREG(MGAREG_AR0, end);
OUTREG(MGAREG_AR3, start);
OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h);
- OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO |
+ OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO |
MGADWG_BITBLT | MGADWG_BFCOL);
return;
- }
+ }
FASTBLIT_BAILOUT:
-
- WAITFIFO(4);
+
+ WAITFIFO(4);
OUTREG(MGAREG_AR0, end);
OUTREG(MGAREG_AR3, start);
OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h);
}
-
+
/******************\
| Solid Fills |
\******************/
-void
+void
MGANAME(SetupForSolidFill)(
ScrnInfoPtr pScrn,
int color,
@@ -1306,28 +1410,28 @@ MGANAME(SetupForSolidFill)(
#if PSZ == 24
if(!RGBEQUAL(color))
- pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO |
- MGADWG_SGNZERO | MGADWG_SHIFTZERO |
+ pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO |
+ MGADWG_SGNZERO | MGADWG_SHIFTZERO |
MGADWG_BMONOLEF | pMga->AtypeNoBLK[rop];
else
#endif
- pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO |
- MGADWG_SGNZERO | MGADWG_SHIFTZERO |
+ pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO |
+ MGADWG_SGNZERO | MGADWG_SHIFTZERO |
MGADWG_BMONOLEF | pMga->Atype[rop];
- pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL |
+ pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL |
pMga->AtypeNoBLK[rop];
- if(pMga->AccelFlags & TRANSC_SOLID_FILL)
+ if(pMga->AccelFlags & TRANSC_SOLID_FILL)
pMga->FilledRectCMD |= MGADWG_TRANSC;
WAITFIFO(3);
SET_FOREGROUND(color);
SET_PLANEMASK(planemask);
OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
-}
+}
-static void
+static void
MGANAME(SubsequentSolidFillRect)(
ScrnInfoPtr pScrn,
int x, int y, int w, int h )
@@ -1337,10 +1441,10 @@ MGANAME(SubsequentSolidFillRect)(
WAITFIFO(2);
OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h);
-}
+}
-static void
-MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
+static void
+MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR )
{
@@ -1351,7 +1455,7 @@ MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
int ar5 = sdxr? dxR : -dxR;
WAITFIFO(11);
- OUTREG(MGAREG_DWGCTL,
+ OUTREG(MGAREG_DWGCTL,
pMga->FilledRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO));
OUTREG(MGAREG_AR0, dyL);
OUTREG(MGAREG_AR1, ar2 - eL);
@@ -1370,10 +1474,10 @@ MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h,
\***************/
-static void
+static void
MGANAME(SubsequentSolidHorVertLine) (
ScrnInfoPtr pScrn,
- int x, int y,
+ int x, int y,
int len, int dir
){
MGAPtr pMga = MGAPTR(pScrn);
@@ -1391,12 +1495,12 @@ MGANAME(SubsequentSolidHorVertLine) (
OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | MGADWG_AUTOLINE_OPEN);
OUTREG(MGAREG_XYSTRT, (y << 16) | (x & 0xffff));
OUTREG(MGAREG_XYEND + MGAREG_EXEC, ((y + len) << 16) | (x & 0xffff));
- OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
+ OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
}
}
-static void
+static void
MGANAME(SubsequentSolidTwoPointLine)(
ScrnInfoPtr pScrn,
int x1, int y1, int x2, int y2, int flags
@@ -1404,11 +1508,11 @@ MGANAME(SubsequentSolidTwoPointLine)(
MGAPtr pMga = MGAPTR(pScrn);
WAITFIFO(4);
- OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD |
+ OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD |
((flags & OMIT_LAST) ? MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE));
OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF));
OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF));
- OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
+ OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
}
@@ -1418,7 +1522,7 @@ MGANAME(SubsequentSolidTwoPointLine)(
\***************************/
-static void
+static void
MGANAME(SetupForMono8x8PatternFill)(
ScrnInfoPtr pScrn,
int patx, int paty,
@@ -1431,12 +1535,12 @@ MGANAME(SetupForMono8x8PatternFill)(
CHECK_DMA_QUIESCENT(pMga, pScrn);
- pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO |
+ pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO |
MGADWG_BMONOLEF;
- infoRec->SubsequentMono8x8PatternFillRect =
+ infoRec->SubsequentMono8x8PatternFillRect =
MGANAME(SubsequentMono8x8PatternFillRect);
-
+
if(bg == -1) {
#if PSZ == 24
if(!RGBEQUAL(fg))
@@ -1448,9 +1552,9 @@ MGANAME(SetupForMono8x8PatternFill)(
WAITFIFO(5);
} else {
#if PSZ == 24
- if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg))
+ if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg))
#else
- if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
+ if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
#endif
pMga->PatternRectCMD |= pMga->Atype[rop];
else
@@ -1468,7 +1572,7 @@ MGANAME(SetupForMono8x8PatternFill)(
-static void
+static void
MGANAME(SubsequentMono8x8PatternFillRect)(
ScrnInfoPtr pScrn,
int patx, int paty,
@@ -1480,11 +1584,11 @@ MGANAME(SubsequentMono8x8PatternFillRect)(
OUTREG(MGAREG_SHIFT, (paty << 4) | patx);
OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h);
- pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect =
+ pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect =
MGANAME(SubsequentMono8x8PatternFillRect_Additional);
}
-static void
+static void
MGANAME(SubsequentMono8x8PatternFillRect_Additional)(
ScrnInfoPtr pScrn,
int patx, int paty,
@@ -1498,12 +1602,12 @@ MGANAME(SubsequentMono8x8PatternFillRect_Additional)(
}
-static void
+static void
MGANAME(SubsequentMono8x8PatternFillTrap)(
ScrnInfoPtr pScrn,
- int patx, int paty,
- int y, int h,
- int left, int dxL, int dyL, int eL,
+ int patx, int paty,
+ int y, int h,
+ int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR
){
MGAPtr pMga = MGAPTR(pScrn);
@@ -1515,7 +1619,7 @@ MGANAME(SubsequentMono8x8PatternFillTrap)(
WAITFIFO(12);
OUTREG(MGAREG_SHIFT, (paty << 4) | patx);
- OUTREG(MGAREG_DWGCTL,
+ OUTREG(MGAREG_DWGCTL,
pMga->PatternRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO));
OUTREG(MGAREG_AR0, dyL);
OUTREG(MGAREG_AR1, ar2 - eL);
@@ -1534,7 +1638,7 @@ MGANAME(SubsequentMono8x8PatternFillTrap)(
\***********************/
-static void
+static void
MGANAME(SetupForScanlineCPUToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
int fg, int bg,
@@ -1542,7 +1646,7 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)(
unsigned int planemask )
{
MGAPtr pMga = MGAPTR(pScrn);
- CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO |
+ CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO |
MGADWG_SHIFTZERO | MGADWG_BMONOLEF;
CHECK_DMA_QUIESCENT(pMga, pScrn);
@@ -1558,10 +1662,10 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)(
WAITFIFO(3);
} else {
#if PSZ == 24
- if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
- RGBEQUAL(fg) && RGBEQUAL(bg))
+ if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
+ RGBEQUAL(fg) && RGBEQUAL(bg))
#else
- if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
+ if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
#endif
mgaCMD |= pMga->Atype[rop];
else
@@ -1573,9 +1677,9 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)(
SET_FOREGROUND(fg);
SET_PLANEMASK(planemask);
OUTREG(MGAREG_DWGCTL, mgaCMD);
-}
+}
-static void
+static void
MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
int x, int y, int w, int h,
@@ -1605,8 +1709,8 @@ MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)(
OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h);
-#ifdef __alpha__
- if(1)
+#if defined(__alpha__)
+ if(1) /* force indirect always on Alpha */
#else
if(pMga->expandDWORDs > pMga->FifoSize)
#endif
@@ -1632,14 +1736,14 @@ MGANAME(SubsequentColorExpandScanlineIndirect)(
MGAPtr pMga = MGAPTR(pScrn);
int dwords = pMga->expandDWORDs;
CARD32 *src = (CARD32*)(pMga->ScratchBuffer);
-
+
while(dwords > pMga->FifoSize) {
WAITFIFO(pMga->FifoSize);
MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize);
src += pMga->FifoSize;
dwords -= pMga->FifoSize;
}
-
+
WAITFIFO(dwords);
MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords);
@@ -1648,7 +1752,7 @@ MGANAME(SubsequentColorExpandScanlineIndirect)(
WAITFIFO(3);
OUTREG(MGAREG_AR0,((pMga->expandDWORDs<< 5)*pMga->expandHeight)-1);
OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */
- OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) |
+ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) |
pMga->expandHeight);
pMga->expandY += pMga->expandHeight;
pMga->expandRows = pMga->expandHeight;
@@ -1672,7 +1776,7 @@ MGANAME(SubsequentColorExpandScanline)(
WAITFIFO(3);
OUTREG(MGAREG_AR0,((pMga->expandDWORDs<<5)*pMga->expandHeight)-1);
OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */
- OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) |
+ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) |
pMga->expandHeight);
pMga->expandY += pMga->expandHeight;
pMga->expandRows = pMga->expandHeight;
@@ -1689,7 +1793,7 @@ MGANAME(SubsequentColorExpandScanline)(
\*******************/
-static void MGANAME(SetupForScanlineImageWrite)(
+static void MGANAME(SetupForScanlineImageWrite)(
ScrnInfoPtr pScrn,
int rop,
unsigned int planemask,
@@ -1758,7 +1862,7 @@ static void MGANAME(SubsequentImageWriteScanline)(
void
MGANAME(SetupForDashedLine)(
- ScrnInfoPtr pScrn,
+ ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask,
int length,
@@ -1793,7 +1897,7 @@ MGANAME(SetupForDashedLine)(
case 4: NiceDashPattern |= NiceDashPattern << 4;
case 8: NiceDashPattern |= byte_reversed[NiceDashPattern] << 16;
NiceDashPattern |= NiceDashPattern << 8;
- pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO |
+ pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO |
MGADWG_SGNZERO | MGADWG_BMONOLEF;
pMga->AccelFlags |= NICE_DASH_PATTERN;
if(bg == -1) {
@@ -1805,10 +1909,10 @@ MGANAME(SetupForDashedLine)(
pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->Atype[rop];
} else {
#if PSZ == 24
- if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
- RGBEQUAL(fg) && RGBEQUAL(bg))
+ if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
+ RGBEQUAL(fg) && RGBEQUAL(bg))
#else
- if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
+ if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION)
#endif
pMga->NiceDashCMD |= pMga->Atype[rop];
else
@@ -1829,8 +1933,8 @@ MGANAME(SetupForDashedLine)(
void
MGANAME(SubsequentDashedTwoPointLine)(
- ScrnInfoPtr pScrn,
- int x1, int y1, int x2, int y2,
+ ScrnInfoPtr pScrn,
+ int x1, int y1, int x2, int y2,
int flags, int phase
){
MGAPtr pMga = MGAPTR(pScrn);
@@ -1840,20 +1944,20 @@ MGANAME(SubsequentDashedTwoPointLine)(
OUTREG(MGAREG_DWGCTL, pMga->NiceDashCMD);
if(x2 < x1) {
if(flags & OMIT_LAST) x2++;
- OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) |
- ((7 - phase - x1) & 0x07));
+ OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) |
+ ((7 - phase - x1) & 0x07));
OUTREG(MGAREG_FXBNDRY, ((x1 + 1) << 16) | (x2 & 0xffff));
} else {
if(!flags) x2++;
- OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) |
- ((phase - x1) & 0x07));
+ OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) |
+ ((phase - x1) & 0x07));
OUTREG(MGAREG_FXBNDRY, (x2 << 16) | (x1 & 0xffff));
- }
+ }
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y1 << 16) | 1);
} else {
- OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) |
- (pMga->StyleLen - phase));
- OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ?
+ OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) |
+ (pMga->StyleLen - phase));
+ OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ?
MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE));
OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF));
OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF));
@@ -1867,15 +1971,15 @@ MGANAME(SubsequentDashedTwoPointLine)(
| Planar Screen to Screen Color Expansion |
\******************************************/
-static void
+static void
MGANAME(SetupForPlanarScreenToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
- int fg, int bg,
+ int fg, int bg,
int rop,
unsigned int planemask
){
MGAPtr pMga = MGAPTR(pScrn);
- CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT |
+ CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT |
MGADWG_SGNZERO | MGADWG_BPLAN;
CHECK_DMA_QUIESCENT(pMga, pScrn);
@@ -1894,11 +1998,11 @@ MGANAME(SetupForPlanarScreenToScreenColorExpandFill)(
OUTREG(MGAREG_DWGCTL, mgaCMD);
}
-static void
+static void
MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
int x, int y, int w, int h,
- int srcx, int srcy,
+ int srcx, int srcy,
int skipleft
){
MGAPtr pMga = MGAPTR(pScrn);
@@ -1921,10 +2025,10 @@ MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)(
| Screen to Screen Color Expansion |
\***********************************/
-static void
+static void
MGANAME(SetupForScreenToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
- int fg, int bg,
+ int fg, int bg,
int rop,
unsigned int planemask
){
@@ -1944,10 +2048,10 @@ MGANAME(SetupForScreenToScreenColorExpandFill)(
WAITFIFO(4);
} else {
#if PSZ == 24
- if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
- RGBEQUAL(fg) && RGBEQUAL(bg))
+ if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) &&
+ RGBEQUAL(fg) && RGBEQUAL(bg))
#else
- if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION))
+ if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION))
#endif
mgaCMD |= pMga->Atype[rop];
else
@@ -1963,11 +2067,11 @@ MGANAME(SetupForScreenToScreenColorExpandFill)(
}
-static void
+static void
MGANAME(SubsequentScreenToScreenColorExpandFill)(
ScrnInfoPtr pScrn,
int x, int y, int w, int h,
- int srcx, int srcy,
+ int srcx, int srcy,
int skipleft
){
MGAPtr pMga = MGAPTR(pScrn);
@@ -2015,10 +2119,10 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)(
OUTREG(MGAREG_AR0, start + num);
OUTREG(MGAREG_FXBNDRY, ((x + num) << 16) | (x & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | 1);
-
+
OUTREG(MGAREG_AR3, next);
OUTREG(MGAREG_AR0, start + w );
- OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) |
+ OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) |
((x + num + 1) & 0xffff));
start += pitch;
h--; y++;
@@ -2033,7 +2137,7 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)(
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | num);
start += num * pitch;
- h -= num; y += num;
+ h -= num; y += num;
}
}
}
@@ -2067,7 +2171,7 @@ MGAFillSolidRectsDMA(
if(nBox & 1) {
OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff));
- OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
+ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
(pBox->y1 << 16) | (pBox->y2 - pBox->y1));
nBox--; pBox++;
}
@@ -2086,7 +2190,7 @@ MGAFillSolidRectsDMA(
pBox++;
base += 5; nBox -= 2;
}
- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
}
void
@@ -2096,7 +2200,7 @@ MGAFillSolidSpansDMA(
unsigned int planemask,
int n,
DDXPointPtr ppt,
- int *pwidth, int fSorted
+ int *pwidth, int fSorted
){
MGAPtr pMga = MGAPTR(pScrn);
XAAInfoRecPtr infoRec = pMga->AccelInfoRec;
@@ -2104,14 +2208,14 @@ MGAFillSolidSpansDMA(
CHECK_DMA_QUIESCENT(pMga, pScrn);
SET_SYNC_FLAG(infoRec);
-
+
if(infoRec->ClipBox) {
OUTREG(MGAREG_CXBNDRY,
- ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1);
- OUTREG(MGAREG_YTOP,
- (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg);
- OUTREG(MGAREG_YBOT,
- ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg);
+ ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1);
+ OUTREG(MGAREG_YTOP,
+ (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg);
+ OUTREG(MGAREG_YBOT,
+ ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg);
}
(*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask);
@@ -2137,13 +2241,13 @@ MGAFillSolidSpansDMA(
ppt++;
base += 5; n -= 2;
}
- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
}
if(infoRec->ClipBox) {
- OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
- OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
- OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
+ OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
+ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
+ OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */
}
}
@@ -2184,7 +2288,7 @@ SECOND_PASS:
while(nBox--) {
WAITFIFO(2);
OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff));
- OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
+ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
(pBox->y1 << 16) | (pBox->y2 - pBox->y1));
pBox++;
}
@@ -2211,17 +2315,17 @@ MGAValidatePolyArc(
MGAPtr pMga = MGAPTR(pScrn);
Bool fullPlanemask = TRUE;
- if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) !=
+ if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) !=
pMga->AccelInfoRec->FullPlanemask)
{
if(pMga->AccelFlags & MGA_NO_PLANEMASK) return;
- fullPlanemask = FALSE;
+ fullPlanemask = FALSE;
}
- if(!pGC->lineWidth &&
+ if(!pGC->lineWidth &&
(pGC->fillStyle == FillSolid) &&
(pGC->lineStyle == LineSolid) &&
- ((pGC->alu != GXcopy) || !fullPlanemask))
+ ((pGC->alu != GXcopy) || !fullPlanemask))
{
pGC->ops->PolyArc = MGAPolyArcThinSolid;
}
@@ -2231,7 +2335,7 @@ static void
MGAPolyPoint (
DrawablePtr pDraw,
GCPtr pGC,
- int mode,
+ int mode,
int npt,
xPoint *ppt
){
@@ -2242,7 +2346,7 @@ MGAPolyPoint (
int xorg, yorg;
if(!numRects) return;
-
+
if(numRects != 1) {
XAAFallbackOps.PolyPoint(pDraw, pGC, mode, npt, ppt);
return;
@@ -2268,7 +2372,7 @@ MGAPolyPoint (
OUTREG(MGAREG_FXBNDRY, ((xorg + 1) << 16) | (xorg & 0xffff));
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (yorg << 16) | 1);
ppt++;
- }
+ }
} else {
int x;
while(npt--) {
@@ -2279,9 +2383,9 @@ MGAPolyPoint (
ppt++;
}
}
-
+
(*infoRec->DisableClipping)(infoRec->pScrn);
-
+
SET_SYNC_FLAG(infoRec);
}
@@ -2298,11 +2402,11 @@ MGAValidatePolyPoint(
pGC->ops->PolyPoint = XAAFallbackOps.PolyPoint;
- if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) !=
+ if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) !=
pMga->AccelInfoRec->FullPlanemask)
{
if(pMga->AccelFlags & MGA_NO_PLANEMASK) return;
- fullPlanemask = FALSE;
+ fullPlanemask = FALSE;
}
if((pGC->alu != GXcopy) || !fullPlanemask)
@@ -2310,7 +2414,7 @@ MGAValidatePolyPoint(
}
-void
+void
MGAFillCacheBltRects(
ScrnInfoPtr pScrn,
int rop,
@@ -2339,11 +2443,11 @@ MGAFillCacheBltRects(
start = phaseY ? (pCache->orig_h - phaseY) : 0;
/* This is optimized for WRAM */
-
- if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) {
+
+ if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) {
w = width; skipleft = phaseX; x = pBox->x1;
blit_h = pCache->orig_h;
-
+
while(1) {
blit_w = pCache->w - skipleft;
if(blit_w > w) blit_w = w;
@@ -2364,7 +2468,7 @@ MGAFillCacheBltRects(
y += start;
}
start = blit_h;
-
+
while(height) {
if(blit_h > height) blit_h = height;
(*infoRec->SubsequentScreenToScreenCopy)(pScrn,
@@ -2379,7 +2483,7 @@ MGAFillCacheBltRects(
w = width; skipleft = phaseX; x = pBox->x1;
blit_h = pCache->h - phaseY;
if(blit_h > height) blit_h = height;
-
+
while(1) {
blit_w = pCache->w - skipleft;
if(blit_w > w) blit_w = w;
@@ -2399,7 +2503,7 @@ MGAFillCacheBltRects(
}
pBox++;
}
-
+
SET_SYNC_FLAG(infoRec);
}
@@ -2411,7 +2515,7 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMGA = MGAPTR(pScrn);
+ MGAPtr pMga = MGAPTR(pScrn);
BoxPtr pbox = REGION_RECTS(prgn);
int nbox = REGION_NUM_RECTS(prgn);
@@ -2429,7 +2533,7 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index)
}
MGASelectBuffer(pScrn, MGA_FRONT);
- pMGA->AccelInfoRec->NeedToSync = TRUE;
+ pMga->AccelInfoRec->NeedToSync = TRUE;
}
/*
@@ -2438,14 +2542,14 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index)
instead of destination. My origin is upside down so the ydir cases
are reversed.
*/
-
+
void
-MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
+MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMGA = MGAPTR(pScrn);
+ MGAPtr pMga = MGAPTR(pScrn);
int nbox;
BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
DDXPointPtr pptTmp, pptNew1, pptNew2;
@@ -2522,7 +2626,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
}
pboxBase = pboxNext = pbox;
while (pboxBase < pbox+nbox) {
- while ((pboxNext < pbox+nbox) &&
+ while ((pboxNext < pbox+nbox) &&
(pboxNext->y1 == pboxBase->y1))
pboxNext++;
pboxTmp = pboxNext;
@@ -2542,9 +2646,9 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
/* No changes are needed */
xdir = 1;
}
-
+
MGANAME(SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, -1, -1);
- for ( ; nbox-- ; pbox++)
+ for ( ; nbox-- ; pbox++)
{
int x1 = pbox->x1;
int y1 = pbox->y1;
@@ -2553,7 +2657,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
int w = pbox->x2 - x1 + 1;
int h = pbox->y2 - y1 + 1;
- if ( destx < 0 ) x1 -= destx, w += destx, destx = 0;
+ if ( destx < 0 ) x1 -= destx, w += destx, destx = 0;
if ( desty < 0 ) y1 -= desty, h += desty, desty = 0;
if ( destx + w > screenwidth ) w = screenwidth - destx;
if ( desty + h > screenheight ) h = screenheight - desty;
@@ -2561,10 +2665,10 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
if ( h <= 0 ) continue;
MGASelectBuffer(pScrn, MGA_BACK);
- MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1,
+ MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1,
destx,desty, w, h);
MGASelectBuffer(pScrn, MGA_DEPTH);
- MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1,
+ MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1,
destx,desty, w, h);
}
MGASelectBuffer(pScrn, MGA_FRONT);
@@ -2578,8 +2682,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
DEALLOCATE_LOCAL(pboxNew1);
}
- pMGA->AccelInfoRec->NeedToSync = TRUE;
+ pMga->AccelInfoRec->NeedToSync = TRUE;
}
-
-#endif /* XF86DRI */
+#endif /* XF86DRI */
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 391194b04..536c6b55d 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.22 2000/12/21 00:10:56 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.23 2001/04/05 17:42:33 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -164,10 +164,6 @@ static XF86ImageRec Images[NUM_IMAGES] =
XVIMAGE_UYVY
};
-#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
-#define outMGAdac(reg, val) \
- (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
-
static void
MGAResetVideoOverlay(ScrnInfoPtr pScrn)
{
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
index 4a5b7ef5f..29c5c8e4f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
@@ -1,38 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.2 2000/09/24 13:51:28 alanh 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.
-
-**************************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.3 2001/03/21 17:02:24 dawes Exp $ */
/*
- * Authors:
- * Keith Whitwell <keithw@precisioninsight.com>
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
-
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
@@ -56,46 +51,50 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mga_macros.h"
#include "mga_dri.h"
#include "mga_wrap.h"
+#include "mga_sarea.h"
+#define MGA_WRAP_DEBUG 0
-static void MGAWakeupHandler(int screenNum,
- pointer wakeupData,
- unsigned long result,
- pointer pReadmask)
+static void MGAWakeupHandler( int screenNum, pointer wakeupData,
+ unsigned long result, pointer pReadmask )
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/
-
- if (0) ErrorF("MGAWakeupHandler (in)\n");
-
- /* Disabled: Check contention like the 3d clients do before trying
- * to restore state.
- */
- DRILock(pScreen, 0);
- if (xf86IsEntityShared(pScrn->entityList[0]))
- MGASwapContext_shared(pScreen);
- else
- MGASwapContext(pScreen);
+
+ if ( xf86IsEntityShared( pScrn->entityList[0] ) ) {
+ MGASwapContextShared( pScreen );
+ } else {
+ MGASwapContext( pScreen );
+ }
}
-static void MGABlockHandler(int screenNum,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask)
+static void MGABlockHandler( int screenNum, pointer blockData,
+ pointer pTimeout, pointer pReadmask )
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
MGAPtr pMga = MGAPTR(pScrn);
- /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/
- MGASAREAPtr sa = (MGASAREAPtr)DRIGetSAREAPrivate( pScreen );
- if (0) ErrorF("MGABlockHandler (out)\n");
+ if ( pMga->haveQuiescense ) {
+ pMga->haveQuiescense = 0;
+
+ if ( pMga->directRenderingEnabled ) {
+ DRIUnlock( pScreen );
+ }
+ }
- /* Examine the cliprects for the most recently used 3d drawable.
+
+
+#if 0
+ MGASAREAPrivPtr sa = (MGASAREAPrivPtr)DRIGetSAREAPrivate( pScreen );
+
+ if ( MGA_WRAP_DEBUG )
+ ErrorF( "MGABlockHandler (out)\n" );
+
+ /* Examine the cliprects for the most recently used 3D drawable.
* If they've changed, attempt to push the updated values into the
* sarea.
*
@@ -106,46 +105,47 @@ static void MGABlockHandler(int screenNum,
*
* Thus the number of round trips in the cases where comparison is
* possible is reduced to no more (and usually fewer) than the number
- * Utah requires.
+ * Utah requires.
*/
- if (sa->req_drawable != sa->exported_drawable ||
- sa->exported_stamp != DRIGetDrawableStamp( pScreen, sa->exported_index ))
+ if ( sa->req_drawable != sa->exported_drawable ||
+ sa->exported_stamp != DRIGetDrawableStamp( pScreen,
+ sa->exported_index ) )
{
int i;
XF86DRIClipRectPtr frontboxes, backboxes;
XF86DRIClipRectPtr boxes = (XF86DRIClipRectPtr)sa->exported_boxes;
WindowPtr window = LookupIDByType( sa->req_drawable, RT_WINDOW );
- if (0)
- ErrorF("Trying to update req_drawable: %d (exp %d), stamp %d/%d\n",
- sa->req_drawable, sa->exported_drawable);
+ if ( MGA_WRAP_DEBUG )
+ ErrorF( "Trying to update req_drawable: %d (exp %d), stamp %d/%d\n",
+ sa->req_drawable, sa->exported_drawable );
sa->exported_drawable = 0;
- if (!window) {
- if (0)
- ErrorF("Couldn't retreive window\n");
+ if ( !window ) {
+ if ( MGA_WRAP_DEBUG )
+ ErrorF( "Couldn't retreive window\n" );
sa->req_drawable = 0;
goto finished;
}
- if (!DRIGetDrawableInfo( pScreen, &(window->drawable),
- &sa->exported_index,
- &sa->exported_stamp,
- &sa->exported_front_x,
- &sa->exported_front_y,
- &sa->exported_w,
- &sa->exported_h,
- &sa->exported_nfront,
- &frontboxes,
- &sa->exported_back_x,
- &sa->exported_back_y,
- &sa->exported_nback,
- &backboxes ))
+ if ( !DRIGetDrawableInfo( pScreen, &(window->drawable),
+ &sa->exported_index,
+ &sa->exported_stamp,
+ &sa->exported_front_x,
+ &sa->exported_front_y,
+ &sa->exported_w,
+ &sa->exported_h,
+ &sa->exported_nfront,
+ &frontboxes,
+ &sa->exported_back_x,
+ &sa->exported_back_y,
+ &sa->exported_nback,
+ &backboxes ) )
{
- if (0)
- ErrorF("Couldn't get DRI info\n");
+ if ( MGA_WRAP_DEBUG )
+ ErrorF( "Couldn't get DRI info\n" );
sa->req_drawable = 0;
goto finished;
}
@@ -153,57 +153,55 @@ static void MGABlockHandler(int screenNum,
/* If we can't fit both sets of cliprects into the sarea, try to
* fit the current draw buffer. Otherwise return.
*/
-
sa->exported_buffers = MGA_FRONT | MGA_BACK;
- if (sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) {
- if (sa->req_draw_buffer == MGA_FRONT) {
+ if ( sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS ) {
+ if ( sa->req_draw_buffer == MGA_FRONT ) {
sa->exported_buffers = MGA_FRONT;
- if (sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS)
+ if ( sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS )
goto finished;
} else {
sa->exported_buffers = MGA_BACK;
- if (sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS)
+ if ( sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS )
goto finished;
}
}
- if (sa->exported_buffers & MGA_BACK) {
- for (i = 0 ; i < sa->exported_nback ; i++)
- *boxes++ = backboxes[i];
+ if ( sa->exported_buffers & MGA_BACK ) {
+ for ( i = 0 ; i < sa->exported_nback ; i++ )
+ *boxes++ = backboxes[i];
}
- if (sa->exported_buffers & MGA_FRONT) {
- for (i = 0 ; i < sa->exported_nfront ; i++)
- *boxes++ = frontboxes[i];
+ if ( sa->exported_buffers & MGA_FRONT ) {
+ for ( i = 0 ; i < sa->exported_nfront ; i++ )
+ *boxes++ = frontboxes[i];
}
sa->exported_drawable = sa->req_drawable;
- }
+ }
finished:
- if (xf86IsEntityShared(pScrn->entityList[0])) {
+ if ( xf86IsEntityShared( pScrn->entityList[0] ) ) {
/* Restore to first screen */
- pMga->RestoreAccelState(pScrn);
- xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex);
+ pMga->RestoreAccelState( pScrn );
+ xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex );
}
- DRIUnlock(pScreen);
+ DRIUnlock( pScreen );
+#endif
}
-
-
/* Just wrap validate tree for now to remove the quiescense hack.
* This is more of a win for the i810 than the mga, but should be useful
* here too.
*/
-void MGADRIWrapFunctions(ScreenPtr pScreen, DRIInfoPtr pDRIInfo)
+void MGADRIWrapFunctions( ScreenPtr pScreen, DRIInfoPtr pDRIInfo )
{
- pDRIInfo->wrap.BlockHandler = MGABlockHandler;
- pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler;
-/* pDRIInfo->wrap.ValidateTree = NULL; */
-/* pDRIInfo->wrap.PostValidateTree = NULL; */
+ pDRIInfo->wrap.BlockHandler = MGABlockHandler;
+ pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler;
+#if 1
+ pDRIInfo->wrap.ValidateTree = NULL;
+ pDRIInfo->wrap.PostValidateTree = NULL;
+#endif
}
-
-
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c
index 745240bfd..c4b3fc455 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c
@@ -30,7 +30,7 @@
* Project.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.6 2000/12/14 20:59:12 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.8 2001/04/01 14:00:11 tsi Exp $ */
/* function prototypes, common data structures & generic includes */
#include "newport.h"
@@ -56,14 +56,6 @@
#include "xf86xv.h"
#include "Xv.h"
-/* Temporary workaround. A module really shouldn't need this */
-#ifndef XFree86LOADER
-# include "xf86_OSlib.h"
-# ifndef MAP_FAILED
-# define MAP_FAILED ((pointer)(-1))
-# endif
-#endif
-
#define VERSION 4000
#define NEWPORT_NAME "Newport"
#define NEWPORT_DRIVER_NAME "newport"
@@ -268,7 +260,7 @@ NewportProbe(DriverPtr drv, int flags)
pScrn->ScreenInit = NewportScreenInit;
pScrn->EnterVT = NewportEnterVT;
pScrn->LeaveVT = NewportLeaveVT;
- pScrn->driverPrivate = (void*)busID;
+ pScrn->driverPrivate = (void*)(long)busID;
foundScreen = TRUE;
break;
}
@@ -294,7 +286,7 @@ NewportPreInit(ScrnInfoPtr pScrn, int flags)
if (pScrn->numEntities != 1)
return FALSE;
- busID = (int)(pScrn->driverPrivate);
+ busID = (long)(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
/* Fill in the monitor field */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile
index 48e26e01b..2444ce45e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile
@@ -1,19 +1,16 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.15 2001/01/24 00:06:25 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.17 2001/04/01 20:51:25 tsi Exp $
XCOMM
XCOMM This is an Imakefile for the NVIDIA driver.
XCOMM
-
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.15 2001/01/24 00:06:25 dawes Exp $
-
#define IHaveModules
#include <Server.tmpl>
SRCS = nv_driver.c nv_dac.c nv_setup.c nv_cursor.c nv_xaa.c nv_dga.c \
- nv_shadow.c riva_hw.c
+ nv_shadow.c riva_hw.c nv_video.c
OBJS = nv_driver.o nv_dac.o nv_setup.o nv_cursor.o nv_xaa.o nv_dga.o \
- nv_shadow.o riva_hw.o
+ nv_shadow.o riva_hw.o nv_video.o
#if defined(XF86DriverSDK)
@@ -57,6 +54,7 @@ InstallDriverSDKNonExecFile(nv_include.h,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_local.h,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_proto.h,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_setup.c,$(DRIVERSDKDIR)/drivers/nv)
+InstallDriverSDKNonExecFile(nv_video.c,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_shadow.c,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_type.h,$(DRIVERSDKDIR)/drivers/nv)
InstallDriverSDKNonExecFile(nv_xaa.c,$(DRIVERSDKDIR)/drivers/nv)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
index 75ae60d4f..4744100ec 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
@@ -24,7 +24,7 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.59 2001/02/18 23:47:29 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.63 2001/03/28 01:17:43 mvojkovi Exp $ */
#include "nv_include.h"
@@ -107,10 +107,10 @@ static SymTabRec NVChipsets[] = {
{ NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX DDR"},
{ NV_CHIP_QUADRO2MXR, "Quadro 2 MXR"},
{ NV_CHIP_GEFORCE2GO, "GeForce 2 Go"},
- { NV_CHIP_0200, "NV Chip 0x0200"},
- { NV_CHIP_0201, "NV Chip 0x0201"},
- { NV_CHIP_0202, "NV Chip 0x0202"},
- { NV_CHIP_0203, "NV Chip 0x0203"},
+ { NV_CHIP_GEFORCE3, "GeForce3"},
+ { NV_CHIP_GEFORCE3_1, "GeForce3 (rev 1)"},
+ { NV_CHIP_GEFORCE3_2, "GeForce3 (rev 2)"},
+ { NV_CHIP_GEFORCE3_3, "GeForce3 (rev 3)"},
{-1, NULL }
};
@@ -135,10 +135,10 @@ static PciChipsets NVPciChipsets[] = {
{ NV_CHIP_GEFORCE2MXDDR, NV_CHIP_GEFORCE2MXDDR, RES_SHARED_VGA },
{ NV_CHIP_QUADRO2MXR, NV_CHIP_QUADRO2MXR, RES_SHARED_VGA },
{ NV_CHIP_GEFORCE2GO, NV_CHIP_GEFORCE2GO, RES_SHARED_VGA },
- { NV_CHIP_0200, NV_CHIP_0200, RES_SHARED_VGA },
- { NV_CHIP_0201, NV_CHIP_0201, RES_SHARED_VGA },
- { NV_CHIP_0202, NV_CHIP_0202, RES_SHARED_VGA },
- { NV_CHIP_0203, NV_CHIP_0203, RES_SHARED_VGA },
+ { NV_CHIP_GEFORCE3, NV_CHIP_GEFORCE3, RES_SHARED_VGA },
+ { NV_CHIP_GEFORCE3_1, NV_CHIP_GEFORCE3_1, RES_SHARED_VGA },
+ { NV_CHIP_GEFORCE3_2, NV_CHIP_GEFORCE3_2, RES_SHARED_VGA },
+ { NV_CHIP_GEFORCE3_3, NV_CHIP_GEFORCE3_3, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED }
};
@@ -293,7 +293,8 @@ typedef enum {
OPTION_SHOWCACHE,
OPTION_SHADOW_FB,
OPTION_FBDEV,
- OPTION_ROTATE
+ OPTION_ROTATE,
+ OPTION_VIDEO_KEY
} NVOpts;
@@ -305,6 +306,7 @@ static OptionInfoRec NVOptions[] = {
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -601,6 +603,30 @@ NVLeaveVT(int scrnIndex, int flags)
vgaHWLock(hwp);
}
+
+
+static void
+NVBlockHandler (
+ int i,
+ pointer blockData,
+ pointer pTimeout,
+ pointer pReadmask
+)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ ScrnInfoPtr pScrnInfo = xf86Screens[i];
+ NVPtr pNv = NVPTR(pScrnInfo);
+
+ pScreen->BlockHandler = pNv->BlockHandler;
+ (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+ pScreen->BlockHandler = NVBlockHandler;
+
+ if (pNv->VideoTimerCallback)
+ (*pNv->VideoTimerCallback)(pScrnInfo, currentTime.milliseconds);
+
+}
+
+
/*
* This is called at the end of each server generation. It restores the
* original (text) mode. It should also unmap the video memory, and free
@@ -636,9 +662,12 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pNv->DGAModes);
if ( pNv->expandBuffer )
xfree(pNv->expandBuffer);
+ if (pNv->overlayAdaptor)
+ xfree(pNv->overlayAdaptor);
pScrn->vtSema = FALSE;
pScreen->CloseScreen = pNv->CloseScreen;
+ pScreen->BlockHandler = pNv->BlockHandler;
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
@@ -1085,6 +1114,15 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
"Valid options are \"CW\" or \"CCW\"\n");
}
}
+ if(xf86GetOptValInteger(NVOptions, OPTION_VIDEO_KEY, &(pNv->videoKey))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
+ pNv->videoKey);
+ } else {
+ pNv->videoKey = (1 << pScrn->offset.red) |
+ (1 << pScrn->offset.green) |
+ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
+ }
+
if (pNv->pEnt->device->MemBase != 0) {
/* Require that the config file value matches one of the PCI values. */
@@ -1153,6 +1191,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
case NV_CHIP_TNT:
case NV_CHIP_TNT2:
+ case NV_CHIP_TNT2_A:
+ case NV_CHIP_TNT2_B:
case NV_CHIP_UTNT2:
case NV_CHIP_VTNT2:
case NV_CHIP_UVTNT2:
@@ -1172,6 +1212,12 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
case NV_CHIP_QUADRO2MXR:
case NV_CHIP_GEFORCE2GO:
NV10Setup(pScrn);
+ break;
+ case NV_CHIP_GEFORCE3:
+ case NV_CHIP_GEFORCE3_1:
+ case NV_CHIP_GEFORCE3_2:
+ case NV_CHIP_GEFORCE3_3:
+ NV20Setup(pScrn);
break;
}
@@ -1256,6 +1302,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
break;
case NV_ARCH_04:
case NV_ARCH_10:
+ case NV_ARCH_20:
pNv->FbUsableSize -= 128 * 1024;
break;
}
@@ -1521,6 +1568,8 @@ NVModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if ( pNv->Restore )
(*pNv->Restore)(pScrn, vgaReg, nvReg, FALSE);
+ NVResetGraphics(pScrn);
+
vgaHWProtect(pScrn, FALSE);
pNv->CurrentLayout.mode = mode;
@@ -1802,18 +1851,7 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->memPhysBase = pNv->FbAddress;
pScrn->fbOffset = 0;
-#ifdef XvExtension
- {
- XF86VideoAdaptorPtr *ptr;
- int n;
-
- n = xf86XVListGenericAdaptors(pScrn,&ptr);
- if (n) {
- xf86XVScreenInit(pScreen, ptr, n);
- }
- }
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Xv set up\n"));
-#endif
+ NVInitVideo(pScreen);
pScreen->SaveScreen = NVSaveScreen;
@@ -1821,6 +1859,9 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pNv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = NVCloseScreen;
+ pNv->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = NVBlockHandler;
+
/* Report any unused options (only for the first generation) */
if (serverGeneration == 1) {
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h
index 5b5b010e3..ddd5e46c5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.9 2000/10/06 12:31:03 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.10 2001/03/28 01:17:43 mvojkovi Exp $ */
#ifndef __NV_INCLUDE_H__
#define __NV_INCLUDE_H__
@@ -31,6 +31,10 @@
#include "xf86RAC.h"
#include "nv_const.h"
+
+#include "dixstruct.h"
+#include "scrnintstr.h"
+
#ifndef NV_USE_FB
/*
* If using cfb, cfb.h is required. Select the others for the bpp values
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h
index 47fd9e68f..3c9c484a5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.3 1999/11/12 02:12:40 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.6 2001/03/28 01:17:43 mvojkovi Exp $ */
#ifndef __NV_PROTO_H__
#define __NV_PROTO_H__
@@ -17,12 +17,16 @@ void NVDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg,
void NVDACLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
LOCO *colors, VisualPtr pVisual );
+/* in nv_video.c */
+void NVInitVideo(ScreenPtr);
+
/* in nv_setup.c */
void RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter);
void NV1Setup(ScrnInfoPtr pScrn);
void NV3Setup(ScrnInfoPtr pScrn);
void NV4Setup(ScrnInfoPtr pScrn);
void NV10Setup(ScrnInfoPtr pScrn);
+void NV20Setup(ScrnInfoPtr pScrn);
/* in nv_cursor.c */
Bool NVCursorInit(ScreenPtr pScreen);
@@ -30,6 +34,7 @@ Bool NVCursorInit(ScreenPtr pScreen);
/* in nv_xaa.c */
Bool NVAccelInit(ScreenPtr pScreen);
void NVSync(ScrnInfoPtr pScrn);
+void NVResetGraphics(ScrnInfoPtr pScrn);
/* in nv_dga.c */
Bool NVDGAInit(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c
index bb0df1af5..d0550f26d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c
@@ -24,7 +24,7 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.7 2000/11/03 18:46:12 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.9 2001/03/28 01:17:43 mvojkovi Exp $ */
#include "nv_include.h"
@@ -235,7 +235,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
regBase+0x00009000, 0x00001000);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PTIMER %x\n", pNv->riva.PTIMER));
pNv->riva.PMC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag,
- regBase+0x00000000, 0x00001000);
+ regBase+0x00000000, 0x00009000);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PMC %x\n", pNv->riva.PMC));
pNv->riva.FIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag,
regBase+0x00800000, 0x00010000);
@@ -334,3 +334,26 @@ NV10Setup(ScrnInfoPtr pScrn)
NVCommonSetup(pScrn);
}
+void
+NV20Setup(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ CARD32 regBase = pNv->IOAddress;
+ int mmioFlags;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV10Setup\n"));
+
+ pNv->riva.Architecture = 0x20;
+ /*
+ * Map chip-specific memory-mapped registers. This MUST be done in the OS sp
+ecific driver code.
+ */
+ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
+ pNv->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag,
+ regBase+0x00710000, 0x00010000);
+ pNv->riva.PCRTC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag,
+ regBase+0x00600000, 0x00001000);
+
+ NVCommonSetup(pScrn);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h
index b7246ddb7..4fc8107a2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.20 2001/02/17 23:20:17 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.22 2001/03/28 01:17:43 mvojkovi Exp $ */
#ifndef __NV_STRUCT_H__
#define __NV_STRUCT_H__
@@ -85,6 +85,7 @@ typedef struct {
void (*Restore)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool);
Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr);
void (*PointerMoved)(int index, int x, int y);
+ ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool FBDev;
/* Color expansion */
@@ -113,6 +114,9 @@ typedef struct {
Bool (*i2cInit)(ScrnInfoPtr);
I2CBusPtr I2C;
xf86Int10InfoPtr pInt;
+ void (*VideoTimerCallback)(ScrnInfoPtr, Time);
+ XF86VideoAdaptorPtr overlayAdaptor;
+ int videoKey;
} NVRec, *NVPtr;
#define NVPTR(p) ((NVPtr)((p)->driverPrivate))
@@ -143,9 +147,9 @@ void NVPointerMoved(int index, int x, int y);
#define NV_CHIP_GEFORCE2GTS_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS_1)
#define NV_CHIP_GEFORCE2ULTRA ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2ULTRA)
#define NV_CHIP_QUADRO2PRO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2PRO)
-#define NV_CHIP_0200 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0200)
-#define NV_CHIP_0201 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0201)
-#define NV_CHIP_0202 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0202)
-#define NV_CHIP_0203 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0203)
+#define NV_CHIP_GEFORCE3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3)
+#define NV_CHIP_GEFORCE3_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_1)
+#define NV_CHIP_GEFORCE3_2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_2)
+#define NV_CHIP_GEFORCE3_3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_3)
#endif /* __NV_STRUCT_H__ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c
new file mode 100644
index 000000000..e7c6452cc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c
@@ -0,0 +1,1221 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "xf86fbman.h"
+#include "regionstr.h"
+
+#include "xf86xv.h"
+#include "Xv.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "dixstruct.h"
+#include "fourcc.h"
+
+#include "nv_include.h"
+#include "nvreg.h"
+#include "nvvga.h"
+
+
+
+#define OFF_DELAY 450 /* milliseconds */
+#define FREE_DELAY 10000
+
+#define OFF_TIMER 0x01
+#define FREE_TIMER 0x02
+#define CLIENT_VIDEO_ON 0x04
+
+#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
+
+
+
+#ifndef XvExtension
+void NVInitVideo(ScreenPtr pScreen) {}
+#else
+
+typedef struct _NVPortPrivRec {
+ short brightness;
+ short contrast;
+ short saturation;
+ short hue;
+ RegionRec clip;
+ CARD32 colorKey;
+ Bool autopaintColorKey;
+ Bool doubleBuffer;
+ CARD32 videoStatus;
+ int currentBuffer;
+ Time videoTime;
+ Bool grabbedByV4L;
+ FBLinearPtr linear;
+ int pitch;
+ int offset;
+} NVPortPrivRec, *NVPortPrivPtr;
+
+
+static XF86VideoAdaptorPtr NVSetupImageVideo(ScreenPtr);
+
+static void NVResetVideo(ScrnInfoPtr);
+
+static void NVStopOverlay (ScrnInfoPtr);
+static void NVPutOverlayImage(ScrnInfoPtr pScrnInfo,
+ int offset,
+ int id,
+ int dstPitch,
+ BoxPtr dstBox,
+ int x1, int y1, int x2, int y2,
+ short width, short height,
+ short src_w, short src_h,
+ short dst_w, short dst_h,
+ RegionPtr cliplist);
+
+static int NVSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
+static int NVGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer);
+
+static void NVStopOverlayVideo(ScrnInfoPtr, pointer, Bool);
+
+static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer);
+static void NVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer);
+static int NVQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *);
+
+static void NVVideoTimerCallback(ScrnInfoPtr, Time);
+
+static void NVInitOffscreenImages (ScreenPtr pScreen);
+
+
+#define GET_OVERLAY_PRIVATE(pNv) \
+ (NVPortPrivPtr)((pNv)->overlayAdaptor->pPortPrivates[0].ptr)
+
+#define GET_BLIT_PRIVATE(pNv) \
+ (NVPortPrivPtr)((pNv)->blitAdaptor->pPortPrivates[0].ptr)
+
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation,
+ xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer;
+
+/* client libraries expect an encoding */
+static XF86VideoEncodingRec DummyEncoding =
+{
+ 0,
+ "XV_IMAGE",
+ 2046, 2047,
+ {1, 1}
+};
+
+#define NUM_FORMATS_ALL 6
+
+XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] =
+{
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor},
+ {15, DirectColor}, {16, DirectColor}, {24, DirectColor}
+};
+
+#define NUM_ATTRIBUTES 8
+
+XF86AttributeRec NVAttributes[NUM_ATTRIBUTES] =
+{
+ {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"},
+ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
+ {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"},
+ {XvSettable , 0, 0, "XV_SET_DEFAULTS"},
+ {XvSettable | XvGettable, -512, 511, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, 0, 8191, "XV_CONTRAST"},
+ {XvSettable | XvGettable, 0, 8191, "XV_SATURATION"},
+ {XvSettable | XvGettable, 0, 360, "XV_HUE"}
+};
+
+#define NUM_IMAGES_ALL 4
+
+static XF86ImageRec NVImages[NUM_IMAGES_ALL] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_UYVY,
+ XVIMAGE_I420
+};
+
+static void
+NVSetPortDefaults (ScrnInfoPtr pScrnInfo, NVPortPrivPtr pPriv)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+
+ pPriv->brightness = 0;
+ pPriv->contrast = 4096;
+ pPriv->saturation = 4096;
+ pPriv->hue = 0;
+ pPriv->colorKey = pNv->videoKey;
+ pPriv->autopaintColorKey = TRUE;
+ pPriv->doubleBuffer = TRUE;
+}
+
+
+static void
+NVResetVideo (ScrnInfoPtr pScrnInfo)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+ RIVA_HW_INST *pRiva = &(pNv->riva);
+ int satSine, satCosine;
+ double angle;
+
+ angle = (double)pPriv->hue * 3.1415927 / 180.0;
+
+ satSine = pPriv->saturation * sin(angle);
+ if (satSine < -1024)
+ satSine = -1024;
+ satCosine = pPriv->saturation * cos(angle);
+ if (satCosine < -1024)
+ satCosine = -1024;
+
+ pRiva->PMC[0x00008910/4] = (pPriv->brightness << 16) | pPriv->contrast;
+ pRiva->PMC[0x00008914/4] = (pPriv->brightness << 16) | pPriv->contrast;
+ pRiva->PMC[0x00008918/4] = (satSine << 16) | (satCosine & 0xffff);
+ pRiva->PMC[0x0000891C/4] = (satSine << 16) | (satCosine & 0xffff);
+ pRiva->PMC[0x00008b00/4] = pPriv->colorKey;
+}
+
+
+
+static void
+NVStopOverlay (ScrnInfoPtr pScrnInfo)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ RIVA_HW_INST *pRiva = &(pNv->riva);
+
+ pRiva->PMC[0x00008704/4] = 1;
+}
+
+static FBLinearPtr
+NVAllocateOverlayMemory(
+ ScrnInfoPtr pScrn,
+ FBLinearPtr linear,
+ int size
+){
+ ScreenPtr pScreen;
+ FBLinearPtr new_linear;
+
+ if(linear) {
+ if(linear->size >= size)
+ return linear;
+
+ if(xf86ResizeOffscreenLinear(linear, size))
+ return linear;
+
+ xf86FreeOffscreenLinear(linear);
+ }
+
+ pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32,
+ NULL, NULL, NULL);
+
+ if(!new_linear) {
+ int max_size;
+
+ xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32,
+ PRIORITY_EXTREME);
+
+ if(max_size < size)
+ return NULL;
+
+ xf86PurgeUnlockedOffscreenAreas(pScreen);
+ new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32,
+ NULL, NULL, NULL);
+ }
+
+ return new_linear;
+}
+
+static void NVFreeOverlayMemory(ScrnInfoPtr pScrnInfo)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+
+ if(pPriv->linear) {
+ xf86FreeOffscreenLinear(pPriv->linear);
+ pPriv->linear = NULL;
+ }
+}
+
+
+void NVInitVideo (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
+ XF86VideoAdaptorPtr overlayAdaptor = NULL;
+ NVPtr pNv = NVPTR(pScrn);
+ int num_adaptors;
+
+ if (pNv->AccelInfoRec && pNv->AccelInfoRec->FillSolidRects &&
+ (pScrn->bitsPerPixel != 8) && (pNv->riva.Architecture >= NV_ARCH_10))
+ {
+
+ overlayAdaptor = NVSetupImageVideo(pScreen);
+
+ if(overlayAdaptor)
+ NVInitOffscreenImages(pScreen);
+ }
+
+ num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
+
+ if(overlayAdaptor) {
+ int size = num_adaptors + 1;
+
+ if((newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*)))) {
+ if(num_adaptors)
+ memcpy(newAdaptors, adaptors,
+ num_adaptors * sizeof(XF86VideoAdaptorPtr));
+
+ if(overlayAdaptor) {
+ newAdaptors[num_adaptors] = overlayAdaptor;
+ num_adaptors++;
+ }
+ adaptors = newAdaptors;
+ }
+ }
+
+ if (num_adaptors)
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if (newAdaptors)
+ xfree(newAdaptors);
+}
+
+
+static XF86VideoAdaptorPtr
+NVSetupImageVideo (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrnInfo);
+ XF86VideoAdaptorPtr adapt;
+ NVPortPrivPtr pPriv;
+
+ if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(NVPortPrivRec) +
+ sizeof(DevUnion))))
+ {
+ return NULL;
+ }
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = VIDEO_OVERLAID_IMAGES|VIDEO_CLIP_TO_VIEWPORT;
+ adapt->name = "NV Video Overlay";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = &DummyEncoding;
+ adapt->nFormats = NUM_FORMATS_ALL;
+ adapt->pFormats = NVFormats;
+ adapt->nPorts = 1;
+ adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
+ pPriv = (NVPortPrivPtr)(&adapt->pPortPrivates[1]);
+ adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
+ adapt->pAttributes = NVAttributes;
+ adapt->nAttributes = NUM_ATTRIBUTES;
+ adapt->pImages = NVImages;
+ adapt->nImages = NUM_IMAGES_ALL;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = NVStopOverlayVideo;
+ adapt->SetPortAttribute = NVSetPortAttribute;
+ adapt->GetPortAttribute = NVGetPortAttribute;
+ adapt->QueryBestSize = NVQueryBestSize;
+ adapt->PutImage = NVPutImage;
+ adapt->QueryImageAttributes = NVQueryImageAttributes;
+
+ pPriv->videoStatus = 0;
+ pPriv->currentBuffer = 0;
+ pPriv->grabbedByV4L = FALSE;
+
+ NVSetPortDefaults (pScrnInfo, pPriv);
+
+ /* gotta uninit this someplace */
+ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
+
+ pNv->overlayAdaptor = adapt;
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+ xvSaturation = MAKE_ATOM("XV_SATURATION");
+ xvHue = MAKE_ATOM("XV_HUE");
+ xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY");
+ xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS");
+
+ NVResetVideo(pScrnInfo);
+
+ return adapt;
+}
+
+/*
+ * RegionsEqual
+ */
+static Bool RegionsEqual
+(
+ RegionPtr A,
+ RegionPtr B
+)
+{
+ int *dataA, *dataB;
+ int num;
+
+ num = REGION_NUM_RECTS(A);
+ if (num != REGION_NUM_RECTS(B))
+ return FALSE;
+
+ if ((A->extents.x1 != B->extents.x1) ||
+ (A->extents.x2 != B->extents.x2) ||
+ (A->extents.y1 != B->extents.y1) ||
+ (A->extents.y2 != B->extents.y2))
+ return FALSE;
+
+ dataA = (int*)REGION_RECTS(A);
+ dataB = (int*)REGION_RECTS(B);
+
+ while(num--)
+ {
+ if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
+ return FALSE;
+ dataA += 2;
+ dataB += 2;
+ }
+ return TRUE;
+}
+/* NVClipVideo -
+
+ Takes the dst box in standard X BoxRec form (top and left
+ edges inclusive, bottom and right exclusive). The new dst
+ box is returned. The source boundaries are given (x1, y1
+ inclusive, x2, y2 exclusive) and returned are the new source
+ boundaries in 16.16 fixed point.
+*/
+
+#define DummyScreen screenInfo.screens[0]
+
+static Bool
+NVClipVideo(
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height
+){
+ INT32 vscale, hscale, delta;
+ BoxPtr extents = REGION_EXTENTS(DummyScreen, reg);
+ int diff;
+
+ hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1);
+ vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1);
+
+ *xa <<= 16; *xb <<= 16;
+ *ya <<= 16; *yb <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if(diff > 0) {
+ dst->x1 = extents->x1;
+ *xa += diff * hscale;
+ }
+ diff = dst->x2 - extents->x2;
+ if(diff > 0) {
+ dst->x2 = extents->x2;
+ *xb -= diff * hscale;
+ }
+ diff = extents->y1 - dst->y1;
+ if(diff > 0) {
+ dst->y1 = extents->y1;
+ *ya += diff * vscale;
+ }
+ diff = dst->y2 - extents->y2;
+ if(diff > 0) {
+ dst->y2 = extents->y2;
+ *yb -= diff * vscale;
+ }
+
+ if(*xa < 0) {
+ diff = (- *xa + hscale - 1)/ hscale;
+ dst->x1 += diff;
+ *xa += diff * hscale;
+ }
+ delta = *xb - (width << 16);
+ if(delta > 0) {
+ diff = (delta + hscale - 1)/ hscale;
+ dst->x2 -= diff;
+ *xb -= diff * hscale;
+ }
+ if(*xa >= *xb) return FALSE;
+
+ if(*ya < 0) {
+ diff = (- *ya + vscale - 1)/ vscale;
+ dst->y1 += diff;
+ *ya += diff * vscale;
+ }
+ delta = *yb - (height << 16);
+ if(delta > 0) {
+ diff = (delta + vscale - 1)/ vscale;
+ dst->y2 -= diff;
+ *yb -= diff * vscale;
+ }
+ if(*ya >= *yb) return FALSE;
+
+ if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) ||
+ (dst->y1 != extents->y1) || (dst->y2 != extents->y2))
+ {
+ RegionRec clipReg;
+ REGION_INIT(DummyScreen, &clipReg, dst, 1);
+ REGION_INTERSECT(DummyScreen, reg, reg, &clipReg);
+ REGION_UNINIT(DummyScreen, &clipReg);
+ }
+ return TRUE;
+}
+
+static void
+NVPutOverlayImage (
+ ScrnInfoPtr pScrnInfo,
+ int offset,
+ int id,
+ int dstPitch,
+ BoxPtr dstBox,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ short width,
+ short height,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h,
+ RegionPtr clipBoxes
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+ RIVA_HW_INST *pRiva = &(pNv->riva);
+ int buffer = pPriv->currentBuffer;
+
+ /* paint the color key */
+ if(pPriv->autopaintColorKey &&
+ (pPriv->grabbedByV4L || !RegionsEqual(&pPriv->clip, clipBoxes)))
+ {
+ /* we always paint V4L's color key */
+ if(!pPriv->grabbedByV4L)
+ REGION_COPY(pScrnInfo->pScreen, &pPriv->clip, clipBoxes);
+ (*pNv->AccelInfoRec->FillSolidRects)(pScrnInfo, pPriv->colorKey,
+ GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes),
+ REGION_RECTS(clipBoxes));
+ }
+
+ pRiva->PMC[(0x8900/4) + buffer] = offset;
+ pRiva->PMC[(0x8928/4) + buffer] = (height << 16) | width;
+ pRiva->PMC[(0x8930/4) + buffer] = ((y1 << 4) & 0xffff0000) | (x1 >> 12);
+ pRiva->PMC[(0x8938/4) + buffer] = (src_w << 20) / drw_w;
+ pRiva->PMC[(0x8940/4) + buffer] = (src_h << 20) / drw_h;
+ pRiva->PMC[(0x8948/4) + buffer] = (dstBox->y1 << 16) | dstBox->x1;
+ pRiva->PMC[(0x8950/4) + buffer] = ((dstBox->y2 - dstBox->y1) << 16) |
+ (dstBox->x2 - dstBox->x1);
+
+ dstPitch |= 1 << 20; /* use color key */
+
+ if(id != FOURCC_UYVY)
+ dstPitch |= 1 << 16;
+
+ pRiva->PMC[(0x8958/4) + buffer] = dstPitch;
+ pRiva->PMC[0x00008704/4] = 0;
+ pRiva->PMC[0x8700/4] = 1 << (buffer << 2);
+
+ pPriv->videoStatus = CLIENT_VIDEO_ON;
+}
+
+
+
+/*
+ * StopVideo
+ */
+static void NVStopOverlayVideo
+(
+ ScrnInfoPtr pScrnInfo,
+ pointer data,
+ Bool Exit
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
+
+ if(pPriv->grabbedByV4L) return;
+
+ REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);
+
+ if(Exit)
+ {
+ if(pPriv->videoStatus & CLIENT_VIDEO_ON)
+ NVStopOverlay(pScrnInfo);
+ NVFreeOverlayMemory(pScrnInfo);
+ pPriv->videoStatus = 0;
+ pNv->VideoTimerCallback = NULL;
+ }
+ else
+ {
+ if(pPriv->videoStatus & CLIENT_VIDEO_ON)
+ {
+ pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
+ pPriv->videoTime = currentTime.milliseconds + OFF_DELAY;
+ pNv->VideoTimerCallback = NVVideoTimerCallback;
+ }
+ }
+}
+
+
+
+static int NVSetPortAttribute
+(
+ ScrnInfoPtr pScrnInfo,
+ Atom attribute,
+ INT32 value,
+ pointer data
+)
+{
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
+
+ if (attribute == xvBrightness)
+ {
+ if ((value < -512) || (value > 512))
+ return BadValue;
+ pPriv->brightness = value;
+ }
+ else if (attribute == xvDoubleBuffer)
+ {
+ if ((value < 0) || (value > 1))
+ return BadValue;
+ pPriv->doubleBuffer = value;
+ }
+ else if (attribute == xvContrast)
+ {
+ if ((value < 0) || (value > 8191))
+ return BadValue;
+ pPriv->contrast = value;
+ }
+ else if (attribute == xvHue)
+ {
+ value %= 360;
+ if (value < 0)
+ value += 360;
+ pPriv->hue = value;
+ }
+ else if (attribute == xvSaturation)
+ {
+ if ((value < 0) || (value > 8191))
+ return BadValue;
+ pPriv->saturation = value;
+ }
+ else if (attribute == xvColorKey)
+ {
+ pPriv->colorKey = value;
+ REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);
+ }
+ else if (attribute == xvAutopaintColorKey)
+ {
+ if ((value < 0) || (value > 1))
+ return BadValue;
+ pPriv->autopaintColorKey = value;
+ }
+ else if (attribute == xvSetDefaults)
+ {
+ NVSetPortDefaults(pScrnInfo, pPriv);
+ }
+ else
+ return BadMatch;
+
+ NVResetVideo(pScrnInfo);
+ return Success;
+}
+
+
+
+
+static int NVGetPortAttribute
+(
+ ScrnInfoPtr pScrnInfo,
+ Atom attribute,
+ INT32 *value,
+ pointer data
+)
+{
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
+
+ if (attribute == xvBrightness)
+ *value = pPriv->brightness;
+ else if (attribute == xvDoubleBuffer)
+ *value = (pPriv->doubleBuffer) ? 1 : 0;
+ else if (attribute == xvContrast)
+ *value = pPriv->contrast;
+ else if (attribute == xvSaturation)
+ *value = pPriv->saturation;
+ else if (attribute == xvHue)
+ *value = pPriv->hue;
+ else if (attribute == xvColorKey)
+ *value = pPriv->colorKey;
+ else if (attribute == xvAutopaintColorKey)
+ *value = (pPriv->autopaintColorKey) ? 1 : 0;
+ else
+ return BadMatch;
+
+ return Success;
+}
+
+
+/*
+ * QueryBestSize
+ */
+static void NVQueryBestSize
+(
+ ScrnInfoPtr pScrnInfo,
+ Bool motion,
+ short vid_w,
+ short vid_h,
+ short drw_w,
+ short drw_h,
+ unsigned int *p_w,
+ unsigned int *p_h,
+ pointer data
+)
+{
+ if(vid_w > (drw_w << 3))
+ drw_w = vid_w >> 3;
+ if(vid_h > (drw_h << 3))
+ drw_h = vid_h >> 3;
+
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+/*
+ * CopyData
+ */
+static void NVCopyData422
+(
+ unsigned char *src,
+ unsigned char *dst,
+ int srcPitch,
+ int dstPitch,
+ int h,
+ int w
+)
+{
+ w <<= 1;
+ while(h--)
+ {
+ memcpy(dst, src, w);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+/*
+ * CopyMungedData
+ */
+static void NVCopyData420
+(
+ unsigned char *src1,
+ unsigned char *src2,
+ unsigned char *src3,
+ unsigned char *dst1,
+ int srcPitch,
+ int srcPitch2,
+ int dstPitch,
+ int h,
+ int w
+)
+{
+ CARD32 *dst;
+ CARD8 *s1, *s2, *s3;
+ int i, j;
+
+ w >>= 1;
+
+ for(j = 0; j < h; j++) {
+ dst = (CARD32*)dst1;
+ s1 = src1; s2 = src2; s3 = src3;
+ i = w;
+ while(i > 4) {
+ dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24);
+ dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24);
+ dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24);
+ dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24);
+ dst += 4; s2 += 4; s3 += 4; s1 += 8;
+ i -= 4;
+ }
+
+ while(i--) {
+ dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24);
+ dst++; s2++; s3++;
+ s1 += 2;
+ }
+
+ dst1 += dstPitch;
+ src1 += srcPitch;
+ if(j & 1) {
+ src2 += srcPitch2;
+ src3 += srcPitch2;
+ }
+ }
+}
+/*
+ * PutImage
+ */
+static int NVPutImage
+(
+ ScrnInfoPtr pScrnInfo,
+ short src_x,
+ short src_y,
+ short drw_x,
+ short drw_y,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool Sync,
+ RegionPtr clipBoxes,
+ pointer data
+)
+{
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
+ NVPtr pNv = NVPTR(pScrnInfo);
+ INT32 xa, xb, ya, yb;
+ unsigned char *dst_start;
+ int pitch, newSize, offset, s2offset, s3offset;
+ int srcPitch, srcPitch2, dstPitch;
+ int top, left, npixels, nlines, bpp;
+ BoxRec dstBox;
+ CARD32 tmp;
+
+ /*
+ * s2offset, s3offset - byte offsets into U and V plane of the
+ * source where copying starts. Y plane is
+ * done by editing "buf".
+ *
+ * offset - byte offset to the first line of the destination.
+ *
+ * dst_start - byte address to the first displayed pel.
+ *
+ */
+
+ if(pPriv->grabbedByV4L) return Success;
+
+ /* make the compiler happy */
+ s2offset = s3offset = srcPitch2 = 0;
+
+ if(src_w > (drw_w << 3))
+ drw_w = src_w >> 3;
+ if(src_h > (drw_h << 3))
+ drw_h = src_h >> 3;
+
+ /* Clip */
+ xa = src_x;
+ xb = src_x + src_w;
+ ya = src_y;
+ yb = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height))
+ return Success;
+
+ dstBox.x1 -= pScrnInfo->frameX0;
+ dstBox.x2 -= pScrnInfo->frameX0;
+ dstBox.y1 -= pScrnInfo->frameY0;
+ dstBox.y2 -= pScrnInfo->frameY0;
+
+ bpp = pScrnInfo->bitsPerPixel >> 3;
+ pitch = bpp * pScrnInfo->displayWidth;
+
+ dstPitch = ((width << 1) + 63) & ~63;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ srcPitch = (width + 3) & ~3; /* of luma */
+ s2offset = srcPitch * height;
+ srcPitch2 = ((width >> 1) + 3) & ~3;
+ s3offset = (srcPitch2 * (height >> 1)) + s2offset;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ srcPitch = (width << 1);
+ break;
+ }
+
+ newSize = height * dstPitch / bpp;
+
+ if(pPriv->doubleBuffer)
+ newSize <<= 1;
+
+ pPriv->linear = NVAllocateOverlayMemory(pScrnInfo,
+ pPriv->linear,
+ newSize);
+
+ if(!pPriv->linear) return BadAlloc;
+
+ offset = pPriv->linear->offset * bpp;
+
+ if(pPriv->doubleBuffer && pPriv->currentBuffer)
+ offset += (newSize * bpp) >> 1;
+
+ dst_start = pNv->FbStart + offset;
+
+ /* copy data */
+ top = ya >> 16;
+ left = (xa >> 16) & ~1;
+ npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left;
+
+#if 0
+ /* I have my reservations about this */
+ if(pPriv->doubleBuffer) {
+ RIVA_HW_INST *pRiva = &(pNv->riva);
+ int mask = 1 << (pPriv->currentBuffer << 2);
+ while(pRiva->PMC[0x00008700/4] & mask);
+ }
+#endif
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ top &= ~1;
+ dst_start += (left << 1) + (top * dstPitch);
+ tmp = ((top >> 1) * srcPitch2) + (left >> 1);
+ s2offset += tmp;
+ s3offset += tmp;
+ if(id == FOURCC_I420) {
+ tmp = s2offset;
+ s2offset = s3offset;
+ s3offset = tmp;
+ }
+ nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top;
+ NVCopyData420(buf + (top * srcPitch) + left, buf + s2offset,
+ buf + s3offset, dst_start, srcPitch, srcPitch2,
+ dstPitch, nlines, npixels);
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ left <<= 1;
+ buf += (top * srcPitch) + left;
+ nlines = ((yb + 0xffff) >> 16) - top;
+ dst_start += left + (top * dstPitch);
+ NVCopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
+ break;
+ }
+
+ NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, xa, ya, xb, yb,
+ width, height, src_w, src_h, drw_w, drw_h, clipBoxes);
+
+ pPriv->currentBuffer ^= 1;
+
+ return Success;
+}
+/*
+ * QueryImageAttributes
+ */
+static int NVQueryImageAttributes
+(
+ ScrnInfoPtr pScrnInfo,
+ int id,
+ unsigned short *w,
+ unsigned short *h,
+ int *pitches,
+ int *offsets
+)
+{
+ int size, tmp;
+
+ if(*w > 2046)
+ *w = 2046;
+ if(*h > 2047)
+ *h = 2047;
+
+ *w = (*w + 1) & ~1;
+ if (offsets)
+ offsets[0] = 0;
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ *h = (*h + 1) & ~1;
+ size = (*w + 3) & ~3;
+ if (pitches)
+ pitches[0] = size;
+ size *= *h;
+ if (offsets)
+ offsets[1] = size;
+ tmp = ((*w >> 1) + 3) & ~3;
+ if (pitches)
+ pitches[1] = pitches[2] = tmp;
+ tmp *= (*h >> 1);
+ size += tmp;
+ if (offsets)
+ offsets[2] = size;
+ size += tmp;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ size = *w << 1;
+ if (pitches)
+ pitches[0] = size;
+ size *= *h;
+ break;
+ }
+ return size;
+}
+
+static void NVVideoTimerCallback
+(
+ ScrnInfoPtr pScrnInfo,
+ Time currentTime
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pOverPriv = NULL;
+
+ pNv->VideoTimerCallback = NULL;
+
+ if(!pScrnInfo->vtSema) return;
+
+ if(pNv->overlayAdaptor) {
+ pOverPriv = GET_OVERLAY_PRIVATE(pNv);
+ if(!pOverPriv->videoStatus)
+ pOverPriv = NULL;
+ }
+
+ if(pOverPriv) {
+ if(pOverPriv->videoTime < currentTime) {
+ if(pOverPriv->videoStatus & OFF_TIMER) {
+ NVStopOverlay(pScrnInfo);
+ pOverPriv->videoStatus = FREE_TIMER;
+ pOverPriv->videoTime = currentTime + FREE_DELAY;
+ pNv->VideoTimerCallback = NVVideoTimerCallback;
+ } else
+ if(pOverPriv->videoStatus & FREE_TIMER) {
+ NVFreeOverlayMemory(pScrnInfo);
+ pOverPriv->videoStatus = 0;
+ }
+ } else
+ pNv->VideoTimerCallback = NVVideoTimerCallback;
+ }
+}
+
+
+/***** Exported offscreen surface stuff ****/
+
+
+static int
+NVAllocSurface (
+ ScrnInfoPtr pScrnInfo,
+ int id,
+ unsigned short w,
+ unsigned short h,
+ XF86SurfacePtr surface
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+ CARD8 *address;
+ int size, bpp;
+
+ bpp = pScrnInfo->bitsPerPixel >> 3;
+
+ if(pPriv->grabbedByV4L) return BadAlloc;
+
+ if((w > 2046) || (h > 2047)) return BadValue;
+
+ w = (w + 1) & ~1;
+ pPriv->pitch = ((w << 1) + 63) & ~63;
+ size = h * pPriv->pitch / bpp;
+
+ pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, pPriv->linear,
+ size);
+
+ if(!pPriv->linear) return BadAlloc;
+
+ pPriv->offset = pPriv->linear->offset * bpp;
+ address = pPriv->offset + pNv->FbStart;
+
+ surface->width = w;
+ surface->height = h;
+ surface->pScrn = pScrnInfo;
+ surface->pitches = &pPriv->pitch;
+ surface->offsets = &pPriv->offset;
+ surface->devPrivate.ptr = (pointer)pPriv;
+
+ /* grab the video */
+ NVStopOverlay(pScrnInfo);
+ pPriv->videoStatus = 0;
+ REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);
+ pNv->VideoTimerCallback = NULL;
+ pPriv->grabbedByV4L = TRUE;
+
+ return Success;
+}
+
+static int
+NVStopSurface (XF86SurfacePtr surface)
+{
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr);
+
+ if(pPriv->grabbedByV4L && pPriv->videoStatus) {
+ NVStopOverlay(surface->pScrn);
+ pPriv->videoStatus = 0;
+ }
+
+ return Success;
+}
+
+static int
+NVFreeSurface (XF86SurfacePtr surface)
+{
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr);
+
+ if(pPriv->grabbedByV4L) {
+ NVStopSurface(surface);
+ NVFreeOverlayMemory(surface->pScrn);
+ pPriv->grabbedByV4L = FALSE;
+ }
+
+ return Success;
+}
+
+static int
+NVGetSurfaceAttribute (
+ ScrnInfoPtr pScrnInfo,
+ Atom attribute,
+ INT32 *value
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+
+ return NVGetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv);
+}
+
+static int
+NVSetSurfaceAttribute(
+ ScrnInfoPtr pScrnInfo,
+ Atom attribute,
+ INT32 value
+)
+{
+ NVPtr pNv = NVPTR(pScrnInfo);
+ NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
+
+ return NVSetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv);
+}
+
+static int
+NVDisplaySurface (
+ XF86SurfacePtr surface,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ RegionPtr clipBoxes
+)
+{
+ ScrnInfoPtr pScrnInfo = surface->pScrn;
+ NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr);
+ INT32 xa, xb, ya, yb;
+ BoxRec dstBox;
+
+ if(!pPriv->grabbedByV4L) return Success;
+
+ if(src_w > (drw_w << 3))
+ drw_w = src_w >> 3;
+ if(src_h > (drw_h << 3))
+ drw_h = src_h >> 3;
+
+ /* Clip */
+ xa = src_x;
+ xb = src_x + src_w;
+ ya = src_y;
+ yb = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes,
+ surface->width, surface->height))
+ {
+ return Success;
+ }
+
+ dstBox.x1 -= pScrnInfo->frameX0;
+ dstBox.x2 -= pScrnInfo->frameX0;
+ dstBox.y1 -= pScrnInfo->frameY0;
+ dstBox.y2 -= pScrnInfo->frameY0;
+
+ pPriv->currentBuffer = 0;
+
+ NVPutOverlayImage (pScrnInfo, surface->offsets[0], surface->id,
+ surface->pitches[0], &dstBox, xa, xb, ya, yb,
+ surface->width, surface->height, src_w, src_h,
+ drw_w, drw_h, clipBoxes);
+
+ return Success;
+}
+
+XF86OffscreenImageRec NVOffscreenImages[2] =
+{
+ {
+ &NVImages[0],
+ VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT,
+ NVAllocSurface,
+ NVFreeSurface,
+ NVDisplaySurface,
+ NVStopSurface,
+ NVGetSurfaceAttribute,
+ NVSetSurfaceAttribute,
+ 2046, 2047,
+ NUM_ATTRIBUTES - 1,
+ &NVAttributes[1]
+ },
+ {
+ &NVImages[2],
+ VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT,
+ NVAllocSurface,
+ NVFreeSurface,
+ NVDisplaySurface,
+ NVStopSurface,
+ NVGetSurfaceAttribute,
+ NVSetSurfaceAttribute,
+ 2046, 2047,
+ NUM_ATTRIBUTES - 1,
+ &NVAttributes[1]
+ },
+};
+
+static void
+NVInitOffscreenImages (ScreenPtr pScreen)
+{
+ xf86XVRegisterOffscreenImages(pScreen, NVOffscreenImages, 2);
+}
+
+#endif
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c
index 0244f86e8..256aa2f1e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c
@@ -41,7 +41,7 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by
Jarno Paananen <jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.19 2001/02/15 11:03:58 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.22 2001/03/31 20:32:13 mvojkovi Exp $ */
#include "nv_include.h"
#include "xaalocal.h"
@@ -52,13 +52,6 @@
#include "miline.h"
-#define DOLINES
-
-/*
- * Macro to define valid rectangle.
- */
-#define NV_RECT_VALID(rr) (((rr).x1 < (rr).x2) && ((rr).y1 < (rr).y2))
-
static void
NVSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
{
@@ -224,6 +217,18 @@ NVSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
}
+void
+NVResetGraphics(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+
+ if(pNv->NoAccel) return;
+
+ pNv->currentRop = -1;
+ NVSetRopPattern(pNv, GXcopy);
+}
+
+
/*
* Synchronise with graphics engine. Make sure it is idle before returning.
@@ -319,8 +324,10 @@ NVSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
write_mem_barrier();
}
- if (!(--pNv->expandRows))
- RIVA_BUSY(pNv->riva);
+ if (!(--pNv->expandRows)) { /* hardware bug workaround */
+ RIVA_FIFO_FREE(pNv->riva, Blt, 1);
+ pNv->riva.Blt->TopLeftSrc = 0;
+ }
}
static void
@@ -330,8 +337,9 @@ NVSubsequentColorExpandScanlineFifo(ScrnInfoPtr pScrn, int bufno)
if ( --pNv->expandRows ) {
RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth);
- } else {
- RIVA_BUSY(pNv->riva);
+ } else { /* hardware bug workaround */
+ RIVA_FIFO_FREE(pNv->riva, Blt, 1);
+ pNv->riva.Blt->TopLeftSrc = 0;
}
write_mem_barrier();
}
@@ -384,8 +392,6 @@ NVSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x,
NVSubsequentColorExpandScanlineFifo;
RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth);
}
-
- RIVA_BUSY(pNv->riva);
}
@@ -412,8 +418,6 @@ NVSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y,
pNv->riva.Pixmap->TopLeft = (y << 16) | (x & 0xFFFF);
pNv->riva.Pixmap->WidthHeight = (h << 16) | w;
pNv->riva.Pixmap->WidthHeightIn = (h << 16) | bw;
-
- RIVA_BUSY(pNv->riva);
}
@@ -466,7 +470,6 @@ NVSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
}
-#ifdef DOLINES
static void
NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
@@ -475,7 +478,6 @@ NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
NVSetRopSolid(pNv, rop);
write_mem_barrier();
- RIVA_FIFO_FREE(pNv->riva, Line, 1);
pNv->FgColor = color;
}
@@ -513,114 +515,6 @@ NVSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
write_mem_barrier();
}
-#else
-
-static void
-NVPolylinesThinSolidWrapper(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- NVPtr pNv = NVPTR(infoRec->pScrn);
- pNv->CurrentGC = pGC;
-#ifdef NV_USE_FB
- pNv->CurrentDrawable = pDraw;
-#endif
- if(infoRec->NeedToSync)
- RIVA_BUSY(pNv->riva);
- XAAPolyLines(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-NVPolySegmentThinSolidWrapper(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- NVPtr pNv = NVPTR(infoRec->pScrn);
- pNv->CurrentGC = pGC;
-#ifdef NV_USE_FB
- pNv->CurrentDrawable = pDraw;
-#endif
- if(infoRec->NeedToSync)
- RIVA_BUSY(pNv->riva);
- XAAPolySegment(pDraw, pGC, nseg, pSeg);
-}
-
-
-#define NVSetupForSolidLine NVSetupForSolidFill
-
-static void
-NVSubsequentSolidHorVertLine(
- ScrnInfoPtr pScrn,
- int x, int y,
- int len, int dir
-){
- NVPtr pNv = NVPTR(pScrn);
- int w, h;
-
- if(dir == DEGREES_0) {
- w = len; h = 1;
- } else {
- w = 1; h = len;
- }
-
- RIVA_FIFO_FREE(pNv->riva, Bitmap, 2);
- pNv->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y;
- pNv->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h;
- write_mem_barrier();
-}
-
-#ifndef NV_USE_FB
-static void (*LineFuncs[4])() = {
- cfbBresS,
- cfb16BresS,
- NULL,
- cfb32BresS
-};
-#endif
-
-static void
-NVSubsequentSolidBresenhamLine(
- ScrnInfoPtr pScrn,
- int x, int y,
- int dmaj, int dmin,
- int e, int len, int octant
-){
- NVPtr pNv = NVPTR(pScrn);
-#ifndef NV_USE_FB
- cfbPrivGCPtr devPriv;
- int Bpp = pScrn->bitsPerPixel >> 3;
-
- devPriv = cfbGetGCPrivate(pNv->CurrentGC);
-
- /* you could trap for lines you could do here and accelerate them */
-
- (*LineFuncs[Bpp - 1])
- (devPriv->rop, devPriv->and, devPriv->xor,
- (unsigned long*)pNv->FbStart,
- (pNv->CurrentLayout.displayWidth * Bpp) >> LOG2_BYTES_PER_SCANLINE_PAD,
- (octant & XDECREASING) ? -1 : 1,
- (octant & YDECREASING) ? -1 : 1,
- (octant & YMAJOR) ? Y_AXIS : X_AXIS,
- x, y, dmin + e, dmin, dmin - dmaj, len);
-#else
- fbBres(pNv->CurrentDrawable, pNv->CurrentGC, 0,
- (octant & XDECREASING) ? -1 : 1,
- (octant & YDECREASING) ? -1 : 1,
- (octant & YMAJOR) ? Y_AXIS : X_AXIS,
- x, y, dmin + e, dmin, -dmaj, len);
-#endif
-}
-
-
-#endif
-
static void
NVValidatePolyArc(
GCPtr pGC,
@@ -733,8 +627,7 @@ NVAccelInit(ScreenPtr pScreen)
/* LEFT_EDGE_CLIPPING |
LEFT_EDGE_CLIPPING_NEGATIVE_X; */
NO_PLANEMASK | NO_TRANSPARENCY |
- NO_GXCOPY |
- SYNC_AFTER_IMAGE_WRITE;
+ NO_GXCOPY;
infoPtr->SetupForScanlineImageWrite = NVSetupForScanlineImageWrite;
infoPtr->SubsequentScanlineImageWriteRect =
@@ -746,7 +639,6 @@ NVAccelInit(ScreenPtr pScreen)
infoPtr->ScanlineImageWriteBuffers = &pNv->expandBuffer;
}
-#ifdef DOLINES
infoPtr->SolidLineFlags = NO_PLANEMASK;
infoPtr->SetupForSolidLine = NVSetupForSolidLine;
infoPtr->SubsequentSolidHorVertLine =
@@ -757,20 +649,6 @@ NVAccelInit(ScreenPtr pScreen)
infoPtr->DisableClipping = NVDisableClipping;
infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE;
miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
-#else
- infoPtr->SolidLineFlags = NO_PLANEMASK;
- infoPtr->SetupForSolidLine = NVSetupForSolidLine;
- infoPtr->PolySegmentThinSolidFlags = NO_PLANEMASK;
- infoPtr->PolylinesThinSolidFlags = NO_PLANEMASK;
- infoPtr->SubsequentSolidHorVertLine =
- NVSubsequentSolidHorVertLine;
- infoPtr->SubsequentSolidBresenhamLine =
- NVSubsequentSolidBresenhamLine;
- infoPtr->PolySegmentThinSolid =
- NVPolySegmentThinSolidWrapper;
- infoPtr->PolylinesThinSolid =
- NVPolylinesThinSolidWrapper;
-#endif
infoPtr->ValidatePolyArc = NVValidatePolyArc;
infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c
index c4fa1cae8..8cf1971e3 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c
@@ -36,7 +36,7 @@
|* those rights set forth herein. *|
|* *|
\***************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.11 2001/02/18 23:47:29 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.13 2001/03/28 01:17:43 mvojkovi Exp $ */
#include "nv_local.h"
#include "riva_hw.h"
@@ -1215,6 +1215,7 @@ static void CalcStateExt
state->repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00;
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
nv10UpdateArbitrationSettings(VClk,
pixelDepth * 8,
&(state->arbitration0),
@@ -1286,6 +1287,7 @@ static void UpdateFifoState
chip->Tri05 = (RivaTexturedTriangle05 *)&(chip->FIFO[0x0000E000/4]);
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
/*
* Initialize state for the RivaTriangle3D05 routines.
*/
@@ -1394,6 +1396,7 @@ static void LoadStateExt
chip->PGRAPH[0x0000067C/4] = state->pitch3;
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
LOAD_FIXED_STATE(nv10,PFIFO);
LOAD_FIXED_STATE(nv10,PRAMIN);
LOAD_FIXED_STATE(nv10,PGRAPH);
@@ -1422,15 +1425,38 @@ static void LoadStateExt
chip->Tri03 = 0L;
break;
}
- chip->PGRAPH[0x00000640/4] = state->offset0;
- chip->PGRAPH[0x00000644/4] = state->offset1;
- chip->PGRAPH[0x00000648/4] = state->offset2;
- chip->PGRAPH[0x0000064C/4] = state->offset3;
- chip->PGRAPH[0x00000670/4] = state->pitch0;
- chip->PGRAPH[0x00000674/4] = state->pitch1;
- chip->PGRAPH[0x00000678/4] = state->pitch2;
- chip->PGRAPH[0x0000067C/4] = state->pitch3;
- chip->PGRAPH[0x00000680/4] = state->pitch3;
+
+ if(chip->Architecture == NV_ARCH_10) {
+ chip->PGRAPH[0x00000640/4] = state->offset0;
+ chip->PGRAPH[0x00000644/4] = state->offset1;
+ chip->PGRAPH[0x00000648/4] = state->offset2;
+ chip->PGRAPH[0x0000064C/4] = state->offset3;
+ chip->PGRAPH[0x00000670/4] = state->pitch0;
+ chip->PGRAPH[0x00000674/4] = state->pitch1;
+ chip->PGRAPH[0x00000678/4] = state->pitch2;
+ chip->PGRAPH[0x0000067C/4] = state->pitch3;
+ chip->PGRAPH[0x00000680/4] = state->pitch3;
+ } else {
+ chip->PGRAPH[0x00000820/4] = state->offset0;
+ chip->PGRAPH[0x00000824/4] = state->offset1;
+ chip->PGRAPH[0x00000828/4] = state->offset2;
+ chip->PGRAPH[0x0000082C/4] = state->offset3;
+ chip->PGRAPH[0x00000850/4] = state->pitch0;
+ chip->PGRAPH[0x00000854/4] = state->pitch1;
+ chip->PGRAPH[0x00000858/4] = state->pitch2;
+ chip->PGRAPH[0x0000085C/4] = state->pitch3;
+ chip->PGRAPH[0x00000860/4] = state->pitch3;
+ chip->PGRAPH[0x00000864/4] = state->pitch3;
+ chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4];
+ chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4];
+ }
+ chip->PMC[0x00008704/4] = 1;
+ chip->PMC[0x00008140/4] = 0;
+ chip->PMC[0x00008920/4] = 0;
+ chip->PMC[0x00008924/4] = 0;
+ chip->PMC[0x00008908/4] = 0x01ffffff;
+ chip->PMC[0x0000890C/4] = 0x01ffffff;
+
chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4];
chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4];
chip->PGRAPH[0x00000B08/4] = chip->PFB[0x00000248/4];
@@ -1608,6 +1634,7 @@ static void UnloadStateExt
state->pitch3 = chip->PGRAPH[0x0000067C/4];
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
state->offset0 = chip->PGRAPH[0x00000640/4];
state->offset1 = chip->PGRAPH[0x00000644/4];
state->offset2 = chip->PGRAPH[0x00000648/4];
@@ -1971,6 +1998,7 @@ int RivaGetConfig
nv4GetConfig(chip);
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
nv10GetConfig(chip);
break;
default:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h
index 71f29dc00..f0eaf6a5a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h
@@ -36,7 +36,7 @@
|* those rights set forth herein. *|
|* *|
\***************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.9 2001/02/15 11:03:58 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.10 2001/02/21 00:42:58 mvojkovi Exp $ */
#ifndef __RIVA_HW_H__
#define __RIVA_HW_H__
#define RIVA_SW_VERSION 0x00010003
@@ -47,6 +47,7 @@
#define NV_ARCH_03 0x03
#define NV_ARCH_04 0x04
#define NV_ARCH_10 0x10
+#define NV_ARCH_20 0x20
/***************************************************************************\
* *
* FIFO registers. *
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h
index 8bd563fcf..7b5c750eb 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h
@@ -36,9 +36,8 @@
|* those rights set forth herein. *|
|* *|
\***************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.6 2000/08/11 05:04:08 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.7 2001/02/21 00:42:58 mvojkovi Exp $ */
-#define NV_NEW
/*
* RIVA Fixed Functionality Init Tables.
@@ -64,9 +63,7 @@ static unsigned RivaTableFIFO[][2] =
{0x00001800, 0x80000010},
{0x00002000, 0x80000011},
{0x00002800, 0x80000012},
-#ifdef NV_NEW
{0x00003000, 0x80000016},
-#endif
{0x00003800, 0x80000013}
};
static unsigned nv3TablePFIFO[][2] =
@@ -172,10 +169,8 @@ static unsigned nv3TablePRAMIN[][2] =
{0x00000249, 0x00CC0346},
{0x0000024C, 0x80000013},
{0x0000024D, 0x00D70347},
-#ifdef NV_NEW
{0x00000258, 0x80000016},
{0x00000259, 0x00CA034C},
-#endif
{0x00000D05, 0x00000000},
{0x00000D06, 0x00000000},
{0x00000D07, 0x00000000},
@@ -212,13 +207,10 @@ static unsigned nv3TablePRAMIN[][2] =
{0x00000D2C, 0x10830200},
{0x00000D2D, 0x00000000},
{0x00000D2E, 0x00000000},
- {0x00000D2F, 0x00000000}
-#ifdef NV_NEW
- ,
+ {0x00000D2F, 0x00000000},
{0x00000D31, 0x00000000},
{0x00000D32, 0x00000000},
{0x00000D33, 0x00000000}
-#endif
};
static unsigned nv3TablePRAMIN_8BPP[][2] =
{
@@ -230,11 +222,8 @@ static unsigned nv3TablePRAMIN_8BPP[][2] =
{0x00000D10, 0x10118203},
{0x00000D14, 0x10110203},
{0x00000D18, 0x10110203},
- {0x00000D1C, 0x10419208}
-#ifdef NV_NEW
- ,
+ {0x00000D1C, 0x10419208},
{0x00000D30, 0x10118203}
-#endif
};
static unsigned nv3TablePRAMIN_15BPP[][2] =
{
@@ -246,11 +235,8 @@ static unsigned nv3TablePRAMIN_15BPP[][2] =
{0x00000D10, 0x10118200},
{0x00000D14, 0x10110200},
{0x00000D18, 0x10110200},
- {0x00000D1C, 0x10419208}
-#ifdef NV_NEW
- ,
+ {0x00000D1C, 0x10419208},
{0x00000D30, 0x10118200}
-#endif
};
static unsigned nv3TablePRAMIN_32BPP[][2] =
{
@@ -262,11 +248,8 @@ static unsigned nv3TablePRAMIN_32BPP[][2] =
{0x00000D10, 0x10118201},
{0x00000D14, 0x10110201},
{0x00000D18, 0x10110201},
- {0x00000D1C, 0x10419208}
-#ifdef NV_NEW
- ,
+ {0x00000D1C, 0x10419208},
{0x00000D30, 0x10118201}
-#endif
};
static unsigned nv4TableFIFO[][2] =
{
@@ -390,10 +373,8 @@ static unsigned nv4TablePRAMIN[][2] =
{0x00000009, 0x80011149},
{0x0000000A, 0x80000015},
{0x0000000B, 0x8001114A},
-#ifdef NV_NEW
{0x0000000C, 0x80000016},
{0x0000000D, 0x8001114F},
-#endif
{0x00000020, 0x80000000},
{0x00000021, 0x80011142},
{0x00000022, 0x80000001},
@@ -461,13 +442,10 @@ static unsigned nv4TablePRAMIN[][2] =
{0x00000537, 0x00000000},
{0x00000538, 0x0000005B},
{0x0000053A, 0x11401140},
- {0x0000053B, 0x00000000}
-#ifdef NV_NEW
- ,
+ {0x0000053B, 0x00000000},
{0x0000053C, 0x0300A01C},
{0x0000053E, 0x11401140},
{0x0000053F, 0x00000000}
-#endif
};
static unsigned nv4TablePRAMIN_8BPP[][2] =
{
@@ -482,11 +460,8 @@ static unsigned nv4TablePRAMIN_8BPP[][2] =
{0x0000052D, 0x00000302},
{0x0000052E, 0x00000302},
{0x00000535, 0x00000000},
- {0x00000539, 0x00000000}
-#ifdef NV_NEW
- ,
+ {0x00000539, 0x00000000},
{0x0000053D, 0x00000302}
-#endif
};
static unsigned nv4TablePRAMIN_15BPP[][2] =
{
@@ -501,11 +476,8 @@ static unsigned nv4TablePRAMIN_15BPP[][2] =
{0x0000052D, 0x00000902},
{0x0000052E, 0x00000902},
{0x00000535, 0x00000702},
- {0x00000539, 0x00000702}
-#ifdef NV_NEW
- ,
+ {0x00000539, 0x00000702},
{0x0000053D, 0x00000902}
-#endif
};
static unsigned nv4TablePRAMIN_16BPP[][2] =
{
@@ -520,11 +492,8 @@ static unsigned nv4TablePRAMIN_16BPP[][2] =
{0x0000052D, 0x00000C02},
{0x0000052E, 0x00000C02},
{0x00000535, 0x00000702},
- {0x00000539, 0x00000702}
-#ifdef NV_NEW
- ,
+ {0x00000539, 0x00000702},
{0x0000053D, 0x00000C02}
-#endif
};
static unsigned nv4TablePRAMIN_32BPP[][2] =
{
@@ -539,11 +508,8 @@ static unsigned nv4TablePRAMIN_32BPP[][2] =
{0x0000052D, 0x00000E02},
{0x0000052E, 0x00000E02},
{0x00000535, 0x00000E02},
- {0x00000539, 0x00000E02}
-#ifdef NV_NEW
- ,
+ {0x00000539, 0x00000E02},
{0x0000053D, 0x00000E02}
-#endif
};
static unsigned nv10TableFIFO[][2] =
{
@@ -856,10 +822,8 @@ static unsigned nv10TablePRAMIN[][2] =
{0x00000009, 0x80011149},
{0x0000000A, 0x80000015},
{0x0000000B, 0x8001114A},
-#ifdef NV_NEW
{0x0000000C, 0x80000016},
{0x0000000D, 0x80011150},
-#endif
{0x00000020, 0x80000000},
{0x00000021, 0x80011142},
{0x00000022, 0x80000001},
@@ -932,13 +896,10 @@ static unsigned nv10TablePRAMIN[][2] =
{0x0000053B, 0x00000000},
{0x0000053C, 0x00000093},
{0x0000053E, 0x11401140},
- {0x0000053F, 0x00000000}
-#ifdef NV_NEW
- ,
+ {0x0000053F, 0x00000000},
{0x00000540, 0x0300A01C},
{0x00000542, 0x11401140},
{0x00000543, 0x00000000}
-#endif
};
static unsigned nv10TablePRAMIN_8BPP[][2] =
{
@@ -954,11 +915,8 @@ static unsigned nv10TablePRAMIN_8BPP[][2] =
{0x0000052E, 0x00000302},
{0x00000535, 0x00000000},
{0x00000539, 0x00000000},
- {0x0000053D, 0x00000000}
-#ifdef NV_NEW
- ,
+ {0x0000053D, 0x00000000},
{0x00000541, 0x00000302}
-#endif
};
static unsigned nv10TablePRAMIN_15BPP[][2] =
{
@@ -974,11 +932,8 @@ static unsigned nv10TablePRAMIN_15BPP[][2] =
{0x0000052E, 0x00000902},
{0x00000535, 0x00000902},
{0x00000539, 0x00000902},
- {0x0000053D, 0x00000902}
-#ifdef NV_NEW
- ,
+ {0x0000053D, 0x00000902},
{0x00000541, 0x00000902}
-#endif
};
static unsigned nv10TablePRAMIN_16BPP[][2] =
{
@@ -994,11 +949,8 @@ static unsigned nv10TablePRAMIN_16BPP[][2] =
{0x0000052E, 0x00000C02},
{0x00000535, 0x00000C02},
{0x00000539, 0x00000C02},
- {0x0000053D, 0x00000C02}
-#ifdef NV_NEW
- ,
+ {0x0000053D, 0x00000C02},
{0x00000541, 0x00000C02}
-#endif
};
static unsigned nv10TablePRAMIN_32BPP[][2] =
{
@@ -1014,10 +966,7 @@ static unsigned nv10TablePRAMIN_32BPP[][2] =
{0x0000052E, 0x00000E02},
{0x00000535, 0x00000E02},
{0x00000539, 0x00000E02},
- {0x0000053D, 0x00000E02}
-#ifdef NV_NEW
- ,
+ {0x0000053D, 0x00000E02},
{0x00000541, 0x00000E02}
-#endif
};
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
index b31a08d26..0d6e8723f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.5 2001/02/13 21:15:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.6 2001/03/03 22:26:12 tsi Exp $ */
/*
*
@@ -15,7 +15,6 @@
*
*/
-#include <math.h>
#include "Xarch.h"
#include "xaalocal.h"
#include "xaarop.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
index ba7cf5adc..0be456c2e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.11 2001/02/15 20:00:19 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.12 2001/03/08 17:12:11 eich Exp $ */
/*
* vim: sw=4 ts=8 ai ic:
*
@@ -1315,6 +1315,8 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
+ SavageUnmapMem(pScrn, 1);
+
return TRUE;
}
@@ -2040,6 +2042,9 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen,
pScrn = xf86Screens[pScreen->myNum];
psav = SAVPTR(pScrn);
+ if (!SavageMapMMIO(pScrn))
+ return FALSE;
+
SavageEnableMMIO(pScrn);
if (!SavageMapFB(pScrn))
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
index 6c48ddf9f..3061d60fa 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and Silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.3 2001/02/15 18:20:33 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.4 2001/03/03 22:26:13 tsi Exp $ */
#ifndef _SMI_H
#define _SMI_H
@@ -63,19 +63,19 @@ authorization from the XFree86 Project and Silicon Motion.
#endif
/******************************************************************************/
-/* D E F I N I T O N S */
+/* D E F I N I T I O N S */
/******************************************************************************/
#ifndef SMI_DEBUG
- #define SMI_DEBUG 0
+ #define SMI_DEBUG 0
#endif
#define SMI_USE_IMAGE_WRITES 0
-#define SMI_USE_VIDEO 1
-#define SMI_USE_CAPTURE 1
+#define SMI_USE_VIDEO 1
+#define SMI_USE_CAPTURE 1
/******************************************************************************/
-/* S T R U C T U R E S */
+/* S T R U C T U R E S */
/******************************************************************************/
/* Driver data structure; this should contain all needed info for a mode */
@@ -100,116 +100,142 @@ typedef struct
typedef struct
{
/* accel additions */
- CARD32 AccelCmd; /* Value for DPR0C */
- CARD32 Stride; /* Stride of frame buffer */
- CARD32 ScissorsLeft; /* Left/top of current scissors */
- CARD32 ScissorsRight; /* Right/bottom of current scissors */
- Bool ClipTurnedOn; /* Clipping was turned on by the
- previous command */
-
- CARD8 SR18Value; /* PDR#521: original SR18 value */
- CARD8 SR21Value; /* PDR#521: original SR21 value */
- SMIRegRec SavedReg; /* console saved mode registers */
- SMIRegRec ModeReg; /* XServer video state mode registers */
- xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */
-
- Bool ModeStructInit; /* Flag indicating ModeReg has been *
- * duped from console state */
- int vgaCRIndex, vgaCRReg;
- int width, height; /* Width and height of the screen */
- int Bpp; /* Bytes per pixel */
+ CARD32 AccelCmd; /* Value for DPR0C */
+ CARD32 Stride; /* Stride of frame buffer */
+ CARD32 ScissorsLeft; /* Left/top of current
+ scissors */
+ CARD32 ScissorsRight; /* Right/bottom of current
+ scissors */
+ Bool ClipTurnedOn; /* Clipping was turned on by
+ the previous command */
+ CARD8 SR18Value; /* PDR#521: original SR18
+ value */
+ CARD8 SR21Value; /* PDR#521: original SR21
+ value */
+ SMIRegRec SavedReg; /* console saved mode
+ registers */
+ SMIRegRec ModeReg; /* XServer video state mode
+ registers */
+ xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */
+
+ Bool ModeStructInit; /* Flag indicating ModeReg has
+ been duped from console
+ state */
+ int vgaCRIndex, vgaCRReg;
+ int width, height; /* Width and height of the
+ screen */
+ int Bpp; /* Bytes per pixel */
/* XAA */
- int videoRAMBytes; /* In units as noted, set in PreInit */
- int videoRAMKBytes; /* In units as noted, set in PreInit */
- unsigned char * MapBase; /* Base of mapped memory */
- int MapSize; /* Size of mapped memory */
- CARD8 * DPRBase; /* Base of DPR registers */
- CARD8 * VPRBase; /* Base of VPR registers */
- CARD8 * CPRBase; /* Base of CPR registers */
- CARD8 * DataPortBase; /* Base of data port */
- int DataPortSize; /* Size of data port */
- volatile CARD8 *IOBase; /* Base of MMIO VGA ports */
- unsigned char * FBBase; /* Base of FB */
- CARD32 FBOffset; /* Current visual FB starting *
- * location */
- CARD32 FBCursorOffset; /* Cursor storage location */
- CARD32 FBReserved; /* Reserved memory in frame buffer */
+ int videoRAMBytes; /* In units as noted, set in
+ PreInit */
+ int videoRAMKBytes; /* In units as noted, set in
+ PreInit */
+ unsigned char * MapBase; /* Base of mapped memory */
+ int MapSize; /* Size of mapped memory */
+ CARD8 * DPRBase; /* Base of DPR registers */
+ CARD8 * VPRBase; /* Base of VPR registers */
+ CARD8 * CPRBase; /* Base of CPR registers */
+ CARD8 * DataPortBase; /* Base of data port */
+ int DataPortSize; /* Size of data port */
+ CARD8 * IOBase; /* Base of MMIO VGA ports */
+ unsigned char * FBBase; /* Base of FB */
+ CARD32 FBOffset; /* Current visual FB starting
+ location */
+ CARD32 FBCursorOffset; /* Cursor storage location */
+ CARD32 FBReserved; /* Reserved memory in frame
+ buffer */
- Bool PrimaryVidMapped; /* Flag indicating if vgaHWMapMem was *
- * used successfully for this screen */
- int dacSpeedBpp; /* Clock value */
- int minClock; /* Mimimum clock */
- int maxClock; /* Maximum clock */
- int MCLK; /* Memory Clock */
- int GEResetCnt; /* Limit the number of errors printed *
- * using a counter */
-
- Bool pci_burst; /* Enable PCI burst mode for reads? */
- Bool NoPCIRetry; /* Diasable PCI retries */
- Bool fifo_conservative; /* Adjust fifo for acceleration? */
- Bool fifo_moderate; /* Adjust fifo for acceleration? */
- Bool fifo_aggressive; /* Adjust fifo for acceleration? */
- Bool NoAccel; /* Disable Acceleration */
- Bool hwcursor; /* hardware cursor enabled */
- Bool ShowCache; /* Debugging option */
- Bool useBIOS; /* USe BIOS for mode sets */
- Bool zoomOnLCD; /* Zoom on LCD */
+ Bool PrimaryVidMapped; /* Flag indicating if
+ vgaHWMapMem was used
+ successfully for
+ this screen */
+ int dacSpeedBpp; /* Clock value */
+ int minClock; /* Mimimum clock */
+ int maxClock; /* Maximum clock */
+ int MCLK; /* Memory Clock */
+ int GEResetCnt; /* Limit the number of errors
+ printed using a counter */
+
+ Bool pci_burst; /* Enable PCI burst mode for
+ reads? */
+ Bool NoPCIRetry; /* Disable PCI retries */
+ Bool fifo_conservative; /* Adjust fifo for
+ acceleration? */
+ Bool fifo_moderate; /* Adjust fifo for
+ acceleration? */
+ Bool fifo_aggressive; /* Adjust fifo for
+ acceleration? */
+ Bool NoAccel; /* Disable Acceleration */
+ Bool hwcursor; /* hardware cursor enabled */
+ Bool ShowCache; /* Debugging option */
+ Bool useBIOS; /* Use BIOS for mode sets */
+ Bool zoomOnLCD; /* Zoom on LCD */
- CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped *
- * CloseScreen function. */
- XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */
- pciVideoPtr PciInfo; /* PCI info vars. */
+ CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped
+ CloseScreen function */
+ XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */
+ pciVideoPtr PciInfo; /* PCI info vars */
PCITAG PciTag;
- int Chipset; /* Chip info, set using PCI above. */
- int ChipRev;
+ int Chipset; /* Chip info, set using PCI
+ above */
+ int ChipRev;
/* DGA */
- DGAModePtr DGAModes; /* Pointer to DGA modes */
- int numDGAModes; /* Number of DGA modes */
- Bool DGAactive; /* Flag if DGA is active */
- int DGAViewportStatus; /* DGA Viewport status */
+ DGAModePtr DGAModes; /* Pointer to DGA modes */
+ int numDGAModes; /* Number of DGA modes */
+ Bool DGAactive; /* Flag if DGA is active */
+ int DGAViewportStatus;
/* DPMS */
- int CurrentDPMS; /* Current DPMS state */
- unsigned char DPMS_SR20; /* Saved DPMS SR20 register */
- unsigned char DPMS_SR21; /* Saved DPMS SR21 register */
- unsigned char DPMS_SR31; /* Saved DPMS SR31 register */
- unsigned char DPMS_SR34; /* Saved DPMS SR34 register */
+ int CurrentDPMS; /* Current DPMS state */
+ unsigned char DPMS_SR20; /* Saved DPMS SR20 register */
+ unsigned char DPMS_SR21; /* Saved DPMS SR21 register */
+ unsigned char DPMS_SR31; /* Saved DPMS SR31 register */
+ unsigned char DPMS_SR34; /* Saved DPMS SR34 register */
/* Panel information */
- Bool lcd; /* LCD active, 1=DSTN, 2=TFT */
- int lcdWidth; /* LCD width */
- int lcdHeight; /* LCD height */
+ Bool lcd; /* LCD active, 1=DSTN, 2=TFT */
+ int lcdWidth; /* LCD width */
+ int lcdHeight; /* LCD height */
- I2CBusPtr I2C; /* Pointer to I2C module */
- xf86Int10InfoPtr pInt; /* Pointer to INT10 module */
- vbeInfoPtr pVbe; /* Pointer to VBE module */
+ I2CBusPtr I2C; /* Pointer into I2C module */
+ xf86Int10InfoPtr pInt; /* Pointer to INT10 module */
+ vbeInfoPtr pVbe; /* Pointer to VBE module */
/* Shadow frame buffer (rotation) */
- Bool shadowFB; /* Flag if shadow buffer is used */
- int rotate; /* Rotation flags */
- int ShadowPitch; /* Pitch of shadow buffer */
- int ShadowWidthBytes; /* Width of shadow buffer in bytes */
- int ShadowWidth; /* Width of shadow buffer in pixels */
- int ShadowHeight; /* Height of shadow buffer in pixels */
- CARD32 saveBufferSize; /* #670 - FB save buffer size */
- void * pSaveBuffer; /* #670 - FB save buffer */
- CARD32 savedFBOffset; /* #670 - Saved FBOffset value */
- CARD32 savedFBReserved; /* #670 - Saved FBReserved value */
- CARD8 * paletteBuffer; /* #920 - Palette save buffer */
+ Bool shadowFB; /* Flag if shadow buffer is
+ used */
+ int rotate; /* Rotation flags */
+ int ShadowPitch; /* Pitch of shadow buffer */
+ int ShadowWidthBytes; /* Width of shadow
+ buffer in bytes */
+ int ShadowWidth; /* Width of shadow buffer in
+ pixels */
+ int ShadowHeight; /* Height of shadow buffer in
+ pixels */
+ CARD32 saveBufferSize; /* #670 - FB save buffer size */
+ void * pSaveBuffer; /* #670 - FB save buffer */
+ CARD32 savedFBOffset; /* #670 - Saved FBOffset value */
+ CARD32 savedFBReserved; /* #670 - Saved
+ FBReserved value */
+ CARD8 * paletteBuffer; /* #920 - Palette save buffer */
/* Polylines - #671 */
- ValidateGCProcPtr ValidatePolylines;/* Org. ValidatePolylines function */
- Bool polyLines; /* Our polylines patch is active */
+ ValidateGCProcPtr ValidatePolylines; /* Org.
+ ValidatePolylines
+ function */
+ Bool polyLines; /* Our polylines patch is
+ active */
void (*PointerMoved)(int index, int x, int y);
#ifdef XvExtension
- int videoKey; /* Video chroma key */
- Bool ByteSwap; /* Byte swap for ZV port */
+ int videoKey; /* Video chroma key */
+ Bool ByteSwap; /* Byte swap for ZV port */
/* XvExtension */
- XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */
+ XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter
+ structure */
void (*BlockHandler)(int i, pointer blockData, pointer pTimeout,
pointer pReadMask);
#endif
@@ -219,7 +245,7 @@ typedef struct
#define SMIPTR(p) ((SMIPtr)((p)->driverPrivate))
/******************************************************************************/
-/* M A C R O S */
+/* M A C R O S */
/******************************************************************************/
#if SMI_DEBUG
@@ -243,51 +269,54 @@ typedef struct
#include "regsmi.h"
#if !defined (MetroLink) && !defined (VertDebug)
-#define VerticalRetraceWait() \
-do \
-{ \
- if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
- { \
- while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \
- while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) ; \
- while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \
- } \
+#define VerticalRetraceWait() \
+do \
+{ \
+ if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
+ { \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08); \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \
+ } \
} while (0)
#else
#define SPIN_LIMIT 1000000
-#define VerticalRetraceWait()
-do \
-{ \
- if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
- { \
- volatile unsigned long _spin_me; \
- for (_spin_me = SPIN_LIMIT; \
- ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \
- _spin_me--) ; \
- if (!_spin_me) \
- ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
- for (_spin_me = SPIN_LIMIT; \
- ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me; \
- _spin_me--) ; \
- if (!_spin_me) \
- ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
- for (_spin_me = SPIN_LIMIT; \
- ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \
- _spin_me--) ; \
- if (!_spin_me) \
- ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
- } \
+#define VerticalRetraceWait() \
+do \
+{ \
+ if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
+ { \
+ volatile unsigned long _spin_me; \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \
+ _spin_me; \
+ _spin_me--); \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && \
+ _spin_me; \
+ _spin_me--); \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \
+ _spin_me; \
+ _spin_me--); \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ } \
} while (0)
#endif
/******************************************************************************/
-/* F U N C T I O N P R O T O T Y P E S */
+/* F U N C T I O N P R O T O T Y P E S */
/******************************************************************************/
/* smi_dac.c */
void SMI_CommonCalcClock(long freq, int min_m, int min_n1, int max_n1,
- int min_n2, int max_n2, long freq_min, long freq_max,
- unsigned char * mdiv, unsigned char * ndiv);
+ int min_n2, int max_n2, long freq_min, long freq_max,
+ unsigned char * mdiv, unsigned char * ndiv);
/* smi_i2c */
Bool SMI_I2CInit(ScrnInfoPtr pScrn);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
index 68257cda5..9a583f336 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from The XFree86 Project or Silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.9 2001/02/15 18:20:33 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.10 2001/03/08 17:12:12 eich Exp $ */
#include "xf86Resources.h"
#include "xf86RAC.h"
@@ -1578,7 +1578,7 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E,
restore->CR90[14] & ~0x20);
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33_2);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33);
VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A, restore->CR3A);
for (i = 0; i < 14; i++)
{
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c
index 323f78c57..b2f8d698f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c
@@ -26,9 +26,9 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and Silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */
-#include <cursorstr.h>
+#include "cursorstr.h"
#include "smi.h"
#define MAX_CURSOR 32
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
index 9022ba330..ff6a713aa 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.3 2001/02/15 18:20:33 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.4 2001/03/03 22:26:13 tsi Exp $ */
#include "smi.h"
#include "smi_video.h"
@@ -36,9 +36,9 @@ authorization from the XFree86 Project and silicon Motion.
#if defined(XvExtension) && SMI_USE_VIDEO
-#include <dixstruct.h>
-#include <xaa.h>
-#include <xaalocal.h>
+#include "dixstruct.h"
+#include "xaa.h"
+#include "xaalocal.h"
static XF86VideoAdaptorPtr SMI_SetupVideo(ScreenPtr pScreen);
static void SMI_ResetVideo(ScrnInfoPtr pScrn);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h
index 3d4729994..7334c49a5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h
@@ -26,12 +26,12 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and silicon Motion.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.2 2001/03/03 22:26:13 tsi Exp $ */
#ifndef _SMI_VIDEO_H
#define _SMI_VIDEO_H
-#include <fourcc.h>
+#include "fourcc.h"
#define SMI_VIDEO_VIDEO 0
#define SMI_VIDEO_IMAGE 1
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c
index ce0f2b0cb..821ced5c4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.5 2000/12/14 02:51:40 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.6 2001/03/03 22:26:13 tsi Exp $ */
/*
*
@@ -14,21 +14,20 @@
#define DEBUG
#endif
-#include <xf86.h>
-#include <xf86_OSproc.h>
-#include <xf86_ansic.h>
-#include <xf86_libc.h>
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
-#include <xf86PciInfo.h>
-#include <xf86Pci.h>
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
-#include <compiler.h>
+#include "compiler.h"
-#include <miline.h>
+#include "miline.h"
-#include <xaa.h>
-#include <xaalocal.h>
-#include <xf86fbman.h>
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86fbman.h"
#include "sis.h"
#include "sis300_accel.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
index b41d5061e..32aa40415 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.9 2000/12/21 12:22:57 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.10 2001/03/21 17:02:25 dawes Exp $ */
/* modified from tdfx_dri.c, mga_dri.c */
@@ -194,9 +194,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
{
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n",
+ "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n",
major, minor, patch);
return FALSE;
}
@@ -262,6 +262,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = SISDRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
xfree(pDRIInfo->devPrivate);
pDRIInfo->devPrivate=0;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
index 32d477566..75e4646db 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
@@ -1,11 +1,11 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.3 2001/03/03 22:26:13 tsi Exp $ */
/* modified from tdfx_dri.h */
#ifndef _SIS_DRI_
#define _SIS_DRI_
-#include <xf86drm.h>
+#include "xf86drm.h"
#define SIS_MAX_DRAWABLES 256
#define SISIOMAPSIZE (64*1024)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
index 08e6e5ab9..c4deecbed 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
@@ -25,7 +25,7 @@
* Mitani Hiroshi <hmitani@drl.mei.co.jp>
* David Thomas <davtom@dream.org.uk>.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.58 2001/01/21 21:19:32 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.59 2001/03/06 17:07:40 dawes Exp $ */
#include "fb.h"
@@ -621,7 +621,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* Our preference for depth 24 is 24bpp, so tell it that too.
*/
pix24flags = Support32bppFb | Support24bppFb |
- SupportConvert24to32 | SupportConvert32to24;
+ SupportConvert24to32 | SupportConvert32to24 |
+ PreferConvert32to24;
if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) {
return FALSE;
@@ -1426,7 +1427,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
- SISInitVideo(pScreen);
+ if (pSiS->Chipset == PCI_CHIP_SIS630) {
+ SISInitVideo(pScreen);
+ }
pSiS->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = SISCloseScreen;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h
index 04df5dd5c..8d96e3d20 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h
@@ -20,7 +20,7 @@
* IN AN ACTION 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/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.1 2000/06/30 17:15:14 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.2 2001/03/03 22:41:33 tsi Exp $ */
#ifndef CG14_H
#define CG14_H
@@ -64,8 +64,10 @@ typedef struct {
#define GET_CG14_FROM_SCRN(p) ((Cg14Ptr)((p)->driverPrivate))
-#ifdef linux
+/*
+ * This should match corresponding definition in Solaris's
+ * '/usr/include/sys/cg14io.h'.
+ */
#define CG14_SET_PIXELMODE (('M' << 8) | 3)
-#endif
#endif /* CG14_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
index 1a2d2e475..763d8916a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile
@@ -1,7 +1,7 @@
XCOMM
XCOMM This is an Imakefile for the ffb driver.
XCOMM
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.5 2001/01/24 00:06:30 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.6 2001/03/03 22:41:34 tsi Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -19,27 +19,36 @@ VISOPTIONS = -DUSE_VIS
ASVISOPTION = AsVISOption
GCCVISOPTION = -Wa,$(ASVISOPTION)
#if AsOutputArchSize == 32
-#define FFBCObjectRule(name) @@\
-name.o: name.c @@\
- ObjectCompile(-mv8 -mtune=ultrasparc $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\
- dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\
- echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc @@\
- @@\
-name.i: name.c @@\
- CPPOnlyCompile(name.c,-mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\
- @@\
-CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES))
-#define FFBsObjectRule(name) @@\
-name.o: name.s @@\
- $(RM) $@ @@\
- $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\
- dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\
- echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc
+#define FFBCObjectRule(name) @@\
+name.o: name.c @@\
+ ObjectCompile(-mv8 -mtune=ultrasparc \
+ $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\
+ dd if=/dev/zero bs=1 count=3 2>/dev/null | \
+ dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\
+ dd if=/dev/zero bs=1 count=1 2>/dev/null | \
+ tr '\000' '\002' | \
+ dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null @@\
+ @@\
+name.i: name.c @@\
+ CPPOnlyCompile(name.c,-mv8 \
+ $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\
+ @@\
+CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 \
+ $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES))
+#define FFBsObjectRule(name) @@\
+name.o: name.s @@\
+ $(RM) $@ @@\
+ $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\
+ dd if=/dev/zero bs=1 count=3 2>/dev/null | \
+ dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\
+ dd if=/dev/zero bs=1 count=1 2>/dev/null | \
+ tr '\000' '\002' | \
+ dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null
#else
#define FFBCObjectRule(name) SpecialCObjectRule(name,,$(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES))
-#define FFBsObjectRule(name) @@\
-name.o: name.s @@\
- $(RM) $@ @@\
+#define FFBsObjectRule(name) @@\
+name.o: name.s @@\
+ $(RM) $@ @@\
$(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ -
#endif
#else
@@ -50,16 +59,17 @@ ASVISOPTION =
#define FFBsObjectRule(name)
#endif
-SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c ffb_cplane.c \
- ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c ffb_line.c ffb_glyph.c \
- ffb_frect.c ffb_circle.c ffb_checks.c ffb_stubs.c ffb_gc.c \
- ffb_gspans.c ffb_sspans.c ffb_zeroarc.c ffb_cursor.c ffb_dga.c ffb_dac.c \
- ffb_wid.c ffb_dbe.c $(DRISRCS)
-OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o ffb_cplane.o \
- ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o ffb_line.o ffb_glyph.o \
- ffb_frect.o ffb_circle.o ffb_checks.o ffb_stubs.o ffb_gc.o \
- ffb_gspans.o ffb_sspans.o ffb_zeroarc.o ffb_cursor.o ffb_dga.o ffb_dac.o \
- ffb_wid.o ffb_dbe.o $(VISOBJS) $(DRIOBJS)
+SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c \
+ ffb_cplane.c ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c \
+ ffb_line.c ffb_glyph.c ffb_frect.c ffb_circle.c ffb_checks.c \
+ ffb_stubs.c ffb_gc.c ffb_gspans.c ffb_sspans.c ffb_zeroarc.c \
+ ffb_cursor.c ffb_dga.c ffb_dac.c ffb_wid.c ffb_dbe.c $(DRISRCS)
+OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o \
+ ffb_cplane.o ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o \
+ ffb_line.o ffb_glyph.o ffb_frect.o ffb_circle.o ffb_checks.o \
+ ffb_stubs.o ffb_gc.o ffb_gspans.o ffb_sspans.o ffb_zeroarc.o \
+ ffb_cursor.o ffb_dga.o ffb_dac.o ffb_wid.o ffb_dbe.o $(VISOBJS) \
+ $(DRIOBJS)
#if defined(XF86DriverSDK)
INCLUDES = -I. -I../../include
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h
index 1a93ec075..5848ecb6e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h
@@ -24,7 +24,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.5 2000/12/01 00:24:34 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.6 2001/03/03 22:41:34 tsi Exp $ */
#ifndef FFB_H
#define FFB_H
@@ -290,8 +290,6 @@ extern int CreatorWindowPrivateIndex;
#ifdef DEBUG_FFB
-#include <stdio.h>
-
extern FILE *FDEBUG_FD;
static __inline__ void FFB_DEBUG_init(void)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c
index 587debf36..b8ce88b5d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c
@@ -24,10 +24,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.4 2000/12/01 00:24:34 dawes Exp $ */
-
-#include <asm/types.h>
-#include <math.h>
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.5 2001/03/03 22:41:34 tsi Exp $ */
#include "scrnintstr.h"
#include "pixmapstr.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c
index aded7f96f..78abdf2f0 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c
@@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.2 2000/06/30 17:15:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */
#include "ffb.h"
#include "ffb_rcache.h"
@@ -348,6 +348,9 @@ init_dac_flags(FFBPtr pFfb)
unsigned int did, manuf_rev, partnum;
char *device;
+ /* Fetch kernel WID. */
+ p->kernel_wid = *((volatile unsigned char *)pFfb->dfb8x);
+
/* For AFB, assume it is PAC2 which also implies not having
* the inverted cursor control attribute.
*/
@@ -425,7 +428,9 @@ static void
restore_kernel_xchannel(FFBPtr pFfb)
{
ffb_fbcPtr ffb = pFfb->regs;
- unsigned int fbc, ppc, ppc_mask, drawop;
+ unsigned int fbc, ppc, ppc_mask, drawop, wid;
+
+ wid = pFfb->dac_info.kernel_wid;
if (pFfb->has_double_buffer)
fbc = FFB_FBC_WB_AB;
@@ -443,7 +448,7 @@ restore_kernel_xchannel(FFBPtr pFfb)
FFB_ATTR_RAW(pFfb, ppc, ppc_mask, ~0,
(FFB_ROP_EDIT_BIT | GXcopy)|(FFB_ROP_NEW<<8),
- drawop, 0x0, fbc, 0xff);
+ drawop, 0x0, fbc, wid);
FFBFifo(pFfb, 4);
FFB_WRITE64(&ffb->by, 0, 0);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h
index cc2911b41..b6c4f5db5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h
@@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.2 2001/04/05 17:42:33 dawes Exp $ */
#ifndef _FFB_DAC_H
#define _FFB_DAC_H
@@ -347,6 +347,8 @@ typedef struct ffb_dac_info {
#define FFB_DAC_PAC2 0x00000002 /* Pacifica2 DAC, BT498 */
#define FFB_DAC_ICURCTL 0x00000004 /* Inverted CUR_CTRL bits */
+ unsigned int kernel_wid;
+
/* These registers need to be modified when changing DAC
* timing state, so at init time we capture their values.
*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c
index f866f1a2d..a5d97167a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.5 2000/12/21 12:22:57 alanh Exp $
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.6 2001/03/21 17:02:25 dawes Exp $
* Acceleration for the Creator and Creator3D framebuffer - DRI/DRM support.
*
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
@@ -273,6 +273,9 @@ FFBDRIScreenInit(ScreenPtr pScreen)
/* Our InitBuffers depends heavily on this setting. */
pDRIInfo->bufferRequests = DRI_3D_WINDOWS_ONLY;
+ pDRIInfo->createDummyCtx = TRUE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &(pFfb->drmSubFD))) {
DRIDestroyInfoRec(pFfb->pDRIInfo);
xfree(pFfbDRI);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c
index b9bc424fc..689607ff3 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c
@@ -20,7 +20,7 @@
* IN AN ACTION 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/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.7 2000/12/02 15:30:54 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.8 2001/04/05 17:42:33 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -818,7 +818,8 @@ FFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
#ifdef XF86DRI
- if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6) {
+ if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6 &&
+ pFfb->NoAccel == FALSE) {
pFfb->dri_enabled = FFBDRIScreenInit(pScreen);
if (pFfb->dri_enabled == TRUE)
xf86Msg(X_INFO, "%s: DRM initialized\n",
@@ -912,7 +913,8 @@ FFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
/* Setup DGA support. */
- FFB_InitDGA(pScreen);
+ if (!pFfb->NoAccel)
+ FFB_InitDGA(pScreen);
#ifdef XF86DRI
if (pFfb->dri_enabled) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c
index 4ad5f744e..340efef3b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c
@@ -24,7 +24,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */
#include "ffb.h"
#include "ffb_regs.h"
@@ -451,7 +451,7 @@ CreatorFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, unsigned long
CreatorBoxFillPage(pFfb, nBox, pBox);
pFfb->rp_active = 1;
- FFBSync(pFfb, ffb);
+ FFBSync(pFfb, pFfb->regs);
}
static void
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c
index 2d194d82e..feb80346a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c
@@ -23,11 +23,10 @@
* IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.2 2000/05/23 04:47:45 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */
#define PSZ 32
-#include <math.h>
#include "ffb.h"
#include "ffb_regs.h"
#include "ffb_rcache.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c
index e70821732..ee6231066 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c
@@ -20,11 +20,9 @@
* IN AN ACTION 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/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.2 2000/12/01 00:24:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */
#define PSZ 32
-#include <asm/types.h>
-#include <math.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
index 9c1af323a..2c048a2d2 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.18 2000/12/20 01:30:46 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.21 2001/04/05 21:29:17 dawes Exp $ */
#ifndef _TDFX_H_
#define _TDFX_H_
@@ -39,6 +39,8 @@ typedef struct _TDFXRec *TDFXPtr;
#include "tdfx_priv.h"
extern void TDFXSwapContextFifo(ScreenPtr pScreen);
extern void TDFXLostContext(ScreenPtr pScreen);
+extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples);
+extern Bool TDFXDisableSLI(TDFXPtr pTDFX);
#ifdef XF86DRI
extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI);
@@ -69,7 +71,7 @@ extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI);
#ifdef TRACECURS
#define TDFXTRACECURS ErrorF
#else
-#define TDFXTRACECURS if(0) (unsigned long)
+#define TDFXTRACECURS if(0) ErrorF
#endif
#ifdef TRACEREG
@@ -78,8 +80,8 @@ extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI);
#define TDFXTRACEREG if(0) ErrorF
#endif
-#include <xaa.h>
-#include <xf86Cursor.h>
+#include "xaa.h"
+#include "xf86Cursor.h"
typedef void (*TDFXWriteIndexedByteFunc)(TDFXPtr pTDFX, int addr,
char index, char value);
@@ -97,12 +99,17 @@ typedef int (*TDFXReadChipWordFunc)(TDFXPtr pTDFX, int chip,
int addr);
typedef void (*TDFXSyncFunc)(ScrnInfoPtr pScrn);
typedef void (*TDFXBufferFunc)(TDFXPtr pTDFX, int which);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+typedef void (*TDFXWriteFifoFunc)(TDFXPtr pTDFX, int val);
+#endif
+
typedef struct {
unsigned int vidcfg;
unsigned int vidpll;
unsigned int dacmode;
unsigned int vgainit0;
+ unsigned int miscinit0;
unsigned int screensize;
unsigned int stride;
unsigned int cursloc;
@@ -174,6 +181,9 @@ typedef struct _TDFXRec {
TDFXWriteChipWordFunc writeChipLong;
TDFXReadChipWordFunc readChipLong;
TDFXSyncFunc sync;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ TDFXWriteFifoFunc writeFifo;
+#endif
int syncDone;
int scanlineWidth;
unsigned char *scanlineColorExpandBuffers[2];
@@ -251,9 +261,11 @@ extern void TDFXSetPIOAccess(TDFXPtr pTDFX);
extern void TDFXSetMMIOAccess(TDFXPtr pTDFX);
extern void TDFXWriteLongMMIO(TDFXPtr pTDFX, int addr, int val);
extern int TDFXReadLongMMIO(TDFXPtr pTDFX, int addr);
+extern void TDFXWriteChipLongMMIO(TDFXPtr pTDFX, int chip, int addr, int val);
extern void TDFXNeedSync(ScrnInfoPtr pScrn);
extern void TDFXCheckSync(ScrnInfoPtr pScrn);
+extern void TDFXFirstSync(ScrnInfoPtr pScrn);
extern void TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
int ydir, int rop,
@@ -269,7 +281,6 @@ extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which);
+extern void TDFXInitVideo(ScreenPtr pScreen);
#endif
-
-
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 ce4b0369e..ce9f18de1 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.17 2000/12/15 15:19:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.19 2001/04/05 21:29:17 dawes Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -57,6 +57,7 @@ static void TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
static void TDFXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int flags,
int phase);
+#ifdef ENABLE_SS_COLOR_EXPAND_FILL
static void TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask);
@@ -64,6 +65,7 @@ static void TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
int x, int y, int w,
int h, int srcx,
int srcy, int offset);
+#endif
static void TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask);
@@ -105,7 +107,6 @@ TDFXCheckSync(ScrnInfoPtr pScrn) {
pTDFX->syncDone=FALSE;
#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
- TDFXLostContext(screenInfo.screens[pScrn->scrnIndex]);
DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
}
#endif
@@ -124,8 +125,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
else fmt=pTDFX->stride|((pTDFX->cpp+1)<<16);
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->fbOffset);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->fbOffset);
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
case TDFX_BACK:
if (pTDFX->cpp==2)
@@ -134,8 +137,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->backOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->backOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
case TDFX_DEPTH:
if (pTDFX->cpp==2)
@@ -144,8 +149,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->depthOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->depthOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
default:
;
@@ -155,6 +162,17 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
void
TDFXSetLFBConfig(TDFXPtr pTDFX) {
if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ unsigned int lfbmode;
+ lfbmode=TDFXReadLongMMIO(pTDFX, SST_3D_LFBMODE);
+
+ lfbmode&=~BIT(12); /* 0 bit 12 is byte swizzle */
+ lfbmode|=BIT(11); /* 1 bit 11 is word swizzle */
+ lfbmode&=~BIT(10); /* 0 bit 10 ARGB or ABGR */
+ lfbmode&=~BIT(9); /* 0 bit 9 if bit10 = 0: ARGB else ABGR */
+
+ TDFXWriteLongMMIO(pTDFX, SST_3D_LFBMODE, lfbmode);
+#endif
TDFXWriteLongMMIO(pTDFX, LFBMEMORYCONFIG, (pTDFX->backOffset>>12) |
SST_RAW_LFB_ADDR_STRIDE_4K |
((pTDFX->stride+127)/128)<<SST_RAW_LFB_TILE_STRIDE_SHIFT);
@@ -233,7 +251,7 @@ TDFXAccelInit(ScreenPtr pScreen)
infoPtr->SubsequentScreenToScreenCopy = TDFXSubsequentScreenToScreenCopy;
infoPtr->ScreenToScreenCopyFlags = commonFlags;
- /* When we're using the fifo interface we have to use indirect */
+ /* When we're using the fifo we have to use indirect expansion */
pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4);
pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4);
infoPtr->NumScanlineColorExpandBuffers=2;
@@ -244,7 +262,10 @@ TDFXAccelInit(ScreenPtr pScreen)
TDFXSubsequentCPUToScreenColorExpandFill;
infoPtr->SubsequentColorExpandScanline =
TDFXSubsequentColorExpandScanline;
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags |
+ infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+#endif
CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD |
LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */
@@ -256,7 +277,7 @@ TDFXAccelInit(ScreenPtr pScreen)
HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
HARDWARE_PATTERN_SCREEN_ORIGIN;
-#if 0
+#ifdef ENABLE_SS_COLOR_EXPAND_FILL
/* This causes us to fail compliance */
/* I suspect 1bpp pixmaps are getting written to cache incorrectly */
infoPtr->SetupForScreenToScreenColorExpandFill =
@@ -274,6 +295,9 @@ TDFXAccelInit(ScreenPtr pScreen)
pTDFX->ModeReg.dstbaseaddr=pTDFX->fbOffset;
TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, pTDFX->ModeReg.dstbaseaddr);
+ pTDFX->sst2DSrcFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_SRCFORMAT);
+ pTDFX->sst2DDstFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_DSTFORMAT);
+
/* Fill in acceleration functions */
return XAAInit(pScreen, infoPtr);
}
@@ -418,7 +442,9 @@ TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
TDFXMakeRoom(pTDFX, 2);
DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
}
void
@@ -476,6 +502,7 @@ TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
DECLARE(SSTCP_DSTFORMAT|SSTCP_COLORFORE|
SSTCP_COLORBACK);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_COLORBACK, color);
TDFXWriteLong(pTDFX, SST_2D_COLORFORE, color);
}
@@ -525,6 +552,7 @@ TDFXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
|SSTCP_PATTERN1ALIAS|SSTCP_COLORFORE|
SSTCP_COLORBACK);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_PATTERN0, patx);
TDFXWriteLong(pTDFX, SST_2D_PATTERN1, paty);
TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg);
@@ -638,8 +666,14 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
(pbox->x1&0x1FFF));
TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, ((pbox->y2&0x1FFF)<<16) |
(pbox->x2&0x1FFF));
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP |
+ SST_2D_SOURCE_PACKING_DWORD | BIT(20));
+#else
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP |
SST_2D_SOURCE_PACKING_DWORD);
+#endif
+ pTDFX->sst2DSrcFmtShadow = SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD;
TDFXWriteLong(pTDFX, SST_2D_SRCXY, 0);
TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg);
TDFXWriteLong(pTDFX, SST_2D_COMMAND, pTDFX->Cmd);
@@ -668,7 +702,11 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
TDFXMakeRoom(pTDFX, i);
DECLARE_LAUNCH(i, 0);
for (j=0; j<i; j++) {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ TDFXWriteLong(pTDFX, SST_2D_LAUNCH, *glyph_data);
+#else
TDFXWriteLong(pTDFX, SST_2D_LAUNCH, XAAReverseBitOrder(*glyph_data));
+#endif
glyph_data++;
}
ndwords -= i;
@@ -682,9 +720,21 @@ TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
unsigned char *pattern)
{
TDFXPtr pTDFX;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ unsigned int pat = *(unsigned int *)pattern;
+#endif
TDFXTRACEACCEL("TDFXSetupForDashedLine\n");
pTDFX=TDFXPTR(pScrn);
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ pat=((pat & 0xAAAAAAAA) >> 1) | ((pat & 0x55555555) << 1);
+ pat=((pat & 0xCCCCCCCC) >> 2) | ((pat & 0x33333333) << 2);
+ pat=((pat & 0xF0F0F0F0) >> 4) | ((pat & 0x0F0F0F0F) << 4);
+ pat=((pat & 0xFF00FF00) >> 8) | ((pat & 0x00FF00FF) << 8);
+ pat=((pat & 0xFFFF0000) >> 16) | ((pat & 0x0000FFFF) << 16);
+#endif
+
TDFXClearState(pScrn);
pTDFX->Cmd = (TDFXROPCvt[rop]<<24) | SST_2D_STIPPLE_LINE;
@@ -695,7 +745,11 @@ TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
TDFXMakeRoom(pTDFX, 3);
DECLARE(SSTCP_COLORFORE|SSTCP_COLORBACK|SSTCP_LINESTIPPLE);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, pat);
+#else
TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, *(int *)pattern);
+#endif
TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg);
TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg);
}
@@ -720,6 +774,7 @@ TDFXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
TDFXSubsequentSolidTwoPointLine(pScrn, x1, y1, x2, y2, flags);
}
+#ifdef ENABLE_SS_COLOR_EXPAND_FILL
static void
TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
int rop, unsigned int planemask)
@@ -773,9 +828,11 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y,
SSTCP_DSTSIZE|SSTCP_DSTXY|SSTCP_COMMAND |
SSTCP_CLIP1MIN|SSTCP_CLIP1MAX);
TDFXWriteLong(pTDFX,SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX,SST_2D_CLIP1MIN, (x&0x1FFF) | ((y&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_CLIP1MAX, ((x+w)&0x1FFF) | (((y+h)&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_SRCFORMAT, pTDFX->stride);
+ pTDFX->sst2DSrcFmtShadow = pTDFX->stride;
TDFXWriteLong(pTDFX,SST_2D_SRCXY, (srcx&0x1FFF) | ((srcy&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_DSTSIZE, ((w+offset)&0x1FFF) | ((h&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_DSTXY, ((x-offset)&0x1FFF) | ((y&0x1FFF)<<16));
@@ -783,6 +840,7 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y,
pTDFX->prevBlitDest.y1=y;
}
+#endif
static void
TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
@@ -834,9 +892,16 @@ TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y,
SSTCP_DSTFORMAT|SSTCP_DSTSIZE|SSTCP_SRCXY|
SSTCP_DSTXY|SSTCP_COMMAND);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_CLIP1MIN, ((y&0x1FFF)<<16)|(x&0x1FFF));
TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, (((y+h)&0x1FFF)<<16)|((x+w)&0x1FFF));
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* bit 20 byte swizzle */
+ TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF | BIT(20));
+#else
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF);
+#endif
+ pTDFX->sst2DSrcFmtShadow = (((w+31)/32)*4) & 0x3FFF;
TDFXWriteLong(pTDFX, SST_2D_SRCXY, skipleft&0x1F);
TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, ((w-skipleft)&0x1FFF)|((h&0x1FFF)<<16));
TDFXWriteLong(pTDFX, SST_2D_DSTXY, ((x+skipleft)&0x1FFF) | ((y&0x1FFF)<<16));
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 c44a22899..f0a97a3b8 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.5 2001/01/13 00:06:29 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.6 2001/03/21 17:02:26 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -170,10 +170,8 @@ TDFX_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h,
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
int ydir = (srcy < dsty) ? -1 : 1;
- (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir,
- GXcopy, ~0, -1);
- (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy,
- dstx, dsty, w, h);
+ (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1);
+ (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, 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 171be47da..82309f52d 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.17 2000/12/21 12:22:57 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.19 2001/03/21 17:02:26 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -16,20 +16,20 @@
static char TDFXKernelDriverName[] = "tdfx";
static char TDFXClientDriverName[] = "tdfx";
-static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
+static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
drmContext hwContext, void *pVisualConfigPriv,
DRIContextType contextStore);
static void TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext,
DRIContextType contextStore);
-static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
- DRIContextType readContextType,
+static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType readContextType,
void *readContextStore,
- DRIContextType writeContextType,
+ DRIContextType writeContextType,
void *writeContextStore);
static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen);
static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen);
static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
-static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
static void TDFXDRITransitionTo2d(ScreenPtr pScreen);
static void TDFXDRITransitionTo3d(ScreenPtr pScreen);
@@ -65,7 +65,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
xfree(pTDFXConfigs);
return FALSE;
}
- for (i=0; i<numConfigs; i++)
+ for (i=0; i<numConfigs; i++)
pTDFXConfigPtrs[i] = &pTDFXConfigs[i];
i=0;
@@ -104,7 +104,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
if (depth) {
if (pTDFX->cpp>2)
pConfigs[i].depthSize = 24;
- else
+ else
pConfigs[i].depthSize = 16;
} else {
pConfigs[i].depthSize = 0;
@@ -158,7 +158,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
return FALSE;
}
- for (i = 0; i < numConfigs; i++)
+ for (i = 0; i < numConfigs; i++)
pTDFXConfigPtrs[i] = &pTDFXConfigs[i];
i=0;
@@ -199,7 +199,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
if (depth) {
if (pTDFX->cpp > 2)
pConfigs[i].depthSize = 24;
- else
+ else
pConfigs[i].depthSize = 16;
} else {
pConfigs[i].depthSize = 0;
@@ -249,7 +249,7 @@ TDFXDoWakeupHandler(int screenNum, pointer wakeupData, unsigned long result,
TDFXNeedSync(pScrn);
}
-static void
+static void
TDFXDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
pointer pReadmask)
{
@@ -280,7 +280,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
case 32:
if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "DRI requires Voodoo3 or later, disabling DRI.\n");
+ "DRI requires Voodoo4/5 in 32 bpp mode, disabling DRI.\n");
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "To use DRI, invoke the server using 16 bpp (depth 16).\n");
return FALSE;
}
}
@@ -300,9 +302,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
{
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
- if (major != 3 || minor != 1 || patch < 0) {
+ if (major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n",
+ "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n",
major, minor, patch);
return FALSE;
}
@@ -343,10 +345,10 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->maxDrawableTableEntry = TDFX_MAX_DRAWABLES;
#ifdef NOT_DONE
- /* FIXME need to extend DRI protocol to pass this size back to client
+ /* FIXME need to extend DRI protocol to pass this size back to client
* for SAREA mapping that includes a device private record
*/
- pDRIInfo->SAREASize =
+ pDRIInfo->SAREASize =
((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */
/* + shared memory device private rec */
#else
@@ -381,6 +383,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->TransitionTo3d = TDFXDRITransitionTo3d;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->createDummyCtx = FALSE;
+ pDRIInfo->createDummyCtxPriv = FALSE;
+
if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) {
xfree(pDRIInfo->devPrivate);
pDRIInfo->devPrivate=0;
@@ -396,8 +401,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
drmVersionPtr version = drmGetVersion(pTDFX->drmSubFD);
if (version) {
if (version->version_major != 1 ||
- version->version_minor != 0 ||
- version->version_patchlevel < 0) {
+ version->version_minor < 0) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"TDFXDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n",
@@ -413,7 +417,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
}
pTDFXDRI->regsSize=TDFXIOMAPSIZE;
- if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0],
+ if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0],
pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) {
TDFXDRICloseScreen(pScreen);
xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap failed, disabling DRI.\n");
@@ -453,7 +457,7 @@ TDFXDRICloseScreen(ScreenPtr pScreen)
}
static Bool
-TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
+TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
drmContext hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
@@ -461,7 +465,7 @@ TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
}
static void
-TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext,
+TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext,
DRIContextType contextStore)
{
}
@@ -489,11 +493,12 @@ TDFXDRIFinishScreenInit(ScreenPtr pScreen)
pTDFXDRI->fbOffset=pTDFX->fbOffset;
pTDFXDRI->backOffset=pTDFX->backOffset;
pTDFXDRI->depthOffset=pTDFX->depthOffset;
+ pTDFXDRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
return DRIFinishScreenInit(pScreen);
}
static void
-TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
DRIContextType newContextType, void *newContext)
{
@@ -515,10 +520,10 @@ TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
TDFXSetupForSolidFill(pScrn, 0, GXcopy, -1);
while (nbox--) {
TDFXSelectBuffer(pTDFX, TDFX_BACK);
- TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
+ TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
pbox->x2-pbox->x1, pbox->y2-pbox->y1);
TDFXSelectBuffer(pTDFX, TDFX_DEPTH);
- TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
+ TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
pbox->x2-pbox->x1, pbox->y2-pbox->y1);
pbox++;
}
@@ -528,7 +533,7 @@ TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
}
static void
-TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
@@ -571,11 +576,11 @@ TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
static Bool
TDFXDRIOpenFullScreen(ScreenPtr pScreen)
{
+#if 0
ScrnInfoPtr pScrn;
TDFXPtr pTDFX;
xf86DrvMsg(pScreen->myNum, X_INFO, "OpenFullScreen\n");
-#if 0
pScrn = xf86Screens[pScreen->myNum];
pTDFX=TDFXPTR(pScrn);
if (pTDFX->numChips>1) {
@@ -588,10 +593,10 @@ TDFXDRIOpenFullScreen(ScreenPtr pScreen)
static Bool
TDFXDRICloseFullScreen(ScreenPtr pScreen)
{
+#if 0
ScrnInfoPtr pScrn;
xf86DrvMsg(pScreen->myNum, X_INFO, "CloseFullScreen\n");
-#if 0
pScrn = xf86Screens[pScreen->myNum];
TDFXDisableSLI(pScrn);
#endif
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 7da92b83a..956b7e703 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h
@@ -1,9 +1,9 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.3 2000/02/15 07:13:43 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.5 2001/03/21 17:02:26 dawes Exp $ */
#ifndef _TDFX_DRI_
#define _TDFX_DRI_
-#include <xf86drm.h>
+#include "xf86drm.h"
typedef struct {
drmHandle regs;
@@ -22,6 +22,7 @@ typedef struct {
int depthOffset;
int textureOffset;
int textureSize;
+ unsigned int sarea_priv_offset;
} TDFXDRIRec, *TDFXDRIPtr;
#endif
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 bc9349c8e..f983ad097 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.64 2001/02/15 18:01:43 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.67 2001/04/05 21:29:17 dawes Exp $ */
/*
* Authors:
@@ -164,7 +164,6 @@ static PciChipsets TDFXPciChipsets[] = {
{ -1, -1, RES_UNDEFINED }
};
-/* !!! Do we want an option for PIO address space? !!! */
/* !!! Do we want an option for alternate clocking? !!! */
typedef enum {
@@ -492,7 +491,10 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
/* set memory interface delay values and enable refresh */
/* these apply to all RAM vendors */
dramInit1 = 0x0;
- dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
+ if (pTDFX->ChipType==PCI_CHIP_BANSHEE)
+ dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
+ else
+ dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
dramInit1 |= SST_SGRAM_CLK_NODELAY;
dramInit1 |= SST_DRAM_REFRESH_EN;
dramInit1 |= (0x18 << SST_DRAM_REFRESH_VALUE_SHIFT) & SST_DRAM_REFRESH_VALUE;
@@ -544,11 +546,13 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
return memSize*1024;
}
+#if 0
static int TDFXCfgToSize(int cfg)
{
if (cfg<4) return 0x8000000<<cfg;
return 0x4000000>>(cfg-4);
}
+#endif
static int TDFXSizeToCfg(int size)
{
@@ -594,28 +598,31 @@ static void
TDFXInitChips(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
- int i, cfgbits, initbits;
+ int i, v, cfgbits, initbits;
int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits;
pTDFX=TDFXPTR(pScrn);
cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE);
mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE);
mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE);
+ initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE);
mem0size=32*1024*1024; /* Registers are always 32MB */
mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */
mem0bits=TDFXSizeToCfg(mem0size);
mem1bits=TDFXSizeToCfg(mem1size)<<4;
cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits;
for (i=0; i<pTDFX->numChips; i++) {
- initbits=pciReadLong(pTDFX->PciTag[i], CFG_INIT_ENABLE);
initbits|=BIT(10);
pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits);
+ v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
+ if (!i)
+ pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3);
+ else
+ pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2);
pTDFX->MMIOAddr[i]=mem0base+i*mem0size;
- pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, 0xFFFFFFFF);
pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]);
pTDFX->MMIOAddr[i]&=0xFFFFFF00;
pTDFX->LinearAddr[i]=mem1base+i*mem1size;
- pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, 0xFFFFFFFF);
pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]);
pTDFX->LinearAddr[i]&=0xFFFFFF00;
pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits);
@@ -655,10 +662,12 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pTDFX->initDone=FALSE;
pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+#if !defined(__powerpc__)
if (flags & PROBE_DETECT) {
TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
return TRUE;
}
+#endif
if (pTDFX->pEnt->location.type != BUS_PCI) return FALSE;
@@ -670,6 +679,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
/* Allocate a vgaHWRec */
if (!vgaHWGetHWRec(pScrn)) return FALSE;
+#if !defined(__powerpc__)
if (xf86LoadSubModule(pScrn, "int10")) {
xf86Int10InfoPtr pInt;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -687,6 +697,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
xf86FreeInt10(pInt);
}
}
+#endif
match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index);
TDFXFindChips(pScrn, match);
@@ -747,9 +758,17 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- if (!xf86SetDefaultVisual (pScrn, -1)) {
+ if (!xf86SetDefaultVisual(pScrn, -1)) {
return FALSE;
- }
+ } else {
+ /* We don't currently support DirectColor at > 8bpp */
+ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
+ " (%s) is not supported at depth %d\n",
+ xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ return FALSE;
+ }
+ }
/* We use a programamble clock */
pScrn->progClock = TRUE;
@@ -939,17 +958,23 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL);
- pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE);
- if (!pTDFX->NoAccel) {
+ if (!xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE)) {
if (!xf86LoadSubModule(pScrn, "xaa")) {
TDFXFreeRec(pScrn);
return FALSE;
}
}
- if (xf86ReturnOptValBool(TDFXOptions, OPTION_SHOWCACHE, FALSE)) {
- pTDFX->ShowCache = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n");
+ if (!xf86GetOptValBool(TDFXOptions, OPTION_SHOWCACHE, &(pTDFX->ShowCache))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache %s\n", pTDFX->ShowCache ? "Enabled" : "Disabled");
+ } else {
+ pTDFX->ShowCache = FALSE;
+ }
+
+ if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pTDFX->videoKey);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key default 0x%x\n", pTDFX->videoKey = 0x1E);
}
if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) {
@@ -967,6 +992,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(ramdacSymbols, NULL);
}
+#if !defined(__powerpc__)
/* Load DDC if needed */
/* This gives us DDC1 - we should be able to get DDC2B using i2c */
if (!xf86LoadSubModule(pScrn, "ddc")) {
@@ -981,11 +1007,42 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pMon = vbeDoEDID(VBEInit(NULL,pTDFX->pEnt->index), NULL);
xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon));
}
+#endif
if (xf86ReturnOptValBool(TDFXOptions, OPTION_USE_PIO, FALSE)) {
pTDFX->usePIO=TRUE;
}
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ pTDFX->ModeReg.miscinit0 = pTDFX->readLong(pTDFX, MISCINIT0);
+ pTDFX->SavedReg.miscinit0 = pTDFX->ModeReg.miscinit0;
+
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ pTDFX->writeFifo = TDFXWriteFifo_8;
+ pTDFX->ModeReg.miscinit0 &= ~BIT(30); /* LFB byte swizzle */
+ pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */
+ break;
+ case 15:
+ case 16:
+ pTDFX->writeFifo = TDFXWriteFifo_16;
+ pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */
+ pTDFX->ModeReg.miscinit0 |= BIT(31); /* LFB word swizzle */
+ break;
+ case 24:
+ case 32:
+ pTDFX->writeFifo = TDFXWriteFifo_24;
+ pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */
+ pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */
+ break;
+ default:
+ return FALSE;
+ break;
+ }
+ pTDFX->writeLong(pTDFX, MISCINIT0, pTDFX->ModeReg.miscinit0);
+#endif
+
+
return TRUE;
}
@@ -1038,6 +1095,7 @@ TDFXUnmapMem(ScrnInfoPtr pScrn)
return TRUE;
}
+#ifdef DEBUG
static void
PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs)
{
@@ -1093,6 +1151,7 @@ PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs)
#endif
#endif
}
+#endif
/*
* TDFXSave --
@@ -1106,6 +1165,7 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
{
TDFXPtr pTDFX;
vgaHWPtr hwp;
+ int i, dummy, count;
TDFXTRACE("TDFXDoSave start\n");
pTDFX = TDFXPTR(pScrn);
@@ -1136,6 +1196,14 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
tdfxReg->clip1max=TDFXReadLongMMIO(pTDFX, SST_2D_CLIP1MAX);
tdfxReg->srcbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_SRCBASEADDR);
tdfxReg->dstbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_DSTBASEADDR);
+ for (i=0; i<512; i++) {
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACADDR, i);
+ dummy=TDFXReadLongMMIO(pTDFX, DACADDR);
+ } while (count++<100 && dummy!=i);
+ tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA);
+ }
}
static void
@@ -1155,6 +1223,7 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
Bool restoreFonts) {
TDFXPtr pTDFX;
vgaHWPtr hwp;
+ int i, dummy, count;
TDFXTRACE("TDFXDoRestore start\n");
pTDFX = TDFXPTR(pScrn);
@@ -1182,11 +1251,25 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MIN, tdfxReg->clip1min);
TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MAX, tdfxReg->clip1max);
pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ pTDFX->writeLong(pTDFX, MISCINIT0, tdfxReg->miscinit0);
+#endif
pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg);
TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr);
TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr);
-
vgaHWProtect(pScrn, FALSE);
+ for (i=0; i<512; i++) {
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACADDR, i);
+ dummy=TDFXReadLongMMIO(pTDFX, DACADDR);
+ } while (count++<100 && dummy!=i);
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACDATA, tdfxReg->dactable[i]);
+ dummy=TDFXReadLongMMIO(pTDFX, DACDATA);
+ } while (count++<100 && dummy!=tdfxReg->dactable[i]);
+ }
pTDFX->sync(pScrn);
}
@@ -1429,6 +1512,7 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
int hd, hbs, hss, hse, hbe, ht, hskew;
Bool dbl;
+ hd = hbs = hss = hse = hbe = ht = hskew = 0;
hwp = VGAHWPTR(pScrn);
pTDFX = TDFXPTR(pScrn);
@@ -1489,35 +1573,35 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
static void
TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
- short visualClass) {
+ VisualPtr pVisual) {
TDFXPtr pTDFX;
int i, j, index, v, repeat, max;
TDFXTRACE("TDFXLoadPalette16 start\n");
pTDFX = TDFXPTR(pScrn);
+
for (i=0; i<numColors; i++) {
index=indices[i];
v=(colors[index/2].red<<16)|(colors[index].green<<8)|colors[index/2].blue;
- if (i<numColors-1) max=indices[i+1]<<2;
- else max=256;
- for (j=index<<2; j<max; j++) {
+ max=min((index+1)<<2, 256);
+ for (j = index<<2; j < max; j++)
+ {
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACADDR, j);
- } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=j);
+ TDFXWriteLongMMIO(pTDFX, DACADDR, j);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j);
if (!repeat) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, "
- "bypassing CLUT\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, bypassing CLUT\n");
pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS;
return;
}
+
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACDATA, v);
- } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v);
+ TDFXWriteLongMMIO(pTDFX, DACDATA, v);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v);
if (!repeat) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, "
- "bypassing CLUT\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, bypassing CLUT\n");
pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS;
return;
}
@@ -1527,7 +1611,7 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
static void
TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
- short visualClass) {
+ VisualPtr pVisual) {
TDFXPtr pTDFX;
int i, index, v, repeat;
@@ -1538,8 +1622,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
v=(colors[index].red<<16)|(colors[index].green<<8)|colors[index].blue;
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACADDR, index);
- } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=index);
+ TDFXWriteLongMMIO(pTDFX, DACADDR, index);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=index);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, "
"bypassing CLUT\n");
@@ -1548,8 +1632,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
}
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACDATA, v);
- } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v);
+ TDFXWriteLongMMIO(pTDFX, DACDATA, v);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, "
"bypassing CLUT\n");
@@ -1593,6 +1677,7 @@ calcBufferHeightInTiles(int yres)
} /* calcBufferHeightInTiles */
+#if 0
static int
calcBufferSizeInTiles(int xres, int yres, int cpp) {
int bufSizeInTiles; /* Size of buffer in tiles */
@@ -1603,6 +1688,7 @@ calcBufferSizeInTiles(int xres, int yres, int cpp) {
return bufSizeInTiles;
} /* calcBufferSizeInTiles */
+#endif
static int
calcBufferSize(int xres, int yres, Bool tiled, int cpp)
@@ -1625,7 +1711,7 @@ calcBufferSize(int xres, int yres, Bool tiled, int cpp)
static void allocateMemory(ScrnInfoPtr pScrn) {
TDFXPtr pTDFX;
- int memRemaining, fifoSize, screenSizeInTiles;
+ int memRemaining, fifoSize, screenSizeInTiles, cursorSize;
pTDFX = TDFXPTR(pScrn);
@@ -1646,7 +1732,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
/* it to be on an *odd* page boundary. */
pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF;
if ((pTDFX->depthOffset & (0x1 << 12)) == 0) {
-#if 0
+#if 1
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Changing depth offset from 0x%08x to 0x%08x\n",
pTDFX->depthOffset,
@@ -1658,7 +1744,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
/* to be on an *even* page boundary. */
pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF;
if (pTDFX->backOffset & (0x1 << 12)) {
-#if 0
+#if 1
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Changing back offset from 0x%08x to 0x%08x\n",
pTDFX->backOffset,
@@ -1670,8 +1756,9 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
/* CMDFIFO_PAGES pages, but no more than */
/* 255. We give 4096 bytes to the cursor */
fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12;
+ cursorSize = 4096;
pTDFX->cursorOffset = 0;
- pTDFX->fifoOffset = 4096;
+ pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize;
pTDFX->fifoSize = fifoSize;
/* Now, place the front buffer, forcing */
/* it to be on a page boundary too, just */
@@ -1684,21 +1771,21 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
if (pTDFX->texSize < 0) {
pTDFX->backOffset = -1;
pTDFX->depthOffset = -1;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available."
- " Disabling direct rendering.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available, disabling DRI\n");
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n",
(float)pTDFX->texSize/1024.0/1024.0);
}
-#if 0
+
+#if 1
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Cursor Offset: [0x%08X,0x%08X)\n",
pTDFX->cursorOffset,
- pTDFX->cursorOffset+1024);
+ pTDFX->cursorOffset + cursorSize);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Fifo Offset: [0x%08X, 0x%08X)\n",
pTDFX->fifoOffset,
- pTDFX->fifoOffset+fifoSize);
+ pTDFX->fifoOffset + pTDFX->fifoSize);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Texture Offset: [0x%08X, 0x%08X)\n",
pTDFX->texOffset,
@@ -1711,11 +1798,11 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"BackOffset: [0x%08X, 0x%08X)\n",
pTDFX->backOffset,
- pTDFX->backOffset+screenSizeInTiles);
+ pTDFX->backOffset + screenSizeInTiles);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"DepthOffset: [0x%08X, 0x%08X)\n",
pTDFX->depthOffset,
- pTDFX->depthOffset+screenSizeInTiles);
+ pTDFX->depthOffset + screenSizeInTiles);
#endif /* 0/1 */
}
@@ -1745,7 +1832,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1)/pTDFX->stride;
allocateMemory(pScrn);
-
+#if 0
if (pTDFX->numChips>1) {
if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) {
TDFXSetupSLI(pScrn, FALSE, 0);
@@ -1753,13 +1840,14 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
TDFXSetupSLI(pScrn, TRUE, 0);
}
}
+#endif
TDFXSetLFBConfig(pTDFX);
/* We initialize in the state that our FIFO is up to date */
pTDFX->syncDone=TRUE;
if (!TDFXInitFifo(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize fifo\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n");
return FALSE;
}
@@ -1778,7 +1866,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"%i lines of offscreen memory available for 2D and video\n",
pTDFX->pixmapCacheLinesMax);
-
MemBox.y1 = 0;
MemBox.x1 = 0;
@@ -1798,6 +1885,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
miSetPixmapDepths ();
+ pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE);
#ifdef XF86DRI
/*
* Setup DRI after visuals have been established, but before fbScreenInit
@@ -1805,12 +1893,9 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
* InitGLXVisuals call back.
*/
if (!pTDFX->NoAccel) {
- if ( !((pTDFX->backOffset == -1) && (pTDFX->depthOffset == -1))) {
+ if ((pTDFX->backOffset != -1) && (pTDFX->depthOffset != -1)) {
pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen);
}
- /* Force the initialization of the context */
- if (pTDFX->directRenderingEnabled)
- TDFXLostContext(pScreen);
}
#endif
@@ -1905,6 +1990,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
}
#endif
+
#ifdef XvExtension
/* Initialize Xv support */
TDFXInitVideo (pScreen);
@@ -1941,6 +2027,10 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) {
TDFXTRACE("TDFXAdjustFrame start\n");
pScrn = xf86Screens[scrnIndex];
pTDFX = TDFXPTR(pScrn);
+
+ if (pTDFX->ShowCache && y && pScrn->vtSema)
+ y += pScrn->virtualY - 1;
+
tdfxReg = &pTDFX->ModeReg;
if(pTDFX->ShowCache && y && pScrn->vtSema)
y += pScrn->virtualY - 1;
@@ -1952,19 +2042,20 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) {
static Bool
TDFXEnterVT(int scrnIndex, int flags) {
ScrnInfoPtr pScrn;
-#ifdef XF86DRI
ScreenPtr pScreen;
+#ifdef XF86DRI
TDFXPtr pTDFX;
#endif
TDFXTRACE("TDFXEnterVT start\n");
pScrn = xf86Screens[scrnIndex];
+ pScreen = screenInfo.screens[scrnIndex];
+ TDFXInitFifo(pScreen);
#ifdef XF86DRI
pTDFX = TDFXPTR(pScrn);
if (pTDFX->directRenderingEnabled) {
pScreen = screenInfo.screens[scrnIndex];
DRIUnlock(pScreen);
- TDFXLostContext(pScreen);
}
#endif
if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE;
@@ -1977,9 +2068,7 @@ TDFXLeaveVT(int scrnIndex, int flags) {
ScrnInfoPtr pScrn;
vgaHWPtr hwp;
ScreenPtr pScreen;
-#ifdef XF86DRI
TDFXPtr pTDFX;
-#endif
TDFXTRACE("TDFXLeaveVT start\n");
pScrn = xf86Screens[scrnIndex];
@@ -1987,8 +2076,10 @@ TDFXLeaveVT(int scrnIndex, int flags) {
TDFXRestore(pScrn);
vgaHWLock(hwp);
pScreen = screenInfo.screens[scrnIndex];
-#ifdef XF86DRI
pTDFX = TDFXPTR(pScrn);
+ pTDFX->sync(pScrn);
+ TDFXShutdownFifo(pScreen);
+#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
DRILock(pScreen, 0);
TDFXSwapContextFifo(pScreen);
@@ -2041,7 +2132,6 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen)
pTDFX->adaptor = NULL;
}
-
pScrn->vtSema=FALSE;
pScreen->BlockHandler = pTDFX->BlockHandler;
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 db003c805..1cf277289 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.3 2000/02/15 07:13:43 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.4 2001/04/05 21:29:17 dawes Exp $ */
/*
Voodoo Banshee driver version 1.0.2
@@ -14,7 +14,6 @@
#include "tdfx.h"
-void TDFXCursorGrabMemory(ScreenPtr pScreen);
static void TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
static void TDFXShowCursor(ScrnInfoPtr pScrn);
static void TDFXHideCursor(ScrnInfoPtr pScrn);
@@ -37,7 +36,11 @@ TDFXCursorInit(ScreenPtr pScreen)
infoPtr->MaxWidth = 64;
infoPtr->MaxHeight = 64;
- infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST|
+
+ infoPtr->Flags =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+#endif
HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK|
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
@@ -54,6 +57,21 @@ TDFXCursorInit(ScreenPtr pScreen)
return xf86InitCursor(pScreen, infoPtr);
}
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+static unsigned int TDFXSwap(TDFXPtr pTDFX, unsigned int val) {
+ switch (pTDFX->cpp) {
+ case 1:
+ return val;
+ case 2:
+ return ((val & 0x00ff00ff) << 8) |
+ ((val & 0xff00ff00) >> 8);
+ case 3:
+ case 4:
+ return BE_BSWAP32(val);
+ }
+}
+#endif
+
static void
TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
@@ -61,7 +79,19 @@ TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
TDFXTRACECURS("TDFXLoadCursorImage start\n");
pTDFX = TDFXPTR(pScrn);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ {
+ int i;
+ unsigned int *ptr=(unsigned int *)(pTDFX->FbBase+pTDFX->cursorOffset);
+
+ for (i=0; i<256; i++) {
+ unsigned int val = ((unsigned int *)src)[i];
+ *ptr++ = TDFXSwap(pTDFX, val);
+ }
+ }
+#else
memcpy(pTDFX->FbBase+pTDFX->cursorOffset, src, 1024);
+#endif
}
static void
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
index 0bb5a1b3b..5de08d7ab 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
@@ -24,7 +24,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_io.c,v 1.6 2000/08/25 16:25:36 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.7 2001/04/05 21:29:17 dawes Exp $ */
/*
* Authors:
@@ -54,11 +54,11 @@ static char TDFXReadControlPIO(TDFXPtr pTDFX, int addr, char index) {
return inb(pTDFX->PIOBase[0]+addr+1);
}
-void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) {
+static void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) {
outl(pTDFX->PIOBase[chip]+addr, val);
}
-int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) {
+static int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) {
return inl(pTDFX->PIOBase[chip]+addr);
}
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 58e49d1cf..a90e130a5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.13 2000/12/15 15:19:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.15 2001/04/05 21:29:17 dawes Exp $ */
#include "xf86.h"
@@ -11,16 +11,37 @@
/*
Memory layout of card is as follows:
- 000000-003fff: Cursor
- 001000-xxxxxx: Fifo (Min of CMDFIFO pages)
- xxxxxx-420fff: Texture maps
- 421000- A-1 : Framebuffer
- A - B-1 : Offscreen pixmaps
- B - C-1 : Back buffer
- C - D-1 : Z buffer
+ 000000-00ffff: VGA memory
+ 010000-013fff: Cursor
+ 011000-xxxxxx: Fifo (Min of CMDFIFO pages)
+ xxxxxx- A-1 : Front Buffer (framebuffer)
+ A - B-1 : Pixmap Cache (framebuffer)
+ B - C-1 : Texture Memory
+ C - D-1 : Back Buffer
+ D - E-1 : Depth Buffer
+
+ NB: pixmap cache usually butts right up against texture memory. when
+ 3d is disabled (via Transition2D) then the pixmap cache is increased
+ to overlap the texture memory. maximum pixmap cache of 4095 lines on
+ voodoo5 and 2048 on voodoo3/4 applies.
*/
-void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn)
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+void TDFXWriteFifo_24(TDFXPtr pTDFX, int val) {
+ *pTDFX->fifoPtr++ = val;
+}
+
+void TDFXWriteFifo_16(TDFXPtr pTDFX, int val) {
+ *pTDFX->fifoPtr++ = BE_WSWAP32(val);
+}
+
+void TDFXWriteFifo_8(TDFXPtr pTDFX, int val) {
+ *pTDFX->fifoPtr++ = BE_BSWAP32(val);
+}
+#endif
+
+
+static void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
@@ -30,7 +51,7 @@ void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn)
WRITE_FIFO(pTDFX, 0, 0);
}
-void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn)
+static void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
@@ -50,7 +71,7 @@ void TDFXSendNOPFifo(ScrnInfoPtr pScrn)
TDFXSendNOPFifo3D(pScrn);
}
-void InstallFifo(ScrnInfoPtr pScrn)
+static void InstallFifo(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
@@ -78,7 +99,7 @@ void InstallFifo(ScrnInfoPtr pScrn)
TDFXSendNOPFifo(pScrn);
}
-void TDFXResetFifo(ScrnInfoPtr pScrn)
+static void TDFXResetFifo(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
int oldValue;
@@ -117,9 +138,9 @@ void TDFXResetFifo(ScrnInfoPtr pScrn)
static void TDFXSyncFifo(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
- int i, cnt;
+ int i, cnt, resets=0;
int stat;
- long start_sec, end_sec, dummy;
+ long start_sec, end_sec, dummy, readptr;
TDFXTRACEACCEL("TDFXSyncFifo start\n");
pTDFX=TDFXPTR(pScrn);
@@ -127,7 +148,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn)
i=0;
cnt=0;
start_sec=0;
+ readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0);
do {
+ readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0);
stat=TDFXReadLongMMIO(pTDFX, 0);
if (stat&SST_BUSY) i=0; else i++;
cnt++;
@@ -137,7 +160,17 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn)
} else {
getsecs(&end_sec, &dummy);
if (end_sec-start_sec>3) {
- TDFXResetFifo(pScrn);
+ dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0);
+ if (dummy==readptr) {
+ TDFXResetFifo(pScrn);
+ readptr=dummy;
+ resets++;
+ if (resets==3) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Board is not responding.\n");
+ return;
+ }
+ }
start_sec=0;
}
}
@@ -237,24 +270,6 @@ void TDFXSwapContextFifo(ScreenPtr pScreen)
pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8;
}
-void TDFXLostContext(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn;
- TDFXPtr pTDFX;
- TDFXSAREAPriv *sPriv;
-
- pScrn = xf86Screens[pScreen->myNum];
- pTDFX=TDFXPTR(pScrn);
- sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen);
- if (!sPriv) return;
- if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) ||
- sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) {
- sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase);
- sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase);
- sPriv->fifoOwner=DRIGetContext(pScreen);
- /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */
- }
-}
#endif
static void
@@ -285,8 +300,13 @@ TDFXMakeSpace(TDFXPtr pTDFX, uint32 slots)
/*
** Put a jump command in command fifo to wrap to the beginning.
*/
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ WRITE_FIFO(pTDFX, 0, (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT |
+ SSTCP_PKT0_JMP_LOCAL);
+#else
*pTDFX->fifoPtr = (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT |
SSTCP_PKT0_JMP_LOCAL;
+#endif
FLUSH_WCB();
/*
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 d7fd4dfa3..1e533baa6 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.7 2000/12/15 15:19:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.9 2001/04/05 21:29:17 dawes Exp $ */
#ifndef _TDFX_FIFO_H_
@@ -11,7 +11,7 @@ typedef int int32;
typedef short int16;
typedef char int8;
-#define CMDFIFO_PAGES 64
+#define CMDFIFO_PAGES 255
#define PROPSAREADATA \
volatile int fifoPtr; \
@@ -87,6 +87,24 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
if ((pTDFX->fifoSlots -= (_n)) < 0) \
cmdfifo_make_room(adapter, fifo_ptr, _n); \
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define BE_BSWAP32(val) ((((val) & 0x000000ff) << 24) | \
+ (((val) & 0x0000ff00) << 8) | \
+ (((val) & 0x00ff0000) >> 8) | \
+ (((val) & 0xff000000) >> 24))
+
+#define BE_WSWAP32(val) ((((val) & 0x0000ffff) << 16) | \
+ (((val) & 0xffff0000) >> 16))
+ void TDFXWriteFifo_24(TDFXPtr pTDFX, int val);
+ void TDFXWriteFifo_16(TDFXPtr pTDFX, int val);
+ void TDFXWriteFifo_8(TDFXPtr pTDFX, int val);
+#else
+/* Don't swap on little-endian platforms */
+#define BE_BSWAP32(val) val
+#define BE_WSWAP32(val) val
+#endif
+
+
#ifdef DEBUG_FIFO
#define WRITE_FIFO(ptr, loc, _val) \
do { \
@@ -94,19 +112,30 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
*pTDFX->fifoPtr++ = _val; \
} while(0)
#else
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define WRITE_FIFO(ptr, loc, _val) \
+ do { \
+ pTDFX->writeFifo(ptr, _val); \
+ } while (0)
+#else
#define WRITE_FIFO(ptr, loc, _val) \
do { \
*pTDFX->fifoPtr++ = _val; \
} while(0)
-#endif
+#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */
+#endif /* DEBUG_FIFO */
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define FLUSH_WCB()
+#else
#define FLUSH_WCB() inb(0x80)
+#endif
/*
** Send a packet header type 1 (2D) to the cmdfifo
*/
#define SET_2DPK1_HEADER(_ndwords, _inc, _reg) \
- WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
+ WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \
SSTCP_PKT1_2D | \
FIELD_OFFSET(H3_2D_REGISTERS, _reg)/4 << SSTCP_REGBASE_SHIFT | \
@@ -117,7 +146,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
** Send a packet header type 1 to begin at launchArea[0] to the cmdfifo
*/
#define SET_PK1_HEADER_LAUNCH(_ndwords, _inc) \
- WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
+ WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \
SSTCP_PKT1_LAUNCH | SSTCP_PKT1 \
)
@@ -126,7 +155,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
** Send a packet header type 1 to begin at colorPattern[0] to the cmdfifo
*/
#define SET_PK1_HEADER_COLORPATTERN(_ndwords, _inc) \
- WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
+ WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \
((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \
SSTCP_PKT1_COLORPATTERN | SSTCP_PKT1 \
)
@@ -135,7 +164,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
** Send a packet header type 2 to the cmdfifo
*/
#define SET_PKT2_HEADER(_mask) \
- WRITE_FIFO (0, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2)
+ WRITE_FIFO (pTDFX, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2)
/*
** These are used to select a register mask for use with
@@ -159,14 +188,14 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots);
#define R13 (1 << 13)
#define SET_2DPK4_HEADER(_mask, _reg0) \
- WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \
+ WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \
SSTCP_PKT4_2D | \
(_reg0) | \
SSTCP_PKT4 \
)
#define SET_3DPK4_HEADER(_mask, _reg0) \
- WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \
+ WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \
(_reg0) | \
SSTCP_PKT4 \
)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
index 4f784ca27..803a0db38 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.6 2000/12/15 15:19:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.7 2001/03/21 17:02:26 dawes Exp $ */
#include "xf86.h"
#include "xf86_ansic.h"
@@ -12,7 +12,7 @@
/* #define RD_ABORT_ERROR */
#define H3VDD
-static Bool TDFXDisableSLI(TDFXPtr pTDFX)
+Bool TDFXDisableSLI(TDFXPtr pTDFX)
{
int i;
int v;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c
index 472bd0bb7..41f781c43 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.9 2001/01/25 02:20:34 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.10 2001/04/05 21:29:17 dawes Exp $ */
#include "xf86.h"
#include "tdfx.h"
@@ -436,12 +436,23 @@ TDFXCopyData(
int h,
int w
){
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ w >>= 1;
+ while(h--) {
+ int i;
+ for (i=0; i<w; i++)
+ ((unsigned long *)dst)[i]=BE_WSWAP32(((unsigned long *)src)[i]);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+#else
w <<= 1;
while(h--) {
memcpy(dst, src, w);
src += srcPitch;
dst += dstPitch;
}
+#endif
}
static void
@@ -467,15 +478,20 @@ TDFXCopyMungedData(
s1 = src1; s2 = src2; s3 = src3;
i = w;
while(i > 4) {
- dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24);
- dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24);
- dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24);
- dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24);
+ dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) |
+ (s2[0] << 24));
+ dst[1] = BE_WSWAP32(s1[2] | (s1[3] << 16) | (s3[1] << 8) |
+ (s2[1] << 24));
+ dst[2] = BE_WSWAP32(s1[4] | (s1[5] << 16) | (s3[2] << 8) |
+ (s2[2] << 24));
+ dst[3] = BE_WSWAP32(s1[6] | (s1[7] << 16) | (s3[3] << 8) |
+ (s2[3] << 24));
dst += 4; s2 += 4; s3 += 4; s1 += 8;
i -= 4;
}
while(i--) {
- dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24);
+ dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) |
+ (s2[0] << 24));
dst++; s2++; s3++;
s1 += 2;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
index f4ae7a125..8fbcf22eb 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.10 2000/12/20 01:30:47 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.12 2001/04/05 21:29:17 dawes Exp $ */
/*
Voodoo Banshee driver version 1.0.1
@@ -47,8 +47,10 @@
#define SST_DESKTOP_CLUT_BYPASS BIT(10)
#define SST_HALF_MODE BIT(4)
#define SST_CURSOR_EN BIT(27)
+#define SST_FBI_BUSY BIT(7)
#define SST_BUSY BIT(9)
#define SST_RETRACE BIT(6)
+#define SST_COMMANDEXTRA_VSYNC BIT(2)
#define MEM_TYPE_SGRAM 0
#define MEM_TYPE_SDRAM 1
@@ -195,14 +197,15 @@
/* 3D Registers */
#define SST_3D_OFFSET 0x200000
+#define SST_3D_LFBMODE SST_3D_OFFSET+0x114
#define SST_3D_COMMAND SST_3D_OFFSET+0x120
#define SST_3D_SLICTRL SST_3D_OFFSET+0x20C
#define SST_3D_AACTRL SST_3D_OFFSET+0x210
-#define SST_3D_CHIPMASK SST_3D_OFFSET+0x214
#define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250
#define SST_3D_RIGHTOVERLAYBUF SST_3D_OFFSET+0x254
/* NAPALM REGISTERS */
+#define CFG_PCI_COMMAND 4
#define CFG_MEM0BASE 16
#define CFG_MEM1BASE 20
#define CFG_INIT_ENABLE 64
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile
index 0d02108f2..694ceae09 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.15 2000/10/21 18:40:13 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.16 2001/03/19 11:00:54 alanh Exp $
XCOMM
XCOMM This is an Imakefile for the TGA driver.
XCOMM
@@ -14,7 +14,7 @@ INCLUDES = -I. -I../../include
#else
INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \
-I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
- -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \
+ -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \
-I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \
-I$(XF86SRC)/rac -I$(EXTINCSRC) \
-I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
index 52fdb941b..ccbe7bbd5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.11 2000/10/20 12:57:26 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.12 2001/03/19 11:00:54 alanh Exp $ */
/*
* Copyright 1996,1997 by Alan Hourihane, Wigan, England.
@@ -26,11 +26,7 @@
* DEC TGA accelerated options.
*/
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-
+#include "fb.h"
#include "micmap.h"
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c
index 9170e5069..b49eb7dc4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c
@@ -22,7 +22,7 @@
* Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
* Matthew Grossman, <mattg@oz.net> - acceleration and misc fixes
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.52 2001/02/15 11:03:58 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.53 2001/03/19 11:00:54 alanh Exp $ */
/* everybody includes these */
#include "xf86.h"
@@ -50,12 +50,7 @@
/* colormap manipulation */
#include "micmap.h"
-/* TGA only does 8 and 32 bpp */
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-
-#include "cfb32.h"
+#include "fb.h"
/* more RAC stuff */
#include "xf86RAC.h"
@@ -761,16 +756,7 @@ TGAPreInit(ScrnInfoPtr pScrn, int flags)
pTga->FbMapSize = pScrn->videoRam * 1024;
- /* Load bpp-specific modules */
- switch (pScrn->bitsPerPixel) {
- case 8:
- mod = "cfb";
- break;
- case 32:
- mod = "cfb32";
- break;
- }
- if (mod && xf86LoadSubModule(pScrn, mod) == NULL) {
+ if (mod && xf86LoadSubModule(pScrn, "fb") == NULL) {
TGAFreeRec(pScrn);
return FALSE;
}
@@ -1236,7 +1222,7 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* function. If not, the visuals will need to be setup before calling
* a fb ScreenInit() function and fixed up after.
*
- * For most PC hardware at depths >= 8, the defaults that cfb uses
+ * For most PC hardware at depths >= 8, the defaults that fb uses
* are not appropriate. In this driver, we fixup the visuals after.
*/
@@ -1264,6 +1250,8 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
+ miSetPixmapDepths ();
+
/*
* Call the framebuffer layer's ScreenInit function, and fill in other
* pScreen fields.
@@ -1271,14 +1259,12 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
switch (pScrn->bitsPerPixel) {
case 8:
- ret = cfbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
case 32:
- ret = cfb32ScreenInit(pScreen, pTga->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
+ ret = fbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX,
+ pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth, pScrn->bitsPerPixel);
+ if (ret)
+ fbPictureInit (pScreen, 0, 0);
break;
default:
xf86DrvMsg(scrnIndex, X_ERROR,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
index 17789443b..50bc6eff5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
@@ -21,7 +21,7 @@
*
* Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.35 2001/01/11 14:42:50 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.38 2001/04/04 12:46:35 alanh Exp $ */
#ifndef _TRIDENT_H_
#define _TRIDENT_H_
@@ -61,9 +61,6 @@ typedef struct {
CARD32 IOAddress;
unsigned long FbAddress;
unsigned char * IOBase;
-#ifdef __alpha__
- unsigned char * IOBaseDense;
-#endif
unsigned char * FbBase;
long FbMapSize;
Bool NoAccel;
@@ -109,6 +106,8 @@ typedef struct {
int w;
int y;
int lcdMode;
+ Bool lcdActive;
+ Bool doInit;
#ifdef READOUT
Bool DontSetClock;
#endif
@@ -143,7 +142,8 @@ typedef struct {
typedef struct {
CARD8 mode;
- char* display;
+ int display_x;
+ int display_y;
int clock;
int shadow_0;
int shadow_3;
@@ -254,7 +254,9 @@ typedef enum {
CYBERBLADEI1D,
CYBERBLADEAI1,
CYBERBLADEAI1D,
- CYBERBLADEE4
+ CYBERBLADEE4,
+ CYBERBLADEXP,
+ CYBERBLADEXPm
} TRIDENTType;
#define UseMMIO (pTrident->NoMMIO == FALSE)
@@ -280,7 +282,9 @@ typedef enum {
(pTrident->Chipset == CYBERBLADEI1D) || \
(pTrident->Chipset == CYBERBLADEAI1) || \
(pTrident->Chipset == CYBERBLADEAI1D) || \
- (pTrident->Chipset == BLADE3D))
+ (pTrident->Chipset == BLADE3D) || \
+ (pTrident->Chipset == CYBERBLADEXP) || \
+ (pTrident->Chipset == CYBERBLADEXPm))
/*
* Trident DAC's
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
index f0d85a00f..95db63a9c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
@@ -21,7 +21,7 @@
*
* Author: Alan Hourihane, alanh@fairlite.demon.co.uk
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.41 2001/02/15 17:59:07 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.42 2001/03/08 17:12:13 eich Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -147,12 +147,15 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
TRIDENTRegPtr pReg = &pTrident->ModeReg;
+
int vgaIOBase;
int offset = 0;
int clock = pTrident->currentClock;
CARD8 protect;
+ Bool fullSize = FALSE;
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr regp = &hwp->ModeReg;
vgaRegPtr vgaReg = &hwp->ModeReg;
vgaHWGetIOBase(VGAHWPTR(pScrn));
vgaIOBase = VGAHWPTR(pScrn)->IOBase;
@@ -210,7 +213,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->tridentRegs3CE[HorStretch] = INB(0x3CF);
OUTB(0x3CE,VertStretch);
pReg->tridentRegs3CE[VertStretch] = INB(0x3CF);
-
+
#ifdef READOUT
if ((!((pReg->tridentRegs3CE[VertStretch] & 1) ||
(pReg->tridentRegs3CE[HorStretch] & 1)))
@@ -251,22 +254,70 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16;
if (LCDActive)
pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd;
+
+ fullSize = (pScrn->currentMode->HDisplay == LCD[i].display_x)
+ && (pScrn->currentMode->VDisplay == LCD[i].display_y);
}
- xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Timing shadow registers:"
- "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x "
- "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",
+ /* copy over common bits from normal VGA */
+
+ pReg->tridentRegs3x4[0x7] &= ~0x4A;
+ pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x4A);
+
+ if (LCDActive && fullSize) {
+ regp->CRTC[0] = pReg->tridentRegs3x4[0];
+ regp->CRTC[3] = pReg->tridentRegs3x4[3];
+ regp->CRTC[4] = pReg->tridentRegs3x4[4];
+ regp->CRTC[5] = pReg->tridentRegs3x4[5];
+ regp->CRTC[6] = pReg->tridentRegs3x4[6];
+ regp->CRTC[7] = pReg->tridentRegs3x4[7];
+ regp->CRTC[0x10] = pReg->tridentRegs3x4[0x10];
+ regp->CRTC[0x11] = pReg->tridentRegs3x4[0x11];
+ regp->CRTC[0x16] = pReg->tridentRegs3x4[0x16];
+ }
+ if (LCDActive && !fullSize) {
+ /*
+ * If the LCD is active and we don't fill the entire screen
+ * and the previous mode was stretched we may need help from
+ * the BIOS to set all registers for the unstreched mode.
+ */
+ pTrident->doInit = ((pReg->tridentRegs3CE[HorStretch] & 1)
+ || (pReg->tridentRegs3CE[VertStretch] & 1));
+ pReg->tridentRegs3CE[CyberControl] |= 0x81;
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n");
+ } else {
+ pReg->tridentRegs3CE[CyberControl] &= 0x7E;
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n");
+ }
+
+
+ if (pTrident->CyberShadow) {
+ pReg->tridentRegs3CE[CyberControl] &= 0x7E;
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n");
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing shadow registers:"
+ " 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",
pReg->tridentRegs3x4[0], pReg->tridentRegs3x4[3],
- pReg->tridentRegs3x4[4], pReg->tridentRegs3x4[5],
- pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7],
+ pReg->tridentRegs3x4[4], pReg->tridentRegs3x4[5]);
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing registers: "
+ " 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",
+ regp->CRTC[0], regp->CRTC[1], regp->CRTC[2],
+ regp->CRTC[3], regp->CRTC[4], regp->CRTC[5]);
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing shadow registers: "
+ "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x"
+ " 0x%2.2x (0x%2.2x)\n",
+ pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7],
pReg->tridentRegs3x4[0x10],pReg->tridentRegs3x4[0x11],
pReg->tridentRegs3x4[0x16],
pReg->tridentRegs3x4[CRTHiOrd]);
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing registers: "
+ "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x "
+ "0x%2.2x 0x%2.2x 0x%2.2x\n",
+ regp->CRTC[6], regp->CRTC[7], regp->CRTC[0x10],
+ regp->CRTC[0x11],regp->CRTC[0x12],
+ regp->CRTC[0x14],regp->CRTC[0x16]);
- /* copy over common bits from normal VGA */
-
- pReg->tridentRegs3x4[0x7] &= ~0x4A;
- pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x4A);
/* disable stretching, enable centering */
pReg->tridentRegs3CE[VertStretch] &= 0xFC;
@@ -303,19 +354,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* no stretch */
pReg->tridentRegs3CE[BiosReg] = 0;
-
- if (LCDActive) {
- pReg->tridentRegs3CE[CyberControl] |= 0x81;
- xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n");
- } else {
- pReg->tridentRegs3CE[CyberControl] &= 0x7E;
- xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n");
- }
- if (pTrident->CyberShadow) {
- pReg->tridentRegs3CE[CyberControl] &= 0x7E;
- xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n");
- }
if (pTrident->CyberStretch) {
pReg->tridentRegs3CE[VertStretch] |= 0x01;
pReg->tridentRegs3CE[HorStretch] |= 0x01;
@@ -524,7 +563,12 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg)
OUTB(0x3C4, Protection);
OUTB(0x3C5, 0x92);
}
-
+#ifdef NOTYET
+ if (pTrident->doInit) {
+ OUTW_3CE(BiosReg);
+
+ }
+#endif
/* Goto New Mode */
OUTB(0x3C4, 0x0B);
temp = INB(0x3C5);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
index d1b1d6e8d..ca7631213 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
@@ -28,7 +28,7 @@
* Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the
* clockchip programming code.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.125 2001/02/15 17:59:07 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.129 2001/04/04 12:46:35 alanh Exp $ */
#include "xf1bpp.h"
#include "xf4bpp.h"
@@ -155,6 +155,8 @@ static SymTabRec TRIDENTChipsets[] = {
{ CYBERBLADEI1D, "cyberbladei1d" },
{ CYBERBLADEAI1, "cyberbladeAi1" },
{ CYBERBLADEAI1D, "cyberbladeAi1d" },
+ { CYBERBLADEXP, "cyberbladeXP" },
+ { CYBERBLADEXPm, "cyberbladeXPm" },
{ -1, NULL }
};
@@ -188,6 +190,8 @@ static PciChipsets TRIDENTPciChipsets[] = {
{ CYBERBLADEI1D, PCI_CHIP_8520, RES_SHARED_VGA },
{ CYBERBLADEAI1, PCI_CHIP_8600, RES_SHARED_VGA },
{ CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA },
+ { CYBERBLADEXP, PCI_CHIP_9910, RES_SHARED_VGA },
+ { CYBERBLADEXPm, PCI_CHIP_9930, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED }
};
@@ -264,6 +268,8 @@ static int ClockLimit[] = {
230000,
230000,
230000,
+ 230000,
+ 230000,
};
static int ClockLimit16bpp[] = {
@@ -304,6 +310,8 @@ static int ClockLimit16bpp[] = {
230000,
230000,
230000,
+ 230000,
+ 230000,
};
static int ClockLimit24bpp[] = {
@@ -344,6 +352,8 @@ static int ClockLimit24bpp[] = {
115000,
115000,
115000,
+ 115000,
+ 115000,
};
static int ClockLimit32bpp[] = {
@@ -385,6 +395,8 @@ static int ClockLimit32bpp[] = {
115000,
115000,
115000,
+ 115000,
+ 115000,
};
/*
@@ -404,21 +416,22 @@ tridentLCD LCD[] = { /* 0 3 4 5 6 7 10 11 16 */
#else
#if 0
tridentLCD LCD[] = {
- { 1,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08},
- { 3,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08},
- { 2,"1024x768",65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08},
- { 0,"1280x1024",108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8},
- { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ { 1,640,480,25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08},
+ { 3,800,600,40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08},
+ { 2,1024,768,65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08},
+ { 0,1280,1024,108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8},
+ { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
-#endif
+#else
tridentLCD LCD[] = {
- { 1,"640x480",25200,0x5f,0x80,0x52,0x1e,0xb,0x3e,0xea,0x0c,0xb,0x08},
- { 3,"800x600",40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08},
- { 2,"1024x768",65000,0xa3,0x86,0x83,0x94,0x24,0xf5,0x03,0x09,0x24,0x08},
- { 0,"1280x1024",108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8},
- { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ { 1,640,480,25200,0x5f,0x80,0x52,0x1e,0xb,0x3e,0xea,0x0c,0xb,0x08},
+ { 3,800,600,40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08},
+ { 2,1024,768,65000,0xa3,0x00,0x84,0x94,0x24,0xf5,0x03,0x09,0x24,0x08},
+ { 0,1280,1024,108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8},
+ { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#endif
+#endif
static const char *xaaSymbols[] = {
"XAADestroyInfoRec",
@@ -977,6 +990,7 @@ TRIDENTProbeDDC(ScrnInfoPtr pScrn, int index)
if (xf86LoadSubModule(pScrn, "vbe")) {
pVbe = VBEInit(NULL,index);
ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
+ vbeFree(pVbe);
}
}
@@ -1336,8 +1350,10 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
*/
if (xf86LoadSubModule(pScrn, "vbe")) {
xf86MonPtr pMon;
- pMon = vbeDoEDID(VBEInit(pTrident->Int10,
- pTrident->pEnt->index), NULL);
+ vbeInfoPtr pVbe;
+ pVbe = VBEInit(pTrident->Int10, pTrident->pEnt->index);
+ pMon = vbeDoEDID(pVbe, NULL);
+ vbeFree(pVbe);
if (pMon) {
if (!xf86LoadSubModule(pScrn, "ddc")) {
TRIDENTFreeRec(pScrn);
@@ -1697,6 +1713,28 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
pTrident->NewClockCode = TRUE;
pTrident->frequency = NTSC;
break;
+ case CYBERBLADEXP:
+ pTrident->ddc1Read = Tridentddc1Read;
+ ramtype = "SGRAM";
+ pTrident->HasSGRAM = TRUE;
+ pTrident->NoAccel = TRUE; /* Disable acceleration */
+ /* pTrident->IsCyber = TRUE; */
+ Support24bpp = TRUE;
+ chipset = "Cyber/BladeXP";
+ pTrident->NewClockCode = TRUE;
+ pTrident->frequency = NTSC;
+ break;
+ case CYBERBLADEXPm:
+ pTrident->ddc1Read = Tridentddc1Read;
+ ramtype = "SGRAM";
+ pTrident->HasSGRAM = TRUE;
+ pTrident->NoAccel = TRUE; /* Disable acceleration */
+ pTrident->IsCyber = TRUE;
+ Support24bpp = TRUE;
+ chipset = "CyberBlade/XPm";
+ pTrident->NewClockCode = TRUE;
+ pTrident->frequency = NTSC;
+ break;
}
if (!pScrn->progClock) {
@@ -1751,8 +1789,10 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
case 0x04: /* 8MB, but - hw cursor can't store above 4MB */
/* So, we force to 4MB for now */
/* pScrn->videoRam = 8192; */
-
- if (pTrident->HWCursor) {
+ /* Appearantly this isn't true for the CYBER9397DVD */
+ /* maybe some other chipsets aren't affected either */
+ /* XXX this needs to be investigated further */
+ if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD)) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Found 8MB board, using 4MB\n");
pScrn->videoRam = 4096;
@@ -1793,11 +1833,14 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
for (i = 0; LCD[i].mode != 0xff; i++) {
if (LCD[i].mode == ((mod >> 4) & 3)) {
pTrident->lcdMode = i;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %s found\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %ix%i found\n",
(dsp & 0x80) ? "TFT" :
- ((dsp1 & 0x20) ? "DSTN" : "STN"), LCD[i].display);
+ ((dsp1 & 0x20) ? "DSTN" : "STN"),
+ LCD[i].display_x,LCD[i].display_y);
}
}
+ OUTB(0x3CE, FPConfig);
+ pTrident->lcdActive = (INB(0x3CF) & 0x10);
}
pTrident->MCLK = 0;
@@ -2088,10 +2131,13 @@ TRIDENTMapMem(ScrnInfoPtr pScrn)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int mapsize = 0x10000;
+
+ if (Is3Dchip) mapsize = 0x20000;
if (IsPciCard && UseMMIO)
pTrident->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
- pTrident->PciTag, pTrident->IOAddress, 0x20000);
+ pTrident->PciTag, pTrident->IOAddress, mapsize);
else {
pTrident->IOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
pTrident->IOAddress, 0x1000);
@@ -2126,12 +2172,15 @@ static Bool
TRIDENTUnmapMem(ScrnInfoPtr pScrn)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+ int mapsize = 0x10000;
+
+ if (Is3Dchip) mapsize = 0x20000;
/*
* Unmap IO registers to virtual address space
*/
if (IsPciCard && UseMMIO)
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, 0x20000);
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, mapsize);
else {
pTrident->IOBase -= 0xF00;
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, 0x1000);
@@ -2211,6 +2260,8 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
case CYBERBLADEE4:
case CYBER9397:
case CYBER9397DVD:
+ case CYBERBLADEXP:
+ case CYBERBLADEXPm:
/* Get ready for MUX mode */
if (pTrident->MUX &&
pScrn->bitsPerPixel == 8 &&
@@ -2773,6 +2824,21 @@ TRIDENTFreeScreen(int scrnIndex, int flags)
static int
TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+
+ if (pTrident->lcdActive && (pTrident->lcdMode != 0xff)
+ && ((mode->HDisplay > LCD[pTrident->lcdMode].display_x)
+ || (mode->VDisplay > LCD[pTrident->lcdMode].display_y))) {
+ xf86DrvMsg(scrnIndex,X_INFO, "Removing mode (%dx%d) "
+ "larger than the LCD panel (%dx%d)\n",
+ mode->HDisplay,
+ mode->VDisplay,
+ LCD[pTrident->lcdMode].display_x,
+ LCD[pTrident->lcdMode].display_y);
+ return(MODE_BAD);
+ }
+
return(MODE_OK);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
index 2b624a5b6..7b14751eb 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.82 2001/02/15 17:54:55 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.83 2001/04/06 16:51:19 dawes Exp $
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -108,6 +108,10 @@ static int pix24bpp = 0;
#define TSENG_MINOR_VERSION 0
#define TSENG_PATCHLEVEL 0
+/* CRTC timing limits */
+#define Tseng_HMAX (4096-8)
+#define Tseng_VMAX (2048-1)
+
/*
* This contains the functions needed by the server after loading the
* driver module. It must be supplied, and gets added the driver list by
@@ -1677,8 +1681,8 @@ TsengPreInit(ScrnInfoPtr pScrn, int flags)
pTseng->Bytesperpixel = 1; /* this is fake for < 8bpp, but simplifies other code */
/* hardware limits */
- pScrn->maxHValue = 4096 / pTseng->Bytesperpixel;
- pScrn->maxVValue = 2048;
+ pScrn->maxHValue = Tseng_HMAX;
+ pScrn->maxVValue = Tseng_VMAX;
/*
* This must happen after pScrn->display has been set because
@@ -2735,8 +2739,6 @@ TsengAdjustFrame(int scrnIndex, int x, int y, int flags)
ModeStatus
TsengValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
-#define Tseng_HMAX (4096-8)
-#define Tseng_VMAX (2048-1)
PDEBUG(" TsengValidMode\n");
@@ -2744,7 +2746,7 @@ TsengValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
is this needed? xf86ValidMode gets HMAX and VMAX variables, so it could deal with this.
need to recheck hsize with mode->Htotal*mulFactor/divFactor
/* Check for CRTC timing bits overflow. */
- if (mode->HTotal * pTseng->Bytesperpixel > Tseng_HMAX) {
+ if (mode->HTotal > Tseng_HMAX) {
return MODE_BAD_HVALUE;
}
if (mode->VTotal > Tseng_VMAX) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c
index 9066dba4a..919df18e5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c
@@ -2,7 +2,7 @@
* video4linux Xv Driver
* based on Michael Schimek's permedia 2 driver.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.20 2001/02/08 18:56:29 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.22 2001/04/05 20:13:47 dawes Exp $ */
#include "videodev.h"
#include "xf86.h"
@@ -17,13 +17,7 @@
#include "dgaproc.h"
#include "xf86str.h"
-
#include <asm/ioctl.h> /* _IORW(xxx) #defines are here */
-#if 0
-typedef unsigned long ulong;
-#endif
-
-/* XXX Lots of xalloc() calls don't check for failure. */
#if 0
# define DEBUG(x) (x)
@@ -116,21 +110,22 @@ typedef struct _PortPrivRec {
Bool StreamOn;
/* file handle */
- int fd;
- char devname[16];
- int useCount;
+ int nr;
struct video_capability cap;
/* RGB overlay */
struct video_buffer rgb_fbuf;
struct video_window rgb_win;
int rgbpalette;
+ int rgbdepth;
/* attributes */
struct video_picture pict;
struct video_audio audio;
XF86VideoEncodingPtr enc;
+ int *input;
+ int *norm;
int nenc,cenc;
/* yuv to offscreen */
@@ -170,18 +165,36 @@ InputVideoFormats[] = {
#define V4L_ATTR (sizeof(Attributes) / sizeof(XF86AttributeRec))
-static XF86AttributeRec Attributes[] = {
- {XvSettable | XvGettable, -1000, 1000, XV_ENCODING},
- {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS},
- {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST},
- {XvSettable | XvGettable, -1000, 1000, XV_SATURATION},
- {XvSettable | XvGettable, -1000, 1000, XV_HUE},
- {XvSettable | XvGettable, 0, 1, XV_MUTE},
- {XvSettable | XvGettable, 0, 16*1000, XV_FREQ},
+static const XF86AttributeRec Attributes[] = {
+ {XvSettable | XvGettable, -1000, 1000, XV_ENCODING},
+ {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS},
+ {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST},
+ {XvSettable | XvGettable, -1000, 1000, XV_SATURATION},
+ {XvSettable | XvGettable, -1000, 1000, XV_HUE},
+};
+static const XF86AttributeRec VolumeAttr =
+ {XvSettable | XvGettable, -1000, 1000, XV_VOLUME};
+static const XF86AttributeRec MuteAttr =
+ {XvSettable | XvGettable, 0, 1, XV_MUTE};
+static const XF86AttributeRec FreqAttr =
+ {XvSettable | XvGettable, 0, 16*1000, XV_FREQ};
+
+
+#define MAX_V4L_DEVICES 4
+#define V4L_FD (v4l_devices[pPPriv->nr].fd)
+#define V4L_REF (v4l_devices[pPPriv->nr].useCount)
+#define V4L_NAME (v4l_devices[pPPriv->nr].devName)
+
+static struct V4L_DEVICE {
+ int fd;
+ int useCount;
+ char devName[16];
+} v4l_devices[MAX_V4L_DEVICES] = {
+ { -1 },
+ { -1 },
+ { -1 },
+ { -1 },
};
-static XF86AttributeRec VolumeAttr =
- {XvSettable | XvGettable, -1000, 1000, XV_VOLUME};
-
/* ---------------------------------------------------------------------- */
/* forward decl */
@@ -194,21 +207,8 @@ static void V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
{
-
-#if 0
- /* I don't know if this is needed or not. Alan Cox says no. EE */
- if (!xf86NoSharedMem(pScrn->scrnIndex)) {
- xf86Msg(X_ERROR,"Screen %i cannot grant access to fb\n",
- pScrn->scrnIndex);
- return 1;
- }
-#endif
- pPPriv->useCount++;
- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
- "Xv/open: refcount=%d\n",pPPriv->useCount));
-
- if (pPPriv->fd == -1) {
- pPPriv->fd = open(pPPriv->devname, O_RDWR, 0);
+ if (-1 == V4L_FD) {
+ V4L_FD = open(V4L_NAME, O_RDWR, 0);
pPPriv->rgb_fbuf.width = pScrn->virtualX;
pPPriv->rgb_fbuf.height = pScrn->virtualY;
@@ -218,35 +218,43 @@ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
switch (pScrn->bitsPerPixel) {
case 16:
- if (pScrn->weight.green == 5)
+ if (pScrn->weight.green == 5) {
pPPriv->rgbpalette = VIDEO_PALETTE_RGB555;
- else
+ pPPriv->rgbdepth = 16;
+ } else {
pPPriv->rgbpalette = VIDEO_PALETTE_RGB565;
+ pPPriv->rgbdepth = 16;
+ }
break;
case 24:
pPPriv->rgbpalette = VIDEO_PALETTE_RGB24;
+ pPPriv->rgbdepth = 24;
break;
case 32:
pPPriv->rgbpalette = VIDEO_PALETTE_RGB32;
+ pPPriv->rgbdepth = 32;
break;
}
}
- if (pPPriv->fd == -1)
+ if (-1 == V4L_FD)
return errno;
-
+
+ V4L_REF++;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+ "Xv/open: refcount=%d\n",V4L_REF));
+
return 0;
}
-static void V4lCloseDevice(PortPrivPtr pPPriv)
+static void V4lCloseDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
{
- pPPriv->useCount--;
-
- DEBUG(xf86DrvMsgVerb(0, X_INFO, 2,
- "Xv/close: refcount=%d\n",pPPriv->useCount));
- if(pPPriv->useCount == 0 && pPPriv->fd != -1) {
- close(pPPriv->fd);
- pPPriv->fd = -1;
+ V4L_REF--;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+ "Xv/close: refcount=%d\n",V4L_REF));
+ if (0 == V4L_REF && -1 != V4L_FD) {
+ close(V4L_FD);
+ V4L_FD = -1;
}
}
@@ -268,7 +276,7 @@ V4lPutVideo(ScrnInfoPtr pScrn,
/* Open a file handle to the device */
if (VIDEO_OFF == pPPriv->VideoOn) {
if (V4lOpenDevice(pPPriv, pScrn))
- return BadAccess;
+ return Success;
}
if (pPPriv->have_yuv) {
@@ -319,19 +327,18 @@ V4lPutVideo(ScrnInfoPtr pScrn,
}
/* program driver */
- if (VIDEO_YUV != pPPriv->VideoOn) {
- if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->yuv_fbuf)))
- perror("ioctl VIDIOCSFBUF");
- if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict))
- perror("ioctl VIDIOCGPICT");
- pPPriv->pict.palette = VIDEO_PALETTE_YUV422;
- if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict))
- perror("ioctl VIDIOCSPICT");
- if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->yuv_win)))
- perror("ioctl VIDIOCSWIN");
- if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one))
- perror("ioctl VIDIOCCAPTURE(1)");
- }
+ if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf)))
+ perror("ioctl VIDIOCSFBUF");
+ if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+ perror("ioctl VIDIOCGPICT");
+ pPPriv->pict.palette = VIDEO_PALETTE_YUV422;
+ pPPriv->pict.depth = 16;
+ if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+ perror("ioctl VIDIOCSPICT");
+ if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win)))
+ perror("ioctl VIDIOCSWIN");
+ if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+ perror("ioctl VIDIOCCAPTURE(1)");
if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
/* invert cliplist */
@@ -415,30 +422,31 @@ V4lPutVideo(ScrnInfoPtr pScrn,
pPPriv->rgb_win.clipcount));
if (0 != pPPriv->rgb_win.clipcount) {
pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
- memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
- pBox = REGION_RECTS(clipBoxes);
- clip = pPPriv->rgb_win.clips;
- for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
- clip->x = pBox->x1 - dx;
- clip->y = pBox->y1 - dy;
- clip->width = pBox->x2 - pBox->x1;
- clip->height = pBox->y2 - pBox->y1;
+ if (NULL != pPPriv->rgb_win.clips) {
+ memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+ pBox = REGION_RECTS(clipBoxes);
+ clip = pPPriv->rgb_win.clips;
+ for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
+ clip->x = pBox->x1 - dx;
+ clip->y = pBox->y1 - dy;
+ clip->width = pBox->x2 - pBox->x1;
+ clip->height = pBox->y2 - pBox->y1;
+ }
}
}
/* start */
- if (VIDEO_RGB != pPPriv->VideoOn) {
- if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->rgb_fbuf)))
- perror("ioctl VIDIOCSFBUF");
- if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict))
- perror("ioctl VIDIOCGPICT");
- pPPriv->pict.palette = pPPriv->rgbpalette;
- if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict))
- perror("ioctl VIDIOCSPICT");
- }
- if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->rgb_win)))
+ if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf)))
+ perror("ioctl VIDIOCSFBUF");
+ if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+ perror("ioctl VIDIOCGPICT");
+ pPPriv->pict.palette = pPPriv->rgbpalette;
+ pPPriv->pict.depth = pPPriv->rgbdepth;
+ if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+ perror("ioctl VIDIOCSPICT");
+ if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win)))
perror("ioctl VIDIOCSWIN");
- if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one))
+ if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
perror("ioctl VIDIOCCAPTURE(1)");
pPPriv->VideoOn = VIDEO_RGB;
@@ -475,7 +483,7 @@ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
if (!exit) {
/* just reclipping, we have to stop DMA transfers to the visible screen */
if (VIDEO_RGB == pPPriv->VideoOn) {
- if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero))
+ if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
perror("ioctl VIDIOCCAPTURE(0)");
pPPriv->VideoOn = VIDEO_RECLIP;
}
@@ -487,10 +495,10 @@ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
xfree(pPPriv->surface);
pPPriv->surface = NULL;
}
- if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero))
+ if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
perror("ioctl VIDIOCCAPTURE(0)");
- V4lCloseDevice(pPPriv);
+ V4lCloseDevice(pPPriv,pScrn);
pPPriv->VideoOn = VIDEO_OFF;
}
}
@@ -520,19 +528,19 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn,
int ret = Success;
if (V4lOpenDevice(pPPriv, pScrn))
- return BadAccess;
+ return Success;
DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n",
- attribute, value));
+ attribute, value));
- if (-1 == pPPriv->fd) {
- ret = Success /* FIXME: EBUSY/ENODEV ?? */;
+ if (-1 == V4L_FD) {
+ ret = Success;
} else if (attribute == xvEncoding) {
if (value >= 0 && value < pPPriv->nenc) {
pPPriv->cenc = value;
- chan.channel = value/3;
- chan.norm = value%3;
- if (-1 == ioctl(pPPriv->fd,VIDIOCSCHAN,&chan))
+ chan.channel = pPPriv->input[value];
+ chan.norm = pPPriv->norm[value];
+ if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan))
perror("ioctl VIDIOCSCHAN");
} else {
ret = BadValue;
@@ -541,16 +549,16 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn,
attribute == xvContrast ||
attribute == xvSaturation ||
attribute == xvHue) {
- ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict);
+ ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value);
if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value);
if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value);
if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value);
- if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict))
+ if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
perror("ioctl VIDIOCSPICT");
} else if (attribute == xvMute ||
attribute == xvVolume) {
- ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio);
+ ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
if (attribute == xvMute) {
if (value)
pPPriv->audio.flags |= VIDEO_AUDIO_MUTE;
@@ -563,10 +571,10 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn,
ret = BadValue;
}
if (ret != BadValue)
- if (-1 == ioctl(pPPriv->fd,VIDIOCSAUDIO,&pPPriv->audio))
+ if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio))
perror("ioctl VIDIOCSAUDIO");
} else if (attribute == xvFreq) {
- if (-1 == ioctl(pPPriv->fd,VIDIOCSFREQ,&value))
+ if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&value))
perror("ioctl VIDIOCSFREQ");
} else if (pPPriv->have_yuv &&
pPPriv->myfmt->setAttribute) {
@@ -576,7 +584,7 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn,
ret = BadValue;
}
- V4lCloseDevice(pPPriv);
+ V4lCloseDevice(pPPriv,pScrn);
return ret;
}
@@ -588,24 +596,27 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn,
int ret = Success;
if (V4lOpenDevice(pPPriv, pScrn))
- return BadAccess;
+ return Success;
- if (-1 == pPPriv->fd) {
- ret = Success /* FIXME: EBUSY/ENODEV ?? */;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n",
+ attribute));
+
+ if (-1 == V4L_FD) {
+ ret = Success;
} else if (attribute == xvEncoding) {
*value = pPPriv->cenc;
} else if (attribute == xvBrightness ||
attribute == xvContrast ||
attribute == xvSaturation ||
attribute == xvHue) {
- ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict);
+ ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness);
if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast);
if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour);
if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue);
} else if (attribute == xvMute ||
attribute == xvVolume) {
- ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio);
+ ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
if (attribute == xvMute) {
*value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0;
} else if (attribute == xvVolume) {
@@ -615,7 +626,7 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn,
ret = BadValue;
}
} else if (attribute == xvFreq) {
- ioctl(pPPriv->fd,VIDIOCGFREQ,value);
+ ioctl(V4L_FD,VIDIOCGFREQ,value);
} else if (pPPriv->have_yuv &&
pPPriv->myfmt->getAttribute) {
/* not mine -> pass to yuv scaler driver */
@@ -627,7 +638,7 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn,
DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n",
attribute, *value));
- V4lCloseDevice(pPPriv);
+ V4lCloseDevice(pPPriv,pScrn);
return ret;
}
@@ -679,55 +690,144 @@ fixname(char *str)
return str;
}
-static XF86VideoEncodingPtr
-V4LBuildEncodings(int fd, int *count, int channels)
+static int
+v4l_add_enc(XF86VideoEncodingPtr enc, int i,
+ char *norm, char *input, int width, int height, int n, int d)
{
- static struct video_channel channel;
- XF86VideoEncodingPtr enc;
- int i;
+ enc[i].id = i;
+ enc[i].name = xalloc(strlen(norm)+strlen(input)+2);
+ if (NULL == enc[i].name)
+ return -1;
+ enc[i].width = width;
+ enc[i].height = height;
+ enc[i].rate.numerator = n;
+ enc[i].rate.denominator = d;
+ sprintf(enc[i].name,"%s-%s",norm,fixname(input));
+ return 0;
+}
- enc = xalloc(sizeof(XF86VideoEncodingRec)*3*channels);
- memset(enc,0,sizeof(XF86VideoEncodingRec)*3*channels);
+static void
+V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
+{
+ static struct video_channel channel;
+ int i,entries,have_bttv;
- for (i = 0; i < 3*channels; ) {
- channel.channel = i/3;
+#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
+ have_bttv = 0;
+ if (-1 != ioctl(fd,BTTV_VERSION,NULL))
+ have_bttv = 1;
+
+ entries = (have_bttv ? 7 : 3) * channels;
+ p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries);
+ if (NULL == p->enc)
+ goto fail;
+ memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries);
+ p->norm = xalloc(sizeof(int) * entries);
+ if (NULL == p->norm)
+ goto fail;
+ memset(p->norm,0,sizeof(int) * entries);
+ p->input = xalloc(sizeof(int) * entries);
+ if (NULL == p->input)
+ goto fail;
+ memset(p->input,0,sizeof(int) * entries);
+
+ p->nenc = 0;
+ for (i = 0; i < channels; i++) {
+ channel.channel = i;
if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) {
perror("ioctl VIDIOCGCHAN");
- return NULL;
+ continue;
+ }
+
+ v4l_add_enc(p->enc, p->nenc,"pal", channel.name, 768,576, 1,50);
+ p->norm[p->nenc] = VIDEO_MODE_PAL;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ v4l_add_enc(p->enc,p->nenc,"ntsc", channel.name, 640,480, 1001,60000);
+ p->norm[p->nenc] = VIDEO_MODE_NTSC;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ v4l_add_enc(p->enc,p->nenc,"secam",channel.name, 768,576, 1,50);
+ p->norm[p->nenc] = VIDEO_MODE_SECAM;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ if (have_bttv) {
+ /* workaround for a v4l design flaw: The v4l API knows just pal,
+ ntsc and secam. But there are a few more norms (pal versions
+ with a different timings used in south america for example).
+ The bttv driver can handle these too. */
+ if (0 != v4l_add_enc(p->enc,p->nenc,"palnc",channel.name,
+ 640, 576, 1,50))
+ goto fail;
+ p->norm[p->nenc] = 3;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ if (0 != v4l_add_enc(p->enc,p->nenc,"palm",channel.name,
+ 640, 576, 1,50))
+ goto fail;
+ p->norm[p->nenc] = 4;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ if (0 != v4l_add_enc(p->enc, p->nenc,"paln", channel.name,
+ 768,576, 1,50))
+ goto fail;
+ p->norm[p->nenc] = 5;
+ p->input[p->nenc] = i;
+ p->nenc++;
+
+ if (0 != v4l_add_enc(p->enc,p->nenc,"ntscjp", channel.name,
+ 640,480, 1001,60000))
+ goto fail;
+ p->norm[p->nenc] = 6;
+ p->input[p->nenc] = i;
+ p->nenc++;
}
+ }
+ return;
+
+ fail:
+ if (p->input)
+ xfree(p->input);
+ p->input = NULL;
+ if (p->norm)
+ xfree(p->norm);
+ p->norm = NULL;
+ if (p->enc)
+ xfree(p->enc);
+ p->enc = NULL;
+ p->nenc = 0;
+}
- /* one for PAL ... */
- enc[i].id = i;
- enc[i].name = malloc(strlen(channel.name)+8);
- enc[i].width = 768;
- enc[i].height = 576;
- enc[i].rate.numerator = 1;
- enc[i].rate.denominator = 50;
- sprintf(enc[i].name,"pal-%s",fixname(channel.name));
- i++;
-
- /* NTSC */
- enc[i].id = i;
- enc[i].name = malloc(strlen(channel.name)+8);
- enc[i].width = 640;
- enc[i].height = 480;
- enc[i].rate.numerator = 1001;
- enc[i].rate.denominator = 60000;
- sprintf(enc[i].name,"ntsc-%s",fixname(channel.name));
- i++;
-
- /* SECAM */
- enc[i].id = i;
- enc[i].name = malloc(strlen(channel.name)+8);
- enc[i].width = 768;
- enc[i].height = 576;
- enc[i].rate.numerator = 1;
- enc[i].rate.denominator = 50;
- sprintf(enc[i].name,"secam-%s",fixname(channel.name));
- i++;
+/* add a attribute a list */
+static void
+v4l_add_attr(XF86AttributeRec **list, int *count,
+ const XF86AttributeRec *attr)
+{
+ XF86AttributeRec *oldlist = *list;
+ int i;
+
+ for (i = 0; i < *count; i++) {
+ if (0 == strcmp((*list)[i].name,attr->name)) {
+ DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
+ return;
+ }
+ }
+
+ DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name));
+ *list = xalloc((*count + 1) * sizeof(XF86AttributeRec));
+ if (NULL == *list) {
+ *count = 0;
+ return;
}
- *count = i;
- return enc;
+ if (*count)
+ memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
+ memcpy(*list + *count, attr, sizeof(XF86AttributeRec));
+ (*count)++;
}
static int
@@ -737,13 +837,12 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
PortPrivPtr pPPriv;
DevUnion *Private;
XF86VideoAdaptorPtr *VAR = NULL;
- XF86VideoEncodingPtr enc;
char dev[18];
- int fd,i,j,nenc;
+ int fd,i,j;
DEBUG(xf86Msg(X_INFO, "v4l: init start\n"));
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < MAX_V4L_DEVICES; i++) {
sprintf(dev, "/dev/video%d", i);
fd = open(dev, O_RDWR, 0);
if (fd == -1) {
@@ -752,32 +851,32 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
if (fd == -1)
break;
}
-
- DEBUG(xf86Msg(X_INFO, "v4l: %s ok\n",dev));
+ DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
/* our private data */
pPPriv = xalloc(sizeof(PortPrivRec));
if (!pPPriv)
return FALSE;
memset(pPPriv,0,sizeof(PortPrivRec));
- pPPriv->fd = -1;
- strncpy(pPPriv->devname, dev, 16);
- pPPriv->useCount=0;
/* check device */
- if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) ||
- NULL == (enc = V4LBuildEncodings
- (fd,&nenc,pPPriv->cap.channels))) {
+ if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) ||
+ 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) {
+ DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev));
xfree(pPPriv);
break;
}
- pPPriv->enc = enc;
- pPPriv->nenc = nenc;
+ strncpy(V4L_NAME, dev, 16);
+ V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels);
+ if (NULL == pPPriv->enc)
+ return FALSE;
#if 1
- /* check for yuv (see if the driver accepts VIDEO_PALETTE_YUV422) */
+ /* test v4l device for yuv support: check if the driver
+ accepts VIDEO_PALETTE_YUV422 */
ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
pPPriv->pict.palette = VIDEO_PALETTE_YUV422;
+ pPPriv->pict.depth = 16;
if (0 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict)) {
ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
if (VIDEO_PALETTE_YUV422 == pPPriv->pict.palette) {
@@ -808,20 +907,36 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
return FALSE;
memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
- /* add attribute lists */
+
+ /* build attribute list */
+ for (j = 0; j < V4L_ATTR; j++) {
+ /* video attributes */
+ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+ &Attributes[j]);
+ }
+ if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) {
+ /* audio attributes */
+ if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+ &VolumeAttr);
+ if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE)
+ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+ &MuteAttr);
+ }
+ if (pPPriv->cap.type & VID_TYPE_TUNER) {
+ /* tuner attributes */
+ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+ &FreqAttr);
+ }
if (pPPriv->have_yuv) {
- VAR[i]->nAttributes = V4L_ATTR + pPPriv->myfmt->num_attributes;
- VAR[i]->pAttributes = xalloc(VAR[i]->nAttributes *
- sizeof(XF86AttributeRec));
- memcpy(VAR[i]->pAttributes, Attributes,
- sizeof(XF86AttributeRec) * V4L_ATTR);
- memcpy(VAR[i]->pAttributes+V4L_ATTR, pPPriv->myfmt->attributes,
- sizeof(XF86AttributeRec) * pPPriv->myfmt->num_attributes);
- } else {
- VAR[i]->nAttributes = V4L_ATTR;
- VAR[i]->pAttributes = Attributes;
+ /* pass throuth scaler attributes */
+ for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
+ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+ pPPriv->myfmt->attributes+j);
+ }
}
-
+
+
/* hook in private data */
Private = xalloc(sizeof(DevUnion));
if (!Private)
@@ -843,32 +958,12 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
VAR[i]->GetPortAttribute = V4lGetPortAttribute;
VAR[i]->QueryBestSize = V4lQueryBestSize;
- VAR[i]->nEncodings = nenc;
- VAR[i]->pEncodings = enc;
+ VAR[i]->nEncodings = pPPriv->nenc;
+ VAR[i]->pEncodings = pPPriv->enc;
VAR[i]->nFormats =
sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
VAR[i]->pFormats = InputVideoFormats;
- /* Check whether we have VIDEO_AUDIO_VOLUME */
- if (!ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio) &&
- pPPriv->audio.flags & VIDEO_AUDIO_VOLUME) {
- XF86AttributeRec *oldattrs = VAR[i]->pAttributes;
- int nattrs = VAR[i]->nAttributes;
-
- DEBUG(xf86Msg(X_INFO, "v4l: Volume supported, adding XV_VOLUME to attribute list\n"));
-
- VAR[i]->pAttributes = xalloc((nattrs + 1) *
- sizeof(XF86AttributeRec));
- memcpy(VAR[i]->pAttributes, oldattrs,
- sizeof(XF86AttributeRec) * nattrs);
- memcpy(VAR[i]->pAttributes+nattrs, &VolumeAttr,
- sizeof(XF86AttributeRec));
- VAR[i]->nAttributes++;
- } else {
- DEBUG(xf86Msg(X_INFO, "v4l: Volume not supported\n"));
- }
-
-
if (fd != -1)
close(fd);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h b/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h
index 460ebcd27..77b592ef9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h
@@ -7,9 +7,9 @@
* Used here with the explicit permission of the original author, Alan Cox.
* <alan@lxorguk.ukuu.org.uk>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.7 1999/05/15 15:31:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.8 2001/03/03 22:46:31 tsi Exp $ */
-#include <Xmd.h>
+#include "Xmd.h"
#define VID_TYPE_CAPTURE 1 /* Can capture */
#define VID_TYPE_TUNER 2 /* Can tune */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
index 0847547d4..6b7750ef4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
@@ -1,4 +1,4 @@
-#define DEBUG
+#define DEBUG_VERB 2
/*
* Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
*
@@ -27,7 +27,7 @@
*
* Authors: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.12 2001/02/16 01:45:45 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.15 2001/04/01 14:00:12 tsi Exp $
*/
#include "vesa.h"
@@ -479,9 +479,8 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
if ((pScrn->monitor->DDC = pVesa->monitor) != NULL)
xf86SetDDCproperties(pScrn, pVesa->monitor);
-#ifdef DEBUG
- ErrorF("Searching for matching VESA mode(s):\n");
-#endif
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB,
+ "Searching for matching VESA mode(s):\n");
i = 0;
while (vbe->VideoModePtr[i] != 0xffff) {
@@ -489,54 +488,94 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
if ((mode = VBEGetModeInfo(pVesa->pVbe, id)) == NULL)
continue;
-#ifdef DEBUG
- ErrorF("Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution);
- ErrorF(" ModeAttributes: 0x%x\n", mode->ModeAttributes);
- ErrorF(" WinAAttributes: 0x%x\n", mode->WinAAttributes);
- ErrorF(" WinBAttributes: 0x%x\n", mode->WinBAttributes);
- ErrorF(" WinGranularity: %d\n", mode->WinGranularity);
- ErrorF(" WinSize: %d\n", mode->WinSize);
- ErrorF(" WinASegment: 0x%x\n", mode->WinASegment);
- ErrorF(" WinBSegment: 0x%x\n", mode->WinBSegment);
- ErrorF(" WinFuncPtr: 0x%x\n", mode->WinFuncPtr);
- ErrorF(" BytesPerScanline: %d\n", mode->BytesPerScanline);
- ErrorF(" XResolution: %d\n", mode->XResolution);
- ErrorF(" YResolution: %d\n", mode->YResolution);
- ErrorF(" XCharSize: %d\n", mode->XCharSize);
- ErrorF(" YCharSize: %d\n", mode->YCharSize);
- ErrorF(" NumberOfPlanes: %d\n", mode->NumberOfPlanes);
- ErrorF(" BitsPerPixel: %d\n", mode->BitsPerPixel);
- ErrorF(" NumberOfBanks: %d\n", mode->NumberOfBanks);
- ErrorF(" MemoryModel: %d\n", mode->MemoryModel);
- ErrorF(" BankSize: %d\n", mode->BankSize);
- ErrorF(" NumberOfImages: %d\n", mode->NumberOfImages);
- ErrorF(" RedMaskSize: %d\n", mode->RedMaskSize);
- ErrorF(" RedFieldPosition: %d\n", mode->RedFieldPosition);
- ErrorF(" GreenMaskSize: %d\n", mode->GreenMaskSize);
- ErrorF(" GreenFieldPosition: %d\n", mode->GreenFieldPosition);
- ErrorF(" BlueMaskSize: %d\n", mode->BlueMaskSize);
- ErrorF(" BlueFieldPosition: %d\n", mode->BlueFieldPosition);
- ErrorF(" RsvdMaskSize: %d\n", mode->RsvdMaskSize);
- ErrorF(" RsvdFieldPosition: %d\n", mode->RsvdFieldPosition);
- ErrorF(" DirectColorModeInfo: %d\n", mode->DirectColorModeInfo);
+ xf86ErrorFVerb(DEBUG_VERB,
+ "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " ModeAttributes: 0x%x\n", mode->ModeAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinAAttributes: 0x%x\n", mode->WinAAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinBAttributes: 0x%x\n", mode->WinBAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinGranularity: %d\n", mode->WinGranularity);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinSize: %d\n", mode->WinSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinASegment: 0x%x\n", mode->WinASegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinBSegment: 0x%x\n", mode->WinBSegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinFuncPtr: 0x%x\n", mode->WinFuncPtr);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BytesPerScanline: %d\n", mode->BytesPerScanline);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " XResolution: %d\n", mode->XResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " YResolution: %d\n", mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " XCharSize: %d\n", mode->XCharSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " YCharSize: %d\n", mode->YCharSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfPlanes: %d\n", mode->NumberOfPlanes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BitsPerPixel: %d\n", mode->BitsPerPixel);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfBanks: %d\n", mode->NumberOfBanks);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " MemoryModel: %d\n", mode->MemoryModel);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BankSize: %d\n", mode->BankSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfImages: %d\n", mode->NumberOfImages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RedMaskSize: %d\n", mode->RedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RedFieldPosition: %d\n", mode->RedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenMaskSize: %d\n", mode->GreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenFieldPosition: %d\n", mode->GreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueMaskSize: %d\n", mode->BlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueFieldPosition: %d\n", mode->BlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdMaskSize: %d\n", mode->RsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo);
if (pVesa->major >= 2) {
- ErrorF(" PhysBasePtr: 0x%x\n", mode->PhysBasePtr);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " PhysBasePtr: 0x%x\n", mode->PhysBasePtr);
if (pVesa->major >= 3) {
- ErrorF(" LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine);
- ErrorF(" BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages);
- ErrorF(" LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages);
- ErrorF(" LinRedMaskSize: %d\n", mode->LinRedMaskSize);
- ErrorF(" LinRedFieldPosition: %d\n", mode->LinRedFieldPosition);
- ErrorF(" LinGreenMaskSize: %d\n", mode->LinGreenMaskSize);
- ErrorF(" LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition);
- ErrorF(" LinBlueMaskSize: %d\n", mode->LinBlueMaskSize);
- ErrorF(" LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition);
- ErrorF(" LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize);
- ErrorF(" LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition);
- ErrorF(" MaxPixelClock: %d\n", mode->MaxPixelClock);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRedMaskSize: %d\n", mode->LinRedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " MaxPixelClock: %d\n", mode->MaxPixelClock);
}
}
-#endif
if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */
!(mode->ModeAttributes & (1 << 4)) || /* text mode */
@@ -587,15 +626,16 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
}
-#ifdef DEBUG
- ErrorF("\n");
- ErrorF("Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory,
+ xf86ErrorFVerb(DEBUG_VERB, "\n");
+ xf86ErrorFVerb(DEBUG_VERB,
+ "Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory,
(vbe->TotalMemory * 65536) / (1024 * 1024));
-#endif
pVesa->mapSize = vbe->TotalMemory * 65536;
- if (pScrn->modePool == NULL)
+ if (pScrn->modePool == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No matching modes\n");
return (FALSE);
+ }
for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) {
pMode = pScrn->modePool;
@@ -704,8 +744,12 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->currentMode = pScrn->modes;
pScrn->displayWidth = pScrn->virtualX;
- if (pScrn->modes == NULL)
+ xf86PrintModes(pScrn);
+
+ if (pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes\n");
return (FALSE);
+ }
/* options */
xf86CollectOptions(pScrn, NULL);
@@ -812,7 +856,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pVesa->mapOff = 0;
}
- if ((void*)pVesa->mapPhys == NULL) {
+ if (pVesa->mapPhys == 0) {
pVesa->mapPhys = 0xa0000;
pVesa->mapSize = 0x10000;
}
@@ -1023,6 +1067,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
VESALoadPalette, NULL, flags))
return (FALSE);
+ pVesa->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = VESACloseScreen;
pScreen->SaveScreen = VESASaveScreen;
@@ -1061,7 +1106,8 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pVesa->pDGAMode);
pScrn->vtSema = FALSE;
- return (TRUE);
+ pScreen->CloseScreen = pVesa->CloseScreen;
+ return pScreen->CloseScreen(scrnIndex, pScreen);
}
static Bool
@@ -1152,10 +1198,9 @@ VESAMapVidMem(ScrnInfoPtr pScrn)
else
pVesa->VGAbase = pVesa->base;
}
-#ifdef DEBUG
- ErrorF("virtual address = %p - physical address = %p - size = %d\n",
+ xf86ErrorFVerb(DEBUG_VERB,
+ "virtual address = %p - physical address = %p - size = %d\n",
pVesa->base, pScrn->memPhysBase, pVesa->mapSize);
-#endif
return (pVesa->base != NULL);
}
@@ -1287,7 +1332,9 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
static void
WriteAttr(int index, int value)
{
- CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
+ CARD8 tmp;
+
+ tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
index |= 0x20;
outb(VGA_ATTR_INDEX, index);
@@ -1297,7 +1344,9 @@ WriteAttr(int index, int value)
static int
ReadAttr(int index)
{
- CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
+ CARD8 tmp;
+
+ tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
index |= 0x20;
outb(VGA_ATTR_INDEX, index);
@@ -1597,7 +1646,7 @@ VESADGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName,
VESAPtr pVesa = VESAGetRec(pScrn);
*DeviceName = NULL; /* No special device */
- *ApertureBase = (unsigned char *)(pVesa->mapPhys);
+ *ApertureBase = (unsigned char *)(long)(pVesa->mapPhys);
*ApertureSize = pVesa->mapSize;
*ApertureOffset = pVesa->mapOff;
*flags = DGA_NEED_ROOT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h
index 2fd47666c..1762da648 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h
@@ -26,7 +26,7 @@
*
* Authors: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.7 2001/02/15 20:00:14 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.8 2001/03/22 03:10:58 dawes Exp $
*/
#ifndef _VESA_H_
@@ -112,6 +112,7 @@ typedef struct _VESARec
/* DGA info */
DGAModePtr pDGAMode;
int nDGAMode;
+ CloseScreenProcPtr CloseScreen;
} VESARec, *VESAPtr;
typedef struct _ModeInfoData {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile
new file mode 100644
index 000000000..df44030f8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile
@@ -0,0 +1,53 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.1 2001/04/05 19:29:43 dawes Exp $
+XCOMM
+XCOMM This is an Imakefile for the VMware virtual SVGA driver.
+XCOMM
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS = vmware.c vmwaregc.c vmwarefs.c vmwarepolypnt.c vmwarepush.c \
+ vmwareglblt.c vmwaretext.c vmwarerect.c vmwarefillarc.c \
+ vmwareply1rct.c vmwarezerarc.c vmwareline.c vmwareblt.c vmwareimage.c \
+ vmwarewindow.c vmwarecurs.c vmwarebstor.c bits2pixels.c
+
+OBJS = vmware.o vmwaregc.o vmwarefs.o vmwarepolypnt.o vmwarepush.o \
+ vmwareglblt.o vmwaretext.o vmwarerect.o vmwarefillarc.o \
+ vmwareply1rct.o vmwarezerarc.o vmwareline.o vmwareblt.o vmwareimage.o \
+ vmwarewindow.o vmwarecurs.o vmwarebstor.o bits2pixels.o
+
+#if defined(XF86DriverSDK)
+INCLUDES = -I. -I../../include
+#else
+INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
+ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(XF86SRC)/int10 \
+ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \
+ -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \
+ -I$(XF86SRC)/ramdac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+ -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf8_32bpp\
+ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \
+ -I$(XF86OSSRC)/vbe $(DRIINCLUDES)
+#endif
+
+DEFINES = -DPSZ=8 $(DRIDEFINES)
+
+#if MakeHasPosixVariableSubstitutions
+SubdirLibraryRule($(OBJS))
+#endif
+
+ModuleObjectRule()
+
+ObjectModuleTarget(vmware,$(OBJS))
+
+InstallObjectModule(vmware,$(MODULEDIR),drivers)
+
+#if !defined(XF86DriverSDK)
+InstallModuleManPage(vmware)
+#endif
+
+DependTarget()
+
+InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/vmware)
+
+InstallDriverSDKObjectModule(vmware,$(DRIVERSDKMODULEDIR),drivers)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/README b/xc/programs/Xserver/hw/xfree86/drivers/vmware/README
new file mode 100644
index 000000000..938856018
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/README
@@ -0,0 +1,346 @@
+
+Copyright (C) 1999-2001 VMware, Inc.
+All Rights Reserved
+
+The code here may be used/distributed under the terms of the standard
+XFree86 license.
+
+
+
+ VMware SVGA Device Interface and Programming Model
+ --------------------------------------------------
+
+
+Include Files
+-------------
+
+svga_reg.h
+ SVGA register definitions, SVGA capabilities, and FIFO command definitions.
+
+svga_limits.h
+ Included by svga_reg.h, defines maximum frame buffer and memory region
+ sizes.
+
+guest_os.h
+ Values for the GUEST_ID register.
+
+vm_basic_types.h
+ Common type definitions.
+
+vm_device_version.h
+ PCI vendor ID's and related information.
+
+
+Programming the VMware SVGA Device
+----------------------------------
+
+1. Reading/writing a register:
+ To read a register:
+ Set the index port to the index of the register, using a dword OUT
+ Do a dword IN from the value port
+
+ To write a register:
+ Set the index port to the index of the register, using a dword OUT
+ Do a dword OUT to the value port
+
+2. Initialization
+ Check the version number
+ loop:
+ Write into SVGA_REG_ID the maximum SVGA_ID_* the driver supports.
+ Read from SVGA_REG_ID.
+ Check if it is the value you wrote.
+ If yes, VMware SVGA device supports it
+ If no, decrement SVGA_ID_* and goto loop
+ This algorithm converges.
+
+ Map the frame buffer and the command FIFO
+ Read SVGA_REG_FB_START, SVGA_REG_FB_SIZE, SVGA_REG_MEM_START,
+ SVGA_REG_MEM_SIZE.
+ Map the frame buffer (FB) and the FIFO memory (MEM)
+
+ Get the frame buffer dimensions
+ Read SVGA_REG_MAX_WIDTH, SVGA_REG_MAX_HEIGHT, SVGA_REG_BITS_PER_PIXEL
+
+ SetMode
+ Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT
+ Read SVGA_REG_FB_OFFSET
+ (SVGA_REG_FB_OFFSET is the offset from SVGA_REG_FB_START of the
+ visible portion of the frame buffer)
+ Read SVGA_REG_BYTES_PER_LINE, SVGA_REG_PSEUDOCOLOR, SVGA_REG_GREEN_MASK,
+ SVGA_REG_RED_MASK
+
+ Enable SVGA
+ Set SVGA_REG_ENABLE to 1
+ (to disable SVGA, set SVGA_REG_ENABLE to 0)
+
+ Initialize the command FIFO
+ The FIFO is exclusively dword (32-bit) aligned. The first four
+ dwords define the portion of the MEM area that is used for the
+ command FIFO. These are values are all in byte offsets from the
+ start of the MEM area.
+
+ A minimum sized FIFO would have these values:
+ mem[SVGA_FIFO_MIN] = 16;
+ mem[SVGA_FIFO_MAX] = 16 + (10 * 1024);
+ mem[SVGA_FIFO_NEXT_CMD] = 16;
+ mem[SVGA_FIFO_STOP] = 16;
+
+ Write SVGA_REG_CONFIG_DONE after these values have been set.
+
+3. SVGA command FIFO protocol
+ The FIFO is empty when SVGA_FIFO_NEXT_CMD == SVGA_FIFO_STOP. The
+ driver writes commands to the FIFO starting at the offset specified
+ by SVGA_FIFO_NEXT_CMD, and then increments SVGA_FIFO_NEXT_CMD.
+
+ The FIFO is full when SVGA_FIFO_NEXT_CMD is one word before SVGA_FIFO_STOP.
+
+ When the FIFO becomes full, the FIFO should be sync'd
+
+ To sync the FIFO
+ Write SVGA_REG_SYNC
+ Read SVGA_REG_BUSY
+ Wait for the value in SVGA_REG_BUSY to be 0
+
+ The FIFO should be sync'd before the driver touches the frame buffer, to
+ guarantee that any outstanding BLT's are completed.
+
+4. Capabilities
+ The capabilities of the SVGA device can be queried by reading
+ SVGA_REG_CAPABILITIES.
+
+
+Drawing to the Screen
+---------------------
+
+After initialization, the driver can write directly to the frame buffer.
+The updated frame buffer is not displayed immediately, but only when
+an update command is sent. The update command (SVGA_CMD_UPDATE) defines
+the rectangle in the frame buffer that has been modified by the driver,
+and causes that rectangle to be updated on the screen.
+
+A complete driver can be developed this way. For increased performance,
+additional commands are available to accelerate common operations. The
+two most useful are SVGA_CMD_RECT_FILL and SVGA_CMD_RECT_COPY.
+
+After issuing an accelerated command, the FIFO should be sync'd, as
+described above, before writing to the frame buffer.
+
+
+Addendum on 7/11/2000
+---------------------
+
+SVGA_REG_FB_OFFSET and SVGA_REG_BYTES_PER_LINE may change after
+SVGA_REG_WIDTH or SVGA_REG_HEIGHT is set. Also the VGA registers must
+be written to after setting SVGA_REG_ENABLE to 0 to change the display
+to a VGA mode.
+
+
+Capabilities
+------------
+
+The capabilities register (SVGA_REG_CAPABILITIES) is an array of
+bits that indicates the capabilities of the SVGA emulation.
+This table shows what commands are available, depending on the
+capabilities:
+
+ Command Capability
+ ------- ----------
+
+ SVGA_CMD_RECT_FILL SVGA_CAP_RECT_FILL
+ SVGA_CMD_RECT_COPY SVGA_CAP_RECT_COPY
+ SVGA_CMD_DEFINE_BITMAP SVGA_CAP_OFFSCREEN
+ SVGA_CMD_DEFINE_BITMAP_SCANLINE SVGA_CAP_OFFSCREEN
+ SVGA_CMD_DEFINE_PIXMAP SVGA_CAP_OFFSCREEN
+ SVGA_CMD_DEFINE_PIXMAP_SCANLINE SVGA_CAP_OFFSCREEN
+ SVGA_CMD_RECT_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL
+ SVGA_CMD_RECT_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL
+ SVGA_CMD_RECT_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL
+ SVGA_CMD_RECT_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL
+ SVGA_CMD_FREE_OBJECT SVGA_CAP_OFFSCREEN
+ SVGA_CMD_RECT_ROP_FILL SVGA_CAP_RECT_FILL +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_RECT_ROP_COPY SVGA_CAP_RECT_COPY +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_RECT_ROP_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_RECT_ROP_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_RECT_ROP_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_RECT_ROP_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL +
+ SVGA_CAP_RASTER_OP
+ SVGA_CMD_DEFINE_CURSOR SVGA_CAP_CURSOR
+ SVGA_CMD_DISPLAY_CURSOR SVGA_CAP_CURSOR
+ SVGA_CMD_MOVE_CURSOR SVGA_CAP_CURSOR
+
+The ability to program the cursor directly through the registers
+(described in the next section) is indicated by the capability
+SVGA_CAP_CURSOR_BYPASS.
+
+
+Cursor Handling
+---------------
+
+Starting with GSX Server Beta 3 (after 11/15/2000), a new cursor interface
+was added that bypasses the FIFO. This is programmed using the
+registers SVGA_REG_CURSOR_ID, SVGA_REG_CURSOR_X, SVGA_REG_CURSOR_Y,
+and SVGA_REG_CURSOR_ON.
+
+First, the cursor must be defined using the FIFO command
+SVGA_CMD_DEFINE_CURSOR. This command allocates a cursor ID and
+associates two pixmaps with the cursor, the AND mask and the XOR mask.
+
+To display the cursor, the ID must be written to SVGA_REG_CURSOR_ID,
+the coordinates written to SVGA_REG_CURSOR_X and SVGA_REG_CURSOR_Y,
+then the value 1 must be written to SVGA_REG_CURSOR_ON. No display
+occurs until SVGA_REG_CURSOR_ON is written. The same sequence is used
+to move the cursor.
+
+To turn the cursor off, the ID must be written to SVGA_REG_CURSOR_ID,
+and the value 0 must be written to SVGA_REG_CURSOR_ON.
+
+NOTE: The cursor must be turned off before touching the frame buffer,
+because it is actually drawn into the frame buffer memory in the case
+of direct graphics mode (e.g. full screen mode on Linux). The cursor
+does not have to be turned off before issuing an accelerated command
+via the command FIFO, this case is handled by the SVGA device.
+
+
+Driver Version Numbers
+----------------------
+
+The SVGA drivers use the following convention for their version numbers:
+
+Version 10.0 - The first version that uses the FIFO
+Version 10.1 - The version that uses the hardware cursor emulation via the FIFO
+Version 10.2 - The version that uses the cursor that bypasses the FIFO
+
+
+Frequently Asked Questions
+--------------------------
+
+1. My driver doesn't display anything, what's going on?
+
+First check if you are issuing an SVGA_CMD_UPDATE after drawing to
+the screen. Another check you can do is to run your driver in full
+screen mode on a Linux host. In this case you are drawing directly
+on the frame buffer, so what you draw to the screen will be immediately
+visible. If nothing is visible in this case, then most likely your
+driver hasn't mapped the frame buffer correctly.
+
+A discrepancy between what you get in full screen mode and what you
+get in window mode indicates that you have a missing or incorrect
+update command.
+
+
+2. What's the difference between bitmaps and pixmaps?
+
+Pixmaps have the same depth as the screen, while bitmaps have depth one.
+When a bitmap is drawn, the command also takes two colors, foreground and
+background. The set bits in the bitmap are replaced with the foreground
+color, and the unset bits are replaced with the background color.
+
+Pixmaps, on the other hand, can be directly copied to the screen.
+
+
+3. What's the significance of the ROP in the commands SVGA_CMD_RECT_ROP_FILL,
+SVGA_CMD_RECT_ROP_BITMAP_COPY, etc. ?
+
+The ROP in the ...ROP... commands is a raster operation. It has the same
+significance (and encoding) as it does in X Windows. The ROP value
+SVGA_ROP_COPY means the source is copied to the destination, which makes
+these commands the same as their non-ROP counterparts. The most commonly
+used raster operation other than copy is probably SVGA_ROP_XOR, which
+combines the source and destination using exclusive-or.
+
+
+4. Tell me more about bitmaps and pixmaps. For example, the macro
+SVGA_CMD_DEFINE_BITMAP has a field <scanlines>. What should this be
+set to? Likewise with SVGA_CMD_DEFINE_PIXMAP. And when should the
+SCANLINE macros be used?
+
+OK, I'll use pixmaps as an example. First you have to define the pixmap:
+
+#define SVGA_CMD_DEFINE_PIXMAP 6
+ /* FIFO layout:
+ Pixmap ID, Width, Height, Depth, <scanlines> */
+
+The ID is something you choose, which you subsequently use to refer to
+this pixmap. It must be an integer between 0 and SVGA_MAX_ID.
+
+The width and height and depth are the dimensions of the pixmap. For now,
+the depth of the pixmap has to match the depth of the screen.
+
+The scanlines are the pixels that make up the pixmap, arranged one row
+at a time. Each row is required to be 32-bit aligned. The macros
+SVGA_PIXMAP_SCANLINE_SIZE and SVGA_PIXMAP_SIZE give the size of a
+single scanline, and the size of the entire pixmap, respectively, in
+32-bit words.
+
+The second step is to use it:
+
+#define SVGA_CMD_RECT_PIXMAP_FILL 9
+ /* FIFO layout:
+ Pixmap ID, X, Y, Width, Height */
+
+The ID here is the one you chose when defining the pixmap. X, Y,
+Width, and Height define a rectangle on the screen that is to be filled
+with the pixmap. The pixmap is screen aligned, which means that the
+coordinates in the pixmap are defined by the screen coordinates modulo
+the pixmap dimensions.
+
+If you want a different alignment between the screen and the pixmap,
+then you can use this command, which allows the pixmap coordinates to
+be defined:
+
+#define SVGA_CMD_RECT_PIXMAP_COPY 11
+ /* FIFO layout:
+ Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width,
+ Height */
+
+The Source X and Source Y are pixmap coordinates, and the Dest X and
+Dest Y are screen coordinates.
+
+
+5. OK, now it works briefly, then stops displaying anything. Also,
+my log file is filled with lines like:
+ Unknown Command 0xff in SVGA command FIFO
+What's happening?
+
+The most common problem at this point is that the FIFO gets out
+of sync. This can happen if the amount of data in the FIFO doesn't
+match what the VMware SVGA device expects. To track this down, try
+to isolate the particular command which causes the problem.
+
+Another way this can happen is if the wraparound in the FIFO isn't
+done correctly. Here is some example code for writing to the FIFO
+(mem is an array of 32-bit integers that points to the FIFO memory
+region):
+
+while (TRUE) {
+ fifo_min = mem[SVGA_FIFO_MIN] / 4;
+ fifo_max = mem[SVGA_FIFO_MAX] / 4;
+ fifo_next = mem[SVGA_FIFO_NEXT_CMD] / 4;
+ fifo_stop = mem[SVGA_FIFO_STOP] / 4;
+
+ tmp_next = fifo_next+1;
+ if (tmp_next == fifo_max)
+ tmp_next = fifo_min; // Wraparound
+
+ if (tmp_next == fifo_stop) {
+ sync_fifo(); // FIFO full
+ continue; // retry
+ }
+
+ mem[fifo_next] = item;
+ mem[SVGA_FIFO_NEXT_CMD] = tmp_next * 4;
+ break;
+}
+
+This isn't the most efficient code, but it should work. It's important
+to do the increment with wraparound before the FIFO full check, and to
+check FIFO full before updating the next command pointer.
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.2 2001/04/05 21:09:37 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c
new file mode 100644
index 000000000..9b73e86db
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c
@@ -0,0 +1,1415 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c,v 1.1 2001/04/05 19:29:43 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_bits2pixels[] = "Id: bits2pixels.c,v 1.6 2001/01/26 23:32:15 yoel Exp $";
+#else
+#define FILECODE "F(814)"
+#endif
+
+/*
+ * bits2pixels.c --
+ *
+ * Emulation routines to convert bitmaps to pixmaps
+ */
+
+#include "vm_basic_types.h"
+#include "bits2pixels.h"
+
+
+/*
+ * Local functions
+ */
+
+void RasterBitsToPixels8(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+void RasterBitsToPixels16(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+void RasterBitsToPixels24(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+void RasterBitsToPixels32(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Raster_BitsToPixels --
+ *
+ * Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ * color (fg) and 0 bits to the background color (bg).
+ *
+ * Results:
+ * Pixmap filled with pixels
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Raster_BitsToPixels(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment, int bytes_per_pixel,
+ uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+ switch (bytes_per_pixel) {
+ case 1:
+ RasterBitsToPixels8(bits, bits_increment, pix, pix_increment,
+ width, height, fg, bg);
+ break;
+
+ case 2:
+ RasterBitsToPixels16(bits, bits_increment, pix, pix_increment,
+ width, height, fg, bg);
+ break;
+
+ case 3:
+ RasterBitsToPixels24(bits, bits_increment, pix, pix_increment,
+ width, height, fg, bg);
+ break;
+
+ case 4:
+ RasterBitsToPixels32(bits, bits_increment, pix, pix_increment,
+ width, height, fg, bg);
+ break;
+ }
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels8 --
+ *
+ * Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ * color (fg) and 0 bits to the background color (bg), for an 8-bit
+ * pixmap
+ *
+ * Results:
+ * Pixmap filled with pixels
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels8(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+ uint8 *lpix, *lbits;
+ int i, j;
+ uint32 expbits = 0; /* Bits to be expanded */
+
+ for (i=0; i<height; i++) {
+ lpix = pix;
+ lbits = bits;
+ for (j = width ; j > 0; j -= 4) {
+ expbits = (*lbits >> 4) & 0x0f;
+
+ if (j < 4)
+ break;
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+
+ expbits = *lbits & 0x0f;
+
+ j -= 4;
+ if (j < 4) {
+ break;
+ }
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+ lbits++;
+ }
+
+ if (j > 0) {
+ *lpix++ = (expbits & 0x08) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x04) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x02) ? fg : bg;
+ j--;
+ }
+ }
+ }
+
+ pix += pix_increment;
+ bits += bits_increment;
+ }
+ return;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels16 --
+ *
+ * Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ * color (fg) and 0 bits to the background color (bg), for a 16-bit
+ * pixmap
+ *
+ * Results:
+ * Pixmap filled with pixels
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels16(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+ uint16 *lpix;
+ uint8 *lbits;
+ int i, j;
+ uint32 expbits = 0; /* Bits to be expanded */
+
+ for (i=0; i<height; i++) {
+ lpix = (uint16 *)pix;
+ lbits = bits;
+ for (j = width; j > 0; j -= 4) {
+ expbits = (*lbits >> 4) & 0x0f;
+
+ if (j < 4)
+ break;
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+
+ expbits = *lbits & 0x0f;
+
+ j -= 4;
+ if (j < 4) {
+ break;
+ }
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+ lbits++;
+ }
+
+ if (j > 0) {
+ *lpix++ = (expbits & 0x08) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x04) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x02) ? fg : bg;
+ j--;
+ }
+ }
+ }
+
+ pix += pix_increment;
+ bits += bits_increment;
+ }
+ return;
+}
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels24 --
+ *
+ * Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ * color (fg) and 0 bits to the background color (bg), for a 24-bit
+ * pixmap
+ *
+ * Results:
+ * Pixmap filled with pixels
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels24(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+ uint8 *lpix, *lbits;
+ uint32 fgColor1, fgColor2, fgColor3;
+ uint32 bgColor1, bgColor2, bgColor3;
+
+ int i, j;
+ uint32 expbits = 0; /* Bits to be expanded */
+
+ fgColor1 = fg & 0x000000ff;
+ fgColor2 = (fg >> 8) & 0x000000ff;
+ fgColor3 = (fg >> 16) & 0x000000ff;
+
+ bgColor1 = bg & 0x000000ff;
+ bgColor2 = (bg >> 8) & 0x000000ff;
+ bgColor3 = (bg >> 16) & 0x000000ff;
+
+ for (i=0; i<height; i++) {
+ lpix = pix;
+ lbits = bits;
+ for (j = width; j > 0; j -= 4) {
+ expbits = (*lbits >> 4) & 0x0f;
+
+ if (j < 4)
+ break;
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 1:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 2:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 3:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 4:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 5:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 6:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 7:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 8:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 9:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 10:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 11:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 12:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 13:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 14:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 15:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ }
+
+ expbits = *lbits & 0x0f;
+
+ j -= 4;
+ if (j < 4) {
+ break;
+ }
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 1:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 2:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 3:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 4:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 5:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 6:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 7:
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 8:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 9:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 10:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 11:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 12:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 13:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ case 14:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = bgColor1;
+ *lpix++ = bgColor2;
+ *lpix++ = bgColor3;
+ break;
+ case 15:
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ *lpix++ = fgColor1;
+ *lpix++ = fgColor2;
+ *lpix++ = fgColor3;
+ break;
+ }
+ lbits++;
+ }
+
+ if (j > 0) {
+ *lpix++ = (expbits & 0x08) ? fgColor1 : bgColor1;
+ *lpix++ = (expbits & 0x08) ? fgColor2 : bgColor2;
+ *lpix++ = (expbits & 0x08) ? fgColor3 : bgColor3;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x04) ? fgColor1 : bgColor1;
+ *lpix++ = (expbits & 0x04) ? fgColor2 : bgColor2;
+ *lpix++ = (expbits & 0x04) ? fgColor3 : bgColor3;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x02) ? fgColor1 : bgColor1;
+ *lpix++ = (expbits & 0x02) ? fgColor2 : bgColor2;
+ *lpix++ = (expbits & 0x02) ? fgColor3 : bgColor3;
+ j--;
+ }
+ }
+ }
+
+ pix += pix_increment;
+ bits += bits_increment;
+ }
+ return;
+}
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels32 --
+ *
+ * Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ * color (fg) and 0 bits to the background color (bg), for a 32-bit
+ * pixmap
+ *
+ * Results:
+ * Pixmap filled with pixels
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels32(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment,
+ uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+ uint32 *lpix;
+ uint8 *lbits;
+ int i, j;
+ uint32 expbits = 0; /* Bits to be expanded */
+
+ for (i=0; i<height; i++) {
+ lpix = (uint32 *)pix;
+ lbits = bits;
+ for (j = width; j > 0; j -= 4) {
+ expbits = (*lbits >> 4) & 0x0f;
+
+ if (j < 4)
+ break;
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+
+ expbits = *lbits & 0x0f;
+
+ j -= 4;
+ if (j < 4) {
+ break;
+ }
+
+ switch (expbits) {
+ case 0:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 1:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 2:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 3:
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 4:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 5:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 6:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 7:
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 8:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 9:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 10:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 11:
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ case 12:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = bg;
+ break;
+ case 13:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ *lpix++ = fg;
+ break;
+ case 14:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = bg;
+ break;
+ case 15:
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ *lpix++ = fg;
+ break;
+ }
+ lbits++;
+ }
+
+ if (j > 0) {
+ *lpix++ = (expbits & 0x08) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x04) ? fg : bg;
+ j--;
+ if (j > 0) {
+ *lpix++ = (expbits & 0x02) ? fg : bg;
+ j--;
+ }
+ }
+ }
+
+ pix += pix_increment;
+ bits += bits_increment;
+ }
+ return;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h
new file mode 100644
index 000000000..348d0c05c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h
@@ -0,0 +1,25 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: bits2pixels.h,v 1.4 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+/*
+ * bits2pixels.h --
+ *
+ * Drawing emulation routines
+ */
+
+#ifndef _BITS2PIXELS_H_
+#define _BITS2PIXELS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#include "includeCheck.h"
+
+void
+Raster_BitsToPixels(uint8 *bits, uint32 bits_increment,
+ uint8 *pix, uint32 pix_increment, int bytes_per_pixel,
+ uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+#endif /* _BITS4PIXELS_H_ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h
new file mode 100644
index 000000000..dedebe040
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h
@@ -0,0 +1,30 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* *********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: guest_os.h,v 1.5 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+#ifndef _GUEST_OS_H_
+#define _GUEST_OS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#include "includeCheck.h"
+
+#define GUEST_OS_BASE 0x5000
+
+#define GUEST_OS_DOS (GUEST_OS_BASE+1)
+#define GUEST_OS_WIN31 (GUEST_OS_BASE+2)
+#define GUEST_OS_WINDOWS95 (GUEST_OS_BASE+3)
+#define GUEST_OS_WINDOWS98 (GUEST_OS_BASE+4)
+#define GUEST_OS_WINDOWSME (GUEST_OS_BASE+5)
+#define GUEST_OS_NT (GUEST_OS_BASE+6)
+#define GUEST_OS_WIN2000 (GUEST_OS_BASE+7)
+#define GUEST_OS_LINUX (GUEST_OS_BASE+8)
+#define GUEST_OS_OS2 (GUEST_OS_BASE+9)
+#define GUEST_OS_OTHER (GUEST_OS_BASE+10)
+#define GUEST_OS_FREEBSD (GUEST_OS_BASE+11)
+#define GUEST_OS_WHISTLER (GUEST_OS_BASE+12)
+
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h
new file mode 100644
index 000000000..05090865e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h
@@ -0,0 +1,2 @@
+/* This space intentionally left blank. */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h,v 1.2 2001/04/06 17:44:58 dawes Exp $ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h
new file mode 100644
index 000000000..cbd878330
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h
@@ -0,0 +1,57 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: svga_limits.h,v 1.8 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+/*
+ * svga_reg.h --
+ *
+ * SVGA limits
+ */
+
+#ifndef _SVGA_LIMITS_H_
+#define _SVGA_LIMITS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#include "includeCheck.h"
+
+/*
+ * Location and size of SVGA frame buffer.
+ */
+#define SVGA_FB_MAX_SIZE (16*1024*1024)
+#define SVGA_MEM_SIZE (256*1024)
+
+/*
+ * SVGA_FB_START is the default starting address of the SVGA frame
+ * buffer in the guest's physical address space.
+ * SVGA_FB_START_BIGMEM is the starting address of the SVGA frame
+ * buffer for VMs that have a large amount of physical memory.
+ *
+ * The address of SVGA_FB_START is set to 2GB - (SVGA_FB_MAX_SIZE + SVGA_MEM_SIZE),
+ * thus the SVGA frame buffer sits at [SVGA_FB_START .. 2GB-1] in the
+ * physical address space. Our older SVGA drivers for NT treat the
+ * address of the frame buffer as a signed integer. For backwards
+ * compatibility, we keep the default location of the frame buffer
+ * at under 2GB in the address space. This restricts VMs to have "only"
+ * up to ~2031MB (i.e., up to SVGA_FB_START) of physical memory.
+ *
+ * For VMs that want more memory than the ~2031MB, we place the SVGA
+ * frame buffer at SVGA_FB_START_BIGMEM. This allows VMs to have up
+ * to 3584MB, at least as far as the SVGA frame buffer is concerned
+ * (note that there may be other issues that limit the VM memory
+ * size). PCI devices use high memory addresses, so we have to put
+ * SVGA_FB_START_BIGMEM low enough so that it doesn't overlap with any
+ * of these devices. Placing SVGA_FB_START_BIGMEM at 0xE0000000
+ * should leave plenty of room for the PCI devices.
+ *
+ * NOTE: All of that is only true for the 0710 chipset. As of the 0405
+ * chipset, the framebuffer start is determined solely based on the value
+ * the guest BIOS or OS programs into the PCI base address registers.
+ */
+#define SVGA_FB_LEGACY_START 0x7EFC0000
+#define SVGA_FB_LEGACY_START_BIGMEM 0xE0000000
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h
new file mode 100644
index 000000000..0452b5d39
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h
@@ -0,0 +1,284 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: svga_reg.h,v 1.9 2001/03/02 02:06:47 bhlim Exp $
+ * **********************************************************/
+
+/*
+ * svga_reg.h --
+ *
+ * SVGA hardware definitions
+ */
+
+#ifndef _SVGA_REG_H_
+#define _SVGA_REG_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#include "includeCheck.h"
+
+#include "svga_limits.h"
+
+/*
+ * Memory and port addresses and fundamental constants
+ */
+
+#define SVGA_MAX_WIDTH 2364
+#define SVGA_MAX_HEIGHT 1773
+
+#ifdef VMX86_SERVER
+#define SVGA_DEFAULT_MAX_WIDTH 1600
+#define SVGA_DEFAULT_MAX_HEIGHT 1200
+#else
+#define SVGA_DEFAULT_MAX_WIDTH SVGA_MAX_WIDTH
+#define SVGA_DEFAULT_MAX_HEIGHT SVGA_MAX_HEIGHT
+#endif
+
+#define SVGA_MAX_BITS_PER_PIXEL 32
+#if SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * SVGA_MAX_BITS_PER_PIXEL / 8 > \
+ SVGA_FB_MAX_SIZE
+#error "Bad SVGA maximum sizes"
+#endif
+#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
+#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
+
+#define SVGA_MAGIC 0x900000
+#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
+
+/* Version 2 let the address of the frame buffer be unsigned on Win32 */
+#define SVGA_VERSION_2 2
+#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
+
+/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
+ PALETTE_BASE has moved */
+#define SVGA_VERSION_1 1
+#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
+
+/* Version 0 is the initial version */
+#define SVGA_VERSION_0 0
+#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
+
+/* Invalid SVGA_ID_ */
+#define SVGA_ID_INVALID 0xFFFFFFFF
+
+/* More backwards compatibility, old location of color map: */
+#define SVGA_OLD_PALETTE_BASE 17
+
+/* Base and Offset gets us headed the right way for PCI Base Addr Registers */
+#define SVGA_LEGACY_BASE_PORT 0x4560
+#define SVGA_INDEX_PORT 0x0
+#define SVGA_VALUE_PORT 0x1
+#define SVGA_BIOS_PORT 0x2
+#define SVGA_NUM_PORTS 0x3
+
+/* This port is deprecated, but retained because of old drivers. */
+#define SVGA_LEGACY_ACCEL_PORT 0x3
+
+/*
+ * Registers
+ */
+
+enum {
+ SVGA_REG_ID = 0,
+ SVGA_REG_ENABLE = 1,
+ SVGA_REG_WIDTH = 2,
+ SVGA_REG_HEIGHT = 3,
+ SVGA_REG_MAX_WIDTH = 4,
+ SVGA_REG_MAX_HEIGHT = 5,
+ SVGA_REG_DEPTH = 6,
+ SVGA_REG_BITS_PER_PIXEL = 7,
+ SVGA_REG_PSEUDOCOLOR = 8,
+ SVGA_REG_RED_MASK = 9,
+ SVGA_REG_GREEN_MASK = 10,
+ SVGA_REG_BLUE_MASK = 11,
+ SVGA_REG_BYTES_PER_LINE = 12,
+ SVGA_REG_FB_START = 13,
+ SVGA_REG_FB_OFFSET = 14,
+ SVGA_REG_FB_MAX_SIZE = 15,
+ SVGA_REG_FB_SIZE = 16,
+
+ SVGA_REG_CAPABILITIES = 17,
+ SVGA_REG_MEM_START = 18, /* Memory for command FIFO and bitmaps */
+ SVGA_REG_MEM_SIZE = 19,
+ SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */
+ SVGA_REG_SYNC = 21, /* Write to force synchronization */
+ SVGA_REG_BUSY = 22, /* Read to check if sync is done */
+ SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */
+ SVGA_REG_CURSOR_ID = 24, /* ID of cursor */
+ SVGA_REG_CURSOR_X = 25, /* Set cursor X position */
+ SVGA_REG_CURSOR_Y = 26, /* Set cursor Y position */
+ SVGA_REG_CURSOR_ON = 27, /* Turn cursor on/off */
+
+ SVGA_REG_TOP = 28, /* Must be 1 greater than the last register */
+
+ SVGA_PALETTE_BASE = 1024 /* Base of SVGA color map */
+};
+
+
+/*
+ * Capabilities
+ */
+
+#define SVGA_CAP_RECT_FILL 0x0001
+#define SVGA_CAP_RECT_COPY 0x0002
+#define SVGA_CAP_RECT_PAT_FILL 0x0004
+#define SVGA_CAP_OFFSCREEN 0x0008
+#define SVGA_CAP_RASTER_OP 0x0010
+#define SVGA_CAP_CURSOR 0x0020
+#define SVGA_CAP_CURSOR_BYPASS 0x0040
+
+
+/*
+ * Raster op codes (same encoding as X)
+ */
+
+#define SVGA_ROP_CLEAR 0x00
+#define SVGA_ROP_AND 0x01
+#define SVGA_ROP_AND_REVERSE 0x02
+#define SVGA_ROP_COPY 0x03
+#define SVGA_ROP_AND_INVERTED 0x04
+#define SVGA_ROP_NOOP 0x05
+#define SVGA_ROP_XOR 0x06
+#define SVGA_ROP_OR 0x07
+#define SVGA_ROP_NOR 0x08
+#define SVGA_ROP_EQUIV 0x09
+#define SVGA_ROP_INVERT 0x0a
+#define SVGA_ROP_OR_REVERSE 0x0b
+#define SVGA_ROP_COPY_INVERTED 0x0c
+#define SVGA_ROP_OR_INVERTED 0x0d
+#define SVGA_ROP_NAND 0x0e
+#define SVGA_ROP_SET 0x0f
+
+
+/*
+ * Memory area offsets (viewed as an array of 32-bit words)
+ */
+
+/*
+ * The distance from MIN to MAX must be at least 10K
+ */
+
+#define SVGA_FIFO_MIN 0
+#define SVGA_FIFO_MAX 1
+#define SVGA_FIFO_NEXT_CMD 2
+#define SVGA_FIFO_STOP 3
+
+#define SVGA_FIFO_USER_DEFINED 4
+
+/*
+ * Drawing object ID's, in the range 0 to SVGA_MAX_ID
+ */
+
+#define SVGA_MAX_ID 499
+
+/*
+ * Macros to compute variable length items (sizes in 32-bit words)
+ */
+
+#define SVGA_BITMAP_SIZE(w,h) ((((w)+31) >> 5) * (h))
+#define SVGA_BITMAP_SCANLINE_SIZE(w) (( (w)+31 ) >> 5)
+#define SVGA_PIXMAP_SIZE(w,h,d) ((( ((w)*(d))+31 ) >> 5) * (h))
+#define SVGA_PIXMAP_SCANLINE_SIZE(w,d) (( ((w)*(d))+31 ) >> 5)
+
+/*
+ * Increment from one scanline to the next of a bitmap or pixmap
+ */
+#define SVGA_BITMAP_INCREMENT(w) ((( (w)+31 ) >> 5) * sizeof (uint32))
+#define SVGA_PIXMAP_INCREMENT(w,d) ((( ((w)*(d))+31 ) >> 5) * sizeof (uint32))
+
+/*
+ * Commands in the command FIFO
+ */
+
+#define SVGA_CMD_UPDATE 1
+ /* FIFO layout:
+ X, Y, Width, Height */
+
+#define SVGA_CMD_RECT_FILL 2
+ /* FIFO layout:
+ Color, X, Y, Width, Height */
+
+#define SVGA_CMD_RECT_COPY 3
+ /* FIFO layout:
+ Source X, Source Y, Dest X, Dest Y, Width, Height */
+
+#define SVGA_CMD_DEFINE_BITMAP 4
+ /* FIFO layout:
+ Pixmap ID, Width, Height, <scanlines> */
+
+#define SVGA_CMD_DEFINE_BITMAP_SCANLINE 5
+ /* FIFO layout:
+ Pixmap ID, Width, Height, Line #, scanline */
+
+#define SVGA_CMD_DEFINE_PIXMAP 6
+ /* FIFO layout:
+ Pixmap ID, Width, Height, Depth, <scanlines> */
+
+#define SVGA_CMD_DEFINE_PIXMAP_SCANLINE 7
+ /* FIFO layout:
+ Pixmap ID, Width, Height, Depth, Line #, scanline */
+
+#define SVGA_CMD_RECT_BITMAP_FILL 8
+ /* FIFO layout:
+ Bitmap ID, X, Y, Width, Height, Foreground, Background */
+
+#define SVGA_CMD_RECT_PIXMAP_FILL 9
+ /* FIFO layout:
+ Pixmap ID, X, Y, Width, Height */
+
+#define SVGA_CMD_RECT_BITMAP_COPY 10
+ /* FIFO layout:
+ Bitmap ID, Source X, Source Y, Dest X, Dest Y,
+ Width, Height, Foreground, Background */
+
+#define SVGA_CMD_RECT_PIXMAP_COPY 11
+ /* FIFO layout:
+ Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, Height */
+
+#define SVGA_CMD_FREE_OBJECT 12
+ /* FIFO layout:
+ Object (pixmap, bitmap, ...) ID */
+
+#define SVGA_CMD_RECT_ROP_FILL 13
+ /* FIFO layout:
+ Color, X, Y, Width, Height, ROP */
+
+#define SVGA_CMD_RECT_ROP_COPY 14
+ /* FIFO layout:
+ Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
+
+#define SVGA_CMD_RECT_ROP_BITMAP_FILL 15
+ /* FIFO layout:
+ ID, X, Y, Width, Height, Foreground, Background, ROP */
+
+#define SVGA_CMD_RECT_ROP_PIXMAP_FILL 16
+ /* FIFO layout:
+ ID, X, Y, Width, Height, ROP */
+
+#define SVGA_CMD_RECT_ROP_BITMAP_COPY 17
+ /* FIFO layout:
+ ID, Source X, Source Y,
+ Dest X, Dest Y, Width, Height, Foreground, Background, ROP */
+
+#define SVGA_CMD_RECT_ROP_PIXMAP_COPY 18
+ /* FIFO layout:
+ ID, Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
+
+#define SVGA_CMD_DEFINE_CURSOR 19
+ /* FIFO layout:
+ ID, Hotspot X, Hotspot Y, Width, Height,
+ Depth for AND mask, Depth for XOR mask,
+ <scanlines for AND mask>, <scanlines for XOR mask> */
+
+#define SVGA_CMD_DISPLAY_CURSOR 20
+ /* FIFO layout:
+ ID, On/Off (1 or 0) */
+
+#define SVGA_CMD_MOVE_CURSOR 21
+ /* FIFO layout:
+ X, Y */
+
+#define SVGA_CMD_MAX 22
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h
new file mode 100644
index 000000000..a884ce77b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h
@@ -0,0 +1,167 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: vm_basic_types.h,v 1.9 2001/02/14 22:22:53 bennett Exp $
+ * **********************************************************/
+
+/*
+ *
+ * vm_basic_types.h --
+ *
+ * basic data types.
+ */
+
+
+#ifndef _VM_BASIC_TYPES_H_
+#define _VM_BASIC_TYPES_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#include "includeCheck.h"
+
+/* STRICT ANSI means the Xserver build and X defines Bool differently. */
+#ifndef __STRICT_ANSI__
+typedef char Bool;
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifdef _MSC_VER
+typedef unsigned __int64 uint64;
+typedef signed __int64 int64;
+
+#pragma warning (disable :4018) // signed/unsigned mismatch
+#pragma warning (disable :4761) // integral size mismatch in argument; conversion supplied
+#pragma warning (disable :4305) // truncation from 'const int' to 'short'
+#pragma warning (disable :4244) // conversion from 'unsigned short' to 'unsigned char'
+//#pragma warning (disable :4101) // unreferenced local variable
+#pragma warning (disable :4133) // incompatible types - from 'struct VM *' to 'int *'
+#pragma warning (disable :4047) // differs in levels of indirection
+#pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned
+#pragma warning (disable :4142) // benign redefinition of type
+
+#elif __GNUC__
+/* The Xserver source compiles with -ansi -pendantic */
+#ifndef __STRICT_ANSI__
+typedef unsigned long long uint64;
+typedef long long int64;
+#endif
+#else
+#error - Need compiler define for int64/uint64
+#endif
+
+typedef unsigned int uint32;
+typedef unsigned short uint16;
+typedef unsigned char uint8;
+
+typedef int int32;
+typedef short int16;
+typedef char int8;
+
+
+/*
+ * Printf format for 64-bit number. Use it like this:
+ * printf("%"FMT64"d\n", big);
+ */
+
+#ifdef _MSC_VER
+#define FMT64 "I64"
+#elif __GNUC__
+#define FMT64 "L"
+#else
+#error - Need compiler define for FMT64
+#endif
+
+typedef uint32 VA;
+typedef uint32 VPN;
+
+typedef uint32 PA;
+typedef uint32 PPN;
+
+typedef uint32 MA;
+typedef uint32 MPN;
+
+#define INVALID_MPN ((MPN)-1)
+
+#define EXTERN extern
+/*
+ * Right now our use of CONST is broken enough that it only works
+ * with GCC. XXX Need to fix this.
+ */
+#ifdef __GNUC__
+#define CONST const
+#else
+#ifndef CONST
+#define CONST
+#endif
+#endif
+
+#ifdef _MSC_VER
+#ifndef INLINE
+#define INLINE __inline
+#endif
+#else
+#ifndef INLINE
+#define INLINE inline
+#endif
+#endif
+
+
+#if defined(WIN32) && !defined(VMX86_NO_THREADS)
+#define THREADSPECIFIC _declspec(thread)
+#else
+#define THREADSPECIFIC
+#endif
+
+/*
+ * Like "INLINE" but use this token to mark functions that are inline
+ * because they have only a single call site. In other words, if a second
+ * call site is introduced, the "INLINE_SINGLE_CALLER" token should be
+ * removed.
+ */
+#define INLINE_SINGLE_CALLER INLINE
+
+/*
+ * Attributes placed on function declarations to tell the compiler
+ * that the function never returns.
+ */
+#ifdef _MSC_VER
+#define NORETURN_DECL(_fndecl) __declspec(noreturn) _fndecl
+#elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 5
+#define NORETURN_DECL(_fndecl) _fndecl __attribute__((__noreturn__))
+#else
+#define NORETURN_DECL(_fndecl) _fndecl
+#endif
+
+
+/*
+ * GCC's argument checking for printf-like functions
+ * This is conditional until we have replaced all `"%x", void *'
+ * with `"0x%08x", (uint32) void *'. Note that %p prints different things
+ * on different platforms.
+ *
+ * fmtPos is the position of the format string argument, beginning at 1
+ * varPos is the position of the variable argument, beginning at 1
+ */
+#if defined(__GNUC__) && defined(notdef)
+# define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos)))
+#else
+# define PRINTF_DECL(fmtPos, varPos)
+#endif
+
+/*
+ * Used to silence compiler warnings that get generated when the
+ * compiler thinks that a function returns when it is marked noreturn.
+ */
+#define INFINITE_LOOP() do { } while (1)
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h
new file mode 100644
index 000000000..8f6dd3b87
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h
@@ -0,0 +1,64 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: vm_device_version.h,v 1.2 2001/01/26 21:53:27 yoel Exp $
+ * **********************************************************/
+
+
+#ifndef VM_DEVICE_VERSION_H
+#define VM_DEVICE_VERSION_H
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#include "includeCheck.h"
+
+#define PCI_VENDOR_ID_VMWARE 0x15AD
+#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+#define PCI_DEVICE_ID_VMWARE_NET 0x0720
+#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730
+#define PCI_DEVICE_ID_VMWARE_IDE 0x1729
+
+/* From linux/pci.h. We emulate an AMD ethernet controller */
+#define PCI_VENDOR_ID_AMD 0x1022
+#define PCI_DEVICE_ID_AMD_VLANCE 0x2000
+#define PCI_VENDOR_ID_BUSLOGIC 0x104B
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
+
+/* Intel Values for the chipset */
+#define PCI_VENDOR_ID_INTEL 0x8086
+#define PCI_DEVICE_ID_INTEL_82439TX 0x7100
+#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110
+#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
+#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
+#define PCI_DEVICE_ID_INTEL_82443BX 0x7192
+
+
+/************* Strings for IDE Identity Fields **************************/
+#define VIDE_ID_SERIAL_STR "00000000000000000001" /* Must be 20 Bytes */
+#define VIDE_ID_FIRMWARE_STR "00000001" /* Must be 8 Bytes */
+
+/* No longer than 40 Bytes and must be an even length. */
+#define VIDE_ATA_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE Hard Drive "
+#define VIDE_ATAPI_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE CDROM Drive "
+
+#define ATAPI_VENDOR_ID "NECVMWar" /* Must be 8 Bytes */
+#define ATAPI_PRODUCT_ID PRODUCT_GENERIC_NAME " IDE CDROM" /* Must be 16 Bytes */
+#define ATAPI_REV_LEVEL "1.00" /* Must be 4 Bytes */
+
+
+/************* Strings for SCSI Identity Fields **************************/
+#define SCSI_DISK_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI Hard Drive"
+#define SCSI_CDROM_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI CDROM Drive"
+
+/************* Strings for the VESA BIOS Identity Fields *****************/
+#define VBE_OEM_STRING COMPANY_NAME " SVGA"
+#define VBE_VENDOR_NAME COMPANY_NAME
+#define VBE_PRODUCT_NAME PRODUCT_GENERIC_NAME
+
+
+#endif /* VM_DEVICE_VERSION_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
new file mode 100644
index 000000000..04ca7f8bf
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
@@ -0,0 +1,1426 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmware[] =
+
+ "Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Resources.h"
+
+#include "compiler.h" /* inb/outb */
+
+#include "xf86PciInfo.h" /* pci vendor id */
+#include "xf86Pci.h" /* pci */
+
+#include "mipointer.h" /* sw cursor */
+#include "mibstore.h" /* backing store */
+#include "micmap.h" /* mi color map */
+#include "vgaHW.h" /* VGA hardware */
+#define PSZ 8 /* 8bpp */
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h" /* 16bpp */
+#include "cfb24.h" /* 24bpp */
+#include "cfb32.h" /* 32bpp */
+
+#include "xf86cmap.h" /* xf86HandleColormaps */
+
+#include "vmware.h"
+#include "guest_os.h"
+#include "vm_device_version.h"
+
+/*
+ * Sanity check that xf86PciInfo.h has the correct values (which come from
+ * the VMware source tree in vm_device_version.h.
+ */
+#if PCI_CHIP_VMWARE0405 != PCI_DEVICE_ID_VMWARE_SVGA2
+#error "PCI_CHIP_VMWARE0405 is wrong, update it from vm_device_version.h"
+#endif
+#if PCI_CHIP_VMWARE0710 != PCI_DEVICE_ID_VMWARE_SVGA
+#error "PCI_CHIP_VMWARE0710 is wrong, update it from vm_device_version.h"
+#endif
+#if PCI_VENDOR_VMWARE != PCI_VENDOR_ID_VMWARE
+#error "PCI_VENDOR_VMWARE is wrong, update it from vm_device_version.h"
+#endif
+
+/*
+ * This is the only way I know to turn a #define of an integer constant into
+ * a constant string.
+ */
+#define VMW_INNERSTRINGIFY(s) #s
+#define VMW_STRING(str) VMW_INNERSTRINGIFY(str)
+
+#define VMWARE_NAME "VMWARE"
+#define VMWARE_DRIVER_NAME "vmware"
+#define VMWARE_MAJOR_VERSION 10
+#define VMWARE_MINOR_VERSION 4
+#define VMWARE_PATCHLEVEL 0
+#define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL)
+
+static const char VMWAREBuildStr[] =
+ "VMware Guest X Server " VMW_STRING(VMWARE_MAJOR_VERSION)
+ "." VMW_STRING(VMWARE_MINOR_VERSION)
+ "." VMW_STRING(VMWARE_PATCHLEVEL) " - build=$Name: $\n";
+
+static SymTabRec VMWAREChipsets[] = {
+ { PCI_CHIP_VMWARE0405, "vmware0405" },
+ { PCI_CHIP_VMWARE0710, "vmware0710" },
+ { -1, NULL }
+};
+
+static resRange vmwareLegacyRes[] = {
+ { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)},
+ _VGA_EXCLUSIVE, _END
+};
+
+/*
+ * Currently, even the PCI obedient 0405 chip still only obeys IOSE and
+ * MEMSE for the SVGA resources. Thus, RES_EXCLUSIVE_VGA is required.
+ *
+ * The 0710 chip also uses hardcoded IO ports that aren't disablable.
+ */
+
+static PciChipsets VMWAREPciChipsets[] = {
+ { PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA },
+ { PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes },
+ { -1, -1, RES_UNDEFINED }
+};
+
+#ifdef XFree86LOADER
+static XF86ModuleVersionInfo vmwareVersRec = {
+ "vmware",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ { 0, 0, 0, 0}
+};
+#endif /* XFree86LOADER */
+
+typedef enum {
+ OPTION_HW_CURSOR,
+ OPTION_NOACCEL
+} VMWAREOpts;
+
+static OptionInfoRec VMWAREOptions[] = {
+ { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+#define nVMWAREOptions (sizeof(VMWAREOptions) / sizeof(VMWAREOptions[0]))
+
+static Bool
+VMWAREGetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate != NULL) {
+ return TRUE;
+ }
+ pScrn->driverPrivate = xnfcalloc(sizeof(VMWARERec), 1);
+ /* FIXME: Initialize driverPrivate... */
+ return TRUE;
+}
+
+static void
+VMWAREFreeRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate) {
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+}
+
+static void ScreenToPrivate(ScreenPtr, ScrnInfoPtr);
+static void ScreenFromPrivate(ScreenPtr, ScrnInfoPtr);
+
+/* VMware specific functions */
+
+static CARD32
+vmwareReadReg(VMWAREPtr pVMWARE, int index)
+{
+ outl(pVMWARE->indexReg, index);
+ return inl(pVMWARE->valueReg);
+}
+
+void
+vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value)
+{
+ outl(pVMWARE->indexReg, index);
+ outl(pVMWARE->valueReg, value);
+}
+
+void
+vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value)
+{
+ CARD32* vmwareFIFO = pVMWARE->vmwareFIFO;
+
+ /* Need to sync? */
+ if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP])
+ || (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - sizeof(CARD32) &&
+ vmwareFIFO[SVGA_FIFO_STOP] == vmwareFIFO[SVGA_FIFO_MIN])) {
+ vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1);
+ while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ;
+ }
+ vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value;
+ vmwareFIFO[SVGA_FIFO_NEXT_CMD] += sizeof(CARD32);
+ if (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX]) {
+ vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN];
+ }
+}
+
+void
+vmwareWaitForFB(VMWAREPtr pVMWARE)
+{
+ if (pVMWARE->vmwareFIFOMarkSet) {
+ vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1);
+ while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ;
+ pVMWARE->vmwareFIFOMarkSet = FALSE;
+ }
+}
+
+void
+vmwareSendSVGACmdUpdate(VMWAREPtr pVMWARE, BoxPtr pBB)
+{
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_UPDATE);
+ vmwareWriteWordToFIFO(pVMWARE, pBB->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pBB->y1);
+ vmwareWriteWordToFIFO(pVMWARE, pBB->x2 - pBB->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pBB->y2 - pBB->y1);
+}
+
+static void
+vmwareSendSVGACmdUpdateFullScreen(VMWAREPtr pVMWARE)
+{
+ BoxRec BB;
+
+ BB.x1 = 0;
+ BB.y1 = 0;
+ BB.x2 = pVMWARE->ModeReg.svga_reg_width;
+ BB.y2 = pVMWARE->ModeReg.svga_reg_height;
+ vmwareSendSVGACmdUpdate(pVMWARE, &BB);
+}
+
+static CARD32
+vmwareCalculateWeight(CARD32 mask)
+{
+ CARD32 weight;
+
+ for (weight = 0; mask; mask >>= 1) {
+ if (mask & 1) {
+ weight++;
+ }
+ }
+ return weight;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMXGetVMwareSvgaId --
+ *
+ * Retrieve the SVGA_ID of the VMware SVGA adapter.
+ * This function should hide any backward compatibility mess.
+ *
+ * Results:
+ * The SVGA_ID_* of the present VMware adapter.
+ *
+ * Side effects:
+ * ins/outs
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static uint32
+VMXGetVMwareSvgaId(VMWAREPtr pVMWARE)
+{
+ uint32 vmware_svga_id;
+
+ /* Any version with any SVGA_ID_* support will initialize SVGA_REG_ID
+ * to SVGA_ID_0 to support versions of this driver with SVGA_ID_0.
+ *
+ * Versions of SVGA_ID_0 ignore writes to the SVGA_REG_ID register.
+ *
+ * Versions of SVGA_ID_1 will allow us to overwrite the content
+ * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1.
+ *
+ * Versions of SVGA_ID_2 will allow us to overwrite the content
+ * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1
+ * or SVGA_ID_2.
+ */
+
+ vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_2);
+ vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID);
+ if (vmware_svga_id == SVGA_ID_2) {
+ return SVGA_ID_2;
+ }
+
+ vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_1);
+ vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID);
+ if (vmware_svga_id == SVGA_ID_1) {
+ return SVGA_ID_1;
+ }
+
+ if (vmware_svga_id == SVGA_ID_0) {
+ return SVGA_ID_0;
+ }
+
+ /* No supported VMware SVGA devices found */
+ return SVGA_ID_INVALID;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RewriteTagString --
+ *
+ * Rewrites the given string, removing the $Name: $, and
+ * replacing it with the contents. The output string must
+ * have enough room, or else.
+ *
+ * Results:
+ *
+ * Output string updated.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RewriteTagString(const char *istr, char *ostr, int osize)
+{
+ int chr;
+ Bool inTag = FALSE;
+ char *op = ostr;
+
+ do {
+ chr = *istr++;
+ if (chr == '$') {
+ if (inTag) {
+ inTag = FALSE;
+ for (; op > ostr && op[-1] == ' '; op--) {
+ }
+ continue;
+ }
+ if (strncmp(istr, "Name:", 5) == 0) {
+ istr += 5;
+ istr += strspn(istr, " ");
+ inTag = TRUE;
+ continue;
+ }
+ }
+ *op++ = chr;
+ } while (chr);
+}
+
+static void
+VMWAREIdentify(int flags)
+{
+ xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets);
+}
+
+static OptionInfoPtr
+VMWAREAvailableOptions(int chipid, int busid)
+{
+ return VMWAREOptions;
+}
+
+static Bool
+VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ MessageType from;
+ VMWAREPtr pVMWARE;
+ OptionInfoRec options[nVMWAREOptions];
+ int bpp24flags;
+ uint32 id;
+ int i;
+ const char* mod;
+ ClockRange* clockRanges;
+
+ if (pScrn->numEntities != 1) {
+ return FALSE;
+ }
+
+ if (!VMWAREGetRec(pScrn)) {
+ return FALSE;
+ }
+ pVMWARE = VMWAREPTR(pScrn);
+
+ pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (pVMWARE->pEnt->location.type != BUS_PCI) {
+ return FALSE;
+ }
+ pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index);
+ if (pVMWARE->PciInfo == NULL) {
+ return FALSE;
+ }
+
+ if (pVMWARE->PciInfo->chipType == PCI_CHIP_VMWARE0710) {
+ pVMWARE->indexReg =
+ SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT*sizeof(uint32);
+ pVMWARE->valueReg =
+ SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32);
+ } else {
+ pVMWARE->indexReg =
+ pVMWARE->PciInfo->ioBase[0] + SVGA_INDEX_PORT;
+ pVMWARE->valueReg =
+ pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VMware SVGA regs at (0x%04x, 0x%04x)\n",
+ pVMWARE->indexReg, pVMWARE->valueReg);
+
+ id = VMXGetVMwareSvgaId(pVMWARE);
+ if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "No supported VMware SVGA found (read ID 0x%08x).\n", id);
+ return FALSE;
+ }
+
+ if (!xf86LoadSubModule(pScrn, "vgahw")) {
+ return FALSE;
+ }
+
+/* xf86LoaderReqSymLists(vgahwSymbols, NULL); */ /* FIXME */
+
+ if (!vgaHWGetHWRec(pScrn)) {
+ return FALSE;
+ }
+
+ pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device,
+ pVMWARE->PciInfo->func);
+ pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo);
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH);
+ pVMWARE->weight.red = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_RED_MASK));
+ pVMWARE->weight.green = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_GREEN_MASK));
+ pVMWARE->weight.blue = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_BLUE_MASK));
+ pVMWARE->offset.blue = 0;
+ pVMWARE->offset.green = pVMWARE->weight.blue;
+ pVMWARE->offset.red = pVMWARE->weight.green + pVMWARE->offset.green;
+ pVMWARE->bitsPerPixel = vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL);
+ pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? PseudoColor : TrueColor;
+ pVMWARE->videoRam = vmwareReadReg(pVMWARE, SVGA_REG_FB_MAX_SIZE);
+ pVMWARE->memPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_FB_START);
+ pVMWARE->maxWidth = vmwareReadReg(pVMWARE, SVGA_REG_MAX_WIDTH);
+ pVMWARE->maxHeight = vmwareReadReg(pVMWARE, SVGA_REG_MAX_HEIGHT);
+#define ACCELERATE_OPS
+#ifdef ACCELERATE_OPS
+ pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES);
+#else
+ pVMWARE->vmwareCapability = 0;
+#endif
+ pVMWARE->cursorDefined = FALSE;
+ pVMWARE->mouseHidden = FALSE;
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.red: %d\n", pVMWARE->weight.red);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.grn: %d\n", pVMWARE->weight.green);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.blu: %d\n", pVMWARE->weight.blue);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vis: %d\n", pVMWARE->defaultVisual);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability);
+
+ switch (pVMWARE->depth) {
+ case 16:
+ /*
+ * In certain cases, the Windows host appears to
+ * report 16 bpp and 16 depth but 555 weight. Just
+ * silently convert it to depth of 15.
+ */
+ if (pVMWARE->bitsPerPixel == 16 &&
+ pVMWARE->weight.green == 5)
+ pVMWARE->depth = 15;
+ case 8:
+ case 15:
+ bpp24flags = NoDepth24Support;
+ break;
+
+ case 32:
+ /*
+ * There is no 32 bit depth, apparently it can get
+ * reported this way sometimes on the Windows host.
+ */
+ if (pVMWARE->bitsPerPixel == 32)
+ pVMWARE->depth = 24;
+ case 24:
+ if (pVMWARE->bitsPerPixel == 24)
+ bpp24flags = Support24bppFb;
+ else
+ bpp24flags = Support32bppFb;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Adapter is using an unsupported depth (%d).\n",
+ pVMWARE->depth);
+ return FALSE;
+ }
+
+ if (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) {
+ return FALSE;
+ }
+ if (pScrn->depth != pVMWARE->depth) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Currently unavailable depth of %d requested.\n"
+ "\tThe guest X server must run at the same depth as the host (which\n"
+ "\tis currently %d). This is automatically detected. Please do not\n"
+ "\tspecify a depth on the command line or via the config file.\n",
+ pScrn->depth, pVMWARE->depth);
+ return FALSE;
+ }
+ if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given bpp (%d) is not supported by this driver (%d is required)\n",
+ pScrn->bitsPerPixel, pVMWARE->bitsPerPixel);
+ return FALSE;
+ }
+ xf86PrintDepthBpp(pScrn);
+
+#if 0
+ if (pScrn->depth == 24 && pix24bpp == 0) {
+ pix24bpp = xf86GetBppFromDepth(pScrn, 24);
+ }
+#endif
+
+ if (pScrn->depth > 8) {
+ rgb zeros = { 0, 0, 0 };
+
+ if (!xf86SetWeight(pScrn, pVMWARE->weight, zeros)) {
+ return FALSE;
+ }
+ /* FIXME check returned weight */
+ }
+ if (!xf86SetDefaultVisual(pScrn, pVMWARE->defaultVisual)) {
+ return FALSE;
+ }
+ if (pScrn->defaultVisual != pVMWARE->defaultVisual) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given visual (%d) is not supported by this driver (%d is required)\n",
+ pScrn->defaultVisual, pVMWARE->defaultVisual);
+ return FALSE;
+ }
+#if 0
+ bytesPerPixel = pScrn->bitsPerPixel / 8;
+#endif
+ pScrn->progClock = TRUE;
+
+#if 0 /* MGA does not do this */
+ if (pScrn->visual != 0) { /* FIXME */
+ /* print error message */
+ return FALSE;
+ }
+#endif
+
+ xf86CollectOptions(pScrn, NULL);
+ memcpy(options, VMWAREOptions, sizeof(VMWAREOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ if (pScrn->depth <= 8) {
+ pScrn->rgbBits = 8;
+ }
+
+ from = X_PROBED;
+ pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType);
+
+ if (!pScrn->chipset) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType);
+ return FALSE;
+ }
+
+ from = X_DEFAULT;
+ pVMWARE->hwCursor = TRUE;
+ if (xf86GetOptValBool(options, OPTION_HW_CURSOR, &pVMWARE->hwCursor)) {
+ from = X_CONFIG;
+ }
+ if (pVMWARE->hwCursor && !(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HW cursor is not supported in this configuration\n");
+ from = X_PROBED;
+ pVMWARE->hwCursor = FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
+ pVMWARE->hwCursor ? "HW" : "SW");
+ if (xf86IsOptionSet(options, OPTION_NOACCEL)) {
+ pVMWARE->noAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
+ pVMWARE->vmwareCapability = 0;
+ } else {
+ pVMWARE->noAccel = FALSE;
+ }
+ pScrn->videoRam = pVMWARE->videoRam / 1024;
+ pScrn->memPhysBase = pVMWARE->memPhysBase;
+
+ {
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+ if (!xf86SetGamma(pScrn, zeros)) {
+ return FALSE;
+ }
+ }
+#if 0
+ if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) {
+ /* print error message */
+ VMWAREFreeRec(pScrn);
+ if (i > 0) {
+ xfree(pciList);
+ }
+ return FALSE;
+ }
+#endif
+ clockRanges = xnfcalloc(sizeof(ClockRange), 1);
+ clockRanges->next = NULL;
+ clockRanges->minClock = 1;
+ clockRanges->maxClock = 400000000;
+ clockRanges->clockIndex = -1;
+ clockRanges->interlaceAllowed = FALSE;
+ clockRanges->doubleScanAllowed = FALSE;
+ clockRanges->ClockMulFactor = 1;
+ clockRanges->ClockDivFactor = 1;
+
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes,
+ clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32,
+ 128, pVMWARE->maxHeight,
+ pScrn->display->virtualX, pScrn->display->virtualY,
+ pVMWARE->videoRam,
+ LOOKUP_BEST_REFRESH);
+ if (i == -1) {
+ VMWAREFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86PruneDriverModes(pScrn);
+ if (i == 0 || pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ VMWAREFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+ pScrn->currentMode = pScrn->modes;
+ xf86PrintModes(pScrn);
+ xf86SetDpi(pScrn, 0, 0);
+ switch (pScrn->bitsPerPixel) {
+ case 8: mod = "cfb"; break;
+ case 16:mod = "cfb16"; break;
+ case 24:mod = "cfb24"; break;
+ case 32:mod = "cfb32"; break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unexpected bpp (%d)\n", pScrn->bitsPerPixel);
+ VMWAREFreeRec(pScrn);
+ return FALSE;
+ }
+ if (mod && !xf86LoadSubModule(pScrn, mod)) {
+ VMWAREFreeRec(pScrn);
+ return FALSE;
+ }
+ if (!pVMWARE->noAccel || pVMWARE->hwCursor) {
+ if (!xf86LoadSubModule(pScrn, "xaa")) {
+ VMWAREFreeRec(pScrn);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static Bool
+VMWAREMapMem(ScrnInfoPtr pScrn)
+{
+ VMWAREPtr pVMWARE;
+
+ pVMWARE = VMWAREPTR(pScrn);
+
+ pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVMWARE->PciTag, pVMWARE->memPhysBase, pVMWARE->videoRam);
+ if (!pVMWARE->FbBase)
+ return FALSE;
+ pVMWARE->FbSize = pVMWARE->videoRam;
+
+ VmwareLog(("FB Mapped: %p/%u -> %p/%u\n",
+ pVMWARE->memPhysBase, pVMWARE->videoRam,
+ pVMWARE->FbBase, pVMWARE->FbSize));
+ return TRUE;
+}
+
+static Bool
+VMWAREUnmapMem(ScrnInfoPtr pScrn)
+{
+ VMWAREPtr pVMWARE;
+
+ pVMWARE = VMWAREPTR(pScrn);
+
+ VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->FbSize));
+
+ xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->FbSize);
+ pVMWARE->FbBase = NULL;
+ return TRUE;
+}
+
+static void
+VMWARESave(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr vgaReg = &hwp->SavedReg;
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+ VMWARERegPtr vmwareReg = &pVMWARE->SavedReg;
+
+ vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
+
+ vmwareReg->svga_reg_enable = 0;
+ /* FIXME: Save VMWARE state */
+}
+
+static void
+VMWARERestoreRegs(ScrnInfoPtr pScrn, VMWARERegPtr vmwareReg)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+
+ if (vmwareReg->svga_reg_enable) {
+ vmwareWriteReg(pVMWARE, SVGA_REG_WIDTH, vmwareReg->svga_reg_width);
+ vmwareWriteReg(pVMWARE, SVGA_REG_HEIGHT, vmwareReg->svga_reg_height);
+ vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable);
+ vmwareWriteReg(pVMWARE, SVGA_REG_GUEST_ID, GUEST_OS_LINUX);
+ } else {
+ vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable);
+ }
+}
+
+static void
+VMWARERestore(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr vgaReg = &hwp->SavedReg;
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+ VMWARERegPtr vmwareReg = &pVMWARE->SavedReg;
+
+ /* FIXME: Sync */
+ vgaHWProtect(pScrn, TRUE);
+ VMWARERestoreRegs(pScrn, vmwareReg);
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
+ vgaHWProtect(pScrn, FALSE);
+}
+
+static Bool
+VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr vgaReg = &hwp->ModeReg;
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+ VMWARERegPtr vmwareReg = &pVMWARE->ModeReg;
+
+ vgaHWUnlock(hwp);
+ if (!vgaHWInit(pScrn, mode))
+ return FALSE;
+ pScrn->vtSema = TRUE;
+
+ if (!vgaHWInit(pScrn, mode))
+ return FALSE;
+
+ vmwareReg->svga_reg_enable = 1;
+ vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX);
+ vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY);
+
+ vgaHWProtect(pScrn, TRUE);
+
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
+ VMWARERestoreRegs(pScrn, vmwareReg);
+
+ VmwareLog(("Required mode: %ux%u\n", mode->HDisplay, mode->VDisplay));
+ VmwareLog(("Virtual: %ux%u\n", pScrn->virtualX, pScrn->virtualY));
+ VmwareLog(("dispWidth: %u\n", pScrn->displayWidth));
+ pVMWARE->fbOffset = vmwareReadReg(pVMWARE, SVGA_REG_FB_OFFSET);
+ pVMWARE->fbPitch = vmwareReadReg(pVMWARE, SVGA_REG_BYTES_PER_LINE);
+
+ pScrn->displayWidth = (pVMWARE->fbPitch * 8) / ((pScrn->bitsPerPixel + 7) & ~7);
+ VmwareLog(("fbOffset: %u\n", pVMWARE->fbOffset));
+ VmwareLog(("fbPitch: %u\n", pVMWARE->fbPitch));
+ VmwareLog(("New dispWidth: %u\n", pScrn->displayWidth));
+
+ vgaHWProtect(pScrn, FALSE);
+ pVMWARE->CurrentLayout.mode = mode;
+ return TRUE;
+}
+
+static void
+VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ /* FIXME */
+}
+
+static void
+VMWAREInitFIFO(ScrnInfoPtr pScrn)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+ CARD32* vmwareFIFO;
+
+ pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START);
+ pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3;
+ pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVMWARE->PciTag, pVMWARE->mmioPhysBase, pVMWARE->mmioSize);
+ vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase;
+ vmwareFIFO[SVGA_FIFO_MIN] = 4 * sizeof(CARD32);
+ vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize;
+ vmwareFIFO[SVGA_FIFO_NEXT_CMD] = 4 * sizeof(CARD32);
+ vmwareFIFO[SVGA_FIFO_STOP] = 4 * sizeof(CARD32);
+ pVMWARE->vmwareFIFOMarkSet = FALSE;
+ vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 1);
+}
+
+static void
+VMWAREStopFIFO(ScrnInfoPtr pScrn)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+
+ /* ??? */
+ vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0);
+}
+
+static Bool
+VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VMWARERestore(pScrn);
+ VMWAREStopFIFO(pScrn);
+ VMWAREUnmapMem(pScrn);
+ pScrn->vtSema = FALSE;
+ ScreenFromPrivate(pScreen, pScrn);
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+}
+
+static Bool
+VMWARESaveScreen(ScreenPtr pScreen, int mode)
+{
+ return vgaHWSaveScreen(pScreen, mode);
+}
+
+static void
+VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices,
+ LOCO* colors, VisualPtr pVisual)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+ int i;
+
+ for (i = 0; i < numColors; i++) {
+ vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 0, colors[*indices].red);
+ vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 1, colors[*indices].green);
+ vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 2, colors[*indices].blue);
+ indices++;
+ }
+
+ pVMWARE->checkCursorColor = TRUE;
+ VmwareLog(("Palette loading done\n"));
+}
+
+static Bool
+VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+{
+ ScrnInfoPtr pScrn;
+ vgaHWPtr hwp;
+ VMWAREPtr pVMWARE;
+ Bool ret;
+
+ /* Get the ScrnInfoRec */
+ pScrn = xf86Screens[pScreen->myNum];
+ pVMWARE = VMWAREPTR(pScrn);
+
+ /*
+ * If using the vgahw module, its data structures and related
+ * things are typically initialised/mapped here.
+ */
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+
+ /* Save the current video state */
+ VMWARESave(pScrn);
+
+ VMWAREInitFIFO(pScrn);
+
+ /* Initialise the first mode */
+ VMWAREModeInit(pScrn, pScrn->currentMode);
+
+ /* Set the viewport if supported */
+ VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ /*
+ * Setup the screen's visuals, and initialise the framebuffer
+ * code.
+ */
+ VMWAREMapMem(pScrn);
+
+ /* Reset the visual list */
+ miClearVisualTypes();
+
+ /*
+ * Setup the visuals supported. This driver only supports
+ * TrueColor for bpp > 8, so the default set of visuals isn't
+ * acceptable. To deal with this, call miSetVisualTypes with
+ * the appropriate visual mask.
+ */
+
+ if (pScrn->bitsPerPixel > 8) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+ pScrn->rgbBits, pScrn->defaultVisual)) {
+ return FALSE;
+ }
+ } else {
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual)) {
+ return FALSE;
+ }
+ }
+
+ /*
+ * Initialise the framebuffer.
+ */
+
+ switch (pScrn->bitsPerPixel) {
+#if 0
+ case 1:
+ ret = xf1bppScreenInit(pScreen, pVMWARE->FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 4:
+ ret = xf4bppScreenInit(pScreen, pVMWARE->FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+#endif
+ case 8:
+ /*
+ * In ScreenToPrivate, below, we register our own
+ * CopyPlane proc (via mfbRegisterCopyPlaneProc).
+ * But we can't handle all cases, so we have to stash
+ * away a pointer to someone who can.
+ */
+ pVMWARE->pcfbCopyPlane = cfbCopyPlane;
+ ret = cfbScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 16:
+ pVMWARE->pcfbCopyPlane = cfb16CopyPlane;
+ ret = cfb16ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 24:
+ pVMWARE->pcfbCopyPlane = cfb24CopyPlane;
+ ret = cfb24ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 32:
+ pVMWARE->pcfbCopyPlane = cfb32CopyPlane;
+ ret = cfb32ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ default:
+ xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in VMWAREScreenInit\n",
+ pScrn->bitsPerPixel);
+ ret = FALSE;
+ break;
+ }
+ if (!ret)
+ return FALSE;
+
+ /* Override the default mask/offset settings */
+ if (pScrn->bitsPerPixel > 8) {
+ int i;
+ VisualPtr visual;
+
+ for (i = 0, visual = pScreen->visuals;
+ i < pScreen->numVisuals; i++, visual++) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ /*
+ * Wrap the CloseScreen vector and set SaveScreen.
+ */
+ ScreenToPrivate(pScreen, pScrn);
+ /*
+ * If backing store is to be supported (as is usually the case),
+ * initialise it.
+ */
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Set initial black & white colourmap indices.
+ */
+ xf86SetBlackWhitePixels(pScreen);
+
+ /*
+ * Install colourmap functions. If using the vgahw module,
+ * vgaHandleColormaps would usually be called here.
+ */
+
+ /*
+ * Initialise cursor functions. This example is for the mi
+ * software cursor.
+ */
+ if (pVMWARE->hwCursor) {
+ vmwareCursorInit(0, pScreen);
+ } else {
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ }
+
+ /* Initialise the default colourmap */
+ switch (pScrn->depth) {
+#if 0
+ case 1:
+ if (!xf1bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ case 4:
+ if (!xf4bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+#endif
+ default:
+ if (!cfbCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ }
+
+ if (!xf86HandleColormaps(pScreen, 256, 8,
+ VMWARELoadPalette, NULL,
+ CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) {
+ return FALSE;
+ }
+
+
+ /* Report any unused options (only for the first generation) */
+ if (serverGeneration == 1) {
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+ }
+
+ vmwareSendSVGACmdUpdateFullScreen(pVMWARE);
+ if (pVMWARE->hwCursor) {
+ vmwareRestoreCursor(pScreen);
+ }
+ /* Done */
+ return TRUE;
+}
+
+static Bool
+VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ return VMWAREModeInit(xf86Screens[scrnIndex], mode);
+}
+
+static Bool
+VMWAREEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ return VMWAREModeInit(pScrn, pScrn->currentMode);
+}
+
+static void
+VMWARELeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ VMWARERestore(pScrn);
+}
+
+static void
+VMWAREFreeScreen(int scrnIndex, int flags)
+{
+ /*
+ * If the vgahw module is used vgaHWFreeHWRec() would be called
+ * here.
+ */
+ VMWAREFreeRec(xf86Screens[scrnIndex]);
+}
+
+static Bool
+VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+ /* FIXME... possible */
+ return MODE_OK;
+}
+
+static Bool
+VMWAREProbe(DriverPtr drv, int flags)
+{
+ int numDevSections, numUsed;
+ GDevPtr *devSections;
+ int *usedChips;
+ int i;
+ Bool foundScreen = FALSE;
+ char buildString[sizeof(VMWAREBuildStr)];
+
+ RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr));
+ xf86DrvMsg(0, X_PROBED, "%s", buildString);
+
+ numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections);
+ if (numDevSections <= 0) {
+ xf86DrvMsg(0, X_ERROR, "No vmware driver section\n");
+ return FALSE;
+ }
+ if (xf86GetPciVideoInfo()) {
+ VmwareLog(("Some PCI Video Info Exists\n"));
+ numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE,
+ VMWAREChipsets, VMWAREPciChipsets, devSections,
+ numDevSections, drv, &usedChips);
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = NULL;
+
+ VmwareLog(("Even some VMware SVGA PCI instances exists\n"));
+ pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i],
+ VMWAREPciChipsets, NULL, NULL, NULL,
+ NULL, NULL);
+ if (pScrn) {
+ VmwareLog(("And even configuration suceeded\n"));
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = VMWARE_DRIVER_NAME;
+ pScrn->name = VMWARE_NAME;
+ pScrn->Probe = VMWAREProbe;
+ pScrn->PreInit = VMWAREPreInit;
+ pScrn->ScreenInit = VMWAREScreenInit;
+ pScrn->SwitchMode = VMWARESwitchMode;
+ pScrn->AdjustFrame = VMWAREAdjustFrame;
+ pScrn->EnterVT = VMWAREEnterVT;
+ pScrn->LeaveVT = VMWARELeaveVT;
+ pScrn->FreeScreen = VMWAREFreeScreen;
+ pScrn->ValidMode = VMWAREValidMode;
+ foundScreen = TRUE;
+ }
+ }
+ if (numUsed > 0) {
+ xfree(usedChips);
+ }
+ }
+ xfree(devSections);
+ return foundScreen;
+}
+
+DriverRec VMWARE = {
+ VERSION,
+ VMWARE_DRIVER_NAME,
+ VMWAREIdentify,
+ VMWAREProbe,
+ VMWAREAvailableOptions,
+ NULL,
+ 0
+};
+
+#ifdef XFree86LOADER
+static MODULESETUPPROTO(vmwareSetup);
+
+XF86ModuleData vmwareModuleData = { &vmwareVersRec, vmwareSetup, NULL };
+
+static pointer
+vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&VMWARE, module, 0);
+ return (pointer)1;
+ }
+ if (errmaj) {
+ *errmaj = LDR_ONCEONLY;
+ }
+ return NULL;
+}
+#endif /* XFree86LOADER */
+
+ScreenPtr funcglob;
+ScrnInfoPtr scrnglob;
+int vmwareGCPrivateIndex;
+
+static void
+ScreenToPrivate(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+
+ pVMWARE->ScrnFuncs = *pScreen;
+ funcglob = &pVMWARE->ScrnFuncs;
+ scrnglob = pScrn;
+
+ pScreen->CloseScreen = VMWARECloseScreen;
+ pScreen->SaveScreen = VMWARESaveScreen;
+
+#if 0
+ pScreen->QueryBestSize = vmwareQueryBestSize;
+ pScreen->GetImage = vmwareGetImage;
+ pScreen->GetSpans = vmwareGetSpans;
+ pScreen->PointerNonInterestBox = vmwarePointerNonInterestBox;
+ pScreen->SourceValidate = vmwareSourceValidate;
+
+ pScreen->CreateWindow = vmwareCreateWindow;
+ pScreen->DestroyWindow = vmwareDestroyWindow;
+ pScreen->PositionWindow = vmwarePositionWindow;
+ pScreen->ChangeWindowAttributes = vmwareChangeWindowAttributes;
+ pScreen->RealizeWindow = vmwareRealizeWindow;
+ pScreen->UnrealizeWindow = vmwareUnrealizeWindow;
+ pScreen->ValidateTree = vmwareValidateTree;
+// pScreen->PostValidateTree = vmwarePostValidateTree;
+ pScreen->WindowExposures = vmwareWindowExposures;
+ pScreen->PaintWindowBackground = vmwarePaintWindowBackground;
+ pScreen->PaintWindowBorder = vmwarePaintWindowBorder;
+ pScreen->CopyWindow = vmwareCopyWindow;
+ pScreen->ClearToBackground = vmwareClearToBackground;
+ pScreen->ClipNotify = vmwareClipNotify;
+ pScreen->RestackWindow = vmwareRestackWindow;
+
+ /* Pixmap procedures */
+
+ pScreen->CreatePixmap = vmwareCreatePixmap;
+ pScreen->DestroyPixmap = vmwareDestroyPixmap;
+
+ /* Backing store procedures */
+
+ pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas;
+ pScreen->RestoreAreas = vmwareRestoreAreas;
+ pScreen->ExposeCopy = vmwareExposeCopy;
+ pScreen->TranslateBackingStore = vmwareTranslateBackingStore;
+ pScreen->ClearBackingStore = vmwareClearBackingStore;
+ pScreen->DrawGuarantee = vmwareDrawGuarantee;
+ /*
+ * A read/write copy of the lower level backing store vector is needed now
+ * that the functions can be wrapped.
+ */
+// pScreen->BackingStoreFuncs = vmwareBackingStoreFuncs;
+
+ /* Font procedures */
+
+ pScreen->RealizeFont = vmwareRealizeFont;
+ pScreen->UnrealizeFont = vmwareUnrealizeFont;
+
+ /* Cursor Procedures */
+
+ pScreen->ConstrainCursor = vmwareConstrainCursor;
+ pScreen->CursorLimits = vmwareCursorLimits;
+ pScreen->DisplayCursor = vmwareDisplayCursor;
+ pScreen->RealizeCursor = vmwareRealizeCursor;
+ pScreen->UnrealizeCursor = vmwareUnrealizeCursor;
+ pScreen->RecolorCursor = vmwareRecolorCursor;
+ pScreen->SetCursorPosition = vmwareSetCursorPosition;
+
+ /* GC procedures */
+
+ pScreen->CreateGC = vmwareCreateGC;
+
+ /* Colormap procedures */
+
+ pScreen->CreateColormap = vmwareCreateColormap;
+ pScreen->DestroyColormap = vmwareDestroyColormap;
+ pScreen->InstallColormap = vmwareInstallColormap;
+ pScreen->UninstallColormap = vmwareUninstallColormap;
+ pScreen->ListInstalledColormaps = vmwareListInstalledColormaps;
+ pScreen->StoreColors = vmwareStoreColors;
+ pScreen->ResolveColor = vmwareResolveColor;
+
+
+ pScreen->GetWindowPixmap = vmwareGetWindowPixmap;
+ pScreen->SetWindowPixmap = vmwareSetWindowPixmap;
+ pScreen->GetScreenPixmap = vmwareGetScreenPixmap;
+ pScreen->SetScreenPixmap = vmwareSetScreenPixmap;
+
+#endif
+
+ mfbRegisterCopyPlaneProc(pScreen, vmwareCopyPlane);
+ pScreen->PaintWindowBackground = vmwarePaintWindow;
+ pScreen->PaintWindowBorder = vmwarePaintWindow;
+ pScreen->CopyWindow = vmwareCopyWindow;
+ pScreen->CreateGC = vmwareCreateGC;
+ pScreen->GetSpans = vmwareGetSpans;
+ pScreen->GetImage = vmwareGetImage;
+ pScreen->BlockHandler = vmwareBlockHandler;
+ pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas;
+ pScreen->RestoreAreas = vmwareRestoreAreas;
+
+ vmwareGCPrivateIndex = AllocateGCPrivateIndex();
+ if (!AllocateGCPrivate(pScreen, vmwareGCPrivateIndex,
+ sizeof(vmwarePrivGC))) return;
+
+
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ pVMWARE->Pmsk = 0x000000FF;
+ break;
+ case 16:
+ pVMWARE->Pmsk = 0x0000FFFF;
+ break;
+ case 24:
+ pVMWARE->Pmsk = 0x00FFFFFF;
+ break;
+ case 32:
+ pVMWARE->Pmsk = 0xFFFFFFFF;
+ break;
+ }
+}
+
+static void ScreenFromPrivate(ScreenPtr pScreen, ScrnInfoPtr p)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(p);
+ ScreenPtr save = &pVMWARE->ScrnFuncs;
+
+ /* Random screen procedures */
+
+ pScreen->CloseScreen = save->CloseScreen;
+ pScreen->QueryBestSize = save->QueryBestSize;
+ pScreen->SaveScreen = save->SaveScreen;
+ pScreen->GetImage = save->GetImage;
+ pScreen->GetSpans = save->GetSpans;
+ pScreen->PointerNonInterestBox = save->PointerNonInterestBox;
+ pScreen->SourceValidate = save->SourceValidate;
+
+ /* Window Procedures */
+
+ pScreen->CreateWindow = save->CreateWindow;
+ pScreen->DestroyWindow = save->DestroyWindow;
+ pScreen->PositionWindow = save->PositionWindow;
+ pScreen->ChangeWindowAttributes = save->ChangeWindowAttributes;
+ pScreen->RealizeWindow = save->RealizeWindow;
+ pScreen->UnrealizeWindow = save->UnrealizeWindow;
+ pScreen->ValidateTree = save->ValidateTree;
+ pScreen->PostValidateTree = save->PostValidateTree;
+ pScreen->WindowExposures = save->WindowExposures;
+ pScreen->PaintWindowBackground = save->PaintWindowBackground;
+ pScreen->PaintWindowBorder = save->PaintWindowBorder;
+ pScreen->CopyWindow = save->CopyWindow;
+ pScreen->ClearToBackground = save->ClearToBackground;
+ pScreen->ClipNotify = save->ClipNotify;
+ pScreen->RestackWindow = save->RestackWindow;
+
+ /* Pixmap procedures */
+
+ pScreen->CreatePixmap = save->CreatePixmap;
+ pScreen->DestroyPixmap = save->DestroyPixmap;
+
+ /* Backing store procedures */
+
+ pScreen->SaveDoomedAreas = save->SaveDoomedAreas;
+ pScreen->RestoreAreas = save->RestoreAreas;
+ pScreen->ExposeCopy = save->ExposeCopy;
+ pScreen->TranslateBackingStore = save->TranslateBackingStore;
+ pScreen->ClearBackingStore = save->ClearBackingStore;
+ pScreen->DrawGuarantee = save->DrawGuarantee;
+ /*
+ * A read/write copy of the lower level backing store vector is needed now
+ * that the functions can be wrapped.
+ */
+ pScreen->BackingStoreFuncs = save->BackingStoreFuncs;
+
+ /* Font procedures */
+
+ pScreen->RealizeFont = save->RealizeFont;
+ pScreen->UnrealizeFont = save->UnrealizeFont;
+
+ /* Cursor Procedures */
+
+ pScreen->ConstrainCursor = save->ConstrainCursor;
+ pScreen->CursorLimits = save->CursorLimits;
+ pScreen->DisplayCursor = save->DisplayCursor;
+ pScreen->RealizeCursor = save->RealizeCursor;
+ pScreen->UnrealizeCursor = save->UnrealizeCursor;
+ pScreen->RecolorCursor = save->RecolorCursor;
+ pScreen->SetCursorPosition = save->SetCursorPosition;
+
+ /* GC procedures */
+
+ pScreen->CreateGC = save->CreateGC;
+
+ /* Colormap procedures */
+
+ pScreen->CreateColormap = save->CreateColormap;
+ pScreen->DestroyColormap = save->DestroyColormap;
+ pScreen->InstallColormap = save->InstallColormap;
+ pScreen->UninstallColormap = save->UninstallColormap;
+ pScreen->ListInstalledColormaps = save->ListInstalledColormaps;
+ pScreen->StoreColors = save->StoreColors;
+ pScreen->ResolveColor = save->ResolveColor;
+
+ /* Region procedures */
+
+#ifdef NEED_SCREEN_REGIONS
+ pScreen->RegionCreate = save->RegionCreate;
+ pScreen->RegionInit = save->RegionInit;
+ pScreen->RegionCopy = save->RegionCopy;
+ pScreen->RegionDestroy = save->RegionDestroy;
+ pScreen->RegionUninit = save->RegionUninit;
+ pScreen->Intersect = save->Intersect;
+ pScreen->Union = save->Union;
+ pScreen->Subtract = save->Subtract;
+ pScreen->Inverse = save->Inverse;
+ pScreen->RegionReset = save->RegionReset;
+ pScreen->TranslateRegion = save->TranslateRegion;
+ pScreen->RectIn = save->RectIn;
+ pScreen->PointInRegion = save->PointInRegion;
+ pScreen->RegionNotEmpty = save->RegionNotEmpty;
+ pScreen->RegionBroken = save->RegionBroken;
+ pScreen->RegionBreak = save->RegionBreak;
+ pScreen->RegionEmpty = save->RegionEmpty;
+ pScreen->RegionExtents = save->RegionExtents;
+ pScreen->RegionAppend = save->RegionAppend;
+ pScreen->RegionValidate = save->RegionValidate;
+#endif /* NEED_SCREEN_REGIONS */
+ pScreen->BitmapToRegion = save->BitmapToRegion;
+#ifdef NEED_SCREEN_REGIONS
+ pScreen->RectsToRegion = save->RectsToRegion;
+#endif /* NEED_SCREEN_REGIONS */
+ pScreen->SendGraphicsExpose = save->SendGraphicsExpose;
+
+ /* os layer procedures */
+
+ pScreen->BlockHandler = save->BlockHandler;
+ pScreen->WakeupHandler = save->WakeupHandler;
+
+ pScreen->CreateScreenResources = save->CreateScreenResources;
+ pScreen->ModifyPixmapHeader = save->ModifyPixmapHeader;
+
+ pScreen->GetWindowPixmap = save->GetWindowPixmap;
+ pScreen->SetWindowPixmap = save->SetWindowPixmap;
+ pScreen->GetScreenPixmap = save->GetScreenPixmap;
+ pScreen->SetScreenPixmap = save->SetScreenPixmap;
+
+ pScreen->MarkWindow = save->MarkWindow;
+ pScreen->MarkOverlappedWindows = save->MarkOverlappedWindows;
+ pScreen->ChangeSaveUnder = save->ChangeSaveUnder;
+ pScreen->PostChangeSaveUnder = save->PostChangeSaveUnder;
+ pScreen->MoveWindow = save->MoveWindow;
+ pScreen->ResizeWindow = save->ResizeWindow;
+ pScreen->GetLayerWindow = save->GetLayerWindow;
+ pScreen->HandleExposures = save->HandleExposures;
+ pScreen->ReparentWindow = save->ReparentWindow;
+
+#ifdef SHAPE
+ pScreen->SetShape = save->SetShape;
+#endif /* SHAPE */
+
+ pScreen->ChangeBorderWidth = save->ChangeBorderWidth;
+ pScreen->MarkUnrealizedWindow = save->MarkUnrealizedWindow;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h
new file mode 100644
index 000000000..ab42e10f1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h
@@ -0,0 +1,758 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $
+ * **********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#ifndef VMWARE_H
+#define VMWARE_H
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Resources.h"
+
+#include "compiler.h" /* inb/outb */
+
+#include "xf86PciInfo.h" /* pci vendor id */
+#include "xf86Pci.h" /* pci */
+
+#include "mipointer.h" /* sw cursor */
+#include "mibstore.h" /* backing store */
+#include "micmap.h" /* mi color map */
+#include "vgaHW.h" /* VGA hardware */
+#define PSZ 8 /* 8bpp */
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h" /* 16bpp */
+#include "cfb24.h" /* 24bpp */
+#include "cfb32.h" /* 32bpp */
+
+#include "xf86cmap.h" /* xf86HandleColormaps */
+
+#include "vm_basic_types.h"
+#include "svga_reg.h"
+
+typedef struct {
+ CARD32 svga_reg_enable;
+ CARD32 svga_reg_width;
+ CARD32 svga_reg_height;
+} VMWARERegRec, *VMWARERegPtr;
+
+typedef struct {
+ DisplayModePtr mode;
+} VMWAREFBLayout;
+
+typedef struct {
+ EntityInfoPtr pEnt;
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+ Bool Primary;
+ int depth;
+ int bitsPerPixel;
+ rgb weight;
+ rgb offset;
+ int defaultVisual;
+ int videoRam;
+ unsigned long memPhysBase;
+ unsigned long fbOffset;
+ unsigned long fbPitch;
+ unsigned long ioBase;
+ int maxWidth;
+ int maxHeight;
+ unsigned int vmwareCapability;
+
+ unsigned char* FbBase;
+ unsigned long FbSize;
+
+ VMWARERegRec SavedReg;
+ VMWARERegRec ModeReg;
+
+ VMWAREFBLayout CurrentLayout;
+ Bool noAccel;
+ Bool hwCursor;
+ Bool cursorDefined;
+ Bool mouseHidden;
+
+ unsigned long mmioPhysBase;
+ unsigned long mmioSize;
+
+ unsigned char* mmioVirtBase;
+ CARD32* vmwareFIFO;
+ Bool vmwareFIFOMarkSet;
+ BoxRec vmwareAccelArea;
+ struct {
+ BoxRec Box;
+ unsigned int Width;
+ unsigned int Height;
+ unsigned int XHot;
+ unsigned int YHot;
+ } Mouse;
+ Bool checkCursorColor;
+ unsigned int vmwareBBLevel;
+ unsigned long Pmsk;
+
+ uint16 indexReg, valueReg;
+
+ RegionPtr (*pcfbCopyPlane) (DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int,
+ unsigned long);
+ ScreenRec ScrnFuncs;
+ /* ... */
+} VMWARERec, *VMWAREPtr;
+
+#define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate))
+
+static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
+ return xf86Screens[s->myNum];
+}
+
+#include "gcstruct.h"
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+#define MAX(a,b) ((a)>(b)?(a):(b))
+
+#define GC_FUNC_PROLOGUE(pGC) \
+{ \
+ vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \
+ (pGC)->funcs = pGCPriv->wrapFuncs; \
+ (pGC)->ops = pGCPriv->wrapOps; \
+}
+
+#define GC_FUNC_EPILOGUE(pGC) \
+{ \
+ vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \
+ pGCPriv->wrapFuncs = (pGC)->funcs; \
+ (pGC)->funcs = &vmwareGCFuncs; \
+ pGCPriv->wrapOps = (pGC)->ops; \
+ (pGC)->ops = &vmwareGCOps; \
+}
+
+#define GC_OPS(pGC) ((vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr)->wrapOps
+
+#define MOUSE_ID 1
+
+#define UPDATE_ACCEL_AREA(pVMWARE,box) \
+{ \
+ if (!(pVMWARE)->vmwareFIFOMarkSet) { \
+ (pVMWARE)->vmwareFIFOMarkSet = TRUE; \
+ (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \
+ (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \
+ (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \
+ (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \
+ } else { \
+ if ((box).x1 < (pVMWARE)->vmwareAccelArea.x1) \
+ (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \
+ if ((box).y1 < (pVMWARE)->vmwareAccelArea.y1) \
+ (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \
+ if ((box).x2 > (pVMWARE)->vmwareAccelArea.x2) \
+ (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \
+ if ((box).y2 > (pVMWARE)->vmwareAccelArea.y2) \
+ (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \
+ } \
+}
+
+#define ABS(x) (((x) >= 0) ? (x) : -(x))
+#define BOX_INTERSECT(a, b) \
+ (ABS(((a).x1 + (a).x2) - ((b).x1 + (b).x2)) <= \
+ ((a).x2 - (a).x1) + ((b).x2 - (b).x1) && \
+ ABS(((a).y1 + (a).y2) - ((b).y1 + (b).y2)) <= \
+ ((a).y2 - (a).y1) + ((b).y2 - (b).y1))
+
+#define HIDE_CURSOR(vmPtr,box) \
+{ \
+ if (!(vmPtr)->mouseHidden) { \
+ if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \
+ BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \
+ (vmPtr)->mouseHidden = TRUE; \
+ if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \
+ vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \
+ vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 0); \
+ } else { \
+ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+ vmwareWriteWordToFIFO(vmPtr, 0); \
+ UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+ } \
+ } \
+ } \
+}
+
+#define HIDE_CURSOR_ACCEL(vmPtr,box) \
+{ \
+ if (!(vmPtr)->mouseHidden) { \
+ if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \
+ !((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) && \
+ BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \
+ (vmPtr)->mouseHidden = TRUE; \
+ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+ vmwareWriteWordToFIFO(vmPtr, 0); \
+ UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+ } \
+ } \
+}
+
+
+#define SHOW_CURSOR(vmPtr,box) \
+{ \
+ if ((vmPtr)->mouseHidden) { \
+ if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \
+ BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \
+ (vmPtr)->mouseHidden = FALSE; \
+ if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \
+ vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \
+ vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 1); \
+ } else { \
+ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+ vmwareWriteWordToFIFO(vmPtr, 1); \
+ UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+ } \
+ } \
+ } \
+}
+
+/* Only use this for debugging */
+
+#define HIDE_CURSOR_ALWAYS(vmPtr,box) \
+{ \
+ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+ vmwareWriteWordToFIFO(vmPtr, 0); \
+ (vmPtr)->mouseHidden = TRUE; \
+ vmwareFIFOMarkSet = TRUE; \
+ UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+}
+
+#define SHOW_CURSOR_ALWAYS(vmPtr,box) \
+{ \
+ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+ vmwareWriteWordToFIFO(vmPtr, 1); \
+ (vmPtr)->mouseHidden = FALSE; \
+ vmwareFIFOMarkSet = TRUE; \
+}
+
+/*#define DEBUG_LOGGING*/
+#undef DEBUG_LOGGING
+#ifdef DEBUG_LOGGING
+#define VmwareLog(args) ErrorF args
+#define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n"));
+#else
+#define VmwareLog(args)
+#define TRACEPOINT
+#endif
+
+/* Undefine this to kill all acceleration */
+#define ACCELERATE_OPS
+
+typedef struct vmwarePrivGC
+{
+ GCFuncs *wrapFuncs;
+ GCOps *wrapOps;
+}
+vmwarePrivGC, *vmwarePrivGCPtr;
+
+
+extern int vmwareGCPrivateIndex;
+
+#define GEN_FUNC_WRAPPER(cond,init,setBB,op) \
+ if ((cond)) { \
+ init; \
+ \
+ if (pVMWARE->vmwareBBLevel == 0) { \
+ BoxRec BB; \
+ \
+ setBB; \
+ HIDE_CURSOR(pVMWARE, BB); \
+ vmwareWaitForFB(pVMWARE); \
+ pVMWARE->vmwareBBLevel++; \
+ op; \
+ pVMWARE->vmwareBBLevel--; \
+ vmwareSendSVGACmdUpdate(pVMWARE, &BB); \
+ SHOW_CURSOR(pVMWARE, BB); \
+ } else { \
+ vmwareWaitForFB(pVMWARE); \
+ op; \
+ } \
+ } else { \
+ op; \
+ }
+#define VM_FUNC_WRAPPER(cond,setBB,op) \
+ GEN_FUNC_WRAPPER(cond,,setBB,op)
+
+#define GC_FUNC_WRAPPER(cond,screen,setBB,op) \
+ GEN_FUNC_WRAPPER(cond, VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)), setBB, op)
+
+#define GC_FUNC_ACCEL_WRAPPER(cond,screen,setBB,accelcond,accel,op) \
+ GEN_FUNC_WRAPPER(cond, \
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)); \
+ if (accelcond) { \
+ BoxRec BB; \
+ Bool hidden = pVMWARE->mouseHidden; \
+ \
+ setBB; \
+ if (!hidden) { \
+ HIDE_CURSOR_ACCEL(pVMWARE, BB); \
+ } \
+ accel; \
+ if (!hidden) { \
+ SHOW_CURSOR(pVMWARE, BB); \
+ } \
+ UPDATE_ACCEL_AREA(pVMWARE, BB); \
+ return; \
+ }, \
+ setBB, op)
+
+void vmwareWriteReg(
+#if NeedFunctionPrototypes
+ VMWAREPtr pVMWARE, int index, CARD32 value
+#endif
+ );
+
+void vmwareWriteWordToFIFO(
+#if NeedFunctionPrototypes
+ VMWAREPtr pVMWARE, CARD32 value
+#endif
+ );
+
+void vmwareWaitForFB(
+#ifdef NeedFunctionPrototypes
+ VMWAREPtr pVMWARE
+#endif
+ );
+
+void vmwareSendSVGACmdUpdate(
+#if NeedFunctionPrototypes
+ VMWAREPtr pVMWARE, BoxPtr pBB
+#endif
+ );
+
+/* vmwaregc.c */
+
+void vmwareInitGC(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+Bool vmwareCreateGC(
+#if NeedFunctionPrototypes
+ GCPtr pGC
+#endif
+ );
+
+void vmwareValidateGC(
+#if NeedFunctionPrototypes
+ GCPtr pGC, unsigned long changes, DrawablePtr pDrawable
+#endif
+ );
+
+void vmwareChangeGC(
+#if NeedFunctionPrototypes
+ GCPtr pGC, unsigned long changes
+#endif
+ );
+
+void vmwareCopyGC(
+#if NeedFunctionPrototypes
+ GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst
+#endif
+ );
+
+void vmwareDestroyGC(
+#if NeedFunctionPrototypes
+ GCPtr pGC
+#endif
+ );
+
+void vmwareChangeClip(
+#if NeedFunctionPrototypes
+ GCPtr pGC, int type, pointer pValue, int nrects
+#endif
+ );
+
+void vmwareDestroyClip(
+#if NeedFunctionPrototypes
+ GCPtr pGC
+#endif
+ );
+
+void vmwareCopyClip(
+#if NeedFunctionPrototypes
+ GCPtr pGCDst, GCPtr pGCSrc
+#endif
+ );
+
+/* vmwareinit.c */
+
+void vmwareInitEnvironment(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+void vmwareInitDisplay(
+#if NeedFunctionPrototypes
+ int screen_idx
+#endif
+ );
+
+void vmwareCleanUp(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+/* vmwarescrin.c */
+CARD32 vmwareCalculateOffset(CARD32 mask);
+
+Bool vmwareScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr pScreen,
+ pointer pbits, int xsize, int ysize, int dpix, int dpiy, int width
+#endif
+ );
+
+/* vmwarevga.c */
+
+void vmwareSaveVGAInfo(
+#if NeedFunctionPrototypes
+ int screen_idx
+#endif
+ );
+
+void vmwareRestoreVGAInfo(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+/* vmwarecmap.c */
+
+void vmwareSetPaletteBase(
+#if NeedFunctionPrototypes
+ int pal
+#endif
+ );
+
+int vmwareListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr pScreen, Colormap * pmaps
+#endif
+ );
+
+int vmwareGetInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr pScreen, ColormapPtr * pmap
+#endif
+ );
+
+void vmwareStoreColors(
+#if NeedFunctionPrototypes
+ ColormapPtr pmap, int ndef, xColorItem * pdefs
+#endif
+ );
+
+void vmwareInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr pmap
+#endif
+ );
+
+void vmwareUninstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr pmap
+#endif
+ );
+
+void vmwareRestoreColor0(
+#if NeedFunctionPrototypes
+ ScreenPtr pScreen
+#endif
+ );
+
+/* vmwarecurs.c */
+Bool vmwareCursorInit(
+#if NeedFunctionPrototypes
+ char *pm, ScreenPtr pScr
+#endif
+ );
+
+Bool vmwareRealizeCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, CursorPtr pCurs
+#endif
+ );
+
+Bool vmwareUnrealizeCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, CursorPtr pCurs
+#endif
+ );
+
+void vmwareSetCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, CursorPtr pCurs, int x, int y
+#endif
+ );
+
+void vmwareRepositionCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr
+#endif
+ );
+
+void vmwareRestoreCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr
+#endif
+ );
+
+void vmwareMoveCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, int x, int y
+#endif
+ );
+
+void vmwareRenewCursorColor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr
+#endif
+ );
+
+void vmwareRecolorCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, CursorPtr pCurs, Bool displayed
+#endif
+ );
+
+void vmwareWarpCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr pScr, int x, int y
+#endif
+ );
+
+void vmwareQueryBestSize(
+#if NeedFunctionPrototypes
+ int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScr
+#endif
+ );
+
+void vmwareCursorOff(
+#if NeedFunctionPrototypes
+ VMWAREPtr pVMWARE
+#endif
+ );
+
+void vmwareClearSavedCursor(
+#if NeedFunctionPrototypes
+ int scr_index
+#endif
+ );
+
+void vmwareBlockHandler(
+#if NeedFunctionPrototypes
+ int i, pointer blockData, pointer pTimeout, pointer pReadmask
+#endif
+ );
+
+/* BEGIN Screen functions that draw */
+
+void vmwareCopyWindow(
+#if NeedFunctionPrototypes
+ WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc
+#endif
+ );
+
+void vmwarePaintWindow(
+#if NeedFunctionPrototypes
+ WindowPtr pWindow, RegionPtr pRegion, int what
+#endif
+ );
+
+void vmwareGetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst
+#endif
+ );
+
+void vmwareGetImage(
+#if NeedFunctionPrototypes
+ DrawablePtr src,
+ int x,
+ int y,
+ int w,
+ int h, unsigned int format, unsigned long planeMask, char *pBinImage
+#endif
+ );
+
+void vmwareSaveDoomedAreas(
+#if NeedFunctionPrototypes
+ WindowPtr pWin, RegionPtr prgnSave, int xorg, int yorg
+#endif
+ );
+
+RegionPtr vmwareRestoreAreas(
+#if NeedFunctionPrototypes
+ WindowPtr pWin,
+ RegionPtr prgnRestore
+#endif
+ );
+
+/* END Screen functions that draw */
+
+/* BEGIN GCOps */
+
+void vmwareFillSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted
+#endif
+ );
+
+void vmwareSetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted
+#endif
+ );
+
+void vmwarePutImage(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pBits
+#endif
+ );
+
+void vmwareDoBitblt(DrawablePtr pSrc,
+#if NeedFunctionPrototypes
+ DrawablePtr pDst,
+ int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane
+#endif
+ );
+
+RegionPtr vmwareCopyArea(
+#if NeedFunctionPrototypes
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty
+#endif
+ );
+
+RegionPtr vmwareCopyPlane(
+#if NeedFunctionPrototypes
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width, int height, int dstx, int dsty, unsigned long bitPlane
+#endif
+ );
+
+void vmwarePolyPoint(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit
+#endif
+ );
+
+void vmwarePolylines(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit
+#endif
+ );
+
+void vmwarePolySegment(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs
+#endif
+ );
+
+void vmwarePolyRectangle(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle * pRects
+#endif
+ );
+
+void vmwarePolyArc(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs
+#endif
+ );
+
+void vmwareFillPolygon(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts
+#endif
+ );
+
+void vmwarePolyFillRect(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle * prectInit
+#endif
+ );
+
+void vmwarePolyFillArc(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs
+#endif
+ );
+
+int vmwarePolyText8(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars
+#endif
+ );
+
+int vmwarePolyText16(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars
+#endif
+ );
+
+void vmwareImageText8(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars
+#endif
+ );
+
+void vmwareImageText16(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars
+#endif
+ );
+
+void vmwareImageGlyphBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase
+#endif
+ );
+
+void vmwarePolyGlyphBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase
+#endif
+ );
+
+void vmwarePushPixels(
+#if NeedFunctionPrototypes
+ GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y
+#endif
+ );
+
+/* END GCOps */
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man
new file mode 100644
index 000000000..e2d707fef
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man
@@ -0,0 +1,37 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man,v 1.2 2001/04/06 17:44:58 dawes Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH VMWARE __drivermansuffix__ __vendorversion__
+.SH NAME
+vmware \- VMware SVGA video driver
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" devname \*q
+.B " Driver \*qvmware\*q"
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B vmware
+is an XFree86 driver for VMware virtual video cards.
+.SH CONFIGURATION DETAILS
+Please refer to XF86Config(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to this
+driver.
+.PP
+The driver auto-detects the version of any virtual VMware SVGA adapter.
+.PP
+The following driver
+.B Options
+are supported:
+.TP
+.BI "Option \*qHWCursor\*q \*q" boolean \*q
+Enable or disable the HW cursor. Default: off.
+.TP
+.BI "Option \*qNoAccel\*q \*q" boolean \*q
+Disable or enable acceleration. Default: acceleration is enabled.
+.SH "SEE ALSO"
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+.SH AUTHORS
+Copyright (c) 1999-2001 VMware, Inc.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c
new file mode 100644
index 000000000..f081a3b31
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c
@@ -0,0 +1,283 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwareblt[] =
+
+ "Id: vmwareblt.c,v 1.4 2001/01/27 00:28:15 bennett Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "X.h"
+#include "cfb.h"
+#include "vmware.h"
+
+void
+vmwareDoBitblt(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane)
+{
+ BoxPtr pbox;
+ int nbox;
+ BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ VMWAREPtr pVMWARE;
+
+ pVMWARE = VMWAREPTR(infoFromScreen(pSrc->pScreen));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (pptSrc->y < pbox->y1) {
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+ if (!pboxNew1)
+ return;
+ pptNew1 =
+ (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+ if (!pptNew1) {
+ DEALLOCATE_LOCAL(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox + nbox - 1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext + 1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ }
+ if (pptSrc->x < pbox->x1) {
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+ pptNew2 =
+ (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+ if (!pboxNew2 || !pptNew2) {
+ if (pptNew2)
+ DEALLOCATE_LOCAL(pptNew2);
+ if (pboxNew2)
+ DEALLOCATE_LOCAL(pboxNew2);
+ if (pboxNew1) {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox + nbox) {
+ while ((pboxNext < pbox + nbox) &&
+ (pboxNext->y1 == pboxBase->y1)) pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ }
+ /* Send the commands */
+ while (nbox--) {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY);
+ vmwareWriteWordToFIFO(pVMWARE, pptSrc->x);
+ vmwareWriteWordToFIFO(pVMWARE, pptSrc->y);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->y1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1);
+ vmwareWriteWordToFIFO(pVMWARE, alu);
+ pptSrc++;
+ pbox++;
+ }
+ if (pboxNew2) {
+ DEALLOCATE_LOCAL(pptNew2);
+ DEALLOCATE_LOCAL(pboxNew2);
+ }
+ if (pboxNew1) {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+}
+
+RegionPtr
+vmwareCopyArea(DrawablePtr pSrcDrawable,
+DrawablePtr pDstDrawable,
+GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ RegionPtr prgn;
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen));
+
+ TRACEPOINT
+ if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY) &&
+ (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) &&
+ pSrcDrawable->type == DRAWABLE_WINDOW &&
+ pDstDrawable->type == DRAWABLE_WINDOW &&
+ (pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk) {
+ void (*doBitBlt) (DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long, unsigned long);
+ BoxRec updateBB;
+ BoxRec mouseBB;
+ Bool hidden = pVMWARE->mouseHidden;
+
+ updateBB.x1 = pDstDrawable->x + dstx;
+ updateBB.y1 = pDstDrawable->y + dsty;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx);
+ mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty);
+ mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width;
+ mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height;
+ doBitBlt = vmwareDoBitblt;
+ if (!hidden) {
+ HIDE_CURSOR_ACCEL(pVMWARE, mouseBB);
+ }
+ prgn =
+ cfbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width,
+ height, dstx, dsty, doBitBlt, 0L);
+ if (!hidden) {
+ SHOW_CURSOR(pVMWARE, mouseBB);
+ }
+ UPDATE_ACCEL_AREA(pVMWARE, updateBB);
+ } else if (pDstDrawable->type == DRAWABLE_WINDOW ||
+ pSrcDrawable->type == DRAWABLE_WINDOW) {
+ if (pVMWARE->vmwareBBLevel == 0) {
+ BoxRec updateBB;
+ BoxRec mouseBB;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW &&
+ pSrcDrawable->type != DRAWABLE_WINDOW) {
+ updateBB.x1 = pDstDrawable->x + dstx;
+ updateBB.y1 = pDstDrawable->y + dsty;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB = updateBB;
+ } else if (pDstDrawable->type != DRAWABLE_WINDOW &&
+ pSrcDrawable->type == DRAWABLE_WINDOW) {
+ updateBB.x1 = pSrcDrawable->x + srcx;
+ updateBB.y1 = pSrcDrawable->y + srcy;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB = updateBB;
+ } else {
+ updateBB.x1 = pDstDrawable->x + dstx;
+ updateBB.y1 = pDstDrawable->y + dsty;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx);
+ mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty);
+ mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width;
+ mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height;
+ }
+ HIDE_CURSOR(pVMWARE, mouseBB);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->vmwareBBLevel++;
+ prgn =
+ GC_OPS(pGC)->CopyArea(pSrcDrawable,
+ pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty);
+ pVMWARE->vmwareBBLevel--;
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ vmwareSendSVGACmdUpdate(pVMWARE, &updateBB);
+ }
+ SHOW_CURSOR(pVMWARE, mouseBB);
+ } else {
+ vmwareWaitForFB(pVMWARE);
+ prgn =
+ GC_OPS(pGC)->CopyArea(pSrcDrawable,
+ pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty);
+ }
+ } else {
+ prgn =
+ GC_OPS(pGC)->CopyArea(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ }
+ return prgn;
+}
+
+RegionPtr
+vmwareCopyPlane(DrawablePtr pSrcDrawable,
+DrawablePtr pDstDrawable,
+GCPtr pGC,
+int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr prgn;
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen));
+
+ TRACEPOINT
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW ||
+ pSrcDrawable->type == DRAWABLE_WINDOW) {
+ if (pVMWARE->vmwareBBLevel == 0) {
+ BoxRec updateBB;
+ BoxRec mouseBB;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW &&
+ pSrcDrawable->type != DRAWABLE_WINDOW) {
+ updateBB.x1 = pDstDrawable->x + dstx;
+ updateBB.y1 = pDstDrawable->y + dsty;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB = updateBB;
+ } else if (pDstDrawable->type != DRAWABLE_WINDOW &&
+ pSrcDrawable->type == DRAWABLE_WINDOW) {
+ updateBB.x1 = pSrcDrawable->x + srcx;
+ updateBB.y1 = pSrcDrawable->y + srcy;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB = updateBB;
+ } else {
+ updateBB.x1 = pDstDrawable->x + dstx;
+ updateBB.y1 = pDstDrawable->y + dsty;
+ updateBB.x2 = updateBB.x1 + width;
+ updateBB.y2 = updateBB.y1 + height;
+ mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx);
+ mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty);
+ mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width;
+ mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height;
+ }
+ HIDE_CURSOR(pVMWARE, mouseBB);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->vmwareBBLevel++;
+ prgn =
+ pVMWARE->pcfbCopyPlane(pSrcDrawable,
+ pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+ pVMWARE->vmwareBBLevel--;
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ vmwareSendSVGACmdUpdate(pVMWARE, &updateBB);
+ }
+ SHOW_CURSOR(pVMWARE, mouseBB);
+ } else {
+ vmwareWaitForFB(pVMWARE);
+ prgn =
+ pVMWARE->pcfbCopyPlane(pSrcDrawable,
+ pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+ }
+ } else {
+ prgn =
+ pVMWARE->pcfbCopyPlane(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ }
+ return prgn;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c
new file mode 100644
index 000000000..d390ddaa8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c
@@ -0,0 +1,65 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarebstor[] =
+
+ "Id: vmwarebstor.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+void
+vmwareSaveDoomedAreas(WindowPtr pWin,
+ RegionPtr prgnSave, int xorg, int yorg)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen));
+
+ TRACEPOINT
+
+ if (pVMWARE->vmwareBBLevel == 0) {
+ BoxRec BB;
+
+ BB = *REGION_EXTENTS(pWin->drawable.pScreen, prgnSave);
+ BB.x1 += xorg;
+ BB.x2 += xorg;
+ BB.y1 += yorg;
+ BB.y2 += yorg;
+ HIDE_CURSOR(pVMWARE, BB);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->vmwareBBLevel++;
+ pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg);
+ pVMWARE->vmwareBBLevel--;
+ SHOW_CURSOR(pVMWARE, BB);
+ } else {
+ pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg);
+ }
+}
+
+RegionPtr
+vmwareRestoreAreas(WindowPtr pWin,
+ RegionPtr prgnRestore)
+{
+ RegionPtr res;
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen));
+
+ TRACEPOINT
+
+ if (pVMWARE->vmwareBBLevel == 0) {
+ BoxPtr pBB;
+
+ pBB = REGION_EXTENTS(pWin->drawable.pScreen, prgnRestore);
+ HIDE_CURSOR(pVMWARE, *pBB);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->vmwareBBLevel++;
+ res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore);
+ pVMWARE->vmwareBBLevel--;
+ vmwareSendSVGACmdUpdate(pVMWARE, pBB);
+ SHOW_CURSOR(pVMWARE, *pBB);
+ } else {
+ res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore);
+ }
+ return res;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c
new file mode 100644
index 000000000..e4b16abce
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c
@@ -0,0 +1,439 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarecurs[] =
+
+ "Id: vmwarecurs.c,v 1.5 2001/01/30 23:33:02 bennett Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+#include "cursorstr.h"
+#include "bits2pixels.h"
+
+typedef struct _VMwareCursPriv {
+ uint8 *bSource;
+ uint8 *bMask;
+ uint8 *pSource;
+ uint8 *pMask;
+} VMwareCursPriv;
+
+static int vmwareCursGeneration = -1;
+static CursorPtr vmwareSaveCursors[MAXSCREENS];
+
+static miPointerSpriteFuncRec vmwarePointerSpriteFuncs = {
+ vmwareRealizeCursor,
+ vmwareUnrealizeCursor,
+ vmwareSetCursor,
+ vmwareMoveCursor,
+};
+
+Bool
+vmwareCursorInit(char *pm,
+ ScreenPtr pScr)
+{
+ TRACEPOINT
+ if (vmwareCursGeneration != serverGeneration) {
+ miPointerScreenFuncPtr xf86scrn = xf86GetPointerScreenFuncs();
+
+ pScr->QueryBestSize = vmwareQueryBestSize;
+ if (!(miPointerInitialize(pScr, &vmwarePointerSpriteFuncs,
+ xf86scrn, FALSE)))
+ return FALSE;
+
+ pScr->RecolorCursor = vmwareRecolorCursor;
+ vmwareCursGeneration = serverGeneration;
+ }
+ return TRUE;
+}
+
+static void ZeroBits(uint8 *buf, int preserveBits, int totalBits) {
+ while (preserveBits > 8) {
+ buf++;
+ preserveBits -= 8;
+ totalBits -= 8;
+ }
+ *buf &= ~(~0 << preserveBits);
+ buf++;
+ preserveBits -= 8;
+ totalBits -= 8;
+ while (totalBits > 0) {
+ *buf++ = 0;
+ totalBits -= 8;
+ }
+}
+
+Bool
+vmwareRealizeCursor(ScreenPtr pScr,
+ CursorPtr pCurs)
+{
+ pointer *pPriv = &pCurs->bits->devPriv[pScr->myNum];
+ VMwareCursPriv *cursPriv;
+ int i;
+ uint8 *bits;
+ VMWAREPtr pVMWARE;
+
+ TRACEPOINT
+ if (pCurs->bits->refcnt > 1)
+ return TRUE;
+ cursPriv = (VMwareCursPriv *) xcalloc(1, sizeof(VMwareCursPriv));
+ if (!cursPriv)
+ return FALSE;
+ cursPriv->bSource = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height);
+ if (!cursPriv->bSource) {
+ xfree(cursPriv);
+ return FALSE;
+ }
+ pVMWARE = VMWAREPTR(infoFromScreen(pScr));
+
+ memcpy(cursPriv->bSource, pCurs->bits->source, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height);
+ bits = cursPriv->bSource;
+ /* Handle cursors that do not have zero bits beyond the right edge of each scanline */
+ for (i = 0; i < pCurs->bits->height; i++) {
+ ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8);
+ bits += PixmapBytePad(pCurs->bits->width, 1);
+ }
+ /* Raster_BitsToPixels expects most significant bit first */
+ for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) {
+ cursPriv->bSource[i] =
+ (cursPriv->bSource[i] & 0x01) << 7 |
+ (cursPriv->bSource[i] & 0x02) << 5 |
+ (cursPriv->bSource[i] & 0x04) << 3 |
+ (cursPriv->bSource[i] & 0x08) << 1 |
+ (cursPriv->bSource[i] & 0x10) >> 1 |
+ (cursPriv->bSource[i] & 0x20) >> 3 |
+ (cursPriv->bSource[i] & 0x40) >> 5 |
+ (cursPriv->bSource[i] & 0x80) >> 7;
+ }
+ cursPriv->bMask = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height);
+ if (!cursPriv->bMask) {
+ xfree(cursPriv->bSource);
+ xfree(cursPriv);
+ return FALSE;
+ }
+ memcpy(cursPriv->bMask, pCurs->bits->mask, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height);
+ bits = cursPriv->bMask;
+ /* Handle cursors that do not have zero bits beyond the right edge of each scanline */
+ for (i = 0; i < pCurs->bits->height; i++) {
+ ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8);
+ bits += PixmapBytePad(pCurs->bits->width, 1);
+ }
+ for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) {
+ cursPriv->bMask[i] =
+ (cursPriv->bMask[i] & 0x01) << 7 |
+ (cursPriv->bMask[i] & 0x02) << 5 |
+ (cursPriv->bMask[i] & 0x04) << 3 |
+ (cursPriv->bMask[i] & 0x08) << 1 |
+ (cursPriv->bMask[i] & 0x10) >> 1 |
+ (cursPriv->bMask[i] & 0x20) >> 3 |
+ (cursPriv->bMask[i] & 0x40) >> 5 |
+ (cursPriv->bMask[i] & 0x80) >> 7;
+ }
+ cursPriv->pSource = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel));
+ if (!cursPriv->pSource) {
+ xfree(cursPriv->bMask);
+ xfree(cursPriv->bSource);
+ xfree(cursPriv);
+ return FALSE;
+ }
+ cursPriv->pMask = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel));
+ if (!cursPriv->pMask) {
+ xfree(cursPriv->pSource);
+ xfree(cursPriv->bMask);
+ xfree(cursPriv->bSource);
+ xfree(cursPriv);
+ return FALSE;
+ }
+ Raster_BitsToPixels(cursPriv->bMask, PixmapBytePad(pCurs->bits->width, 1),
+ cursPriv->pMask, 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel),
+ pVMWARE->bitsPerPixel / 8,
+ pCurs->bits->width, pCurs->bits->height, 0, ~0);
+ *pPriv = (pointer) cursPriv;
+ return TRUE;
+}
+
+Bool
+vmwareUnrealizeCursor(ScreenPtr pScr,
+ CursorPtr pCurs)
+{
+ VMwareCursPriv *cursPriv;
+
+ TRACEPOINT
+ if (pCurs->bits->refcnt <= 1 &&
+ (cursPriv = pCurs->bits->devPriv[pScr->myNum])) {
+ xfree(cursPriv->pMask);
+ xfree(cursPriv->pSource);
+ xfree(cursPriv->bMask);
+ xfree(cursPriv->bSource);
+ xfree(cursPriv);
+ }
+ return TRUE;
+}
+
+static void
+vmwareLoadCursor(ScreenPtr pScr,
+ CursorPtr pCurs,
+ int x,
+ int y)
+{
+ VMWAREPtr pVMWARE;
+
+ TRACEPOINT
+
+ if (!pCurs)
+ return;
+
+ pVMWARE = VMWAREPTR(infoFromScreen(pScr));
+
+ pVMWARE->Mouse.Width = pCurs->bits->width;
+ pVMWARE->Mouse.Height = pCurs->bits->height;
+ pVMWARE->Mouse.XHot = pCurs->bits->xhot;
+ pVMWARE->Mouse.YHot = pCurs->bits->yhot;
+ vmwareRecolorCursor(pScr, pCurs, TRUE);
+ vmwareMoveCursor(pScr, x, y);
+
+ if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR);
+ vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID);
+ vmwareWriteWordToFIFO(pVMWARE, 1);
+ }
+}
+
+void
+vmwareSetCursor(ScreenPtr pScr,
+ CursorPtr pCurs,
+ int x,
+ int y)
+{
+ int index = pScr->myNum;
+
+ TRACEPOINT
+
+ if (!pCurs)
+ return;
+
+ vmwareSaveCursors[index] = pCurs;
+ vmwareLoadCursor(pScr, pCurs, x, y);
+}
+
+void
+vmwareRestoreCursor(ScreenPtr pScr)
+{
+ int index = pScr->myNum;
+ int x, y;
+
+ TRACEPOINT
+
+ miPointerPosition(&x, &y);
+ vmwareLoadCursor(pScr, vmwareSaveCursors[index], x, y);
+}
+
+void
+vmwareMoveCursor(ScreenPtr pScr,
+ int x,
+ int y)
+{
+ VMWAREPtr pVMWARE;
+
+ TRACEPOINT
+
+ pVMWARE = VMWAREPTR(infoFromScreen(pScr));
+
+ pVMWARE->Mouse.Box.x1 = x - pVMWARE->Mouse.XHot;
+ if (pVMWARE->Mouse.Box.x1 < 0) pVMWARE->Mouse.Box.x1 = 0;
+ pVMWARE->Mouse.Box.y1 = y - pVMWARE->Mouse.YHot;
+ if (pVMWARE->Mouse.Box.y1 < 0) pVMWARE->Mouse.Box.y1 = 0;
+
+ pVMWARE->Mouse.Box.x2 = pVMWARE->Mouse.Box.x1 + pVMWARE->Mouse.Width;
+ pVMWARE->Mouse.Box.y2 = pVMWARE->Mouse.Box.y1 + pVMWARE->Mouse.Height;
+
+ if (pVMWARE->cursorDefined && !pVMWARE->mouseHidden) {
+ if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) {
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID);
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, x);
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, y);
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 1);
+ } else {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR);
+ vmwareWriteWordToFIFO(pVMWARE, x);
+ vmwareWriteWordToFIFO(pVMWARE, y);
+ UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box);
+ }
+ }
+}
+
+void
+vmwareRecolorCursor(ScreenPtr pScr,
+ CursorPtr pCurs,
+ Bool displayed)
+{
+ xColorItem sourceColor;
+ xColorItem maskColor;
+ VMwareCursPriv *cursPriv = pCurs->bits->devPriv[pScr->myNum];
+ uint32 *b1, *b2;
+ int i;
+ VMWAREPtr pVMWARE;
+
+ TRACEPOINT
+
+ if (!displayed)
+ return;
+
+ pVMWARE = VMWAREPTR(infoFromScreen(pScr));
+
+ sourceColor.red = pCurs->foreRed;
+ sourceColor.green = pCurs->foreGreen;
+ sourceColor.blue = pCurs->foreBlue;
+
+ maskColor.red = pCurs->backRed;
+ maskColor.green = pCurs->backGreen;
+ maskColor.blue = pCurs->backBlue;
+
+ if (pScr->rootDepth > 8)
+ {
+ sourceColor.pixel = (sourceColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red |
+ (sourceColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green |
+ (sourceColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue;
+ maskColor.pixel = (maskColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red |
+ (maskColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green |
+ (maskColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue;
+ }
+ else
+ {
+ ColormapPtr pmap;
+
+ pmap = miInstalledMaps[pScr->myNum];
+
+ FakeAllocColor(pmap, &sourceColor);
+ FakeAllocColor(pmap, &maskColor);
+
+ FakeFreeColor(pmap, sourceColor.pixel);
+ FakeFreeColor(pmap, maskColor.pixel);
+
+ maskColor.red = maskColor.red >> 8;
+ maskColor.green = maskColor.green >> 8;
+ maskColor.blue = maskColor.blue >> 8;
+
+ sourceColor.red = sourceColor.red >> 8;
+ sourceColor.green = sourceColor.green >> 8;
+ sourceColor.blue = sourceColor.blue >> 8;
+ }
+
+ /* Calculate XOR mask */
+ Raster_BitsToPixels(cursPriv->bSource, PixmapBytePad(pCurs->bits->width, 1),
+ cursPriv->pSource,
+ 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel),
+ pVMWARE->bitsPerPixel / 8,
+ pCurs->bits->width, pCurs->bits->height, sourceColor.pixel, maskColor.pixel);
+ b1 = (uint32 *) cursPriv->pSource;
+ b2 = (uint32 *) cursPriv->pMask;
+ for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) {
+ *b1++ &= ~*b2++;
+ }
+
+ /* Define cursor */
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR);
+ vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID);
+ vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->xhot);
+ vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->yhot);
+ vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->width);
+ vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->height);
+ vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel);
+ vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel);
+ b1 = (uint32 *) cursPriv->pSource;
+ b2 = (uint32 *) cursPriv->pMask;
+ for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) {
+ vmwareWriteWordToFIFO(pVMWARE, *b2++);
+ }
+ for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) {
+ vmwareWriteWordToFIFO(pVMWARE, *b1++);
+ /* vmwareWriteWordToFIFO(~0); */
+ }
+ pVMWARE->checkCursorColor = FALSE;
+
+ /* Sync the FIFO, so that the definition preceeds any use of the cursor */
+ UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->cursorDefined = TRUE;
+}
+
+void
+vmwareRenewCursorColor(ScreenPtr pScr)
+{
+ TRACEPOINT
+
+ if (vmwareSaveCursors[pScr->myNum])
+ vmwareRecolorCursor(pScr, vmwareSaveCursors[pScr->myNum], TRUE);
+}
+
+void
+vmwareBlockHandler(i, blockData, pTimeout, pReadmask)
+ int i;
+ pointer blockData;
+ pointer pTimeout;
+ pointer pReadmask;
+{
+ VMWAREPtr pVMWARE;
+
+ TRACEPOINT
+
+ pVMWARE = VMWAREPTR(xf86Screens[i]);
+ if (pVMWARE->checkCursorColor)
+ vmwareRenewCursorColor(screenInfo.screens[i]);
+}
+
+void
+vmwareQueryBestSize(class, pwidth, pheight, pScr)
+ int class;
+ unsigned short *pwidth;
+ unsigned short *pheight;
+ ScreenPtr pScr;
+{
+ TRACEPOINT
+
+ if (*pwidth > 0) {
+
+ switch (class) {
+
+ case CursorShape:
+ if (*pwidth > 64)
+ *pwidth = 64;
+ if (*pheight > 64)
+ *pheight = 64;
+ break;
+ default:
+ mfbQueryBestSize(class, pwidth, pheight, pScr);
+ break;
+ }
+ }
+}
+
+void
+vmwareCursorOff(VMWAREPtr pVMWARE)
+{
+ TRACEPOINT
+
+ if (pVMWARE->cursorDefined) {
+ if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) {
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID);
+ vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 0);
+ } else {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR);
+ vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID);
+ vmwareWriteWordToFIFO(pVMWARE, 0);
+ UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box);
+ }
+ }
+}
+
+void
+vmwareClearSavedCursor(int scr_index)
+{
+ TRACEPOINT
+
+ vmwareSaveCursors[scr_index] = NULL;
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c
new file mode 100644
index 000000000..0e1e8fc15
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c
@@ -0,0 +1,62 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarefillarc[] =
+
+ "Id: vmwarefillarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static void
+computeBBarc(DrawablePtr pDrawable,
+ GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB)
+{
+ if (narcs <= 0)
+ return;
+ pBB->x1 = parcs->x;
+ pBB->y1 = parcs->y;
+ pBB->x2 = parcs->x + parcs->width;
+ pBB->y2 = parcs->y + parcs->height;
+ while (--narcs) {
+ parcs++;
+ if (parcs->x < pBB->x1)
+ pBB->x1 = parcs->x;
+ if (parcs->y < pBB->y1)
+ pBB->y1 = parcs->y;
+ if ((parcs->x + parcs->width) > pBB->x2)
+ pBB->x2 = parcs->x + parcs->width;
+ if ((parcs->y + parcs->height) > pBB->y2)
+ pBB->y2 = parcs->y + parcs->height;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBarc(pDrawable, pGC, narcs, parcs, &BB),
+ GC_OPS(pGC)->PolyFillArc(pDrawable, pGC, narcs, parcs));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c
new file mode 100644
index 000000000..3bb70e3c4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c
@@ -0,0 +1,63 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarefs[] =
+
+ "Id: vmwarefs.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static __inline void
+vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable)
+{
+ BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width;
+ BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height;
+}
+
+void
+vmwareFillSpans(DrawablePtr pDrawable,
+ GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pDrawable->pScreen,
+ vmwareDrawableToBox(&BB, pDrawable),
+ GC_OPS(pGC)->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted));
+}
+
+void
+vmwareSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pcharsrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pDrawable->pScreen,
+ vmwareDrawableToBox(&BB, pDrawable),
+ GC_OPS(pGC)->SetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted));
+}
+
+void
+vmwareGetSpans(DrawablePtr pDrawable,
+ int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen));
+
+ TRACEPOINT
+
+ VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ (BB.x1 = 0, BB.y1 = 0,
+ BB.x2 = pDrawable->pScreen->width,
+ BB.y2 = pDrawable->pScreen->height),
+ pVMWARE->ScrnFuncs.GetSpans(pDrawable, wMax, pPoints, pWidths, nSpans, pDst));
+}
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c
new file mode 100644
index 000000000..cad0109e6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c
@@ -0,0 +1,132 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwaregc[] =
+
+ "Id: vmwaregc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "X.h"
+#include "cfb.h"
+#include "cfb16.h"
+#include "cfb24.h"
+#include "cfb32.h"
+#include "mi.h"
+#include "migc.h"
+#include "vmware.h"
+
+GCFuncs vmwareGCFuncs = {
+ vmwareValidateGC,
+ vmwareChangeGC,
+ vmwareCopyGC,
+ vmwareDestroyGC,
+ vmwareChangeClip,
+ vmwareDestroyClip,
+ vmwareCopyClip
+};
+
+GCOps vmwareGCOps = {
+ vmwareFillSpans,
+ vmwareSetSpans,
+ vmwarePutImage,
+ vmwareCopyArea,
+ vmwareCopyPlane,
+ vmwarePolyPoint,
+ vmwarePolylines,
+ vmwarePolySegment,
+ vmwarePolyRectangle,
+ vmwarePolyArc,
+ vmwareFillPolygon,
+ vmwarePolyFillRect,
+ vmwarePolyFillArc,
+ vmwarePolyText8,
+ vmwarePolyText16,
+ vmwareImageText8,
+ vmwareImageText16,
+ vmwareImageGlyphBlt,
+ vmwarePolyGlyphBlt,
+ vmwarePushPixels,
+#ifdef NEED_LINEHELPER
+ , NULL
+#endif
+};
+
+unsigned long Pmsk;
+
+Bool
+vmwareCreateGC(GCPtr pGC)
+{
+ Bool ret;
+
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ ret = VMWAREPTR(infoFromScreen(pGC->pScreen))->ScrnFuncs.CreateGC(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+ return ret;
+}
+
+void
+vmwareValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ValidateGC(pGC, changes, pDrawable);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+void
+vmwareChangeGC(GCPtr pGC, unsigned long changes)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeGC(pGC, changes);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+void
+vmwareCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGCDst);
+ pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst);
+ GC_FUNC_EPILOGUE(pGCDst);
+}
+
+void
+vmwareDestroyGC(GCPtr pGC)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyGC(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+void
+vmwareChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+void
+vmwareDestroyClip(GCPtr pGC)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyClip(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+void
+vmwareCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+{
+ TRACEPOINT
+ GC_FUNC_PROLOGUE(pGCDst);
+ pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
+ GC_FUNC_EPILOGUE(pGCDst);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c
new file mode 100644
index 000000000..1579d3bfc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c
@@ -0,0 +1,47 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwareglblt[] =
+
+ "Id: vmwareglblt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static __inline void
+vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable)
+{
+ BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width;
+ BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height;
+}
+
+void
+vmwareImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareDrawableToBox(&BB, pDrawable),
+ GC_OPS(pGC)->ImageGlyphBlt(pDrawable, pGC, x, y,
+ nglyph, ppci, pglyphBase));
+}
+
+void
+vmwarePolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareDrawableToBox(&BB, pDrawable),
+ GC_OPS(pGC)->PolyGlyphBlt(pDrawable, pGC, x, y,
+ nglyph, ppci, pglyphBase));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c
new file mode 100644
index 000000000..d1dece31b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c
@@ -0,0 +1,59 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwareimage[] =
+
+ "Id: vmwareimage.c,v 1.3 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+/*
+ * vmwarePutImage does not optimize ops because a downstream call is made
+ * to CopyArea.
+ */
+
+static __inline void
+vmwareImageToBox(BoxPtr BB, DrawablePtr pDrawable, int x, int y, int w, int h)
+{
+ BB->x2 = (BB->x1 = pDrawable->x + x) + w;
+ BB->y2 = (BB->y1 = pDrawable->y + y) + h;
+}
+
+void
+vmwarePutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareImageToBox(&BB, pDrawable, x, y, w, h),
+ GC_OPS(pGC)->PutImage(pDrawable, pGC, depth, x, y,
+ w, h, leftPad, format, pImage));
+}
+
+void
+vmwareGetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h, unsigned int format, unsigned long planeMask, char *pBinImage)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen));
+
+ TRACEPOINT
+
+ VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ vmwareImageToBox(&BB, pDrawable, x, y, w, h),
+ pVMWARE->ScrnFuncs.GetImage(pDrawable, x, y, w, h, format, planeMask, pBinImage));
+}
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c
new file mode 100644
index 000000000..a09b5a12b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c
@@ -0,0 +1,141 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwareline[] =
+
+ "Id: vmwareline.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static void
+computeBBpoints(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB)
+{
+ int x, y;
+
+ if (npt <= 0)
+ return;
+ x = pptInit->x;
+ y = pptInit->y;
+ pBB->x1 = x;
+ pBB->y1 = y;
+ pBB->x2 = x + 1;
+ pBB->y2 = y + 1;
+ while (--npt) {
+ pptInit++;
+ if (mode == CoordModeOrigin) {
+ x = pptInit->x;
+ y = pptInit->y;
+ } else {
+ x += pptInit->x;
+ y += pptInit->y;
+ }
+ if (x < pBB->x1)
+ pBB->x1 = x;
+ if (y < pBB->y1)
+ pBB->y1 = y;
+ if (x + 1 > pBB->x2)
+ pBB->x2 = x + 1;
+ if (y + 1 > pBB->y2)
+ pBB->y2 = y + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolylines(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBpoints(pDrawable, pGC, mode, npt, pPts, &BB),
+ GC_OPS(pGC)->Polylines(pDrawable, pGC, mode, npt, pPts));
+}
+
+static void
+computeBBsegments(DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSegs, BoxPtr pBB)
+{
+ if (nseg <= 0)
+ return;
+ pBB->x1 = pSegs->x1;
+ pBB->y1 = pSegs->y1;
+ pBB->x2 = pSegs->x1 + 1;
+ pBB->y2 = pSegs->y1 + 1;
+ if (pSegs->x2 < pBB->x1)
+ pBB->x1 = pSegs->x2;
+ if (pSegs->y2 < pBB->y1)
+ pBB->y1 = pSegs->y2;
+ if (pSegs->x2 + 1 > pBB->x2)
+ pBB->x2 = pSegs->x2 + 1;
+ if (pSegs->y2 + 1 > pBB->y2)
+ pBB->y2 = pSegs->y2 + 1;
+ while (--nseg) {
+ pSegs++;
+ if (pSegs->x1 < pBB->x1)
+ pBB->x1 = pSegs->x1;
+ if (pSegs->y1 < pBB->y1)
+ pBB->y1 = pSegs->y1;
+ if (pSegs->x1 + 1 > pBB->x2)
+ pBB->x2 = pSegs->x1 + 1;
+ if (pSegs->y1 + 1 > pBB->y2)
+ pBB->y2 = pSegs->y1 + 1;
+ if (pSegs->x2 < pBB->x1)
+ pBB->x1 = pSegs->x2;
+ if (pSegs->y2 < pBB->y1)
+ pBB->y1 = pSegs->y2;
+ if (pSegs->x2 + 1 > pBB->x2)
+ pBB->x2 = pSegs->x2 + 1;
+ if (pSegs->y2 + 1 > pBB->y2)
+ pBB->y2 = pSegs->y2 + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolySegment(DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSegs)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBsegments(pDrawable, pGC, nseg, pSegs, &BB),
+ GC_OPS(pGC)->PolySegment(pDrawable, pGC, nseg, pSegs));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c
new file mode 100644
index 000000000..7f9d6d308
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c
@@ -0,0 +1,80 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwareply1rct[] =
+
+ "Id: vmwareply1rct.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static void
+computeBBpoly(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int count, DDXPointPtr pptInit, BoxPtr pBB)
+{
+ int x, y;
+
+ if (count <= 0)
+ return;
+ x = pptInit->x;
+ y = pptInit->y;
+ pBB->x1 = x;
+ pBB->y1 = y;
+ pBB->x2 = x + 1;
+ pBB->y2 = y + 1;
+ while (--count) {
+ pptInit++;
+ if (mode == CoordModeOrigin) {
+ x = pptInit->x;
+ y = pptInit->y;
+ } else {
+ x += pptInit->x;
+ y += pptInit->y;
+ }
+ if (x < pBB->x1)
+ pBB->x1 = x;
+ if (y < pBB->y1)
+ pBB->y1 = y;
+ if (x + 1 > pBB->x2)
+ pBB->x2 = x + 1;
+ if (y + 1 > pBB->y2)
+ pBB->y2 = y + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwareFillPolygon(DrawablePtr pDrawable,
+ GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBpoly(pDrawable, pGC, mode, count, pPts, &BB),
+ GC_OPS(pGC)->FillPolygon(pDrawable, pGC, shape, mode,
+ count, pPts));
+}
+
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c
new file mode 100644
index 000000000..fb17997e1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c
@@ -0,0 +1,74 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarepolypnt[] =
+
+ "Id: vmwarepolypnt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static void
+computeBBpoints(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB)
+{
+ int x, y;
+
+ if (npt <= 0)
+ return;
+ x = pptInit->x;
+ y = pptInit->y;
+ pBB->x1 = x;
+ pBB->y1 = y;
+ pBB->x2 = x + 1;
+ pBB->y2 = y + 1;
+ while (--npt) {
+ pptInit++;
+ if (mode == CoordModeOrigin) {
+ x = pptInit->x;
+ y = pptInit->y;
+ } else {
+ x += pptInit->x;
+ y += pptInit->y;
+ }
+ if (x < pBB->x1)
+ pBB->x1 = x;
+ if (y < pBB->y1)
+ pBB->y1 = y;
+ if (x + 1 > pBB->x2)
+ pBB->x2 = x + 1;
+ if (y + 1 > pBB->y2)
+ pBB->y2 = y + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+ xPoint * pptInit)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBpoints(pDrawable, pGC, mode, npt, pptInit, &BB),
+ GC_OPS(pGC)->PolyPoint(pDrawable, pGC, mode, npt, pptInit));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c
new file mode 100644
index 000000000..8fd371f8e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c
@@ -0,0 +1,43 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarepush[] =
+
+ "Id: vmwarepush.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static __inline void
+vmwarePushToBox(BoxPtr BB, const GCPtr pGC, PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg)
+{
+ BB->x1 =
+ MAX(pDrawable->x + xOrg, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + yOrg, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + xOrg + dx, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + yOrg + dy, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePushPixels(GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwarePushToBox(&BB, pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg),
+ GC_OPS(pGC)->PushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c
new file mode 100644
index 000000000..00a9517e7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c
@@ -0,0 +1,274 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarerect[] =
+
+ "Id: vmwarerect.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "X.h"
+#include "cfb.h"
+#include "vmware.h"
+
+static void
+computeBBrect(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB)
+{
+ if (nrectFill <= 0)
+ return;
+ pBB->x1 = prectInit->x;
+ pBB->y1 = prectInit->y;
+ pBB->x2 = prectInit->x + prectInit->width + 1;
+ pBB->y2 = prectInit->y + prectInit->height + 1;
+ while (--nrectFill) {
+ prectInit++;
+ if (prectInit->x < pBB->x1)
+ pBB->x1 = prectInit->x;
+ if (prectInit->y < pBB->y1)
+ pBB->y1 = prectInit->y;
+ if ((prectInit->x + prectInit->width + 1) > pBB->x2)
+ pBB->x2 = prectInit->x + prectInit->width + 1;
+ if ((prectInit->y + prectInit->height + 1) > pBB->y2)
+ pBB->y2 = prectInit->y + prectInit->height + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolyRectangle(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectFill, xRectangle * prectInit)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBrect(pDrawable, pGC, nrectFill, prectInit, &BB),
+ GC_OPS(pGC)->PolyRectangle(pDrawable, pGC, nrectFill, prectInit));
+}
+
+static void
+accelFillRectSolid(VMWAREPtr pVMWARE, DrawablePtr pDrawable, GCPtr pGC, int nBox, BoxPtr pBox)
+{
+ while (nBox) {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_FILL);
+ vmwareWriteWordToFIFO(pVMWARE, pGC->fgPixel);
+ vmwareWriteWordToFIFO(pVMWARE, pBox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pBox->y1);
+ vmwareWriteWordToFIFO(pVMWARE, pBox->x2 - pBox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pBox->y2 - pBox->y1);
+ vmwareWriteWordToFIFO(pVMWARE, pGC->alu);
+ pBox++;
+ nBox--;
+ }
+}
+
+#define NUM_STACK_RECTS 1024
+
+static void
+accelPolyFillRect(VMWAREPtr pVMWARE, DrawablePtr pDrawable,
+ GCPtr pGC, int nrectFill, xRectangle * prectInit)
+{
+ xRectangle *prect;
+ RegionPtr prgnClip;
+ BoxPtr pbox;
+ BoxPtr pboxClipped;
+ BoxPtr pboxClippedBase;
+ BoxPtr pextent;
+ BoxRec stackRects[NUM_STACK_RECTS];
+ cfbPrivGC *priv;
+ int numRects;
+ int n;
+ int xorg, yorg;
+
+ priv = cfbGetGCPrivate(pGC);
+ prgnClip = cfbGetCompositeClip(pGC);
+
+ prect = prectInit;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (xorg || yorg) {
+ prect = prectInit;
+ n = nrectFill;
+ while (n--) {
+ prect->x += xorg;
+ prect->y += yorg;
+ prect++;
+ }
+ }
+
+ prect = prectInit;
+
+ numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
+ if (numRects > NUM_STACK_RECTS) {
+ pboxClippedBase = (BoxPtr) ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+ if (!pboxClippedBase)
+ return;
+ } else
+ pboxClippedBase = stackRects;
+
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1) {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_RECTS(prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--) {
+ if ((pboxClipped->x1 = prect->x) < x1)
+ pboxClipped->x1 = x1;
+
+ if ((pboxClipped->y1 = prect->y) < y1)
+ pboxClipped->y1 = y1;
+
+ bx2 = (int)prect->x + (int)prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ pboxClipped->x2 = bx2;
+
+ by2 = (int)prect->y + (int)prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ pboxClipped->y2 = by2;
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ }
+ }
+ } else {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--) {
+ BoxRec box;
+
+ if ((box.x1 = prect->x) < x1)
+ box.x1 = x1;
+
+ if ((box.y1 = prect->y) < y1)
+ box.y1 = y1;
+
+ bx2 = (int)prect->x + (int)prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ box.x2 = bx2;
+
+ by2 = (int)prect->y + (int)prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ box.y2 = by2;
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS(prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect()
+ */
+ while (n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if (pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+ if (pboxClipped != pboxClippedBase)
+ accelFillRectSolid(pVMWARE, pDrawable, pGC,
+ pboxClipped - pboxClippedBase, pboxClippedBase);
+ if (pboxClippedBase != stackRects)
+ DEALLOCATE_LOCAL(pboxClippedBase);
+}
+
+static void
+computeBBfillrect(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB)
+{
+ if (nrectFill <= 0)
+ return;
+ pBB->x1 = prectInit->x;
+ pBB->y1 = prectInit->y;
+ pBB->x2 = prectInit->x + prectInit->width;
+ pBB->y2 = prectInit->y + prectInit->height;
+ while (--nrectFill) {
+ prectInit++;
+ if (prectInit->x < pBB->x1)
+ pBB->x1 = prectInit->x;
+ if (prectInit->y < pBB->y1)
+ pBB->y1 = prectInit->y;
+ if ((prectInit->x + prectInit->width) > pBB->x2)
+ pBB->x2 = prectInit->x + prectInit->width;
+ if ((prectInit->y + prectInit->height) > pBB->y2)
+ pBB->y2 = prectInit->y + prectInit->height;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolyFillRect(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectFill, xRectangle * prectInit)
+{
+ TRACEPOINT
+
+ GC_FUNC_ACCEL_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBfillrect(pDrawable, pGC, nrectFill, prectInit, &BB),
+ (pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) &&
+ (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) &&
+ pGC->fillStyle == FillSolid && ((pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk),
+ accelPolyFillRect(pVMWARE, pDrawable, pGC, nrectFill, prectInit),
+ GC_OPS(pGC)->PolyFillRect(pDrawable, pGC, nrectFill, prectInit));
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c
new file mode 100644
index 000000000..ed91bd63a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c
@@ -0,0 +1,180 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwaretext[] =
+
+ "Id: vmwaretext.c,v 1.3 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+#include "dixfontstr.h"
+
+static void
+vmwareTextExtent(FontPtr pFont, int count, char* chars, FontEncoding fontEncoding, BoxPtr box)
+{
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars,
+ fontEncoding, &n, charinfo);
+ w = 0;
+ for (i=0; i < n; i++) {
+ w += charinfo[i]->metrics.characterWidth;
+ }
+ if (i) {
+ w += charinfo[i - 1]->metrics.rightSideBearing;
+ }
+
+ box->x1 = 0;
+ if (n) {
+ if (charinfo[0]->metrics.leftSideBearing < 0) {
+ box->x1 = charinfo[0]->metrics.leftSideBearing;
+ }
+ }
+ box->x2 = w;
+ box->y1 = -FONTMAXBOUNDS(pFont,ascent);
+ box->y2 = FONTMAXBOUNDS(pFont,descent);
+}
+
+static __inline void
+vmwareFontToBox(BoxPtr BB, DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, char *chars,
+ int wide)
+{
+ FontPtr pFont;
+
+ pFont = pGC->font;
+ if (pFont->info.constantWidth) {
+ int ascent, descent, left, right = 0;
+
+ ascent =
+ MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
+ descent =
+ MAX(pFont->info.fontDescent,
+ pFont->info.maxbounds.descent);
+ left = pFont->info.maxbounds.leftSideBearing;
+ if (count > 0) {
+ right =
+ (count - 1) * pFont->info.maxbounds.characterWidth;
+ }
+ right += pFont->info.maxbounds.rightSideBearing;
+ BB->x1 =
+ MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + y - ascent,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + x + right,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + y + descent,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+ } else {
+ vmwareTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
+ BB->x1 =
+ MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + y + BB->y1,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + x + BB->x2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + y + BB->y2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+ }
+}
+
+static __inline void
+vmwareImageFontToBox(BoxPtr BB, DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, char *chars,
+ int wide)
+{
+ FontPtr pFont;
+
+ pFont = pGC->font;
+ vmwareTextExtent(pFont, count, chars,
+ wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit,
+ BB);
+ BB->x1 =
+ MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + y + BB->y1,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + x + BB->x2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + y + BB->y2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+int
+vmwarePolyText8(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ int n;
+
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0),
+ n = GC_OPS(pGC)->PolyText8(pDrawable, pGC, x, y, count, chars));
+ return n;
+}
+
+int
+vmwarePolyText16(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ int n;
+
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1),
+ n = GC_OPS(pGC)->PolyText16(pDrawable, pGC, x, y, count, chars));
+ return n;
+}
+
+void
+vmwareImageText8(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0),
+ GC_OPS(pGC)->ImageText8(pDrawable, pGC, x, y, count, chars));
+}
+
+void
+vmwareImageText16(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1),
+ GC_OPS(pGC)->ImageText16(pDrawable, pGC, x, y, count, chars));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c
new file mode 100644
index 000000000..45bc3d75d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c
@@ -0,0 +1,145 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarewindow[] =
+
+ "Id: vmwarewindow.c,v 1.4 2001/01/27 00:28:15 bennett Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+void
+vmwareCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy;
+ int i, nbox;
+ WindowPtr pwinRoot;
+ BoxPtr pBB;
+
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen));
+
+ TRACEPOINT
+ if (!(pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY)) {
+ pVMWARE->ScrnFuncs.CopyWindow(pWin, ptOldOrg, prgnSrc);
+ return;
+ }
+ pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+ REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0);
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip,
+ prgnSrc);
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if (!nbox ||
+ !(pptSrc =
+ (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+ for (i = nbox; --i >= 0; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+ pBB = REGION_EXTENTS(pWin->drawable.pScreen, &rgnDst);
+ HIDE_CURSOR_ACCEL(pVMWARE, *pBB);
+ vmwareDoBitblt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
+ GXcopy, &rgnDst, pptSrc, ~0L, 0);
+ SHOW_CURSOR(pVMWARE, *pBB);
+ UPDATE_ACCEL_AREA(pVMWARE, *pBB);
+ DEALLOCATE_LOCAL(pptSrc);
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+}
+
+static void
+accelPaintWindow(VMWAREPtr pVMWARE, WindowPtr pWin, RegionPtr pRegion, int what, BoxPtr pBB)
+{
+ Pixel pixel;
+ RegionRec drawRegion;
+ RegionRec BBRegion;
+ BoxPtr pbox;
+ int nbox;
+
+ if (what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) {
+ pixel = pWin->background.pixel;
+ } else if (what == PW_BORDER && pWin->borderIsPixel) {
+ pixel = pWin->border.pixel;
+ } else {
+ /*
+ * The caller has guaranteed that this case has been excluded,
+ * but the compiler doesn't know that. So this line is just to
+ * eliminate the compiler warning.
+ */
+ pixel = 0;
+ }
+
+ REGION_INIT(pWin->drawable.pScreen, &drawRegion, NullBox, 0);
+ REGION_INIT(pWin->drawable.pScreen, &BBRegion, pBB, 1);
+ REGION_INTERSECT(pWin->drawable.pScreen, &drawRegion, pRegion, &BBRegion);
+ pbox = REGION_RECTS(&drawRegion);
+ nbox = REGION_NUM_RECTS(&drawRegion);
+ while (nbox) {
+ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_FILL);
+ vmwareWriteWordToFIFO(pVMWARE, pixel);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->y1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1);
+ vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1);
+ pbox++;
+ nbox--;
+ }
+ REGION_UNINIT(pWin->drawable.pScreen, &BBRegion);
+ REGION_UNINIT(pWin->drawable.pScreen, &drawRegion);
+}
+
+void
+vmwarePaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
+{
+ VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen));
+
+ TRACEPOINT
+ /* Accelerate solid fills */
+ if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) &&
+ ((what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel)
+ || (what == PW_BORDER && pWin->borderIsPixel))) {
+ BoxPtr pBB;
+ Bool hidden = pVMWARE->mouseHidden;
+
+ pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion);
+ if (!hidden) {
+ HIDE_CURSOR(pVMWARE, *pBB);
+ }
+ accelPaintWindow(pVMWARE, pWin, pRegion, what, pBB);
+ if (!hidden) {
+ SHOW_CURSOR(pVMWARE, *pBB);
+ }
+ UPDATE_ACCEL_AREA(pVMWARE, *pBB);
+ /* vmwareWaitForFB(); */ /* XXX */
+ return;
+ }
+ if (pVMWARE->vmwareBBLevel == 0) {
+ BoxPtr pBB;
+
+ pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion);
+ HIDE_CURSOR(pVMWARE, *pBB);
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->vmwareBBLevel++;
+ pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what);
+ pVMWARE->vmwareBBLevel--;
+ vmwareSendSVGACmdUpdate(pVMWARE, pBB);
+ SHOW_CURSOR(pVMWARE, *pBB);
+ } else {
+ VmwareLog(("vmwarePaintWindow not called at top level\n"));
+ vmwareWaitForFB(pVMWARE);
+ pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what);
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c
new file mode 100644
index 000000000..fb50612ad
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c
@@ -0,0 +1,62 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarezerarc[] =
+
+ "Id: vmwarezerarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $";
+#endif
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+
+#include "vmware.h"
+
+static void
+computeBBarc(DrawablePtr pDrawable,
+ GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB)
+{
+ if (narcs <= 0)
+ return;
+ pBB->x1 = parcs->x;
+ pBB->y1 = parcs->y;
+ pBB->x2 = parcs->x + parcs->width + 1;
+ pBB->y2 = parcs->y + parcs->height + 1;
+ while (--narcs) {
+ parcs++;
+ if (parcs->x < pBB->x1)
+ pBB->x1 = parcs->x;
+ if (parcs->y < pBB->y1)
+ pBB->y1 = parcs->y;
+ if ((parcs->x + parcs->width + 1) > pBB->x2)
+ pBB->x2 = parcs->x + parcs->width + 1;
+ if ((parcs->y + parcs->height + 1) > pBB->y2)
+ pBB->y2 = parcs->y + parcs->height + 1;
+ }
+ pBB->x1 =
+ MAX(pDrawable->x + pBB->x1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x1);
+ pBB->y1 =
+ MAX(pDrawable->y + pBB->y1 - pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y1);
+ pBB->x2 =
+ MIN(pDrawable->x + pBB->x2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->x2);
+ pBB->y2 =
+ MIN(pDrawable->y + pBB->y2 + pGC->lineWidth,
+ (REGION_EXTENTS(pGC->pScreen,
+&((WindowPtr) pDrawable)->winSize))->y2);
+}
+
+void
+vmwarePolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
+{
+ TRACEPOINT
+
+ GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW,
+ pGC->pScreen,
+ computeBBarc(pDrawable, pGC, narcs, parcs, &BB),
+ GC_OPS(pGC)->PolyArc(pDrawable, pGC, narcs, parcs));
+}
diff --git a/xc/programs/Xserver/hw/xfree86/etc/Imakefile b/xc/programs/Xserver/hw/xfree86/etc/Imakefile
index 944a1096d..842334b2d 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/etc/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/24 1996/10/28 04:24:12 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.37 2000/07/30 17:12:21 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.38 2001/03/21 17:36:47 dawes Exp $
#include <Server.tmpl>
#if SystemV
@@ -43,7 +43,7 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.37 2000/07/30 1
# endif
#endif
-#if !BuildServersOnly
+#if !BuildServersOnly && BuildClients
#ifdef SunArchitecture
TERMFILES = xterm.termcap xterm.terminfo
#else
@@ -128,7 +128,7 @@ InstallNamedProg(svr4_patch,svr4_patch,$(LIBDIR)/etc)
InstallNamedProg(svr4_rem_pch,svr4_patch_rem,$(LIBDIR)/etc)
#endif
-#if !BuildServersOnly
+#if !BuildServersOnly && BuildClients
LinkFile(xterm.termcap,$(PROGRAMSRC)/xterm/termcap)
LinkFile(xterm.terminfo,$(PROGRAMSRC)/xterm/terminfo)
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def
index b5c6671f8..371566bc9 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def
@@ -1,7 +1,7 @@
/*
* Host.def for building Linux/alpha bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.5 2000/12/18 14:34:58 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.6 2001/03/17 18:41:32 dawes Exp $
*/
#define InstallEmptyHostDef
@@ -14,3 +14,5 @@
#define BuildXF86DRI YES
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def
index 4059b1755..6cb9eb81c 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def
@@ -1,7 +1,7 @@
/*
* Host.def for building Linux/ix86 bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.6 2000/03/17 15:59:46 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.7 2001/03/17 18:41:32 dawes Exp $
*/
#define InstallEmptyHostDef
@@ -16,3 +16,5 @@
#define BuildXF86DRI YES
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def
index d4553c823..2c8e5a311 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def
@@ -1,8 +1,10 @@
/*
* Host.def for building Linux/m68k bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.4 2000/03/07 14:47:34 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.5 2001/03/17 18:41:33 dawes Exp $
*/
#define InstallEmptyHostDef
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def
index 4e3d78ad3..03b7f5fa2 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def
@@ -1,8 +1,10 @@
/*
* Host.def for building Linux/ppc bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.3 2000/03/07 14:47:36 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $
*/
#define InstallEmptyHostDef
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def
index fdeeb09ae..c89665d4b 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def
@@ -1,8 +1,10 @@
/*
* Host.def for building SVR4.0 bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.3 2000/03/07 14:47:37 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $
*/
#define InstallEmptyHostDef
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def
index 2392ea639..4fba95ca7 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def
@@ -1,8 +1,10 @@
/*
* Host.def for building Solaris bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.3 2000/03/07 14:47:38 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $
*/
#define InstallEmptyHostDef
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def
index 647056fc1..9bf96d029 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def
@@ -1,8 +1,10 @@
/*
* Host.def for building UnixWare bindists
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.3 2000/03/07 14:47:39 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $
*/
#define InstallEmptyHostDef
+#define ForceNormalLib YES
+
diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c
index 34cc1ab50..37f1a1d61 100644
--- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.22 2001/01/21 21:19:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.24 2001/04/06 18:16:31 dawes Exp $ */
/* all driver need this */
#include "xf86.h"
@@ -527,7 +527,7 @@ fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
void
calculateFbmem_len(fbdevHWPtr fPtr)
{
- fPtr->fboff = (unsigned int) fPtr->fix.smem_start & ~PAGE_MASK;
+ fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK;
fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) &
PAGE_MASK;
}
@@ -596,7 +596,7 @@ fbdevHWMapMMIO(ScrnInfoPtr pScrn)
perror("FBIOPUT_VSCREENINFO");
return FALSE;
}
- mmio_off = (unsigned int) fPtr->fix.mmio_start & ~PAGE_MASK;
+ mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK;
fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) &
PAGE_MASK;
if (NULL == fPtr->fbmem)
@@ -812,3 +812,21 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode))
perror("ioctl FBIOBLANK");
}
+
+Bool
+fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ unsigned long unblank;
+
+ if (!pScrn->vtSema)
+ return;
+
+ unblank = xf86IsUnblank(mode);
+
+ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank)))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
index 151b64ae7..d2acfcd4c 100644
--- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.9 2000/11/18 19:37:14 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.10 2001/04/06 18:16:31 dawes Exp $ */
#ifndef _FBDEVHW_H_
#define _FBDEVHW_H_
@@ -47,4 +47,6 @@ Bool fbdevHWEnterVT(int scrnIndex, int flags);
void fbdevHWLeaveVT(int scrnIndex, int flags);
void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
+Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
+
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c
index 8fdeb1b47..cf0be9823 100644
--- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.9 2000/10/20 14:59:01 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.10 2001/04/06 18:16:31 dawes Exp $ */
#include "xf86.h"
#include "xf86cmap.h"
@@ -161,3 +161,8 @@ void
fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
{
}
+
+Bool
+fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
+{
+}
diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
index 5fb55c3e4..9d12f26b6 100644
--- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
+++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
@@ -1,4 +1,4 @@
-/*
+/* Id: citron.c,v 1.8 2001/03/28 08:24:38 pk Exp $
* Copyright (c) 1998 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,13 +25,13 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.5 2000/11/21 23:10:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.6 2001/04/05 17:42:34 dawes Exp $ */
/*
* Based, in part, on code with the following copyright notice:
*
- * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de>
- * Copyright 1999-2000 by Peter Kunzmann, Citron GmbH, Germany. <support@citron.de>
+ * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de>
+ * Copyright 1999-2001 by Peter Kunzmann, Citron GmbH, Germany. <kunzmann@citron.de>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -95,6 +95,21 @@
"cit_ParseCommand" to set the variables not
only on the touch side but also in the priv rec pk
2.04 19.10.00 reconnect enhanced pk
+ 2.05 27.02.01 QueryHardware enhanced, connection faster pk
+ 2.06 15.03.01 cit_SetBlockDuration added, cit_Flush modified pk
+ 2.07 16.03.01 The problem that the touch didn't connect to the
+ X-server was a hardware problem
+ with the winbond chip (interrupt was dead after
+ receiving spurious characters when the touch screen
+ is switched on). The SIO has to be reinitialized to
+ get rid of that problem. pk
+ 2.08 20.03.01 if cit_GetPacket has an overrun
+ cit_ReinitSerial has to be called, Vmin set to "1"
+ cit_SuperVisionTimer, cit_SetEnterCount added
+ debuglevel, entercount(z) from external now poss.
+ enter_touched not reset by coord_exit pk
+ 2.09 25.03.01 enter_touched also reset by press_exit, a new
+ command (SetPWMFreq) for backlight dimming added pk
============================================================================
*/
@@ -104,30 +119,31 @@
#define PK 0
#define INITT 0 /* Initialisation of touch in first loop */
-/* ODD version number enables the debug macros */
-/* EVEN version number is for release */
-#define CITOUCH_VERSION 0x204
-char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH";
+#define CITOUCH_VERSION 0x209
+char version[]="Touch Driver V2.09 (c) 1999-2001 Citron GmbH";
+
+#define CITOUCH_VERSION_MAJOR ((CITOUCH_VERSION >> 8) & 0xf)
+#define CITOUCH_VERSION_MINOR ((CITOUCH_VERSION >> 4) & 0xf)
+#define CITOUCH_VERSION_PATCH ((CITOUCH_VERSION >> 0) & 0xf)
/*****************************************************************************
* Standard Headers
****************************************************************************/
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#define NEED_XF86_TYPES
-/*#include <xf86Version.h>*/
-#include <xf86_ansic.h>
-#include <xf86_OSproc.h>
-#include <xf86Optrec.h>
-#include <xf86Xinput.h>
-#include <xisb.h>
-#include <exevents.h> /* Needed for InitValuator/Proximity stuff*/
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86Optrec.h"
+#include "xf86Xinput.h"
+#include "xisb.h"
+#include "exevents.h" /* Needed for InitValuator/Proximity stuff*/
-/* #define CI_TIM */ /* Enable timer */
+/* #define CIT_TIM */ /* Enable timer */
#define CIT_BEEP /* enable beep feature */
/*****************************************************************************
@@ -162,9 +178,13 @@ char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH";
#endif
static int debug_level = 0;
-#if CITOUCH_VERSION & 0x0001
+
+/*
+ debug is always on, because we can set the debug-level
+ in XF86Config (Option DebugLevel)
+*/
#define DEBUG
-#endif
+
#ifdef DEBUG
#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
#else
@@ -237,10 +257,10 @@ static XF86ModuleVersionInfo VersionRec =
MODULEVENDORSTRING, /* vendor specific string */
MODINFOSTRING1,
MODINFOSTRING2,
- XF86_VERSION_CURRENT, /* Module-specific current version */
- 0, /* Module-specific major version */
- 1, /* Module-specific minor version */
- 1, /* Module-specific patch level */
+ XF86_VERSION_CURRENT, /* Current XFree version */
+ CITOUCH_VERSION_MAJOR, /* Module-specific major version */
+ CITOUCH_VERSION_MINOR, /* Module-specific minor version */
+ CITOUCH_VERSION_PATCH, /* Module-specific patch level */
ABI_CLASS_XINPUT,
ABI_XINPUT_VERSION,
MOD_CLASS_XINPUT,
@@ -297,7 +317,45 @@ static const char *default_options[] =
"StopBits", "1",
"DataBits", "8",
"Parity", "None",
- "Vmin", "3",
+/*
+ In non-canonical input processing mode, input is not assembled into
+ lines and input processing (erase, kill, delete, etc.) does not occur.
+ Two parameters control the behavior of this mode: c_cc[VTIME] sets the
+ character timer, and c_cc[VMIN] sets the minimum number of characters
+ to receive before satisfying the read.
+
+ If MIN > 0 and TIME = 0, MIN sets the number of characters to receive
+ before the read is satisfied. As TIME is zero, the timer is not used.
+
+ If MIN = 0 and TIME > 0, TIME serves as a timeout value. The read will
+ be satisfied if a single character is read, or TIME is exceeded (t =
+ TIME *0.1 s). If TIME is exceeded, no character will be returned.
+
+
+ If MIN > 0 and TIME > 0, TIME serves as an inter-character timer. The
+ read will be satisfied if MIN characters are received, or the time
+ between two characters exceeds TIME. The timer is restarted every time
+ a character is received and only becomes active after the first
+ character has been received.
+
+ If MIN = 0 and TIME = 0, read will be satisfied immediately. The
+ number of characters currently available, or the number of characters
+ requested will be returned. According to Antonino (see contributions),
+ you could issue a fcntl(fd, F_SETFL, FNDELAY); before reading to get
+ the same result.
+
+ By modifying newtio.c_cc[VTIME] and newtio.c_cc[VMIN] all modes
+ described above can be tested.
+ (Copied from serial-programming-howto)
+*/
+
+
+/* Vmin was set to 3 (Three characters have to arrive until Read_Input is called).
+ I set it to 1 because of the winbond SIO (maybe the interrupt disappears after 1 character
+ and X waits for another two.
+*/
+
+ "Vmin", "1", /* blocking read until 1 chars received */
"Vtime", "1",
"FlowControl", "None",
"ClearDTR", ""
@@ -325,7 +383,7 @@ cit_SendtoTouch(DeviceIntPtr dev)
unsigned char buf[MAX_BYTES_TO_TRANSFER*2+2];
DBG(DDS, ErrorF("%scit_SendtoTouch(numbytes=0x%02X, data[0]=%02x, data[1]=%02x, data[2]=%02x, data[3]=%02x, ...)\n", CI_INFO, priv->dds.numbytes,
- priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3],));
+ priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3]));
j=0;
buf[j++] = CTS_STX; /* transmit start of packet */
@@ -377,12 +435,17 @@ cit_ParseCommand(DeviceIntPtr dev)
DBG(DDS, ErrorF("%scit_ParseCommand(PWM Active:%d PWM Sleep:%d \n", CI_INFO, priv->pwm_active, priv->pwm_sleep));
break;
+ case C_SETPWMFREQ:
+ priv->pwm_freq = (int)priv->dds.data[1] | (int)(priv->dds.data[2] << 8);
+ DBG(DDS, ErrorF("%scit_ParseCommand: PWM Freq:%d\n", CI_INFO, priv->pwm_freq));
+ break;
+
case C_SETSLEEPMODE:
if(priv->dds.data[1] == 0)
{
priv->sleep_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8);
}
- DBG(DDS, ErrorF("%scit_ParseCommand(Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act));
+ DBG(DDS, ErrorF("%scit_ParseCommand: Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act));
break;
case C_SETDOZEMODE:
@@ -390,13 +453,18 @@ cit_ParseCommand(DeviceIntPtr dev)
{
priv->doze_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8);
}
- DBG(DDS, ErrorF("%scit_ParseCommand(Doze Time act:%d \n", CI_INFO, priv->doze_time_act));
+ DBG(DDS, ErrorF("%scit_ParseCommand: Doze Time act:%d \n", CI_INFO, priv->doze_time_act));
break;
case C_SETAREAPRESSURE:
priv->button_threshold = priv->dds.data[1];
- DBG(DDS, ErrorF("%scit_ParseCommand(Button Threshold:%d \n", CI_INFO, priv->button_threshold));
+ DBG(DDS, ErrorF("%scit_ParseCommand: Button Threshold:%d \n", CI_INFO, priv->button_threshold));
+ break;
+
+ default:
+ DBG(DDS, ErrorF("%scit_ParseCommand: Command %d not found\n", CI_INFO, priv->dds.data[0]));
break;
+
}
}
@@ -418,6 +486,7 @@ cit_DriverComm(DeviceIntPtr dev)
case D_SETCLICKMODE:
priv->click_mode = priv->dds.data[i++];
ErrorF("%sClick Mode: %d\n", CI_INFO, priv->click_mode);
+ cit_SetEnterCount(priv); /* set enter_count according to click_mode */
break;
case D_BEEP:
@@ -444,9 +513,26 @@ cit_DriverComm(DeviceIntPtr dev)
ErrorF("%sBeep Release Duration: %d\n", CI_INFO, priv->rel_dur);
break;
- default:
- ErrorF("%sNot known command: %d\n", CI_WARNING, priv->dds.data[1]);
+ case D_DEBUG:
+ debug_level = priv->dds.data[i++];
+ ErrorF("%sDebug level set to %d \n", CI_INFO, debug_level);
+ break;
+
+ case D_ENTERCOUNT:
+ priv->enter_count_no_Z = priv->dds.data[i++];
+ cit_SetEnterCount(priv); /* set enter_count according click_mode */
+ ErrorF("%sEnterCount set to %d \n", CI_INFO, priv->enter_count_no_Z);
+ break;
+
+ case D_ZENTERCOUNT:
+ priv->enter_count_Z = priv->dds.data[i++];
+ cit_SetEnterCount(priv); /* set enter_count according click_mode */
+ ErrorF("%sZEnterCount set to %d \n", CI_INFO, priv->enter_count_Z);
+ break;
+ default:
+ ErrorF("%sNot known command: %d - Get a recent driver\n", CI_WARNING, priv->dds.data[1]);
+ break;
}
}
@@ -563,17 +649,17 @@ static void hexdump (void *ioaddr, int len)
}
#endif
-#ifdef CIT_TIM
+
/*****************************************************************************
* [cit_StartTimer]
****************************************************************************/
static void
-cit_StartTimer(cit_PrivatePtr priv)
+cit_StartTimer(cit_PrivatePtr priv, int nr)
{
- priv->timer_ptr = TimerSet(priv->timer_ptr, 0, priv->timer_val1,
- priv->timer_callback, (pointer)priv);
- DBG(5, ErrorF ("%scit_StartTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr));
+ priv->timer_ptr[nr] = TimerSet(priv->timer_ptr[nr], 0, priv->timer_val1[nr],
+ priv->timer_callback[nr], (pointer)priv);
+ DBG(5, ErrorF ("%scit_StartTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr));
}
@@ -581,20 +667,43 @@ cit_StartTimer(cit_PrivatePtr priv)
* [cit_CloseTimer]
****************************************************************************/
static void
-cit_CloseTimer(cit_PrivatePtr priv)
+cit_CloseTimer(cit_PrivatePtr priv, int nr)
{
- DBG(5, ErrorF ("%scit_CloseTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr));
- if(priv->timer_ptr)
+ DBG(5, ErrorF ("%scit_CloseTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr));
+ if(priv->timer_ptr[nr])
{
- TimerFree(priv->timer_ptr);
- priv->timer_ptr = NULL;
+ TimerFree(priv->timer_ptr[nr]);
+ priv->timer_ptr[nr] = NULL;
}
else
- DBG(5, ErrorF ("%scit_CloseTimer: Nothing to close\n", CI_WARNING));
+ DBG(5, ErrorF ("%scit_CloseTimer[%d]: Nothing to close\n", CI_WARNING, nr));
+}
+
+
+
+/*****************************************************************************
+ * [cit_SuperVisionTimer] If called reset Serial device
+ ****************************************************************************/
+static CARD32
+cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+ cit_PrivatePtr priv = (cit_PrivatePtr) arg;
+ int sigstate;
+
+ DBG(5, ErrorF ("%scit_SuperVisionTimer called %d\n", CI_INFO, GetTimeInMillis()));
+
+ sigstate = xf86BlockSIGIO ();
+
+ cit_ReinitSerial(priv);
+
+ xf86UnblockSIGIO (sigstate);
+
+ return (0); /* stop timer */
}
+#ifdef CIT_TIM
/*****************************************************************************
* [cit_DualTouchTimer]
@@ -648,6 +757,8 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags)
goto SetupProc_fail;
}
+ priv->local = local; /* save local device pointer */
+
/* this results in an xf86strdup that must be freed later */
local->name = xf86SetStrOption(local->options, "DeviceName", "CiTouch");
@@ -762,10 +873,16 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags)
ErrorF("%sBeam Timeout: %d\n", CI_CONFIG, priv->beam_timeout);
priv->touch_time = xf86SetIntOption(local->options, "TouchTime", 0) & 0xff;
ErrorF("%sTouch Time: %d\n", CI_CONFIG, priv->touch_time);
- priv->enter_count = xf86SetIntOption(local->options, "EnterCount", 3);
- ErrorF("%sEnter Count: %d\n", CI_CONFIG, priv->enter_count);
priv->max_dual_count = xf86SetIntOption(local->options, "DualCount", MAX_DUAL_TOUCH_COUNT);
ErrorF("%sDual Count: %d\n", CI_CONFIG, priv->max_dual_count);
+ priv->enter_count_no_Z = xf86SetIntOption(priv->local->options, "EnterCount", 3);
+ ErrorF("%sEnterCount: %d\n", CI_CONFIG, priv->enter_count_no_Z);
+ priv->enter_count_Z = xf86SetIntOption(priv->local->options, "ZEnterCount", 2);
+ ErrorF("%sZEnterCount: %d\n", CI_CONFIG, priv->enter_count_Z);
+ priv->pwm_freq = xf86SetIntOption(priv->local->options, "PWMFreq", -1);
+ ErrorF("%sPWMFreq: %d\n", CI_CONFIG, priv->pwm_freq);
+
+ cit_SetEnterCount(priv); /* set enter_count according click_mode */
/* trace the min and max values */
priv->raw_min_x = CIT_DEF_MAX_X;
@@ -775,15 +892,18 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags)
#ifdef CIT_TIM
/* preset timer values */
- priv->timer_ptr = NULL;
- priv->timer_val1 = 0;
- priv->timer_val2 = 0;
- priv->timer_callback = NULL;
+ priv->timer_ptr[FAKE_TIMER] = NULL;
+ priv->timer_val1[FAKE_TIMER] = 0;
+ priv->timer_val2[FAKE_TIMER] = 0;
+ priv->timer_callback[FAKE_TIMER] = NULL;
#endif
+ priv->timer_ptr[SV_TIMER] = NULL;
+ priv->timer_val1[SV_TIMER] = 0;
+ priv->timer_val2[SV_TIMER] = 0;
+ priv->timer_callback[SV_TIMER] = NULL;
priv->fake_exit = FALSE;
priv->enter_touched = 0; /* preset */
- priv->local = local; /* save local device pointer */
DBG(6, ErrorF("%s\t+ options read\n", CI_INFO));
s = xf86FindOptionValue (local->options, "ReportingMode");
@@ -845,6 +965,8 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags)
priv->buffer = NULL;
}
xf86CloseSerial(local->fd);
+ local->fd = 0;
+
#endif
}
@@ -860,7 +982,10 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags)
SetupProc_fail:
#if(INITT)
if ((local) && (local->fd))
+ {
xf86CloseSerial (local->fd);
+ local->fd = 0;
+ }
#endif
if ((local) && (local->name))
xfree (local->name);
@@ -910,6 +1035,7 @@ DeviceControl (DeviceIntPtr dev, int mode)
ErrorF ("%sDeviceControl Mode (%d) not found\n", CI_ERROR, mode);
RetVal = BadValue;
}
+ DBG(2, ErrorF ("%sDeviceControl: RetVal = %d\n", CI_INFO, RetVal));
return(RetVal);
}
@@ -928,7 +1054,7 @@ DeviceOn (DeviceIntPtr dev)
local->fd = xf86OpenSerial(local->options);
if (local->fd == -1)
{
- xf86Msg(X_WARNING, "%s%s: cannot open input device\n", CI_ERROR, local->name);
+ DBG(5, ErrorF("%s%s: cannot open input device\n", CI_ERROR, local->name));
goto DeviceOn_fail;
}
priv->buffer = XisbNew (local->fd, CIT_BUFFER_SIZE);
@@ -937,22 +1063,29 @@ DeviceOn (DeviceIntPtr dev)
xf86FlushInput(local->fd);
+ cit_SendCommand(priv->buffer, C_SOFTRESET, 0); /* Make a Reset in case of a connected touch */
+
if (QueryHardware (local, &errmaj, &errmin) != Success)
{
- ErrorF ("%s\t- Unable to query/initialize Citron hardware.\n", CI_ERROR);
+ ErrorF ("%s\t- DeviceOn: Unable to query/initialize hardware.\n", CI_ERROR);
goto DeviceOn_fail;
}
- AddEnabledDevice (local->fd);
+ AddEnabledDevice(local->fd);
dev->public.on = TRUE;
+ DBG(5, ErrorF ("%sDeviceOn Success\n", CI_INFO));
return (Success);
/*
* If something went wrong, cleanup
*/
DeviceOn_fail:
+
if ((local) && (local->fd))
+ {
xf86CloseSerial (local->fd);
+ local->fd = 0;
+ }
if ((local) && (local->name))
xfree (local->name);
@@ -970,9 +1103,6 @@ DeviceOn (DeviceIntPtr dev)
}
ErrorF ("%sDeviceOn failed\n", CI_ERROR);
return (!Success);
-
-
-
}
/*****************************************************************************
@@ -997,14 +1127,16 @@ DeviceClose (DeviceIntPtr dev)
DBG(5, ErrorF ("%sDeviceClose called\n",CI_INFO));
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_SOFTRESET, 0);
#ifdef CIT_TIM
- cit_CloseTimer(priv); /* Close timer if started */
+ cit_CloseTimer(priv, FAKE_TIMER); /* Close timer if started */
#endif
+ cit_CloseTimer(priv, SV_TIMER); /* Do not know if it is running, close anyway */
+
XisbTrace(priv->buffer, 1); /* trace on */
- XisbBlockDuration (priv->buffer, 500000);
+ cit_SetBlockDuration (priv, 500000);
c = XisbRead (priv->buffer);
if(c == CTS_NAK)
{
@@ -1154,8 +1286,7 @@ ReadInput (LocalDevicePtr local)
*/
if(!priv->fake_exit)
{
- XisbBlockDuration (priv->buffer, -1);
- DBG(RI, ErrorF("%sXisbBlockDuration = -1\n", CI_INFO));
+ cit_SetBlockDuration (priv, -1);
}
while (
#ifdef CIT_TIM
@@ -1243,7 +1374,6 @@ ReadInput (LocalDevicePtr local)
xf86PostButtonEvent (local->dev, TRUE,
priv->button_number, 0, 0, 2, x, y);
cit_Beep(priv, 0);
- priv->enter_touched = 0; /* reset coordinate report counter */
DBG(RI, ErrorF("%s\tPostButtonEvent(UP, x=%d, y=%d)\n", CI_INFO, x, y));
priv->button_down = FALSE;
}
@@ -1396,142 +1526,107 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin)
unsigned char x;
int i, cnt;
int err; /* for WAIT */
- int init = FALSE;
+
/* Reset the IRT from any mode and wait for end of warmstart */
DBG(5, ErrorF("%sQueryHardware called\n", CI_INFO));
-/* Will not work with XFree86 4.0 */
-/* xf86SerialSendBreak (local->fd, 2); */
- cit_Flush(priv->buffer);
-
-/* Test if touch is already initialized */
- cit_SendCommand(priv->buffer, C_GETORIGIN, 0);
-
- /* wait max. 0.5 seconds for acknowledge */
- DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO));
-/* WAIT(50); */
- XisbBlockDuration (priv->buffer, 500000);
- cnt = 0;
- err = FALSE;
-
- while ((i=XisbRead(priv->buffer)) != -1)
- {
- DBG(7, ErrorF("%s\t* 0x%02X received - cnt %d\n",CI_INFO, i, cnt));
- {
- switch (cnt)
- {
-
- case 0:
- if ((unsigned char)i != CTS_STX)
- init = TRUE;
- break;
- case 1:
- if ((unsigned char)i != (CMD_REP_CONV & C_GETORIGIN))
- init = TRUE;
- break;
- case 2:
- if ((unsigned char)i > 3)
- init = TRUE;
- break;
+/* Will not work with XFree86 4.0.1 */
+/* xf86SerialSendBreak (local->fd, 2); */
+ cit_Flush(priv);
- case 3:
- if ((unsigned char)i != CTS_ETX)
- init = TRUE;
- break;
- }
- }
- cnt++;
- if(init)
- break;
- }
- /* Touch is physically not connected or sio problem or break */
- cit_Flush(priv->buffer); /* flush the buffer and wait for break */
- if(cnt < 3)
- {
- WAIT(150);
- /* if we have 0 in the buffer I assume we got a break */
- if (XisbRead(priv->buffer) == 0)
- {
-
- DBG(6, ErrorF("%s+ BREAK detected - cnt=%d\n", CI_INFO, cnt));
- init = TRUE;
- }
- else /* if nothing is in the buffer I assume the touch is not connected */
- {
- ErrorF("%sTouch not connected - please connect - cnt=%d\n", CI_ERROR, cnt);
- return(Success); /* If success is returned we can later connect */
- } /* the touch again when it was reconnected without */
- } /* restarting X */
- /* if init is true, we have to (re)initialize the touch */
- if (init)
- {
- ErrorF("%sTouch not initialized yet\n",CI_INFO);
/*
* IRT signals end of startup by sending BREAKS with 100 ms length.
* wait a maximum of 2 seconds for at least 2 consecutive breaks
* to be sure the IRT is really initialized
*/
- cit_Flush(priv->buffer); /* clear the buffer and wait for break */
- DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO));
- for (i=0, cnt=0; (i<20) && (cnt<2); i++)
+ cit_Flush(priv); /* clear the buffer and wait for break */
+ DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO));
+
+ cit_SetBlockDuration (priv, 1);
+
+ for (i=0, cnt=0; (i<20) && (cnt<3); i++)
+ {
+ cit_Flush(priv); /* clear the buffer and wait for break */
+ WAIT(150); /* wait a little bit longer than 100 ms */
+ DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i));
+ if (XisbRead(priv->buffer) == 0)
{
-/* millisleep (105); */
- WAIT(120); /* wait a little bit longer than 100 ms */
- DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i));
- if (XisbRead(priv->buffer) == 0)
- {
- cnt++;
- DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt));
- }
- else
- {
- cnt = 0;
- }
+ cnt++;
+ DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt));
}
- if (cnt < 2)
+ else
{
- ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR);
-/* *errmaj = LDR_NOHARDWARE; */
- return (!Success);
+ cnt = 0;
+ }
+ if ( i == 12)
+ {
+ cit_SendCommand(priv->buffer, C_SOFTRESET, 0);
+ DBG(6, ErrorF("%s\t+ SOFTRESET sent\n", CI_INFO));
}
- /* Now initialize IRT to CTS Protocol */
- DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO));
- x = 0x0d;
- for (i=0; i<2; i++)
+#if(0)
+ /* maybe we are in Debug Mode and have to sent a soft reset */
+ if(i == 15)
{
+ XisbWrite(priv->buffer, (unsigned char *)"r2", 2);
+ x = 0x0d;
XisbWrite(priv->buffer, &x, 1);
-/* millisleep (50); */
- WAIT(50);
+ DBG(6, ErrorF("%s\t+ DEBUG-MODE SOFTRESET sent\n", CI_INFO));
}
- x = MODE_D;
+#endif
+ }
+ if (cnt < 2)
+ {
+ ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR);
+
+/* Workaround - bugfix
+ Normally when the touch is connected and the driver thinks it didn't sent
+ breaks we have the problem, that spurious characters, which are sent at
+ the startup of the touch screen make the winbond SIO chip not to sent
+ any further interrupts. To overcome this problem we reinitialize the
+ winbond chip with a close and open of the serial line.
+ Thanks a lot winbond team. Without it I wouldn't have
+ written these wonderful lines of source code ;-).
+*/
+ cit_ReinitSerial(priv);
+ return (!Success);
+ }
+ /* Now initialize IRT to CTS Protocol */
+ DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO));
+ x = 0x0d;
+ for (i=0; i<2; i++)
+ {
XisbWrite(priv->buffer, &x, 1);
+ WAIT(50);
+ }
+ x = MODE_D;
+ XisbWrite(priv->buffer, &x, 1);
- /* wait max. 0.5 seconds for acknowledge */
- DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO));
- XisbBlockDuration (priv->buffer, 500000);
- cnt = 0;
- while ((i=XisbRead(priv->buffer)) != -1)
- {
- DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i));
- if ((unsigned char)i == CTS_XON)
- break;
- if(cnt++ > 100) return (Success); /* emergency stop */
- }
- if ((unsigned char)i != CTS_XON)
- {
- ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR);
-/* *errmaj = LDR_NOHARDWARE; */
- return (!Success);
- }
+ /* wait max. 0.5 seconds for acknowledge */
+ DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO));
+ cit_SetBlockDuration (priv, 500000);
+ cnt = 0;
+ while ((i=XisbRead(priv->buffer)) != -1)
+ {
+ DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i));
+ if ((unsigned char)i == CTS_XON)
+ break;
+ if(cnt++ > 50) return (Success); /* emergency stop */
}
+ if ((unsigned char)i != CTS_XON)
+ {
+ ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR);
+ cit_ReinitSerial(priv);
+ return (!Success);
+ }
+
/* now we have the touch connected, do the initialization stuff */
DBG(6, ErrorF("%s\t+ Touch connected!\n",CI_INFO));
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
DBG(6, ErrorF("%s\t+ requesting pressure sensors report\n",CI_INFO));
if (cit_GetPressureSensors(priv)!=Success)
@@ -1540,10 +1635,11 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin)
}
DBG(5, ErrorF("%s ClickMode is %d\n",CI_INFO, priv->click_mode));
- if(priv->click_mode == NO_CLICK_MODE) /* no click mode set in XF86Config */
+ if(priv->click_mode == NO_CLICK_MODE) /* if no click mode set in XF86Config set it automatically */
{
priv->click_mode = (priv->pressure_sensors > 0) ? CM_ZPRESS : CM_ENTER;
DBG(5, ErrorF("%sClickMode set to %d\n",CI_INFO, priv->click_mode));
+ cit_SetEnterCount(priv);
}
cit_SendCommand(priv->buffer, C_SETAREAFLAGS, 1, AOF_ADDEXIT
@@ -1593,6 +1689,7 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin)
cit_SendCommand(priv->buffer, C_SETTRANSMISSION, 1, TM_TRANSMIT);
cit_SendCommand(priv->buffer, C_SETSCANNING, 1, 1);
+ cit_SendPWMFreq(priv); /* Set PWM Frequency */
if(priv->query_state == 0) /* do error reporting only 1 time */
{
@@ -1665,7 +1762,7 @@ cit_GetPacket (cit_PrivatePtr priv)
{
int c;
int errmaj, errmin;
-
+ int loop = 0;
DBG(GP, ErrorF("%scit_GetPacket called\n", CI_INFO));
DBG(GP, ErrorF("%s\t* initial lex_mode =%d (%s)\n", CI_INFO, priv->lex_mode,
priv->lex_mode==cit_idle ?"idle":
@@ -1677,7 +1774,8 @@ cit_GetPacket (cit_PrivatePtr priv)
{
#if(0)
DBG(GP, ErrorF("%s c=%d\n",CI_INFO, c));
-#endif
+#endif
+ loop++;
if (c == CTS_STX)
{
DBG(GP, ErrorF("%s\t+ STX detected\n", CI_INFO));
@@ -1686,6 +1784,11 @@ cit_GetPacket (cit_PrivatePtr priv)
DBG(7, ErrorF("%s\t- no ETX received before this STX!\n", CI_WARNING));
priv->lex_mode = cit_getID;
DBG(GP, ErrorF("%s\t+ new lex_mode == getID\n", CI_INFO));
+ /* Start supervision timer at the beginning of a command */
+ priv->timer_val1[SV_TIMER] = 2000; /* Timer delay [ms] 2s */
+ priv->timer_callback[SV_TIMER] = (OsTimerCallback)cit_SuperVisionTimer; /* timer callback routine */
+ cit_StartTimer(priv, SV_TIMER);
+
}
else if (c == CTS_ETX)
{
@@ -1697,6 +1800,7 @@ cit_GetPacket (cit_PrivatePtr priv)
{
DBG(GP, ErrorF("%s\t+ Good report received\n", CI_INFO));
priv->lex_mode = cit_idle;
+ cit_CloseTimer(priv, SV_TIMER); /* stop supervision */
return (Success);
}
DBG(GP, ErrorF("%s\t- unexpected ETX received!\n", CI_WARNING));
@@ -1741,45 +1845,81 @@ cit_GetPacket (cit_PrivatePtr priv)
}
else
{
- DBG(GP, ErrorF("%s\t- command buffer overrun\n", CI_ERROR));
+ DBG(GP, ErrorF("%s\t- command buffer overrun, loop[%d]\n", CI_ERROR, loop));
/* let's reinitialize the touch - maybe it sends breaks */
- cit_Flush(priv->buffer);
+ /* The touch assembles breaks until the buffer has an overrun */
+ /* 100ms x 256 -> 26 seconds */
+
+ priv->lex_mode = cit_idle;
+ cit_ReinitSerial(priv);
}
}
else
{
/* this happens e.g. when the touch sends breaks, so we try to reconnect */
- DBG(GP, ErrorF("%s\t- unexpected non control received!\n", CI_WARNING));
+ DBG(GP, ErrorF("%s\t- unexpected non control received! [%d, 0x%02x, loop[%d]]\n", CI_WARNING, c, c, loop));
DBG(GP, ErrorF("%s\t- Device not connected - trying to reconnect ...\n", CI_WARNING));
if (QueryHardware (priv->local, &errmaj, &errmin) != Success)
ErrorF ("%s\t- Unable to query/initialize Citron Touch hardware.\n", CI_ERROR);
else
ErrorF ("%s\t- Citron Touch reconnected\n", CI_INFO);
+ return(!Success);
}
}
else if (c != CTS_XON && c != CTS_XOFF)
{
- DBG(GP, ErrorF("%s\t- unhandled control character received!\n", CI_WARNING));
+ DBG(GP, ErrorF("%s\t- unhandled control character received! loop[%d]\n", CI_WARNING, loop));
}
- }
- DBG(GP, ErrorF("%scit_GetPacket exit !Success\n", CI_INFO));
+ } /* end while */
+ DBG(GP, ErrorF("%scit_GetPacket exit !Success - loop[%d]\n", CI_INFO, loop));
+
return (!Success);
}
/*****************************************************************************
+ * [cit_ReinitSerial] Reinitialize serial port
+ ****************************************************************************/
+static void
+cit_ReinitSerial(cit_PrivatePtr priv)
+{
+ if(priv->local->fd)
+ {
+ xf86CloseSerial(priv->local->fd);
+ priv->local->fd = 0;
+ priv->local->fd = xf86OpenSerial (priv->local->options);
+ DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection reinitialized\n", CI_INFO));
+ }
+ else
+ DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection not opened\n", CI_ERROR));
+}
+
+/*****************************************************************************
* [cit_Flush]
****************************************************************************/
static void
-cit_Flush (XISBuffer *b)
+cit_Flush (cit_PrivatePtr priv)
{
+ int old_block_duration;
+
DBG(7, ErrorF("%scit_Flush called\n", CI_INFO));
- XisbBlockDuration(b, 0);
- while (XisbRead(b) > 0);
+ old_block_duration = priv->buffer->block_duration;
+ XisbBlockDuration(priv->buffer, 1000); /* wait for at least 10ms for the next character */
+ while (XisbRead(priv->buffer) >= 0);
+ cit_SetBlockDuration(priv, old_block_duration); /* Restore the last set block duration (cit_SetBlockDuration) */
}
+/*****************************************************************************
+ * [cit_SetBlockDuration]
+ ****************************************************************************/
+static void
+cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration)
+{
+ DBG(7, ErrorF("%scit_SetBlockDuration called [%d]\n", CI_INFO, block_duration));
+ XisbBlockDuration(priv->buffer, block_duration);
+}
/*****************************************************************************
@@ -1852,7 +1992,7 @@ static Bool cit_GetInitialErrors(cit_PrivatePtr priv)
int i;
Bool res;
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_INITIAL);
/*
touch responds within 1 millisecond,
@@ -1860,7 +2000,7 @@ static Bool cit_GetInitialErrors(cit_PrivatePtr priv)
*/
for (i=0; i<5; i++)
{
- XisbBlockDuration(priv->buffer, 500000);
+ cit_SetBlockDuration(priv, 500000);
res = cit_GetPacket(priv);
if ((res == Success) || (priv->lex_mode == cit_idle));
break;
@@ -1979,7 +2119,7 @@ static Bool cit_GetDefectiveBeams(cit_PrivatePtr priv)
int i;
Bool res;
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_DEFECTBEAMS);
/*
touch responds within 1 millisecond,
@@ -1987,7 +2127,7 @@ static Bool cit_GetDefectiveBeams(cit_PrivatePtr priv)
*/
for (i=0; i<5; i++)
{
- XisbBlockDuration(priv->buffer, 500000);
+ cit_SetBlockDuration(priv, 500000);
res = cit_GetPacket(priv);
if ((res == Success) || (priv->lex_mode == cit_idle));
break;
@@ -2060,7 +2200,7 @@ static Bool cit_GetDesignator(cit_PrivatePtr priv)
int i,n;
Bool res;
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, GR_DESIGNATOR);
/*
touch responds within 1 millisecond,
@@ -2068,7 +2208,7 @@ static Bool cit_GetDesignator(cit_PrivatePtr priv)
*/
for (i=0; i<5; i++)
{
- XisbBlockDuration(priv->buffer, 500000);
+ cit_SetBlockDuration(priv, 500000);
res = cit_GetPacket(priv);
if ((res == Success) || (priv->lex_mode == cit_idle));
break;
@@ -2126,13 +2266,13 @@ static Bool cit_GetRevision(cit_PrivatePtr priv, int selection)
int i,n;
Bool res;
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, (unsigned char)selection);
/*
touch responds within 1 millisecond,
but it takes some time, until the command is sent and received!
*/
- XisbBlockDuration(priv->buffer, 500000);
+ cit_SetBlockDuration(priv, 500000);
while (((res = cit_GetPacket(priv)) != Success) && (priv->lex_mode != cit_idle));
if (res != Success)
{
@@ -2192,9 +2332,9 @@ static void cit_ProcessPacket(cit_PrivatePtr priv)
priv->dual_flg = TRUE; /* Dual Touch Error occurred */
#ifdef CIT_TIM
- priv->timer_val1 = 1000; /* Timer delay [ms]*/
- priv->timer_callback = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */
- cit_StartTimer(priv);
+ priv->timer_val1[FAKE_TIMER] = 1000; /* Timer delay [ms]*/
+ priv->timer_callback[FAKE_TIMER] = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */
+ cit_StartTimer(priv, FAKE_TIMER);
#endif
switch (priv->packet[0])
@@ -2234,12 +2374,13 @@ static void cit_ProcessPacket(cit_PrivatePtr priv)
priv->state &= ~(CIT_TOUCHED | CIT_PRESSED);
priv->dual_touch_count = 0;
+ priv->enter_touched = 0; /* reset coordinate report counter */
priv->raw_x = 0x0001U * priv->packet[1]
+ 0x0100U * priv->packet[2];
priv->raw_y = 0x0001U * priv->packet[3]
+ 0x0100U * priv->packet[4];
#ifdef CIT_TIM
- cit_CloseTimer(priv); /* close timer if exit message was received */
+ cit_CloseTimer(priv, FAKE_TIMER); /* close timer if exit message was received */
#endif
DBG(PP, ErrorF("%s\t+ EXIT message (%d,%d)\n", CI_INFO, priv->raw_x, priv->raw_y));
break;
@@ -2261,6 +2402,7 @@ static void cit_ProcessPacket(cit_PrivatePtr priv)
priv->state |= CIT_PRESSED;
else if(priv->packet[1] == PRESS_BELOW)
{
+ priv->enter_touched = 0; /* reset coordinate report counter */
priv->state &= ~CIT_PRESSED;
}
else
@@ -2368,7 +2510,7 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv)
int i;
Bool res;
- cit_Flush(priv->buffer);
+ cit_Flush(priv);
cit_SendCommand(priv->buffer, C_GETHARDWARE, 1, GH_SENSORCOUNT);
/*
touch responds within 1 millisecond,
@@ -2376,7 +2518,7 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv)
*/
for (i=0; i<5; i++)
{
- XisbBlockDuration(priv->buffer, 500000);
+ cit_SetBlockDuration(priv, 500000);
res = cit_GetPacket(priv);
if ((res == Success) || (priv->lex_mode == cit_idle));
break;
@@ -2413,3 +2555,45 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv)
}
+/*****************************************************************************
+ * [cit_ZPress] tell if click mode is ZPress (True if ZPress)
+ ****************************************************************************/
+static int cit_ZPress(cit_PrivatePtr priv)
+{
+ if((priv->click_mode == CM_ZPRESS) || (priv->click_mode == CM_ZPRESSEXIT))
+ return (TRUE);
+ else
+ return (FALSE);
+}
+
+
+/*****************************************************************************
+ * [cit_SetEnterCount] set enter_count according click_mode
+ ****************************************************************************/
+static void cit_SetEnterCount(cit_PrivatePtr priv)
+{
+ if(cit_ZPress(priv)) /* Test if 3D Mode is active and set Options according */
+ priv->enter_count = priv->enter_count_Z;
+ else priv->enter_count = priv->enter_count_no_Z;
+ ErrorF("%scit_SetEnterCount: Count=%d\n", CI_CONFIG, priv->enter_count);
+}
+
+
+/*****************************************************************************
+ * [cit_SendPWMFreq] send pwm frequency of PWM signal to the touch
+ ****************************************************************************/
+static void cit_SendPWMFreq(cit_PrivatePtr priv)
+{
+ if(priv->pwm_freq >= 0) /* -1 is switched off (no SetPWMFreq set in XF86Config */
+ {
+ cit_SendCommand(priv->buffer, C_SETPWMFREQ, 2,
+ LOBYTE(priv->pwm_freq),
+ HIBYTE(priv->pwm_freq));
+ DBG(3,ErrorF("%scit_SendPWMFreq: Freq=%d\n", CI_CONFIG, priv->pwm_freq));
+ }
+ else
+ DBG(3,ErrorF("%scit_SendPWMFreq: Frequency not set\n", CI_CONFIG));
+}
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.h b/xc/programs/Xserver/hw/xfree86/input/citron/citron.h
index b43d45ce6..f89d08102 100644
--- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.h
+++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.h
@@ -1,4 +1,4 @@
-/*
+/* Id: citron.h,v 1.3 2001/03/28 08:24:38 pk Exp $
* Copyright (c) 1998 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,12 +25,12 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.1 2000/11/02 02:51:21 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.2 2001/04/05 17:42:34 dawes Exp $ */
/*
* Based, in part, on code with the following copyright notice:
*
- * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de>
+ * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -247,7 +247,9 @@
#define D_SETCLICKMODE 0x00
#define D_BEEP 0x01
#define D_SETBEEP 0x02
-
+#define D_DEBUG 0x03
+#define D_ENTERCOUNT 0x04
+#define D_ZENTERCOUNT 0x05
/* Message identifiers */
#define R_DUALTOUCHERROR 0x18 /* Invalid multiple touches are detected */
@@ -337,6 +339,8 @@
#define C_SETSLEEPMODE 0xf7
#define C_GETDOZEMODE 0xf8
#define C_SETDOZEMODE 0xf9
+#define C_SETPWMFREQ 0xfa
+#define C_GETPWMFREQ 0xfb
/* touch states */
#define CIT_TOUCHED 0x01
@@ -434,6 +438,7 @@ typedef struct _cit_privateRec
int sleep_time_scan; /* time interval between two scans */
int pwm_sleep; /* PWM duty cycle during touch saver mode */
int pwm_active; /* PWM duty cycle during regular operation */
+ int pwm_freq; /* PWM base frequency */
int state;
/* additional parameters */
int last_x; /* last cooked data */
@@ -456,6 +461,8 @@ typedef struct _cit_privateRec
int touch_time; /* minimum time span for a valid interruption */
int enter_touched; /* button is down due to an enter event */
int enter_count; /* number of jumed coord reports before a ButtonPress event is sent */
+ int enter_count_no_Z; /* number of jumped over coords before ButtonPress event in not pressure sensitive mode */
+ int enter_count_Z; /* number of jumped over coords before ButtonPress event in pressure sensitive mode */
int max_dual_count; /* number of jumed dualtouch error reports before a ButtonPress event is sent */
int dual_flg; /* Flag set if dualtouch error report is received , reset by counter */
int raw_min_x; /* min x,y max x,y value accumulated over the whole session */
@@ -464,12 +471,17 @@ typedef struct _cit_privateRec
int raw_min_y;
int raw_max_y;
int pressure_sensors; /* number of pressure sensors */
- OsTimerPtr timer_ptr; /* Timer for general purposes */
- CARD32 timer_val1; /* Timer 1st delay */
- CARD32 timer_val2; /* Timer second delay */
- OsTimerCallback timer_callback; /* timer callback routine */
+
+#define MAX_TIMER 2 /* Max. concurrent timers */
+#define FAKE_TIMER 0 /* Timer for faked exit message */
+#define SV_TIMER 1 /* Supervision timer for command timeout suopervision */
+ OsTimerPtr timer_ptr[MAX_TIMER]; /* Timer for general purposes */
+ CARD32 timer_val1[MAX_TIMER]; /* Timer 1st delay */
+ CARD32 timer_val2[MAX_TIMER]; /* Timer second delay */
+ OsTimerCallback timer_callback[MAX_TIMER]; /* timer callback routine */
int fake_exit; /* tell the ReadInput function there is a exit message (from timer) */
/* end additional parameters */
+
LocalDevicePtr local; /* Pointer to local device */
Bool button_down; /* is the "button" currently down */
Bool proximity;
@@ -499,7 +511,7 @@ static int SwitchMode (ClientPtr, DeviceIntPtr, int);
static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *);
static Bool QueryHardware (LocalDevicePtr, int *, int *);
static Bool cit_GetPacket (cit_PrivatePtr);
-static void cit_Flush(XISBuffer *);
+static void cit_Flush(cit_PrivatePtr);
static void cit_SendCommand(XISBuffer *, unsigned char, int, ...);
static Bool cit_GetInitialErrors(cit_PrivatePtr);
static Bool cit_GetDefectiveBeams(cit_PrivatePtr);
@@ -508,9 +520,16 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr);
static Bool cit_GetRevision(cit_PrivatePtr, int);
static void cit_ProcessPacket(cit_PrivatePtr);
static void cit_Beep(cit_PrivatePtr priv, int press);
+static void cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration);
+static void cit_ReinitSerial(cit_PrivatePtr priv);
+static int cit_ZPress(cit_PrivatePtr priv);
+static void cit_SetEnterCount(cit_PrivatePtr priv);
+static void cit_SendPWMFreq(cit_PrivatePtr priv);
+
#ifdef CIT_TIM
-static void cit_StartTimer(cit_PrivatePtr priv);
-static void cit_CloseTimer(cit_PrivatePtr priv);
+static void cit_StartTimer(cit_PrivatePtr priv, int nr);
+static void cit_CloseTimer(cit_PrivatePtr priv, int nr);
+static CARD32 cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg);
static CARD32 cit_DualTouchTimer(OsTimerPtr timer, CARD32 now, pointer arg);
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.man b/xc/programs/Xserver/hw/xfree86/input/citron/citron.man
index c35e1778b..6498a734d 100644
--- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.man
+++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.man
@@ -1,6 +1,6 @@
-.\" Copyright (c) 2000 Peter Kunzmann <support@@citron.de>
+.\" Copyright (c) 2000-2001 Peter Kunzmann <support@@citron.de>
.\"
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.man,v 1.2 2001/01/27 18:20:57 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.man,v 1.3 2001/04/05 17:42:34 dawes Exp $
.\"
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
@@ -281,6 +281,20 @@ Higher values result in longer pulse widths.
.RE
.TP 7
+.BI "Option \*qPWMFreq\*q \*q" value \*q
+This value determines the
+.I PWM
+frequency in Hertz.
+.RS 7
+.PP
+.I Range:
+"39" - "9803"
+.PP
+.I Default:
+"9803" (max. frequency)
+
+.RE
+.TP 7
.BI "Option \*qClickMode\*q \*q" mode \*q
With mode one can select between 5
.I ClickModes
@@ -610,6 +624,20 @@ every 20ms.
.RE
.TP 7
+.BI "Option \*qZEnterCount\*q \*q" count \*q
+Number of skipped "enter reports" while in pressure
+sensitive mode. Reports are sent approx. every 20ms.
+.RS 7
+.PP
+.I Range:
+"0" - "31"
+.PP
+.I Default:
+"1" (1 skipped messages = 20ms)
+
+
+.RE
+.TP 7
.BI "Option \*qDualCount\*q \*q" count \*q
Number of skipped "dual touch error". Reports are sent approx.
every 20ms. This option is only available for "ZPress" and
@@ -626,4 +654,4 @@ every 20ms. This option is only available for "ZPress" and
.SH "SEE ALSO"
XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__).
.SH AUTHORS
-2000 - written by Citron GmbH (support@citron.de)
+2000-2001 \- written by Citron GmbH (support@citron.de)
diff --git a/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c
index 7f1476a6d..d223c14f8 100644
--- a/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c
+++ b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c
@@ -30,9 +30,9 @@
* Probably buggy as hell, no idea what the initialisation strings are,
* no idea how to ack it. If the tablet stops responding power cycle it.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.1 2000/08/11 19:10:41 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.3 2001/04/01 14:00:12 tsi Exp $ */
-#include <xf86Version.h>
+#include "xf86Version.h"
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
#define XFREE86_V4 1
@@ -46,25 +46,23 @@
#include <errno.h>
#endif
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#define NEED_XF86_TYPES
#if !defined(DGUX)
-#include <xf86_ansic.h>
-#include <xisb.h>
+#include "xf86_ansic.h"
+#include "xisb.h"
#endif
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
-#include <keysym.h>
-#include <mipointer.h>
+#include "xf86_OSproc.h"
+#include "xf86Xinput.h"
+#include "exevents.h" /* Needed for InitValuator/Proximity stuff */
+#include "keysym.h"
+#include "mipointer.h"
#ifdef XFree86LOADER
-#include <xf86Module.h>
+#include "xf86Module.h"
#endif
-#undef memset
-#define memset xf86memset
#undef sleep
#define sleep(t) xf86WaitForInput(-1, 1000 * (t))
#define wait_for_fd(fd) xf86WaitForInput((fd), 1000)
@@ -135,7 +133,6 @@ static InputDriverPtr dedgeDrv;
#include "xf86_Config.h"
#include "xf86Xinput.h"
#include "atKeynames.h"
-#include "xf86Version.h"
#endif
#if !defined(sun) || defined(i386)
@@ -1191,9 +1188,9 @@ static LocalDevicePtr xf86SumAllocate()
local->history_size = 0;
#if defined(sun) && !defined(i386)
- if (def_name) {
+ if (dev_name) {
priv->dedgeDevice = (char *) xalloc(strlen(dev_name) + 1);
- strcpy(priv->dedgeDevice, device_name);
+ strcpy(priv->dedgeDevice, dev_name);
ErrorF("xf86SumOpen port changed to '%s'\n", priv->dedgeDevice);
} else {
priv->dedgeDevice = "";
diff --git a/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c b/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c
index 4c47793c2..80bd23121 100644
--- a/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c
+++ b/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.11 2000/08/11 19:10:45 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */
/*
*******************************************************************************
@@ -46,7 +46,7 @@
*******************************************************************************
*/
-#include <xf86Version.h>
+#include "xf86Version.h"
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
#define XFREE86_V4
#endif
@@ -58,17 +58,17 @@
#include <errno.h>
#endif
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#if !defined(DGUX)
-#include <xf86_ansic.h>
+#include "xf86_ansic.h"
#endif
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <exevents.h>
+#include "xf86_OSproc.h"
+#include "xf86Xinput.h"
+#include "exevents.h"
#ifdef XFree86LOADER
-#include <xf86Module.h>
+#include "xf86Module.h"
#endif
#else /* XFREE86_V4 */
@@ -100,7 +100,6 @@
#include "xf86_OSlib.h"
#include "xf86_Config.h"
#include "xf86Xinput.h"
-#include "xf86Version.h"
#endif /* defined(sun) && !defined(i386) */
#if !defined(sun) || defined(i386)
@@ -1196,7 +1195,7 @@ xf86EloControl(DeviceIntPtr dev,
case DEVICE_INIT:
{
-#if defined(sun) && !defined(i386)
+#if defined(sun) && !defined(i386) && !defined(XFREE86_V4)
char *name = (char *) getenv("ELO_DEV");
char *calib = (char *) getenv("ELO_CALIB");
char *speed = (char *) getenv("ELO_SPEED");
@@ -1205,7 +1204,7 @@ xf86EloControl(DeviceIntPtr dev,
DBG(2, ErrorF("Elographics touchscreen init...\n"));
-#if defined(sun) && !defined(i386)
+#if defined(sun) && !defined(i386) && !defined(XFREE86_V4)
if (name) {
priv->input_dev = strdup(name);
ErrorF("Elographics touchscreen port changed to '%s'\n",
diff --git a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c
index 0fdf42ee0..224a0e350 100644
--- a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c
+++ b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.38 2000/12/18 15:52:22 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.41 2001/03/07 16:21:05 paulo Exp $ */
/*
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
@@ -898,7 +898,7 @@ SetupMouse(InputInfoPtr pInfo)
case PROT_IMPS2: /* IntelliMouse */
{
- static unsigned char s[] = { 243, 200, 243, 100, 243, 80, };
+ static unsigned char s[] = { 243, 200, 243, 100, 243, 80, 242 };
param = s;
paramlen = sizeof(s);
@@ -907,7 +907,7 @@ SetupMouse(InputInfoPtr pInfo)
case PROT_EXPPS2: /* IntelliMouse Explorer */
{
- static unsigned char s[] = { 243, 200, 243, 200, 243, 80, };
+ static unsigned char s[] = { 243, 200, 243, 200, 243, 80, 242 };
param = s;
paramlen = sizeof(s);
@@ -1406,7 +1406,7 @@ MouseReadInput(InputInfoPtr pInfo)
(pBuf[0] & 0x01) << 2 | /* Left */
((pBuf[0] & 0x08) ? 0x08 : 0);/* fourth button */
pBuf[1] |= (pBuf[0] & 0x40) ? 0x80 : 0x00;
- dx = (pBuf[0] & 0x10) ? pBuf[1] : pBuf[1];
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
break;
@@ -1594,101 +1594,140 @@ MouseConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2,
return TRUE;
}
-static CARD32
-buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- int sigstate;
-
- pInfo = arg;
- pMse = pInfo->private;
-
- sigstate = xf86BlockSIGIO ();
- pMse->PostEvent(pInfo, pMse->truebuttons, 0, 0, 0, 0);
- xf86UnblockSIGIO (sigstate);
- return 0;
-}
-
/*
- * Lets create a simple finite-state machine:
+ * Lets create a simple finite-state machine for 3 button emulation:
+ *
+ * We track buttons 1 and 3 (left and right). There are 11 states:
+ * 0 ground - initial state
+ * 1 delayed left - left pressed, waiting for right
+ * 2 delayed right - right pressed, waiting for left
+ * 3 pressed middle - right and left pressed, emulated middle sent
+ * 4 pressed left - left pressed and sent
+ * 5 pressed right - right pressed and sent
+ * 6 released left - left released after emulated middle
+ * 7 released right - right released after emulated middle
+ * 8 repressed left - left pressed after released left
+ * 9 repressed right - right pressed after released right
+ * 10 pressed both - both pressed, not emulating middle
+ *
+ * At each state, we need handlers for the following events
+ * 0: no buttons down
+ * 1: left button down
+ * 2: right button down
+ * 3: both buttons down
+ * 4: emulate3Timeout passed without a button change
+ * Note that button events are not deltas, they are the set of buttons being
+ * pressed now. It's possible (ie, mouse hardware does it) to go from (eg)
+ * left down to right down without anything in between, so all cases must be
+ * handled.
*
- * state[?][0]: action1
- * state[?][1]: action2
- * state[?][2]: next state
+ * a handler consists of three values:
+ * 0: action1
+ * 1: action2
+ * 2: new emulation state
*
- * action > 0: ButtonPress
- * action = 0: nothing
- * action < 0: ButtonRelease
+ * action > 0: ButtonPress
+ * action = 0: nothing
+ * action < 0: ButtonRelease
*
- * Why this stuff ??? Normally you cannot press both mousebuttons together, so
- * the mouse reports both pressed at the same time ...
+ * The comment preceeding each section is the current emulation state.
+ * The comments to the right are of the form
+ * <button state> (<events>) -> <new emulation state>
+ * which should be read as
+ * If the buttons are in <button state>, generate <events> then go to
+ * <new emulation state>.
*/
-
-static signed char stateTab[48][3] = {
-
-/* nothing pressed */
- { 0, 0, 0 },
- { 0, 0, 8 }, /* 1 right -> delayed right */
- { 0, 0, 0 }, /* 2 nothing */
- { 0, 0, 8 }, /* 3 right -> delayed right */
- { 0, 0, 16 }, /* 4 left -> delayed left */
- { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */
- { 0, 0, 16 }, /* 6 left -> delayed left */
- { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */
-
-/* delayed right */
- { 1, -1, 0 }, /* 8 nothing (right event) -> init */
- { 1, 0, 32 }, /* 9 right (right press) -> right pressed */
- { 1, -1, 0 }, /* 10 nothing (right event) -> init */
- { 1, 0, 32 }, /* 11 right (right press) -> right pressed */
- { 1, -1, 16 }, /* 12 left (right event) -> delayed left */
- { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */
- { 1, -1, 16 }, /* 14 left (right event) -> delayed left */
- { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */
-
-/* delayed left */
- { 3, -3, 0 }, /* 16 nothing (left event) -> init */
- { 3, -3, 8 }, /* 17 right (left event) -> delayed right */
- { 3, -3, 0 }, /* 18 nothing (left event) -> init */
- { 3, -3, 8 }, /* 19 right (left event) -> delayed right */
- { 3, 0, 40 }, /* 20 left (left press) -> pressed left */
- { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */
- { 3, 0, 40 }, /* 22 left (left press) -> pressed left */
- { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */
-
-/* pressed middle */
- { -2, 0, 0 }, /* 24 nothing (middle release) -> init */
- { -2, 0, 0 }, /* 25 right (middle release) -> init */
- { -2, 0, 0 }, /* 26 nothing (middle release) -> init */
- { -2, 0, 0 }, /* 27 right (middle release) -> init */
- { -2, 0, 0 }, /* 28 left (middle release) -> init */
- { 0, 0, 24 }, /* 29 left & right -> pressed middle */
- { -2, 0, 0 }, /* 30 left (middle release) -> init */
- { 0, 0, 24 }, /* 31 left & right -> pressed middle */
-
-/* pressed right */
- { -1, 0, 0 }, /* 32 nothing (right release) -> init */
- { 0, 0, 32 }, /* 33 right -> pressed right */
- { -1, 0, 0 }, /* 34 nothing (right release) -> init */
- { 0, 0, 32 }, /* 35 right -> pressed right */
- { -1, 0, 16 }, /* 36 left (right release) -> delayed left */
- { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */
- { -1, 0, 16 }, /* 38 left (right release) -> delayed left */
- { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */
-
-/* pressed left */
- { -3, 0, 0 }, /* 40 nothing (left release) -> init */
- { -3, 0, 8 }, /* 41 right (left release) -> delayed right */
- { -3, 0, 0 }, /* 42 nothing (left release) -> init */
- { -3, 0, 8 }, /* 43 right (left release) -> delayed right */
- { 0, 0, 40 }, /* 44 left -> left pressed */
- { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */
- { 0, 0, 40 }, /* 46 left -> left pressed */
- { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */
+static signed char stateTab[11][5][3] = {
+/* 0 ground */
+ {
+ { 0, 0, 0 }, /* nothing -> ground (no change) */
+ { 0, 0, 1 }, /* left -> delayed left */
+ { 0, 0, 2 }, /* right -> delayed right */
+ { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
+ { 0, 0, -1 } /* timeout N/A */
+ },
+/* 1 delayed left */
+ {
+ { 1, -1, 0 }, /* nothing (left event) -> ground */
+ { 0, 0, 1 }, /* left -> delayed left (no change) */
+ { 1, -1, 2 }, /* right (left event) -> delayed right */
+ { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
+ { 1, 0, 4 }, /* timeout (left press) -> pressed left */
+ },
+/* 2 delayed right */
+ {
+ { 3, -3, 0 }, /* nothing (right event) -> ground */
+ { 3, -3, 1 }, /* left (right event) -> delayed left (no change) */
+ { 0, 0, 2 }, /* right -> delayed right (no change) */
+ { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
+ { 3, 0, 5 }, /* timeout (right press) -> pressed right */
+ },
+/* 3 pressed middle */
+ {
+ { -2, 0, 0 }, /* nothing (middle release) -> ground */
+ { 0, 0, 7 }, /* left -> released right */
+ { 0, 0, 6 }, /* right -> released left */
+ { 0, 0, 3 }, /* left & right -> pressed middle (no change) */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 4 pressed left */
+ {
+ { -1, 0, 0 }, /* nothing (left release) -> ground */
+ { 0, 0, 4 }, /* left -> pressed left (no change) */
+ { -1, 0, 2 }, /* right (left release) -> delayed right */
+ { 3, 0, 10 }, /* left & right (right press) -> pressed both */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 5 pressed right */
+ {
+ { -3, 0, 0 }, /* nothing (right release) -> ground */
+ { -3, 0, 1 }, /* left (right release) -> delayed left */
+ { 0, 0, 5 }, /* right -> pressed right (no change) */
+ { 1, 0, 10 }, /* left & right (left press) -> pressed both */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 6 released left */
+ {
+ { -2, 0, 0 }, /* nothing (middle release) -> ground */
+ { -2, 0, 1 }, /* left (middle release) -> delayed left */
+ { 0, 0, 6 }, /* right -> released left (no change) */
+ { 1, 0, 8 }, /* left & right (left press) -> repressed left */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 7 released right */
+ {
+ { -2, 0, 0 }, /* nothing (middle release) -> ground */
+ { 0, 0, 7 }, /* left -> released right (no change) */
+ { -2, 0, 2 }, /* right (middle release) -> delayed right */
+ { 3, 0, 9 }, /* left & right (right press) -> repressed right */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 8 repressed left */
+ {
+ { -2, -1, 0 }, /* nothing (middle release, left release) -> ground */
+ { -2, 0, 4 }, /* left (middle release) -> pressed left */
+ { -1, 0, 6 }, /* right (left release) -> released left */
+ { 0, 0, 8 }, /* left & right -> repressed left (no change) */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 9 repressed right */
+ {
+ { -2, -3, 0 }, /* nothing (middle release, right release) -> ground */
+ { -3, 0, 7 }, /* left (right release) -> released right */
+ { -2, 0, 5 }, /* right (middle release) -> pressed right */
+ { 0, 0, 9 }, /* left & right -> repressed right (no change) */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
+/* 10 pressed both */
+ {
+ { -1, -3, 0 }, /* nothing (left release, right release) -> ground */
+ { -3, 0, 4 }, /* left (right release) -> pressed left */
+ { -1, 0, 5 }, /* right (left release) -> pressed right */
+ { 0, 0, 10 }, /* left & right -> pressed both (no change) */
+ { 0, 0, -1 }, /* timeout N/A */
+ },
};
-
/*
* Table to allow quick reversal of natural button mapping to correct mapping
*/
@@ -1715,12 +1754,36 @@ static char hitachMap[16] = { 0, 2, 1, 3,
#define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f])
+static CARD32
+buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ int sigstate;
+ int id;
+
+ pInfo = arg;
+ pMse = pInfo->private;
+
+ sigstate = xf86BlockSIGIO ();
+
+ if ((id = stateTab[pMse->emulateState][4][0]) != 0) {ErrorF("0\n");
+ xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
+ pMse->emulateState = stateTab[pMse->emulateState][4][2];
+ } else {
+ ErrorF("Got unexpected buttonTimer in state %d\n", pMse->emulateState);
+ }
+
+ xf86UnblockSIGIO (sigstate);
+ return 0;
+}
+
static void
MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
{
static OsTimerPtr timer = NULL;
MouseDevPtr pMse;
- int truebuttons;
+ int truebuttons, emulateButtons;
int id, change;
pMse = pInfo->private;
@@ -1734,69 +1797,51 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
if (dx || dy)
xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
- if (pMse->emulate3Buttons) {
- /*
- * Hack to operate the middle button even with Emulate3Buttons set.
- * Modifying the state table to keep track of the middle button state
- * would nearly double its size, so I'll stick with this fix. - TJW
- */
+ if (truebuttons != pMse->lastButtons) {
+
if (pMse->protocolID == PROT_MMHIT)
change = buttons ^ reverseBits(hitachMap, pMse->lastButtons);
else
change = buttons ^ reverseBits(reverseMap, pMse->lastButtons);
- /*
- * process button 2, 4 and above
- */
- change &= ~0x05;
- while (change) {
- id = ffs(change);
- change &= ~(1 << (id - 1));
- xf86PostButtonEvent(pInfo->dev, 0, id,
- (buttons & (1 << (id - 1))), 0, 0);
- }
+ if (pMse->emulate3Buttons) {
- /*
- * emulate the third button by the other two
- */
- buttons &= 0x07;
- if ((id = stateTab[buttons + pMse->emulateState][0]) != 0)
- xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
-
- if ((id = stateTab[buttons + pMse->emulateState][1]) != 0)
- xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
-
- pMse->emulateState = stateTab[buttons + pMse->emulateState][2];
- if (stateTab[buttons + pMse->emulateState][0] ||
- stateTab[buttons + pMse->emulateState][1]) {
- pMse->truebuttons = truebuttons;
- timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer,
+ /* handle all but buttons 1 & 3 normally */
+
+ change &= ~05;
+
+ /* emulate the third button by the other two */
+
+ emulateButtons = (buttons & 01) | ((buttons &04) >> 1);
+
+ if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0)
+ xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
+ if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0)
+ xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
+
+ pMse->emulateState =
+ stateTab[pMse->emulateState][emulateButtons][2];
+
+ if (stateTab[pMse->emulateState][4][0] != 0) {
+ timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer,
pInfo);
- } else {
- if (timer) {
- TimerFree(timer);
- timer = NULL;
- }
- }
- } else {
- /*
- * real three button event
- * Note that pMse.lastButtons has the hardware button mapping which
- * is the reverse of the button mapping reported to the server.
- */
- if (pMse->protocolID == PROT_MMHIT)
- change = buttons ^ reverseBits(hitachMap, pMse->lastButtons);
- else
- change = buttons ^ reverseBits(reverseMap, pMse->lastButtons);
+ } else {
+ if (timer) {
+ TimerFree(timer);
+ timer = NULL;
+ }
+ }
+ }
+
while (change) {
id = ffs(change);
change &= ~(1 << (id - 1));
xf86PostButtonEvent(pInfo->dev, 0, id,
(buttons & (1 << (id - 1))), 0, 0);
}
- }
- pMse->lastButtons = truebuttons;
+ pMse->lastButtons = truebuttons;
+ }
}
static void
diff --git a/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c b/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c
index 9f0fc9f8c..8c7b05004 100644
--- a/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c
+++ b/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c
@@ -21,7 +21,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.12 2000/06/07 22:03:10 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */
/*
*******************************************************************************
@@ -42,23 +42,23 @@
*******************************************************************************
*/
-#include <xf86Version.h>
+#include "xf86Version.h"
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
#define XFREE86_V4
#endif
#ifdef XFREE86_V4
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#if !defined(DGUX)
-#include <xf86_ansic.h>
+#include "xf86_ansic.h"
#endif
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <exevents.h>
+#include "xf86_OSproc.h"
+#include "xf86Xinput.h"
+#include "exevents.h"
#ifdef XFree86LOADER
-#include <xf86Module.h>
+#include "xf86Module.h"
#endif
#else /* XFREE86_V4 */
@@ -82,7 +82,6 @@
#include "xf86_OSlib.h"
#include "xf86_Config.h"
#include "xf86Xinput.h"
-#include "xf86Version.h"
#include "os.h"
#include "osdep.h"
diff --git a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c
index c23975d73..f3de89f06 100644
--- a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c
+++ b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c
@@ -1,6 +1,10 @@
/*
* Copyright 1996 by Steven Lang <tiger@tyger.org>
*
+ * AceCad tablet support ported by Arpad Gereoffy <arpi@esp-team.scene.hu>
+ * originally written by Shane Watts <shane@bofh.asn.au>
+ * and Fredrik Chabot <fhc@f6.nl>
+ *
* 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
@@ -20,11 +24,11 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.4 2000/08/11 19:10:48 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.8 2001/04/05 17:42:34 dawes Exp $ */
static const char identification[] = "$Identification: 18 $";
-#include <xf86Version.h>
+#include "xf86Version.h"
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
#define XFREE86_V4 1
@@ -38,25 +42,23 @@ static const char identification[] = "$Identification: 18 $";
#include <errno.h>
#endif
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#define NEED_XF86_TYPES
#if !defined(DGUX)
-#include <xf86_ansic.h>
-#include <xisb.h>
+#include "xf86_ansic.h"
+#include "xisb.h"
#endif
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
-#include <keysym.h>
-#include <mipointer.h>
+#include "xf86_OSproc.h"
+#include "xf86Xinput.h"
+#include "exevents.h" /* Needed for InitValuator/Proximity stuff */
+#include "keysym.h"
+#include "mipointer.h"
#ifdef XFree86LOADER
-#include <xf86Module.h>
+#include "xf86Module.h"
#endif
-#undef memset
-#define memset xf86memset
#undef sleep
#define sleep(t) xf86WaitForInput(-1, 1000 * (t))
#define wait_for_fd(fd) xf86WaitForInput((fd), 1000)
@@ -123,7 +125,6 @@ static InputDriverPtr sumDrv;
#include "xf86Config.h"
#include "xf86Xinput.h"
#include "atKeynames.h"
-#include "xf86Version.h"
#endif
#if !defined(sun) || defined(i386)
@@ -154,10 +155,14 @@ static int debug_level = 5;
#endif
/*
-** Device records
+** Device records (flag bits)
*/
-#define ABSOLUTE_FLAG 1
-#define STYLUS_FLAG 2
+#define ABSOLUTE_FLAG 1 /* default */
+#define STYLUS_FLAG 2 /* not default */
+#define COMPATIBLE_FLAG 4 /* not default */
+#define H1217D_FLAG 8 /* not default */
+#define Z_AXIS_FLAG 16 /* not default */
+#define INITIALIZED 32
typedef struct
{
@@ -166,6 +171,7 @@ typedef struct
int sumButTrans; /* button translation flags */
int sumOldX; /* previous X position */
int sumOldY; /* previous Y position */
+ int sumOldZ; /* previous Z position */
int sumOldProximity; /* previous proximity */
int sumOldButtons; /* previous buttons state */
int sumMaxX; /* max X value */
@@ -177,7 +183,7 @@ typedef struct
int sumRes; /* resolution in lines per inch */
int flags; /* various flags */
int sumIndex; /* number of bytes read */
- unsigned char sumData[5]; /* data read on the device */
+ unsigned char sumData[7]; /* data read on the device */
} SummaDeviceRec, *SummaDevicePtr;
/*
@@ -198,6 +204,9 @@ typedef struct
#define ALWAYS_CORE 9
#define ACTIVE_AREA 10
#define ACTIVE_OFFSET 11
+#define COMPATIBLE 12
+#define RESOLUTION 13
+#define HITACHI_1217D 14
#if !defined(sun) || defined(i386)
static SymTabRec SumTab[] = {
@@ -213,6 +222,9 @@ static SymTabRec SumTab[] = {
{ALWAYS_CORE, "alwayscore"},
{ACTIVE_AREA, "activearea"},
{ACTIVE_OFFSET, "activeoffset"},
+ {COMPATIBLE, "compatible"},
+ {RESOLUTION, "resolution"},
+ {HITACHI_1217D, "hitachi_1217d"},
{-1, ""}
};
@@ -254,7 +266,6 @@ static SymTabRec SumPointTabRec[] = {
#define SS_RELATIVE 'E' /* Relative mode */
#define SS_UPPER_ORIGIN "b" /* Origin upper left */
-#define SS_500LPI "h" /* 500 lines per inch */
#define SS_PROMPT_MODE "B" /* Prompt mode */
#define SS_STREAM_MODE "@" /* Stream mode */
@@ -273,6 +284,9 @@ static const char * ss_initstr = SS_TABID0 SS_UPPER_ORIGIN SS_BINARY_FMT SS_STRE
#define BUTTON_BITS 0x07
#define COORD_BITS 0x7f
+/* macro from counts/inch to counts/meter */
+#define LPI2CPM(res) (res * 1000 / 25.4)
+
/*
** External declarations
*/
@@ -316,7 +330,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val)
int token;
int mtoken;
- DBG(1, ErrorF("xf86SumConfig\n"));
+ DBG(2, ErrorF("xf86SumConfig\n"));
while ((token = xf86GetToken(SumTab)) != ENDSUBSECTION) {
switch(token) {
@@ -414,6 +428,18 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val)
dev->history_size);
break;
+ case HITACHI_1217D:
+ priv->flags |= H1217D_FLAG;
+ priv->sumInc = 0;
+ if(xf86Verbose)
+ ErrorF("%s Hitach_1217D, compatible enforced.\n", XCONFIG_GIVEN);
+
+ case COMPATIBLE:
+ priv->flags |= COMPATIBLE_FLAG;
+ if(xf86Verbose)
+ ErrorF("%s SummaSketch compatible - will not query firmware ID\n", XCONFIG_GIVEN);
+ break;
+
case ALWAYS_CORE:
xf86AlwaysCore(dev, TRUE);
if (xf86Verbose)
@@ -424,29 +450,38 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val)
case ACTIVE_AREA:
if (xf86GetToken(NULL) != NUMBER)
xf86ConfigError("Option number expected");
- priv->sumXSize = val->num;
+ priv->sumXSize = val->realnum * 100;
if (xf86GetToken(NULL) != NUMBER)
xf86ConfigError("Option number expected");
- priv->sumYSize = val->num;
+ priv->sumYSize = val->realnum * 100;
if (xf86Verbose)
- ErrorF("%s SummaSketch active area set to %d.%1dx%d.%1d"
- " inches\n", XCONFIG_GIVEN, priv->sumXSize / 10,
- priv->sumXSize % 10, priv->sumYSize / 10,
- priv->sumYSize % 10);
+ ErrorF("%s SummaSketch active area: %d.%02dx%d.%02d"
+ " inches\n", XCONFIG_GIVEN, priv->sumXSize / 100,
+ priv->sumXSize % 100, priv->sumYSize / 100,
+ priv->sumYSize % 100);
break;
case ACTIVE_OFFSET:
if (xf86GetToken(NULL) != NUMBER)
xf86ConfigError("Option number expected");
- priv->sumXOffset = val->num;
+ priv->sumXOffset = val->realnum * 100;
if (xf86GetToken(NULL) != NUMBER)
xf86ConfigError("Option number expected");
- priv->sumYOffset = val->num;
+ priv->sumYOffset = val->realnum * 100;
if (xf86Verbose)
- ErrorF("%s SummaSketch active area offset set to %d.%1dx%d.%1d"
- " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 10,
- priv->sumXOffset % 10, priv->sumYOffset / 10,
- priv->sumYOffset % 10);
+ ErrorF("%s SummaSketch active offsets: %d.%02d %d.%02d"
+ " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 100,
+ priv->sumXOffset % 100, priv->sumYOffset / 100,
+ priv->sumYOffset % 100);
+ break;
+
+ case RESOLUTION:
+ if (xf86GetToken(NULL) != NUMBER)
+ xf86ConfigError("Option number expected");
+ priv->sumRes = val->num;
+ if (xf86Verbose)
+ ErrorF("%s SummaSketch resolution set to %d\n", XCONFIG_GIVEN,
+ priv->sumRes);
break;
case EOF:
@@ -459,7 +494,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val)
}
}
- DBG(1, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice));
+ DBG(2, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice));
return Success;
}
@@ -468,7 +503,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val)
/*
** xf86SumConvert
-** Convert valuators to X and Y.
+** Convert device valuator values to screen X and Y.
*/
static Bool
xf86SumConvert(LocalDevicePtr local,
@@ -488,12 +523,10 @@ xf86SumConvert(LocalDevicePtr local,
if (first != 0 || num == 1)
return FALSE;
- *x = (v0 - priv->sumXOffset) * screenInfo.screens[0]->width / priv->sumXSize;
- *y = (v1 - priv->sumYOffset) * screenInfo.screens[0]->height / priv->sumYSize;
- if (*x < 0)
- *x = 0;
- if (*y < 0)
- *y = 0;
+ *x = (v0 * screenInfo.screens[0]->width) / priv->sumXSize;
+ *y = (v1 * screenInfo.screens[0]->height) / priv->sumYSize;
+ if (*x < 0) *x = 0;
+ if (*y < 0) *y = 0;
if (*x > screenInfo.screens[0]->width)
*x = screenInfo.screens[0]->width;
if (*y > screenInfo.screens[0]->height)
@@ -513,8 +546,8 @@ xf86SumReadInput(LocalDevicePtr local)
{
SummaDevicePtr priv = (SummaDevicePtr) local->private;
int len, loop;
- int is_absolute;
- int x, y, buttons, prox;
+ int is_absolute, num_ax;
+ int x, y, z, buttons, prox;
DeviceIntPtr device;
unsigned char buffer[BUFFER_SIZE];
@@ -554,6 +587,23 @@ xf86SumReadInput(LocalDevicePtr local)
Byte 5 (Absolute mode only)
bit 7 Always 0
bits 6-0 = Y13 - Y7
+ ---------------------------------
+ Flair extends this with
+ ---------------------------------
+ Byte 6
+ bit 7 Always 0
+ bits 6-0 = Z8-2
+
+ Byte 7
+ bit 7-5 Always 0
+ bit 4 = Z0
+ bit 3-2 = Cr1-0
+ Controler 00 = 4 button puck
+ 01 = 3 button stylus (default)
+ 10 = 16 button puck (how? only 4bits)
+ 11 = reserved
+ bit 1 = Button status
+ bit 0 = Z1
*/
if ((priv->sumIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */
@@ -563,38 +613,54 @@ xf86SumReadInput(LocalDevicePtr local)
priv->sumData[priv->sumIndex++] = buffer[loop];
- if (priv->sumIndex == (priv->flags & ABSOLUTE_FLAG? 5: 3)) {
+ if (priv->sumIndex == ( (priv->flags & ABSOLUTE_FLAG) ?
+ ((priv->flags & Z_AXIS_FLAG)?7:5) : 3)) {
/* the packet is OK */
/* reset char count for next read */
priv->sumIndex = 0;
+ prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1;
+ buttons = (priv->sumData[0] & BUTTON_BITS);
if (priv->flags & ABSOLUTE_FLAG) {
x = (int)priv->sumData[1] + ((int)priv->sumData[2] << 7);
y = (int)priv->sumData[3] + ((int)priv->sumData[4] << 7);
+ if(priv->flags & Z_AXIS_FLAG){
+ z = ((int)priv->sumData[5] << 2) |
+ ((int)priv->sumData[6] & 0x01 << 1) |
+ ((int)priv->sumData[6] & 0x10);
+ buttons |= ((int)priv->sumData[6] & 0x02 << 2);
+ } else z = 0;
} else {
x = priv->sumData[0] & XSIGN_BIT? priv->sumData[1]: -priv->sumData[1];
y = priv->sumData[0] & YSIGN_BIT? priv->sumData[2]: -priv->sumData[2];
+ z = 0;
}
- prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1;
- buttons = (priv->sumData[0] & BUTTON_BITS);
+ /* adj x/y by user given offsets; z untouched */
+ x -= priv->sumXOffset;
+ y -= priv->sumYOffset;
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ if (x > priv->sumXSize) x = priv->sumXSize;
+ if (y > priv->sumYSize) y = priv->sumYSize;
device = local->dev;
- DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbuttons=%d\n",
- prox ? "true" : "false", x, y, buttons));
+ DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tz=%d\tbuttons=%d\n",
+ prox ? "true" : "false", x, y, z, buttons));
is_absolute = (priv->flags & ABSOLUTE_FLAG);
+ num_ax = (priv->flags & Z_AXIS_FLAG)? 3 : 2;
-/* coordonates are ready we can send events */
+/* coordinates are ready we can send events */
if (prox) {
if (!(priv->sumOldProximity))
- xf86PostProximityEvent(device, 1, 0, 2, x, y);
+ xf86PostProximityEvent(device, 1, 0, num_ax, x, y, z);
- if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y)))
+ if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y) || (priv->sumOldZ != z)))
|| (!is_absolute && (x || y))) {
if (is_absolute || priv->sumOldProximity) {
- xf86PostMotionEvent(device, is_absolute, 0, 2, x, y);
+ xf86PostMotionEvent(device, is_absolute, 0, num_ax, x, y, z);
}
}
if (priv->sumOldButtons != buttons) {
@@ -610,17 +676,18 @@ xf86SumReadInput(LocalDevicePtr local)
delta));
xf86PostButtonEvent(device, is_absolute, button,
- (delta > 0), 0, 2, x, y);
+ (delta > 0), 0, num_ax, x, y, z);
}
}
priv->sumOldButtons = buttons;
priv->sumOldX = x;
priv->sumOldY = y;
+ priv->sumOldZ = z;
priv->sumOldProximity = prox;
} else { /* !PROXIMITY */
/* Any changes in buttons are ignored when !proximity */
if (priv->sumOldProximity)
- xf86PostProximityEvent(device, 0, 0, 2, x, y);
+ xf86PostProximityEvent(device, 0, 0, num_ax, x, y, z);
priv->sumOldProximity = 0;
}
}
@@ -669,7 +736,7 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term)
SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
#else
- err = xf86WaitForInput(fd, 1000);
+ err = xf86WaitForInput(fd, 200000);
#endif
if (err == -1) {
Error("SummaSketch select");
@@ -699,6 +766,47 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term)
return buffer;
}
+/* xf86SumSetResCode
+ * Set Summa MM mode resolution code letter.
+*/
+static void
+xf86SumSetResCode (int *res, char *buffer, int index)
+{
+ switch (*res) {
+ case 1: buffer[index] = 'l'; break;
+ case 2: buffer[index] = 'n'; break;
+ case 4: buffer[index] = 'p'; break;
+ case 100: buffer[index] = 'd'; break;
+ case 200: buffer[index] = 'e'; break;
+ case 10: /* 10 lpmm */
+ *res = 254;
+ case 254:
+ buffer[index] = 'f'; break;
+ case 400:
+ buffer[index] = 'g'; break;
+ case 20: /* 20 lpmm */
+ *res = 508;
+ case 508:
+ buffer[index] = 'i'; break;
+ case 1000:
+ buffer[index] = 'j'; break;
+ case 40: /* 40 lpmm */
+ *res = 1016;
+ case 1016:
+ buffer[index] = 'q'; break;
+ case 2000:
+ buffer[index] = 's'; break;
+ case 2032:
+ buffer[index] = 'u'; break;
+ case 2540: /* note: for 12x12 tablet only */
+ buffer[index] = 'v'; break;
+
+ default: /* default to 500 lpi */
+ *res = 500;
+ buffer[index] = 'h'; break;
+ }
+ buffer[index+1] = 0;
+}
/*
** xf86SumOpen
@@ -711,11 +819,13 @@ xf86SumOpen(LocalDevicePtr local)
struct termios termios_tty;
struct timeval timeout;
#endif
- char buffer[256];
+ char buffer[256], dbuffer[4];
int err, idx;
+ int res100;
+ double sratio, tratio;
SummaDevicePtr priv = (SummaDevicePtr)local->private;
- DBG(1, ErrorF("opening %s\n", priv->sumDevice));
+ DBG(2, ErrorF("opening %s\n", priv->sumDevice));
#ifdef XFREE86_V4
local->fd = xf86OpenSerial(local->options);
#else
@@ -738,7 +848,7 @@ xf86SumOpen(LocalDevicePtr local)
termios_tty.c_cflag = B9600|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD;
termios_tty.c_lflag = 0;
-/* I wonder what these all do, anyway */
+ /* prevent tty term discipline processing */
termios_tty.c_cc[VINTR] = 0;
termios_tty.c_cc[VQUIT] = 0;
termios_tty.c_cc[VERASE] = 0;
@@ -773,21 +883,20 @@ xf86SumOpen(LocalDevicePtr local)
#else
#error Code for someone else to write to handle OSs without POSIX tty functions
#endif
-#else
-/* if (xf86SetSerialSpeed(local->fd, 9600) < 0) {
- return !Success;
- }
-*/
-#endif
- DBG(1, ErrorF("initializing SummaSketch tablet\n"));
+#endif /* xf_v4 */
+
+ DBG(2, ErrorF("initializing SummaSketch tablet\n"));
-/* Send reset (NULL) to the tablet */
- SYSCALL(err = write(local->fd, "", 1));
+ /* send ASCII spaces in case tablet can auto-baud */
+ for (idx = 0; idx < 10; idx++) buffer[idx] = ' ';
+ SYSCALL(err = write(local->fd, buffer, 10));
if (err == -1) {
Error("SummaSketch write");
return !Success;
}
+ buffer[0] = 0;
+ SYSCALL(err = write(local->fd, buffer, 1));
/* wait 200 mSecs, just in case */
#ifndef XFREE86_V4
@@ -814,63 +923,88 @@ xf86SumOpen(LocalDevicePtr local)
#else
xf86FlushInput(local->fd);
#endif
- DBG(2, ErrorF("reading firmware ID\n"));
- if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1))
- return !Success;
- DBG(2, ErrorF("%s\n", buffer));
+ if ((priv->flags & COMPATIBLE_FLAG) == 0) {
+ DBG(2, ErrorF("reading firmware ID\n"));
+ if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1))
+ return !Success;
+ DBG(2, ErrorF("%s\n", buffer));
+ if (xf86Verbose)
+ ErrorF("%s %s firmware ID : %s\n", XCONFIG_PROBED, local->name, buffer);
+ }
- if (xf86Verbose)
- ErrorF("%s SummaSketch firmware ID : %s\n", XCONFIG_PROBED, buffer);
+ DBG(2, ErrorF("setting up resolution\n"));
+ xf86SumSetResCode (&priv->sumRes, dbuffer, 0);
+ dbuffer[1] = 'a'; /* config cmd */
+ dbuffer[2] = 0;
DBG(2, ErrorF("reading max coordinates\n"));
- if (!xf86SumWriteAndRead(local->fd, SS_500LPI SS_CONFIG, buffer, 5, 0))
+ if (!xf86SumWriteAndRead(local->fd, dbuffer, buffer,
+ (priv->flags&Z_AXIS_FLAG)?7:5, 0))
return !Success;
- priv->sumMaxX = (int)buffer[1] + ((int)buffer[2] << 7);
- priv->sumMaxY = (int)buffer[3] + ((int)buffer[4] << 7);
+
+ priv->sumMaxX = (buffer[1] & 0x7f) | (buffer[2] << 7);
+ priv->sumMaxY = (buffer[3] & 0x7f) | (buffer[4] << 7);
+
+ if (priv->flags & H1217D_FLAG) {
+ /* the numbers below are from Hitachi 1217D spec sheet */
+ priv->sumMaxX = (432.4 / 25.4) * priv->sumRes;
+ priv->sumMaxY = (297.6 / 25.4) * priv->sumRes;
+ }
if (xf86Verbose)
- ErrorF("%s SummaSketch tablet size is %d.%1dinx%d.%1din, %dx%d "
- "lines of resolution\n", XCONFIG_PROBED,
- priv->sumMaxX / 500, (priv->sumMaxX / 50) % 10,
- priv->sumMaxY / 500, (priv->sumMaxY / 50) % 10,
+ ErrorF("%s %s: tablet size is %d.%02din. x %d.%02din., %dx%d "
+ "lines of resolution\n", XCONFIG_PROBED, local->name,
+ priv->sumMaxX / priv->sumRes,
+ (priv->sumMaxX * 100 / priv->sumRes) % 100,
+ priv->sumMaxY / priv->sumRes,
+ (priv->sumMaxY * 100 / priv->sumRes) % 100,
priv->sumMaxX, priv->sumMaxY);
+ res100 = priv->sumRes / 100;
+ if (priv->sumXOffset >= 0 && priv->sumYOffset >= 0) {
+ priv->sumXOffset *= res100;
+ priv->sumYOffset *= res100;
+ priv->sumMaxX -= priv->sumXOffset;
+ priv->sumMaxY -= priv->sumYOffset;
+ }
+
if (priv->sumXSize > 0 && priv->sumYSize > 0) {
- if (priv->sumXSize * 50 < priv->sumMaxX &&
- priv->sumYSize * 50 < priv->sumMaxY) {
- priv->sumXSize *= 50;
- priv->sumYSize *= 50;
+ if ((priv->sumXSize * res100) <= priv->sumMaxX &&
+ (priv->sumYSize * res100) <= priv->sumMaxY) {
+ priv->sumXSize *= res100;
+ priv->sumYSize *= res100;
} else {
- ErrorF("%s SummaSketch active area bigger than tablet, "
- "assuming maximum\n", XCONFIG_PROBED);
+ ErrorF("%s %s: active area bigger than tablet, "
+ "assuming maximum\n", XCONFIG_PROBED, local->name);
priv->sumXSize = priv->sumMaxX;
- priv->sumYSize = priv->sumMaxX;
+ priv->sumYSize = priv->sumMaxY;
}
} else {
priv->sumXSize = priv->sumMaxX;
priv->sumYSize = priv->sumMaxY;
}
- if (priv->sumXOffset > 0 && priv->sumYOffset > 0) {
- if (priv->sumXSize * 50 < priv->sumMaxX - priv->sumXOffset &&
- priv->sumYSize * 50 < priv->sumMaxY - priv->sumYOffset) {
- priv->sumXOffset *= 50;
- priv->sumYOffset *= 50;
- } else {
- ErrorF("%s SummaSketch offset sets active area off tablet, "
- "centering\n", XCONFIG_PROBED);
- priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2;
- priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2;
- }
- } else {
- priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2;
- priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2;
- }
+ /* map tablet area by screen aspect ratio */
+ sratio = (double)screenInfo.screens[0]->height /
+ (double)screenInfo.screens[0]->width;
+ tratio = (double)priv->sumMaxY / (double)priv->sumMaxX;
+
+ if (tratio <= 1.0) { /* tablet horizontal > vertical */
+ priv->sumXSize = (double)priv->sumYSize / sratio;
+ if (priv->sumXSize > priv->sumMaxX) priv->sumXSize = priv->sumMaxX;
+ }
+ else {
+ priv->sumYSize = (double)priv->sumXSize / sratio;
+ if (priv->sumYSize > priv->sumMaxY) priv->sumYSize = priv->sumMaxY;
+ }
+ ErrorF("%s %s: using tablet area %d by %d, at res %d lpi\n",
+ XCONFIG_PROBED, local->name, priv->sumXSize, priv->sumYSize,
+ priv->sumRes);
if (priv->sumInc > 95)
priv->sumInc = 95;
- if (priv->sumInc < 1) {
+ if (priv->sumInc < 0) { /* increment not given by user */
/* Make a guess as to the best increment value given video mode */
if (priv->sumXSize / screenInfo.screens[0]->width <
priv->sumYSize / screenInfo.screens[0]->height)
@@ -880,8 +1014,8 @@ xf86SumOpen(LocalDevicePtr local)
if (priv->sumInc < 1)
priv->sumInc = 1;
if (xf86Verbose)
- ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED,
- priv->sumInc);
+ ErrorF("%s %s: Using increment value of %d\n", XCONFIG_PROBED,
+ local->name, priv->sumInc);
}
/* Sets up the tablet mode to increment, stream, and such */
@@ -928,21 +1062,63 @@ xf86SumOpenDevice(DeviceIntPtr pSum)
/* Set the real values */
InitValuatorAxisStruct(pSum,
0,
- 0, /* min val */
- priv->sumMaxX, /* max val */
- 500000, /* resolution */
- 0, /* min_res */
- 500000); /* max_res */
+ 0, /* min val */
+ priv->sumXSize, /* max val in use */
+ LPI2CPM(priv->sumRes), /* resolution */
+ 0, /* min_res */
+ LPI2CPM(priv->sumRes)); /* max_res */
InitValuatorAxisStruct(pSum,
1,
- 0, /* min val */
- priv->sumMaxY, /* max val */
- 500000, /* resolution */
- 0, /* min_res */
- 500000); /* max_res */
+ 0, /* min val */
+ priv->sumYSize, /* max val in use */
+ LPI2CPM(priv->sumRes), /* resolution */
+ 0, /* min_res */
+ LPI2CPM(priv->sumRes)); /* max_res */
+ if(priv->flags&Z_AXIS_FLAG)
+ InitValuatorAxisStruct(pSum,
+ 2,
+ 0, /* min val */
+ 512, /* max val */
+ LPI2CPM(priv->sumRes), /* resolution */
+ 0, /* min_res */
+ LPI2CPM(priv->sumRes)); /* max_res */
+
return (local->fd != -1);
}
+/* initialize start-up values */
+static void
+xf86SumInitPrivate (SummaDevicePtr priv)
+{
+ if (priv == NULL) return;
+
+#if defined(sun) && !defined(i386)
+ if (dev_name) {
+ priv->sumDevice = xalloc(strlen(dev_name) + 1);
+ strcpy(priv->sumDevice, dev_name);
+ ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice);
+ } else {
+ priv->sumDevice = "";
+ }
+#else
+ priv->sumDevice = ""; /* device file name */
+#endif
+ priv->sumRes = 500; /* default 500 lpi */
+ priv->sumInc = -1; /* event trigger delta moves thrshold */
+ priv->sumOldX = -1; /* previous X position */
+ priv->sumOldY = -1; /* previous Y position */
+ priv->sumOldProximity = 0; /* previous proximity */
+ priv->sumOldButtons = 0; /* previous buttons state */
+ priv->sumMaxX = -1; /* max X value */
+ priv->sumMaxY = -1; /* max Y value */
+ priv->sumXSize = 0; /* active area X size */
+ priv->sumXOffset = 0; /* active area X offset */
+ priv->sumYSize = 0; /* active area Y size */
+ priv->sumYOffset = 0; /* active area Y offset */
+ priv->sumIndex = 0; /* number of bytes read */
+ priv->flags = ABSOLUTE_FLAG; /* various flags -- default absolute */
+}
+
/*
** xf86SumProc
** Handle requests to do stuff to the driver.
@@ -961,10 +1137,12 @@ xf86SumProc(DeviceIntPtr pSum, int what)
switch (what) {
case DEVICE_INIT:
- DBG(1, ErrorF("xf86SumProc pSum=0x%x what=INIT\n", pSum));
+ DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=INIT\n", pSum,
+ local->fd));
+ if (priv->flags & INITIALIZED) break; /* already done */
- nbaxes = 2; /* X, Y */
- nbbuttons = (priv->flags & STYLUS_FLAG)? 2: 4;
+ nbaxes = (priv->flags & Z_AXIS_FLAG)?3:2; /* X, Y [,Z] */
+ nbbuttons = (priv->flags & STYLUS_FLAG)? ((priv->flags & Z_AXIS_FLAG)?3:2): 4;
for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop;
@@ -1000,24 +1178,39 @@ xf86SumProc(DeviceIntPtr pSum, int what)
ErrorF("unable to allocate Valuator class device\n");
return !Success;
}
-/* allocate the motion history buffer if needed */
+ /* allocate the motion history buffer if needed */
xf86MotionHistoryAllocate(local);
#ifndef XFREE86_V4
AssignTypeAndName(pSum, local->atom, local->name);
#endif
-/* open the device to gather informations */
+ /* open the device to gather informations */
xf86SumOpenDevice(pSum);
+ priv->flags |= INITIALIZED;
break;
case DEVICE_ON:
- DBG(1, ErrorF("xf86SumProc pSum=0x%x what=ON\n", pSum));
+ DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=ON\n", pSum,
+ local->fd));
+ if (pSum->public.on) break; /* already on */
if ((local->fd < 0) && (!xf86SumOpenDevice(pSum))) {
return !Success;
}
+
+ /* send prompt character to start the reports */
SYSCALL(write(local->fd, SS_PROMPT, strlen(SS_PROMPT)));
-#ifdef XFREE86_V4
+
+/* note: using xf86Add/Remove EnabledDevice() somehow causes the tablet
+ * to stop responding after a VT switch, and cannot be restored w/o
+ * cycling tablet power. until we figure out what's going on, do not
+ * enagae signal handlers yet. -huver@amgraf.com mar/12/2001.
+*/
+#if 0
+ #ifdef XFREE86_V4
xf86AddEnabledDevice(local);
+ #else
+ AddEnabledDevice(local->fd);
+ #endif
#else
AddEnabledDevice(local->fd);
#endif
@@ -1025,11 +1218,16 @@ xf86SumProc(DeviceIntPtr pSum, int what)
break;
case DEVICE_OFF:
- DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum,
- (what == DEVICE_CLOSE) ? "CLOSE" : "OFF"));
+ DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=OFF\n", pSum,
+ local->fd));
+ if (! pSum->public.on) break; /* already off */
if (local->fd >= 0)
-#ifdef XFREE86_V4
+#if 0
+ #ifdef XFREE86_V4
xf86RemoveEnabledDevice(local);
+ #else
+ RemoveEnabledDevice(local->fd);
+ #endif
#else
RemoveEnabledDevice(local->fd);
#endif
@@ -1037,10 +1235,12 @@ xf86SumProc(DeviceIntPtr pSum, int what)
break;
case DEVICE_CLOSE:
- DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum,
- (what == DEVICE_CLOSE) ? "CLOSE" : "OFF"));
- SYSCALL(close(local->fd));
- local->fd = -1;
+ DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=CLOSE\n", pSum,
+ local->fd));
+ if (local->fd != -1) {
+ SYSCALL(close(local->fd));
+ local->fd = -1;
+ }
break;
default:
@@ -1060,10 +1260,16 @@ xf86SumProc(DeviceIntPtr pSum, int what)
static void
xf86SumClose(LocalDevicePtr local)
{
+ DBG(2, ErrorF("xf86SumClose local = %lx, ->fd = %d\n", local, local->fd));
if (local->fd >= 0) {
+#ifdef XFREE86_V4
+ xf86CloseSerial(local->fd);
+#else
SYSCALL(close(local->fd));
+#endif
}
local->fd = -1;
+ xf86SumInitPrivate (local->private);
}
/*
@@ -1110,7 +1316,7 @@ xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
break;
default:
- DBG(1, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n",
+ DBG(2, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n",
dev, mode));
return BadMatch;
}
@@ -1123,7 +1329,7 @@ xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
** Allocates the device structures for the SummaSketch.
*/
static LocalDevicePtr
-xf86SumAllocate()
+xf86SumAllocate(void)
{
LocalDevicePtr local;
SummaDevicePtr priv;
@@ -1167,32 +1373,7 @@ xf86SumAllocate()
local->history_size = 0;
local->old_x = -1;
local->old_y = -1;
-
-#if defined(sun) && !defined(i386)
- if (def_name) {
- priv->sumDevice = xalloc(strlen(dev_name) + 1);
- strcpy(priv->sumDevice, device_name);
- ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice);
- } else {
- priv->sumDevice = "";
- }
-#else
- priv->sumDevice = ""; /* device file name */
-#endif
- priv->sumInc = -1; /* re-transmit position on increment */
- priv->sumOldX = -1; /* previous X position */
- priv->sumOldY = -1; /* previous Y position */
- priv->sumOldProximity = 0; /* previous proximity */
- priv->sumOldButtons = 0; /* previous buttons state */
- priv->sumMaxX = -1; /* max X value */
- priv->sumMaxY = -1; /* max Y value */
- priv->sumXSize = -1; /* active area X */
- priv->sumXOffset = -1; /* active area X offset */
- priv->sumYSize = -1; /* active area Y */
- priv->sumYOffset = -1; /* active area U offset */
- priv->flags = 0; /* various flags */
- priv->sumIndex = 0; /* number of bytes read */
-
+ xf86SumInitPrivate (priv);
return local;
}
@@ -1229,9 +1410,9 @@ init_xf86Summa(unsigned long server_version)
return 1;
}
}
-#endif
+#endif /* dynamic_module */
-#else
+#else /* below for xfree86_v4 */
/*
* xf86SumUninit --
@@ -1245,7 +1426,7 @@ xf86SumUninit(InputDriverPtr drv,
{
SummaDevicePtr priv = (SummaDevicePtr) local->private;
- DBG(1, ErrorF("xf86SumUninit\n"));
+ DBG(2, ErrorF("xf86SumUninit\n"));
xf86SumProc(local->dev, DEVICE_OFF);
@@ -1269,7 +1450,7 @@ xf86SumInit(InputDriverPtr drv,
sumDrv = drv;
- DBG(1, ErrorF("xf86SumInit allocating...\n"));
+ DBG(2, ErrorF("xf86SumInit allocating...\n"));
local = xf86SumAllocate();
if (!local)
@@ -1277,17 +1458,16 @@ xf86SumInit(InputDriverPtr drv,
local->conf_idev = dev;
- DBG(1, ErrorF("xf86SumInit CollectInputOptions...\n"));
+ DBG(2, ErrorF("xf86SumInit CollectInputOptions... "));
xf86CollectInputOptions(local, default_options, NULL);
- DBG(1, ErrorF("done.\n"));
+ DBG(2, ErrorF("done.\n"));
xf86OptionListReport( local->options );
-
priv = (SummaDevicePtr) local->private;
local->name = dev->identifier;
- /* Serial Device is mandatory */
+ /* Serial Device name is mandatory */
priv->sumDevice = xf86FindOptionValue(local->options, "Device");
if (!priv->sumDevice) {
@@ -1300,7 +1480,7 @@ xf86SumInit(InputDriverPtr drv,
/* Optional configuration */
- xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier,
+ xf86Msg(X_CONFIG, "%s: serial device is %s\n", dev->identifier,
priv->sumDevice);
debug_level = xf86SetIntOption(local->options, "DebugLevel", 0);
@@ -1308,7 +1488,11 @@ xf86SumInit(InputDriverPtr drv,
xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level);
}
-
+ s = xf86FindOptionValue(local->options, "Resolution");
+ if (s) {
+ priv->sumRes=atoi(s);
+ xf86Msg(X_CONFIG, "%s: resolution given %d\n", local->name, priv->sumRes);
+ }
s = xf86FindOptionValue(local->options, "Mode");
@@ -1322,9 +1506,29 @@ xf86SumInit(InputDriverPtr drv,
xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). "
"Using default.\n", dev->identifier);
}
- xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name,
+ xf86Msg(X_CONFIG, "%s: set for %s mode\n", local->name,
(priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
+ s = xf86FindOption(local->options, "Compatible");
+ if (s) {
+ priv->flags|=COMPATIBLE_FLAG;
+ }
+
+ if (xf86FindOption(local->options, "Hitachi_1217D") != NULL) {
+ priv->flags |= H1217D_FLAG | COMPATIBLE_FLAG;
+ priv->sumInc = 0; /* this must be zero for Hitachi 1217D */
+ xf86Msg(X_CONFIG, "%s: Hitachi 1217D, Compatible mode and Increment 0 implied\n",
+ local->name);
+ }
+ if (priv->flags & COMPATIBLE_FLAG) {
+ xf86Msg(X_CONFIG, "%s: will not query firmware ID.\n", local->name);
+ }
+
+ s = xf86FindOptionValue(local->options, "ZAxis");
+ if(s){
+ priv->flags|=Z_AXIS_FLAG;
+ xf86Msg(X_CONFIG, "Tablet has Z axis (AceCad Flair or compatible)\n");
+ }
s = xf86FindOptionValue(local->options, "Cursor");
@@ -1338,31 +1542,33 @@ xf86SumInit(InputDriverPtr drv,
xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). "
"Using default.\n", dev->identifier);
}
- xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name,
+ xf86Msg(X_CONFIG, "%s: cursor mode is %s\n", local->name,
(priv->flags & STYLUS_FLAG) ? "cursor" : "puck");
- priv->sumXSize = xf86SetIntOption(local->options, "XSize", 0);
+ priv->sumXSize = xf86SetRealOption(local->options, "XSize", 0.0) * 100;
if (priv->sumXSize != 0) {
- xf86Msg(X_CONFIG, "%s: XSize = %d\n",
- dev->identifier, priv->sumXSize);
+ xf86Msg(X_CONFIG, "%s: XSize = %d.%02din.\n",
+ dev->identifier, priv->sumXSize/100, priv->sumXSize%100);
}
- priv->sumYSize = xf86SetIntOption(local->options, "YSize", 0);
+ priv->sumYSize = xf86SetRealOption(local->options, "YSize", 0.0) * 100;
if (priv->sumYSize != 0) {
- xf86Msg(X_CONFIG, "%s: YSize = %d\n",
- dev->identifier, priv->sumYSize);
+ xf86Msg(X_CONFIG, "%s: YSize = %d.%02din.\n",
+ dev->identifier, priv->sumYSize/100, priv->sumYSize%100);
}
- priv->sumXOffset = xf86SetIntOption(local->options, "XOffset", 0);
+ priv->sumXOffset = xf86SetRealOption(local->options, "XOffset", 0.0) * 100;
if (priv->sumXOffset != 0) {
- xf86Msg(X_CONFIG, "%s: XOffset = %d\n",
- dev->identifier, priv->sumXOffset);
+ xf86Msg(X_CONFIG, "%s: XOffset = %d.%02din.\n",
+ dev->identifier, priv->sumXOffset / 100,
+ priv->sumXOffset % 100);
}
- priv->sumYOffset = xf86SetIntOption(local->options, "YOffset", 0);
+ priv->sumYOffset = xf86SetRealOption(local->options, "YOffset", 0.0) * 100;
if (priv->sumYOffset != 0) {
- xf86Msg(X_CONFIG, "%s: YOffset = %d\n",
- dev->identifier, priv->sumYOffset);
+ xf86Msg(X_CONFIG, "%s: YOffset = %d.%02din.\n",
+ dev->identifier, priv->sumYOffset / 100,
+ priv->sumYOffset % 100);
}
/* mark the device configured */
@@ -1407,7 +1613,7 @@ InputDriverRec SUMMA = {
static void
xf86SumUnplug(pointer p)
{
- DBG(1, ErrorF("xf86SumUnplug\n"));
+ DBG(2, ErrorF("xf86SumUnplug\n"));
}
/*
@@ -1421,7 +1627,7 @@ xf86SumPlug(pointer module,
int *errmaj,
int *errmin)
{
- DBG(1, ErrorF("xf86SumPlug\n"));
+ DBG(2, ErrorF("xf86SumPlug\n"));
xf86AddInputDriver(&SUMMA, module, 0);
@@ -1452,3 +1658,4 @@ XF86ModuleData summaModuleData = {&xf86SumVersionRec,
/* end of xf86Summa.c */
+
diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
index e9b570494..ed9aa453c 100644
--- a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
+++ b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.25 2001/02/13 19:19:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.26 2001/04/01 14:00:13 tsi Exp $ */
/*
* This driver is only able to handle the Wacom IV and Wacom V protocols.
@@ -58,7 +58,7 @@
static const char identification[] = "$Identification: 20 $";
-#include <xf86Version.h>
+#include "xf86Version.h"
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
#define XFREE86_V4 1
@@ -85,21 +85,21 @@ static const char identification[] = "$Identification: 20 $";
#include <errno.h>
#endif
-#include <misc.h>
-#include <xf86.h>
+#include "misc.h"
+#include "xf86.h"
#define NEED_XF86_TYPES
#if !defined(DGUX)
-#include <xf86_ansic.h>
-#include <xisb.h>
+#include "xf86_ansic.h"
+#include "xisb.h"
#endif
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
-#include <keysym.h>
-#include <mipointer.h>
+#include "xf86_OSproc.h"
+#include "xf86Xinput.h"
+#include "exevents.h" /* Needed for InitValuator/Proximity stuff */
+#include "keysym.h"
+#include "mipointer.h"
#ifdef XFree86LOADER
-#include <xf86Module.h>
+#include "xf86Module.h"
#endif
#undef sleep
@@ -170,7 +170,6 @@ static InputDriverPtr wcmDrv;
#include "xf86_Config.h"
#include "xf86Xinput.h"
#include "atKeynames.h"
-#include "xf86Version.h"
#endif
#if !defined(sun) || defined(i386)
diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
index d8ab6ebe5..edcfedb0e 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.14 2001/02/15 19:37:26 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.15 2001/03/25 05:32:13 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -274,19 +274,15 @@ x_inb(CARD16 port)
{
CARD8 val;
- if (port >= 0x0100) {
- val = inb(port);
-#ifdef PRINT_PORT
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
-#endif
- } else if (port == 0x40) {
+ if (port == 0x40) {
Int10Current->inb40time++;
val = (CARD8)(Int10Current->inb40time >>
((Int10Current->inb40time & 1) << 3));
#ifdef PRINT_PORT
ErrorF(" inb(%#x) = %2.2x\n", port, val);
#endif
- } else { /* Don't interfere with mainboard */
+#ifdef __NOT_YET__
+ } else if (port < 0x0100) { /* Don't interfere with mainboard */
val = 0;
xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
"inb 0x%4.4x\n", port);
@@ -294,6 +290,12 @@ x_inb(CARD16 port)
dump_registers(Int10Current);
stack_trace(Int10Current);
}
+#endif /* __NOT_YET__ */
+ } else {
+ val = inb(port);
+#ifdef PRINT_PORT
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
+#endif
}
return val;
}
@@ -323,14 +325,9 @@ x_inw(CARD16 port)
void
x_outb(CARD16 port, CARD8 val)
{
- if (port >= 0x0100) {
-#ifdef PRINT_PORT
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
-#endif
- outb(port, val);
- } else if ((port == 0x43) && (val == 0)) {
+ if ((port == 0x43) && (val == 0)) {
/*
- * Emulate a PC's timer. Such timers typically have a resolution of
+ * Emulate a PC's timer 0. Such timers typically have a resolution of
* some .838 usec per tick, but this can only provide 1 usec per tick.
* (Not that this matters much, given inherent emulation delays.) Use
* the bottom bit as a byte select. See inb(0x40) above.
@@ -341,13 +338,20 @@ x_outb(CARD16 port, CARD8 val)
#ifdef PRINT_PORT
ErrorF(" outb(%#x, %2.2x)\n", port, val);
#endif
- } else { /* Don't interfere with mainboard */
+#ifdef __NOT_YET__
+ } else if (port < 0x0100) { /* Don't interfere with mainboard */
xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
"outb 0x%4.4x,0x%2.2x\n", port, val);
if (xf86GetVerbosity() > 3) {
dump_registers(Int10Current);
stack_trace(Int10Current);
}
+#endif /* __NOT_YET__ */
+ } else {
+#ifdef PRINT_PORT
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
+#endif
+ outb(port, val);
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
index 2d0bd6ff2..cd434bf9e 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.17 2001/02/15 19:37:26 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.18 2001/03/03 22:46:32 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -101,7 +101,7 @@ setup_int_vect(xf86Int10InfoPtr pInt)
#endif
int
-setup_system_bios(memType base_addr)
+setup_system_bios(void *base_addr)
{
char *base = (char *) base_addr;
diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c
index e68a3c0f3..e61c2ae6f 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.7 2001/03/25 05:32:13 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -570,10 +570,10 @@ int42_handler(xf86Int10InfoPtr pInt)
break;
default:
- /* Various extensions */
+ /* Various extensions */
/* Enter: Various */
/* Leave: Various */
- /* Ignored */
+ /* Ignored */
break;
}
diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
index 0c7432faa..b2ffd420d 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
+++ b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.18 2001/02/16 10:04:31 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.19 2001/03/03 22:46:32 tsi Exp $ */
/*
* XFree86 int10 module
@@ -151,7 +151,7 @@ void Mem_wl(int addr, CARD32 val);
/* helper_mem.c */
void setup_int_vect(xf86Int10InfoPtr pInt);
-int setup_system_bios(unsigned long base_addr);
+int setup_system_bios(void *base_addr);
void reset_int_vect(xf86Int10InfoPtr pInt);
void set_return_trap(xf86Int10InfoPtr pInt);
Bool int10skip(ScrnInfoPtr pScrn, int entityIndex);
diff --git a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
index 34a386bd3..50ce4d1a8 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.36 2001/01/21 21:19:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.38 2001/04/05 17:42:34 dawes Exp $ */
/*
@@ -39,6 +39,8 @@
#include "scrnintstr.h"
#include "windowstr.h"
#include "extension.h"
+#define EVENT_SWAP_PTR
+#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
#include "swaprep.h"
#include "swapreq.h"
@@ -168,6 +170,7 @@ LOOKUP dixLookupTab[] = {
SYMVAR(XvScreenInitProc)
SYMVAR(XvGetScreenIndexProc)
SYMVAR(XvGetRTPortProc)
+ SYMVAR(XvMCScreenInitProc)
#endif
SYMVAR(ScreenSaverBlanking)
SYMVAR(WindowTable)
diff --git a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
index 32125dfa4..773665b37 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.35 2001/01/11 03:36:59 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.36 2001/04/01 14:00:14 tsi Exp $ */
/*
*
@@ -71,6 +71,10 @@ typedef Elf64_Sym Elf_Sym;
typedef Elf64_Rel Elf_Rel;
typedef Elf64_Rela Elf_Rela;
typedef Elf64_Addr Elf_Addr;
+typedef Elf64_Half Elf_Half;
+typedef Elf64_Off Elf_Off;
+typedef Elf64_Sword Elf_Sword;
+typedef Elf64_Word Elf_Word;
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
#define ELF_R_SYM ELF64_R_SYM
@@ -132,6 +136,10 @@ typedef Elf32_Sym Elf_Sym;
typedef Elf32_Rel Elf_Rel;
typedef Elf32_Rela Elf_Rela;
typedef Elf32_Addr Elf_Addr;
+typedef Elf32_Half Elf_Half;
+typedef Elf32_Off Elf_Off;
+typedef Elf32_Sword Elf_Sword;
+typedef Elf32_Word Elf_Word;
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
#define ELF_R_SYM ELF32_R_SYM
@@ -237,7 +245,7 @@ typedef struct {
typedef struct _elf_reloc {
Elf_Rel_t *rel;
ELFModulePtr file;
- unsigned char *secp;
+ Elf_Word secn;
struct _elf_reloc *next;
} ELFRelocRec;
@@ -259,14 +267,14 @@ static int ELFhashCleanOut(void *, itemPtr);
static char *ElfGetStringIndex(ELFModulePtr, int, int);
static char *ElfGetString(ELFModulePtr, int);
static char *ElfGetSectionName(ELFModulePtr, int);
-static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel_t *);
+static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, Elf_Word, Elf_Rel_t *);
static ELFCommonPtr ElfAddCOMMON(Elf_Sym *);
static int ElfCOMMONSize(void);
static int ElfCreateCOMMON(ELFModulePtr,LOOKUP *);
static char *ElfGetSymbolNameIndex(ELFModulePtr, int, int);
static char *ElfGetSymbolName(ELFModulePtr, int);
static Elf_Addr ElfGetSymbolValue(ELFModulePtr, int);
-static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel_t *, int);
+static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, Elf_Word, Elf_Rel_t *, int);
static ELFRelocPtr ELFCollectRelocations(ELFModulePtr, int);
static LOOKUP *ELF_GetSymbols(ELFModulePtr, unsigned short **);
static void ELFCollectSections(ELFModulePtr, int, int *, int *);
@@ -340,9 +348,9 @@ itemPtr item ;
* Manage listResolv
*/
static ELFRelocPtr
-ElfDelayRelocation(elffile,secp,rel)
+ElfDelayRelocation(elffile, secn, rel)
ELFModulePtr elffile;
-unsigned char *secp;
+Elf_Word secn;
Elf_Rel_t *rel;
{
ELFRelocPtr reloc;
@@ -352,13 +360,13 @@ Elf_Rel_t *rel;
return 0;
}
reloc->file=elffile;
- reloc->secp=secp;
+ reloc->secn=secn;
reloc->rel=rel;
reloc->next=0;
#ifdef ELFDEBUG
- ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx,"
+ ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %d,"
" r_offset 0x%lx, r_info 0x%x",
- reloc, elffile, secp, rel->r_offset, rel->r_info);
+ reloc, elffile, secn, rel->r_offset, rel->r_info);
#if defined(__powerpc__) || \
defined(__mc68000__) || \
defined(__alpha__) || \
@@ -799,6 +807,10 @@ int maxalign;
ELFGotPtr gots;
#endif
int gotsize;
+
+ /*
+ * XXX: Is it REALLY needed to ensure GOT's are non-null?
+ */
#ifdef ELFDEBUG
ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 );
@@ -1069,6 +1081,7 @@ long value;
case 2: memcpy((char *)data128 + 10, &data, 6); break;
default: FatalError("Unexpected slot in IA64InstallReloc()\n");
}
+ ia64_flush_cache(data128);
#ifdef ELFDEBUG
ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]);
#endif
@@ -1083,12 +1096,13 @@ long value;
* LoaderDefaultFunc) otherwise, the relocation will be deferred.
*/
static ELFRelocPtr
-Elf_RelocateEntry(elffile, secp, rel, force)
+Elf_RelocateEntry(elffile, secn, rel, force)
ELFModulePtr elffile;
-unsigned char *secp; /* Begining of the target section */
+Elf_Word secn;
Elf_Rel_t *rel;
int force;
{
+ unsigned char *secp = elffile->saddr[secn];
unsigned int *dest32; /* address of the 32 bit place being modified */
#if defined(__powerpc__) || defined(__mc68000__) || defined(__sparc__)
unsigned short *dest16; /* address of the 16 bit place being modified */
@@ -1132,7 +1146,7 @@ int force;
ELFDEBUG("***Unable to resolve symbol %s\n",
ElfGetSymbolName(elffile, ELF_R_SYM(rel->r_info)));
#endif
- return ElfDelayRelocation(elffile,secp,rel);
+ return ElfDelayRelocation(elffile, secn, rel);
}
}
}
@@ -1975,6 +1989,7 @@ int force;
if (rel->r_addend)
FatalError("\nAddend not supported for R_IA64_FPTR64LSB\n");
*dest64 = symval;
+ ia64_flush_cache(dest64);
break;
case R_IA64_DIR64LSB:
@@ -1987,6 +2002,7 @@ int force;
ELFDEBUG( "dest64=%lx\n", dest64 );
#endif
*dest64 = symval + rel->r_addend;
+ ia64_flush_cache(dest64);
break;
case R_IA64_GPREL22:
@@ -2022,14 +2038,9 @@ int index; /* The section to use as relocation data */
Elf_Shdr *sect=&(elffile->sections[index]);
Elf_Rel_t *rel=(Elf_Rel_t *)elffile->saddr[index];
Elf_Sym *syms;
- unsigned char *secp; /* Begining of the target section */
ELFRelocPtr reloc_head = NULL;
ELFRelocPtr tmp;
- secp=(unsigned char *)elffile->saddr[sect->sh_info];
- if (secp == NULL) {
- secp=(unsigned char *)(long)sect->sh_info;
- }
syms = (Elf_Sym *) elffile->saddr[elffile->symndx];
numrel=sect->sh_size/sect->sh_entsize;
@@ -2055,7 +2066,7 @@ int index; /* The section to use as relocation data */
}
}
#endif
- tmp = ElfDelayRelocation(elffile,secp,&(rel[i]));
+ tmp = ElfDelayRelocation(elffile, sect->sh_info, &(rel[i]));
tmp->next = reloc_head;
reloc_head = tmp;
}
@@ -2840,11 +2851,6 @@ LOOKUP **ppLookup;
}
xf86loaderfree(secttable);
- for (elf_reloc = _LoaderGetRelocations(v)->elf_reloc;
- elf_reloc; elf_reloc = elf_reloc->next)
- if ((unsigned long)elf_reloc->secp < elffile->numsh)
- elf_reloc->secp = (unsigned char *)elffile->saddr[(unsigned long)elf_reloc->secp];
-
#if defined(__ia64__)
ELFCreateOPD(elffile);
#endif
@@ -2886,10 +2892,10 @@ void *mod;
newlist = 0;
for (p = _LoaderGetRelocations(mod)->elf_reloc; p; ) {
#ifdef ELFDEBUG
- ErrorF("ResolveSymbols: file %lx, sec %lx, r_offset 0x%x, r_info 0x%lx\n",
- p->file, p->secp, p->rel->r_offset, p->rel->r_info);
+ ErrorF("ResolveSymbols: file %lx, sec %d, r_offset 0x%x, r_info 0x%lx\n",
+ p->file, p->secn, p->rel->r_offset, p->rel->r_info);
#endif
- tmp = Elf_RelocateEntry(p->file, p->secp, p->rel, FALSE);
+ tmp = Elf_RelocateEntry(p->file, p->secn, p->rel, FALSE);
if (tmp) {
/* Failed to relocate. Keep it in the list. */
tmp->next = newlist;
@@ -2914,7 +2920,7 @@ void *mod;
return 0;
while( erel ) {
- Elf_RelocateEntry(erel->file, erel->secp, erel->rel, TRUE);
+ Elf_RelocateEntry(erel->file, erel->secn, erel->rel, TRUE);
name = ElfGetSymbolName(erel->file, ELF_R_SYM(erel->rel->r_info));
flag = _LoaderHandleUnresolved(
name, _LoaderHandleToName(erel->file->handle));
diff --git a/xc/programs/Xserver/hw/xfree86/loader/hash.c b/xc/programs/Xserver/hw/xfree86/loader/hash.c
index ab5e22aad..997bc3ffd 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/hash.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/hash.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.17 2001/02/17 11:36:52 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.18 2001/02/22 23:17:09 dawes Exp $ */
/*
*
@@ -135,12 +135,9 @@ int handle;
int module;
LOOKUP *list ;
{
- LOOKUP *l = list;
- itemPtr i;
+ LOOKUP *l = list, *exports = NULL;
+ itemPtr i, exportsItem = NULL;
char *modname;
- char **exports = NULL;
- char **e;
- int found = 0;
if (!list)
return;
@@ -160,11 +157,9 @@ LOOKUP *list ;
sprintf(exportname, "%sExportedSymbols", modname);
while (l->symName) {
if (strcmp(l->symName, exportname) == 0) {
- exports = (char **)l->offset;
-#ifdef DEBUG
+ exports = l;
ErrorF("LoaderAddSymbols: %s: %s found\n", modname,
exportname);
-#endif
break;
}
l++;
@@ -173,42 +168,35 @@ LOOKUP *list ;
}
/*
- * Visit every symbol in the lookup table,
- * and add it to the given namespace if appropriate based on the
- * presence and content of an export list.
+ * Allocate the exports list item first.
+ */
+ if (exports) {
+ exportsItem = xf86loadermalloc( sizeof( itemRec )) ;
+ exportsItem->name = exports->symName ;
+ exportsItem->address = (char *) exports->offset ;
+ exportsItem->handle = handle ;
+ exportsItem->module = module ;
+ exportsItem->exports = NULL;
+ LoaderHashAdd( exportsItem );
+ }
+
+ /*
+ * Visit every symbol in the lookup table, tagging it with the
+ * reference to the export list, if present.
*/
l = list;
while ( l->symName ) {
- /* XXX This might be slow if lots of symbols are exported. */
- if (exports) {
- found = 0;
- for (e = exports; *e != NULL; e++) {
- if (strcmp(l->symName, *e) == 0) {
- found = 1;
- break;
- }
- }
- } else {
- found = 1;
- }
-#ifdef DEBUG
- ErrorF("LoaderAddSymbols: modname: Symbol \"%s\" %sexported\n",
- l->symName, found ? "" : "NOT");
-#endif
- if (found) {
+ if (l != exports) {
i = xf86loadermalloc( sizeof( itemRec )) ;
i->name = l->symName ;
i->address = (char *) l->offset ;
i->handle = handle ;
i->module = module ;
+ i->exports = exportsItem;
LoaderHashAdd( i );
}
l ++ ;
}
- /*
- * XXX It might be useful to check for exported symbols that weren't
- * actually present in the module, and print a warning for them.
- */
}
itemPtr
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.c b/xc/programs/Xserver/hw/xfree86/loader/loader.c
index 8af5fc48e..210213ff7 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loader.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/loader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.52 2001/02/16 02:14:21 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.53 2001/04/05 15:55:28 dawes Exp $ */
/*
*
@@ -365,7 +365,7 @@ _GetModuleType(int fd, long offset)
#endif
if (strncmp((char *) buf, ELFMAG, SELFMAG) == 0) {
- if( buf[ELFDLOFF] == ELFDLMAG ) {
+ if( *((Elf32_Half *)(buf + ELFDLOFF)) == ELFDLMAG ) {
return LD_ELFDLOBJECT;
} else {
return LD_ELFOBJECT;
@@ -1249,8 +1249,10 @@ LoaderCheckUnresolved(int delay_flag )
return ret;
}
+void xf86LoaderTrap(void);
+
void
-xf86LoaderTrap()
+xf86LoaderTrap(void)
{
}
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.h b/xc/programs/Xserver/hw/xfree86/loader/loader.h
index c9af8f011..a814544b8 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loader.h
+++ b/xc/programs/Xserver/hw/xfree86/loader/loader.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.24 2001/02/16 01:36:07 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.25 2001/02/22 23:17:09 dawes Exp $ */
/*
*
@@ -84,12 +84,14 @@ typedef struct _LoaderReloc {
AOUTRelocPtr aout_reloc;
} LoaderRelocRec, *LoaderRelocPtr;
+typedef struct _loader_item *itemPtr;
typedef struct _loader_item {
char *name ;
void *address ;
- struct _loader_item *next ;
+ itemPtr next ;
int handle ;
int module ;
+ itemPtr exports;
#if defined(__powerpc__)
/*
* PowerPC file formats require special routines in some circumstances
@@ -101,7 +103,7 @@ typedef struct _loader_item {
unsigned short glink[14]; /* XCOFF */
} code ;
#endif
- } itemRec, *itemPtr ;
+ } itemRec ;
/* The following structures provide an interface to GDB (note that GDB
has copies of the definitions - if you change anything here make
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
index 1df228a80..48e008a7a 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.63 2001/02/16 01:43:07 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.64 2001/03/27 23:42:17 dawes Exp $ */
/*
*
@@ -553,7 +553,7 @@ CheckVersion (const char *module, XF86ModuleVersionInfo *data,
data->modname ? data->modname : "UNKNOWN!",
data->vendor ? data->vendor : "UNKNOWN!");
- if (ver < 40000000) {
+ if (ver > (4 << 24)) {
/* 4.0.x and earlier */
verstr[1] = verstr[3] = 0;
verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
index 227ab0777..2be9e1c01 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.184 2001/02/18 16:41:14 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.190 2001/04/05 17:42:34 dawes Exp $ */
/*
*
@@ -43,6 +43,7 @@
#endif
#include "xf86OSmouse.h"
#include "xf86xv.h"
+#include "xf86xvmc.h"
#include "xf86cmap.h"
#include "xf86fbman.h"
#include "dgaproc.h"
@@ -52,7 +53,6 @@
#define DONT_DEFINE_WRAPPERS
#include "xf86_ansic.h"
#include "xisb.h"
-#include "xf86Priv.h"
#include "vbe.h"
#include "xf86sbusBus.h"
#include "compiler.h"
@@ -266,6 +266,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86FindScreenForEntity)
SYMFUNC(xf86FindPciDeviceVendor)
SYMFUNC(xf86FindPciClass)
+ SYMFUNC(xf86EnablePciBusMaster)
SYMFUNC(xf86RegisterStateChangeNotificationCallback)
SYMFUNC(xf86DeregisterStateChangeNotificationCallback)
SYMFUNC(xf86NoSharedResources)
@@ -459,6 +460,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86OptionValue)
SYMFUNC(xf86OptionListReport)
SYMFUNC(xf86SetIntOption)
+ SYMFUNC(xf86SetRealOption)
SYMFUNC(xf86SetStrOption)
SYMFUNC(xf86ReplaceIntOption)
SYMFUNC(xf86ReplaceStrOption)
@@ -516,6 +518,9 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86XVAllocateVideoAdaptorRec)
SYMFUNC(xf86XVFreeVideoAdaptorRec)
+ /* xf86xvmc.c */
+ SYMFUNC(xf86XvMCScreenInit)
+
/* xf86VidMode.c */
SYMFUNC(VidModeExtensionInit)
#ifdef XF86VIDMODE
@@ -563,8 +568,8 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(GetTimeInMillis)
/* xf86Xinput.c */
- SYMFUNC(xf86ProcessCommonOptions)
#ifdef XINPUT
+ SYMFUNC(xf86ProcessCommonOptions)
SYMFUNC(xf86IsCorePointer)
SYMFUNC(xf86PostMotionEvent)
SYMFUNC(xf86PostProximityEvent)
@@ -878,7 +883,6 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86WriteMmioNB32)
SYMFUNC(xf86WriteMmioNB16)
SYMFUNC(xf86WriteMmioNB8)
- SYMFUNC(memcpy)
#endif
#if defined(sun) && defined(SVR4)
SYMFUNC(inb)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c
index 81af01648..ec95306e8 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.1 2000/03/05 16:59:17 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.2 2001/02/27 23:05:00 alanh Exp $ */
#include "X.h"
#include "input.h"
@@ -29,18 +29,21 @@ writeDense32(int Value, pointer Base, register unsigned long Offset);
int
readDense8(pointer Base, register unsigned long Offset)
{
+ mem_barrier();
return *(volatile CARD8*) ((unsigned long)Base+(Offset));
}
int
readDense16(pointer Base, register unsigned long Offset)
{
+ mem_barrier();
return *(volatile CARD16*) ((unsigned long)Base+(Offset));
}
int
readDense32(pointer Base, register unsigned long Offset)
{
+ mem_barrier();
return *(volatile CARD32*)((unsigned long)Base+(Offset));
}
@@ -65,20 +68,20 @@ writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
void
writeDense8(int Value, pointer Base, register unsigned long Offset)
{
+ write_mem_barrier();
*(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value;
- mem_barrier();
}
void
writeDense16(int Value, pointer Base, register unsigned long Offset)
{
+ write_mem_barrier();
*(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value;
- mem_barrier();
}
void
writeDense32(int Value, pointer Base, register unsigned long Offset)
{
+ write_mem_barrier();
*(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value;
- mem_barrier();
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
index 2744d770e..f20bbaba1 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.41 2001/02/15 19:34:19 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.42 2001/02/27 23:05:00 alanh Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -1511,6 +1511,7 @@ readSparse8(pointer Base, register unsigned long Offset)
register unsigned long result, shift;
register unsigned long msb;
+ mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
shift = (Offset & 0x3) << 3;
if (Offset >= (hae_thresh)) {
@@ -1533,6 +1534,7 @@ readSparse16(pointer Base, register unsigned long Offset)
register unsigned long result, shift;
register unsigned long msb;
+ mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
shift = (Offset & 0x2) << 3;
if (Offset >= (hae_thresh)) {
@@ -1551,6 +1553,7 @@ readSparse16(pointer Base, register unsigned long Offset)
static int
readSparse32(pointer Base, register unsigned long Offset)
{
+ mem_barrier();
return *(vuip)((unsigned long)Base+(Offset));
}
@@ -1560,6 +1563,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int b = Value & 0xffU;
+ write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
@@ -1570,7 +1574,6 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
}
}
*(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
- mem_barrier();
}
static void
@@ -1579,6 +1582,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int w = Value & 0xffffU;
+ write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
@@ -1590,15 +1594,14 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
}
*(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
w * 0x00010001;
- mem_barrier();
}
static void
writeSparse32(int Value, pointer Base, register unsigned long Offset)
{
+ write_mem_barrier();
*(vuip)((unsigned long)Base + (Offset)) = Value;
- mem_barrier();
return;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd
index ff26c7628..61cba175f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd
@@ -1,5 +1,5 @@
# $FreeBSD$
-SUBDIR = drm tdfx gamma
+SUBDIR = drm tdfx mga gamma
.include <bsd.subdir.mk>
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c
index a26990112..37d17be54 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c
@@ -135,12 +135,12 @@ int drm_getmagic(dev_t kdev, u_long cmd, caddr_t data,
if (priv->magic) {
auth.magic = priv->magic;
} else {
- simple_lock(&lock);
do {
+ simple_lock(&lock);
if (!sequence) ++sequence; /* reserve 0 */
auth.magic = sequence++;
- } while (drm_find_file(dev, auth.magic));
simple_unlock(&lock);
+ } while (drm_find_file(dev, auth.magic));
priv->magic = auth.magic;
drm_add_magic(dev, priv, auth.magic);
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c
index 61becaa12..b9722973e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c
@@ -121,6 +121,7 @@ int drm_freelist_create(drm_freelist_t *bl, int count)
bl->low_mark = 0;
bl->high_mark = 0;
atomic_set(&bl->wfh, 0);
+/* bl->lock = SPIN_LOCK_UNLOCKED; */
++bl->initialized;
return 0;
}
@@ -159,6 +160,7 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
drm_histogram_compute(dev, buf);
#endif
buf->list = DRM_LIST_FREE;
+/*
do {
old = (unsigned long)bl->next;
buf->next = (void *)old;
@@ -169,6 +171,13 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
return 1;
}
} while (failed);
+*/
+
+ simple_lock(&bl->lock);
+ buf->next = bl->next;
+ bl->next = buf;
+ simple_unlock(&bl->lock);
+
atomic_inc(&bl->count);
if (atomic_read(&bl->count) > dma->buf_count) {
DRM_ERROR("%d of %d buffers free after addition of %d\n",
@@ -195,6 +204,7 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
if (!bl) return NULL;
/* Get buffer */
+/*
do {
old = (unsigned int)bl->next;
if (!old) {
@@ -210,6 +220,16 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
atomic_dec(&bl->count);
buf = (drm_buf_t *)old;
+*/
+ simple_lock(&bl->lock);
+ if(!bl->next){
+ simple_unlock(&bl->lock);
+ return NULL;
+ }
+ buf = bl->next;
+ bl->next = bl->next->next;
+ simple_unlock(&bl->lock);
+ atomic_dec(&bl->count);
buf->next = NULL;
buf->list = DRM_LIST_NONE;
DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n",
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c
index 1affcd1d0..ec295b2b2 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c
@@ -135,9 +135,12 @@ static int drm_flush_queue(drm_device_t *dev, int context)
if (atomic_read(&q->use_count) > 1) {
atomic_inc(&q->block_write);
atomic_inc(&q->block_count);
- error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0);
- if (error)
- return error;
+ for (;;) {
+ if (!DRM_BUFCOUNT(&q->waitlist)) break;
+ error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0);
+ if (error)
+ return error;
+ }
atomic_dec(&q->block_count);
}
atomic_dec(&q->use_count);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c
index 81c1b1a04..f60e21289 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c
@@ -95,7 +95,7 @@ void drm_mem_init(void)
/* drm_mem_info is called whenever a process reads /dev/drm/mem. */
-static int _drm_mem_info SYSCTL_HANDLER_ARGS
+static int _drm_mem_info DRM_SYSCTL_HANDLER_ARGS
{
drm_mem_stats_t *pt;
char buf[128];
@@ -127,7 +127,7 @@ static int _drm_mem_info SYSCTL_HANDLER_ARGS
return 0;
}
-int drm_mem_info SYSCTL_HANDLER_ARGS
+int drm_mem_info DRM_SYSCTL_HANDLER_ARGS
{
int ret;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c
index 3f6616ef7..6ca3fabc1 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c
@@ -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/bsd/drm/kernel/drm/proc.c,v 1.1 2000/06/17 00:03:30 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.2 2001/03/02 02:45:38 dawes Exp $
*
*/
@@ -165,7 +165,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len,
{
drm_device_t *dev = (drm_device_t *)data;
drm_map_t *map;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP" };
const char *type;
int i;
@@ -176,7 +176,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len,
"address mtrr\n\n");
for (i = 0; i < dev->map_count; i++) {
map = dev->maplist[i];
- if (map->type < 0 || map->type > 2) type = "??";
+ if (map->type < 0 || map->type > 3) type = "??";
else type = types[map->type];
DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
@@ -226,7 +226,7 @@ static int _drm_queues_info(char *buf, char **start, off_t offset, int len,
atomic_inc(&q->use_count);
DRM_PROC_PRINT_RET(atomic_dec(&q->use_count),
"%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
+ " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n",
i,
q->flags,
atomic_read(&q->use_count),
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c
index a890abac4..0bc04d222 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI$
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.1 2000/06/17 00:03:31 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.2 2001/03/02 02:45:38 dawes Exp $
*
*/
@@ -35,21 +35,21 @@
SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics");
-static int drm_name_info SYSCTL_HANDLER_ARGS;
-static int drm_vm_info SYSCTL_HANDLER_ARGS;
-static int drm_clients_info SYSCTL_HANDLER_ARGS;
-static int drm_queues_info SYSCTL_HANDLER_ARGS;
-static int drm_bufs_info SYSCTL_HANDLER_ARGS;
+static int drm_name_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS;
+static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS;
#if DRM_DEBUG_CODExx
-static int drm_vma_info SYSCTL_HANDLER_ARGS;
+static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS;
#endif
#if DRM_DMA_HISTOGRAM
-static int drm_histo_info SYSCTL_HANDLER_ARGS;
+static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS;
#endif
struct drm_sysctl_list {
const char *name;
- int (*f) SYSCTL_HANDLER_ARGS;
+ int (*f) DRM_SYSCTL_HANDLER_ARGS;
} drm_sysctl_list[] = {
{ "name", drm_name_info },
{ "mem", drm_mem_info },
@@ -137,7 +137,7 @@ int drm_sysctl_cleanup(drm_device_t *dev)
return 0;
}
-static int drm_name_info SYSCTL_HANDLER_ARGS
+static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
char buf[128];
@@ -155,11 +155,11 @@ static int drm_name_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int _drm_vm_info SYSCTL_HANDLER_ARGS
+static int _drm_vm_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_map_t *map;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP" };
const char *type;
int i;
char buf[128];
@@ -172,7 +172,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS
for (i = 0; i < dev->map_count; i++) {
map = dev->maplist[i];
- if (map->type < 0 || map->type > 2) type = "??";
+ if (map->type < 0 || map->type > 3) type = "??";
else type = types[map->type];
DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
@@ -192,7 +192,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_vm_info SYSCTL_HANDLER_ARGS
+static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -205,7 +205,7 @@ static int drm_vm_info SYSCTL_HANDLER_ARGS
}
-static int _drm_queues_info SYSCTL_HANDLER_ARGS
+static int _drm_queues_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int i;
@@ -221,7 +221,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS
atomic_inc(&q->use_count);
DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count),
"%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
+ " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n",
i,
q->flags,
atomic_read(&q->use_count),
@@ -243,7 +243,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_queues_info SYSCTL_HANDLER_ARGS
+static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -257,7 +257,7 @@ static int drm_queues_info SYSCTL_HANDLER_ARGS
/* drm_bufs_info is called whenever a process reads
hw.dri.0.bufs. */
-static int _drm_bufs_info SYSCTL_HANDLER_ARGS
+static int _drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_device_dma_t *dma = dev->dma;
@@ -293,7 +293,7 @@ static int _drm_bufs_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_bufs_info SYSCTL_HANDLER_ARGS
+static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -305,7 +305,7 @@ static int drm_bufs_info SYSCTL_HANDLER_ARGS
}
-static int _drm_clients_info SYSCTL_HANDLER_ARGS
+static int _drm_clients_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_file_t *priv;
@@ -327,7 +327,7 @@ static int _drm_clients_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_clients_info SYSCTL_HANDLER_ARGS
+static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -340,7 +340,7 @@ static int drm_clients_info SYSCTL_HANDLER_ARGS
#if DRM_DEBUG_CODExx
-static int _drm_vma_info SYSCTL_HANDLER_ARGS
+static int _drm_vma_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_vma_entry_t *pt;
@@ -412,7 +412,7 @@ static int _drm_vma_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_vma_info SYSCTL_HANDLER_ARGS
+static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
@@ -426,7 +426,7 @@ static int drm_vma_info SYSCTL_HANDLER_ARGS
#if DRM_DMA_HISTOGRAM
-static int _drm_histo_info SYSCTL_HANDLER_ARGS
+static int _drm_histo_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
drm_device_dma_t *dma = dev->dma;
@@ -498,9 +498,9 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS
} else {
DRM_SYSCTL_PRINT("lock none\n");
}
- DRM_SYSCTL_PRINT("context_flag 0x%08x\n", dev->context_flag);
- DRM_SYSCTL_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag);
- DRM_SYSCTL_PRINT("dma_flag 0x%08x\n", dev->dma_flag);
+ DRM_SYSCTL_PRINT("context_flag 0x%08lx\n", dev->context_flag);
+ DRM_SYSCTL_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag);
+ DRM_SYSCTL_PRINT("dma_flag 0x%08lx\n", dev->dma_flag);
DRM_SYSCTL_PRINT("queue_count %10d\n", dev->queue_count);
DRM_SYSCTL_PRINT("last_context %10d\n", dev->last_context);
@@ -541,7 +541,7 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS
return 0;
}
-static int drm_histo_info SYSCTL_HANDLER_ARGS
+static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS
{
drm_device_t *dev = arg1;
int ret;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h
index b62aff08d..7a1159c78 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h
@@ -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/bsd/drm/kernel/drmP.h,v 1.1 2000/06/17 00:03:28 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.3 2001/03/06 16:45:26 dawes Exp $
*
*/
@@ -49,11 +49,11 @@
#include <sys/sysctl.h>
#include <sys/select.h>
#include <sys/bus.h>
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
#include <sys/taskqueue.h>
#endif
-#if __FreeBSD_version >= 500006
+#if __FreeBSD_version >= 400006
#define DRM_AGP
#endif
@@ -73,6 +73,11 @@ typedef u_int32_t spinlock_t;
#define atomic_add(n, p) atomic_add_int(p, n)
#define atomic_sub(n, p) atomic_subtract_int(p, n)
+/* The version number here is a guess */
+#if __FreeBSD_version >= 500010
+#define callout_init(a) callout_init(a, 0)
+#endif
+
/* Fake this */
static __inline u_int32_t
test_and_set_bit(int b, volatile u_int32_t *p)
@@ -128,14 +133,14 @@ find_first_zero_bit(volatile u_int32_t *p, int max)
* Fake out the module macros for versions of FreeBSD where they don't
* exist.
*/
-#if __FreeBSD_version < 500002
+#if __FreeBSD_version < 400002
#define MODULE_VERSION(a,b) struct __hack
#define MODULE_DEPEND(a,b,c,d,e) struct __hack
#endif
-#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
+#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
also include looping detection. */
#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
@@ -340,6 +345,7 @@ typedef struct drm_freelist {
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
atomic_t wfh; /* If waiting for high mark */
+ struct simplelock lock; /* hope this doesn't need to be linux compatible */
} drm_freelist_t;
typedef struct drm_buf_entry {
@@ -509,15 +515,15 @@ typedef struct drm_device {
/* Context support */
struct resource *irq; /* Interrupt used by board */
void *irqh; /* Handle from bus_setup_intr */
- __volatile__ int context_flag; /* Context swapping flag */
- __volatile__ int interrupt_flag;/* Interruption handler flag */
- __volatile__ int dma_flag; /* DMA dispatch flag */
+ __volatile__ long context_flag; /* Context swapping flag */
+ __volatile__ long interrupt_flag;/* Interruption handler flag */
+ __volatile__ long dma_flag; /* DMA dispatch flag */
struct callout timer; /* Timer for delaying ctx switch */
int context_wait; /* Processes waiting on ctx switch */
int last_checked; /* Last context checked for DMA */
int last_context; /* Last current context */
int last_switch; /* Time at last context switch */
-#if __FreeBSD_version >= 500005
+#if __FreeBSD_version >= 400005
struct task task;
#endif
struct timespec ctx_start;
@@ -594,7 +600,13 @@ extern int drm_sysctl_cleanup(drm_device_t *dev);
/* Memory management support (memory.c) */
extern void drm_mem_init(void);
-extern int drm_mem_info SYSCTL_HANDLER_ARGS;
+
+#if __FreeBSD_version < 411000
+#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
+#else
+#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
+#endif
+extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS;
extern void *drm_alloc(size_t size, int area);
extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile
index f5635910b..37f3f5e7b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile
@@ -3,7 +3,7 @@
KMOD = gamma
SRCS = gamma_drv.c gamma_dma.c
SRCS += device_if.h bus_if.h pci_if.h
-CFLAGS += ${DEBUG_FLAGS} -I..
+CFLAGS += ${DEBUG_FLAGS} -I. -I..
KMODDEPS = drm
@:
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c
index 63f1b42b1..63515bab3 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c
@@ -188,7 +188,11 @@ int mga_rmctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p)
ctx = *(drm_ctx_t *) data;
DRM_DEBUG("%d\n", ctx.handle);
- if(ctx.handle != DRM_KERNEL_CONTEXT) {
+/*
+ if(ctx.handle == DRM_KERNEL_CONTEXT+1)
+ priv->remove_auth_on_close = 1;
+*/
+ if(ctx.handle != DRM_KERNEL_CONTEXT ) {
drm_ctxbitmap_free(dev, ctx.handle);
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c
index 7055d28da..85c29df7e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c
@@ -130,7 +130,6 @@ static int mga_freelist_init(drm_device_t *dev)
item->buf = buf;
buf_priv->my_freelist = item;
buf_priv->discard = 0;
- buf_priv->dispatched = 0;
dev_priv->head->next = item;
}
@@ -176,7 +175,7 @@ static __inline void mga_dma_quiescent(drm_device_t *dev)
atomic_read(&dev->total_irq),
atomic_read(&dma->total_lost));
DRM_ERROR("lockup\n");
- goto out_nolock;
+ return;
}
for (i = 0 ; i < 2000 ; i++) mga_delay();
}
@@ -188,15 +187,15 @@ static __inline void mga_dma_quiescent(drm_device_t *dev)
atomic_read(&dev->total_irq),
atomic_read(&dma->total_lost));
DRM_ERROR("lockup\n");
- goto out_status;
+ clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
+ return;
}
for (i = 0 ; i < 2000 ; i++) mga_delay();
}
sarea_priv->dirty |= MGA_DMA_FLUSH;
-out_status:
clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
-out_nolock:
+ DRM_DEBUG("exit, dispatch_status = 0x%02x\n",dev_priv->dispatch_status);
}
static void mga_reset_freelist(drm_device_t *dev)
@@ -236,20 +235,22 @@ drm_buf_t *mga_freelist_get(drm_device_t *dev)
set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status);
for (;;) {
mga_dma_schedule(dev, 0);
- if(!test_bit(MGA_IN_GETBUF,
- &dev_priv->dispatch_status))
+/* if(!test_bit(MGA_IN_GETBUF,
+ &dev_priv->dispatch_status)) */
+ if(dev_priv->tail->age < dev_priv->last_prim_age)
break;
atomic_inc(&dev->total_sleeps);
ret = tsleep(&dev_priv->buf_queue, PZERO|PCATCH,
"mgafg", 0);
- if (ret) {
+ if (ret == EINTR) {
clear_bit(MGA_IN_GETBUF,
&dev_priv->dispatch_status);
- splx(s);
- goto failed_getbuf;
+ break;
}
}
splx(s);
+ clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status);
+ if (ret) return NULL;
}
if(dev_priv->tail->age < dev_priv->last_prim_age) {
@@ -263,7 +264,6 @@ drm_buf_t *mga_freelist_get(drm_device_t *dev)
return next->buf;
}
-failed_getbuf:
failed++;
return NULL;
}
@@ -520,61 +520,55 @@ int mga_advance_primary(drm_device_t *dev)
static __inline int mga_decide_to_fire(drm_device_t *dev)
{
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
DRM_DEBUG("%s\n", __FUNCTION__);
if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) {
- atomic_inc(&dma->total_prio);
return 1;
}
if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) &&
dev_priv->next_prim->num_dwords) {
- atomic_inc(&dma->total_prio);
return 1;
}
if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) &&
dev_priv->next_prim->num_dwords) {
- atomic_inc(&dma->total_prio);
return 1;
}
if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) {
if(test_bit(MGA_BUF_SWAP_PENDING,
&dev_priv->next_prim->buffer_status)) {
- atomic_inc(&dma->total_dmas);
return 1;
}
}
if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) {
if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) {
- atomic_inc(&dma->total_hit);
return 1;
}
}
if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) {
if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) {
- atomic_inc(&dma->total_missed_free);
return 1;
}
}
- atomic_inc(&dma->total_tried);
return 0;
}
int mga_dma_schedule(drm_device_t *dev, int locked)
{
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
+ int retval =0 ;
+
+ if (!dev_priv) return EBUSY;
if (test_and_set_bit(0, &dev->dma_flag)) {
- atomic_inc(&dma->total_missed_dma);
- return EBUSY;
+ retval = EBUSY;
+ goto sch_out_wakeup;
}
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -591,17 +585,15 @@ int mga_dma_schedule(drm_device_t *dev, int locked)
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);
DRM_DEBUG("Not locked\n");
- return EBUSY;
+ retval = EBUSY;
+ goto sch_out_wakeup;
}
- DRM_DEBUG("I'm locked\n");
if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) {
/* Fire dma buffer */
if(mga_decide_to_fire(dev)) {
- DRM_DEBUG("idx :%d\n", dev_priv->next_prim->idx);
clear_bit(MGA_BUF_FORCE_FIRE,
&dev_priv->next_prim->buffer_status);
if(dev_priv->current_prim == dev_priv->next_prim) {
@@ -613,8 +605,6 @@ int mga_dma_schedule(drm_device_t *dev, int locked)
} else {
clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
}
- } else {
- DRM_DEBUG("I can't get the dispatch lock\n");
}
if (!locked) {
@@ -623,9 +613,9 @@ int mga_dma_schedule(drm_device_t *dev, int locked)
DRM_ERROR("\n");
}
}
-
+ clear_bit(0, &dev->dma_flag);
+sch_out_wakeup:
if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) &&
- dev_priv->next_prim->num_dwords == 0 &&
atomic_read(&dev_priv->pending_bufs) == 0) {
/* Everything has been processed by the hardware */
clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status);
@@ -633,18 +623,10 @@ int mga_dma_schedule(drm_device_t *dev, int locked)
}
if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) &&
- dev_priv->tail->age < dev_priv->last_prim_age) {
- clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status);
- DRM_DEBUG("Waking up buf queue\n");
+ dev_priv->tail->age < dev_priv->last_prim_age)
wakeup(&dev_priv->buf_queue);
- } else if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) {
- DRM_DEBUG("Not waking buf_queue on %d %d\n",
- atomic_read(&dev->total_irq),
- dev_priv->last_prim_age);
- }
- clear_bit(0, &dev->dma_flag);
- return 0;
+ return retval;
}
static void mga_dma_service(void *arg)
@@ -653,7 +635,6 @@ static void mga_dma_service(void *arg)
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
drm_mga_prim_buf_t *last_prim_buffer;
- DRM_DEBUG("%s\n", __FUNCTION__);
atomic_inc(&dev->total_irq);
if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return;
MGA_WRITE(MGAREG_ICLEAR, 0x00000001);
@@ -663,11 +644,11 @@ static void mga_dma_service(void *arg)
dev_priv->sarea_priv->last_dispatch =
dev_priv->last_prim_age = last_prim_buffer->prim_age;
clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status);
- wakeup(&dev_priv->wait_queue);
clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status);
clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
atomic_dec(&dev_priv->pending_bufs);
taskqueue_enqueue(taskqueue_swi, &dev->task);
+ wakeup(&dev_priv->wait_queue);
}
static void mga_dma_task_queue(void *device, int pending)
@@ -684,6 +665,8 @@ int mga_dma_cleanup(drm_device_t *dev)
drm_mga_private_t *dev_priv =
(drm_mga_private_t *) dev->dev_private;
+ if (dev->irq) mga_flush_queue(dev);
+ mga_dma_quiescent(dev);
if(dev_priv->ioremap) {
int temp = (dev_priv->warp_ucode_size +
dev_priv->primary_size +
@@ -723,9 +706,6 @@ int mga_dma_cleanup(drm_device_t *dev)
static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
drm_mga_private_t *dev_priv;
drm_map_t *sarea_map = NULL;
- int i;
-
- DRM_DEBUG("%s\n", __FUNCTION__);
dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
if(dev_priv == NULL) return ENOMEM;
@@ -760,8 +740,8 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
dev_priv->mAccess = init->mAccess;
dev_priv->flush_queue = 0;
- dev_priv->buf_queue = 0;
- dev_priv->WarpPipe = -1;
+ dev_priv->WarpPipe = 0xff000000;
+ dev_priv->vertexsize = 0;
DRM_DEBUG("chipset: %d ucode_size: %d backOffset: %x depthOffset: %x\n",
dev_priv->chipset, dev_priv->warp_ucode_size,
@@ -773,13 +753,6 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
memcpy(&dev_priv->WarpIndex, &init->WarpIndex,
sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES);
- for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++)
- DRM_DEBUG("warp pipe %d: installed: %d phys: %lx size: %x\n",
- i,
- dev_priv->WarpIndex[i].installed,
- dev_priv->WarpIndex[i].phys_addr,
- dev_priv->WarpIndex[i].size);
-
if(mga_init_primary_bufs(dev, init) != 0) {
DRM_ERROR("Can not initialize primary buffers\n");
mga_dma_cleanup(dev);
@@ -951,9 +924,7 @@ static int mga_flush_queue(drm_device_t *dev)
DRM_DEBUG("%s\n", __FUNCTION__);
- if(dev_priv == NULL) {
- return 0;
- }
+ if(!dev_priv) return 0;
if(dev_priv->next_prim->num_dwords != 0) {
s = splsofttq();
@@ -1065,7 +1036,7 @@ int mga_lock(dev_t kdev, u_long cmd, caddr_t data,
}
}
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
+ if (ret) DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
return ret;
}
@@ -1086,16 +1057,16 @@ int mga_flush_ioctl(dev_t kdev, u_long cmd, caddr_t data,
}
if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) {
- drm_mga_prim_buf_t *temp_buf =
- dev_priv->prim_bufs[dev_priv->current_prim_idx];
+ drm_mga_prim_buf_t *temp_buf;
+ temp_buf = dev_priv->current_prim;
- if(temp_buf && temp_buf->num_dwords) {
s = splsofttq();
+ if(temp_buf && temp_buf->num_dwords) {
set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status);
mga_advance_primary(dev);
+ }
mga_dma_schedule(dev, 1);
splx(s);
- }
}
if(lock.flags & _DRM_LOCK_QUIESCENT) {
mga_flush_queue(dev);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c
index 099372012..77d7c4409 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c
@@ -40,8 +40,8 @@ MODULE_DEPEND(mga, agp, 1, 1, 1);
#define MGA_NAME "mga"
#define MGA_DESC "Matrox g200/g400"
-#define MGA_DATE "19991213"
-#define MGA_MAJOR 1
+#define MGA_DATE "20000928"
+#define MGA_MAJOR 2
#define MGA_MINOR 0
#define MGA_PATCHLEVEL 0
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h
index 05c4d9d2e..9e51a20d0 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h
@@ -39,8 +39,8 @@
typedef struct {
u_int32_t buffer_status;
- unsigned int num_dwords;
- unsigned int max_dwords;
+ int num_dwords;
+ int max_dwords;
u_int32_t *current_dma_ptr;
u_int32_t *head;
u_int32_t phys_head;
@@ -50,7 +50,7 @@ typedef struct {
} drm_mga_prim_buf_t;
typedef struct _drm_mga_freelist {
- unsigned int age;
+ __volatile__ unsigned int age;
drm_buf_t *buf;
struct _drm_mga_freelist *next;
struct _drm_mga_freelist *prev;
@@ -82,6 +82,7 @@ typedef struct _drm_mga_private {
int use_agp;
drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES];
unsigned int WarpPipe;
+ unsigned int vertexsize;
atomic_t pending_bufs;
void *status_page;
unsigned long real_status_page;
@@ -191,12 +192,20 @@ typedef struct {
&tmp_buf->buffer_status)) { \
mga_advance_primary(dev); \
mga_dma_schedule(dev, 1); \
+ tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
} else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length ||\
tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \
set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \
mga_advance_primary(dev); \
mga_dma_schedule(dev, 1); \
+ tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
} \
+ if(MGA_VERBOSE) \
+ DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \
+ dma_ptr = tmp_buf->current_dma_ptr; \
+ num_dwords = tmp_buf->num_dwords; \
+ phys_head = tmp_buf->phys_head; \
+ outcount = 0; \
} while(0)
#define PRIMGETPTR(dev_priv) do { \
@@ -344,6 +353,73 @@ drm_mga_prim_buf_t *tmp_buf = \
#define MGAREG_YTOP 0x1c98
#define MGAREG_ZORG 0x1c0c
+/* Warp registers */
+#define MGAREG_WR0 0x2d00
+#define MGAREG_WR1 0x2d04
+#define MGAREG_WR2 0x2d08
+#define MGAREG_WR3 0x2d0c
+#define MGAREG_WR4 0x2d10
+#define MGAREG_WR5 0x2d14
+#define MGAREG_WR6 0x2d18
+#define MGAREG_WR7 0x2d1c
+#define MGAREG_WR8 0x2d20
+#define MGAREG_WR9 0x2d24
+#define MGAREG_WR10 0x2d28
+#define MGAREG_WR11 0x2d2c
+#define MGAREG_WR12 0x2d30
+#define MGAREG_WR13 0x2d34
+#define MGAREG_WR14 0x2d38
+#define MGAREG_WR15 0x2d3c
+#define MGAREG_WR16 0x2d40
+#define MGAREG_WR17 0x2d44
+#define MGAREG_WR18 0x2d48
+#define MGAREG_WR19 0x2d4c
+#define MGAREG_WR20 0x2d50
+#define MGAREG_WR21 0x2d54
+#define MGAREG_WR22 0x2d58
+#define MGAREG_WR23 0x2d5c
+#define MGAREG_WR24 0x2d60
+#define MGAREG_WR25 0x2d64
+#define MGAREG_WR26 0x2d68
+#define MGAREG_WR27 0x2d6c
+#define MGAREG_WR28 0x2d70
+#define MGAREG_WR29 0x2d74
+#define MGAREG_WR30 0x2d78
+#define MGAREG_WR31 0x2d7c
+#define MGAREG_WR32 0x2d80
+#define MGAREG_WR33 0x2d84
+#define MGAREG_WR34 0x2d88
+#define MGAREG_WR35 0x2d8c
+#define MGAREG_WR36 0x2d90
+#define MGAREG_WR37 0x2d94
+#define MGAREG_WR38 0x2d98
+#define MGAREG_WR39 0x2d9c
+#define MGAREG_WR40 0x2da0
+#define MGAREG_WR41 0x2da4
+#define MGAREG_WR42 0x2da8
+#define MGAREG_WR43 0x2dac
+#define MGAREG_WR44 0x2db0
+#define MGAREG_WR45 0x2db4
+#define MGAREG_WR46 0x2db8
+#define MGAREG_WR47 0x2dbc
+#define MGAREG_WR48 0x2dc0
+#define MGAREG_WR49 0x2dc4
+#define MGAREG_WR50 0x2dc8
+#define MGAREG_WR51 0x2dcc
+#define MGAREG_WR52 0x2dd0
+#define MGAREG_WR53 0x2dd4
+#define MGAREG_WR54 0x2dd8
+#define MGAREG_WR55 0x2ddc
+#define MGAREG_WR56 0x2de0
+#define MGAREG_WR57 0x2de4
+#define MGAREG_WR58 0x2de8
+#define MGAREG_WR59 0x2dec
+#define MGAREG_WR60 0x2df0
+#define MGAREG_WR61 0x2df4
+#define MGAREG_WR62 0x2df8
+#define MGAREG_WR63 0x2dfc
+
+
#define PDEA_pagpxfer_enable 0x2
#define WIA_wmode_suspend 0x0
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c
index 73029bbe1..fb3656310 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c
@@ -37,6 +37,20 @@
typedef u_int16_t u16;
typedef u_int32_t u32;
+#define MGAEMITCLIP_SIZE 10
+#define MGAEMITCTX_SIZE 20
+#define MGAG200EMITTEX_SIZE 20
+#define MGAG400EMITTEX0_SIZE 30
+#define MGAG400EMITTEX1_SIZE 25
+#define MGAG400EMITPIPE_SIZE 50
+#define MGAG200EMITPIPE_SIZE 15
+
+#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \
+ MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \
+ MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE)
+
+
+
static void mgaEmitClipRect(drm_mga_private_t * dev_priv,
drm_clip_rect_t * box)
{
@@ -49,6 +63,7 @@ static void mgaEmitClipRect(drm_mga_private_t * dev_priv,
PRIMGETPTR(dev_priv);
/* Force reset of dwgctl (eliminates clip disable) */
+ if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
#if 0
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_DWGSYNC, 0);
@@ -60,11 +75,11 @@ static void mgaEmitClipRect(drm_mga_private_t * dev_priv,
PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000);
#endif
-
+ }
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1));
- PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / 2);
- PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / 2);
+ PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp);
+ PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp);
PRIMADVANCE(dev_priv);
}
@@ -76,7 +91,7 @@ static void mgaEmitContext(drm_mga_private_t * dev_priv)
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- /* This takes a max of 15 dwords */
+ /* This takes a max of 20 dwords */
PRIMGETPTR(dev_priv);
PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]);
@@ -94,6 +109,12 @@ static void mgaEmitContext(drm_mga_private_t * dev_priv)
PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]);
PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]);
PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
+
+ PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]);
+ PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+
} else {
PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
PRIMOUTREG(MGAREG_DMAPAD, 0);
@@ -128,9 +149,9 @@ static void mgaG200EmitTex(drm_mga_private_t * dev_priv)
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(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]);
- PRIMOUTREG(0x2d00 + 34 * 4, regs[MGA_TEXREG_HEIGHT]);
+ PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]);
PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
PRIMOUTREG(MGAREG_DMAPAD, 0);
@@ -138,11 +159,12 @@ static void mgaG200EmitTex(drm_mga_private_t * dev_priv)
PRIMADVANCE(dev_priv);
}
+#define TMC_dualtex_enable 0x80
+
static void mgaG400EmitTex0(drm_mga_private_t * dev_priv)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int *regs = sarea_priv->TexState[0];
- int multitex = sarea_priv->WarpPipe & MGA_T2;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -163,22 +185,21 @@ static void mgaG400EmitTex0(drm_mga_private_t * dev_priv)
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(MGAREG_WR49, 0);
+
+ PRIMOUTREG(MGAREG_WR57, 0);
+ PRIMOUTREG(MGAREG_WR53, 0);
+ PRIMOUTREG(MGAREG_WR61, 0);
+ PRIMOUTREG(MGAREG_WR52, 0x40);
- PRIMOUTREG(0x2d00 + 57 * 4, 0);
- PRIMOUTREG(0x2d00 + 53 * 4, 0);
- PRIMOUTREG(0x2d00 + 61 * 4, 0);
+ PRIMOUTREG(MGAREG_WR60, 0x40);
+ PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40);
+ PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40);
PRIMOUTREG(MGAREG_DMAPAD, 0);
- if (!multitex) {
- PRIMOUTREG(0x2d00 + 52 * 4, 0x40);
- PRIMOUTREG(0x2d00 + 60 * 4, 0x40);
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_DMAPAD, 0);
- }
- PRIMOUTREG(0x2d00 + 54 * 4, regs[MGA_TEXREG_WIDTH] | 0x40);
- PRIMOUTREG(0x2d00 + 62 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40);
PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
@@ -212,14 +233,15 @@ static void mgaG400EmitTex1(drm_mga_private_t * dev_priv)
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(MGAREG_WR49, 0);
+
+ PRIMOUTREG(MGAREG_WR57, 0);
+ PRIMOUTREG(MGAREG_WR53, 0);
+ PRIMOUTREG(MGAREG_WR61, 0);
+ PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40);
- 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(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40);
- PRIMOUTREG(0x2d00 + 60 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40);
PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000);
@@ -227,12 +249,17 @@ static void mgaG400EmitTex1(drm_mga_private_t * dev_priv)
PRIMADVANCE(dev_priv);
}
+#define MAGIC_FPARAM_HEX_VALUE 0x46480000
+/* This is the hex value of 12800.0f which is a magic value we must
+ * set in wr56.
+ */
+
+
#define EMIT_PIPE 50
static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int pipe = sarea_priv->WarpPipe;
- float fParam = 12800.0f;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -266,14 +293,14 @@ static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000);
+ PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
+
PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
+ PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
}
PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807);
@@ -289,18 +316,20 @@ static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
PRIMOUTREG(MGAREG_WFLAG, 0);
PRIMOUTREG(MGAREG_WFLAG1, 0);
- PRIMOUTREG(0x2d00 + 56 * 4, *((u32 *) (&fParam)));
+ PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE);
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(MGAREG_WR49, 0); /* Tex stage 0 */
+ PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */
+ PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */
+ PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */
+
+
+ PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */
+ PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */
+ PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */
+ PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */
- 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);
@@ -326,12 +355,12 @@ static void mgaG200EmitPipe(drm_mga_private_t * 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(MGAREG_WR24, 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);
+ PRIMOUTREG(MGAREG_WR25, 0x100);
+ PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */
+ PRIMOUTREG(MGAREG_WR42, 0xFFFF);
+ PRIMOUTREG(MGAREG_WR60, 0xFFFF);
/* Dma pading required due to hw bug */
PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
@@ -495,7 +524,6 @@ static void mga_dma_dispatch_tex_blit(drm_device_t * dev,
y2 = length / 64;
PRIM_OVERFLOW(dev, dev_priv, 30);
- PRIMGETPTR(dev_priv);
PRIMOUTREG(MGAREG_DSTORG, destOrg);
PRIMOUTREG(MGAREG_MACCESS, 0x00000000);
@@ -513,10 +541,11 @@ static void mga_dma_dispatch_tex_blit(drm_device_t * dev,
PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16));
PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_SRCORG, 0);
PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
+
PRIMADVANCE(dev_priv);
}
@@ -529,7 +558,6 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
int length = buf->used;
int use_agp = PDEA_pagpxfer_enable;
int i = 0;
- int primary_needed;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -545,11 +573,16 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
* these numbers (Overestimating this doesn't hurt).
*/
buf_priv->dispatched = 1;
- primary_needed = (50 + 15 + 15 + 30 + 25 +
- 10 + 15 * MGA_NR_SAREA_CLIPRECTS);
- PRIM_OVERFLOW(dev, dev_priv, primary_needed);
+ PRIM_OVERFLOW(dev, dev_priv,
+ (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS)));
mgaEmitState(dev_priv);
+#if 0
+ length = dev_priv->vertexsize * 3 * 4;
+#endif
+
+
+
do {
if (i < sarea_priv->nbox) {
DRM_DEBUG("idx %d Emit box %d/%d:"
@@ -597,7 +630,6 @@ static void mga_dma_dispatch_indices(drm_device_t * dev,
unsigned int address = (unsigned int) buf->bus_address;
int use_agp = PDEA_pagpxfer_enable;
int i = 0;
- int primary_needed;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -611,9 +643,9 @@ static void mga_dma_dispatch_indices(drm_device_t * dev,
* these numbers (Overestimating this doesn't hurt).
*/
buf_priv->dispatched = 1;
- primary_needed = (50 + 15 + 15 + 30 + 25 +
- 10 + 15 * MGA_NR_SAREA_CLIPRECTS);
- PRIM_OVERFLOW(dev, dev_priv, primary_needed);
+ PRIM_OVERFLOW(dev, dev_priv,
+ (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS)));
+
mgaEmitState(dev_priv);
do {
@@ -639,6 +671,7 @@ static void mga_dma_dispatch_indices(drm_device_t * dev,
SETADD_mode_vertlist));
PRIMOUTREG(MGAREG_SETUPEND,
((address + end) | use_agp));
+
PRIMADVANCE(dev_priv);
} while (++i < sarea_priv->nbox);
}
@@ -653,7 +686,10 @@ static void mga_dma_dispatch_indices(drm_device_t * dev,
static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
unsigned int clear_color,
- unsigned int clear_zval)
+ unsigned int clear_zval,
+ unsigned int clear_colormask,
+ unsigned int clear_depthmask)
+
{
drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -662,7 +698,6 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
drm_clip_rect_t *pbox = sarea_priv->boxes;
unsigned int cmd;
int i;
- int primary_needed;
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
@@ -671,11 +706,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
else
cmd = MGA_CLEAR_CMD | DC_atype_rstr;
- primary_needed = nbox * 70;
- if (primary_needed == 0)
- primary_needed = 70;
- PRIM_OVERFLOW(dev, dev_priv, primary_needed);
- PRIMGETPTR(dev_priv);
+ PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS);
for (i = 0; i < nbox; i++) {
unsigned int height = pbox[i].y2 - pbox[i].y1;
@@ -687,7 +718,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
if (flags & MGA_FRONT) {
DRM_DEBUG("clear front\n");
PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_PLNWT, clear_colormask);
PRIMOUTREG(MGAREG_YDSTLEN,
(pbox[i].y1 << 16) | height);
PRIMOUTREG(MGAREG_FXBNDRY,
@@ -702,7 +733,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
if (flags & MGA_BACK) {
DRM_DEBUG("clear back\n");
PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_PLNWT, clear_colormask);
PRIMOUTREG(MGAREG_YDSTLEN,
(pbox[i].y1 << 16) | height);
PRIMOUTREG(MGAREG_FXBNDRY,
@@ -717,7 +748,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
if (flags & MGA_DEPTH) {
DRM_DEBUG("clear depth\n");
PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_PLNWT, clear_depthmask);
PRIMOUTREG(MGAREG_YDSTLEN,
(pbox[i].y1 << 16) | height);
PRIMOUTREG(MGAREG_FXBNDRY,
@@ -746,31 +777,32 @@ static void mga_dma_dispatch_swap(drm_device_t * dev)
int nbox = sarea_priv->nbox;
drm_clip_rect_t *pbox = sarea_priv->boxes;
int i;
- int primary_needed;
+ int pixel_stride = dev_priv->stride / dev_priv->cpp;
+
PRIMLOCALS;
DRM_DEBUG("%s\n", __FUNCTION__);
- primary_needed = nbox * 5;
- primary_needed += 60;
- PRIM_OVERFLOW(dev, dev_priv, primary_needed);
- PRIMGETPTR(dev_priv);
+ PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20);
+
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0x7100);
+ PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset);
PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess);
PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset);
- PRIMOUTREG(MGAREG_AR5, dev_priv->stride / 2);
+ PRIMOUTREG(MGAREG_AR5, pixel_stride);
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(MGAREG_DMAPAD, 0);
PRIMOUTREG(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 / 2;
-
- DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n",
- pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2);
+ unsigned int start = pbox[i].y1 * pixel_stride;
PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1);
PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1);
@@ -814,7 +846,10 @@ int mga_clear_bufs(dev_t kdev, u_long cmd, caddr_t data,
*/
dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
mga_dma_dispatch_clear(dev, clear.flags,
- clear.clear_color, clear.clear_depth);
+ clear.clear_color,
+ clear.clear_depth,
+ clear.clear_color_mask,
+ clear.clear_depth_mask);
PRIMUPDATE(dev_priv);
mga_flush_write_combine();
s = splsofttq();
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile
index 471a5fbfd..4362a5ba4 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile
@@ -3,7 +3,7 @@
KMOD = tdfx
SRCS = tdfx_drv.c tdfx_context.c
SRCS += device_if.h bus_if.h pci_if.h
-CFLAGS += ${DEBUG_FLAGS} -I..
+CFLAGS += ${DEBUG_FLAGS} -I. -I..
KMODDEPS = drm
@:
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c
index 91e7d5603..202df7c34 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c
@@ -42,7 +42,7 @@ MODULE_DEPEND(tdfx, agp, 1, 1, 1);
#define TDFX_NAME "tdfx"
#define TDFX_DESC "tdfx"
-#define TDFX_DATE "19991009"
+#define TDFX_DATE "20000928"
#define TDFX_MAJOR 1
#define TDFX_MINOR 0
#define TDFX_PATCHLEVEL 0
@@ -64,6 +64,9 @@ static int tdfx_probe(device_t dev)
case 0x0005121a:
s = "3Dfx Voodoo 3 graphics accelerator";
break;
+ case 0x0009121a:
+ s = "3Dfx Voodoo 5 graphics accelerator";
+ break;
}
if (s) {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
index 5fe6fa30a..c849eb7c5 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.43 2001/01/06 20:19:15 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.45 2001/03/25 05:32:13 tsi Exp $ */
/*
* Pci.c - New server PCI access functions
*
@@ -559,7 +559,7 @@ pciGetBaseSize(PCITAG tag, int index, Bool destructive, Bool *min)
else
mask1 = PCIGETIO(mask1);
else
- mask1 = PCIGETROM(mask1);
+ mask1 = PCIGETROM(mask1);
if (mask1 == 0)
return 0;
bits = 0;
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 9fe0038fc..a39b3cc51 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
@@ -62,7 +62,7 @@ obj-$(CONFIG_DRM_MGA) += mga.o
obj-$(CONFIG_DRM_I810) += i810.o
-# When linking into the kernel, link the library just once.
+# When linking into the kernel, link the library just once.
# If making modules, we include the library into each module
lib-objs-mod := $(patsubst %.o,%-mod.o,$(lib-objs))
@@ -75,7 +75,7 @@ endif
include $(TOPDIR)/Rules.make
-$(patsubst %.o,%.c,$(lib-objs-mod)):
+$(patsubst %.o,%.c,$(lib-objs-mod)):
@ln -sf $(subst -mod,,$@) $@
drmlib-mod.a: $(lib-objs-mod)
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 9cea44db6..470c25b38 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
@@ -23,7 +23,7 @@
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-#
+#
#
# ***** NOTE NOTE NOTE NOTE NOTE *****
# To override the automatic Linux source tree determination, pass the
@@ -47,32 +47,34 @@
# **** End of SMP/MODVERSIONS detection
-MODS= gamma.o tdfx.o r128.o radeon.o
-LIBS= libdrm.a
+MODS = gamma.o tdfx.o
+LIBS =
-DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
- lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
-DRMHEADERS= drm.h drmP.h compat-pre24.h
+DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \
+ drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_lists.h \
+ drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h
+DRMHEADERS = drm.h drmP.h compat-pre24.h
-GAMMAOBJS= gamma_drv.o gamma_dma.o
-GAMMAHEADERS= gamma_drv.h $(DRMHEADERS)
+GAMMAOBJS = gamma_drv.o gamma_dma.o
+GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES)
-TDFXOBJS= tdfx_drv.o tdfx_context.o
-TDFXHEADERS= tdfx_drv.h $(DRMHEADERS)
+TDFXOBJS = tdfx_drv.o
+TDFXHEADERS = tdfx.h $(DRMHEADERS)
-INC= /usr/include
+INC = /usr/include
-CFLAGS= -O2 $(WARNINGS)
-WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
+CFLAGS = -O2 $(WARNINGS)
+WARNINGS = -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
-Wstrict-prototypes -Wnested-externs \
-Wpointer-arith
# -Wshadow -Winline -- make output too noisy
-MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
-PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
+MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
+PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
-D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \
-I../../../../../../include -I../../../../../../../../include \
- -I../../../../../../../../programs/Xserver/hw/xfree86/common
-PRGLIBS=
+ -I../../../../../../../../programs/Xserver/hw/xfree86/common \
+ -I. -I../../.. -I../../../../../../../../lib/X11
+PRGLIBS =
# **** Start of SMP/MODVERSIONS detection
@@ -128,25 +130,29 @@ endif
ifeq ($(AGP),1)
MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE
-DRMOBJS += agpsupport.o
-MODS += mga.o
+DRMTEMPLATES += drm_agpsupport.h
+DRMHEADERS += agpsupport-pre24.h
+MODS += mga.o r128.o radeon.o
ifeq ($(MACHINE),i386)
MODS += i810.o
endif
+ifeq ($(MACHINE),i686)
+MODS += i810.o
+endif
-MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_context.o mga_state.o
-MGAHEADERS= mga_drv.h $(DRMHEADERS)
+MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o
+MGAHEADERS = mga.h mga_drv.h mga_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
-I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o
-I810HEADERS= i810_drv.h $(DRMHEADERS)
+I810OBJS = i810_drv.o i810_dma.o
+I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
-R128OBJS= r128_drv.o r128_cce.o r128_bufs.o r128_context.o r128_state.o
-R128HEADERS= r128_drv.h r128_drm.h $(DRMHEADERS)
+R128OBJS = r128_drv.o r128_cce.o r128_state.o
+R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
-RADEONOBJS= radeon_drv.o radeon_cp.o radeon_bufs.o radeon_context.o \
- radeon_state.o
-RADEONHEADERS= radeon_drv.h radeon_drm.h $(DRMHEADERS)
+RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o
+RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \
+ $(DRMTEMPLATES)
endif
ifeq ($(SIS),1)
@@ -167,6 +173,9 @@ all::;@echo === KERNEL HEADERS IN $(TREE)
all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${AGP}
all::;@echo === kill_fasync has $(PARAMS) parameters
all::;@echo === Compiling for machine $(MACHINE)
+all::;@echo === WARNING
+all::;@echo === WARNING 2.4.0 kernels before 2.4.0-test11 DO NOT WORK
+all::;@echo === WARNING
ifeq ($(MODULES),0)
all::;@echo
@@ -193,13 +202,12 @@ endif
# **** End of configuration
-libdrm.a: $(DRMOBJS)
- -$(RM) -f $@
- $(AR) rcs $@ $(DRMOBJS)
+dristat: dristat.c
+ $(CC) $(PRGCFLAGS) $< -o $@
gamma_drv.o: gamma_drv.c
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
-gamma.o: $(GAMMAOBJS) $(LIBS)
+gamma.o: $(GAMMAOBJS)
$(LD) -r $^ -o $@
tdfx_drv.o: tdfx_drv.c
@@ -213,7 +221,7 @@ sis.o: $(SISOBJS) $(LIBS)
ifeq ($(AGP),1)
mga_drv.o: mga_drv.c
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
-mga.o: $(MGAOBJS) $(LIBS)
+mga.o: $(MGAOBJS)
$(LD) -r $^ -o $@
i810_drv.o: i810_drv.c
@@ -245,7 +253,6 @@ ChangeLog:
%.o: %.c
$(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@
-$(DRMOBJS): $(DRMHEADERS)
$(GAMMAOBJS): $(GAMMAHEADERS)
$(TDFXOBJS): $(TDFXHEADERS)
ifeq ($(AGP),1)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h
index f6dae008d..0ad96b12a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h
@@ -45,6 +45,7 @@
/* This is a hack that only works for
this code base -- because we always
call this with dev->tq.* */
+#undef INIT_LIST_HEAD
#define INIT_LIST_HEAD(pointer) dev->tq.next = NULL
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c
new file mode 100644
index 000000000..47193ab46
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c
@@ -0,0 +1,280 @@
+/* dristat.c --
+ * Created: Mon Jan 15 05:05:07 2001 by faith@acm.org
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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@valinux.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "../../../xf86drm.h"
+#include "../xf86drmRandom.c"
+#include "../xf86drmHash.c"
+#include "../xf86drm.c"
+
+#define DRM_VERSION 0x00000001
+#define DRM_MEMORY 0x00000002
+#define DRM_CLIENTS 0x00000004
+#define DRM_STATS 0x00000008
+#define DRM_BUSID 0x00000010
+
+static void getversion(int fd)
+{
+ drmVersionPtr version;
+
+ version = drmGetVersion(fd);
+ if (version) {
+ printf(" Version information:\n");
+ printf(" Name: %s\n", version->name ? version->name : "?");
+ printf(" Version: %d.%d.%d\n",
+ version->version_major,
+ version->version_minor,
+ version->version_patchlevel);
+ printf(" Date: %s\n", version->date ? version->date : "?");
+ printf(" Desc: %s\n", version->desc ? version->desc : "?");
+ drmFreeVersion(version);
+ } else {
+ printf(" No version information available\n");
+ }
+}
+
+static void getbusid(int fd)
+{
+ const char *busid = drmGetBusid(fd);
+
+ printf(" Busid: %s\n", *busid ? busid : "(not set)");
+ drmFreeBusid(busid);
+}
+
+#if 0
+typedef struct {
+ unsigned long offset; /* Requested physical address (0 for SAREA)*/
+ unsigned long size; /* Requested physical size (bytes) */
+ drm_map_type_t type; /* Type of memory to map */
+ drm_map_flags_t flags; /* Flags */
+ void *handle; /* User-space: "Handle" to pass to mmap */
+ /* Kernel-space: kernel-virtual address */
+ int mtrr; /* MTRR slot used */
+ /* Private data */
+} drmVmRec, *drmVmPtr;
+#endif
+
+static void getvm(int fd)
+{
+ int i;
+ const char *typename;
+ char flagname[33];
+ drmHandle offset;
+ drmSize size;
+ drmMapType type;
+ drmMapFlags flags;
+ drmHandle handle;
+ int mtrr;
+
+ printf(" VM map information (Restricted locked kernel WC Lock):\n");
+ printf(" slot offset size type flags address mtrr\n");
+
+ for (i = 0;
+ !drmGetMap(fd, i, &offset, &size, &type, &flags, &handle, &mtrr);
+ i++) {
+
+ switch (type) {
+ case DRM_FRAME_BUFFER: typename = "FB"; break;
+ case DRM_REGISTERS: typename = "REG"; break;
+ case DRM_SHM: typename = "SHM"; break;
+ case DRM_AGP: typename = "AGP"; break;
+ default: typename = "???"; break;
+ }
+
+ flagname[0] = (flags & DRM_RESTRICTED) ? 'R' : ' ';
+ flagname[1] = (flags & DRM_READ_ONLY) ? 'r' : 'w';
+ flagname[2] = (flags & DRM_LOCKED) ? 'l' : ' ';
+ flagname[3] = (flags & DRM_KERNEL) ? 'k' : ' ';
+ flagname[4] = (flags & DRM_WRITE_COMBINING) ? 'W' : ' ';
+ flagname[5] = (flags & DRM_CONTAINS_LOCK) ? 'L' : ' ';
+ flagname[6] = '\0';
+
+ printf(" %4d 0x%08lx 0x%08lx %3.3s %6.6s 0x%08lx ",
+ i, offset, (unsigned long)size, typename, flagname, handle);
+ if (mtrr < 0) printf("none\n");
+ else printf("%4d\n", mtrr);
+ }
+}
+
+static void getclients(int fd)
+{
+ int i;
+ int auth;
+ int pid;
+ int uid;
+ unsigned long magic;
+ unsigned long iocs;
+ char buf[64];
+ char cmd[40];
+ int procfd;
+
+ printf(" DRI client information:\n");
+ printf(" a pid uid magic ioctls prog\n");
+
+ for (i = 0; !drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs); i++) {
+ sprintf(buf, "/proc/%d/cmdline", pid);
+ memset(cmd, sizeof(cmd), 0);
+ if ((procfd = open(buf, O_RDONLY, 0)) >= 0) {
+ read(procfd, cmd, sizeof(cmd)-1);
+ close(procfd);
+ }
+ if (*cmd) {
+ char *pt;
+
+ for (pt = cmd; *pt; pt++) if (!isprint(*pt)) *pt = ' ';
+ printf(" %c %5d %5d %10lu %10lu %s\n",
+ auth ? 'y' : 'n', pid, uid, magic, iocs, cmd);
+ } else {
+ printf(" %c %5d %5d %10lu %10lu\n",
+ auth ? 'y' : 'n', pid, uid, magic, iocs);
+ }
+ }
+}
+
+static void printhuman(unsigned long value, const char *name, int mult)
+{
+ const char *p;
+ double f;
+ /* Print width 5 number in width 6 space */
+ if (value < 100000) {
+ printf(" %5lu", value);
+ return;
+ }
+
+ p = name;
+ f = (double)value / (double)mult;
+ if (f < 10.0) {
+ printf(" %4.2f%c", f, *p);
+ return;
+ }
+
+ p++;
+ f = (double)value / (double)mult;
+ if (f < 10.0) {
+ printf(" %4.2f%c", f, *p);
+ return;
+ }
+
+ p++;
+ f = (double)value / (double)mult;
+ if (f < 10.0) {
+ printf(" %4.2f%c", f, *p);
+ return;
+ }
+}
+
+static void getstats(int fd, int i)
+{
+ drmStatsT prev, curr;
+ int j;
+ double rate;
+
+ printf(" System statistics:\n");
+
+ if (drmGetStats(fd, &prev)) return;
+ if (!i) {
+ for (j = 0; j < prev.count; j++) {
+ printf(" ");
+ printf(prev.data[j].long_format, prev.data[j].long_name);
+ if (prev.data[j].isvalue) printf(" 0x%08lx\n", prev.data[j].value);
+ else printf(" %10lu\n", prev.data[j].value);
+ }
+ return;
+ }
+
+ printf(" ");
+ for (j = 0; j < prev.count; j++)
+ if (!prev.data[j].verbose) {
+ printf(" ");
+ printf(prev.data[j].rate_format, prev.data[j].rate_name);
+ }
+ printf("\n");
+
+ for (;;) {
+ sleep(i);
+ if (drmGetStats(fd, &curr)) return;
+ printf(" ");
+ for (j = 0; j < curr.count; j++) {
+ if (curr.data[j].verbose) continue;
+ if (curr.data[j].isvalue) {
+ printf(" %08lx", curr.data[j].value);
+ } else {
+ rate = (curr.data[j].value - prev.data[j].value) / (double)i;
+ printhuman(rate, curr.data[j].mult_names, curr.data[j].mult);
+ }
+ }
+ printf("\n");
+ memcpy(&prev, &curr, sizeof(prev));
+ }
+
+}
+
+int main(int argc, char **argv)
+{
+ int c;
+ int mask = 0;
+ int minor = 0;
+ int interval = 0;
+ int fd;
+ char buf[64];
+ int i;
+
+ while ((c = getopt(argc, argv, "avmcsbM:i:")) != EOF)
+ switch (c) {
+ case 'a': mask = ~0; break;
+ case 'v': mask |= DRM_VERSION; break;
+ case 'm': mask |= DRM_MEMORY; break;
+ case 'c': mask |= DRM_CLIENTS; break;
+ case 's': mask |= DRM_STATS; break;
+ case 'b': mask |= DRM_BUSID; break;
+ case 'i': interval = strtol(optarg, NULL, 0); break;
+ case 'M': minor = strtol(optarg, NULL, 0); break;
+ default:
+ fprintf( stderr, "Usage: dristat [options]\n" );
+ return 1;
+ }
+
+ for (i = 0; i < 16; i++) if (!minor || i == minor) {
+ sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i);
+ fd = drmOpenMinor(i, 1);
+ if (fd >= 0) {
+ printf("%s\n", buf);
+ if (mask & DRM_BUSID) getbusid(fd);
+ if (mask & DRM_VERSION) getversion(fd);
+ if (mask & DRM_MEMORY) getvm(fd);
+ if (mask & DRM_CLIENTS) getclients(fd);
+ if (mask & DRM_STATS) getstats(fd, interval);
+ close(fd);
+ }
+ }
+
+ return 0;
+}
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 dc3d262d4..f1abaabff 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
@@ -19,10 +19,10 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * 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@valinux.com>
@@ -36,6 +36,7 @@
#define _DRM_H_
#if defined(__linux__)
+#include <linux/config.h>
#include <asm/ioctl.h> /* For _IO* macros */
#define DRM_IOCTL_NR(n) _IOC_NR(n)
#elif defined(__FreeBSD__)
@@ -43,15 +44,8 @@
#define DRM_IOCTL_NR(n) ((n) & 0xff)
#endif
-#define DRM_PROC_DEVICES "/proc/devices"
-#define DRM_PROC_MISC "/proc/misc"
-#define DRM_PROC_DRM "/proc/drm"
-#define DRM_DEV_DRM "/dev/drm"
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-#define DRM_DEV_UID 0
-#define DRM_DEV_GID 0
-
-
+#define DRM_MAJOR 226
+#define DRM_MAX_MINOR 15
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */
@@ -72,12 +66,20 @@ typedef unsigned int drm_magic_t;
* XF86DRIClipRectRec in the server as well */
typedef struct drm_clip_rect {
- unsigned short x1;
- unsigned short y1;
- unsigned short x2;
- unsigned short y2;
+ unsigned short x1;
+ unsigned short y1;
+ unsigned short x2;
+ unsigned short y2;
} drm_clip_rect_t;
+typedef struct drm_tex_region {
+ unsigned char next;
+ unsigned char prev;
+ unsigned char in_use;
+ unsigned char padding;
+ unsigned int age;
+} drm_tex_region_t;
+
/* Seperate include files for the i810/mga/r128 specific structures */
#include "mga_drm.h"
#include "i810_drm.h"
@@ -136,9 +138,15 @@ typedef enum drm_map_flags {
_DRM_LOCKED = 0x04, /* shared, cached, locked */
_DRM_KERNEL = 0x08, /* kernel requires access */
_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */
- _DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */
+ _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */
+ _DRM_REMOVABLE = 0x40 /* Removable mapping */
} drm_map_flags_t;
+typedef struct drm_ctx_priv_map {
+ unsigned int ctx_id; /* Context requesting private mapping */
+ void *handle; /* Handle of map */
+} drm_ctx_priv_map_t;
+
typedef struct drm_map {
unsigned long offset; /* Requested physical address (0 for SAREA)*/
unsigned long size; /* Requested physical size (bytes) */
@@ -150,6 +158,44 @@ typedef struct drm_map {
/* Private data */
} drm_map_t;
+typedef struct drm_client {
+ int idx; /* Which client desired? */
+ int auth; /* Is client authenticated? */
+ unsigned long pid; /* Process id */
+ unsigned long uid; /* User id */
+ unsigned long magic; /* Magic */
+ unsigned long iocs; /* Ioctl count */
+} drm_client_t;
+
+typedef enum {
+ _DRM_STAT_LOCK,
+ _DRM_STAT_OPENS,
+ _DRM_STAT_CLOSES,
+ _DRM_STAT_IOCTLS,
+ _DRM_STAT_LOCKS,
+ _DRM_STAT_UNLOCKS,
+ _DRM_STAT_VALUE, /* Generic value */
+ _DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */
+ _DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */
+
+ _DRM_STAT_IRQ, /* IRQ */
+ _DRM_STAT_PRIMARY, /* Primary DMA bytes */
+ _DRM_STAT_SECONDARY, /* Secondary DMA bytes */
+ _DRM_STAT_DMA, /* DMA */
+ _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */
+ _DRM_STAT_MISSED /* Missed DMA opportunity */
+
+ /* Add to the *END* of the list */
+} drm_stat_type_t;
+
+typedef struct drm_stats {
+ unsigned long count;
+ struct {
+ unsigned long value;
+ drm_stat_type_t type;
+ } data[15];
+} drm_stats_t;
+
typedef enum drm_lock_flags {
_DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
_DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
@@ -309,6 +355,9 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t)
#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t)
#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t)
+#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t)
+#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t)
+#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t)
#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t)
#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t)
@@ -322,6 +371,11 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t)
#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t)
+#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t)
+
+#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t)
+#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t)
+
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t)
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t)
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t)
@@ -345,17 +399,18 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
-/* Mga specific ioctls */
+/* MGA specific ioctls */
#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)
-#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t)
-#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t )
+#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t)
+#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42)
+#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43)
+#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t)
+#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t)
#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t)
-#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x47, drm_mga_blit_t)
+#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t)
+#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t)
-/* I810 specific ioctls */
+/* i810 specific ioctls */
#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t)
#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t)
#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t)
@@ -395,7 +450,7 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t)
#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t)
#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t)
-#define DRM_IOCTL_RADEON_BLIT DRM_IOW( 0x4b, drm_radeon_blit_t)
+#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4b, drm_radeon_texture_t)
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
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 affeae705..274e318aa 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
@@ -11,22 +11,22 @@
* 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
+ * 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@valinux.com>
- *
+ * Gareth Hughes <gareth@valinux.com>
*/
#ifndef _DRM_P_H_
@@ -73,11 +73,46 @@
#if LINUX_VERSION_CODE < 0x020400
#include "compat-pre24.h"
#endif
+#include <asm/pgalloc.h>
#include "drm.h"
+/* DRM template customization defaults
+ */
+#ifndef __HAVE_AGP
+#define __HAVE_AGP 0
+#endif
+#ifndef __HAVE_MTRR
+#define __HAVE_MTRR 0
+#endif
+#ifndef __HAVE_CTX_BITMAP
+#define __HAVE_CTX_BITMAP 0
+#endif
+#ifndef __HAVE_DMA
+#define __HAVE_DMA 0
+#endif
+#ifndef __HAVE_DMA_IRQ
+#define __HAVE_DMA_IRQ 0
+#endif
+#ifndef __HAVE_DMA_WAITLIST
+#define __HAVE_DMA_WAITLIST 0
+#endif
+#ifndef __HAVE_DMA_FREELIST
+#define __HAVE_DMA_FREELIST 0
+#endif
+#ifndef __HAVE_DMA_HISTOGRAM
+#define __HAVE_DMA_HISTOGRAM 0
+#endif
+
+#define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \
+ defined(CONFIG_AGP_MODULE)))
+#define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR))
+
+
+/* Begin the DRM...
+ */
+
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
also include looping detection. */
-#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
@@ -109,6 +144,7 @@
#define DRM_MEM_TOTALAGP 16
#define DRM_MEM_BOUNDAGP 17
#define DRM_MEM_CTXBITMAP 18
+#define DRM_MEM_STUB 19
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
@@ -259,16 +295,16 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg)
#define DRM_MEM_ERROR(area, fmt, arg...) \
printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \
- drm_mem_stats[area].name , ##arg)
+ DRM(mem_stats)[area].name , ##arg)
#define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
#if DRM_DEBUG_CODE
-#define DRM_DEBUG(fmt, arg...) \
- do { \
- if (drm_flags&DRM_FLAG_DEBUG) \
- printk(KERN_DEBUG \
- "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \
- ##arg); \
+#define DRM_DEBUG(fmt, arg...) \
+ do { \
+ if ( DRM(flags) & DRM_FLAG_DEBUG ) \
+ printk(KERN_DEBUG \
+ "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \
+ ##arg); \
} while (0)
#else
#define DRM_DEBUG(fmt, arg...) do { } while (0)
@@ -276,13 +312,36 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
-#define DRM_PROC_PRINT(fmt, arg...) \
- len += sprintf(&buf[len], fmt , ##arg); \
- if (len > DRM_PROC_LIMIT) return len;
+#define DRM_PROC_PRINT(fmt, arg...) \
+ len += sprintf(&buf[len], fmt , ##arg); \
+ if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; }
+
+#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
+ len += sprintf(&buf[len], fmt , ##arg); \
+ if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; }
+
+ /* Mapping helper macros */
+#define DRM_IOREMAP(map) \
+ (map)->handle = DRM(ioremap)( (map)->offset, (map)->size )
+
+#define DRM_IOREMAPFREE(map) \
+ do { \
+ if ( (map)->handle && (map)->size ) \
+ DRM(ioremapfree)( (map)->handle, (map)->size ); \
+ } while (0)
-#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
- len += sprintf(&buf[len], fmt , ##arg); \
- if (len > DRM_PROC_LIMIT) { ret; return len; }
+#define DRM_FIND_MAP(_map, _o) \
+do { \
+ struct list_head *_list; \
+ list_for_each( _list, &dev->maplist->head ) { \
+ drm_map_list_t *_entry = (drm_map_list_t *)_list; \
+ if ( _entry->map && \
+ _entry->map->offset == (_o) ) { \
+ (_map) = _entry->map; \
+ break; \
+ } \
+ } \
+} while(0)
/* Internal types and structures */
#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
@@ -293,8 +352,12 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
#define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
-typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
+#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
+ (_map) = (_dev)->context_sareas[_ctx]; \
+} while(0)
+
+typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
typedef struct drm_ioctl_desc {
drm_ioctl_t *func;
@@ -304,7 +367,7 @@ typedef struct drm_ioctl_desc {
typedef struct drm_devstate {
pid_t owner; /* X server pid holding x_lock */
-
+
} drm_devstate_t;
typedef struct drm_magic_entry {
@@ -365,14 +428,14 @@ typedef struct drm_buf {
#define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10)
typedef struct drm_histogram {
atomic_t total;
-
+
atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS];
atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS];
atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS];
-
+
atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS];
atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS];
-
+
atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS];
atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS];
atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS];
@@ -396,7 +459,7 @@ typedef struct drm_freelist {
int initialized; /* Freelist in use */
atomic_t count; /* Number of free buffers */
drm_buf_t *next; /* End pointer */
-
+
wait_queue_head_t waiting; /* Processes waiting on free bufs */
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
@@ -442,9 +505,11 @@ typedef struct drm_queue {
wait_queue_head_t read_queue; /* Processes waiting on block_read */
atomic_t block_write; /* Queue blocked for writes */
wait_queue_head_t write_queue; /* Processes waiting on block_write */
+#if 1
atomic_t total_queued; /* Total queued statistic */
atomic_t total_flushed;/* Total flushes statistic */
atomic_t total_locks; /* Total locks statistics */
+#endif
drm_ctx_flags_t flags; /* Context preserving and 2D-only */
drm_waitlist_t waitlist; /* Pending buffers */
wait_queue_head_t flush_queue; /* Processes waiting until flush */
@@ -458,11 +523,12 @@ typedef struct drm_lock_data {
} drm_lock_data_t;
typedef struct drm_device_dma {
+#if 0
/* Performance Counters */
atomic_t total_prio; /* Total DRM_DMA_PRIORITY */
atomic_t total_bytes; /* Total bytes DMA'd */
atomic_t total_dmas; /* Total DMA buffers dispatched */
-
+
atomic_t total_missed_dma; /* Missed drm_do_dma */
atomic_t total_missed_lock; /* Missed lock in drm_do_dma */
atomic_t total_missed_free; /* Missed drm_free_this_buffer */
@@ -471,16 +537,17 @@ typedef struct drm_device_dma {
atomic_t total_tried; /* Tried next_buffer */
atomic_t total_hit; /* Sent next_buffer */
atomic_t total_lost; /* Lost interrupt */
+#endif
drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
int buf_count;
drm_buf_t **buflist; /* Vector of pointers info bufs */
- int seg_count;
+ int seg_count;
int page_count;
unsigned long *pagelist;
unsigned long byte_count;
enum {
- _DRM_DMA_USE_AGP = 0x01
+ _DRM_DMA_USE_AGP = 0x01
} flags;
/* DMA support */
@@ -490,7 +557,7 @@ typedef struct drm_device_dma {
wait_queue_head_t waiting; /* Processes waiting on free bufs */
} drm_device_dma_t;
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
+#if __REALLY_HAVE_AGP
typedef struct drm_agp_mem {
unsigned long handle;
agp_memory *memory;
@@ -517,13 +584,18 @@ typedef struct drm_sigdata {
drm_hw_lock_t *lock;
} drm_sigdata_t;
+typedef struct drm_map_list {
+ struct list_head head;
+ drm_map_t *map;
+} drm_map_list_t;
+
typedef struct drm_device {
const char *name; /* Simple driver name */
char *unique; /* Unique identifier: e.g., busid */
int unique_len; /* Length of unique field */
dev_t device; /* Device number for mknod */
char *devname; /* For /proc/interrupts */
-
+
int blocked; /* Blocked due to VC switch? */
struct proc_dir_entry *root; /* Root for this device's entries */
@@ -538,17 +610,10 @@ typedef struct drm_device {
int buf_use; /* Buffers in use -- cannot alloc */
atomic_t buf_alloc; /* Buffer allocation in progress */
- /* Performance Counters */
- atomic_t total_open;
- atomic_t total_close;
- atomic_t total_ioctl;
- atomic_t total_irq; /* Total interruptions */
- atomic_t total_ctx; /* Total context switches */
-
- atomic_t total_locks;
- atomic_t total_unlocks;
- atomic_t total_contends;
- atomic_t total_sleeps;
+ /* Performance counters */
+ unsigned long counters;
+ drm_stat_type_t types[15];
+ atomic_t counts[15];
/* Authentication */
drm_file_t *file_first;
@@ -556,9 +621,12 @@ typedef struct drm_device {
drm_magic_head_t magiclist[DRM_HASH_SIZE];
/* Memory management */
- drm_map_t **maplist; /* Vector of pointers to regions */
+ drm_map_list_t *maplist; /* Linked list of regions */
int map_count; /* Number of mappable regions */
+ drm_map_t **context_sareas;
+ int max_context;
+
drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */
drm_lock_data_t lock; /* Information on hardware lock */
@@ -582,10 +650,10 @@ typedef struct drm_device {
struct tq_struct tq;
cycles_t ctx_start;
cycles_t lck_start;
-#if DRM_DMA_HISTOGRAM
+#if __HAVE_DMA_HISTOGRAM
drm_histogram_t histo;
#endif
-
+
/* Callback to X server for context switch
and for heavy-handed reset. */
char buf[DRM_BSZ]; /* Output buffer */
@@ -595,8 +663,8 @@ typedef struct drm_device {
struct fasync_struct *buf_async;/* Processes waiting for SIGIO */
wait_queue_head_t buf_readers; /* Processes waiting to read */
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
+
+#if __REALLY_HAVE_AGP
drm_agp_head_t *agp;
#endif
unsigned long *ctx_bitmap;
@@ -606,230 +674,278 @@ typedef struct drm_device {
} drm_device_t;
- /* Internal function definitions */
-
- /* Misc. support (init.c) */
-extern int drm_flags;
-extern void drm_parse_options(char *s);
-extern int drm_cpu_valid(void);
+/* ================================================================
+ * Internal function definitions
+ */
+ /* Misc. support (drm_init.h) */
+extern int DRM(flags);
+extern void DRM(parse_options)( char *s );
+extern int DRM(cpu_valid)( void );
- /* Device support (fops.c) */
-extern int drm_open_helper(struct inode *inode, struct file *filp,
- drm_device_t *dev);
-extern int drm_flush(struct file *filp);
-extern int drm_release(struct inode *inode, struct file *filp);
-extern int drm_fasync(int fd, struct file *filp, int on);
-extern ssize_t drm_read(struct file *filp, char *buf, size_t count,
- loff_t *off);
-extern int drm_write_string(drm_device_t *dev, const char *s);
-extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
+ /* Driver support (drm_drv.h) */
+extern int DRM(version)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(open)(struct inode *inode, struct file *filp);
+extern int DRM(release)(struct inode *inode, struct file *filp);
+extern int DRM(ioctl)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(lock)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(unlock)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
- /* Mapping support (vm.c) */
+ /* Device support (drm_fops.h) */
+extern int DRM(open_helper)(struct inode *inode, struct file *filp,
+ drm_device_t *dev);
+extern int DRM(flush)(struct file *filp);
+extern int DRM(release_fuck)(struct inode *inode, struct file *filp);
+extern int DRM(fasync)(int fd, struct file *filp, int on);
+extern ssize_t DRM(read)(struct file *filp, char *buf, size_t count,
+ loff_t *off);
+extern int DRM(write_string)(drm_device_t *dev, const char *s);
+extern unsigned int DRM(poll)(struct file *filp,
+ struct poll_table_struct *wait);
+
+ /* Mapping support (drm_vm.h) */
#if LINUX_VERSION_CODE < 0x020317
-extern unsigned long drm_vm_nopage(struct vm_area_struct *vma,
+extern unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+#else
+ /* Return type changed in 2.3.23 */
+extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access);
-extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
+extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access);
-extern unsigned long drm_vm_shm_nopage_lock(struct vm_area_struct *vma,
- unsigned long address,
- int write_access);
-extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
+extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access);
-#else
- /* Return type changed in 2.3.23 */
-extern struct page *drm_vm_nopage(struct vm_area_struct *vma,
- unsigned long address,
- int write_access);
-extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
- unsigned long address,
- int write_access);
-extern struct page *drm_vm_shm_nopage_lock(struct vm_area_struct *vma,
- unsigned long address,
- int write_access);
-extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
- unsigned long address,
- int write_access);
-#endif
-extern void drm_vm_open(struct vm_area_struct *vma);
-extern void drm_vm_close(struct vm_area_struct *vma);
-extern int drm_mmap_dma(struct file *filp,
- struct vm_area_struct *vma);
-extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
-
-
- /* Proc support (proc.c) */
-extern int drm_proc_init(drm_device_t *dev);
-extern int drm_proc_cleanup(void);
-
- /* Memory management support (memory.c) */
-extern void drm_mem_init(void);
-extern int drm_mem_info(char *buf, char **start, off_t offset,
- int len, int *eof, void *data);
-extern void *drm_alloc(size_t size, int area);
-extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
- int area);
-extern char *drm_strdup(const char *s, int area);
-extern void drm_strfree(const char *s, int area);
-extern void drm_free(void *pt, size_t size, int area);
-extern unsigned long drm_alloc_pages(int order, int area);
-extern void drm_free_pages(unsigned long address, int order,
- int area);
-extern void *drm_ioremap(unsigned long offset, unsigned long size);
-extern void drm_ioremapfree(void *pt, unsigned long size);
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
-extern agp_memory *drm_alloc_agp(int pages, u32 type);
-extern int drm_free_agp(agp_memory *handle, int pages);
-extern int drm_bind_agp(agp_memory *handle, unsigned int start);
-extern int drm_unbind_agp(agp_memory *handle);
+#endif
+extern void DRM(vm_open)(struct vm_area_struct *vma);
+extern void DRM(vm_close)(struct vm_area_struct *vma);
+extern void DRM(vm_shm_close)(struct vm_area_struct *vma);
+extern int DRM(mmap_dma)(struct file *filp,
+ struct vm_area_struct *vma);
+extern int DRM(mmap)(struct file *filp, struct vm_area_struct *vma);
+
+ /* Memory management support (drm_memory.h) */
+extern void DRM(mem_init)(void);
+extern int DRM(mem_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+extern void *DRM(alloc)(size_t size, int area);
+extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
+ int area);
+extern char *DRM(strdup)(const char *s, int area);
+extern void DRM(strfree)(const char *s, int area);
+extern void DRM(free)(void *pt, size_t size, int area);
+extern unsigned long DRM(alloc_pages)(int order, int area);
+extern void DRM(free_pages)(unsigned long address, int order,
+ int area);
+extern void *DRM(ioremap)(unsigned long offset, unsigned long size);
+extern void DRM(ioremapfree)(void *pt, unsigned long size);
+
+#if __REALLY_HAVE_AGP
+extern agp_memory *DRM(alloc_agp)(int pages, u32 type);
+extern int DRM(free_agp)(agp_memory *handle, int pages);
+extern int DRM(bind_agp)(agp_memory *handle, unsigned int start);
+extern int DRM(unbind_agp)(agp_memory *handle);
#endif
-
- /* Buffer management support (bufs.c) */
-extern int drm_order(unsigned long size);
-extern int drm_addmap(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_addbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_infobufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_markbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_freebufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_mapbufs(struct inode *inode, struct file *filp,
+ /* Misc. IOCTL support (drm_ioctl.h) */
+extern int DRM(irq_busid)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(getunique)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(setunique)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(getmap)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern int DRM(getclient)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(getstats)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
-
- /* Buffer list management support (lists.c) */
-extern int drm_waitlist_create(drm_waitlist_t *bl, int count);
-extern int drm_waitlist_destroy(drm_waitlist_t *bl);
-extern int drm_waitlist_put(drm_waitlist_t *bl, drm_buf_t *buf);
-extern drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl);
-
-extern int drm_freelist_create(drm_freelist_t *bl, int count);
-extern int drm_freelist_destroy(drm_freelist_t *bl);
-extern int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl,
- drm_buf_t *buf);
-extern drm_buf_t *drm_freelist_get(drm_freelist_t *bl, int block);
-
- /* DMA support (gen_dma.c) */
-extern void drm_dma_setup(drm_device_t *dev);
-extern void drm_dma_takedown(drm_device_t *dev);
-extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
-extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
-extern int drm_context_switch(drm_device_t *dev, int old, int new);
-extern int drm_context_switch_complete(drm_device_t *dev, int new);
-extern void drm_clear_next_buffer(drm_device_t *dev);
-extern int drm_select_queue(drm_device_t *dev,
- void (*wrapper)(unsigned long));
-extern int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *dma);
-extern int drm_dma_get_buffers(drm_device_t *dev, drm_dma_t *dma);
-#if DRM_DMA_HISTOGRAM
-extern int drm_histogram_slot(unsigned long count);
-extern void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf);
+ /* Context IOCTL support (drm_context.h) */
+extern int DRM(resctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(addctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(modctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(getctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(switchctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(newctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(rmctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+
+extern int DRM(context_switch)(drm_device_t *dev, int old, int new);
+extern int DRM(context_switch_complete)(drm_device_t *dev, int new);
+
+#if __HAVE_CTX_BITMAP
+extern int DRM(ctxbitmap_init)( drm_device_t *dev );
+extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev );
#endif
+extern int DRM(setsareactx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(getsareactx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
- /* Misc. IOCTL support (ioctl.c) */
-extern int drm_irq_busid(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_getunique(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_setunique(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
+ /* Drawable IOCTL support (drm_drawable.h) */
+extern int DRM(adddraw)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(rmdraw)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
- /* Context IOCTL support (context.c) */
-extern int drm_resctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_addctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_modctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_getctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_switchctx(struct inode *inode, struct file *filp,
+ /* Authentication IOCTL support (drm_auth.h) */
+extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv,
+ drm_magic_t magic);
+extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic);
+extern int DRM(getmagic)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_newctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_rmctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
+extern int DRM(authmagic)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
- /* Drawable IOCTL support (drawable.c) */
-extern int drm_adddraw(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_rmdraw(struct inode *inode, struct file *filp,
+ /* Locking IOCTL support (drm_lock.h) */
+extern int DRM(block)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-
-
- /* Authentication IOCTL support (auth.c) */
-extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv,
- drm_magic_t magic);
-extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic);
-extern int drm_getmagic(struct inode *inode, struct file *filp,
+extern int DRM(unblock)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_authmagic(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-
- /* Locking IOCTL support (lock.c) */
-extern int drm_block(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_unblock(struct inode *inode, struct file *filp,
+extern int DRM(lock_take)(__volatile__ unsigned int *lock,
+ unsigned int context);
+extern int DRM(lock_transfer)(drm_device_t *dev,
+ __volatile__ unsigned int *lock,
+ unsigned int context);
+extern int DRM(lock_free)(drm_device_t *dev,
+ __volatile__ unsigned int *lock,
+ unsigned int context);
+extern int DRM(finish)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_lock_take(__volatile__ unsigned int *lock,
- unsigned int context);
-extern int drm_lock_transfer(drm_device_t *dev,
- __volatile__ unsigned int *lock,
- unsigned int context);
-extern int drm_lock_free(drm_device_t *dev,
- __volatile__ unsigned int *lock,
- unsigned int context);
-extern int drm_finish(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_flush_unblock(drm_device_t *dev, int context,
- drm_lock_flags_t flags);
-extern int drm_flush_block_and_flush(drm_device_t *dev, int context,
- drm_lock_flags_t flags);
-extern int drm_notifier(void *priv);
-
- /* Context Bitmap support (ctxbitmap.c) */
-extern int drm_ctxbitmap_init(drm_device_t *dev);
-extern void drm_ctxbitmap_cleanup(drm_device_t *dev);
-extern int drm_ctxbitmap_next(drm_device_t *dev);
-extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
+extern int DRM(flush_unblock)(drm_device_t *dev, int context,
+ drm_lock_flags_t flags);
+extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context,
+ drm_lock_flags_t flags);
+extern int DRM(notifier)(void *priv);
+
+ /* Buffer management support (drm_bufs.h) */
+extern int DRM(order)( unsigned long size );
+extern int DRM(addmap)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(rmmap)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+#if __HAVE_DMA
+extern int DRM(addbufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(infobufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(markbufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(freebufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(mapbufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+
+ /* DMA support (drm_dma.h) */
+extern int DRM(dma_setup)(drm_device_t *dev);
+extern void DRM(dma_takedown)(drm_device_t *dev);
+extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf);
+extern void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid);
+#if __HAVE_OLD_DMA
+/* GH: This is a dirty hack for now...
+ */
+extern void DRM(clear_next_buffer)(drm_device_t *dev);
+extern int DRM(select_queue)(drm_device_t *dev,
+ void (*wrapper)(unsigned long));
+extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma);
+extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma);
+#endif
+#if __HAVE_DMA_IRQ
+extern int DRM(control)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int DRM(irq_install)( drm_device_t *dev, int irq );
+extern int DRM(irq_uninstall)( drm_device_t *dev );
+extern void DRM(dma_service)( int irq, void *device,
+ struct pt_regs *regs );
+#if __HAVE_DMA_IRQ_BH
+extern void DRM(dma_immediate_bh)( void *dev );
+#endif
+#endif
+#if DRM_DMA_HISTOGRAM
+extern int DRM(histogram_slot)(unsigned long count);
+extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf);
+#endif
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- /* AGP/GART support (agpsupport.c) */
-extern drm_agp_head_t *drm_agp_init(void);
-extern void drm_agp_uninit(void);
-extern int drm_agp_acquire(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern void _drm_agp_release(void);
-extern int drm_agp_release(struct inode *inode, struct file *filp,
+ /* Buffer list support (drm_lists.h) */
+#if __HAVE_DMA_WAITLIST
+extern int DRM(waitlist_create)(drm_waitlist_t *bl, int count);
+extern int DRM(waitlist_destroy)(drm_waitlist_t *bl);
+extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf);
+extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl);
+#endif
+#if __HAVE_DMA_FREELIST
+extern int DRM(freelist_create)(drm_freelist_t *bl, int count);
+extern int DRM(freelist_destroy)(drm_freelist_t *bl);
+extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl,
+ drm_buf_t *buf);
+extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block);
+#endif
+#endif /* __HAVE_DMA */
+
+#if __REALLY_HAVE_AGP
+ /* AGP/GART support (drm_agpsupport.h) */
+extern drm_agp_head_t *DRM(agp_init)(void);
+extern void DRM(agp_uninit)(void);
+extern int DRM(agp_acquire)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern void DRM(agp_do_release)(void);
+extern int DRM(agp_release)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_agp_enable(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_agp_info(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_agp_alloc(struct inode *inode, struct file *filp,
+extern int DRM(agp_info)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_agp_free(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int drm_agp_unbind(struct inode *inode, struct file *filp,
+extern int DRM(agp_alloc)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_agp_bind(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type);
-extern int drm_agp_free_memory(agp_memory *handle);
-extern int drm_agp_bind_memory(agp_memory *handle, off_t start);
-extern int drm_agp_unbind_memory(agp_memory *handle);
-#endif
+extern int DRM(agp_free)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(agp_unbind)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(agp_bind)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type);
+extern int DRM(agp_free_memory)(agp_memory *handle);
+extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start);
+extern int DRM(agp_unbind_memory)(agp_memory *handle);
#endif
+
+ /* Stub support (drm_stub.h) */
+int DRM(stub_register)(const char *name,
+ struct file_operations *fops,
+ drm_device_t *dev);
+int DRM(stub_unregister)(int minor);
+
+ /* Proc support (drm_proc.h) */
+extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev,
+ int minor,
+ struct proc_dir_entry *root,
+ struct proc_dir_entry **dev_root);
+extern int DRM(proc_cleanup)(int minor,
+ struct proc_dir_entry *root,
+ struct proc_dir_entry *dev_root);
+
+#endif /* __KERNEL__ */
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h
new file mode 100644
index 000000000..dfd0d8fc2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h
@@ -0,0 +1,335 @@
+/* drm_agpsupport.h -- 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.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include <linux/module.h>
+
+#if __REALLY_HAVE_AGP
+
+#if LINUX_VERSION_CODE < 0x020400
+#include "agpsupport-pre24.h"
+#else
+#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
+#define DRM_AGP_PUT inter_module_put("drm_agp")
+#endif
+
+static const drm_agp_t *drm_agp = 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;
+
+ if (copy_to_user((drm_agp_info_t *)arg, &info, sizeof(info)))
+ return -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|| 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;
+
+}
+
+void DRM(agp_do_release)(void)
+{
+ if (drm_agp->release) drm_agp->release();
+}
+
+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;
+
+ if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
+ return -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;
+ if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
+ return -EFAULT;
+ if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
+ return -ENOMEM;
+
+ memset(entry, 0, sizeof(*entry));
+
+ 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;
+ if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
+ return -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;
+ if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
+ return -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);
+ DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
+ dev->agp->base, entry->bound);
+ 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;
+ if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
+ return -EFAULT;
+ if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
+ return -EINVAL;
+ if (entry->bound) DRM(unbind_agp)(entry->memory);
+
+ if (entry->prev) entry->prev->next = entry->next;
+ else dev->agp->memory = entry->next;
+ if (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_head_t *head = NULL;
+
+ drm_agp = DRM_AGP_GET;
+ if (drm_agp) {
+ if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
+ return NULL;
+ memset((void *)head, 0, sizeof(*head));
+ drm_agp->copy_info(&head->agp_info);
+ if (head->agp_info.chipset == NOT_SUPPORTED) {
+ DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS);
+ return NULL;
+ }
+ 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;
+
+#if LINUX_VERSION_CODE >= 0x020400
+ case INTEL_I840: head->chipset = "Intel i840"; break;
+#endif
+
+ case VIA_GENERIC: head->chipset = "VIA"; break;
+ case VIA_VP3: head->chipset = "VIA VP3"; break;
+ case VIA_MVP3: head->chipset = "VIA MVP3"; break;
+
+#if LINUX_VERSION_CODE >= 0x020400
+ case VIA_MVP4: head->chipset = "VIA MVP4"; break;
+ case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133";
+ break;
+ case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133";
+ break;
+#endif
+
+ 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: head->chipset = "Unknown"; break;
+ }
+ DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\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;
+}
+
+void DRM(agp_uninit)(void)
+{
+ DRM_AGP_PUT;
+ drm_agp = NULL;
+}
+
+agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
+{
+ if (!drm_agp->allocate_memory) return NULL;
+ return drm_agp->allocate_memory(pages, type);
+}
+
+int DRM(agp_free_memory)(agp_memory *handle)
+{
+ if (!handle || !drm_agp->free_memory) return 0;
+ drm_agp->free_memory(handle);
+ return 1;
+}
+
+int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
+{
+ if (!handle || !drm_agp->bind_memory) return -EINVAL;
+ return drm_agp->bind_memory(handle, start);
+}
+
+int DRM(agp_unbind_memory)(agp_memory *handle)
+{
+ if (!handle || !drm_agp->unbind_memory) return -EINVAL;
+ return drm_agp->unbind_memory(handle);
+}
+
+#endif /* __REALLY_HAVE_AGP */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h
new file mode 100644
index 000000000..2636e6179
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h
@@ -0,0 +1,162 @@
+/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
+ * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+static int DRM(hash_magic)(drm_magic_t magic)
+{
+ return magic & (DRM_HASH_SIZE-1);
+}
+
+static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
+{
+ drm_file_t *retval = NULL;
+ drm_magic_entry_t *pt;
+ int hash = DRM(hash_magic)(magic);
+
+ down(&dev->struct_sem);
+ for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
+ if (pt->magic == magic) {
+ retval = pt->priv;
+ break;
+ }
+ }
+ up(&dev->struct_sem);
+ return retval;
+}
+
+int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
+{
+ int hash;
+ drm_magic_entry_t *entry;
+
+ DRM_DEBUG("%d\n", magic);
+
+ hash = DRM(hash_magic)(magic);
+ entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC);
+ if (!entry) return -ENOMEM;
+ entry->magic = magic;
+ entry->priv = priv;
+ entry->next = NULL;
+
+ down(&dev->struct_sem);
+ if (dev->magiclist[hash].tail) {
+ dev->magiclist[hash].tail->next = entry;
+ dev->magiclist[hash].tail = entry;
+ } else {
+ dev->magiclist[hash].head = entry;
+ dev->magiclist[hash].tail = entry;
+ }
+ up(&dev->struct_sem);
+
+ return 0;
+}
+
+int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
+{
+ drm_magic_entry_t *prev = NULL;
+ drm_magic_entry_t *pt;
+ int hash;
+
+ DRM_DEBUG("%d\n", magic);
+ hash = DRM(hash_magic)(magic);
+
+ down(&dev->struct_sem);
+ for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
+ if (pt->magic == magic) {
+ if (dev->magiclist[hash].head == pt) {
+ dev->magiclist[hash].head = pt->next;
+ }
+ if (dev->magiclist[hash].tail == pt) {
+ dev->magiclist[hash].tail = prev;
+ }
+ if (prev) {
+ prev->next = pt->next;
+ }
+ up(&dev->struct_sem);
+ return 0;
+ }
+ }
+ up(&dev->struct_sem);
+
+ DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
+
+ return -EINVAL;
+}
+
+int DRM(getmagic)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ static drm_magic_t sequence = 0;
+ static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_auth_t auth;
+
+ /* Find unique magic */
+ if (priv->magic) {
+ auth.magic = priv->magic;
+ } else {
+ do {
+ spin_lock(&lock);
+ if (!sequence) ++sequence; /* reserve 0 */
+ auth.magic = sequence++;
+ spin_unlock(&lock);
+ } while (DRM(find_file)(dev, auth.magic));
+ priv->magic = auth.magic;
+ DRM(add_magic)(dev, priv, auth.magic);
+ }
+
+ DRM_DEBUG("%u\n", auth.magic);
+ if (copy_to_user((drm_auth_t *)arg, &auth, sizeof(auth)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(authmagic)(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_auth_t auth;
+ drm_file_t *file;
+
+ if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth)))
+ return -EFAULT;
+ DRM_DEBUG("%u\n", auth.magic);
+ if ((file = DRM(find_file)(dev, auth.magic))) {
+ file->authenticated = 1;
+ DRM(remove_magic)(dev, auth.magic);
+ return 0;
+ }
+ return -EINVAL;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h
new file mode 100644
index 000000000..63cfb0d44
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h
@@ -0,0 +1,829 @@
+/* drm_bufs.h -- Generic buffer template -*- linux-c -*-
+ * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
+ *
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include <linux/vmalloc.h>
+#include "drmP.h"
+
+#ifndef __HAVE_PCI_DMA
+#define __HAVE_PCI_DMA 0
+#endif
+
+#ifndef DRIVER_BUF_PRIV_T
+#define DRIVER_BUF_PRIV_T u32
+#endif
+#ifndef DRIVER_AGP_BUFFERS_MAP
+#if __HAVE_AGP && __HAVE_DMA
+#error "You must define DRIVER_AGP_BUFFERS_MAP()"
+#else
+#define DRIVER_AGP_BUFFERS_MAP( dev ) NULL
+#endif
+#endif
+
+/*
+ * Compute order. Can be made faster.
+ */
+int DRM(order)( unsigned long size )
+{
+ int order;
+ unsigned long tmp;
+
+ for ( order = 0, tmp = size ; tmp >>= 1 ; ++order );
+
+ if ( size & ~(1 << order) )
+ ++order;
+
+ return order;
+}
+
+int DRM(addmap)( 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_map_t *map;
+ drm_map_list_t *list;
+
+ if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */
+
+ map = DRM(alloc)( sizeof(*map), DRM_MEM_MAPS );
+ if ( !map )
+ return -ENOMEM;
+
+ if ( copy_from_user( map, (drm_map_t *)arg, sizeof(*map) ) ) {
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -EFAULT;
+ }
+
+ /* Only allow shared memory to be removable since we only keep enough
+ * book keeping information about shared memory to allow for removal
+ * when processes fork.
+ */
+ if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) {
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -EINVAL;
+ }
+ DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n",
+ map->offset, map->size, map->type );
+ if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) {
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -EINVAL;
+ }
+ map->mtrr = -1;
+ map->handle = 0;
+
+ switch ( map->type ) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#ifndef __sparc__
+ if ( map->offset + map->size < map->offset ||
+ map->offset < virt_to_phys(high_memory) ) {
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -EINVAL;
+ }
+#endif
+#if __REALLY_HAVE_MTRR
+ if ( map->type == _DRM_FRAME_BUFFER ||
+ (map->flags & _DRM_WRITE_COMBINING) ) {
+ map->mtrr = mtrr_add( map->offset, map->size,
+ MTRR_TYPE_WRCOMB, 1 );
+ }
+#endif
+ map->handle = DRM(ioremap)( map->offset, map->size );
+ break;
+
+ case _DRM_SHM:
+ map->handle = vmalloc_32(map->size);
+ DRM_DEBUG( "%ld %d %p\n",
+ map->size, DRM(order)( map->size ), map->handle );
+ if ( !map->handle ) {
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -ENOMEM;
+ }
+ map->offset = (unsigned long)map->handle;
+ if ( map->flags & _DRM_CONTAINS_LOCK ) {
+ dev->lock.hw_lock = map->handle; /* Pointer to lock */
+ }
+ break;
+#if __REALLY_HAVE_AGP
+ case _DRM_AGP:
+ map->offset = map->offset + dev->agp->base;
+ map->mtrr = dev->agp->agp_mtrr; /* for getmap */
+ break;
+#endif
+ default:
+ DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+ return -EINVAL;
+ }
+
+ list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS);
+ if(!list) {
+ DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
+ return -EINVAL;
+ }
+ memset(list, 0, sizeof(*list));
+ list->map = map;
+
+ down(&dev->struct_sem);
+ list_add(&list->head, &dev->maplist->head);
+ up(&dev->struct_sem);
+
+ if ( copy_to_user( (drm_map_t *)arg, map, sizeof(*map) ) )
+ return -EFAULT;
+ if ( map->type != _DRM_SHM ) {
+ if ( copy_to_user( &((drm_map_t *)arg)->handle,
+ &map->offset,
+ sizeof(map->offset) ) )
+ return -EFAULT;
+ }
+ return 0;
+}
+
+
+/* Remove a map private from list and deallocate resources if the mapping
+ * isn't in use.
+ */
+
+int DRM(rmmap)(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;
+ struct list_head *list;
+ drm_map_list_t *r_list;
+ drm_vma_entry_t *pt, *prev;
+ drm_map_t *map;
+ drm_map_t request;
+ int found_maps = 0;
+
+ if (copy_from_user(&request, (drm_map_t *)arg,
+ sizeof(request))) {
+ return -EFAULT;
+ }
+
+ down(&dev->struct_sem);
+ list = &dev->maplist->head;
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *) list;
+
+ if(r_list->map &&
+ r_list->map->handle == request.handle &&
+ r_list->map->flags & _DRM_REMOVABLE) break;
+ }
+
+ /* List has wrapped around to the head pointer, or its empty we didn't
+ * find anything.
+ */
+ if(list == (&dev->maplist->head)) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+ map = r_list->map;
+ list_del(list);
+ DRM(free)(list, sizeof(*list), DRM_MEM_MAPS);
+
+ for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
+#if LINUX_VERSION_CODE >= 0x020300
+ if (pt->vma->vm_private_data == map) found_maps++;
+#else
+ if (pt->vma->vm_pte == map) found_maps++;
+#endif
+ }
+
+ if(!found_maps) {
+ switch (map->type) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#if __REALLY_HAVE_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:
+ vfree(map->handle);
+ break;
+ case _DRM_AGP:
+ break;
+ }
+ DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
+ }
+ up(&dev->struct_sem);
+ return 0;
+}
+
+#if __HAVE_DMA
+
+#if __REALLY_HAVE_AGP
+int DRM(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;
+
+ if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ count = request.count;
+ order = DRM(order)( request.size );
+ size = 1 << order;
+
+ 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;
+ agp_offset = dev->agp->base + request.agp_start;
+
+ DRM_DEBUG( "count: %d\n", count );
+ DRM_DEBUG( "order: %d\n", order );
+ DRM_DEBUG( "size: %d\n", size );
+ DRM_DEBUG( "agp_offset: %ld\n", agp_offset );
+ DRM_DEBUG( "alignment: %d\n", alignment );
+ DRM_DEBUG( "page_order: %d\n", page_order );
+ DRM_DEBUG( "total: %d\n", total );
+
+ 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;
+
+ buf->offset = (dma->byte_count + offset);
+ buf->bus_address = agp_offset + offset;
+ buf->address = (void *)(agp_offset + offset);
+ buf->next = NULL;
+ buf->waiting = 0;
+ buf->pending = 0;
+ init_waitqueue_head( &buf->dma_wait );
+ buf->pid = 0;
+
+ buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
+ buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T),
+ DRM_MEM_BUFS );
+ memset( buf->dev_private, 0, buf->dev_priv_size );
+
+#if __HAVE_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 );
+
+ offset += alignment;
+ entry->buf_count++;
+ byte_count += PAGE_SIZE << page_order;
+ }
+
+ DRM_DEBUG( "byte_count: %d\n", byte_count );
+
+ 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 = 0 ; i < entry->buf_count ; i++ ) {
+ dma->buflist[i + dma->buf_count] = &entry->buflist[i];
+ }
+
+ dma->buf_count += entry->buf_count;
+ dma->byte_count += byte_count;
+
+ DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
+ DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
+
+#if __HAVE_DMA_FREELIST
+ 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] );
+ }
+#endif
+ up( &dev->struct_sem );
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) )
+ return -EFAULT;
+
+ dma->flags = _DRM_DMA_USE_AGP;
+
+ atomic_dec( &dev->buf_alloc );
+ return 0;
+}
+#endif /* __REALLY_HAVE_AGP */
+
+#if __HAVE_PCI_DMA
+int DRM(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;
+
+ if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
+ sizeof(request) ) )
+ return -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 ) {
+ page = DRM(alloc_pages)( page_order, DRM_MEM_DMA );
+ if ( !page ) 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 __HAVE_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 = 0 ; i < entry->buf_count ; i++ ) {
+ dma->buflist[i + dma->buf_count] = &entry->buflist[i];
+ }
+
+ 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);
+
+#if __HAVE_DMA_FREELIST
+ 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] );
+ }
+#endif
+ up( &dev->struct_sem );
+
+ request.count = entry->buf_count;
+ request.size = size;
+
+ if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) )
+ return -EFAULT;
+
+ atomic_dec( &dev->buf_alloc );
+ return 0;
+}
+#endif /* __HAVE_PCI_DMA */
+
+int DRM(addbufs)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_buf_desc_t request;
+
+ if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+#if __REALLY_HAVE_AGP
+ if ( request.flags & _DRM_AGP_BUFFER )
+ return DRM(addbufs_agp)( inode, filp, cmd, arg );
+ else
+#endif
+#if __HAVE_PCI_DMA
+ return DRM(addbufs_pci)( inode, filp, cmd, arg );
+#else
+ return -EINVAL;
+#endif
+}
+
+int DRM(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 );
+
+ if ( copy_from_user( &request,
+ (drm_buf_info_t *)arg,
+ sizeof(request) ) )
+ return -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 ) {
+ drm_buf_desc_t *to = &request.list[count];
+ drm_buf_entry_t *from = &dma->bufs[i];
+ drm_freelist_t *list = &dma->bufs[i].freelist;
+ if ( copy_to_user( &to->count,
+ &from->buf_count,
+ sizeof(from->buf_count) ) ||
+ copy_to_user( &to->size,
+ &from->buf_size,
+ sizeof(from->buf_size) ) ||
+ copy_to_user( &to->low_mark,
+ &list->low_mark,
+ sizeof(list->low_mark) ) ||
+ copy_to_user( &to->high_mark,
+ &list->high_mark,
+ sizeof(list->high_mark) ) )
+ return -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;
+
+ if ( copy_to_user( (drm_buf_info_t *)arg,
+ &request,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ return 0;
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &request,
+ (drm_buf_desc_t *)arg,
+ sizeof(request) ) )
+ return -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 DRM(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;
+
+ if ( copy_from_user( &request,
+ (drm_buf_free_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ DRM_DEBUG( "%d\n", request.count );
+ for ( i = 0 ; i < request.count ; i++ ) {
+ if ( copy_from_user( &idx,
+ &request.list[i],
+ sizeof(idx) ) )
+ return -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 DRM(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;
+
+ 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 );
+
+ if ( copy_from_user( &request, (drm_buf_map_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ if ( request.count >= dma->buf_count ) {
+ if ( __HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP) ) {
+ drm_map_t *map = DRIVER_AGP_BUFFERS_MAP( dev );
+
+ if ( !map ) {
+ retcode = -EINVAL;
+ goto done;
+ }
+
+ down( &current->mm->mmap_sem );
+ virtual = do_mmap( filp, 0, map->size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ (unsigned long)map->offset );
+ up( &current->mm->mmap_sem );
+ } else {
+ down( &current->mm->mmap_sem );
+ virtual = do_mmap( filp, 0, dma->byte_count,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, 0 );
+ up( &current->mm->mmap_sem );
+ }
+ 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 );
+
+ if ( copy_to_user( (drm_buf_map_t *)arg, &request, sizeof(request) ) )
+ return -EFAULT;
+
+ return retcode;
+}
+
+#endif /* __HAVE_DMA */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h
new file mode 100644
index 000000000..4ac896ef5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h
@@ -0,0 +1,760 @@
+/* drm_context.h -- IOCTLs for generic contexts -*- linux-c -*-
+ * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com
+ *
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+#if __HAVE_CTX_BITMAP
+
+/* ================================================================
+ * Context bitmap support
+ */
+
+void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle )
+{
+ if ( ctx_handle < 0 ) goto failed;
+ if ( !dev->ctx_bitmap ) goto failed;
+
+ if ( ctx_handle < DRM_MAX_CTXBITMAP ) {
+ down(&dev->struct_sem);
+ clear_bit( ctx_handle, dev->ctx_bitmap );
+ dev->context_sareas[ctx_handle] = NULL;
+ up(&dev->struct_sem);
+ 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;
+
+ if(!dev->ctx_bitmap) return -1;
+
+ down(&dev->struct_sem);
+ bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP );
+ if ( bit < DRM_MAX_CTXBITMAP ) {
+ set_bit( bit, dev->ctx_bitmap );
+ DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit );
+ if((bit+1) > dev->max_context) {
+ dev->max_context = (bit+1);
+ if(dev->context_sareas) {
+ dev->context_sareas = DRM(realloc)(
+ dev->context_sareas,
+ (dev->max_context - 1) *
+ sizeof(*dev->context_sareas),
+ dev->max_context *
+ sizeof(*dev->context_sareas),
+ DRM_MEM_MAPS);
+ dev->context_sareas[bit] = NULL;
+ } else {
+ /* max_context == 1 at this point */
+ dev->context_sareas = DRM(alloc)(
+ dev->max_context *
+ sizeof(*dev->context_sareas),
+ DRM_MEM_MAPS);
+ dev->context_sareas[bit] = NULL;
+ }
+ }
+ up(&dev->struct_sem);
+ return bit;
+ }
+ up(&dev->struct_sem);
+ return -1;
+}
+
+int DRM(ctxbitmap_init)( drm_device_t *dev )
+{
+ int i;
+ int temp;
+
+ down(&dev->struct_sem);
+ dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE,
+ DRM_MEM_CTXBITMAP );
+ if ( dev->ctx_bitmap == NULL ) {
+ up(&dev->struct_sem);
+ return -ENOMEM;
+ }
+ memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE );
+ dev->context_sareas = NULL;
+ dev->max_context = -1;
+ up(&dev->struct_sem);
+
+ for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
+ temp = DRM(ctxbitmap_next)( dev );
+ DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp );
+ }
+
+ return 0;
+}
+
+void DRM(ctxbitmap_cleanup)( drm_device_t *dev )
+{
+ down(&dev->struct_sem);
+ if( dev->context_sareas ) DRM(free)( dev->context_sareas,
+ sizeof(*dev->context_sareas) *
+ dev->max_context,
+ DRM_MEM_MAPS );
+ DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP );
+ up(&dev->struct_sem);
+}
+
+/* ================================================================
+ * Per Context SAREA Support
+ */
+
+int DRM(getsareactx)(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_priv_map_t request;
+ drm_map_t *map;
+
+ if (copy_from_user(&request,
+ (drm_ctx_priv_map_t *)arg,
+ sizeof(request)))
+ return -EFAULT;
+
+ down(&dev->struct_sem);
+ if ((int)request.ctx_id >= dev->max_context) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+
+ map = dev->context_sareas[request.ctx_id];
+ up(&dev->struct_sem);
+
+ request.handle = map->handle;
+ if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(setsareactx)(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_priv_map_t request;
+ drm_map_t *map = NULL;
+ drm_map_list_t *r_list;
+ struct list_head *list;
+
+ if (copy_from_user(&request,
+ (drm_ctx_priv_map_t *)arg,
+ sizeof(request)))
+ return -EFAULT;
+
+ down(&dev->struct_sem);
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *)list;
+ if(r_list->map &&
+ r_list->map->handle == request.handle) break;
+ }
+ if (list == &(dev->maplist->head)) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+ map = r_list->map;
+ up(&dev->struct_sem);
+
+ if (!map) return -EINVAL;
+
+ down(&dev->struct_sem);
+ if ((int)request.ctx_id >= dev->max_context) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+ dev->context_sareas[request.ctx_id] = map;
+ up(&dev->struct_sem);
+ return 0;
+}
+
+/* ================================================================
+ * The actual DRM context handling routines
+ */
+
+int DRM(context_switch)( drm_device_t *dev, int old, int new )
+{
+ char buf[64];
+
+ if ( test_and_set_bit( 0, &dev->context_flag ) ) {
+ DRM_ERROR( "Reentering -- FIXME\n" );
+ return -EBUSY;
+ }
+
+#if __HAVE_DMA_HISTOGRAM
+ dev->ctx_start = get_cycles();
+#endif
+
+ DRM_DEBUG( "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 ) {
+ DRM(context_switch_complete)( dev, new );
+ } else {
+ sprintf( buf, "C %d %d\n", old, new );
+ DRM(write_string)( dev, buf );
+ }
+
+ return 0;
+}
+
+int DRM(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 __HAVE_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 DRM(resctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_ctx_res_t res;
+ drm_ctx_t ctx;
+ int i;
+
+ if ( copy_from_user( &res, (drm_ctx_res_t *)arg, sizeof(res) ) )
+ return -EFAULT;
+
+ if ( res.count >= DRM_RESERVED_CONTEXTS ) {
+ memset( &ctx, 0, sizeof(ctx) );
+ for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
+ ctx.handle = i;
+ if ( copy_to_user( &res.contexts[i],
+ &i, sizeof(i) ) )
+ return -EFAULT;
+ }
+ }
+ res.count = DRM_RESERVED_CONTEXTS;
+
+ if ( copy_to_user( (drm_ctx_res_t *)arg, &res, sizeof(res) ) )
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+ return -EFAULT;
+
+ ctx.handle = DRM(ctxbitmap_next)( dev );
+ if ( ctx.handle == DRM_KERNEL_CONTEXT ) {
+ /* Skip kernel's context and get a new one. */
+ ctx.handle = DRM(ctxbitmap_next)( dev );
+ }
+ DRM_DEBUG( "%d\n", ctx.handle );
+ if ( ctx.handle == -1 ) {
+ DRM_DEBUG( "Not enough free contexts.\n" );
+ /* Should this return -EBUSY instead? */
+ return -ENOMEM;
+ }
+
+ if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) )
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(modctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ /* This does nothing */
+ return 0;
+}
+
+int DRM(getctx)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_ctx_t ctx;
+
+ if ( copy_from_user( &ctx, (drm_ctx_t*)arg, sizeof(ctx) ) )
+ return -EFAULT;
+
+ /* This is 0, because we don't handle any context flags */
+ ctx.flags = 0;
+
+ if ( copy_to_user( (drm_ctx_t*)arg, &ctx, sizeof(ctx) ) )
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+ return -EFAULT;
+
+ DRM_DEBUG( "%d\n", ctx.handle );
+ return DRM(context_switch)( dev, dev->last_context, ctx.handle );
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+ return -EFAULT;
+
+ DRM_DEBUG( "%d\n", ctx.handle );
+ DRM(context_switch_complete)( dev, ctx.handle );
+
+ return 0;
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+ return -EFAULT;
+
+ DRM_DEBUG( "%d\n", ctx.handle );
+ if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) {
+ priv->remove_auth_on_close = 1;
+ }
+ if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
+ DRM(ctxbitmap_free)( dev, ctx.handle );
+ }
+
+ return 0;
+}
+
+
+#else /* __HAVE_CTX_BITMAP */
+
+/* ================================================================
+ * Old-style context support
+ */
+
+
+int DRM(context_switch)(drm_device_t *dev, int old, int new)
+{
+ char buf[64];
+ drm_queue_t *q;
+
+#if 0
+ atomic_inc(&dev->total_ctx);
+#endif
+
+ if (test_and_set_bit(0, &dev->context_flag)) {
+ DRM_ERROR("Reentering -- FIXME\n");
+ return -EBUSY;
+ }
+
+#if __HAVE_DMA_HISTOGRAM
+ dev->ctx_start = get_cycles();
+#endif
+
+ DRM_DEBUG("Context switch from %d to %d\n", old, new);
+
+ if (new >= dev->queue_count) {
+ clear_bit(0, &dev->context_flag);
+ return -EINVAL;
+ }
+
+ if (new == dev->last_context) {
+ clear_bit(0, &dev->context_flag);
+ return 0;
+ }
+
+ q = dev->queuelist[new];
+ atomic_inc(&q->use_count);
+ if (atomic_read(&q->use_count) == 1) {
+ atomic_dec(&q->use_count);
+ clear_bit(0, &dev->context_flag);
+ return -EINVAL;
+ }
+
+ if (DRM(flags) & DRM_FLAG_NOCTX) {
+ DRM(context_switch_complete)(dev, new);
+ } else {
+ sprintf(buf, "C %d %d\n", old, new);
+ DRM(write_string)(dev, buf);
+ }
+
+ atomic_dec(&q->use_count);
+
+ return 0;
+}
+
+int DRM(context_switch_complete)(drm_device_t *dev, int new)
+{
+ drm_device_dma_t *dma = dev->dma;
+
+ 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 (!dma || !(dma->next_buffer && dma->next_buffer->while_locked)) {
+ if (DRM(lock_free)(dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT)) {
+ DRM_ERROR("Cannot free lock\n");
+ }
+ }
+
+#if __HAVE_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.ctx[DRM(histogram_slot)(get_cycles()
+ - dev->ctx_start)]);
+
+#endif
+ clear_bit(0, &dev->context_flag);
+ wake_up_interruptible(&dev->context_wait);
+
+ return 0;
+}
+
+static int DRM(init_queue)(drm_device_t *dev, drm_queue_t *q, drm_ctx_t *ctx)
+{
+ DRM_DEBUG("\n");
+
+ if (atomic_read(&q->use_count) != 1
+ || atomic_read(&q->finalization)
+ || atomic_read(&q->block_count)) {
+ DRM_ERROR("New queue is already in use: u%d f%d b%d\n",
+ atomic_read(&q->use_count),
+ atomic_read(&q->finalization),
+ atomic_read(&q->block_count));
+ }
+
+ atomic_set(&q->finalization, 0);
+ atomic_set(&q->block_count, 0);
+ atomic_set(&q->block_read, 0);
+ atomic_set(&q->block_write, 0);
+ atomic_set(&q->total_queued, 0);
+ atomic_set(&q->total_flushed, 0);
+ atomic_set(&q->total_locks, 0);
+
+ init_waitqueue_head(&q->write_queue);
+ init_waitqueue_head(&q->read_queue);
+ init_waitqueue_head(&q->flush_queue);
+
+ q->flags = ctx->flags;
+
+ DRM(waitlist_create)(&q->waitlist, dev->dma->buf_count);
+
+ return 0;
+}
+
+
+/* drm_alloc_queue:
+PRE: 1) dev->queuelist[0..dev->queue_count] is allocated and will not
+ disappear (so all deallocation must be done after IOCTLs are off)
+ 2) dev->queue_count < dev->queue_slots
+ 3) dev->queuelist[i].use_count == 0 and
+ dev->queuelist[i].finalization == 0 if i not in use
+POST: 1) dev->queuelist[i].use_count == 1
+ 2) dev->queue_count < dev->queue_slots */
+
+static int DRM(alloc_queue)(drm_device_t *dev)
+{
+ int i;
+ drm_queue_t *queue;
+ int oldslots;
+ int newslots;
+ /* Check for a free queue */
+ for (i = 0; i < dev->queue_count; i++) {
+ atomic_inc(&dev->queuelist[i]->use_count);
+ if (atomic_read(&dev->queuelist[i]->use_count) == 1
+ && !atomic_read(&dev->queuelist[i]->finalization)) {
+ DRM_DEBUG("%d (free)\n", i);
+ return i;
+ }
+ atomic_dec(&dev->queuelist[i]->use_count);
+ }
+ /* Allocate a new queue */
+ down(&dev->struct_sem);
+
+ queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES);
+ memset(queue, 0, sizeof(*queue));
+ atomic_set(&queue->use_count, 1);
+
+ ++dev->queue_count;
+ if (dev->queue_count >= dev->queue_slots) {
+ oldslots = dev->queue_slots * sizeof(*dev->queuelist);
+ if (!dev->queue_slots) dev->queue_slots = 1;
+ dev->queue_slots *= 2;
+ newslots = dev->queue_slots * sizeof(*dev->queuelist);
+
+ dev->queuelist = DRM(realloc)(dev->queuelist,
+ oldslots,
+ newslots,
+ DRM_MEM_QUEUES);
+ if (!dev->queuelist) {
+ up(&dev->struct_sem);
+ DRM_DEBUG("out of memory\n");
+ return -ENOMEM;
+ }
+ }
+ dev->queuelist[dev->queue_count-1] = queue;
+
+ up(&dev->struct_sem);
+ DRM_DEBUG("%d (new)\n", dev->queue_count - 1);
+ return dev->queue_count - 1;
+}
+
+int DRM(resctx)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_ctx_res_t res;
+ drm_ctx_t ctx;
+ int i;
+
+ DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
+ if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res)))
+ return -EFAULT;
+ if (res.count >= DRM_RESERVED_CONTEXTS) {
+ memset(&ctx, 0, sizeof(ctx));
+ for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
+ ctx.handle = i;
+ if (copy_to_user(&res.contexts[i],
+ &i,
+ sizeof(i)))
+ return -EFAULT;
+ }
+ }
+ res.count = DRM_RESERVED_CONTEXTS;
+ if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+ if ((ctx.handle = DRM(alloc_queue)(dev)) == DRM_KERNEL_CONTEXT) {
+ /* Init kernel's context and get a new one. */
+ DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx);
+ ctx.handle = DRM(alloc_queue)(dev);
+ }
+ DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx);
+ DRM_DEBUG("%d\n", ctx.handle);
+ if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(modctx)(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+
+ DRM_DEBUG("%d\n", ctx.handle);
+
+ if (ctx.handle < 0 || ctx.handle >= dev->queue_count) return -EINVAL;
+ 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;
+ }
+
+ if (DRM_BUFCOUNT(&q->waitlist)) {
+ atomic_dec(&q->use_count);
+ return -EBUSY;
+ }
+
+ q->flags = ctx.flags;
+
+ atomic_dec(&q->use_count);
+ return 0;
+}
+
+int DRM(getctx)(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+
+ DRM_DEBUG("%d\n", ctx.handle);
+
+ if (ctx.handle >= dev->queue_count) return -EINVAL;
+ 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;
+ }
+
+ ctx.flags = q->flags;
+ atomic_dec(&q->use_count);
+
+ if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx)))
+ return -EFAULT;
+
+ return 0;
+}
+
+int DRM(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+ DRM_DEBUG("%d\n", ctx.handle);
+ return DRM(context_switch)(dev, dev->last_context, ctx.handle);
+}
+
+int DRM(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+ DRM_DEBUG("%d\n", ctx.handle);
+ DRM(context_switch_complete)(dev, ctx.handle);
+
+ return 0;
+}
+
+int DRM(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;
+
+ if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
+ return -EFAULT;
+ DRM_DEBUG("%d\n", ctx.handle);
+
+ if (ctx.handle >= dev->queue_count) return -EINVAL;
+ 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)) {
+ 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);
+ return 0;
+}
+
+#endif /* __HAVE_CTX_BITMAP */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h
new file mode 100644
index 000000000..e715bd416
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h
@@ -0,0 +1,594 @@
+/* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*-
+ * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com
+ *
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+#include <linux/interrupt.h> /* For task queue support */
+
+#ifndef __HAVE_DMA_WAITQUEUE
+#define __HAVE_DMA_WAITQUEUE 0
+#endif
+#ifndef __HAVE_DMA_RECLAIM
+#define __HAVE_DMA_RECLAIM 0
+#endif
+
+#if __HAVE_DMA
+
+int DRM(dma_setup)( drm_device_t *dev )
+{
+ int i;
+
+ dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER );
+ if ( !dev->dma )
+ return -ENOMEM;
+
+ memset( dev->dma, 0, sizeof(*dev->dma) );
+
+ for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ )
+ memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
+
+ return 0;
+}
+
+void DRM(dma_takedown)(drm_device_t *dev)
+{
+ drm_device_dma_t *dma = dev->dma;
+ int i, j;
+
+ if (!dma) return;
+
+ /* Clear dma buffers */
+ for (i = 0; i <= DRM_MAX_ORDER; i++) {
+ if (dma->bufs[i].seg_count) {
+ DRM_DEBUG("order %d: buf_count = %d,"
+ " seg_count = %d\n",
+ i,
+ dma->bufs[i].buf_count,
+ dma->bufs[i].seg_count);
+ for (j = 0; j < dma->bufs[i].seg_count; j++) {
+ DRM(free_pages)(dma->bufs[i].seglist[j],
+ dma->bufs[i].page_order,
+ DRM_MEM_DMA);
+ }
+ DRM(free)(dma->bufs[i].seglist,
+ dma->bufs[i].seg_count
+ * sizeof(*dma->bufs[0].seglist),
+ DRM_MEM_SEGS);
+ }
+ if(dma->bufs[i].buf_count) {
+ for(j = 0; j < dma->bufs[i].buf_count; j++) {
+ if(dma->bufs[i].buflist[j].dev_private) {
+ DRM(free)(dma->bufs[i].buflist[j].dev_private,
+ dma->bufs[i].buflist[j].dev_priv_size,
+ DRM_MEM_BUFS);
+ }
+ }
+ DRM(free)(dma->bufs[i].buflist,
+ dma->bufs[i].buf_count *
+ sizeof(*dma->bufs[0].buflist),
+ DRM_MEM_BUFS);
+#if __HAVE_DMA_FREELIST
+ DRM(freelist_destroy)(&dma->bufs[i].freelist);
+#endif
+ }
+ }
+
+ if (dma->buflist) {
+ DRM(free)(dma->buflist,
+ dma->buf_count * sizeof(*dma->buflist),
+ DRM_MEM_BUFS);
+ }
+
+ if (dma->pagelist) {
+ DRM(free)(dma->pagelist,
+ dma->page_count * sizeof(*dma->pagelist),
+ DRM_MEM_PAGES);
+ }
+ DRM(free)(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER);
+ dev->dma = NULL;
+}
+
+
+#if __HAVE_DMA_HISTOGRAM
+/* This is slow, but is useful for debugging. */
+int DRM(histogram_slot)(unsigned long count)
+{
+ int value = DRM_DMA_HISTOGRAM_INITIAL;
+ int slot;
+
+ for (slot = 0;
+ slot < DRM_DMA_HISTOGRAM_SLOTS;
+ ++slot, value = DRM_DMA_HISTOGRAM_NEXT(value)) {
+ if (count < value) return slot;
+ }
+ return DRM_DMA_HISTOGRAM_SLOTS - 1;
+}
+
+void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf)
+{
+ cycles_t queued_to_dispatched;
+ cycles_t dispatched_to_completed;
+ cycles_t completed_to_freed;
+ int q2d, d2c, c2f, q2c, q2f;
+
+ if (buf->time_queued) {
+ queued_to_dispatched = (buf->time_dispatched
+ - buf->time_queued);
+ dispatched_to_completed = (buf->time_completed
+ - buf->time_dispatched);
+ completed_to_freed = (buf->time_freed
+ - buf->time_completed);
+
+ q2d = DRM(histogram_slot)(queued_to_dispatched);
+ d2c = DRM(histogram_slot)(dispatched_to_completed);
+ c2f = DRM(histogram_slot)(completed_to_freed);
+
+ q2c = DRM(histogram_slot)(queued_to_dispatched
+ + dispatched_to_completed);
+ q2f = DRM(histogram_slot)(queued_to_dispatched
+ + dispatched_to_completed
+ + completed_to_freed);
+
+ atomic_inc(&dev->histo.total);
+ atomic_inc(&dev->histo.queued_to_dispatched[q2d]);
+ atomic_inc(&dev->histo.dispatched_to_completed[d2c]);
+ atomic_inc(&dev->histo.completed_to_freed[c2f]);
+
+ atomic_inc(&dev->histo.queued_to_completed[q2c]);
+ atomic_inc(&dev->histo.queued_to_freed[q2f]);
+
+ }
+ buf->time_queued = 0;
+ buf->time_dispatched = 0;
+ buf->time_completed = 0;
+ buf->time_freed = 0;
+}
+#endif
+
+void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
+{
+ if (!buf) return;
+
+ buf->waiting = 0;
+ buf->pending = 0;
+ buf->pid = 0;
+ buf->used = 0;
+#if __HAVE_DMA_HISTOGRAM
+ buf->time_completed = get_cycles();
+#endif
+
+ if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) {
+ wake_up_interruptible(&buf->dma_wait);
+ }
+#if __HAVE_DMA_FREELIST
+ else {
+ drm_device_dma_t *dma = dev->dma;
+ /* If processes are waiting, the last one
+ to wake will put the buffer on the free
+ list. If no processes are waiting, we
+ put the buffer on the freelist here. */
+ DRM(freelist_put)(dev, &dma->bufs[buf->order].freelist, buf);
+ }
+#endif
+}
+
+#if !__HAVE_DMA_RECLAIM
+void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid)
+{
+ drm_device_dma_t *dma = dev->dma;
+ int i;
+
+ if (!dma) return;
+ for (i = 0; i < dma->buf_count; i++) {
+ if (dma->buflist[i]->pid == pid) {
+ switch (dma->buflist[i]->list) {
+ case DRM_LIST_NONE:
+ DRM(free_buffer)(dev, dma->buflist[i]);
+ break;
+ case DRM_LIST_WAIT:
+ dma->buflist[i]->list = DRM_LIST_RECLAIM;
+ break;
+ default:
+ /* Buffer already on hardware. */
+ break;
+ }
+ }
+ }
+}
+#endif
+
+
+/* GH: This is a big hack for now...
+ */
+#if __HAVE_OLD_DMA
+
+void DRM(clear_next_buffer)(drm_device_t *dev)
+{
+ drm_device_dma_t *dma = dev->dma;
+
+ dma->next_buffer = NULL;
+ if (dma->next_queue && !DRM_BUFCOUNT(&dma->next_queue->waitlist)) {
+ wake_up_interruptible(&dma->next_queue->flush_queue);
+ }
+ dma->next_queue = NULL;
+}
+
+int DRM(select_queue)(drm_device_t *dev, void (*wrapper)(unsigned long))
+{
+ int i;
+ int candidate = -1;
+ int j = jiffies;
+
+ if (!dev) {
+ DRM_ERROR("No device\n");
+ return -1;
+ }
+ if (!dev->queuelist || !dev->queuelist[DRM_KERNEL_CONTEXT]) {
+ /* This only happens between the time the
+ interrupt is initialized and the time
+ the queues are initialized. */
+ return -1;
+ }
+
+ /* Doing "while locked" DMA? */
+ if (DRM_WAITCOUNT(dev, DRM_KERNEL_CONTEXT)) {
+ return DRM_KERNEL_CONTEXT;
+ }
+
+ /* If there are buffers on the last_context
+ queue, and we have not been executing
+ this context very long, continue to
+ execute this context. */
+ if (dev->last_switch <= j
+ && dev->last_switch + DRM_TIME_SLICE > j
+ && DRM_WAITCOUNT(dev, dev->last_context)) {
+ return dev->last_context;
+ }
+
+ /* Otherwise, find a candidate */
+ for (i = dev->last_checked + 1; i < dev->queue_count; i++) {
+ if (DRM_WAITCOUNT(dev, i)) {
+ candidate = dev->last_checked = i;
+ break;
+ }
+ }
+
+ if (candidate < 0) {
+ for (i = 0; i < dev->queue_count; i++) {
+ if (DRM_WAITCOUNT(dev, i)) {
+ candidate = dev->last_checked = i;
+ break;
+ }
+ }
+ }
+
+ if (wrapper
+ && candidate >= 0
+ && candidate != dev->last_context
+ && dev->last_switch <= j
+ && dev->last_switch + DRM_TIME_SLICE > j) {
+ if (dev->timer.expires != dev->last_switch + DRM_TIME_SLICE) {
+ del_timer(&dev->timer);
+ dev->timer.function = wrapper;
+ dev->timer.data = (unsigned long)dev;
+ dev->timer.expires = dev->last_switch+DRM_TIME_SLICE;
+ add_timer(&dev->timer);
+ }
+ return -1;
+ }
+
+ return candidate;
+}
+
+
+int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
+{
+ int i;
+ drm_queue_t *q;
+ drm_buf_t *buf;
+ int idx;
+ int while_locked = 0;
+ drm_device_dma_t *dma = dev->dma;
+ DECLARE_WAITQUEUE(entry, current);
+
+ DRM_DEBUG("%d\n", d->send_count);
+
+ if (d->flags & _DRM_DMA_WHILE_LOCKED) {
+ int context = dev->lock.hw_lock->lock;
+
+ if (!_DRM_LOCK_IS_HELD(context)) {
+ DRM_ERROR("No lock held during \"while locked\""
+ " request\n");
+ return -EINVAL;
+ }
+ if (d->context != _DRM_LOCKING_CONTEXT(context)
+ && _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Lock held by %d while %d makes"
+ " \"while locked\" request\n",
+ _DRM_LOCKING_CONTEXT(context),
+ d->context);
+ return -EINVAL;
+ }
+ q = dev->queuelist[DRM_KERNEL_CONTEXT];
+ while_locked = 1;
+ } else {
+ q = dev->queuelist[d->context];
+ }
+
+
+ atomic_inc(&q->use_count);
+ if (atomic_read(&q->block_write)) {
+ add_wait_queue(&q->write_queue, &entry);
+ atomic_inc(&q->block_count);
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ if (!atomic_read(&q->block_write)) break;
+ schedule();
+ if (signal_pending(current)) {
+ atomic_dec(&q->use_count);
+ remove_wait_queue(&q->write_queue, &entry);
+ return -EINTR;
+ }
+ }
+ atomic_dec(&q->block_count);
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&q->write_queue, &entry);
+ }
+
+ for (i = 0; i < d->send_count; i++) {
+ idx = d->send_indices[i];
+ if (idx < 0 || idx >= dma->buf_count) {
+ atomic_dec(&q->use_count);
+ DRM_ERROR("Index %d (of %d max)\n",
+ d->send_indices[i], dma->buf_count - 1);
+ return -EINVAL;
+ }
+ buf = dma->buflist[ idx ];
+ if (buf->pid != current->pid) {
+ atomic_dec(&q->use_count);
+ DRM_ERROR("Process %d using buffer owned by %d\n",
+ current->pid, buf->pid);
+ return -EINVAL;
+ }
+ if (buf->list != DRM_LIST_NONE) {
+ atomic_dec(&q->use_count);
+ DRM_ERROR("Process %d using buffer %d on list %d\n",
+ current->pid, buf->idx, buf->list);
+ }
+ buf->used = d->send_sizes[i];
+ buf->while_locked = while_locked;
+ buf->context = d->context;
+ if (!buf->used) {
+ DRM_ERROR("Queueing 0 length buffer\n");
+ }
+ if (buf->pending) {
+ atomic_dec(&q->use_count);
+ DRM_ERROR("Queueing pending buffer:"
+ " buffer %d, offset %d\n",
+ d->send_indices[i], i);
+ return -EINVAL;
+ }
+ if (buf->waiting) {
+ atomic_dec(&q->use_count);
+ DRM_ERROR("Queueing waiting buffer:"
+ " buffer %d, offset %d\n",
+ d->send_indices[i], i);
+ return -EINVAL;
+ }
+ buf->waiting = 1;
+ if (atomic_read(&q->use_count) == 1
+ || atomic_read(&q->finalization)) {
+ DRM(free_buffer)(dev, buf);
+ } else {
+ DRM(waitlist_put)(&q->waitlist, buf);
+ atomic_inc(&q->total_queued);
+ }
+ }
+ atomic_dec(&q->use_count);
+
+ return 0;
+}
+
+static int DRM(dma_get_buffers_of_order)(drm_device_t *dev, drm_dma_t *d,
+ int order)
+{
+ int i;
+ drm_buf_t *buf;
+ drm_device_dma_t *dma = dev->dma;
+
+ for (i = d->granted_count; i < d->request_count; i++) {
+ buf = DRM(freelist_get)(&dma->bufs[order].freelist,
+ d->flags & _DRM_DMA_WAIT);
+ if (!buf) break;
+ if (buf->pending || buf->waiting) {
+ DRM_ERROR("Free buffer %d in use by %d (w%d, p%d)\n",
+ buf->idx,
+ buf->pid,
+ buf->waiting,
+ buf->pending);
+ }
+ buf->pid = current->pid;
+ if (copy_to_user(&d->request_indices[i],
+ &buf->idx,
+ sizeof(buf->idx)))
+ return -EFAULT;
+
+ if (copy_to_user(&d->request_sizes[i],
+ &buf->total,
+ sizeof(buf->total)))
+ return -EFAULT;
+
+ ++d->granted_count;
+ }
+ return 0;
+}
+
+
+int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
+{
+ int order;
+ int retcode = 0;
+ int tmp_order;
+
+ order = DRM(order)(dma->request_size);
+
+ dma->granted_count = 0;
+ retcode = DRM(dma_get_buffers_of_order)(dev, dma, order);
+
+ if (dma->granted_count < dma->request_count
+ && (dma->flags & _DRM_DMA_SMALLER_OK)) {
+ for (tmp_order = order - 1;
+ !retcode
+ && dma->granted_count < dma->request_count
+ && tmp_order >= DRM_MIN_ORDER;
+ --tmp_order) {
+
+ retcode = DRM(dma_get_buffers_of_order)(dev, dma,
+ tmp_order);
+ }
+ }
+
+ if (dma->granted_count < dma->request_count
+ && (dma->flags & _DRM_DMA_LARGER_OK)) {
+ for (tmp_order = order + 1;
+ !retcode
+ && dma->granted_count < dma->request_count
+ && tmp_order <= DRM_MAX_ORDER;
+ ++tmp_order) {
+
+ retcode = DRM(dma_get_buffers_of_order)(dev, dma,
+ tmp_order);
+ }
+ }
+ return 0;
+}
+
+#endif /* __HAVE_OLD_DMA */
+
+
+#if __HAVE_DMA_IRQ
+
+int DRM(irq_install)( drm_device_t *dev, int irq )
+{
+ int ret;
+
+ 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( "%s: irq=%d\n", __FUNCTION__, 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;
+
+#if __HAVE_DMA_IRQ_BH
+ INIT_LIST_HEAD( &dev->tq.list );
+ dev->tq.sync = 0;
+ dev->tq.routine = DRM(dma_immediate_bh);
+ dev->tq.data = dev;
+#endif
+
+ /* Before installing handler */
+ DRIVER_PREINSTALL();
+
+ /* Install handler */
+ ret = request_irq( dev->irq, DRM(dma_service),
+ 0, dev->devname, dev );
+ if ( ret < 0 ) {
+ down( &dev->struct_sem );
+ dev->irq = 0;
+ up( &dev->struct_sem );
+ return ret;
+ }
+
+ /* After installing handler */
+ DRIVER_POSTINSTALL();
+
+ return 0;
+}
+
+int DRM(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( "%s: irq=%d\n", __FUNCTION__, irq );
+
+ DRIVER_UNINSTALL();
+
+ free_irq( irq, dev );
+
+ return 0;
+}
+
+int DRM(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;
+
+ if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) )
+ return -EFAULT;
+
+ switch ( ctl.func ) {
+ case DRM_INST_HANDLER:
+ return DRM(irq_install)( dev, ctl.irq );
+ case DRM_UNINST_HANDLER:
+ return DRM(irq_uninstall)( dev );
+ default:
+ return -EINVAL;
+ }
+}
+
+#endif /* __HAVE_DMA_IRQ */
+
+#endif /* __HAVE_DMA */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h
new file mode 100644
index 000000000..13e46b9fd
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h
@@ -0,0 +1,51 @@
+/* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*-
+ * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+int DRM(adddraw)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_draw_t draw;
+
+ draw.handle = 0; /* NOOP */
+ DRM_DEBUG("%d\n", draw.handle);
+ if (copy_to_user((drm_draw_t *)arg, &draw, sizeof(draw)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(rmdraw)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ return 0; /* NOOP */
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h
new file mode 100644
index 000000000..7447ca6d4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h
@@ -0,0 +1,938 @@
+/* drm_drv.h -- Generic driver template -*- linux-c -*-
+ * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
+ *
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+/*
+ * To use this template, you must at least define the following (samples
+ * given for the MGA driver):
+ *
+ * #define DRIVER_AUTHOR "VA Linux Systems, Inc."
+ *
+ * #define DRIVER_NAME "mga"
+ * #define DRIVER_DESC "Matrox G200/G400"
+ * #define DRIVER_DATE "20001127"
+ *
+ * #define DRIVER_MAJOR 2
+ * #define DRIVER_MINOR 0
+ * #define DRIVER_PATCHLEVEL 2
+ *
+ * #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( mga_ioctls )
+ *
+ * #define DRM(x) mga_##x
+ */
+
+#ifndef __MUST_HAVE_AGP
+#define __MUST_HAVE_AGP 0
+#endif
+#ifndef __HAVE_CTX_BITMAP
+#define __HAVE_CTX_BITMAP 0
+#endif
+#ifndef __HAVE_DMA_IRQ
+#define __HAVE_DMA_IRQ 0
+#endif
+#ifndef __HAVE_DMA_QUEUE
+#define __HAVE_DMA_QUEUE 0
+#endif
+#ifndef __HAVE_MULTIPLE_DMA_QUEUES
+#define __HAVE_MULTIPLE_DMA_QUEUES 0
+#endif
+#ifndef __HAVE_DMA_SCHEDULE
+#define __HAVE_DMA_SCHEDULE 0
+#endif
+#ifndef __HAVE_DMA_FLUSH
+#define __HAVE_DMA_FLUSH 0
+#endif
+#ifndef __HAVE_DMA_READY
+#define __HAVE_DMA_READY 0
+#endif
+#ifndef __HAVE_DMA_QUIESCENT
+#define __HAVE_DMA_QUIESCENT 0
+#endif
+#ifndef __HAVE_RELEASE
+#define __HAVE_RELEASE 0
+#endif
+#ifndef __HAVE_COUNTERS
+#define __HAVE_COUNTERS 0
+#endif
+
+#ifndef DRIVER_PREINIT
+#define DRIVER_PREINIT()
+#endif
+#ifndef DRIVER_POSTINIT
+#define DRIVER_POSTINIT()
+#endif
+#ifndef DRIVER_PRERELEASE
+#define DRIVER_PRERELEASE()
+#endif
+#ifndef DRIVER_PRETAKEDOWN
+#define DRIVER_PRETAKEDOWN()
+#endif
+#ifndef DRIVER_IOCTLS
+#define DRIVER_IOCTLS
+#endif
+
+
+static drm_device_t DRM(device);
+static int DRM(minor);
+
+static struct file_operations DRM(fops) = {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
+ owner: THIS_MODULE,
+#endif
+ open: DRM(open),
+ flush: DRM(flush),
+ release: DRM(release),
+ ioctl: DRM(ioctl),
+ mmap: DRM(mmap),
+ read: DRM(read),
+ fasync: DRM(fasync),
+ poll: DRM(poll),
+};
+
+
+static drm_ioctl_desc_t DRM(ioctls)[] = {
+ [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(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_GET_MAP)] = { DRM(getmap), 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 },
+
+ [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_AUTH_MAGIC)] = { DRM(authmagic), 1, 1 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 },
+
+ [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 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_LOCK)] = { DRM(lock), 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 },
+
+#if __HAVE_DMA
+ [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 },
+
+ /* The DRM_IOCTL_DMA ioctl should be defined by the driver.
+ */
+#if __HAVE_DMA_IRQ
+ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 },
+#endif
+#endif
+
+#if __REALLY_HAVE_AGP
+ [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 },
+#endif
+
+ DRIVER_IOCTLS
+};
+
+#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( DRM(ioctls) )
+
+#ifdef MODULE
+static char *drm_opts = NULL;
+#endif
+
+MODULE_AUTHOR( DRIVER_AUTHOR );
+MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_PARM( drm_opts, "s" );
+
+#ifndef MODULE
+/* DRM(options) 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.
+ */
+
+static int __init DRM(options)( char *str )
+{
+ DRM(parse_options)( str );
+ return 1;
+}
+
+__setup( DRIVER_NAME "=", DRM(options) );
+#endif
+
+static int DRM(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 );
+
+#if __HAVE_DMA
+ i = DRM(dma_setup)( dev );
+ if ( i < 0 )
+ return i;
+#endif
+
+ dev->counters = 6 + __HAVE_COUNTERS;
+ dev->types[0] = _DRM_STAT_LOCK;
+ dev->types[1] = _DRM_STAT_OPENS;
+ dev->types[2] = _DRM_STAT_CLOSES;
+ dev->types[3] = _DRM_STAT_IOCTLS;
+ dev->types[4] = _DRM_STAT_LOCKS;
+ dev->types[5] = _DRM_STAT_UNLOCKS;
+#ifdef __HAVE_COUNTER6
+ dev->types[6] = __HAVE_COUNTER6;
+#endif
+#ifdef __HAVE_COUNTER7
+ dev->types[7] = __HAVE_COUNTER7;
+#endif
+#ifdef __HAVE_COUNTER8
+ dev->types[8] = __HAVE_COUNTER8;
+#endif
+#ifdef __HAVE_COUNTER9
+ dev->types[9] = __HAVE_COUNTER9;
+#endif
+#ifdef __HAVE_COUNTER10
+ dev->types[10] = __HAVE_COUNTER10;
+#endif
+#ifdef __HAVE_COUNTER11
+ dev->types[11] = __HAVE_COUNTER11;
+#endif
+#ifdef __HAVE_COUNTER12
+ dev->types[12] = __HAVE_COUNTER12;
+#endif
+#ifdef __HAVE_COUNTER13
+ dev->types[13] = __HAVE_COUNTER13;
+#endif
+#ifdef __HAVE_COUNTER14
+ dev->types[14] = __HAVE_COUNTER14;
+#endif
+#ifdef __HAVE_COUNTER15
+ dev->types[14] = __HAVE_COUNTER14;
+#endif
+
+ for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ )
+ atomic_set( &dev->counts[i], 0 );
+
+ for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
+ dev->magiclist[i].head = NULL;
+ dev->magiclist[i].tail = NULL;
+ }
+
+ dev->maplist = DRM(alloc)(sizeof(*dev->maplist),
+ DRM_MEM_MAPS);
+ if(dev->maplist == NULL) return -ENOMEM;
+ memset(dev->maplist, 0, sizeof(*dev->maplist));
+ INIT_LIST_HEAD(&dev->maplist->head);
+ 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 DRM(takedown)( drm_device_t *dev )
+{
+ drm_magic_entry_t *pt, *next;
+ drm_map_t *map;
+ drm_map_list_t *r_list;
+ struct list_head *list;
+ drm_vma_entry_t *vma, *vma_next;
+ int i;
+
+ DRM_DEBUG( "\n" );
+
+ DRIVER_PRETAKEDOWN();
+#if __HAVE_DMA_IRQ
+ if ( dev->irq ) DRM(irq_uninstall)( dev );
+#endif
+
+ 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;
+ }
+
+#if __REALLY_HAVE_AGP
+ /* 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 drv_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_do_release)();
+
+ dev->agp->acquired = 0;
+ dev->agp->enabled = 0;
+ }
+#endif
+
+ /* 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;
+ }
+
+ if( dev->maplist ) {
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *)list;
+ map = r_list->map;
+ DRM(free)(r_list, sizeof(*r_list), DRM_MEM_MAPS);
+ if(!map) continue;
+
+ switch ( map->type ) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#if __REALLY_HAVE_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:
+ vfree(map->handle);
+ break;
+
+ case _DRM_AGP:
+ /* Do nothing here, because this is all
+ * handled in the AGP/GART driver.
+ */
+ break;
+ }
+ DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
+ }
+ DRM(free)(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
+ dev->maplist = NULL;
+ }
+
+#if __HAVE_DMA_QUEUE || __HAVE_MULTIPLE_DMA_QUEUES
+ 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;
+ }
+ dev->queue_count = 0;
+#endif
+
+#if __HAVE_DMA
+ DRM(dma_takedown)( dev );
+#endif
+ 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;
+}
+
+/* drm_init is called via init_module at module load time, or via
+ * linux/init/main.c (this is not currently supported).
+ */
+static int __init drm_init( void )
+{
+ drm_device_t *dev = &DRM(device);
+#if __HAVE_CTX_BITMAP
+ int retcode;
+#endif
+ 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)( drm_opts );
+#endif
+ DRIVER_PREINIT();
+
+ DRM(mem_init)();
+
+ if ((DRM(minor) = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
+ return -EPERM;
+ dev->device = MKDEV(DRM_MAJOR, DRM(minor) );
+ dev->name = DRIVER_NAME;
+
+#if __REALLY_HAVE_AGP
+ dev->agp = DRM(agp_init)();
+#if __MUST_HAVE_AGP
+ if ( dev->agp == NULL ) {
+ DRM_ERROR( "Cannot initialize the agpgart module.\n" );
+ DRM(stub_unregister)(DRM(minor));
+ DRM(takedown)( dev );
+ return -ENOMEM;
+ }
+#endif
+#if __REALLY_HAVE_MTRR
+ if (dev->agp)
+ dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
+ dev->agp->agp_info.aper_size*1024*1024,
+ MTRR_TYPE_WRCOMB,
+ 1 );
+#endif
+#endif
+
+#if __HAVE_CTX_BITMAP
+ retcode = DRM(ctxbitmap_init)( dev );
+ if( retcode ) {
+ DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
+ DRM(stub_unregister)(DRM(minor));
+ DRM(takedown)( dev );
+ return retcode;
+ }
+#endif
+
+ DRIVER_POSTINIT();
+
+ DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n",
+ DRIVER_NAME,
+ DRIVER_MAJOR,
+ DRIVER_MINOR,
+ DRIVER_PATCHLEVEL,
+ DRIVER_DATE,
+ DRM(minor) );
+
+ return 0;
+}
+
+/* drm_cleanup is called via cleanup_module at module unload time.
+ */
+static void __exit drm_cleanup( void )
+{
+ drm_device_t *dev = &DRM(device);
+
+ DRM_DEBUG( "\n" );
+
+ if ( DRM(stub_unregister)(DRM(minor)) ) {
+ DRM_ERROR( "Cannot unload module\n" );
+ } else {
+ DRM_INFO( "Module unloaded\n" );
+ }
+#if __HAVE_CTX_BITMAP
+ DRM(ctxbitmap_cleanup)( dev );
+#endif
+
+#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
+ if ( dev->agp && dev->agp->agp_mtrr ) {
+ int retval;
+ retval = mtrr_del( dev->agp->agp_mtrr,
+ dev->agp->agp_info.aper_base,
+ dev->agp->agp_info.aper_size*1024*1024 );
+ DRM_DEBUG( "mtrr_del=%d\n", retval );
+ }
+#endif
+
+ DRM(takedown)( dev );
+
+#if __REALLY_HAVE_AGP
+ if ( dev->agp ) {
+ DRM(agp_uninit)();
+ DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
+ dev->agp = NULL;
+ }
+#endif
+}
+
+module_init( drm_init );
+module_exit( drm_cleanup );
+
+
+int DRM(version)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_version_t version;
+ int len;
+
+ if ( copy_from_user( &version,
+ (drm_version_t *)arg,
+ sizeof(version) ) )
+ return -EFAULT;
+
+#define DRM_COPY( name, value ) \
+ len = strlen( value ); \
+ if ( len > name##_len ) len = name##_len; \
+ name##_len = strlen( value ); \
+ if ( len && name ) { \
+ if ( copy_to_user( name, value, len ) ) \
+ return -EFAULT; \
+ }
+
+ version.version_major = DRIVER_MAJOR;
+ version.version_minor = DRIVER_MINOR;
+ version.version_patchlevel = DRIVER_PATCHLEVEL;
+
+ DRM_COPY( version.name, DRIVER_NAME );
+ DRM_COPY( version.date, DRIVER_DATE );
+ DRM_COPY( version.desc, DRIVER_DESC );
+
+ if ( copy_to_user( (drm_version_t *)arg,
+ &version,
+ sizeof(version) ) )
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(open)( struct inode *inode, struct file *filp )
+{
+ drm_device_t *dev = &DRM(device);
+ int retcode = 0;
+
+ DRM_DEBUG( "open_count = %d\n", dev->open_count );
+
+ retcode = DRM(open_helper)( inode, filp, dev );
+ if ( !retcode ) {
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
+ atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
+ spin_lock( &dev->count_lock );
+ if ( !dev->open_count++ ) {
+ spin_unlock( &dev->count_lock );
+ return DRM(setup)( dev );
+ }
+ spin_unlock( &dev->count_lock );
+ }
+
+ return retcode;
+}
+
+int DRM(release)( struct inode *inode, struct file *filp )
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev;
+ int retcode = 0;
+
+ lock_kernel();
+ dev = priv->dev;
+
+ DRM_DEBUG( "open_count = %d\n", dev->open_count );
+
+ DRIVER_PRERELEASE();
+
+ /* ========================================================
+ * Begin inline drm_release
+ */
+
+ DRM_DEBUG( "pid = %d, device = 0x%x, open_count = %d\n",
+ current->pid, dev->device, dev->open_count );
+
+ if ( dev->lock.hw_lock &&
+ _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
+ dev->lock.pid == current->pid ) {
+ DRM_DEBUG( "Process %d dead, freeing lock for context %d\n",
+ current->pid,
+ _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
+#if __HAVE_RELEASE
+ DRIVER_RELEASE();
+#endif
+ DRM(lock_free)( dev, &dev->lock.hw_lock->lock,
+ _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
+
+ /* FIXME: may require heavy-handed reset of
+ hardware at this point, possibly
+ processed via a callback to the X
+ server. */
+ }
+#if __HAVE_RELEASE
+ else if ( dev->lock.hw_lock ) {
+ /* The lock is required to reclaim buffers */
+ DECLARE_WAITQUEUE( entry, current );
+ add_wait_queue( &dev->lock.lock_queue, &entry );
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ if ( !dev->lock.hw_lock ) {
+ /* Device has been unregistered */
+ retcode = -EINTR;
+ break;
+ }
+ if ( DRM(lock_take)( &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT ) ) {
+ dev->lock.pid = priv->pid;
+ dev->lock.lock_time = jiffies;
+ atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );
+ break; /* Got lock */
+ }
+ /* Contention */
+#if 0
+ atomic_inc( &dev->total_sleeps );
+#endif
+ schedule();
+ if ( signal_pending( current ) ) {
+ retcode = -ERESTARTSYS;
+ break;
+ }
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue( &dev->lock.lock_queue, &entry );
+ if( !retcode ) {
+ DRIVER_RELEASE();
+ DRM(lock_free)( dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT );
+ }
+ }
+#elif __HAVE_DMA
+ DRM(reclaim_buffers)( dev, priv->pid );
+#endif
+
+ DRM(fasync)( -1, filp, 0 );
+
+ down( &dev->struct_sem );
+ if ( priv->remove_auth_on_close == 1 ) {
+ drm_file_t *temp = dev->file_first;
+ while ( temp ) {
+ temp->authenticated = 0;
+ temp = temp->next;
+ }
+ }
+ if ( priv->prev ) {
+ priv->prev->next = priv->next;
+ } else {
+ dev->file_first = priv->next;
+ }
+ if ( priv->next ) {
+ priv->next->prev = priv->prev;
+ } else {
+ dev->file_last = priv->prev;
+ }
+ up( &dev->struct_sem );
+
+ DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES );
+
+ /* ========================================================
+ * End inline drm_release
+ */
+
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
+ atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
+ 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 );
+ unlock_kernel();
+ return -EBUSY;
+ }
+ spin_unlock( &dev->count_lock );
+ unlock_kernel();
+ return DRM(takedown)( dev );
+ }
+ spin_unlock( &dev->count_lock );
+
+ unlock_kernel();
+ return retcode;
+}
+
+/* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm.
+ */
+int DRM(ioctl)( 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_ioctl_desc_t *ioctl;
+ drm_ioctl_t *func;
+ int nr = DRM_IOCTL_NR(cmd);
+ int retcode = 0;
+
+ atomic_inc( &dev->ioctl_count );
+ atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
+ ++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 >= DRIVER_IOCTL_COUNT ) {
+ retcode = -EINVAL;
+ } else {
+ ioctl = &DRM(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 DRM(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 );
+ drm_lock_t lock;
+ int ret = 0;
+#if __HAVE_MULTIPLE_DMA_QUEUES
+ drm_queue_t *q;
+#endif
+#if __HAVE_DMA_HISTOGRAM
+ cycles_t start;
+
+ dev->lck_start = start = get_cycles();
+#endif
+
+ if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
+ return -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 (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+ lock.context, current->pid,
+ dev->lock.hw_lock->lock, lock.flags );
+
+#if __HAVE_DMA_QUEUE
+ if ( lock.context < 0 )
+ return -EINVAL;
+#elif __HAVE_MULTIPLE_DMA_QUEUES
+ if ( lock.context < 0 || lock.context >= dev->queue_count )
+ return -EINVAL;
+ q = dev->queuelist[lock.context];
+#endif
+
+#if __HAVE_DMA_FLUSH
+ ret = DRM(flush_block_and_flush)( dev, lock.context, lock.flags );
+#endif
+ if ( !ret ) {
+ add_wait_queue( &dev->lock.lock_queue, &entry );
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ 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->counts[_DRM_STAT_LOCKS] );
+ break; /* Got lock */
+ }
+
+ /* Contention */
+ schedule();
+ if ( signal_pending( current ) ) {
+ ret = -ERESTARTSYS;
+ break;
+ }
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue( &dev->lock.lock_queue, &entry );
+ }
+
+#if __HAVE_DMA_FLUSH
+ DRM(flush_unblock)( dev, lock.context, lock.flags ); /* cleanup phase */
+#endif
+
+ if ( !ret ) {
+ sigemptyset( &dev->sigmask );
+ sigaddset( &dev->sigmask, SIGSTOP );
+ sigaddset( &dev->sigmask, SIGTSTP );
+ sigaddset( &dev->sigmask, SIGTTIN );
+ sigaddset( &dev->sigmask, SIGTTOU );
+ dev->sigdata.context = lock.context;
+ dev->sigdata.lock = dev->lock.hw_lock;
+ block_all_signals( DRM(notifier),
+ &dev->sigdata, &dev->sigmask );
+
+#if __HAVE_DMA_READY
+ if ( lock.flags & _DRM_LOCK_READY ) {
+ DRIVER_DMA_READY();
+ }
+#endif
+#if __HAVE_DMA_QUIESCENT
+ if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
+ DRIVER_DMA_QUIESCENT();
+ }
+#endif
+ }
+
+ DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" );
+
+#if __HAVE_DMA_HISTOGRAM
+ atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]);
+#endif
+ return ret;
+}
+
+
+int DRM(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;
+
+ if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
+ return -EFAULT;
+
+ if ( lock.context == DRM_KERNEL_CONTEXT ) {
+ DRM_ERROR( "Process %d using kernel context %d\n",
+ current->pid, lock.context );
+ return -EINVAL;
+ }
+
+ atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
+
+ DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT );
+#if __HAVE_DMA_SCHEDULE
+ DRM(dma_schedule)( dev, 1 );
+#endif
+
+ /* FIXME: Do we ever really need to check this???
+ */
+ if ( 1 /* !dev->context_flag */ ) {
+ if ( DRM(lock_free)( dev, &dev->lock.hw_lock->lock,
+ DRM_KERNEL_CONTEXT ) ) {
+ DRM_ERROR( "\n" );
+ }
+ }
+
+ unblock_all_signals();
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h
new file mode 100644
index 000000000..dd5747669
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h
@@ -0,0 +1,208 @@
+/* drm_fops.h -- File operations for DRM -*- linux-c -*-
+ * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Daryll Strauss <daryll@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include <linux/poll.h>
+
+/* drm_open is called whenever a process opens /dev/drm. */
+
+int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
+{
+ kdev_t minor = MINOR(inode->i_rdev);
+ drm_file_t *priv;
+
+ if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
+ if (!DRM(cpu_valid)()) return -EINVAL;
+
+ DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
+
+ priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES);
+ memset(priv, 0, sizeof(*priv));
+ filp->private_data = priv;
+ priv->uid = current->euid;
+ priv->pid = current->pid;
+ priv->minor = minor;
+ priv->dev = dev;
+ priv->ioctl_count = 0;
+ priv->authenticated = capable(CAP_SYS_ADMIN);
+
+ down(&dev->struct_sem);
+ if (!dev->file_last) {
+ priv->next = NULL;
+ priv->prev = NULL;
+ dev->file_first = priv;
+ dev->file_last = priv;
+ } else {
+ priv->next = NULL;
+ priv->prev = dev->file_last;
+ dev->file_last->next = priv;
+ dev->file_last = priv;
+ }
+ up(&dev->struct_sem);
+
+ return 0;
+}
+
+int DRM(flush)(struct file *filp)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+
+ DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
+ current->pid, dev->device, dev->open_count);
+ return 0;
+}
+
+int DRM(fasync)(int fd, struct file *filp, int on)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int retcode;
+
+ DRM_DEBUG("fd = %d, device = 0x%x\n", fd, dev->device);
+ retcode = fasync_helper(fd, filp, on, &dev->buf_async);
+ if (retcode < 0) return retcode;
+ return 0;
+}
+
+
+/* The drm_read and drm_write_string code (especially that which manages
+ the circular buffer), is based on Alessandro Rubini's LINUX DEVICE
+ DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */
+
+ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ int left;
+ int avail;
+ int send;
+ int cur;
+
+ DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp);
+
+ while (dev->buf_rp == dev->buf_wp) {
+ DRM_DEBUG(" sleeping\n");
+ if (filp->f_flags & O_NONBLOCK) {
+ return -EAGAIN;
+ }
+ interruptible_sleep_on(&dev->buf_readers);
+ if (signal_pending(current)) {
+ DRM_DEBUG(" interrupted\n");
+ return -ERESTARTSYS;
+ }
+ DRM_DEBUG(" awake\n");
+ }
+
+ left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ;
+ avail = DRM_BSZ - left;
+ send = DRM_MIN(avail, count);
+
+ while (send) {
+ if (dev->buf_wp > dev->buf_rp) {
+ cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp);
+ } else {
+ cur = DRM_MIN(send, dev->buf_end - dev->buf_rp);
+ }
+ if (copy_to_user(buf, dev->buf_rp, cur))
+ return -EFAULT;
+ dev->buf_rp += cur;
+ if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf;
+ send -= cur;
+ }
+
+ wake_up_interruptible(&dev->buf_writers);
+ return DRM_MIN(avail, count);;
+}
+
+int DRM(write_string)(drm_device_t *dev, const char *s)
+{
+ int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ;
+ int send = strlen(s);
+ int count;
+
+ DRM_DEBUG("%d left, %d to send (%p, %p)\n",
+ left, send, dev->buf_rp, dev->buf_wp);
+
+ if (left == 1 || dev->buf_wp != dev->buf_rp) {
+ DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n",
+ left,
+ dev->buf_wp,
+ dev->buf_rp);
+ }
+
+ while (send) {
+ if (dev->buf_wp >= dev->buf_rp) {
+ count = DRM_MIN(send, dev->buf_end - dev->buf_wp);
+ if (count == left) --count; /* Leave a hole */
+ } else {
+ count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1);
+ }
+ strncpy(dev->buf_wp, s, count);
+ dev->buf_wp += count;
+ if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf;
+ send -= count;
+ }
+
+#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS)
+ /* The extra parameter to kill_fasync was added in 2.3.21, and is
+ _not_ present in _stock_ 2.2.14 and 2.2.15. However, some
+ distributions patch 2.2.x kernels to add this parameter. The
+ Makefile.linux attempts to detect this addition and defines
+ KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */
+ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
+#else
+
+ /* Parameter added in 2.3.21. */
+#if LINUX_VERSION_CODE < 0x020400
+ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
+#else
+ /* Type of first parameter changed in
+ Linux 2.4.0-test2... */
+ if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN);
+#endif
+#endif
+ DRM_DEBUG("waking\n");
+ wake_up_interruptible(&dev->buf_readers);
+ return 0;
+}
+
+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/drm_init.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h
new file mode 100644
index 000000000..9ae984147
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h
@@ -0,0 +1,112 @@
+/* drm_init.h -- Setup/Cleanup for DRM -*- linux-c -*-
+ * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+int DRM(flags) = 0;
+
+/* drm_parse_option parses a single option. See description for
+ * drm_parse_options for details.
+ */
+static void DRM(parse_option)(char *s)
+{
+ char *c, *r;
+
+ DRM_DEBUG("\"%s\"\n", s);
+ if (!s || !*s) return;
+ for (c = s; *c && *c != ':'; c++); /* find : or \0 */
+ if (*c) r = c + 1; else r = NULL; /* remember remainder */
+ *c = '\0'; /* terminate */
+ if (!strcmp(s, "noctx")) {
+ DRM(flags) |= DRM_FLAG_NOCTX;
+ DRM_INFO("Server-mediated context switching OFF\n");
+ return;
+ }
+ if (!strcmp(s, "debug")) {
+ DRM(flags) |= DRM_FLAG_DEBUG;
+ DRM_INFO("Debug messages ON\n");
+ return;
+ }
+ DRM_ERROR("\"%s\" is not a valid option\n", s);
+ return;
+}
+
+/* drm_parse_options parse the insmod "drm=" options, or the command-line
+ * options passed to the kernel via LILO. The grammar of the format is as
+ * follows:
+ *
+ * drm ::= 'drm=' option_list
+ * option_list ::= option [ ';' option_list ]
+ * option ::= 'device:' major
+ * | 'debug'
+ * | 'noctx'
+ * major ::= INTEGER
+ *
+ * Note that 's' contains option_list without the 'drm=' part.
+ *
+ * device=major,minor specifies the device number used for /dev/drm
+ * if major == 0 then the misc device is used
+ * if major == 0 and minor == 0 then dynamic misc allocation is used
+ * debug=on specifies that debugging messages will be printk'd
+ * debug=trace specifies that each function call will be logged via printk
+ * debug=off turns off all debugging options
+ *
+ */
+
+void DRM(parse_options)(char *s)
+{
+ char *h, *t, *n;
+
+ DRM_DEBUG("\"%s\"\n", s ?: "");
+ if (!s || !*s) return;
+
+ for (h = t = n = s; h && *h; h = n) {
+ for (; *t && *t != ';'; t++); /* find ; or \0 */
+ if (*t) n = t + 1; else n = NULL; /* remember next */
+ *t = '\0'; /* terminate */
+ DRM(parse_option)(h); /* parse */
+ }
+}
+
+/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0
+ * otherwise.
+ */
+int DRM(cpu_valid)(void)
+{
+#if defined(__i386__)
+ if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
+#endif
+#if defined(__sparc__) && !defined(__sparc_v9__)
+ return 0; /* No cmpxchg before v9 sparc. */
+#endif
+ return 1;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h
new file mode 100644
index 000000000..2fba6b0c2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h
@@ -0,0 +1,210 @@
+/* drm_ioctl.h -- IOCTL processing for DRM -*- linux-c -*-
+ * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+int DRM(irq_busid)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_irq_busid_t p;
+ struct pci_dev *dev;
+
+ if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p)))
+ return -EFAULT;
+ dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum));
+ if (dev) p.irq = dev->irq;
+ else p.irq = 0;
+ DRM_DEBUG("%d:%d:%d => IRQ %d\n",
+ p.busnum, p.devnum, p.funcnum, p.irq);
+ if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(getunique)(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_unique_t u;
+
+ if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u)))
+ return -EFAULT;
+ if (u.unique_len >= dev->unique_len) {
+ if (copy_to_user(u.unique, dev->unique, dev->unique_len))
+ return -EFAULT;
+ }
+ u.unique_len = dev->unique_len;
+ if (copy_to_user((drm_unique_t *)arg, &u, sizeof(u)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(setunique)(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_unique_t u;
+
+ if (dev->unique_len || dev->unique)
+ return -EBUSY;
+
+ if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u)))
+ return -EFAULT;
+
+ if (!u.unique_len)
+ return -EINVAL;
+
+ dev->unique_len = u.unique_len;
+ dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER);
+ if (copy_from_user(dev->unique, u.unique, dev->unique_len))
+ return -EFAULT;
+ dev->unique[dev->unique_len] = '\0';
+
+ dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2,
+ DRM_MEM_DRIVER);
+ sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
+
+ return 0;
+}
+
+
+int DRM(getmap)( 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_map_t map;
+ drm_map_list_t *r_list = NULL;
+ struct list_head *list;
+ int idx;
+ int i;
+
+ if (copy_from_user(&map, (drm_map_t *)arg, sizeof(map)))
+ return -EFAULT;
+ idx = map.offset;
+
+ down(&dev->struct_sem);
+ if (idx < 0 || idx >= dev->map_count) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+
+ i = 0;
+ list_for_each(list, &dev->maplist->head) {
+ if(i == idx) {
+ r_list = (drm_map_list_t *)list;
+ break;
+ }
+ i++;
+ }
+ if(!r_list || !r_list->map) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+
+ map.offset = r_list->map->offset;
+ map.size = r_list->map->size;
+ map.type = r_list->map->type;
+ map.flags = r_list->map->flags;
+ map.handle = r_list->map->handle;
+ map.mtrr = r_list->map->mtrr;
+ up(&dev->struct_sem);
+
+ if (copy_to_user((drm_map_t *)arg, &map, sizeof(map))) return -EFAULT;
+ return 0;
+}
+
+int DRM(getclient)( 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_client_t client;
+ drm_file_t *pt;
+ int idx;
+ int i;
+
+ if (copy_from_user(&client, (drm_client_t *)arg, sizeof(client)))
+ return -EFAULT;
+ idx = client.idx;
+ down(&dev->struct_sem);
+ for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next)
+ ;
+
+ if (!pt) {
+ up(&dev->struct_sem);
+ return -EINVAL;
+ }
+ client.auth = pt->authenticated;
+ client.pid = pt->pid;
+ client.uid = pt->uid;
+ client.magic = pt->magic;
+ client.iocs = pt->ioctl_count;
+ up(&dev->struct_sem);
+
+ if (copy_to_user((drm_client_t *)arg, &client, sizeof(client)))
+ return -EFAULT;
+ return 0;
+}
+
+int DRM(getstats)( 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_stats_t stats;
+ int i;
+
+ memset(&stats, 0, sizeof(stats));
+
+ down(&dev->struct_sem);
+
+ for (i = 0; i < dev->counters; i++) {
+ if (dev->types[i] == _DRM_STAT_LOCK)
+ stats.data[i].value
+ = (dev->lock.hw_lock
+ ? dev->lock.hw_lock->lock : 0);
+ else
+ stats.data[i].value = atomic_read(&dev->counts[i]);
+ stats.data[i].type = dev->types[i];
+ }
+
+ stats.count = dev->counters;
+
+ up(&dev->struct_sem);
+
+ if (copy_to_user((drm_stats_t *)arg, &stats, sizeof(stats)))
+ return -EFAULT;
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h
new file mode 100644
index 000000000..f8dbaaa71
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h
@@ -0,0 +1,227 @@
+/* drm_lists.h -- Buffer list handling routines -*- linux-c -*-
+ * Created: Mon Apr 19 20:54:22 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+#if __HAVE_DMA_WAITLIST
+
+int DRM(waitlist_create)(drm_waitlist_t *bl, int count)
+{
+ if (bl->count) return -EINVAL;
+
+ bl->count = count;
+ bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs),
+ DRM_MEM_BUFLISTS);
+ bl->rp = bl->bufs;
+ bl->wp = bl->bufs;
+ bl->end = &bl->bufs[bl->count+1];
+ bl->write_lock = SPIN_LOCK_UNLOCKED;
+ bl->read_lock = SPIN_LOCK_UNLOCKED;
+ return 0;
+}
+
+int DRM(waitlist_destroy)(drm_waitlist_t *bl)
+{
+ if (bl->rp != bl->wp) return -EINVAL;
+ if (bl->bufs) DRM(free)(bl->bufs,
+ (bl->count + 2) * sizeof(*bl->bufs),
+ DRM_MEM_BUFLISTS);
+ bl->count = 0;
+ bl->bufs = NULL;
+ bl->rp = NULL;
+ bl->wp = NULL;
+ bl->end = NULL;
+ return 0;
+}
+
+int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf)
+{
+ int left;
+ unsigned long flags;
+
+ left = DRM_LEFTCOUNT(bl);
+ if (!left) {
+ DRM_ERROR("Overflow while adding buffer %d from pid %d\n",
+ buf->idx, buf->pid);
+ return -EINVAL;
+ }
+#if __HAVE_DMA_HISTOGRAM
+ buf->time_queued = get_cycles();
+#endif
+ buf->list = DRM_LIST_WAIT;
+
+ spin_lock_irqsave(&bl->write_lock, flags);
+ *bl->wp = buf;
+ if (++bl->wp >= bl->end) bl->wp = bl->bufs;
+ spin_unlock_irqrestore(&bl->write_lock, flags);
+
+ return 0;
+}
+
+drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl)
+{
+ drm_buf_t *buf;
+ unsigned long flags;
+
+ spin_lock_irqsave(&bl->read_lock, flags);
+ buf = *bl->rp;
+ if (bl->rp == bl->wp) {
+ spin_unlock_irqrestore(&bl->read_lock, flags);
+ return NULL;
+ }
+ if (++bl->rp >= bl->end) bl->rp = bl->bufs;
+ spin_unlock_irqrestore(&bl->read_lock, flags);
+
+ return buf;
+}
+
+#endif /* __HAVE_DMA_WAITLIST */
+
+
+#if __HAVE_DMA_FREELIST
+
+int DRM(freelist_create)(drm_freelist_t *bl, int count)
+{
+ atomic_set(&bl->count, 0);
+ bl->next = NULL;
+ init_waitqueue_head(&bl->waiting);
+ bl->low_mark = 0;
+ bl->high_mark = 0;
+ atomic_set(&bl->wfh, 0);
+ bl->lock = SPIN_LOCK_UNLOCKED;
+ ++bl->initialized;
+ return 0;
+}
+
+int DRM(freelist_destroy)(drm_freelist_t *bl)
+{
+ atomic_set(&bl->count, 0);
+ bl->next = NULL;
+ return 0;
+}
+
+int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
+{
+ drm_device_dma_t *dma = dev->dma;
+
+ if (!dma) {
+ DRM_ERROR("No DMA support\n");
+ return 1;
+ }
+
+ if (buf->waiting || buf->pending || buf->list == DRM_LIST_FREE) {
+ DRM_ERROR("Freed buffer %d: w%d, p%d, l%d\n",
+ buf->idx, buf->waiting, buf->pending, buf->list);
+ }
+ if (!bl) return 1;
+#if __HAVE_DMA_HISTOGRAM
+ buf->time_freed = get_cycles();
+ DRM(histogram_compute)(dev, buf);
+#endif
+ buf->list = DRM_LIST_FREE;
+
+ spin_lock(&bl->lock);
+ buf->next = bl->next;
+ bl->next = buf;
+ spin_unlock(&bl->lock);
+
+ atomic_inc(&bl->count);
+ if (atomic_read(&bl->count) > dma->buf_count) {
+ DRM_ERROR("%d of %d buffers free after addition of %d\n",
+ atomic_read(&bl->count), dma->buf_count, buf->idx);
+ return 1;
+ }
+ /* Check for high water mark */
+ if (atomic_read(&bl->wfh) && atomic_read(&bl->count)>=bl->high_mark) {
+ atomic_set(&bl->wfh, 0);
+ wake_up_interruptible(&bl->waiting);
+ }
+ return 0;
+}
+
+static drm_buf_t *DRM(freelist_try)(drm_freelist_t *bl)
+{
+ drm_buf_t *buf;
+
+ if (!bl) return NULL;
+
+ /* Get buffer */
+ spin_lock(&bl->lock);
+ if (!bl->next) {
+ spin_unlock(&bl->lock);
+ return NULL;
+ }
+ buf = bl->next;
+ bl->next = bl->next->next;
+ spin_unlock(&bl->lock);
+
+ atomic_dec(&bl->count);
+ buf->next = NULL;
+ buf->list = DRM_LIST_NONE;
+ if (buf->waiting || buf->pending) {
+ DRM_ERROR("Free buffer %d: w%d, p%d, l%d\n",
+ buf->idx, buf->waiting, buf->pending, buf->list);
+ }
+
+ return buf;
+}
+
+drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block)
+{
+ drm_buf_t *buf = NULL;
+ DECLARE_WAITQUEUE(entry, current);
+
+ if (!bl || !bl->initialized) return NULL;
+
+ /* Check for low water mark */
+ if (atomic_read(&bl->count) <= bl->low_mark) /* Became low */
+ atomic_set(&bl->wfh, 1);
+ if (atomic_read(&bl->wfh)) {
+ if (block) {
+ add_wait_queue(&bl->waiting, &entry);
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ if (!atomic_read(&bl->wfh)
+ && (buf = DRM(freelist_try)(bl))) break;
+ schedule();
+ if (signal_pending(current)) break;
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&bl->waiting, &entry);
+ }
+ return buf;
+ }
+
+ return DRM(freelist_try)(bl);
+}
+
+#endif /* __HAVE_DMA_FREELIST */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h
new file mode 100644
index 000000000..c10cfe2c0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h
@@ -0,0 +1,251 @@
+/* lock.c -- IOCTLs for locking -*- linux-c -*-
+ * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ DRM_DEBUG("\n");
+ return 0;
+}
+
+int DRM(unblock)(struct inode *inode, struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ DRM_DEBUG("\n");
+ return 0;
+}
+
+int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
+{
+ unsigned int old, new, prev;
+
+ do {
+ old = *lock;
+ if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT;
+ else new = context | _DRM_LOCK_HELD;
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
+ if (_DRM_LOCKING_CONTEXT(old) == context) {
+ if (old & _DRM_LOCK_HELD) {
+ if (context != DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("%d holds heavyweight lock\n",
+ context);
+ }
+ return 0;
+ }
+ }
+ if (new == (context | _DRM_LOCK_HELD)) {
+ /* Have lock */
+ return 1;
+ }
+ return 0;
+}
+
+/* This takes a lock forcibly and hands it to context. Should ONLY be used
+ inside *_unlock to give lock to kernel before calling *_dma_schedule. */
+int DRM(lock_transfer)(drm_device_t *dev,
+ __volatile__ unsigned int *lock, unsigned int context)
+{
+ unsigned int old, new, prev;
+
+ dev->lock.pid = 0;
+ do {
+ old = *lock;
+ new = context | _DRM_LOCK_HELD;
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
+ return 1;
+}
+
+int DRM(lock_free)(drm_device_t *dev,
+ __volatile__ unsigned int *lock, unsigned int context)
+{
+ unsigned int old, new, prev;
+ pid_t pid = dev->lock.pid;
+
+ dev->lock.pid = 0;
+ do {
+ old = *lock;
+ new = 0;
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
+ if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
+ DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n",
+ context,
+ _DRM_LOCKING_CONTEXT(old),
+ pid);
+ return 1;
+ }
+ wake_up_interruptible(&dev->lock.lock_queue);
+ return 0;
+}
+
+static int DRM(flush_queue)(drm_device_t *dev, int context)
+{
+ DECLARE_WAITQUEUE(entry, current);
+ int ret = 0;
+ drm_queue_t *q = dev->queuelist[context];
+
+ DRM_DEBUG("\n");
+
+ atomic_inc(&q->use_count);
+ if (atomic_read(&q->use_count) > 1) {
+ atomic_inc(&q->block_write);
+ add_wait_queue(&q->flush_queue, &entry);
+ atomic_inc(&q->block_count);
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ if (!DRM_BUFCOUNT(&q->waitlist)) break;
+ schedule();
+ if (signal_pending(current)) {
+ ret = -EINTR; /* Can't restart */
+ break;
+ }
+ }
+ atomic_dec(&q->block_count);
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&q->flush_queue, &entry);
+ }
+ atomic_dec(&q->use_count);
+
+ /* NOTE: block_write is still incremented!
+ Use drm_flush_unlock_queue to decrement. */
+ return ret;
+}
+
+static int DRM(flush_unblock_queue)(drm_device_t *dev, int context)
+{
+ drm_queue_t *q = dev->queuelist[context];
+
+ DRM_DEBUG("\n");
+
+ atomic_inc(&q->use_count);
+ if (atomic_read(&q->use_count) > 1) {
+ if (atomic_read(&q->block_write)) {
+ atomic_dec(&q->block_write);
+ wake_up_interruptible(&q->write_queue);
+ }
+ }
+ atomic_dec(&q->use_count);
+ return 0;
+}
+
+int DRM(flush_block_and_flush)(drm_device_t *dev, int context,
+ drm_lock_flags_t flags)
+{
+ int ret = 0;
+ int i;
+
+ DRM_DEBUG("\n");
+
+ if (flags & _DRM_LOCK_FLUSH) {
+ ret = DRM(flush_queue)(dev, DRM_KERNEL_CONTEXT);
+ if (!ret) ret = DRM(flush_queue)(dev, context);
+ }
+ if (flags & _DRM_LOCK_FLUSH_ALL) {
+ for (i = 0; !ret && i < dev->queue_count; i++) {
+ ret = DRM(flush_queue)(dev, i);
+ }
+ }
+ return ret;
+}
+
+int DRM(flush_unblock)(drm_device_t *dev, int context, drm_lock_flags_t flags)
+{
+ int ret = 0;
+ int i;
+
+ DRM_DEBUG("\n");
+
+ if (flags & _DRM_LOCK_FLUSH) {
+ ret = DRM(flush_unblock_queue)(dev, DRM_KERNEL_CONTEXT);
+ if (!ret) ret = DRM(flush_unblock_queue)(dev, context);
+ }
+ if (flags & _DRM_LOCK_FLUSH_ALL) {
+ for (i = 0; !ret && i < dev->queue_count; i++) {
+ ret = DRM(flush_unblock_queue)(dev, i);
+ }
+ }
+
+ return ret;
+}
+
+int DRM(finish)(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 ret = 0;
+ drm_lock_t lock;
+
+ DRM_DEBUG("\n");
+
+ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
+ return -EFAULT;
+ ret = DRM(flush_block_and_flush)(dev, lock.context, lock.flags);
+ DRM(flush_unblock)(dev, lock.context, lock.flags);
+ return ret;
+}
+
+/* If we get here, it means that the process has called DRM_IOCTL_LOCK
+ without calling DRM_IOCTL_UNLOCK.
+
+ If the lock is not held, then let the signal proceed as usual.
+
+ If the lock is held, then set the contended flag and keep the signal
+ blocked.
+
+
+ Return 1 if the signal should be delivered normally.
+ Return 0 if the signal should be blocked. */
+
+int DRM(notifier)(void *priv)
+{
+ drm_sigdata_t *s = (drm_sigdata_t *)priv;
+ unsigned int old, new, prev;
+
+
+ /* Allow signal delivery if lock isn't held */
+ if (!_DRM_LOCK_IS_HELD(s->lock->lock)
+ || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1;
+
+ /* Otherwise, set flag to force call to
+ drmUnlock */
+ do {
+ old = s->lock->lock;
+ new = old | _DRM_LOCK_CONT;
+ prev = cmpxchg(&s->lock->lock, old, new);
+ } while (prev != old);
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h
new file mode 100644
index 000000000..1763d9b41
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h
@@ -0,0 +1,458 @@
+/* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*-
+ * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include <linux/config.h>
+#include "drmP.h"
+#include <linux/wrapper.h>
+
+typedef struct drm_mem_stats {
+ const char *name;
+ int succeed_count;
+ int free_count;
+ int fail_count;
+ unsigned long bytes_allocated;
+ unsigned long bytes_freed;
+} drm_mem_stats_t;
+
+static spinlock_t DRM(mem_lock) = SPIN_LOCK_UNLOCKED;
+static unsigned long DRM(ram_available) = 0; /* In pages */
+static unsigned long DRM(ram_used) = 0;
+static drm_mem_stats_t DRM(mem_stats)[] = {
+ [DRM_MEM_DMA] = { "dmabufs" },
+ [DRM_MEM_SAREA] = { "sareas" },
+ [DRM_MEM_DRIVER] = { "driver" },
+ [DRM_MEM_MAGIC] = { "magic" },
+ [DRM_MEM_IOCTLS] = { "ioctltab" },
+ [DRM_MEM_MAPS] = { "maplist" },
+ [DRM_MEM_VMAS] = { "vmalist" },
+ [DRM_MEM_BUFS] = { "buflist" },
+ [DRM_MEM_SEGS] = { "seglist" },
+ [DRM_MEM_PAGES] = { "pagelist" },
+ [DRM_MEM_FILES] = { "files" },
+ [DRM_MEM_QUEUES] = { "queues" },
+ [DRM_MEM_CMDS] = { "commands" },
+ [DRM_MEM_MAPPINGS] = { "mappings" },
+ [DRM_MEM_BUFLISTS] = { "buflists" },
+ [DRM_MEM_AGPLISTS] = { "agplist" },
+ [DRM_MEM_TOTALAGP] = { "totalagp" },
+ [DRM_MEM_BOUNDAGP] = { "boundagp" },
+ [DRM_MEM_CTXBITMAP] = { "ctxbitmap"},
+ [DRM_MEM_STUB] = { "stub" },
+ { NULL, 0, } /* Last entry must be null */
+};
+
+void DRM(mem_init)(void)
+{
+ drm_mem_stats_t *mem;
+ struct sysinfo si;
+
+ for (mem = DRM(mem_stats); mem->name; ++mem) {
+ mem->succeed_count = 0;
+ mem->free_count = 0;
+ mem->fail_count = 0;
+ mem->bytes_allocated = 0;
+ mem->bytes_freed = 0;
+ }
+
+ si_meminfo(&si);
+#if LINUX_VERSION_CODE < 0x020317
+ /* Changed to page count in 2.3.23 */
+ DRM(ram_available) = si.totalram >> PAGE_SHIFT;
+#else
+ DRM(ram_available) = si.totalram;
+#endif
+ DRM(ram_used) = 0;
+}
+
+/* drm_mem_info is called whenever a process reads /dev/drm/mem. */
+
+static int DRM(_mem_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data)
+{
+ drm_mem_stats_t *pt;
+ int len = 0;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *eof = 0;
+ *start = &buf[offset];
+
+ DRM_PROC_PRINT(" total counts "
+ " | outstanding \n");
+ DRM_PROC_PRINT("type alloc freed fail bytes freed"
+ " | allocs bytes\n\n");
+ DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
+ "system", 0, 0, 0,
+ DRM(ram_available) << (PAGE_SHIFT - 10));
+ DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
+ "locked", 0, 0, 0, DRM(ram_used) >> 10);
+ DRM_PROC_PRINT("\n");
+ for (pt = DRM(mem_stats); pt->name; pt++) {
+ DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n",
+ pt->name,
+ pt->succeed_count,
+ pt->free_count,
+ pt->fail_count,
+ pt->bytes_allocated,
+ pt->bytes_freed,
+ pt->succeed_count - pt->free_count,
+ (long)pt->bytes_allocated
+ - (long)pt->bytes_freed);
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+int DRM(mem_info)(char *buf, char **start, off_t offset,
+ int len, int *eof, void *data)
+{
+ int ret;
+
+ spin_lock(&DRM(mem_lock));
+ ret = DRM(_mem_info)(buf, start, offset, len, eof, data);
+ spin_unlock(&DRM(mem_lock));
+ return ret;
+}
+
+void *DRM(alloc)(size_t size, int area)
+{
+ void *pt;
+
+ if (!size) {
+ DRM_MEM_ERROR(area, "Allocating 0 bytes\n");
+ return NULL;
+ }
+
+ if (!(pt = kmalloc(size, GFP_KERNEL))) {
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[area].fail_count;
+ spin_unlock(&DRM(mem_lock));
+ return NULL;
+ }
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[area].succeed_count;
+ DRM(mem_stats)[area].bytes_allocated += size;
+ spin_unlock(&DRM(mem_lock));
+ return pt;
+}
+
+void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
+{
+ void *pt;
+
+ if (!(pt = DRM(alloc)(size, area))) return NULL;
+ if (oldpt && oldsize) {
+ memcpy(pt, oldpt, oldsize);
+ DRM(free)(oldpt, oldsize, area);
+ }
+ return pt;
+}
+
+char *DRM(strdup)(const char *s, int area)
+{
+ char *pt;
+ int length = s ? strlen(s) : 0;
+
+ if (!(pt = DRM(alloc)(length+1, area))) return NULL;
+ strcpy(pt, s);
+ return pt;
+}
+
+void DRM(strfree)(const char *s, int area)
+{
+ unsigned int size;
+
+ if (!s) return;
+
+ size = 1 + (s ? strlen(s) : 0);
+ DRM(free)((void *)s, size, area);
+}
+
+void DRM(free)(void *pt, size_t size, int area)
+{
+ int alloc_count;
+ int free_count;
+
+ if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n");
+ else kfree(pt);
+ spin_lock(&DRM(mem_lock));
+ DRM(mem_stats)[area].bytes_freed += size;
+ free_count = ++DRM(mem_stats)[area].free_count;
+ alloc_count = DRM(mem_stats)[area].succeed_count;
+ spin_unlock(&DRM(mem_lock));
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
+ }
+}
+
+unsigned long DRM(alloc_pages)(int order, int area)
+{
+ unsigned long address;
+ unsigned long bytes = PAGE_SIZE << order;
+ unsigned long addr;
+ unsigned int sz;
+
+ spin_lock(&DRM(mem_lock));
+ if ((DRM(ram_used) >> PAGE_SHIFT)
+ > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) {
+ spin_unlock(&DRM(mem_lock));
+ return 0;
+ }
+ spin_unlock(&DRM(mem_lock));
+
+ address = __get_free_pages(GFP_KERNEL, order);
+ if (!address) {
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[area].fail_count;
+ spin_unlock(&DRM(mem_lock));
+ return 0;
+ }
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[area].succeed_count;
+ DRM(mem_stats)[area].bytes_allocated += bytes;
+ DRM(ram_used) += bytes;
+ spin_unlock(&DRM(mem_lock));
+
+
+ /* Zero outside the lock */
+ memset((void *)address, 0, bytes);
+
+ /* Reserve */
+ for (addr = address, sz = bytes;
+ sz > 0;
+ addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* Argument type changed in 2.4.0-test6/pre8 */
+ mem_map_reserve(virt_to_page(addr));
+#else
+ mem_map_reserve(MAP_NR(addr));
+#endif
+ }
+
+ return address;
+}
+
+void DRM(free_pages)(unsigned long address, int order, int area)
+{
+ unsigned long bytes = PAGE_SIZE << order;
+ int alloc_count;
+ int free_count;
+ unsigned long addr;
+ unsigned int sz;
+
+ if (!address) {
+ DRM_MEM_ERROR(area, "Attempt to free address 0\n");
+ } else {
+ /* Unreserve */
+ for (addr = address, sz = bytes;
+ sz > 0;
+ addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* Argument type changed in 2.4.0-test6/pre8 */
+ mem_map_unreserve(virt_to_page(addr));
+#else
+ mem_map_unreserve(MAP_NR(addr));
+#endif
+ }
+ free_pages(address, order);
+ }
+
+ spin_lock(&DRM(mem_lock));
+ free_count = ++DRM(mem_stats)[area].free_count;
+ alloc_count = DRM(mem_stats)[area].succeed_count;
+ DRM(mem_stats)[area].bytes_freed += bytes;
+ DRM(ram_used) -= bytes;
+ spin_unlock(&DRM(mem_lock));
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(area,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
+ }
+}
+
+void *DRM(ioremap)(unsigned long offset, unsigned long size)
+{
+ void *pt;
+
+ if (!size) {
+ DRM_MEM_ERROR(DRM_MEM_MAPPINGS,
+ "Mapping 0 bytes at 0x%08lx\n", offset);
+ return NULL;
+ }
+
+ if (!(pt = ioremap(offset, size))) {
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count;
+ spin_unlock(&DRM(mem_lock));
+ return NULL;
+ }
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count;
+ DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size;
+ spin_unlock(&DRM(mem_lock));
+ return pt;
+}
+
+void DRM(ioremapfree)(void *pt, unsigned long size)
+{
+ int alloc_count;
+ int free_count;
+
+ if (!pt)
+ DRM_MEM_ERROR(DRM_MEM_MAPPINGS,
+ "Attempt to free NULL pointer\n");
+ else
+ iounmap(pt);
+
+ spin_lock(&DRM(mem_lock));
+ DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size;
+ free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count;
+ alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count;
+ spin_unlock(&DRM(mem_lock));
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_MAPPINGS,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
+ }
+}
+
+#if __REALLY_HAVE_AGP
+
+agp_memory *DRM(alloc_agp)(int pages, u32 type)
+{
+ agp_memory *handle;
+
+ if (!pages) {
+ DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n");
+ return NULL;
+ }
+
+ if ((handle = DRM(agp_allocate_memory)(pages, type))) {
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count;
+ DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated
+ += pages << PAGE_SHIFT;
+ spin_unlock(&DRM(mem_lock));
+ return handle;
+ }
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count;
+ spin_unlock(&DRM(mem_lock));
+ return NULL;
+}
+
+int DRM(free_agp)(agp_memory *handle, int pages)
+{
+ int alloc_count;
+ int free_count;
+ int retval = -EINVAL;
+
+ if (!handle) {
+ DRM_MEM_ERROR(DRM_MEM_TOTALAGP,
+ "Attempt to free NULL AGP handle\n");
+ return retval;;
+ }
+
+ if (DRM(agp_free_memory)(handle)) {
+ spin_lock(&DRM(mem_lock));
+ free_count = ++DRM(mem_stats)[DRM_MEM_TOTALAGP].free_count;
+ alloc_count = DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count;
+ DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_freed
+ += pages << PAGE_SHIFT;
+ spin_unlock(&DRM(mem_lock));
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_TOTALAGP,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
+ }
+ return 0;
+ }
+ return retval;
+}
+
+int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+{
+ int retcode = -EINVAL;
+
+ if (!handle) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Attempt to bind NULL AGP handle\n");
+ return retcode;
+ }
+
+ if (!(retcode = DRM(agp_bind_memory)(handle, start))) {
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count;
+ DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&DRM(mem_lock));
+ return retcode;
+ }
+ spin_lock(&DRM(mem_lock));
+ ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count;
+ spin_unlock(&DRM(mem_lock));
+ return retcode;
+}
+
+int DRM(unbind_agp)(agp_memory *handle)
+{
+ int alloc_count;
+ int free_count;
+ int retcode = -EINVAL;
+
+ if (!handle) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Attempt to unbind NULL AGP handle\n");
+ return retcode;
+ }
+
+ if ((retcode = DRM(agp_unbind_memory)(handle))) return retcode;
+ spin_lock(&DRM(mem_lock));
+ free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count;
+ alloc_count = DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count;
+ DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_freed
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&DRM(mem_lock));
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
+ }
+ return retcode;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h
new file mode 100644
index 000000000..f65f42b71
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h
@@ -0,0 +1,630 @@
+/* drm_proc.h -- /proc support for DRM -*- linux-c -*-
+ * Created: Mon Jan 11 09:48:47 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ *
+ * Acknowledgements:
+ * Matthew J Sottek <matthew.j.sottek@intel.com> sent in a patch to fix
+ * the problem with the proc files not outputting all their information.
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+static int DRM(name_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+static int DRM(vm_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+static int DRM(clients_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+static int DRM(queues_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+static int DRM(bufs_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+#if DRM_DEBUG_CODE
+static int DRM(vma_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+#endif
+#if __HAVE_DMA_HISTOGRAM
+static int DRM(histo_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data);
+#endif
+
+struct drm_proc_list {
+ const char *name;
+ int (*f)(char *, char **, off_t, int, int *, void *);
+} DRM(proc_list)[] = {
+ { "name", DRM(name_info) },
+ { "mem", DRM(mem_info) },
+ { "vm", DRM(vm_info) },
+ { "clients", DRM(clients_info) },
+ { "queues", DRM(queues_info) },
+ { "bufs", DRM(bufs_info) },
+#if DRM_DEBUG_CODE
+ { "vma", DRM(vma_info) },
+#endif
+#if __HAVE_DMA_HISTOGRAM
+ { "histo", DRM(histo_info) },
+#endif
+};
+#define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0]))
+
+struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, int minor,
+ struct proc_dir_entry *root,
+ struct proc_dir_entry **dev_root)
+{
+ struct proc_dir_entry *ent;
+ int i, j;
+ char name[64];
+
+ if (!minor) root = create_proc_entry("dri", S_IFDIR, NULL);
+ if (!root) {
+ DRM_ERROR("Cannot create /proc/dri\n");
+ return NULL;
+ }
+
+ sprintf(name, "%d", minor);
+ *dev_root = create_proc_entry(name, S_IFDIR, root);
+ if (!*dev_root) {
+ DRM_ERROR("Cannot create /proc/%s\n", name);
+ return NULL;
+ }
+
+ for (i = 0; i < DRM_PROC_ENTRIES; i++) {
+ ent = create_proc_entry(DRM(proc_list)[i].name,
+ S_IFREG|S_IRUGO, *dev_root);
+ if (!ent) {
+ DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
+ name, DRM(proc_list)[i].name);
+ for (j = 0; j < i; j++)
+ remove_proc_entry(DRM(proc_list)[i].name,
+ *dev_root);
+ remove_proc_entry(name, root);
+ if (!minor) remove_proc_entry("dri", NULL);
+ return NULL;
+ }
+ ent->read_proc = DRM(proc_list)[i].f;
+ ent->data = dev;
+ }
+
+ return root;
+}
+
+
+int DRM(proc_cleanup)(int minor, struct proc_dir_entry *root,
+ struct proc_dir_entry *dev_root)
+{
+ int i;
+ char name[64];
+
+ if (!root || !dev_root) return 0;
+
+ for (i = 0; i < DRM_PROC_ENTRIES; i++)
+ remove_proc_entry(DRM(proc_list)[i].name, dev_root);
+ sprintf(name, "%d", minor);
+ remove_proc_entry(name, root);
+ if (!minor) remove_proc_entry("dri", NULL);
+
+ return 0;
+}
+
+static int DRM(name_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ if (dev->unique) {
+ DRM_PROC_PRINT("%s 0x%x %s\n",
+ dev->name, dev->device, dev->unique);
+ } else {
+ DRM_PROC_PRINT("%s 0x%x\n", dev->name, dev->device);
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(_vm_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ drm_map_t *map;
+ drm_map_list_t *r_list;
+ struct list_head *list;
+
+ /* Hardcoded from _DRM_FRAME_BUFFER,
+ _DRM_REGISTERS, _DRM_SHM, and
+ _DRM_AGP. */
+ const char *types[] = { "FB", "REG", "SHM", "AGP" };
+ const char *type;
+ int i;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT("slot offset size type flags "
+ "address mtrr\n\n");
+ i = 0;
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *)list;
+ map = r_list->map;
+ if(!map) continue;
+ if (map->type < 0 || map->type > 3) type = "??";
+ else type = types[map->type];
+ DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
+ i,
+ map->offset,
+ map->size,
+ type,
+ map->flags,
+ (unsigned long)map->handle);
+ if (map->mtrr < 0) {
+ DRM_PROC_PRINT("none\n");
+ } else {
+ DRM_PROC_PRINT("%4d\n", map->mtrr);
+ }
+ i++;
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(vm_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_vm_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+
+
+static int DRM(_queues_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ int i;
+ drm_queue_t *q;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT(" ctx/flags use fin"
+ " blk/rw/rwf wait flushed queued"
+ " locks\n\n");
+ for (i = 0; i < dev->queue_count; i++) {
+ q = dev->queuelist[i];
+ atomic_inc(&q->use_count);
+ DRM_PROC_PRINT_RET(atomic_dec(&q->use_count),
+ "%5d/0x%03x %5d %5d"
+ " %5d/%c%c/%c%c%c %5Zd\n",
+ i,
+ q->flags,
+ atomic_read(&q->use_count),
+ atomic_read(&q->finalization),
+ atomic_read(&q->block_count),
+ atomic_read(&q->block_read) ? 'r' : '-',
+ atomic_read(&q->block_write) ? 'w' : '-',
+ waitqueue_active(&q->read_queue) ? 'r':'-',
+ waitqueue_active(&q->write_queue) ? 'w':'-',
+ waitqueue_active(&q->flush_queue) ? 'f':'-',
+ DRM_BUFCOUNT(&q->waitlist));
+ atomic_dec(&q->use_count);
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(queues_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_queues_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+
+/* drm_bufs_info is called whenever a process reads
+ /dev/dri/<dev>/bufs. */
+
+static int DRM(_bufs_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ drm_device_dma_t *dma = dev->dma;
+ int i;
+
+ if (!dma || offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT(" o size count free segs pages kB\n\n");
+ for (i = 0; i <= DRM_MAX_ORDER; i++) {
+ if (dma->bufs[i].buf_count)
+ DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n",
+ i,
+ dma->bufs[i].buf_size,
+ dma->bufs[i].buf_count,
+ atomic_read(&dma->bufs[i]
+ .freelist.count),
+ dma->bufs[i].seg_count,
+ dma->bufs[i].seg_count
+ *(1 << dma->bufs[i].page_order),
+ (dma->bufs[i].seg_count
+ * (1 << dma->bufs[i].page_order))
+ * PAGE_SIZE / 1024);
+ }
+ DRM_PROC_PRINT("\n");
+ for (i = 0; i < dma->buf_count; i++) {
+ if (i && !(i%32)) DRM_PROC_PRINT("\n");
+ DRM_PROC_PRINT(" %d", dma->buflist[i]->list);
+ }
+ DRM_PROC_PRINT("\n");
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(bufs_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_bufs_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+
+
+static int DRM(_clients_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ drm_file_t *priv;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n");
+ for (priv = dev->file_first; priv; priv = priv->next) {
+ DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n",
+ priv->authenticated ? 'y' : 'n',
+ priv->minor,
+ priv->pid,
+ priv->uid,
+ priv->magic,
+ priv->ioctl_count);
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(clients_info)(char *buf, char **start, off_t offset,
+ int request, int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_clients_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+
+#if DRM_DEBUG_CODE
+
+#define DRM_VMA_VERBOSE 0
+
+static int DRM(_vma_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ drm_vma_entry_t *pt;
+ struct vm_area_struct *vma;
+#if DRM_VMA_VERBOSE
+ unsigned long i;
+ unsigned long address;
+ pgd_t *pgd;
+ pmd_t *pmd;
+ pte_t *pte;
+#endif
+#if defined(__i386__)
+ unsigned int pgprot;
+#endif
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n",
+ atomic_read(&dev->vma_count),
+ high_memory, virt_to_phys(high_memory));
+ for (pt = dev->vmalist; pt; pt = pt->next) {
+ if (!(vma = pt->vma)) continue;
+ DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx",
+ pt->pid,
+ vma->vm_start,
+ vma->vm_end,
+ vma->vm_flags & VM_READ ? 'r' : '-',
+ vma->vm_flags & VM_WRITE ? 'w' : '-',
+ vma->vm_flags & VM_EXEC ? 'x' : '-',
+ vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
+ vma->vm_flags & VM_LOCKED ? 'l' : '-',
+ vma->vm_flags & VM_IO ? 'i' : '-',
+ VM_OFFSET(vma));
+
+#if defined(__i386__)
+ pgprot = pgprot_val(vma->vm_page_prot);
+ DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c",
+ pgprot & _PAGE_PRESENT ? 'p' : '-',
+ pgprot & _PAGE_RW ? 'w' : 'r',
+ pgprot & _PAGE_USER ? 'u' : 's',
+ pgprot & _PAGE_PWT ? 't' : 'b',
+ pgprot & _PAGE_PCD ? 'u' : 'c',
+ pgprot & _PAGE_ACCESSED ? 'a' : '-',
+ pgprot & _PAGE_DIRTY ? 'd' : '-',
+ pgprot & _PAGE_PSE ? 'm' : 'k',
+ pgprot & _PAGE_GLOBAL ? 'g' : 'l' );
+#endif
+ DRM_PROC_PRINT("\n");
+#if 0
+ for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) {
+ pgd = pgd_offset(vma->vm_mm, i);
+ pmd = pmd_offset(pgd, i);
+ pte = pte_offset(pmd, i);
+ if (pte_present(*pte)) {
+ address = __pa(pte_page(*pte))
+ + (i & (PAGE_SIZE-1));
+ DRM_PROC_PRINT(" 0x%08lx -> 0x%08lx"
+ " %c%c%c%c%c\n",
+ i,
+ address,
+ pte_read(*pte) ? 'r' : '-',
+ pte_write(*pte) ? 'w' : '-',
+ pte_exec(*pte) ? 'x' : '-',
+ pte_dirty(*pte) ? 'd' : '-',
+ pte_young(*pte) ? 'a' : '-' );
+ } else {
+ DRM_PROC_PRINT(" 0x%08lx\n", i);
+ }
+ }
+#endif
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(vma_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_vma_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+#endif
+
+
+#if __HAVE_DMA_HISTOGRAM
+static int DRM(_histo_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int len = 0;
+ drm_device_dma_t *dma = dev->dma;
+ int i;
+ unsigned long slot_value = DRM_DMA_HISTOGRAM_INITIAL;
+ unsigned long prev_value = 0;
+ drm_buf_t *buffer;
+
+ if (offset > DRM_PROC_LIMIT) {
+ *eof = 1;
+ return 0;
+ }
+
+ *start = &buf[offset];
+ *eof = 0;
+
+ DRM_PROC_PRINT("general statistics:\n");
+ DRM_PROC_PRINT("total %10u\n", atomic_read(&dev->histo.total));
+ DRM_PROC_PRINT("open %10u\n",
+ atomic_read(&dev->counts[_DRM_STAT_OPENS]));
+ DRM_PROC_PRINT("close %10u\n",
+ atomic_read(&dev->counts[_DRM_STAT_CLOSES]));
+ DRM_PROC_PRINT("ioctl %10u\n",
+ atomic_read(&dev->counts[_DRM_STAT_IOCTLS]));
+
+ DRM_PROC_PRINT("\nlock statistics:\n");
+ DRM_PROC_PRINT("locks %10u\n",
+ atomic_read(&dev->counts[_DRM_STAT_LOCKS]));
+ DRM_PROC_PRINT("unlocks %10u\n",
+ atomic_read(&dev->counts[_DRM_STAT_UNLOCKS]));
+
+ if (dma) {
+#if 0
+ DRM_PROC_PRINT("\ndma statistics:\n");
+ DRM_PROC_PRINT("prio %10u\n",
+ atomic_read(&dma->total_prio));
+ DRM_PROC_PRINT("bytes %10u\n",
+ atomic_read(&dma->total_bytes));
+ DRM_PROC_PRINT("dmas %10u\n",
+ atomic_read(&dma->total_dmas));
+ DRM_PROC_PRINT("missed:\n");
+ DRM_PROC_PRINT(" dma %10u\n",
+ atomic_read(&dma->total_missed_dma));
+ DRM_PROC_PRINT(" lock %10u\n",
+ atomic_read(&dma->total_missed_lock));
+ DRM_PROC_PRINT(" free %10u\n",
+ atomic_read(&dma->total_missed_free));
+ DRM_PROC_PRINT(" sched %10u\n",
+ atomic_read(&dma->total_missed_sched));
+ DRM_PROC_PRINT("tried %10u\n",
+ atomic_read(&dma->total_tried));
+ DRM_PROC_PRINT("hit %10u\n",
+ atomic_read(&dma->total_hit));
+ DRM_PROC_PRINT("lost %10u\n",
+ atomic_read(&dma->total_lost));
+#endif
+
+ buffer = dma->next_buffer;
+ if (buffer) {
+ DRM_PROC_PRINT("next_buffer %7d\n", buffer->idx);
+ } else {
+ DRM_PROC_PRINT("next_buffer none\n");
+ }
+ buffer = dma->this_buffer;
+ if (buffer) {
+ DRM_PROC_PRINT("this_buffer %7d\n", buffer->idx);
+ } else {
+ DRM_PROC_PRINT("this_buffer none\n");
+ }
+ }
+
+
+ DRM_PROC_PRINT("\nvalues:\n");
+ if (dev->lock.hw_lock) {
+ DRM_PROC_PRINT("lock 0x%08x\n",
+ dev->lock.hw_lock->lock);
+ } else {
+ DRM_PROC_PRINT("lock none\n");
+ }
+ DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag);
+ DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag);
+ DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag);
+
+ DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count);
+ DRM_PROC_PRINT("last_context %10d\n", dev->last_context);
+ DRM_PROC_PRINT("last_switch %10lu\n", dev->last_switch);
+ DRM_PROC_PRINT("last_checked %10d\n", dev->last_checked);
+
+
+ DRM_PROC_PRINT("\n q2d d2c c2f"
+ " q2c q2f dma sch"
+ " ctx lacq lhld\n\n");
+ for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) {
+ DRM_PROC_PRINT("%s %10lu %10u %10u %10u %10u %10u"
+ " %10u %10u %10u %10u %10u\n",
+ i == DRM_DMA_HISTOGRAM_SLOTS - 1 ? ">=" : "< ",
+ i == DRM_DMA_HISTOGRAM_SLOTS - 1
+ ? prev_value : slot_value ,
+
+ atomic_read(&dev->histo
+ .queued_to_dispatched[i]),
+ atomic_read(&dev->histo
+ .dispatched_to_completed[i]),
+ atomic_read(&dev->histo
+ .completed_to_freed[i]),
+
+ atomic_read(&dev->histo
+ .queued_to_completed[i]),
+ atomic_read(&dev->histo
+ .queued_to_freed[i]),
+ atomic_read(&dev->histo.dma[i]),
+ atomic_read(&dev->histo.schedule[i]),
+ atomic_read(&dev->histo.ctx[i]),
+ atomic_read(&dev->histo.lacq[i]),
+ atomic_read(&dev->histo.lhld[i]));
+ prev_value = slot_value;
+ slot_value = DRM_DMA_HISTOGRAM_NEXT(slot_value);
+ }
+
+ if (len > request + offset) return request;
+ *eof = 1;
+ return len - offset;
+}
+
+static int DRM(histo_info)(char *buf, char **start, off_t offset, int request,
+ int *eof, void *data)
+{
+ drm_device_t *dev = (drm_device_t *)data;
+ int ret;
+
+ down(&dev->struct_sem);
+ ret = DRM(_histo_info)(buf, start, offset, request, eof, data);
+ up(&dev->struct_sem);
+ return ret;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h
new file mode 100644
index 000000000..bc9587963
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h
@@ -0,0 +1,152 @@
+/* drm_stub.h -- -*- linux-c -*-
+ * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org
+ *
+ * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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@valinux.com>
+ *
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+#if LINUX_VERSION_CODE < 0x020400
+#include "stubsupport-pre24.h"
+#endif
+
+#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */
+
+static struct drm_stub_list {
+ const char *name;
+ struct file_operations *fops;
+ struct proc_dir_entry *dev_root;
+} *DRM(stub_list);
+
+static struct proc_dir_entry *DRM(stub_root);
+
+static struct drm_stub_info {
+ int (*info_register)(const char *name, struct file_operations *fops,
+ drm_device_t *dev);
+ int (*info_unregister)(int minor);
+} DRM(stub_info);
+
+static int DRM(stub_open)(struct inode *inode, struct file *filp)
+{
+ int minor = MINOR(inode->i_rdev);
+ int err = -ENODEV;
+ struct file_operations *old_fops;
+
+ if (!DRM(stub_list) || !DRM(stub_list)[minor].fops) return -ENODEV;
+ old_fops = filp->f_op;
+ filp->f_op = fops_get(DRM(stub_list)[minor].fops);
+ if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) {
+ fops_put(filp->f_op);
+ filp->f_op = fops_get(old_fops);
+ }
+ fops_put(old_fops);
+
+ return err;
+}
+
+static struct file_operations DRM(stub_fops) = {
+#if LINUX_VERSION_CODE >= 0x020400
+ owner: THIS_MODULE,
+#endif
+ open: DRM(stub_open)
+};
+
+static int DRM(stub_getminor)(const char *name, struct file_operations *fops,
+ drm_device_t *dev)
+{
+ int i;
+
+ if (!DRM(stub_list)) {
+ DRM(stub_list) = DRM(alloc)(sizeof(*DRM(stub_list))
+ * DRM_STUB_MAXCARDS, DRM_MEM_STUB);
+ for (i = 0; i < DRM_STUB_MAXCARDS; i++) {
+ DRM(stub_list)[i].name = NULL;
+ DRM(stub_list)[i].fops = NULL;
+ }
+ }
+ for (i = 0; i < DRM_STUB_MAXCARDS; i++) {
+ if (!DRM(stub_list)[i].fops) {
+ DRM(stub_list)[i].name = name;
+ DRM(stub_list)[i].fops = fops;
+ DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root),
+ &DRM(stub_list)[i]
+ .dev_root);
+ return i;
+ }
+ }
+ return -1;
+}
+
+static int DRM(stub_putminor)(int minor)
+{
+ if (minor < 0 || minor >= DRM_STUB_MAXCARDS) return -1;
+ DRM(stub_list)[minor].name = NULL;
+ DRM(stub_list)[minor].fops = NULL;
+ DRM(proc_cleanup)(minor, DRM(stub_root),
+ DRM(stub_list)[minor].dev_root);
+ if (minor) {
+ inter_module_put("drm");
+ } else {
+ inter_module_unregister("drm");
+ DRM(free)(DRM(stub_list),
+ sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS,
+ DRM_MEM_STUB);
+ unregister_chrdev(DRM_MAJOR, "drm");
+ }
+ return 0;
+}
+
+int DRM(stub_register)(const char *name, struct file_operations *fops,
+ drm_device_t *dev)
+{
+ struct drm_stub_info *i = NULL;
+
+ if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)))
+ i = (struct drm_stub_info *)inter_module_get("drm");
+
+ if (i) {
+ /* Already registered */
+ DRM(stub_info).info_register = i->info_register;
+ DRM(stub_info).info_unregister = i->info_unregister;
+ } else {
+ DRM(stub_info).info_register = DRM(stub_getminor);
+ DRM(stub_info).info_unregister = DRM(stub_putminor);
+ inter_module_register("drm", THIS_MODULE, &DRM(stub_info));
+ }
+ if (DRM(stub_info).info_register)
+ return DRM(stub_info).info_register(name, fops, dev);
+ return -1;
+}
+
+int DRM(stub_unregister)(int minor)
+{
+ DRM_DEBUG("%d\n", minor);
+ if (DRM(stub_info).info_unregister)
+ return DRM(stub_info).info_unregister(minor);
+ return -1;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h
new file mode 100644
index 000000000..fb51926ba
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h
@@ -0,0 +1,416 @@
+/* drm_vm.h -- Memory mapping for DRM -*- linux-c -*-
+ * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "drmP.h"
+
+struct vm_operations_struct drm_vm_ops = {
+ nopage: DRM(vm_nopage),
+ open: DRM(vm_open),
+ close: DRM(vm_close),
+};
+
+struct vm_operations_struct drm_vm_shm_ops = {
+ nopage: DRM(vm_shm_nopage),
+ open: DRM(vm_open),
+ close: DRM(vm_shm_close),
+};
+
+struct vm_operations_struct drm_vm_dma_ops = {
+ nopage: DRM(vm_dma_nopage),
+ open: DRM(vm_open),
+ close: DRM(vm_close),
+};
+
+#if LINUX_VERSION_CODE < 0x020317
+unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
+{
+ return NOPAGE_SIGBUS; /* Disallow mremap */
+}
+
+#if LINUX_VERSION_CODE < 0x020317
+unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
+{
+#if LINUX_VERSION_CODE >= 0x020300
+ drm_map_t *map = (drm_map_t *)vma->vm_private_data;
+#else
+ drm_map_t *map = (drm_map_t *)vma->vm_pte;
+#endif
+ unsigned long physical;
+ unsigned long offset;
+ unsigned long i;
+ pgd_t *pgd;
+ pmd_t *pmd;
+ pte_t *pte;
+
+ if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+ if (!map) return NOPAGE_OOM; /* Nothing allocated */
+
+ offset = address - vma->vm_start;
+ i = (unsigned long)map->handle + offset;
+ /* We have to walk page tables here because we need large SAREA's, and
+ * they need to be virtually contigious in kernel space.
+ */
+ pgd = pgd_offset_k( i );
+ if( !pgd_present( *pgd ) ) return NOPAGE_OOM;
+ pmd = pmd_offset( pgd, i );
+ if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
+ pte = pte_offset( pmd, i );
+ if( !pte_present( *pte ) ) return NOPAGE_OOM;
+ physical = (unsigned long)pte_page( *pte )->virtual;
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
+
+ DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
+#if LINUX_VERSION_CODE < 0x020317
+ return physical;
+#else
+ return virt_to_page(physical);
+#endif
+}
+
+/* Special close routine which deletes map information if we are the last
+ * person to close a mapping and its not in the global maplist.
+ */
+
+void DRM(vm_shm_close)(struct vm_area_struct *vma)
+{
+ drm_file_t *priv = vma->vm_file->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_vma_entry_t *pt, *prev;
+ drm_map_t *map;
+ drm_map_list_t *r_list;
+ struct list_head *list;
+ int found_maps = 0;
+
+ DRM_DEBUG("0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
+ atomic_dec(&dev->vma_count);
+
+#if LINUX_VERSION_CODE >= 0x020300
+ map = vma->vm_private_data;
+#else
+ map = vma->vm_pte;
+#endif
+
+ down(&dev->struct_sem);
+ for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
+#if LINUX_VERSION_CODE >= 0x020300
+ if (pt->vma->vm_private_data == map) found_maps++;
+#else
+ if (pt->vma->vm_pte == map) found_maps++;
+#endif
+ if (pt->vma == vma) {
+ if (prev) {
+ prev->next = pt->next;
+ } else {
+ dev->vmalist = pt->next;
+ }
+ DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS);
+ }
+ }
+ /* We were the only map that was found */
+ if(found_maps == 1 &&
+ map->flags & _DRM_REMOVABLE) {
+ /* Check to see if we are in the maplist, if we are not, then
+ * we delete this mappings information.
+ */
+ found_maps = 0;
+ list = &dev->maplist->head;
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *) list;
+ if (r_list->map == map) found_maps++;
+ }
+
+ if(!found_maps) {
+ switch (map->type) {
+ case _DRM_REGISTERS:
+ case _DRM_FRAME_BUFFER:
+#if __REALLY_HAVE_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:
+ vfree(map->handle);
+ break;
+ case _DRM_AGP:
+ break;
+ }
+ DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
+ }
+ }
+ up(&dev->struct_sem);
+}
+
+#if LINUX_VERSION_CODE < 0x020317
+unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
+{
+ drm_file_t *priv = vma->vm_file->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ unsigned long physical;
+ unsigned long offset;
+ unsigned long page;
+
+ if (!dma) return NOPAGE_SIGBUS; /* Error */
+ if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+ if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
+
+ offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
+ page = offset >> PAGE_SHIFT;
+ physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
+
+ DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+#if LINUX_VERSION_CODE < 0x020317
+ return physical;
+#else
+ return virt_to_page(physical);
+#endif
+}
+
+void DRM(vm_open)(struct vm_area_struct *vma)
+{
+ drm_file_t *priv = vma->vm_file->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_vma_entry_t *vma_entry;
+
+ DRM_DEBUG("0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
+ atomic_inc(&dev->vma_count);
+#if LINUX_VERSION_CODE < 0x020333
+ /* The map can exist after the fd is closed. */
+ MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
+
+ vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS);
+ if (vma_entry) {
+ down(&dev->struct_sem);
+ vma_entry->vma = vma;
+ vma_entry->next = dev->vmalist;
+ vma_entry->pid = current->pid;
+ dev->vmalist = vma_entry;
+ up(&dev->struct_sem);
+ }
+}
+
+void DRM(vm_close)(struct vm_area_struct *vma)
+{
+ drm_file_t *priv = vma->vm_file->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_vma_entry_t *pt, *prev;
+
+ DRM_DEBUG("0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
+ atomic_dec(&dev->vma_count);
+
+ down(&dev->struct_sem);
+ for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
+ if (pt->vma == vma) {
+ if (prev) {
+ prev->next = pt->next;
+ } else {
+ dev->vmalist = pt->next;
+ }
+ DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS);
+ break;
+ }
+ }
+ up(&dev->struct_sem);
+}
+
+int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev;
+ drm_device_dma_t *dma;
+ unsigned long length = vma->vm_end - vma->vm_start;
+
+ lock_kernel();
+ dev = priv->dev;
+ dma = dev->dma;
+ DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+
+ /* Length must match exact page count */
+ if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
+ unlock_kernel();
+ return -EINVAL;
+ }
+ unlock_kernel();
+
+ vma->vm_ops = &drm_vm_dma_ops;
+ vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
+
+#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
+ /* In Linux 2.2.3 and above, this is
+ handled in do_mmap() in mm/mmap.c. */
+ ++filp->f_count;
+#endif
+ vma->vm_file = filp; /* Needed for drm_vm_open() */
+ DRM(vm_open)(vma);
+ return 0;
+}
+
+int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_map_t *map = NULL;
+ drm_map_list_t *r_list;
+ struct list_head *list;
+
+ DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+
+ if (!VM_OFFSET(vma)) return DRM(mmap_dma)(filp, vma);
+
+ /* A sequential search of a linked list is
+ fine here because: 1) there will only be
+ about 5-10 entries in the list and, 2) a
+ DRI client only has to do this mapping
+ once, so it doesn't have to be optimized
+ for performance, even if the list was a
+ bit longer. */
+ list_for_each(list, &dev->maplist->head) {
+ r_list = (drm_map_list_t *)list;
+ map = r_list->map;
+ if (!map) continue;
+ if (map->offset == VM_OFFSET(vma)) break;
+ }
+
+ if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
+ return -EPERM;
+
+ /* Check for valid size. */
+ if (map->size != vma->vm_end - vma->vm_start) return -EINVAL;
+
+ if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
+ vma->vm_flags &= VM_MAYWRITE;
+#if defined(__i386__)
+ pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
+#else
+ /* Ye gads this is ugly. With more thought
+ we could move this up higher and use
+ `protection_map' instead. */
+ vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect(
+ __pte(pgprot_val(vma->vm_page_prot)))));
+#endif
+ }
+
+ switch (map->type) {
+ case _DRM_FRAME_BUFFER:
+ case _DRM_REGISTERS:
+ case _DRM_AGP:
+ if (VM_OFFSET(vma) >= __pa(high_memory)) {
+#if defined(__i386__)
+ if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) {
+ pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+ pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
+ }
+#elif defined(__ia64__)
+ if (map->type != _DRM_AGP)
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+#endif
+ vma->vm_flags |= VM_IO; /* not in core dump */
+ }
+ if (remap_page_range(vma->vm_start,
+ VM_OFFSET(vma),
+ vma->vm_end - vma->vm_start,
+ vma->vm_page_prot))
+ return -EAGAIN;
+ DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx,"
+ " offset = 0x%lx\n",
+ map->type,
+ vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+ vma->vm_ops = &drm_vm_ops;
+ break;
+ case _DRM_SHM:
+ vma->vm_ops = &drm_vm_shm_ops;
+#if LINUX_VERSION_CODE >= 0x020300
+ vma->vm_private_data = (void *)map;
+#else
+ vma->vm_pte = (unsigned long)map;
+#endif
+ /* Don't let this area swap. Change when
+ DRM_KERNEL advisory is supported. */
+ vma->vm_flags |= VM_LOCKED;
+ break;
+ default:
+ return -EINVAL; /* This should never happen. */
+ }
+ vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
+
+#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
+ /* In Linux 2.2.3 and above, this is
+ handled in do_mmap() in mm/mmap.c. */
+ ++filp->f_count;
+#endif
+ vma->vm_file = filp; /* Needed for drm_vm_open() */
+ DRM(vm_open)(vma);
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h
new file mode 100644
index 000000000..232ed018b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h
@@ -0,0 +1,93 @@
+/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*-
+ * Created: Mon Jan 4 08:58:31 1999 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __GAMMA_H__
+#define __GAMMA_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) gamma_##x
+
+/* General customization:
+ */
+#define __HAVE_MTRR 1
+
+/* DMA customization:
+ */
+#define __HAVE_DMA 1
+#define __HAVE_OLD_DMA 1
+#define __HAVE_PCI_DMA 1
+
+#define __HAVE_MULTIPLE_DMA_QUEUES 1
+#define __HAVE_DMA_WAITQUEUE 1
+
+#define __HAVE_DMA_WAITLIST 1
+#define __HAVE_DMA_FREELIST 1
+
+#define __HAVE_DMA_FLUSH 1
+#define __HAVE_DMA_SCHEDULE 1
+
+#define __HAVE_DMA_READY 1
+#define DRIVER_DMA_READY() do { \
+ gamma_dma_ready(dev); \
+} while (0)
+
+#define __HAVE_DMA_QUIESCENT 1
+#define DRIVER_DMA_QUIESCENT() do { \
+ /* FIXME ! */ \
+ gamma_dma_quiescent_dual(dev); \
+ return 0; \
+} while (0)
+
+#define __HAVE_DMA_IRQ 1
+#define __HAVE_DMA_IRQ_BH 1
+#define DRIVER_PREINSTALL() do { \
+ drm_gamma_private_t *dev_priv = \
+ (drm_gamma_private_t *)dev->dev_private;\
+ GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000000 ); \
+ GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 ); \
+} while (0)
+
+#define DRIVER_POSTINSTALL() do { \
+ drm_gamma_private_t *dev_priv = \
+ (drm_gamma_private_t *)dev->dev_private;\
+ GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 ); \
+ GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 ); \
+ GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00039090 ); \
+} while (0)
+
+#define DRIVER_UNINSTALL() do { \
+ drm_gamma_private_t *dev_priv = \
+ (drm_gamma_private_t *)dev->dev_private;\
+ GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 ); \
+ GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 ); \
+ GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 ); \
+} while (0)
+
+#endif /* __GAMMA_H__ */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
index 4854c56d5..d3a9414d7 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
@@ -11,11 +11,11 @@
* 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
@@ -23,73 +23,38 @@
* OTHER LIABILITY, WHETHER IN AN ACTION 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@valinux.com>
*
*/
#define __NO_VERSION__
+#include "gamma.h"
#include "drmP.h"
#include "gamma_drv.h"
#include <linux/interrupt.h> /* For task queue support */
+#include <linux/delay.h>
-/* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the
- kernel must be specified here. Currently, the number is 2. This must
- match the order the X server uses for instantiating register regions ,
- or must be passed in a new ioctl. */
-#define GAMMA_REG(reg) \
- (2 \
- + ((reg < 0x1000) \
- ? 0 \
- : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3))))
-
-#define GAMMA_OFF(reg) \
- ((reg < 0x1000) \
- ? reg \
- : ((reg < 0x10000) \
- ? (reg - 0x1000) \
- : ((reg < 0x11000) \
- ? (reg - 0x10000) \
- : (reg - 0x11000))))
-
-#define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle)
-#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg))
-#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg)
-#define GAMMA_READ(reg) GAMMA_DEREF(reg)
-#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0)
-
-#define GAMMA_BROADCASTMASK 0x9378
-#define GAMMA_COMMANDINTENABLE 0x0c48
-#define GAMMA_DMAADDRESS 0x0028
-#define GAMMA_DMACOUNT 0x0030
-#define GAMMA_FILTERMODE 0x8c00
-#define GAMMA_GCOMMANDINTFLAGS 0x0c50
-#define GAMMA_GCOMMANDMODE 0x0c40
-#define GAMMA_GCOMMANDSTATUS 0x0c60
-#define GAMMA_GDELAYTIMER 0x0c38
-#define GAMMA_GDMACONTROL 0x0060
-#define GAMMA_GINTENABLE 0x0808
-#define GAMMA_GINTFLAGS 0x0810
-#define GAMMA_INFIFOSPACE 0x0018
-#define GAMMA_OUTFIFOWORDS 0x0020
-#define GAMMA_OUTPUTFIFO 0x2000
-#define GAMMA_SYNC 0x8c40
-#define GAMMA_SYNC_TAG 0x0188
-
static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address,
unsigned long length)
{
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address));
while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4)
;
GAMMA_WRITE(GAMMA_DMACOUNT, length / 4);
}
-static inline void gamma_dma_quiescent_single(drm_device_t *dev)
+void gamma_dma_quiescent_single(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
while (GAMMA_READ(GAMMA_DMACOUNT))
;
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
@@ -97,15 +62,18 @@ static inline void gamma_dma_quiescent_single(drm_device_t *dev)
GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
GAMMA_WRITE(GAMMA_SYNC, 0);
-
+
do {
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
;
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
}
-static inline void gamma_dma_quiescent_dual(drm_device_t *dev)
+void gamma_dma_quiescent_dual(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
while (GAMMA_READ(GAMMA_DMACOUNT))
;
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
@@ -115,13 +83,13 @@ static inline void gamma_dma_quiescent_dual(drm_device_t *dev)
GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
GAMMA_WRITE(GAMMA_SYNC, 0);
-
+
/* Read from first MX */
do {
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
;
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
-
+
/* Read from second MX */
do {
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000))
@@ -129,34 +97,39 @@ static inline void gamma_dma_quiescent_dual(drm_device_t *dev)
} while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG);
}
-static inline void gamma_dma_ready(drm_device_t *dev)
+void gamma_dma_ready(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
while (GAMMA_READ(GAMMA_DMACOUNT))
;
}
static inline int gamma_dma_is_ready(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
return !GAMMA_READ(GAMMA_DMACOUNT);
}
-static void gamma_dma_service(int irq, void *device, struct pt_regs *regs)
+void gamma_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);
+ drm_device_t *dev = (drm_device_t *)device;
+ drm_device_dma_t *dma = dev->dma;
+ drm_gamma_private_t *dev_priv =
+ (drm_gamma_private_t *)dev->dev_private;
+
+ atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */
GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */
GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8);
GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001);
if (gamma_dma_is_ready(dev)) {
/* Free previous buffer */
- if (test_and_set_bit(0, &dev->dma_flag)) {
- atomic_inc(&dma->total_missed_free);
- return;
- }
+ if (test_and_set_bit(0, &dev->dma_flag)) return;
if (dma->this_buffer) {
- drm_free_buffer(dev, dma->this_buffer);
+ gamma_free_buffer(dev, dma->this_buffer);
dma->this_buffer = NULL;
}
clear_bit(0, &dev->dma_flag);
@@ -179,11 +152,8 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
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 (test_and_set_bit(0, &dev->dma_flag)) return -EBUSY;
+
#if DRM_DMA_HISTOGRAM
dma_start = get_cycles();
#endif
@@ -202,20 +172,20 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
buf->context, buf->idx, length);
if (buf->list == DRM_LIST_RECLAIM) {
- drm_clear_next_buffer(dev);
- drm_free_buffer(dev, buf);
+ gamma_clear_next_buffer(dev);
+ gamma_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);
+ gamma_clear_next_buffer(dev);
+ gamma_free_buffer(dev, buf);
clear_bit(0, &dev->dma_flag);
return 0;
}
-
+
if (!gamma_dma_is_ready(dev)) {
clear_bit(0, &dev->dma_flag);
return -EBUSY;
@@ -228,9 +198,8 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
buf->idx, buf->pid);
}
} else {
- if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock,
+ if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
- atomic_inc(&dma->total_missed_lock);
clear_bit(0, &dev->dma_flag);
return -EBUSY;
}
@@ -240,13 +209,14 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
&& !(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);
+ 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.
@@ -254,7 +224,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
TIME! */
}
- drm_clear_next_buffer(dev);
+ gamma_clear_next_buffer(dev);
buf->pending = 1;
buf->waiting = 0;
buf->list = DRM_LIST_PEND;
@@ -263,14 +233,14 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
#endif
gamma_dma_dispatch(dev, address, length);
- drm_free_buffer(dev, dma->this_buffer);
+ gamma_free_buffer(dev, dma->this_buffer);
dma->this_buffer = buf;
- atomic_add(length, &dma->total_bytes);
- atomic_inc(&dma->total_dmas);
+ atomic_inc(&dev->counts[7]); /* _DRM_STAT_DMA */
+ atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */
if (!buf->while_locked && !dev->context_flag && !locked) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ if (gamma_lock_free(dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
DRM_ERROR("\n");
}
@@ -281,18 +251,18 @@ cleanup:
#if DRM_DMA_HISTOGRAM
dma_stop = get_cycles();
- atomic_inc(&dev->histo.dma[drm_histogram_slot(dma_stop - dma_start)]);
+ atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]);
#endif
return retcode;
}
-static void gamma_dma_schedule_timer_wrapper(unsigned long dev)
+static void gamma_dma_timer_bh(unsigned long dev)
{
gamma_dma_schedule((drm_device_t *)dev, 0);
}
-static void gamma_dma_schedule_tq_wrapper(void *dev)
+void gamma_dma_immediate_bh(void *dev)
{
gamma_dma_schedule(dev, 0);
}
@@ -313,10 +283,10 @@ int gamma_dma_schedule(drm_device_t *dev, int locked)
if (test_and_set_bit(0, &dev->interrupt_flag)) {
/* Not reentrant */
- atomic_inc(&dma->total_missed_sched);
+ atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */
return -EBUSY;
}
- missed = atomic_read(&dma->total_missed_sched);
+ missed = atomic_read(&dev->counts[10]);
#if DRM_DMA_HISTOGRAM
schedule_start = get_cycles();
@@ -333,23 +303,18 @@ again:
because the lock could not be obtained
or the DMA engine wasn't ready. Try
again. */
- atomic_inc(&dma->total_tried);
- if (!(retcode = gamma_do_dma(dev, locked))) {
- atomic_inc(&dma->total_hit);
- ++processed;
- }
+ if (!(retcode = gamma_do_dma(dev, locked))) ++processed;
} else {
do {
- next = drm_select_queue(dev,
- gamma_dma_schedule_timer_wrapper);
+ next = gamma_select_queue(dev, gamma_dma_timer_bh);
if (next >= 0) {
q = dev->queuelist[next];
- buf = drm_waitlist_get(&q->waitlist);
+ buf = gamma_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);
+ gamma_clear_next_buffer(dev);
+ gamma_free_buffer(dev, buf);
}
}
} while (next >= 0 && !dma->next_buffer);
@@ -361,21 +326,19 @@ again:
}
if (--expire) {
- if (missed != atomic_read(&dma->total_missed_sched)) {
- atomic_inc(&dma->total_lost);
+ if (missed != atomic_read(&dev->counts[10])) {
if (gamma_dma_is_ready(dev)) goto again;
}
if (processed && gamma_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()
+ atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles()
- schedule_start)]);
#endif
return retcode;
@@ -400,7 +363,7 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
if (signal_pending(current)) return -EINTR;
}
if (!(d->flags & _DRM_DMA_WHILE_LOCKED)) {
- while (!drm_lock_take(&dev->lock.hw_lock->lock,
+ while (!gamma_lock_take(&dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
schedule();
if (signal_pending(current)) {
@@ -410,7 +373,6 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
}
++must_free;
}
- atomic_inc(&dma->total_prio);
for (i = 0; i < d->send_count; i++) {
idx = d->send_indices[i];
@@ -461,15 +423,15 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
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);
+ 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.
@@ -494,11 +456,11 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
buf->time_dispatched = buf->time_queued;
#endif
gamma_dma_dispatch(dev, address, length);
- atomic_add(length, &dma->total_bytes);
- atomic_inc(&dma->total_dmas);
-
+ atomic_inc(&dev->counts[9]); /* _DRM_STAT_SPECIAL */
+ atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */
+
if (last_buf) {
- drm_free_buffer(dev, last_buf);
+ gamma_free_buffer(dev, last_buf);
}
last_buf = buf;
}
@@ -507,11 +469,11 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
cleanup:
if (last_buf) {
gamma_dma_ready(dev);
- drm_free_buffer(dev, last_buf);
+ gamma_free_buffer(dev, last_buf);
}
-
+
if (must_free && !dev->context_flag) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ if (gamma_lock_free(dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
DRM_ERROR("\n");
}
@@ -531,15 +493,15 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
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 ((retcode = gamma_dma_enqueue(dev, d))) {
if (d->flags & _DRM_DMA_BLOCK)
remove_wait_queue(&last_buf->dma_wait, &entry);
return retcode;
}
-
+
gamma_dma_schedule(dev, 0);
-
+
if (d->flags & _DRM_DMA_BLOCK) {
DRM_DEBUG("%d waiting\n", current->pid);
for (;;) {
@@ -558,7 +520,7 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
if (!retcode
|| (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) {
if (!waitqueue_active(&last_buf->dma_wait)) {
- drm_free_buffer(dev, last_buf);
+ gamma_free_buffer(dev, last_buf);
}
}
if (retcode) {
@@ -585,21 +547,19 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
int retcode = 0;
drm_dma_t d;
+#if 0
+ LOCK_TEST_WITH_RETURN( dev );
+#endif
+
if (copy_from_user(&d, (drm_dma_t *)arg, sizeof(d)))
return -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);
@@ -609,14 +569,14 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
if (d.send_count) {
if (d.flags & _DRM_DMA_PRIORITY)
retcode = gamma_dma_priority(dev, &d);
- else
+ else
retcode = gamma_dma_send_buffers(dev, &d);
}
d.granted_count = 0;
if (!retcode && d.request_count) {
- retcode = drm_dma_get_buffers(dev, &d);
+ retcode = gamma_dma_get_buffers(dev, &d);
}
DRM_DEBUG("%d returning, granted = %d\n",
@@ -626,211 +586,3 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
return retcode;
}
-
-int gamma_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;
-
- INIT_LIST_HEAD(&dev->tq.list);
- dev->tq.sync = 0;
- dev->tq.routine = gamma_dma_schedule_tq_wrapper;
- dev->tq.data = dev;
-
-
- /* Before installing handler */
- GAMMA_WRITE(GAMMA_GCOMMANDMODE, 0);
- GAMMA_WRITE(GAMMA_GDMACONTROL, 0);
-
- /* Install handler */
- if ((retcode = request_irq(dev->irq,
- gamma_dma_service,
- 0,
- dev->devname,
- dev))) {
- down(&dev->struct_sem);
- dev->irq = 0;
- up(&dev->struct_sem);
- return retcode;
- }
-
- /* After installing handler */
- GAMMA_WRITE(GAMMA_GINTENABLE, 0x2001);
- GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0x0008);
- GAMMA_WRITE(GAMMA_GDELAYTIMER, 0x39090);
-
- return 0;
-}
-
-int gamma_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);
-
- GAMMA_WRITE(GAMMA_GDELAYTIMER, 0);
- GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0);
- GAMMA_WRITE(GAMMA_GINTENABLE, 0);
- free_irq(irq, dev);
-
- return 0;
-}
-
-
-int gamma_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;
-
- if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl)))
- return -EFAULT;
-
- switch (ctl.func) {
- case DRM_INST_HANDLER:
- if ((retcode = gamma_irq_install(dev, ctl.irq)))
- return retcode;
- break;
- case DRM_UNINST_HANDLER:
- if ((retcode = gamma_irq_uninstall(dev)))
- return retcode;
- break;
- default:
- return -EINVAL;
- }
- return 0;
-}
-
-int gamma_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
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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 (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 || 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 (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
- 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) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
-
- if (lock.flags & _DRM_LOCK_READY)
- gamma_dma_ready(dev);
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- if (gamma_found() == 1) {
- gamma_dma_quiescent_single(dev);
- } else {
- gamma_dma_quiescent_dual(dev);
- }
- }
- }
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
-
-#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/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c
index a17bc1a9f..98916bc53 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
@@ -26,546 +26,48 @@
*
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
- *
+ * Gareth Hughes <gareth@valinux.com>
*/
#include <linux/config.h>
+#include "gamma.h"
#include "drmP.h"
#include "gamma_drv.h"
-#ifndef PCI_DEVICE_ID_3DLABS_GAMMA
-#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
-#endif
-#ifndef PCI_DEVICE_ID_3DLABS_MX
-#define PCI_DEVICE_ID_3DLABS_MX 0x0006
-#endif
-
-#define GAMMA_NAME "gamma"
-#define GAMMA_DESC "3dlabs GMX 2000"
-#define GAMMA_DATE "20000910"
-#define GAMMA_MAJOR 1
-#define GAMMA_MINOR 0
-#define GAMMA_PATCHLEVEL 0
-
-static drm_device_t gamma_device;
-
-static struct file_operations gamma_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: gamma_open,
- flush: drm_flush,
- release: gamma_release,
- ioctl: gamma_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-static struct miscdevice gamma_misc = {
- minor: MISC_DYNAMIC_MINOR,
- name: GAMMA_NAME,
- fops: &gamma_fops,
-};
-
-static drm_ioctl_desc_t gamma_ioctls[] = {
- [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { gamma_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)] = { gamma_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)] = { drm_addbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_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)] = { gamma_dma, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { gamma_lock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { gamma_unlock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-};
-#define GAMMA_IOCTL_COUNT DRM_ARRAY_SIZE(gamma_ioctls)
-
-#ifdef MODULE
-static char *gamma = NULL;
-#endif
-static int devices = 0;
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("3dlabs GMX 2000");
-MODULE_PARM(gamma, "s");
-MODULE_PARM(devices, "i");
-MODULE_PARM_DESC(devices,
- "devices=x, where x is the number of MX chips on card\n");
-#ifndef MODULE
-/* gamma_options 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_options.
- */
-
-
-static int __init gamma_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("gamma=", gamma_options);
-#endif
-
-static int gamma_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 gamma_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) gamma_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 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:
- /* Do nothing here, because this is all
- handled in the AGP/GART driver. */
- 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;
-}
-
-int gamma_found(void)
-{
- return devices;
-}
-
-int gamma_find_devices(void)
-{
- struct pci_dev *d = NULL, *one = NULL, *two = NULL;
-
- d = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_GAMMA,d);
- if (!d) return 0;
-
- one = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,d);
- if (!one) return 0;
-
- /* Make sure it's on the same card, if not - no MX's found */
- if (PCI_SLOT(d->devfn) != PCI_SLOT(one->devfn)) return 0;
-
- two = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,one);
- if (!two) return 1;
-
- /* Make sure it's on the same card, if not - only 1 MX found */
- if (PCI_SLOT(d->devfn) != PCI_SLOT(two->devfn)) return 1;
-
- /* Two MX's found - we don't currently support more than 2 */
- return 2;
-}
-
-/* gamma_init is called via init_module at module load time, or via
- * linux/init/main.c (this is not currently supported). */
-
-static int __init gamma_init(void)
-{
- int retcode;
- drm_device_t *dev = &gamma_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(gamma);
-#endif
- devices = gamma_find_devices();
- if (devices == 0) return -1;
-
- if ((retcode = misc_register(&gamma_misc))) {
- DRM_ERROR("Cannot register \"%s\"\n", GAMMA_NAME);
- return retcode;
- }
- dev->device = MKDEV(MISC_MAJOR, gamma_misc.minor);
- dev->name = GAMMA_NAME;
-
- drm_mem_init();
- drm_proc_init(dev);
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d with %d MX devices\n",
- GAMMA_NAME,
- GAMMA_MAJOR,
- GAMMA_MINOR,
- GAMMA_PATCHLEVEL,
- GAMMA_DATE,
- gamma_misc.minor,
- devices);
-
- return 0;
-}
-
-/* gamma_cleanup is called via cleanup_module at module unload time. */
-
-static void __exit gamma_cleanup(void)
-{
- drm_device_t *dev = &gamma_device;
-
- DRM_DEBUG("\n");
-
- drm_proc_cleanup();
- if (misc_deregister(&gamma_misc)) {
- DRM_ERROR("Cannot unload module\n");
- } else {
- DRM_INFO("Module unloaded\n");
- }
- gamma_takedown(dev);
-}
-
-module_init(gamma_init);
-module_exit(gamma_cleanup);
-
-
-int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -EFAULT; \
- }
-
- version.version_major = GAMMA_MAJOR;
- version.version_minor = GAMMA_MINOR;
- version.version_patchlevel = GAMMA_PATCHLEVEL;
-
- DRM_COPY(version.name, GAMMA_NAME);
- DRM_COPY(version.date, GAMMA_DATE);
- DRM_COPY(version.desc, GAMMA_DESC);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -EFAULT;
- return 0;
-}
-
-int gamma_open(struct inode *inode, struct file *filp)
-{
- drm_device_t *dev = &gamma_device;
- int retcode = 0;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_open_helper(inode, filp, dev))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- atomic_inc(&dev->total_open);
- spin_lock(&dev->count_lock);
- if (!dev->open_count++) {
- spin_unlock(&dev->count_lock);
- return gamma_setup(dev);
- }
- spin_unlock(&dev->count_lock);
- }
- return retcode;
-}
-
-int gamma_release(struct inode *inode, struct file *filp)
-{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_release(inode, filp))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return gamma_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- }
- unlock_kernel();
- return retcode;
-}
-
-/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-
-int gamma_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 >= GAMMA_IOCTL_COUNT) {
- retcode = -EINVAL;
- } else {
- ioctl = &gamma_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 gamma_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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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);
- gamma_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
-
- unblock_all_signals();
- return 0;
-}
+#define DRIVER_AUTHOR "VA Linux Systems Inc."
+
+#define DRIVER_NAME "gamma"
+#define DRIVER_DESC "3DLabs gamma"
+#define DRIVER_DATE "20010216"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 0
+#define DRIVER_PATCHLEVEL 0
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }
+
+
+#define __HAVE_COUNTERS 5
+#define __HAVE_COUNTER6 _DRM_STAT_IRQ
+#define __HAVE_COUNTER7 _DRM_STAT_DMA
+#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY
+#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL
+#define __HAVE_COUNTER10 _DRM_STAT_MISSED
+
+
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lists.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h
index e9ce39589..68b520700 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h
@@ -11,11 +11,11 @@
* 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
@@ -23,36 +23,83 @@
* OTHER LIABILITY, WHETHER IN AN ACTION 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@valinux.com>
- *
+ *
*/
#ifndef _GAMMA_DRV_H_
#define _GAMMA_DRV_H_
- /* gamma_drv.c */
-extern int gamma_version(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int gamma_open(struct inode *inode, struct file *filp);
-extern int gamma_release(struct inode *inode, struct file *filp);
-extern int gamma_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int gamma_lock(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int gamma_unlock(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
+
+typedef struct drm_gamma_private {
+ drm_map_t *buffers;
+ drm_map_t *mmio0;
+ drm_map_t *mmio1;
+ drm_map_t *mmio2;
+ drm_map_t *mmio3;
+} drm_gamma_private_t;
+
+#define LOCK_TEST_WITH_RETURN( dev ) \
+do { \
+ if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
+ dev->lock.pid != current->pid ) { \
+ DRM_ERROR( "%s called without lock held\n", \
+ __FUNCTION__ ); \
+ return -EINVAL; \
+ } \
+} while (0)
+
+
+extern void gamma_dma_ready(drm_device_t *dev);
+extern void gamma_dma_quiescent_single(drm_device_t *dev);
+extern void gamma_dma_quiescent_dual(drm_device_t *dev);
/* gamma_dma.c */
extern int gamma_dma_schedule(drm_device_t *dev, int locked);
extern int gamma_dma(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int gamma_irq_install(drm_device_t *dev, int irq);
-extern int gamma_irq_uninstall(drm_device_t *dev);
-extern int gamma_control(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
extern int gamma_find_devices(void);
extern int gamma_found(void);
+
+#define GAMMA_OFF(reg) \
+ ((reg < 0x1000) \
+ ? reg \
+ : ((reg < 0x10000) \
+ ? (reg - 0x1000) \
+ : ((reg < 0x11000) \
+ ? (reg - 0x10000) \
+ : (reg - 0x11000))))
+
+#define GAMMA_BASE(reg) ((unsigned long) \
+ ((reg < 0x1000) ? dev_priv->mmio0->handle : \
+ ((reg < 0x10000) ? dev_priv->mmio1->handle : \
+ ((reg < 0x11000) ? dev_priv->mmio2->handle : \
+ dev_priv->mmio3->handle))))
+
+#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg))
+#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg)
+#define GAMMA_READ(reg) GAMMA_DEREF(reg)
+#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0)
+
+#define GAMMA_BROADCASTMASK 0x9378
+#define GAMMA_COMMANDINTENABLE 0x0c48
+#define GAMMA_DMAADDRESS 0x0028
+#define GAMMA_DMACOUNT 0x0030
+#define GAMMA_FILTERMODE 0x8c00
+#define GAMMA_GCOMMANDINTFLAGS 0x0c50
+#define GAMMA_GCOMMANDMODE 0x0c40
+#define GAMMA_GCOMMANDSTATUS 0x0c60
+#define GAMMA_GDELAYTIMER 0x0c38
+#define GAMMA_GDMACONTROL 0x0060
+#define GAMMA_GINTENABLE 0x0808
+#define GAMMA_GINTFLAGS 0x0810
+#define GAMMA_INFIFOSPACE 0x0018
+#define GAMMA_OUTFIFOWORDS 0x0020
+#define GAMMA_OUTPUTFIFO 0x2000
+#define GAMMA_SYNC 0x8c40
+#define GAMMA_SYNC_TAG 0x0188
+
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h
new file mode 100644
index 000000000..ed25b2a99
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h
@@ -0,0 +1,112 @@
+/* i810.h -- Intel i810/i815 DRM template customization -*- linux-c -*-
+ * Created: Thu Feb 15 00:01:12 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __I810_H__
+#define __I810_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) i810_##x
+
+/* General customization:
+ */
+#define __HAVE_AGP 1
+#define __MUST_HAVE_AGP 1
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+/* Driver customization:
+ */
+#define __HAVE_RELEASE 1
+#define DRIVER_RELEASE() do { \
+ i810_reclaim_buffers( dev, priv->pid ); \
+} while (0)
+
+/* DMA customization:
+ */
+#define __HAVE_DMA 1
+#define __HAVE_DMA_QUEUE 1
+#define __HAVE_DMA_WAITLIST 1
+#define __HAVE_DMA_RECLAIM 1
+
+#define __HAVE_DMA_QUIESCENT 1
+#define DRIVER_DMA_QUIESCENT() do { \
+ i810_dma_quiescent( dev ); \
+} while (0)
+
+#define __HAVE_DMA_IRQ 1
+#define __HAVE_DMA_IRQ_BH 1
+#define DRIVER_PREINSTALL() do { \
+ drm_i810_private_t *dev_priv = \
+ (drm_i810_private_t *)dev->dev_private; \
+ u16 tmp; \
+ tmp = I810_READ16( I810REG_HWSTAM ); \
+ tmp = tmp & 0x6000; \
+ I810_WRITE16( I810REG_HWSTAM, tmp ); \
+ \
+ tmp = I810_READ16( I810REG_INT_MASK_R ); \
+ tmp = tmp & 0x6000; /* Unmask interrupts */ \
+ I810_WRITE16( I810REG_INT_MASK_R, tmp ); \
+ tmp = I810_READ16( I810REG_INT_ENABLE_R ); \
+ tmp = tmp & 0x6000; /* Disable all interrupts */ \
+ I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \
+} while (0)
+
+#define DRIVER_POSTINSTALL() do { \
+ drm_i810_private_t *dev_priv = \
+ (drm_i810_private_t *)dev->dev_private; \
+ u16 tmp; \
+ tmp = I810_READ16( I810REG_INT_ENABLE_R ); \
+ tmp = tmp & 0x6000; \
+ tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \
+ I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \
+} while (0)
+
+#define DRIVER_UNINSTALL() do { \
+ drm_i810_private_t *dev_priv = \
+ (drm_i810_private_t *)dev->dev_private; \
+ u16 tmp; \
+ tmp = I810_READ16( I810REG_INT_IDENTITY_R ); \
+ tmp = tmp & ~(0x6000); /* Clear all interrupts */ \
+ if ( tmp != 0 ) I810_WRITE16( I810REG_INT_IDENTITY_R, tmp ); \
+ \
+ tmp = I810_READ16( I810REG_INT_ENABLE_R ); \
+ tmp = tmp & 0x6000; /* Disable all interrupts */ \
+ I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \
+} while (0)
+
+/* Buffer customization:
+ */
+
+#define DRIVER_BUF_PRIV_T drm_i810_buf_priv_t
+
+#define DRIVER_AGP_BUFFERS_MAP( dev ) \
+ ((drm_i810_private_t *)((dev)->dev_private))->buffer_map
+
+#endif
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
index aa824a79c..4c90496a7 100644
--- 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
@@ -11,11 +11,11 @@
* 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
@@ -31,6 +31,7 @@
*/
#define __NO_VERSION__
+#include "i810.h"
#include "drmP.h"
#include "i810_drv.h"
#include <linux/interrupt.h> /* For task queue support */
@@ -47,17 +48,6 @@
#define I810_BUF_UNMAPPED 0
#define I810_BUF_MAPPED 1
-#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)
-#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg)
-#define I810_READ16(reg) I810_DEREF16(reg)
-#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0)
-
#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt;
#define BEGIN_LP_RING(n) do { \
@@ -107,14 +97,14 @@ static drm_buf_t *i810_freelist_get(drm_device_t *dev)
drm_device_dma_t *dma = dev->dma;
int i;
int used;
-
+
/* Linear search might not be the best solution */
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
/* In use is already a pointer */
- used = cmpxchg(buf_priv->in_use, I810_BUF_FREE,
+ used = cmpxchg(buf_priv->in_use, I810_BUF_FREE,
I810_BUF_CLIENT);
if(used == I810_BUF_FREE) {
return buf;
@@ -131,26 +121,26 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
{
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
int used;
-
+
/* In use is already a pointer */
used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE);
if(used != I810_BUF_CLIENT) {
DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx);
return -EINVAL;
}
-
+
return 0;
}
static struct file_operations i810_buffer_fops = {
- open: i810_open,
- flush: drm_flush,
- release: i810_release,
- ioctl: i810_ioctl,
+ open: DRM(open),
+ flush: DRM(flush),
+ release: DRM(release),
+ ioctl: DRM(ioctl),
mmap: i810_mmap_buffers,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
+ read: DRM(read),
+ fasync: DRM(fasync),
+ poll: DRM(poll),
};
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
@@ -166,10 +156,10 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
dev_priv = dev->dev_private;
buf = dev_priv->mmap_buffer;
buf_priv = buf->dev_private;
-
+
vma->vm_flags |= (VM_IO | VM_DONTCOPY);
vma->vm_file = filp;
-
+
buf_priv->currently_mapped = I810_BUF_MAPPED;
unlock_kernel();
@@ -196,9 +186,9 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
old_fops = filp->f_op;
filp->f_op = &i810_buffer_fops;
dev_priv->mmap_buffer = buf;
- buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total,
+ buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total,
PROT_READ|PROT_WRITE,
- MAP_SHARED,
+ MAP_SHARED,
buf->bus_address);
dev_priv->mmap_buffer = NULL;
filp->f_op = old_fops;
@@ -222,15 +212,15 @@ static int i810_unmap_buffer(drm_buf_t *buf)
int retcode = 0;
if(VM_DONTCOPY != 0) {
- if(buf_priv->currently_mapped != I810_BUF_MAPPED)
+ if(buf_priv->currently_mapped != I810_BUF_MAPPED)
return -EINVAL;
down(&current->mm->mmap_sem);
#if LINUX_VERSION_CODE < 0x020399
- retcode = do_munmap((unsigned long)buf_priv->virtual,
+ retcode = do_munmap((unsigned long)buf_priv->virtual,
(size_t) buf->total);
#else
- retcode = do_munmap(current->mm,
- (unsigned long)buf_priv->virtual,
+ retcode = do_munmap(current->mm,
+ (unsigned long)buf_priv->virtual,
(size_t) buf->total);
#endif
up(&current->mm->mmap_sem);
@@ -241,7 +231,7 @@ static int i810_unmap_buffer(drm_buf_t *buf)
return retcode;
}
-static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
+static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
struct file *filp)
{
drm_file_t *priv = filp->private_data;
@@ -255,7 +245,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
DRM_DEBUG("retcode=%d\n", retcode);
return retcode;
}
-
+
retcode = i810_map_buffer(buf, filp);
if(retcode) {
i810_freelist_put(dev, buf);
@@ -263,7 +253,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
return retcode;
}
buf->pid = priv->pid;
- buf_priv = buf->dev_private;
+ buf_priv = buf->dev_private;
d->granted = 1;
d->request_idx = buf->idx;
d->request_size = buf->total;
@@ -275,22 +265,22 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
static unsigned long i810_alloc_page(drm_device_t *dev)
{
unsigned long address;
-
+
address = __get_free_page(GFP_KERNEL);
- if(address == 0UL)
+ if(address == 0UL)
return 0;
-
+
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
-
+
return address;
}
static void i810_free_page(drm_device_t *dev, unsigned long page)
{
- if(page == 0UL)
+ if(page == 0UL)
return;
-
+
atomic_dec(&virt_to_page(page)->count);
clear_bit(PG_locked, &virt_to_page(page)->flags);
wake_up(&virt_to_page(page)->wait);
@@ -304,26 +294,26 @@ static int i810_dma_cleanup(drm_device_t *dev)
if(dev->dev_private) {
int i;
- drm_i810_private_t *dev_priv =
+ drm_i810_private_t *dev_priv =
(drm_i810_private_t *) dev->dev_private;
-
+
if(dev_priv->ring.virtual_start) {
- drm_ioremapfree((void *) dev_priv->ring.virtual_start,
- dev_priv->ring.Size);
+ DRM(ioremapfree)((void *) dev_priv->ring.virtual_start,
+ dev_priv->ring.Size);
}
if(dev_priv->hw_status_page != 0UL) {
i810_free_page(dev, dev_priv->hw_status_page);
/* Need to rewrite hardware status page */
I810_WRITE(0x02080, 0x1ffff000);
}
- drm_free(dev->dev_private, sizeof(drm_i810_private_t),
+ DRM(free)(dev->dev_private, sizeof(drm_i810_private_t),
DRM_MEM_DRIVER);
dev->dev_private = NULL;
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
- drm_ioremapfree(buf_priv->kernel_virtual, buf->total);
+ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
}
}
return 0;
@@ -340,14 +330,14 @@ static int i810_wait_ring(drm_device_t *dev, int n)
end = jiffies + (HZ*3);
while (ring->space < n) {
int i;
-
+
ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR;
ring->space = ring->head - (ring->tail+8);
if (ring->space < 0) ring->space += ring->Size;
-
+
if (ring->head != last_head)
end = jiffies + (HZ*3);
-
+
iters++;
if((signed)(end - jiffies) <= 0) {
DRM_ERROR("space: %d wanted %d\n", ring->space, n);
@@ -358,7 +348,7 @@ static int i810_wait_ring(drm_device_t *dev, int n)
for (i = 0 ; i < 2000 ; i++) ;
}
-out_wait_ring:
+out_wait_ring:
return iters;
}
@@ -366,7 +356,7 @@ static void i810_kernel_lost_context(drm_device_t *dev)
{
drm_i810_private_t *dev_priv = dev->dev_private;
drm_i810_ring_buffer_t *ring = &(dev_priv->ring);
-
+
ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR;
ring->tail = I810_READ(LP_RING + RING_TAIL);
ring->space = ring->head - (ring->tail+8);
@@ -380,7 +370,7 @@ static int i810_freelist_init(drm_device_t *dev)
int my_idx = 24;
u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx);
int i;
-
+
if(dma->buf_count > 1019) {
/* Not enough space in the status page for the freelist */
return -EINVAL;
@@ -389,55 +379,58 @@ static int i810_freelist_init(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
-
+
buf_priv->in_use = hw_status++;
buf_priv->my_use_idx = my_idx;
my_idx += 4;
*buf_priv->in_use = I810_BUF_FREE;
- buf_priv->kernel_virtual = drm_ioremap(buf->bus_address,
- buf->total);
+ buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address,
+ buf->total);
}
return 0;
}
-static int i810_dma_initialize(drm_device_t *dev,
+static int i810_dma_initialize(drm_device_t *dev,
drm_i810_private_t *dev_priv,
drm_i810_init_t *init)
{
- drm_map_t *sarea_map;
+ struct list_head *list;
dev->dev_private = (void *) dev_priv;
memset(dev_priv, 0, sizeof(drm_i810_private_t));
- if (init->ring_map_idx >= dev->map_count ||
- init->buffer_map_idx >= dev->map_count) {
- i810_dma_cleanup(dev);
- DRM_ERROR("ring_map or buffer_map are invalid\n");
- return -EINVAL;
- }
-
- dev_priv->ring_map_idx = init->ring_map_idx;
- dev_priv->buffer_map_idx = init->buffer_map_idx;
- sarea_map = dev->maplist[0];
- dev_priv->sarea_priv = (drm_i810_sarea_t *)
- ((u8 *)sarea_map->handle +
+ list_for_each(list, &dev->maplist->head) {
+ drm_map_list_t *r_list = (drm_map_list_t *)list;
+ if( r_list->map &&
+ r_list->map->type == _DRM_SHM &&
+ r_list->map->flags & _DRM_CONTAINS_LOCK ) {
+ dev_priv->sarea_map = r_list->map;
+ break;
+ }
+ }
+
+ DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset );
+ DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset );
+
+ dev_priv->sarea_priv = (drm_i810_sarea_t *)
+ ((u8 *)dev_priv->sarea_map->handle +
init->sarea_priv_offset);
atomic_set(&dev_priv->flush_done, 0);
init_waitqueue_head(&dev_priv->flush_queue);
-
+
dev_priv->ring.Start = init->ring_start;
dev_priv->ring.End = init->ring_end;
dev_priv->ring.Size = init->ring_size;
- dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base +
- init->ring_start,
- init->ring_size);
+ dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base +
+ init->ring_start,
+ init->ring_size);
dev_priv->ring.tail_mask = dev_priv->ring.Size - 1;
-
+
if (dev_priv->ring.virtual_start == NULL) {
i810_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for"
@@ -454,8 +447,8 @@ static int i810_dma_initialize(drm_device_t *dev,
dev_priv->front_di1 = init->front_offset | init->pitch_bits;
dev_priv->back_di1 = init->back_offset | init->pitch_bits;
dev_priv->zi1 = init->depth_offset | init->pitch_bits;
-
-
+
+
/* Program Hardware Status Page */
dev_priv->hw_status_page = i810_alloc_page(dev);
memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE);
@@ -465,10 +458,10 @@ static int i810_dma_initialize(drm_device_t *dev,
return -ENOMEM;
}
DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page);
-
+
I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page));
DRM_DEBUG("Enabled hardware status page\n");
-
+
/* Now we need to init our freelist */
if(i810_freelist_init(dev) != 0) {
i810_dma_cleanup(dev);
@@ -487,13 +480,13 @@ int i810_dma_init(struct inode *inode, struct file *filp,
drm_i810_private_t *dev_priv;
drm_i810_init_t init;
int retcode = 0;
-
+
if (copy_from_user(&init, (drm_i810_init_t *)arg, sizeof(init)))
return -EFAULT;
-
+
switch(init.func) {
case I810_INIT_DMA:
- dev_priv = drm_alloc(sizeof(drm_i810_private_t),
+ dev_priv = DRM(alloc)(sizeof(drm_i810_private_t),
DRM_MEM_DRIVER);
if(dev_priv == NULL) return -ENOMEM;
retcode = i810_dma_initialize(dev, dev_priv, &init);
@@ -505,7 +498,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
retcode = -EINVAL;
break;
}
-
+
return retcode;
}
@@ -517,9 +510,9 @@ int i810_dma_init(struct inode *inode, struct file *filp,
* Use 'volatile' & local var tmp to force the emitted values to be
* identical to the verified ones.
*/
-static void i810EmitContextVerified( drm_device_t *dev,
- volatile unsigned int *code )
-{
+static void i810EmitContextVerified( drm_device_t *dev,
+ volatile unsigned int *code )
+{
drm_i810_private_t *dev_priv = dev->dev_private;
int i, j = 0;
unsigned int tmp;
@@ -537,22 +530,22 @@ static void i810EmitContextVerified( drm_device_t *dev,
tmp = code[i];
if ((tmp & (7<<29)) == (3<<29) &&
- (tmp & (0x1f<<24)) < (0x1d<<24))
+ (tmp & (0x1f<<24)) < (0x1d<<24))
{
- OUT_RING( tmp );
+ OUT_RING( tmp );
j++;
- }
+ }
}
- if (j & 1)
- OUT_RING( 0 );
+ if (j & 1)
+ OUT_RING( 0 );
ADVANCE_LP_RING();
}
-static void i810EmitTexVerified( drm_device_t *dev,
- volatile unsigned int *code )
-{
+static void i810EmitTexVerified( drm_device_t *dev,
+ volatile unsigned int *code )
+{
drm_i810_private_t *dev_priv = dev->dev_private;
int i, j = 0;
unsigned int tmp;
@@ -569,15 +562,15 @@ static void i810EmitTexVerified( drm_device_t *dev,
tmp = code[i];
if ((tmp & (7<<29)) == (3<<29) &&
- (tmp & (0x1f<<24)) < (0x1d<<24))
+ (tmp & (0x1f<<24)) < (0x1d<<24))
{
- OUT_RING( tmp );
+ OUT_RING( tmp );
j++;
}
- }
-
- if (j & 1)
- OUT_RING( 0 );
+ }
+
+ if (j & 1)
+ OUT_RING( 0 );
ADVANCE_LP_RING();
}
@@ -585,9 +578,9 @@ static void i810EmitTexVerified( drm_device_t *dev,
/* Need to do some additional checking when setting the dest buffer.
*/
-static void i810EmitDestVerified( drm_device_t *dev,
- volatile unsigned int *code )
-{
+static void i810EmitDestVerified( drm_device_t *dev,
+ volatile unsigned int *code )
+{
drm_i810_private_t *dev_priv = dev->dev_private;
unsigned int tmp;
RING_LOCALS;
@@ -651,9 +644,9 @@ static void i810EmitState( drm_device_t *dev )
-/* need to verify
+/* need to verify
*/
-static void i810_dma_dispatch_clear( drm_device_t *dev, int flags,
+static void i810_dma_dispatch_clear( drm_device_t *dev, int flags,
unsigned int clear_color,
unsigned int clear_zval )
{
@@ -684,10 +677,10 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags,
pbox->y2 > dev_priv->h)
continue;
- if ( flags & I810_FRONT ) {
+ if ( flags & I810_FRONT ) {
DRM_DEBUG("clear front\n");
- BEGIN_LP_RING( 6 );
- OUT_RING( BR00_BITBLT_CLIENT |
+ BEGIN_LP_RING( 6 );
+ OUT_RING( BR00_BITBLT_CLIENT |
BR00_OP_COLOR_BLT | 0x3 );
OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch );
OUT_RING( (height << 16) | width );
@@ -699,8 +692,8 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags,
if ( flags & I810_BACK ) {
DRM_DEBUG("clear back\n");
- BEGIN_LP_RING( 6 );
- OUT_RING( BR00_BITBLT_CLIENT |
+ BEGIN_LP_RING( 6 );
+ OUT_RING( BR00_BITBLT_CLIENT |
BR00_OP_COLOR_BLT | 0x3 );
OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch );
OUT_RING( (height << 16) | width );
@@ -712,8 +705,8 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags,
if ( flags & I810_DEPTH ) {
DRM_DEBUG("clear depth\n");
- BEGIN_LP_RING( 6 );
- OUT_RING( BR00_BITBLT_CLIENT |
+ BEGIN_LP_RING( 6 );
+ OUT_RING( BR00_BITBLT_CLIENT |
BR00_OP_COLOR_BLT | 0x3 );
OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch );
OUT_RING( (height << 16) | width );
@@ -744,7 +737,7 @@ static void i810_dma_dispatch_swap( drm_device_t *dev )
if (nbox > I810_NR_SAREA_CLIPRECTS)
nbox = I810_NR_SAREA_CLIPRECTS;
- for (i = 0 ; i < nbox; i++, pbox++)
+ for (i = 0 ; i < nbox; i++, pbox++)
{
unsigned int w = pbox->x2 - pbox->x1;
unsigned int h = pbox->y2 - pbox->y1;
@@ -756,7 +749,7 @@ static void i810_dma_dispatch_swap( drm_device_t *dev )
pbox->x2 > dev_priv->w ||
pbox->y2 > dev_priv->h)
continue;
-
+
DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n",
pbox[i].x1, pbox[i].y1,
pbox[i].x2, pbox[i].y2);
@@ -766,14 +759,14 @@ static void i810_dma_dispatch_swap( drm_device_t *dev )
OUT_RING( pitch | (0xCC << 16));
OUT_RING( (h << 16) | (w * cpp));
OUT_RING( dst );
- OUT_RING( pitch );
+ OUT_RING( pitch );
OUT_RING( start );
ADVANCE_LP_RING();
}
}
-static void i810_dma_dispatch_vertex(drm_device_t *dev,
+static void i810_dma_dispatch_vertex(drm_device_t *dev,
drm_buf_t *buf,
int discard,
int used)
@@ -784,30 +777,30 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev,
drm_clip_rect_t *box = sarea_priv->boxes;
int nbox = sarea_priv->nbox;
unsigned long address = (unsigned long)buf->bus_address;
- unsigned long start = address - dev->agp->base;
+ unsigned long start = address - dev->agp->base;
int i = 0, u;
RING_LOCALS;
i810_kernel_lost_context(dev);
- if (nbox > I810_NR_SAREA_CLIPRECTS)
+ if (nbox > I810_NR_SAREA_CLIPRECTS)
nbox = I810_NR_SAREA_CLIPRECTS;
if (discard) {
- u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
+ u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
I810_BUF_HARDWARE);
if(u != I810_BUF_CLIENT) {
DRM_DEBUG("xxxx 2\n");
}
}
- if (used > 4*1024)
+ if (used > 4*1024)
used = 0;
if (sarea_priv->dirty)
i810EmitState( dev );
- DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n",
+ DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n",
address, used, nbox);
dev_priv->counter++;
@@ -821,7 +814,7 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev,
*(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE |
sarea_priv->vertex_prim |
((used/4)-2));
-
+
if (used & 4) {
*(u32 *)((u32)buf_priv->virtual + used) = 0;
used += 4;
@@ -829,26 +822,26 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev,
i810_unmap_buffer(buf);
}
-
+
if (used) {
do {
if (i < nbox) {
BEGIN_LP_RING(4);
- OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR |
+ OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR |
SC_ENABLE );
OUT_RING( GFX_OP_SCISSOR_INFO );
OUT_RING( box[i].x1 | (box[i].y1<<16) );
OUT_RING( (box[i].x2-1) | ((box[i].y2-1)<<16) );
ADVANCE_LP_RING();
}
-
+
BEGIN_LP_RING(4);
OUT_RING( CMD_OP_BATCH_BUFFER );
OUT_RING( start | BB1_PROTECTED );
OUT_RING( start + used - 4 );
OUT_RING( 0 );
ADVANCE_LP_RING();
-
+
} while (++i < nbox);
}
@@ -872,24 +865,25 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev,
/* Interrupts are only for flushing */
-static void i810_dma_service(int irq, void *device, struct pt_regs *regs)
+void i810_dma_service(int irq, void *device, struct pt_regs *regs)
{
drm_device_t *dev = (drm_device_t *)device;
+ drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u16 temp;
-
- atomic_inc(&dev->total_irq);
+
+ atomic_inc(&dev->counts[_DRM_STAT_IRQ]);
temp = I810_READ16(I810REG_INT_IDENTITY_R);
temp = temp & ~(0x6000);
- if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R,
+ if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R,
temp); /* Clear all interrupts */
else
return;
-
+
queue_task(&dev->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
}
-static void i810_dma_task_queue(void *device)
+void i810_dma_immediate_bh(void *device)
{
drm_device_t *dev = (drm_device_t *) device;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
@@ -898,129 +892,6 @@ static void i810_dma_task_queue(void *device)
wake_up_interruptible(&dev_priv->flush_queue);
}
-int i810_irq_install(drm_device_t *dev, int irq)
-{
- int retcode;
- u16 temp;
-
- 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( "Interrupt Install : %d\n", irq);
- 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;
-
- INIT_LIST_HEAD(&dev->tq.list);
- dev->tq.sync = 0;
- dev->tq.routine = i810_dma_task_queue;
- dev->tq.data = dev;
-
- /* Before installing handler */
- temp = I810_READ16(I810REG_HWSTAM);
- temp = temp & 0x6000;
- I810_WRITE16(I810REG_HWSTAM, temp);
-
- temp = I810_READ16(I810REG_INT_MASK_R);
- temp = temp & 0x6000;
- I810_WRITE16(I810REG_INT_MASK_R, temp); /* Unmask interrupts */
- temp = I810_READ16(I810REG_INT_ENABLE_R);
- temp = temp & 0x6000;
- I810_WRITE16(I810REG_INT_ENABLE_R, temp); /* Disable all interrupts */
-
- /* Install handler */
- if ((retcode = request_irq(dev->irq,
- i810_dma_service,
- SA_SHIRQ,
- dev->devname,
- dev))) {
- down(&dev->struct_sem);
- dev->irq = 0;
- up(&dev->struct_sem);
- return retcode;
- }
- temp = I810_READ16(I810REG_INT_ENABLE_R);
- temp = temp & 0x6000;
- temp = temp | 0x0003;
- I810_WRITE16(I810REG_INT_ENABLE_R,
- temp); /* Enable bp & user interrupts */
- return 0;
-}
-
-int i810_irq_uninstall(drm_device_t *dev)
-{
- int irq;
- u16 temp;
-
-
-/* return 0; */
-
- down(&dev->struct_sem);
- irq = dev->irq;
- dev->irq = 0;
- up(&dev->struct_sem);
-
- if (!irq) return -EINVAL;
-
- DRM_DEBUG( "Interrupt UnInstall: %d\n", irq);
- DRM_DEBUG("%d\n", irq);
-
- temp = I810_READ16(I810REG_INT_IDENTITY_R);
- temp = temp & ~(0x6000);
- if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R,
- temp); /* Clear all interrupts */
-
- temp = I810_READ16(I810REG_INT_ENABLE_R);
- temp = temp & 0x6000;
- I810_WRITE16(I810REG_INT_ENABLE_R,
- temp); /* Disable all 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;
-
- DRM_DEBUG( "i810_control\n");
-
- if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl)))
- return -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;
-}
-
static inline void i810_dma_emit_flush(drm_device_t *dev)
{
drm_i810_private_t *dev_priv = dev->dev_private;
@@ -1057,11 +928,11 @@ static inline void i810_dma_quiescent_emit(drm_device_t *dev)
/* wake_up_interruptible(&dev_priv->flush_queue); */
}
-static void i810_dma_quiescent(drm_device_t *dev)
+void i810_dma_quiescent(drm_device_t *dev)
{
DECLARE_WAITQUEUE(entry, current);
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
- unsigned long end;
+ unsigned long end;
if(dev_priv == NULL) {
return;
@@ -1069,7 +940,7 @@ static void i810_dma_quiescent(drm_device_t *dev)
atomic_set(&dev_priv->flush_done, 0);
add_wait_queue(&dev_priv->flush_queue, &entry);
end = jiffies + (HZ*3);
-
+
for (;;) {
current->state = TASK_INTERRUPTIBLE;
i810_dma_quiescent_emit(dev);
@@ -1077,16 +948,16 @@ static void i810_dma_quiescent(drm_device_t *dev)
if((signed)(end - jiffies) <= 0) {
DRM_ERROR("lockup\n");
break;
- }
+ }
schedule_timeout(HZ*3);
if (signal_pending(current)) {
break;
}
}
-
+
current->state = TASK_RUNNING;
remove_wait_queue(&dev_priv->flush_queue, &entry);
-
+
return;
}
@@ -1096,7 +967,7 @@ static int i810_flush_queue(drm_device_t *dev)
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
drm_device_dma_t *dma = dev->dma;
unsigned long end;
- int i, ret = 0;
+ int i, ret = 0;
if(dev_priv == NULL) {
return 0;
@@ -1111,14 +982,14 @@ static int i810_flush_queue(drm_device_t *dev)
if((signed)(end - jiffies) <= 0) {
DRM_ERROR("lockup\n");
break;
- }
+ }
schedule_timeout(HZ*3);
if (signal_pending(current)) {
ret = -EINTR; /* Can't restart */
break;
}
}
-
+
current->state = TASK_RUNNING;
remove_wait_queue(&dev_priv->flush_queue, &entry);
@@ -1126,8 +997,8 @@ static int i810_flush_queue(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
-
- int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE,
+
+ int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE,
I810_BUF_FREE);
if (used == I810_BUF_HARDWARE)
@@ -1154,9 +1025,9 @@ void i810_reclaim_buffers(drm_device_t *dev, pid_t pid)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
-
+
if (buf->pid == pid && buf_priv) {
- int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
+ int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
I810_BUF_FREE);
if (used == I810_BUF_CLIENT)
@@ -1167,91 +1038,12 @@ void i810_reclaim_buffers(drm_device_t *dev, pid_t pid)
}
}
-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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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 (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 (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
- DRM_DEBUG("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) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
-
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- DRM_DEBUG("_DRM_LOCK_QUIESCENT\n");
- DRM_DEBUG("fred\n");
- i810_dma_quiescent(dev);
- }
- }
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
- return ret;
-}
-
-int i810_flush_ioctl(struct inode *inode, struct file *filp,
+int i810_flush_ioctl(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_DEBUG("i810_flush_ioctl\n");
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_flush_ioctl called without lock held\n");
@@ -1271,8 +1063,8 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = (u32 *)dev_priv->hw_status_page;
- drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
- dev_priv->sarea_priv;
+ drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
+ dev_priv->sarea_priv;
drm_i810_vertex_t vertex;
if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex)))
@@ -1286,15 +1078,15 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n",
vertex.idx, vertex.used, vertex.discard);
- i810_dma_dispatch_vertex( dev,
- dma->buflist[ vertex.idx ],
+ i810_dma_dispatch_vertex( dev,
+ dma->buflist[ vertex.idx ],
vertex.discard, vertex.used );
- atomic_add(vertex.used, &dma->total_bytes);
- atomic_inc(&dma->total_dmas);
+ atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]);
+ atomic_inc(&dev->counts[_DRM_STAT_DMA]);
sarea_priv->last_enqueue = dev_priv->counter-1;
sarea_priv->last_dispatch = (int) hw_status[5];
-
+
return 0;
}
@@ -1309,14 +1101,14 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear)))
return -EFAULT;
-
+
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_clear_bufs called without lock held\n");
return -EINVAL;
}
- i810_dma_dispatch_clear( dev, clear.flags,
- clear.clear_color,
+ i810_dma_dispatch_clear( dev, clear.flags,
+ clear.clear_color,
clear.clear_depth );
return 0;
}
@@ -1326,7 +1118,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
-
+
DRM_DEBUG("i810_swap_bufs\n");
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1345,8 +1137,8 @@ int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
drm_device_t *dev = priv->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = (u32 *)dev_priv->hw_status_page;
- drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
- dev_priv->sarea_priv;
+ drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
+ dev_priv->sarea_priv;
sarea_priv->last_dispatch = (int) hw_status[5];
return 0;
@@ -1361,18 +1153,18 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
drm_i810_dma_t d;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = (u32 *)dev_priv->hw_status_page;
- drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
- dev_priv->sarea_priv;
+ drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
+ dev_priv->sarea_priv;
DRM_DEBUG("getbuf\n");
if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d)))
return -EFAULT;
-
+
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_dma called without lock held\n");
return -EINVAL;
}
-
+
d.granted = 0;
retcode = i810_dma_get_buffer(dev, &d, filp);
@@ -1395,8 +1187,8 @@ int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd,
drm_i810_copy_t d;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = (u32 *)dev_priv->hw_status_page;
- drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
- dev_priv->sarea_priv;
+ drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
+ dev_priv->sarea_priv;
drm_buf_t *buf;
drm_i810_buf_priv_t *buf_priv;
drm_device_dma_t *dma = dev->dma;
@@ -1405,7 +1197,7 @@ int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd,
DRM_ERROR("i810_dma called without lock held\n");
return -EINVAL;
}
-
+
if (copy_from_user(&d, (drm_i810_copy_t *)arg, sizeof(d)))
return -EFAULT;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h
index c5f51c9ad..cee189b7b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h
@@ -98,8 +98,8 @@ typedef struct _drm_i810_init {
I810_INIT_DMA = 0x01,
I810_CLEANUP_DMA = 0x02
} func;
- int ring_map_idx;
- int buffer_map_idx;
+ unsigned int mmio_offset;
+ unsigned int buffers_offset;
int sarea_priv_offset;
unsigned int ring_start;
unsigned int ring_end;
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
index 7152eac3a..12a59dbf3 100644
--- 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
@@ -19,630 +19,64 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- * Jeff Hartmann <jhartmann@valinux.com>
+ * 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@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
#include <linux/config.h>
+#include "i810.h"
#include "drmP.h"
#include "i810_drv.h"
-#define I810_NAME "i810"
-#define I810_DESC "Intel I810"
-#define I810_DATE "20000928"
-#define I810_MAJOR 1
-#define I810_MINOR 1
-#define I810_PATCHLEVEL 0
-
-static drm_device_t i810_device;
-drm_ctx_t i810_res_ctx;
-
-static struct file_operations i810_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: i810_open,
- flush: drm_flush,
- release: i810_release,
- ioctl: i810_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-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_FREE_BUFS)] = { i810_freebufs, 1, 0 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { i810_addctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { i810_rmctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { i810_modctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { i810_getctx, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { i810_switchctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { i810_newctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { i810_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_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 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl,1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 },
-};
-
-#define I810_IOCTL_COUNT DRM_ARRAY_SIZE(i810_ioctls)
-
-#ifdef MODULE
-static char *i810 = NULL;
-#endif
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("Intel I810");
-MODULE_PARM(i810, "s");
-
-#ifndef MODULE
-/* i810_options 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.
- */
-
-static int __init i810_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("i810=", i810_options);
-#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();
-
- 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). */
-
-static int __init 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
- DRM_DEBUG("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;
-
- 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();
- if(dev->agp == NULL) {
- DRM_INFO("The i810 drm module requires the agpgart module"
- " to function correctly\nPlease load the agpgart"
- " module before you load the i810 module\n");
- drm_proc_cleanup();
- misc_deregister(&i810_misc);
- i810_takedown(dev);
- return -ENOMEM;
- }
- 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(&i810_misc);
- i810_takedown(dev);
- return retcode;
- }
-
- 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. */
-
-static void __exit 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_takedown(dev);
- if (dev->agp) {
- drm_agp_uninit();
- drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-}
-
-module_init(i810_init);
-module_exit(i810_cleanup);
-
-
-int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -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);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -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))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
- DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
- current->pid, dev->device, dev->open_count);
-
- if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
- && dev->lock.pid == current->pid) {
- i810_reclaim_buffers(dev, priv->pid);
- DRM_ERROR("Process %d dead, freeing lock for context %d\n",
- current->pid,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
- drm_lock_free(dev,
- &dev->lock.hw_lock->lock,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
-
- /* FIXME: may require heavy-handed reset of
- hardware at this point, possibly
- processed via a callback to the X
- server. */
- } else if (dev->lock.hw_lock) {
- /* The lock is required to reclaim buffers */
- DECLARE_WAITQUEUE(entry, current);
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- if (!dev->lock.hw_lock) {
- /* Device has been unregistered */
- retcode = -EINTR;
- break;
- }
- if (drm_lock_take(&dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- dev->lock.pid = priv->pid;
- dev->lock.lock_time = jiffies;
- atomic_inc(&dev->total_locks);
- break; /* Got lock */
- }
- /* Contention */
- atomic_inc(&dev->total_sleeps);
- schedule();
- if (signal_pending(current)) {
- retcode = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- if(!retcode) {
- i810_reclaim_buffers(dev, priv->pid);
- drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT);
- }
- }
- drm_fasync(-1, filp, 0);
-
- down(&dev->struct_sem);
- if (priv->prev) priv->prev->next = priv->next;
- else dev->file_first = priv->next;
- if (priv->next) priv->next->prev = priv->prev;
- else dev->file_last = priv->prev;
- up(&dev->struct_sem);
-
- drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return i810_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- 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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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);
- 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
-
- unblock_all_signals();
- return 0;
-}
+#define DRIVER_AUTHOR "VA Linux Systems Inc."
+
+#define DRIVER_NAME "i810"
+#define DRIVER_DESC "Intel i810"
+#define DRIVER_DATE "20010215"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 },
+
+
+#define __HAVE_COUNTERS 4
+#define __HAVE_COUNTER6 _DRM_STAT_IRQ
+#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
+#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
+#define __HAVE_COUNTER9 _DRM_STAT_DMA
+
+
+#include "drm_agpsupport.h"
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lock.h"
+#include "drm_lists.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
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
index 1c9574017..e1b17148e 100644
--- 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
@@ -11,11 +11,11 @@
* 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
@@ -54,11 +54,12 @@ typedef struct _drm_i810_ring_buffer{
} drm_i810_ring_buffer_t;
typedef struct drm_i810_private {
- int ring_map_idx;
- int buffer_map_idx;
+ drm_map_t *sarea_map;
+ drm_map_t *buffer_map;
+ drm_map_t *mmio_map;
- drm_i810_ring_buffer_t ring;
drm_i810_sarea_t *sarea_priv;
+ drm_i810_ring_buffer_t ring;
unsigned long hw_status_page;
unsigned long counter;
@@ -67,78 +68,33 @@ typedef struct drm_i810_private {
wait_queue_head_t flush_queue; /* Processes waiting until flush */
drm_buf_t *mmap_buffer;
-
+
u32 front_di1, back_di1, zi1;
-
+
int back_offset;
int depth_offset;
int w, h;
int pitch;
} drm_i810_private_t;
- /* i810_drv.c */
-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_getbuf(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 int i810_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i810_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid);
-extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
-extern int i810_copybuf(struct inode *inode, struct file *filp,
+extern int i810_getage(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int i810_docopy(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
- /* i810_bufs.c */
-extern int i810_addbufs(struct inode *inode, struct file *filp,
+extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
+extern int i810_copybuf(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_addmap(struct inode *inode, struct file *filp,
+extern int i810_docopy(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
- /* i810_context.c */
-extern int i810_resctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_addctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_modctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_getctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_switchctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_newctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int i810_rmctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-extern int i810_context_switch(drm_device_t *dev, int old, int new);
-extern int i810_context_switch_complete(drm_device_t *dev, int new);
+extern void i810_dma_quiescent(drm_device_t *dev);
#define I810_VERBOSE 0
@@ -152,6 +108,18 @@ int i810_swap_bufs(struct inode *inode, struct file *filp,
int i810_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+
+#define I810_BASE(reg) ((unsigned long) \
+ dev_priv->mmio_map->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)
+#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg)
+#define I810_READ16(reg) I810_DEREF16(reg)
+#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0)
+
+
#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
#define CMD_REPORT_HEAD (7<<23)
@@ -184,7 +152,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
#define RING_START 0x08
#define START_ADDR 0x00FFFFF8
#define RING_LEN 0x0C
-#define RING_NR_PAGES 0x000FF000
+#define RING_NR_PAGES 0x000FF000
#define RING_REPORT_MASK 0x00000006
#define RING_REPORT_64K 0x00000002
#define RING_REPORT_128K 0x00000004
@@ -222,4 +190,3 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
#endif
-
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h
new file mode 100644
index 000000000..277aa2029
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h
@@ -0,0 +1,67 @@
+/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*-
+ * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __MGA_H__
+#define __MGA_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) mga_##x
+
+/* General customization:
+ */
+#define __HAVE_AGP 1
+#define __MUST_HAVE_AGP 1
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+/* Driver customization:
+ */
+#define DRIVER_PRETAKEDOWN() do { \
+ if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \
+} while (0)
+
+/* DMA customization:
+ */
+#define __HAVE_DMA 1
+
+#define __HAVE_DMA_QUIESCENT 1
+#define DRIVER_DMA_QUIESCENT() do { \
+ drm_mga_private_t *dev_priv = dev->dev_private; \
+ return mga_do_wait_for_idle( dev_priv ); \
+} while (0)
+
+/* Buffer customization:
+ */
+#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t
+
+#define DRIVER_AGP_BUFFERS_MAP( dev ) \
+ ((drm_mga_private_t *)((dev)->dev_private))->buffers
+
+#endif
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
index 356376ca9..8b0a67a2d 100644
--- 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
@@ -24,1028 +24,695 @@
* 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@valinux.com>
- * Jeff Hartmann <jhartmann@valinux.com>
- * Keith Whitwell <keithw@valinux.com>
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
+ * Rewritten by:
+ * Gareth Hughes <gareth@valinux.com>
*/
#define __NO_VERSION__
+#include "mga.h"
#include "drmP.h"
#include "mga_drv.h"
#include <linux/interrupt.h> /* For task queue support */
+#include <linux/delay.h>
-#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 MGA_DEFAULT_USEC_TIMEOUT 10000
-#define PDEA_pagpxfer_enable 0x2
-static int mga_flush_queue(drm_device_t *dev);
+/* ================================================================
+ * Engine control
+ */
-static unsigned long mga_alloc_page(drm_device_t *dev)
+int mga_do_wait_for_idle( drm_mga_private_t *dev_priv )
{
- unsigned long address;
+ u32 status = 0;
+ int i;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
- address = __get_free_page(GFP_KERNEL);
- if(address == 0UL) {
- return 0;
+ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
+ status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK;
+ if ( status == MGA_ENDPRDMASTS ) {
+ MGA_WRITE8( MGA_CRTC_INDEX, 0 );
+ return 0;
+ }
+ udelay( 1 );
}
- atomic_inc(&virt_to_page(address)->count);
- set_bit(PG_reserved, &virt_to_page(address)->flags);
- return address;
+ DRM_DEBUG( "failed! status=0x%08x\n", status );
+ return -EBUSY;
}
-static void mga_free_page(drm_device_t *dev, unsigned long page)
+int mga_do_dma_idle( drm_mga_private_t *dev_priv )
{
- if(!page) return;
- atomic_dec(&virt_to_page(page)->count);
- clear_bit(PG_reserved, &virt_to_page(page)->flags);
- free_page(page);
- return;
+ u32 status = 0;
+ int i;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
+ status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK;
+ if ( status == MGA_ENDPRDMASTS ) return 0;
+ udelay( 1 );
+ }
+
+ DRM_DEBUG( "failed! status=0x%08x\n", status );
+ return -EBUSY;
}
-static void mga_delay(void)
+int mga_do_dma_reset( drm_mga_private_t *dev_priv )
{
- return;
-}
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_primary_buffer_t *primary = &dev_priv->prim;
-/* These are two age tags that will never be sent to
- * the hardware */
-#define MGA_BUF_USED 0xffffffff
-#define MGA_BUF_FREE 0
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
-static int mga_freelist_init(drm_device_t *dev)
-{
- drm_device_dma_t *dma = dev->dma;
- drm_buf_t *buf;
- drm_mga_buf_priv_t *buf_priv;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_freelist_t *item;
- int i;
-
- dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
- if(dev_priv->head == NULL) return -ENOMEM;
- memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t));
- dev_priv->head->age = MGA_BUF_USED;
-
- for (i = 0; i < dma->buf_count; i++) {
- buf = dma->buflist[ i ];
- buf_priv = buf->dev_private;
- item = drm_alloc(sizeof(drm_mga_freelist_t),
- DRM_MEM_DRIVER);
- if(item == NULL) return -ENOMEM;
- memset(item, 0, sizeof(drm_mga_freelist_t));
- item->age = MGA_BUF_FREE;
- item->prev = dev_priv->head;
- item->next = dev_priv->head->next;
- if(dev_priv->head->next != NULL)
- dev_priv->head->next->prev = item;
- if(item->next == NULL) dev_priv->tail = item;
- item->buf = buf;
- buf_priv->my_freelist = item;
- buf_priv->discard = 0;
- buf_priv->dispatched = 0;
- dev_priv->head->next = item;
- }
+ /* The primary DMA stream should look like new right about now.
+ */
+ primary->tail = 0;
+ primary->space = primary->size;
+ primary->last_flush = 0;
- return 0;
-}
+ sarea_priv->last_wrap = 0;
-static void mga_freelist_cleanup(drm_device_t *dev)
-{
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_freelist_t *item;
- drm_mga_freelist_t *prev;
-
- item = dev_priv->head;
- while(item) {
- prev = item;
- item = item->next;
- drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
- }
+ /* FIXME: Reset counters, buffer ages etc...
+ */
+
+ /* FIXME: What else do we need to reinitialize? WARP stuff?
+ */
- dev_priv->head = dev_priv->tail = NULL;
+ return 0;
}
-/* Frees dispatch lock */
-static inline void mga_dma_quiescent(drm_device_t *dev)
+int mga_do_engine_reset( drm_mga_private_t *dev_priv )
{
- 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;
- unsigned long end;
- int i;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
- DRM_DEBUG("dispatch_status = 0x%02lx\n", dev_priv->dispatch_status);
- end = jiffies + (HZ*3);
- while(1) {
- if(!test_and_set_bit(MGA_IN_DISPATCH,
- &dev_priv->dispatch_status)) {
- break;
- }
- if((signed)(end - jiffies) <= 0) {
- DRM_ERROR("irqs: %d wanted %d\n",
- atomic_read(&dev->total_irq),
- atomic_read(&dma->total_lost));
- DRM_ERROR("lockup: dispatch_status = 0x%02lx,"
- " jiffies = %lu, end = %lu\n",
- dev_priv->dispatch_status, jiffies, end);
- return;
- }
- for (i = 0 ; i < 2000 ; i++) mga_delay();
- }
- end = jiffies + (HZ*3);
- DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS));
- while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) {
- if((signed)(end - jiffies) <= 0) {
- DRM_ERROR("irqs: %d wanted %d\n",
- atomic_read(&dev->total_irq),
- atomic_read(&dma->total_lost));
- DRM_ERROR("lockup\n");
- clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
- return;
- }
- for (i = 0 ; i < 2000 ; i++) mga_delay();
- }
- sarea_priv->dirty |= MGA_DMA_FLUSH;
+ /* Okay, so we've completely screwed up and locked the engine.
+ * How about we clean up after ourselves?
+ */
+ MGA_WRITE( MGA_RST, MGA_SOFTRESET );
+ udelay( 15 ); /* Wait at least 10 usecs */
+ MGA_WRITE( MGA_RST, 0 );
+
+ /* Initialize the registers that get clobbered by the soft
+ * reset. Many of the core register values survive a reset,
+ * but the drawing registers are basically all gone.
+ *
+ * 3D clients should probably die after calling this. The X
+ * server should reset the engine state to known values.
+ */
+#if 0
+ MGA_WRITE( MGA_PRIMPTR,
+ virt_to_bus((void *)dev_priv->prim.status_page) |
+ MGA_PRIMPTREN0 |
+ MGA_PRIMPTREN1 );
+#endif
- clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
- DRM_DEBUG("exit, dispatch_status = 0x%02lx\n",
- dev_priv->dispatch_status);
-}
+ MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR );
+ MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN );
-static void mga_reset_freelist(drm_device_t *dev)
-{
- drm_device_dma_t *dma = dev->dma;
- drm_buf_t *buf;
- drm_mga_buf_priv_t *buf_priv;
- int i;
+ /* The primary DMA stream should look like new right about now.
+ */
+ mga_do_dma_reset( dev_priv );
- for (i = 0; i < dma->buf_count; i++) {
- buf = dma->buflist[ i ];
- buf_priv = buf->dev_private;
- buf_priv->my_freelist->age = MGA_BUF_FREE;
- }
+ /* This bad boy will never fail.
+ */
+ return 0;
}
-/* Least recently used :
- * These operations are not atomic b/c they are protected by the
- * hardware lock */
-drm_buf_t *mga_freelist_get(drm_device_t *dev)
+/* ================================================================
+ * Primary DMA stream
+ */
+
+void mga_do_dma_flush( drm_mga_private_t *dev_priv )
{
- DECLARE_WAITQUEUE(entry, current);
- drm_mga_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
- drm_mga_freelist_t *prev;
- drm_mga_freelist_t *next;
- static int failed = 0;
- int return_null = 0;
-
- if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) {
- DRM_DEBUG("Waiting on freelist,"
- " tail->age = %d, last_prim_age= %d\n",
- dev_priv->tail->age,
- dev_priv->last_prim_age);
- add_wait_queue(&dev_priv->buf_queue, &entry);
- set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- mga_dma_schedule(dev, 0);
- if(dev_priv->tail->age < dev_priv->last_prim_age)
- break;
- atomic_inc(&dev->total_sleeps);
- schedule();
- if (signal_pending(current)) {
- ++return_null;
- break;
- }
- }
- clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status);
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev_priv->buf_queue, &entry);
- if (return_null) return NULL;
- }
+ drm_mga_primary_buffer_t *primary = &dev_priv->prim;
+ u32 head, tail;
+ DMA_LOCALS;
+ DRM_DEBUG( "%s:\n", __FUNCTION__ );
- if(dev_priv->tail->age < dev_priv->last_prim_age) {
- prev = dev_priv->tail->prev;
- next = dev_priv->tail;
- prev->next = NULL;
- next->prev = next->next = NULL;
- dev_priv->tail = prev;
- next->age = MGA_BUF_USED;
- failed = 0;
- return next->buf;
+ if ( primary->tail == primary->last_flush ) {
+ DRM_DEBUG( " bailing out...\n" );
+ return;
}
- failed++;
- return NULL;
-}
+ tail = primary->tail + dev_priv->primary->offset;
-int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf)
-{
- drm_mga_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
- drm_mga_freelist_t *prev;
- drm_mga_freelist_t *head;
- drm_mga_freelist_t *next;
+ /* We need to pad the stream between flushes, as the card
+ * actually (partially?) reads the first of these commands.
+ * See page 4-16 in the G400 manual, middle of the page or so.
+ */
+ BEGIN_DMA( 1 );
- if(buf_priv->my_freelist->age == MGA_BUF_USED) {
- /* Discarded buffer, put it on the tail */
- next = buf_priv->my_freelist;
- next->age = MGA_BUF_FREE;
- prev = dev_priv->tail;
- prev->next = next;
- next->prev = prev;
- next->next = NULL;
- dev_priv->tail = next;
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
+
+ ADVANCE_DMA();
+
+ primary->last_flush = primary->tail;
+
+ head = MGA_READ( MGA_PRIMADDRESS );
+
+ if ( head <= tail ) {
+ primary->space = primary->size - primary->tail;
} else {
- /* Normally aged buffer, put it on the head + 1,
- * as the real head is a sentinal element
- */
- next = buf_priv->my_freelist;
- head = dev_priv->head;
- prev = head->next;
- head->next = next;
- prev->prev = next;
- next->prev = head;
- next->next = prev;
+ primary->space = head - tail;
}
- return 0;
+ DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset );
+ DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset );
+ DRM_DEBUG( " space = 0x%06x\n", primary->space );
+
+ mga_flush_write_combine();
+ MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER );
+
+ DRM_DEBUG( "%s: done.\n", __FUNCTION__ );
}
-static int mga_init_primary_bufs(drm_device_t *dev, drm_mga_init_t *init)
+void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv )
{
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_prim_buf_t *prim_buffer;
- int i, temp, size_of_buf;
- int offset = init->reserved_map_agpstart;
-
- dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) /
- PAGE_SIZE) * PAGE_SIZE;
- size_of_buf = dev_priv->primary_size / MGA_NUM_PRIM_BUFS;
- dev_priv->warp_ucode_size = init->warp_ucode_size;
- dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) *
- (MGA_NUM_PRIM_BUFS + 1),
- DRM_MEM_DRIVER);
- if(dev_priv->prim_bufs == NULL) {
- DRM_ERROR("Unable to allocate memory for prim_buf\n");
- return -ENOMEM;
- }
- memset(dev_priv->prim_bufs,
- 0, sizeof(drm_mga_prim_buf_t *) * (MGA_NUM_PRIM_BUFS + 1));
+ drm_mga_primary_buffer_t *primary = &dev_priv->prim;
+ u32 head, tail;
+ DMA_LOCALS;
+ DRM_DEBUG( "%s:\n", __FUNCTION__ );
- temp = init->warp_ucode_size + dev_priv->primary_size;
- temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
+ BEGIN_DMA_WRAP();
- dev_priv->ioremap = drm_ioremap(dev->agp->base + offset,
- temp);
- if(dev_priv->ioremap == NULL) {
- DRM_ERROR("Ioremap failed\n");
- return -ENOMEM;
- }
- init_waitqueue_head(&dev_priv->wait_queue);
-
- for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) {
- prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t),
- DRM_MEM_DRIVER);
- if(prim_buffer == NULL) return -ENOMEM;
- memset(prim_buffer, 0, sizeof(drm_mga_prim_buf_t));
- prim_buffer->phys_head = offset + dev->agp->base;
- prim_buffer->current_dma_ptr =
- prim_buffer->head =
- (u32 *) (dev_priv->ioremap +
- offset -
- init->reserved_map_agpstart);
- prim_buffer->num_dwords = 0;
- prim_buffer->max_dwords = size_of_buf / sizeof(u32);
- prim_buffer->max_dwords -= 5; /* Leave room for the softrap */
- prim_buffer->sec_used = 0;
- prim_buffer->idx = i;
- prim_buffer->prim_age = i + 1;
- offset = offset + size_of_buf;
- dev_priv->prim_bufs[i] = prim_buffer;
- }
- dev_priv->current_prim_idx = 0;
- dev_priv->next_prim =
- dev_priv->last_prim =
- dev_priv->current_prim =
- dev_priv->prim_bufs[0];
- dev_priv->next_prim_age = 2;
- dev_priv->last_prim_age = 1;
- set_bit(MGA_BUF_IN_USE, &dev_priv->current_prim->buffer_status);
- return 0;
-}
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DWGSYNC, 0x12345678 );
-void mga_fire_primary(drm_device_t *dev, drm_mga_prim_buf_t *prim)
-{
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- int use_agp = PDEA_pagpxfer_enable;
- unsigned long end;
- int i;
- int next_idx;
- PRIMLOCALS;
-
- dev_priv->last_prim = prim;
-
- /* We never check for overflow, b/c there is always room */
- PRIMPTR(prim);
- if(num_dwords <= 0) {
- DRM_ERROR("num_dwords == 0 when dispatched\n");
- goto out_prim_wait;
- }
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_DMAPAD, 0);
- PRIMOUTREG( MGAREG_SOFTRAP, 0);
- PRIMFINISH(prim);
-
- end = jiffies + (HZ*3);
- if(sarea_priv->dirty & MGA_DMA_FLUSH) {
- while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) {
- if((signed)(end - jiffies) <= 0) {
- DRM_ERROR("irqs: %d wanted %d\n",
- atomic_read(&dev->total_irq),
- atomic_read(&dma->total_lost));
- DRM_ERROR("lockup (flush)\n");
- goto out_prim_wait;
- }
-
- for (i = 0 ; i < 4096 ; i++) mga_delay();
- }
- sarea_priv->dirty &= ~(MGA_DMA_FLUSH);
- } else {
- while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) {
- if((signed)(end - jiffies) <= 0) {
- DRM_ERROR("irqs: %d wanted %d\n",
- atomic_read(&dev->total_irq),
- atomic_read(&dma->total_lost));
- DRM_ERROR("lockup (wait)\n");
- goto out_prim_wait;
- }
-
- for (i = 0 ; i < 4096 ; i++) mga_delay();
- }
- }
+ ADVANCE_DMA();
- mga_flush_write_combine();
- atomic_inc(&dev_priv->pending_bufs);
- MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL);
- MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
- prim->num_dwords = 0;
- sarea_priv->last_enqueue = prim->prim_age;
-
- next_idx = prim->idx + 1;
- if(next_idx >= MGA_NUM_PRIM_BUFS)
- next_idx = 0;
-
- dev_priv->next_prim = dev_priv->prim_bufs[next_idx];
- return;
-
- out_prim_wait:
- prim->num_dwords = 0;
- prim->sec_used = 0;
- clear_bit(MGA_BUF_IN_USE, &prim->buffer_status);
- wake_up_interruptible(&dev_priv->wait_queue);
- clear_bit(MGA_BUF_SWAP_PENDING, &prim->buffer_status);
- clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
-}
+ tail = primary->tail + dev_priv->primary->offset;
-int mga_advance_primary(drm_device_t *dev)
-{
- DECLARE_WAITQUEUE(entry, current);
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_prim_buf_t *prim_buffer;
- drm_device_dma_t *dma = dev->dma;
- int next_prim_idx;
- int ret = 0;
-
- /* This needs to reset the primary buffer if available,
- * we should collect stats on how many times it bites
- * it's tail */
-
- next_prim_idx = dev_priv->current_prim_idx + 1;
- if(next_prim_idx >= MGA_NUM_PRIM_BUFS)
- next_prim_idx = 0;
- prim_buffer = dev_priv->prim_bufs[next_prim_idx];
- set_bit(MGA_IN_WAIT, &dev_priv->dispatch_status);
-
- /* In use is cleared in interrupt handler */
-
- if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) {
- add_wait_queue(&dev_priv->wait_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- mga_dma_schedule(dev, 0);
- if(!test_and_set_bit(MGA_BUF_IN_USE,
- &prim_buffer->buffer_status))
- break;
- atomic_inc(&dev->total_sleeps);
- atomic_inc(&dma->total_missed_sched);
- schedule();
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev_priv->wait_queue, &entry);
- if(ret) return ret;
- }
- clear_bit(MGA_IN_WAIT, &dev_priv->dispatch_status);
-
- /* This primary buffer is now free to use */
- prim_buffer->current_dma_ptr = prim_buffer->head;
- prim_buffer->num_dwords = 0;
- prim_buffer->sec_used = 0;
- prim_buffer->prim_age = dev_priv->next_prim_age++;
- if(prim_buffer->prim_age == 0 || prim_buffer->prim_age == 0xffffffff) {
- mga_flush_queue(dev);
- mga_dma_quiescent(dev);
- mga_reset_freelist(dev);
- prim_buffer->prim_age = (dev_priv->next_prim_age += 2);
+ primary->tail = 0;
+ primary->last_flush = 0;
+ primary->last_wrap++;
+
+ head = MGA_READ( MGA_PRIMADDRESS );
+
+ if ( head == dev_priv->primary->offset ) {
+ primary->space = primary->size;
+ } else {
+ primary->space = head - dev_priv->primary->offset;
}
- /* Reset all buffer status stuff */
- clear_bit(MGA_BUF_NEEDS_OVERFLOW, &prim_buffer->buffer_status);
- clear_bit(MGA_BUF_FORCE_FIRE, &prim_buffer->buffer_status);
- clear_bit(MGA_BUF_SWAP_PENDING, &prim_buffer->buffer_status);
+ DRM_DEBUG( " head = 0x%06lx\n",
+ head - dev_priv->primary->offset );
+ DRM_DEBUG( " tail = 0x%06x\n", primary->tail );
+ DRM_DEBUG( " wrap = %d\n", primary->last_wrap );
+ DRM_DEBUG( " space = 0x%06x\n", primary->space );
+
+ mga_flush_write_combine();
+ MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER );
- dev_priv->current_prim = prim_buffer;
- dev_priv->current_prim_idx = next_prim_idx;
- return 0;
+ DRM_DEBUG( "%s: done.\n", __FUNCTION__ );
}
-/* More dynamic performance decisions */
-static inline int mga_decide_to_fire(drm_device_t *dev)
+void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv )
{
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ u32 head = dev_priv->primary->offset;
+ DRM_DEBUG( "%s:\n", __FUNCTION__ );
- if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) {
- return 1;
- }
+ sarea_priv->last_wrap++;
+ DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap );
- if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) &&
- dev_priv->next_prim->num_dwords) {
- return 1;
- }
+ mga_flush_write_combine();
+ MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL );
- if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) &&
- dev_priv->next_prim->num_dwords) {
- return 1;
- }
+ DRM_DEBUG( "%s: done.\n", __FUNCTION__ );
+}
- if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) {
- if(test_bit(MGA_BUF_SWAP_PENDING,
- &dev_priv->next_prim->buffer_status)) {
- return 1;
- }
- }
- if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) {
- if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) {
- return 1;
- }
- }
+/* ================================================================
+ * Freelist management
+ */
- if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) {
- if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) {
- return 1;
- }
- }
+#define MGA_BUFFER_USED ~0
+#define MGA_BUFFER_FREE 0
- return 0;
+static void mga_freelist_print( drm_device_t *dev )
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_freelist_t *entry;
+
+ DRM_INFO( "\n" );
+ DRM_INFO( "current dispatch: last=0x%x done=0x%x\n",
+ dev_priv->sarea_priv->last_dispatch,
+ (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) -
+ dev_priv->primary->offset) );
+ DRM_INFO( "current freelist:\n" );
+
+ for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) {
+ DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n",
+ entry, entry->buf->idx, entry->age.head,
+ entry->age.head - dev_priv->primary->offset );
+ }
+ DRM_INFO( "\n" );
}
-int mga_dma_schedule(drm_device_t *dev, int locked)
+static int mga_freelist_init( drm_device_t *dev )
{
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- int retval = 0;
-
- if (!dev_priv) return -EBUSY;
-
- if (test_and_set_bit(0, &dev->dma_flag)) {
- retval = -EBUSY;
- goto sch_out_wakeup;
- }
+ drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_buf_t *buf;
+ drm_mga_buf_priv_t *buf_priv;
+ drm_mga_freelist_t *entry;
+ int i;
+ DRM_DEBUG( "%s: count=%d\n",
+ __FUNCTION__, dma->buf_count );
- if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) ||
- test_bit(MGA_IN_WAIT, &dev_priv->dispatch_status) ||
- test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) {
- locked = 1;
- }
+ dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t),
+ DRM_MEM_DRIVER );
+ if ( dev_priv->head == NULL )
+ return -ENOMEM;
- if (!locked &&
- !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) {
- clear_bit(0, &dev->dma_flag);
- retval = -EBUSY;
- goto sch_out_wakeup;
- }
+ memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) );
+ SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 );
- if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) {
- /* Fire dma buffer */
- if(mga_decide_to_fire(dev)) {
- clear_bit(MGA_BUF_FORCE_FIRE,
- &dev_priv->next_prim->buffer_status);
- if(dev_priv->current_prim == dev_priv->next_prim) {
- /* Schedule overflow for a later time */
- set_bit(MGA_BUF_NEEDS_OVERFLOW,
- &dev_priv->next_prim->buffer_status);
- }
- mga_fire_primary(dev, dev_priv->next_prim);
- } else {
- clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
- }
- }
+ for ( i = 0 ; i < dma->buf_count ; i++ ) {
+ buf = dma->buflist[i];
+ buf_priv = buf->dev_private;
- if (!locked) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- DRM_ERROR("\n");
- }
- }
+ entry = DRM(alloc)( sizeof(drm_mga_freelist_t),
+ DRM_MEM_DRIVER );
+ if ( entry == NULL )
+ return -ENOMEM;
- clear_bit(0, &dev->dma_flag);
+ memset( entry, 0, sizeof(drm_mga_freelist_t) );
-sch_out_wakeup:
- if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) &&
- atomic_read(&dev_priv->pending_bufs) == 0) {
- /* Everything has been processed by the hardware */
- clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status);
- wake_up_interruptible(&dev_priv->flush_queue);
- }
+ entry->next = dev_priv->head->next;
+ entry->prev = dev_priv->head;
+ SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 );
+ entry->buf = buf;
+
+ if ( dev_priv->head->next != NULL )
+ dev_priv->head->next->prev = entry;
+ if ( entry->next == NULL )
+ dev_priv->tail = entry;
+
+ buf_priv->list_entry = entry;
+ buf_priv->discard = 0;
+ buf_priv->dispatched = 0;
- if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)
- && dev_priv->tail->age < dev_priv->last_prim_age)
- wake_up_interruptible(&dev_priv->buf_queue);
+ dev_priv->head->next = entry;
+ }
- return retval;
+ return 0;
}
-static void mga_dma_service(int irq, void *device, struct pt_regs *regs)
+static void mga_freelist_cleanup( drm_device_t *dev )
{
- drm_device_t *dev = (drm_device_t *)device;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- drm_mga_prim_buf_t *last_prim_buffer;
-
- atomic_inc(&dev->total_irq);
- if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return;
- MGA_WRITE(MGAREG_ICLEAR, 0x00000001);
- last_prim_buffer = dev_priv->last_prim;
- last_prim_buffer->num_dwords = 0;
- last_prim_buffer->sec_used = 0;
- dev_priv->sarea_priv->last_dispatch =
- dev_priv->last_prim_age = last_prim_buffer->prim_age;
- clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status);
- clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status);
- clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status);
- atomic_dec(&dev_priv->pending_bufs);
- queue_task(&dev->tq, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
- wake_up_interruptible(&dev_priv->wait_queue);
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_freelist_t *entry;
+ drm_mga_freelist_t *next;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ entry = dev_priv->head;
+ while ( entry ) {
+ next = entry->next;
+ DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER );
+ entry = next;
+ }
+
+ dev_priv->head = dev_priv->tail = NULL;
}
-static void mga_dma_task_queue(void *device)
+static void mga_freelist_reset( drm_device_t *dev )
{
- mga_dma_schedule((drm_device_t *)device, 0);
+ drm_device_dma_t *dma = dev->dma;
+ drm_buf_t *buf;
+ drm_mga_buf_priv_t *buf_priv;
+ int i;
+
+ for ( i = 0 ; i < dma->buf_count ; i++ ) {
+ buf = dma->buflist[i];
+ buf_priv = buf->dev_private;
+ SET_AGE( &buf_priv->list_entry->age,
+ MGA_BUFFER_FREE, 0 );
+ }
}
-int mga_dma_cleanup(drm_device_t *dev)
+static drm_buf_t *mga_freelist_get( drm_device_t *dev )
{
- if(dev->dev_private) {
- drm_mga_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_freelist_t *next;
+ drm_mga_freelist_t *prev;
+ drm_mga_freelist_t *tail = dev_priv->tail;
+ u32 head, wrap;
+ DRM_DEBUG( "%s:\n", __FUNCTION__ );
- if (dev->irq) mga_flush_queue(dev);
- mga_dma_quiescent(dev);
+ head = MGA_READ( MGA_PRIMADDRESS );
+ wrap = dev_priv->sarea_priv->last_wrap;
- if(dev_priv->ioremap) {
- int temp = (dev_priv->warp_ucode_size +
- dev_priv->primary_size +
- PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE;
+ DRM_DEBUG( " tail=0x%06lx %d\n",
+ tail->age.head ?
+ tail->age.head - dev_priv->primary->offset : 0,
+ tail->age.wrap );
+ DRM_DEBUG( " head=0x%06lx %d\n",
+ head - dev_priv->primary->offset, wrap );
- drm_ioremapfree((void *) dev_priv->ioremap, temp);
- }
- if(dev_priv->status_page != NULL) {
- iounmap(dev_priv->status_page);
- }
- if(dev_priv->real_status_page != 0UL) {
- mga_free_page(dev, dev_priv->real_status_page);
- }
- if(dev_priv->prim_bufs != NULL) {
- int i;
- for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) {
- if(dev_priv->prim_bufs[i] != NULL) {
- drm_free(dev_priv->prim_bufs[i],
- sizeof(drm_mga_prim_buf_t),
- DRM_MEM_DRIVER);
- }
- }
- drm_free(dev_priv->prim_bufs, sizeof(void *) *
- (MGA_NUM_PRIM_BUFS + 1),
- DRM_MEM_DRIVER);
- }
- if(dev_priv->head != NULL) {
- mga_freelist_cleanup(dev);
- }
+ if ( TEST_AGE( &tail->age, head, wrap ) ) {
+ prev = dev_priv->tail->prev;
+ next = dev_priv->tail;
+ prev->next = NULL;
+ next->prev = next->next = NULL;
+ dev_priv->tail = prev;
+ SET_AGE( &next->age, MGA_BUFFER_USED, 0 );
+ return next->buf;
+ }
+ DRM_DEBUG( "returning NULL!\n" );
+ return NULL;
+}
- drm_free(dev->dev_private, sizeof(drm_mga_private_t),
- DRM_MEM_DRIVER);
- dev->dev_private = NULL;
+int mga_freelist_put( 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;
+ drm_mga_freelist_t *head, *entry, *prev;
+
+ DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n",
+ __FUNCTION__,
+ buf_priv->list_entry->age.head -
+ dev_priv->primary->offset,
+ buf_priv->list_entry->age.wrap );
+
+ entry = buf_priv->list_entry;
+ head = dev_priv->head;
+
+ if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) {
+ SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 );
+ prev = dev_priv->tail;
+ prev->next = entry;
+ entry->prev = prev;
+ entry->next = NULL;
+ } else {
+ prev = head->next;
+ head->next = entry;
+ prev->prev = entry;
+ entry->prev = head;
+ entry->next = prev;
}
return 0;
}
-static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
- drm_mga_private_t *dev_priv;
- drm_map_t *sarea_map = NULL;
- dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
- if(dev_priv == NULL) return -ENOMEM;
- dev->dev_private = (void *) dev_priv;
+/* ================================================================
+ * DMA initialization, cleanup
+ */
- memset(dev_priv, 0, sizeof(drm_mga_private_t));
+static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
+{
+ drm_mga_private_t *dev_priv;
+ struct list_head *list;
+ int ret;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
- if((init->reserved_map_idx >= dev->map_count) ||
- (init->buffer_map_idx >= dev->map_count)) {
- mga_dma_cleanup(dev);
- return -EINVAL;
- }
+ dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER );
+ if ( !dev_priv )
+ return -ENOMEM;
+ dev->dev_private = (void *)dev_priv;
- 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);
+ memset( dev_priv, 0, sizeof(drm_mga_private_t) );
- /* Scale primary size to the next page */
dev_priv->chipset = init->chipset;
- dev_priv->frontOffset = init->frontOffset;
- 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->mAccess = init->mAccess;
- init_waitqueue_head(&dev_priv->flush_queue);
- init_waitqueue_head(&dev_priv->buf_queue);
- dev_priv->WarpPipe = 0xff000000;
- dev_priv->vertexsize = 0;
-
- DRM_DEBUG("chipset=%d ucode_size=%d backOffset=%x depthOffset=%x\n",
- dev_priv->chipset, dev_priv->warp_ucode_size,
- dev_priv->backOffset, dev_priv->depthOffset);
- DRM_DEBUG("cpp: %d sgram: %d stride: %d maccess: %x\n",
- dev_priv->cpp, dev_priv->sgram, dev_priv->stride,
- dev_priv->mAccess);
-
- memcpy(&dev_priv->WarpIndex, &init->WarpIndex,
- sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES);
-
- if(mga_init_primary_bufs(dev, init) != 0) {
- DRM_ERROR("Can not initialize primary buffers\n");
- mga_dma_cleanup(dev);
- return -ENOMEM;
+
+ dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
+
+ if ( init->sgram ) {
+ dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK;
+ } else {
+ dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR;
+ }
+ dev_priv->maccess = init->maccess;
+
+ dev_priv->fb_cpp = init->fb_cpp;
+ dev_priv->front_offset = init->front_offset;
+ dev_priv->front_pitch = init->front_pitch;
+ dev_priv->back_offset = init->back_offset;
+ dev_priv->back_pitch = init->back_pitch;
+
+ dev_priv->depth_cpp = init->depth_cpp;
+ dev_priv->depth_offset = init->depth_offset;
+ dev_priv->depth_pitch = init->depth_pitch;
+
+ list_for_each( list, &dev->maplist->head ) {
+ drm_map_list_t *entry = (drm_map_list_t *)list;
+ if ( entry->map &&
+ entry->map->type == _DRM_SHM &&
+ (entry->map->flags & _DRM_CONTAINS_LOCK) ) {
+ dev_priv->sarea = entry->map;
+ break;
+ }
+ }
+
+ DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
+ DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
+ DRM_FIND_MAP( dev_priv->status, init->status_offset );
+
+ DRM_FIND_MAP( dev_priv->warp, init->warp_offset );
+ DRM_FIND_MAP( dev_priv->primary, init->primary_offset );
+ DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
+
+ dev_priv->sarea_priv =
+ (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle +
+ init->sarea_priv_offset);
+
+ DRM_IOREMAP( dev_priv->warp );
+ DRM_IOREMAP( dev_priv->primary );
+ DRM_IOREMAP( dev_priv->buffers );
+
+ ret = mga_warp_install_microcode( dev );
+ if ( ret < 0 ) {
+ DRM_ERROR( "failed to install WARP ucode!\n" );
+ mga_do_cleanup_dma( dev );
+ return ret;
}
- dev_priv->real_status_page = mga_alloc_page(dev);
- if(dev_priv->real_status_page == 0UL) {
- mga_dma_cleanup(dev);
- DRM_ERROR("Can not allocate status page\n");
- return -ENOMEM;
+
+ ret = mga_warp_init( dev );
+ if ( ret < 0 ) {
+ DRM_ERROR( "failed to init WARP engine!\n" );
+ mga_do_cleanup_dma( dev );
+ return ret;
}
- dev_priv->status_page =
- ioremap_nocache(virt_to_bus((void *)dev_priv->real_status_page),
- PAGE_SIZE);
+ dev_priv->prim.status = (u32 *)dev_priv->status->handle;
- if(dev_priv->status_page == NULL) {
- mga_dma_cleanup(dev);
- DRM_ERROR("Can not remap status page\n");
- return -ENOMEM;
- }
+ mga_do_wait_for_idle( dev_priv );
+
+ /* Init the primary DMA registers.
+ */
+ MGA_WRITE( MGA_PRIMADDRESS,
+ dev_priv->primary->offset | MGA_DMA_GENERAL );
+#if 0
+ MGA_WRITE( MGA_PRIMPTR,
+ virt_to_bus((void *)dev_priv->prim.status) |
+ MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */
+ MGA_PRIMPTREN1 ); /* DWGSYNC */
+#endif
+
+ dev_priv->prim.start = (u8 *)dev_priv->primary->handle;
+ dev_priv->prim.end = ((u8 *)dev_priv->primary->handle
+ + dev_priv->primary->size);
+ dev_priv->prim.size = dev_priv->primary->size;
- /* Write status page when secend or softrap occurs */
- MGA_WRITE(MGAREG_PRIMPTR,
- virt_to_bus((void *)dev_priv->real_status_page) | 0x00000003);
+ dev_priv->prim.tail = 0;
+ dev_priv->prim.space = dev_priv->prim.size;
+ dev_priv->prim.last_flush = 0;
+ dev_priv->prim.last_wrap = 0;
- /* Private is now filled in, initialize the hardware */
- {
- PRIMLOCALS;
- PRIMGETPTR( dev_priv );
+ dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE;
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x0100);
- PRIMOUTREG(MGAREG_SOFTRAP, 0);
- /* Poll for the first buffer to insure that
- * the status register will be correct
- */
+ spin_lock_init( &dev_priv->prim.list_lock );
- mga_flush_write_combine();
- MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL);
+ dev_priv->prim.status[0] = dev_priv->primary->offset;
+ dev_priv->prim.status[1] = 0;
- MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) |
- PDEA_pagpxfer_enable));
+ dev_priv->sarea_priv->last_wrap = 0;
+ dev_priv->sarea_priv->last_frame.head = 0;
+ dev_priv->sarea_priv->last_frame.wrap = 0;
- while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ;
+ if ( mga_freelist_init( dev ) < 0 ) {
+ DRM_ERROR( "could not initialize freelist\n" );
+ mga_do_cleanup_dma( dev );
+ return -ENOMEM;
}
- if(mga_freelist_init(dev) != 0) {
- DRM_ERROR("Could not initialize freelist\n");
- mga_dma_cleanup(dev);
- return -ENOMEM;
+ return 0;
+}
+
+int mga_do_cleanup_dma( drm_device_t *dev )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ if ( dev->dev_private ) {
+ drm_mga_private_t *dev_priv = dev->dev_private;
+
+ DRM_IOREMAPFREE( dev_priv->warp );
+ DRM_IOREMAPFREE( dev_priv->primary );
+ DRM_IOREMAPFREE( dev_priv->buffers );
+
+ if ( dev_priv->head != NULL ) {
+ mga_freelist_cleanup( dev );
+ }
+
+ DRM(free)( dev->dev_private, sizeof(drm_mga_private_t),
+ DRM_MEM_DRIVER );
+ dev->dev_private = NULL;
}
+
return 0;
}
-int mga_dma_init(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+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;
- if (copy_from_user(&init, (drm_mga_init_t *)arg, sizeof(init)))
+ if ( copy_from_user( &init, (drm_mga_init_t *)arg, sizeof(init) ) )
return -EFAULT;
- switch(init.func) {
+ switch ( init.func ) {
case MGA_INIT_DMA:
- return mga_dma_initialize(dev, &init);
+ return mga_do_init_dma( dev, &init );
case MGA_CLEANUP_DMA:
- return mga_dma_cleanup(dev);
+ return mga_do_cleanup_dma( dev );
}
return -EINVAL;
}
-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);
-
- DRM_DEBUG("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;
- INIT_LIST_HEAD(&dev->tq.list);
- dev->tq.sync = 0;
- dev->tq.routine = mga_dma_task_queue;
- dev->tq.data = dev;
-
- /* Before installing handler */
- MGA_WRITE(MGAREG_IEN, 0);
- /* Install handler */
- if ((retcode = request_irq(dev->irq,
- mga_dma_service,
- SA_SHIRQ,
- dev->devname,
- dev))) {
- down(&dev->struct_sem);
- dev->irq = 0;
- up(&dev->struct_sem);
- return retcode;
- }
- /* After installing handler */
- MGA_WRITE(MGAREG_ICLEAR, 0x00000001);
- MGA_WRITE(MGAREG_IEN, 0x00000001);
- return 0;
-}
+/* ================================================================
+ * Primary DMA stream management
+ */
-int mga_irq_uninstall(drm_device_t *dev)
+int mga_dma_flush( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
{
- int irq;
-
- down(&dev->struct_sem);
- irq = dev->irq;
- dev->irq = 0;
- up(&dev->struct_sem);
-
- if (!irq) return -EINVAL;
- DRM_DEBUG("remove irq handler %d\n", irq);
- MGA_WRITE(MGAREG_ICLEAR, 0x00000001);
- MGA_WRITE(MGAREG_IEN, 0);
- free_irq(irq, dev);
- return 0;
-}
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_lock_t lock;
-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;
+ LOCK_TEST_WITH_RETURN( dev );
- if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl)))
+ if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
return -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;
- }
-}
+ DRM_DEBUG( "%s: %s%s%s\n",
+ __FUNCTION__,
+ (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "",
+ (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "",
+ (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" );
-static int mga_flush_queue(drm_device_t *dev)
-{
- DECLARE_WAITQUEUE(entry, current);
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
- int ret = 0;
-
- if(!dev_priv) return 0;
-
- if(dev_priv->next_prim->num_dwords != 0) {
- add_wait_queue(&dev_priv->flush_queue, &entry);
- if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status))
- DRM_ERROR("Incorrect mga_flush_queue logic\n");
- set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status);
- mga_dma_schedule(dev, 0);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- if (!test_bit(MGA_IN_FLUSH,
- &dev_priv->dispatch_status))
- break;
- atomic_inc(&dev->total_sleeps);
- schedule();
- if (signal_pending(current)) {
- ret = -EINTR; /* Can't restart */
- clear_bit(MGA_IN_FLUSH,
- &dev_priv->dispatch_status);
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev_priv->flush_queue, &entry);
+ WRAP_TEST_WITH_RETURN( dev_priv );
+
+#if 0
+ if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) {
+ mga_do_dma_flush( dev_priv );
+ }
+#endif
+ if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
+ return mga_do_wait_for_idle( dev_priv );
+ } else {
+ return 0;
}
- return ret;
}
-/* Must be called with the lock held */
-void mga_reclaim_buffers(drm_device_t *dev, pid_t pid)
+int mga_dma_reset( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
{
- drm_device_dma_t *dma = dev->dma;
- int i;
-
- if (!dma) return;
- if(dev->dev_private == NULL) return;
- if(dma->buflist == NULL) return;
-
- DRM_DEBUG("buf_count=%d\n", dma->buf_count);
-
- mga_flush_queue(dev);
-
- for (i = 0; i < dma->buf_count; i++) {
- drm_buf_t *buf = dma->buflist[ i ];
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
-
- /* Only buffers that need to get reclaimed ever
- * get set to free
- */
- if (buf->pid == pid && buf_priv) {
- if(buf_priv->my_freelist->age == MGA_BUF_USED)
- buf_priv->my_freelist->age = MGA_BUF_FREE;
- }
- }
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+
+ LOCK_TEST_WITH_RETURN( dev );
+
+ return mga_do_dma_reset( dev_priv );
}
-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;
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -EFAULT;
+/* ================================================================
+ * DMA buffer management
+ */
- if (lock.context == DRM_KERNEL_CONTEXT) {
- DRM_ERROR("Process %d using kernel context %d\n",
- current->pid, lock.context);
- return -EINVAL;
- }
+static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d )
+{
+ drm_buf_t *buf;
+ int i;
- if (lock.context < 0) return -EINVAL;
+ for ( i = d->granted_count ; i < d->request_count ; i++ ) {
+ buf = mga_freelist_get( dev );
+ if ( !buf ) return -EAGAIN;
- /* Only one queue:
- */
+ buf->pid = current->pid;
- if (!ret) {
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
- schedule();
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- }
+ if ( copy_to_user( &d->request_indices[i],
+ &buf->idx, sizeof(buf->idx) ) )
+ return -EFAULT;
+ if ( copy_to_user( &d->request_sizes[i],
+ &buf->total, sizeof(buf->total) ) )
+ return -EFAULT;
- if (!ret) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
-
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- DRM_DEBUG("_DRM_LOCK_QUIESCENT\n");
- mga_flush_queue(dev);
- mga_dma_quiescent(dev);
- }
+ d->granted_count++;
}
-
- if (ret) DRM_DEBUG("%d %s\n", lock.context,
- ret ? "interrupted" : "has lock");
- return ret;
+ return 0;
}
-int mga_flush_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+int mga_dma_buffers( 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;
- drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_device_dma_t *dma = dev->dma;
+ drm_dma_t d;
+ int ret = 0;
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
+ LOCK_TEST_WITH_RETURN( dev );
+
+ if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) )
return -EFAULT;
- if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("lock not held\n");
+ /* Please don't send us buffers.
+ */
+ if ( d.send_count != 0 ) {
+ DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n",
+ current->pid, d.send_count );
return -EINVAL;
}
- if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) {
- drm_mga_prim_buf_t *temp_buf;
+ /* We'll send you buffers.
+ */
+ 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;
+ }
- temp_buf = dev_priv->current_prim;
+ d.granted_count = 0;
- if(temp_buf && temp_buf->num_dwords) {
- set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status);
- mga_advance_primary(dev);
- }
- mga_dma_schedule(dev, 1);
- }
- if(lock.flags & _DRM_LOCK_QUIESCENT) {
- mga_flush_queue(dev);
- mga_dma_quiescent(dev);
+ if ( d.request_count ) {
+ ret = mga_dma_get_buffers( dev, &d );
}
- return 0;
+ if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) )
+ return -EFAULT;
+
+ return ret;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h
index 538133937..066b4e480 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h
@@ -11,197 +11,178 @@
* 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
- * Authors: Jeff Hartmann <jhartmann@valinux.com>
- * Keith Whitwell <keithw@valinux.com>
+ * Authors:
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
+ * Rewritten by:
+ * Gareth Hughes <gareth@valinux.com>
*/
-#ifndef _MGA_DRM_H_
-#define _MGA_DRM_H_
+#ifndef __MGA_DRM_H__
+#define __MGA_DRM_H__
/* WARNING: If you change any of these defines, make sure to change the
- * defines in the Xserver file (xf86drmMga.h)
- */
-#ifndef _MGA_DEFINES_
-#define _MGA_DEFINES_
-
-#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
-
-#define MGA_FRONT 0x1
-#define MGA_BACK 0x2
-#define MGA_DEPTH 0x4
-
-/* 3d state excluding texture units:
- */
-#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_CTXREG_FCOL 9
-#define MGA_CTXREG_STENCIL 10
-#define MGA_CTXREG_STENCILCTL 11
-#define MGA_CTX_SETUP_SIZE 12
-
-/* 2d state
+ * defines in the Xserver file (mga_sarea.h)
*/
-#define MGA_2DREG_PITCH 0
-#define MGA_2D_SETUP_SIZE 1
+#ifndef __MGA_SAREA_DEFINES__
+#define __MGA_SAREA_DEFINES__
-/* Each texture unit has a state:
+/* WARP pipe flags
*/
-#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
+#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_G200_PIPES 8 /* no multitex */
+#define MGA_MAX_G400_PIPES 16
+#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
+#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */
+
+#define MGA_CARD_TYPE_G200 1
+#define MGA_CARD_TYPE_G400 2
+
+
+#define MGA_FRONT 0x1
+#define MGA_BACK 0x2
+#define MGA_DEPTH 0x4
/* What needs to be changed for the current vertex dma buffer?
*/
-#define MGA_UPLOAD_CTX 0x1
-#define MGA_UPLOAD_TEX0 0x2
-#define MGA_UPLOAD_TEX1 0x4
-#define MGA_UPLOAD_PIPE 0x8
-#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */
-#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */
-#define MGA_UPLOAD_2D 0x40
-#define MGA_WAIT_AGE 0x80 /* handled client-side */
-#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
-#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
- quiescent */
+#define MGA_UPLOAD_CONTEXT 0x1
+#define MGA_UPLOAD_TEX0 0x2
+#define MGA_UPLOAD_TEX1 0x4
+#define MGA_UPLOAD_PIPE 0x8
+#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */
+#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */
+#define MGA_UPLOAD_2D 0x40
+#define MGA_WAIT_AGE 0x80 /* handled client-side */
+#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
+#if 0
+#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
+ quiescent */
+#endif
/* 32 buffers of 64k each, total 2 meg.
*/
-#define MGA_DMA_BUF_ORDER 16
-#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER)
-#define MGA_DMA_BUF_NR 31
+#define MGA_BUFFER_SIZE (1 << 16)
+#define MGA_NUM_BUFFERS 128
/* Keep these small for testing.
*/
-#define MGA_NR_SAREA_CLIPRECTS 8
+#define MGA_NR_SAREA_CLIPRECTS 8
/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
- * regions, subject to a minimum region size of (1<<16) == 64k.
+ * regions, subject to a minimum region size of (1<<16) == 64k.
*
* Clients may subdivide regions internally, but when sharing between
- * clients, the region size is the minimum granularity.
+ * clients, the region size is the minimum granularity.
*/
-#define MGA_CARD_HEAP 0
-#define MGA_AGP_HEAP 1
-#define MGA_NR_TEX_HEAPS 2
-#define MGA_NR_TEX_REGIONS 16
-#define MGA_LOG_MIN_TEX_REGION_SIZE 16
-#endif
+#define MGA_CARD_HEAP 0
+#define MGA_AGP_HEAP 1
+#define MGA_NR_TEX_HEAPS 2
+#define MGA_NR_TEX_REGIONS 16
+#define MGA_LOG_MIN_TEX_REGION_SIZE 16
-typedef struct _drm_mga_warp_index {
- int installed;
- unsigned long phys_addr;
- int size;
-} drm_mga_warp_index_t;
+#endif /* __MGA_SAREA_DEFINES__ */
-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;
- unsigned int frontOffset;
- unsigned int backOffset;
- unsigned int depthOffset;
- unsigned int textureOffset;
- unsigned int textureSize;
- unsigned int agpTextureOffset;
- unsigned int agpTextureSize;
- unsigned int cpp;
- unsigned int stride;
- int sgram;
- int chipset;
- drm_mga_warp_index_t WarpIndex[MGA_MAX_WARP_PIPES];
- unsigned int mAccess;
-} drm_mga_init_t;
-/* Warning: if you change the sarea structure, you must change the Xserver
- * structures as well */
+/* Setup registers for 3D context
+ */
+typedef struct {
+ unsigned int dstorg;
+ unsigned int maccess;
+ unsigned int plnwt;
+ unsigned int dwgctl;
+ unsigned int alphactrl;
+ unsigned int fogcolor;
+ unsigned int wflag;
+ unsigned int tdualstage0;
+ unsigned int tdualstage1;
+ unsigned int fcol;
+ unsigned int stencil;
+ unsigned int stencilctl;
+} drm_mga_context_regs_t;
+
+/* Setup registers for 2D, X server
+ */
+typedef struct {
+ unsigned int pitch;
+} drm_mga_server_regs_t;
-typedef struct _drm_mga_tex_region {
- unsigned char next, prev;
- unsigned char in_use;
- unsigned int age;
-} drm_mga_tex_region_t;
+/* Setup registers for each texture unit
+ */
+typedef struct {
+ unsigned int texctl;
+ unsigned int texctl2;
+ unsigned int texfilter;
+ unsigned int texbordercol;
+ unsigned int texorg;
+ unsigned int texwidth;
+ unsigned int texheight;
+ unsigned int texorg1;
+ unsigned int texorg2;
+ unsigned int texorg3;
+ unsigned int texorg4;
+} drm_mga_texture_regs_t;
+
+/* General aging mechanism
+ */
+typedef struct {
+ unsigned int head; /* Position of head pointer */
+ unsigned int wrap; /* Primary DMA wrap count */
+} drm_mga_age_t;
typedef struct _drm_mga_sarea {
/* The channel for communication of state information to the kernel
* on firing a vertex dma buffer.
*/
- 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;
+ drm_mga_context_regs_t context_state;
+ drm_mga_server_regs_t server_state;
+ drm_mga_texture_regs_t tex_state[2];
+ unsigned int warp_pipe;
unsigned int dirty;
+ unsigned int vertsize;
- unsigned int nbox;
+ /* The current cliprects, or a subset thereof.
+ */
drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS];
-
+ unsigned int nbox;
/* Information about the most recently used 3d drawable. The
- * client fills in the req_* fields, the server fills in the
+ * client fills in the req_* fields, the server fills in the
* exported_ fields and puts the cliprects into boxes, above.
*
* The client clears the exported_drawable field before
@@ -210,71 +191,116 @@ typedef struct _drm_mga_sarea {
unsigned int req_drawable; /* the X drawable id */
unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */
- unsigned int exported_drawable;
- unsigned int exported_index;
- unsigned int exported_stamp;
- unsigned int exported_buffers;
+ unsigned int exported_drawable;
+ unsigned int exported_index;
+ unsigned int exported_stamp;
+ unsigned int exported_buffers;
unsigned int exported_nfront;
unsigned int exported_nback;
- int exported_back_x, exported_front_x, exported_w;
+ int exported_back_x, exported_front_x, exported_w;
int exported_back_y, exported_front_y, exported_h;
drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS];
-
+
/* Counters for aging textures and for client-side throttling.
*/
+ unsigned int status[4];
+ unsigned int last_wrap;
+
+ drm_mga_age_t last_frame;
unsigned int last_enqueue; /* last time a buffer was enqueued */
unsigned int last_dispatch; /* age of the most recently dispatched buffer */
unsigned int last_quiescent; /* */
-
- /* LRU lists for texture memory in agp space and on the card
+ /* LRU lists for texture memory in agp space and on the card.
*/
- drm_mga_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1];
+ drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1];
unsigned int texAge[MGA_NR_TEX_HEAPS];
-
+
/* Mechanism to validate card state.
*/
int ctxOwner;
- int vertexsize;
-} drm_mga_sarea_t;
+} drm_mga_sarea_t;
-/* Device specific ioctls:
+
+/* WARNING: If you change any of these defines, make sure to change the
+ * defines in the Xserver file (xf86drmMga.h)
*/
-typedef struct _drm_mga_clear {
+typedef struct _drm_mga_warp_index {
+ int installed;
+ unsigned long phys_addr;
+ int size;
+} drm_mga_warp_index_t;
+
+typedef struct drm_mga_init {
+ enum {
+ MGA_INIT_DMA = 0x01,
+ MGA_CLEANUP_DMA = 0x02
+ } func;
+
+ int sarea_priv_offset;
+
+ int chipset;
+ int sgram;
+
+ unsigned int maccess;
+
+ unsigned int fb_cpp;
+ unsigned int front_offset, front_pitch;
+ unsigned int back_offset, back_pitch;
+
+ unsigned int depth_cpp;
+ unsigned int depth_offset, depth_pitch;
+
+ unsigned int texture_offset[MGA_NR_TEX_HEAPS];
+ unsigned int texture_size[MGA_NR_TEX_HEAPS];
+
+ unsigned int fb_offset;
+ unsigned int mmio_offset;
+ unsigned int status_offset;
+ unsigned int warp_offset;
+ unsigned int primary_offset;
+ unsigned int buffers_offset;
+} drm_mga_init_t;
+
+typedef struct drm_mga_fullscreen {
+ enum {
+ MGA_INIT_FULLSCREEN = 0x01,
+ MGA_CLEANUP_FULLSCREEN = 0x02
+ } func;
+} drm_mga_fullscreen_t;
+
+typedef struct drm_mga_clear {
+ unsigned int flags;
unsigned int clear_color;
unsigned int clear_depth;
- unsigned int flags;
- unsigned int clear_depth_mask;
- unsigned int clear_color_mask;
+ unsigned int color_mask;
+ unsigned int depth_mask;
} drm_mga_clear_t;
-typedef struct _drm_mga_swap {
- int dummy;
-} drm_mga_swap_t;
-
-typedef struct _drm_mga_iload {
- int idx;
- int length;
- unsigned int destOrg;
-} drm_mga_iload_t;
-
-typedef struct _drm_mga_vertex {
- int idx; /* buffer to queue */
- int used; /* bytes in use */
- int discard; /* client finished with buffer? */
+typedef struct drm_mga_vertex {
+ int idx; /* buffer to queue */
+ int used; /* bytes in use */
+ int discard; /* client finished with buffer? */
} drm_mga_vertex_t;
-typedef struct _drm_mga_indices {
- int idx; /* buffer to queue */
- unsigned int start;
- unsigned int end;
- int discard; /* client finished with buffer? */
+typedef struct drm_mga_indices {
+ int idx; /* buffer to queue */
+ unsigned int start;
+ unsigned int end;
+ int discard; /* client finished with buffer? */
} drm_mga_indices_t;
+typedef struct drm_mga_iload {
+ int idx;
+ unsigned int dstorg;
+ unsigned int length;
+} drm_mga_iload_t;
+
typedef struct _drm_mga_blit {
unsigned int planemask;
- unsigned int source;
- unsigned int dest;
+ unsigned int srcorg;
+ unsigned int dstorg;
+ int src_pitch, dst_pitch;
int delta_sx, delta_sy;
int delta_dx, delta_dy;
int height, ydir; /* flip image vertically */
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
index d1c39e999..42794e829 100644
--- 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
@@ -1,4 +1,4 @@
-/* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*-
+/* 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.
@@ -19,648 +19,62 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- * Jeff Hartmann <jhartmann@valinux.com>
- *
+ * 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@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
#include <linux/config.h>
+#include "mga.h"
#include "drmP.h"
#include "mga_drv.h"
-#define MGA_NAME "mga"
-#define MGA_DESC "Matrox G200/G400"
-#define MGA_DATE "20000928"
-#define MGA_MAJOR 2
-#define MGA_MINOR 1
-#define MGA_PATCHLEVEL 1
-
-static drm_device_t mga_device;
-drm_ctx_t mga_res_ctx;
-
-static struct file_operations mga_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: mga_open,
- flush: drm_flush,
- release: mga_release,
- ioctl: mga_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-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_swap_bufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_clear_bufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_vertex, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_flush_ioctl, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_indices, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_blit, 1, 0 },
-};
-
-#define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls)
-
-#ifdef MODULE
-static char *mga = NULL;
-#endif
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("Matrox G200/G400");
-MODULE_PARM(mga, "s");
-
-#ifndef MODULE
-/* mga_options 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.
- */
-
-static int __init mga_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("mga=", mga_options);
-#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->dev_private) mga_dma_cleanup(dev);
- 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();
-
- 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). */
-
-static int __init 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
- 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_mem_init();
- drm_proc_init(dev);
- dev->agp = drm_agp_init();
- if(dev->agp == NULL) {
- DRM_INFO("The mga drm module requires the agpgart module"
- " to function correctly\nPlease load the agpgart"
- " module before you load the mga module\n");
- drm_proc_cleanup();
- misc_deregister(&mga_misc);
- mga_takedown(dev);
- return -ENOMEM;
- }
-#ifdef CONFIG_MTRR
- dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size * 1024 * 1024,
- MTRR_TYPE_WRCOMB,
- 1);
-#endif
- 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. */
-
-static void __exit 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);
-#ifdef CONFIG_MTRR
- if(dev->agp && dev->agp->agp_mtrr) {
- int retval;
- retval = mtrr_del(dev->agp->agp_mtrr,
- dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size * 1024*1024);
- DRM_DEBUG("mtrr_del = %d\n", retval);
- }
-#endif
-
- mga_takedown(dev);
- if (dev->agp) {
- drm_agp_uninit();
- drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-}
-
-module_init(mga_init);
-module_exit(mga_cleanup);
-
-
-int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -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);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -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))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
- DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
- current->pid, dev->device, dev->open_count);
-
- if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
- && dev->lock.pid == current->pid) {
- mga_reclaim_buffers(dev, priv->pid);
- DRM_INFO("Process %d dead (ctx %d, d_s = 0x%02lx)\n",
- current->pid,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock),
- dev->dev_private ?
- ((drm_mga_private_t *)dev->dev_private)
- ->dispatch_status
- : 0);
-
- if (dev->dev_private)
- ((drm_mga_private_t *)dev->dev_private)
- ->dispatch_status &= MGA_IN_DISPATCH;
-
- drm_lock_free(dev,
- &dev->lock.hw_lock->lock,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
- } else if (dev->lock.hw_lock) {
- /* The lock is required to reclaim buffers */
- DECLARE_WAITQUEUE(entry, current);
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- if (!dev->lock.hw_lock) {
- /* Device has been unregistered */
- retcode = -EINTR;
- break;
- }
- if (drm_lock_take(&dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- dev->lock.pid = priv->pid;
- dev->lock.lock_time = jiffies;
- atomic_inc(&dev->total_locks);
- break; /* Got lock */
- }
- /* Contention */
- atomic_inc(&dev->total_sleeps);
- schedule();
- if (signal_pending(current)) {
- retcode = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- if(!retcode) {
- mga_reclaim_buffers(dev, priv->pid);
- if (dev->dev_private)
- ((drm_mga_private_t *)dev->dev_private)
- ->dispatch_status &= MGA_IN_DISPATCH;
- drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT);
- }
- }
- drm_fasync(-1, filp, 0);
-
- down(&dev->struct_sem);
- if (priv->remove_auth_on_close == 1) {
- drm_file_t *temp = dev->file_first;
- while(temp) {
- temp->authenticated = 0;
- temp = temp->next;
- }
- }
- if (priv->prev) priv->prev->next = priv->next;
- else dev->file_first = priv->next;
- if (priv->next) priv->next->prev = priv->prev;
- else dev->file_last = priv->prev;
- up(&dev->struct_sem);
-
- drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return mga_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- 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;
-
- if (nr >= MGA_IOCTL_COUNT) {
- retcode = -EINVAL;
- } else {
- ioctl = &mga_ioctls[nr];
- func = ioctl->func;
-
- if (!func) {
- DRM_DEBUG("no function: pid = %d, cmd = 0x%02x,"
- " nr = 0x%02x, dev 0x%x, auth = %d\n",
- current->pid, cmd, nr, dev->device,
- priv->authenticated);
- 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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -EFAULT;
-
- if (lock.context == DRM_KERNEL_CONTEXT) {
- DRM_ERROR("Process %d using kernel context %d\n",
- current->pid, lock.context);
- return -EINVAL;
- }
-
- 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");
-
- unblock_all_signals();
- return 0;
-}
+#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
+
+#define DRIVER_NAME "mga"
+#define DRIVER_DESC "Matrox G200/G400"
+#define DRIVER_DATE "20010319"
+
+#define DRIVER_MAJOR 3
+#define DRIVER_MINOR 0
+#define DRIVER_PATCHLEVEL 1
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 },
+
+
+#define __HAVE_COUNTERS 3
+#define __HAVE_COUNTER6 _DRM_STAT_IRQ
+#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
+#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
+
+
+#include "drm_agpsupport.h"
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
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
index d7bf63263..bd33d9d1e 100644
--- 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
@@ -1,4 +1,4 @@
-/* mga_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*-
+/* 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.
@@ -19,182 +19,140 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- * Jeff Hartmann <jhartmann@valinux.com>
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
*/
-#ifndef _MGA_DRV_H_
-#define _MGA_DRV_H_
+#ifndef __MGA_DRV_H__
+#define __MGA_DRV_H__
-#define MGA_BUF_IN_USE 0
-#define MGA_BUF_SWAP_PENDING 1
-#define MGA_BUF_FORCE_FIRE 2
-#define MGA_BUF_NEEDS_OVERFLOW 3
+typedef struct drm_mga_primary_buffer {
+ u8 *start;
+ u8 *end;
+ int size;
-typedef struct {
- long buffer_status; /* long req'd for set_bit() --RR */
- int num_dwords;
- int max_dwords;
- u32 *current_dma_ptr;
- u32 *head;
- u32 phys_head;
- unsigned int prim_age;
- int sec_used;
- int idx;
-} drm_mga_prim_buf_t;
-
-typedef struct _drm_mga_freelist {
- __volatile__ unsigned int age;
+ u32 tail;
+ int space;
+
+ volatile u32 *status;
+
+ u32 last_flush;
+ u32 last_wrap;
+
+ u32 high_mark;
+
+ spinlock_t list_lock;
+} drm_mga_primary_buffer_t;
+
+typedef struct drm_mga_freelist {
+ struct drm_mga_freelist *next;
+ struct drm_mga_freelist *prev;
+ drm_mga_age_t age;
drm_buf_t *buf;
- struct _drm_mga_freelist *next;
- struct _drm_mga_freelist *prev;
} drm_mga_freelist_t;
-#define MGA_IN_DISPATCH 0
-#define MGA_IN_FLUSH 1
-#define MGA_IN_WAIT 2
-#define MGA_IN_GETBUF 3
-
-typedef struct _drm_mga_private {
- long dispatch_status; /* long req'd for set_bit() --RR */
- unsigned int next_prim_age;
- __volatile__ unsigned int last_prim_age;
- int reserved_map_idx;
- int buffer_map_idx;
- drm_mga_sarea_t *sarea_priv;
- int primary_size;
- int warp_ucode_size;
- int chipset;
- unsigned int frontOffset;
- unsigned int backOffset;
- unsigned int depthOffset;
- unsigned int textureOffset;
- unsigned int textureSize;
- int cpp;
- unsigned int stride;
- int sgram;
- int use_agp;
- drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES];
- unsigned int WarpPipe;
- unsigned int vertexsize;
- atomic_t pending_bufs;
- void *status_page;
- unsigned long real_status_page;
- u8 *ioremap;
- drm_mga_prim_buf_t **prim_bufs;
- drm_mga_prim_buf_t *next_prim;
- drm_mga_prim_buf_t *last_prim;
- drm_mga_prim_buf_t *current_prim;
- int current_prim_idx;
+typedef struct {
+ drm_mga_freelist_t *list_entry;
+ int discard;
+ int dispatched;
+} drm_mga_buf_priv_t;
+
+typedef struct drm_mga_private {
+ drm_mga_primary_buffer_t prim;
+ drm_mga_sarea_t *sarea_priv;
+
drm_mga_freelist_t *head;
drm_mga_freelist_t *tail;
- wait_queue_head_t flush_queue; /* Processes waiting until flush */
- wait_queue_head_t wait_queue; /* Processes waiting until interrupt */
- wait_queue_head_t buf_queue; /* Processes waiting for a free buf */
- /* Some validated register values:
- */
- u32 mAccess;
-} drm_mga_private_t;
- /* mga_drv.c */
-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);
+ unsigned int warp_pipe;
+ unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES];
+
+ int chipset;
+ int usec_timeout;
+
+ u32 clear_cmd;
+ u32 maccess;
+
+ unsigned int fb_cpp;
+ unsigned int front_offset;
+ unsigned int front_pitch;
+ unsigned int back_offset;
+ unsigned int back_pitch;
+
+ unsigned int depth_cpp;
+ unsigned int depth_offset;
+ unsigned int depth_pitch;
+
+ unsigned int texture_offset;
+ unsigned int texture_size;
+
+ drm_map_t *sarea;
+ drm_map_t *fb;
+ drm_map_t *mmio;
+ drm_map_t *status;
+ drm_map_t *warp;
+ drm_map_t *primary;
+ drm_map_t *buffers;
+ drm_map_t *agp_textures;
+} drm_mga_private_t;
/* 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);
-
-/* mga_dma_init does init and release */
-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);
-extern int mga_flush_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern unsigned int mga_create_sync_tag(drm_device_t *dev);
-extern drm_buf_t *mga_freelist_get(drm_device_t *dev);
-extern int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf);
-extern int mga_advance_primary(drm_device_t *dev);
-extern void mga_reclaim_buffers(drm_device_t *dev, pid_t pid);
-
-
- /* 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);
+extern int mga_dma_init( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_flush( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_reset( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_buffers( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+
+extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv );
+extern int mga_do_dma_idle( drm_mga_private_t *dev_priv );
+extern int mga_do_dma_reset( drm_mga_private_t *dev_priv );
+extern int mga_do_engine_reset( drm_mga_private_t *dev_priv );
+extern int mga_do_cleanup_dma( drm_device_t *dev );
+
+extern void mga_do_dma_flush( drm_mga_private_t *dev_priv );
+extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv );
+extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv );
+
+extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf );
+
+
/* 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);
-extern int mga_vertex(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int mga_indices(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int mga_blit(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);
+extern int mga_dma_clear( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_swap( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_vertex( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_indices( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_iload( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+extern int mga_dma_blit( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
+
+ /* mga_warp.c */
+extern int mga_warp_install_microcode( drm_device_t *dev );
+extern int mga_warp_init( drm_device_t *dev );
#define mga_flush_write_combine() mb()
-typedef enum {
- TT_GENERAL,
- TT_BLIT,
- TT_VECTOR,
- TT_VERTEX
-} transferType_t;
-typedef struct {
- drm_mga_freelist_t *my_freelist;
- int discard;
- int dispatched;
-} drm_mga_buf_priv_t;
+#define MGA_BASE( reg ) ((u32)(dev_priv->mmio->handle))
+#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg)
+
+#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg )
+#define MGA_READ( reg ) MGA_DEREF( reg )
+#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0)
+#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg )
+#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0)
#define DWGREG0 0x1c00
#define DWGREG0_END 0x1dff
@@ -202,328 +160,443 @@ typedef struct {
#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))
-
-#define MGA_VERBOSE 0
-#define MGA_NUM_PRIM_BUFS 8
-
-#define PRIMLOCALS u8 tempIndex[4]; u32 *dma_ptr; u32 phys_head; \
- int outcount, num_dwords
-
-#define PRIM_OVERFLOW(dev, dev_priv, length) do { \
- drm_mga_prim_buf_t *tmp_buf = \
- dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- if( test_bit(MGA_BUF_NEEDS_OVERFLOW, &tmp_buf->buffer_status)) { \
- mga_advance_primary(dev); \
- mga_dma_schedule(dev, 1); \
- tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length || \
- tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \
- set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \
- mga_advance_primary(dev); \
- mga_dma_schedule(dev, 1); \
- tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- } \
- if(MGA_VERBOSE) \
- DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \
- dma_ptr = tmp_buf->current_dma_ptr; \
- num_dwords = tmp_buf->num_dwords; \
- phys_head = tmp_buf->phys_head; \
- outcount = 0; \
-} while(0)
-
-#define PRIMGETPTR(dev_priv) do { \
- drm_mga_prim_buf_t *tmp_buf = \
- dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- if(MGA_VERBOSE) \
- DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \
- dma_ptr = tmp_buf->current_dma_ptr; \
- num_dwords = tmp_buf->num_dwords; \
- phys_head = tmp_buf->phys_head; \
- outcount = 0; \
-} while(0)
-
-#define PRIMPTR(prim_buf) do { \
- if(MGA_VERBOSE) \
- DRM_DEBUG("PRIMPTR in %s\n", __FUNCTION__); \
- dma_ptr = prim_buf->current_dma_ptr; \
- num_dwords = prim_buf->num_dwords; \
- phys_head = prim_buf->phys_head; \
- outcount = 0; \
-} while(0)
-
-#define PRIMFINISH(prim_buf) do { \
- if (MGA_VERBOSE) { \
- DRM_DEBUG( "PRIMFINISH in %s\n", __FUNCTION__); \
- if (outcount & 3) \
- DRM_DEBUG(" --- truncation\n"); \
- } \
- prim_buf->num_dwords = num_dwords; \
- prim_buf->current_dma_ptr = dma_ptr; \
-} while(0)
-
-#define PRIMADVANCE(dev_priv) do { \
-drm_mga_prim_buf_t *tmp_buf = \
- dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- if (MGA_VERBOSE) { \
- DRM_DEBUG("PRIMADVANCE in %s\n", __FUNCTION__); \
- if (outcount & 3) \
- DRM_DEBUG(" --- truncation\n"); \
- } \
- tmp_buf->num_dwords = num_dwords; \
- tmp_buf->current_dma_ptr = dma_ptr; \
+#define DMAREG0(r) (u8)((r - DWGREG0) >> 2)
+#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80)
+#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r))
+
+
+
+/* ================================================================
+ * Helper macross...
+ */
+
+#define MGA_EMIT_STATE( dev_priv, dirty ) \
+do { \
+ if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \
+ if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \
+ mga_g400_emit_state( dev_priv ); \
+ } else { \
+ mga_g200_emit_state( dev_priv ); \
+ } \
+ } \
+} while (0)
+
+#define LOCK_TEST_WITH_RETURN( dev ) \
+do { \
+ if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
+ dev->lock.pid != current->pid ) { \
+ DRM_ERROR( "%s called without lock held\n", \
+ __FUNCTION__ ); \
+ return -EINVAL; \
+ } \
+} while (0)
+
+#define WRAP_TEST_WITH_RETURN( dev_priv ) \
+do { \
+ if ( dev_priv->sarea_priv->last_wrap < \
+ dev_priv->prim.last_wrap ) { \
+ if ( mga_do_wait_for_idle( dev_priv ) < 0 ) \
+ return -EBUSY; \
+ mga_do_dma_wrap_end( dev_priv ); \
+ } \
+} while (0)
+
+
+/* ================================================================
+ * Primary DMA command stream
+ */
+
+#define MGA_VERBOSE 0
+
+#define DMA_LOCALS unsigned int write; volatile u8 *prim;
+
+#define DMA_BLOCK_SIZE (5 * sizeof(u32))
+
+#define BEGIN_DMA( n ) \
+do { \
+ if ( MGA_VERBOSE ) { \
+ DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \
+ (n), __FUNCTION__ ); \
+ DRM_INFO( " space=0x%x req=0x%x\n", \
+ dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \
+ } \
+ prim = dev_priv->prim.start; \
+ write = dev_priv->prim.tail; \
+} while (0)
+
+#define BEGIN_DMA_WRAP() \
+do { \
+ if ( MGA_VERBOSE ) { \
+ DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \
+ DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \
+ } \
+ prim = dev_priv->prim.start; \
+ write = dev_priv->prim.tail; \
+} while (0)
+
+#define ADVANCE_DMA() \
+do { \
+ dev_priv->prim.tail = write; \
+ if ( MGA_VERBOSE ) { \
+ DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \
+ write, dev_priv->prim.space ); \
+ } \
+} while (0)
+
+#define FLUSH_DMA() \
+do { \
+ if ( 0 ) { \
+ DRM_INFO( __FUNCTION__ ":\n" ); \
+ DRM_INFO( " tail=0x%06x head=0x%06lx\n", \
+ dev_priv->prim.tail, \
+ MGA_READ( MGA_PRIMADDRESS ) - \
+ dev_priv->primary->offset ); \
+ } \
+ if ( dev_priv->prim.space < dev_priv->prim.high_mark ) { \
+ mga_do_dma_wrap_start( dev_priv ); \
+ } else { \
+ mga_do_dma_flush( dev_priv ); \
+ } \
} while (0)
-#define PRIMUPDATE(dev_priv) do { \
- drm_mga_prim_buf_t *tmp_buf = \
- dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- tmp_buf->sec_used++; \
+/* Never use this, always use DMA_BLOCK(...) for primary DMA output.
+ */
+#define DMA_WRITE( offset, val ) \
+do { \
+ if ( MGA_VERBOSE ) { \
+ DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \
+ (u32)(val), write + (offset) * sizeof(u32) ); \
+ } \
+ *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \
} while (0)
-#define AGEBUF(dev_priv, buf_priv) do { \
- drm_mga_prim_buf_t *tmp_buf = \
- dev_priv->prim_bufs[dev_priv->current_prim_idx]; \
- buf_priv->my_freelist->age = tmp_buf->prim_age; \
+#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \
+do { \
+ DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \
+ (DMAREG( reg1 ) << 8) | \
+ (DMAREG( reg2 ) << 16) | \
+ (DMAREG( reg3 ) << 24)) ); \
+ DMA_WRITE( 1, val0 ); \
+ DMA_WRITE( 2, val1 ); \
+ DMA_WRITE( 3, val2 ); \
+ DMA_WRITE( 4, val3 ); \
+ write += DMA_BLOCK_SIZE; \
} while (0)
-#define PRIMOUTREG(reg, val) do { \
- tempIndex[outcount]=ADRINDEX(reg); \
- dma_ptr[1+outcount] = val; \
- if (MGA_VERBOSE) \
- DRM_DEBUG(" PRIMOUT %d: 0x%x -- 0x%x\n", \
- num_dwords + 1 + outcount, ADRINDEX(reg), val); \
- if( ++outcount == 4) { \
- outcount = 0; \
- dma_ptr[0] = *(unsigned long *)tempIndex; \
- dma_ptr+=5; \
- num_dwords += 5; \
+/* Buffer aging via primary DMA stream head pointer.
+ */
+
+#define SET_AGE( age, h, w ) \
+do { \
+ (age)->head = h; \
+ (age)->wrap = w; \
+} while (0)
+
+#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \
+ ( (age)->wrap == w && \
+ (age)->head < h ) )
+
+#define AGE_BUFFER( buf_priv ) \
+do { \
+ drm_mga_freelist_t *entry = (buf_priv)->list_entry; \
+ if ( (buf_priv)->dispatched ) { \
+ entry->age.head = (dev_priv->prim.tail + \
+ dev_priv->primary->offset); \
+ entry->age.wrap = dev_priv->sarea_priv->last_wrap; \
+ } else { \
+ entry->age.head = 0; \
+ entry->age.wrap = 0; \
} \
-}while (0)
+} while (0)
+
+
+#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \
+ MGA_DWGENGSTS | \
+ MGA_ENDPRDMASTS)
+#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \
+ MGA_ENDPRDMASTS)
+
+#define MGA_DMA_SOFTRAP_SIZE 32 * DMA_BLOCK_SIZE
+
+
/* A reduced set of the mga registers.
*/
+#define MGA_CRTC_INDEX 0x1fd4
+
+#define MGA_ALPHACTRL 0x2c7c
+#define MGA_AR0 0x1c60
+#define MGA_AR1 0x1c64
+#define MGA_AR2 0x1c68
+#define MGA_AR3 0x1c6c
+#define MGA_AR4 0x1c70
+#define MGA_AR5 0x1c74
+#define MGA_AR6 0x1c78
+
+#define MGA_CXBNDRY 0x1c80
+#define MGA_CXLEFT 0x1ca0
+#define MGA_CXRIGHT 0x1ca4
+
+#define MGA_DMAPAD 0x1c54
+#define MGA_DSTORG 0x2cb8
+#define MGA_DWGCTL 0x1c00
+# define MGA_OPCOD_MASK (15 << 0)
+# define MGA_OPCOD_TRAP (4 << 0)
+# define MGA_OPCOD_TEXTURE_TRAP (6 << 0)
+# define MGA_OPCOD_BITBLT (8 << 0)
+# define MGA_OPCOD_ILOAD (9 << 0)
+# define MGA_ATYPE_MASK (7 << 4)
+# define MGA_ATYPE_RPL (0 << 4)
+# define MGA_ATYPE_RSTR (1 << 4)
+# define MGA_ATYPE_ZI (3 << 4)
+# define MGA_ATYPE_BLK (4 << 4)
+# define MGA_ATYPE_I (7 << 4)
+# define MGA_LINEAR (1 << 7)
+# define MGA_ZMODE_MASK (7 << 8)
+# define MGA_ZMODE_NOZCMP (0 << 8)
+# define MGA_ZMODE_ZE (2 << 8)
+# define MGA_ZMODE_ZNE (3 << 8)
+# define MGA_ZMODE_ZLT (4 << 8)
+# define MGA_ZMODE_ZLTE (5 << 8)
+# define MGA_ZMODE_ZGT (6 << 8)
+# define MGA_ZMODE_ZGTE (7 << 8)
+# define MGA_SOLID (1 << 11)
+# define MGA_ARZERO (1 << 12)
+# define MGA_SGNZERO (1 << 13)
+# define MGA_SHIFTZERO (1 << 14)
+# define MGA_BOP_MASK (15 << 16)
+# define MGA_BOP_ZERO (0 << 16)
+# define MGA_BOP_DST (10 << 16)
+# define MGA_BOP_SRC (12 << 16)
+# define MGA_BOP_ONE (15 << 16)
+# define MGA_TRANS_SHIFT 20
+# define MGA_TRANS_MASK (15 << 20)
+# define MGA_BLTMOD_MASK (15 << 25)
+# define MGA_BLTMOD_BMONOLEF (0 << 25)
+# define MGA_BLTMOD_BMONOWF (4 << 25)
+# define MGA_BLTMOD_PLAN (1 << 25)
+# define MGA_BLTMOD_BFCOL (2 << 25)
+# define MGA_BLTMOD_BU32BGR (3 << 25)
+# define MGA_BLTMOD_BU32RGB (7 << 25)
+# define MGA_BLTMOD_BU24BGR (11 << 25)
+# define MGA_BLTMOD_BU24RGB (15 << 25)
+# define MGA_PATTERN (1 << 29)
+# define MGA_TRANSC (1 << 30)
+# define MGA_CLIPDIS (1 << 31)
+#define MGA_DWGSYNC 0x2c4c
+
+#define MGA_FCOL 0x1c24
+#define MGA_FIFOSTATUS 0x1e10
+#define MGA_FOGCOL 0x1cf4
+#define MGA_FXBNDRY 0x1c84
+#define MGA_FXLEFT 0x1ca8
+#define MGA_FXRIGHT 0x1cac
+
+#define MGA_ICLEAR 0x1e18
+# define MGA_SOFTRAPICLR (1 << 0)
+#define MGA_IEN 0x1e1c
+# define MGA_SOFTRAPIEN (1 << 0)
+
+#define MGA_LEN 0x1c5c
+
+#define MGA_MACCESS 0x1c04
+
+#define MGA_PITCH 0x1c8c
+#define MGA_PLNWT 0x1c1c
+#define MGA_PRIMADDRESS 0x1e58
+# define MGA_DMA_GENERAL (0 << 0)
+# define MGA_DMA_BLIT (1 << 0)
+# define MGA_DMA_VECTOR (2 << 0)
+# define MGA_DMA_VERTEX (3 << 0)
+#define MGA_PRIMEND 0x1e5c
+# define MGA_PRIMNOSTART (1 << 0)
+# define MGA_PAGPXFER (1 << 1)
+#define MGA_PRIMPTR 0x1e50
+# define MGA_PRIMPTREN0 (1 << 0)
+# define MGA_PRIMPTREN1 (1 << 1)
+
+#define MGA_RST 0x1e40
+# define MGA_SOFTRESET (1 << 0)
+# define MGA_SOFTEXTRST (1 << 1)
+
+#define MGA_SECADDRESS 0x2c40
+#define MGA_SECEND 0x2c44
+#define MGA_SETUPADDRESS 0x2cd0
+#define MGA_SETUPEND 0x2cd4
+#define MGA_SGN 0x1c58
+#define MGA_SOFTRAP 0x2c48
+#define MGA_SRCORG 0x2cb4
+# define MGA_SRMMAP_MASK (1 << 0)
+# define MGA_SRCMAP_FB (0 << 0)
+# define MGA_SRCMAP_SYSMEM (1 << 0)
+# define MGA_SRCACC_MASK (1 << 1)
+# define MGA_SRCACC_PCI (0 << 1)
+# define MGA_SRCACC_AGP (1 << 1)
+#define MGA_STATUS 0x1e14
+# define MGA_SOFTRAPEN (1 << 0)
+# define MGA_DWGENGSTS (1 << 16)
+# define MGA_ENDPRDMASTS (1 << 17)
+#define MGA_STENCIL 0x2cc8
+#define MGA_STENCILCTL 0x2ccc
+
+#define MGA_TDUALSTAGE0 0x2cf8
+#define MGA_TDUALSTAGE1 0x2cfc
+#define MGA_TEXBORDERCOL 0x2c5c
+#define MGA_TEXCTL 0x2c30
+#define MGA_TEXCTL2 0x2c3c
+# define MGA_DUALTEX (1 << 7)
+# define MGA_G400_TC2_MAGIC (1 << 15)
+# define MGA_MAP1_ENABLE (1 << 31)
+#define MGA_TEXFILTER 0x2c58
+#define MGA_TEXHEIGHT 0x2c2c
+#define MGA_TEXORG 0x2c24
+# define MGA_TEXORGMAP_MASK (1 << 0)
+# define MGA_TEXORGMAP_FB (0 << 0)
+# define MGA_TEXORGMAP_SYSMEM (1 << 0)
+# define MGA_TEXORGACC_MASK (1 << 1)
+# define MGA_TEXORGACC_PCI (0 << 1)
+# define MGA_TEXORGACC_AGP (1 << 1)
+#define MGA_TEXORG1 0x2ca4
+#define MGA_TEXORG2 0x2ca8
+#define MGA_TEXORG3 0x2cac
+#define MGA_TEXORG4 0x2cb0
+#define MGA_TEXTRANS 0x2c34
+#define MGA_TEXTRANSHIGH 0x2c38
+#define MGA_TEXWIDTH 0x2c28
+
+#define MGA_WACCEPTSEQ 0x1dd4
+#define MGA_WCODEADDR 0x1e6c
+#define MGA_WFLAG 0x1dc4
+#define MGA_WFLAG1 0x1de0
+#define MGA_WFLAGNB 0x1e64
+#define MGA_WFLAGNB1 0x1e08
+#define MGA_WGETMSB 0x1dc8
+#define MGA_WIADDR 0x1dc0
+#define MGA_WIADDR2 0x1dd8
+# define MGA_WMODE_SUSPEND (0 << 0)
+# define MGA_WMODE_RESUME (1 << 0)
+# define MGA_WMODE_JUMP (2 << 0)
+# define MGA_WMODE_START (3 << 0)
+# define MGA_WAGP_ENABLE (1 << 2)
+#define MGA_WMISC 0x1e70
+# define MGA_WUCODECACHE_ENABLE (1 << 0)
+# define MGA_WMASTER_ENABLE (1 << 1)
+# define MGA_WCACHEFLUSH_ENABLE (1 << 3)
+#define MGA_WVRTXSZ 0x1dcc
+
+#define MGA_YBOT 0x1c9c
+#define MGA_YDST 0x1c90
+#define MGA_YDSTLEN 0x1c88
+#define MGA_YDSTORG 0x1c94
+#define MGA_YTOP 0x1c98
+
+#define MGA_ZORG 0x1c0c
+
+/* This finishes the current batch of commands
+ */
+#define MGA_EXEC 0x0100
-#define MGAREG_MGA_EXEC 0x0100
-#define MGAREG_ALPHACTRL 0x2c7c
-#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_CXBNDRY 0x1c80
-#define MGAREG_CXLEFT 0x1ca0
-#define MGAREG_CXRIGHT 0x1ca4
-#define MGAREG_DMAPAD 0x1c54
-#define MGAREG_DSTORG 0x2cb8
-#define MGAREG_DWGCTL 0x1c00
-#define MGAREG_DWGSYNC 0x2c4c
-#define MGAREG_FCOL 0x1c24
-#define MGAREG_FIFOSTATUS 0x1e10
-#define MGAREG_FOGCOL 0x1cf4
-#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_PITCH 0x1c8c
-#define MGAREG_PLNWT 0x1c1c
-#define MGAREG_PRIMADDRESS 0x1e58
-#define MGAREG_PRIMEND 0x1e5c
-#define MGAREG_PRIMPTR 0x1e50
-#define MGAREG_SECADDRESS 0x2c40
-#define MGAREG_SECEND 0x2c44
-#define MGAREG_SETUPADDRESS 0x2cd0
-#define MGAREG_SETUPEND 0x2cd4
-#define MGAREG_SGN 0x1c58
-#define MGAREG_SOFTRAP 0x2c48
-#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_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_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_WMISC 0x1e70
-#define MGAREG_WVRTXSZ 0x1dcc
-#define MGAREG_YBOT 0x1c9c
-#define MGAREG_YDST 0x1c90
-#define MGAREG_YDSTLEN 0x1c88
-#define MGAREG_YDSTORG 0x1c94
-#define MGAREG_YTOP 0x1c98
-#define MGAREG_ZORG 0x1c0c
-
-/* Warp registers */
-#define MGAREG_WR0 0x2d00
-#define MGAREG_WR1 0x2d04
-#define MGAREG_WR2 0x2d08
-#define MGAREG_WR3 0x2d0c
-#define MGAREG_WR4 0x2d10
-#define MGAREG_WR5 0x2d14
-#define MGAREG_WR6 0x2d18
-#define MGAREG_WR7 0x2d1c
-#define MGAREG_WR8 0x2d20
-#define MGAREG_WR9 0x2d24
-#define MGAREG_WR10 0x2d28
-#define MGAREG_WR11 0x2d2c
-#define MGAREG_WR12 0x2d30
-#define MGAREG_WR13 0x2d34
-#define MGAREG_WR14 0x2d38
-#define MGAREG_WR15 0x2d3c
-#define MGAREG_WR16 0x2d40
-#define MGAREG_WR17 0x2d44
-#define MGAREG_WR18 0x2d48
-#define MGAREG_WR19 0x2d4c
-#define MGAREG_WR20 0x2d50
-#define MGAREG_WR21 0x2d54
-#define MGAREG_WR22 0x2d58
-#define MGAREG_WR23 0x2d5c
-#define MGAREG_WR24 0x2d60
-#define MGAREG_WR25 0x2d64
-#define MGAREG_WR26 0x2d68
-#define MGAREG_WR27 0x2d6c
-#define MGAREG_WR28 0x2d70
-#define MGAREG_WR29 0x2d74
-#define MGAREG_WR30 0x2d78
-#define MGAREG_WR31 0x2d7c
-#define MGAREG_WR32 0x2d80
-#define MGAREG_WR33 0x2d84
-#define MGAREG_WR34 0x2d88
-#define MGAREG_WR35 0x2d8c
-#define MGAREG_WR36 0x2d90
-#define MGAREG_WR37 0x2d94
-#define MGAREG_WR38 0x2d98
-#define MGAREG_WR39 0x2d9c
-#define MGAREG_WR40 0x2da0
-#define MGAREG_WR41 0x2da4
-#define MGAREG_WR42 0x2da8
-#define MGAREG_WR43 0x2dac
-#define MGAREG_WR44 0x2db0
-#define MGAREG_WR45 0x2db4
-#define MGAREG_WR46 0x2db8
-#define MGAREG_WR47 0x2dbc
-#define MGAREG_WR48 0x2dc0
-#define MGAREG_WR49 0x2dc4
-#define MGAREG_WR50 0x2dc8
-#define MGAREG_WR51 0x2dcc
-#define MGAREG_WR52 0x2dd0
-#define MGAREG_WR53 0x2dd4
-#define MGAREG_WR54 0x2dd8
-#define MGAREG_WR55 0x2ddc
-#define MGAREG_WR56 0x2de0
-#define MGAREG_WR57 0x2de4
-#define MGAREG_WR58 0x2de8
-#define MGAREG_WR59 0x2dec
-#define MGAREG_WR60 0x2df0
-#define MGAREG_WR61 0x2df4
-#define MGAREG_WR62 0x2df8
-#define MGAREG_WR63 0x2dfc
-
-#define PDEA_pagpxfer_enable 0x2
-
-#define WIA_wmode_suspend 0x0
-#define WIA_wmode_start 0x3
-#define WIA_wagp_agp 0x4
-
-#define DC_opcod_line_open 0x0
-#define DC_opcod_autoline_open 0x1
-#define DC_opcod_line_close 0x2
-#define DC_opcod_autoline_close 0x3
-#define DC_opcod_trap 0x4
-#define DC_opcod_texture_trap 0x6
-#define DC_opcod_bitblt 0x8
-#define DC_opcod_iload 0x9
-#define DC_atype_rpl 0x0
-#define DC_atype_rstr 0x10
-#define DC_atype_zi 0x30
-#define DC_atype_blk 0x40
-#define DC_atype_i 0x70
-#define DC_linear_xy 0x0
-#define DC_linear_linear 0x80
-#define DC_zmode_nozcmp 0x0
-#define DC_zmode_ze 0x200
-#define DC_zmode_zne 0x300
-#define DC_zmode_zlt 0x400
-#define DC_zmode_zlte 0x500
-#define DC_zmode_zgt 0x600
-#define DC_zmode_zgte 0x700
-#define DC_solid_disable 0x0
-#define DC_solid_enable 0x800
-#define DC_arzero_disable 0x0
-#define DC_arzero_enable 0x1000
-#define DC_sgnzero_disable 0x0
-#define DC_sgnzero_enable 0x2000
-#define DC_shftzero_disable 0x0
-#define DC_shftzero_enable 0x4000
-#define DC_bop_SHIFT 16
-#define DC_trans_SHIFT 20
-#define DC_bltmod_bmonolef 0x0
-#define DC_bltmod_bmonowf 0x8000000
-#define DC_bltmod_bplan 0x2000000
-#define DC_bltmod_bfcol 0x4000000
-#define DC_bltmod_bu32bgr 0x6000000
-#define DC_bltmod_bu32rgb 0xe000000
-#define DC_bltmod_bu24bgr 0x16000000
-#define DC_bltmod_bu24rgb 0x1e000000
-#define DC_pattern_disable 0x0
-#define DC_pattern_enable 0x20000000
-#define DC_transc_disable 0x0
-#define DC_transc_enable 0x40000000
-#define DC_clipdis_disable 0x0
-#define DC_clipdis_enable 0x80000000
-
-
-#define SO_srcacc_pci 0x0
-#define SO_srcacc_agp 0x2
-#define SO_srcmap_fb 0x0
-#define SO_srcmap_sys 0x1
-
-
-#define SETADD_mode_vertlist 0x0
-
-
-#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) \
-
-#define MGA_FLUSH_CMD (DC_opcod_texture_trap | (0xF << DC_trans_SHIFT) |\
- DC_arzero_enable | DC_sgnzero_enable | \
- DC_atype_i)
+/* Warp registers
+ */
+#define MGA_WR0 0x2d00
+#define MGA_WR1 0x2d04
+#define MGA_WR2 0x2d08
+#define MGA_WR3 0x2d0c
+#define MGA_WR4 0x2d10
+#define MGA_WR5 0x2d14
+#define MGA_WR6 0x2d18
+#define MGA_WR7 0x2d1c
+#define MGA_WR8 0x2d20
+#define MGA_WR9 0x2d24
+#define MGA_WR10 0x2d28
+#define MGA_WR11 0x2d2c
+#define MGA_WR12 0x2d30
+#define MGA_WR13 0x2d34
+#define MGA_WR14 0x2d38
+#define MGA_WR15 0x2d3c
+#define MGA_WR16 0x2d40
+#define MGA_WR17 0x2d44
+#define MGA_WR18 0x2d48
+#define MGA_WR19 0x2d4c
+#define MGA_WR20 0x2d50
+#define MGA_WR21 0x2d54
+#define MGA_WR22 0x2d58
+#define MGA_WR23 0x2d5c
+#define MGA_WR24 0x2d60
+#define MGA_WR25 0x2d64
+#define MGA_WR26 0x2d68
+#define MGA_WR27 0x2d6c
+#define MGA_WR28 0x2d70
+#define MGA_WR29 0x2d74
+#define MGA_WR30 0x2d78
+#define MGA_WR31 0x2d7c
+#define MGA_WR32 0x2d80
+#define MGA_WR33 0x2d84
+#define MGA_WR34 0x2d88
+#define MGA_WR35 0x2d8c
+#define MGA_WR36 0x2d90
+#define MGA_WR37 0x2d94
+#define MGA_WR38 0x2d98
+#define MGA_WR39 0x2d9c
+#define MGA_WR40 0x2da0
+#define MGA_WR41 0x2da4
+#define MGA_WR42 0x2da8
+#define MGA_WR43 0x2dac
+#define MGA_WR44 0x2db0
+#define MGA_WR45 0x2db4
+#define MGA_WR46 0x2db8
+#define MGA_WR47 0x2dbc
+#define MGA_WR48 0x2dc0
+#define MGA_WR49 0x2dc4
+#define MGA_WR50 0x2dc8
+#define MGA_WR51 0x2dcc
+#define MGA_WR52 0x2dd0
+#define MGA_WR53 0x2dd4
+#define MGA_WR54 0x2dd8
+#define MGA_WR55 0x2ddc
+#define MGA_WR56 0x2de0
+#define MGA_WR57 0x2de4
+#define MGA_WR58 0x2de8
+#define MGA_WR59 0x2dec
+#define MGA_WR60 0x2df0
+#define MGA_WR61 0x2df4
+#define MGA_WR62 0x2df8
+#define MGA_WR63 0x2dfc
+# define MGA_G400_WR_MAGIC (1 << 6)
+# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */
+
+
+#define MGA_ILOAD_ALIGN 64
+#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1)
+
+#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \
+ MGA_ATYPE_I | \
+ MGA_ZMODE_NOZCMP | \
+ MGA_ARZERO | \
+ MGA_SGNZERO | \
+ MGA_BOP_SRC | \
+ (15 << MGA_TRANS_SHIFT))
+
+#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \
+ MGA_ZMODE_NOZCMP | \
+ MGA_SOLID | \
+ MGA_ARZERO | \
+ MGA_SGNZERO | \
+ MGA_SHIFTZERO | \
+ MGA_BOP_SRC | \
+ (0 << MGA_TRANS_SHIFT) | \
+ MGA_BLTMOD_BMONOLEF | \
+ MGA_TRANSC | \
+ MGA_CLIPDIS)
+
+#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \
+ MGA_ATYPE_RPL | \
+ MGA_SGNZERO | \
+ MGA_SHIFTZERO | \
+ MGA_BOP_SRC | \
+ (0 << MGA_TRANS_SHIFT) | \
+ MGA_BLTMOD_BFCOL | \
+ MGA_CLIPDIS)
#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
index bba8fa35b..4c9c9c058 100644
--- 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
@@ -1,4 +1,4 @@
-/* mga_state.c -- State support for mga g200/g400 -*- linux-c -*-
+/* 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.
@@ -19,404 +19,400 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
- * Authors: Jeff Hartmann <jhartmann@valinux.com>
- * Keith Whitwell <keithw@valinux.com>
+ * Authors:
+ * Jeff Hartmann <jhartmann@valinux.com>
+ * Keith Whitwell <keithw@valinux.com>
*
+ * Rewritten by:
+ * Gareth Hughes <gareth@valinux.com>
*/
#define __NO_VERSION__
+#include "mga.h"
#include "drmP.h"
#include "mga_drv.h"
#include "drm.h"
-/* If you change the functions to set state, PLEASE
- * change these values
- */
-
-#define MGAEMITCLIP_SIZE 10
-#define MGAEMITCTX_SIZE 20
-#define MGAG200EMITTEX_SIZE 20
-#define MGAG400EMITTEX0_SIZE 30
-#define MGAG400EMITTEX1_SIZE 25
-#define MGAG400EMITPIPE_SIZE 50
-#define MGAG200EMITPIPE_SIZE 15
-#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \
- MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \
- MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE)
+/* ================================================================
+ * DMA hardware state programming functions
+ */
-static void mgaEmitClipRect(drm_mga_private_t * dev_priv,
- drm_clip_rect_t * box)
+static void mga_emit_clip_rect( drm_mga_private_t *dev_priv,
+ drm_clip_rect_t *box )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- PRIMLOCALS;
-
- /* This takes 10 dwords */
- PRIMGETPTR(dev_priv);
-
- /* Force reset of dwgctl on G400 (eliminates clip disable bit) */
- if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
-#if 0
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DWGSYNC, 0);
- PRIMOUTREG(MGAREG_DWGSYNC, 0);
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
-#else
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
- PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000);
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
- PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000);
-#endif
- }
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1));
- PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp);
- PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp);
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+ unsigned int pitch = dev_priv->front_pitch;
+ DMA_LOCALS;
- PRIMADVANCE(dev_priv);
-}
+ BEGIN_DMA( 2 );
-static void mgaEmitContext(drm_mga_private_t * dev_priv)
-{
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- PRIMLOCALS;
-
- /* This takes a max of 20 dwords */
- 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]);
- PRIMOUTREG(MGAREG_ZORG, dev_priv->depthOffset); /* invarient */
-
- 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]);
- PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
-
- PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]);
- PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- } else {
- PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ /* Force reset of DWGCTL on G400 (eliminates clip disable bit).
+ */
+ if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) {
+ DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl,
+ MGA_LEN + MGA_EXEC, 0x80000000,
+ MGA_DWGCTL, ctx->dwgctl,
+ MGA_LEN + MGA_EXEC, 0x80000000 );
}
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_CXBNDRY, (box->x2 << 16) | box->x1,
+ MGA_YTOP, box->y1 * pitch,
+ MGA_YBOT, box->y2 * pitch );
- PRIMADVANCE(dev_priv);
+ ADVANCE_DMA();
}
-static void mgaG200EmitTex(drm_mga_private_t * dev_priv)
+static inline void mga_g200_emit_context( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->TexState[0];
- PRIMLOCALS;
-
- PRIMGETPTR(dev_priv);
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+ DMA_LOCALS;
- /* This takes 20 dwords */
+ BEGIN_DMA( 3 );
- 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]);
+ DMA_BLOCK( MGA_DSTORG, ctx->dstorg,
+ MGA_MACCESS, ctx->maccess,
+ MGA_PLNWT, ctx->plnwt,
+ MGA_DWGCTL, ctx->dwgctl );
- 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]);
+ DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl,
+ MGA_FOGCOL, ctx->fogcolor,
+ MGA_WFLAG, ctx->wflag,
+ MGA_ZORG, dev_priv->depth_offset );
- PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
- PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
- PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
- PRIMOUTREG(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]);
+ DMA_BLOCK( MGA_FCOL, ctx->fcol,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
- PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]);
- PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
- PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- PRIMADVANCE(dev_priv);
+ ADVANCE_DMA();
}
-#define TMC_dualtex_enable 0x80
-
-static void mgaG400EmitTex0(drm_mga_private_t * dev_priv)
+static inline void mga_g400_emit_context( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->TexState[0];
- PRIMLOCALS;
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+ DMA_LOCALS;
- PRIMGETPTR(dev_priv);
+ BEGIN_DMA( 4 );
- /* This takes 30 dwords */
+ DMA_BLOCK( MGA_DSTORG, ctx->dstorg,
+ MGA_MACCESS, ctx->maccess,
+ MGA_PLNWT, ctx->plnwt,
+ MGA_DWGCTL, ctx->dwgctl );
- PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000);
- PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]);
- PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]);
- PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]);
+ DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl,
+ MGA_FOGCOL, ctx->fogcolor,
+ MGA_WFLAG, ctx->wflag,
+ MGA_ZORG, dev_priv->depth_offset );
- 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]);
+ DMA_BLOCK( MGA_WFLAG1, ctx->wflag,
+ MGA_TDUALSTAGE0, ctx->tdualstage0,
+ MGA_TDUALSTAGE1, ctx->tdualstage1,
+ MGA_FCOL, ctx->fcol );
- PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
- PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
- PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
- PRIMOUTREG(MGAREG_WR49, 0);
+ DMA_BLOCK( MGA_STENCIL, ctx->stencil,
+ MGA_STENCILCTL, ctx->stencilctl,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
- PRIMOUTREG(MGAREG_WR57, 0);
- PRIMOUTREG(MGAREG_WR53, 0);
- PRIMOUTREG(MGAREG_WR61, 0);
- PRIMOUTREG(MGAREG_WR52, 0x40);
-
- PRIMOUTREG(MGAREG_WR60, 0x40);
- PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40);
- PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
- PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
-
- PRIMADVANCE(dev_priv);
+ ADVANCE_DMA();
}
-#define TMC_map1_enable 0x80000000
-
-static void mgaG400EmitTex1(drm_mga_private_t * dev_priv)
+static inline void mga_g200_emit_tex0( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->TexState[1];
- PRIMLOCALS;
+ drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0];
+ DMA_LOCALS;
- PRIMGETPTR(dev_priv);
+ BEGIN_DMA( 4 );
- /* This takes 25 dwords */
+ DMA_BLOCK( MGA_TEXCTL2, tex->texctl2,
+ MGA_TEXCTL, tex->texctl,
+ MGA_TEXFILTER, tex->texfilter,
+ MGA_TEXBORDERCOL, tex->texbordercol );
- PRIMOUTREG(MGAREG_TEXCTL2,
- regs[MGA_TEXREG_CTL2] | TMC_map1_enable | 0x00008000);
- PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]);
- PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]);
- PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]);
+ DMA_BLOCK( MGA_TEXORG, tex->texorg,
+ MGA_TEXORG1, tex->texorg1,
+ MGA_TEXORG2, tex->texorg2,
+ MGA_TEXORG3, tex->texorg3 );
- 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]);
+ DMA_BLOCK( MGA_TEXORG4, tex->texorg4,
+ MGA_TEXWIDTH, tex->texwidth,
+ MGA_TEXHEIGHT, tex->texheight,
+ MGA_WR24, tex->texwidth );
- PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]);
- PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]);
- PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]);
- PRIMOUTREG(MGAREG_WR49, 0);
+ DMA_BLOCK( MGA_WR34, tex->texheight,
+ MGA_TEXTRANS, 0x0000ffff,
+ MGA_TEXTRANSHIGH, 0x0000ffff,
+ MGA_DMAPAD, 0x00000000 );
- PRIMOUTREG(MGAREG_WR57, 0);
- PRIMOUTREG(MGAREG_WR53, 0);
- PRIMOUTREG(MGAREG_WR61, 0);
- PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40);
-
- PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40);
- PRIMOUTREG(MGAREG_TEXTRANS, 0xffff);
- PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff);
- PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000);
+ ADVANCE_DMA();
+}
- PRIMADVANCE(dev_priv);
+static inline void mga_g400_emit_tex0( drm_mga_private_t *dev_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0];
+ DMA_LOCALS;
+
+ BEGIN_DMA( 6 );
+
+ DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC,
+ MGA_TEXCTL, tex->texctl,
+ MGA_TEXFILTER, tex->texfilter,
+ MGA_TEXBORDERCOL, tex->texbordercol );
+
+ DMA_BLOCK( MGA_TEXORG, tex->texorg,
+ MGA_TEXORG1, tex->texorg1,
+ MGA_TEXORG2, tex->texorg2,
+ MGA_TEXORG3, tex->texorg3 );
+
+ DMA_BLOCK( MGA_TEXORG4, tex->texorg4,
+ MGA_TEXWIDTH, tex->texwidth,
+ MGA_TEXHEIGHT, tex->texheight,
+ MGA_WR49, 0x00000000 );
+
+ DMA_BLOCK( MGA_WR57, 0x00000000,
+ MGA_WR53, 0x00000000,
+ MGA_WR61, 0x00000000,
+ MGA_WR52, MGA_G400_WR_MAGIC );
+
+ DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC,
+ MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC,
+ MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC,
+ MGA_DMAPAD, 0x00000000 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_TEXTRANS, 0x0000ffff,
+ MGA_TEXTRANSHIGH, 0x0000ffff );
+
+ ADVANCE_DMA();
}
-#define MAGIC_FPARAM_HEX_VALUE 0x46480000
-/* This is the hex value of 12800.0f which is a magic value we must
- * set in wr56.
- */
+static inline void mga_g400_emit_tex1( drm_mga_private_t *dev_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1];
+ DMA_LOCALS;
+
+ BEGIN_DMA( 5 );
+
+ DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 |
+ MGA_MAP1_ENABLE |
+ MGA_G400_TC2_MAGIC),
+ MGA_TEXCTL, tex->texctl,
+ MGA_TEXFILTER, tex->texfilter,
+ MGA_TEXBORDERCOL, tex->texbordercol );
+
+ DMA_BLOCK( MGA_TEXORG, tex->texorg,
+ MGA_TEXORG1, tex->texorg1,
+ MGA_TEXORG2, tex->texorg2,
+ MGA_TEXORG3, tex->texorg3 );
+
+ DMA_BLOCK( MGA_TEXORG4, tex->texorg4,
+ MGA_TEXWIDTH, tex->texwidth,
+ MGA_TEXHEIGHT, tex->texheight,
+ MGA_WR49, 0x00000000 );
+
+ DMA_BLOCK( MGA_WR57, 0x00000000,
+ MGA_WR53, 0x00000000,
+ MGA_WR61, 0x00000000,
+ MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC );
+
+ DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC,
+ MGA_TEXTRANS, 0x0000ffff,
+ MGA_TEXTRANSHIGH, 0x0000ffff,
+ MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC );
+
+ ADVANCE_DMA();
+}
-static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
+static inline void mga_g200_emit_pipe( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int pipe = sarea_priv->WarpPipe;
- PRIMLOCALS;
+ unsigned int pipe = sarea_priv->warp_pipe;
+ DMA_LOCALS;
- PRIMGETPTR(dev_priv);
+ BEGIN_DMA( 3 );
- /* This takes 50 dwords */
+ DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND,
+ MGA_WVRTXSZ, 0x00000007,
+ MGA_WFLAG, 0x00000000,
+ MGA_WR24, 0x00000000 );
- /* Establish vertex size.
+ DMA_BLOCK( MGA_WR25, 0x00000100,
+ MGA_WR34, 0x00000000,
+ MGA_WR42, 0x0000ffff,
+ MGA_WR60, 0x0000ffff );
+
+ /* Padding required to to hardware bug.
*/
- PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- if (pipe & MGA_T2) {
- PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000);
+ DMA_BLOCK( MGA_DMAPAD, 0xffffffff,
+ MGA_DMAPAD, 0xffffffff,
+ MGA_DMAPAD, 0xffffffff,
+ MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] |
+ MGA_WMODE_START |
+ MGA_WAGP_ENABLE) );
+
+ ADVANCE_DMA();
+}
+
+static inline void mga_g400_emit_pipe( drm_mga_private_t *dev_priv )
+{
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ unsigned int pipe = sarea_priv->warp_pipe;
+ DMA_LOCALS;
+
+ BEGIN_DMA( 10 );
+
+ DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
+
+ if ( pipe & MGA_T2 ) {
+ DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
+
+ DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x1e000000 );
} else {
- if (dev_priv->WarpPipe & MGA_T2) {
+ if ( dev_priv->warp_pipe & MGA_T2 ) {
/* Flush the WARP pipe */
- PRIMOUTREG(MGAREG_YDST, 0);
- PRIMOUTREG(MGAREG_FXLEFT, 0);
- PRIMOUTREG(MGAREG_FXRIGHT, 1);
- PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD);
-
- PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
- PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
- PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
-
- PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000);
- PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
- PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ DMA_BLOCK( MGA_YDST, 0x00000000,
+ MGA_FXLEFT, 0x00000000,
+ MGA_FXRIGHT, 0x00000001,
+ MGA_DWGCTL, MGA_DWGCTL_FLUSH );
+
+ DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001,
+ MGA_DWGSYNC, 0x00007000,
+ MGA_TEXCTL2, MGA_G400_TC2_MAGIC,
+ MGA_LEN + MGA_EXEC, 0x00000000 );
+
+ DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX |
+ MGA_G400_TC2_MAGIC),
+ MGA_LEN + MGA_EXEC, 0x00000000,
+ MGA_TEXCTL2, MGA_G400_TC2_MAGIC,
+ MGA_DMAPAD, 0x00000000 );
}
- PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ DMA_BLOCK( MGA_WVRTXSZ, 0x00001807,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000 );
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0);
- PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000);
+ DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x00000000,
+ MGA_WACCEPTSEQ, 0x18000000 );
}
- PRIMOUTREG(MGAREG_WFLAG, 0);
- PRIMOUTREG(MGAREG_WFLAG1, 0);
- PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
-
- PRIMOUTREG(MGAREG_WR49, 0); /* Tex stage 0 */
- PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */
- PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */
- PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */
-
- PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */
- PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */
- PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */
- PRIMOUTREG(MGAREG_WR60, 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,
- (u32) (dev_priv->WarpIndex[pipe].
- phys_addr | WIA_wmode_start | WIA_wagp_agp));
- PRIMADVANCE(dev_priv);
+ DMA_BLOCK( MGA_WFLAG, 0x00000000,
+ MGA_WFLAG1, 0x00000000,
+ MGA_WR56, MGA_G400_WR56_MAGIC,
+ MGA_DMAPAD, 0x00000000 );
+
+ DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */
+ MGA_WR57, 0x00000000, /* tex0 */
+ MGA_WR53, 0x00000000, /* tex1 */
+ MGA_WR61, 0x00000000 ); /* tex1 */
+
+ DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */
+ MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */
+ MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */
+ MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */
+
+ /* Padding required to to hardware bug */
+ DMA_BLOCK( MGA_DMAPAD, 0xffffffff,
+ MGA_DMAPAD, 0xffffffff,
+ MGA_DMAPAD, 0xffffffff,
+ MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] |
+ MGA_WMODE_START |
+ MGA_WAGP_ENABLE) );
+
+ ADVANCE_DMA();
}
-static void mgaG200EmitPipe(drm_mga_private_t * dev_priv)
+static void mga_g200_emit_state( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int pipe = sarea_priv->WarpPipe;
- PRIMLOCALS;
-
- PRIMGETPTR(dev_priv);
-
- /* This takes 15 dwords */
-
- PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend);
- PRIMOUTREG(MGAREG_WVRTXSZ, 7);
- PRIMOUTREG(MGAREG_WFLAG, 0);
- PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */
+ unsigned int dirty = sarea_priv->dirty;
- PRIMOUTREG(MGAREG_WR25, 0x100);
- PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */
- PRIMOUTREG(MGAREG_WR42, 0xFFFF);
- PRIMOUTREG(MGAREG_WR60, 0xFFFF);
+ if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) {
+ mga_g200_emit_pipe( dev_priv );
+ dev_priv->warp_pipe = sarea_priv->warp_pipe;
+ }
- /* Dma pading required due to hw bug */
- PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
- PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
- PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff);
- PRIMOUTREG(MGAREG_WIADDR,
- (u32) (dev_priv->WarpIndex[pipe].
- phys_addr | WIA_wmode_start | WIA_wagp_agp));
+ if ( dirty & MGA_UPLOAD_CONTEXT ) {
+ mga_g200_emit_context( dev_priv );
+ sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT;
+ }
- PRIMADVANCE( dev_priv );
+ if ( dirty & MGA_UPLOAD_TEX0 ) {
+ mga_g200_emit_tex0( dev_priv );
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
+ }
}
-static void mgaEmitState(drm_mga_private_t * dev_priv)
+static void mga_g400_emit_state( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty;
+ int multitex = sarea_priv->warp_pipe & MGA_T2;
- if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
- int multitex = sarea_priv->WarpPipe & MGA_T2;
-
- if (sarea_priv->WarpPipe != dev_priv->WarpPipe) {
- mgaG400EmitPipe(dev_priv);
- dev_priv->WarpPipe = sarea_priv->WarpPipe;
- }
-
- if (dirty & MGA_UPLOAD_CTX) {
- mgaEmitContext(dev_priv);
- sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
- }
-
- if (dirty & MGA_UPLOAD_TEX0) {
- mgaG400EmitTex0(dev_priv);
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
- }
+ if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) {
+ mga_g400_emit_pipe( dev_priv );
+ dev_priv->warp_pipe = sarea_priv->warp_pipe;
+ }
- if ((dirty & MGA_UPLOAD_TEX1) && multitex) {
- mgaG400EmitTex1(dev_priv);
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX1;
- }
- } else {
- if (sarea_priv->WarpPipe != dev_priv->WarpPipe) {
- mgaG200EmitPipe(dev_priv);
- dev_priv->WarpPipe = sarea_priv->WarpPipe;
- }
+ if ( dirty & MGA_UPLOAD_CONTEXT ) {
+ mga_g400_emit_context( dev_priv );
+ sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT;
+ }
- if (dirty & MGA_UPLOAD_CTX) {
- mgaEmitContext(dev_priv);
- sarea_priv->dirty &= ~MGA_UPLOAD_CTX;
- }
+ if ( dirty & MGA_UPLOAD_TEX0 ) {
+ mga_g400_emit_tex0( dev_priv );
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
+ }
- if (dirty & MGA_UPLOAD_TEX0) {
- mgaG200EmitTex(dev_priv);
- sarea_priv->dirty &= ~MGA_UPLOAD_TEX0;
- }
+ if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) {
+ mga_g400_emit_tex1( dev_priv );
+ sarea_priv->dirty &= ~MGA_UPLOAD_TEX1;
}
}
+
+/* ================================================================
+ * SAREA state verification
+ */
+
/* Disallow all write destinations except the front and backbuffer.
*/
-static int mgaVerifyContext(drm_mga_private_t * dev_priv)
+static int mga_verify_context( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
-
- if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOffset &&
- regs[MGA_CTXREG_DSTORG] != dev_priv->backOffset) {
- DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n",
- regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset,
- dev_priv->backOffset);
- regs[MGA_CTXREG_DSTORG] = 0;
- return -1;
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+
+ if ( ctx->dstorg != dev_priv->front_offset &&
+ ctx->dstorg != dev_priv->back_offset ) {
+ DRM_DEBUG( "*** bad DSTORG: %x (front %x, back %x)\n\n",
+ ctx->dstorg, dev_priv->front_offset,
+ dev_priv->back_offset );
+ ctx->dstorg = 0;
+ return -EINVAL;
}
return 0;
@@ -424,720 +420,644 @@ static int mgaVerifyContext(drm_mga_private_t * dev_priv)
/* Disallow texture reads from PCI space.
*/
-static int mgaVerifyTex(drm_mga_private_t * dev_priv, int unit)
+static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit];
+ unsigned int org;
- if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1) {
- DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n",
- sarea_priv->TexState[unit][MGA_TEXREG_ORG],
- unit);
- sarea_priv->TexState[unit][MGA_TEXREG_ORG] = 0;
- return -1;
+ org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK);
+
+ if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) {
+ DRM_DEBUG( "*** bad TEXORG: 0x%x, unit %d\n",
+ tex->texorg, unit );
+ tex->texorg = 0;
+ return -EINVAL;
}
return 0;
}
-static int mgaVerifyState(drm_mga_private_t * dev_priv)
+static int mga_verify_state( drm_mga_private_t *dev_priv )
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty;
- int rv = 0;
+ int ret = 0;
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
- if (dirty & MGA_UPLOAD_CTX)
- rv |= mgaVerifyContext(dev_priv);
+ if ( dirty & MGA_UPLOAD_CONTEXT )
+ ret |= mga_verify_context( dev_priv );
- if (dirty & MGA_UPLOAD_TEX0)
- rv |= mgaVerifyTex(dev_priv, 0);
+ if ( dirty & MGA_UPLOAD_TEX0 )
+ ret |= mga_verify_tex( dev_priv, 0 );
- if (dev_priv->chipset == MGA_CARD_TYPE_G400) {
- if (dirty & MGA_UPLOAD_TEX1)
- rv |= mgaVerifyTex(dev_priv, 1);
+ if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) {
+ if ( dirty & MGA_UPLOAD_TEX1 )
+ ret |= mga_verify_tex( dev_priv, 1 );
- if (dirty & MGA_UPLOAD_PIPE)
- rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES);
+ if ( dirty & MGA_UPLOAD_PIPE )
+ ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES );
} else {
- if (dirty & MGA_UPLOAD_PIPE)
- rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES);
+ if ( dirty & MGA_UPLOAD_PIPE )
+ ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES );
}
- return rv == 0;
+ return ( ret == 0 );
}
-static int mgaVerifyIload(drm_mga_private_t * dev_priv,
- unsigned long bus_address,
- unsigned int dstOrg, int length)
+static int mga_verify_iload( drm_mga_private_t *dev_priv,
+ unsigned int dstorg, unsigned int length )
{
- if (dstOrg < dev_priv->textureOffset ||
- dstOrg + length >
- (dev_priv->textureOffset + dev_priv->textureSize)) {
+ if ( dstorg < dev_priv->texture_offset ||
+ dstorg + length > (dev_priv->texture_offset +
+ dev_priv->texture_size) ) {
return -EINVAL;
}
- if (length % 64) {
+
+ if ( length & MGA_ILOAD_MASK ) {
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int mga_verify_blit( drm_mga_private_t *dev_priv,
+ unsigned int srcorg, unsigned int dstorg )
+{
+ if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ||
+ (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) {
return -EINVAL;
}
return 0;
}
-/* This copies a 64 byte aligned agp region to the frambuffer
- * with a standard blit, the ioctl needs to do checking */
-static void mga_dma_dispatch_tex_blit(drm_device_t * dev,
- unsigned long bus_address,
- int length, unsigned int destOrg)
+/* ================================================================
+ *
+ */
+
+static void mga_dma_dispatch_clear( drm_device_t *dev,
+ drm_mga_clear_t *clear )
{
drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- int use_agp = PDEA_pagpxfer_enable | 0x00000001;
- u16 y2;
- PRIMLOCALS;
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+ drm_clip_rect_t *pbox = sarea_priv->boxes;
+ int nbox = sarea_priv->nbox;
+ int i;
+ DMA_LOCALS;
+ DRM_DEBUG( __FUNCTION__ ":\n" );
- y2 = length / 64;
+ for ( i = 0 ; i < nbox ; i++ ) {
+ drm_clip_rect_t *box = &pbox[i];
+ u32 height = box->y2 - box->y1;
+
+ DRM_DEBUG( " from=%d,%d to=%d,%d\n",
+ box->x1, box->y1, box->x2, box->y2 );
+
+ if ( clear->flags & MGA_FRONT ) {
+ BEGIN_DMA( 2 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, clear->color_mask,
+ MGA_YDSTLEN, (box->y1 << 16) | height,
+ MGA_FXBNDRY, (box->x2 << 16) | box->x1 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_FCOL, clear->clear_color,
+ MGA_DSTORG, dev_priv->front_offset,
+ MGA_DWGCTL + MGA_EXEC,
+ dev_priv->clear_cmd );
+
+ ADVANCE_DMA();
+ }
+
+
+ if ( clear->flags & MGA_BACK ) {
+ BEGIN_DMA( 2 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, clear->color_mask,
+ MGA_YDSTLEN, (box->y1 << 16) | height,
+ MGA_FXBNDRY, (box->x2 << 16) | box->x1 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_FCOL, clear->clear_color,
+ MGA_DSTORG, dev_priv->back_offset,
+ MGA_DWGCTL + MGA_EXEC,
+ dev_priv->clear_cmd );
+
+ ADVANCE_DMA();
+ }
+
+ if ( clear->flags & MGA_DEPTH ) {
+ BEGIN_DMA( 2 );
- PRIM_OVERFLOW(dev, dev_priv, 30);
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, clear->depth_mask,
+ MGA_YDSTLEN, (box->y1 << 16) | height,
+ MGA_FXBNDRY, (box->x2 << 16) | box->x1 );
- PRIMOUTREG(MGAREG_DSTORG, destOrg);
- PRIMOUTREG(MGAREG_MACCESS, 0x00000000);
- PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp);
- PRIMOUTREG(MGAREG_AR5, 64);
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_FCOL, clear->clear_depth,
+ MGA_DSTORG, dev_priv->depth_offset,
+ MGA_DWGCTL + MGA_EXEC,
+ dev_priv->clear_cmd );
- PRIMOUTREG(MGAREG_PITCH, 64);
- PRIMOUTREG(MGAREG_PLNWT, ~0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
+ ADVANCE_DMA();
+ }
+
+ }
+
+ BEGIN_DMA( 1 );
- PRIMOUTREG(MGAREG_AR0, 63);
- PRIMOUTREG(MGAREG_AR3, 0);
- PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16));
- PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2);
+ /* Force reset of DWGCTL */
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, ctx->plnwt,
+ MGA_DWGCTL, ctx->dwgctl );
+
+ ADVANCE_DMA();
- PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]);
- PRIMOUTREG(MGAREG_SRCORG, 0);
- PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
- PRIMADVANCE(dev_priv);
+ FLUSH_DMA();
}
-static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
+static void mga_dma_dispatch_swap( drm_device_t *dev )
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
+ drm_clip_rect_t *pbox = sarea_priv->boxes;
+ int nbox = sarea_priv->nbox;
+ int i;
+ DMA_LOCALS;
+ DRM_DEBUG( __FUNCTION__ ":\n" );
+
+ sarea_priv->last_frame.head = dev_priv->prim.tail;
+ sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap;
+
+ BEGIN_DMA( 4 + nbox );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DWGSYNC, 0x00007100,
+ MGA_DWGSYNC, 0x00007000 );
+
+ DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset,
+ MGA_MACCESS, dev_priv->maccess,
+ MGA_SRCORG, dev_priv->back_offset,
+ MGA_AR5, dev_priv->front_pitch );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, 0xffffffff,
+ MGA_DWGCTL, MGA_DWGCTL_COPY );
+
+ for ( i = 0 ; i < nbox ; i++ ) {
+ drm_clip_rect_t *box = &pbox[i];
+ u32 height = box->y2 - box->y1;
+ u32 start = box->y1 * dev_priv->front_pitch;
+
+ DRM_DEBUG( " from=%d,%d to=%d,%d\n",
+ box->x1, box->y1, box->x2, box->y2 );
+
+ DMA_BLOCK( MGA_AR0, start + box->x2 - 1,
+ MGA_AR3, start + box->x1,
+ MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1,
+ MGA_YDSTLEN + MGA_EXEC,
+ (box->y1 << 16) | height );
+ }
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, ctx->plnwt,
+ MGA_SRCORG, dev_priv->front_offset,
+ MGA_DWGCTL, ctx->dwgctl );
+
+ ADVANCE_DMA();
+
+ FLUSH_DMA();
+
+ DRM_DEBUG( "%s... done.\n", __FUNCTION__ );
+}
+
+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;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned long address = (unsigned long) buf->bus_address;
- int length = buf->used;
- int use_agp = PDEA_pagpxfer_enable;
+ u32 address = (u32) buf->bus_address;
+ u32 length = (u32) buf->used;
int i = 0;
- PRIMLOCALS;
+ DMA_LOCALS;
+ DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used );
- if (buf->used) {
- /* WARNING: if you change any of the state functions verify
- * these numbers (Overestimating this doesn't hurt).
- */
+ if ( buf->used ) {
buf_priv->dispatched = 1;
- PRIM_OVERFLOW(dev, dev_priv,
- (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS)));
- mgaEmitState(dev_priv);
-#if 0
- length = dev_priv->vertexsize * 3 * 4;
-#endif
+ MGA_EMIT_STATE( dev_priv, sarea_priv->dirty );
do {
- if (i < sarea_priv->nbox) {
- mgaEmitClipRect(dev_priv,
- &sarea_priv->boxes[i]);
+ if ( i < sarea_priv->nbox ) {
+ mga_emit_clip_rect( dev_priv,
+ &sarea_priv->boxes[i] );
}
- PRIMGETPTR(dev_priv);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_SECADDRESS,
- ((u32) address) | TT_VERTEX);
- PRIMOUTREG(MGAREG_SECEND,
- (((u32) (address + length)) | use_agp));
- PRIMADVANCE(dev_priv);
- } while (++i < sarea_priv->nbox);
+ BEGIN_DMA( 1 );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_SECADDRESS, (address |
+ MGA_DMA_VERTEX),
+ MGA_SECEND, ((address + length) |
+ MGA_PAGPXFER) );
+
+ ADVANCE_DMA();
+ } while ( ++i < sarea_priv->nbox );
}
- if (buf_priv->discard) {
- if (buf_priv->dispatched == 1)
- AGEBUF(dev_priv, buf_priv);
+
+ if ( buf_priv->discard ) {
+ AGE_BUFFER( buf_priv );
+ buf->pending = 0;
+ buf->used = 0;
buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
- }
+ mga_freelist_put( dev, buf );
+ }
+ FLUSH_DMA();
}
-
-static void mga_dma_dispatch_indices(drm_device_t * dev,
- drm_buf_t * buf,
- unsigned int start, unsigned int end)
+static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf,
+ unsigned int start, unsigned int end )
{
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 int address = (unsigned int) buf->bus_address;
- int use_agp = PDEA_pagpxfer_enable;
+ u32 address = (u32) buf->bus_address;
int i = 0;
- PRIMLOCALS;
+ DMA_LOCALS;
+ DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end );
- if (start != end) {
- /* WARNING: if you change any of the state functions verify
- * these numbers (Overestimating this doesn't hurt).
- */
+ if ( start != end ) {
buf_priv->dispatched = 1;
- PRIM_OVERFLOW(dev, dev_priv,
- (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS)));
- mgaEmitState(dev_priv);
+
+ MGA_EMIT_STATE( dev_priv, sarea_priv->dirty );
do {
- if (i < sarea_priv->nbox) {
- mgaEmitClipRect(dev_priv,
- &sarea_priv->boxes[i]);
+ if ( i < sarea_priv->nbox ) {
+ mga_emit_clip_rect( dev_priv,
+ &sarea_priv->boxes[i] );
}
- PRIMGETPTR(dev_priv);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_SETUPADDRESS,
- ((address + start) |
- SETADD_mode_vertlist));
- PRIMOUTREG(MGAREG_SETUPEND,
- ((address + end) | use_agp));
-/* ((address + start + 12) | use_agp)); */
- PRIMADVANCE(dev_priv);
- } while (++i < sarea_priv->nbox);
- }
- if (buf_priv->discard) {
- if (buf_priv->dispatched == 1)
- AGEBUF(dev_priv, buf_priv);
- buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
- }
-}
+ BEGIN_DMA( 1 );
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_SETUPADDRESS, address + start,
+ MGA_SETUPEND, ((address + end) |
+ MGA_PAGPXFER) );
-static void mga_dma_dispatch_clear(drm_device_t * dev, int flags,
- unsigned int clear_color,
- unsigned int clear_zval,
- unsigned int clear_colormask,
- unsigned int clear_depthmask)
-{
- drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- int nbox = sarea_priv->nbox;
- drm_clip_rect_t *pbox = sarea_priv->boxes;
- unsigned int cmd;
- int i;
- PRIMLOCALS;
-
- if (dev_priv->sgram)
- cmd = MGA_CLEAR_CMD | DC_atype_blk;
- else
- cmd = MGA_CLEAR_CMD | DC_atype_rstr;
-
- PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS);
-
- for (i = 0; i < nbox; i++) {
- unsigned int height = pbox[i].y2 - pbox[i].y1;
-
- if (flags & MGA_FRONT) {
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, clear_colormask);
- PRIMOUTREG(MGAREG_YDSTLEN,
- (pbox[i].y1 << 16) | height);
- PRIMOUTREG(MGAREG_FXBNDRY,
- (pbox[i].x2 << 16) | pbox[i].x1);
-
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_FCOL, clear_color);
- PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset);
- PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
- }
+ ADVANCE_DMA();
+ } while ( ++i < sarea_priv->nbox );
+ }
- if (flags & MGA_BACK) {
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, clear_colormask);
- PRIMOUTREG(MGAREG_YDSTLEN,
- (pbox[i].y1 << 16) | height);
- PRIMOUTREG(MGAREG_FXBNDRY,
- (pbox[i].x2 << 16) | pbox[i].x1);
-
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_FCOL, clear_color);
- PRIMOUTREG(MGAREG_DSTORG, dev_priv->backOffset);
- PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
- }
+ if ( buf_priv->discard ) {
+ AGE_BUFFER( buf_priv );
+ buf->pending = 0;
+ buf->used = 0;
+ buf_priv->dispatched = 0;
- if (flags & MGA_DEPTH) {
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, clear_depthmask);
- PRIMOUTREG(MGAREG_YDSTLEN,
- (pbox[i].y1 << 16) | height);
- PRIMOUTREG(MGAREG_FXBNDRY,
- (pbox[i].x2 << 16) | pbox[i].x1);
-
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_FCOL, clear_zval);
- PRIMOUTREG(MGAREG_DSTORG, dev_priv->depthOffset);
- PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd);
- }
+ mga_freelist_put( dev, buf );
}
- /* Force reset of DWGCTL */
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]);
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
- PRIMADVANCE(dev_priv);
+ FLUSH_DMA();
}
-static void mga_dma_dispatch_swap(drm_device_t * dev)
+/* This copies a 64 byte aligned agp region to the frambuffer with a
+ * standard blit, the ioctl needs to do checking.
+ */
+static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf,
+ unsigned int dstorg, unsigned int length )
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- int nbox = sarea_priv->nbox;
- drm_clip_rect_t *pbox = sarea_priv->boxes;
- int i;
- int pixel_stride = dev_priv->stride / dev_priv->cpp;
+ drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state;
+ u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM;
+ u32 y2;
+ DMA_LOCALS;
+ DRM_DEBUG( "%s: buf=%d used=%d\n",
+ __FUNCTION__, buf->idx, buf->used );
+
+ y2 = length / 64;
- PRIMLOCALS;
+ BEGIN_DMA( 4 );
- PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20);
+ DMA_BLOCK( MGA_DSTORG, dstorg,
+ MGA_MACCESS, 0x00000000,
+ MGA_SRCORG, srcorg,
+ MGA_AR5, 64 );
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7100);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
+ DMA_BLOCK( MGA_PITCH, 64,
+ MGA_PLNWT, 0xffffffff,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DWGCTL, MGA_DWGCTL_COPY );
- PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset);
- PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess);
- PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset);
- PRIMOUTREG(MGAREG_AR5, pixel_stride);
+ DMA_BLOCK( MGA_AR0, 63,
+ MGA_AR3, 0,
+ MGA_FXBNDRY, (63 << 16) | 0,
+ MGA_YDSTLEN + MGA_EXEC, y2 );
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, ~0);
- PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
+ DMA_BLOCK( MGA_PLNWT, ctx->plnwt,
+ MGA_SRCORG, dev_priv->front_offset,
+ MGA_PITCH, dev_priv->front_pitch,
+ MGA_DWGSYNC, 0x00007000 );
- for (i = 0; i < nbox; i++) {
- unsigned int h = pbox[i].y2 - pbox[i].y1;
- unsigned int start = pbox[i].y1 * pixel_stride;
+ ADVANCE_DMA();
- PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1);
- PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1);
- PRIMOUTREG(MGAREG_FXBNDRY,
- pbox[i].x1 | ((pbox[i].x2 - 1) << 16));
- PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC,
- (pbox[i].y1 << 16) | h);
- }
+ AGE_BUFFER( buf_priv );
- /* Force reset of DWGCTL */
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]);
- PRIMOUTREG(MGAREG_SRCORG, 0);
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+ buf->pending = 0;
+ buf->used = 0;
+ buf_priv->dispatched = 0;
+
+ mga_freelist_put( dev, buf );
- PRIMADVANCE(dev_priv);
+ FLUSH_DMA();
}
-/* #define BLIT_LEFT 1 */
-/* #define BLIT_UP 4 */
-
-static void mga_dma_dispatch_blit(drm_device_t * dev,
- unsigned int planemask,
- unsigned int source,
- unsigned int dest,
- int delta_sx, int delta_sy,
- int delta_dx, int delta_dy,
- int source_pitch,
- int dest_pitch,
- int height,
- int ydir)
+static void mga_dma_dispatch_blit( drm_device_t *dev,
+ drm_mga_blit_t *blit )
{
drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- unsigned int *regs = sarea_priv->ContextState;
- int nbox = sarea_priv->nbox;
+ drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
drm_clip_rect_t *pbox = sarea_priv->boxes;
- int pixel_stride = dev_priv->stride / dev_priv->cpp;
+ int nbox = sarea_priv->nbox;
u32 scandir = 0, i;
-
- PRIMLOCALS;
-
- PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20);
-
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7100);
- PRIMOUTREG(MGAREG_DWGSYNC, 0x7000);
-
- PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD);
- PRIMOUTREG(MGAREG_PLNWT, planemask);
- PRIMOUTREG(MGAREG_SRCORG, source);
- PRIMOUTREG(MGAREG_DSTORG, dest);
-
- PRIMOUTREG(MGAREG_SGN, scandir);
- PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess);
- PRIMOUTREG(MGAREG_AR5, ydir * source_pitch);
- PRIMOUTREG(MGAREG_PITCH, dest_pitch);
-
- for (i = 0; i < nbox; i++) {
- int srcx = pbox[i].x1 + delta_sx;
- int srcy = pbox[i].y1 + delta_sy;
- int dstx = pbox[i].x1 + delta_dx;
- int dsty = pbox[i].y1 + delta_dy;
+ DMA_LOCALS;
+ DRM_DEBUG( __FUNCTION__ ":\n" );
+
+ BEGIN_DMA( 4 + nbox );
+
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_DMAPAD, 0x00000000,
+ MGA_DWGSYNC, 0x00007100,
+ MGA_DWGSYNC, 0x00007000 );
+
+ DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY,
+ MGA_PLNWT, blit->planemask,
+ MGA_SRCORG, blit->srcorg,
+ MGA_DSTORG, blit->dstorg );
+
+ DMA_BLOCK( MGA_SGN, scandir,
+ MGA_MACCESS, dev_priv->maccess,
+ MGA_AR5, blit->ydir * blit->src_pitch,
+ MGA_PITCH, blit->dst_pitch );
+
+ for ( i = 0 ; i < nbox ; i++ ) {
+ int srcx = pbox[i].x1 + blit->delta_sx;
+ int srcy = pbox[i].y1 + blit->delta_sy;
+ int dstx = pbox[i].x1 + blit->delta_dx;
+ int dsty = pbox[i].y1 + blit->delta_dy;
int h = pbox[i].y2 - pbox[i].y1;
int w = pbox[i].x2 - pbox[i].x1 - 1;
int start;
- if (ydir == -1) {
- srcy = height - srcy - 1;
+ if ( blit->ydir == -1 ) {
+ srcy = blit->height - srcy - 1;
}
- start = srcy * source_pitch + srcx;
+ start = srcy * blit->src_pitch + srcx;
- PRIMOUTREG(MGAREG_AR0, start + w);
- PRIMOUTREG(MGAREG_AR3, start);
- PRIMOUTREG(MGAREG_FXBNDRY, ((dstx+w) << 16) | (dstx & 0xffff));
- PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, (dsty << 16) | h);
+ DMA_BLOCK( MGA_AR0, start + w,
+ MGA_AR3, start,
+ MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff),
+ MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h );
}
/* Do something to flush AGP?
*/
/* Force reset of DWGCTL */
- PRIMOUTREG(MGAREG_DMAPAD, 0);
- PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]);
- PRIMOUTREG(MGAREG_PITCH, pixel_stride);
- PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]);
+ DMA_BLOCK( MGA_DMAPAD, 0x00000000,
+ MGA_PLNWT, ctx->plnwt,
+ MGA_PITCH, dev_priv->front_pitch,
+ MGA_DWGCTL, ctx->dwgctl );
- PRIMADVANCE(dev_priv);
+ ADVANCE_DMA();
}
-int mga_blit(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+/* ================================================================
+ *
+ */
+
+int mga_dma_clear( 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_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- drm_mga_blit_t blit;
+ drm_mga_clear_t clear;
- if (copy_from_user(&blit, (drm_mga_blit_t *) arg, sizeof(blit)))
- return -EFAULT;
-
- DRM_DEBUG("%s\n", __FUNCTION__);
+ LOCK_TEST_WITH_RETURN( dev );
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_blit_bufs called without lock held\n");
- return -EINVAL;
- }
+ if ( copy_from_user( &clear, (drm_mga_clear_t *) arg, sizeof(clear) ) )
+ return -EFAULT;
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
- /* Make sure we restore the 3D state next time.
- */
- dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
-
- if ((blit.source & 0x3) != (SO_srcmap_sys|SO_srcacc_pci) &&
- (blit.dest & 0x3) != (SO_srcmap_sys|SO_srcacc_pci))
- {
- mga_dma_dispatch_blit(dev,
- blit.planemask,
- blit.source,
- blit.dest,
- blit.delta_sx, blit.delta_sy,
- blit.delta_dx, blit.delta_dy,
- blit.source_pitch,
- blit.dest_pitch,
- blit.height,
- blit.ydir);
- }
+ WRAP_TEST_WITH_RETURN( dev_priv );
+ mga_dma_dispatch_clear( dev, &clear );
- PRIMUPDATE(dev_priv);
+ /* Make sure we restore the 3D state next time.
+ */
+ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;
-#ifdef __i386__
- mga_flush_write_combine();
-#endif
- mga_dma_schedule(dev, 1);
return 0;
}
-
-int mga_clear_bufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+int mga_dma_swap( 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_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
- drm_mga_clear_t clear;
-
- if (copy_from_user(&clear, (drm_mga_clear_t *) arg, sizeof(clear)))
- return -EFAULT;
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_clear_bufs called without lock held\n");
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
+ if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
- /* Make sure we restore the 3D state next time.
- */
- dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
- mga_dma_dispatch_clear(dev, clear.flags,
- clear.clear_color,
- clear.clear_depth,
- clear.clear_color_mask,
- clear.clear_depth_mask);
- PRIMUPDATE(dev_priv);
- mga_flush_write_combine();
- mga_dma_schedule(dev, 1);
- return 0;
-}
-
-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_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
- drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
-
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_swap_bufs called without lock held\n");
- return -EINVAL;
- }
+ WRAP_TEST_WITH_RETURN( dev_priv );
- if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
- sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
+ mga_dma_dispatch_swap( dev );
/* Make sure we restore the 3D state next time.
*/
- dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX;
- mga_dma_dispatch_swap(dev);
- PRIMUPDATE(dev_priv);
- set_bit(MGA_BUF_SWAP_PENDING,
- &dev_priv->current_prim->buffer_status);
- mga_flush_write_combine();
- mga_dma_schedule(dev, 1);
+ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;
+
return 0;
}
-int mga_iload(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+int mga_dma_vertex( 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_private_t *dev_priv = dev->dev_private;
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;
drm_buf_t *buf;
drm_mga_buf_priv_t *buf_priv;
- drm_mga_iload_t iload;
- unsigned long bus_address;
+ drm_mga_vertex_t vertex;
- if (copy_from_user(&iload, (drm_mga_iload_t *) arg, sizeof(iload)))
- return -EFAULT;
+ LOCK_TEST_WITH_RETURN( dev );
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_iload called without lock held\n");
- return -EINVAL;
- }
+ if ( copy_from_user( &vertex,
+ (drm_mga_vertex_t *)arg,
+ sizeof(vertex) ) )
+ return -EFAULT;
- buf = dma->buflist[iload.idx];
+ buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private;
- bus_address = buf->bus_address;
- if (mgaVerifyIload(dev_priv,
- bus_address, iload.destOrg, iload.length)) {
- mga_freelist_put(dev, buf);
+ buf->used = vertex.used;
+ buf_priv->discard = vertex.discard;
+
+ if ( !mga_verify_state( dev_priv ) ) {
+ if ( vertex.discard ) {
+ if ( buf_priv->dispatched == 1 )
+ AGE_BUFFER( buf_priv );
+ buf_priv->dispatched = 0;
+ mga_freelist_put( dev, buf );
+ }
return -EINVAL;
}
- sarea_priv->dirty |= MGA_UPLOAD_CTX;
+ WRAP_TEST_WITH_RETURN( dev_priv );
+
+ mga_dma_dispatch_vertex( dev, buf );
- mga_dma_dispatch_tex_blit(dev, bus_address, iload.length,
- iload.destOrg);
- AGEBUF(dev_priv, buf_priv);
- buf_priv->discard = 1;
- mga_freelist_put(dev, buf);
- mga_flush_write_combine();
- mga_dma_schedule(dev, 1);
return 0;
}
-int mga_vertex(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+int mga_dma_indices( 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_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_device_dma_t *dma = dev->dma;
drm_buf_t *buf;
drm_mga_buf_priv_t *buf_priv;
- drm_mga_vertex_t vertex;
+ drm_mga_indices_t indices;
- if (copy_from_user(&vertex, (drm_mga_vertex_t *) arg, sizeof(vertex)))
- return -EFAULT;
+ LOCK_TEST_WITH_RETURN( dev );
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_vertex called without lock held\n");
- return -EINVAL;
- }
+ if ( copy_from_user( &indices,
+ (drm_mga_indices_t *)arg,
+ sizeof(indices) ) )
+ return -EFAULT;
- buf = dma->buflist[vertex.idx];
+ buf = dma->buflist[indices.idx];
buf_priv = buf->dev_private;
- buf->used = vertex.used;
- buf_priv->discard = vertex.discard;
+ buf_priv->discard = indices.discard;
- if (!mgaVerifyState(dev_priv)) {
- if (vertex.discard) {
- if (buf_priv->dispatched == 1)
- AGEBUF(dev_priv, buf_priv);
+ if ( !mga_verify_state( dev_priv ) ) {
+ if ( indices.discard ) {
+ if ( buf_priv->dispatched == 1 )
+ AGE_BUFFER( buf_priv );
buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
+ mga_freelist_put( dev, buf );
}
return -EINVAL;
}
- mga_dma_dispatch_vertex(dev, buf);
+ WRAP_TEST_WITH_RETURN( dev_priv );
+
+ mga_dma_dispatch_indices( dev, buf, indices.start, indices.end );
- PRIMUPDATE(dev_priv);
- mga_flush_write_combine();
- mga_dma_schedule(dev, 1);
return 0;
}
-
-int mga_indices(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+int mga_dma_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_private_t *dev_priv =
- (drm_mga_private_t *) dev->dev_private;
drm_device_dma_t *dma = dev->dma;
+ drm_mga_private_t *dev_priv = dev->dev_private;
drm_buf_t *buf;
drm_mga_buf_priv_t *buf_priv;
- drm_mga_indices_t indices;
+ drm_mga_iload_t iload;
+ DRM_DEBUG( __FUNCTION__ ":\n" );
- if (copy_from_user(&indices,
- (drm_mga_indices_t *)arg, sizeof(indices)))
+ LOCK_TEST_WITH_RETURN( dev );
+
+ if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) )
return -EFAULT;
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_indices called without lock held\n");
- return -EINVAL;
- }
+ if ( mga_do_wait_for_idle( dev_priv ) < 0 )
+ return -EBUSY;
- buf = dma->buflist[indices.idx];
+ buf = dma->buflist[iload.idx];
buf_priv = buf->dev_private;
- buf_priv->discard = indices.discard;
-
- if (!mgaVerifyState(dev_priv)) {
- if (indices.discard) {
- if (buf_priv->dispatched == 1)
- AGEBUF(dev_priv, buf_priv);
- buf_priv->dispatched = 0;
- mga_freelist_put(dev, buf);
- }
+#if 0
+ DRM_INFO( " verifying iload...\n" );
+ if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) {
+ mga_freelist_put( dev, buf );
return -EINVAL;
}
+ DRM_INFO( " verifying iload... done.\n" );
+#endif
- mga_dma_dispatch_indices(dev, buf, indices.start, indices.end);
-
- PRIMUPDATE(dev_priv);
- mga_flush_write_combine();
- mga_dma_schedule(dev, 1);
- return 0;
-}
-
+ WRAP_TEST_WITH_RETURN( dev_priv );
+ mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length );
-static int mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d)
-{
- int i;
- drm_buf_t *buf;
+ /* Make sure we restore the 3D state next time.
+ */
+ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;
- for (i = d->granted_count; i < d->request_count; i++) {
- buf = mga_freelist_get(dev);
- if (!buf)
- break;
- buf->pid = current->pid;
- if (copy_to_user(&d->request_indices[i],
- &buf->idx, sizeof(buf->idx)))
- return -EFAULT;
- if (copy_to_user(&d->request_sizes[i],
- &buf->total, sizeof(buf->total)))
- return -EFAULT;
- ++d->granted_count;
- }
return 0;
}
-int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+int mga_dma_blit( 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;
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
+ drm_mga_blit_t blit;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ LOCK_TEST_WITH_RETURN( dev );
- if (copy_from_user(&d, (drm_dma_t *) arg, sizeof(d)))
+ if ( copy_from_user( &blit, (drm_mga_blit_t *)arg, sizeof(blit) ) )
return -EFAULT;
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("mga_dma called without lock held\n");
- return -EINVAL;
- }
+ if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
+ sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
- /* Please don't send us buffers.
- */
- if (d.send_count != 0) {
- DRM_ERROR
- ("Process %d trying to send %d buffers via drmDMA\n",
- current->pid, d.send_count);
+ if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) )
return -EINVAL;
- }
- /* We'll send you buffers.
- */
- 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;
- }
+ WRAP_TEST_WITH_RETURN( dev_priv );
- d.granted_count = 0;
+ mga_dma_dispatch_blit( dev, &blit );
- if (d.request_count) {
- retcode = mga_dma_get_buffers(dev, &d);
- }
+ /* Make sure we restore the 3D state next time.
+ */
+ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;
- if (copy_to_user((drm_dma_t *) arg, &d, sizeof(d)))
- return -EFAULT;
- return retcode;
+ return 0;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h
new file mode 100644
index 000000000..fa0f82ec9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h
@@ -0,0 +1,11645 @@
+/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*-
+ * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com
+ *
+ * Copyright 1999 Matrox Graphics Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Kernel-based WARP engine management:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+/*
+ * WARP pipes are named according to the functions they perform, where:
+ *
+ * - T stands for computation of texture stage 0
+ * - T2 stands for computation of both texture stage 0 and texture stage 1
+ * - G stands for computation of triangle intensity (Gouraud interpolation)
+ * - Z stands for computation of Z buffer interpolation
+ * - S stands for computation of specular highlight
+ * - A stands for computation of the alpha channel
+ * - F stands for computation of vertex fog interpolation
+ */
+
+static 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,
+
+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, 0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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,
+
+};
+
+static 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, 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, 0x08, 0xCD,
+
+0xB9, 0x41, 0x49, 0xBB,
+0x1F, 0xF0, 0x41, 0xCD,
+
+0x51, 0x3C, 0x51, 0xA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, 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,
+
+0x79, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x77, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC8, 0x40, 0xC0, 0xEC,
+0x00, 0x80, 0x00, 0xE8,
+
+0x74, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+
+static 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, 0x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20, 0xEA,
+0x19, 0xC8, 0xC1, 0xCD,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+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,
+
+0x73, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x71, 0xFF, 0x20, 0xEA,
+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,
+
+};
+
+static unsigned char warp_g200_tgzf[] = {
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00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, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+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,
+
+0x77, 0xFF, 0x0A, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0xC9, 0x41, 0xC8, 0xEC,
+0x42, 0xE1,
+0x00, 0xE0,
+
+0x75, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+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,
+
+};
+
+static 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, 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,
+
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7, 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,
+
+};
+
+static 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,
+0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
+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,
+
+};
+
+static 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, 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, 0xE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 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x00, 0x80, 0x00, 0xE8,
+0x00, 0x80, 0x00, 0xE8,
+
+};
+
+static 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, 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,
+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x90, 0xE2,
+0x00, 0xE0,
+
+0x68, 0xFF, 0x20, 0xEA,
+0x19, 0xC8, 0xC1, 0xCD,
+
+0x1F, 0xD7, 0x18, 0xBD,
+0x3F, 0xD7, 0x22, 0xBD,
+
+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,
+
+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,
+
+};
+
+static unsigned char warp_g400_t2gz[] = {
+
+0x00, 0x8A, 0x98, 0xE9,
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0x3C, 0x80, 0x3C, 0xBD,
+
+0x33, 0xD7, 0x0B, 0xBD,
+0x3B, 0xD7, 0x1B, 0xBD,
+
+0x48, 0x80, 0x48, 0xCF,
+0x59, 0x80, 0x59, 0xCF,
+
+0x68, 0x33, 0x68, 0xCF,
+0x49, 0x3B, 0x49, 0xCF,
+
+0xBE, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x58, 0x33, 0x58, 0xCF,
+0x69, 0x3B, 0x69, 0xCF,
+
+0x7D, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_t2gza[] = {
+
+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,
+
+0x7C,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, 0x2B, 0xDE, 0xE8,
+0x1B, 0x80, 0xDE, 0xE8,
+
+0x34, 0x80, 0x34, 0xBD,
+0x3C, 0x80, 0x3C, 0xBD,
+
+0x33, 0xD7, 0x0B, 0xBD,
+0x3B, 0xD7, 0x1B, 0xBD,
+
+0x48, 0x80, 0x48, 0xCF,
+0x59, 0x80, 0x59, 0xCF,
+
+0x68, 0x33, 0x68, 0xCF,
+0x49, 0x3B, 0x49, 0xCF,
+
+0xBB, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x58, 0x33, 0x58, 0xCF,
+0x69, 0x3B, 0x69, 0xCF,
+
+0x78, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_t2gzs[] = {
+
+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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A,
+0x00, 0x80, 0x00, 0xE8,
+
+0x58, 0x33, 0x58, 0xCF,
+0x69, 0x3B, 0x69, 0xCF,
+
+0x67, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_t2gzsf[] = {
+
+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,
+
+0x8A, 0x80, 0x15, 0xEA,
+0x10, 0x04,
+0x20, 0x04,
+
+0x61, 0x51, 0xE0, 0xEC,
+0x2F, 0x41, 0x60, 0xEA,
+
+0x31, 0x20,
+0x39, 0x20,
+0x1F, 0x42, 0xA0, 0xE8,
+
+0x2A, 0x42, 0x52, 0xBF,
+0x0F, 0x52, 0xA0, 0xE8,
+
+0x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EC,
+
+0x0B, 0x2B, 0xDE, 0xE8,
+0x1B, 0x80, 0xDE, 0xE8,
+
+0x34, 0x80, 0x34, 0xBD,
+0x3C, 0x80, 0x3C, 0xBD,
+
+0x33, 0xD7, 0x0B, 0xBD,
+0x3B, 0xD7, 0x1B, 0xBD,
+
+0x48, 0x80, 0x48, 0xCF,
+0x59, 0x80, 0x59, 0xCF,
+
+0x68, 0x33, 0x68, 0xCF,
+0x49, 0x3B, 0x49, 0xCF,
+
+0xAD, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x58, 0x33, 0x58, 0xCF,
+0x69, 0x3B, 0x69, 0xCF,
+
+0x6B, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgz[] = {
+
+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,
+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0xD7, 0x1C, 0xBD,
+0x3B, 0xD7, 0x23, 0xBD,
+
+0x46, 0x80, 0x46, 0xCF,
+0x4F, 0x80, 0x4F, 0xCF,
+
+0x56, 0x33, 0x56, 0xCF,
+0x47, 0x3B, 0x47, 0xCF,
+
+0xD6, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x4E, 0x33, 0x4E, 0xCF,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x9D, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgza[] = {
+
+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,
+
+0x5C, 0x80, 0x15, 0xEA,
+0x08, 0x04,
+0x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, 0xE8,
+0x23, 0x80, 0xDE, 0xE8,
+
+0x36, 0x80, 0x36, 0xBD,
+0x3E, 0x80, 0x3E, 0xBD,
+
+0x33, 0xD7, 0x1C, 0xBD,
+0x3B, 0xD7, 0x23, 0xBD,
+
+0x46, 0x80, 0x46, 0xCF,
+0x4F, 0x80, 0x4F, 0xCF,
+
+0x56, 0x33, 0x56, 0xCF,
+0x47, 0x3B, 0x47, 0xCF,
+
+0xD3, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x4E, 0x33, 0x4E, 0xCF,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x99, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgzaf[] = {
+
+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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,
+0x00, 0xE0,
+
+0x1D, 0x00,
+0x24, 0x00,
+0x2C, 0x00,
+0x00, 0xE0,
+
+0x1C, 0x65,
+0x23, 0x65,
+0x2B, 0x65,
+0x00, 0xE0,
+
+0x1D, 0x65,
+0x24, 0x65,
+0x2C, 0x65,
+0x00, 0xE0,
+
+0x1C, 0x23, 0x60, 0xEC,
+0x36, 0xD7, 0x36, 0xAD,
+
+0x2B, 0x80, 0x60, 0xEC,
+0x1D, 0x24, 0x60, 0xEC,
+
+0x3E, 0xD7, 0x3E, 0xAD,
+0x2C, 0x80, 0x60, 0xEC,
+
+0x1C, 0x2B, 0xDE, 0xE8,
+0x23, 0x80, 0xDE, 0xE8,
+
+0x36, 0x80, 0x36, 0xBD,
+0x3E, 0x80, 0x3E, 0xBD,
+
+0x33, 0xD7, 0x1C, 0xBD,
+0x3B, 0xD7, 0x23, 0xBD,
+
+0x46, 0x80, 0x46, 0xCF,
+0x4F, 0x80, 0x4F, 0xCF,
+
+0x56, 0x33, 0x56, 0xCF,
+0x47, 0x3B, 0x47, 0xCF,
+
+0xCD, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x4E, 0x33, 0x4E, 0xCF,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x94, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned 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,
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0x36, 0xBD,
+0x3E, 0x80, 0x3E, 0xBD,
+
+0x33, 0xD7, 0x1C, 0xBD,
+0x3B, 0xD7, 0x23, 0xBD,
+
+0x46, 0x80, 0x46, 0xCF,
+0x4F, 0x80, 0x4F, 0xCF,
+
+0x56, 0x33, 0x56, 0xCF,
+0x47, 0x3B, 0x47, 0xCF,
+
+0xCA, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x4E, 0x33, 0x4E, 0xCF,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x90, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgzsa[] = {
+
+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, 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,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x8B, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgzsaf[] = {
+
+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,
+
+0x6E, 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,
+
+0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0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
+
+static unsigned char warp_g400_tgzsf[] = {
+
+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,
+
+0x6A, 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,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8,
+
+0x24, 0x4F, 0xA0, 0xE8,
+0x2C, 0x57, 0xA0, 0xE8,
+
+0x1C, 0x00,
+0x23, 0x00,
+0x2B, 0x00,
+0x00, 0xE0,
+
+0x1D, 0x00,
+0x24, 0x00,
+0x2C, 0x00,
+0x00, 0xE0,
+
+0x1C, 0x65,
+0x23, 0x65,
+0x2B, 0x65,
+0x00, 0xE0,
+
+0x1D, 0x65,
+0x24, 0x65,
+0x2C, 0x65,
+0x00, 0xE0,
+
+0x1C, 0x23, 0x60, 0xEC,
+0x36, 0xD7, 0x36, 0xAD,
+
+0x2B, 0x80, 0x60, 0xEC,
+0x1D, 0x24, 0x60, 0xEC,
+
+0x3E, 0xD7, 0x3E, 0xAD,
+0x2C, 0x80, 0x60, 0xEC,
+
+0x1C, 0x2B, 0xDE, 0xE8,
+0x23, 0x80, 0xDE, 0xE8,
+
+0x36, 0x80, 0x36, 0xBD,
+0x3E, 0x80, 0x3E, 0xBD,
+
+0x33, 0xD7, 0x1C, 0xBD,
+0x3B, 0xD7, 0x23, 0xBD,
+
+0x46, 0x80, 0x46, 0xCF,
+0x4F, 0x80, 0x4F, 0xCF,
+
+0x56, 0x33, 0x56, 0xCF,
+0x47, 0x3B, 0x47, 0xCF,
+
+0xC5, 0xFF, 0x20, 0xEA,
+0x00, 0x80, 0x00, 0xE8,
+
+0x4E, 0x33, 0x4E, 0xCF,
+0x57, 0x3B, 0x57, 0xCF,
+
+0x8B, 0xFF, 0x20, 0xEA,
+0x57, 0xC0, 0xBF, 0xEA,
+
+0x00, 0x80, 0xA0, 0xE9,
+0x00, 0x00, 0xD8, 0xEC,
+
+};
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c
new file mode 100644
index 000000000..5994ab0c0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c
@@ -0,0 +1,215 @@
+/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*-
+ * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#define __NO_VERSION__
+#include "mga.h"
+#include "drmP.h"
+#include "mga_drv.h"
+#include "mga_ucode.h"
+
+
+#define MGA_WARP_CODE_ALIGN 256 /* in bytes */
+
+#define WARP_UCODE_SIZE( which ) \
+ ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN)
+
+#define WARP_UCODE_INSTALL( which, where ) \
+do { \
+ DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\
+ dev_priv->warp_pipe_phys[where] = pcbase; \
+ memcpy( vcbase, which, sizeof(which) ); \
+ pcbase += WARP_UCODE_SIZE( which ); \
+ vcbase += WARP_UCODE_SIZE( which ); \
+} while (0)
+
+
+static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv )
+{
+ unsigned int size;
+
+ size = ( WARP_UCODE_SIZE( warp_g400_tgz ) +
+ WARP_UCODE_SIZE( warp_g400_tgza ) +
+ WARP_UCODE_SIZE( warp_g400_tgzaf ) +
+ WARP_UCODE_SIZE( warp_g400_tgzf ) +
+ WARP_UCODE_SIZE( warp_g400_tgzs ) +
+ WARP_UCODE_SIZE( warp_g400_tgzsa ) +
+ WARP_UCODE_SIZE( warp_g400_tgzsaf ) +
+ WARP_UCODE_SIZE( warp_g400_tgzsf ) +
+ WARP_UCODE_SIZE( warp_g400_t2gz ) +
+ WARP_UCODE_SIZE( warp_g400_t2gza ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzaf ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzf ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzs ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzsa ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzsaf ) +
+ WARP_UCODE_SIZE( warp_g400_t2gzsf ) );
+
+ size = PAGE_ALIGN( size );
+
+ DRM_DEBUG( "G400 ucode size = %d bytes\n", size );
+ return size;
+}
+
+static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv )
+{
+ unsigned int size;
+
+ size = ( WARP_UCODE_SIZE( warp_g200_tgz ) +
+ WARP_UCODE_SIZE( warp_g200_tgza ) +
+ WARP_UCODE_SIZE( warp_g200_tgzaf ) +
+ WARP_UCODE_SIZE( warp_g200_tgzf ) +
+ WARP_UCODE_SIZE( warp_g200_tgzs ) +
+ WARP_UCODE_SIZE( warp_g200_tgzsa ) +
+ WARP_UCODE_SIZE( warp_g200_tgzsaf ) +
+ WARP_UCODE_SIZE( warp_g200_tgzsf ) );
+
+ size = PAGE_ALIGN( size );
+
+ DRM_DEBUG( "G200 ucode size = %d bytes\n", size );
+ return size;
+}
+
+static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv )
+{
+ unsigned char *vcbase = dev_priv->warp->handle;
+ unsigned long pcbase = dev_priv->warp->offset;
+ unsigned int size;
+
+ size = mga_warp_g400_microcode_size( dev_priv );
+ if ( size > dev_priv->warp->size ) {
+ DRM_ERROR( "microcode too large! (%u > %lu)\n",
+ size, dev_priv->warp->size );
+ return -ENOMEM;
+ }
+
+ memset( dev_priv->warp_pipe_phys, 0,
+ sizeof(dev_priv->warp_pipe_phys) );
+
+ WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ );
+ WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF );
+ WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA );
+ WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF );
+ WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS );
+ WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF );
+ WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA );
+ WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF );
+
+ WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ );
+ WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF );
+ WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA );
+ WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF );
+ WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS );
+ WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF );
+ WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA );
+ WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF );
+
+ return 0;
+}
+
+static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv )
+{
+ unsigned char *vcbase = dev_priv->warp->handle;
+ unsigned long pcbase = dev_priv->warp->offset;
+ unsigned int size;
+
+ size = mga_warp_g200_microcode_size( dev_priv );
+ if ( size > dev_priv->warp->size ) {
+ DRM_ERROR( "microcode too large! (%u > %lu)\n",
+ size, dev_priv->warp->size );
+ return -ENOMEM;
+ }
+
+ memset( dev_priv->warp_pipe_phys, 0,
+ sizeof(dev_priv->warp_pipe_phys) );
+
+ WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ );
+ WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF );
+ WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA );
+ WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF );
+ WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS );
+ WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF );
+ WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA );
+ WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF );
+
+ return 0;
+}
+
+int mga_warp_install_microcode( drm_device_t *dev )
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ switch ( dev_priv->chipset ) {
+ case MGA_CARD_TYPE_G400:
+ return mga_warp_install_g400_microcode( dev_priv );
+ case MGA_CARD_TYPE_G200:
+ return mga_warp_install_g200_microcode( dev_priv );
+ default:
+ return -EINVAL;
+ }
+}
+
+#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE)
+
+int mga_warp_init( drm_device_t *dev )
+{
+ drm_mga_private_t *dev_priv = dev->dev_private;
+ u32 wmisc;
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ /* FIXME: Get rid of these damned magic numbers...
+ */
+ switch ( dev_priv->chipset ) {
+ case MGA_CARD_TYPE_G400:
+ MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND );
+ MGA_WRITE( MGA_WGETMSB, 0x00000E00 );
+ MGA_WRITE( MGA_WVRTXSZ, 0x00001807 );
+ MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 );
+ break;
+ case MGA_CARD_TYPE_G200:
+ MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND );
+ MGA_WRITE( MGA_WGETMSB, 0x1606 );
+ MGA_WRITE( MGA_WVRTXSZ, 7 );
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE |
+ MGA_WMASTER_ENABLE |
+ MGA_WCACHEFLUSH_ENABLE) );
+ wmisc = MGA_READ( MGA_WMISC );
+ if ( wmisc != WMISC_EXPECTED ) {
+ DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n",
+ wmisc, WMISC_EXPECTED );
+ return -EINVAL;
+ }
+
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h
new file mode 100644
index 000000000..83e002afa
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h
@@ -0,0 +1,79 @@
+/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*-
+ * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __R128_H__
+#define __R128_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) r128_##x
+
+/* General customization:
+ */
+#define __HAVE_AGP 1
+#define __MUST_HAVE_AGP 1
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+/* Driver customization:
+ */
+#define DRIVER_PRERELEASE() do { \
+ if ( dev->dev_private ) { \
+ drm_r128_private_t *dev_priv = dev->dev_private; \
+ if ( dev_priv->page_flipping ) { \
+ r128_do_cleanup_pageflip( dev ); \
+ } \
+ } \
+} while (0)
+
+#define DRIVER_PRETAKEDOWN() do { \
+ if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \
+} while (0)
+
+/* DMA customization:
+ */
+#define __HAVE_DMA 1
+
+#if 0
+/* GH: Remove this for now... */
+#define __HAVE_DMA_QUIESCENT 1
+#define DRIVER_DMA_QUIESCENT() do { \
+ drm_r128_private_t *dev_priv = dev->dev_private; \
+ return r128_do_cce_idle( dev_priv ); \
+} while (0)
+#endif
+
+/* Buffer customization:
+ */
+#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t
+
+#define DRIVER_AGP_BUFFERS_MAP( dev ) \
+ ((drm_r128_private_t *)((dev)->dev_private))->buffers
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c
index 6df2b45ad..c0e20c213 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c
@@ -25,11 +25,11 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
+ * Gareth Hughes <gareth@valinux.com>
*/
#define __NO_VERSION__
+#include "r128.h"
#include "drmP.h"
#include "r128_drv.h"
@@ -85,26 +85,6 @@ static u32 r128_cce_microcode[] = {
};
-#define DO_IOREMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size)
-
-#define DO_IOREMAPFREE(_m) \
- do { \
- if ((_m)->handle && (_m)->size) \
- drm_ioremapfree((_m)->handle, (_m)->size); \
- } while (0)
-
-#define DO_FIND_MAP(_m, _o) \
- do { \
- int _i; \
- for (_i = 0; _i < dev->map_count; _i++) { \
- if (dev->maplist[_i]->offset == _o) { \
- _m = dev->maplist[_i]; \
- break; \
- } \
- } \
- } while (0)
-
-
int R128_READ_PLL(drm_device_t *dev, int addr)
{
drm_r128_private_t *dev_priv = dev->dev_private;
@@ -169,7 +149,7 @@ static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries )
return -EBUSY;
}
-static int r128_do_wait_for_idle( drm_r128_private_t *dev_priv )
+int r128_do_wait_for_idle( drm_r128_private_t *dev_priv )
{
int i, ret;
@@ -223,7 +203,7 @@ static void r128_do_cce_flush( drm_r128_private_t *dev_priv )
/* Wait for the CCE to go idle.
*/
-static int r128_do_cce_idle( drm_r128_private_t *dev_priv )
+int r128_do_cce_idle( drm_r128_private_t *dev_priv )
{
int i;
@@ -364,9 +344,9 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev )
static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
{
drm_r128_private_t *dev_priv;
- int i;
+ struct list_head *list;
- dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER );
+ dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
return -ENOMEM;
dev->dev_private = (void *)dev_priv;
@@ -380,7 +360,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
* the CCE ring code.
*/
if ( dev_priv->is_pci ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -388,7 +368,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv->usec_timeout = init->usec_timeout;
if ( dev_priv->usec_timeout < 1 ||
dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -407,7 +387,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
( init->cce_mode != R128_PM4_128BM_64INDBM ) &&
( init->cce_mode != R128_PM4_64BM_128INDBM ) &&
( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -433,13 +413,30 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
break;
}
- dev_priv->fb_bpp = init->fb_bpp;
+ switch ( init->fb_bpp ) {
+ case 16:
+ dev_priv->color_fmt = R128_DATATYPE_RGB565;
+ break;
+ case 32:
+ default:
+ dev_priv->color_fmt = R128_DATATYPE_ARGB8888;
+ break;
+ }
dev_priv->front_offset = init->front_offset;
dev_priv->front_pitch = init->front_pitch;
dev_priv->back_offset = init->back_offset;
dev_priv->back_pitch = init->back_pitch;
- dev_priv->depth_bpp = init->depth_bpp;
+ switch ( init->depth_bpp ) {
+ case 16:
+ dev_priv->depth_fmt = R128_DATATYPE_RGB565;
+ break;
+ case 24:
+ case 32:
+ default:
+ dev_priv->depth_fmt = R128_DATATYPE_ARGB8888;
+ break;
+ }
dev_priv->depth_offset = init->depth_offset;
dev_priv->depth_pitch = init->depth_pitch;
dev_priv->span_offset = init->span_offset;
@@ -454,39 +451,34 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) |
(dev_priv->span_offset >> 5));
- /* FIXME: We want multiple shared areas, including one shared
- * only by the X Server and kernel module.
- */
- for ( i = 0 ; i < dev->map_count ; i++ ) {
- if ( dev->maplist[i]->type == _DRM_SHM ) {
- dev_priv->sarea = dev->maplist[i];
- break;
- }
- }
-
- DO_FIND_MAP( dev_priv->fb, init->fb_offset );
- DO_FIND_MAP( dev_priv->mmio, init->mmio_offset );
- DO_FIND_MAP( dev_priv->cce_ring, init->ring_offset );
- DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
- DO_FIND_MAP( dev_priv->buffers, init->buffers_offset );
+ list_for_each(list, &dev->maplist->head) {
+ drm_map_list_t *r_list = (drm_map_list_t *)list;
+ if( r_list->map &&
+ r_list->map->type == _DRM_SHM &&
+ r_list->map->flags & _DRM_CONTAINS_LOCK ) {
+ dev_priv->sarea = r_list->map;
+ break;
+ }
+ }
+
+ DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
+ DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
+ DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset );
+ DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
+ DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
if ( !dev_priv->is_pci ) {
- DO_FIND_MAP( dev_priv->agp_textures,
- init->agp_textures_offset );
+ DRM_FIND_MAP( dev_priv->agp_textures,
+ init->agp_textures_offset );
}
dev_priv->sarea_priv =
(drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
- DO_IOREMAP( dev_priv->cce_ring );
- DO_IOREMAP( dev_priv->ring_rptr );
- DO_IOREMAP( dev_priv->buffers );
-#if 0
- if ( !dev_priv->is_pci ) {
- DO_IOREMAP( dev_priv->agp_textures );
- }
-#endif
+ DRM_IOREMAP( dev_priv->cce_ring );
+ DRM_IOREMAP( dev_priv->ring_rptr );
+ DRM_IOREMAP( dev_priv->buffers );
dev_priv->ring.head = ((__volatile__ u32 *)
dev_priv->ring_rptr->handle);
@@ -495,11 +487,13 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle
+ init->ring_size / sizeof(u32));
dev_priv->ring.size = init->ring_size;
- dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 );
+ dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 );
dev_priv->ring.tail_mask =
(dev_priv->ring.size / sizeof(u32)) - 1;
+ dev_priv->ring.high_mark = 128;
+
dev_priv->sarea_priv->last_frame = 0;
R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame );
@@ -514,22 +508,17 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
return 0;
}
-static int r128_do_cleanup_cce( drm_device_t *dev )
+int r128_do_cleanup_cce( drm_device_t *dev )
{
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
- DO_IOREMAPFREE( dev_priv->cce_ring );
- DO_IOREMAPFREE( dev_priv->ring_rptr );
- DO_IOREMAPFREE( dev_priv->buffers );
-#if 0
- if ( !dev_priv->is_pci ) {
- DO_IOREMAPFREE( dev_priv->agp_textures );
- }
-#endif
+ DRM_IOREMAPFREE( dev_priv->cce_ring );
+ DRM_IOREMAPFREE( dev_priv->ring_rptr );
+ DRM_IOREMAPFREE( dev_priv->buffers );
- drm_free( dev->dev_private, sizeof(drm_r128_private_t),
- DRM_MEM_DRIVER );
+ DRM(free)( dev->dev_private, sizeof(drm_r128_private_t),
+ DRM_MEM_DRIVER );
dev->dev_private = NULL;
}
@@ -564,11 +553,8 @@ int r128_cce_start( struct inode *inode, struct file *filp,
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) {
DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ );
return 0;
@@ -592,11 +578,7 @@ int r128_cce_stop( struct inode *inode, struct file *filp,
int ret;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &stop, (drm_r128_init_t *)arg, sizeof(stop) ) )
return -EFAULT;
@@ -638,11 +620,8 @@ int r128_cce_reset( struct inode *inode, struct file *filp,
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv ) {
DRM_DEBUG( "%s called before init done\n", __FUNCTION__ );
return -EINVAL;
@@ -664,11 +643,7 @@ int r128_cce_idle( struct inode *inode, struct file *filp,
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( dev_priv->cce_running ) {
r128_do_cce_flush( dev_priv );
@@ -684,11 +659,7 @@ int r128_engine_reset( struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
return r128_do_engine_reset( dev );
}
@@ -737,11 +708,7 @@ int r128_fullscreen( struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_r128_fullscreen_t fs;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &fs, (drm_r128_fullscreen_t *)arg, sizeof(fs) ) )
return -EFAULT;
@@ -773,8 +740,8 @@ static int r128_freelist_init( drm_device_t *dev )
drm_r128_freelist_t *entry;
int i;
- dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t),
- DRM_MEM_DRIVER );
+ dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t),
+ DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
return -ENOMEM;
@@ -785,8 +752,8 @@ static int r128_freelist_init( drm_device_t *dev )
buf = dma->buflist[i];
buf_priv = buf->dev_private;
- entry = drm_alloc( sizeof(drm_r128_freelist_t),
- DRM_MEM_DRIVER );
+ entry = DRM(alloc)( sizeof(drm_r128_freelist_t),
+ DRM_MEM_DRIVER );
if ( !entry ) return -ENOMEM;
entry->age = R128_BUFFER_FREE;
@@ -872,13 +839,9 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n )
int i;
for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
- ring->space = *ring->head - ring->tail;
- if ( ring->space <= 0 )
- ring->space += ring->size;
-
+ r128_update_ring_snapshot( ring );
if ( ring->space >= n )
return 0;
-
udelay( 1 );
}
@@ -887,19 +850,6 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n )
return -EBUSY;
}
-void r128_update_ring_snapshot( drm_r128_private_t *dev_priv )
-{
- drm_r128_ring_buffer_t *ring = &dev_priv->ring;
-
- ring->space = *ring->head - ring->tail;
-#if R128_PERFORMANCE_BOXES
- if ( ring->space == 0 )
- atomic_inc( &dev_priv->idle_count );
-#endif
- if ( ring->space <= 0 )
- ring->space += ring->size;
-}
-
static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d )
{
int i;
@@ -932,15 +882,11 @@ int r128_cce_buffers( struct inode *inode, struct file *filp,
int ret = 0;
drm_dma_t d;
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) )
return -EFAULT;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
-
/* Please don't send us buffers.
*/
if ( d.send_count != 0 ) {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
index 94dba1ed9..86aba175f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
@@ -25,9 +25,8 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- *
+ * Kevin E. Martin <martin@valinux.com>
*/
#ifndef __R128_DRM_H__
@@ -142,12 +141,6 @@ typedef struct {
} drm_r128_texture_regs_t;
-typedef struct drm_tex_region {
- unsigned char next, prev;
- unsigned char in_use;
- int age;
-} drm_tex_region_t;
-
typedef struct drm_r128_sarea {
/* The channel for communication of state information to the kernel
* on firing a vertex buffer.
@@ -218,9 +211,10 @@ typedef struct drm_r128_fullscreen {
typedef struct drm_r128_clear {
unsigned int flags;
- int x, y, w, h;
unsigned int clear_color;
unsigned int clear_depth;
+ unsigned int color_mask;
+ unsigned int depth_mask;
} drm_r128_clear_t;
typedef struct drm_r128_vertex {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c
index cf2589251..daae0f875 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c
@@ -1,7 +1,7 @@
/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*-
* Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
@@ -19,693 +19,72 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * 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@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- *
*/
#include <linux/config.h>
+#include "r128.h"
#include "drmP.h"
#include "r128_drv.h"
-#define R128_NAME "r128"
-#define R128_DESC "ATI Rage 128"
-#define R128_DATE "20010101"
-#define R128_MAJOR 2
-#define R128_MINOR 1
-#define R128_PATCHLEVEL 4
-
-static drm_device_t r128_device;
-drm_ctx_t r128_res_ctx;
-
-static struct file_operations r128_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: r128_open,
- flush: drm_flush,
- release: r128_release,
- ioctl: r128_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-static struct miscdevice r128_misc = {
- minor: MISC_DYNAMIC_MINOR,
- name: R128_NAME,
- fops: &r128_fops,
-};
-
-static drm_ioctl_desc_t r128_ioctls[] = {
- [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { r128_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_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { r128_addbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { r128_mapbufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { r128_addctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { r128_rmctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { r128_modctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { r128_getctx, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { r128_switchctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { r128_newctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { r128_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)] = { r128_cce_buffers, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- [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 },
-#endif
-
- [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)]= { r128_fullscreen, 1, 0 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 },
-};
-#define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls)
-
-#ifdef MODULE
-static char *r128 = NULL;
-#endif
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("r128");
-MODULE_PARM(r128, "s");
-
-#ifndef MODULE
-/* r128_options 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.
- */
-
-static int __init r128_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("r128=", r128_options);
-#endif
-
-static int r128_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);
-
- r128_res_ctx.handle=-1;
-
- 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 r128_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");
-
- 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;
- }
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- /* 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();
-
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
- }
-#endif
-
- /* 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:
- /* Do nothing here, because this is all
- handled in the AGP/GART driver. */
- 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;
- }
-
- 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;
-}
-
-/* r128_init is called via init_module at module load time, or via
- * linux/init/main.c (this is not currently supported). */
-
-static int __init r128_init(void)
-{
- int retcode;
- drm_device_t *dev = &r128_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(r128);
-#endif
-
- if ((retcode = misc_register(&r128_misc))) {
- DRM_ERROR("Cannot register \"%s\"\n", R128_NAME);
- return retcode;
- }
- dev->device = MKDEV(MISC_MAJOR, r128_misc.minor);
- dev->name = R128_NAME;
-
- drm_mem_init();
- drm_proc_init(dev);
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- dev->agp = drm_agp_init();
- if (dev->agp == NULL) {
- DRM_ERROR("Cannot initialize agpgart module.\n");
- drm_proc_cleanup();
- misc_deregister(&r128_misc);
- r128_takedown(dev);
- return -ENOMEM;
- }
-
-#ifdef CONFIG_MTRR
- dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size*1024*1024,
- MTRR_TYPE_WRCOMB,
- 1);
-#endif
-#endif
-
- if((retcode = drm_ctxbitmap_init(dev))) {
- DRM_ERROR("Cannot allocate memory for context bitmap.\n");
- drm_proc_cleanup();
- misc_deregister(&r128_misc);
- r128_takedown(dev);
- return retcode;
- }
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
- R128_NAME,
- R128_MAJOR,
- R128_MINOR,
- R128_PATCHLEVEL,
- R128_DATE,
- r128_misc.minor);
-
- return 0;
-}
-
-/* r128_cleanup is called via cleanup_module at module unload time. */
-
-static void __exit r128_cleanup(void)
-{
- drm_device_t *dev = &r128_device;
-
- DRM_DEBUG("\n");
-
- drm_proc_cleanup();
- if (misc_deregister(&r128_misc)) {
- DRM_ERROR("Cannot unload module\n");
- } else {
- DRM_INFO("Module unloaded\n");
- }
- drm_ctxbitmap_cleanup(dev);
- r128_takedown(dev);
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- if (dev->agp) {
- drm_agp_uninit();
- drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-#endif
-}
-
-module_init(r128_init);
-module_exit(r128_cleanup);
-
-
-int r128_version(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -EFAULT; \
- }
-
- version.version_major = R128_MAJOR;
- version.version_minor = R128_MINOR;
- version.version_patchlevel = R128_PATCHLEVEL;
-
- DRM_COPY(version.name, R128_NAME);
- DRM_COPY(version.date, R128_DATE);
- DRM_COPY(version.desc, R128_DESC);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -EFAULT;
- return 0;
-}
-
-int r128_open(struct inode *inode, struct file *filp)
-{
- drm_device_t *dev = &r128_device;
- int retcode = 0;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_open_helper(inode, filp, dev))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- atomic_inc(&dev->total_open);
- spin_lock(&dev->count_lock);
- if (!dev->open_count++) {
- spin_unlock(&dev->count_lock);
- return r128_setup(dev);
- }
- spin_unlock(&dev->count_lock);
- }
-
- return retcode;
-}
-
-int r128_release(struct inode *inode, struct file *filp)
-{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
-
- /* Force the cleanup of page flipping when required */
- if ( dev->dev_private ) {
- drm_r128_private_t *dev_priv = dev->dev_private;
- if ( dev_priv->page_flipping ) {
- r128_do_cleanup_pageflip( dev );
- }
- }
-
- if (!(retcode = drm_release(inode, filp))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return r128_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- }
-
- unlock_kernel();
- return retcode;
-}
-
-/* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-int r128_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;
+#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
+
+#define DRIVER_NAME "r128"
+#define DRIVER_DESC "ATI Rage 128"
+#define DRIVER_DATE "20010308"
+
+#define DRIVER_MAJOR 2
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 5
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 },
- 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 >= R128_IOCTL_COUNT) {
- retcode = -EINVAL;
- } else {
- ioctl = &r128_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);
- }
- }
-
-#if 0
- if ( retcode ) {
- DRM_INFO( "%s 0x%x ret = %d\n", __FUNCTION__, nr, retcode );
- }
-#endif
-
- atomic_dec(&dev->ioctl_count);
- return retcode;
-}
-
-int r128_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;
-#if DRM_DMA_HISTOGRAM
- cycles_t start;
-
- dev->lck_start = start = get_cycles();
-#endif
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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 (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;
-
- if (!ret) {
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
- schedule();
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- }
-
- if (!ret) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
- if (lock.flags & _DRM_LOCK_READY) {
- /* Wait for space in DMA/FIFO */
- }
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- /* Make hardware quiescent */
- DRM_DEBUG( "not quiescent!\n" );
#if 0
- r128_quiescent(dev);
-#endif
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != r128_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY/4;
- }
-#endif
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
-
-#if DRM_DMA_HISTOGRAM
- atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
-#endif
-
- return ret;
-}
-
-
-int r128_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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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);
- /* FIXME: Try to send data to card here */
- if (!dev->context_flag) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- DRM_ERROR("\n");
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != r128_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY;
- }
-#endif
- unblock_all_signals();
- return 0;
-}
+/* GH: Count data sent to card via ring or vertex/indirect buffers.
+ */
+#define __HAVE_COUNTERS 3
+#define __HAVE_COUNTER6 _DRM_STAT_IRQ
+#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
+#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
+#endif
+
+
+#include "drm_agpsupport.h"
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
index 08ef5dc92..6216b9a1b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
@@ -25,10 +25,9 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ * Kevin E. Martin <martin@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
#ifndef __R128_DRV_H__
@@ -51,6 +50,8 @@ typedef struct drm_r128_ring_buffer {
u32 tail;
u32 tail_mask;
int space;
+
+ int high_mark;
} drm_r128_ring_buffer_t;
typedef struct drm_r128_private {
@@ -74,13 +75,13 @@ typedef struct drm_r128_private {
u32 crtc_offset;
u32 crtc_offset_cntl;
- unsigned int fb_bpp;
+ u32 color_fmt;
unsigned int front_offset;
unsigned int front_pitch;
unsigned int back_offset;
unsigned int back_pitch;
- unsigned int depth_bpp;
+ u32 depth_fmt;
unsigned int depth_offset;
unsigned int depth_pitch;
unsigned int span_offset;
@@ -107,18 +108,6 @@ typedef struct drm_r128_buf_priv {
drm_r128_freelist_t *list_entry;
} drm_r128_buf_priv_t;
- /* r128_drv.c */
-extern int r128_version( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int r128_open( struct inode *inode, struct file *filp );
-extern int r128_release( struct inode *inode, struct file *filp );
-extern int r128_ioctl( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int r128_lock( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int r128_unlock( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-
/* r128_cce.c */
extern int r128_cce_init( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
@@ -141,8 +130,17 @@ extern void r128_freelist_reset( drm_device_t *dev );
extern drm_buf_t *r128_freelist_get( drm_device_t *dev );
extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n );
-extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv );
+static inline void
+r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring )
+{
+ ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32);
+ if ( ring->space <= 0 )
+ ring->space += ring->size;
+}
+
+extern int r128_do_cce_idle( drm_r128_private_t *dev_priv );
+extern int r128_do_cleanup_cce( drm_device_t *dev );
extern int r128_do_cleanup_pageflip( drm_device_t *dev );
/* r128_state.c */
@@ -163,31 +161,6 @@ extern int r128_cce_stipple( struct inode *inode, struct file *filp,
extern int r128_cce_indirect( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
- /* r128_bufs.c */
-extern int r128_addbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_mapbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
- /* r128_context.c */
-extern int r128_resctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_addctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_modctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_getctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_switchctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_newctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int r128_rmctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-extern int r128_context_switch(drm_device_t *dev, int old, int new);
-extern int r128_context_switch_complete(drm_device_t *dev, int new);
-
/* Register definitions, register access macros and drmAddMap constants
* for Rage 128 kernel driver.
@@ -286,6 +259,8 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_TEX_CNTL_C 0x1c9c
# define R128_TEX_CACHE_FLUSH (1 << 23)
+#define R128_WAIT_UNTIL 0x1720
+# define R128_EVENT_CRTC_OFFSET (1 << 0)
#define R128_WINDOW_XY_OFFSET 0x1bcc
@@ -386,25 +361,29 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_WATERMARK_N 8
#define R128_WATERMARK_K 128
-#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */
+#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */
#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0
#define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1
#define R128_MAX_VB_AGE 0xffffffff
-
#define R128_MAX_VB_VERTS (0xffff)
+#define R128_RING_HIGH_MARK 128
+
+#define R128_PERFORMANCE_BOXES 0
+
#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle))
-#define R128_ADDR(reg) (R128_BASE(reg) + reg)
+#define R128_ADDR(reg) (R128_BASE( reg ) + reg)
-#define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg)
-#define R128_READ(reg) R128_DEREF(reg)
-#define R128_WRITE(reg,val) do { R128_DEREF(reg) = val; } while (0)
+#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg )
+#define R128_READ(reg) R128_DEREF( reg )
+#define R128_WRITE(reg,val) do { R128_DEREF( reg ) = val; } while (0)
+
+#define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg )
+#define R128_READ8(reg) R128_DEREF8( reg )
+#define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0)
-#define R128_DEREF8(reg) *(__volatile__ char *)R128_ADDR(reg)
-#define R128_READ8(reg) R128_DEREF8(reg)
-#define R128_WRITE8(reg,val) do { R128_DEREF8(reg) = val; } while (0)
#define R128_WRITE_PLL(addr,val) \
do { \
@@ -414,13 +393,6 @@ do { \
extern int R128_READ_PLL(drm_device_t *dev, int addr);
-#define R128CCE0(p,r,n) ((p) | ((n) << 16) | ((r) >> 2))
-#define R128CCE1(p,r1,r2) ((p) | (((r2) >> 2) << 11) | ((r1) >> 2))
-#define R128CCE2(p) ((p))
-#define R128CCE3(p,n) ((p) | ((n) << 16))
-
-
-
#define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \
((n) << 16) | ((reg) >> 2))
@@ -431,19 +403,71 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr);
(pkt) | ((n) << 16))
-#define r128_flush_write_combine() mb()
+/* ================================================================
+ * Misc helper macros
+ */
+
+#define LOCK_TEST_WITH_RETURN( dev ) \
+do { \
+ if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
+ dev->lock.pid != current->pid ) { \
+ DRM_ERROR( "%s called without lock held\n", \
+ __FUNCTION__ ); \
+ return -EINVAL; \
+ } \
+} while (0)
+
+#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \
+do { \
+ drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \
+ if ( ring->space < ring->high_mark ) { \
+ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \
+ r128_update_ring_snapshot( ring ); \
+ if ( ring->space >= ring->high_mark ) \
+ goto __ring_space_done; \
+ udelay( 1 ); \
+ } \
+ DRM_ERROR( "ring space check failed!\n" ); \
+ return -EBUSY; \
+ } \
+ __ring_space_done: \
+} while (0)
+
+#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \
+do { \
+ drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \
+ if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \
+ int __ret = r128_do_cce_idle( dev_priv ); \
+ if ( __ret < 0 ) return __ret; \
+ sarea_priv->last_dispatch = 0; \
+ r128_freelist_reset( dev ); \
+ } \
+} while (0)
+
+#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \
+ OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \
+ OUT_RING( R128_EVENT_CRTC_OFFSET ); \
+} while (0)
+
+
+/* ================================================================
+ * Ring control
+ */
+
+#define r128_flush_write_combine() mb()
#define R128_VERBOSE 0
-#define RING_LOCALS int write; unsigned int tail_mask; volatile u32 *ring;
+#define RING_LOCALS \
+ int write; unsigned int tail_mask; volatile u32 *ring;
#define BEGIN_RING( n ) do { \
if ( R128_VERBOSE ) { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \
(n), __FUNCTION__ ); \
} \
- if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \
+ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \
} \
dev_priv->ring.space -= (n) * sizeof(u32); \
@@ -452,11 +476,23 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr);
tail_mask = dev_priv->ring.tail_mask; \
} while (0)
+/* You can set this to zero if you want. If the card locks up, you'll
+ * need to keep this set. It works around a bug in early revs of the
+ * Rage 128 chipset, where the CCE would read 32 dwords past the end of
+ * the ring buffer before wrapping around.
+ */
+#define R128_BROKEN_CCE 1
+
#define ADVANCE_RING() do { \
if ( R128_VERBOSE ) { \
DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \
write, dev_priv->ring.tail ); \
} \
+ if ( R128_BROKEN_CCE && write < 32 ) { \
+ memcpy( dev_priv->ring.end, \
+ dev_priv->ring.start, \
+ write * sizeof(u32) ); \
+ } \
r128_flush_write_combine(); \
dev_priv->ring.tail = write; \
R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \
@@ -471,6 +507,4 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr);
write &= tail_mask; \
} while (0)
-#define R128_PERFORMANCE_BOXES 0
-
#endif /* __R128_DRV_H__ */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c
index ba0039293..9fc6b485c 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c
@@ -25,13 +25,14 @@
*
* Authors:
* Gareth Hughes <gareth@valinux.com>
- *
*/
#define __NO_VERSION__
+#include "r128.h"
#include "drmP.h"
#include "r128_drv.h"
#include "drm.h"
+#include <linux/delay.h>
/* ================================================================
@@ -360,45 +361,18 @@ static void r128_print_dirty( const char *msg, unsigned int flags )
}
static void r128_cce_dispatch_clear( drm_device_t *dev,
- unsigned int flags,
- int cx, int cy, int cw, int ch,
- unsigned int clear_color,
- unsigned int clear_depth )
+ drm_r128_clear_t *clear )
{
drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
int nbox = sarea_priv->nbox;
drm_clip_rect_t *pbox = sarea_priv->boxes;
- u32 fb_bpp, depth_bpp;
+ unsigned int flags = clear->flags;
int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
- switch ( dev_priv->fb_bpp ) {
- case 16:
- fb_bpp = R128_GMC_DST_16BPP;
- break;
- case 32:
- fb_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return;
- }
- switch ( dev_priv->depth_bpp ) {
- case 16:
- depth_bpp = R128_GMC_DST_16BPP;
- break;
- case 24:
- case 32:
- depth_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return;
- }
-
- if ( dev_priv->page_flipping && dev_priv->current_page == 1) {
+ if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) {
unsigned int tmp = flags;
flags &= ~(R128_FRONT | R128_BACK);
@@ -420,7 +394,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
BEGIN_RING( 2 );
OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) );
- OUT_RING( sarea_priv->context_state.plane_3d_mask_c );
+ OUT_RING( clear->color_mask );
ADVANCE_RING();
}
@@ -431,14 +405,14 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- fb_bpp |
+ (dev_priv->color_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS );
OUT_RING( dev_priv->front_pitch_offset_c );
- OUT_RING( clear_color );
+ OUT_RING( clear->clear_color );
OUT_RING( (x << 16) | y );
OUT_RING( (w << 16) | h );
@@ -452,14 +426,14 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- fb_bpp |
+ (dev_priv->color_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS );
OUT_RING( dev_priv->back_pitch_offset_c );
- OUT_RING( clear_color );
+ OUT_RING( clear->clear_color );
OUT_RING( (x << 16) | y );
OUT_RING( (w << 16) | h );
@@ -473,7 +447,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
@@ -481,7 +455,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev,
R128_GMC_WR_MSK_DIS );
OUT_RING( dev_priv->depth_pitch_offset_c );
- OUT_RING( clear_depth );
+ OUT_RING( clear->clear_depth );
OUT_RING( (x << 16) | y );
OUT_RING( (w << 16) | h );
@@ -497,29 +471,16 @@ static void r128_cce_dispatch_swap( drm_device_t *dev )
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
int nbox = sarea_priv->nbox;
drm_clip_rect_t *pbox = sarea_priv->boxes;
- u32 fb_bpp;
int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
#if R128_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
r128_cce_performance_boxes( dev_priv );
#endif
- switch ( dev_priv->fb_bpp ) {
- case 16:
- fb_bpp = R128_GMC_DST_16BPP;
- break;
- case 32:
- default:
- fb_bpp = R128_GMC_DST_32BPP;
- break;
- }
-
for ( i = 0 ; i < nbox ; i++ ) {
int x = pbox[i].x1;
int y = pbox[i].y1;
@@ -532,7 +493,7 @@ static void r128_cce_dispatch_swap( drm_device_t *dev )
OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL |
R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_NONE |
- fb_bpp |
+ (dev_priv->color_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_S |
R128_DP_SRC_SOURCE_MEMORY |
@@ -570,16 +531,15 @@ static void r128_cce_dispatch_flip( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page );
- r128_update_ring_snapshot( dev_priv );
-
#if R128_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
r128_cce_performance_boxes( dev_priv );
#endif
- BEGIN_RING( 2 );
+ BEGIN_RING( 4 );
+ R128_WAIT_UNTIL_PAGE_FLIPPED();
OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) );
if ( dev_priv->current_page == 0 ) {
@@ -613,7 +573,7 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev,
drm_r128_buf_priv_t *buf_priv = buf->dev_private;
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
int format = sarea_priv->vc_format;
- int offset = dev_priv->buffers->offset + buf->offset - dev->agp->base;
+ int offset = buf->bus_address;
int size = buf->used;
int prim = buf_priv->prim;
int i = 0;
@@ -621,8 +581,6 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev,
DRM_DEBUG( "%s: buf=%d nbox=%d\n",
__FUNCTION__, buf->idx, sarea_priv->nbox );
- r128_update_ring_snapshot( dev_priv );
-
if ( 0 )
r128_print_dirty( "dispatch_vertex", sarea_priv->dirty );
@@ -676,22 +634,10 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev,
dev_priv->sarea_priv->last_dispatch++;
-#if 0
- if ( dev_priv->submit_age == R128_MAX_VB_AGE ) {
- ret = r128_do_cce_idle( dev_priv );
- if ( ret < 0 ) return ret;
- dev_priv->submit_age = 0;
- r128_freelist_reset( dev );
- }
-#endif
-
sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS;
sarea_priv->nbox = 0;
}
-
-
-
static void r128_cce_dispatch_indirect( drm_device_t *dev,
drm_buf_t *buf,
int start, int end )
@@ -702,11 +648,8 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev,
DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n",
buf->idx, start, end );
- r128_update_ring_snapshot( dev_priv );
-
if ( start != end ) {
- int offset = (dev_priv->buffers->offset - dev->agp->base
- + buf->offset + start);
+ int offset = buf->bus_address + start;
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
@@ -750,15 +693,6 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev,
}
dev_priv->sarea_priv->last_dispatch++;
-
-#if 0
- if ( dev_priv->submit_age == R128_MAX_VB_AGE ) {
- ret = r128_do_cce_idle( dev_priv );
- if ( ret < 0 ) return ret;
- dev_priv->submit_age = 0;
- r128_freelist_reset( dev );
- }
-#endif
}
static void r128_cce_dispatch_indices( drm_device_t *dev,
@@ -778,8 +712,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count );
- r128_update_ring_snapshot( dev_priv );
-
if ( 0 )
r128_print_dirty( "dispatch_indices", sarea_priv->dirty );
@@ -839,15 +771,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev,
dev_priv->sarea_priv->last_dispatch++;
-#if 0
- if ( dev_priv->submit_age == R128_MAX_VB_AGE ) {
- ret = r128_do_cce_idle( dev_priv );
- if ( ret < 0 ) return ret;
- dev_priv->submit_age = 0;
- r128_freelist_reset( dev );
- }
-#endif
-
sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS;
sarea_priv->nbox = 0;
}
@@ -864,8 +787,6 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
/* The compiler won't optimize away a division by a variable,
* even if the only legal values are powers of two. Thus, we'll
* use a shift instead.
@@ -972,25 +893,10 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
int count, x, y;
u32 *buffer;
u8 *mask;
- u32 depth_bpp;
int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
- switch ( dev_priv->depth_bpp ) {
- case 16:
- depth_bpp = R128_GMC_DST_16BPP;
- break;
- case 24:
- case 32:
- depth_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return -EINVAL;
- }
-
count = depth->n;
if ( copy_from_user( &x, depth->x, sizeof(x) ) ) {
return -EFAULT;
@@ -1028,7 +934,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
@@ -1052,7 +958,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
@@ -1080,25 +986,10 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
int count, *x, *y;
u32 *buffer;
u8 *mask;
- u32 depth_bpp;
int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
- switch ( dev_priv->depth_bpp ) {
- case 16:
- depth_bpp = R128_GMC_DST_16BPP;
- break;
- case 24:
- case 32:
- depth_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return -EINVAL;
- }
-
count = depth->n;
x = kmalloc( count * sizeof(*x), 0 );
@@ -1159,7 +1050,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
@@ -1183,7 +1074,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) );
OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_SOLID_COLOR |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_P |
R128_GMC_CLR_CMP_CNTL_DIS |
@@ -1211,24 +1102,9 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev,
{
drm_r128_private_t *dev_priv = dev->dev_private;
int count, x, y;
- u32 depth_bpp;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
- switch ( dev_priv->depth_bpp ) {
- case 16:
- depth_bpp = R128_GMC_DST_16BPP;
- break;
- case 24:
- case 32:
- depth_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return -EINVAL;
- }
-
count = depth->n;
if ( copy_from_user( &x, depth->x, sizeof(x) ) ) {
return -EFAULT;
@@ -1243,7 +1119,7 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev,
OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL |
R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_NONE |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_S |
R128_DP_SRC_SOURCE_MEMORY |
@@ -1267,25 +1143,10 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
{
drm_r128_private_t *dev_priv = dev->dev_private;
int count, *x, *y;
- u32 depth_bpp;
int i;
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
- switch ( dev_priv->depth_bpp ) {
- case 16:
- depth_bpp = R128_GMC_DST_16BPP;
- break;
- case 24:
- case 32:
- depth_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- return -EINVAL;
- }
-
count = depth->n;
if ( count > dev_priv->depth_pitch ) {
count = dev_priv->depth_pitch;
@@ -1318,7 +1179,7 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL |
R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_BRUSH_NONE |
- depth_bpp |
+ (dev_priv->depth_fmt << 8) |
R128_GMC_SRC_DATATYPE_COLOR |
R128_ROP3_S |
R128_DP_SRC_SOURCE_MEMORY |
@@ -1353,8 +1214,6 @@ static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- r128_update_ring_snapshot( dev_priv );
-
BEGIN_RING( 33 );
OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) );
@@ -1380,22 +1239,18 @@ int r128_cce_clear( struct inode *inode, struct file *filp,
drm_r128_clear_t clear;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "r128_cce_clear called without lock held\n" );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &clear, (drm_r128_clear_t *) arg,
sizeof(clear) ) )
return -EFAULT;
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+
if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS;
- r128_cce_dispatch_clear( dev, clear.flags,
- clear.x, clear.y, clear.w, clear.h,
- clear.clear_color, clear.clear_depth );
+ r128_cce_dispatch_clear( dev, &clear );
/* Make sure we restore the 3D state next time.
*/
@@ -1413,11 +1268,9 @@ int r128_cce_swap( struct inode *inode, struct file *filp,
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "r128_cce_swap called without lock held\n" );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS;
@@ -1444,11 +1297,8 @@ int r128_cce_vertex( struct inode *inode, struct file *filp,
drm_r128_buf_priv_t *buf_priv;
drm_r128_vertex_t vertex;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv || dev_priv->is_pci ) {
DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ );
return -EINVAL;
@@ -1473,6 +1323,9 @@ int r128_cce_vertex( struct inode *inode, struct file *filp,
return -EINVAL;
}
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
+
buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private;
@@ -1507,11 +1360,8 @@ int r128_cce_indices( struct inode *inode, struct file *filp,
drm_r128_indices_t elts;
int count;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv || dev_priv->is_pci ) {
DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ );
return -EINVAL;
@@ -1536,6 +1386,9 @@ int r128_cce_indices( struct inode *inode, struct file *filp,
return -EINVAL;
}
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
+
buf = dma->buflist[elts.idx];
buf_priv = buf->dev_private;
@@ -1576,13 +1429,10 @@ int r128_cce_blit( struct inode *inode, struct file *filp,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma;
+ drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_blit_t blit;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &blit, (drm_r128_blit_t *)arg,
sizeof(blit) ) )
@@ -1597,6 +1447,9 @@ int r128_cce_blit( struct inode *inode, struct file *filp,
return -EINVAL;
}
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
+
return r128_cce_dispatch_blit( dev, &blit );
}
@@ -1605,18 +1458,17 @@ int r128_cce_depth( struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
+ drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_depth_t depth;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &depth, (drm_r128_depth_t *)arg,
sizeof(depth) ) )
return -EFAULT;
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+
switch ( depth.func ) {
case R128_WRITE_SPAN:
return r128_cce_dispatch_write_span( dev, &depth );
@@ -1636,14 +1488,11 @@ int r128_cce_stipple( struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
+ drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_stipple_t stipple;
u32 mask[32];
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &stipple, (drm_r128_stipple_t *)arg,
sizeof(stipple) ) )
@@ -1653,6 +1502,8 @@ int r128_cce_stipple( struct inode *inode, struct file *filp,
32 * sizeof(u32) ) )
return -EFAULT;
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+
r128_cce_dispatch_stipple( dev, mask );
return 0;
@@ -1664,11 +1515,7 @@ int r128_cce_indirect( struct inode *inode, struct file *filp,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
/* Indirect buffer firing is not supported at this time.
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h
new file mode 100644
index 000000000..db238b1b4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h
@@ -0,0 +1,79 @@
+/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*-
+ * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __RADEON_H__
+#define __RADEON_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) radeon_##x
+
+/* General customization:
+ */
+#define __HAVE_AGP 1
+#define __MUST_HAVE_AGP 1
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+/* Driver customization:
+ */
+#define DRIVER_PRERELEASE() do { \
+ if ( dev->dev_private ) { \
+ drm_radeon_private_t *dev_priv = dev->dev_private; \
+ if ( dev_priv->page_flipping ) { \
+ radeon_do_cleanup_pageflip( dev ); \
+ } \
+ } \
+} while (0)
+
+#define DRIVER_PRETAKEDOWN() do { \
+ if ( dev->dev_private ) radeon_do_cleanup_cp( dev ); \
+} while (0)
+
+/* DMA customization:
+ */
+#define __HAVE_DMA 1
+
+#if 0
+/* GH: Remove this for now... */
+#define __HAVE_DMA_QUIESCENT 1
+#define DRIVER_DMA_QUIESCENT() do { \
+ drm_radeon_private_t *dev_priv = dev->dev_private; \
+ return radeon_do_cp_idle( dev_priv ); \
+} while (0)
+#endif
+
+/* Buffer customization:
+ */
+#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t
+
+#define DRIVER_AGP_BUFFERS_MAP( dev ) \
+ ((drm_radeon_private_t *)((dev)->dev_private))->buffers
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c
index 5d662bc08..ed8b1bbca 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c
@@ -24,12 +24,12 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
+ * Kevin E. Martin <martin@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
#define __NO_VERSION__
+#include "radeon.h"
#include "drmP.h"
#include "radeon_drv.h"
@@ -300,26 +300,6 @@ static u32 radeon_cp_microcode[][2] = {
};
-#define DO_IOREMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size)
-
-#define DO_IOREMAPFREE(_m) \
- do { \
- if ((_m)->handle && (_m)->size) \
- drm_ioremapfree((_m)->handle, (_m)->size); \
- } while (0)
-
-#define DO_FIND_MAP(_m, _o) \
- do { \
- int _i; \
- for (_i = 0; _i < dev->map_count; _i++) { \
- if (dev->maplist[_i]->offset == _o) { \
- _m = dev->maplist[_i]; \
- break; \
- } \
- } \
- } while (0)
-
-
int RADEON_READ_PLL(drm_device_t *dev, int addr)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -621,9 +601,9 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev )
static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
{
drm_radeon_private_t *dev_priv;
- int i;
+ struct list_head *list;
- dev_priv = drm_alloc( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
+ dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
return -ENOMEM;
dev->dev_private = (void *)dev_priv;
@@ -637,7 +617,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
* the CP ring code.
*/
if ( dev_priv->is_pci ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -645,7 +625,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->usec_timeout = init->usec_timeout;
if ( dev_priv->usec_timeout < 1 ||
dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -662,7 +642,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
*/
if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) &&
( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) {
- drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return -EINVAL;
}
@@ -722,49 +702,42 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
RADEON_BFACE_SOLID |
RADEON_FFACE_SOLID |
RADEON_FLAT_SHADE_VTX_LAST |
-
RADEON_DIFFUSE_SHADE_FLAT |
RADEON_ALPHA_SHADE_FLAT |
RADEON_SPECULAR_SHADE_FLAT |
RADEON_FOG_SHADE_FLAT |
-
RADEON_VTX_PIX_CENTER_OGL |
RADEON_ROUND_MODE_TRUNC |
RADEON_ROUND_PREC_8TH_PIX);
- /* FIXME: We want multiple shared areas, including one shared
- * only by the X Server and kernel module.
- */
- for ( i = 0 ; i < dev->map_count ; i++ ) {
- if ( dev->maplist[i]->type == _DRM_SHM ) {
- dev_priv->sarea = dev->maplist[i];
- break;
- }
- }
-
- DO_FIND_MAP( dev_priv->fb, init->fb_offset );
- DO_FIND_MAP( dev_priv->mmio, init->mmio_offset );
- DO_FIND_MAP( dev_priv->cp_ring, init->ring_offset );
- DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
- DO_FIND_MAP( dev_priv->buffers, init->buffers_offset );
+ list_for_each(list, &dev->maplist->head) {
+ drm_map_list_t *r_list = (drm_map_list_t *)list;
+ if( r_list->map &&
+ r_list->map->type == _DRM_SHM &&
+ r_list->map->flags & _DRM_CONTAINS_LOCK ) {
+ dev_priv->sarea = r_list->map;
+ break;
+ }
+ }
+
+ DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
+ DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
+ DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset );
+ DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
+ DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
if ( !dev_priv->is_pci ) {
- DO_FIND_MAP( dev_priv->agp_textures,
- init->agp_textures_offset );
+ DRM_FIND_MAP( dev_priv->agp_textures,
+ init->agp_textures_offset );
}
dev_priv->sarea_priv =
(drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
- DO_IOREMAP( dev_priv->cp_ring );
- DO_IOREMAP( dev_priv->ring_rptr );
- DO_IOREMAP( dev_priv->buffers );
-#if 0
- if ( !dev_priv->is_pci ) {
- DO_IOREMAP( dev_priv->agp_textures );
- }
-#endif
+ DRM_IOREMAP( dev_priv->cp_ring );
+ DRM_IOREMAP( dev_priv->ring_rptr );
+ DRM_IOREMAP( dev_priv->buffers );
dev_priv->agp_size = init->agp_size;
dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE );
@@ -779,11 +752,13 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle
+ init->ring_size / sizeof(u32));
dev_priv->ring.size = init->ring_size;
- dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 );
+ dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 );
dev_priv->ring.tail_mask =
(dev_priv->ring.size / sizeof(u32)) - 1;
+ dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
+
#if 0
/* Initialize the scratch register pointer. This will cause
* the scratch register values to be written out to memory
@@ -823,22 +798,17 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
return 0;
}
-static int radeon_do_cleanup_cp( drm_device_t *dev )
+int radeon_do_cleanup_cp( drm_device_t *dev )
{
if ( dev->dev_private ) {
drm_radeon_private_t *dev_priv = dev->dev_private;
- DO_IOREMAPFREE( dev_priv->cp_ring );
- DO_IOREMAPFREE( dev_priv->ring_rptr );
- DO_IOREMAPFREE( dev_priv->buffers );
-#if 0
- if ( !dev_priv->is_pci ) {
- DO_IOREMAPFREE( dev_priv->agp_textures );
- }
-#endif
+ DRM_IOREMAPFREE( dev_priv->cp_ring );
+ DRM_IOREMAPFREE( dev_priv->ring_rptr );
+ DRM_IOREMAPFREE( dev_priv->buffers );
- drm_free( dev->dev_private, sizeof(drm_radeon_private_t),
- DRM_MEM_DRIVER );
+ DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t),
+ DRM_MEM_DRIVER );
dev->dev_private = NULL;
}
@@ -873,11 +843,8 @@ int radeon_cp_start( struct inode *inode, struct file *filp,
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( dev_priv->cp_running ) {
DRM_DEBUG( "%s while CP running\n", __FUNCTION__ );
return 0;
@@ -906,11 +873,7 @@ int radeon_cp_stop( struct inode *inode, struct file *filp,
int ret;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &stop, (drm_radeon_init_t *)arg, sizeof(stop) ) )
return -EFAULT;
@@ -952,11 +915,8 @@ int radeon_cp_reset( struct inode *inode, struct file *filp,
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv ) {
DRM_DEBUG( "%s called before init done\n", __FUNCTION__ );
return -EINVAL;
@@ -978,11 +938,7 @@ int radeon_cp_idle( struct inode *inode, struct file *filp,
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
return radeon_do_cp_idle( dev_priv );
}
@@ -994,11 +950,7 @@ int radeon_engine_reset( struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
return radeon_do_engine_reset( dev );
}
@@ -1048,11 +1000,7 @@ int radeon_fullscreen( struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_radeon_fullscreen_t fs;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &fs, (drm_radeon_fullscreen_t *)arg,
sizeof(fs) ) )
@@ -1085,8 +1033,8 @@ static int radeon_freelist_init( drm_device_t *dev )
drm_radeon_freelist_t *entry;
int i;
- dev_priv->head = drm_alloc( sizeof(drm_radeon_freelist_t),
- DRM_MEM_DRIVER );
+ dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t),
+ DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
return -ENOMEM;
@@ -1097,8 +1045,8 @@ static int radeon_freelist_init( drm_device_t *dev )
buf = dma->buflist[i];
buf_priv = buf->dev_private;
- entry = drm_alloc( sizeof(drm_radeon_freelist_t),
- DRM_MEM_DRIVER );
+ entry = DRM(alloc)( sizeof(drm_radeon_freelist_t),
+ DRM_MEM_DRIVER );
if ( !entry ) return -ENOMEM;
entry->age = RADEON_BUFFER_FREE;
@@ -1218,13 +1166,9 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n )
int i;
for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
- ring->space = *ring->head - ring->tail;
- if ( ring->space <= 0 )
- ring->space += ring->size;
-
- if ( ring->space >= n )
+ radeon_update_ring_snapshot( ring );
+ if ( ring->space > n )
return 0;
-
udelay( 1 );
}
@@ -1233,17 +1177,6 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n )
return -EBUSY;
}
-void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv )
-{
- drm_radeon_ring_buffer_t *ring = &dev_priv->ring;
-
- ring->space = *ring->head - ring->tail;
- if ( ring->space == 0 )
- atomic_inc( &dev_priv->idle_count );
- if ( ring->space <= 0 )
- ring->space += ring->size;
-}
-
static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d )
{
int i;
@@ -1276,14 +1209,10 @@ int radeon_cp_buffers( struct inode *inode, struct file *filp,
int ret = 0;
drm_dma_t d;
- if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) )
- return -EFAULT;
+ LOCK_TEST_WITH_RETURN( dev );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) )
+ return -EFAULT;
/* Please don't send us buffers.
*/
@@ -1307,7 +1236,7 @@ int radeon_cp_buffers( struct inode *inode, struct file *filp,
ret = radeon_cp_get_buffers( dev, &d );
}
- if ( copy_to_user( (drm_dma_t *) arg, &d, sizeof(d) ) )
+ if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) )
return -EFAULT;
return ret;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h
index c5f9f66d1..50a7d6ed8 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h
@@ -26,7 +26,6 @@
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- *
*/
#ifndef __RADEON_DRM_H__
@@ -74,7 +73,7 @@
/* Vertex/indirect buffer size
*/
-#define RADEON_BUFFER_SIZE 16384
+#define RADEON_BUFFER_SIZE 65536
/* Byte offsets for indirect buffer data
*/
@@ -276,15 +275,18 @@ typedef struct drm_radeon_fullscreen {
#define CLEAR_Y2 3
#define CLEAR_DEPTH 4
+typedef union drm_radeon_clear_rect {
+ float f[5];
+ unsigned int ui[5];
+} drm_radeon_clear_rect_t;
+
typedef struct drm_radeon_clear {
unsigned int flags;
- int x, y, w, h;
unsigned int clear_color;
unsigned int clear_depth;
- union {
- float f[5];
- unsigned int ui[5];
- } rect;
+ unsigned int color_mask;
+ unsigned int depth_mask;
+ drm_radeon_clear_rect_t *depth_boxes;
} drm_radeon_clear_t;
typedef struct drm_radeon_vertex {
@@ -302,14 +304,20 @@ typedef struct drm_radeon_indices {
int discard; /* Client finished with buffer? */
} drm_radeon_indices_t;
-typedef struct drm_radeon_blit {
- int idx;
- int pitch;
+typedef struct drm_radeon_tex_image {
+ unsigned int x, y; /* Blit coordinates */
+ unsigned int width, height;
+ const void *data;
+} drm_radeon_tex_image_t;
+
+typedef struct drm_radeon_texture {
int offset;
+ int pitch;
int format;
- unsigned short x, y;
- unsigned short width, height;
-} drm_radeon_blit_t;
+ int width; /* Texture image coordinates */
+ int height;
+ drm_radeon_tex_image_t *image;
+} drm_radeon_texture_t;
typedef struct drm_radeon_stipple {
unsigned int *mask;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c
index 0113ed97c..dba2037f9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c
@@ -1,7 +1,7 @@
/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*-
+ * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,685 +18,70 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Kevin E. Martin <martin@valinux.com>
- * Rickard E. (Rik) Faith <faith@valinux.com>
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
*/
#include <linux/config.h>
+#include "radeon.h"
#include "drmP.h"
#include "radeon_drv.h"
-#define RADEON_NAME "radeon"
-#define RADEON_DESC "ATI Radeon"
-#define RADEON_DATE "20010105"
-#define RADEON_MAJOR 1
-#define RADEON_MINOR 0
-#define RADEON_PATCHLEVEL 0
-
-static drm_device_t radeon_device;
-drm_ctx_t radeon_res_ctx;
-
-static struct file_operations radeon_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: radeon_open,
- flush: drm_flush,
- release: radeon_release,
- ioctl: radeon_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-static struct miscdevice radeon_misc = {
- minor: MISC_DYNAMIC_MINOR,
- name: RADEON_NAME,
- fops: &radeon_fops,
-};
-
-static drm_ioctl_desc_t radeon_ioctls[] = {
- [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { radeon_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_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { radeon_addbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { radeon_mapbufs, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { radeon_addctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { radeon_rmctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { radeon_modctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { radeon_getctx, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { radeon_switchctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { radeon_newctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { radeon_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)] = { radeon_cp_buffers, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { radeon_lock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { radeon_unlock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- [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 },
-#endif
-
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_BLIT)] = { radeon_cp_blit, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)]= { radeon_cp_indirect,1, 1 },
-};
-#define RADEON_IOCTL_COUNT DRM_ARRAY_SIZE(radeon_ioctls)
-
-#ifdef MODULE
-static char *radeon = NULL;
-#endif
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("radeon");
-MODULE_PARM(radeon, "s");
-
-#ifndef MODULE
-/* radeon_options 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.
- */
-
-static int __init radeon_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("radeon=", radeon_options);
-#endif
-
-static int radeon_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);
-
- radeon_res_ctx.handle = -1;
-
- 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 radeon_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");
-
- 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;
- }
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- /* 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 radeon_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();
-
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
- }
-#endif
-
- /* 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:
- /* Do nothing here, because this is all
- handled in the AGP/GART driver. */
- 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;
- }
-
- 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;
-}
-
-/* radeon_init is called via init_module at module load time, or via
- * linux/init/main.c (this is not currently supported). */
-
-static int __init radeon_init(void)
-{
- int retcode;
- drm_device_t *dev = &radeon_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(radeon);
-#endif
-
- if ((retcode = misc_register(&radeon_misc))) {
- DRM_ERROR("Cannot register \"%s\"\n", RADEON_NAME);
- return retcode;
- }
- dev->device = MKDEV(MISC_MAJOR, radeon_misc.minor);
- dev->name = RADEON_NAME;
-
- drm_mem_init();
- drm_proc_init(dev);
-
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- dev->agp = drm_agp_init();
- if (dev->agp == NULL) {
- DRM_ERROR("Cannot initialize agpgart module.\n");
- drm_proc_cleanup();
- misc_deregister(&radeon_misc);
- radeon_takedown(dev);
- return -ENOMEM;
- }
-
-#ifdef CONFIG_MTRR
- dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size*1024*1024,
- MTRR_TYPE_WRCOMB,
- 1);
-#endif
-#endif
-
- if((retcode = drm_ctxbitmap_init(dev))) {
- DRM_ERROR("Cannot allocate memory for context bitmap.\n");
- drm_proc_cleanup();
- misc_deregister(&radeon_misc);
- radeon_takedown(dev);
- return retcode;
- }
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
- RADEON_NAME,
- RADEON_MAJOR,
- RADEON_MINOR,
- RADEON_PATCHLEVEL,
- RADEON_DATE,
- radeon_misc.minor);
-
- return 0;
-}
-
-/* radeon_cleanup is called via cleanup_module at module unload time. */
-
-static void __exit radeon_cleanup(void)
-{
- drm_device_t *dev = &radeon_device;
-
- DRM_DEBUG("\n");
-
- drm_proc_cleanup();
- if (misc_deregister(&radeon_misc)) {
- DRM_ERROR("Cannot unload module\n");
- } else {
- DRM_INFO("Module unloaded\n");
- }
- drm_ctxbitmap_cleanup(dev);
- radeon_takedown(dev);
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- if (dev->agp) {
- drm_agp_uninit();
- drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-#endif
-}
-
-module_init(radeon_init);
-module_exit(radeon_cleanup);
-
-
-int radeon_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -EFAULT; \
- }
-
- version.version_major = RADEON_MAJOR;
- version.version_minor = RADEON_MINOR;
- version.version_patchlevel = RADEON_PATCHLEVEL;
-
- DRM_COPY(version.name, RADEON_NAME);
- DRM_COPY(version.date, RADEON_DATE);
- DRM_COPY(version.desc, RADEON_DESC);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -EFAULT;
- return 0;
-}
-
-int radeon_open(struct inode *inode, struct file *filp)
-{
- drm_device_t *dev = &radeon_device;
- int retcode = 0;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_open_helper(inode, filp, dev))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- atomic_inc(&dev->total_open);
- spin_lock(&dev->count_lock);
- if (!dev->open_count++) {
- spin_unlock(&dev->count_lock);
- return radeon_setup(dev);
- }
- spin_unlock(&dev->count_lock);
- }
-
- return retcode;
-}
-
-int radeon_release(struct inode *inode, struct file *filp)
-{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
-
- /* Force the cleanup of page flipping when required */
- if ( dev->dev_private ) {
- drm_radeon_private_t *dev_priv = dev->dev_private;
- if ( dev_priv->page_flipping ) {
- radeon_do_cleanup_pageflip( dev );
- }
- }
-
- if (!(retcode = drm_release(inode, filp))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return radeon_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- }
-
- unlock_kernel();
- return retcode;
-}
+#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
+
+#define DRIVER_NAME "radeon"
+#define DRIVER_DESC "ATI Radeon"
+#define DRIVER_DATE "20010308"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 0
+#define DRIVER_PATCHLEVEL 1
+
+#define DRIVER_IOCTLS \
+ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 },
-/* radeon_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-int radeon_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 >= RADEON_IOCTL_COUNT) {
- retcode = -EINVAL;
- } else {
- ioctl = &radeon_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 radeon_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;
-#if DRM_DMA_HISTOGRAM
- cycles_t start;
-
- dev->lck_start = start = get_cycles();
-#endif
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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 (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 /* || lock.context >= dev->queue_count */)
- return -EINVAL;
-
- if (!ret) {
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
- schedule();
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- }
-
- if (!ret) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
- if (lock.flags & _DRM_LOCK_READY) {
- /* Wait for space in DMA/FIFO */
- }
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- /* Make hardware quiescent */
- DRM_DEBUG("not quiescent!\n");
#if 0
- radeon_quiescent(dev);
-#endif
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != radeon_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY/4;
- }
-#endif
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
-
-#if DRM_DMA_HISTOGRAM
- atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
-#endif
-
- return ret;
-}
-
-
-int radeon_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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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);
- /* FIXME: Try to send data to card here */
- if (!dev->context_flag) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- DRM_ERROR("\n");
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != radeon_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY;
- }
-#endif
- unblock_all_signals();
- return 0;
-}
+/* GH: Count data sent to card via ring or vertex/indirect buffers.
+ */
+#define __HAVE_COUNTERS 3
+#define __HAVE_COUNTER6 _DRM_STAT_IRQ
+#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
+#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
+#endif
+
+
+#include "drm_agpsupport.h"
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h
index 06b541991..f176bb560 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h
@@ -24,10 +24,8 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
+ * Kevin E. Martin <martin@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
*/
#ifndef __RADEON_DRV_H__
@@ -50,6 +48,8 @@ typedef struct drm_radeon_ring_buffer {
u32 tail;
u32 tail_mask;
int space;
+
+ int high_mark;
} drm_radeon_ring_buffer_t;
typedef struct drm_radeon_depth_clear_t {
@@ -91,13 +91,13 @@ typedef struct drm_radeon_private {
u32 crtc_offset;
u32 crtc_offset_cntl;
- unsigned int color_fmt;
+ u32 color_fmt;
unsigned int front_offset;
unsigned int front_pitch;
unsigned int back_offset;
unsigned int back_pitch;
- unsigned int depth_fmt;
+ u32 depth_fmt;
unsigned int depth_offset;
unsigned int depth_pitch;
@@ -124,18 +124,6 @@ typedef struct drm_radeon_buf_priv {
drm_radeon_freelist_t *list_entry;
} drm_radeon_buf_priv_t;
- /* radeon_drv.c */
-extern int radeon_version( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int radeon_open( struct inode *inode, struct file *filp );
-extern int radeon_release( struct inode *inode, struct file *filp );
-extern int radeon_ioctl( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int radeon_lock( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-extern int radeon_unlock( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
-
/* radeon_cp.c */
extern int radeon_cp_init( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
@@ -158,9 +146,17 @@ extern void radeon_freelist_reset( drm_device_t *dev );
extern drm_buf_t *radeon_freelist_get( drm_device_t *dev );
extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n );
-extern void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv );
+
+static inline void
+radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring )
+{
+ ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32);
+ if ( ring->space <= 0 )
+ ring->space += ring->size;
+}
extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv );
+extern int radeon_do_cleanup_cp( drm_device_t *dev );
extern int radeon_do_cleanup_pageflip( drm_device_t *dev );
/* radeon_state.c */
@@ -172,38 +168,13 @@ extern int radeon_cp_vertex( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int radeon_cp_indices( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
-extern int radeon_cp_blit( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg );
+extern int radeon_cp_texture( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg );
extern int radeon_cp_stipple( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int radeon_cp_indirect( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
- /* radeon_bufs.c */
-extern int radeon_addbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_mapbufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
- /* radeon_context.c */
-extern int radeon_resctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_addctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_modctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_getctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_switchctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_newctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern int radeon_rmctx(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-extern int radeon_context_switch(drm_device_t *dev, int old, int new);
-extern int radeon_context_switch_complete(drm_device_t *dev, int new);
-
/* Register definitions, register access macros and drmAddMap constants
* for Radeon kernel driver.
@@ -514,14 +485,14 @@ extern int radeon_context_switch_complete(drm_device_t *dev, int new);
#define RADEON_COLOR_FORMAT_RGB8 9
#define RADEON_COLOR_FORMAT_ARGB4444 15
-#define RADEON_TXF_8BPP_I 0
-#define RADEON_TXF_16BPP_AI88 1
-#define RADEON_TXF_8BPP_RGB332 2
-#define RADEON_TXF_16BPP_ARGB1555 3
-#define RADEON_TXF_16BPP_RGB565 4
-#define RADEON_TXF_16BPP_ARGB4444 5
-#define RADEON_TXF_32BPP_ARGB8888 6
-#define RADEON_TXF_32BPP_RGBA8888 7
+#define RADEON_TXFORMAT_I8 0
+#define RADEON_TXFORMAT_AI88 1
+#define RADEON_TXFORMAT_RGB332 2
+#define RADEON_TXFORMAT_ARGB1555 3
+#define RADEON_TXFORMAT_RGB565 4
+#define RADEON_TXFORMAT_ARGB4444 5
+#define RADEON_TXFORMAT_ARGB8888 6
+#define RADEON_TXFORMAT_RGBA8888 7
/* Constants */
#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
@@ -534,27 +505,27 @@ extern int radeon_context_switch_complete(drm_device_t *dev, int new);
#define RADEON_MAX_VB_AGE 0x7fffffff
#define RADEON_MAX_VB_VERTS (0xffff)
+#define RADEON_RING_HIGH_MARK 128
+
#define RADEON_BASE(reg) ((u32)(dev_priv->mmio->handle))
-#define RADEON_ADDR(reg) (RADEON_BASE(reg) + reg)
+#define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg)
-#define RADEON_DEREF(reg) *(__volatile__ u32 *)RADEON_ADDR(reg)
-#define RADEON_READ(reg) RADEON_DEREF(reg)
-#define RADEON_WRITE(reg,val) do { RADEON_DEREF(reg) = val; } while (0)
+#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg )
+#define RADEON_READ(reg) RADEON_DEREF( reg )
+#define RADEON_WRITE(reg, val) do { RADEON_DEREF( reg ) = val; } while (0)
-#define RADEON_DEREF8(reg) *(__volatile__ u8 *)RADEON_ADDR(reg)
-#define RADEON_READ8(reg) RADEON_DEREF8(reg)
-#define RADEON_WRITE8(reg,val) do { RADEON_DEREF8(reg) = val; } while (0)
+#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg )
+#define RADEON_READ8(reg) RADEON_DEREF8( reg )
+#define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0)
-#define RADEON_WRITE_PLL(addr,val) \
-do { \
- RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, \
- ((addr) & 0x1f) | RADEON_PLL_WR_EN); \
- RADEON_WRITE(RADEON_CLOCK_CNTL_DATA, (val)); \
+#define RADEON_WRITE_PLL( addr, val ) do { \
+ RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \
+ ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \
+ RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \
} while (0)
-extern int RADEON_READ_PLL(drm_device_t *dev, int addr);
-
+extern int RADEON_READ_PLL( drm_device_t *dev, int addr );
#define CP_PACKET0( reg, n ) \
@@ -573,54 +544,46 @@ extern int RADEON_READ_PLL(drm_device_t *dev, int addr);
* Engine control helper macros
*/
-#define RADEON_WAIT_UNTIL_2D_IDLE() \
-do { \
+#define RADEON_WAIT_UNTIL_2D_IDLE() do { \
OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \
OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \
RADEON_WAIT_HOST_IDLECLEAN) ); \
} while (0)
-#define RADEON_WAIT_UNTIL_3D_IDLE() \
-do { \
+#define RADEON_WAIT_UNTIL_3D_IDLE() do { \
OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \
OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \
RADEON_WAIT_HOST_IDLECLEAN) ); \
} while (0)
-#define RADEON_WAIT_UNTIL_IDLE() \
-do { \
+#define RADEON_WAIT_UNTIL_IDLE() do { \
OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \
OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \
RADEON_WAIT_3D_IDLECLEAN | \
RADEON_WAIT_HOST_IDLECLEAN) ); \
} while (0)
-#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() \
-do { \
+#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \
OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \
OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \
} while (0)
-#define RADEON_FLUSH_CACHE() \
-do { \
+#define RADEON_FLUSH_CACHE() do { \
OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \
OUT_RING( RADEON_RB2D_DC_FLUSH ); \
} while (0)
-#define RADEON_PURGE_CACHE() \
-do { \
+#define RADEON_PURGE_CACHE() do { \
OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \
OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \
} while (0)
-#define RADEON_FLUSH_ZCACHE() \
-do { \
+#define RADEON_FLUSH_ZCACHE() do { \
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
OUT_RING( RADEON_RB3D_ZC_FLUSH ); \
} while (0)
-#define RADEON_PURGE_ZCACHE() \
-do { \
+#define RADEON_PURGE_ZCACHE() do { \
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \
} while (0)
@@ -630,7 +593,33 @@ do { \
* Misc helper macros
*/
-#define VB_AGE_CHECK_WITH_RET( dev_priv ) \
+#define LOCK_TEST_WITH_RETURN( dev ) \
+do { \
+ if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
+ dev->lock.pid != current->pid ) { \
+ DRM_ERROR( "%s called without lock held\n", \
+ __FUNCTION__ ); \
+ return -EINVAL; \
+ } \
+} while (0)
+
+#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \
+do { \
+ drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \
+ if ( ring->space < ring->high_mark ) { \
+ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \
+ radeon_update_ring_snapshot( ring ); \
+ if ( ring->space >= ring->high_mark ) \
+ goto __ring_space_done; \
+ udelay( 1 ); \
+ } \
+ DRM_ERROR( "ring space check failed!\n" ); \
+ return -EBUSY; \
+ } \
+ __ring_space_done: \
+} while (0)
+
+#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \
do { \
drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \
if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \
@@ -641,20 +630,17 @@ do { \
} \
} while (0)
-#define RADEON_DISPATCH_AGE( age ) \
-do { \
+#define RADEON_DISPATCH_AGE( age ) do { \
OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \
OUT_RING( age ); \
} while (0)
-#define RADEON_FRAME_AGE( age ) \
-do { \
+#define RADEON_FRAME_AGE( age ) do { \
OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \
OUT_RING( age ); \
} while (0)
-#define RADEON_CLEAR_AGE( age ) \
-do { \
+#define RADEON_CLEAR_AGE( age ) do { \
OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \
OUT_RING( age ); \
} while (0)
@@ -676,7 +662,7 @@ do { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \
n, __FUNCTION__ ); \
} \
- if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \
+ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \
} \
dev_priv->ring.space -= (n) * sizeof(u32); \
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c
index 7bfefb2ca..9360c43b0 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c
@@ -23,12 +23,12 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- *
+ * Kevin E. Martin <martin@valinux.com>
*/
#define __NO_VERSION__
+#include "radeon.h"
#include "drmP.h"
#include "radeon_drv.h"
#include "drm.h"
@@ -486,7 +486,8 @@ static void radeon_print_dirty( const char *msg, unsigned int flags )
}
static void radeon_cp_dispatch_clear( drm_device_t *dev,
- drm_radeon_clear_t *clear )
+ drm_radeon_clear_t *clear,
+ drm_radeon_clear_rect_t *depth_boxes )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -497,8 +498,6 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) {
unsigned int tmp = flags;
@@ -525,7 +524,7 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev,
RADEON_WAIT_UNTIL_3D_IDLE();
OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) );
- OUT_RING( sarea_priv->context_state.rb3d_planemask );
+ OUT_RING( clear->color_mask );
ADVANCE_RING();
@@ -609,17 +608,17 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev,
RADEON_VTX_FMT_RADEON_MODE |
(3 << RADEON_NUM_VERTICES_SHIFT)) );
- OUT_RING( clear->rect.ui[CLEAR_X1] );
- OUT_RING( clear->rect.ui[CLEAR_Y1] );
- OUT_RING( clear->rect.ui[CLEAR_DEPTH] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_X1] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_Y1] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] );
- OUT_RING( clear->rect.ui[CLEAR_X1] );
- OUT_RING( clear->rect.ui[CLEAR_Y2] );
- OUT_RING( clear->rect.ui[CLEAR_DEPTH] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_X1] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_Y2] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] );
- OUT_RING( clear->rect.ui[CLEAR_X2] );
- OUT_RING( clear->rect.ui[CLEAR_Y2] );
- OUT_RING( clear->rect.ui[CLEAR_DEPTH] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_X2] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_Y2] );
+ OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] );
ADVANCE_RING();
@@ -655,8 +654,6 @@ static void radeon_cp_dispatch_swap( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
#if RADEON_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -724,8 +721,6 @@ static void radeon_cp_dispatch_flip( drm_device_t *dev )
RING_LOCALS;
DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page );
- radeon_update_ring_snapshot( dev_priv );
-
#if RADEON_PERFORMANCE_BOXES
/* Do some trivial performance monitoring...
*/
@@ -776,9 +771,7 @@ static void radeon_cp_dispatch_vertex( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox );
- radeon_update_ring_snapshot( dev_priv );
-
- if ( 1 )
+ if ( 0 )
radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty );
if ( buf->used ) {
@@ -844,8 +837,6 @@ static void radeon_cp_dispatch_indirect( drm_device_t *dev,
DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n",
buf->idx, start, end );
- radeon_update_ring_snapshot( dev_priv );
-
if ( start != end ) {
int offset = (dev_priv->agp_buffers_offset
+ buf->offset + start);
@@ -908,8 +899,6 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev,
RING_LOCALS;
DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count );
- radeon_update_ring_snapshot( dev_priv );
-
if ( 0 )
radeon_print_dirty( "dispatch_indices", sarea_priv->dirty );
@@ -971,50 +960,67 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev,
sarea_priv->nbox = 0;
}
-static int radeon_cp_dispatch_blit( drm_device_t *dev,
- drm_radeon_blit_t *blit )
+#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32))
+
+static int radeon_cp_dispatch_texture( drm_device_t *dev,
+ drm_radeon_texture_t *tex,
+ drm_radeon_tex_image_t *image )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
drm_buf_t *buf;
drm_radeon_buf_priv_t *buf_priv;
u32 format;
- u32 *data;
- int dword_shift, dwords;
+ u32 *buffer;
+ u8 *data;
+ int size, dwords, tex_width, blit_width;
+ u32 y, height;
+ int ret = 0, i;
RING_LOCALS;
- DRM_DEBUG( "blit: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n",
- blit->offset >> 10, blit->pitch, blit->format,
- blit->x, blit->y, blit->width, blit->height );
- radeon_update_ring_snapshot( dev_priv );
+ /* FIXME: Be smarter about this...
+ */
+ buf = radeon_freelist_get( dev );
+ if ( !buf ) return -EAGAIN;
+
+ DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n",
+ tex->offset >> 10, tex->pitch, tex->format,
+ image->x, image->y, image->width, image->height );
+
+ buf_priv = buf->dev_private;
/* The compiler won't optimize away a division by a variable,
* even if the only legal values are powers of two. Thus, we'll
* use a shift instead.
*/
- switch ( blit->format ) {
- case RADEON_TXF_32BPP_ARGB8888:
- case RADEON_TXF_32BPP_RGBA8888:
+ switch ( tex->format ) {
+ case RADEON_TXFORMAT_ARGB8888:
+ case RADEON_TXFORMAT_RGBA8888:
format = RADEON_COLOR_FORMAT_ARGB8888;
- dword_shift = 0;
+ tex_width = tex->width * 4;
+ blit_width = image->width * 4;
break;
- case RADEON_TXF_16BPP_AI88:
- case RADEON_TXF_16BPP_ARGB1555:
- case RADEON_TXF_16BPP_RGB565:
- case RADEON_TXF_16BPP_ARGB4444:
+ case RADEON_TXFORMAT_AI88:
+ case RADEON_TXFORMAT_ARGB1555:
+ case RADEON_TXFORMAT_RGB565:
+ case RADEON_TXFORMAT_ARGB4444:
format = RADEON_COLOR_FORMAT_RGB565;
- dword_shift = 1;
+ tex_width = tex->width * 2;
+ blit_width = image->width * 2;
break;
- case RADEON_TXF_8BPP_I:
- case RADEON_TXF_8BPP_RGB332:
+ case RADEON_TXFORMAT_I8:
+ case RADEON_TXFORMAT_RGB332:
format = RADEON_COLOR_FORMAT_CI8;
- dword_shift = 2;
+ tex_width = tex->width * 1;
+ blit_width = image->width * 1;
break;
default:
- DRM_ERROR( "invalid blit format %d\n", blit->format );
+ DRM_ERROR( "invalid texture format %d\n", tex->format );
return -EINVAL;
}
+ DRM_DEBUG( " tex=%dx%d blit=%d\n",
+ tex_width, tex->height, blit_width );
+
/* Flush the pixel cache. This ensures no pixel data gets mixed
* up with the texture data from the host data blit, otherwise
* part of the texture image may be corrupted.
@@ -1026,46 +1032,88 @@ static int radeon_cp_dispatch_blit( drm_device_t *dev,
ADVANCE_RING();
- /* Dispatch the indirect buffer.
+ /* Make a copy of the parameters in case we have to update them
+ * for a multi-pass texture blit.
*/
- buf = dma->buflist[blit->idx];
- buf_priv = buf->dev_private;
+ y = image->y;
+ height = image->height;
+ data = (u8 *)image->data;
- if ( buf->pid != current->pid ) {
- DRM_ERROR( "process %d using buffer owned by %d\n",
- current->pid, buf->pid );
- return -EINVAL;
- }
- if ( buf->pending ) {
- DRM_ERROR( "sending pending buffer %d\n", blit->idx );
- return -EINVAL;
- }
+ size = height * blit_width;
- buf_priv->discard = 1;
+ if ( size > RADEON_MAX_TEXTURE_SIZE ) {
+ /* Texture image is too large, do a multipass upload */
+ ret = -EAGAIN;
- dwords = (blit->width * blit->height) >> dword_shift;
- if ( !dwords ) dwords = 1;
+ /* Adjust the blit size to fit the indirect buffer */
+ height = RADEON_MAX_TEXTURE_SIZE / blit_width;
+ size = height * blit_width;
- data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset);
+ /* Update the input parameters for next time */
+ image->y += height;
+ image->height -= height;
+ image->data = (char *)image->data + size;
- data[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 );
- data[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- (format << 8) |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_HOST_DATA |
- RADEON_GMC_CLR_CMP_CNTL_DIS |
- RADEON_GMC_WR_MSK_DIS);
+ if ( copy_to_user( tex->image, image, sizeof(*image) ) ) {
+ DRM_ERROR( "EFAULT on tex->image\n" );
+ return -EFAULT;
+ }
+ } else if ( size < 4 ) {
+ size = 4;
+ }
- data[2] = (blit->pitch << 22) | (blit->offset >> 10);
- data[3] = 0xffffffff;
- data[4] = 0xffffffff;
- data[5] = (blit->y << 16) | blit->x;
- data[6] = (blit->height << 16) | blit->width;
- data[7] = dwords;
+ dwords = size / 4;
+ /* Dispatch the indirect buffer.
+ */
+ buffer = (u32 *)((char *)dev_priv->buffers->handle + buf->offset);
+
+ buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 );
+ buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL |
+ RADEON_GMC_BRUSH_NONE |
+ (format << 8) |
+ RADEON_GMC_SRC_DATATYPE_COLOR |
+ RADEON_ROP3_S |
+ RADEON_DP_SRC_SOURCE_HOST_DATA |
+ RADEON_GMC_CLR_CMP_CNTL_DIS |
+ RADEON_GMC_WR_MSK_DIS);
+
+ buffer[2] = (tex->pitch << 22) | (tex->offset >> 10);
+ buffer[3] = 0xffffffff;
+ buffer[4] = 0xffffffff;
+ buffer[5] = (y << 16) | image->x;
+ buffer[6] = (height << 16) | image->width;
+ buffer[7] = dwords;
+
+ buffer += 8;
+
+ if ( tex_width >= 32 ) {
+ /* Texture image width is larger than the minimum, so we
+ * can upload it directly.
+ */
+ if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) {
+ DRM_ERROR( "EFAULT on data, %d dwords\n", dwords );
+ return -EFAULT;
+ }
+ } else {
+ /* Texture image width is less than the minimum, so we
+ * need to pad out each image scanline to the minimum
+ * width.
+ */
+ for ( i = 0 ; i < tex->height ; i++ ) {
+ if ( copy_from_user( buffer, data, tex_width ) ) {
+ DRM_ERROR( "EFAULT on pad, %d bytes\n",
+ tex_width );
+ return -EFAULT;
+ }
+ buffer += 8;
+ data += tex_width;
+ }
+ }
+
+ buf->pid = current->pid;
buf->used = (dwords + 8) * sizeof(u32);
+ buf_priv->discard = 1;
radeon_cp_dispatch_indirect( dev, buf, 0, buf->used );
@@ -1080,7 +1128,7 @@ static int radeon_cp_dispatch_blit( drm_device_t *dev,
ADVANCE_RING();
- return 0;
+ return ret;
}
static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple )
@@ -1090,8 +1138,6 @@ static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple )
RING_LOCALS;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- radeon_update_ring_snapshot( dev_priv );
-
BEGIN_RING( 35 );
OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) );
@@ -1118,22 +1164,25 @@ int radeon_cp_clear( struct inode *inode, struct file *filp,
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_radeon_clear_t clear;
+ drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
- if ( copy_from_user( &clear, (drm_radeon_clear_t *) arg,
+ if ( copy_from_user( &clear, (drm_radeon_clear_t *)arg,
sizeof(clear) ) )
return -EFAULT;
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+
if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS;
- radeon_cp_dispatch_clear( dev, &clear );
+ if ( copy_from_user( &depth_boxes, clear.depth_boxes,
+ sarea_priv->nbox * sizeof(depth_boxes[0]) ) )
+ return -EFAULT;
+
+ radeon_cp_dispatch_clear( dev, &clear, depth_boxes );
return 0;
}
@@ -1147,11 +1196,9 @@ int radeon_cp_swap( struct inode *inode, struct file *filp,
drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
DRM_DEBUG( "%s\n", __FUNCTION__ );
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS )
sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS;
@@ -1178,11 +1225,8 @@ int radeon_cp_vertex( struct inode *inode, struct file *filp,
drm_radeon_buf_priv_t *buf_priv;
drm_radeon_vertex_t vertex;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv || dev_priv->is_pci ) {
DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ );
return -EINVAL;
@@ -1207,7 +1251,8 @@ int radeon_cp_vertex( struct inode *inode, struct file *filp,
return -EINVAL;
}
- VB_AGE_CHECK_WITH_RET( dev_priv );
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private;
@@ -1243,11 +1288,8 @@ int radeon_cp_indices( struct inode *inode, struct file *filp,
drm_radeon_indices_t elts;
int count;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv || dev_priv->is_pci ) {
DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ );
return -EINVAL;
@@ -1272,7 +1314,8 @@ int radeon_cp_indices( struct inode *inode, struct file *filp,
return -EINVAL;
}
- VB_AGE_CHECK_WITH_RET( dev_priv );
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
buf = dma->buflist[elts.idx];
buf_priv = buf->dev_private;
@@ -1308,37 +1351,34 @@ int radeon_cp_indices( struct inode *inode, struct file *filp,
return 0;
}
-int radeon_cp_blit( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg )
+int radeon_cp_texture( 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_radeon_private_t *dev_priv = dev->dev_private;
- drm_device_dma_t *dma = dev->dma;
- drm_radeon_blit_t blit;
+ drm_radeon_texture_t tex;
+ drm_radeon_tex_image_t image;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
- if ( copy_from_user( &blit, (drm_radeon_blit_t *)arg,
- sizeof(blit) ) )
+ if ( copy_from_user( &tex, (drm_radeon_texture_t *)arg, sizeof(tex) ) )
return -EFAULT;
- DRM_DEBUG( "%s: pid=%d index=%d\n",
- __FUNCTION__, current->pid, blit.idx );
-
- if ( blit.idx < 0 || blit.idx > dma->buf_count ) {
- DRM_ERROR( "sending %d buffers (of %d max)\n",
- blit.idx, dma->buf_count );
+ if ( tex.image == NULL ) {
+ DRM_ERROR( "null texture image!\n" );
return -EINVAL;
}
- VB_AGE_CHECK_WITH_RET( dev_priv );
+ if ( copy_from_user( &image,
+ (drm_radeon_tex_image_t *)tex.image,
+ sizeof(image) ) )
+ return -EFAULT;
+
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
- return radeon_cp_dispatch_blit( dev, &blit );
+ return radeon_cp_dispatch_texture( dev, &tex, &image );
}
int radeon_cp_stipple( struct inode *inode, struct file *filp,
@@ -1346,23 +1386,21 @@ int radeon_cp_stipple( struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
+ drm_radeon_private_t *dev_priv = dev->dev_private;
drm_radeon_stipple_t stipple;
u32 mask[32];
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
if ( copy_from_user( &stipple, (drm_radeon_stipple_t *)arg,
sizeof(stipple) ) )
return -EFAULT;
- if ( copy_from_user( &mask, stipple.mask,
- 32 * sizeof(u32) ) )
+ if ( copy_from_user( &mask, stipple.mask, 32 * sizeof(u32) ) )
return -EFAULT;
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+
radeon_cp_dispatch_stipple( dev, mask );
return 0;
@@ -1380,11 +1418,8 @@ int radeon_cp_indirect( struct inode *inode, struct file *filp,
drm_radeon_indirect_t indirect;
RING_LOCALS;
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) ||
- dev->lock.pid != current->pid ) {
- DRM_ERROR( "%s called without lock held\n", __FUNCTION__ );
- return -EINVAL;
- }
+ LOCK_TEST_WITH_RETURN( dev );
+
if ( !dev_priv || dev_priv->is_pci ) {
DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ );
return -EINVAL;
@@ -1423,7 +1458,8 @@ int radeon_cp_indirect( struct inode *inode, struct file *filp,
return -EINVAL;
}
- VB_AGE_CHECK_WITH_RET( dev_priv );
+ RING_SPACE_TEST_WITH_RETURN( dev_priv );
+ VB_AGE_TEST_WITH_RETURN( dev_priv );
buf->used = indirect.end;
buf_priv->discard = indirect.discard;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h
new file mode 100644
index 000000000..f5046f7f9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h
@@ -0,0 +1,44 @@
+/* stubsupport.h -- -*- linux-c -*-
+ * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org
+ *
+ * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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@valinux.com>
+ *
+ */
+
+#ifndef _STUBSUPPORT_PRE24_H_
+#define _STUBSUPPORT_PRE24_H_
+struct drm_stub_info *DRM(_stub_pointer) = NULL;
+#define inter_module_put(x)
+#define inter_module_unregister(x)
+#define inter_module_get(x) DRM(_stub_pointer)
+#define inter_module_register(x,y,z) do { DRM(_stub_pointer) = z; } while (0)
+
+ /* This is a kludge for backward compatibility
+ that is only useful in DRM(stub_open) */
+#define fops_put(fops) MOD_DEC_USE_COUNT
+#define fops_get(fops) (fops); MOD_INC_USE_COUNT
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h
new file mode 100644
index 000000000..40aba8fb2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h
@@ -0,0 +1,42 @@
+/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*-
+ * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+#ifndef __TDFX_H__
+#define __TDFX_H__
+
+/* This remains constant for all DRM template files.
+ */
+#define DRM(x) tdfx_##x
+
+/* General customization:
+ */
+#define __HAVE_MTRR 1
+#define __HAVE_CTX_BITMAP 1
+
+#endif
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 7d79a013b..f478395f8 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
@@ -27,670 +27,35 @@
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
* Daryll Strauss <daryll@valinux.com>
- *
+ * Gareth Hughes <gareth@valinux.com>
*/
#include <linux/config.h>
+#include "tdfx.h"
#include "drmP.h"
-#include "tdfx_drv.h"
-
-#define TDFX_NAME "tdfx"
-#define TDFX_DESC "3dfx Banshee/Voodoo3+"
-#define TDFX_DATE "20000928"
-#define TDFX_MAJOR 1
-#define TDFX_MINOR 0
-#define TDFX_PATCHLEVEL 0
-
-static drm_device_t tdfx_device;
-drm_ctx_t tdfx_res_ctx;
-
-static struct file_operations tdfx_fops = {
-#if LINUX_VERSION_CODE >= 0x020400
- /* This started being used during 2.4.0-test */
- owner: THIS_MODULE,
-#endif
- open: tdfx_open,
- flush: drm_flush,
- release: tdfx_release,
- ioctl: tdfx_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
-};
-
-static struct miscdevice tdfx_misc = {
- minor: MISC_DYNAMIC_MINOR,
- name: TDFX_NAME,
- fops: &tdfx_fops,
-};
-
-static drm_ioctl_desc_t tdfx_ioctls[] = {
- [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { tdfx_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_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
-
- [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { tdfx_addctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { tdfx_getctx, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { tdfx_switchctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { tdfx_newctx, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { tdfx_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_LOCK)] = { tdfx_lock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- [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, 1},
- [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_unbind, 1, 1},
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1},
-#endif
-};
-#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls)
-
-#ifdef MODULE
-static char *tdfx = NULL;
-#endif
-
-MODULE_AUTHOR("VA Linux Systems, Inc.");
-MODULE_DESCRIPTION("tdfx");
-MODULE_PARM(tdfx, "s");
-
-#ifndef MODULE
-/* tdfx_options 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.
- */
-
-static int __init tdfx_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("tdfx=", tdfx_options);
-#endif
-
-static int tdfx_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);
-
- 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 = 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);
-
- tdfx_res_ctx.handle=-1;
-
- 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 tdfx_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");
-
- 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;
- }
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- /* Clear AGP information */
- if (dev->agp) {
- drm_agp_mem_t *temp;
- drm_agp_mem_t *temp_next;
-
- temp = dev->agp->memory;
- while(temp != NULL) {
- temp_next = temp->next;
- drm_free_agp(temp->memory, temp->pages);
- drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS);
- temp = temp_next;
- }
- if (dev->agp->acquired) _drm_agp_release();
- }
-#endif
- /* 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:
- /* Do nothing here, because this is all
- handled in the AGP/GART driver. */
- 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->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;
-}
-
-/* tdfx_init is called via init_module at module load time, or via
- * linux/init/main.c (this is not currently supported). */
-
-static int __init tdfx_init(void)
-{
- int retcode;
- drm_device_t *dev = &tdfx_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(tdfx);
-#endif
-
- if ((retcode = misc_register(&tdfx_misc))) {
- DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME);
- return retcode;
- }
- dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor);
- dev->name = TDFX_NAME;
-
- drm_mem_init();
- drm_proc_init(dev);
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- dev->agp = drm_agp_init();
-#endif
- if((retcode = drm_ctxbitmap_init(dev))) {
- DRM_ERROR("Cannot allocate memory for context bitmap.\n");
- drm_proc_cleanup();
- misc_deregister(&tdfx_misc);
- tdfx_takedown(dev);
- return retcode;
- }
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
- TDFX_NAME,
- TDFX_MAJOR,
- TDFX_MINOR,
- TDFX_PATCHLEVEL,
- TDFX_DATE,
- tdfx_misc.minor);
-
- return 0;
-}
-
-/* tdfx_cleanup is called via cleanup_module at module unload time. */
-
-static void __exit tdfx_cleanup(void)
-{
- drm_device_t *dev = &tdfx_device;
-
- DRM_DEBUG("\n");
-
- drm_proc_cleanup();
- if (misc_deregister(&tdfx_misc)) {
- DRM_ERROR("Cannot unload module\n");
- } else {
- DRM_INFO("Module unloaded\n");
- }
- drm_ctxbitmap_cleanup(dev);
- tdfx_takedown(dev);
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
- if (dev->agp) {
- drm_agp_uninit();
- drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-#endif
-}
-
-module_init(tdfx_init);
-module_exit(tdfx_cleanup);
-
-
-int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_version_t version;
- int len;
-
- if (copy_from_user(&version,
- (drm_version_t *)arg,
- sizeof(version)))
- return -EFAULT;
-
-#define DRM_COPY(name,value) \
- len = strlen(value); \
- if (len > name##_len) len = name##_len; \
- name##_len = strlen(value); \
- if (len && name) { \
- if (copy_to_user(name, value, len)) \
- return -EFAULT; \
- }
-
- version.version_major = TDFX_MAJOR;
- version.version_minor = TDFX_MINOR;
- version.version_patchlevel = TDFX_PATCHLEVEL;
-
- DRM_COPY(version.name, TDFX_NAME);
- DRM_COPY(version.date, TDFX_DATE);
- DRM_COPY(version.desc, TDFX_DESC);
-
- if (copy_to_user((drm_version_t *)arg,
- &version,
- sizeof(version)))
- return -EFAULT;
- return 0;
-}
-
-int tdfx_open(struct inode *inode, struct file *filp)
-{
- drm_device_t *dev = &tdfx_device;
- int retcode = 0;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_open_helper(inode, filp, dev))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- atomic_inc(&dev->total_open);
- spin_lock(&dev->count_lock);
- if (!dev->open_count++) {
- spin_unlock(&dev->count_lock);
- return tdfx_setup(dev);
- }
- spin_unlock(&dev->count_lock);
- }
- return retcode;
-}
-
-int tdfx_release(struct inode *inode, struct file *filp)
-{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev;
- int retcode = 0;
-
- lock_kernel();
- dev = priv->dev;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (!(retcode = drm_release(inode, filp))) {
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
- 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);
- unlock_kernel();
- return -EBUSY;
- }
- spin_unlock(&dev->count_lock);
- unlock_kernel();
- return tdfx_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
- }
-
- unlock_kernel();
- return retcode;
-}
-
-/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */
-
-int tdfx_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 >= TDFX_IOCTL_COUNT) {
- retcode = -EINVAL;
- } else {
- ioctl = &tdfx_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 tdfx_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;
-#if DRM_DMA_HISTOGRAM
- cycles_t start;
-
- dev->lck_start = start = get_cycles();
-#endif
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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 (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
- lock.context, current->pid, dev->lock.hw_lock->lock,
- lock.flags);
-
-#if 0
- /* dev->queue_count == 0 right now for
- tdfx. FIXME? */
- if (lock.context < 0 || lock.context >= dev->queue_count)
- return -EINVAL;
-#endif
-
- if (!ret) {
-#if 0
- if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
- != lock.context) {
- long j = jiffies - dev->lock.lock_time;
-
- if (lock.context == tdfx_res_ctx.handle &&
- j >= 0 && j < DRM_LOCK_SLICE) {
- /* Can't take lock if we just had it and
- there is contention. */
- DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n",
- lock.context, current->pid, j,
- dev->lock.lock_time, jiffies);
- current->state = TASK_INTERRUPTIBLE;
- current->policy |= SCHED_YIELD;
- schedule_timeout(DRM_LOCK_SLICE-j);
- DRM_DEBUG("jiffies=%d\n", jiffies);
- }
- }
-#endif
- add_wait_queue(&dev->lock.lock_queue, &entry);
- for (;;) {
- current->state = TASK_INTERRUPTIBLE;
- 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);
-#if 1
- current->policy |= SCHED_YIELD;
-#endif
- schedule();
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->lock.lock_queue, &entry);
- }
-
-#if 0
- if (!ret && dev->last_context != lock.context &&
- lock.context != tdfx_res_ctx.handle &&
- dev->last_context != tdfx_res_ctx.handle) {
- add_wait_queue(&dev->context_wait, &entry);
- current->state = TASK_INTERRUPTIBLE;
- /* PRE: dev->last_context != lock.context */
- tdfx_context_switch(dev, dev->last_context, lock.context);
- /* POST: we will wait for the context
- switch and will dispatch on a later call
- when dev->last_context == lock.context
- NOTE WE HOLD THE LOCK THROUGHOUT THIS
- TIME! */
- current->policy |= SCHED_YIELD;
- schedule();
- current->state = TASK_RUNNING;
- remove_wait_queue(&dev->context_wait, &entry);
- if (signal_pending(current)) {
- ret = -EINTR;
- } else if (dev->last_context != lock.context) {
- DRM_ERROR("Context mismatch: %d %d\n",
- dev->last_context, lock.context);
- }
- }
-#endif
-
- if (!ret) {
- sigemptyset(&dev->sigmask);
- sigaddset(&dev->sigmask, SIGSTOP);
- sigaddset(&dev->sigmask, SIGTSTP);
- sigaddset(&dev->sigmask, SIGTTIN);
- sigaddset(&dev->sigmask, SIGTTOU);
- dev->sigdata.context = lock.context;
- dev->sigdata.lock = dev->lock.hw_lock;
- block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
-
- if (lock.flags & _DRM_LOCK_READY) {
- /* Wait for space in DMA/FIFO */
- }
- if (lock.flags & _DRM_LOCK_QUIESCENT) {
- /* Make hardware quiescent */
-#if 0
- tdfx_quiescent(dev);
-#endif
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != tdfx_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY/4;
- }
-#endif
- DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
-
-#if DRM_DMA_HISTOGRAM
- atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
-#endif
-
- return ret;
-}
-
-
-int tdfx_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;
-
- if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock)))
- return -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);
- /* FIXME: Try to send data to card here */
- if (!dev->context_flag) {
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
- DRM_ERROR("\n");
- }
- }
-
-#if LINUX_VERSION_CODE < 0x020400
- if (lock.context != tdfx_res_ctx.handle) {
- current->counter = 5;
- current->priority = DEF_PRIORITY;
- }
-#endif
- unblock_all_signals();
- return 0;
-}
+#define DRIVER_AUTHOR "VA Linux Systems Inc."
+
+#define DRIVER_NAME "tdfx"
+#define DRIVER_DESC "3dfx Banshee/Voodoo3+"
+#define DRIVER_DATE "20010216"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 0
+#define DRIVER_PATCHLEVEL 0
+
+
+#include "drm_auth.h"
+#include "drm_bufs.h"
+#include "drm_context.h"
+#include "drm_dma.h"
+#include "drm_drawable.h"
+#include "drm_drv.h"
+#include "drm_fops.h"
+#include "drm_init.h"
+#include "drm_ioctl.h"
+#include "drm_lock.h"
+#include "drm_memory.h"
+#include "drm_proc.h"
+#include "drm_vm.h"
+#include "drm_stub.h"
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 5c2c08c3b..a7be5031c 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
@@ -11,11 +11,11 @@
* 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
@@ -23,12 +23,12 @@
* OTHER LIABILITY, WHETHER IN AN ACTION 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@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.17 2000/09/24 13:51:32 alanh Exp $
- *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.18 2001/03/21 18:08:54 dawes Exp $
+ *
*/
#ifdef XFree86Server
@@ -81,7 +81,18 @@ extern unsigned long _bus_base(void);
#include "xf86drm.h"
#include "drm.h"
-#define DRM_FIXED_DEVICE_MAJOR 145
+#ifndef DRM_MAJOR
+#define DRM_MAJOR 226 /* Linux */
+#endif
+
+#ifndef __linux__
+#undef DRM_MAJOR
+#define DRM_MAJOR 145 /* Should set in drm.h for *BSD */
+#endif
+
+#ifndef DRM_MAX_MINOR
+#define DRM_MAX_MINOR 16
+#endif
#ifdef __linux__
#include <sys/sysmacros.h> /* for makedev() */
@@ -119,7 +130,7 @@ void drmFree(void *pt)
static char *drmStrdup(const char *s)
{
char *retval = NULL;
-
+
if (s) {
retval = _DRM_MALLOC(strlen(s)+1);
strcpy(retval, s);
@@ -161,93 +172,108 @@ static drmHashEntry *drmGetEntry(int fd)
return entry;
}
-/* drm_open is used to open the /dev/dri device */
-
-static int drm_open(const char *file)
-{
- int fd = open(file, O_RDWR, 0);
-
- if (fd >= 0) return fd;
- return -errno;
-}
-
-static int drmOpenDevice(const char *path, long dev,
- mode_t mode, uid_t user, gid_t group)
+static int drmOpenDevice(long dev, int minor)
{
#ifdef XFree86LOADER
struct xf86stat st;
#else
struct stat st;
#endif
+ char buf[64];
+ int fd;
+ mode_t dirmode = DRM_DEV_DIRMODE;
+ mode_t devmode = DRM_DEV_MODE;
+ int isroot = !geteuid();
+#if defined(XFree86Server)
+ uid_t user = DRM_DEV_UID;
+ gid_t group = DRM_DEV_GID;
+#endif
- /* Fiddle mode to remove execute bits */
- mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+#if defined(XFree86Server)
+ devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
+ dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0;
+ dirmode |= (devmode & S_IRGRP) ? S_IXGRP : 0;
+ dirmode |= (devmode & S_IROTH) ? S_IXOTH : 0;
+ dirmode |= devmode;
+ devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+ group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
+#endif
- if (!stat(path, &st) && st.st_rdev == dev) {
- if (!geteuid()) {
- chown(path, user, group);
- chmod(path, mode);
- }
- return drm_open(path);
+ if (stat(DRM_DIR_NAME, &st)) {
+ if (!isroot) return DRM_ERR_NOT_ROOT;
+ remove(DRM_DIR_NAME);
+ mkdir(DRM_DIR_NAME, dirmode);
}
+#if defined(XFree86Server)
+ chown(DRM_DIR_NAME, user, group);
+ chmod(DRM_DIR_NAME, dirmode);
+#endif
- if (geteuid()) return DRM_ERR_NOT_ROOT;
- remove(path);
- if (mknod(path, S_IFCHR, dev)) {
- remove(path);
- return DRM_ERR_NOT_ROOT;
+ sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
+ if (stat(buf, &st) || st.st_rdev != dev) {
+ if (!isroot) return DRM_ERR_NOT_ROOT;
+ remove(buf);
+ mknod(buf, S_IFCHR | devmode, dev);
}
- chown(path, user, group);
- chmod(path, mode);
- return drm_open(path);
+#if defined(XFree86Server)
+ chown(buf, user, group);
+ chmod(buf, devmode);
+#endif
+
+ if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd;
+ remove(buf);
+ return -errno;
}
-/* drmAvailable looks for /proc/dri, and returns 1 if it is present. On
- OSs that do not have a Linux-like /proc, this information will not be
- available, and we'll have to create a device and check if the driver is
- loaded that way. */
+int drmOpenMinor(int minor, int create)
+{
+ int fd;
+ char buf[64];
+
+ if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor);
+
+ sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
+ if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd;
+ return -errno;
+}
+
+/* drmAvailable looks for (DRM_MAJOR, 0) and returns 1 if it returns
+ information for DRM_IOCTL_VERSION. For backward compatibility with
+ older Linux implementations, /proc/dri is also checked. */
int drmAvailable(void)
{
- char dev_name[64];
drmVersionPtr version;
int retval = 0;
int fd;
+
+ if ((fd = drmOpenMinor(0, 1)) < 0) {
+ /* Try proc for backward Linux compatibility */
+ if (!access("/proc/dri/0", R_OK)) return 1;
+ return 0;
+ }
- if (!access("/proc/dri/0", R_OK)) return 1;
-
- sprintf(dev_name, "/dev/dri-temp-%d", getpid());
-
- remove(dev_name);
- if ((fd = drmOpenDevice(dev_name, makedev(DRM_FIXED_DEVICE_MAJOR, 0),
- S_IRUSR, geteuid(), getegid())) >= 0) {
- /* Read version to make sure this is
- actually a DRI device. */
- if ((version = drmGetVersion(fd))) {
- retval = 1;
- drmFreeVersion(version);
- }
- close(fd);
+ if ((version = drmGetVersion(fd))) {
+ retval = 1;
+ drmFreeVersion(version);
}
- remove(dev_name);
+ close(fd);
return retval;
}
static int drmOpenByBusid(const char *busid)
{
- int i;
- char dev_name[64];
- char *buf;
- int fd;
-
- for (i = 0; i < 8; i++) {
- sprintf(dev_name, "/dev/dri/card%d", i);
- if ((fd = drm_open(dev_name)) >= 0) {
+ int i;
+ int fd;
+ const char *buf;
+
+ for (i = 0; i < DRM_MAX_MINOR; i++) {
+ if ((fd = drmOpenMinor(i, 0)) >= 0) {
buf = drmGetBusid(fd);
if (buf && !strcmp(buf, busid)) {
- drmFreeBusid(buf);
- return fd;
+ drmFreeBusid(buf);
+ return fd;
}
if (buf) drmFreeBusid(buf);
close(fd);
@@ -258,54 +284,43 @@ static int drmOpenByBusid(const char *busid)
static int drmOpenByName(const char *name)
{
- int i;
- char proc_name[64];
- char dev_name[64];
- char buf[512];
- mode_t mode = DRM_DEV_MODE;
- mode_t dirmode;
- gid_t group = DRM_DEV_GID;
- uid_t user = DRM_DEV_UID;
- int fd;
- char *pt;
- char *driver = NULL;
- char *devstring;
- long dev = 0;
- int retcode;
-
-#if defined(XFree86Server)
- mode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
- group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
-#endif
-
-#if defined(XFree86Server)
+ int i;
+ int fd;
+ drmVersionPtr version;
+
if (!drmAvailable()) {
+#if !defined(XFree86Server)
+ return -1;
+#else
/* try to load the kernel module now */
if (!xf86LoadKernelModule(name)) {
ErrorF("[drm] failed to load kernel module \"%s\"\n",
name);
return -1;
}
- }
-#else
- if (!drmAvailable())
- return -1;
#endif
+ }
- if (!geteuid()) {
- dirmode = mode;
- if (dirmode & S_IRUSR) dirmode |= S_IXUSR;
- if (dirmode & S_IRGRP) dirmode |= S_IXGRP;
- if (dirmode & S_IROTH) dirmode |= S_IXOTH;
- dirmode &= ~(S_IWGRP | S_IWOTH);
- mkdir("/dev/dri", 0);
- chown("/dev/dri", user, group);
- chmod("/dev/dri", dirmode);
+ for (i = 0; i < DRM_MAX_MINOR; i++) {
+ if ((fd = drmOpenMinor(i, 1)) >= 0) {
+ if ((version = drmGetVersion(fd))) {
+ if (!strcmp(version->name, name)) {
+ drmFreeVersion(version);
+ return fd;
+ }
+ drmFreeVersion(version);
+ }
+ }
}
+#ifdef __linux__
+ /* Backward-compatibility /proc support */
for (i = 0; i < 8; i++) {
+ char proc_name[64], buf[512];
+ char *driver, *pt, *devstring;
+ int retcode;
+
sprintf(proc_name, "/proc/dri/%d/name", i);
- sprintf(dev_name, "/dev/dri/card%d", i);
if ((fd = open(proc_name, 0, 0)) >= 0) {
retcode = read(fd, buf, sizeof(buf)-1);
close(fd);
@@ -319,34 +334,17 @@ static int drmOpenByName(const char *name)
for (devstring = ++pt; *pt && *pt != ' '; ++pt)
;
if (*pt) { /* Found busid */
- return drmOpenByBusid(++pt);
+ return drmOpenByBusid(++pt);
} else { /* No busid */
- dev = strtol(devstring, NULL, 0);
- return drmOpenDevice(dev_name, dev,
- mode, user, group);
+ return drmOpenDevice(strtol(devstring, NULL, 0),i);
}
}
}
}
- } else {
- drmVersionPtr version;
- /* /proc/dri not available, possibly
- because we aren't on a Linux system.
- So, try to create the next device and
- see if it's active. */
- dev = makedev(DRM_FIXED_DEVICE_MAJOR, i);
- if ((fd = drmOpenDevice(dev_name, dev, mode, user, group))) {
- if ((version = drmGetVersion(fd))) {
- if (!strcmp(version->name, name)) {
- drmFreeVersion(version);
- return fd;
- }
- drmFreeVersion(version);
- }
- }
- remove(dev_name);
}
}
+#endif
+
return -1;
}
@@ -408,7 +406,7 @@ drmVersionPtr drmGetVersion(int fd)
version->date = NULL;
version->desc_len = 0;
version->desc = NULL;
-
+
if (ioctl(fd, DRM_IOCTL_VERSION, version)) {
drmFreeKernelVersion(version);
return NULL;
@@ -421,7 +419,7 @@ drmVersionPtr drmGetVersion(int fd)
version->date = drmMalloc(version->date_len + 1);
if (version->desc_len)
version->desc = drmMalloc(version->desc_len + 1);
-
+
if (ioctl(fd, DRM_IOCTL_VERSION, version)) {
drmFreeKernelVersion(version);
return NULL;
@@ -503,7 +501,7 @@ int drmAddMap(int fd,
map.offset = offset;
#ifdef __alpha__
/* Make sure we add the bus_base to all but shm */
- if (type != DRM_SHM)
+ if (type != DRM_SHM)
map.offset += BUS_BASE;
#endif
map.size = size;
@@ -515,18 +513,28 @@ int drmAddMap(int fd,
return 0;
}
+int drmRmMap(int fd, drmHandle handle)
+{
+ drm_map_t map;
+
+ map.handle = (void *)handle;
+
+ if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno;
+ return 0;
+}
+
int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags,
int agp_offset)
{
drm_buf_desc_t request;
-
+
request.count = count;
request.size = size;
request.low_mark = 0;
request.high_mark = 0;
request.flags = flags;
request.agp_start = agp_offset;
-
+
if (ioctl(fd, DRM_IOCTL_ADD_BUFS, &request)) return -errno;
return request.count;
}
@@ -542,16 +550,16 @@ int drmMarkBufs(int fd, double low, double high)
if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return -EINVAL;
if (!info.count) return -EINVAL;
-
+
if (!(info.list = drmMalloc(info.count * sizeof(*info.list))))
return -ENOMEM;
-
+
if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) {
int retval = -errno;
drmFree(info.list);
return retval;
}
-
+
for (i = 0; i < info.count; i++) {
info.list[i].low_mark = low * info.list[i].count;
info.list[i].high_mark = high * info.list[i].count;
@@ -562,7 +570,7 @@ int drmMarkBufs(int fd, double low, double high)
}
}
drmFree(info.list);
-
+
return 0;
}
@@ -630,7 +638,7 @@ drmBufInfoPtr drmGetBufInfo(int fd)
if (info.count) {
if (!(info.list = drmMalloc(info.count * sizeof(*info.list))))
return NULL;
-
+
if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) {
drmFree(info.list);
return NULL;
@@ -657,7 +665,7 @@ drmBufMapPtr drmMapBufs(int fd)
drm_buf_map_t bufs;
drmBufMapPtr retval;
int i;
-
+
bufs.count = 0;
bufs.list = NULL;
if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL;
@@ -689,16 +697,19 @@ drmBufMapPtr drmMapBufs(int fd)
int drmUnmapBufs(drmBufMapPtr bufs)
{
int i;
-
+
for (i = 0; i < bufs->count; i++) {
munmap(bufs->list[i].address, bufs->list[i].total);
}
return 0;
}
+#define DRM_DMA_RETRY 16
+
int drmDMA(int fd, drmDMAReqPtr request)
{
drm_dma_t dma;
+ int ret, i = 0;
/* Copy to hidden structure */
dma.context = request->context;
@@ -710,10 +721,17 @@ int drmDMA(int fd, drmDMAReqPtr request)
dma.request_size = request->request_size;
dma.request_indices = request->request_list;
dma.request_sizes = request->request_sizes;
- if (ioctl(fd, DRM_IOCTL_DMA, &dma)) return -errno;
- request->granted_count = dma.granted_count;
-
- return 0;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_DMA, &dma );
+ } while ( ret && errno == EAGAIN && i++ < DRM_DMA_RETRY );
+
+ if ( ret == 0 ) {
+ request->granted_count = dma.granted_count;
+ return 0;
+ } else {
+ return -errno;
+ }
}
int drmGetLock(int fd, drmContext context, drmLockFlags flags)
@@ -728,7 +746,7 @@ int drmGetLock(int fd, drmContext context, drmLockFlags flags)
if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL;
if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES;
if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES;
-
+
while (ioctl(fd, DRM_IOCTL_LOCK, &lock))
;
return 0;
@@ -827,7 +845,7 @@ int drmGetContextFlags(int fd, drmContext context, drmContextFlagsPtr flags)
if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY;
return 0;
}
-
+
int drmDestroyContext(int fd, drmContext handle)
{
drm_ctx_t ctx;
@@ -1074,12 +1092,189 @@ void *drmGetContextTag(int fd, drmContext context)
{
drmHashEntry *entry = drmGetEntry(fd);
void *value;
-
+
if (drmHashLookup(entry->tagTable, context, &value)) return NULL;
return value;
}
+int drmAddContextPrivateMapping(int fd, drmContext ctx_id, drmHandle handle)
+{
+ drm_ctx_priv_map_t map;
+
+ map.ctx_id = ctx_id;
+ map.handle = (void *)handle;
+
+ if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno;
+ return 0;
+}
+
+int drmGetContextPrivateMapping(int fd, drmContext ctx_id, drmHandlePtr handle)
+{
+ drm_ctx_priv_map_t map;
+
+ map.ctx_id = ctx_id;
+
+ if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno;
+ if (handle) *handle = (drmHandle)map.handle;
+
+ return 0;
+}
+
+int drmGetMap(int fd, int idx, drmHandle *offset, drmSize *size,
+ drmMapType *type, drmMapFlags *flags, drmHandle *handle,
+ int *mtrr)
+{
+ drm_map_t map;
+
+ map.offset = idx;
+ if (ioctl(fd, DRM_IOCTL_GET_MAP, &map)) return -errno;
+ *offset = map.offset;
+ *size = map.size;
+ *type = map.type;
+ *flags = map.flags;
+ *handle = (unsigned long)map.handle;
+ *mtrr = map.mtrr;
+ return 0;
+}
+
+int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
+ unsigned long *magic, unsigned long *iocs)
+{
+ drm_client_t client;
+
+ client.idx = idx;
+ if (ioctl(fd, DRM_IOCTL_GET_CLIENT, &client)) return -errno;
+ *auth = client.auth;
+ *pid = client.pid;
+ *uid = client.uid;
+ *magic = client.magic;
+ *iocs = client.iocs;
+ return 0;
+}
+
+int drmGetStats(int fd, drmStatsT *stats)
+{
+ drm_stats_t s;
+ int i;
+
+ if (ioctl(fd, DRM_IOCTL_GET_STATS, &s)) return -errno;
+
+ stats->count = 0;
+ memset(stats, 0, sizeof(*stats));
+ if (s.count > sizeof(stats->data)/sizeof(stats->data[0]))
+ return -1;
+
+#define SET_VALUE \
+ stats->data[i].long_format = "%-20.20s"; \
+ stats->data[i].rate_format = "%8.8s"; \
+ stats->data[i].isvalue = 1; \
+ stats->data[i].verbose = 0
+
+#define SET_COUNT \
+ stats->data[i].long_format = "%-20.20s"; \
+ stats->data[i].rate_format = "%5.5s"; \
+ stats->data[i].isvalue = 0; \
+ stats->data[i].mult_names = "kgm"; \
+ stats->data[i].mult = 1000; \
+ stats->data[i].verbose = 0
+
+#define SET_BYTE \
+ stats->data[i].long_format = "%-20.20s"; \
+ stats->data[i].rate_format = "%5.5s"; \
+ stats->data[i].isvalue = 0; \
+ stats->data[i].mult_names = "KGM"; \
+ stats->data[i].mult = 1024; \
+ stats->data[i].verbose = 0
+
+
+ stats->count = s.count;
+ for (i = 0; i < s.count; i++) {
+ stats->data[i].value = s.data[i].value;
+ switch (s.data[i].type) {
+ case _DRM_STAT_LOCK:
+ stats->data[i].long_name = "Lock";
+ stats->data[i].rate_name = "Lock";
+ SET_VALUE;
+ break;
+ case _DRM_STAT_OPENS:
+ stats->data[i].long_name = "Opens";
+ stats->data[i].rate_name = "O";
+ SET_COUNT;
+ stats->data[i].verbose = 1;
+ break;
+ case _DRM_STAT_CLOSES:
+ stats->data[i].long_name = "Closes";
+ stats->data[i].rate_name = "Lock";
+ SET_COUNT;
+ stats->data[i].verbose = 1;
+ break;
+ case _DRM_STAT_IOCTLS:
+ stats->data[i].long_name = "Ioctls";
+ stats->data[i].rate_name = "Ioc/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_LOCKS:
+ stats->data[i].long_name = "Locks";
+ stats->data[i].rate_name = "Lck/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_UNLOCKS:
+ stats->data[i].long_name = "Unlocks";
+ stats->data[i].rate_name = "Unl/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_IRQ:
+ stats->data[i].long_name = "IRQs";
+ stats->data[i].rate_name = "IRQ/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_PRIMARY:
+ stats->data[i].long_name = "Primary Bytes";
+ stats->data[i].rate_name = "PB/s";
+ SET_BYTE;
+ break;
+ case _DRM_STAT_SECONDARY:
+ stats->data[i].long_name = "Secondary Bytes";
+ stats->data[i].rate_name = "SB/s";
+ SET_BYTE;
+ break;
+ case _DRM_STAT_DMA:
+ stats->data[i].long_name = "DMA";
+ stats->data[i].rate_name = "DMA/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_SPECIAL:
+ stats->data[i].long_name = "Special DMA";
+ stats->data[i].rate_name = "dma/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_MISSED:
+ stats->data[i].long_name = "Miss";
+ stats->data[i].rate_name = "Ms/s";
+ SET_COUNT;
+ break;
+ case _DRM_STAT_VALUE:
+ stats->data[i].long_name = "Value";
+ stats->data[i].rate_name = "Value";
+ SET_VALUE;
+ break;
+ case _DRM_STAT_BYTE:
+ stats->data[i].long_name = "Bytes";
+ stats->data[i].rate_name = "B/s";
+ SET_BYTE;
+ break;
+ case _DRM_STAT_COUNT:
+ default:
+ stats->data[i].long_name = "Count";
+ stats->data[i].rate_name = "Cnt/s";
+ SET_COUNT;
+ break;
+ }
+ }
+ return 0;
+}
+
#if defined(XFree86Server) || defined(DRM_USE_MALLOC)
static void drmSIGIOHandler(int interrupt, void *closure)
{
@@ -1108,7 +1303,7 @@ static void drmSIGIOHandler(int interrupt, void *closure)
#if 0
fprintf(stderr, "Got %s\n", buf);
#endif
-
+
for (pt = buf; *pt != ' '; ++pt); /* Find first space */
++pt;
old = strtol(pt, &pt, 0);
@@ -1141,7 +1336,7 @@ int drmRemoveSIGIOHandler(int fd)
drmHashEntry *entry = drmGetEntry(fd);
entry->f = NULL;
-
+
return xf86RemoveSIGIOHandler(fd);
}
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c
index 24b698cce..1f1a05b3a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c
@@ -10,11 +10,11 @@
* 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
@@ -22,10 +22,10 @@
* OTHER LIABILITY, WHETHER IN AN ACTION 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@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $
*
* DESCRIPTION
*
@@ -187,7 +187,7 @@ int N(HashDestroy)(void *t)
int i;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
+
for (i = 0; i < HASH_SIZE; i++) {
for (bucket = table->buckets[i]; bucket;) {
next = bucket->next;
@@ -235,8 +235,8 @@ int N(HashLookup)(void *t, unsigned long key, void **value)
HashTablePtr table = (HashTablePtr)t;
HashBucketPtr bucket;
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
+ if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */
+
bucket = HashFind(table, key, NULL);
if (!bucket) return 1; /* Not found */
*value = bucket->value;
@@ -250,7 +250,7 @@ int N(HashInsert)(void *t, unsigned long key, void *value)
unsigned long hash;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
+
if (HashFind(table, key, &hash)) return 1; /* Already in table */
bucket = HASH_ALLOC(sizeof(*bucket));
@@ -272,7 +272,7 @@ int N(HashDelete)(void *t, unsigned long key)
HashBucketPtr bucket;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
+
bucket = HashFind(table, key, &hash);
if (!bucket) return 1; /* Not found */
@@ -285,7 +285,7 @@ int N(HashDelete)(void *t, unsigned long key)
int N(HashNext)(void *t, unsigned long *key, void **value)
{
HashTablePtr table = (HashTablePtr)t;
-
+
for (; table->p0 < HASH_SIZE;
++table->p0, table->p1 = table->buckets[table->p0]) {
if (table->p1) {
@@ -301,7 +301,7 @@ int N(HashNext)(void *t, unsigned long *key, void **value)
int N(HashFirst)(void *t, unsigned long *key, void **value)
{
HashTablePtr table = (HashTablePtr)t;
-
+
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
table->p0 = 0;
@@ -337,7 +337,7 @@ static void compute_dist(HashTablePtr table)
{
int i;
HashBucketPtr bucket;
-
+
printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n",
table->entries, table->hits, table->partials, table->misses);
clear_dist();
@@ -356,7 +356,7 @@ static void check_table(HashTablePtr table,
{
unsigned long retval = 0;
int retcode = N(HashLookup)(table, key, &retval);
-
+
switch (retcode) {
case -1:
printf("Bad magic = 0x%08lx:"
@@ -391,7 +391,7 @@ int main(void)
for (i = 256; i >= 0; i--) check_table(table, i, i);
compute_dist(table);
N(HashDestroy)(table);
-
+
printf("\n***** 1024 consecutive integers ****\n");
table = N(HashCreate)();
for (i = 0; i < 1024; i++) N(HashInsert)(table, i, i);
@@ -399,7 +399,7 @@ int main(void)
for (i = 1024; i >= 0; i--) check_table(table, i, i);
compute_dist(table);
N(HashDestroy)(table);
-
+
printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
table = N(HashCreate)();
for (i = 0; i < 1024; i++) N(HashInsert)(table, i*4096, i);
@@ -407,7 +407,7 @@ int main(void)
for (i = 1024; i >= 0; i--) check_table(table, i*4096, i);
compute_dist(table);
N(HashDestroy)(table);
-
+
printf("\n***** 1024 random integers ****\n");
table = N(HashCreate)();
srandom(0xbeefbeef);
@@ -429,7 +429,7 @@ int main(void)
for (i = 0; i < 5000; i++) check_table(table, random(), i);
compute_dist(table);
N(HashDestroy)(table);
-
+
return 0;
}
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c
index d5a7e2263..064340e08 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */
#ifdef XFree86Server
# include "xf86.h"
@@ -70,8 +70,8 @@ Bool drmI810InitDma(int driSubFD, drmI810Init *info)
memset(&init, 0, sizeof(drm_i810_init_t));
init.func = I810_INIT_DMA;
- init.ring_map_idx = info->ring_map_idx;
- init.buffer_map_idx = info->buffer_map_idx;
+ init.mmio_offset = info->mmio_offset;
+ init.buffers_offset = info->buffers_offset;
init.ring_start = info->start;
init.ring_end = info->end;
init.ring_size = info->size;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c
index d566b0868..2ba199fdb 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c
@@ -1,4 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */
+/* xf86drmMga.c -- User-level interface to MGA DRM device
+ * Created: Sun Apr 9 18:13:54 2000 by gareth@valinux.com
+ *
+ * Copyright 1999, 2000 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:
+ * Gareth Hughes <gareth@valinux.com>
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */
#ifdef XFree86Server
# include "xf86.h"
@@ -49,73 +78,237 @@ extern int xf86RemoveSIGIOHandler(int fd);
#include "xf86drmMga.h"
#include "drm.h"
-Bool drmMgaCleanupDma(int driSubFD)
+#define MGA_IDLE_RETRY 128
+
+
+int drmMGAInitDMA( int fd, drmMGAInit *info )
{
drm_mga_init_t init;
- memset(&init, 0, sizeof(drm_mga_init_t));
+
+ memset( &init, 0, sizeof(drm_mga_init_t) );
+
+ init.func = MGA_INIT_DMA;
+
+ init.sarea_priv_offset = info->sarea_priv_offset;
+ init.sgram = info->sgram;
+ init.chipset = info->chipset;
+ init.maccess = info->maccess;
+
+ init.fb_cpp = info->fb_cpp;
+ init.front_offset = info->front_offset;
+ init.front_pitch = info->front_pitch;
+ init.back_offset = info->back_offset;
+ init.back_pitch = info->back_pitch;
+
+ init.depth_cpp = info->depth_cpp;
+ init.depth_offset = info->depth_offset;
+ init.depth_pitch = info->depth_pitch;
+
+ init.texture_offset[0] = info->texture_offset[0];
+ init.texture_size[0] = info->texture_size[0];
+ init.texture_offset[1] = info->texture_offset[1];
+ init.texture_size[1] = info->texture_size[1];
+
+ init.fb_offset = info->fb_offset;
+ init.mmio_offset = info->mmio_offset;
+ init.status_offset = info->status_offset;
+ init.warp_offset = info->warp_offset;
+ init.primary_offset = info->primary_offset;
+ init.buffers_offset = info->buffers_offset;
+
+ if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) {
+ return -errno;
+ } else {
+ return 0;
+ }
+}
+
+int drmMGACleanupDMA( int fd )
+{
+ drm_mga_init_t init;
+
+ memset( &init, 0, sizeof(drm_mga_init_t) );
+
init.func = MGA_CLEANUP_DMA;
- if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) {
- return FALSE;
+
+ if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) {
+ return -errno;
+ } else {
+ return 0;
}
-
- return TRUE;
}
-Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags)
+int drmMGAFlushDMA( int fd, drmLockFlags flags )
{
drm_lock_t lock;
-
- memset(&lock, 0, sizeof(drm_lock_t));
-
- if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT;
- if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH;
- if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL;
-
- if(ioctl(driSubFD, DRM_IOCTL_MGA_FLUSH, &lock)) {
- return FALSE;
+ int ret, i = 0;
+
+ memset( &lock, 0, sizeof(drm_lock_t) );
+
+ if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= _DRM_LOCK_QUIESCENT;
+ if ( flags & DRM_LOCK_FLUSH ) lock.flags |= _DRM_LOCK_FLUSH;
+ if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= _DRM_LOCK_FLUSH_ALL;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+
+ if ( ret == 0 )
+ return 0;
+ if ( errno != EBUSY )
+ return -errno;
+
+ if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
+ /* Only keep trying if we need quiescence.
+ */
+ lock.flags &= ~(_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL);
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+ }
+
+ if ( ret == 0 ) {
+ return 0;
+ } else {
+ return -errno;
+ }
+}
+
+int drmMGAEngineReset( int fd )
+{
+ if ( ioctl( fd, DRM_IOCTL_MGA_RESET, NULL ) ) {
+ return -errno;
+ } else {
+ return 0;
+ }
+}
+
+int drmMGAFullScreen( int fd, int enable )
+{
+ return -EINVAL;
+}
+
+int drmMGASwapBuffers( int fd )
+{
+ int ret, i = 0;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_SWAP, NULL );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+
+ if ( ret == 0 ) {
+ return 0;
+ } else {
+ return -errno;
+ }
+}
+
+int drmMGAClear( int fd, unsigned int flags,
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask )
+{
+ drm_mga_clear_t clear;
+ int ret, i = 0;
+
+ clear.flags = flags;
+ clear.clear_color = clear_color;
+ clear.clear_depth = clear_depth;
+ clear.color_mask = color_mask;
+ clear.depth_mask = depth_mask;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_CLEAR, &clear );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+
+ if ( ret == 0 ) {
+ return 0;
+ } else {
+ return -errno;
+ }
+}
+
+int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard )
+{
+ drm_mga_vertex_t vertex;
+
+ vertex.idx = index;
+ vertex.used = used;
+ vertex.discard = discard;
+
+ if ( ioctl( fd, DRM_IOCTL_MGA_VERTEX, &vertex ) ) {
+ return -errno;
+ } else {
+ return 0;
}
-
- return TRUE;
}
-Bool drmMgaInitDma(int driSubFD, drmMgaInit *info)
+int drmMGAFlushIndices( int fd, int index, int start, int end, int discard )
{
- drm_mga_init_t init;
- int i;
-
- memset(&init, 0, sizeof(drm_mga_init_t));
- init.func = MGA_INIT_DMA;
- init.reserved_map_agpstart = info->reserved_map_agpstart;
- init.reserved_map_idx = info->reserved_map_idx;
- init.buffer_map_idx = info->buffer_map_idx;
- init.sarea_priv_offset = info->sarea_priv_offset;
- init.primary_size = info->primary_size;
- init.warp_ucode_size = info->warp_ucode_size;
- init.frontOffset = info->frontOffset;
- init.backOffset = info->backOffset;
- init.depthOffset = info->depthOffset;
- init.textureOffset = info->textureOffset;
- init.textureSize = info->textureSize;
- init.agpTextureSize = info->agpTextureSize;
- init.agpTextureOffset = info->agpTextureOffset;
- init.cpp = info->cpp;
- init.stride = info->stride;
- init.sgram = info->sgram;
- init.chipset = info->chipset;
-
- for(i = 0; i < MGA_MAX_WARP_PIPES; i++) {
- init.WarpIndex[i].installed = info->WarpIndex[i].installed;
- init.WarpIndex[i].phys_addr = info->WarpIndex[i].phys_addr;
- init.WarpIndex[i].size = info->WarpIndex[i].size;
- }
-
- init.mAccess = info->mAccess;
-
-
-
- if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) {
- return FALSE;
- }
- return TRUE;
+ drm_mga_indices_t indices;
+
+ indices.idx = index;
+ indices.start = start;
+ indices.end = end;
+ indices.discard = discard;
+
+ if ( ioctl( fd, DRM_IOCTL_MGA_INDICES, &indices ) ) {
+ return -errno;
+ } else {
+ return 0;
+ }
}
+int drmMGATextureLoad( int fd, int index,
+ unsigned int dstorg, unsigned int length )
+{
+ drm_mga_iload_t iload;
+ int ret, i = 0;
+
+ iload.idx = index;
+ iload.dstorg = dstorg;
+ iload.length = length;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_ILOAD, &iload );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+
+ if ( ret == 0 ) {
+ return 0;
+ } else {
+ return -errno;
+ }
+}
+
+int drmMGAAgpBlit( int fd, unsigned int planemask,
+ unsigned int src_offset, int src_pitch,
+ unsigned int dst_offset, int dst_pitch,
+ int delta_sx, int delta_sy,
+ int delta_dx, int delta_dy,
+ int height, int ydir )
+{
+ drm_mga_blit_t blit;
+ int ret, i = 0;
+
+ blit.planemask = planemask;
+ blit.srcorg = src_offset;
+ blit.dstorg = dst_offset;
+ blit.src_pitch = src_pitch;
+ blit.dst_pitch = dst_pitch;
+ blit.delta_sx = delta_sx;
+ blit.delta_sy = delta_sy;
+ blit.delta_dx = delta_dx;
+ blit.delta_dx = delta_dx;
+ blit.height = height;
+ blit.ydir = ydir;
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_MGA_BLIT, &blit );
+ } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY );
+
+ if ( ret == 0 ) {
+ return 0;
+ } else {
+ return -errno;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c
index 82559225e..c10ee7924 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c
@@ -26,7 +26,7 @@
* Author: Kevin E. Martin <martin@valinux.com>
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.7 2001/01/08 01:07:37 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.8 2001/03/21 18:08:54 dawes Exp $ */
#ifdef XFree86Server
# include "xf86.h"
@@ -154,8 +154,11 @@ int drmR128StopCCE( int fd )
ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop );
- if ( ret && errno != EBUSY )
+ if ( ret == 0 ) {
+ return 0;
+ } else if ( errno != EBUSY ) {
return -errno;
+ }
stop.flush = 0;
@@ -163,8 +166,11 @@ int drmR128StopCCE( int fd )
ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop );
} while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
- if ( ret && errno != EBUSY )
+ if ( ret == 0 ) {
+ return 0;
+ } else if ( errno != EBUSY ) {
return -errno;
+ }
stop.idle = 0;
@@ -235,19 +241,16 @@ int drmR128SwapBuffers( int fd )
}
int drmR128Clear( int fd, unsigned int flags,
- int x, int y, int w, int h,
- unsigned int clear_color,
- unsigned int clear_depth )
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask )
{
drm_r128_clear_t clear;
clear.flags = flags;
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
clear.clear_color = clear_color;
clear.clear_depth = clear_depth;
+ clear.color_mask = color_mask;
+ clear.depth_mask = depth_mask;
if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) {
return -errno;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c
index 41d7cdf27..ff3fadae6 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c
@@ -27,7 +27,7 @@
* Kevin E. Martin <martin@valinux.com>
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.1 2001/01/08 01:07:37 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.2 2001/03/21 18:08:54 dawes Exp $ */
#ifdef XFree86Server
# include "xf86.h"
@@ -154,8 +154,11 @@ int drmRadeonStopCP( int fd )
ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop );
- if ( ret && errno != EBUSY )
+ if ( ret == 0 ) {
+ return 0;
+ } else if ( errno != EBUSY ) {
return -errno;
+ }
stop.flush = 0;
@@ -163,8 +166,11 @@ int drmRadeonStopCP( int fd )
ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop );
} while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY );
- if ( ret && errno != EBUSY )
+ if ( ret == 0 ) {
+ return 0;
+ } else if ( errno != EBUSY ) {
return -errno;
+ }
stop.idle = 0;
@@ -235,29 +241,33 @@ int drmRadeonSwapBuffers( int fd )
}
int drmRadeonClear( int fd, unsigned int flags,
- int x, int y, int w, int h,
- unsigned int clear_color,
- unsigned int clear_depth )
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask,
+ void *b, int nbox )
{
drm_radeon_clear_t clear;
+ drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
+ drm_clip_rect_t *boxes = (drm_clip_rect_t *)b;
+ int i;
clear.flags = flags;
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
clear.clear_color = clear_color;
clear.clear_depth = clear_depth;
+ clear.color_mask = color_mask;
+ clear.depth_mask = depth_mask;
+ clear.depth_boxes = depth_boxes;
/* We can remove this when we do real depth clears, instead of
* rendering a rectangle into the depth buffer. This prevents
* floating point calculations being done in the kernel.
*/
- clear.rect.f[CLEAR_X1] = (float)x;
- clear.rect.f[CLEAR_Y1] = (float)y;
- clear.rect.f[CLEAR_X2] = (float)x + w;
- clear.rect.f[CLEAR_Y2] = (float)y + h;
- clear.rect.f[CLEAR_DEPTH] = (float)clear_depth;
+ for ( i = 0 ; i < nbox ; i++ ) {
+ depth_boxes[i].f[CLEAR_X1] = (float)boxes[i].x1;
+ depth_boxes[i].f[CLEAR_Y1] = (float)boxes[i].y1;
+ depth_boxes[i].f[CLEAR_X2] = (float)boxes[i].x2;
+ depth_boxes[i].f[CLEAR_Y2] = (float)boxes[i].y2;
+ depth_boxes[i].f[CLEAR_DEPTH] = (float)clear_depth;
+ }
if ( ioctl( fd, DRM_IOCTL_RADEON_CLEAR, &clear ) < 0 ) {
return -errno;
@@ -301,25 +311,32 @@ int drmRadeonFlushIndices( int fd, int prim, int index,
}
}
-int drmRadeonTextureBlit( int fd, int index,
- int offset, int pitch, int format,
- int x, int y, int width, int height )
+int drmRadeonLoadTexture( int fd, int offset, int pitch, int format,
+ int width, int height, drmRadeonTexImage *image )
{
- drm_radeon_blit_t blit;
-
- blit.idx = index;
- blit.offset = offset;
- blit.pitch = pitch;
- blit.format = format;
- blit.x = x;
- blit.y = y;
- blit.width = width;
- blit.height = height;
-
- if ( ioctl( fd, DRM_IOCTL_RADEON_BLIT, &blit ) < 0 ) {
- return -errno;
- } else {
+ drm_radeon_texture_t tex;
+ drm_radeon_tex_image_t tmp;
+ int ret;
+
+ tex.offset = offset;
+ tex.pitch = pitch;
+ tex.format = format;
+ tex.width = width;
+ tex.height = height;
+ tex.image = &tmp;
+
+ /* This gets updated by the kernel when a multipass blit is needed.
+ */
+ memcpy( &tmp, image, sizeof(drm_radeon_tex_image_t) );
+
+ do {
+ ret = ioctl( fd, DRM_IOCTL_RADEON_TEXTURE, &tex );
+ } while ( ret && errno == EAGAIN );
+
+ if ( ret == 0 ) {
return 0;
+ } else {
+ return -errno;
}
}
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 efa113f84..07451887b 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.21 2001/02/15 19:46:04 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.22 2001/03/03 23:54:13 tsi Exp $ */
/*
* linux specific part of the int10 module
* Copyright 1999 Egbert Eich
@@ -557,9 +557,11 @@ do_vm86(xf86Int10InfoPtr pInt)
{
int retval, signo;
+ xf86DisableIO(); /* So that all I/O can be trapped */
xf86InterceptSignals(&signo);
retval = vm86_rep(VM86S);
xf86InterceptSignals(NULL);
+ xf86EnableIO();
if (signo >= 0) {
xf86DrvMsg(pInt->scrnIndex, X_ERROR,
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c
index 45cefd9ba..160d75dbd 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.18 2000/08/31 19:03:59 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.19 2001/03/05 20:18:24 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Dawes <dawes@xfree86.org>
@@ -219,10 +219,12 @@ xf86KbdOn()
struct termios nTty;
#ifdef __powerpc__
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW);
-#else
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
+ if (xf86Info.kbdCustomKeycodes)
+ ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW);
+ else
#endif
+ ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
+
nTty = kbdtty;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c
index bd1a4b657..81616fab6 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c
@@ -1,16 +1,18 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.4 2001/04/01 14:00:15 tsi Exp $ */
+
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
#define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe"
#define MAX_PATH 1024
+#if 0
/* XFree86 #defines execl to be the xf86execl() function which does
* a fork AND exec. We don't want that. We want the regular,
* standard execl().
@@ -18,6 +20,7 @@
#ifdef execl
#undef execl
#endif
+#endif
/*
@@ -29,7 +32,8 @@
* Return:
* 0 for failure, 1 for success
*/
-int xf86LoadKernelModule(const char *modName)
+int
+xf86LoadKernelModule(const char *modName)
{
char mpPath[MAX_PATH] = "";
int fd = -1, status, n;
@@ -51,10 +55,15 @@ int xf86LoadKernelModule(const char *modName)
if (mpPath[0] == 0) {
/* we failed to get the path from the system, use a default */
- xf86strcpy(mpPath, "/sbin/modprobe");
+ strcpy(mpPath, "/sbin/modprobe");
}
/* now fork/exec the modprobe command */
+ /*
+ * It would be good to capture stdout/stderr so that it can be directed
+ * to the log file. modprobe errors currently are missing from the log
+ * file.
+ */
switch (pid = fork()) {
case 0: /* child */
n = execl(mpPath, "modprobe", modName, NULL);
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 6d3e0644d..acbeaa187 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.5 2000/10/17 16:53:20 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.6 2001/04/03 17:05:32 dawes Exp $ */
#include <stdio.h>
#include "X.h"
@@ -13,7 +13,7 @@ Bool
xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
{
FILE *file;
- char c[0x100];
+ char c[0x200];
char *res;
int bus, devfn, dev, fn;
unsigned int size[7];
@@ -26,14 +26,14 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
if (!(file = fopen("/proc/bus/pci/devices","r")))
return FALSE;
do {
- res = fgets(c,0xff,file);
+ res = fgets(c,0x1ff,file);
if (res) {
num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x"
"\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x"
"\t%x\t%x\t%x\t%x\t%x\t%x\t%x",
&bus,&devfn,&size[0],&size[1],&size[2],&size[3],
&size[4],&size[5],&size[6]);
- if (num != 9) { /* apparantly not 2.3 style */
+ if (num != 9) { /* apparently not 2.3 style */
fclose(file);
return FALSE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
index 4cb1ed053..e49583d78 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.45 2001/02/15 11:03:56 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.49 2001/04/05 21:29:18 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -100,6 +100,9 @@ static unsigned long sparse_size;
#endif
#ifdef HAS_MTRR_SUPPORT
+
+#define SPLIT_WC_REGIONS 1
+
static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
static void undoWC(int, pointer);
@@ -239,6 +242,57 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
wcr->added = TRUE;
wcr->next = NULL;
+#if SPLIT_WC_REGIONS
+ /*********************************** by _usul ********************/
+ /*
+ * Splits up the write-combining region if it is not aligned on a
+ * size boundary.
+ */
+
+ if (base % size) {
+ struct mtrr_wc_region *wcrc = wcr;
+ int rgs = 1;
+ int srem, sdiv, bcurr;
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 2,
+ "WC region has to be split (0x%lx,0x%lx)\n", base, size);
+
+ bcurr = base;
+ srem = size;
+
+ do {
+ for (sdiv = size; sdiv /= 2; sdiv) {
+ while(sdiv > srem) {
+ sdiv /= 2;
+ }
+ if (!(bcurr % sdiv)) {
+ mtrr_add_wc_region(screenNum, bcurr,
+ sdiv, from);
+ break;
+ }
+ }
+ if (!sdiv) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "Serious error in region splitting!\n");
+ }
+ wcrc->sentry.base = bcurr;
+ wcrc->sentry.size = sdiv;
+ wcrc->sentry.type = MTRR_TYPE_WRCOMB;
+ wcrc->added = TRUE;
+ if ((srem - sdiv)) {
+ wcrc->next = xalloc(sizeof(*wcrc));
+ wcrc = wcrc->next;
+ } else {
+ wcrc->next = NULL;
+ }
+ srem -= sdiv;
+ bcurr += sdiv;
+ } while (srem);
+ return wcr;
+ }
+ /*****************************************************************/
+#endif /* SPLIT_WC_REGIONS */
+
if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &wcr->sentry) >= 0) {
/* Avoid printing on every VT switch */
if (xf86ServerIsInitialising()) {
@@ -418,21 +472,46 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
/***************************************************************************/
#if defined(__powerpc__)
-/* FIXME: init this... */
-volatile unsigned char *ioBase = MAP_FAILED;
+volatile unsigned char *ioBase = NULL;
+
+#ifndef __NR_pciconfig_iobase
+#define __NR_pciconfig_iobase 200
+#endif
#endif
void
xf86EnableIO(void)
{
+#if defined(__powerpc__)
+ int fd;
+ unsigned int ioBase_phys;
+#endif
+
if (ExtendedEnabled)
return;
-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__)
+#if defined(__powerpc__)
+ ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+
+ fd = open("/dev/mem", O_RDWR);
+ if (ioBase == NULL) {
+ ioBase = (volatile unsigned char *)mmap(0, 0x20000,
+ PROT_READ|PROT_WRITE, MAP_SHARED, fd,
+ ioBase_phys);
+/* Should this be fatal or just a warning? */
+#if 0
+ if (ioBase == MAP_FAILED) {
+ FatalError(
+ "xf86EnableIOPorts: Failed to map iobase (%s)\n",
+ strerror(errno));
+ }
+#endif
+ }
+ close(fd);
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__)
if (ioperm(0, 1024, 1) || iopl(3))
- FatalError("%s: Failed to set IOPL for I/O\n",
- "xf86EnableIOPorts");
+ FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n");
#endif
ExtendedEnabled = TRUE;
@@ -444,8 +523,10 @@ xf86DisableIO(void)
{
if (!ExtendedEnabled)
return;
-
-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__)
+#if defined(__powerpc__)
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__)
iopl(0);
ioperm(0, 1024, 0);
#endif
@@ -471,7 +552,9 @@ xf86DisableInterrupts()
#else
#ifdef __GNUC__
#if defined(__ia64__)
- __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory");
+#if 0
+ __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory");
+#endif
#else
__asm__ __volatile__("cli");
#endif
@@ -501,7 +584,9 @@ xf86EnableInterrupts()
#else
#ifdef __GNUC__
#if defined(__ia64__)
- __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory");
+#if 0
+ __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory");
+#endif
#else
__asm__ __volatile__("sti");
#endif
@@ -612,6 +697,7 @@ readSparse8(pointer Base, register unsigned long Offset)
register unsigned long result, shift;
register unsigned long msb;
+ mem_barrier();
Offset += (unsigned long)Base - (unsigned long)lnxBase;
shift = (Offset & 0x3) << 3;
if (Offset >= (hae_thresh)) {
@@ -634,6 +720,7 @@ readSparse16(pointer Base, register unsigned long Offset)
register unsigned long result, shift;
register unsigned long msb;
+ mem_barrier();
Offset += (unsigned long)Base - (unsigned long)lnxBase;
shift = (Offset & 0x2) << 3;
if (Offset >= hae_thresh) {
@@ -652,6 +739,7 @@ readSparse16(pointer Base, register unsigned long Offset)
static int
readSparse32(pointer Base, register unsigned long Offset)
{
+ mem_barrier();
return *(vuip)((unsigned long)Base+(Offset));
}
@@ -661,7 +749,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int b = Value & 0xffU;
- mem_barrier();
+ write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)lnxBase;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
@@ -680,7 +768,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int w = Value & 0xffffU;
- mem_barrier();
+ write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)lnxBase;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
@@ -697,7 +785,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
static void
writeSparse32(int Value, pointer Base, register unsigned long Offset)
{
- mem_barrier();
+ write_mem_barrier();
*(vuip)((unsigned long)Base + (Offset)) = Value;
return;
}
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 dc3d262d4..f1abaabff 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
@@ -19,10 +19,10 @@
* THE SOFTWARE IS PROVIDED "AS 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * 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@valinux.com>
@@ -36,6 +36,7 @@
#define _DRM_H_
#if defined(__linux__)
+#include <linux/config.h>
#include <asm/ioctl.h> /* For _IO* macros */
#define DRM_IOCTL_NR(n) _IOC_NR(n)
#elif defined(__FreeBSD__)
@@ -43,15 +44,8 @@
#define DRM_IOCTL_NR(n) ((n) & 0xff)
#endif
-#define DRM_PROC_DEVICES "/proc/devices"
-#define DRM_PROC_MISC "/proc/misc"
-#define DRM_PROC_DRM "/proc/drm"
-#define DRM_DEV_DRM "/dev/drm"
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-#define DRM_DEV_UID 0
-#define DRM_DEV_GID 0
-
-
+#define DRM_MAJOR 226
+#define DRM_MAX_MINOR 15
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */
@@ -72,12 +66,20 @@ typedef unsigned int drm_magic_t;
* XF86DRIClipRectRec in the server as well */
typedef struct drm_clip_rect {
- unsigned short x1;
- unsigned short y1;
- unsigned short x2;
- unsigned short y2;
+ unsigned short x1;
+ unsigned short y1;
+ unsigned short x2;
+ unsigned short y2;
} drm_clip_rect_t;
+typedef struct drm_tex_region {
+ unsigned char next;
+ unsigned char prev;
+ unsigned char in_use;
+ unsigned char padding;
+ unsigned int age;
+} drm_tex_region_t;
+
/* Seperate include files for the i810/mga/r128 specific structures */
#include "mga_drm.h"
#include "i810_drm.h"
@@ -136,9 +138,15 @@ typedef enum drm_map_flags {
_DRM_LOCKED = 0x04, /* shared, cached, locked */
_DRM_KERNEL = 0x08, /* kernel requires access */
_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */
- _DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */
+ _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */
+ _DRM_REMOVABLE = 0x40 /* Removable mapping */
} drm_map_flags_t;
+typedef struct drm_ctx_priv_map {
+ unsigned int ctx_id; /* Context requesting private mapping */
+ void *handle; /* Handle of map */
+} drm_ctx_priv_map_t;
+
typedef struct drm_map {
unsigned long offset; /* Requested physical address (0 for SAREA)*/
unsigned long size; /* Requested physical size (bytes) */
@@ -150,6 +158,44 @@ typedef struct drm_map {
/* Private data */
} drm_map_t;
+typedef struct drm_client {
+ int idx; /* Which client desired? */
+ int auth; /* Is client authenticated? */
+ unsigned long pid; /* Process id */
+ unsigned long uid; /* User id */
+ unsigned long magic; /* Magic */
+ unsigned long iocs; /* Ioctl count */
+} drm_client_t;
+
+typedef enum {
+ _DRM_STAT_LOCK,
+ _DRM_STAT_OPENS,
+ _DRM_STAT_CLOSES,
+ _DRM_STAT_IOCTLS,
+ _DRM_STAT_LOCKS,
+ _DRM_STAT_UNLOCKS,
+ _DRM_STAT_VALUE, /* Generic value */
+ _DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */
+ _DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */
+
+ _DRM_STAT_IRQ, /* IRQ */
+ _DRM_STAT_PRIMARY, /* Primary DMA bytes */
+ _DRM_STAT_SECONDARY, /* Secondary DMA bytes */
+ _DRM_STAT_DMA, /* DMA */
+ _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */
+ _DRM_STAT_MISSED /* Missed DMA opportunity */
+
+ /* Add to the *END* of the list */
+} drm_stat_type_t;
+
+typedef struct drm_stats {
+ unsigned long count;
+ struct {
+ unsigned long value;
+ drm_stat_type_t type;
+ } data[15];
+} drm_stats_t;
+
typedef enum drm_lock_flags {
_DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
_DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
@@ -309,6 +355,9 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t)
#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t)
#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t)
+#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t)
+#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t)
+#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t)
#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t)
#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t)
@@ -322,6 +371,11 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t)
#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t)
+#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t)
+
+#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t)
+#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t)
+
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t)
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t)
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t)
@@ -345,17 +399,18 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
-/* Mga specific ioctls */
+/* MGA specific ioctls */
#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)
-#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t)
-#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t )
+#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t)
+#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42)
+#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43)
+#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t)
+#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t)
#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t)
-#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x47, drm_mga_blit_t)
+#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t)
+#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t)
-/* I810 specific ioctls */
+/* i810 specific ioctls */
#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t)
#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t)
#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t)
@@ -395,7 +450,7 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t)
#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t)
#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t)
-#define DRM_IOCTL_RADEON_BLIT DRM_IOW( 0x4b, drm_radeon_blit_t)
+#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4b, drm_radeon_texture_t)
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h
index 40095aa87..d57b4f9b3 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.8 2000/12/18 02:25:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.9 2001/03/07 19:53:18 dawes Exp $ */
#ifndef _SOL8KEYNAMES_H
#define _SOL8KEYNAMES_H
@@ -64,7 +64,7 @@ unsigned char sol8map[256] = {
KEY_Comma, /* 53 */
KEY_Period, /* 54 */
KEY_Slash, /* 55 */
- 0x73, /*KEY_P_BKSL*/ /* 56 */
+ KEY_BSlash2, /* 56 */
KEY_ShiftR, /* 57 */
KEY_LCtrl, /* 58 */
KEY_LMeta, /* 59 */
@@ -139,9 +139,9 @@ unsigned char sol8map[256] = {
KEY_UNKNOWN, /* 128 */
KEY_UNKNOWN, /* 129 */
KEY_UNKNOWN, /* 130 */
- 0x7B, /*KEY_P_NFER*/ /* 131 */
- 0x79, /*KEY_P_XFER*/ /* 132 */
- 0x70, /*KEY_HKTG*/ /* 133 */
+ KEY_NFER, /* 131 */
+ KEY_XFER, /* 132 */
+ KEY_HKTG /* 133 */
KEY_UNKNOWN, /* 134 */
/* The rest default to KEY_UNKNOWN */
};
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c
index 1e46cf95d..b6093121c 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c
@@ -1,19 +1,271 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.1 1999/09/25 14:38:10 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.2 2001/04/06 02:16:25 dawes Exp $ */
/*
- * Copyright 1999 by The XFree86 Project, Inc.
+ * Copyright 1999-2001 by The XFree86 Project, Inc.
*/
#include "X.h"
#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
+#include "xisb.h"
+#include "mipointer.h"
+#include <sys/vuid_event.h>
+
+/* Names of protocols that are handled internally here. */
+
+static const char *internalNames[] = {
+ "VUID",
+ NULL
+};
+
+typedef struct _VuidMseRec {
+ Firm_event event;
+ unsigned char *buffer;
+} VuidMseRec, *VuidMsePtr;
+
+
+static int vuidMouseProc(DeviceIntPtr pPointer, int what);
+static void vuidReadInput(InputInfoPtr pInfo);
+
+/* This function is called when the protocol is "VUID". */
+static Bool
+vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse = pInfo->private;
+ VuidMsePtr pVuidMse;
+ int i;
+
+ pVuidMse = xalloc(sizeof(VuidMseRec));
+ if (pVuidMse == NULL) {
+ xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name);
+ xfree(pMse);
+ return FALSE;
+ }
+
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
+ xfree(pVuidMse);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ pVuidMse->buffer = (unsigned char *)&pVuidMse->event;
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+
+ /* Private structure */
+ pMse->mousePriv = pVuidMse;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = vuidMouseProc;
+ pInfo->read_input = vuidReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+static void
+vuidReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ VuidMsePtr pVuidMse;
+ int buttons;
+ int dx = 0, dy = 0, dz = 0, dw = 0;
+ unsigned int n;
+ int c;
+ unsigned char *pBuf;
+
+ pMse = pInfo->private;
+ pVuidMse = pMse->mousePriv;
+ buttons = pMse->lastButtons;
+ XisbBlockDuration(pMse->buffer, -1);
+ pBuf = pVuidMse->buffer;
+ n = 0;
+
+ do {
+ while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) {
+ pBuf[n++] = (unsigned char)c;
+ }
+
+ if (n == 0)
+ return;
+
+ if (n != sizeof(Firm_event)) {
+ xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n",
+ pInfo->name, n);
+ }
+
+ if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) {
+ /* button */
+ int butnum = pVuidMse->event.id - BUT_FIRST;
+ if (butnum < 3)
+ butnum = 2 - butnum;
+ if (!pVuidMse->event.value)
+ buttons &= ~(1 << butnum);
+ else
+ buttons |= (1 << butnum);
+ } else if (pVuidMse->event.id >= VLOC_FIRST &&
+ pVuidMse->event.id <= VLOC_LAST) {
+ /* axis */
+ int delta = pVuidMse->event.value;
+ switch(pVuidMse->event.id) {
+ case LOC_X_DELTA:
+ dx += delta;
+ break;
+ case LOC_Y_DELTA:
+ dy -= delta;
+ break;
+ }
+ }
+
+ n = 0;
+ if ((c = XisbRead(pMse->buffer)) >= 0) {
+ /* Another packet. Handle it right away. */
+ pBuf[n++] = c;
+ }
+ } while (n != 0);
+
+ pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
+ return;
+}
+
+#define NUMEVENTS 64
+
+static int
+vuidMouseProc(DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ VuidMsePtr pVuidMse;
+ unsigned char map[MSE_MAXBUTTONS + 1];
+ int nbuttons;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+ pVuidMse = pMse->mousePriv;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
+ map[nbuttons + 1] = nbuttons + 1;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer,
+ map,
+ min(pMse->buttons, MSE_MAXBUTTONS),
+ miPointerGetMotionEvents,
+ pMse->Ctrl,
+ miPointerGetMotionBufferSize());
+
+ /* X valuator */
+ xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 0);
+ /* Y valuator */
+ xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 1);
+ xf86MotionHistoryAllocate(pInfo);
+ break;
+
+ case DEVICE_ON:
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1)
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ pMse->buffer = XisbNew(pInfo->fd,
+ NUMEVENTS * sizeof(Firm_event));
+ if (!pMse->buffer) {
+ xfree(pMse);
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ } else {
+ int fmt = VUID_FIRM_EVENT;
+ ioctl(pInfo->fd, VUIDSFORMAT, &fmt);
+ xf86FlushInput(pInfo->fd);
+ AddEnabledDevice(pInfo->fd);
+ }
+ }
+ pMse->lastButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ if (pInfo->fd != -1) {
+ RemoveEnabledDevice(pInfo->fd);
+ if (pMse->buffer) {
+ XisbFree(pMse->buffer);
+ pMse->buffer = NULL;
+ }
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ }
+ pPointer->public.on = FALSE;
+ usleep(300000);
+ break;
+ }
+ return Success;
+}
+
+static Bool
+sol8MousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ /* The protocol is guaranteed to be one of the internalNames[] */
+ if (xf86NameCmp(protocol, "VUID") == 0) {
+ return vuidPreInit(pInfo, protocol, flags);
+ }
+ return TRUE;
+}
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+
+ return FALSE;
+}
static int
SupportedInterfaces(void)
{
/* XXX This needs to be checked. */
- return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2;
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC;
+}
+
+static const char *
+DefaultProtocol(void)
+{
+ return "VUID";
}
OSMouseInfoPtr
@@ -25,6 +277,10 @@ xf86OSMouseInit(int flags)
if (!p)
return NULL;
p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = sol8MousePreInit;
return p;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c b/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c
index 9e8321cda..0478ee65e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.19 2000/02/10 22:33:45 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.20 2001/03/06 18:20:31 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993-1999 by The XFree86 Project, Inc.
@@ -508,6 +508,7 @@ XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
MouseDevPtr pMse;
XqInfoPtr pXq;
+ pMse = pInfo->private;
pMse->protocol = protocol;
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
pXq = pMse->mousePriv = xnfcalloc(sizeof(XqInfoRec), 1);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h
index d1d7c14b5..9b4678833 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.12 2000/12/18 15:52:25 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.14 2001/03/07 16:21:04 paulo Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -9,6 +9,8 @@
#ifndef _XF86OSMOUSE_H_
#define _XF86OSMOUSE_H_
+#include "xf86Xinput.h"
+
/* Mouse interface classes */
#define MSE_NONE 0x00
#define MSE_SERIAL 0x01 /* serial port */
@@ -121,7 +123,8 @@ typedef struct _MouseDevRec {
int invY;
int mouseFlags; /* Flags to Clear after opening
* mouse dev */
- int truebuttons; /* Arg to maintain before
+ int truebuttons; /* (not used)
+ * Arg to maintain before
* emulate3buttons timer callback */
int resolution;
int negativeZ;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
index 4549805b3..a5ee75d0b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.76 2000/11/14 21:59:23 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.79 2001/03/03 09:53:00 herrb Exp $ */
/*
* Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1992 by David Dawes <dawes@XFree86.org>
@@ -98,10 +98,6 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
#endif
-#ifndef NO_COMPILER_H
-#include "compiler.h"
-#endif
-
#if defined(MACH386) || defined(__OSF__)
# undef NULL
#endif /* MACH386 || __OSF__ */
@@ -465,22 +461,35 @@ extern int errno;
# undef CONSOLE_X_MODE_OFF
# undef CONSOLE_X_BELL
# endif
+# if defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
+# include <dev/wscons/wsdisplay_usl_io.h>
+# endif
# endif
# ifdef SYSCONS_SUPPORT
# define COMPAT_SYSCONS
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__NetBSD__) || defined(__OpenBSD__)
# include <machine/console.h>
# else
-# include <sys/console.h>
-# endif /* __FreeBSD__ || __NetBSD__ || defined(__OpenBSD__) */
+# if defined(__FreeBSD__)
+# include <osreldate.h>
+# if __FreeBSD_version >= 410000
+# include <sys/consio.h>
+# include <sys/kbio.h>
+# else
+# include <machine/console.h>
+# endif /* FreeBSD 4.1 RELEASE or lator */
+# else
+# include <sys/console.h>
+# endif
+# endif
# endif /* SYSCONS_SUPPORT */
# if defined(PCVT_SUPPORT)
# if !defined(SYSCONS_SUPPORT)
/* no syscons, so include pcvt specific header file */
-# if defined(__FreeBSD__) || defined(__OpenBSD__)
+# if defined(__FreeBSD__)
# include <machine/pcvt_ioctl.h>
# else
-# if defined(__NetBSD__)
+# if defined(__NetBSD__) || defined(__OpenBSD__)
# if defined(WSCONS_SUPPORT)
/* NetBSD's wscons has a PCVT-compatibility module. */
# include <dev/wscons/wsdisplay_usl_io.h>
@@ -503,8 +512,13 @@ extern int errno;
# include <dev/wscons/wsconsio.h>
# endif /* WSCONS_SUPPORT */
# if defined(__FreeBSD__)
-# undef MOUSE_GETINFO
-# include <machine/mouse.h>
+# include <osreldate.h>
+# if __FreeBSD_version >= 500013
+# include <sys/mouse.h>
+# else
+# undef MOUSE_GETINFO
+# include <machine/mouse.h>
+# endif
# endif
/* Include these definitions in case ioctl_pc.h didn't get included */
# ifndef CONSOLE_X_MODE_ON
@@ -555,7 +569,7 @@ extern int errno;
# define CLEARDTR_SUPPORT
-# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
# define USE_VT_SYSREQ
# endif
@@ -894,4 +908,8 @@ double RInt(
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
+#ifndef NO_COMPILER_H
+#include "compiler.h"
+#endif
+
#endif /* _XF86_OSLIB_H */
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 7d3b9a804..e8be0690a 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.44 2000/12/06 20:39:53 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.45 2001/03/03 22:53:02 tsi Exp $ */
#ifndef _XF86_ANSIC_H
#define _XF86_ANSIC_H
@@ -179,7 +179,7 @@ extern int xf86fputs(const char*,XF86FILE*);
extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*);
extern void xf86free(void*);
extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*);
-#ifdef HAVE_VFSCANF
+#if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES)
extern int xf86fscanf(XF86FILE*,const char*,...);
#else
extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *,
@@ -226,7 +226,7 @@ extern double xf86sin(double);
extern int xf86sprintf(char*,const char*,...);
extern int xf86snprintf(char*,xf86size_t,const char*,...);
extern double xf86sqrt(double);
-#ifdef HAVE_VSSCANF
+#if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES)
extern int xf86sscanf(char*,const char*,...);
#else
extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *,
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
index de77ddd8b..664e6855b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
@@ -11,11 +11,11 @@
* 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
@@ -23,16 +23,26 @@
* OTHER LIABILITY, WHETHER IN AN ACTION 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@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.12 2000/09/24 13:51:32 alanh Exp $
- *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.13 2001/03/21 18:08:53 dawes Exp $
+ *
*/
#ifndef _XF86DRM_H_
#define _XF86DRM_H_
+ /* Defaults, if nothing set in xf86config */
+#define DRM_DEV_UID 0
+#define DRM_DEV_GID 0
+#define DRM_DEV_DIRMODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP)
+#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
+
+#define DRM_DIR_NAME "/dev/dri"
+#define DRM_DEV_NAME "%s/card%d"
+#define DRM_PROC_NAME "/proc/dri/" /* For backware Linux compatibility */
+
#define DRM_ERR_NO_DEVICE (-1001)
#define DRM_ERR_NO_ACCESS (-1002)
#define DRM_ERR_NOT_ROOT (-1003)
@@ -58,6 +68,21 @@ typedef struct _drmVersion {
char *desc; /* User-space buffer to hold desc */
} drmVersion, *drmVersionPtr;
+typedef struct _drmStats {
+ unsigned long count; /* Number of data */
+ struct {
+ unsigned long value; /* Value from kernel */
+ const char *long_format; /* Suggested format for long_name */
+ const char *long_name; /* Long name for value */
+ const char *rate_format; /* Suggested format for rate_name */
+ const char *rate_name; /* Short name for value per second */
+ int isvalue; /* True if value (vs. counter) */
+ const char *mult_names; /* Multiplier names (e.g., "KGM") */
+ int mult; /* Multiplier value (e.g., 1024) */
+ int verbose; /* Suggest only in verbose output */
+ } data[15];
+} drmStatsT;
+
/* All of these enums *MUST* match with the
kernel implementation -- so do *NOT*
@@ -77,7 +102,8 @@ typedef enum {
DRM_LOCKED = 0x0004, /* Physical pages locked */
DRM_KERNEL = 0x0008, /* Kernel requires access */
DRM_WRITE_COMBINING = 0x0010, /* Use write-combining, if available */
- DRM_CONTAINS_LOCK = 0x0020 /* SHM page that contains lock */
+ DRM_CONTAINS_LOCK = 0x0020, /* SHM page that contains lock */
+ DRM_REMOVABLE = 0x0040 /* Removable mapping */
} drmMapFlags;
typedef enum { /* These values *MUST* match drm.h */
@@ -147,7 +173,7 @@ typedef struct _drmBufMap {
typedef struct _drmLock {
volatile unsigned int lock;
char padding[60];
- /* This is big enough for most current (and future?) architectures:
+ /* This is big enough for most current (and future?) architectures:
DEC Alpha: 32 bytes
Intel Merced: ?
Intel P5/PPro/PII/PIII: 32 bytes
@@ -175,14 +201,22 @@ typedef struct _drmDMAReq {
int granted_count; /* Number of buffers granted at this size */
} drmDMAReq, *drmDMAReqPtr;
-#if 0
- /* The kernel does this, but it doesn't
- seem necessary with recent gcc's. */
-typedef struct { unsigned int a[100]; } __drm_dummy_lock_t;
-#define __drm_dummy_lock(lock) (*(__volatile__ __drm_dummy_lock_t *)lock)
-#else
+typedef struct _drmRegion {
+ drmHandle handle;
+ unsigned int offset;
+ drmSize size;
+ drmAddress map;
+} drmRegion, *drmRegionPtr;
+
+typedef struct _drmTextureRegion {
+ unsigned char next;
+ unsigned char prev;
+ unsigned char in_use;
+ unsigned char padding; /* Explicitly pad this out */
+ unsigned int age;
+} drmTextureRegion, *drmTextureRegionPtr;
+
#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
-#endif
#define DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
#define DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
@@ -227,7 +261,7 @@ typedef struct { unsigned int a[100]; } __drm_dummy_lock_t;
: "r" (old), \
"r" (new)); \
} while(0)
-
+
#elif defined(__sparc__)
#define DRM_CAS(lock,old,new,__ret) \
@@ -314,7 +348,7 @@ do { register unsigned int __old __asm("o0"); \
if (flags) drmGetLock(fd,context,flags); \
else DRM_LIGHT_LOCK(fd,lock,context); \
} while(0)
-
+
#define DRM_UNLOCK(fd,lock,context) \
do { \
DRM_CAS_RESULT(__ret); \
@@ -372,6 +406,14 @@ extern int drmGetMagic(int fd, drmMagicPtr magic);
extern char *drmGetBusid(int fd);
extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum,
int funcnum);
+extern int drmGetMap(int fd, int idx, drmHandle *offset,
+ drmSize *size, drmMapType *type,
+ drmMapFlags *flags, drmHandle *handle,
+ int *mtrr);
+extern int drmGetClient(int fd, int idx, int *auth, int *pid,
+ int *uid, unsigned long *magic,
+ unsigned long *iocs);
+extern int drmGetStats(int fd, drmStatsT *stats);
/* General user-level programmer's API: X server (root) only */
@@ -384,7 +426,11 @@ extern int drmAddMap(int fd,
drmMapType type,
drmMapFlags flags,
drmHandlePtr handle);
-extern int drmAddBufs(int fd, int count, int size,
+extern int drmRmMap(int fd, drmHandle handle);
+extern int drmAddContextPrivateMapping(int fd, drmContext ctx_id,
+ drmHandle handle);
+
+extern int drmAddBufs(int fd, int count, int size,
drmBufDescFlags flags,
int agp_offset);
extern int drmMarkBufs(int fd, double low, double high);
@@ -426,12 +472,14 @@ extern int drmGetLock(int fd,
drmLockFlags flags);
extern int drmUnlock(int fd, drmContext context);
extern int drmFinish(int fd, int context, drmLockFlags flags);
+extern int drmGetContextPrivateMapping(int fd, drmContext ctx_id,
+ drmHandlePtr handle);
/* AGP/GART support: X server (root) only */
extern int drmAgpAcquire(int fd);
extern int drmAgpRelease(int fd);
extern int drmAgpEnable(int fd, unsigned long mode);
-extern int drmAgpAlloc(int fd, unsigned long size,
+extern int drmAgpAlloc(int fd, unsigned long size,
unsigned long type, unsigned long *address,
unsigned long *handle);
extern int drmAgpFree(int fd, unsigned long handle);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h
index 6c11b7a10..8c8368877 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.3 2001/04/01 14:00:14 tsi Exp $ */
/* WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (i810_drm.h)
@@ -25,9 +26,9 @@
typedef struct _drmI810Init {
unsigned int start;
unsigned int end;
- unsigned int size;
- int ring_map_idx;
- int buffer_map_idx;
+ unsigned int size;
+ unsigned int mmio_offset;
+ unsigned int buffers_offset;
int sarea_off;
unsigned int front_offset;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
index 75157024f..0a4e072bb 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
@@ -1,151 +1,71 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.3 2000/09/26 15:57:19 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.4 2001/03/21 18:08:53 dawes Exp $ */
+
+#ifndef __XF86DRI_MGA_H__
+#define __XF86DRI_MGA_H__
/*
* WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (mga_drm.h)
*/
-#ifndef _XF86DRI_MGA_H_
-#define _XF86DRI_MGA_H_
-#ifndef _MGA_DEFINES_
-#define _MGA_DEFINES_
-#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
-#define MGA_FRONT 0x1
-#define MGA_BACK 0x2
-#define MGA_DEPTH 0x4
-
-/* 3d state excluding texture units:
- */
-#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_CTXREG_FCOL 9
-#define MGA_CTXREG_STENCIL 10
-#define MGA_CTXREG_STENCILCTL 11
-#define MGA_CTX_SETUP_SIZE 12
-
-/* 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 MGA_UPLOAD_CTX 0x1
-#define MGA_UPLOAD_TEX0 0x2
-#define MGA_UPLOAD_TEX1 0x4
-#define MGA_UPLOAD_PIPE 0x8
-#define MGA_UPLOAD_TEX0IMAGE 0x10
-#define MGA_UPLOAD_TEX1IMAGE 0x20
-#define MGA_UPLOAD_2D 0x40
-#define MGA_WAIT_AGE 0x80 /* handled client-side */
-#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
-#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
- quiescent */
-
-/* 32 buffers of 64k each, total 1 meg.
- */
-#define MGA_DMA_BUF_ORDER 16
-#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER)
-#define MGA_DMA_BUF_NR 31
-
-/* Keep these small for testing.
- */
-#define MGA_NR_SAREA_CLIPRECTS 8
-
-/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
- * regions, subject to a minimum region size of (1<<16) == 64k.
- *
- * Clients may subdivide regions internally, but when sharing between
- * clients, the region size is the minimum granularity.
- */
-
-#define MGA_CARD_HEAP 0
-#define MGA_AGP_HEAP 1
-#define MGA_NR_TEX_HEAPS 2
-#define MGA_NR_TEX_REGIONS 16
-#define MGA_LOG_MIN_TEX_REGION_SIZE 16
-#endif
-
-typedef struct _drmMgaWarpIndex {
+typedef struct {
int installed;
unsigned long phys_addr;
int size;
-} drmMgaWarpIndex;
+} drmMGAWarpIndex;
-typedef struct _drmMgaInit {
- int reserved_map_agpstart;
- int reserved_map_idx;
- int buffer_map_idx;
+typedef struct {
int sarea_priv_offset;
- int primary_size;
- int warp_ucode_size;
- unsigned int frontOffset;
- unsigned int backOffset;
- unsigned int depthOffset;
- unsigned int textureOffset;
- unsigned int textureSize;
- unsigned int agpTextureSize;
- unsigned int agpTextureOffset;
- unsigned int cpp;
- unsigned int stride;
- int sgram;
+
int chipset;
- drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES];
- unsigned int mAccess;
-} drmMgaInit;
+ int sgram;
+
+ unsigned int maccess;
+
+ unsigned int fb_cpp;
+ unsigned int front_offset, front_pitch;
+ unsigned int back_offset, back_pitch;
+
+ unsigned int depth_cpp;
+ unsigned int depth_offset, depth_pitch;
+
+ unsigned int texture_offset[2];
+ unsigned int texture_size[2];
+
+ unsigned int fb_offset;
+ unsigned int mmio_offset;
+ unsigned int status_offset;
+ unsigned int warp_offset;
+ unsigned int primary_offset;
+ unsigned int buffers_offset;
+} drmMGAInit;
+
+extern int drmMGAInitDMA( int fd, drmMGAInit *info );
+extern int drmMGACleanupDMA( int fd );
+
+extern int drmMGAFlushDMA( int fd, drmLockFlags flags );
+
+extern int drmMGAEngineReset( int fd );
+
+extern int drmMGAFullScreen( int fd, int enable );
+
+extern int drmMGASwapBuffers( int fd );
+extern int drmMGAClear( int fd, unsigned int flags,
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask );
+
+extern int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard );
+extern int drmMGAFlushIndices( int fd, int index,
+ int start, int end, int discard );
+
+extern int drmMGATextureLoad( int fd, int index,
+ unsigned int dstorg, unsigned int length );
+extern int drmMGAAgpBlit( int fd, unsigned int planemask,
+ unsigned int src, int src_pitch,
+ unsigned int dst, int dst_pitch,
+ int delta_sx, int delta_sy,
+ int delta_dx, int delta_dy,
+ int height, int ydir );
-Bool drmMgaCleanupDma(int driSubFD);
-Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags);
-Bool drmMgaInitDma(int driSubFD, drmMgaInit *info);
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
index ce544a72b..b4973b0b3 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
@@ -27,7 +27,7 @@
* Gareth Hughes <gareth@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.7 2001/01/11 03:37:00 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.9 2001/03/25 05:32:13 tsi Exp $
*
*/
@@ -82,9 +82,8 @@ extern int drmR128FullScreen( int fd, int enable );
extern int drmR128SwapBuffers( int fd );
extern int drmR128Clear( int fd, unsigned int flags,
- int x, int y, int w, int h,
- unsigned int clear_color,
- unsigned int clear_depth );
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask );
extern int drmR128FlushVertexBuffer( int fd, int prim, int indx,
int count, int discard );
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h
index 37c55ca8a..abf94b657 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h
@@ -27,7 +27,7 @@
* Gareth Hughes <gareth@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.2 2001/01/11 03:37:00 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.4 2001/03/25 05:32:13 tsi Exp $
*
*/
@@ -43,27 +43,35 @@
#define DRM_RADEON_DEPTH 0x4
typedef struct {
- int sarea_priv_offset;
- int is_pci;
- int cp_mode;
- int agp_size;
- int ring_size;
- int usec_timeout;
-
- unsigned int fb_bpp;
- unsigned int front_offset, front_pitch;
- unsigned int back_offset, back_pitch;
- unsigned int depth_bpp;
- unsigned int depth_offset, depth_pitch;
-
- unsigned int fb_offset;
- unsigned int mmio_offset;
- unsigned int ring_offset;
- unsigned int ring_rptr_offset;
- unsigned int buffers_offset;
- unsigned int agp_textures_offset;
+ int sarea_priv_offset;
+ int is_pci;
+ int cp_mode;
+ int agp_size;
+ int ring_size;
+ int usec_timeout;
+
+ unsigned int fb_bpp;
+ unsigned int front_offset, front_pitch;
+ unsigned int back_offset, back_pitch;
+ unsigned int depth_bpp;
+ unsigned int depth_offset, depth_pitch;
+
+ unsigned int fb_offset;
+ unsigned int mmio_offset;
+ unsigned int ring_offset;
+ unsigned int ring_rptr_offset;
+ unsigned int buffers_offset;
+ unsigned int agp_textures_offset;
} drmRadeonInit;
+typedef struct {
+ unsigned int x;
+ unsigned int y;
+ unsigned int width;
+ unsigned int height;
+ void *data;
+} drmRadeonTexImage;
+
extern int drmRadeonInitCP( int fd, drmRadeonInit *info );
extern int drmRadeonCleanupCP( int fd );
@@ -78,18 +86,18 @@ extern int drmRadeonFullScreen( int fd, int enable );
extern int drmRadeonSwapBuffers( int fd );
extern int drmRadeonClear( int fd, unsigned int flags,
- int x, int y, int w, int h,
- unsigned int clear_color,
- unsigned int clear_depth );
+ unsigned int clear_color, unsigned int clear_depth,
+ unsigned int color_mask, unsigned int depth_mask,
+ void *boxes, int nbox );
extern int drmRadeonFlushVertexBuffer( int fd, int prim, int indx,
int count, int discard );
extern int drmRadeonFlushIndices( int fd, int prim, int indx,
int start, int end, int discard );
-extern int drmRadeonTextureBlit( int fd, int indx,
- int offset, int pitch, int format,
- int x, int y, int width, int height );
+extern int drmRadeonLoadTexture( int fd, int offset, int pitch, int format,
+ int width, int height,
+ drmRadeonTexImage *image );
extern int drmRadeonPolygonStipple( int fd, unsigned int *mask );
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Configint.h b/xc/programs/Xserver/hw/xfree86/parser/Configint.h
index c9f6d35ae..41d0392f1 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Configint.h
+++ b/xc/programs/Xserver/hw/xfree86/parser/Configint.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.16 2000/10/20 14:59:02 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.17 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -184,6 +184,8 @@ else\
#define GROUP_MSG \
"The Group keyword must be followed by either a group name in quotes or\n" \
"\ta numerical group id."
+#define MULTIPLE_MSG \
+"Multiple \"%s\" lines."
/* Warning messages */
#define OBSOLETE_MSG \
diff --git a/xc/programs/Xserver/hw/xfree86/parser/DRI.c b/xc/programs/Xserver/hw/xfree86/parser/DRI.c
index 86ee209ab..b70237cb3 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/DRI.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/DRI.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/parser/DRI.c,v 1.8 2000/11/30 20:45:33 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.9 2001/03/08 21:32:35 anderson Exp $
*
*/
@@ -129,6 +129,7 @@ xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
if (ptr == NULL)
return;
+ fprintf (cf, "Section \"DRI\"\n");
if (ptr->dri_group_name)
fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
else if (ptr->dri_group >= 0)
@@ -141,6 +142,7 @@ xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags);
fprintf (cf, "\n");
}
+ fprintf (cf, "EndSection\n\n");
}
void
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Device.c b/xc/programs/Xserver/hw/xfree86/parser/Device.c
index d24cc6e60..a39ac033b 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Device.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Device.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.17 2000/11/30 20:45:33 paulo Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.18 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -89,6 +89,8 @@ xf86parseDeviceSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->dev_identifier = val.str;
has_ident = TRUE;
break;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Input.c b/xc/programs/Xserver/hw/xfree86/parser/Input.c
index 6ab1a291a..f17b6d76a 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Input.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Input.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.5 2000/10/20 14:59:02 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.6 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -66,6 +66,8 @@ xf86parseInputSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->inp_identifier = val.str;
has_ident = TRUE;
break;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Layout.c b/xc/programs/Xserver/hw/xfree86/parser/Layout.c
index ee304525c..bfa80ba6a 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Layout.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Layout.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.13 2000/10/20 14:59:02 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.14 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -78,6 +78,8 @@ xf86parseLayoutSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->lay_identifier = val.str;
has_ident = TRUE;
break;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
index 2816c58d2..46fa5c2ed 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.19 2001/01/31 20:52:18 paulo Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.20 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -391,6 +391,8 @@ xf86parseMonitorSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->mon_identifier = val.str;
has_ident = TRUE;
break;
@@ -437,7 +439,10 @@ xf86parseMonitorSection (void)
(float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
Error (HORIZSYNC_MSG, NULL);
ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
- break;
+ if (token = xf86getToken (NULL) == COMMA)
+ break;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
default:
/* We cannot currently know if a '\n' was found,
* or this is a real error
@@ -471,7 +476,10 @@ HorizDone:
(float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
Error (VERTREFRESH_MSG, NULL);
ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
- break;
+ if (token = xf86getToken (NULL) == COMMA)
+ break;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
default:
/* We cannot currently know if a '\n' was found,
* or this is a real error
@@ -589,6 +597,8 @@ xf86parseModesSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->modes_identifier = val.str;
has_ident = TRUE;
break;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c
index a5adb3bde..e94693d84 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.8 2000/11/30 20:45:34 paulo Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.9 2001/02/21 23:37:04 paulo Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -48,6 +48,7 @@ static xf86ConfigSymTabRec VendorSubTab[] =
XF86ConfVendSubPtr
xf86parseVendorSubSection (void)
{
+ int has_ident = FALSE;
parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec)
while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION)
@@ -57,7 +58,10 @@ xf86parseVendorSubSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->vs_identifier = val.str;
+ has_ident = TRUE;
break;
case OPTION:
{
@@ -129,6 +133,8 @@ xf86parseVendorSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->vnd_identifier = val.str;
has_ident = TRUE;
break;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Video.c b/xc/programs/Xserver/hw/xfree86/parser/Video.c
index 941a6cf76..47d601f0d 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Video.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Video.c
@@ -25,7 +25,7 @@
* in this Software without prior written authorization from Metro Link.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.6 2000/11/30 20:45:34 paulo Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.7 2001/02/21 23:37:04 paulo Exp $ */
/* View/edit this file with tab stops set to 4 */
@@ -48,6 +48,7 @@ static xf86ConfigSymTabRec VideoPortTab[] =
XF86ConfVideoPortPtr
xf86parseVideoPortSubSection (void)
{
+ int has_ident = FALSE;
parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION)
@@ -57,7 +58,10 @@ xf86parseVideoPortSubSection (void)
case IDENTIFIER:
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
ptr->vp_identifier = val.str;
+ has_ident = TRUE;
break;
case OPTION:
{
@@ -129,6 +133,8 @@ xf86parseVideoAdaptorSection (void)
if (xf86getToken (NULL) != STRING)
Error (QUOTE_MSG, "Identifier");
ptr->va_identifier = val.str;
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
has_ident = TRUE;
break;
case VENDOR:
diff --git a/xc/programs/Xserver/hw/xfree86/parser/write.c b/xc/programs/Xserver/hw/xfree86/parser/write.c
index 9afe9a549..ee62771ab 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/write.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/write.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.12 2000/11/14 17:33:01 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.13 2001/03/08 21:32:35 anderson Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -98,9 +98,7 @@ doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
xf86printScreenSection (cf, cptr->conf_screen_lst);
- fprintf (cf, "Section \"DRI\"\n");
xf86printDRISection (cf, cptr->conf_dri);
- fprintf (cf, "EndSection\n\n");
fclose(cf);
return 1;
diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h
index ab067f45a..12a04be1e 100644
--- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h
+++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h
@@ -1,8 +1,9 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.4 1999/03/14 11:18:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.5 2001/03/25 05:32:14 tsi Exp $ */
#ifndef _XF86CURSOR_H
#define _XF86CURSOR_H
+#include "xf86str.h"
#include "mipointrst.h"
typedef struct _xf86CursorInfoRec {
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c
index 88c1d7172..497c3e7a1 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.12 2000/09/28 20:47:59 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.13 2001/02/19 22:19:49 mvojkovi Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -65,17 +65,6 @@ XAACopyArea(
pGC, srcx, srcy, width, height, dstx, dsty,
XAADoBitBlt, 0L));
}
- } else if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrcDrawable)) {
- if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
- (pSrcDrawable->bitsPerPixel == pDstDrawable->bitsPerPixel) &&
- ((pGC->planemask & infoRec->FullPlanemasks[pSrcDrawable->depth - 1])
- == infoRec->FullPlanemasks[pSrcDrawable->depth - 1]))
- {
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoImageRead, 0L));
- }
}
return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
@@ -245,10 +234,11 @@ XAADoImageRead(
BoxPtr pbox = REGION_RECTS(prgnDst);
int nbox = REGION_NUM_RECTS(prgnDst);
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Bpp = pSrc->bitsPerPixel >> 3;
+ int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
+ src and dst have same bpp */
pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr;
- dstwidth = (int)((PixmapPtr)pSrc)->devKind;
+ dstwidth = (int)((PixmapPtr)pDst)->devKind;
for(; nbox; pbox++, pptSrc++, nbox--) {
dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c
index c3bd3e12a..c9ef93a1b 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.18 2000/09/28 20:48:00 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.19 2001/02/19 22:19:50 mvojkovi Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -369,19 +369,33 @@ XAACopyAreaPixmap(
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
RegionPtr ret;
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
-
if(infoRec->pScrn->vtSema &&
- ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc)))
+ {
+ if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
+ (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
+ == infoRec->FullPlanemasks[pSrc->depth - 1]))
+ {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
+ pixPriv->flags |= DIRTY;
+
+ return (XAABitBlt( pSrc, pDst, pGC,
+ srcx, srcy, width, height, dstx, dsty,
+ XAADoImageRead, 0L));
+ } else
if(infoRec->NeedToSync) {
(*infoRec->Sync)(infoRec->pScrn);
infoRec->NeedToSync = FALSE;
}
}
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ {
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ }
return ret;
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c b/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c
index 2625adfab..25efff45f 100644
--- a/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c
+++ b/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.4 1999/09/25 14:38:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.5 2001/03/08 17:12:16 eich Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -127,7 +127,6 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
in the general case, NOT necessarily
the same as the string's bounding box
*/
-
/* GJA -- I agree, this ALL should be moved to GC validation. */
if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) ||
!xf86Screens[pDrawable->pScreen->myNum]->vtSema ||
@@ -193,6 +192,7 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
colorRrop.alu = oldalu; /* GJA */
pGC->alu = oldalu;
}
+
}
static void
@@ -212,13 +212,13 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
int widthDst; /* width of dst in longwords */
/* these keep track of the character origin */
- unsigned long *pdstBase;
+ CARD32 *pdstBase;
/* points to longword with character origin */
int xchar; /* xorigin of char (mod 32) */
/* these are used for placing the glyph */
register int xoff; /* x offset of left edge of glyph (mod 32) */
- register unsigned long *pdst;
+ register CARD32 *pdst;
/* pointer to current longword in dst */
int w; /* width of glyph in bits */
@@ -239,20 +239,19 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
yorg = pDrawable->y;
if (pDrawable->type == DRAWABLE_WINDOW)
{
- pdstBase = (unsigned long *)
+ pdstBase = (CARD32 *)
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
widthDst = (int)
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
}
else
{
- pdstBase = (unsigned long *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
+ pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
}
x += xorg;
y += yorg;
-
bbox.x1 = x + infop->overallLeft;
bbox.x2 = x + infop->overallRight;
bbox.y1 = y - infop->overallAscent;
@@ -311,8 +310,10 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
if ((xoff + w) <= 32)
{
+ int i;
/* glyph all in one longword */
maskpartialbits(xoff, w, startmask);
+
while (h--)
{
getleftbits(pglyph, w, tmpSrc);
diff --git a/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h b/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h
index 469b1bf3d..0a53572b2 100644
--- a/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h
+++ b/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.5 2000/09/26 15:57:21 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.6 2001/03/08 17:12:17 eich Exp $ */
#ifndef __XF4BPP_H__
@@ -10,7 +10,7 @@
#include "colormapst.h"
#include "fontstruct.h"
#ifndef PixelType
-#define PixelType unsigned long
+#define PixelType CARD32
#endif
/* ppcArea.c */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h
index 57ab37b04..8298cb727 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86Version.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h
@@ -1,9 +1,11 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.464 2001/02/19 20:21:00 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.467 2001/04/06 16:51:16 dawes Exp $ */
+
+#ifndef XF86_VERSION_CURRENT
#define XF86_VERSION_MAJOR 4
#define XF86_VERSION_MINOR 0
#define XF86_VERSION_PATCH 99
-#define XF86_VERSION_SNAP 1
+#define XF86_VERSION_SNAP 2
/* This has five arguments for compatibilty reasons */
#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \
@@ -22,6 +24,8 @@
0)
-#define XF86_DATE "19 February 2001"
+#define XF86_DATE "6 April 2001"
+
+#endif
/* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
index 8071cdc15..43134fcc2 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.15 2001/01/24 00:06:39 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.17 2001/03/02 22:39:27 paulo Exp $
XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic
@@ -95,8 +95,12 @@ CURSESLIB = NCursesLibName
CURSESDEFINES = -DHAS_NCURSES
#endif
-DEFINES = -DXF86CONFIG=\"XConfigFile\" $(MODULEDEFINES) \
- $(CURSESDEFINES) -DPROJECT_ROOT=\"ProjectRoot\"
+XF86CONFIGFILE = XConfigFile
+XF86CONFIGDIR = XConfigDir
+
+DEFINES = -DXF86CONFIG=\"$(XF86CONFIGFILE)\" $(MODULEDEFINES) \
+ $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" \
+ -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\"
#if HasDlopen
DLLIB = DlLibrary
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
index 9e2cbc5db..0a2ba49b6 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
@@ -26,7 +26,7 @@
!!
!! Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
!!
-!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.7 2000/12/27 23:37:36 paulo Exp $
+!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.12 2001/03/29 16:54:30 paulo Exp $
!!
*Form.background: gray85
@@ -187,10 +187,23 @@ lines -1,0,0,0,0,-1
*card.fromHoriz: keyboard
*monitor.fromHoriz: card
-*commands.mouse.tip: Add mouse
-*commands.keyboard.tip: Add keyboard
-*commands.card.tip: Add video card
-*commands.monitor.tip: Add monitor
+*commands.mouse*new.label: Add new mouse
+*commands.keyboard*new.label: Add new keyboard
+*commands.card*new.label: Add new video card
+*commands.monitor*new.label: Add new monitor
+*commands.mouse*configure.label: Configure mouse(s)
+*commands.keyboard*configure.label: Configure keyboard(s)
+*commands.card*configure.label: Configure video card(s)
+*commands.monitor*configure.label: Configure monitor(s)
+*commands.mouse*SimpleMenu*newMouse.label: New mouse
+*commands.keyboard*SimpleMenu*newKeyboard.label:New keyboard
+*commands.card*SimpleMenu*newcard.label: New card
+*commands.monitor*SimpleMenu*newMonitor.label: New monitor
+
+*commands.MenuButton.translations: \
+<Enter>: highlight()\n\
+<Leave>: reset()\n\
+Any<BtnDown>: highlight() set() PopupMenu()
*hpane.showGrip: False
*hpane.expert.label: Expert Mode
@@ -324,28 +337,40 @@ lines -1,0,0,0,0,-1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! keyboardML widget
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-*keyboardML.labelL.vertDistance: 16
-*keyboardML.layout.vertDistance: 16
-*keyboardML.keyboard.vertDistance: 16
+*keyboardML.Label.vertDistance: 8
+*keyboardML.MenuButton.vertDistance: 8
+*keyboardML.keyboard.vertDistance: 10
*keyboardML.Label.borderWidth: 0
*keyboardML.Label.width: 115
+*keyboardML.MenuButton.width: 185
+*keyboardML.MenuButton.justify: left
*keyboardML.Label.internalWidth: 0
*keyboardML.Label.justify: right
-*keyboardML.model.width: 185
+*keyboardML.labelR.label: Xkb rules:
+*keyboardML.rules.left: chainRight
+*keyboardML.rules.right: chainRight
+*keyboardML.rules.fromHoriz: labelR
+*keyboardML.model.fromVert: rules
+*keyboardML.labelM.fromVert: rules
*keyboardML.model.left: chainRight
*keyboardML.model.right: chainRight
-*keyboardML.model.justify: left
*keyboardML.model.fromHoriz: labelM
*keyboardML.labelM.label: Keyboard model:
-*keyboardML.layout.width: 185
*keyboardML.layout.left: chainRight
*keyboardML.layout.right: chainRight
-*keyboardML.layout.justify: left
*keyboardML.layout.fromVert: model
*keyboardML.labelL.fromVert: model
*keyboardML.layout.fromHoriz: labelL
*keyboardML.labelL.label: Keyboard layout:
-*keyboardML.keyboard.fromVert: labelL
+*keyboardML.variant.fromVert: labelL
+*keyboardML.variant.fromHoriz: labelV
+*keyboardML.labelV.fromVert: labelL
+*keyboardML.labelV.label: Xkb variant:
+*keyboardML.options.fromVert: labelV
+*keyboardML.options.fromHoriz: labelO
+*keyboardML.labelO.fromVert: labelV
+*keyboardML.labelO.label: Xkb options:
+*keyboardML.keyboard.fromVert: labelO
*keyboardML.keyboard.borderWidth: 0
*keyboardML.keyboard.width: 305
*keyboardML.keyboard.height: 121
@@ -1386,6 +1411,8 @@ lines -1,0,0,0,0,-1
*expert*tree*Text.width: 160
*expert*tree*fontpath.Text.width: 228
+*expert*tree*fontpath.up.fromHoriz: remove
+*expert*tree*fontpath.down.fromHoriz: up
*expert*tree*fontpath.value.fromVert: remove
*expert*tree*fontpath.valueNew.fromVert: new
@@ -1767,4 +1794,4 @@ lines -1,0,0,0,0,-1
*expert*tree*buffers.flagsL.fromVert: size
*expert*tree*buffers.flags.fromVert: size
*expert*tree*buffers.flags.fromHoriz: flagsL
-*Expert*close.label: Close \ No newline at end of file
+*Expert*close.label: Close
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
index 79139309c..03e441790 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.8 2001/01/26 21:17:40 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.9 2001/03/02 22:39:27 paulo Exp $
*/
#include "config.h"
@@ -109,7 +109,7 @@ startaccessx(void)
xkb_info->xkb->ctrls->mk_max_speed = 500;
xkb_info->xkb->ctrls->mk_curve = 0;
XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
- UpdateKeyboard(True);
+ (void)UpdateKeyboard(True);
CreateAccessXHelpDialog();
}
@@ -676,5 +676,5 @@ ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
XSync(DPY, False);
- UpdateKeyboard(True);
+ (void)UpdateKeyboard(True);
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
index ee7b7d07f..d2a708905 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.4 2000/12/01 23:27:54 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.5 2001/03/24 01:17:20 paulo Exp $
*/
#include "xf86config.h"
@@ -126,8 +126,8 @@ CardConfig(XtPointer config)
device = (XF86ConfDevicePtr)(device->list.next);
}
do {
- ++ndevices;
XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices);
+ ++ndevices;
} while (xf86findDevice(card_name,
XF86Config->conf_device_lst));
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
index 0e564300c..9d8a6a9e2 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.9 2000/12/08 21:51:05 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.10 2001/03/29 16:54:30 paulo Exp $
*/
#include <X11/IntrinsicP.h>
@@ -216,5 +216,6 @@ extern char *XFree86Dir;
extern xf86cfgComputer computer;
extern Atom wm_delete_window;
extern Display *DPY;
+extern Pixmap menuPixmap;
#endif /* _xf86cfg_config_h */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
index 0f53ff9e0..1b13ae39f 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.6 2000/12/27 23:37:37 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.8 2001/04/01 14:00:15 tsi Exp $
*/
#include "config.h"
@@ -124,6 +124,7 @@ union _TreeData {
} layout;
struct {
Widget menu, button, scrnum, adjx, adjy;
+ XF86ConfScreenPtr screen;
XF86ConfAdjacencyPtr adjacency;
} adjacency;
struct {
@@ -182,6 +183,7 @@ static void CreateFontPath(TreeNode*, char*);
static Widget CreateFontPathField(TreeNode*, char*, Bool);
static void FontPathChanged(TreeNode*);
static void NewFontPathCallback(Widget, XtPointer, XtPointer);
+static void FontPathCallback(Widget, XtPointer, XtPointer);
static void CreateModulePath(TreeNode*, char*);
static Widget CreateModulePathField(TreeNode*, char*, Bool);
@@ -522,6 +524,12 @@ CreateFontPathField(TreeNode *fontpath, char *value, Bool addnew)
NULL, 0);
XtAddCallback(command, XtNcallback, DestroyCallback,
(XtPointer)fontpath);
+ command = XtCreateManagedWidget("up", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, FontPathCallback,
+ (XtPointer)fontpath);
+ command = XtCreateManagedWidget("down", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, FontPathCallback,
+ (XtPointer)fontpath);
text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
XtNeditType, XawtextEdit,
XtNstring, value, NULL, 0);
@@ -590,6 +598,44 @@ NewFontPathCallback(Widget unused, XtPointer user_data, XtPointer call_data)
RelayoutTree();
}
+/*ARGSUSED*/
+static void
+FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node, *fontpath = (TreeNode*)user_data;
+ char *t1, *t2;
+ Widget w1, w2;
+
+ parent = fontpath->parent;
+ node = parent->child;
+ if (!node->next->next)
+ return;
+ if (strcmp(XtName(w), "up") == 0) {
+ if (node == fontpath)
+ while (node->next->next)
+ node = node->next;
+ else
+ while (node && node->next != fontpath)
+ node = node->next;
+ }
+ else {
+ if (fontpath->next->next)
+ node = fontpath->next;
+ /* else is already correct */
+ }
+
+ w1 = node->data->files.text;
+ w2 = fontpath->data->files.text;
+
+ XtVaGetValues(w1, XtNstring, &t1, NULL);
+ XtVaGetValues(w2, XtNstring, &t2, NULL);
+ t1 = XtNewString(t1);
+ XtVaSetValues(w1, XtNstring, t2, NULL);
+ XtVaSetValues(w2, XtNstring, t1, NULL);
+ XtFree(t1);
+}
+
+
/* ModulePath */
/* Don't need to set the update tree field, as it is already set
* as the destroy field */
@@ -2759,13 +2805,14 @@ ScreenDestroy(TreeNode *node)
for (i = 0; i < composite->composite.num_children; ++i)
if (strcmp(XtName(composite->composite.children[i]),
- node->data->screen.screen->scrn_identifier) == 0)
+ node->data->screen.screen->scrn_identifier) == 0) {
XtDestroyWidget(composite->composite.children[i]);
+ break;
+ }
- if (adj && adj->data->adjacency.adjacency &&
- strcmp(adj->data->adjacency.adjacency->adj_screen_str,
- node->data->screen.screen->scrn_identifier) == 0)
+ if (adj->data->adjacency.screen == node->data->screen.screen)
DeleteNode(adj);
+
adj = next;
}
@@ -2777,6 +2824,9 @@ ScreenDestroy(TreeNode *node)
config = computer.screens[i]->widget;
RemoveDeviceCallback(NULL, NULL, NULL);
}
+
+ /* for the case of screens added and removed in the expert dialog */
+ xf86removeScreen(XF86Config, node->data->screen.screen);
}
}
@@ -3084,6 +3134,8 @@ NewScreenDisplayCallback(Widget w, XtPointer user_data, XtPointer call_data)
parent = node->parent;
DeleteNode(node);
dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
+ dsp->disp_black.red = dsp->disp_black.green = dsp->disp_black.blue =
+ dsp->disp_white.red = dsp->disp_white.green = dsp->disp_white.blue = -1;
parent->parent->data->screen.screen->scrn_display_lst =
xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst,
dsp);
@@ -3584,6 +3636,7 @@ CreateAdjacency(TreeNode *parent, XF86ConfAdjacencyPtr adj)
while (adj) {
data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->adjacency.screen = adj ? adj->adj_screen : NULL;
data->adjacency.adjacency = adj;
node = NewNode(parent, NULL, NULL, parent->node, data);
node->destroy = AdjacencyDestroy;
@@ -3740,6 +3793,8 @@ NewAdjacencyCallback(Widget w, XtPointer user_data, XtPointer call_data)
DeleteNode(node);
adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst);
+ if (adj->adj_screen)
+ adj->adj_screen_str = XtNewString(adj->adj_screen->scrn_identifier);
parent->parent->data->layout.layout->lay_adjacency_lst =
xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst,
adj);
@@ -3767,7 +3822,7 @@ AdjacencyToggleCallback(Widget w, XtPointer user_data, XtPointer call_data)
XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency;
char *x, *y;
- if ((Bool)call_data == False)
+ if ((Bool)(long)call_data == False)
return;
XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL, 0);
@@ -4501,7 +4556,7 @@ ToggleCallback(Widget w, XtPointer user_data, XtPointer call_data)
if (nodeParent->child) {
if (XtIsRealized(tree))
XtUnmapWidget(tree);
- ToggleNode(nodeParent->child, (Bool)call_data);
+ ToggleNode(nodeParent->child, (Bool)(long)call_data);
RelayoutTree();
if (XtIsRealized(tree))
XtMapWidget(tree);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
index 7ad6cfaa5..01518410b 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.14 2000/12/29 20:09:52 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.21 2001/04/01 14:00:15 tsi Exp $
*/
#include <X11/IntrinsicP.h>
@@ -81,6 +81,7 @@ void DevicePopupMenu(Widget, XEvent*, String*, Cardinal*);
void DevicePopdownMenu(Widget, XEvent*, String*, Cardinal*);
void AddDeviceCallback(Widget, XtPointer, XtPointer);
void QuitCallback(Widget, XtPointer, XtPointer);
+void SmeConfigureDeviceCallback(Widget, XtPointer, XtPointer);
void ConfigureDeviceCallback(Widget, XtPointer, XtPointer);
void EnableDeviceCallback(Widget, XtPointer, XtPointer);
void DisableDeviceCallback(Widget, XtPointer, XtPointer);
@@ -100,6 +101,7 @@ void PopdownErrorCallback(Widget, XtPointer, XtPointer);
static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*);
static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*);
static void HelpCallback(Widget, XtPointer, XtPointer);
+static void UpdateMenuDeviceList(int);
extern void AccessXConfigureStart(void);
extern void AccessXConfigureEnd(void);
@@ -115,6 +117,8 @@ extern void TextMode(void);
Widget toplevel, work, config, layout, layoutsme, layoutp;
XtAppContext appcon;
+Pixmap menuPixmap;
+
char *XF86Config_path = NULL;
char *XF86Module_path = NULL;
char *XFree86_path = NULL;
@@ -137,6 +141,9 @@ int sxpos, sypos;
static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 };
static GC cablegc, cablegcshadow;
Atom wm_delete_window;
+static Bool config_set = False;
+static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu,
+ cardSme, cardMenu, monitorSme, monitorMenu;
#define CONFIG_LAYOUT 0
#define CONFIG_SCREEN 1
@@ -179,12 +186,16 @@ static char *device_names[] = {
"screen",
};
-/*
static XtResource appResources[] = {
+#if 0
{"xf86config", "XF86Config", XtRString, sizeof(char*),
0, XtRString, "/etc/X11/XF86Config"},
+#endif
+ {"menuBitmap", "MenuBitmap", XtRString, sizeof(char*),
+ 0, XtRString, "menu10"},
};
+/*
static XrmOptionDescRec optionDescList[] = {
{"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"},
};
@@ -203,6 +214,8 @@ main(int argc, char *argv[])
XGCValues values;
XF86ConfLayoutPtr lay;
int i, startedx;
+ char *menuPixmapPath;
+ XrmValue from, to;
#ifdef USE_MODULES
xf86Verbose = 1;
@@ -215,8 +228,10 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-xf86config") == 0) {
- if (i + 1 < argc)
+ if (i + 1 < argc) {
XF86Config_path = argv[++i];
+ config_set = True;
+ }
} else if (strcmp(argv[i], "-modulepath") == 0) {
if (i + 1 < argc)
XF86Module_path = argv[++i];
@@ -256,10 +271,15 @@ main(int argc, char *argv[])
if (DPY == NULL)
DPY = XtDisplay(toplevel);
-/*
- XtGetApplicationResources(toplevel, (XtPointer)&XF86Config_path,
- appResources, XtNumber(appResources), NULL, 0);
-*/
+ if (strlen(menuPixmapPath)) {
+ XtGetApplicationResources(toplevel, (XtPointer)&menuPixmapPath,
+ appResources, XtNumber(appResources), NULL, 0);
+ from.size = strlen(menuPixmapPath);
+ from.addr = menuPixmapPath;
+ to.size = sizeof(Pixmap);
+ to.addr = (XtPointer)&(menuPixmap);
+ XtConvertAndStore(toplevel, XtRString, &from, XtRBitmap, &to);
+ }
XtAppAddActions(appcon, actions, XtNumber(actions));
@@ -297,18 +317,54 @@ main(int argc, char *argv[])
commands = XtCreateManagedWidget("commands", formWidgetClass,
pane, NULL, 0);
- mouse = XtCreateManagedWidget("mouse", commandWidgetClass,
- commands, NULL, 0);
- XtAddCallback(mouse, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE);
- keyboard = XtCreateManagedWidget("keyboard", commandWidgetClass,
- commands, NULL, 0);
- XtAddCallback(keyboard, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD);
- card = XtCreateManagedWidget("card", commandWidgetClass,
- commands, NULL, 0);
- XtAddCallback(card, XtNcallback, AddDeviceCallback, (XtPointer)CARD);
- monitor = XtCreateManagedWidget("monitor", commandWidgetClass,
- commands, NULL, 0);
- XtAddCallback(monitor, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR);
+
+ mouse = XtVaCreateManagedWidget("mouse", menuButtonWidgetClass,
+ commands, XtNmenuName, "mouseP", NULL, 0);
+ popup = XtCreatePopupShell("mouseP", simpleMenuWidgetClass,
+ mouse, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE);
+ mouseSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(mouseSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)MOUSE);
+
+ keyboard = XtVaCreateManagedWidget("keyboard", menuButtonWidgetClass,
+ commands, XtNmenuName, "keyboardP", NULL, 0);
+ popup = XtCreatePopupShell("keyboardP", simpleMenuWidgetClass,
+ keyboard, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD);
+ keyboardSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(keyboardSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)KEYBOARD);
+
+ card = XtVaCreateManagedWidget("card", menuButtonWidgetClass,
+ commands, XtNmenuName, "cardP", NULL, 0);
+ popup = XtCreatePopupShell("cardP", simpleMenuWidgetClass,
+ card, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)CARD);
+ cardSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(cardSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)CARD);
+
+ monitor = XtVaCreateManagedWidget("monitor", menuButtonWidgetClass,
+ commands, XtNmenuName, "monitorP", NULL, 0);
+ popup = XtCreatePopupShell("monitorP", simpleMenuWidgetClass,
+ monitor, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR);
+ monitorSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(monitorSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)MONITOR);
work = XtCreateManagedWidget("work", compositeWidgetClass,
pane, NULL, 0);
@@ -380,6 +436,10 @@ main(int argc, char *argv[])
StartConfig();
InitializeDevices();
+ UpdateMenuDeviceList(MOUSE);
+ UpdateMenuDeviceList(KEYBOARD);
+ UpdateMenuDeviceList(CARD);
+ UpdateMenuDeviceList(MONITOR);
XtSetSensitive(smemodeline, VideoModeInitialize());
ReadCardsDatabase();
@@ -389,6 +449,7 @@ main(int argc, char *argv[])
layoutp,
XtNlabel, lay->lay_identifier,
XtNmenuName, "options",
+ XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
if (layoutsme == NULL)
@@ -421,6 +482,22 @@ main(int argc, char *argv[])
LoaderInitializeOptions();
#endif
+ if (!config_set && startedx) {
+ XtFree(XF86Config_path);
+#ifdef XF86CONFIG
+# ifdef XF86CONFIGDIR
+ XF86Config_path = XtNewString(XF86CONFIGDIR "/" XF86CONFIG);
+# else
+ XF86Config_path = XtNewString("/etc/X11/" XF86CONFIG);
+# endif
+#else
+# ifdef XF86CONFIGDIR
+ XF86Config_path = XtNewString(XF86CONFIGDIR "/XF86Config-4");
+# else
+ XF86Config_path = XtNewString("/etc/X11/XF86Config-4");
+# endif
+#endif
+ }
XtAppMainLoop(appcon);
if (startedx)
endx();
@@ -789,6 +866,8 @@ AddDevice(int type, XtPointer config, int x, int y)
return (NULL);
}
+ UpdateMenuDeviceList(type);
+
return (computer.devices[computer.num_devices - 1]);
}
@@ -931,6 +1010,7 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
layoutp,
XtNlabel, name,
XtNmenuName, "options",
+ XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(layoutsme, XtNcallback,
SelectLayoutCallback, (XtPointer)l);
@@ -1033,6 +1113,7 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
layoutp,
XtNlabel, lay->lay_identifier,
XtNmenuName, "options",
+ XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
if (layoutsme == NULL)
@@ -1214,6 +1295,46 @@ AddDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
}
void
+SmeConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+
+ switch ((long)user_data) {
+ case MOUSE:
+ case KEYBOARD:
+ case CARD:
+ case MONITOR:
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == (long)user_data) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+
+ /* hack for newly added devices */
+ case -(MOUSE + 100):
+ case -(KEYBOARD + 100):
+ case -(CARD + 100):
+ case -(MONITOR + 100):
+ for (i = 0; i < computer.num_devices; i++)
+ if (-(computer.devices[i]->type + 100) == (long)user_data &&
+ computer.devices[i]->config == NULL) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+
+ default:
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->config == user_data) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+ }
+}
+
+void
ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
int i, j;
@@ -1277,6 +1398,8 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
SetTip((xf86cfgDevice*)computer.screens[j]);
} break;
}
+ /* Need to update because it may have been renamed */
+ UpdateMenuDeviceList(computer.devices[i]->type);
break;
}
}
@@ -1572,6 +1695,8 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
}
if (computer.devices[i]->refcount <= 0) {
+ int type = computer.devices[i]->type;
+
XtDestroyWidget(computer.devices[i]->widget);
XtFree((XtPointer)computer.devices[i]);
if (--computer.num_devices > i)
@@ -1579,6 +1704,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
(computer.num_devices - i) * sizeof(xf86cfgDevice*));
DrawCables();
+ UpdateMenuDeviceList(type);
}
break;
@@ -1586,6 +1712,127 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
}
}
+static void
+UpdateMenuDeviceList(int type)
+{
+ Widget sme = NULL, menu = NULL;
+ int i, count;
+ static char *mouseM = "mouseM", *keyboardM = "keyboardM",
+ *cardM = "cardM", *monitorM = "monitorM";
+
+ for (i = count = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == type)
+ ++count;
+
+ switch (type) {
+ case MOUSE:
+ sme = mouseSme;
+ menu = mouseMenu;
+ break;
+ case KEYBOARD:
+ sme = keyboardSme;
+ menu = keyboardMenu;
+ break;
+ case CARD:
+ sme = cardSme;
+ menu = cardMenu;
+ break;
+ case MONITOR:
+ sme = monitorSme;
+ menu = monitorMenu;
+ break;
+ }
+
+ if (menu)
+ for (i = ((CompositeWidget)menu)->composite.num_children - 1; i >= 0; i--)
+ XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]);
+
+ if (count < 2) {
+ XtVaSetValues(sme, XtNmenuName, NULL, XtNleftBitmap, None, NULL);
+ return;
+ }
+
+ switch (type) {
+ case MOUSE:
+ if (mouseMenu == NULL)
+ menu = mouseMenu =
+ XtCreatePopupShell(mouseM, simpleMenuWidgetClass,
+ XtParent(mouseSme), NULL, 0);
+ XtVaSetValues(mouseSme, XtNmenuName, mouseM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case KEYBOARD:
+ if (keyboardMenu == NULL)
+ menu = keyboardMenu =
+ XtCreatePopupShell(keyboardM, simpleMenuWidgetClass,
+ XtParent(keyboardSme), NULL, 0);
+ XtVaSetValues(keyboardSme, XtNmenuName, keyboardM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case CARD:
+ if (cardMenu == NULL)
+ menu = cardMenu =
+ XtCreatePopupShell(cardM, simpleMenuWidgetClass,
+ XtParent(cardSme), NULL, 0);
+ XtVaSetValues(cardSme, XtNmenuName, cardM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case MONITOR:
+ if (monitorMenu == NULL)
+ menu = monitorMenu =
+ XtCreatePopupShell(monitorM, simpleMenuWidgetClass,
+ XtParent(monitorSme), NULL, 0);
+ XtVaSetValues(monitorSme, XtNmenuName, monitorM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == type) {
+ char *label = NULL;
+
+ if (computer.devices[i]->config) {
+ switch (type) {
+ case MOUSE:
+ case KEYBOARD:
+ label = ((XF86ConfInputPtr)computer.devices[i]->config)
+ ->inp_identifier;
+ break;
+ case CARD:
+ label = ((XF86ConfDevicePtr)computer.devices[i]->config)
+ ->dev_identifier;
+ break;
+ case MONITOR:
+ label = ((XF86ConfMonitorPtr)computer.devices[i]->config)
+ ->mon_identifier;
+ break;
+ }
+ }
+ else {
+ switch (type) {
+ case MOUSE:
+ label = "newMouse";
+ break;
+ case KEYBOARD:
+ label = "newKeyboard";
+ break;
+ case CARD:
+ label = "newCard";
+ break;
+ case MONITOR:
+ label = "newMonitor";
+ break;
+ }
+ }
+
+ sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SmeConfigureDeviceCallback,
+ computer.devices[i]->config ?
+ computer.devices[i]->config :
+ (XtPointer) (-((long)type + 100)));
+ }
+}
+
/*ARGSUSED*/
void
SelectDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
index 1f5720a8e..7a65545bf 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.10 2000/12/11 18:47:46 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.14 2001/03/29 16:54:30 paulo Exp $
*/
#include "xf86config.h"
@@ -39,30 +39,47 @@
#include <X11/Xaw/SmeBSB.h>
/*
+ * Types
+ */
+typedef struct {
+ char *rules;
+ XkbRF_RulesPtr list;
+ XF86XkbDescInfo model;
+ XF86XkbDescInfo layout;
+ XF86XkbDescInfo variant;
+ XF86XkbDescInfo option;
+} XF86XkbRulesDescInfo;
+
+/*
* Prototypes
*/
+static void KeyboardRulesCallback(Widget, XtPointer, XtPointer);
static void KeyboardModelCallback(Widget, XtPointer, XtPointer);
static void KeyboardLayoutCallback(Widget, XtPointer, XtPointer);
+static void KeyboardVariantCallback(Widget, XtPointer, XtPointer);
+static void KeyboardOptionsCallback(Widget, XtPointer, XtPointer);
static void KeyboardApplyCallback(Widget, XtPointer, XtPointer);
static Bool KeyboardConfigCheck(void);
static void XkbUIEventHandler(Widget, XtPointer, XEvent*, Boolean*);
+static XF86XkbRulesDescInfo *GetXkbRulesDesc(char*);
+static void UpdateRulesPopups(void);
/*
* Initialization
*/
-static XF86XkbDescInfo xkb_model;
-static XF86XkbDescInfo xkb_layout;
-static XF86XkbDescInfo xkb_variant;
-static XF86XkbDescInfo xkb_option;
+static XF86XkbRulesDescInfo **xkb_desc, *xkb_rules;
+static int num_xkb_desc;
+static char *XkbRulesDir = "lib/X11/xkb/rules/";
#ifdef XFREE98_XKB
-static char *XkbRulesFile = "lib/X11/xkb/rules/xfree98";
+static char *XkbRulesFile = "xfree98";
#else
-static char *XkbRulesFile = "lib/X11/xkb/rules/xfree86";
+static char *XkbRulesFile = "xfree86";
#endif
static XF86ConfInputPtr current_input;
-static char *model, *layout;
-static Widget kbd, modelb, layoutb;
+static char *rules, *model, *layout, *variant, *options;
+static Widget kbd, rulesb, modelb, layoutb, variantb, optionsb,
+ modelp, layoutp, variantp, optionsp;
static XkbInfo **xkb_infos;
static int num_xkb_infos;
XkbInfo *xkb_info;
@@ -79,9 +96,20 @@ KeyboardConfig(XtPointer config)
XF86ConfInputPtr keyboard = (XF86ConfInputPtr)config;
XF86OptionPtr option;
Arg args[1];
- static char *XkbModel = "XkbModel", *XkbLayout = "XkbLayout";
+ static char *XkbRules = "XkbRules", *XkbModel = "XkbModel",
+ *XkbLayout = "XkbLayout", *XkbVariant = "XkbVariant",
+ *XkbOptions = "XkbOptions";
+ XF86XkbRulesDescInfo *info;
+ char *omodel, *olayout, *ovariant, *ooptions;
InitializeKeyboard();
+ rules = xkb_rules->rules;
+ if (xkb_info->config.rules_file == NULL)
+ xkb_info->config.rules_file = rules;
+
+ if (options)
+ XtFree(options);
+ options = NULL;
if (xkb_info->conf == NULL)
xkb_info->conf = keyboard;
@@ -148,19 +176,38 @@ KeyboardConfig(XtPointer config)
current_input = keyboard;
if (keyboard != NULL) {
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) != NULL) {
+ if (strcmp(rules, option->opt_val)) {
+ XF86XkbRulesDescInfo *info = GetXkbRulesDesc(option->opt_val);
+
+ if (info) {
+ rules = info->rules;
+ UpdateRulesPopups();
+ }
+ }
+ }
if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL)
xkb_info->defs.model = model = option->opt_val;
else
- xkb_info->defs.model = model = xkb_model.name[0];
+ xkb_info->defs.model = model = xkb_rules->model.name[0];
if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL)
xkb_info->defs.layout = layout = option->opt_val;
else
- xkb_info->defs.layout = layout = xkb_layout.name[0];
+ xkb_info->defs.layout = layout = xkb_rules->layout.name[0];
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) != NULL)
+ xkb_info->defs.variant = variant = option->opt_val;
+ else
+ xkb_info->defs.variant = variant = NULL;
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) != NULL)
+ xkb_info->defs.options = options = XtNewString(option->opt_val);
+ else
+ xkb_info->defs.options = options = NULL;
XtSetArg(args[0], XtNstring, keyboard->inp_identifier);
XtSetValues(ident_widget, args, 1);
- UpdateKeyboard(False);
+ (void)UpdateKeyboard(False);
}
else {
XF86ConfInputPtr input = XF86Config->conf_input_lst;
@@ -173,18 +220,26 @@ KeyboardConfig(XtPointer config)
input = (XF86ConfInputPtr)(input->list.next);
}
do {
- ++nkeyboards;
XmuSnprintf(keyboard_name, sizeof(keyboard_name),
"Keyboard%d", nkeyboards);
+ ++nkeyboards;
} while (xf86findInput(keyboard_name,
XF86Config->conf_input_lst));
- model = xkb_model.name[0];
- layout = xkb_layout.name[0];
+ model = xkb_rules->model.name[0];
+ layout = xkb_rules->layout.name[0];
+ variant = "";
+ options = XtNewString("");
XtSetArg(args[0], XtNstring, keyboard_name);
XtSetValues(ident_widget, args, 1);
}
+ info = xkb_rules;
+ omodel = model;
+ olayout = layout;
+ ovariant = variant;
+ ooptions = options ? XtNewString(options) : NULL;
+
xf86info.cur_list = KEYBOARD;
XtSetSensitive(back, xf86info.lists[KEYBOARD].cur_function > 0);
XtSetSensitive(next, xf86info.lists[KEYBOARD].cur_function <
@@ -198,10 +253,20 @@ KeyboardConfig(XtPointer config)
keyboard->list.next = NULL;
keyboard->inp_identifier = XtNewString(ident_string);
keyboard->inp_driver = XtNewString("keyboard");
- keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel),
- XtNewString(model));
+ keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules),
+ XtNewString(rules));
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbModel), XtNewString(model));
xf86addNewOption(keyboard->inp_option_lst,
XtNewString(XkbLayout), XtNewString(layout));
+ if (variant && *variant)
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbVariant), XtNewString(variant));
+ if (options && *options) {
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbOptions), options);
+ options = NULL;
+ }
keyboard->inp_comment = NULL;
}
else {
@@ -210,34 +275,41 @@ KeyboardConfig(XtPointer config)
XtSetArg(args[0], XtNlabel, &str);
XtGetValues(modelb, args, 1);
- for (i = 0; i < xkb_model.nelem; i++)
- if (strcmp(xkb_model.desc[i], str) == 0) {
- model = xkb_model.name[i];
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(xkb_rules->model.desc[i], str) == 0) {
+ model = xkb_rules->model.name[i];
break;
}
XtSetArg(args[0], XtNlabel, &str);
XtGetValues(layoutb, args, 1);
- for (i = 0; i < xkb_layout.nelem; i++)
- if (strcmp(xkb_layout.desc[i], str) == 0) {
- layout = xkb_layout.name[i];
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(xkb_rules->layout.desc[i], str) == 0) {
+ layout = xkb_rules->layout.name[i];
break;
}
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules))
+ != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(rules);
+ XtFree(option->opt_comment);
+ }
+ else
+ keyboard->inp_option_lst =
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbRules), XtNewString(rules));
+
if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel))
!= NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(model);
XtFree(option->opt_comment);
}
- else {
- if (keyboard->inp_option_lst == NULL)
- keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel),
- XtNewString(model));
- else
+ else
+ keyboard->inp_option_lst =
xf86addNewOption(keyboard->inp_option_lst,
XtNewString(XkbModel), XtNewString(model));
- }
XtFree(xkb_info->config.model);
xkb_info->config.model = XtNewString(model);
@@ -245,21 +317,66 @@ KeyboardConfig(XtPointer config)
!= NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(layout);
- XtFree(option->opt_comment);
}
else
- xf86addNewOption(keyboard->inp_option_lst,
- XtNewString(XkbLayout), XtNewString(layout));
+ keyboard->inp_option_lst =
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbLayout), XtNewString(layout));
XtFree(xkb_info->config.layout);
xkb_info->config.layout = XtNewString(layout);
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant))
+ != NULL) {
+ if (variant && *variant) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(variant);
+ }
+ else
+ xf86removeOption(&keyboard->inp_option_lst, XkbVariant);
+ }
+ else if (variant && *variant)
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbVariant), XtNewString(variant));
+ XtFree(xkb_info->config.variant);
+ xkb_info->config.variant = variant && *variant ?
+ XtNewString(variant) : NULL;
+
+ XtFree(xkb_info->config.options);
+ xkb_info->config.options = options && *options ?
+ XtNewString(options) : NULL;
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions))
+ != NULL) {
+ if (options && *options) {
+ XtFree(option->opt_val);
+ option->opt_val = options;
+ options = NULL;
+ }
+ else
+ xf86removeOption(&keyboard->inp_option_lst, XkbOptions);
+ }
+ else if (options && *options) {
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbOptions), options);
+ options = NULL;
+ }
}
if (strcasecmp(keyboard->inp_identifier, ident_string))
xf86renameInput(XF86Config, keyboard, ident_string);
xkb_info->conf = keyboard;
+ xkb_info->config.rules_file = rules;
+
return ((XtPointer)keyboard);
}
+ xkb_rules = info;
+ rules = info->rules;
+ model = omodel;
+ layout = olayout;
+ variant = ovariant;
+ XtFree(options);
+ options = ooptions;
+
return (NULL);
}
@@ -312,8 +429,7 @@ InitializeKeyboard(void)
{
int major, minor, op, event, error;
static int first = 1;
- XkbRF_RulesPtr list;
- int i, timeout = 5;
+ int timeout = 5;
XF86ConfInputPtr keyboard = XF86Config->conf_input_lst;
XF86OptionPtr option;
char name[PATH_MAX];
@@ -355,69 +471,9 @@ InitializeKeyboard(void)
bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec));
- if ((list = XkbRF_Create(0, 0)) == NULL ||
- !XkbRF_LoadDescriptionsByName(XkbRulesFile, NULL, list)) {
- fprintf(stderr, "Can't create rules structure\n");
- exit(1);
- }
-
- for (i = 0; i < list->models.num_desc; i++) {
- if (i % 16 == 0) {
- xkb_model.name = (char**)XtRealloc((XtPointer)xkb_model.name,
- (i + 16) * sizeof(char*));
- xkb_model.desc = (char**)XtRealloc((XtPointer)xkb_model.desc,
- (i + 16) * sizeof(char*));
- }
- xkb_model.name[i] = XtNewString(list->models.desc[i].name);
- xkb_model.desc[i] = XtNewString(list->models.desc[i].desc);
- }
- xkb_model.nelem = i;
-
- for (i = 0; i < list->layouts.num_desc; i++) {
- if (i % 16 == 0) {
- xkb_layout.name = (char**)XtRealloc((XtPointer)xkb_layout.name,
- (i + 16) * sizeof(char*));
- xkb_layout.desc = (char**)XtRealloc((XtPointer)xkb_layout.desc,
- (i + 16) * sizeof(char*));
- }
- xkb_layout.name[i] = XtNewString(list->layouts.desc[i].name);
- xkb_layout.desc[i] = XtNewString(list->layouts.desc[i].desc);
- }
- xkb_layout.nelem = i;
-
- for (i = 0; i < list->variants.num_desc; i++) {
- if (i % 16 == 0) {
- xkb_variant.name = (char**)XtRealloc((XtPointer)xkb_variant.name,
- (i + 16) * sizeof(char*));
- xkb_variant.desc = (char**)XtRealloc((XtPointer)xkb_variant.desc,
- (i + 16) * sizeof(char*));
- }
- xkb_variant.name[i] = XtNewString(list->variants.desc[i].name);
- xkb_variant.desc[i] = XtNewString(list->variants.desc[i].desc);
- }
- xkb_variant.nelem = i;
-
- for (i = 0; i < list->options.num_desc; i++) {
- if (i % 16 == 0) {
- xkb_option.name = (char**)XtRealloc((XtPointer)xkb_option.name,
- (i + 16) * sizeof(char*));
- xkb_option.desc = (char**)XtRealloc((XtPointer)xkb_option.desc,
- (i + 16) * sizeof(char*));
- }
- xkb_option.name[i] = XtNewString(list->options.desc[i].name);
- xkb_option.desc[i] = XtNewString(list->options.desc[i].desc);
- }
- xkb_option.nelem = i;
-
- XkbRF_Free(list, True);
-
/* Load configuration */
XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile);
file = fopen(name, "r");
-/* if ((file = fopen(name, "r")) == NULL) {
- strcpy(name, XkbConfigFile);
- file = fopen(name, "r");
- }*/
if (file != NULL) {
if (XkbCFParse(file, XkbCFDflts, xkb_info->xkb, &xkb_info->config) == 0) {
fprintf(stderr, "Error parsing config file: ");
@@ -427,6 +483,12 @@ InitializeKeyboard(void)
fclose(file);
}
+ xkb_rules = GetXkbRulesDesc(xkb_info->config.rules_file != NULL ?
+ xkb_info->config.rules_file : XkbRulesFile);
+ if (xkb_rules == NULL)
+ /* error message was printed */
+ exit(1);
+
/* XXX Assumes the first keyboard is the core keyboard */
while (keyboard != NULL) {
if (strcasecmp(keyboard->inp_driver, "keyboard") == 0)
@@ -436,13 +498,49 @@ InitializeKeyboard(void)
if (keyboard == NULL)
return;
+ if (xkb_info->config.rules_file != NULL)
+ rules = xkb_info->config.rules_file;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbRules"))
+ != NULL)
+ rules = option->opt_val;
+ else
+ rules = XkbRulesFile;
+
+ if (strcmp(rules, xkb_rules->rules)) {
+ xkb_rules = GetXkbRulesDesc(rules);
+ if (xkb_rules == NULL)
+ /* error message was printed */
+ exit(1);
+ }
+ {
+ FILE *fp;
+ char filename[1024];
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, xkb_rules->rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ exit(1);
+ }
+
+ if (!XkbRF_LoadRules(fp, xkb_rules->list)) {
+ fclose(fp);
+ fprintf(stderr, "Can't load rules\n");
+ exit(1);
+ }
+ fclose(fp);
+ }
+
+ if (xkb_info->config.rules_file == NULL)
+ xkb_info->config.rules_file = xkb_rules->rules;
+
if (xkb_info->config.model != NULL)
xkb_info->defs.model = xkb_info->config.model;
else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel"))
!= NULL)
xkb_info->defs.model = option->opt_val;
else
- xkb_info->defs.model = xkb_model.name[0];
+ xkb_info->defs.model = xkb_rules->model.name[0];
if (xkb_info->config.layout != NULL)
xkb_info->defs.layout = xkb_info->config.layout;
@@ -450,7 +548,103 @@ InitializeKeyboard(void)
!= NULL)
xkb_info->defs.layout = option->opt_val;
else
- xkb_info->defs.layout = xkb_layout.name[0];
+ xkb_info->defs.layout = xkb_rules->layout.name[0];
+
+ if (xkb_info->config.variant != NULL)
+ xkb_info->defs.variant = xkb_info->config.variant;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbVariant"))
+ != NULL)
+ xkb_info->defs.variant = option->opt_val;
+ else
+ xkb_info->defs.variant = NULL;
+
+ if (xkb_info->config.options != NULL)
+ xkb_info->defs.options = xkb_info->config.options;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbOptions"))
+ != NULL)
+ xkb_info->defs.options = option->opt_val;
+ else
+ xkb_info->defs.options = NULL;
+}
+
+static XF86XkbRulesDescInfo *
+GetXkbRulesDesc(char *rules)
+{
+ int i;
+ XkbRF_RulesPtr list;
+ char filename[1024];
+ XF86XkbRulesDescInfo *info;
+
+ if (rules == NULL)
+ return (NULL);
+
+ for (i = 0; i < num_xkb_desc; i++)
+ if (strcmp(rules, xkb_desc[i]->rules) == 0)
+ return (xkb_desc[i]);
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s", XkbRulesDir, rules);
+ if ((list = XkbRF_Create(0, 0)) == NULL ||
+ !XkbRF_LoadDescriptionsByName(filename, NULL, list)) {
+ fprintf(stderr, "Can't create rules structure\n");
+ return (NULL);
+ }
+
+ info = (XF86XkbRulesDescInfo*)XtCalloc(1, sizeof(XF86XkbRulesDescInfo));
+ xkb_desc = (XF86XkbRulesDescInfo**)
+ XtRealloc((XtPointer)xkb_desc,
+ sizeof(XF86XkbRulesDescInfo*) * (num_xkb_desc + 1));
+ xkb_desc[num_xkb_desc++] = info;
+ info->rules = XtNewString(rules);
+ for (i = 0; i < list->models.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->model.name = (char**)XtRealloc((XtPointer)info->model.name,
+ (i + 16) * sizeof(char*));
+ info->model.desc = (char**)XtRealloc((XtPointer)info->model.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->model.name[i] = XtNewString(list->models.desc[i].name);
+ info->model.desc[i] = XtNewString(list->models.desc[i].desc);
+ }
+ info->model.nelem = i;
+
+ for (i = 0; i < list->layouts.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->layout.name = (char**)XtRealloc((XtPointer)info->layout.name,
+ (i + 16) * sizeof(char*));
+ info->layout.desc = (char**)XtRealloc((XtPointer)info->layout.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->layout.name[i] = XtNewString(list->layouts.desc[i].name);
+ info->layout.desc[i] = XtNewString(list->layouts.desc[i].desc);
+ }
+ info->layout.nelem = i;
+
+ for (i = 0; i < list->variants.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->variant.name = (char**)XtRealloc((XtPointer)info->variant.name,
+ (i + 16) * sizeof(char*));
+ info->variant.desc = (char**)XtRealloc((XtPointer)info->variant.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->variant.name[i] = XtNewString(list->variants.desc[i].name);
+ info->variant.desc[i] = XtNewString(list->variants.desc[i].desc);
+ }
+ info->variant.nelem = i;
+
+ for (i = 0; i < list->options.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->option.name = (char**)XtRealloc((XtPointer)info->option.name,
+ (i + 16) * sizeof(char*));
+ info->option.desc = (char**)XtRealloc((XtPointer)info->option.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->option.name[i] = XtNewString(list->options.desc[i].name);
+ info->option.desc[i] = XtNewString(list->options.desc[i].desc);
+ }
+ info->option.nelem = i;
+ info->list = list;
+
+ return (info);
}
static xf86ConfigSymTabRec ax_controls[] =
@@ -499,7 +693,7 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf)
return (False);
if (conf->rules_file != NULL)
- fprintf(fp, "Rules = %s\n",
+ fprintf(fp, "Rules = \"%s\"\n",
conf->rules_file);
if (conf->model != NULL)
fprintf(fp, "Model = \"%s\"\n",
@@ -508,10 +702,10 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf)
fprintf(fp, "Layout = \"%s\"\n",
conf->layout);
if (conf->variant != NULL)
- fprintf(fp, "Variant = %s\n",
+ fprintf(fp, "Variant = \"%s\"\n",
conf->variant);
if (conf->options != NULL)
- fprintf(fp, "Options = %s\n",
+ fprintf(fp, "Options = \"%s\"\n",
conf->options);
if (conf->keymap != NULL)
fprintf(fp, "Keymap = %s\n",
@@ -645,45 +839,21 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf)
return (True);
}
-void
+Bool
UpdateKeyboard(Bool load)
{
- static XkbRF_RulesPtr rules;
XkbComponentNamesRec comps;
XkbDescPtr xkb;
- if (rules == NULL) {
- FILE *fp;
-
- if ((fp = fopen(XkbRulesFile, "r")) == NULL) {
- fprintf(stderr, "Can't open rules file\n");
- exit(1);
- }
-
- if ((rules = XkbRF_Create(0, 0)) == NULL) {
- fclose(fp);
- fprintf(stderr, "Can't create rules structure\n");
- exit(1);
- }
-
- if (!XkbRF_LoadRules(fp, rules)) {
- fclose(fp);
- XkbRF_Free(rules, True);
- fprintf(stderr, "Can't load rules\n");
- exit(1);
- }
- fclose(fp);
- }
-
bzero((char*)&comps, sizeof(XkbComponentNamesRec));
- XkbRF_GetComponents(rules, &(xkb_info->defs), &comps);
+ XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps);
xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps,
XkbGBN_AllComponentsMask, 0, load);
if (xkb == NULL || xkb->geom == NULL) {
fprintf(stderr, "Couldn't get keyboard\n");
- exit(1);
+ return (False);
}
if (xkb->names->geometry == 0)
xkb->names->geometry = xkb->geom->name;
@@ -701,6 +871,150 @@ UpdateKeyboard(Bool load)
if (kbd != NULL)
XClearArea(XtDisplay(configp), XtWindow(kbd), 0, 0, 0, 0, True);
+
+ return (True);
+}
+
+static void
+KeyboardRulesCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+ FILE *fp;
+ Arg args[1];
+ char filename[1024], *omodel, *olayout, *ovariant, *ooptions,
+ *dmodel, *dlayout, *dvariant;
+ XF86XkbRulesDescInfo *oxkb_rules, *info = GetXkbRulesDesc(XtName(w));
+
+ if (strcmp(XtName(w), rules) == 0 || info == NULL)
+ /* a error message was printed */
+ return;
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, info->rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ return;
+ }
+
+ if (!XkbRF_LoadRules(fp, info->list)) {
+ fclose(fp);
+ fprintf(stderr, "Can't load rules\n");
+ return;
+ }
+ fclose(fp);
+
+ oxkb_rules = xkb_rules;
+ omodel = xkb_info->defs.model;
+ olayout = xkb_info->defs.layout;
+ ovariant = xkb_info->defs.variant;
+ ooptions = xkb_info->defs.options;
+
+ if (omodel) {
+ for (i = 0; i < info->model.nelem; i++) {
+ if (strcmp(omodel, info->model.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = 0;
+ model = xkb_info->defs.model = info->model.name
+ [i < info->model.nelem ? i : 0];
+ dmodel = info->model.desc[i < info->model.nelem ? i : 0];
+
+ if (olayout) {
+ for (i = 0; i < info->layout.nelem; i++) {
+ if (strcmp(olayout, info->layout.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = 0;
+ layout = xkb_info->defs.layout = info->layout.name
+ [i < info->layout.nelem ? i : 0];
+ dlayout = info->layout.desc[i < info->layout.nelem ? i : 0];
+
+ if (ovariant) {
+ for (i = 0; i < info->variant.nelem; i++) {
+ if (strcmp(ovariant, info->variant.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = info->variant.nelem;
+ variant = xkb_info->defs.variant = i < info->variant.nelem ?
+ info->variant.name[i] : NULL;
+ dvariant = i < info->variant.nelem ?
+ info->variant.desc[i] : NULL;
+
+ if (ooptions) {
+ char *ptr, *tmp = XtNewString(options);
+
+ for (ptr = strtok(tmp, ","); ptr != NULL; ptr = strtok(NULL, ",")) {
+ if (strchr(ptr, ':') == NULL)
+ continue;
+
+ for (i = 0; i < xkb_rules->option.nelem; i++)
+ if (strcmp(xkb_rules->option.name[i], ptr) == 0)
+ break;
+
+ if (i == xkb_rules->option.nelem) {
+ XtFree(options);
+ options = NULL;
+ /* no option with the same name */
+ break;
+ }
+ }
+ XtFree(tmp);
+ }
+ else {
+ XtFree(options);
+ options = NULL;
+ }
+
+ oxkb_rules = xkb_rules;
+ xkb_rules = info;
+ rules = info->rules;
+
+ if (!UpdateKeyboard(False)) {
+ model = xkb_info->defs.model = omodel;
+ layout = xkb_info->defs.layout = olayout;
+ variant = xkb_info->defs.variant = ovariant;
+ options = xkb_info->defs.options = ooptions;
+ xkb_rules = oxkb_rules;
+ rules = xkb_rules->rules;
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ return;
+ }
+
+ if (!XkbRF_LoadRules(fp, xkb_rules->list)) {
+ fclose(fp);
+ fprintf(stderr, "Can't load rules\n");
+ }
+ fclose(fp);
+
+ return;
+ }
+
+ UpdateRulesPopups();
+
+ XtSetArg(args[0], XtNlabel, rules);
+ XtSetValues(rulesb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dmodel);
+ XtSetValues(modelb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dlayout);
+ XtSetValues(layoutb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dvariant ? dvariant : "");
+ XtSetValues(variantb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, options ? options : "");
+ XtSetValues(variantb, args, 1);
}
static void
@@ -708,14 +1022,18 @@ KeyboardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Arg args[1];
int i;
+ char *oldval = xkb_info->defs.model;
- for (i = 0; i < xkb_model.nelem; i++)
- if (strcmp(XtName(w), xkb_model.name[i]) == 0)
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->model.name[i]) == 0)
break;
- XtSetArg(args[0], XtNlabel, xkb_model.desc[i]);
- XtSetValues(modelb, args, 1);
- model = xkb_info->defs.model = xkb_model.name[i];
- UpdateKeyboard(False);
+ model = xkb_info->defs.model = xkb_rules->model.name[i];
+ if (!UpdateKeyboard(False))
+ model = xkb_info->defs.model = oldval;
+ else {
+ XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]);
+ XtSetValues(modelb, args, 1);
+ }
}
static void
@@ -723,20 +1041,209 @@ KeyboardLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Arg args[1];
int i;
+ char *oldval = xkb_info->defs.layout;
- for (i = 0; i < xkb_layout.nelem; i++)
- if (strcmp(XtName(w), xkb_layout.name[i]) == 0)
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->layout.name[i]) == 0)
break;
- XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]);
- XtSetValues(layoutb, args, 1);
- layout = xkb_info->defs.layout = xkb_layout.name[i];
+ layout = xkb_info->defs.layout = xkb_rules->layout.name[i];
+ if (!UpdateKeyboard(False))
+ layout = xkb_info->defs.layout = oldval;
+ else {
+ XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]);
+ XtSetValues(layoutb, args, 1);
+ }
+}
+
+static void
+KeyboardVariantCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+ char *label, *oldval = xkb_info->defs.variant;
+
+ for (i = 0; i < xkb_rules->variant.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->variant.name[i]) == 0)
+ break;
+ variant = i < xkb_rules->variant.nelem ? xkb_rules->variant.name[i] : "";
+ xkb_info->defs.variant = variant && *variant ? variant : NULL;
+
+ if (!UpdateKeyboard(False))
+ xkb_info->defs.variant = variant = oldval;
+ else {
+ label = i < xkb_rules->variant.nelem ? xkb_rules->variant.desc[i] : "";
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(variantb, args, 1);
+ }
+}
+
+static void
+KeyboardOptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+ char *oldval = xkb_info->defs.options ?
+ XtNewString(xkb_info->defs.options) : XtNewString("");
+
+ for (i = 0; i < xkb_rules->option.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0)
+ break;
+
+ if (i < xkb_rules->option.nelem) {
+ char *delim, *ptr, str[256];
+
+ /* remove old string, don't check if the same */
+ if ((delim = strchr(XtName(w), ':')) != NULL) {
+ if (delim - XtName(w) >= sizeof(str) - 2)
+ return;
+ strncpy(str, XtName(w), delim - XtName(w) + 1);
+ str[delim - XtName(w) + 1] = '\0';
+ }
+ else
+ XmuSnprintf(str, sizeof(str), "%s:", XtName(w));
+ if (options && (delim = strstr(options, str)) != NULL) {
+ if ((ptr = strchr(delim, ',')) != NULL) {
+ *delim = *ptr = '\0';
+ XmuSnprintf(str, sizeof(str), "%s%s", options, ptr + 1);
+ XtFree(options);
+ options = XtNewString(str);
+ }
+ else {
+ if (delim > options)
+ delim[-1] = '\0';
+ else
+ delim[0] = '\0';
+ }
+ }
+
+ /* update string, if required */
+ if ((delim = strchr(XtName(w), ':')) != NULL) {
+ if (options && *options)
+ XmuSnprintf(str, sizeof(str), "%s,%s", options, XtName(w));
+ else
+ XmuSnprintf(str, sizeof(str), "%s", XtName(w));
+ XtFree(options);
+ options = XtNewString(str);
+ }
+ }
+ else {
+ XtFree(options);
+ options = XtNewString("");
+ }
+
+ if (options == NULL)
+ options = XtNewString("");
+
+ xkb_info->defs.options = *options ? options : NULL;
+ if (!UpdateKeyboard(False)) {
+ XtFree(options);
+ xkb_info->defs.options = *oldval ? oldval : NULL;
+ }
+ else {
+ XtFree(oldval);
+ XtSetArg(args[0], XtNlabel, options);
+ XtSetValues(optionsb, args, 1);
+ XtSetArg(args[0], XtNtip, options);
+ XtSetValues(optionsb, args, 1);
+ }
}
/*ARGSUSED*/
static void
KeyboardApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- UpdateKeyboard(True);
+ (void)UpdateKeyboard(True);
+}
+
+static void
+UpdateRulesPopups(void)
+{
+ int i;
+ char *optname;
+ Widget sme, optpopup, optparent;
+
+ /* MODEL */
+ if (modelp)
+ XtDestroyWidget(modelp);
+ modelp = XtCreatePopupShell("modelP", simpleMenuWidgetClass,
+ modelb, NULL, 0);
+ for (i = 0; i < xkb_rules->model.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->model.name[i], smeBSBObjectClass,
+ modelp,
+ XtNlabel, xkb_rules->model.desc[i],
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL);
+ }
+
+ /* LAYOUT */
+ if (layoutp)
+ XtDestroyWidget(layoutp);
+ layoutp = XtCreatePopupShell("layoutP", simpleMenuWidgetClass,
+ layoutb, NULL, 0);
+ for (i = 0; i < xkb_rules->layout.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->layout.name[i], smeBSBObjectClass,
+ layoutp,
+ XtNlabel, xkb_rules->layout.desc[i],
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL);
+ }
+
+ /* VARIANT */
+ if (variantp)
+ XtDestroyWidget(variantp);
+ variantp = XtCreatePopupShell("variantP", simpleMenuWidgetClass,
+ variantb, NULL, 0);
+ sme = XtVaCreateManagedWidget("None", smeBSBObjectClass,
+ variantp,
+ XtNlabel, "None",
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL);
+ for (i = 0; i < xkb_rules->variant.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->variant.name[i], smeBSBObjectClass,
+ variantp,
+ XtNlabel, xkb_rules->variant.desc[i],
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL);
+ }
+
+ /* OPTIONS */
+ if (optionsp)
+ XtDestroyWidget(optionsp);
+ optionsp = XtCreatePopupShell("optionsP", simpleMenuWidgetClass,
+ optionsb, NULL, 0);
+ sme = XtVaCreateManagedWidget("None", smeBSBObjectClass,
+ optionsp,
+ XtNlabel, "None",
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ optparent = optionsp;
+ optname = NULL;
+ for (i = 0; i < xkb_rules->option.nelem; i++) {
+ if (!strchr(xkb_rules->option.name[i], ':')) {
+ optpopup =
+ XtCreatePopupShell(optname = xkb_rules->option.desc[i],
+ simpleMenuWidgetClass,
+ optparent = optionsp, NULL, 0);
+ sme = XtVaCreateManagedWidget(xkb_rules->option.name[i],
+ smeBSBObjectClass,
+ optpopup,
+ XtNlabel, "None",
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ }
+ else {
+ optparent = optpopup;
+ optname = NULL;
+ }
+ sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], smeBSBObjectClass,
+ optparent,
+ XtNlabel, xkb_rules->option.desc[i],
+ XtNmenuName, optname,
+ XtNleftBitmap, optname ? menuPixmap : None,
+ NULL, 0);
+ if (optparent != optionsp)
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ }
}
void
@@ -748,45 +1255,69 @@ KeyboardModelAndLayout(XF86SetupInfo *info)
int i;
if (first) {
- Widget label, popup, sme;
+ Widget popup, sme;
first = 0;
kbdml = XtCreateWidget("keyboardML", formWidgetClass,
configp, NULL, 0);
+ /* RULES */
+ XtCreateManagedWidget("labelR", labelWidgetClass, kbdml, NULL, 0);
+ rulesb = XtVaCreateManagedWidget("rules", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "rulesP",
+ NULL, 0);
+ popup = XtCreatePopupShell("rulesP", simpleMenuWidgetClass,
+ rulesb, NULL, 0);
+ {
+ struct dirent *ent;
+ DIR *dir;
+
+ if ((dir = opendir(XkbRulesDir)) != NULL) {
+ (void)readdir(dir);
+ (void)readdir(dir);
+ while ((ent = readdir(dir)) != NULL) {
+ if (strchr(ent->d_name, '.'))
+ continue;
+
+ sme = XtVaCreateManagedWidget(ent->d_name, smeBSBObjectClass,
+ popup,
+ XtNlabel, ent->d_name,
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, KeyboardRulesCallback, NULL);
+ }
+ closedir(dir);
+ }
+ }
+
/* MODEL */
- label = XtCreateManagedWidget("labelM", labelWidgetClass,
- kbdml, NULL, 0);
+ XtCreateManagedWidget("labelM", labelWidgetClass, kbdml, NULL, 0);
modelb = XtVaCreateManagedWidget("model", menuButtonWidgetClass, kbdml,
XtNmenuName, "modelP",
NULL, 0);
- popup = XtCreatePopupShell("modelP", simpleMenuWidgetClass,
- modelb, NULL, 0);
- for (i = 0; i < xkb_model.nelem; i++) {
- sme = XtVaCreateManagedWidget(xkb_model.name[i], smeBSBObjectClass,
- popup,
- XtNlabel, xkb_model.desc[i],
- NULL, 0);
- XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL);
- }
/* LAYOUT */
- label = XtCreateManagedWidget("labelL", labelWidgetClass,
- kbdml, NULL, 0);
+ XtCreateManagedWidget("labelL", labelWidgetClass, kbdml, NULL, 0);
layoutb = XtVaCreateManagedWidget("layout", menuButtonWidgetClass, kbdml,
XtNmenuName, "layoutP",
- XtNlabel, xkb_layout.desc[0],
+ XtNlabel, xkb_rules->layout.desc[0],
NULL, 0);
- popup = XtCreatePopupShell("layoutP", simpleMenuWidgetClass,
- layoutb, NULL, 0);
- for (i = 0; i < xkb_layout.nelem; i++) {
- sme = XtVaCreateManagedWidget(xkb_layout.name[i], smeBSBObjectClass,
- popup,
- XtNlabel, xkb_layout.desc[i],
+
+ /* VARIANT */
+ XtCreateManagedWidget("labelV", labelWidgetClass, kbdml, NULL, 0);
+ variantb = XtVaCreateManagedWidget("variant", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "variantP",
+ XtNlabel, "",
NULL, 0);
- XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL);
- }
+
+ /* OPTIONS */
+ XtCreateManagedWidget("labelO", labelWidgetClass, kbdml, NULL, 0);
+ optionsb = XtVaCreateManagedWidget("options", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "optionsP",
+ XtNlabel, "",
+ NULL, 0);
+
+ UpdateRulesPopups();
kbd = XtCreateManagedWidget("keyboard", coreWidgetClass,
kbdml, NULL, 0);
@@ -802,20 +1333,36 @@ KeyboardModelAndLayout(XF86SetupInfo *info)
XClearArea(XtDisplay(kbd), XtWindow(kbd), 0, 0, 0, 0, True);
}
- for (i = 0; i < xkb_model.nelem; i++)
- if (strcmp(model, xkb_model.name[i]) == 0) {
- XtSetArg(args[0], XtNlabel, xkb_model.desc[i]);
+ XtSetArg(args[0], XtNlabel, xkb_rules->rules);
+ XtSetValues(rulesb, args, 1);
+
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(model, xkb_rules->model.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]);
XtSetValues(modelb, args, 1);
break;
}
- for (i = 0; i < xkb_layout.nelem; i++)
- if (strcmp(layout, xkb_layout.name[i]) == 0) {
- XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]);
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(layout, xkb_rules->layout.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]);
XtSetValues(layoutb, args, 1);
break;
}
+ if (variant)
+ for (i = 0; i < xkb_rules->variant.nelem; i++)
+ if (strcmp(variant, xkb_rules->variant.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->variant.desc[i]);
+ XtSetValues(variantb, args, 1);
+ break;
+ }
+
+ if (options) {
+ XtSetArg(args[0], XtNlabel, options);
+ XtSetValues(optionsb, args, 1);
+ }
+
XtChangeManagedSet(&current, 1, NULL, NULL, &kbdml, 1);
current = kbdml;
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h
index b8f461c78..6ff63c002 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.2 2000/06/13 23:15:51 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.3 2001/03/02 22:39:27 paulo Exp $
*/
#include "config.h"
@@ -63,7 +63,7 @@ typedef struct {
XtPointer KeyboardConfig(XtPointer);
void KeyboardModelAndLayout(XF86SetupInfo*);
void InitializeKeyboard(void);
-void UpdateKeyboard(Bool);
+Bool UpdateKeyboard(Bool);
Bool WriteXKBConfiguration(char*, XkbConfigRtrnPtr);
/*
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
index 7ab3e7f82..430833381 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.5 2001/01/31 20:52:19 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.7 2001/03/24 01:17:20 paulo Exp $
*/
#include "xf86config.h"
@@ -166,9 +166,9 @@ MonitorConfig(XtPointer conf)
monitor = (XF86ConfMonitorPtr)(monitor->list.next);
}
do {
- ++nmonitors;
XmuSnprintf(monitor_name, sizeof(monitor_name),
"Monitor%d", nmonitors);
+ ++nmonitors;
} while (xf86findMonitor(monitor_name,
XF86Config->conf_monitor_lst));
@@ -266,6 +266,10 @@ string_to_parser_range(char *str, parser_range *range, int nrange)
while (*str) {
while (*str && isspace(*str))
++str;
+ if (!isdigit(*str)) {
+ ++str;
+ continue;
+ }
val = strtod(str, &str);
while (*str && isspace(*str))
++str;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
index e3949d60e..d7d2f3c61 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.5 2000/10/20 14:59:06 alanh Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.6 2001/03/24 01:17:21 paulo Exp $
*/
#include "xf86config.h"
@@ -115,8 +115,8 @@ MouseConfig(XtPointer config)
input = (XF86ConfInputPtr)(input->list.next);
}
do {
- ++nmouses;
XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses);
+ ++nmouses;
} while (xf86findInput(mouse_name,
XF86Config->conf_input_lst));
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
index 9914ad7a9..e683bff12 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.6 2000/12/08 21:51:06 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.7 2001/04/01 14:00:15 tsi Exp $
*/
#include "xf86config.h"
@@ -367,7 +367,7 @@ static void
MoveCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
char *tmp;
- Bool down = (Bool)user_data;
+ Bool down = (long)user_data;
if (unsel_index < 0 || unsel_index >= ndefmodes)
return;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
index a1bbf8c8f..227701269 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.5 2000/12/01 18:31:07 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.6 2001/03/24 01:17:21 paulo Exp $
*/
#include <X11/IntrinsicP.h>
@@ -194,9 +194,9 @@ AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
screen = (XF86ConfScreenPtr)(screen->list.next);
}
do {
- ++nscreens;
XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d",
nscreens);
+ ++nscreens;
} while (xf86findScreen(screen_name,
XF86Config->conf_screen_lst) != NULL);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
index f710c5940..d387af8e8 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.8 2001/02/15 17:28:35 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.9 2001/03/01 20:37:25 paulo Exp $
*/
#include <stdio.h>
@@ -798,6 +798,7 @@ MonitorConfig(void)
int nlist, def;
char hsync_str[256], vrefresh_str[256];
+ hsync_str[0] = vrefresh_str[0] = '\0';
nlist = 0;
while (monitor) {
list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
@@ -929,7 +930,7 @@ MonitorConfig(void)
}
}
}
- else
+ if (hsync_str[0] == '\0')
strcpy(hsync_str, "31.5");
ClearScreen();
@@ -987,7 +988,7 @@ MonitorConfig(void)
}
}
}
- else
+ if (vrefresh_str[0] == '\0')
strcpy(vrefresh_str, "50 - 70");
ClearScreen();
refresh();
@@ -1678,7 +1679,7 @@ CopyAdjacency(XF86ConfAdjacencyPtr ptr)
adj->adj_scrnum = ptr->adj_scrnum;
adj->adj_screen = ptr->adj_screen;
- adj->adj_screen_str = XtNewString(adj->adj_screen_str);
+ adj->adj_screen_str = XtNewString(ptr->adj_screen_str);
adj->adj_top = ptr->adj_top;
if (ptr->adj_top_str)
adj->adj_top_str = XtNewString(ptr->adj_top_str);
@@ -2152,7 +2153,7 @@ LayoutConfig(void)
ClearScreen();
refresh();
Dialog("Layout configuration",
- (nmouses > 1 && nkeyboards > 1) ?
+ (nmouses > 1 || nkeyboards > 1) ?
"As you have only one screen configured, I can now finish "
"creating this Layout configuration."
:
@@ -3308,7 +3309,7 @@ DialogInput(char *title, char *prompt, int height, int width, char *init,
case '\r':
case '\n':
delwin(dialog);
- return (button == -1 ? XtNewString(instr) : NULL);
+ return (button != 1 ? XtNewString(instr) : NULL);
}
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
index 08fd8285e..b2b0b871c 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
@@ -26,7 +26,7 @@
*
* Author: Paulo Csar Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.4 2000/11/30 20:55:18 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.5 2001/03/27 20:25:30 paulo Exp $
*/
#include "xf86config.h"
@@ -247,6 +247,8 @@ xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
scrn = (XF86ConfScreenPtr)(scrn->list.next);
}
+ if (scrn == NULL)
+ return (False);
while (lay != NULL) {
XF86ConfAdjacencyPtr pad, ad = NULL, adj = lay->lay_adjacency_lst;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Cards b/xc/programs/Xserver/hw/xfree86/xf86config/Cards
index 512250bbb..9c4575347 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86config/Cards
+++ b/xc/programs/Xserver/hw/xfree86/xf86config/Cards
@@ -18,7 +18,7 @@
# The majority of entries are just a binding of a model name to a
# chipset/server and untested.
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.75 2000/12/12 17:01:40 dawes Exp $
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.76 2001/04/01 14:00:16 tsi Exp $
# VGA
@@ -1645,7 +1645,7 @@ SEE ET6000 (generic)
NAME ATI Rage 128
CHIPSET ati
SERVER SVGA
-DRIVER r128
+DRIVER ati
NAME ATI 8514 Ultra (no VGA)
CHIPSET ati